Answered by:
Play an MP3 from file name

Question
-
Can someone provide a complete and reusable example of how to play an mp3 file in a XAML-less application, starting with only a Platform::String^ for the file name?
Software Engineer, Brainium Studios LLC
- Edited by brentAtBrainium Friday, May 4, 2012 11:09 PM
Friday, May 4, 2012 11:02 PM
Answers
-
Hello,
How about the XAudio sample code?
http://code.msdn.microsoft.com/windowsapps/Basic-Audio-Sample-9a5bb0b7Best regards,
JesseJesse Jiang [MSFT]
MSDN Community Support | Feedback to us
Monday, May 7, 2012 11:11 AM -
Hello Brent,
I agree with Jessie. I think that XAudio2 should work for you. You can also use the MediaEngine. I've linked to a couple of samples below that should hopefully should help. I believe this XAudio2 sample decompressed the audio files from mp3 but I haven't looked that closely at it. The ME sample is a bit complex but hopefully you can get what you need out of it.
XAudio2 audio stream effect sample
http://code.msdn.microsoft.com/windowsapps/XAudio2-Stream-Effect-3f95c8f2Media engine native C++ playback sample
http://code.msdn.microsoft.com/windowsapps/Media-Engine-Playback-ce1c82f0I hope this helps,
James
Windows Media SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/
- Proposed as answer by James Dailey - MSFTMicrosoft employee, Moderator Tuesday, May 8, 2012 12:45 AM
- Edited by James Dailey - MSFTMicrosoft employee, Moderator Tuesday, May 8, 2012 12:47 AM added text
- Marked as answer by Jesse Jiang Friday, May 18, 2012 7:03 AM
Tuesday, May 8, 2012 12:45 AMModerator
All replies
-
Hello,
How about the XAudio sample code?
http://code.msdn.microsoft.com/windowsapps/Basic-Audio-Sample-9a5bb0b7Best regards,
JesseJesse Jiang [MSFT]
MSDN Community Support | Feedback to us
Monday, May 7, 2012 11:11 AM -
That example deals with uncompressed wave files specifically. It doesn't support any sort of decoding.
Software Engineer, Brainium Studios LLC
Monday, May 7, 2012 2:45 PM -
Hello Brent,
I agree with Jessie. I think that XAudio2 should work for you. You can also use the MediaEngine. I've linked to a couple of samples below that should hopefully should help. I believe this XAudio2 sample decompressed the audio files from mp3 but I haven't looked that closely at it. The ME sample is a bit complex but hopefully you can get what you need out of it.
XAudio2 audio stream effect sample
http://code.msdn.microsoft.com/windowsapps/XAudio2-Stream-Effect-3f95c8f2Media engine native C++ playback sample
http://code.msdn.microsoft.com/windowsapps/Media-Engine-Playback-ce1c82f0I hope this helps,
James
Windows Media SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/
- Proposed as answer by James Dailey - MSFTMicrosoft employee, Moderator Tuesday, May 8, 2012 12:45 AM
- Edited by James Dailey - MSFTMicrosoft employee, Moderator Tuesday, May 8, 2012 12:47 AM added text
- Marked as answer by Jesse Jiang Friday, May 18, 2012 7:03 AM
Tuesday, May 8, 2012 12:45 AMModerator