0

is there any better way to play Mp3 than mciSendString? mciSendString sucks, and hard to use in muilti-thread, eg.hard to get the current PlayingState

Brad
  • 159,648
  • 54
  • 349
  • 530
gpu
  • 129
  • 10
  • 1
    https://stackoverflow.com/q/4019733/362536 – Brad Apr 28 '19 at 23:42
  • Asking for a *"better way"* without explaining, what *"better"* is, will get this question closed off as primarily opinion based. Please provide a succinct specification of what you need, and why you believe that your current approach doesn't deliver. Do keep in mind that multithreading *is* hard, no matter how you approach it. – IInspectable Apr 29 '19 at 07:55
  • MciSendString is really bad for multithreading. If you just want to mix in real time, you can use DirectSound, but for now, this function can only be applied to old programs. In contrast, using new XAudio2 is a good choice. – Strive Sun Apr 29 '19 at 07:58

1 Answers1

1

I'd suggest DirectShow or Windows Media Foundation, since both have flexible APIs for file based playback (you won't have to deal with reading the file and understanding the format, looking up codecs etc.) and still expose playback control. See these articles:

  1. DirectShow and IGraphBuilder (very simple and straightforward) - How To Play a File
  2. How to Play Media Files with Media Foundation
  3. Link to example from the first link
Rudolfs Bundulis
  • 11,636
  • 6
  • 33
  • 71