Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

waveOutWrite()

Posted on 2004-04-09
4
808 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone 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

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…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
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 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.

808 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