- started separation of sb16 and lowlevel sound module code. The first step is
an own header file for the basic sound output class. When ready we should have a separate 'soundmod' plugin that could be used by other soundcard implementations.
This commit is contained in:
parent
5915d92775
commit
dec6bcaf73
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (C) 2001-2009 The Bochs Project
|
||||
// Copyright (C) 2001-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
|
||||
@ -218,8 +218,6 @@
|
||||
#define BX_SUPPORT_GAMEPORT 0
|
||||
|
||||
#if BX_SUPPORT_SB16
|
||||
// Use virtual methods for the sound output functions
|
||||
#define BX_USE_SOUND_VIRTUAL 1
|
||||
// Determines which sound output class is to be used.
|
||||
// Currently the following are available:
|
||||
// bx_sound_linux_c Output for Linux, to /dev/dsp and /dev/midi00
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!--
|
||||
================================================================
|
||||
doc/docbook/development/development.dbk
|
||||
$Id: development.dbk,v 1.36 2010-05-15 19:35:41 sshwarts Exp $
|
||||
$Id: development.dbk,v 1.37 2011-01-25 23:29:08 vruppert Exp $
|
||||
|
||||
This is the top level file for the Bochs Developers Manual.
|
||||
================================================================
|
||||
@ -777,13 +777,6 @@ BX_USE_SB16_SMF should be 1 unless you intend to have several sound cards
|
||||
running at the same time.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
BX_USE_SOUND_VIRTUAL can be 0 or 1, and determines whether the output class
|
||||
uses virtual functions or not. The former is more versatile and allows to
|
||||
select the class at runtime (not supported at the moment), while the latter
|
||||
is slightly faster.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
BX_SOUND_OUTPUT_C is the name of the class used for output. The default is
|
||||
to have no output functions, so you need to change this if you want any sound.
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!--
|
||||
================================================================
|
||||
doc/docbook/user/user.dbk
|
||||
$Id: user.dbk,v 1.286 2011-01-06 18:15:28 vruppert Exp $
|
||||
$Id: user.dbk,v 1.287 2011-01-25 23:29:08 vruppert Exp $
|
||||
|
||||
This is the top level file for the Bochs Users Manual.
|
||||
================================================================
|
||||
@ -4466,13 +4466,6 @@ BX_USE_SB16_SMF should be 1 unless you intend to have several sound cards
|
||||
running at the same time.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
BX_USE_SOUND_VIRTUAL can be 0 or 1, and determines whether the output class
|
||||
uses virtual functions or not. The former is more versatile and allows to
|
||||
select the class at runtime (not supported at the moment), while the latter
|
||||
is slightly faster.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
BX_SOUND_OUTPUT_C is the name of the class used for output. The default is
|
||||
to have no output functions, so you need to change this if you want any sound.
|
||||
|
@ -1,8 +1,8 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: sb16.cc,v 1.70 2010-02-26 14:18:19 sshwarts Exp $
|
||||
// $Id: sb16.cc,v 1.71 2011-01-25 23:29:08 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001-2009 The Bochs Project
|
||||
// Copyright (C) 2001-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
|
||||
@ -20,7 +20,7 @@
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// This file (SB16.CC) written and donated by Josef Drexler
|
||||
// The original version of the SB16 support written and donated by Josef Drexler
|
||||
|
||||
// Define BX_PLUGGABLE in files that can be compiled into plugins. For
|
||||
// platforms that require a special tag on exported symbols, BX_PLUGGABLE
|
||||
@ -28,11 +28,11 @@
|
||||
#define BX_PLUGGABLE
|
||||
|
||||
#include "iodev.h"
|
||||
#include "param_names.h"
|
||||
|
||||
#if BX_SUPPORT_SB16
|
||||
|
||||
#include "sb16.h"
|
||||
#include "soundmod.h"
|
||||
#include "soundlnx.h"
|
||||
#include "soundwin.h"
|
||||
#include "soundosx.h"
|
||||
@ -63,7 +63,7 @@ void libsb16_LTX_plugin_fini(void)
|
||||
#define EMUL BX_SB16_THIS emuldata
|
||||
#define OPL BX_SB16_THIS opl
|
||||
|
||||
#define BX_SB16_OUTPUT BX_SB16_THIS output
|
||||
#define BX_SB16_OUTPUT BX_SB16_THIS soundmod
|
||||
|
||||
// here's a safe way to print out null pointeres
|
||||
#define MIGHT_BE_NULL(x) ((x==NULL)? "(null)" : x)
|
||||
@ -437,7 +437,7 @@ void bx_sb16_c::dsp_dmatimer(void *this_ptr)
|
||||
if ((BX_SB16_THIS wavemode != 1) ||
|
||||
((This->dsp.dma.chunkindex + 1 < BX_SOUND_OUTPUT_WAVEPACKETSIZE) &&
|
||||
(This->dsp.dma.count > 0)) ||
|
||||
(This->output->waveready() == BX_SOUND_OUTPUT_OK)) {
|
||||
(BX_SB16_OUTPUT->waveready() == BX_SOUND_OUTPUT_OK)) {
|
||||
if ((DSP.dma.bits == 8) || (BX_SB16_DMAH == 0)) {
|
||||
DEV_dma_set_drq(BX_SB16_DMAL, 1);
|
||||
} else {
|
||||
@ -3669,9 +3669,9 @@ int bx_sb16_buffer::commandbytes(void)
|
||||
}
|
||||
|
||||
// The dummy output functions. They don't do anything
|
||||
bx_sound_output_c::bx_sound_output_c(bx_sb16_c *sb16)
|
||||
bx_sound_output_c::bx_sound_output_c(bx_sb16_c *dev)
|
||||
{
|
||||
UNUSED(sb16);
|
||||
device = dev;
|
||||
}
|
||||
|
||||
bx_sound_output_c::~bx_sound_output_c()
|
||||
@ -3688,9 +3688,9 @@ int bx_sound_output_c::midiready()
|
||||
return BX_SOUND_OUTPUT_OK;
|
||||
}
|
||||
|
||||
int bx_sound_output_c::openmidioutput(char *device)
|
||||
int bx_sound_output_c::openmidioutput(char *mididev)
|
||||
{
|
||||
UNUSED(device);
|
||||
UNUSED(mididev);
|
||||
return BX_SOUND_OUTPUT_OK;
|
||||
}
|
||||
|
||||
@ -3708,9 +3708,9 @@ int bx_sound_output_c::closemidioutput()
|
||||
return BX_SOUND_OUTPUT_OK;
|
||||
}
|
||||
|
||||
int bx_sound_output_c::openwaveoutput(char *device)
|
||||
int bx_sound_output_c::openwaveoutput(char *wavedev)
|
||||
{
|
||||
UNUSED(device);
|
||||
UNUSED(wavedev);
|
||||
return BX_SOUND_OUTPUT_OK;
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: sb16.h,v 1.35 2009-12-04 19:50:29 sshwarts Exp $
|
||||
// $Id: sb16.h,v 1.36 2011-01-25 23:29:08 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001-2009 The Bochs Project
|
||||
// Copyright (C) 2001-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
|
||||
@ -18,7 +18,7 @@
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
// This file (SB16.H) written and donated by Josef Drexler
|
||||
// The original version of the SB16 support written and donated by Josef Drexler
|
||||
|
||||
#ifndef BX_IODEV_SB16_H
|
||||
#define BX_IODEV_SB16_H
|
||||
@ -33,14 +33,6 @@
|
||||
# define BX_SB16_THISP (this)
|
||||
#endif
|
||||
|
||||
#if BX_USE_SOUND_VIRTUAL
|
||||
# define BX_SOUND_VIRTUAL virtual
|
||||
# define BX_SOUND_OUTPUT_C_DEF bx_sound_output_c
|
||||
#else
|
||||
# define BX_SOUND_VIRTUAL
|
||||
# define BX_SOUND_OUTPUT_C_DEF BX_SOUND_OUTPUT_C
|
||||
#endif
|
||||
|
||||
// If the buffer commands are to be inlined:
|
||||
#define BX_SB16_BUFINL BX_CPP_INLINE
|
||||
// BX_CPP_INLINE is defined to the inline keyword for the C++ compiler.
|
||||
@ -79,10 +71,6 @@
|
||||
emulated at adresses 0x388..0x38b, or two separate OPL2's.
|
||||
*/
|
||||
|
||||
/* Definitions for the output functions */
|
||||
#define BX_SOUND_OUTPUT_OK 0
|
||||
#define BX_SOUND_OUTPUT_ERR 1
|
||||
|
||||
// this is the size of a DMA chunk sent to output
|
||||
// it should not be too large to avoid lag, and not too
|
||||
// small to avoid unnecessary overhead.
|
||||
@ -182,7 +170,7 @@ private:
|
||||
|
||||
|
||||
// forward definition
|
||||
class BX_SOUND_OUTPUT_C_DEF;
|
||||
class bx_sound_output_c;
|
||||
|
||||
// The actual emulator class, emulating the sound blaster ports
|
||||
class bx_sb16_c : public bx_devmodel_c {
|
||||
@ -207,7 +195,7 @@ private:
|
||||
int midimode, wavemode, loglevel;
|
||||
Bit32u dmatimer;
|
||||
FILE *logfile, *midifile, *wavefile; // the output files or devices
|
||||
BX_SOUND_OUTPUT_C_DEF *output;// the output class
|
||||
bx_sound_output_c *soundmod;// the output class
|
||||
int currentirq;
|
||||
int currentdma8;
|
||||
int currentdma16;
|
||||
@ -387,40 +375,15 @@ private:
|
||||
#endif
|
||||
};
|
||||
|
||||
// The class with the output functions
|
||||
class bx_sound_output_c : public logfunctions {
|
||||
public:
|
||||
|
||||
/* These functions are the sound output functions, sending
|
||||
the music/sound to the OS specific driver.
|
||||
They are in a different file (sound.cc) because they are
|
||||
non-portable, while everything in sb16.cc is portable */
|
||||
|
||||
bx_sound_output_c(bx_sb16_c *sb16);
|
||||
BX_SOUND_VIRTUAL ~bx_sound_output_c();
|
||||
|
||||
BX_SOUND_VIRTUAL int waveready();
|
||||
BX_SOUND_VIRTUAL int midiready();
|
||||
|
||||
BX_SOUND_VIRTUAL int openmidioutput(char *device);
|
||||
BX_SOUND_VIRTUAL int sendmidicommand(int delta, int command, int length, Bit8u data[]);
|
||||
BX_SOUND_VIRTUAL int closemidioutput();
|
||||
|
||||
BX_SOUND_VIRTUAL int openwaveoutput(char *device);
|
||||
BX_SOUND_VIRTUAL int startwaveplayback(int frequency, int bits, int stereo, int format);
|
||||
BX_SOUND_VIRTUAL int sendwavepacket(int length, Bit8u data[]);
|
||||
BX_SOUND_VIRTUAL int stopwaveplayback();
|
||||
BX_SOUND_VIRTUAL int closewaveoutput();
|
||||
};
|
||||
|
||||
#define WRITELOG sb16->writelog
|
||||
#define BOTHLOG(x) (x)
|
||||
#ifndef BX_SOUNDLOW
|
||||
#define WRITELOG (BX_SB16_THIS writelog)
|
||||
#define MIDILOG(x) ((BX_SB16_THIS midimode>0?x:0x7f))
|
||||
#define WAVELOG(x) ((BX_SB16_THIS wavemode>0?x:0x7f))
|
||||
#else
|
||||
#define MIDILOG(x) ((sb16->get_midimode()>0?x:0x7f))
|
||||
#define WAVELOG(x) ((sb16->get_wavemode()>0?x:0x7f))
|
||||
#define WRITELOG (device->writelog)
|
||||
#define MIDILOG(x) ((device->get_midimode()>0?x:0x7f))
|
||||
#define WAVELOG(x) ((device->get_wavemode()>0?x:0x7f))
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: soundlnx.cc,v 1.22 2011-01-24 20:35:51 vruppert Exp $
|
||||
// $Id: soundlnx.cc,v 1.23 2011-01-25 23:29:08 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001-2011 The Bochs Project
|
||||
@ -26,10 +26,11 @@
|
||||
#include "iodev.h"
|
||||
#define BX_SOUNDLOW
|
||||
#include "sb16.h"
|
||||
#include "soundmod.h"
|
||||
|
||||
#if (defined(linux) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && BX_SUPPORT_SB16
|
||||
|
||||
#define LOG_THIS sb16->
|
||||
#define LOG_THIS device->
|
||||
|
||||
#include "soundlnx.h"
|
||||
|
||||
@ -37,10 +38,9 @@
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/soundcard.h>
|
||||
|
||||
bx_sound_linux_c::bx_sound_linux_c(bx_sb16_c *sb16)
|
||||
:bx_sound_output_c(sb16)
|
||||
bx_sound_linux_c::bx_sound_linux_c(bx_sb16_c *dev)
|
||||
:bx_sound_output_c(dev)
|
||||
{
|
||||
this->sb16 = sb16;
|
||||
#if BX_HAVE_ALSASOUND
|
||||
alsa_seq.handle = NULL;
|
||||
alsa_pcm.handle = NULL;
|
||||
@ -49,6 +49,7 @@ bx_sound_linux_c::bx_sound_linux_c(bx_sb16_c *sb16)
|
||||
midi = NULL;
|
||||
wavedevice = NULL;
|
||||
wave = -1;
|
||||
BX_INFO(("Sound output module 'linux' initialized"));
|
||||
}
|
||||
|
||||
bx_sound_linux_c::~bx_sound_linux_c()
|
||||
@ -68,18 +69,18 @@ int bx_sound_linux_c::midiready()
|
||||
}
|
||||
|
||||
#if BX_HAVE_ALSASOUND
|
||||
int bx_sound_linux_c::alsa_seq_open(char *device)
|
||||
int bx_sound_linux_c::alsa_seq_open(char *alsadev)
|
||||
{
|
||||
char *mididev, *ptr;
|
||||
int client, port, ret = 0;
|
||||
int length = strlen(device) + 1;
|
||||
int length = strlen(alsadev) + 1;
|
||||
|
||||
mididev = new char[length];
|
||||
|
||||
if (mididev == NULL)
|
||||
return BX_SOUND_OUTPUT_ERR;
|
||||
|
||||
strcpy(mididev, device);
|
||||
strcpy(mididev, alsadev);
|
||||
ptr = strtok(mididev, ":");
|
||||
if (ptr == NULL) {
|
||||
WRITELOG(MIDILOG(2), "ALSA sequencer setup: missing client parameters");
|
||||
@ -122,24 +123,24 @@ int bx_sound_linux_c::alsa_seq_open(char *device)
|
||||
}
|
||||
#endif
|
||||
|
||||
int bx_sound_linux_c::openmidioutput(char *device)
|
||||
int bx_sound_linux_c::openmidioutput(char *mididev)
|
||||
{
|
||||
if ((device == NULL) || (strlen(device) < 1))
|
||||
if ((mididev == NULL) || (strlen(mididev) < 1))
|
||||
return BX_SOUND_OUTPUT_ERR;
|
||||
|
||||
#if BX_HAVE_ALSASOUND
|
||||
use_alsa_seq = !strncmp(device, "alsa:", 5);
|
||||
use_alsa_seq = !strncmp(mididev, "alsa:", 5);
|
||||
if (use_alsa_seq) {
|
||||
return alsa_seq_open(device+5);
|
||||
return alsa_seq_open(mididev+5);
|
||||
}
|
||||
#endif
|
||||
|
||||
midi = fopen(device,"w");
|
||||
midi = fopen(mididev,"w");
|
||||
|
||||
if (midi == NULL)
|
||||
{
|
||||
WRITELOG(MIDILOG(2), "Couldn't open midi output device %s: %s.",
|
||||
device, strerror(errno));
|
||||
mididev, strerror(errno));
|
||||
return BX_SOUND_OUTPUT_ERR;
|
||||
}
|
||||
|
||||
@ -248,15 +249,15 @@ int bx_sound_linux_c::closemidioutput()
|
||||
}
|
||||
|
||||
|
||||
int bx_sound_linux_c::openwaveoutput(char *device)
|
||||
int bx_sound_linux_c::openwaveoutput(char *wavedev)
|
||||
{
|
||||
#if BX_HAVE_ALSASOUND
|
||||
use_alsa_pcm = !strcmp(device, "alsa");
|
||||
use_alsa_pcm = !strcmp(wavedev, "alsa");
|
||||
if (use_alsa_pcm) {
|
||||
return BX_SOUND_OUTPUT_OK;
|
||||
}
|
||||
#endif
|
||||
int length = strlen(device) + 1;
|
||||
int length = strlen(wavedev) + 1;
|
||||
|
||||
if (wavedevice != NULL)
|
||||
delete(wavedevice);
|
||||
@ -266,7 +267,7 @@ int bx_sound_linux_c::openwaveoutput(char *device)
|
||||
if (wavedevice == NULL)
|
||||
return BX_SOUND_OUTPUT_ERR;
|
||||
|
||||
strncpy(wavedevice, device, length);
|
||||
strncpy(wavedevice, wavedev, length);
|
||||
|
||||
return BX_SOUND_OUTPUT_OK;
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: soundlnx.h,v 1.14 2009-12-04 19:50:29 sshwarts Exp $
|
||||
// $Id: soundlnx.h,v 1.15 2011-01-25 23:29:08 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001-2009 The Bochs Project
|
||||
// Copyright (C) 2001-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
|
||||
@ -35,36 +35,29 @@
|
||||
|
||||
class bx_sound_linux_c : public bx_sound_output_c {
|
||||
public:
|
||||
bx_sound_linux_c(bx_sb16_c *sb16);
|
||||
BX_SOUND_VIRTUAL ~bx_sound_linux_c();
|
||||
bx_sound_linux_c(bx_sb16_c *dev);
|
||||
virtual ~bx_sound_linux_c();
|
||||
|
||||
// if virtual functions are used, we have to override them
|
||||
// and define our own. Otherwise this file will just implement
|
||||
// the original functions
|
||||
#ifdef BX_USE_SOUND_VIRTUAL
|
||||
BX_SOUND_VIRTUAL int waveready();
|
||||
BX_SOUND_VIRTUAL int midiready();
|
||||
virtual int waveready();
|
||||
virtual int midiready();
|
||||
|
||||
BX_SOUND_VIRTUAL int openmidioutput(char *device);
|
||||
BX_SOUND_VIRTUAL int sendmidicommand(int delta, int command, int length, Bit8u data[]);
|
||||
BX_SOUND_VIRTUAL int closemidioutput();
|
||||
virtual int openmidioutput(char *mididev);
|
||||
virtual int sendmidicommand(int delta, int command, int length, Bit8u data[]);
|
||||
virtual int closemidioutput();
|
||||
|
||||
BX_SOUND_VIRTUAL int openwaveoutput(char *device);
|
||||
BX_SOUND_VIRTUAL int startwaveplayback(int frequency, int bits, int stereo, int format);
|
||||
BX_SOUND_VIRTUAL int sendwavepacket(int length, Bit8u data[]);
|
||||
BX_SOUND_VIRTUAL int stopwaveplayback();
|
||||
BX_SOUND_VIRTUAL int closewaveoutput();
|
||||
#endif
|
||||
virtual int openwaveoutput(char *wavedev);
|
||||
virtual int startwaveplayback(int frequency, int bits, int stereo, int format);
|
||||
virtual int sendwavepacket(int length, Bit8u data[]);
|
||||
virtual int stopwaveplayback();
|
||||
virtual int closewaveoutput();
|
||||
|
||||
private:
|
||||
#if BX_HAVE_ALSASOUND
|
||||
int alsa_seq_open(char *device);
|
||||
int alsa_seq_open(char *alsadev);
|
||||
int alsa_seq_output(int delta, int command, int length, Bit8u data[]);
|
||||
int alsa_pcm_open(int frequency, int bits, int stereo, int format);
|
||||
int alsa_pcm_write();
|
||||
#endif
|
||||
bx_sb16_c *sb16;
|
||||
#if BX_HAVE_ALSASOUND
|
||||
|
||||
bx_bool use_alsa_seq;
|
||||
bx_bool use_alsa_pcm;
|
||||
struct {
|
||||
|
54
bochs/iodev/soundmod.h
Normal file
54
bochs/iodev/soundmod.h
Normal file
@ -0,0 +1,54 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: soundmod.h,v 1.1 2011-01-25 23:29:08 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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
|
||||
|
||||
|
||||
/* Definitions for the output functions */
|
||||
#define BX_SOUND_OUTPUT_OK 0
|
||||
#define BX_SOUND_OUTPUT_ERR 1
|
||||
|
||||
// The class with the output functions
|
||||
class bx_sound_output_c : public logfunctions {
|
||||
public:
|
||||
|
||||
/*
|
||||
These functions are the sound output functions, sending
|
||||
the music/sound to the OS specific driver.
|
||||
They are in a different file (soundxxx.cc) because they are
|
||||
non-portable, while everything in sb16.cc is portable
|
||||
*/
|
||||
|
||||
bx_sound_output_c(bx_sb16_c *dev);
|
||||
virtual ~bx_sound_output_c();
|
||||
|
||||
virtual int waveready();
|
||||
virtual int midiready();
|
||||
|
||||
virtual int openmidioutput(char *mididev);
|
||||
virtual int sendmidicommand(int delta, int command, int length, Bit8u data[]);
|
||||
virtual int closemidioutput();
|
||||
|
||||
virtual int openwaveoutput(char *wavedev);
|
||||
virtual int startwaveplayback(int frequency, int bits, int stereo, int format);
|
||||
virtual int sendwavepacket(int length, Bit8u data[]);
|
||||
virtual int stopwaveplayback();
|
||||
virtual int closewaveoutput();
|
||||
protected:
|
||||
bx_sb16_c *device;
|
||||
};
|
@ -1,8 +1,8 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: soundosx.cc,v 1.13 2011-01-24 20:35:51 vruppert Exp $
|
||||
// $Id: soundosx.cc,v 1.14 2011-01-25 23:29:08 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2004 The Bochs Project
|
||||
// Copyright (C) 2004-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
|
||||
@ -27,10 +27,11 @@
|
||||
#include "iodev.h"
|
||||
#define BX_SOUNDLOW
|
||||
#include "sb16.h"
|
||||
#include "soundmod.h"
|
||||
|
||||
#if defined(macintosh) && BX_SUPPORT_SB16
|
||||
|
||||
#define LOG_THIS sb16->
|
||||
#define LOG_THIS device->
|
||||
|
||||
#include "soundosx.h"
|
||||
|
||||
@ -70,17 +71,16 @@ AudioUnit WaveOutputUnit = NULL;
|
||||
AudioConverterRef WaveConverter = NULL;
|
||||
#endif
|
||||
|
||||
bx_sound_osx_c::bx_sound_osx_c(bx_sb16_c *sb16)
|
||||
:bx_sound_output_c(sb16)
|
||||
bx_sound_osx_c::bx_sound_osx_c(bx_sb16_c *dev)
|
||||
:bx_sound_output_c(dev)
|
||||
{
|
||||
this->sb16 = sb16;
|
||||
|
||||
MidiOpen = 0;
|
||||
WaveOpen = 0;
|
||||
head = 0;
|
||||
tail = 0;
|
||||
for (int i=0; i<BX_SOUND_OSX_NBUF; i++)
|
||||
WaveLength[i] = 0;
|
||||
BX_INFO(("Sound output module 'osx' initialized"));
|
||||
}
|
||||
|
||||
bx_sound_osx_c::~bx_sound_osx_c()
|
||||
@ -94,7 +94,7 @@ int bx_sound_osx_c::midiready()
|
||||
return BX_SOUND_OUTPUT_OK;
|
||||
}
|
||||
|
||||
int bx_sound_osx_c::openmidioutput(char *device)
|
||||
int bx_sound_osx_c::openmidioutput(char *mididev)
|
||||
{
|
||||
#ifdef BX_SOUND_OSX_use_converter
|
||||
ComponentDescription description;
|
||||
@ -136,7 +136,7 @@ int bx_sound_osx_c::openmidioutput(char *device)
|
||||
// Start playing
|
||||
AUGraphStart (MidiGraph);
|
||||
#endif
|
||||
WRITELOG(WAVELOG(4), "openmidioutput(%s)", device);
|
||||
WRITELOG(WAVELOG(4), "openmidioutput(%s)", mididev);
|
||||
MidiOpen = 1;
|
||||
return BX_SOUND_OUTPUT_OK;
|
||||
}
|
||||
@ -182,11 +182,11 @@ void WaveCallbackProc (SndChannelPtr chan, SndCommand *cmd)
|
||||
}
|
||||
#endif
|
||||
|
||||
int bx_sound_osx_c::openwaveoutput(char *device)
|
||||
int bx_sound_osx_c::openwaveoutput(char *wavedev)
|
||||
{
|
||||
OSStatus err;
|
||||
|
||||
WRITELOG(WAVELOG(4), "openwaveoutput(%s)", device);
|
||||
WRITELOG(WAVELOG(4), "openwaveoutput(%s)", wavedev);
|
||||
|
||||
// open the default output unit
|
||||
#ifdef BX_SOUND_OSX_use_quicktime
|
||||
|
@ -1,8 +1,8 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: soundosx.h,v 1.4 2010-02-26 14:18:19 sshwarts Exp $
|
||||
// $Id: soundosx.h,v 1.5 2011-01-25 23:29:08 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2004 The Bochs Project
|
||||
// Copyright (C) 2004-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
|
||||
@ -37,33 +37,26 @@
|
||||
|
||||
class bx_sound_osx_c : public bx_sound_output_c {
|
||||
public:
|
||||
bx_sound_osx_c(bx_sb16_c *sb16);
|
||||
BX_SOUND_VIRTUAL ~bx_sound_osx_c();
|
||||
bx_sound_osx_c(bx_sb16_c *dev);
|
||||
virtual ~bx_sound_osx_c();
|
||||
|
||||
// if virtual functions are used, we have to override them
|
||||
// and define our own. Otherwise this file will just implement
|
||||
// the original functions
|
||||
#ifdef BX_USE_SOUND_VIRTUAL
|
||||
BX_SOUND_VIRTUAL int waveready();
|
||||
BX_SOUND_VIRTUAL int midiready();
|
||||
virtual int waveready();
|
||||
virtual int midiready();
|
||||
|
||||
BX_SOUND_VIRTUAL int openmidioutput(char *device);
|
||||
BX_SOUND_VIRTUAL int sendmidicommand(int delta, int command, int length, Bit8u data[]);
|
||||
BX_SOUND_VIRTUAL int closemidioutput();
|
||||
virtual int openmidioutput(char *mididev);
|
||||
virtual int sendmidicommand(int delta, int command, int length, Bit8u data[]);
|
||||
virtual int closemidioutput();
|
||||
|
||||
BX_SOUND_VIRTUAL int openwaveoutput(char *device);
|
||||
BX_SOUND_VIRTUAL int startwaveplayback(int frequency, int bits, int stereo, int format);
|
||||
BX_SOUND_VIRTUAL int sendwavepacket(int length, Bit8u data[]);
|
||||
BX_SOUND_VIRTUAL int stopwaveplayback();
|
||||
BX_SOUND_VIRTUAL int closewaveoutput();
|
||||
#endif
|
||||
virtual int openwaveoutput(char *wavedev);
|
||||
virtual int startwaveplayback(int frequency, int bits, int stereo, int format);
|
||||
virtual int sendwavepacket(int length, Bit8u data[]);
|
||||
virtual int stopwaveplayback();
|
||||
virtual int closewaveoutput();
|
||||
#ifdef BX_SOUND_OSX_use_converter
|
||||
void nextbuffer(int *outDataSize, void **outData);
|
||||
#endif
|
||||
|
||||
private:
|
||||
bx_sb16_c *sb16;
|
||||
|
||||
int MidiOpen;
|
||||
int WaveOpen;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: soundwin.cc,v 1.26 2011-01-24 20:35:51 vruppert Exp $
|
||||
// $Id: soundwin.cc,v 1.27 2011-01-25 23:29:08 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001-2011 The Bochs Project
|
||||
@ -29,18 +29,17 @@
|
||||
#include "iodev.h"
|
||||
#define BX_SOUNDLOW
|
||||
#include "sb16.h"
|
||||
#include "soundmod.h"
|
||||
|
||||
#if defined(WIN32) && BX_SUPPORT_SB16
|
||||
|
||||
#include "soundwin.h"
|
||||
|
||||
#define LOG_THIS sb16->
|
||||
#define LOG_THIS device->
|
||||
|
||||
bx_sound_windows_c::bx_sound_windows_c(bx_sb16_c *sb16)
|
||||
:bx_sound_output_c(sb16)
|
||||
bx_sound_windows_c::bx_sound_windows_c(bx_sb16_c *dev)
|
||||
:bx_sound_output_c(dev)
|
||||
{
|
||||
this->sb16 = sb16;
|
||||
|
||||
MidiOpen = 0;
|
||||
WaveOpen = 0;
|
||||
|
||||
@ -82,6 +81,8 @@ bx_sound_windows_c::bx_sound_windows_c(bx_sb16_c *sb16)
|
||||
#undef size
|
||||
#undef ALIGN
|
||||
#undef NEWBUFFER
|
||||
|
||||
BX_INFO(("Sound output module 'win' initialized"));
|
||||
}
|
||||
|
||||
bx_sound_windows_c::~bx_sound_windows_c()
|
||||
@ -111,11 +112,11 @@ int bx_sound_windows_c::midiready()
|
||||
return BX_SOUND_OUTPUT_ERR;
|
||||
}
|
||||
|
||||
int bx_sound_windows_c::openmidioutput(char *device)
|
||||
int bx_sound_windows_c::openmidioutput(char *mididev)
|
||||
{
|
||||
// could make the output device selectable,
|
||||
// but currently only the midi mapper is supported
|
||||
UNUSED(device);
|
||||
UNUSED(mididev);
|
||||
|
||||
UINT deviceid = (UINT) MIDIMAPPER;
|
||||
|
||||
@ -186,13 +187,13 @@ int bx_sound_windows_c::closemidioutput()
|
||||
return (ret == 0) ? BX_SOUND_OUTPUT_OK : BX_SOUND_OUTPUT_ERR;
|
||||
}
|
||||
|
||||
int bx_sound_windows_c::openwaveoutput(char *device)
|
||||
int bx_sound_windows_c::openwaveoutput(char *wavedev)
|
||||
{
|
||||
// could make the output device selectable,
|
||||
// but currently only the midi mapper is supported
|
||||
UNUSED(device);
|
||||
// but currently only the wave mapper is supported
|
||||
UNUSED(wavedev);
|
||||
|
||||
WRITELOG(WAVELOG(4), "openwaveoutput(%s)", device);
|
||||
WRITELOG(WAVELOG(4), "openwaveoutput(%s)", wavedev);
|
||||
|
||||
#ifdef usewaveOut
|
||||
WaveDevice = (UINT) WAVEMAPPER;
|
||||
@ -477,7 +478,7 @@ void bx_sound_windows_c::checkmidiready()
|
||||
{
|
||||
UINT ret;
|
||||
|
||||
if ((MidiHeader->dwFlags & WHDR_DONE) != 0)
|
||||
if ((MidiHeader->dwFlags & MHDR_DONE) != 0)
|
||||
{
|
||||
WRITELOG(MIDILOG(5), "SYSEX message done, midi ready again.");
|
||||
ret = midiOutUnprepareHeader(MidiOut, MidiHeader, sizeof(*MidiHeader));
|
||||
|
@ -1,8 +1,8 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: soundwin.h,v 1.8 2009-12-04 19:50:29 sshwarts Exp $
|
||||
// $Id: soundwin.h,v 1.9 2011-01-25 23:29:08 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001-2009 The Bochs Project
|
||||
// Copyright (C) 2001-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
|
||||
@ -166,30 +166,23 @@ typedef struct {
|
||||
|
||||
class bx_sound_windows_c : public bx_sound_output_c {
|
||||
public:
|
||||
bx_sound_windows_c(bx_sb16_c *sb16);
|
||||
BX_SOUND_VIRTUAL ~bx_sound_windows_c();
|
||||
bx_sound_windows_c(bx_sb16_c *dev);
|
||||
virtual ~bx_sound_windows_c();
|
||||
|
||||
// if virtual functions are used, we have to override them
|
||||
// and define our own. Otherwise this file will just implement
|
||||
// the original functions
|
||||
#ifdef BX_USE_SOUND_VIRTUAL
|
||||
BX_SOUND_VIRTUAL int waveready();
|
||||
BX_SOUND_VIRTUAL int midiready();
|
||||
virtual int waveready();
|
||||
virtual int midiready();
|
||||
|
||||
BX_SOUND_VIRTUAL int openmidioutput(char *device);
|
||||
BX_SOUND_VIRTUAL int sendmidicommand(int delta, int command, int length, Bit8u data[]);
|
||||
BX_SOUND_VIRTUAL int closemidioutput();
|
||||
virtual int openmidioutput(char *mididev);
|
||||
virtual int sendmidicommand(int delta, int command, int length, Bit8u data[]);
|
||||
virtual int closemidioutput();
|
||||
|
||||
BX_SOUND_VIRTUAL int openwaveoutput(char *device);
|
||||
BX_SOUND_VIRTUAL int startwaveplayback(int frequency, int bits, int stereo, int format);
|
||||
BX_SOUND_VIRTUAL int sendwavepacket(int length, Bit8u data[]);
|
||||
BX_SOUND_VIRTUAL int stopwaveplayback();
|
||||
BX_SOUND_VIRTUAL int closewaveoutput();
|
||||
#endif
|
||||
virtual int openwaveoutput(char *wavedev);
|
||||
virtual int startwaveplayback(int frequency, int bits, int stereo, int format);
|
||||
virtual int sendwavepacket(int length, Bit8u data[]);
|
||||
virtual int stopwaveplayback();
|
||||
virtual int closewaveoutput();
|
||||
|
||||
private:
|
||||
bx_sb16_c *sb16;
|
||||
|
||||
struct bx_sb16_waveinfo_struct {
|
||||
int frequency;
|
||||
int bits;
|
||||
|
Loading…
Reference in New Issue
Block a user