1 /* 2 * Copyright (C) 2011 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_AUDIOPOLICYCLIENTLEGACY_H 18 #define ANDROID_AUDIOPOLICYCLIENTLEGACY_H 19 20 #include <system/audio.h> 21 #include <system/audio_policy.h> 22 #include <hardware/audio_policy.h> 23 24 #include <hardware_legacy/AudioSystemLegacy.h> 25 #include <hardware_legacy/AudioPolicyInterface.h> 26 27 /************************************/ 28 /* FOR BACKWARDS COMPATIBILITY ONLY */ 29 /************************************/ 30 namespace android_audio_legacy { 31 32 class AudioPolicyCompatClient : public AudioPolicyClientInterface { 33 public: AudioPolicyCompatClient(struct audio_policy_service_ops * serviceOps,void * service)34 AudioPolicyCompatClient(struct audio_policy_service_ops *serviceOps, 35 void *service) : 36 mServiceOps(serviceOps) , mService(service) {} 37 38 virtual audio_module_handle_t loadHwModule(const char *moduleName); 39 40 virtual audio_io_handle_t openOutput(audio_module_handle_t module, 41 audio_devices_t *pDevices, 42 uint32_t *pSamplingRate, 43 audio_format_t *pFormat, 44 audio_channel_mask_t *pChannelMask, 45 uint32_t *pLatencyMs, 46 audio_output_flags_t flags, 47 const audio_offload_info_t *offloadInfo); 48 virtual audio_io_handle_t openDuplicateOutput(audio_io_handle_t output1, 49 audio_io_handle_t output2); 50 virtual status_t closeOutput(audio_io_handle_t output); 51 virtual status_t suspendOutput(audio_io_handle_t output); 52 virtual status_t restoreOutput(audio_io_handle_t output); 53 virtual audio_io_handle_t openInput(audio_module_handle_t module, 54 audio_devices_t *pDevices, 55 uint32_t *pSamplingRate, 56 audio_format_t *pFormat, 57 audio_channel_mask_t *pChannelMask); 58 virtual status_t closeInput(audio_io_handle_t input); 59 virtual status_t invalidateStream(AudioSystem::stream_type stream); 60 virtual status_t moveEffects(audio_session_t session, 61 audio_io_handle_t srcOutput, 62 audio_io_handle_t dstOutput); 63 64 virtual String8 getParameters(audio_io_handle_t ioHandle, const String8& keys); 65 virtual void setParameters(audio_io_handle_t ioHandle, 66 const String8& keyValuePairs, 67 int delayMs = 0); 68 virtual status_t setStreamVolume(AudioSystem::stream_type stream, 69 float volume, 70 audio_io_handle_t output, 71 int delayMs = 0); 72 virtual status_t startTone(ToneGenerator::tone_type tone, AudioSystem::stream_type stream); 73 virtual status_t stopTone(); 74 virtual status_t setVoiceVolume(float volume, int delayMs = 0); 75 76 private: 77 struct audio_policy_service_ops* mServiceOps; 78 void* mService; 79 }; 80 81 }; // namespace android_audio_legacy 82 83 #endif // ANDROID_AUDIOPOLICYCLIENTLEGACY_H 84