1

I'm trying to play an MP3 sound but I need it played from a memory stream (I don't have the actual file). What's my best option to do this? mciSendString accepts a file name as a parameter but not a memory stream. Is is possible to play the mp3 file with winmm's PlaySound?

Thanks!

Cody Gray
  • 230,875
  • 49
  • 477
  • 553
Ron
  • 27
  • 1
  • 4
  • 1
    Is this really a C-only question? If not, please include other tags. – Neilvert Noval Dec 22 '10 at 11:37
  • 7
    Hi Ron. You should go back to your previous questions and mark the answer that helped you the most as the "accepted" answer. This will make people more motivated to help you. – Anton Hansson Dec 22 '10 at 11:38
  • 2
    possible duplicate of [Play Audio from a Stream using C#](http://stackoverflow.com/questions/184683/play-audio-from-a-stream-using-c) – Cody Gray Dec 23 '10 at 04:01

1 Answers1

2

For Alvas.Audio see code below

//Memory stream with mp3 audio data
MemoryStream ms = new MemoryStream();
Mp3Reader mr = new Mp3Reader(ms);
PlayerEx plex = new PlayerEx();
plex.OpenPlayer(mr.ReadFormat());
plex.AddData(mr.ReadData());
plex.StartPlay();
Sam
  • 7,157
  • 15
  • 45
  • 65