locked
XAudio2 - How to achieve 'set position' behavior? Need to forward and rewind audio.

    Question

  • Hello all!

    I am working on a music-based Windows Store App. The UI and app logic are built over C# and XAML and the audio components are built using C++. We are using XAudio2 for playback and WASAPI for audio recording.

    We are able to play and stop music as well as record music properly. Now, we are faced with another requirement, namely jumping forward and back in time. On click of corresponding buttons, we need to jump forward or back by 10 seconds at a time.

    I was not able to find any XAudio2 function that would do this off the shelf. It would be awesome if I could get some pointers here!

    A related question would be:

    Is there a way to submit a voice that would play after say 25 seconds? Is it possible to set this time delay value along with the voice, or should we have to maintain a timer to trigger the voice manually after 25 seconds?

    TIA!

    Shankar

    Thursday, February 21, 2013 10:03 AM

Answers

  • With the XAUDIO2 submission model, ideally you would just submit 10 seconds of audio data to a SourceVoice at any given time and then you can handle the 'position' issues as part of your handling of the audio data/packet submission.

    You could make use of command sets and use an app timer to trigger them.

    • Marked as answer by Jesse Jiang Wednesday, February 27, 2013 2:02 AM
    Thursday, February 21, 2013 9:10 PM