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

manipulating an IXAudio2SourceVoice

Last post 7/13/2009 9:37 PM by Tom Wolle. 4 replies.
  • 7/12/2009 2:13 PM

    manipulating an IXAudio2SourceVoice

    Hi all,

    I need to create a voice like this:

    XAUDIO2_VOICE_STATE::SamplesPlayed = XAUDIO2_BUFFER::PlayBegin;

    Is that possible? Can I manipulate an IXAudio2SourceVoice like that?

    Or maybe even better,
    is there a way to get the sample (within the current buffer) the voice is at?

    Or is there a way to "reset" a voice other than destroying and re-creating it?

    Tom
  • 7/13/2009 12:47 AM In reply to

    Re: manipulating an IXAudio2SourceVoice

    This may not be the full story but when I was working on a project with XAudio2, I found that the only way to reset an IXAudio2SourceVoice without destroying it was to call SubmitSourceBuffer again.  If you still have buffers playing you need to call FlushSourceBuffers first.  I don't know weather this is a "smooth" way to do it meaning no clicks.
  • 7/13/2009 8:40 AM In reply to

    Re: manipulating an IXAudio2SourceVoice

    Atm I'm not really worried about "clicks".
    Just re-submitting or submitting a buffer in general doesn't "reset" the "samples played" member.
    I just need to know if it's even possible.
    Probably not, but then it would be interesting to know why.

    Tom
  • 7/13/2009 5:36 PM In reply to

    Re: manipulating an IXAudio2SourceVoice

    This is from the DirectX SDK documentation for XAUDIO2_VOICE_STATE.SamplesPlayed.

    Total number of samples processed by this voice since it was last started,or since the last audio stream ended (as marked with the XAUDIO2_END_OF_STREAMflag). This total includes samples played multiple times due to looping.Theoretically, if all audio emitted by the voice up to this time had beencaptured, this parameter would be the length of the audio stream in samples.


    So I guess if you used XAUDIO2_END_OF_STREAM it would work.
  • 7/13/2009 9:37 PM In reply to

    Re: manipulating an IXAudio2SourceVoice

    By now I'm 100% sure that it's not possible what I'm asking.
    So I need to do what I was afraid of...all the work ;)

    What you mentioned wouldn't help either since at another place in the SDK docs it states:

    XAUDIO2_END_OF_STREAM Indicates that there cannot be any buffers in the queue after this buffer. The only effect of this flag is to suppress debug output warnings caused by starvation of the buffer queue.

    Anyway, thanks for the help!

    Tom
Page 1 of 1 (5 items) Previous Next