007 PortAudio - can't set deviceID

hey there,

ofSoundStream (ofPortAudioSoundStream under ubuntu) works fine with the default input device. but when i try to set a deviceID before calling setup i get the following error:

Expression ‘alsa_snd_pcm_hw_params_set_buffer_size_near( self->pcm, hwParams, &bufSz )’ failed in ‘src/hostapi/alsa/pa_linux_alsa.c’, line: 2000
Expression ‘PaAlsaStreamComponent_FinishConfigure( &self->capture, hwParamsCapture, inParams, self->primeBuffers, realSr, inputLatency )’ failed in ‘src/hostapi/alsa/pa_linux_alsa.c’, line: 2650
Expression ‘PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )’ failed in ‘src/hostapi/alsa/pa_linux_alsa.c’, line: 2762
OF: OF_LOG_ERROR: PortAudio error: Unanticipated host error

i tried the precompiled libportaudio.a and the library which comes with ubuntu (USER_LIBS = -lportaudio) without success.

in addition - every time when i work with ofSoundStream i get the following messages.

ALSA lib pcm.c:2212:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2212:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2212:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_dmix.c:957:(snd_pcm_dmix_open) The dmix plugin supports only playba

any ideas?

thanks,
felix

when i try to switch to rtaudio by changing the define in ofConstants.h

  
#ifdef TARGET_LINUX  
   #define OF_SOUNDSTREAM_RTAUDIO  
  

and rebuild all i get the following error at runtime:

RtApiAlsa::callbackEvent: audio read error, Input/output error

the problem described above happens on my ubuntu 64bit (11.04).

i switchted to ubuntu 32bit (11.10) and get the same probleme as described here

now i doesn’t matter if i try to set a deviceId or use the default. i get

[tt]OF: OF_LOG_ERROR: PortAudio error: Invalid device[/tt]

if i now install ubuntus portaudio and dont use the one included into oF i get the same error as on my 64bit ubunutu (described above).

can you list the devices and post them here

sure

with portaudio19-dev listDevices() prints:

0: HDA Intel: ALC883 Analog (hw:0,0)
api: 0
max in channels2
max out channels6
default sample rate:44100
1: HDA Intel: ALC883 Digital (hw:0,1)
api: 0
max in channels2
max out channels2
default sample rate:44100
2: HDA Intel: ALC883 Analog (hw:0,2)
api: 0
max in channels2
max out channels0
default sample rate:44100
3: Wireless Mic #023114341: USB Audio (hw:1,0)
api: 0
max in channels2
max out channels0
default sample rate:44100
4: front
api: 0
max in channels0
max out channels6
default sample rate:44100
5: surround40
api: 0
max in channels0
max out channels6
default sample rate:44100
6: surround41
api: 0
max in channels0
max out channels128
default sample rate:44100
7: surround50
api: 0
max in channels0
max out channels128
default sample rate:44100
8: surround51
api: 0
max in channels0
max out channels6
default sample rate:44100
9: surround71
api: 0
max in channels0
max out channels6
default sample rate:44100
10: iec958
api: 0
max in channels0
max out channels2
default sample rate:44100
11: spdif
api: 0
max in channels2
max out channels2
default sample rate:44100
12: rawbluetooth
api: 0
max in channels1
max out channels1
default sample rate:8000
13: bluetooth
api: 0
max in channels128
max out channels128
default sample rate:44100
14: pulse
api: 0
max in channels32
max out channels32
default sample rate:44100
15: dmix
api: 0
max in channels0
max out channels2
default sample rate:48000
16: default
api: 0
max in channels32
max out channels32
default sample rate:44100

which devices are you trying to use?

3 and 12. but at the moment i’m only trying 3.

and with rtaudi in only get the first 3 printed.

have you tried to make them work in other programs? it could be a general problem with those devices under linux. Some other options

  • try using pulse (device 14) and configuring the input device in the audio config in the system to one of those devices.
  • try stopping pulse audio it could be using those devices and blocking them from being used in other software:
    sudo service pulseaudio stop
  • if you have a browser with any window with flash opened close it
  • the same with any other app which could be using the devices like skype…

hey arturo,

thanks for your hints.

  • i tried both devices and both are working with ofSoundStream. but only one at the same time and only if i don’t set any device id. in this setup i have to configure my default input device to switch between both.

  • if i use the pulse deviceID it is the same. it works but i can only use the system default input.

  • i tried to stop pulseaudio with your suggested command and get

* PulseAudio configured for per-user sessions

after some more steps i managed to kill pulseaudio (and im not able to start it again …) and now i can set device 13 ( bluetooth headset) but not device 3 (wireless ps2 singstar) and without setting any deviceId the example app crashs - so i cant use the default until next system restart.

  • during reading about pulseaudio i came across stuff like ALSA and OSS. maybe i have to change some settings there or need other verions? maybe configure pulseaudio better?

  • i managed to use rtaudio with device 3 but as i mentioned before with rtaudio listDevices() prints only device 0-3 and logically i get an error with invalid deviceId if i try anything higher than 3.

so at the moment i can set one of them as default with portaudio, use device 3 with rtaudio or use device 13(bluetooth) after killing pulse. i need just one way to use both…

any more ideas?

thanks for reading,
felix