| Hello csounder,
I have made an useful modification to rtaudio.c for the people who have
two soundcard and want to use one for input and the other for output.
#ifdef LINUX /* Jonathan Mohr 1995 Oct 17 */
#include
#include
/* in this section you can specify your device for input and for
output */
#define DSPIN_NAME "/dev/dsp1"
#define DSPOUT_NAME "/dev/dsp"
static int dspinfd;
static int dspoutfd;
/* */
void setsndparms(int, int, int, float, unsigned);
void setvolume(volume);
#endif
.
.
.
/* in this section I change DSP_NAME for DSPIN_NAME and
dspfd for dspinfd */
#ifdef LINUX /* Jonathan Mohr 1995 Oct 17 */
/* open DSP device for reading */
if ( (dspinfd = open(DSPIN_NAME, O_RDONLY)) == -1 )
die("unable to open soundcard for audio input");
/* initialize data format, channels, sample rate, and buffer size */
setsndparms( dspinfd, O.informat, nchnls, esr, oMaxLag * O.insampsiz );
#endif
.
.
.
/*same thing here but for DSPOUT_NAME and dspoutfd */
#ifdef LINUX /* J. Mohr 1995 Oct 17 */
/* The following code not only opens the DSP device (soundcard and driver)
for writing and initializes it for the proper sample size, rate, and
channels, but allows the user to set the output volume. */
{
extern void setscheduler(void);
/* open DSP device for writing */
if ( (dspoutfd = open(DSPOUT_NAME, O_WRONLY)) == -1 )
die("unable to open soundcard for audio output");
/* set sample size/format, rate, channels, and DMA buffer size */
setsndparms( dspoutfd, O.outformat, nchnls, esr,
O.outbufsamps * O.outsampsiz);
.
.
.
/* after that, all the dspfd are change to dspinfd or dspoutfd
depending if they are use for input or output*/
/*Don't forget to close the two file descriptor*/
It is possible to use a
csound -odevaudio -idevaudio .....
csound will use the good soundcard
--
Antoine Lefebvre
antoinelefebvre@softhome.net
http://pages.infinit.net/linux/music/music.html
|