Solved

waveOutWrite()

Posted on 2004-04-09
4
790 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

910 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now