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 * \param[in] handle handle for the client stream to tear down. 35 */ 36 virtual void onTearDown(audio_port_handle_t handle) = 0; 37 38 /** 39 * The volume to be applied to the use case specified when opening the stream has changed 40 * \param[in] volume the new target volume 41 */ 42 virtual void onVolumeChanged(float volume) = 0; 43 44 /** 45 * The device the stream is routed to/from has changed 46 * \param[in] onRoutingChanged the unique device ID of the new device. 47 */ 48 virtual void onRoutingChanged(audio_port_handle_t deviceId) = 0; 49 50 protected: MmapStreamCallback()51 MmapStreamCallback() {} ~MmapStreamCallback()52 virtual ~MmapStreamCallback() {} 53 }; 54 55 56 } // namespace android 57 58 #endif // ANDROID_AUDIO_MMAP_STREAM_CALLBACK_H 59