views:

545

answers:

2

I have a .NET CF library that produces PCM formatted data stream (as Stream object) from an MP3 file. I want to make my Windows Mobile phone to play the podcast I decode with that library. How can I play the PCM stream? I have tried PlaySound pinvoke stuff but does not work. It expects the entire song to be in memory as a WAVE file, which is not that good since just the compressed podcast is 30MB.

I was thinking of slicing the stream to chunks and appending the WAVE header to each chunk and playing one chunk after the other. But I did not succeed with that yet.

+1  A: 

If you have .NET 3.5 then you could use the SoundPlayer component.

From the MSDN:

The SoundPlayer class provides a simple interface for loading and playing a .wav file. The SoundPlayer class supports loading a .wav file from a file path, a URL, a Stream that contains a .wav file, or an embedded resource that contains a .wav file.

Shay Erlichmen
+1  A: 

I'm trying to do the same thing. I'm having an WAV/LPCM stream that I want to play. Still no solution.

Maybe possible to port this low level player to .NET CF, and play the wav file in smaller chunks: http://www.codeproject.com/KB/audio-video/cswavplay.aspx?msg=1200579

Keep me updated.

Btw, forgot to mention: SoundPlayer works just as PlaySound, it loads the entire wav file into memory before playing it.