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
31 #include <sys/ioctl.h>
32 #include <sys/types.h>
37 #include <linux/soundcard.h>
38 #include <linux/cdrom.h>
46 extern int _frequency
;
48 static int _audio_fd
=-1;
50 #define SOUND_BUFFER_BITS 10
51 #define SOUND_BUFFER_SIZE (1<<SOUND_BUFFER_BITS)
57 static int detect_endianess(void)
58 /* is this machine big or little endian? */
64 c
=(unsigned char *) &s
;
66 if(*c
==1) return(AFMT_S16_LE
);
71 int _out_open_oss(char * devfile
)
75 if((_audio_fd
=open(devfile
, O_WRONLY
))==-1)
78 n
=(2<<16)|SOUND_BUFFER_BITS
;
79 if(ioctl(_audio_fd
, SNDCTL_DSP_SETFRAGMENT
, &n
)==-1)
82 if(ioctl(_audio_fd
, SNDCTL_DSP_RESET
, 0)==-1)
85 if(ioctl(_audio_fd
, SNDCTL_DSP_SPEED
, &_frequency
)==-1)
89 if(ioctl(_audio_fd
, SNDCTL_DSP_STEREO
, &n
)==-1)
93 if(ioctl(_audio_fd
, SNDCTL_DSP_SETFMT
, &n
)==-1)
95 /* do I really want 8 bit output? */
97 if(ioctl(_audio_fd
, SNDCTL_DSP_SETFMT
, &n
)==-1)
105 int _out_write_oss(int lsample
, int rsample
)
109 c=lsample & 0xff; write(_audio_fd, &c, 1);
110 c=(lsample & 0xff00) >> 8; write(_audio_fd, &c, 1);
111 c=rsample & 0xff; write(_audio_fd, &c, 1);
112 c=(rsample & 0xff00) >> 8; write(_audio_fd, &c, 1); */
115 i
=lsample
& 0xffff; write(_audio_fd
, &i
, sizeof(short int));
116 i
=rsample
& 0xffff; write(_audio_fd
, &i
, sizeof(short int));
122 int _out_close_oss(void)
128 #endif /* #ifdef LINUX_OSS */