2011-01-26 02:29:08 +03:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
2011-02-25 01:05:47 +03:00
|
|
|
// $Id$
|
2011-01-26 02:29:08 +03:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2011 The Bochs Project
|
|
|
|
//
|
|
|
|
// This library is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation; either
|
|
|
|
// version 2 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
// License along with this library; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
|
2011-03-20 21:02:12 +03:00
|
|
|
// Common code for sound lowlevel modules
|
2011-01-26 02:29:08 +03:00
|
|
|
|
2011-03-20 21:02:12 +03:00
|
|
|
// this is the size of a sound packet used for sending and receiving
|
2011-02-11 01:58:22 +03:00
|
|
|
// it should not be too large to avoid lag, and not too
|
|
|
|
// small to avoid unnecessary overhead.
|
2011-03-20 21:02:12 +03:00
|
|
|
#define BX_SOUNDLOW_WAVEPACKETSIZE 8192
|
2011-02-11 01:58:22 +03:00
|
|
|
|
2011-02-15 00:14:20 +03:00
|
|
|
// Definitions for the output functions
|
2011-03-20 21:02:12 +03:00
|
|
|
#define BX_SOUNDLOW_OK 0
|
|
|
|
#define BX_SOUNDLOW_ERR 1
|
2011-01-26 02:29:08 +03:00
|
|
|
|
2011-04-04 20:07:24 +04:00
|
|
|
typedef Bit32u (*sound_record_handler_t)(void *arg, Bit32u len);
|
|
|
|
|
2011-02-15 00:14:20 +03:00
|
|
|
// Pseudo device that loads the lowlevel sound module
|
|
|
|
class bx_soundmod_ctl_c : public bx_soundmod_ctl_stub_c {
|
|
|
|
public:
|
|
|
|
bx_soundmod_ctl_c() {}
|
|
|
|
virtual ~bx_soundmod_ctl_c() {}
|
2011-03-20 21:02:12 +03:00
|
|
|
virtual int init_module(const char *type, void **module, logfunctions *device);
|
2011-02-15 00:14:20 +03:00
|
|
|
};
|
|
|
|
|
2011-03-20 21:02:12 +03:00
|
|
|
// The class with the input/output functions
|
2011-03-19 15:57:13 +03:00
|
|
|
class bx_sound_lowlevel_c : public logfunctions {
|
2011-01-26 02:29:08 +03:00
|
|
|
public:
|
|
|
|
|
|
|
|
/*
|
2011-03-20 21:02:12 +03:00
|
|
|
These functions are the sound lowlevel functions, sending
|
|
|
|
the music or sending/receiving sound to/from the OS specific driver.
|
2011-01-26 02:29:08 +03:00
|
|
|
They are in a different file (soundxxx.cc) because they are
|
2011-03-20 21:02:12 +03:00
|
|
|
non-portable, while everything in the soundcard code is portable
|
2011-01-26 02:29:08 +03:00
|
|
|
*/
|
|
|
|
|
2011-03-19 15:57:13 +03:00
|
|
|
bx_sound_lowlevel_c(logfunctions *dev);
|
|
|
|
virtual ~bx_sound_lowlevel_c();
|
2011-01-26 02:29:08 +03:00
|
|
|
|
|
|
|
virtual int waveready();
|
|
|
|
virtual int midiready();
|
|
|
|
|
2011-02-13 20:26:52 +03:00
|
|
|
virtual int openmidioutput(const char *mididev);
|
2011-01-26 02:29:08 +03:00
|
|
|
virtual int sendmidicommand(int delta, int command, int length, Bit8u data[]);
|
|
|
|
virtual int closemidioutput();
|
|
|
|
|
2011-02-13 20:26:52 +03:00
|
|
|
virtual int openwaveoutput(const char *wavedev);
|
2011-03-20 21:02:12 +03:00
|
|
|
virtual int startwaveplayback(int frequency, int bits, bx_bool stereo, int format);
|
2011-01-26 02:29:08 +03:00
|
|
|
virtual int sendwavepacket(int length, Bit8u data[]);
|
|
|
|
virtual int stopwaveplayback();
|
|
|
|
virtual int closewaveoutput();
|
2011-04-04 20:07:24 +04:00
|
|
|
|
|
|
|
virtual int openwaveinput(const char *wavedev, sound_record_handler_t rh);
|
|
|
|
virtual int startwaverecord(int frequency, int bits, bx_bool stereo, int format);
|
|
|
|
virtual int getwavepacket(int length, Bit8u data[]);
|
|
|
|
virtual int stopwaverecord();
|
|
|
|
virtual int closewaveinput();
|
|
|
|
|
|
|
|
static void record_timer_handler(void *);
|
|
|
|
void record_timer(void);
|
2011-01-26 02:29:08 +03:00
|
|
|
protected:
|
2011-02-11 01:58:22 +03:00
|
|
|
logfunctions *device;
|
2011-04-04 20:07:24 +04:00
|
|
|
int record_timer_index;
|
|
|
|
int record_packet_size;;
|
|
|
|
sound_record_handler_t record_handler;
|
2011-01-26 02:29:08 +03:00
|
|
|
};
|