Solved

waveOutWrite()

Posted on 2004-04-09
4
788 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
Comment Utility
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
Comment Utility
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
Comment Utility
PAQd, 250 points refunded.

GhostMod
Community Support Moderator
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
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.

763 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

12 Experts available now in Live!

Get 1:1 Help Now