3

I have an xmos-200 board that is able to record 8 channels and push output through 8 channels. I'm going to focus on the output.

For outputs, there are 4 3.5mm jacks with 2 channels each. The board is recognized by Linux, and aplay -L shows

sysdefault:CARD=x20
    xCORE USB Audio 2.0, USB Audio
    Default Audio Device
front:CARD=x20,DEV=0
    xCORE USB Audio 2.0, USB Audio
    Front speakers
surround40:CARD=x20,DEV=0
    xCORE USB Audio 2.0, USB Audio
    4.0 Surround output to Front and Rear speakers
surround41:CARD=x20,DEV=0
    xCORE USB Audio 2.0, USB Audio
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=x20,DEV=0
    xCORE USB Audio 2.0, USB Audio
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=x20,DEV=0
    xCORE USB Audio 2.0, USB Audio
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=x20,DEV=0
    xCORE USB Audio 2.0, USB Audio
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=x20,DEV=0
    xCORE USB Audio 2.0, USB Audio
    IEC958 (S/PDIF) Digital Audio Output
dmix:CARD=x20,DEV=0
    xCORE USB Audio 2.0, USB Audio
    Direct sample mixing device
dsnoop:CARD=x20,DEV=0
    xCORE USB Audio 2.0, USB Audio
    Direct sample snooping device
hw:CARD=x20,DEV=0
    xCORE USB Audio 2.0, USB Audio
    Direct hardware device without any conversions
plughw:CARD=x20,DEV=0
    xCORE USB Audio 2.0, USB Audio
    Hardware device with all software conversions

I can play audio files from all the output ports and all the channels using

aplay --device plughw:CARD=x20,DEV=0 camera.wav

I want to choose which of the 4 stereo outputs is used. Any help on how I can go about doing that?

3

The four jacks are separated physically, but the software just sees a single eight-channel device.

You can split this device using ALSA plugins:

pcm_slave.eightchannels {
    pcm "hw:x20,0"
    channels 8
    rate 48000     # or whatever
}

pcm.stereo1 {
    type plug
    slave.pcm {
        type dshare
        ipc_key 20160316     # any random but unique number
        slave eightchannels
        bindings [ 0 1 ]
    }
}
pcm.stereo2 {
    type plug
    slave.pcm {
        type dshare
        ipc_key 20160316
        slave eightchannels
        bindings [ 2 3 ]
    }
}
pcm.stereo3 {
    type plug
    slave.pcm {
        type dshare
        ipc_key 20160316
        slave eightchannels
        bindings [ 4 5 ]
    }
}
pcm.stereo4 {
    type plug
    slave.pcm {
        type dshare
        ipc_key 20160316
        slave eightchannels
        bindings [ 6 7 ]
    }
}

To allow multiple application to use the same stereo device, replace dshare with dmix.

  • Thanks a lot. It's like magic! I assume the bindings field decides which channels to use for each virtual pcm device? – Mr. Fegur Mar 16 '16 at 18:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.