Hi,
I am developing application on leopard board for recording and playing audio in .pcm format on board.
For this purpose i want to open device driver for read and write operation but i am not getting the proper device name to open.
Since in file system of board "dev/dsp" is not present so I used "default" name which is mention in gstreamer documentation for
alsasink and alsasrc elements but it didn't work.
Following is code snippet i used to open device.
char *dev_name = "default"; //Device name for audio read/write: Here I used dev/dsp but which is not there in dev directory.
struct stat st;
/* open sound device */
if (-1 == stat (dev_name, &st))
{
fprintf (stderr,"Error:Cannot identify %s: %d, %s\n",dev_name, errno, strerror (errno));
exit (1);
}
if (!S_ISCHR (st.st_mode))
fprintf (stderr,"Error:%s is no device\n", dev_name);
fd = open(dev_name, O_RDWR);
if (fd < 0)
fprintf (stderr, "Cannot open '%s': %d, %s\n",dev_name, errno, strerror (errno));
exit(1);
This code always fail in first if condition and gives same error as follows
Error:Cannot identify 'examples/alsa': 2, No such file or directory
Please tell me the alsa driver name or method for recording/playing on leopard board
Thanks
Rama
Linux supports ALSA (Advanced Linux Sound Architecture). Start by reading up on ALSA. Then you should be able to use arecord and aplay to get your started.
Todd
Thanks for reply
I used the device name as
char *dev_name="dev/ALSA";
But it does not working it gives the same error.
Can you please tell me exactly what to use in string
"Char *dev_name=???"
Following are the contents of dev directory which is used by board
/dev # ls -l
crw-r--r-- 1 root root 252, 0 Jan 1 00:02 cmem
crw-rw---- 1 root root 5, 1 Jan 1 00:00 console
crw-rw---- 1 root root 116, 0 Jan 1 00:00 controlC0
crw-rw---- 1 root root 10, 63 Jan 1 00:00 cpu_dma_latency
crw-r--r-- 1 root root 251, 0 Jan 1 00:02 dm350mmap
drwxr-xr-x 2 root root 100 Jan 1 00:00 fb
crw-rw---- 1 root root 29, 0 Jan 1 00:00 fb0
crw-rw---- 1 root root 29, 1 Jan 1 00:00 fb1
crw-rw---- 1 root root 29, 2 Jan 1 00:00 fb2
crw-rw---- 1 root root 29, 3 Jan 1 00:00 fb3
crw-rw---- 1 root root 1, 7 Jan 1 00:00 full
drwxr-xr-x 2 root root 40 Jan 1 00:00 i2c
crw-rw---- 1 root root 89, 1 Jan 1 00:00 i2c-1
drwxr-xr-x 2 root root 40 Jan 1 00:00 input
crw-rw---- 1 root root 1, 2 Jan 1 00:00 kmem
crw-rw---- 1 root root 1, 11 Jan 1 00:00 kmsg
srw-rw-rw- 1 root root 0 Jan 1 00:00 log
brw-rw---- 1 root root 7, 0 Jan 1 00:00 loop0
brw-rw---- 1 root root 7, 1 Jan 1 00:00 loop1
brw-rw---- 1 root root 7, 2 Jan 1 00:00 loop2
brw-rw---- 1 root root 7, 3 Jan 1 00:00 loop3
brw-rw---- 1 root root 7, 4 Jan 1 00:00 loop4
brw-rw---- 1 root root 7, 5 Jan 1 00:00 loop5
brw-rw---- 1 root root 7, 6 Jan 1 00:00 loop6
brw-rw---- 1 root root 7, 7 Jan 1 00:00 loop7
crw-rw---- 1 root root 1, 1 Jan 1 00:00 mem
crw-rw---- 1 root root 10, 62 Jan 1 00:00 network_latency
crw-rw---- 1 root root 10, 61 Jan 1 00:00 network_throughput
crw-rw---- 1 root root 1, 3 Jan 1 00:00 null
crw-rw---- 1 root root 116, 24 Jan 1 00:00 pcmC0D0c
crw-rw---- 1 root root 116, 16 Jan 1 00:00 pcmC0D0p
crw-rw---- 1 root root 5, 2 Jan 1 00:00 ptmx
drwxr-xr-x 2 root root 0 Jan 1 00:00 pts
brw-rw---- 1 root root 1, 0 Jan 1 00:00 ram0
crw-rw---- 1 root root 1, 8 Jan 1 00:00 random
drwxr-xr-x 2 root root 120 Jan 1 00:00 snd
crw-rw---- 1 root root 116, 33 Jan 1 00:00 timer
crw-rw---- 1 root root 5, 0 Jan 1 00:00 tty
crw-rw---- 1 root root 4, 64 Jan 1 00:17 ttyS0
crw-rw---- 1 root root 4, 65 Jan 1 00:00 ttyS1
crw-rw---- 1 root root 4, 66 Jan 1 00:00 ttyS2
crw-rw---- 1 root root 1, 9 Jan 1 00:00 urandom
crw-rw---- 1 root root 189, 0 Jan 1 00:00 usbdev1.1
crw-rw---- 1 root root 253, 1 Jan 1 00:00 usbdev1.1_ep00
crw-rw---- 1 root root 253, 0 Jan 1 00:00 usbdev1.1_ep81
crw-rw---- 1 root root 81, 0 Jan 1 00:00 video0
crw-rw---- 1 root root 81, 1 Jan 1 00:00 video2
crw-rw---- 1 root root 81, 2 Jan 1 00:00 video3
crw-rw---- 1 root root 10, 130 Jan 1 00:00 watchdog
crw-rw---- 1 root root 1, 5 Jan 1 00:00 zero
/dev #
I am not getting exact device name for audio.