locked
play sound

    Question

  • I want to write some to play sound.

    I found various sample and it won't be difficult but.. it left me puzzled...

    Some sample use IXAudio2 and some other use IMFMediaEngineEx.
    Which one would be my best choice?

    I see that IMFMediaEngineEx plays everything (sound and video), what else plays video?

    On these page I found out there are so many thing to do that...
    http://social.msdn.microsoft.com/Forums/en-US/windowspro-audiodevelopment/thread/2558b1fa-539f-44d2-b2d1-2c9eaebf7c9e

    I'm mostly interested in the most advanced / complete / simple solution for Windows 8

    Monday, February 4, 2013 3:57 PM

Answers

  • XAudio2 is intended for doing real-time audio mixing, sound effects, and complex sound processing as is common in games. If you are just trying to play a WAV file or play audio & video sync'd, then Media Foundation is the best solution.

    The 'lowest' level audio API is Windows Core Audio (WASAPI) which really for scenarios where you have your own mixer.


    Monday, February 4, 2013 9:29 PM
  • XAudio2 is the way to go.  Start with the sample and it is one days work to get things working.

    one thing with the sample is that if you don't have headphones or a speaker plugged in the initialization will fail and return null and the sample framework will crash when you try to play a sound.  I luckily caught that before my game went live. it could have easily been a lot of mysterious crashes if I had missed that.

    hope that helps!


    http://www.puttnutz.com

    • Marked as answer by Lloyd Friday, February 8, 2013 11:22 AM
    Thursday, February 7, 2013 10:36 PM

All replies

  • XAudio2 is intended for doing real-time audio mixing, sound effects, and complex sound processing as is common in games. If you are just trying to play a WAV file or play audio & video sync'd, then Media Foundation is the best solution.

    The 'lowest' level audio API is Windows Core Audio (WASAPI) which really for scenarios where you have your own mixer.


    Monday, February 4, 2013 9:29 PM
  • Thanks Chuck, it' a little clearer now! :)
    Tuesday, February 5, 2013 2:15 AM
  • XAudio2 is the way to go.  Start with the sample and it is one days work to get things working.

    one thing with the sample is that if you don't have headphones or a speaker plugged in the initialization will fail and return null and the sample framework will crash when you try to play a sound.  I luckily caught that before my game went live. it could have easily been a lot of mysterious crashes if I had missed that.

    hope that helps!


    http://www.puttnutz.com

    • Marked as answer by Lloyd Friday, February 8, 2013 11:22 AM
    Thursday, February 7, 2013 10:36 PM
  • Thanks for the tip, it is good! :)
    Friday, February 8, 2013 11:22 AM