Help needed, to play a mp3 file with Vortice.XAudio2 #445
shellohunter
started this conversation in
General
Replies: 1 comment
-
You need to ask other topics about how to use them, if you enable native debugging in visual studio you should probably see some error in output window. As said I maintain bindings but don't follow posting process. Thanks |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I spent another day trying to play a mp3 file with Vortice.XAudio2, no luck yet.
Here's my source code: https://gist.github.com/shellohunter/8158a170b479f17b0d93cf57eacb533e
It uses Vortice.MediaFoundation as the decoder, then submits decoded data to XAudio2.
I picked up some code from: https://github.com/walbourn/directx-sdk-samples/tree/main/XAudio2/XAudio2MFStream
which is written in cpp. There's a lot of macros I cannot find in vortice, so I have to made it myself.
AFAK, I should call SetCurrentMediaType on IMFSourceReader to specify the audio format I needed. the reader will load corresponding decoder internally, and give me the expected pcm stream. then I can submit pcm data to Xaudio2.
I haven't go far yet, since the program always went wrong at this line:
Vortice.MediaFoundation.MediaFactory.MFCreateMediaType throws SharpGen.Runtime.SharpGenException
These API are mystery for me. I've no idea how to debug. I googled around, and found barely nothing helpful. :-(
Beta Was this translation helpful? Give feedback.
All reactions