Loading audio/effect/2.0/IEffect.hal +14 −2 Original line number Diff line number Diff line Loading @@ -59,7 +59,7 @@ interface IEffect { * * @return retval operation completion status. */ @callflow(next={"process"}) @callflow(next={"prepareForProcessing"}) enable() generates (Result retval); /* Loading @@ -67,7 +67,7 @@ interface IEffect { * * @return retval operation completion status. */ @exit @callflow(next={"close"}) disable() generates (Result retval); /* Loading @@ -75,6 +75,9 @@ interface IEffect { * effect implementation must set EFFECT_FLAG_DEVICE_IND flag in its * descriptor to receive this command when the device changes. * * Note: this method is only supported for effects inserted into * the output chain. * * @param device output device specification. * @return retval operation completion status. */ Loading Loading @@ -145,6 +148,9 @@ interface IEffect { * implementation must set EFFECT_FLAG_DEVICE_IND flag in its descriptor to * receive this command when the device changes. * * Note: this method is only supported for effects inserted into * the input chain. * * @param device input device specification. * @return retval operation completion status. */ Loading Loading @@ -209,6 +215,9 @@ interface IEffect { * Set the audio source the capture path is configured for (Camcorder, voice * recognition...). * * Note: this method is only supported for effects inserted into * the input chain. * * @param source source descriptor. * @return retval operation completion status. */ Loading Loading @@ -258,6 +267,7 @@ interface IEffect { * the queue. * @return statusMQ a message queue used for passing status from the effect. */ @callflow(next={"setProcessBuffers"}) prepareForProcessing() generates (Result retval, fmq_sync<Result> statusMQ); /* Loading @@ -275,6 +285,7 @@ interface IEffect { * INVALID_ARGUMENTS if there was a problem with mapping * any of the buffers. */ @callflow(next={"*"}) setProcessBuffers(AudioBuffer inBuffer, AudioBuffer outBuffer) generates ( Result retval); Loading Loading @@ -423,5 +434,6 @@ interface IEffect { * @return retval OK in case the success. * INVALID_STATE if the effect was already closed. */ @exit close() generates (Result retval); }; audio/effect/2.0/IEqualizerEffect.hal +12 −10 Original line number Diff line number Diff line Loading @@ -29,34 +29,36 @@ interface IEqualizerEffect extends IEffect { * Returns the minimum and maximum band levels supported. */ getLevelRange() generates (Result retval, uint16_t minLevel, uint16_t maxLevel); generates (Result retval, int16_t minLevel, int16_t maxLevel); /* * Sets the gain for the given equalizer band. */ setBandLevel(uint16_t band, uint16_t level) generates (Result retval); setBandLevel(uint16_t band, int16_t level) generates (Result retval); /* * Gets the gain for the given equalizer band. */ getBandLevel(uint16_t band) generates (Result retval, uint16_t level); getBandLevel(uint16_t band) generates (Result retval, int16_t level); /* * Gets the center frequency of the given band. * Gets the center frequency of the given band, in milliHertz. */ getBandCenterFrequency(uint16_t band) generates (Result retval, uint32_t centerFreq); generates (Result retval, uint32_t centerFreqmHz); /* * Gets the frequency range of the given frequency band. * Gets the frequency range of the given frequency band, in milliHertz. */ getBandFrequencyRange(uint16_t band) generates (Result retval, uint32_t minFreqHz, uint32_t maxFreqHz); generates (Result retval, uint32_t minFreqmHz, uint32_t maxFreqmHz); /* * Gets the band that has the most effect on the given frequency. * Gets the band that has the most effect on the given frequency * in milliHertz. */ getBandForFrequency(uint32_t freq) generates (Result retval, uint16_t band); getBandForFrequency(uint32_t freqmHz) generates (Result retval, uint16_t band); /* * Gets the names of all presets the equalizer supports. Loading @@ -76,7 +78,7 @@ interface IEqualizerEffect extends IEffect { struct AllProperties { uint16_t curPreset; vec<uint16_t> bandLevels; vec<int16_t> bandLevels; }; /* Loading audio/effect/2.0/default/Effect.cpp +7 −4 Original line number Diff line number Diff line Loading @@ -188,6 +188,8 @@ void Effect::effectAuxChannelsConfigToHal( // static void Effect::effectBufferConfigFromHal( const buffer_config_t& halConfig, EffectBufferConfig* config) { config->buffer.id = 0; config->buffer.frameCount = 0; config->samplingRateHz = halConfig.samplingRate; config->channels = AudioChannelMask(halConfig.channels); config->format = AudioFormat(halConfig.format); Loading Loading @@ -282,7 +284,7 @@ Result Effect::analyzeStatus( void Effect::getConfigImpl(int commandCode, const char* commandName, GetConfigCallback cb) { uint32_t halResultSize = sizeof(effect_config_t); effect_config_t halConfig; effect_config_t halConfig{}; status_t status = (*mHandle)->command( mHandle, commandCode, 0, NULL, &halResultSize, &halConfig); EffectConfig config; Loading @@ -309,15 +311,16 @@ Result Effect::getCurrentConfigImpl( Result Effect::getParameterImpl( uint32_t paramSize, const void* paramData, uint32_t valueSize, uint32_t requestValueSize, uint32_t replyValueSize, GetParameterSuccessCallback onSuccess) { // As it is unknown what method HAL uses for copying the provided parameter data, // it is safer to make sure that input and output buffers do not overlap. std::vector<uint8_t> halCmdBuffer = parameterToHal(paramSize, paramData, valueSize, nullptr); parameterToHal(paramSize, paramData, requestValueSize, nullptr); const void *valueData = nullptr; std::vector<uint8_t> halParamBuffer = parameterToHal(paramSize, paramData, valueSize, &valueData); parameterToHal(paramSize, paramData, replyValueSize, &valueData); uint32_t halParamBufferSize = halParamBuffer.size(); return sendCommandReturningStatusAndData( Loading audio/effect/2.0/default/Effect.h +18 −9 Original line number Diff line number Diff line Loading @@ -60,6 +60,8 @@ using ::android::sp; struct Effect : public IEffect { typedef MessageQueue<Result, kSynchronizedReadWrite> StatusMQ; using GetParameterSuccessCallback = std::function<void(uint32_t valueSize, const void* valueData)>; explicit Effect(effect_handle_t handle); Loading Loading @@ -163,6 +165,22 @@ struct Effect : public IEffect { return setParameterImpl(sizeof(params), params, sizeof(T), ¶mValue); } Result getParameterImpl( uint32_t paramSize, const void* paramData, uint32_t valueSize, GetParameterSuccessCallback onSuccess) { return getParameterImpl(paramSize, paramData, valueSize, valueSize, onSuccess); } Result getParameterImpl( uint32_t paramSize, const void* paramData, uint32_t requestValueSize, uint32_t replyValueSize, GetParameterSuccessCallback onSuccess); Result setParameterImpl( uint32_t paramSize, const void* paramData, uint32_t valueSize, const void* valueData); private: friend struct VirtualizerEffect; // for getParameterImpl friend struct VisualizerEffect; // to allow executing commands Loading @@ -170,8 +188,6 @@ struct Effect : public IEffect { using CommandSuccessCallback = std::function<void()>; using GetConfigCallback = std::function<void(Result retval, const EffectConfig& config)>; using GetCurrentConfigSuccessCallback = std::function<void(void* configData)>; using GetParameterSuccessCallback = std::function<void(uint32_t valueSize, const void* valueData)>; using GetSupportedConfigsSuccessCallback = std::function<void(uint32_t supportedConfigs, void* configsData)>; Loading Loading @@ -220,11 +236,6 @@ struct Effect : public IEffect { void getConfigImpl(int commandCode, const char* commandName, GetConfigCallback cb); Result getCurrentConfigImpl( uint32_t featureId, uint32_t configSize, GetCurrentConfigSuccessCallback onSuccess); Result getParameterImpl( uint32_t paramSize, const void* paramData, uint32_t valueSize, GetParameterSuccessCallback onSuccess); Result getSupportedConfigsImpl( uint32_t featureId, uint32_t maxConfigs, Loading Loading @@ -252,8 +263,6 @@ struct Effect : public IEffect { const EffectConfig& config, const sp<IEffectBufferProviderCallback>& inputBufferProvider, const sp<IEffectBufferProviderCallback>& outputBufferProvider); Result setParameterImpl( uint32_t paramSize, const void* paramData, uint32_t valueSize, const void* valueData); }; } // namespace implementation Loading audio/effect/2.0/default/EffectsFactory.cpp +6 −4 Original line number Diff line number Diff line Loading @@ -95,7 +95,7 @@ restart: status = EffectQueryNumberEffects(&numEffects); if (status != OK) { retval = Result::NOT_INITIALIZED; ALOGW("Error querying number of effects: %s", strerror(-status)); ALOGE("Error querying number of effects: %s", strerror(-status)); goto exit; } result.resize(numEffects); Loading @@ -105,7 +105,7 @@ restart: if (status == OK) { effectDescriptorFromHal(halDescriptor, &result[i]); } else { ALOGW("Error querying effect at position %d / %d: %s", ALOGE("Error querying effect at position %d / %d: %s", i, numEffects, strerror(-status)); switch (status) { case -ENOSYS: { Loading Loading @@ -139,7 +139,7 @@ Return<void> EffectsFactory::getDescriptor(const Uuid& uid, getDescriptor_cb _hi effectDescriptorFromHal(halDescriptor, &descriptor); Result retval(Result::OK); if (status != OK) { ALOGW("Error querying effect descriptor for %s: %s", ALOGE("Error querying effect descriptor for %s: %s", uuidToString(halUuid).c_str(), strerror(-status)); if (status == -ENOENT) { retval = Result::INVALID_ARGUMENTS; Loading Loading @@ -168,11 +168,13 @@ Return<void> EffectsFactory::createEffect( effect = dispatchEffectInstanceCreation(halDescriptor, handle); effectId = EffectMap::getInstance().add(handle); } else { ALOGE("Error querying effect descriptor for %s: %s", uuidToString(halUuid).c_str(), strerror(-status)); EffectRelease(handle); } } if (status != OK) { ALOGW("Error creating effect %s: %s", uuidToString(halUuid).c_str(), strerror(-status)); ALOGE("Error creating effect %s: %s", uuidToString(halUuid).c_str(), strerror(-status)); if (status == -ENOENT) { retval = Result::INVALID_ARGUMENTS; } else { Loading Loading
audio/effect/2.0/IEffect.hal +14 −2 Original line number Diff line number Diff line Loading @@ -59,7 +59,7 @@ interface IEffect { * * @return retval operation completion status. */ @callflow(next={"process"}) @callflow(next={"prepareForProcessing"}) enable() generates (Result retval); /* Loading @@ -67,7 +67,7 @@ interface IEffect { * * @return retval operation completion status. */ @exit @callflow(next={"close"}) disable() generates (Result retval); /* Loading @@ -75,6 +75,9 @@ interface IEffect { * effect implementation must set EFFECT_FLAG_DEVICE_IND flag in its * descriptor to receive this command when the device changes. * * Note: this method is only supported for effects inserted into * the output chain. * * @param device output device specification. * @return retval operation completion status. */ Loading Loading @@ -145,6 +148,9 @@ interface IEffect { * implementation must set EFFECT_FLAG_DEVICE_IND flag in its descriptor to * receive this command when the device changes. * * Note: this method is only supported for effects inserted into * the input chain. * * @param device input device specification. * @return retval operation completion status. */ Loading Loading @@ -209,6 +215,9 @@ interface IEffect { * Set the audio source the capture path is configured for (Camcorder, voice * recognition...). * * Note: this method is only supported for effects inserted into * the input chain. * * @param source source descriptor. * @return retval operation completion status. */ Loading Loading @@ -258,6 +267,7 @@ interface IEffect { * the queue. * @return statusMQ a message queue used for passing status from the effect. */ @callflow(next={"setProcessBuffers"}) prepareForProcessing() generates (Result retval, fmq_sync<Result> statusMQ); /* Loading @@ -275,6 +285,7 @@ interface IEffect { * INVALID_ARGUMENTS if there was a problem with mapping * any of the buffers. */ @callflow(next={"*"}) setProcessBuffers(AudioBuffer inBuffer, AudioBuffer outBuffer) generates ( Result retval); Loading Loading @@ -423,5 +434,6 @@ interface IEffect { * @return retval OK in case the success. * INVALID_STATE if the effect was already closed. */ @exit close() generates (Result retval); };
audio/effect/2.0/IEqualizerEffect.hal +12 −10 Original line number Diff line number Diff line Loading @@ -29,34 +29,36 @@ interface IEqualizerEffect extends IEffect { * Returns the minimum and maximum band levels supported. */ getLevelRange() generates (Result retval, uint16_t minLevel, uint16_t maxLevel); generates (Result retval, int16_t minLevel, int16_t maxLevel); /* * Sets the gain for the given equalizer band. */ setBandLevel(uint16_t band, uint16_t level) generates (Result retval); setBandLevel(uint16_t band, int16_t level) generates (Result retval); /* * Gets the gain for the given equalizer band. */ getBandLevel(uint16_t band) generates (Result retval, uint16_t level); getBandLevel(uint16_t band) generates (Result retval, int16_t level); /* * Gets the center frequency of the given band. * Gets the center frequency of the given band, in milliHertz. */ getBandCenterFrequency(uint16_t band) generates (Result retval, uint32_t centerFreq); generates (Result retval, uint32_t centerFreqmHz); /* * Gets the frequency range of the given frequency band. * Gets the frequency range of the given frequency band, in milliHertz. */ getBandFrequencyRange(uint16_t band) generates (Result retval, uint32_t minFreqHz, uint32_t maxFreqHz); generates (Result retval, uint32_t minFreqmHz, uint32_t maxFreqmHz); /* * Gets the band that has the most effect on the given frequency. * Gets the band that has the most effect on the given frequency * in milliHertz. */ getBandForFrequency(uint32_t freq) generates (Result retval, uint16_t band); getBandForFrequency(uint32_t freqmHz) generates (Result retval, uint16_t band); /* * Gets the names of all presets the equalizer supports. Loading @@ -76,7 +78,7 @@ interface IEqualizerEffect extends IEffect { struct AllProperties { uint16_t curPreset; vec<uint16_t> bandLevels; vec<int16_t> bandLevels; }; /* Loading
audio/effect/2.0/default/Effect.cpp +7 −4 Original line number Diff line number Diff line Loading @@ -188,6 +188,8 @@ void Effect::effectAuxChannelsConfigToHal( // static void Effect::effectBufferConfigFromHal( const buffer_config_t& halConfig, EffectBufferConfig* config) { config->buffer.id = 0; config->buffer.frameCount = 0; config->samplingRateHz = halConfig.samplingRate; config->channels = AudioChannelMask(halConfig.channels); config->format = AudioFormat(halConfig.format); Loading Loading @@ -282,7 +284,7 @@ Result Effect::analyzeStatus( void Effect::getConfigImpl(int commandCode, const char* commandName, GetConfigCallback cb) { uint32_t halResultSize = sizeof(effect_config_t); effect_config_t halConfig; effect_config_t halConfig{}; status_t status = (*mHandle)->command( mHandle, commandCode, 0, NULL, &halResultSize, &halConfig); EffectConfig config; Loading @@ -309,15 +311,16 @@ Result Effect::getCurrentConfigImpl( Result Effect::getParameterImpl( uint32_t paramSize, const void* paramData, uint32_t valueSize, uint32_t requestValueSize, uint32_t replyValueSize, GetParameterSuccessCallback onSuccess) { // As it is unknown what method HAL uses for copying the provided parameter data, // it is safer to make sure that input and output buffers do not overlap. std::vector<uint8_t> halCmdBuffer = parameterToHal(paramSize, paramData, valueSize, nullptr); parameterToHal(paramSize, paramData, requestValueSize, nullptr); const void *valueData = nullptr; std::vector<uint8_t> halParamBuffer = parameterToHal(paramSize, paramData, valueSize, &valueData); parameterToHal(paramSize, paramData, replyValueSize, &valueData); uint32_t halParamBufferSize = halParamBuffer.size(); return sendCommandReturningStatusAndData( Loading
audio/effect/2.0/default/Effect.h +18 −9 Original line number Diff line number Diff line Loading @@ -60,6 +60,8 @@ using ::android::sp; struct Effect : public IEffect { typedef MessageQueue<Result, kSynchronizedReadWrite> StatusMQ; using GetParameterSuccessCallback = std::function<void(uint32_t valueSize, const void* valueData)>; explicit Effect(effect_handle_t handle); Loading Loading @@ -163,6 +165,22 @@ struct Effect : public IEffect { return setParameterImpl(sizeof(params), params, sizeof(T), ¶mValue); } Result getParameterImpl( uint32_t paramSize, const void* paramData, uint32_t valueSize, GetParameterSuccessCallback onSuccess) { return getParameterImpl(paramSize, paramData, valueSize, valueSize, onSuccess); } Result getParameterImpl( uint32_t paramSize, const void* paramData, uint32_t requestValueSize, uint32_t replyValueSize, GetParameterSuccessCallback onSuccess); Result setParameterImpl( uint32_t paramSize, const void* paramData, uint32_t valueSize, const void* valueData); private: friend struct VirtualizerEffect; // for getParameterImpl friend struct VisualizerEffect; // to allow executing commands Loading @@ -170,8 +188,6 @@ struct Effect : public IEffect { using CommandSuccessCallback = std::function<void()>; using GetConfigCallback = std::function<void(Result retval, const EffectConfig& config)>; using GetCurrentConfigSuccessCallback = std::function<void(void* configData)>; using GetParameterSuccessCallback = std::function<void(uint32_t valueSize, const void* valueData)>; using GetSupportedConfigsSuccessCallback = std::function<void(uint32_t supportedConfigs, void* configsData)>; Loading Loading @@ -220,11 +236,6 @@ struct Effect : public IEffect { void getConfigImpl(int commandCode, const char* commandName, GetConfigCallback cb); Result getCurrentConfigImpl( uint32_t featureId, uint32_t configSize, GetCurrentConfigSuccessCallback onSuccess); Result getParameterImpl( uint32_t paramSize, const void* paramData, uint32_t valueSize, GetParameterSuccessCallback onSuccess); Result getSupportedConfigsImpl( uint32_t featureId, uint32_t maxConfigs, Loading Loading @@ -252,8 +263,6 @@ struct Effect : public IEffect { const EffectConfig& config, const sp<IEffectBufferProviderCallback>& inputBufferProvider, const sp<IEffectBufferProviderCallback>& outputBufferProvider); Result setParameterImpl( uint32_t paramSize, const void* paramData, uint32_t valueSize, const void* valueData); }; } // namespace implementation Loading
audio/effect/2.0/default/EffectsFactory.cpp +6 −4 Original line number Diff line number Diff line Loading @@ -95,7 +95,7 @@ restart: status = EffectQueryNumberEffects(&numEffects); if (status != OK) { retval = Result::NOT_INITIALIZED; ALOGW("Error querying number of effects: %s", strerror(-status)); ALOGE("Error querying number of effects: %s", strerror(-status)); goto exit; } result.resize(numEffects); Loading @@ -105,7 +105,7 @@ restart: if (status == OK) { effectDescriptorFromHal(halDescriptor, &result[i]); } else { ALOGW("Error querying effect at position %d / %d: %s", ALOGE("Error querying effect at position %d / %d: %s", i, numEffects, strerror(-status)); switch (status) { case -ENOSYS: { Loading Loading @@ -139,7 +139,7 @@ Return<void> EffectsFactory::getDescriptor(const Uuid& uid, getDescriptor_cb _hi effectDescriptorFromHal(halDescriptor, &descriptor); Result retval(Result::OK); if (status != OK) { ALOGW("Error querying effect descriptor for %s: %s", ALOGE("Error querying effect descriptor for %s: %s", uuidToString(halUuid).c_str(), strerror(-status)); if (status == -ENOENT) { retval = Result::INVALID_ARGUMENTS; Loading Loading @@ -168,11 +168,13 @@ Return<void> EffectsFactory::createEffect( effect = dispatchEffectInstanceCreation(halDescriptor, handle); effectId = EffectMap::getInstance().add(handle); } else { ALOGE("Error querying effect descriptor for %s: %s", uuidToString(halUuid).c_str(), strerror(-status)); EffectRelease(handle); } } if (status != OK) { ALOGW("Error creating effect %s: %s", uuidToString(halUuid).c_str(), strerror(-status)); ALOGE("Error creating effect %s: %s", uuidToString(halUuid).c_str(), strerror(-status)); if (status == -ENOENT) { retval = Result::INVALID_ARGUMENTS; } else { Loading