Lines Matching defs:effect

92 // 0; but one side effect of this is to turn all LOGV's as well.  Some messages
483 // check if an effect chain with the same session ID is present on another
508 // move effect chain to this output thread if an effect on same session was waiting
1489 ALOGV("updateSuspendedSessions_l() suspend adding effect %08x", key);
1498 ALOGV("updateSuspendedSessions_l() restore removing effect %08x", key);
1512 void AudioFlinger::ThreadBase::checkSuspendOnEffectEnabled(const sp<EffectModule>& effect,
1517 checkSuspendOnEffectEnabled_l(effect, enabled, sessionId);
1520 void AudioFlinger::ThreadBase::checkSuspendOnEffectEnabled_l(const sp<EffectModule>& effect,
1525 // suspend all effects in AUDIO_SESSION_OUTPUT_MIX when enabling any effect on
1526 // another session. This gives the priority to well behaved effect control panels
1537 chain->checkSuspendOnEffectEnabled(effect, enabled);
2106 // force reconfiguration of effect chains and engines to take new buffer size and audio
2109 // but in this case nothing is done below as no audio sessions have effect yet so it doesn't
2111 // create a copy of mEffectChains as calling moveEffectChain_l() can reorder some effect chains
2635 // prevent any changes in effect chain list and in each effect chain
2636 // during mixing and effect process as the audio buffers could be deleted
2637 // or modified if an effect is created or deleted
2659 // enable changes in effect chain
2896 // TODO add standby time extension fct of effect tail
2919 // Delegate master volume control to effect in output mix effect chain if needed
3132 // track->mainBuffer() != mMixBuffer means there is an effect chain
3137 // Delegate volume control to effect in track effect chain if needed
3141 ALOGW("prepareTracks_l(): track %d attached to effect but no chain found on session %d",
3201 // Delegate volume control to effect in track effect chain if needed
3203 // Do not ramp volume if volume is controlled by effect
3208 // from effect chain to avoid volume spike
3264 // clear effect chain input buffer if an active track underruns to avoid sending
3376 // effect chain as in this case the mixer will not write to
3772 // Delegate volume control to effect in track effect chain if needed
3773 // only one effect chain can be present on DirectOutputThread, so if
3776 // Do not ramp volume if volume is controlled by effect
3789 // clear effect chain input buffer if an active track underruns to avoid sending
4744 sp<EffectModule> effect = chain->getEffectFromId_l(EffectId);
4745 if (effect == 0) {
4748 srcThread->removeEffect_l(effect);
4749 playbackThread->addEffect_l(effect);
4750 // removeEffect_l() has stopped the effect if it was active so it must be restarted
4751 if (effect->state() == EffectModule::ACTIVE ||
4752 effect->state() == EffectModule::STOPPING) {
4753 effect->start();
4756 sp<EffectChain> dstChain = effect->chain().promote();
4758 srcThread->addEffect_l(effect);
4761 AudioSystem::unregisterEffect(effect->id());
4762 AudioSystem::registerEffect(&effect->desc(),
4766 effect->id());
6209 // enable changes in effect chain
7351 sp<EffectModule> effect = ec->mEffects[0];
7352 effect->unPin();
7353 t->removeEffect_l(effect);
7354 if (effect->purgeHandles()) {
7355 t->checkSuspendOnEffectEnabled_l(effect, false, effect->sessionId());
7357 AudioSystem::unregisterEffect(effect->id());
7522 // if uuid is specified, request effect descriptor
7530 // of the required type in effect factory
7532 ALOGW("createEffect() no effect type");
7553 // If matching type found save effect descriptor. If the session is
7554 // 0 and the effect is not auxiliary, continue enumeration in case
7555 // an auxiliary version of this effect type is available
7566 ALOGW("createEffect() effect not found");
7569 // For same effect type, chose auxiliary version over insert version if
7591 // return effect descriptor
7598 // Note: io is never 0 when creating an effect on an input
7616 // first output. The effect chain will be moved to the correct output
7621 ALOGV("createEffect() got io %d for effect %s", io, desc.name);
7635 // create effect on selected output thread
7689 ALOGW("moveEffectChain_l() effect chain for session %d not on source thread %p",
7694 // remove chain first. This is useful only if reconfiguring effect chain on same output thread,
7695 // so that a new chain is created with correct parameters when first effect is added. This is
7696 // otherwise unnecessary as removeEffect_l() will remove the chain when last effect is
7700 // transfer all effects one by one so that new effect chain is created on new thread with
7701 // correct buffer sizes and audio parameters and effect engines reconfigured accordingly
7705 sp<EffectModule> effect = chain->getEffectFromId_l(0);
7706 while (effect != 0) {
7707 srcThread->removeEffect_l(effect);
7708 dstThread->addEffect_l(effect);
7709 // removeEffect_l() has stopped the effect if it was active so it must be restarted
7710 if (effect->state() == EffectModule::ACTIVE ||
7711 effect->state() == EffectModule::STOPPING) {
7712 effect->start();
7714 // if the move request is not received from audio policy manager, the effect must be
7717 dstChain = effect->chain().promote();
7719 ALOGW("moveEffectChain_l() cannot get chain from effect %p", effect.get());
7720 srcThread->addEffect_l(effect);
7726 AudioSystem::unregisterEffect(effect->id());
7727 AudioSystem::registerEffect(&effect->desc(),
7731 effect->id());
7733 effect = chain->getEffectFromId_l(0);
7751 sp<EffectModule> effect;
7768 ALOGW("createEffect_l() Cannot add auxiliary effect %s to session %d",
7775 ALOGW("createEffect_l() effect %s (flags %08x) created on wrong thread type %d",
7781 ALOGV("createEffect_l() thread %p effect %s on session %d", this, desc->name, sessionId);
7786 // check for existing effect chain with the requested audio session
7790 ALOGV("createEffect_l() new effect chain for session %d", sessionId);
7796 effect = chain->getEffectFromDesc_l(desc);
7799 ALOGV("createEffect_l() got effect %p on chain %p", effect.get(), chain.get());
7801 if (effect == 0) {
7809 // create a new effect module if none present in the chain
7810 effect = new EffectModule(this, chain, desc, id, sessionId);
7811 lStatus = effect->status();
7815 lStatus = chain->addEffect_l(effect);
7821 effect->setDevice(mOutDevice);
7822 effect->setDevice(mInDevice);
7823 effect->setMode(mAudioFlinger->getMode());
7824 effect->setAudioSource(mAudioSource);
7826 // create effect handle and connect it to effect module
7827 handle = new EffectHandle(effect, client, effectClient, priority);
7828 lStatus = effect->addHandle(handle.get());
7830 *enabled = (int)effect->isEnabled();
7838 chain->removeEffect_l(effect);
7841 AudioSystem::unregisterEffect(effect->id());
7869 status_t AudioFlinger::ThreadBase::addEffect_l(const sp<EffectModule>& effect)
7871 // check for existing effect chain with the requested audio session
7872 int sessionId = effect->sessionId();
7878 ALOGV("addEffect_l() new effect chain for session %d", sessionId);
7884 ALOGV("addEffect_l() %p chain %p effect %p", this, chain.get(), effect.get());
7886 if (chain->getEffectFromId_l(effect->id()) != 0) {
7887 ALOGW("addEffect_l() %p effect %s already present in chain %p",
7888 this, effect->desc().name, chain.get());
7892 status_t status = chain->addEffect_l(effect);
7900 effect->setDevice(mOutDevice);
7901 effect->setDevice(mInDevice);
7902 effect->setMode(mAudioFlinger->getMode());
7903 effect->setAudioSource(mAudioSource);
7907 void AudioFlinger::ThreadBase::removeEffect_l(const sp<EffectModule>& effect) {
7909 ALOGV("removeEffect_l() %p effect %p", this, effect.get());
7910 effect_descriptor_t desc = effect->desc();
7912 detachAuxEffect_l(effect->id());
7915 sp<EffectChain> chain = effect->chain().promote();
7917 // remove effect chain if removing last effect
7918 if (chain->removeEffect_l(effect) == 0) {
7922 ALOGW("removeEffect_l() %p cannot promote chain for effect %p", this, effect.get());
7969 void AudioFlinger::ThreadBase::disconnectEffect(const sp<EffectModule>& effect,
7974 ALOGV("disconnectEffect() %p effect %p", this, effect.get());
7975 // delete the effect module if removing last handle on it
7976 if (effect->removeHandle(handle) == 0) {
7977 if (!effect->isPinned() || unpinIfLast) {
7978 removeEffect_l(effect);
7979 AudioSystem::unregisterEffect(effect->id());
7992 // Only one effect chain can be present in direct output thread and it uses
8025 // Effect chain for session AUDIO_SESSION_OUTPUT_STAGE is inserted at end of effect
8032 // Effect chain for other sessions are inserted at beginning of effect
8096 sp<EffectModule> effect = getEffect_l(AUDIO_SESSION_OUTPUT_MIX, EffectId);
8097 if (effect != 0) {
8098 if ((effect->desc().flags & EFFECT_FLAG_TYPE_MASK) == EFFECT_FLAG_TYPE_AUXILIARY) {
8099 track->setAuxBuffer(EffectId, (int32_t *)effect->inBuffer());
8175 // create effect engine from effect factory
8209 // release effect engine
8231 // if inserted in first place, move effect control from previous owner to this handle
8262 // if removed from first place, move effect control from this handle to next in line
8270 // Prevent calls to process() and other functions on effect interface from now on.
8271 // The effect engine will be released by the destructor when the last strong reference on
8318 // clear auxiliary effect input buffer for next accumulation
8356 // do 32 bit to 16 bit conversion for auxiliary effect input buffer
8363 // do the actual processing in the effect engine
8373 // clear auxiliary effect input buffer for next accumulation
8380 // If an insert effect is idle and input buffer is different from output buffer,
8433 // Insert effect:
8437 // last effect in the chain accumulates in output buffer: input buffer != output buffer
8438 // other effect: overwrites output buffer: input buffer == output buffer
8439 // Auxiliary effect:
8816 handle->effect().clear();
8914 AudioFlinger::EffectHandle::EffectHandle(const sp<EffectModule>& effect,
8919 mEffect(effect), mEffectClient(effectClient), mClient(client), mCblk(NULL),
8973 // checkSuspendOnEffectEnabled() can suspend this same effect when enabled
9055 // only get parameter command is permitted for applications not controlling the effect
9062 // handle commands that are not forwarded transparently to effect engine
9223 // by convention, return first effect if id provided is 0 (0 is never a valid id)
9274 // always process effects unless no more tracks are on the session and the effect tail
9285 // if no track is active and the effect tail has not been rendered,
9308 status_t AudioFlinger::EffectChain::addEffect_l(const sp<EffectModule>& effect)
9310 effect_descriptor_t desc = effect->desc();
9314 effect->setChain(this);
9319 effect->setThread(thread);
9324 mEffects.insertAt(effect, 0);
9326 // the input buffer for auxiliary effect contains mono samples in
9329 // calling the process in effect engine
9333 effect->setInBuffer((int16_t *)buffer);
9336 effect->setOutBuffer(mInBuffer);
9340 // Insert effect order as a function of indicated preference:
9342 // another effect is present
9344 // last effect claiming first position
9346 // first effect claiming last position
9348 // Reject insertion if an effect with EFFECT_FLAG_INSERT_EXCLUSIVE is
9361 // check invalid effect chaining combinations
9364 ALOGW("addEffect_l() could not insert effect %s: exclusive conflict with %s", desc.name, d.name);
9367 // remember position of first insert effect and by default
9368 // select this as insert position for new effect
9372 // remember position of last insert effect claiming
9377 // remember position of first insert effect claiming
9400 effect->setInBuffer(mInBuffer);
9402 // if last effect in the chain, output samples to chain
9409 effect->setOutBuffer(mOutBuffer);
9411 effect->setOutBuffer(mInBuffer);
9413 mEffects.insertAt(effect, idx_insert);
9415 ALOGV("addEffect_l() effect %p, added in chain %p at rank %d", effect.get(), this, idx_insert);
9417 effect->configure();
9422 size_t AudioFlinger::EffectChain::removeEffect_l(const sp<EffectModule>& effect)
9426 uint32_t type = effect->desc().flags & EFFECT_FLAG_TYPE_MASK;
9429 if (effect == mEffects[i]) {
9430 // calling stop here will remove pre-processing effect from the audio HAL.
9438 delete[] effect->inBuffer();
9446 ALOGV("removeEffect_l() effect %p, removed from chain %p at rank %d", effect.get(), this, i);
9564 sp<EffectModule> effect = mEffects[i];
9565 if (effect != 0) {
9566 effect->dump(fd, args);
9580 // use effect type UUID timelow as key as there is no real risk of identical
9581 // timeLow fields among effect type UUIDs.
9593 sp<EffectModule> effect = getEffectIfEnabled(type);
9594 if (effect != 0) {
9595 desc->mEffect = effect;
9596 effect->setSuspended(true);
9597 effect->setEnabled(false);
9612 sp<EffectModule> effect = desc->mEffect.promote();
9613 if (effect != 0) {
9614 effect->setSuspended(false);
9615 effect->lock();
9616 EffectHandle *handle = effect->controlHandle_l();
9618 effect->setEnabled_l(handle->enabled());
9620 effect->unlock();
9677 // The volume effect is used for automated tests only
9709 sp<EffectModule> effect = getEffectFromType_l(type);
9710 return effect != 0 && effect->isEnabled() ? effect : 0;
9713 void AudioFlinger::EffectChain::checkSuspendOnEffectEnabled(const sp<EffectModule>& effect,
9716 ssize_t index = mSuspendedEffects.indexOfKey(effect->desc().type.timeLow);
9719 // if the effect is not suspend check if all effects are suspended
9724 if (!isEffectEligibleForSuspend(effect->desc())) {
9727 setEffectSuspended_l(&effect->desc().type, enabled);
9728 index = mSuspendedEffects.indexOfKey(effect->desc().type.timeLow);
9735 effect->desc().type.timeLow);
9737 // if effect is requested to suspended but was not yet enabled, supend it now.
9739 desc->mEffect = effect;
9740 effect->setEnabled(false);
9741 effect->setSuspended(true);
9748 effect->desc().type.timeLow);
9751 effect->setSuspended(false);