Dima Zavin | e81531e | 2011-04-19 16:53:42 -0700 | [diff] [blame] | 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 | |
Dima Zavin | 4a0748b | 2011-05-11 14:16:14 -0700 | [diff] [blame] | 20 | #include <system/audio.h> |
Dima Zavin | d17f66f | 2011-06-13 18:18:55 -0700 | [diff] [blame] | 21 | #include <system/audio_policy.h> |
Dima Zavin | e81531e | 2011-04-19 16:53:42 -0700 | [diff] [blame] | 22 | #include <hardware/audio_policy.h> |
Dima Zavin | e81531e | 2011-04-19 16:53:42 -0700 | [diff] [blame] | 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: |
| 34 | AudioPolicyCompatClient(struct audio_policy_service_ops *serviceOps, |
| 35 | void *service) : |
| 36 | mServiceOps(serviceOps) , mService(service) {} |
| 37 | |
Eric Laurent | 70c236c | 2012-03-28 11:27:13 -0700 | [diff] [blame] | 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, |
Dima Zavin | e81531e | 2011-04-19 16:53:42 -0700 | [diff] [blame] | 42 | uint32_t *pSamplingRate, |
Eric Laurent | 70c236c | 2012-03-28 11:27:13 -0700 | [diff] [blame] | 43 | audio_format_t *pFormat, |
| 44 | audio_channel_mask_t *pChannelMask, |
Dima Zavin | e81531e | 2011-04-19 16:53:42 -0700 | [diff] [blame] | 45 | uint32_t *pLatencyMs, |
Eric Laurent | 0977cf5 | 2012-04-18 09:28:52 -0700 | [diff] [blame] | 46 | audio_output_flags_t flags); |
Dima Zavin | e81531e | 2011-04-19 16:53:42 -0700 | [diff] [blame] | 47 | virtual audio_io_handle_t openDuplicateOutput(audio_io_handle_t output1, |
| 48 | audio_io_handle_t output2); |
| 49 | virtual status_t closeOutput(audio_io_handle_t output); |
| 50 | virtual status_t suspendOutput(audio_io_handle_t output); |
| 51 | virtual status_t restoreOutput(audio_io_handle_t output); |
Eric Laurent | 70c236c | 2012-03-28 11:27:13 -0700 | [diff] [blame] | 52 | virtual audio_io_handle_t openInput(audio_module_handle_t module, |
| 53 | audio_devices_t *pDevices, |
Dima Zavin | e81531e | 2011-04-19 16:53:42 -0700 | [diff] [blame] | 54 | uint32_t *pSamplingRate, |
Eric Laurent | 70c236c | 2012-03-28 11:27:13 -0700 | [diff] [blame] | 55 | audio_format_t *pFormat, |
| 56 | audio_channel_mask_t *pChannelMask); |
Dima Zavin | e81531e | 2011-04-19 16:53:42 -0700 | [diff] [blame] | 57 | virtual status_t closeInput(audio_io_handle_t input); |
| 58 | virtual status_t setStreamOutput(AudioSystem::stream_type stream, audio_io_handle_t output); |
| 59 | virtual status_t moveEffects(int session, |
| 60 | audio_io_handle_t srcOutput, |
| 61 | audio_io_handle_t dstOutput); |
| 62 | |
| 63 | virtual String8 getParameters(audio_io_handle_t ioHandle, const String8& keys); |
| 64 | virtual void setParameters(audio_io_handle_t ioHandle, |
| 65 | const String8& keyValuePairs, |
| 66 | int delayMs = 0); |
| 67 | virtual status_t setStreamVolume(AudioSystem::stream_type stream, |
| 68 | float volume, |
| 69 | audio_io_handle_t output, |
| 70 | int delayMs = 0); |
| 71 | virtual status_t startTone(ToneGenerator::tone_type tone, AudioSystem::stream_type stream); |
| 72 | virtual status_t stopTone(); |
| 73 | virtual status_t setVoiceVolume(float volume, int delayMs = 0); |
| 74 | |
| 75 | private: |
| 76 | struct audio_policy_service_ops* mServiceOps; |
| 77 | void* mService; |
| 78 | }; |
| 79 | |
| 80 | }; // namespace android_audio_legacy |
| 81 | |
| 82 | #endif // ANDROID_AUDIOPOLICYCLIENTLEGACY_H |