blob: 31b8eb54c44b80188b8df9a530cb5cbf654a6e13 [file] [log] [blame]
Eric Laurentfc235202016-12-20 18:48:17 -08001/*
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
24namespace android {
25
26
27class 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.
Eric Laurenta2f478c2018-04-10 19:09:40 -070034 * \param[in] handle handle for the client stream to tear down.
Eric Laurentfc235202016-12-20 18:48:17 -080035 */
Eric Laurenta2f478c2018-04-10 19:09:40 -070036 virtual void onTearDown(audio_port_handle_t handle) = 0;
Eric Laurentfc235202016-12-20 18:48:17 -080037
38 /**
39 * The volume to be applied to the use case specified when opening the stream has changed
40 * \param[in] channels a channel mask containing all channels the volume should be applied to.
41 * \param[in] values the volume values to be applied to each channel. The size of the vector
42 * should correspond to the channel count retrieved with
43 * audio_channel_count_from_in_mask() or audio_channel_count_from_out_mask()
44 */
45 virtual void onVolumeChanged(audio_channel_mask_t channels, Vector<float> values) = 0;
46
47 /**
48 * The device the stream is routed to/from has changed
49 * \param[in] onRoutingChanged the unique device ID of the new device.
50 */
51 virtual void onRoutingChanged(audio_port_handle_t deviceId) = 0;
52
53 protected:
54 MmapStreamCallback() {}
55 virtual ~MmapStreamCallback() {}
56};
57
58
59} // namespace android
60
61#endif // ANDROID_AUDIO_MMAP_STREAM_CALLBACK_H