Can't start PortAudio


3 posts
by RaspberrySmoothie » Sun Jul 29, 2012 2:40 pm
Hi all.

I'm trying to write a very simple PortAudio test program. But when I try and Pa_Initialize(), I just get an error.

Here's my code:

Code: Select all
#include <stdio.h>
#include "portaudio.h"

main( int argc, char *argv[] )
{
  PaError err;

  err = Pa_Initialize();

  if ( err != paNoError )
  {

  }
  else
  {
    printf( "I couldn't initialise port audio\n" );
  }
}


(Yes, I haven't gotten very far yet).

And here's the output I get:

Code: Select all
$ ./sineout
The program is running
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.front
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround40
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround41
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround50
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround51
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm_dmix.c:957:(snd_pcm_dmix_open) The dmix plugin supports only playback stream
ALSA lib pcm_direct.c:877:(snd1_pcm_direct_initialize_slave) slave plugin does not support mmap interleaved or mmap noninterleaved access
ALSA lib pcm_dmix.c:1030:(snd_pcm_dmix_open) unable to initialize slave
I couldn't initialise port audio
$


I get the same error whether or not I "sudo ./sineout" or run it as the "pi" user.

Here's my /etc/asound.conf

Code: Select all
pcm.!default {
        type hw
        card 0
}

ctl.!default {
        type hw
        card 0
}
Posts: 8
Joined: Mon Jul 23, 2012 5:01 pm
by dom » Sun Jul 29, 2012 6:03 pm
I really know very little about this, but this thread gave a asound.conf file that enabled mmap emulation:
viewtopic.php?f=66&t=7107&p=133075&hilit=alsa#p133075

Given the error message you got, it might be worth trying.
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 3995
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge
by pholy » Sun Jul 29, 2012 9:21 pm
On my desktop I get a ton of messages even with the sound working:
Code: Select all
phil@AmyDee:~$ grandfatherclock.py
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 audio/pcm_bluetooth.c:1613:(audioservice_expect) BT_GET_CAPABILITIES failed : Input/output error(5)
ALSA lib audio/pcm_bluetooth.c:1613:(audioservice_expect) BT_GET_CAPABILITIES failed : Input/output error(5)
ALSA lib audio/pcm_bluetooth.c:1613:(audioservice_expect) BT_GET_CAPABILITIES failed : Input/output error(5)
ALSA lib audio/pcm_bluetooth.c:1613:(audioservice_expect) BT_GET_CAPABILITIES failed : Input/output error(5)
ALSA lib pcm_dmix.c:957:(snd_pcm_dmix_open) The dmix plugin supports only playback stream
Cannot connect to server socket err = No such file or directory
Cannot connect to server socket
jack server is not running or cannot be started
phil@AmyDee:~$

That's a Python wrapper of port audio I'm using. I don't know why alsa lib goes crazy like that.

But I don't have that mmap error, so Dom's hint might be on the right track. I guess we need to figure out how to incorporate the mmap stuff into the alsa driver so we don't need the extra config file.
Posts: 42
Joined: Sun Jun 24, 2012 11:29 pm