Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Callback function never called - arm #128

Closed
bburdette opened this issue Mar 4, 2016 · 15 comments
Closed

Callback function never called - arm #128

bburdette opened this issue Mar 4, 2016 · 15 comments
Labels

Comments

@bburdette
Copy link

I'm working on getting rust-portaudio to work on my bananapi. On the bananapi I want to ignore the builtin audio devices and use a USB soundblaster instead. I'm able to specify that device using a device index, but I get a lot of error messages concerning the builtin audio device. The results is I don't hear any audio. I'm not sure what the cause might be, though the error messages look suspicious. PortAudio doesn't seem to be too happy.

FWIW, I am able to play audio through the soundblaster using other sound sources on that computer. aplay works, as does supercollider running through jack1.

Output from my test program is below. (portaudio startup is at line 89 in my test program).

initting with sample rate: 44100
add_elem(ui_elem_type_t type, char *label) 0x00
add_elem(ui_elem_type_t type, char *label) Volume
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.sunxi-CODEC.pcm.front.0:CARD=0'
ALSA lib conf.c:4260:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4739:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM front
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.sunxi-CODEC.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4260:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4739:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM surround21
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.sunxi-CODEC.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4260:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4739:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM surround21
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.sunxi-CODEC.pcm.surround40.0:CARD=0'
ALSA lib conf.c:4260:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4739:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM surround40
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.sunxi-CODEC.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4260:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4739:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM surround41
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.sunxi-CODEC.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4260:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4739:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM surround50
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.sunxi-CODEC.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4260:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4739:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM surround51
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.sunxi-CODEC.pcm.surround71.0:CARD=0'
ALSA lib conf.c:4260:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4739:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM surround71
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.sunxi-CODEC.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4260:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4739:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM iec958
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.sunxi-CODEC.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4260:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4739:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM spdif
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.sunxi-CODEC.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4260:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4739:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM spdif
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused

ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused

connect(2) call to /dev/shm/jack-1000/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed
--------------------------------------- DeviceIndex(1)
DeviceInfo {
    struct_version: 2,
    name: "Sound Blaster X-Fi Go! Pro: USB Audio (hw:1,0)",
    host_api: 0,
    max_input_channels: 2,
    max_output_channels: 2,
    default_low_input_latency: 0.008684807256235827,
    default_low_output_latency: 0.008707482993197279,
    default_high_input_latency: 0.034829931972789115,
    default_high_output_latency: 0.034829931972789115,
    default_sample_rate: 44100
}
Supported standard sample rates for half-duplex 16-bit 2 channel input:
    44100hz
Supported standard sample rates for half-duplex 16-bit 2 channel output:
    44100hz
Supported standard sample rates for full-duplex 16-bit 2 channel input, 2 channel output:
    44100hz

And here's output from the 'devices.rs' example:

ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.sunxi-CODEC.pcm.front.0:CARD=0'
ALSA lib conf.c:4260:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4739:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM front
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.sunxi-CODEC.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4260:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4739:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM surround21
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.sunxi-CODEC.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4260:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4739:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM surround21
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.sunxi-CODEC.pcm.surround40.0:CARD=0'
ALSA lib conf.c:4260:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4739:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM surround40
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.sunxi-CODEC.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4260:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4739:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM surround41
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.sunxi-CODEC.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4260:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4739:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM surround50
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.sunxi-CODEC.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4260:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4739:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM surround51
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.sunxi-CODEC.pcm.surround71.0:CARD=0'
ALSA lib conf.c:4260:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4739:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM surround71
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.sunxi-CODEC.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4260:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4739:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM iec958
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.sunxi-CODEC.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4260:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4739:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM spdif
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.sunxi-CODEC.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4260:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4739:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM spdif
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused

ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused

connect(2) call to /dev/shm/jack-1000/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed
Number of devices = 7
--------------------------------------- DeviceIndex(0)
DeviceInfo {
    struct_version: 2,
    name: "sunxi-CODEC: PCM (hw:0,0)",
    host_api: 0,
    max_input_channels: 2,
    max_output_channels: 2,
    default_low_input_latency: 0.06965986394557823,
    default_low_output_latency: 0.06965986394557823,
    default_high_input_latency: 0.06965986394557823,
    default_high_output_latency: 0.06965986394557823,
    default_sample_rate: 44100
}
Supported standard sample rates for half-duplex 16-bit 2 channel input:
    8000hz
    11025hz
    12000hz
    16000hz
    22050hz
    24000hz
    32000hz
    44100hz
    48000hz
    96000hz
    192000hz
Supported standard sample rates for half-duplex 16-bit 2 channel output:
    8000hz
    11025hz
    12000hz
    16000hz
    22050hz
    24000hz
    32000hz
    44100hz
    48000hz
    96000hz
    192000hz
Supported standard sample rates for full-duplex 16-bit 2 channel input, 2 channel output:
    8000hz
    11025hz
    12000hz
    16000hz
    22050hz
    24000hz
    32000hz
    44100hz
    48000hz
    96000hz
    192000hz
--------------------------------------- DeviceIndex(1)
DeviceInfo {
    struct_version: 2,
    name: "Sound Blaster X-Fi Go! Pro: USB Audio (hw:1,0)",
    host_api: 0,
    max_input_channels: 2,
    max_output_channels: 2,
    default_low_input_latency: 0.008684807256235827,
    default_low_output_latency: 0.008707482993197279,
    default_high_input_latency: 0.034829931972789115,
    default_high_output_latency: 0.034829931972789115,
    default_sample_rate: 44100
}
Supported standard sample rates for half-duplex 16-bit 2 channel input:
    44100hz
Supported standard sample rates for half-duplex 16-bit 2 channel output:
    44100hz
Supported standard sample rates for full-duplex 16-bit 2 channel input, 2 channel output:
    44100hz
--------------------------------------- DeviceIndex(2)
DeviceInfo {
    struct_version: 2,
    name: "sysdefault",
    host_api: 0,
    max_input_channels: 128,
    max_output_channels: 128,
    default_low_input_latency: 0.06965986394557823,
    default_low_output_latency: 0.06965986394557823,
    default_high_input_latency: 0.06965986394557823,
    default_high_output_latency: 0.06965986394557823,
    default_sample_rate: 44100
}
Supported standard sample rates for half-duplex 16-bit 128 channel input:
    8000hz
    9600hz
    11025hz
    12000hz
    16000hz
    22050hz
    24000hz
    32000hz
    44100hz
    48000hz
    88200hz
    96000hz
    192000hz
Supported standard sample rates for half-duplex 16-bit 128 channel output:
    8000hz
    9600hz
    11025hz
    12000hz
    16000hz
    22050hz
    24000hz
    32000hz
    44100hz
    48000hz
    88200hz
    96000hz
    192000hz
Supported standard sample rates for full-duplex 16-bit 128 channel input, 128 channel output:
    8000hz
    9600hz
    11025hz
    12000hz
    16000hz
    22050hz
    24000hz
    32000hz
    44100hz
    48000hz
    88200hz
    96000hz
    192000hz
--------------------------------------- DeviceIndex(3)
DeviceInfo {
    struct_version: 2,
    name: "default",
    host_api: 0,
    max_input_channels: 128,
    max_output_channels: 128,
    default_low_input_latency: 0.06965986394557823,
    default_low_output_latency: 0.06965986394557823,
    default_high_input_latency: 0.06965986394557823,
    default_high_output_latency: 0.06965986394557823,
    default_sample_rate: 44100
}
Supported standard sample rates for half-duplex 16-bit 128 channel input:
    8000hz
    9600hz
    11025hz
    12000hz
    16000hz
    22050hz
    24000hz
    32000hz
    44100hz
    48000hz
    88200hz
    96000hz
    192000hz
Supported standard sample rates for half-duplex 16-bit 128 channel output:
    8000hz
    9600hz
    11025hz
    12000hz
    16000hz
    22050hz
    24000hz
    32000hz
    44100hz
    48000hz
    88200hz
    96000hz
    192000hz
Supported standard sample rates for full-duplex 16-bit 128 channel input, 128 channel output:
    8000hz
    9600hz
    11025hz
    12000hz
    16000hz
    22050hz
    24000hz
    32000hz
    44100hz
    48000hz
    88200hz
    96000hz
    192000hz
--------------------------------------- DeviceIndex(4)
DeviceInfo {
    struct_version: 2,
    name: "dmix",
    host_api: 0,
    max_input_channels: 0,
    max_output_channels: 2,
    default_low_input_latency: -1,
    default_low_output_latency: 0.021333333333333333,
    default_high_input_latency: -1,
    default_high_output_latency: 0.021333333333333333,
    default_sample_rate: 48000
}
Supported standard sample rates for half-duplex 16-bit 0 channel input:
Supported standard sample rates for half-duplex 16-bit 2 channel output:
    48000hz
Supported standard sample rates for full-duplex 16-bit 0 channel input, 2 channel output:
--------------------------------------- DeviceIndex(5)
DeviceInfo {
    struct_version: 2,
    name: "/dev/dsp",
    host_api: 1,
    max_input_channels: 16,
    max_output_channels: 16,
    default_low_input_latency: 0.008707482993197279,
    default_low_output_latency: 0.008707482993197279,
    default_high_input_latency: 0.034829931972789115,
    default_high_output_latency: 0.034829931972789115,
    default_sample_rate: 44100
}
Supported standard sample rates for half-duplex 16-bit 16 channel input:
Supported standard sample rates for half-duplex 16-bit 16 channel output:
Supported standard sample rates for full-duplex 16-bit 16 channel input, 16 channel output:
--------------------------------------- DeviceIndex(6)
DeviceInfo {
    struct_version: 2,
    name: "/dev/dsp1",
    host_api: 1,
    max_input_channels: 16,
    max_output_channels: 16,
    default_low_input_latency: 0.008707482993197279,
    default_low_output_latency: 0.008707482993197279,
    default_high_input_latency: 0.034829931972789115,
    default_high_output_latency: 0.034829931972789115,
    default_sample_rate: 44100
}
Supported standard sample rates for half-duplex 16-bit 16 channel input:
Supported standard sample rates for half-duplex 16-bit 16 channel output:
Supported standard sample rates for full-duplex 16-bit 16 channel input, 16 channel output:
@bburdette
Copy link
Author

Ok I gave it a try on a raspberry pi 2, also with arch. I got similar results as the above, but with the PI I'm able to comment out the default audio device in /etc/modules-load.d/raspberrypi.conf (snd-bcm2835), so that there's only the USB audio device when the PI boots. So now aplay only lists the usb device:

[bburdette@alarmpi cyclofraust_pa]$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Device [USB PnP Sound Device], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
[bburdette@alarmpi cyclofraust_pa]$ 

The rust program runs normally, with fewer error messages than before, but doesn't make any sound.

[bburdette@alarmpi cyclofraust_pa]$ ./target/debug/fraust_test 
initting with sample rate: 44100
add_elem(ui_elem_type_t type, char *label) 0x00
add_elem(ui_elem_type_t type, char *label) Volume
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
connect(2) call to /dev/shm/jack-1001/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed
--------------------------------------- DeviceIndex(0)
DeviceInfo {
    struct_version: 2,
    name: "USB PnP Sound Device: Audio (hw:0,0)",
    host_api: 0,
    max_input_channels: 1,
    max_output_channels: 2,
    default_low_input_latency: 0.008684807256235827,
    default_low_output_latency: 0.008684807256235827,
    default_high_input_latency: 0.034829931972789115,
    default_high_output_latency: 0.034829931972789115,
    default_sample_rate: 44100
}
Supported standard sample rates for half-duplex 16-bit 1 channel input:
        44100hz
        48000hz
Supported standard sample rates for half-duplex 16-bit 2 channel output:
        44100hz
        48000hz
Supported standard sample rates for full-duplex 16-bit 1 channel input, 2 channel output:
        44100hz
        48000hz
^C
[bburdette@alarmpi cyclofraust_pa]$

I compiled a portaudio example program, and that works - I hear pink noise through headphones on the usb device.

[bburdette@alarmpi pa_test]$ ls
a.out  paex_pink.c
[bburdette@alarmpi pa_test]$ ./a.out 
Pink = -0.071180
Pink = 0.052018
Pink = 0.050252
Pink = -0.008767
Pink = -0.097822
Pink = -0.016096
Pink = -0.033893
Pink = -0.074743
Pink = 0.019028
Pink = -0.006414
Pink = -0.042970
Pink = -0.036499
Pink = -0.144389
Pink = -0.060056
Pink = 0.040915
Pink = 0.082905
Pink = 0.145651
Pink = 0.096118
Pink = 0.096055
Pink = 0.279387
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
connect(2) call to /dev/shm/jack-1001/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed
Stereo pink noise for one minute...
^C
[bburdette@alarmpi pa_test]$ 

@bburdette
Copy link
Author

Ok it looks like the program never executes the portaudio callback function when running on the PI. Throwing a printf in there results in lots of messages on my laptop, and none on the pi. Progress is made.

@bburdette
Copy link
Author

Gave it a try with the sine example, it appears to run normally but no sound. I put a println! in the callback function but it never gets called.

[bburdette@alarmpi rust-portaudio]$ ./target/debug/examples/sine 
PortAudio Test: output sine wave. SR = 44100, BufSize = 64
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
connect(2) call to /dev/shm/jack-1001/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed
Play for 5 seconds.
Test finished.
[bburdette@alarmpi rust-portaudio]$ 

put the println here:

    // This routine will be called by the PortAudio engine when audio is needed. It may called at
    // interrupt level on some machines so don't do anything that could mess up the system like
    // dynamic resource allocation or IO.
    let callback = move |pa::OutputStreamCallbackArgs { buffer, frames, .. }| {
        // any events to update the DSP with??
        println!("in the callback!");
        match rx.try_recv() {
          Ok(ke) => {
            match ke.evttype {
              KeType::KeyHit => {

@bburdette bburdette changed the title No audio output on bananapi Callback function never called - arm Mar 6, 2016
@mitchmindtree
Copy link
Member

@bburdette Thanks so much for this issue and keeping us up to date with your discoveries - it's highly appreciated!

I don't have an arm device myself, but am happy to make any fixes or changes you deem necessary to get this working 👍 I'm planning on running this on arm at some point in the near future as well, so I'm keen to do what we can!

@bburdette
Copy link
Author

Ok thanks Mitch! If you have any suggestions for things to try, don't hesitate! I'm kind of stuck-ish right now, until I think of another angle. I'll keep you posted.

@bburdette
Copy link
Author

Looked at this again today, didn't figure anything out. If you feel like hacking on this I'll be glad to give you a login to my raspberry pi 2.

@mitchmindtree
Copy link
Member

mitchmindtree commented Apr 17, 2016

Have been thinking about this a little and I'm wondering if your errors are due to us not yet having bindings to the Host-API-specific header for linux alsa?

Also, I recently added an example that will enumerate all available Hosts on the system - would be interesting to see what it outputs when running on your R-PI if you happen to get a chance?

@bburdette
Copy link
Author

Right now I have the default Pi audio hardware blacklisted, so it only sees the USB audio hardware.

[bburdette@alarmpi rust-portaudio]$ cargo run --example hosts
     Running `target/debug/examples/hosts`
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
connect(2) call to /dev/shm/jack-1001/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed
Default Host API: Ok(0)
All Host APIs:
(
    0,
    HostApiInfo {
        struct_version: 1,
        host_type: ALSA,
        name: "ALSA",
        device_count: 8,
        default_input_device: Some(
            DeviceIndex(
                6
            )
        ),
        default_output_device: Some(
            DeviceIndex(
                6
            )
        )
    }
)
(
    1,
    HostApiInfo {
        struct_version: 1,
        host_type: OSS,
        name: "OSS",
        device_count: 0,
        default_input_device: None,
        default_output_device: None
    }
)
[bburdette@alarmpi rust-portaudio]$ 

Ok, un-blacklisted the default hardware. Now I get this:

[bburdette@alarmpi rust-portaudio]$ cargo run --example hosts
     Running `target/debug/examples/hosts`
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.front.0:CARD=0'
ALSA lib conf.c:4292:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4771:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM front
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4292:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4771:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM surround21
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4292:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4771:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM surround21
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround40.0:CARD=0'
ALSA lib conf.c:4292:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4771:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM surround40
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4292:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4771:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM surround41
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4292:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4771:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM surround50
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4292:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4771:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM surround51
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround71.0:CARD=0'
ALSA lib conf.c:4292:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4771:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM surround71
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4292:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4771:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM iec958
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4292:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4771:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM spdif
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4292:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4771:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM spdif
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
connect(2) call to /dev/shm/jack-1001/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed
Default Host API: Ok(0)
All Host APIs:
(
    0,
    HostApiInfo {
        struct_version: 1,
        host_type: ALSA,
        name: "ALSA",
        device_count: 6,
        default_input_device: Some(
            DeviceIndex(
                2
            )
        ),
        default_output_device: Some(
            DeviceIndex(
                4
            )
        )
    }
)
(
    1,
    HostApiInfo {
        struct_version: 1,
        host_type: OSS,
        name: "OSS",
        device_count: 0,
        default_input_device: None,
        default_output_device: None
    }
)
[bburdette@alarmpi rust-portaudio]$ 

Hope this helps! I haven't had time to look at this lately...

@ed-bassett
Copy link

Hi @mitchmindtree,

I'm trying the same sort of thing with my raspberry pi zero, and am having the same issue. I'm using the 'pHAT DAC' from Pimoroni. Using speaker-test produces sound without issue, but like @bburdette, the callback's not getting called.

Interestingly, running the test example from portaudio-rs works fine, so looking at the differences between that and your library might help narrow down what the issue is.

I'm happy to help out trying to debug this, so let me know if there's anything you want me to test out and I'll let you know how it goes.

Don't know if helps, but I've included the output from the hosts example below.

Cheers,
Ed

ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.snd_rpi_hifiber.pcm.front.0:CARD=0'
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM front
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.snd_rpi_hifiber.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround21
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.snd_rpi_hifiber.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround21
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.snd_rpi_hifiber.pcm.surround40.0:CARD=0'
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround40
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.snd_rpi_hifiber.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround41
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.snd_rpi_hifiber.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround50
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.snd_rpi_hifiber.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround51
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.snd_rpi_hifiber.pcm.surround71.0:CARD=0'
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround71
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.snd_rpi_hifiber.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM iec958
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.snd_rpi_hifiber.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM spdif
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.snd_rpi_hifiber.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM spdif
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
Default Host API: Ok(0)
All Host APIs:
(   
    0,
    HostApiInfo {
        struct_version: 1,
        host_type: ALSA,
        name: "ALSA",
        device_count: 4,
        default_input_device: None,
        default_output_device: Some(
            DeviceIndex(
                3
            )
        )
    }
)
(   
    1,
    HostApiInfo {
        struct_version: 1,
        host_type: OSS,
        name: "OSS",
        device_count: 0,
        default_input_device: None,
        default_output_device: None
    }
)

@mitchmindtree
Copy link
Member

I forgot to mention, #22 is the tracking issue for adding the platform-specific extensions (I'm guessing the lack of the ALSA extension is what is causing an issue here).

@mitchmindtree
Copy link
Member

Hmm looking more closely at portaudio-rs, it seems that that they aren't binding to the platform-specific ALSA extensions either.

One difference is that portaudio-rs has used rust-bindgen to generate the bindings, whereas rust-portaudio's ffi.rs module was written by hand a long time ago. I wonder if there is some subtle mistake in the hand-rolled bindings? I've been considering re-doing all the bindings using rust-bindgen in a unique crate (along with the build script) for a while now - I might have a go a this next month when I get my new C.H.I.P which will require getting the Linux-ALSA backend working.

@bburdette
Copy link
Author

I've had good luck with portaudio-rs on ARM so far, but it only works in debug mode, not release mode.

@joe-hauns
Copy link

for me pull request #152 fixed the issue after i did apply a patch to the pull request itself to make it compile on a 32-bit processor

@joe-hauns
Copy link

I guess this can be marked as resolved now.

@mitchmindtree
Copy link
Member

Closing as #152 seems to have fixed this (see #137 on discussion related to publishing this fix).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants