[linux-audio-dev] Digital in read

Ralfs Kurmis kurmisk at inbox.lv
Fri Jul 4 14:16:00 UTC 2003


Hi folks

I have SB sound card and OSS driver 
For read sound from line in  i use such functions  [see below]
How i can read signals from digital in ?
any example/idea welcomed  

Tnx in advance 

RalfsK



status = read(fdi, adat , sizeof( adat )); /* record some sound */

int fdi;       /* sound device file descriptor */
int fdo;       /* sound device file descriptor */
int arg;      /* argument for ioctl calls */
int status;   /* return status of system calls */

/*----*/void open_sound_device_read(void)
/*----*/{
/*----*/
/*----*/  fdi = open("/dev/dsp", O_RDONLY|O_NONBLOCK );
/*----*/  if (fdi < 0) {
/*----*/    perror("open of /dev/dsp failed");
/*----*/    exit(1);
/*----*/  }
/*----*/  //// set sampling parameters 
/*----*/  arg = SIZE;      //// sample size 
/*----*/  status = ioctl(fdi, SOUND_PCM_WRITE_BITS, &arg);
/*----*/  if (status == -1)
/*----*/    perror("SOUND_PCM_WRITE_BITS ioctl failed");
/*----*/  if (arg != SIZE)
/*----*/    perror("unable to set sample size");
/*----*/
/*----*/  arg = CHANNELS;  //// mono or stereo 
/*----*/  status = ioctl(fdi, SOUND_PCM_WRITE_CHANNELS, &arg);
/*----*/  if (status == -1)
/*----*/    perror("SOUND_PCM_WRITE_CHANNELS ioctl failed");
/*----*/  if (arg != CHANNELS)
/*----*/    perror("unable to set number of channels");
/*----*/
/*----*/  arg = RATE;      //// sampling rate 
/*----*/  status = ioctl(fdi, SOUND_PCM_WRITE_RATE, &arg);
/*----*/  if (status == -1)
/*----*/    perror("SOUND_PCM_WRITE_WRITE ioctl failed");
/*----*/
/*----*/}

/*----*/void close_sound_device_read(void)
/*----*/{
/*----*/  close(fdi);
/*----*/}






---
This message contains no viruses. 
Guaranteed by Kaspersky Anti-Virus.
www.antivirus.lv




More information about the Linux-audio-dev mailing list