Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

MP3 to PCM and playback with waveOutWrite

20 views
Skip to first unread message

dim....@gmail.com

unread,
May 12, 2008, 3:11:16 AM5/12/08
to
I have an existing C++ program which plays wav files using windows API
waveOutWrite() functions. The wave file samples are read using direct
file I/O (fopen, fread). The PCM samples are processed in the program
before being sent to the sound card for playback.

So:

PCM wav file -> read PCM samples -> process samples -> send to sound
card.

The program works fine, and supports skipping in time and other
playback controls, which are implemented by manipulating the file
pointer.

I need to change this program to support MP3 files. Preferably it
should support any compressed audio for which there is a codec
installed on the system. So I need to read the file (MP3 or other
format) in small chunks, convert them to PCM samples, process them and
then output the samples to the sound card using waveOutWrite() as per
the existing program. Also the new mechanism should still support
uncompressed wav files.

What is the best way for me to adapt this program to support MP3? I've
read a bit about ACM, DirectSound and MCI and I am unsure as what is
the best thing for me to use. I want the API to work out what type of
file it is and do the conversion to PCM samples for me, so I can plug
them into my existing code. I don't want to have to convert the whole
compressed file to PCM in memory because the files might be quite
large (1 hour +), so I need to convert just small chunks at a time.

The least effort option is preferable. I don't want to have to re-
write the whole program.

Hope someone can help me soon!

0 new messages