3 PROGRAM_NAME PROGRAM_VERSION - PROGRAM_DESCRIPTION
5 Copyright (C) 2003 Angel Ortega <angel@triptico.com>
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either version 2
10 of the License, or (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 http://www.triptico.com
33 #include <sys/ioctl.h>
34 #include <sys/types.h>
39 #include <linux/soundcard.h>
40 #include <linux/cdrom.h>
49 static int _audio_fd
=-1;
51 #define SOUND_BUFFER_BITS 10
52 #define SOUND_BUFFER_SIZE (1<<SOUND_BUFFER_BITS)
58 static int detect_endianess(void)
59 /* is this machine big or little endian? */
65 c
=(unsigned char *) &s
;
67 if(*c
==1) return(AFMT_S16_LE
);
72 int _out_open_oss(char * devfile
)
76 if((_audio_fd
=open(devfile
, O_WRONLY
))==-1)
79 n
=(2<<16)|SOUND_BUFFER_BITS
;
80 if(ioctl(_audio_fd
, SNDCTL_DSP_SETFRAGMENT
, &n
)==-1)
83 if(ioctl(_audio_fd
, SNDCTL_DSP_RESET
, 0)==-1)
86 if(ioctl(_audio_fd
, SNDCTL_DSP_SPEED
, &_frequency
)==-1)
90 if(ioctl(_audio_fd
, SNDCTL_DSP_STEREO
, &n
)==-1)
94 if(ioctl(_audio_fd
, SNDCTL_DSP_SETFMT
, &n
)==-1)
96 /* do I really want 8 bit output? */
98 if(ioctl(_audio_fd
, SNDCTL_DSP_SETFMT
, &n
)==-1)
106 int _out_write_oss(int lsample
, int rsample
)
110 c=lsample & 0xff; write(_audio_fd, &c, 1);
111 c=(lsample & 0xff00) >> 8; write(_audio_fd, &c, 1);
112 c=rsample & 0xff; write(_audio_fd, &c, 1);
113 c=(rsample & 0xff00) >> 8; write(_audio_fd, &c, 1); */
116 i
=lsample
& 0xffff; write(_audio_fd
, &i
, sizeof(short int));
117 i
=rsample
& 0xffff; write(_audio_fd
, &i
, sizeof(short int));
123 int _out_close_oss(void)
129 #endif /* #ifdef LINUX_OSS */