by Arne Elster (23 Submissions)
Category: Sound/MP3
Difficulty: Advanced
Date Added: Wed 3rd February 2021
Rating:
(2 Votes)
This shows how to play MP3s and WMAs directly from resources without writing them to disk first.
For decoding it uses the functions of the Windows Media Format SDK v9, wich ships with all Windows Media Players >= v9 (or google for "wmfdist.exe").
It allocates some memory, copies the sound from the resource to that memory,
and plays it using DirectSound. You can control volume, balance and position.
As the DirectSound stream uses an Windows API timer,
debugging is pretty hard. You might be better off if you put the whole playback stuff into a DLL.