DirectXTK icon indicating copy to clipboard operation
DirectXTK copied to clipboard

Audio play mp3 Enhancement

Open cpyburn opened this issue 4 years ago • 5 comments

Would be awesome if you added mp3 support to the audio.

cpyburn avatar Jun 25 '21 16:06 cpyburn

The SoundStreamInstance class is designed to stream content from XACT WaveBanks, so that class will only support what XACT did: PCM, ADPCM, xWMA, and XMA2 (Xbox only).

For MP3 you can use DynamicSoundEffectInstance to integrate into the DirectX Tool Kit for Audio if you have a decompression library for the format. I don't have an explicit tutorial on this, but I should so I'll make this issue a doc request. I do have this implemented using WMA via MediaFoundation in the test suite.

I also have a Xaudio2 sample (i.e. doesn't use DirectX Tool Kit for Audio) for WMA here.

Note that due to patent issues, my tutorial on additional compressed streaming formats would likely not be MP3 but Ogg Vorbis instead, but the basic pattern would apply to any audio decompression library that produces PCM data. For background on the concerns here, see wikipedia.

walbourn avatar Jun 25 '21 20:06 walbourn

It looks like there's an Ogg Vorbis library on NuGet I could use for the tutorial here:

https://www.nuget.org/packages/ogg-msvc-x64/

https://www.nuget.org/packages/ogg-msvc-x86/

walbourn avatar Jun 25 '21 20:06 walbourn

The SoundStreamInstance class is designed to stream content from XACT WaveBanks, so that class will only support what XACT did: PCM, ADPCM, xWMA, and XMA2 (Xbox only).

For MP3 you can use DynamicSoundEffectInstance to integrate into the DirectX Tool Kit for Audio if you have a decompression library for the format. I don't have an explicit tutorial on this, but I should so I'll make this issue a doc request. I do have this implemented using WMA via MediaFoundation in the test suite.

I also have a Xaudio2 sample (i.e. doesn't use DirectX Tool Kit for Audio) for WMA here.

Note that due to patent issues, my tutorial on additional compressed streaming formats would likely not be MP3 but Ogg Vorbis instead, but the basic pattern would apply to any audio decompression library that produces PCM data. For background on the concerns here, see wikipedia.

Awesome, will you update here once you have the document completed?

cpyburn avatar Jun 25 '21 22:06 cpyburn

Yes.

walbourn avatar Jun 26 '21 04:06 walbourn

Hey Chuck, I was about to give this a shot. I see that you posted some helpful links previously but haven't gotten around to the documentation. Just curious if this is still on your radar or if I should just try to backwards engineer what you have already done?

"I do have this implemented using WMA via MediaFoundation in the test suite."

cpyburn avatar May 25 '22 20:05 cpyburn