Re: openal soft loopback query
Chris Robinson <[email protected]> Tue, 07 Feb 2012 06:04:41 -0800
| Newsgroups | gmane.comp.lib.openal |
|---|---|
| Message-ID | <8006459.oIAjigiJeb@kittycat> |
On Tuesday, February 07, 2012 7:22:26 PM Michael Zucchi wrote:
> Hi there,
>
> I was playing with the experimental openal loopback stuff in openal-soft
> HEAD but came across a problem: if I drain the output too fast, the
> input wont keep up and I get sections of blank space in the output. I'm
> obviously trying to drain as fast as possible, but not too fast (the
> output is going to a file or codec).
>
> Is there any suggested way to approach this or some intention to provide
> the needed capability?
Hi.
The idea with the loopback device is that the device would be processed at a
rate similar to everything else. That is, the faster you render samples, the
faster you check and update your sources and everything. Working synchronously
would be simplest, so for example you'd do:
while(AppRuns)
{
CheckAndUpdateSources();
alcRenderSamplesSOFT(device, outbuffer, samples);
HandleOutput(outbuffer, samples);
}
As long as you don't render too many samples at once, or have short buffer
queues, this should keep up just fine and get everything out ASAP.
If you were to render samples asynchronously, then you would need to
artificially limit how fast it renders samples so the main app (what's calling
"CheckAndUpdateSources") can keep up. In such a case, the main app could
probably use a semaphore or something to tell the async thread when it's okay
to render. For example:
Thread 1:
while(AppRuns)
{
CheckAndUpdateSources();
sem_post(&RenderNow);
}
Thread 2:
while(AppRuns)
{
alcRenderSamplesSOFT(device, outbuffer, samples);
HandleOutput(outbuffer, samples);
sem_wait(&RenderNow);
}
Hope that helps. :) If you have more questions, feel free to ask.
_______________________________________________
Openal mailing list
[email protected]
http://opensource.creative.com/mailman/listinfo/openal