1 /////////////////////////////////////////////////////////////////////////
2 // $Id: soundlnx.h,v 1.11 2008/07/20 08:08:23 vruppert Exp $
3 /////////////////////////////////////////////////////////////////////////
5 // Copyright (C) 2001 MandrakeSoft S.A.
9 // 75002 Paris - France
10 // http://www.linux-mandrake.com/
11 // http://www.mandrakesoft.com/
13 // This library is free software; you can redistribute it and/or
14 // modify it under the terms of the GNU Lesser General Public
15 // License as published by the Free Software Foundation; either
16 // version 2 of the License, or (at your option) any later version.
18 // This library is distributed in the hope that it will be useful,
19 // but WITHOUT ANY WARRANTY; without even the implied warranty of
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 // Lesser General Public License for more details.
23 // You should have received a copy of the GNU Lesser General Public
24 // License along with this library; if not, write to the Free Software
25 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 // Josef Drexler coded the original version of the lowlevel sound support
28 // for Linux using OSS. The current version also supports OSS on FreeBSD and
29 // ALSA PCM output on Linux.
31 #if (defined(linux) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__))
33 #define BX_SOUND_LINUX_BUFSIZE BX_SOUND_OUTPUT_WAVEPACKETSIZE * 2
36 #define ALSA_PCM_NEW_HW_PARAMS_API
37 #include <alsa/asoundlib.h>
40 class bx_sound_linux_c
: public bx_sound_output_c
{
42 bx_sound_linux_c(bx_sb16_c
*sb16
);
43 BX_SOUND_VIRTUAL
~bx_sound_linux_c();
45 // if virtual functions are used, we have to override them
46 // and define our own. Otherwise this file will just implement
47 // the original functions
48 #ifdef BX_USE_SOUND_VIRTUAL
49 BX_SOUND_VIRTUAL
int waveready();
50 BX_SOUND_VIRTUAL
int midiready();
52 BX_SOUND_VIRTUAL
int openmidioutput(char *device
);
53 BX_SOUND_VIRTUAL
int sendmidicommand(int delta
, int command
, int length
, Bit8u data
[]);
54 BX_SOUND_VIRTUAL
int closemidioutput();
56 BX_SOUND_VIRTUAL
int openwaveoutput(char *device
);
57 BX_SOUND_VIRTUAL
int startwaveplayback(int frequency
, int bits
, int stereo
, int format
);
58 BX_SOUND_VIRTUAL
int sendwavepacket(int length
, Bit8u data
[]);
59 BX_SOUND_VIRTUAL
int stopwaveplayback();
60 BX_SOUND_VIRTUAL
int closewaveoutput();
65 int alsa_seq_open(char *device
);
66 int alsa_seq_output(int delta
, int command
, int length
, Bit8u data
[]);
67 int alsa_pcm_open(int frequency
, int bits
, int stereo
, int format
);
80 snd_pcm_uframes_t frames
;
82 int dir
, alsa_bufsize
, audio_bufsize
;
88 Bit8u audio_buffer
[BX_SOUND_LINUX_BUFSIZE
];
89 int oldfreq
,oldbits
,oldstereo
,oldformat
;