Skip to contentSkip to conversation

programming with dmix ?

DISCUSSION Alex Kuang 3 participants 3 messages Jun 19, 2003

lore
Share & tools
lore

Alex Kuang

author
#0 lore raw

Hi there,

Just wondered how I can apply the cool feature - dmix
- to my own program to mix sounds? for example, after I compile my small c++ program, I can run it one at a time:

./a.out TestMusic.wav

The thing's that how I can mix sounds when I run:

./a.out TestMusic01.wav &
./a.out TestMusic02.wav &
./a.out TestMusic03.wav &

Thank you very much,

Alex

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner. Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission! INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php

#1 lore raw
Quoted 5 lines

Just wondered how I can apply the cool feature - dmix
- to my own program to mix sounds? for example, after I compile my small c++ program, I can run it one at a time:

Quoted 7 lines

./a.out TestMusic.wav

The thing's that how I can mix sounds when I run:

./a.out TestMusic01.wav &
./a.out TestMusic02.wav &
./a.out TestMusic03.wav &

make your program accept an argument naming the PCM device to open. define the device (if necessary) in ~/.asoundrc. run the program with the appropriate argument. i believe that there is documentation on the website about using dmix, but it'll be up to someone else to point you at it if you can't find it.

different kinds ALSA PCM devices do not require different source code. writing to the dmix plugin is no different than writing to hardware or other plugins.

--p

-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner. Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission! INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php

#2 lore raw
In reply to Alex Kuang
Quoted 9 lines · Alex Kuang

Hi there,

Just wondered how I can apply the cool feature - dmix
- to my own program to mix sounds? for example, after I compile my small c++ program, I can run it one at a time:

./a.out TestMusic.wav

Quoted 7 lines

The thing's that how I can mix sounds when I run:

./a.out TestMusic01.wav &
./a.out TestMusic02.wav &
./a.out TestMusic03.wav &

Thank you very much,

Simply use different pcm name as argument to snd_pcm_open(). Replace 'default' with 'plug:dmix'.

Jaroslav

-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs

-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner. Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission! INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php