XNA Creators Club Online
Page 1 of 1 (6 items)
Sort Posts: Previous Next

IXAudio2SubmixVoice->SetFilterParameters

Last post 05-04-2008 12:49 AM by Dugan. 5 replies.
  • 04-08-2008 6:04 PM

    IXAudio2SubmixVoice->SetFilterParameters


    Regarding Submix voices and filter parameters try the following:

    int main(array<System::String ^> ^args)
    {
      HRESULT hr = 0;
      IXAudio2* pIXAudio = NULL;
      IXAudio2MasteringVoice* pIMasterVoice = NULL;
      IXAudio2SubmixVoice* pISubmix = NULL;

      UINT32 Flags = 0;

    #ifdef _DEBUG
      Flags = XAUDIO2_DEBUG_ENGINE;
    #endif

      // Create XAudio2 object
      hr = XAudio2Create(&pIXAudio, Flags);

      if(FAILED(hr))
        return -1;

      // Create XAudio2 Mastering Voice
      hr = pIXAudio->CreateMasteringVoice(&pIMasterVoice);

      if(FAILED(hr))
      {
        // Give up and exit
        pIXAudio->Release();
        return -1;
      }

      // Create XAudio2 Submix Voice
      hr = pIXAudio->CreateSubmixVoice(&pISubmix, 2, 44100);

      if(FAILED(hr))
      {
        // Destroy Mastering voice
        pIMasterVoice->DestroyVoice();

        // Free XAudio2 object
        pIXAudio->Release();
      }

      XAUDIO2_FILTER_PARAMETERS xfp;
      xfp.Frequency = 0.2f;
      xfp.OneOverQ = 0.1f;
      xfp.Type = BandPassFilter;


      pISubmix->SetFilterParameters(&xfp);

      // clean up
      pISubmix->DestroyVoice();

      pIMasterVoice->DestroyVoice();

      pIXAudio->Release();

    return 0;
    }

    As soon as the SetFilterParameters method is called the following debug info is generated:

    XAUDIO2: Thread 320: 3331.162ms: CX2Voice::SetFilterParameters: Acquiring m_ApiLock at 0x01121FCC created by CX2Engine::InitializeLocks...
    XAUDIO2: Thread 320: 3331.354ms: CX2Voice::SetFilterParameters: Acquired m_ApiLock at 0x01121FCC created by CX2Engine::InitializeLocks
    XAUDIO2: Thread 320: 3336.649ms: x2voicebase.cpp:1082: IXAudio2Voice::SetFilterParameters: API call: Entry (this=0x011304F4)
    XAUDIO2: Thread 320: 3336.853ms: x2voicebase.cpp:1088: CX2Voice::SetFilterParameters: ERROR: Filter control is not available on this voice


    Now the documentation with the DirectX March 2008 SDK and indeed http://msdn2.microsoft.com/en-us/library/bb669181(VS.85).aspx states that submix voices support the SetFilterParameters method but http://msdn2.microsoft.com/en-us/library/bb694519(VS.85).aspx does not list SetFilterParameters as a method.

    Does anyone else recieve this information or are their requests successful?

    Thanks

    :)
  • 04-08-2008 10:42 PM In reply to

    Re: IXAudio2SubmixVoice->SetFilterParameters

    Looks to me like you forgot to use XAUDIO2_VOICE_USEFILTER in your CreateSubmixVoice call...
    Dugan Porter [MS]
    Game Audio Team
  • 04-09-2008 5:53 AM In reply to

    Re: IXAudio2SubmixVoice->SetFilterParameters

    That'll be because the DirectX SDK March 2008 documentation and http://msdn2.microsoft.com/en-us/library/bb633469(VS.85).aspx state that the flags parameter MUST be 0 (zero)!
  • 04-09-2008 4:32 PM In reply to

    Re: IXAudio2SubmixVoice-&gt;SetFilterParameters

    Answer

    Very good point!  The filter was originally only available on source voices, and when we decided to support it on submix voices as well we neglected to update the docs.  I'll get that fixed.  Sorry about the time-waster.

    Dugan

    Dugan Porter [MS]
    Game Audio Team
  • 04-09-2008 6:01 PM In reply to

    Re: IXAudio2SubmixVoice->SetFilterParameters

    Thanks Dugan, I'll change the source code accordingly. :)

    While you are at it could you also add GetFilterParameters and SetFilterParameters to the IXAudio2SubmixVoice interface methods on http://msdn2.microsoft.com/en-us/library/bb694519(VS.85).aspx?

    Thanks again.

    :)
  • 05-04-2008 12:49 AM In reply to

    Re: IXAudio2SubmixVoice->SetFilterParameters

    Done!  (For the June release.)

    Dugan Porter [MS]
    Game Audio Team
Page 1 of 1 (6 items) Previous Next
var gDomain='m.webtrends.com'; var gDcsId='dcschd84w10000w4lw9hcqmsz_8n3x'; var gTrackEvents=1; var gFpc='WT_FPC'; /*<\/scr"+"ipt>");} /*]]>*/
DCSIMG