I get the following from aplay -l
, lsusb
.
pi@raspberrypi:~ $ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
Subdevices: 8/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: Device [USB PnP Sound Device], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: Device_1 [USB PnP Sound Device], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
pi@raspberrypi:~ $ lsusb
Bus 001 Device 005: ID 046d:c31c Logitech, Inc. Keyboard K120 for Business
Bus 001 Device 008: ID 0d8c:013c C-Media Electronics, Inc. CM108 Audio Controller
Bus 001 Device 007: ID 0d8c:013c C-Media Electronics, Inc. CM108 Audio Controller
Bus 001 Device 006: ID 05e3:0606 Genesys Logic, Inc. USB 2.0 Hub / D-Link DUB-H4 USB 2.0 Hub
Bus 001 Device 004: ID 1bcf:0005 Sunplus Innovation Technology Inc.
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
-----------------------------------------------------------------------------
I want to play my MP3 via CM108 Audio Controllers with libao
. I tried these:
ao_initialize();
ao_option aoption;
ao_option *poption;
poption = &aoption;
poption->key = (char*)"dev";
poption->value = (char*)"hw:0";
dev = ao_open_live(driver, &format, poption);
while (mpg123_read(mh, buffer, buffer_size, &done) == MPG123_OK)
ao_play(dev, (char *)buffer, done);
So sound is played via the Pi successfully. I understand that hw:0
is a sound card of the Pi. What should I use instead of hw:0
if I want to play via the first or second CM108 Audio Controller? I already tried hw:1
and hw:2
and it does not work.
aplay
work? – CL. Jun 6 '17 at 11:49