Hello,
I know it's been a while since I've originally sent this patch to this
list, but I have finally been able to found time and a USB headset to
test the Pa_Terminate(); Pa_Initialize(); method to rescan audio
devices. And when plugging, unplugging the headset while using audio it
causes my application to crash. So I'll keep my current implementation
for now. Do you plan integrating this feature to portaudio?
-Yann
Yann Biancheri wrote:
Hello,
I've tried the solution of calling Pa_Terminate(); Pa_Initialize();
before starting implementation and it was causing my application to
crash.
I beleive that one benefit of my solution is that it can detect
audio devices while having some opened streams. In fact, it is just
rescanning audio devices and not going all the way through
destrotying, reconsrtucting the hostApis. In case no device are
detected (which is really likely) nothing is destroyed or rebuilt and
make my solution lighter since I'm calling this method every 10
seconds. I use PortAudio in a VoIP application and I'm able to detect
newly inserted device and auto-select them while on the phone.
Do you beleive your hack can handle this use-case? If yes, then this
patch just make the process lighter.
I've tried replacing my Pa_RescanDevice() implementation by
Pa_Terminate(); Pa_Initialize(); and it doesn't crash my app while on
the phone. It has one nice side effect of cutting the echo each time I
do a rescan. Therefore, I didn't have any USB headset right now to
test if the detection of a newly inserted device will crash the
system. I'll test with an USB headset as soon as I can get one and
will post the result in the mailing list.
At least it will be helpful to create an API call, or document
somewhere how we can rescandevice if this method is retained.
-Yann
Ross Bencina wrote:
Hi Yann
I Could be missing something here. But why can't you just call
Pa_Terminate(); Pa_Initialize(); to refresh the device list? That's
what I do. What does the patch do beyond that? What are the benefits?
On a slightly separate topic: I think a more important patch would be
to fix problems where PortAudio gets out of sync with the host API
when devices are connected/disconnected. Ideally it should be able to
resolve portAudio devices even if the underlying device indexes have
changed...
Best wishes
Ross.
----- Original Message ----- From: "Yann Biancheri"
<ybiancheri@xxxxxxxxxxxxxxxx>
To: <portaudio@xxxxxxxxxxxxxxx>
Sent: Tuesday, January 09, 2007 7:55 PM
Subject: [Portaudio] Patch to rescan audio device while launched
Hello,
I have worked in adding audio device detection in IAXClient while
the application is launched, and I end up adding this feature in
PortAudio. Looking at your track entries it seems that it
corresponds to ticket#11 (
http://www.portaudio.com/trac/ticket/11).
My implementation is quite basic and offers the opportunity to
rescan audio devices by an API call.
There is no callback if a device is inserted or removed, but the new
audio device information could be accessed through standard API
calls. I've done only two hostApi's implementation so far, one for
CoreAudio on mac and one for Wmme on windows which are the only ones
I need in my appication. It's certainly not the best way to handle
those problems but it is by far (in my opinion) the simpler way to
do it.
Please found the patch here
http://yannbiancheri.free.fr/rescanDevicePortAudio.patch.
Sincerly,
Yann Biancheri
_______________________________________________
Portaudio mailing list
Portaudio@xxxxxxxxxxxxxxx
http://techweb.rfa.org/mailman/listinfo/portaudio
_______________________________________________
Portaudio mailing list
Portaudio@xxxxxxxxxxxxxxx
http://techweb.rfa.org/mailman/listinfo/portaudio