Slashdot Mirror


What's A Good Way To Handle Multiple /dev/dsp's?

kronoman asks: "I've got a multiple-soundcard setup (three cards, four DSP devices) under Mandrake 7.0. Currently, I have an Ensoniq ES1371 on /dev/dsp0 and /dev/dsp1, an SB AWE64 on /dev/dsp2 and an AU8830 on /dev/dsp3. I'm already using ESD to send all ESD sound (especially xmms/mpg123) to /dev/dsp3, and timidity and kmidi use /dev/dsp1. I want to use /dev/dsp2 for emulator output and /dev/dsp for system sound and programs not smart enough to be able to put sound anywhere else. Unfortunately, most of my emus only want to output to /dev/dsp (in particular, UAE, Bochs, Snes9x). Is there a way to either A) get those emus to send output to /dev/dsp2 or B) get kaudioserver/kwmsound to output on a different DSP device (can't seem to find it in the docs, don't know enough C/C++ to find it in the source without some clue what to look for)"

6 of 17 comments (clear)

  1. Similar problem with CD-ROMs by Tet · · Score: 3

    I have a similar problem with CD-ROMs. Far too many apps use /dev/cdrom, and assume it'll be pointing to the right place. I have both a CD-ROM and a CD-RW in my machine, and obviously can't have /dev/cdrom pointing to both...

    --
    "The invisible and the non-existent look very much alike." -- Delos B. McKown
  2. Use the source Luke! by peterthomas · · Score: 2

    There is an easy answer although it may not be the cleanest/most scalable method. Just edit the source, change the references to /dev/dsp to /dev/dsp2 etc and recompile. Anyone got any comments on this?

  3. EsounD can manage it like this: by Rozzin · · Score: 2

    You can tell esd to use a specific device with the -d parameter, and you can tell it to use TCP and bind a different port by using the -tcp and -port options.

    So, you can set up multiple EsounD instances by doing something like:
    esd -d /dev/dsp0 -tcp -port 12345
    esd -d /dev/dsp1 -tcp -port 12346
    esd -d /dev/dsp2 -tcp -port 12347

    Any programs that have built-in support for EsounD (ie: anything GNOME) can be told to use a specific host:port for audio output.

    What's more: a lot of programs that just try to open /dev/dsp can be launched with the esddsp script, which will cause them to use EsounD for their audio output, ie:

    esddsp --server=localhost:12347 netscape

    Given a build of Netscape that's dynamically linked against the same C library you build your local copy of EsounD (unless you're running an a.out build, it probably is;) with, netscape's audio will acutally come out on /dev/dsp2 (try viewing a shockwave thing with audio, or something).

    Of course, with free software, the proper thing to do would be to patch the source so that it doesn't just assume that /dev/dsp is the proper device to open, and send the patch back to the author/maintainer of the software:)

    --
    -rozzin.
  4. Patch for UAE 0.7.6 by retep · · Score: 3

    I just made a patch for UAE 0.7.6 that adds a -e option that allows you to specify the device used for sound output. Download it here. To apply it simply go into your UAE source directory and type patch -p0 < patchfile where patchfile is the patch you want to apply.

    I hope this helps.

  5. Bochs by retep · · Score: 2

    The most recent version of Bochs supports different sound output devices. Look at the default .bochsrc configuration file and search for /dev/dsp and you'll find the line you need to change.

  6. Solaris solution? by larien · · Score: 3
    Not much help to you in this case, but Solaris recommends this in man audio:
    As some systems may contain more than one audio device, application writers are encouraged to query the AUDIODEV environment variable. If this variable is present in the environment, its value should identify the path name of the default audio device.
    Thus, you would use something like:
    char *dev;
    dev=getenv("AUDIODEV");
    if ( dev == NULL )
    dev = "/dev/audio"; /* or /dev/dsp in linux */
    and now you could use dev in open() calls.

    Perhaps we should recommend this for all app writers under linux?
    --