Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
×
Hardware

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

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)"
This discussion has been archived. No new comments can be posted.

What's a Good Way to Handle Multiple /dev/dsp's?

Comments Filter:
  • I have not tried this, so I could just be blowing smoke here, but how about running the emulaters in a chroot'd enviro?
  • 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...
  • 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?
  • 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:)
  • symlinks!
  • Can't one just linking /dev/dsp to /dev/dsp2 via ln -s /dev/dsp2 /dev/dsp? Not that I know if this works, but it works on the serial-ports..
  • Hard links surely? The whole point in chroot is that it changes the root!! How can you symlink to another piece of the filesystem when you can't see it?? :)
  • That would just make it all go to /dev/dsp2 would it not? I believe he is trying to make just the his emulators pipe their sound to /dev/dsp2, with the rest of the sound (system beeps etc) going to /dev/dsp.

    I'm not entirely sure why you would want to do this, but I'm guessing that he wants to record the sound from some of his programs without the risk of having random system sounds interspersed in there.


  • This isn't really an answer to the question, but please bear with me... there are good reasons to run multiple soundcards simultaneously (for instance, recording each player in your band through a separate channel), but this doesn't sound like one of them. Instead, the standard approach is to mix the output of the three programs together in software, and send it to the speakers through a single card. This is exactly what ESD and the like were created to do.

    But my grandest creation, as history will tell,
  • chroot enviro's are pretty tough to setup. You need to copy all of the libraries needed from /lib and /usr/lib, any needed shared files from /usr/share and anything else you find you need such as programs. It can be done, but it would be easier to just change the source for the programs in question.

  • by retep ( 108840 ) on Tuesday June 20, 2000 @07:04AM (#990812)

    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. [sourceforge.net] 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.

  • That'll be a few minutes work to fix... I'm off to write some patches for UAE, Bochs and Snes9x!

  • by retep ( 108840 )

    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.

  • Or edit the binary. Load up the binary into emacs, then search for /dev/dsp - make sure emacs is in overwrite mode and change it to "/dev/ds2" - you cant make it /dev/dsp2 because that would change the length of the binary and probably break it.

    Now make /dev/ds2 as a symlink to /dev/dsp2. Sorted.

    Make a backup of the binary first of course...

    Baz

  • Posted by 11223:

    If you're using the commercial Open Sound System, there is a program that comes with your distrobution that allows you to run another program on a different dsp. I don't know the name (don't use OSS myself), but check your documentation.
  • by larien ( 5608 ) on Wednesday June 21, 2000 @03:08AM (#990817) Homepage Journal
    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?
    --

  • Oops - I was too quick with that post! Symlinks certainly wouldn't be much good if the target can't be accessed.

    And even with hard links, a chrooted environment would be hard to set up if you had / and /usr on seperate partitions, since it would be impossible to link to both /bin and /usr/bin and /lib and /usr/lib (and /usr/local/bin and /usr/local/lib as well)

BLISS is ignorance.

Working...