• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2016 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef ANDROID_AUDIO_MMAP_STREAM_CALLBACK_H
18 #define ANDROID_AUDIO_MMAP_STREAM_CALLBACK_H
19 
20 #include <system/audio.h>
21 #include <utils/Errors.h>
22 #include <utils/RefBase.h>
23 
24 namespace android {
25 
26 
27 class MmapStreamCallback : public virtual RefBase {
28   public:
29 
30     /**
31      * The mmap stream should be torn down because conditions that permitted its creation with
32      * the requested parameters have changed and do not allow it to operate with the requested
33      * constraints any more.
34      */
35     virtual void onTearDown() = 0;
36 
37     /**
38      * The volume to be applied to the use case specified when opening the stream has changed
39      * \param[in] channels a channel mask containing all channels the volume should be applied to.
40      * \param[in] values the volume values to be applied to each channel. The size of the vector
41      *                   should correspond to the channel count retrieved with
42      *                   audio_channel_count_from_in_mask() or audio_channel_count_from_out_mask()
43      */
44     virtual void onVolumeChanged(audio_channel_mask_t channels, Vector<float> values) = 0;
45 
46     /**
47      * The device the stream is routed to/from has changed
48      * \param[in] onRoutingChanged the unique device ID of the new device.
49      */
50     virtual void onRoutingChanged(audio_port_handle_t deviceId) = 0;
51 
52   protected:
MmapStreamCallback()53     MmapStreamCallback() {}
~MmapStreamCallback()54     virtual ~MmapStreamCallback() {}
55 };
56 
57 
58 } // namespace android
59 
60 #endif // ANDROID_AUDIO_MMAP_STREAM_CALLBACK_H
61