Following up from a previous thread "AudioEffect integration"

Does anyone know the/a preferred way for an application to apply an
effect to the global output mix, and for the effect to remain applied
persistently (i.e. until removed).
On first thought I assume that the application that created the global
effect needs to remain alive.

In my testing I've noticed that when my Java app exits, the global
effect successfully continues to process audio playing on the device,
but I notice in the process list (in the Eclipse Devices tab) that my
application is still running. I understand this is not the Java
application, but the linux/C process that is still running.

If I manually [stop] this process, my global effect ceases (I can no
longer hear the effects of its processing). Therefore I assume that
this could also have occured if my process was killed by the system to
recover resources later on.

So my question is: Would I need to ensure my application continues to
run (e.g. using a background service) so that the effect (or the
process responsible for it) does not get cleaned up?




On Jan 22, 4:29 am, Eric Laurent <elaur...@android.com> wrote:
> Hi,
>
> There is no other documentation onaudioeffects framework than the
> java doc for APIs
> and the comments in EffectApi.h foreffectengine implementers.
>
> You are almost correct when saying that "effects are applied either
> per-track before mixing, or on the output mix".
> The exact statement would be that "INSERT effects are applied either
> perAUDIOSESSION before mixing, or on the output mix".
> With the exception ofaudiosession 0 which by convention refers to
> the output mix,  anaudiosession refers to either an AudioTrack or a
> group of
> AudioTracks. An inserteffectcreated on a particular session applies
> to all AudioTracks in that session.
> Now the AUXILIARY effects (currently only the Reverb when attached to
> output mix - session 0) are handled differently. An Auxiliaryeffect
> will process several inputs from AudioTracks (or MediaPlayers) and
> accumulate the result to the output mix. When the auxiliaryeffectis
> created, it will not process anything by default. An AudioTrack must
> be explicitly sent to the theeffectwith the attachAuxEffect
> method(). Then the amount of signal sent to theeffectis modified by
> the
> setAuxEffectSendLevel() method. This means that the AudioTrack has a
> WET path (going though theeffect) and a DRY path going directly to
> the output mix. So, yes, although instantiated on the session 0
> (output mix), auxiliary effects do not
> apply equally to all sources.
>
> The statement "sameeffectengine being used multiple times" means
> that INSIDE A GIVENAUDIOSESSION, the sameeffectengine is reused if
> 2 applications create 2 instances of a the sameeffecttype.
>
> There is no built-in mechanism in the framework to ensure that effects
> applied in different sessions do not conflict with each other.
> However, currenteffectlibrary implementation has an optimized
> processing when multiple effects are applied within the same session.
> It is up to to the implementor of platform specificeffectlibraries
> that would replace the default ones to add this type of optimizations.
>
> A similar reply applies to your last question. Theeffectengines are
> notified by theeffectframeworks ofaudiodevice changes. It is up to
> the implementor to alter the process according to the type of device
> or devices connected.
> For instance, current virtualizer implementation behaves differently
> whether headphones are connected or not.
>
> Hope this helps.
>
> Eric.
>
> > per-track before mixing, or on the output mix
>
> On Jan 20, 2:55 pm, eugene <eugene.ar...@dolby.com> wrote:
>
>
>
>
>
>
>
> > Hi
> > I'm looking to add some new AudioEffects into the framework and also
> > get a good understanding of the implementation architecture of the
> > AudioEffects framework.
> > I can't find any documentation about these. Is there any publicly
> > available that I've missed?
>
> > Specifically I'm not clear on how the Effects framework instantiates
> > effects when the sameeffectis applied to multiple tracks. Looking at
> > the AudioFlinger source code, it seems like effects are applied either
> > per-track before mixing, or on the output mix from the mixer. This all
> > makes sense, but the higher level APIs/Java API refers to:
> > * sameeffectengine being used multiple times
> > * CPU load limiting to allocate effects to particular users
> > * and some "connectMode" (EFFECT_INSERT or EFFECT_AUXILIARY), the
> > ultimate purpose/implementation of which I'm unsure.
> > In general, I'm not sure what this means for the implementation.
> > The documentation states that an EFFECT_AUXILIARYeffectmust be
> > created on the global output mix, but then implies that a media player
> > oraudiotrack will only be "fed into thiseffect" if they are
> > explicitly attached and a send-level is specified. How can aneffect
> > that is configured for session 0 (global output mix) end up not
> > applying to anaudiotrack from an application? Does it get mixed
> > seperately inAudioFlinger?
>
> > Also, is there a way to enforce that effects don't end up conflicting
> > with eachother? e.g. Bass enhancement applying on anAudioTrack and a
> > Bass enhancementeffecton the global output mix.
>
> > Finally, what doAudioEffectimplementations need to consider for the
> > case that the output device is transitioning from one to another (e.g.
> > speaker to bluetooth headset), or when 2 output devices are being used
> > at the same time (e.g. when ringtone plays it can play over speaker
> > and bluetooth headset simultaneously).
>
> > Thanks
> > Eugene

-- 
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: http://groups.google.com/group/android-porting

Reply via email to