Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

waveOutWrite()

Posted on 2004-04-09
4
Medium Priority
?
855 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
3 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
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 viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

772 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