Effects enable/disable

Last post 05-09-2008, 8:17 PM by phoo. 1 replies.
Sort Posts: Previous Next
  •  04-30-2008, 1:46 PM

    Effects enable/disable

    Hi,

    I have playing around with effects a little bit and came across few problems. I will appreciate if someone can point me in the right direction.

    Application: My current application creates a custom effect derived from CXAPOBase and CXAPOParametersBase classes. And I have a chain of 3 such effects attached to a submix voice. The first effects takes 1 channel as input and outputs 2 channel. The other two effects has 2 input channels and 2 output channels. Now I want to be able to enable and disable this effect to show how different effects modify the input audio. Below are the issues I am facing.

    1) Even if I set the InitialState of the descriptor to false. The effect still gets applied.

      descriptor[0].InitialState = false;
      descriptor[1].InitialState = false;

      XAUDIO2_EFFECT_CHAIN eChain;
      eChain.EffectCount = 2;
      eChain.pEffectDescriptors = descriptor;

    In my case, i am basically taking a 1 input stream and panning it. So even if I set the initial state to false. I can still hear the panning as I move the sound source.

    2) EnableEffect() and DisableEffect() are not working. I am not sure if it related to the above problem. But when I try to DisableEffect(i) on the SubmixVoice I have the effects attached to, it does nothing.

    Thanks,
    Anish
  •  05-09-2008, 8:17 PM

    Re: Effects enable/disable

    How being enabled is handled is done by the effect itself. "BOOL IsEnabled" is a parameter of the IXAPO::Process() call (the base interface defined in XAPO.h). In other words it's totally up to the custom effect's implementation what to do whatever it needs to do for the given state.

    The InitialState is just that, with EnableEffect and DisableEffect simply setting that value TRUE or FALSE at a later time.

    For example, the first effect has one input channel and two output channels. What should it do when disabled? Normally a channel converter would need to continue doing the channel conversion even when disabled or there could be a channel mismatch error with the next effect (it is expecting channel data). Of course the effect could be implemented to not send at all when disabled (silence).

    Check the custom effects' implementations of Process() to see that they're handling IsEnabled as expected.

View as RSS news feed in XML
©2007 Microsoft Corporation. All rights reserved. Privacy Statement Terms of Use Code of Conduct Feedback