Home PortAudio Device Unavailable when device used for stream is the same as Windows default playback device
Reply: 0

PortAudio Device Unavailable when device used for stream is the same as Windows default playback device

charlie1329
1#
charlie1329 Published in 2018-01-10 18:57:09Z

I'm attempting to write an application which requires fairly basic PortAudio functionality: data/samples are read in from a stream and then processed elsewhere in the application.

My problem arises on the call to Pa_OpenStream() in which the error code -9985 for Device Unavailable is returned. The PaStreamParameters struct passed into this function (an instance of the struct is only passed for input, the argument for output is a nullptr as it is not necessary here) is instantiated with values found from Pa_GetDefaultInputDevice().

I am using (on a Windows 10 machine) a Focusrite Scarlett 2i2 for input and as such the two related drivers I have installed on my machine are Focusrite USB 2.0 Audio Driver 2.5.1 and Focusrite USB 4.36.0.484. The device name in PortAudio is labelled as Line In (Scarlett 2i2 USB).

Previously, the aforementioned error code wasn't returned and the code would run as intended, however, due to issues with other pieces of software, the drivers had to be reinstalled; I am unable to say with certainty as to whether the current drivers are the same version as that which are currently running.

After researching the problem, (see Portaudio won't play sound if another program is currently playing), I found that if I change the default playback device on windows from Line Out (Scarlett 2i2 USB) to some other playback device (e.g. built in laptop speakers), the stream can be opened without any issues.

I would like to be able to have Line Out (Scarlett 2i2 USB) set as the default playback device on my machine as my application requires audio output from non-PortAudio sources (e.g. the system uses the Windows MIDI API with the default MIDI device), and having it arrive through this device is more desirable to me. Is anyone able to help diagnose the issue here, and if so suggest a fix?

Many thanks in advance.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.304967 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO