[Portaudio] StopStream problem
andy at bridle.demon.co.uk
Tue Dec 8 06:13:06 EST 2009
Hi Ross. Thanks for the response.
Re Problem 1: I thought I'd figured out what's happening, but so far my fixes haven't resolved it. On my system, with a built-in SigmaTel sound chip and an external SBLive card, all the DSound devices are showing a default low and high latency of 0.0 secs in their associated PaDeviceInfos. This is what I pass to the suggestedLatency param in the Pa_OpenStream() output PaStreamParameters. I thought that if I set the suggestedLatency to a non-zero value it might fix the problem, but it doesn't. I've tried to follow the code in pa_front.c and pa_win_ds.c to see if they're still using the zero latency from the PaDeviceInfo, but I'm struggling a bit. I note the following comment in pa_win_ds.c:
@todo implement initialisation of PaDeviceInfo default*Latency fields (currently set to 0.)
I will try and make a test case to reproduce the problem, but not sure when I'll get time. Meanwhile I may build my app with only MME support, as this seems to work fine and I'm not too worried about latency.
Problem 2 no longer a problem.
Thanks for the help.
From: portaudio-bounces at music.columbia.edu [mailto:portaudio-bounces at music.columbia.edu] On Behalf Of Ross Bencina
Sent: 07 December 2009 23:41
To: Portaudio Mailing List
Subject: Re: [Portaudio] StopStream problem
Problem 1 sounds like a bug although I've never heard of it before. Can you make a small test case which reproduces the problem (perhaps modify one of the tests in the tests directory?) and I'll try it here.
Problem 2: you still need to call Pa_StopStream after returning paComplete from the callback, see the state diagram here:
----- Original Message -----
From: Andy Bridle
To: portaudio at music.columbia.edu
Sent: Tuesday, December 08, 2009 1:01 AM
Subject: [Portaudio] StopStream problem
My Win32 app uses PortAudio V19-devel, downloaded and compiled on the 16th Oct 2009. It's working fine except for two problems:
1) The app has the ability to stop audio playback and restart from the beginning. When the audio device is being driven via the WinMME host API, the call to Pa_StopStream works fine; there is a perceptible delay while the remaining buffers are played, and a subsequent call to Pa_StartStream restarts the audio correctly. But if I change the host API (for the same physical device) to Windows DirectSound, the call to Pa_StopStream returns almost immediately, and a subsequent call to Pa_StartStream results in a loud distorted noise before the correct audio restarts. The app is designed to produce soothing audio, over headphones, so this is very disconcerting.
2) If my callback function returns 'paComplete' it seems to put the stream into an indeterminate state. A call to Pa_IsStreamActive shows the stream as inactive, but a subsequent call to Pa_StartStream fails with 'Stream is not stopped'. This is not a show-stopper; I've coded round it, but it's not the behaviour that the documentation describes.
Apart from that, PortAudio rocks!
Portaudio mailing list
Portaudio at music.columbia.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Portaudio