diff options
-rw-r--r-- | audio/AudioPolicyManagerBase.cpp | 116 | ||||
-rw-r--r-- | audio/audio_policy_hal.cpp | 2 | ||||
-rw-r--r-- | include/hardware_legacy/AudioPolicyInterface.h | 2 | ||||
-rw-r--r-- | include/hardware_legacy/AudioPolicyManagerBase.h | 42 |
4 files changed, 83 insertions, 79 deletions
diff --git a/audio/AudioPolicyManagerBase.cpp b/audio/AudioPolicyManagerBase.cpp index 71ad659..0e6a1cb 100644 --- a/audio/AudioPolicyManagerBase.cpp +++ b/audio/AudioPolicyManagerBase.cpp @@ -116,11 +116,11 @@ status_t AudioPolicyManagerBase::setDeviceConnectionState(AudioSystem::audio_dev ALOGV("setDeviceConnectionState() connecting device %x", device); // register new device as available - mAvailableOutputDevices |= device; + mAvailableOutputDevices = (audio_devices_t)(mAvailableOutputDevices | device); - output = checkOutputForDevice(device, state); + output = checkOutputForDevice((audio_devices_t)device, state); if (output == 0) { - mAvailableOutputDevices &= ~device; + mAvailableOutputDevices = (audio_devices_t)(mAvailableOutputDevices & ~device); return INVALID_OPERATION; } // handle A2DP device connection @@ -146,9 +146,9 @@ status_t AudioPolicyManagerBase::setDeviceConnectionState(AudioSystem::audio_dev ALOGV("setDeviceConnectionState() disconnecting device %x", device); // remove device from available output devices - mAvailableOutputDevices &= ~device; + mAvailableOutputDevices = (audio_devices_t)(mAvailableOutputDevices & ~device); - output = checkOutputForDevice(device, state); + output = checkOutputForDevice((audio_devices_t)device, state); // handle A2DP device disconnection if (sHasA2dp && AudioSystem::isA2dpDevice(device)) { mA2dpDeviceAddress = ""; @@ -164,7 +164,7 @@ status_t AudioPolicyManagerBase::setDeviceConnectionState(AudioSystem::audio_dev } // request routing change if necessary - uint32_t newDevice = getNewDevice(mPrimaryOutput, false); + audio_devices_t newDevice = getNewDevice(mPrimaryOutput, false); checkA2dpSuspend(); checkOutputForAllStrategies(); @@ -217,7 +217,7 @@ status_t AudioPolicyManagerBase::setDeviceConnectionState(AudioSystem::audio_dev audio_io_handle_t activeInput = getActiveInput(); if (activeInput != 0) { AudioInputDescriptor *inputDesc = mInputs.valueFor(activeInput); - uint32_t newDevice = getDeviceForInputSource(inputDesc->mInputSource); + audio_devices_t newDevice = getDeviceForInputSource(inputDesc->mInputSource); if (newDevice != inputDesc->mDevice) { ALOGV("setDeviceConnectionState() changing device from %x to %x for input %d", inputDesc->mDevice, newDevice, activeInput); @@ -264,7 +264,7 @@ AudioSystem::device_connection_state AudioPolicyManagerBase::getDeviceConnection void AudioPolicyManagerBase::setPhoneState(int state) { ALOGV("setPhoneState() state %d", state); - uint32_t newDevice = 0; + audio_devices_t newDevice = (audio_devices_t)0; if (state < 0 || state >= AudioSystem::NUM_MODES) { ALOGW("setPhoneState() invalid state %d", state); return; @@ -409,7 +409,7 @@ void AudioPolicyManagerBase::setForceUse(AudioSystem::force_use usage, AudioSyst } // check for device and output changes triggered by new phone state - uint32_t newDevice = getNewDevice(mPrimaryOutput, false); + audio_devices_t newDevice = getNewDevice(mPrimaryOutput, false); checkA2dpSuspend(); checkOutputForAllStrategies(); updateDeviceForStrategy(); @@ -462,7 +462,7 @@ audio_io_handle_t AudioPolicyManagerBase::getOutput(AudioSystem::stream_type str audio_io_handle_t output = 0; uint32_t latency = 0; routing_strategy strategy = getStrategy((AudioSystem::stream_type)stream); - uint32_t device = getDeviceForStrategy(strategy); + audio_devices_t device = getDeviceForStrategy(strategy); ALOGV("getOutput() stream %d, samplingRate %d, format %d, channels %x, flags %x", stream, samplingRate, format, channels, flags); #ifdef AUDIO_POLICY_TEST @@ -510,7 +510,7 @@ audio_io_handle_t AudioPolicyManagerBase::getOutput(AudioSystem::stream_type str outputDesc->mFlags = (AudioSystem::output_flags)(flags | AudioSystem::OUTPUT_FLAG_DIRECT); outputDesc->mRefCount[stream] = 0; outputDesc->mStopTime[stream] = 0; - output = mpClientInterface->openOutput(&outputDesc->mDevice, + output = mpClientInterface->openOutput((uint32_t *)&outputDesc->mDevice, &outputDesc->mSamplingRate, &outputDesc->mFormat, &outputDesc->mChannels, @@ -575,9 +575,9 @@ status_t AudioPolicyManagerBase::startOutput(audio_io_handle_t output, // necassary for a correct control of hardware output routing by startOutput() and stopOutput() outputDesc->changeRefCount(stream, 1); - uint32_t prevDevice = outputDesc->device(); + audio_devices_t prevDevice = outputDesc->device(); setOutputDevice(output, getNewDevice(output)); - uint32_t newDevice = outputDesc->device(); + audio_devices_t newDevice = outputDesc->device(); // handle special case for sonification while in call if (isInCall()) { @@ -674,7 +674,7 @@ audio_io_handle_t AudioPolicyManagerBase::getInput(int inputSource, AudioSystem::audio_in_acoustics acoustics) { audio_io_handle_t input = 0; - uint32_t device = getDeviceForInputSource(inputSource); + audio_devices_t device = getDeviceForInputSource(inputSource); ALOGV("getInput() inputSource %d, samplingRate %d, format %d, channels %x, acoustics %x", inputSource, samplingRate, format, channels, acoustics); @@ -706,7 +706,7 @@ audio_io_handle_t AudioPolicyManagerBase::getInput(int inputSource, inputDesc->mChannels = channels; inputDesc->mAcoustics = acoustics; inputDesc->mRefCount = 0; - input = mpClientInterface->openInput(&inputDesc->mDevice, + input = mpClientInterface->openInput((uint32_t *)&inputDesc->mDevice, &inputDesc->mSamplingRate, &inputDesc->mFormat, &inputDesc->mChannels, @@ -1080,7 +1080,7 @@ AudioPolicyManagerBase::AudioPolicyManagerBase(AudioPolicyClientInterface *clien #ifdef AUDIO_POLICY_TEST Thread(false), #endif //AUDIO_POLICY_TEST - mAvailableOutputDevices(0), + mAvailableOutputDevices((audio_devices_t)0), mPhoneState(AudioSystem::MODE_NORMAL), mLimitRingtoneVolume(false), mLastVoiceVolume(-1.0f), mTotalEffectsCpuLoad(0), mTotalEffectsMemory(0), @@ -1106,12 +1106,12 @@ AudioPolicyManagerBase::AudioPolicyManagerBase(AudioPolicyClientInterface *clien if ((*outProfile)->mSupportedDevices & sAttachedOutputDevices) { AudioOutputDescriptor *outputDesc = new AudioOutputDescriptor(*outProfile); - outputDesc->mDevice = (uint32_t)sDefaultOutputDevice & (*outProfile)->mSupportedDevices; + outputDesc->mDevice = (audio_devices_t)(sDefaultOutputDevice & (*outProfile)->mSupportedDevices); outputDesc->mSamplingRate = (*outProfile)->mSamplingRates[0]; outputDesc->mFormat = (*outProfile)->mFormats[0]; outputDesc->mChannels = (*outProfile)->mChannelMasks[0]; outputDesc->mFlags = (AudioSystem::output_flags)(*outProfile)->mFlags; - audio_io_handle_t output = mpClientInterface->openOutput(&outputDesc->mDevice, + audio_io_handle_t output = mpClientInterface->openOutput((uint32_t *)&outputDesc->mDevice, &outputDesc->mSamplingRate, &outputDesc->mFormat, &outputDesc->mChannels, @@ -1120,13 +1120,13 @@ AudioPolicyManagerBase::AudioPolicyManagerBase(AudioPolicyClientInterface *clien if (output == 0) { delete outputDesc; } else { - mAvailableOutputDevices |= ((*outProfile)->mSupportedDevices & sAttachedOutputDevices); + mAvailableOutputDevices = (audio_devices_t)(mAvailableOutputDevices | ((*outProfile)->mSupportedDevices & sAttachedOutputDevices)); if ((*outProfile)->mFlags & AUDIO_POLICY_OUTPUT_FLAG_PRIMARY) { mPrimaryOutput = output; } addOutput(output, outputDesc); setOutputDevice(output, - (uint32_t)(sDefaultOutputDevice & (*outProfile)->mSupportedDevices), + (audio_devices_t)(sDefaultOutputDevice & (*outProfile)->mSupportedDevices), true); } } @@ -1344,7 +1344,7 @@ void AudioPolicyManagerBase::addOutput(audio_io_handle_t id, AudioOutputDescript audio_io_handle_t AudioPolicyManagerBase::checkOutputForDevice( - AudioSystem::audio_devices device, + audio_devices_t device, AudioSystem::device_connection_state state) { audio_io_handle_t output = 0; @@ -1377,7 +1377,7 @@ audio_io_handle_t AudioPolicyManagerBase::checkOutputForDevice( ALOGV("opening output for device %08x", device); outputDesc = new AudioOutputDescriptor(*outProfile); outputDesc->mDevice = device; - output = mpClientInterface->openOutput(&outputDesc->mDevice, + output = mpClientInterface->openOutput((uint32_t *)&outputDesc->mDevice, &outputDesc->mSamplingRate, &outputDesc->mFormat, &outputDesc->mChannels, @@ -1483,7 +1483,7 @@ void AudioPolicyManagerBase::closeOutput(audio_io_handle_t output) mOutputs.removeItem(output); } -SortedVector<audio_io_handle_t> AudioPolicyManagerBase::getOutputsForDevice(uint32_t device) +SortedVector<audio_io_handle_t> AudioPolicyManagerBase::getOutputsForDevice(audio_devices_t device) { SortedVector<audio_io_handle_t> outputs; @@ -1623,9 +1623,9 @@ void AudioPolicyManagerBase::checkA2dpSuspend() } } -uint32_t AudioPolicyManagerBase::getNewDevice(audio_io_handle_t output, bool fromCache) +audio_devices_t AudioPolicyManagerBase::getNewDevice(audio_io_handle_t output, bool fromCache) { - uint32_t device = 0; + audio_devices_t device = (audio_devices_t)0; AudioOutputDescriptor *outputDesc = mOutputs.valueFor(output); // check the following by order of priority to request a routing change if necessary: @@ -1660,13 +1660,13 @@ uint32_t AudioPolicyManagerBase::getStrategyForStream(AudioSystem::stream_type s return (uint32_t)getStrategy(stream); } -uint32_t AudioPolicyManagerBase::getDevicesForStream(AudioSystem::stream_type stream) { - uint32_t devices; +audio_devices_t AudioPolicyManagerBase::getDevicesForStream(AudioSystem::stream_type stream) { + audio_devices_t devices; // By checking the range of stream before calling getStrategy, we avoid // getStrategy's behavior for invalid streams. getStrategy would do a ALOGE // and then return STRATEGY_MEDIA, but we want to return the empty set. if (stream < (AudioSystem::stream_type) 0 || stream >= AudioSystem::NUM_STREAM_TYPES) { - devices = 0; + devices = (audio_devices_t)0; } else { AudioPolicyManagerBase::routing_strategy strategy = getStrategy(stream); devices = getDeviceForStrategy(strategy, true); @@ -1700,7 +1700,7 @@ AudioPolicyManagerBase::routing_strategy AudioPolicyManagerBase::getStrategy( } } -uint32_t AudioPolicyManagerBase::getDeviceForStrategy(routing_strategy strategy, bool fromCache) +audio_devices_t AudioPolicyManagerBase::getDeviceForStrategy(routing_strategy strategy, bool fromCache) { uint32_t device = 0; @@ -1844,7 +1844,7 @@ uint32_t AudioPolicyManagerBase::getDeviceForStrategy(routing_strategy strategy, } ALOGV("getDeviceForStrategy() strategy %d, device %x", strategy, device); - return device; + return (audio_devices_t)device; } void AudioPolicyManagerBase::updateDeviceForStrategy() @@ -1854,7 +1854,10 @@ void AudioPolicyManagerBase::updateDeviceForStrategy() } } -void AudioPolicyManagerBase::setOutputDevice(audio_io_handle_t output, uint32_t device, bool force, int delayMs) +void AudioPolicyManagerBase::setOutputDevice(audio_io_handle_t output, + audio_devices_t device, + bool force, + int delayMs) { ALOGV("setOutputDevice() output %d device %x delayMs %d", output, device, delayMs); AudioOutputDescriptor *outputDesc = mOutputs.valueFor(output); @@ -1866,9 +1869,9 @@ void AudioPolicyManagerBase::setOutputDevice(audio_io_handle_t output, uint32_t return; } // filter devices according to output selected - device &= outputDesc->mProfile->mSupportedDevices; + device = (audio_devices_t)(device & outputDesc->mProfile->mSupportedDevices); - uint32_t prevDevice = (uint32_t)outputDesc->device(); + audio_devices_t prevDevice = outputDesc->device(); // Do not change the routing if: // - the requestede device is 0 // - the requested device is the same as current device and force is not specified. @@ -1896,12 +1899,12 @@ void AudioPolicyManagerBase::setOutputDevice(audio_io_handle_t output, uint32_t applyStreamVolumes(output, device, delayMs); // if changing from a combined headset + speaker route, unmute media streams - if (output == mPrimaryOutput && AudioSystem::popCount(prevDevice) == 2) { + if (output == mPrimaryOutput && AudioSystem::popCount((uint32_t)prevDevice) == 2) { setStrategyMute(STRATEGY_MEDIA, false, output, delayMs); } } -uint32_t AudioPolicyManagerBase::getDeviceForInputSource(int inputSource) +audio_devices_t AudioPolicyManagerBase::getDeviceForInputSource(int inputSource) { uint32_t device; @@ -1937,7 +1940,7 @@ uint32_t AudioPolicyManagerBase::getDeviceForInputSource(int inputSource) break; } ALOGV("getDeviceForInputSource()input source %d, device %08x", inputSource, device); - return device; + return (audio_devices_t)device; } audio_io_handle_t AudioPolicyManagerBase::getActiveInput() @@ -1977,9 +1980,9 @@ audio_devices_t AudioPolicyManagerBase::getDeviceForVolume(audio_devices_t devic return device; } -AudioPolicyManagerBase::device_category AudioPolicyManagerBase::getDeviceCategory(uint32_t device) +AudioPolicyManagerBase::device_category AudioPolicyManagerBase::getDeviceCategory(audio_devices_t device) { - switch(getDeviceForVolume((audio_devices_t)device)) { + switch(getDeviceForVolume(device)) { case AUDIO_DEVICE_OUT_EARPIECE: return DEVICE_CATEGORY_EARPIECE; case AUDIO_DEVICE_OUT_WIRED_HEADSET: @@ -1998,7 +2001,7 @@ AudioPolicyManagerBase::device_category AudioPolicyManagerBase::getDeviceCategor } } -float AudioPolicyManagerBase::volIndexToAmpl(uint32_t device, const StreamDescriptor& streamDesc, +float AudioPolicyManagerBase::volIndexToAmpl(audio_devices_t device, const StreamDescriptor& streamDesc, int indexInUi) { device_category deviceCategory = getDeviceCategory(device); @@ -2109,7 +2112,7 @@ void AudioPolicyManagerBase::initializeVolumeCurves() float AudioPolicyManagerBase::computeVolume(int stream, int index, audio_io_handle_t output, - uint32_t device) + audio_devices_t device) { float volume = 1.0; AudioOutputDescriptor *outputDesc = mOutputs.valueFor(output); @@ -2122,8 +2125,8 @@ float AudioPolicyManagerBase::computeVolume(int stream, // if volume is not 0 (not muted), force media volume to max on digital output if (stream == AudioSystem::MUSIC && index != mStreams[stream].mIndexMin && - (device == AudioSystem::DEVICE_OUT_AUX_DIGITAL || - device == AudioSystem::DEVICE_OUT_DGTL_DOCK_HEADSET)) { + (device == AUDIO_DEVICE_OUT_AUX_DIGITAL || + device == AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET)) { return 1.0; } @@ -2148,9 +2151,9 @@ float AudioPolicyManagerBase::computeVolume(int stream, // just stopped if (outputDesc->mRefCount[AudioSystem::MUSIC] || mLimitRingtoneVolume) { float musicVol = computeVolume(AudioSystem::MUSIC, - mStreams[AudioSystem::MUSIC].getVolumeIndex((audio_devices_t)device), + mStreams[AudioSystem::MUSIC].getVolumeIndex(device), output, - (uint32_t)device); + device); float minVol = (musicVol > SONIFICATION_HEADSET_VOLUME_MIN) ? musicVol : SONIFICATION_HEADSET_VOLUME_MIN; if (volume > minVol) { @@ -2166,7 +2169,7 @@ float AudioPolicyManagerBase::computeVolume(int stream, status_t AudioPolicyManagerBase::checkAndSetVolume(int stream, int index, audio_io_handle_t output, - uint32_t device, + audio_devices_t device, int delayMs, bool force) { @@ -2229,7 +2232,7 @@ status_t AudioPolicyManagerBase::checkAndSetVolume(int stream, } void AudioPolicyManagerBase::applyStreamVolumes(audio_io_handle_t output, - uint32_t device, + audio_devices_t device, int delayMs, bool force) { @@ -2237,7 +2240,7 @@ void AudioPolicyManagerBase::applyStreamVolumes(audio_io_handle_t output, for (int stream = 0; stream < AudioSystem::NUM_STREAM_TYPES; stream++) { checkAndSetVolume(stream, - mStreams[stream].getVolumeIndex((audio_devices_t)device), + mStreams[stream].getVolumeIndex(device), output, device, delayMs, @@ -2259,7 +2262,7 @@ void AudioPolicyManagerBase::setStreamMute(int stream, bool on, audio_io_handle_ { StreamDescriptor &streamDesc = mStreams[stream]; AudioOutputDescriptor *outputDesc = mOutputs.valueFor(output); - uint32_t device = outputDesc->device(); + audio_devices_t device = outputDesc->device(); ALOGV("setStreamMute() stream %d, mute %d, output %d, mMuteCount %d", stream, on, output, outputDesc->mMuteCount[stream]); @@ -2363,7 +2366,8 @@ uint32_t AudioPolicyManagerBase::getMaxEffectsMemory() AudioPolicyManagerBase::AudioOutputDescriptor::AudioOutputDescriptor( const output_profile_t *profile) : mId(0), mSamplingRate(0), mFormat(0), mChannels(0), mLatency(0), - mFlags((AudioSystem::output_flags)0), mDevice(0), mOutput1(0), mOutput2(0), mProfile(profile) + mFlags((AudioSystem::output_flags)0), mDevice((audio_devices_t)0), + mOutput1(0), mOutput2(0), mProfile(profile) { // clear usage count for all stream types for (int i = 0; i < AudioSystem::NUM_STREAM_TYPES; i++) { @@ -2374,15 +2378,13 @@ AudioPolicyManagerBase::AudioOutputDescriptor::AudioOutputDescriptor( } } -uint32_t AudioPolicyManagerBase::AudioOutputDescriptor::device() +audio_devices_t AudioPolicyManagerBase::AudioOutputDescriptor::device() { - uint32_t device = 0; if (isDuplicated()) { - device = mOutput1->mDevice | mOutput2->mDevice; + return (audio_devices_t)(mOutput1->mDevice | mOutput2->mDevice); } else { - device = mDevice; + return mDevice; } - return device; } void AudioPolicyManagerBase::AudioOutputDescriptor::changeRefCount(AudioSystem::stream_type stream, int delta) @@ -2421,10 +2423,10 @@ uint32_t AudioPolicyManagerBase::AudioOutputDescriptor::strategyRefCount(routing return refCount; } -uint32_t AudioPolicyManagerBase::AudioOutputDescriptor::supportedDevices() +audio_devices_t AudioPolicyManagerBase::AudioOutputDescriptor::supportedDevices() { if (isDuplicated()) { - return (mOutput1->supportedDevices() | mOutput2->supportedDevices()); + return (audio_devices_t)(mOutput1->supportedDevices() | mOutput2->supportedDevices()); } else { return mProfile->mSupportedDevices ; } @@ -2463,7 +2465,7 @@ status_t AudioPolicyManagerBase::AudioOutputDescriptor::dump(int fd) AudioPolicyManagerBase::AudioInputDescriptor::AudioInputDescriptor() : mSamplingRate(0), mFormat(0), mChannels(0), - mAcoustics((AudioSystem::audio_in_acoustics)0), mDevice(0), mRefCount(0), + mAcoustics((AudioSystem::audio_in_acoustics)0), mDevice((audio_devices_t)0), mRefCount(0), mInputSource(0) { } diff --git a/audio/audio_policy_hal.cpp b/audio/audio_policy_hal.cpp index 40d73cb..9a71d2f 100644 --- a/audio/audio_policy_hal.cpp +++ b/audio/audio_policy_hal.cpp @@ -258,7 +258,7 @@ static uint32_t ap_get_strategy_for_stream(const struct audio_policy *pol, return lap->apm->getStrategyForStream((AudioSystem::stream_type)stream); } -static uint32_t ap_get_devices_for_stream(const struct audio_policy *pol, +static audio_devices_t ap_get_devices_for_stream(const struct audio_policy *pol, audio_stream_type_t stream) { const struct legacy_audio_policy *lap = to_clap(pol); diff --git a/include/hardware_legacy/AudioPolicyInterface.h b/include/hardware_legacy/AudioPolicyInterface.h index f283594..d703485 100644 --- a/include/hardware_legacy/AudioPolicyInterface.h +++ b/include/hardware_legacy/AudioPolicyInterface.h @@ -144,7 +144,7 @@ public: virtual uint32_t getStrategyForStream(AudioSystem::stream_type stream) = 0; // return the enabled output devices for the given stream type - virtual uint32_t getDevicesForStream(AudioSystem::stream_type stream) = 0; + virtual audio_devices_t getDevicesForStream(AudioSystem::stream_type stream) = 0; // Audio effect management virtual audio_io_handle_t getOutputForEffect(effect_descriptor_t *desc) = 0; diff --git a/include/hardware_legacy/AudioPolicyManagerBase.h b/include/hardware_legacy/AudioPolicyManagerBase.h index 31e1dc3..1459e7e 100644 --- a/include/hardware_legacy/AudioPolicyManagerBase.h +++ b/include/hardware_legacy/AudioPolicyManagerBase.h @@ -130,7 +130,7 @@ public: virtual uint32_t getStrategyForStream(AudioSystem::stream_type stream); // return the enabled output devices for the given stream type - virtual uint32_t getDevicesForStream(AudioSystem::stream_type stream); + virtual audio_devices_t getDevicesForStream(AudioSystem::stream_type stream); virtual audio_io_handle_t getOutputForEffect(effect_descriptor_t *desc); virtual status_t registerEffect(effect_descriptor_t *desc, @@ -197,13 +197,13 @@ protected: status_t dump(int fd); - uint32_t device(); + audio_devices_t device(); void changeRefCount(AudioSystem::stream_type, int delta); uint32_t refCount(); uint32_t strategyRefCount(routing_strategy strategy); bool isUsedByStrategy(routing_strategy strategy) { return (strategyRefCount(strategy) != 0);} bool isDuplicated() { return (mOutput1 != NULL && mOutput2 != NULL); } - uint32_t supportedDevices(); + audio_devices_t supportedDevices(); audio_io_handle_t mId; // output handle uint32_t mSamplingRate; // @@ -211,7 +211,7 @@ protected: uint32_t mChannels; // output configuration uint32_t mLatency; // AudioSystem::output_flags mFlags; // - uint32_t mDevice; // current device this output is routed to + audio_devices_t mDevice; // current device this output is routed to uint32_t mRefCount[AudioSystem::NUM_STREAM_TYPES]; // number of streams of each type using this output nsecs_t mStopTime[AudioSystem::NUM_STREAM_TYPES]; AudioOutputDescriptor *mOutput1; // used by duplicated outputs: first output @@ -234,9 +234,9 @@ protected: uint32_t mFormat; // input configuration uint32_t mChannels; // AudioSystem::audio_in_acoustics mAcoustics; // - uint32_t mDevice; // current device this input is routed to + audio_devices_t mDevice; // current device this input is routed to uint32_t mRefCount; // number of AudioRecord clients using this output - int mInputSource; // input source selected by application (mediarecorder.h) + int mInputSource; // input source selected by application (mediarecorder.h) }; // stream descriptor used for volume control @@ -285,13 +285,16 @@ protected: // "future" device selection (fromCache == false) when called from a context // where conditions are changing (setDeviceConnectionState(), setPhoneState()...) AND // before updateDeviceForStrategy() is called. - virtual uint32_t getDeviceForStrategy(routing_strategy strategy, bool fromCache = true); + virtual audio_devices_t getDeviceForStrategy(routing_strategy strategy, bool fromCache = true); // change the route of the specified output - void setOutputDevice(audio_io_handle_t output, uint32_t device, bool force = false, int delayMs = 0); + void setOutputDevice(audio_io_handle_t output, + audio_devices_t device, + bool force = false, + int delayMs = 0); // select input device corresponding to requested audio source - virtual uint32_t getDeviceForInputSource(int inputSource); + virtual audio_devices_t getDeviceForInputSource(int inputSource); // return io handle of active input or 0 if no input is active audio_io_handle_t getActiveInput(); @@ -301,13 +304,13 @@ protected: // compute the actual volume for a given stream according to the requested index and a particular // device - virtual float computeVolume(int stream, int index, audio_io_handle_t output, uint32_t device); + virtual float computeVolume(int stream, int index, audio_io_handle_t output, audio_devices_t device); // check that volume change is permitted, compute and send new volume to audio hardware - status_t checkAndSetVolume(int stream, int index, audio_io_handle_t output, uint32_t device, int delayMs = 0, bool force = false); + status_t checkAndSetVolume(int stream, int index, audio_io_handle_t output, audio_devices_t device, int delayMs = 0, bool force = false); // apply all stream volumes to the specified output and device - void applyStreamVolumes(audio_io_handle_t output, uint32_t device, int delayMs = 0, bool force = false); + void applyStreamVolumes(audio_io_handle_t output, audio_devices_t device, int delayMs = 0, bool force = false); // Mute or unmute all streams handled by the specified strategy on the specified output void setStrategyMute(routing_strategy strategy, bool on, audio_io_handle_t output, int delayMs = 0); @@ -334,7 +337,7 @@ protected: // when a device is disconnected, checks if an output is not used any more and // returns its handle if any. // transfers the audio tracks and effects from one output thread to another accordingly. - audio_io_handle_t checkOutputForDevice(AudioSystem::audio_devices device, + audio_io_handle_t checkOutputForDevice(audio_devices_t device, AudioSystem::device_connection_state state); // close an output and its companion duplicating output. @@ -360,7 +363,7 @@ protected: // changed: connected device, phone state, force use, output start, output stop.. // see getDeviceForStrategy() for the use of fromCache parameter - uint32_t getNewDevice(audio_io_handle_t output, bool fromCache = true); + audio_devices_t getNewDevice(audio_io_handle_t output, bool fromCache = true); // updates cache of device used by all strategies (mDeviceForStrategy[]) // must be called every time a condition that affects the device choice for a given strategy is // changed: connected device, phone state, force use... @@ -390,13 +393,12 @@ protected: status_t setEffectEnabled(EffectDescriptor *pDesc, bool enabled); // returns the category the device belongs to with regard to volume curve management - static device_category getDeviceCategory(uint32_t device); + static device_category getDeviceCategory(audio_devices_t device); // extract one device relevant for volume control from multiple device selection static audio_devices_t getDeviceForVolume(audio_devices_t device); - audio_io_handle_t getOutputForDevice(uint32_t device); - SortedVector<audio_io_handle_t> getOutputsForDevice(uint32_t device); + SortedVector<audio_io_handle_t> getOutputsForDevice(audio_devices_t device); bool vectorsEqual(SortedVector<audio_io_handle_t>& outputs1, SortedVector<audio_io_handle_t>& outputs2); @@ -404,7 +406,7 @@ protected: audio_io_handle_t mPrimaryOutput; // primary output handle DefaultKeyedVector<audio_io_handle_t, AudioOutputDescriptor *> mOutputs; // list of output descriptors DefaultKeyedVector<audio_io_handle_t, AudioInputDescriptor *> mInputs; // list of input descriptors - uint32_t mAvailableOutputDevices; // bit field of all available output devices + audio_devices_t mAvailableOutputDevices; // bit field of all available output devices uint32_t mAvailableInputDevices; // bit field of all available input devices int mPhoneState; // current phone state AudioSystem::forced_config mForceUse[AudioSystem::NUM_FORCE_USE]; // current forced use configuration @@ -413,7 +415,7 @@ protected: String8 mA2dpDeviceAddress; // A2DP device MAC address String8 mScoDeviceAddress; // SCO device MAC address bool mLimitRingtoneVolume; // limit ringtone volume to music volume if headset connected - uint32_t mDeviceForStrategy[NUM_STRATEGIES]; + audio_devices_t mDeviceForStrategy[NUM_STRATEGIES]; float mLastVoiceVolume; // last voice volume value sent to audio HAL // Maximum CPU load allocated to audio effects in 0.1 MIPS (ARMv5TE, 0 WS memory) units @@ -441,7 +443,7 @@ protected: #endif //AUDIO_POLICY_TEST private: - static float volIndexToAmpl(uint32_t device, const StreamDescriptor& streamDesc, + static float volIndexToAmpl(audio_devices_t device, const StreamDescriptor& streamDesc, int indexInUi); }; |