|
-
October 24th, 2006, 12:49 AM
#1
Playing an MP3 from a buffer
Is it possible to play an MP3 from a buffer using MCI commands?
I know it can be played from a file on disk by specifing a file name in the lpstrElementName member of MCI_OPEN_PARMS but I need to play it directly from a buffer. Our application loads all its resources from a DLL and we don't want to create temporary files on disk at runtime.
Thank you.
-
October 26th, 2006, 05:06 AM
#2
Re: Playing an MP3 from a buffer
I was intrested in this some time ago also, and i did find somthing. Tho from memory it wasnt worth the effort for me and i forgot about it. I have no idea where i found it now but Ill keep looking
-
October 26th, 2006, 05:23 AM
#3
Re: Playing an MP3 from a buffer
Maybe the following article can help you (I'm not sure if it works with MP3 files):
How To Use MCI to Play AVI/WAVE Files from Memory
-
November 7th, 2006, 07:29 AM
#4
Re: Playing an MP3 from a buffer
Thank you for the link, I tried but I still can't make it work.
From what I understood only waveaudio and avivideo can be played from memory. I wrote a callback method to open/read/seek on a buffer and installed it. I read a file into that buffer and here is the funny thing: when I read a .wav file and play it like this:
Code:
mmioInstallIOProc(mmioFOURCC('M', 'E', 'Y', ' '), (LPMMIOPROC)IOProc, MMIO_INSTALLPROC | MMIO_GLOBALPROC);
mciSendString("open test.MEY+ type waveaudio alias test", 0, 0, 0);
mciSendString("play test", NULL, 0, 0);
it works fine, when I load an .mp3 file and play it with
Code:
mmioInstallIOProc(mmioFOURCC('M', 'E', 'Y', ' '), (LPMMIOPROC)IOProc, MMIO_INSTALLPROC | MMIO_GLOBALPROC);
mciSendString("open test.MEY+ type mpegvideo alias test", 0, 0, 0);
mciSendString("play test", NULL, 0, 0);
it doesn't work and I get a "Cannot find the specified file" error. Does anyone know any workaround for this? Or maybe another approach?
-
November 7th, 2006, 08:54 AM
#5
Re: Playing an MP3 from a buffer
I've never done it myself so I don't know why it is not working.
Do you have to use MCI?
Maybe you can use another audio library, for example fmod? Note, I have used fmod before but not for streaming from memory, so I'm not 100% sure if it works, but I think it should work. It's worth a try.
-
November 8th, 2006, 02:25 AM
#6
Re: Playing an MP3 from a buffer
I see fmod has a dll which must be shipped with the application, meaning I can't use it (it's not up to me).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|