Moved sources of the sound lowlevel base class ('dummy' driver) to separate files.

This commit is contained in:
Volker Ruppert 2014-11-24 18:25:14 +00:00
parent 5a346de14d
commit fba9145f66
12 changed files with 297 additions and 229 deletions

View File

@ -49,7 +49,7 @@ top_builddir = ../..
LIBTOOL=@LIBTOOL@ LIBTOOL=@LIBTOOL@
WIN32_DLL_IMPORT_LIBRARY=../../@WIN32_DLL_IMPORT_LIB@ WIN32_DLL_IMPORT_LIBRARY=../../@WIN32_DLL_IMPORT_LIB@
SOUNDLOW_OBJS = @SOUNDLOW_OBJS@ SOUNDLOW_OBJS = soundlow.o @SOUNDLOW_OBJS@
SOUNDMOD_LINK_OPTS = -lwinmm SOUNDMOD_LINK_OPTS = -lwinmm
SOUNDMOD_LINK_OPTS_VCPP = winmm.lib SOUNDMOD_LINK_OPTS_VCPP = winmm.lib
@ -61,8 +61,7 @@ OBJS_THAT_CAN_BE_PLUGINS = \
@SOUNDCARD_OBJS@ \ @SOUNDCARD_OBJS@ \
soundmod.o soundmod.o
OBJS_THAT_SUPPORT_OTHER_PLUGINS = \ OBJS_THAT_SUPPORT_OTHER_PLUGINS = $(SOUNDLOW_OBJS)
$(SOUNDLOW_OBJS)
NONPLUGIN_OBJS = @IODEV_EXT_NON_PLUGIN_OBJS@ NONPLUGIN_OBJS = @IODEV_EXT_NON_PLUGIN_OBJS@
PLUGIN_OBJS = @IODEV_EXT_PLUGIN_OBJS@ PLUGIN_OBJS = @IODEV_EXT_PLUGIN_OBJS@
@ -133,96 +132,108 @@ es1370.o: es1370.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h ../../osde
../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \ ../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \
../../memory/memory.h ../../pc_system.h ../../gui/gui.h \ ../../memory/memory.h ../../pc_system.h ../../gui/gui.h \
../../instrument/stubs/instrument.h ../../plugin.h ../../extplugin.h \ ../../instrument/stubs/instrument.h ../../plugin.h ../../extplugin.h \
../../param_names.h ../pci.h es1370.h soundmod.h ../../param_names.h ../pci.h es1370.h soundlow.h
sb16.o: sb16.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h ../../osdep.h \ sb16.o: sb16.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h ../../osdep.h \
../../bx_debug/debug.h ../../config.h ../../osdep.h \ ../../bx_debug/debug.h ../../config.h ../../osdep.h \
../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \ ../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \
../../memory/memory.h ../../pc_system.h ../../gui/gui.h \ ../../memory/memory.h ../../pc_system.h ../../gui/gui.h \
../../instrument/stubs/instrument.h ../../plugin.h ../../extplugin.h \ ../../instrument/stubs/instrument.h ../../plugin.h ../../extplugin.h \
../../param_names.h sb16.h soundmod.h ../../param_names.h sb16.h soundlow.h
soundalsa.o: soundalsa.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h \ soundalsa.o: soundalsa.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h \
../../osdep.h ../../bx_debug/debug.h ../../config.h ../../osdep.h \ ../../osdep.h ../../bx_debug/debug.h ../../config.h ../../osdep.h \
../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \ ../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \
../../memory/memory.h ../../pc_system.h ../../gui/gui.h \ ../../memory/memory.h ../../pc_system.h ../../gui/gui.h \
../../instrument/stubs/instrument.h ../../plugin.h ../../extplugin.h \ ../../instrument/stubs/instrument.h ../../plugin.h ../../extplugin.h \
../../param_names.h soundmod.h soundalsa.h ../../param_names.h soundlow.h soundalsa.h
soundlnx.o: soundlnx.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h \ soundlnx.o: soundlnx.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h \
../../osdep.h ../../bx_debug/debug.h ../../config.h ../../osdep.h \ ../../osdep.h ../../bx_debug/debug.h ../../config.h ../../osdep.h \
../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \ ../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \
../../memory/memory.h ../../pc_system.h ../../gui/gui.h \ ../../memory/memory.h ../../pc_system.h ../../gui/gui.h \
../../instrument/stubs/instrument.h ../../plugin.h ../../extplugin.h \ ../../instrument/stubs/instrument.h ../../plugin.h ../../extplugin.h \
../../param_names.h soundmod.h soundlnx.h ../../param_names.h soundlow.h soundlnx.h
soundlow.o: soundlow.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h \
../../osdep.h ../../bx_debug/debug.h ../../config.h ../../osdep.h \
../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \
../../memory/memory.h ../../pc_system.h ../../gui/gui.h \
../../instrument/stubs/instrument.h ../../plugin.h ../../extplugin.h \
../../param_names.h soundlow.h
soundmod.o: soundmod.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h \ soundmod.o: soundmod.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h \
../../osdep.h ../../bx_debug/debug.h ../../config.h ../../osdep.h \ ../../osdep.h ../../bx_debug/debug.h ../../config.h ../../osdep.h \
../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \ ../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \
../../memory/memory.h ../../pc_system.h ../../gui/gui.h \ ../../memory/memory.h ../../pc_system.h ../../gui/gui.h \
../../instrument/stubs/instrument.h ../../plugin.h ../../extplugin.h \ ../../instrument/stubs/instrument.h ../../plugin.h ../../extplugin.h \
../../param_names.h soundmod.h soundlnx.h soundosx.h soundwin.h \ ../../param_names.h soundmod.h soundlow.h soundlnx.h soundosx.h \
soundsdl.h soundalsa.h soundwin.h soundsdl.h soundalsa.h
soundosx.o: soundosx.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h \ soundosx.o: soundosx.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h \
../../osdep.h ../../bx_debug/debug.h ../../config.h ../../osdep.h \ ../../osdep.h ../../bx_debug/debug.h ../../config.h ../../osdep.h \
../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \ ../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \
../../memory/memory.h ../../pc_system.h ../../gui/gui.h \ ../../memory/memory.h ../../pc_system.h ../../gui/gui.h \
../../instrument/stubs/instrument.h ../../plugin.h ../../extplugin.h \ ../../instrument/stubs/instrument.h ../../plugin.h ../../extplugin.h \
../../param_names.h soundmod.h soundosx.h ../../param_names.h soundlow.h soundosx.h
soundsdl.o: soundsdl.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h \ soundsdl.o: soundsdl.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h \
../../osdep.h ../../bx_debug/debug.h ../../config.h ../../osdep.h \ ../../osdep.h ../../bx_debug/debug.h ../../config.h ../../osdep.h \
../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \ ../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \
../../memory/memory.h ../../pc_system.h ../../gui/gui.h \ ../../memory/memory.h ../../pc_system.h ../../gui/gui.h \
../../instrument/stubs/instrument.h ../../plugin.h ../../extplugin.h \ ../../instrument/stubs/instrument.h ../../plugin.h ../../extplugin.h \
../../param_names.h soundmod.h soundsdl.h ../../param_names.h soundlow.h soundsdl.h
soundwin.o: soundwin.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h \ soundwin.o: soundwin.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h \
../../osdep.h ../../bx_debug/debug.h ../../config.h ../../osdep.h \ ../../osdep.h ../../bx_debug/debug.h ../../config.h ../../osdep.h \
../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \ ../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \
../../memory/memory.h ../../pc_system.h ../../gui/gui.h \ ../../memory/memory.h ../../pc_system.h ../../gui/gui.h \
../../instrument/stubs/instrument.h ../../plugin.h ../../extplugin.h \ ../../instrument/stubs/instrument.h ../../plugin.h ../../extplugin.h \
../../param_names.h soundmod.h soundwin.h ../../param_names.h soundlow.h soundwin.h
es1370.lo: es1370.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h ../../osdep.h \ es1370.lo: es1370.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h ../../osdep.h \
../../bx_debug/debug.h ../../config.h ../../osdep.h \ ../../bx_debug/debug.h ../../config.h ../../osdep.h \
../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \ ../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \
../../memory/memory.h ../../pc_system.h ../../gui/gui.h \ ../../memory/memory.h ../../pc_system.h ../../gui/gui.h \
../../instrument/stubs/instrument.h ../../plugin.h ../../extplugin.h \ ../../instrument/stubs/instrument.h ../../plugin.h ../../extplugin.h \
../../param_names.h ../pci.h es1370.h soundmod.h ../../param_names.h ../pci.h es1370.h soundlow.h
sb16.lo: sb16.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h ../../osdep.h \ sb16.lo: sb16.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h ../../osdep.h \
../../bx_debug/debug.h ../../config.h ../../osdep.h \ ../../bx_debug/debug.h ../../config.h ../../osdep.h \
../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \ ../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \
../../memory/memory.h ../../pc_system.h ../../gui/gui.h \ ../../memory/memory.h ../../pc_system.h ../../gui/gui.h \
../../instrument/stubs/instrument.h ../../plugin.h ../../extplugin.h \ ../../instrument/stubs/instrument.h ../../plugin.h ../../extplugin.h \
../../param_names.h sb16.h soundmod.h ../../param_names.h sb16.h soundlow.h
soundalsa.lo: soundalsa.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h \ soundalsa.lo: soundalsa.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h \
../../osdep.h ../../bx_debug/debug.h ../../config.h ../../osdep.h \ ../../osdep.h ../../bx_debug/debug.h ../../config.h ../../osdep.h \
../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \ ../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \
../../memory/memory.h ../../pc_system.h ../../gui/gui.h \ ../../memory/memory.h ../../pc_system.h ../../gui/gui.h \
../../instrument/stubs/instrument.h ../../plugin.h ../../extplugin.h \ ../../instrument/stubs/instrument.h ../../plugin.h ../../extplugin.h \
../../param_names.h soundmod.h soundalsa.h ../../param_names.h soundlow.h soundalsa.h
soundlnx.lo: soundlnx.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h \ soundlnx.lo: soundlnx.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h \
../../osdep.h ../../bx_debug/debug.h ../../config.h ../../osdep.h \ ../../osdep.h ../../bx_debug/debug.h ../../config.h ../../osdep.h \
../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \ ../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \
../../memory/memory.h ../../pc_system.h ../../gui/gui.h \ ../../memory/memory.h ../../pc_system.h ../../gui/gui.h \
../../instrument/stubs/instrument.h ../../plugin.h ../../extplugin.h \ ../../instrument/stubs/instrument.h ../../plugin.h ../../extplugin.h \
../../param_names.h soundmod.h soundlnx.h ../../param_names.h soundlow.h soundlnx.h
soundlow.lo: soundlow.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h \
../../osdep.h ../../bx_debug/debug.h ../../config.h ../../osdep.h \
../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \
../../memory/memory.h ../../pc_system.h ../../gui/gui.h \
../../instrument/stubs/instrument.h ../../plugin.h ../../extplugin.h \
../../param_names.h soundlow.h
soundmod.lo: soundmod.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h \ soundmod.lo: soundmod.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h \
../../osdep.h ../../bx_debug/debug.h ../../config.h ../../osdep.h \ ../../osdep.h ../../bx_debug/debug.h ../../config.h ../../osdep.h \
../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \ ../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \
../../memory/memory.h ../../pc_system.h ../../gui/gui.h \ ../../memory/memory.h ../../pc_system.h ../../gui/gui.h \
../../instrument/stubs/instrument.h ../../plugin.h ../../extplugin.h \ ../../instrument/stubs/instrument.h ../../plugin.h ../../extplugin.h \
../../param_names.h soundmod.h soundlnx.h soundosx.h soundwin.h \ ../../param_names.h soundmod.h soundlow.h soundlnx.h soundosx.h \
soundsdl.h soundalsa.h soundwin.h soundsdl.h soundalsa.h
soundosx.lo: soundosx.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h \ soundosx.lo: soundosx.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h \
../../osdep.h ../../bx_debug/debug.h ../../config.h ../../osdep.h \ ../../osdep.h ../../bx_debug/debug.h ../../config.h ../../osdep.h \
../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \ ../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \
../../memory/memory.h ../../pc_system.h ../../gui/gui.h \ ../../memory/memory.h ../../pc_system.h ../../gui/gui.h \
../../instrument/stubs/instrument.h ../../plugin.h ../../extplugin.h \ ../../instrument/stubs/instrument.h ../../plugin.h ../../extplugin.h \
../../param_names.h soundmod.h soundosx.h ../../param_names.h soundlow.h soundosx.h
soundsdl.lo: soundsdl.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h \ soundsdl.lo: soundsdl.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h \
../../osdep.h ../../bx_debug/debug.h ../../config.h ../../osdep.h \ ../../osdep.h ../../bx_debug/debug.h ../../config.h ../../osdep.h \
../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \ ../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \
../../memory/memory.h ../../pc_system.h ../../gui/gui.h \ ../../memory/memory.h ../../pc_system.h ../../gui/gui.h \
../../instrument/stubs/instrument.h ../../plugin.h ../../extplugin.h \ ../../instrument/stubs/instrument.h ../../plugin.h ../../extplugin.h \
../../param_names.h soundmod.h soundsdl.h ../../param_names.h soundlow.h soundsdl.h
soundwin.lo: soundwin.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h \ soundwin.lo: soundwin.@CPP_SUFFIX@ ../iodev.h ../../bochs.h ../../config.h \
../../osdep.h ../../bx_debug/debug.h ../../config.h ../../osdep.h \ ../../osdep.h ../../bx_debug/debug.h ../../config.h ../../osdep.h \
../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \ ../../gui/siminterface.h ../../cpudb.h ../../gui/paramtree.h \
../../memory/memory.h ../../pc_system.h ../../gui/gui.h \ ../../memory/memory.h ../../pc_system.h ../../gui/gui.h \
../../instrument/stubs/instrument.h ../../plugin.h ../../extplugin.h \ ../../instrument/stubs/instrument.h ../../plugin.h ../../extplugin.h \
../../param_names.h soundmod.h soundwin.h ../../param_names.h soundlow.h soundwin.h

View File

@ -36,7 +36,7 @@
#include "pci.h" #include "pci.h"
#include "es1370.h" #include "es1370.h"
#include "soundmod.h" #include "soundlow.h"
#include <math.h> #include <math.h>

View File

@ -32,7 +32,7 @@
#if BX_SUPPORT_SB16 #if BX_SUPPORT_SB16
#include "sb16.h" #include "sb16.h"
#include "soundmod.h" #include "soundlow.h"
#include <math.h> #include <math.h>

View File

@ -22,7 +22,7 @@
// ALSA PCM input/output and MIDI output support written by Volker Ruppert // ALSA PCM input/output and MIDI output support written by Volker Ruppert
#include "iodev.h" #include "iodev.h"
#include "soundmod.h" #include "soundlow.h"
#include "soundalsa.h" #include "soundalsa.h"
#if BX_HAVE_ALSASOUND && BX_SUPPORT_SOUNDLOW #if BX_HAVE_ALSASOUND && BX_SUPPORT_SOUNDLOW

View File

@ -2,7 +2,7 @@
// $Id$ // $Id$
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2001-2013 The Bochs Project // Copyright (C) 2001-2014 The Bochs Project
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
@ -23,7 +23,7 @@
// for Linux using OSS. The current version also supports OSS on FreeBSD. // for Linux using OSS. The current version also supports OSS on FreeBSD.
#include "iodev.h" #include "iodev.h"
#include "soundmod.h" #include "soundlow.h"
#include "soundlnx.h" #include "soundlnx.h"
#if (defined(linux) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && BX_SUPPORT_SOUNDLOW #if (defined(linux) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && BX_SUPPORT_SOUNDLOW

View File

@ -0,0 +1,170 @@
/////////////////////////////////////////////////////////////////////////
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011-2014 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
// Common sound module code and dummy sound lowlevel functions
// Define BX_PLUGGABLE in files that can be compiled into plugins. For
// platforms that require a special tag on exported symbols, BX_PLUGGABLE
// is used to know when we are exporting symbols and when we are importing.
#define BX_PLUGGABLE
#include "iodev.h"
#if BX_SUPPORT_SOUNDLOW
#include "soundlow.h"
// The dummy sound lowlevel functions. They don't do anything.
bx_sound_lowlevel_c::bx_sound_lowlevel_c()
{
put("soundlow", "SNDLOW");
record_timer_index = BX_NULL_TIMER_HANDLE;
}
bx_sound_lowlevel_c::~bx_sound_lowlevel_c()
{
}
int bx_sound_lowlevel_c::waveready()
{
return BX_SOUNDLOW_OK;
}
int bx_sound_lowlevel_c::midiready()
{
return BX_SOUNDLOW_OK;
}
int bx_sound_lowlevel_c::openmidioutput(const char *mididev)
{
UNUSED(mididev);
return BX_SOUNDLOW_OK;
}
int bx_sound_lowlevel_c::sendmidicommand(int delta, int command, int length, Bit8u data[])
{
UNUSED(delta);
UNUSED(command);
UNUSED(length);
UNUSED(data);
return BX_SOUNDLOW_OK;
}
int bx_sound_lowlevel_c::closemidioutput()
{
return BX_SOUNDLOW_OK;
}
int bx_sound_lowlevel_c::openwaveoutput(const char *wavedev)
{
UNUSED(wavedev);
return BX_SOUNDLOW_OK;
}
int bx_sound_lowlevel_c::startwaveplayback(int frequency, int bits, bx_bool stereo, int format)
{
UNUSED(frequency);
UNUSED(bits);
UNUSED(stereo);
UNUSED(format);
return BX_SOUNDLOW_OK;
}
int bx_sound_lowlevel_c::sendwavepacket(int length, Bit8u data[])
{
UNUSED(length);
UNUSED(data);
return BX_SOUNDLOW_OK;
}
int bx_sound_lowlevel_c::stopwaveplayback()
{
return BX_SOUNDLOW_OK;
}
int bx_sound_lowlevel_c::closewaveoutput()
{
return BX_SOUNDLOW_OK;
}
int bx_sound_lowlevel_c::openwaveinput(const char *wavedev, sound_record_handler_t rh)
{
UNUSED(wavedev);
record_handler = rh;
if (rh != NULL) {
record_timer_index = bx_pc_system.register_timer(this, record_timer_handler, 1, 1, 0, "soundmod");
// record timer: inactive, continuous, frequency variable
}
return BX_SOUNDLOW_OK;
}
int bx_sound_lowlevel_c::startwaverecord(int frequency, int bits, bx_bool stereo, int format)
{
Bit64u timer_val;
Bit8u shift = 0;
UNUSED(format);
if (record_timer_index != BX_NULL_TIMER_HANDLE) {
if (bits == 16) shift++;
if (stereo) shift++;
record_packet_size = (frequency / 10) << shift; // 0.1 sec
if (record_packet_size > BX_SOUNDLOW_WAVEPACKETSIZE) {
record_packet_size = BX_SOUNDLOW_WAVEPACKETSIZE;
}
timer_val = (Bit64u)record_packet_size * 1000000 / (frequency << shift);
bx_pc_system.activate_timer(record_timer_index, (Bit32u)timer_val, 1);
}
return BX_SOUNDLOW_OK;
}
int bx_sound_lowlevel_c::getwavepacket(int length, Bit8u data[])
{
memset(data, 0, length);
return BX_SOUNDLOW_OK;
}
int bx_sound_lowlevel_c::stopwaverecord()
{
if (record_timer_index != BX_NULL_TIMER_HANDLE) {
bx_pc_system.deactivate_timer(record_timer_index);
}
return BX_SOUNDLOW_OK;
}
int bx_sound_lowlevel_c::closewaveinput()
{
stopwaverecord();
return BX_SOUNDLOW_OK;
}
void bx_sound_lowlevel_c::record_timer_handler(void *this_ptr)
{
bx_sound_lowlevel_c *class_ptr = (bx_sound_lowlevel_c *) this_ptr;
class_ptr->record_timer();
}
void bx_sound_lowlevel_c::record_timer(void)
{
record_handler(this, record_packet_size);
}
#endif

View File

@ -0,0 +1,83 @@
/////////////////////////////////////////////////////////////////////////
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011-2014 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
// Common code for sound lowlevel modules
// this is the size of a sound packet used for sending and receiving
// it should not be too large to avoid lag, and not too
// small to avoid unnecessary overhead.
#define BX_SOUNDLOW_WAVEPACKETSIZE 8192
// Definitions for the output functions
#define BX_SOUNDLOW_OK 0
#define BX_SOUNDLOW_ERR 1
// Lowlvel sound modules
#define BX_SOUNDLOW_DUMMY 0
#define BX_SOUNDLOW_LINUX 1
#define BX_SOUNDLOW_OSX 2
#define BX_SOUNDLOW_WIN 3
#define BX_SOUNDLOW_SDL 4
#define BX_SOUNDLOW_ALSA 5
typedef Bit32u (*sound_record_handler_t)(void *arg, Bit32u len);
// The class with the input/output functions
class bx_sound_lowlevel_c : public logfunctions {
public:
/*
These functions are the sound lowlevel functions, sending
the music or sending/receiving sound to/from the OS specific driver.
They are in a different file (soundxxx.cc) because they are
non-portable, while everything in the soundcard code is portable
*/
bx_sound_lowlevel_c();
virtual ~bx_sound_lowlevel_c();
virtual int get_type() {return BX_SOUNDLOW_DUMMY;}
virtual int waveready();
virtual int midiready();
virtual int openmidioutput(const char *mididev);
virtual int sendmidicommand(int delta, int command, int length, Bit8u data[]);
virtual int closemidioutput();
virtual int openwaveoutput(const char *wavedev);
virtual int startwaveplayback(int frequency, int bits, bx_bool stereo, int format);
virtual int sendwavepacket(int length, Bit8u data[]);
virtual int stopwaveplayback();
virtual int closewaveoutput();
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);
protected:
int record_timer_index;
int record_packet_size;
sound_record_handler_t record_handler;
};

View File

@ -30,6 +30,7 @@
#if BX_SUPPORT_SOUNDLOW #if BX_SUPPORT_SOUNDLOW
#include "soundmod.h" #include "soundmod.h"
#include "soundlow.h"
#include "soundlnx.h" #include "soundlnx.h"
#include "soundosx.h" #include "soundosx.h"
#include "soundwin.h" #include "soundwin.h"
@ -321,139 +322,4 @@ void bx_soundmod_ctl_c::pcm_apply_volume(Bit32u datalen, Bit8u data[], Bit16u vo
} }
} }
// The dummy sound lowlevel functions. They don't do anything.
bx_sound_lowlevel_c::bx_sound_lowlevel_c()
{
put("soundlow", "SNDLOW");
record_timer_index = BX_NULL_TIMER_HANDLE;
}
bx_sound_lowlevel_c::~bx_sound_lowlevel_c()
{
}
int bx_sound_lowlevel_c::waveready()
{
return BX_SOUNDLOW_OK;
}
int bx_sound_lowlevel_c::midiready()
{
return BX_SOUNDLOW_OK;
}
int bx_sound_lowlevel_c::openmidioutput(const char *mididev)
{
UNUSED(mididev);
return BX_SOUNDLOW_OK;
}
int bx_sound_lowlevel_c::sendmidicommand(int delta, int command, int length, Bit8u data[])
{
UNUSED(delta);
UNUSED(command);
UNUSED(length);
UNUSED(data);
return BX_SOUNDLOW_OK;
}
int bx_sound_lowlevel_c::closemidioutput()
{
return BX_SOUNDLOW_OK;
}
int bx_sound_lowlevel_c::openwaveoutput(const char *wavedev)
{
UNUSED(wavedev);
return BX_SOUNDLOW_OK;
}
int bx_sound_lowlevel_c::startwaveplayback(int frequency, int bits, bx_bool stereo, int format)
{
UNUSED(frequency);
UNUSED(bits);
UNUSED(stereo);
UNUSED(format);
return BX_SOUNDLOW_OK;
}
int bx_sound_lowlevel_c::sendwavepacket(int length, Bit8u data[])
{
UNUSED(length);
UNUSED(data);
return BX_SOUNDLOW_OK;
}
int bx_sound_lowlevel_c::stopwaveplayback()
{
return BX_SOUNDLOW_OK;
}
int bx_sound_lowlevel_c::closewaveoutput()
{
return BX_SOUNDLOW_OK;
}
int bx_sound_lowlevel_c::openwaveinput(const char *wavedev, sound_record_handler_t rh)
{
UNUSED(wavedev);
record_handler = rh;
if (rh != NULL) {
record_timer_index = bx_pc_system.register_timer(this, record_timer_handler, 1, 1, 0, "soundmod");
// record timer: inactive, continuous, frequency variable
}
return BX_SOUNDLOW_OK;
}
int bx_sound_lowlevel_c::startwaverecord(int frequency, int bits, bx_bool stereo, int format)
{
Bit64u timer_val;
Bit8u shift = 0;
UNUSED(format);
if (record_timer_index != BX_NULL_TIMER_HANDLE) {
if (bits == 16) shift++;
if (stereo) shift++;
record_packet_size = (frequency / 10) << shift; // 0.1 sec
if (record_packet_size > BX_SOUNDLOW_WAVEPACKETSIZE) {
record_packet_size = BX_SOUNDLOW_WAVEPACKETSIZE;
}
timer_val = (Bit64u)record_packet_size * 1000000 / (frequency << shift);
bx_pc_system.activate_timer(record_timer_index, (Bit32u)timer_val, 1);
}
return BX_SOUNDLOW_OK;
}
int bx_sound_lowlevel_c::getwavepacket(int length, Bit8u data[])
{
memset(data, 0, length);
return BX_SOUNDLOW_OK;
}
int bx_sound_lowlevel_c::stopwaverecord()
{
if (record_timer_index != BX_NULL_TIMER_HANDLE) {
bx_pc_system.deactivate_timer(record_timer_index);
}
return BX_SOUNDLOW_OK;
}
int bx_sound_lowlevel_c::closewaveinput()
{
stopwaverecord();
return BX_SOUNDLOW_OK;
}
void bx_sound_lowlevel_c::record_timer_handler(void *this_ptr)
{
bx_sound_lowlevel_c *class_ptr = (bx_sound_lowlevel_c *) this_ptr;
class_ptr->record_timer();
}
void bx_sound_lowlevel_c::record_timer(void)
{
record_handler(this, record_packet_size);
}
#endif #endif

View File

@ -2,7 +2,7 @@
// $Id$ // $Id$
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2011-2013 The Bochs Project // Copyright (C) 2011-2014 The Bochs Project
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
@ -20,25 +20,6 @@
// Common code for sound lowlevel modules // Common code for sound lowlevel modules
// this is the size of a sound packet used for sending and receiving
// it should not be too large to avoid lag, and not too
// small to avoid unnecessary overhead.
#define BX_SOUNDLOW_WAVEPACKETSIZE 8192
// Definitions for the output functions
#define BX_SOUNDLOW_OK 0
#define BX_SOUNDLOW_ERR 1
// Lowlvel sound modules
#define BX_SOUNDLOW_DUMMY 0
#define BX_SOUNDLOW_LINUX 1
#define BX_SOUNDLOW_OSX 2
#define BX_SOUNDLOW_WIN 3
#define BX_SOUNDLOW_SDL 4
#define BX_SOUNDLOW_ALSA 5
typedef Bit32u (*sound_record_handler_t)(void *arg, Bit32u len);
class bx_sound_lowlevel_c; class bx_sound_lowlevel_c;
// Pseudo device that loads the lowlevel sound module // Pseudo device that loads the lowlevel sound module
@ -58,46 +39,3 @@ public:
private: private:
bx_sound_lowlevel_c *soundmod; bx_sound_lowlevel_c *soundmod;
}; };
// The class with the input/output functions
class bx_sound_lowlevel_c : public logfunctions {
public:
/*
These functions are the sound lowlevel functions, sending
the music or sending/receiving sound to/from the OS specific driver.
They are in a different file (soundxxx.cc) because they are
non-portable, while everything in the soundcard code is portable
*/
bx_sound_lowlevel_c();
virtual ~bx_sound_lowlevel_c();
virtual int get_type() {return BX_SOUNDLOW_DUMMY;}
virtual int waveready();
virtual int midiready();
virtual int openmidioutput(const char *mididev);
virtual int sendmidicommand(int delta, int command, int length, Bit8u data[]);
virtual int closemidioutput();
virtual int openwaveoutput(const char *wavedev);
virtual int startwaveplayback(int frequency, int bits, bx_bool stereo, int format);
virtual int sendwavepacket(int length, Bit8u data[]);
virtual int stopwaveplayback();
virtual int closewaveoutput();
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);
protected:
int record_timer_index;
int record_packet_size;
sound_record_handler_t record_handler;
};

View File

@ -2,7 +2,7 @@
// $Id$ // $Id$
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2004-2013 The Bochs Project // Copyright (C) 2004-2014 The Bochs Project
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
@ -25,7 +25,7 @@
#endif #endif
#include "iodev.h" #include "iodev.h"
#include "soundmod.h" #include "soundlow.h"
#include "soundosx.h" #include "soundosx.h"
#if defined(macintosh) && BX_SUPPORT_SOUNDLOW #if defined(macintosh) && BX_SUPPORT_SOUNDLOW

View File

@ -21,7 +21,7 @@
// Lowlevel sound output support for SDL written by Volker Ruppert // Lowlevel sound output support for SDL written by Volker Ruppert
#include "iodev.h" #include "iodev.h"
#include "soundmod.h" #include "soundlow.h"
#include "soundsdl.h" #include "soundsdl.h"
#if (BX_WITH_SDL || BX_WITH_SDL2) && BX_SUPPORT_SOUNDLOW #if (BX_WITH_SDL || BX_WITH_SDL2) && BX_SUPPORT_SOUNDLOW

View File

@ -2,7 +2,7 @@
// $Id$ // $Id$
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2001-2013 The Bochs Project // Copyright (C) 2001-2014 The Bochs Project
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
@ -27,7 +27,7 @@
#define BX_PLUGGABLE #define BX_PLUGGABLE
#include "iodev.h" #include "iodev.h"
#include "soundmod.h" #include "soundlow.h"
#include "soundwin.h" #include "soundwin.h"
#if defined(WIN32) && BX_SUPPORT_SOUNDLOW #if defined(WIN32) && BX_SUPPORT_SOUNDLOW