Stream wav files

I have a server that sends data through a socket, data is a wav file. I can easily write data to disk and then play it back in WMP, but I don’t know how I can play it when I read it from the socket. Is it possible?

Bonus question: how can I do this if the stream was in mp3 or in another format?

This is for windows in native C ++.

+3
source share
3 answers

Since you said WMP, I assume the question relates to trying to play a wav file on a Windows machine. If not, this answer does not matter.

, , . , Windows. , . "" , , . , . ,

  • .
  • , , .
  • , .

. .

+3

, . , DirectSound waveOut. : - . , - , 2 , .

FMOD. FAQ:

  • . - , SHOUTcast, Icecast HTTP.
  • . FMODs, , .

. FMOD . :

  • MP3 - ( MPEG I/II 3, VBR)
  • OGG - ( Ogg Vorbis)
  • WAV - ( Microsoft Wave, wavs. PCM, MP3 IMA ADPCM wav
+1

, . API- waveOutXXXX ( Windows 95) , . API ++, #. , , .

If your stream is a format other than WAV files (such as MP3 or WMA), you will have to perform an additional step to decode the data in WAV format and play it using the waveOutXXXX API. Finding a good MP3 decoding component is harder than you expected - I think this is due to the Fraunhofer licensing situation (you have to pay them if you use any kind of MP3 code).

I would find a finished product to do this if you do not want training.

0
source

Source: https://habr.com/ru/post/1697490/


All Articles