[alsa-devel] Nonblocking non-synchronized io plugin?

Aryeh Leib Taurog vim at aryehleib.com
Sun Jun 22 05:04:54 CEST 2008


Hello,

    I am trying to develop an io plugin to route audio input/output to/from 
a network application I'm developing.  I'm working on openSUSE 10.2, which 
I think means I'm using ALSA 1.0.13rc2

I am running into two problems:

1. ALSA calls my transfer function with io->nonblock = 0 and seems to be 
   quite picky about the timing of the function.  I'm having trouble 
getting the timing correct, and it seems to be causing ALSA to stop/crash.  
Is there any way that I can get ALSA to handle the timing for me and call 
my transfer function with io->nonblock = 1 instead?

2. ALSA seems to require that the capture and playback transfers be 
   synchronized.  That seems like a simple enough expectation, but for some 
reason, I am having a hard time providing this.  I tried splitting the 
capture and playback up in .asoundrc as below, but it doesn't seem to help.  
(Actually I can't be sure, since it could just be a timing issue).  Is 
there a way to separate the capture from the playback so it won't require 
them to be synchronized?

Basically, I want the ioplug to have as much latitude as possible to just 
transfer the data and return as soon as it can.  I guess if the calls are 
non-blocking, then they also won't need to be syncronized.  Please correct 
me if I'm wrong.

.asoundrc:
-----------------------------
pcm.read {
    type myplug
}

pcm.write {
    type myplug
}

ctl.myapp {
    type myplug
}

pcm.myapp {
    type asym
    playback.pcm "write"
    capture.pcm "read"
}

pcm.!default myapp
------------------------------


Thanks very much
Please let me know if I need to clarify anything.

Aryeh Leib Taurog




More information about the Alsa-devel mailing list