locked
How to change the speed of playing music with xaudio2?

    Question

  • Hi, I'm working on a music game for windows store.

    I use xaudio2 to play sound.

    Now I need to achieve a feature that can change the music speed, but I don't know how to do.

    Any help will be appreciated.

    Thanks.

    Sunday, June 29, 2014 9:44 AM

All replies

  • I'll ask James to check out this post.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Monday, June 30, 2014 7:40 PM
    Moderator
  • Hello,

    I think this is what you are looking for:

    How to: Change Voice Pitch

    http://msdn.microsoft.com/en-us/library/windows/desktop/ee415785(v=vs.85).aspx

    I hope this helps,

    James


    Windows SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    Monday, June 30, 2014 9:58 PM
    Moderator
  • Thanks for your reply.
    Thursday, July 03, 2014 3:00 AM
  • I have tried this, but it didn't work.

    I set frequency ratio like this:

    musicSourceVoice->SetFrequencyRatio(0.1f);

    And CreateSourceVoice like this:

    musicEngine->CreateSourceVoice(&musicSourceVoice, &waveFormat, 0, 2.0f, nullptr, nullptr, nullptr));

    Nothing thanged whatever ratio I set.I have tried set ratio from 0.1f to 1024.0f.

    Is there still anythine I need to do?

    Thursday, July 03, 2014 3:04 AM