How to play a specific buffer,not a file?
-
-
-
-
How to play a buffer? Can you elaborate a bit more?
-
-
?? what kind of buffer?? sound? if sound-> copy it to a sound buffer and play it! Don't try it, just do it! ;-)
-
-
-
How to play a buffer? Can you elaborate a bit more?
:confused: Well,now i am doing a web streamming project. Client receives data from the server via UDP protocol and plays the data buffer(wave). Now I have tried many methods,including MCI and DirectSound,but still haven't found a better solution. With MCI,I use waveOutWrite() to play the data buffer.But waveOutWrite() will spend about 0.2 second to send the data block to the playing device and then return.This is deal to that there is about 0.2s interval when playing the sound continually. I can't fix the problem. So now it is not smooth when playing the sound. (the sound buffer is about 800K). DirectSound is usually used for game,and it base on focus.This is meant that when the program loses focus it can't play the sound in the background. Now I need it to play the sound whenever the program loses focus or not. Now I am seeking a method to play the sound buffer(wave) without any delays. My current method that plays the sound buffer go as follows: when MCI(waveOutWrite()) finishs playing the current buffer,it singals the event. Thread receives this notification,then it fills in the buffer with new data. And then use waveOutWrite() playing it again. but waveOutWrite() has about 0.2s delay. Now I want to find a better method without any delays. Can anyone help me? You can contact me at this email address: xiaochengwx@163.com Hoping your replies.
-
The functions you need are: waveOutOpen() waveOutPrepareHeader() waveOutWrite() waveOutClose()
But it seams that waveOutWrite() has about 0.2 second delay before it returns to main program.