Solved

waveOutWrite()

Posted on 2004-04-09
4
815 Views
Last Modified: 2012-06-21
Hi.
I am trying to stream audio with waveOutWrite(). I have a server which gets continuously packets with voice data. What I do is playing data with waveOutWrite() and then in callback function when the playing is done I call to waveOutWrite() with next packet (there is no such situation that there are no ready packets). The problem is that because of a very small size of packets and so a large amount of packets there is a small gap between them, so I dont get a clear playing. How can I stream it more smoothly?
0
Comment
Question by:Buffon
4 Comments
 
LVL 22

Expert Comment

by:grg99
ID: 10792226
You have to buffer up a second or so of data before you start playing.  That way you will always have a buffer full of sound to play when the current sound finishes.

You need some code like:

SecsPerBuffer := BufferSize / BytesPerSecondPlaybackRate;
WantedBacklog :=  1;  // seconds

NeedBuffers := WantedBacklog / SecsPerBuffer;

HaveBuffers := 0;

While HaveBuffers < NeedBuffers do ReadNextBuffer;

QueueUpFirstBuffer;

----------------

You can also add another level of queuing by sending out with waveoutwrite one orr more buffers more than the current one.
That way your callback doesnt have to run at the highest priority in order to bring up the next buffer.



0
 
LVL 11

Author Comment

by:Buffon
ID: 10796395
Hi.
As I said I have no problem with buffering. But thanks anyway, I already found a solution:
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=4422&lngWId=3
0
 
LVL 1

Accepted Solution

by:
GhostMod earned 0 total points
ID: 10823957
PAQd, 250 points refunded.

GhostMod
Community Support Moderator
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question