- changed all log messages in the lowlevel sound modules to BX_ERROR, BX_INFO
and BX_DEBUG to make them independent from the SB16 emulation - soundwin: increased number of buffers to 64
This commit is contained in:
parent
389938a508
commit
d7e9cec933
@ -428,8 +428,8 @@ sb16.o: sb16.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \
|
|||||||
../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \
|
../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \
|
||||||
../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \
|
../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \
|
||||||
../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \
|
../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \
|
||||||
../instrument/stubs/instrument.h ../param_names.h sb16.h soundlnx.h \
|
../instrument/stubs/instrument.h ../param_names.h sb16.h soundmod.h \
|
||||||
soundwin.h soundosx.h
|
soundlnx.h soundwin.h soundosx.h
|
||||||
scancodes.o: scancodes.@CPP_SUFFIX@ ../bochs.h ../config.h ../osdep.h \
|
scancodes.o: scancodes.@CPP_SUFFIX@ ../bochs.h ../config.h ../osdep.h \
|
||||||
../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \
|
../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \
|
||||||
../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \
|
../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \
|
||||||
@ -460,17 +460,17 @@ soundlnx.o: soundlnx.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \
|
|||||||
../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \
|
../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \
|
||||||
../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \
|
../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \
|
||||||
../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \
|
../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \
|
||||||
../instrument/stubs/instrument.h ../param_names.h sb16.h soundlnx.h
|
../instrument/stubs/instrument.h ../param_names.h soundmod.h soundlnx.h
|
||||||
soundosx.o: soundosx.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \
|
soundosx.o: soundosx.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \
|
||||||
../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \
|
../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \
|
||||||
../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \
|
../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \
|
||||||
../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \
|
../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \
|
||||||
../instrument/stubs/instrument.h ../param_names.h sb16.h
|
../instrument/stubs/instrument.h ../param_names.h soundmod.h soundosx.h
|
||||||
soundwin.o: soundwin.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \
|
soundwin.o: soundwin.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \
|
||||||
../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \
|
../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \
|
||||||
../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \
|
../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \
|
||||||
../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \
|
../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \
|
||||||
../instrument/stubs/instrument.h ../param_names.h sb16.h
|
../instrument/stubs/instrument.h ../param_names.h soundmod.h soundwin.h
|
||||||
speaker.o: speaker.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \
|
speaker.o: speaker.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \
|
||||||
../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \
|
../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \
|
||||||
../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \
|
../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \
|
||||||
@ -759,8 +759,8 @@ sb16.lo: sb16.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \
|
|||||||
../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \
|
../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \
|
||||||
../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \
|
../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \
|
||||||
../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \
|
../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \
|
||||||
../instrument/stubs/instrument.h ../param_names.h sb16.h soundlnx.h \
|
../instrument/stubs/instrument.h ../param_names.h sb16.h soundmod.h \
|
||||||
soundwin.h soundosx.h
|
soundlnx.h soundwin.h soundosx.h
|
||||||
scancodes.lo: scancodes.@CPP_SUFFIX@ ../bochs.h ../config.h ../osdep.h \
|
scancodes.lo: scancodes.@CPP_SUFFIX@ ../bochs.h ../config.h ../osdep.h \
|
||||||
../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \
|
../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \
|
||||||
../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \
|
../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \
|
||||||
@ -791,17 +791,17 @@ soundlnx.lo: soundlnx.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \
|
|||||||
../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \
|
../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \
|
||||||
../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \
|
../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \
|
||||||
../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \
|
../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \
|
||||||
../instrument/stubs/instrument.h ../param_names.h sb16.h soundlnx.h
|
../instrument/stubs/instrument.h ../param_names.h soundmod.h soundlnx.h
|
||||||
soundosx.lo: soundosx.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \
|
soundosx.lo: soundosx.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \
|
||||||
../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \
|
../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \
|
||||||
../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \
|
../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \
|
||||||
../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \
|
../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \
|
||||||
../instrument/stubs/instrument.h ../param_names.h sb16.h
|
../instrument/stubs/instrument.h ../param_names.h soundmod.h soundosx.h
|
||||||
soundwin.lo: soundwin.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \
|
soundwin.lo: soundwin.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \
|
||||||
../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \
|
../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \
|
||||||
../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \
|
../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \
|
||||||
../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \
|
../pc_system.h ../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h \
|
||||||
../instrument/stubs/instrument.h ../param_names.h sb16.h
|
../instrument/stubs/instrument.h ../param_names.h soundmod.h soundwin.h
|
||||||
speaker.lo: speaker.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \
|
speaker.lo: speaker.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \
|
||||||
../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \
|
../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \
|
||||||
../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \
|
../gui/siminterface.h ../gui/paramtree.h ../memory/memory.h \
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
// $Id: sb16.cc,v 1.71 2011-01-25 23:29:08 vruppert Exp $
|
// $Id: sb16.cc,v 1.72 2011-02-10 22:58:22 vruppert Exp $
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright (C) 2001-2011 The Bochs Project
|
// Copyright (C) 2001-2011 The Bochs Project
|
||||||
@ -3669,7 +3669,7 @@ int bx_sb16_buffer::commandbytes(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// The dummy output functions. They don't do anything
|
// The dummy output functions. They don't do anything
|
||||||
bx_sound_output_c::bx_sound_output_c(bx_sb16_c *dev)
|
bx_sound_output_c::bx_sound_output_c(logfunctions *dev)
|
||||||
{
|
{
|
||||||
device = dev;
|
device = dev;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
// $Id: sb16.h,v 1.36 2011-01-25 23:29:08 vruppert Exp $
|
// $Id: sb16.h,v 1.37 2011-02-10 22:58:22 vruppert Exp $
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright (C) 2001-2011 The Bochs Project
|
// Copyright (C) 2001-2011 The Bochs Project
|
||||||
@ -71,11 +71,6 @@
|
|||||||
emulated at adresses 0x388..0x38b, or two separate OPL2's.
|
emulated at adresses 0x388..0x38b, or two separate OPL2's.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// 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.
|
|
||||||
#define BX_SOUND_OUTPUT_WAVEPACKETSIZE 8192
|
|
||||||
|
|
||||||
#define BX_SB16_MIX_REG 0x100 // total number of mixer registers
|
#define BX_SB16_MIX_REG 0x100 // total number of mixer registers
|
||||||
|
|
||||||
// The array containing an instrument/bank remapping
|
// The array containing an instrument/bank remapping
|
||||||
@ -376,14 +371,8 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define BOTHLOG(x) (x)
|
#define BOTHLOG(x) (x)
|
||||||
#ifndef BX_SOUNDLOW
|
|
||||||
#define WRITELOG (BX_SB16_THIS writelog)
|
#define WRITELOG (BX_SB16_THIS writelog)
|
||||||
#define MIDILOG(x) ((BX_SB16_THIS midimode>0?x:0x7f))
|
#define MIDILOG(x) ((BX_SB16_THIS midimode>0?x:0x7f))
|
||||||
#define WAVELOG(x) ((BX_SB16_THIS wavemode>0?x:0x7f))
|
#define WAVELOG(x) ((BX_SB16_THIS wavemode>0?x:0x7f))
|
||||||
#else
|
|
||||||
#define WRITELOG (device->writelog)
|
|
||||||
#define MIDILOG(x) ((device->get_midimode()>0?x:0x7f))
|
|
||||||
#define WAVELOG(x) ((device->get_wavemode()>0?x:0x7f))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
// $Id: soundlnx.cc,v 1.23 2011-01-25 23:29:08 vruppert Exp $
|
// $Id: soundlnx.cc,v 1.24 2011-02-10 22:58:22 vruppert Exp $
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright (C) 2001-2011 The Bochs Project
|
// Copyright (C) 2001-2011 The Bochs Project
|
||||||
@ -23,22 +23,20 @@
|
|||||||
// for Linux using OSS. The current version also supports OSS on FreeBSD and
|
// for Linux using OSS. The current version also supports OSS on FreeBSD and
|
||||||
// ALSA PCM output on Linux.
|
// ALSA PCM output on Linux.
|
||||||
|
|
||||||
#include "iodev.h"
|
#include "bochs.h"
|
||||||
#define BX_SOUNDLOW
|
|
||||||
#include "sb16.h"
|
|
||||||
#include "soundmod.h"
|
|
||||||
|
|
||||||
#if (defined(linux) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && BX_SUPPORT_SB16
|
#if (defined(linux) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && BX_SUPPORT_SB16
|
||||||
|
|
||||||
#define LOG_THIS device->
|
#define LOG_THIS device->
|
||||||
|
|
||||||
|
#include "soundmod.h"
|
||||||
#include "soundlnx.h"
|
#include "soundlnx.h"
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/soundcard.h>
|
#include <sys/soundcard.h>
|
||||||
|
|
||||||
bx_sound_linux_c::bx_sound_linux_c(bx_sb16_c *dev)
|
bx_sound_linux_c::bx_sound_linux_c(logfunctions *dev)
|
||||||
:bx_sound_output_c(dev)
|
:bx_sound_output_c(dev)
|
||||||
{
|
{
|
||||||
#if BX_HAVE_ALSASOUND
|
#if BX_HAVE_ALSASOUND
|
||||||
@ -83,13 +81,13 @@ int bx_sound_linux_c::alsa_seq_open(char *alsadev)
|
|||||||
strcpy(mididev, alsadev);
|
strcpy(mididev, alsadev);
|
||||||
ptr = strtok(mididev, ":");
|
ptr = strtok(mididev, ":");
|
||||||
if (ptr == NULL) {
|
if (ptr == NULL) {
|
||||||
WRITELOG(MIDILOG(2), "ALSA sequencer setup: missing client parameters");
|
BX_ERROR(("ALSA sequencer setup: missing client parameters"));
|
||||||
return BX_SOUND_OUTPUT_ERR;
|
return BX_SOUND_OUTPUT_ERR;
|
||||||
}
|
}
|
||||||
client = atoi(ptr);
|
client = atoi(ptr);
|
||||||
ptr = strtok(NULL, ":");
|
ptr = strtok(NULL, ":");
|
||||||
if (ptr == NULL) {
|
if (ptr == NULL) {
|
||||||
WRITELOG(MIDILOG(2), "ALSA sequencer setup: missing port parameter");
|
BX_ERROR(("ALSA sequencer setup: missing port parameter"));
|
||||||
return BX_SOUND_OUTPUT_ERR;
|
return BX_SOUND_OUTPUT_ERR;
|
||||||
}
|
}
|
||||||
port = atoi(ptr);
|
port = atoi(ptr);
|
||||||
@ -97,7 +95,7 @@ int bx_sound_linux_c::alsa_seq_open(char *alsadev)
|
|||||||
delete(mididev);
|
delete(mididev);
|
||||||
|
|
||||||
if (snd_seq_open(&alsa_seq.handle, "default", SND_SEQ_OPEN_OUTPUT, 0) < 0) {
|
if (snd_seq_open(&alsa_seq.handle, "default", SND_SEQ_OPEN_OUTPUT, 0) < 0) {
|
||||||
WRITELOG(MIDILOG(2), "Couldn't open ALSA sequencer for midi output");
|
BX_ERROR(("Couldn't open ALSA sequencer for midi output"));
|
||||||
return BX_SOUND_OUTPUT_ERR;
|
return BX_SOUND_OUTPUT_ERR;
|
||||||
}
|
}
|
||||||
ret = snd_seq_create_simple_port(alsa_seq.handle, NULL,
|
ret = snd_seq_create_simple_port(alsa_seq.handle, NULL,
|
||||||
@ -106,12 +104,12 @@ int bx_sound_linux_c::alsa_seq_open(char *alsadev)
|
|||||||
SND_SEQ_PORT_CAP_READ,
|
SND_SEQ_PORT_CAP_READ,
|
||||||
SND_SEQ_PORT_TYPE_MIDI_GENERIC);
|
SND_SEQ_PORT_TYPE_MIDI_GENERIC);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
WRITELOG(MIDILOG(2), "ALSA sequencer: error creating port %s\n", snd_strerror(errno));
|
BX_ERROR(("ALSA sequencer: error creating port %s", snd_strerror(errno)));
|
||||||
} else {
|
} else {
|
||||||
alsa_seq.source_port = ret;
|
alsa_seq.source_port = ret;
|
||||||
ret = snd_seq_connect_to(alsa_seq.handle, alsa_seq.source_port, client, port);
|
ret = snd_seq_connect_to(alsa_seq.handle, alsa_seq.source_port, client, port);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
WRITELOG(MIDILOG(2), "ALSA sequencer: could not connect to port %d:%d\n", client, port);
|
BX_ERROR(("ALSA sequencer: could not connect to port %d:%d", client, port));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
@ -137,10 +135,9 @@ int bx_sound_linux_c::openmidioutput(char *mididev)
|
|||||||
|
|
||||||
midi = fopen(mididev,"w");
|
midi = fopen(mididev,"w");
|
||||||
|
|
||||||
if (midi == NULL)
|
if (midi == NULL) {
|
||||||
{
|
BX_ERROR(("Couldn't open midi output device %s: %s",
|
||||||
WRITELOG(MIDILOG(2), "Couldn't open midi output device %s: %s.",
|
mididev, strerror(errno)));
|
||||||
mididev, strerror(errno));
|
|
||||||
return BX_SOUND_OUTPUT_ERR;
|
return BX_SOUND_OUTPUT_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,10 +202,10 @@ int bx_sound_linux_c::alsa_seq_output(int delta, int command, int length, Bit8u
|
|||||||
ev.data.control.value = value;
|
ev.data.control.value = value;
|
||||||
break;
|
break;
|
||||||
case 0xf0:
|
case 0xf0:
|
||||||
WRITELOG(MIDILOG(3), "alsa_seq_output(): SYSEX not implemented, length=%d", length);
|
BX_ERROR(("alsa_seq_output(): SYSEX not implemented, length=%d", length));
|
||||||
return BX_SOUND_OUTPUT_ERR;
|
return BX_SOUND_OUTPUT_ERR;
|
||||||
default:
|
default:
|
||||||
WRITELOG(MIDILOG(3), "alsa_seq_output(): unknown command 0x%02x, length=%d", command, length);
|
BX_ERROR(("alsa_seq_output(): unknown command 0x%02x, length=%d", command, length));
|
||||||
return BX_SOUND_OUTPUT_ERR;
|
return BX_SOUND_OUTPUT_ERR;
|
||||||
}
|
}
|
||||||
snd_seq_event_output(alsa_seq.handle, &ev);
|
snd_seq_event_output(alsa_seq.handle, &ev);
|
||||||
@ -288,7 +285,7 @@ int bx_sound_linux_c::alsa_pcm_open(int frequency, int bits, int stereo, int for
|
|||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
return BX_SOUND_OUTPUT_ERR;
|
return BX_SOUND_OUTPUT_ERR;
|
||||||
}
|
}
|
||||||
WRITELOG(WAVELOG(1), "ALSA: opened default PCM output device");
|
BX_ERROR(("ALSA: opened default PCM output device"));
|
||||||
}
|
}
|
||||||
snd_pcm_hw_params_alloca(¶ms);
|
snd_pcm_hw_params_alloca(¶ms);
|
||||||
snd_pcm_hw_params_any(alsa_pcm.handle, params);
|
snd_pcm_hw_params_any(alsa_pcm.handle, params);
|
||||||
@ -337,7 +334,7 @@ int bx_sound_linux_c::alsa_pcm_open(int frequency, int bits, int stereo, int for
|
|||||||
}
|
}
|
||||||
snd_pcm_hw_params_get_period_size(params, &alsa_pcm.frames, &dir);
|
snd_pcm_hw_params_get_period_size(params, &alsa_pcm.frames, &dir);
|
||||||
alsa_bufsize = alsa_pcm.frames * size;
|
alsa_bufsize = alsa_pcm.frames * size;
|
||||||
WRITELOG(WAVELOG(4), "ALSA: buffer size set to %d", alsa_bufsize);
|
BX_DEBUG(("ALSA: buffer size set to %d", alsa_bufsize));
|
||||||
if (alsa_buffer != NULL) {
|
if (alsa_buffer != NULL) {
|
||||||
free(alsa_buffer);
|
free(alsa_buffer);
|
||||||
alsa_buffer = NULL;
|
alsa_buffer = NULL;
|
||||||
@ -365,7 +362,7 @@ int bx_sound_linux_c::startwaveplayback(int frequency, int bits, int stereo, int
|
|||||||
if (wave == -1) {
|
if (wave == -1) {
|
||||||
return BX_SOUND_OUTPUT_ERR;
|
return BX_SOUND_OUTPUT_ERR;
|
||||||
} else {
|
} else {
|
||||||
WRITELOG(WAVELOG(1), "OSS: opened output device %s", wavedevice);
|
BX_INFO(("OSS: opened output device %s", wavedevice));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ((frequency == oldfreq) &&
|
if ((frequency == oldfreq) &&
|
||||||
@ -395,7 +392,7 @@ int bx_sound_linux_c::startwaveplayback(int frequency, int bits, int stereo, int
|
|||||||
// set frequency etc.
|
// set frequency etc.
|
||||||
ret = ioctl(wave, SNDCTL_DSP_RESET);
|
ret = ioctl(wave, SNDCTL_DSP_RESET);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
WRITELOG(WAVELOG(4), "ioctl(SNDCTL_DSP_RESET): %s", strerror(errno));
|
BX_DEBUG(("ioctl(SNDCTL_DSP_RESET): %s", strerror(errno)));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ret = ioctl(wave, SNDCTL_DSP_SETFRAGMENT, &fragment);
|
ret = ioctl(wave, SNDCTL_DSP_SETFRAGMENT, &fragment);
|
||||||
@ -407,20 +404,20 @@ int bx_sound_linux_c::startwaveplayback(int frequency, int bits, int stereo, int
|
|||||||
ret = ioctl(wave, SNDCTL_DSP_SETFMT, &fmt);
|
ret = ioctl(wave, SNDCTL_DSP_SETFMT, &fmt);
|
||||||
if (ret != 0) // abort if the format is unknown, to avoid playing noise
|
if (ret != 0) // abort if the format is unknown, to avoid playing noise
|
||||||
{
|
{
|
||||||
WRITELOG(WAVELOG(4), "ioctl(SNDCTL_DSP_SETFMT, %d): %s",
|
BX_DEBUG(("ioctl(SNDCTL_DSP_SETFMT, %d): %s",
|
||||||
fmt, strerror(errno));
|
fmt, strerror(errno)));
|
||||||
return BX_SOUND_OUTPUT_ERR;
|
return BX_SOUND_OUTPUT_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = ioctl(wave, SNDCTL_DSP_STEREO, &stereo);
|
ret = ioctl(wave, SNDCTL_DSP_STEREO, &stereo);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
WRITELOG(WAVELOG(4), "ioctl(SNDCTL_DSP_STEREO, %d): %s",
|
BX_DEBUG(("ioctl(SNDCTL_DSP_STEREO, %d): %s",
|
||||||
stereo, strerror(errno));
|
stereo, strerror(errno)));
|
||||||
|
|
||||||
ret = ioctl(wave, SNDCTL_DSP_SPEED, &frequency);
|
ret = ioctl(wave, SNDCTL_DSP_SPEED, &frequency);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
WRITELOG(WAVELOG(4), "ioctl(SNDCTL_DSP_SPEED, %d): %s",
|
BX_DEBUG(("ioctl(SNDCTL_DSP_SPEED, %d): %s",
|
||||||
frequency, strerror(errno));
|
frequency, strerror(errno)));
|
||||||
|
|
||||||
// ioctl(wave, SNDCTL_DSP_GETBLKSIZE, &fragment);
|
// ioctl(wave, SNDCTL_DSP_GETBLKSIZE, &fragment);
|
||||||
// WRITELOG(WAVELOG(4), "current output block size is %d", fragment);
|
// WRITELOG(WAVELOG(4), "current output block size is %d", fragment);
|
||||||
@ -441,12 +438,12 @@ int bx_sound_linux_c::alsa_pcm_write()
|
|||||||
ret = snd_pcm_writei(alsa_pcm.handle, alsa_buffer, alsa_pcm.frames);
|
ret = snd_pcm_writei(alsa_pcm.handle, alsa_buffer, alsa_pcm.frames);
|
||||||
if (ret == -EPIPE) {
|
if (ret == -EPIPE) {
|
||||||
/* EPIPE means underrun */
|
/* EPIPE means underrun */
|
||||||
WRITELOG(WAVELOG(3), "ALSA: underrun occurred");
|
BX_ERROR(("ALSA: underrun occurred"));
|
||||||
snd_pcm_prepare(alsa_pcm.handle);
|
snd_pcm_prepare(alsa_pcm.handle);
|
||||||
} else if (ret < 0) {
|
} else if (ret < 0) {
|
||||||
WRITELOG(WAVELOG(3), "ALSA: error from writei: %s", snd_strerror(ret));
|
BX_ERROR(("ALSA: error from writei: %s", snd_strerror(ret)));
|
||||||
} else if (ret != (int)alsa_pcm.frames) {
|
} else if (ret != (int)alsa_pcm.frames) {
|
||||||
WRITELOG(WAVELOG(3), "ALSA: short write, write %d frames", ret);
|
BX_ERROR(("ALSA: short write, write %d frames", ret));
|
||||||
}
|
}
|
||||||
audio_bufsize -= alsa_bufsize;
|
audio_bufsize -= alsa_bufsize;
|
||||||
memcpy(audio_buffer, audio_buffer+alsa_bufsize, audio_bufsize);
|
memcpy(audio_buffer, audio_buffer+alsa_bufsize, audio_bufsize);
|
||||||
@ -468,7 +465,7 @@ int bx_sound_linux_c::sendwavepacket(int length, Bit8u data[])
|
|||||||
memcpy(audio_buffer+audio_bufsize, data, length);
|
memcpy(audio_buffer+audio_bufsize, data, length);
|
||||||
audio_bufsize += length;
|
audio_bufsize += length;
|
||||||
} else {
|
} else {
|
||||||
WRITELOG(WAVELOG(3), "ALSA: audio buffer overflow");
|
BX_ERROR(("ALSA: audio buffer overflow"));
|
||||||
return BX_SOUND_OUTPUT_ERR;
|
return BX_SOUND_OUTPUT_ERR;
|
||||||
}
|
}
|
||||||
if (audio_bufsize < alsa_bufsize) {
|
if (audio_bufsize < alsa_bufsize) {
|
||||||
@ -483,7 +480,7 @@ int bx_sound_linux_c::sendwavepacket(int length, Bit8u data[])
|
|||||||
if (ret == length) {
|
if (ret == length) {
|
||||||
return BX_SOUND_OUTPUT_OK;
|
return BX_SOUND_OUTPUT_OK;
|
||||||
} else {
|
} else {
|
||||||
WRITELOG(WAVELOG(3), "OSS: write error");
|
BX_ERROR(("OSS: write error"));
|
||||||
return BX_SOUND_OUTPUT_ERR;
|
return BX_SOUND_OUTPUT_ERR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
// $Id: soundlnx.h,v 1.15 2011-01-25 23:29:08 vruppert Exp $
|
// $Id: soundlnx.h,v 1.16 2011-02-10 22:58:22 vruppert Exp $
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright (C) 2001-2011 The Bochs Project
|
// Copyright (C) 2001-2011 The Bochs Project
|
||||||
@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
class bx_sound_linux_c : public bx_sound_output_c {
|
class bx_sound_linux_c : public bx_sound_output_c {
|
||||||
public:
|
public:
|
||||||
bx_sound_linux_c(bx_sb16_c *dev);
|
bx_sound_linux_c(logfunctions *dev);
|
||||||
virtual ~bx_sound_linux_c();
|
virtual ~bx_sound_linux_c();
|
||||||
|
|
||||||
virtual int waveready();
|
virtual int waveready();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
// $Id: soundmod.h,v 1.1 2011-01-25 23:29:08 vruppert Exp $
|
// $Id: soundmod.h,v 1.2 2011-02-10 22:58:22 vruppert Exp $
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright (C) 2011 The Bochs Project
|
// Copyright (C) 2011 The Bochs Project
|
||||||
@ -19,6 +19,11 @@
|
|||||||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
|
||||||
|
// 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.
|
||||||
|
#define BX_SOUND_OUTPUT_WAVEPACKETSIZE 8192
|
||||||
|
|
||||||
/* Definitions for the output functions */
|
/* Definitions for the output functions */
|
||||||
#define BX_SOUND_OUTPUT_OK 0
|
#define BX_SOUND_OUTPUT_OK 0
|
||||||
#define BX_SOUND_OUTPUT_ERR 1
|
#define BX_SOUND_OUTPUT_ERR 1
|
||||||
@ -34,7 +39,7 @@ public:
|
|||||||
non-portable, while everything in sb16.cc is portable
|
non-portable, while everything in sb16.cc is portable
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bx_sound_output_c(bx_sb16_c *dev);
|
bx_sound_output_c(logfunctions *dev);
|
||||||
virtual ~bx_sound_output_c();
|
virtual ~bx_sound_output_c();
|
||||||
|
|
||||||
virtual int waveready();
|
virtual int waveready();
|
||||||
@ -50,5 +55,5 @@ public:
|
|||||||
virtual int stopwaveplayback();
|
virtual int stopwaveplayback();
|
||||||
virtual int closewaveoutput();
|
virtual int closewaveoutput();
|
||||||
protected:
|
protected:
|
||||||
bx_sb16_c *device;
|
logfunctions *device;
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
// $Id: soundosx.cc,v 1.14 2011-01-25 23:29:08 vruppert Exp $
|
// $Id: soundosx.cc,v 1.15 2011-02-10 22:58:22 vruppert Exp $
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright (C) 2004-2011 The Bochs Project
|
// Copyright (C) 2004-2011 The Bochs Project
|
||||||
@ -24,15 +24,13 @@
|
|||||||
#include <MacTypes.h>
|
#include <MacTypes.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "iodev.h"
|
#include "bochs.h"
|
||||||
#define BX_SOUNDLOW
|
|
||||||
#include "sb16.h"
|
|
||||||
#include "soundmod.h"
|
|
||||||
|
|
||||||
#if defined(macintosh) && BX_SUPPORT_SB16
|
#if defined(macintosh) && BX_SUPPORT_SB16
|
||||||
|
|
||||||
#define LOG_THIS device->
|
#define LOG_THIS device->
|
||||||
|
|
||||||
|
#include "soundmod.h"
|
||||||
#include "soundosx.h"
|
#include "soundosx.h"
|
||||||
|
|
||||||
#if BX_WITH_MACOS
|
#if BX_WITH_MACOS
|
||||||
@ -71,7 +69,7 @@ AudioUnit WaveOutputUnit = NULL;
|
|||||||
AudioConverterRef WaveConverter = NULL;
|
AudioConverterRef WaveConverter = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bx_sound_osx_c::bx_sound_osx_c(bx_sb16_c *dev)
|
bx_sound_osx_c::bx_sound_osx_c(logfunctions *dev)
|
||||||
:bx_sound_output_c(dev)
|
:bx_sound_output_c(dev)
|
||||||
{
|
{
|
||||||
MidiOpen = 0;
|
MidiOpen = 0;
|
||||||
@ -136,14 +134,14 @@ int bx_sound_osx_c::openmidioutput(char *mididev)
|
|||||||
// Start playing
|
// Start playing
|
||||||
AUGraphStart (MidiGraph);
|
AUGraphStart (MidiGraph);
|
||||||
#endif
|
#endif
|
||||||
WRITELOG(WAVELOG(4), "openmidioutput(%s)", mididev);
|
BX_DEBUG(("openmidioutput(%s)", mididev));
|
||||||
MidiOpen = 1;
|
MidiOpen = 1;
|
||||||
return BX_SOUND_OUTPUT_OK;
|
return BX_SOUND_OUTPUT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bx_sound_osx_c::sendmidicommand(int delta, int command, int length, Bit8u data[])
|
int bx_sound_osx_c::sendmidicommand(int delta, int command, int length, Bit8u data[])
|
||||||
{
|
{
|
||||||
WRITELOG(WAVELOG(5), "sendmidicommand(%i,%02x,%i)", delta, command, length);
|
BX_DEBUG(("sendmidicommand(%i,%02x,%i)", delta, command, length));
|
||||||
if (!MidiOpen) return BX_SOUND_OUTPUT_ERR;
|
if (!MidiOpen) return BX_SOUND_OUTPUT_ERR;
|
||||||
|
|
||||||
#ifdef BX_SOUND_OSX_use_converter
|
#ifdef BX_SOUND_OSX_use_converter
|
||||||
@ -161,7 +159,7 @@ int bx_sound_osx_c::sendmidicommand(int delta, int command, int length, Bit8u da
|
|||||||
|
|
||||||
int bx_sound_osx_c::closemidioutput()
|
int bx_sound_osx_c::closemidioutput()
|
||||||
{
|
{
|
||||||
WRITELOG(WAVELOG(4), "closemidioutput()");
|
BX_DEBUG(("closemidioutput()"));
|
||||||
MidiOpen = 0;
|
MidiOpen = 0;
|
||||||
#ifdef BX_SOUND_OSX_use_converter
|
#ifdef BX_SOUND_OSX_use_converter
|
||||||
AUGraphStop (MidiGraph);
|
AUGraphStop (MidiGraph);
|
||||||
@ -186,7 +184,7 @@ int bx_sound_osx_c::openwaveoutput(char *wavedev)
|
|||||||
{
|
{
|
||||||
OSStatus err;
|
OSStatus err;
|
||||||
|
|
||||||
WRITELOG(WAVELOG(4), "openwaveoutput(%s)", wavedev);
|
BX_DEBUG(("openwaveoutput(%s)", wavedev));
|
||||||
|
|
||||||
// open the default output unit
|
// open the default output unit
|
||||||
#ifdef BX_SOUND_OSX_use_quicktime
|
#ifdef BX_SOUND_OSX_use_quicktime
|
||||||
@ -218,7 +216,7 @@ int bx_sound_osx_c::startwaveplayback(int frequency, int bits, int stereo, int f
|
|||||||
UInt32 formatSize = sizeof(AudioStreamBasicDescription);
|
UInt32 formatSize = sizeof(AudioStreamBasicDescription);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
WRITELOG(WAVELOG(4), "startwaveplayback(%d, %d, %d, %x)", frequency, bits, stereo, format);
|
BX_DEBUG(("startwaveplayback(%d, %d, %d, %x)", frequency, bits, stereo, format));
|
||||||
|
|
||||||
#ifdef BX_SOUND_OSX_use_quicktime
|
#ifdef BX_SOUND_OSX_use_quicktime
|
||||||
WaveInfo.samplePtr = NULL;
|
WaveInfo.samplePtr = NULL;
|
||||||
@ -309,7 +307,7 @@ int bx_sound_osx_c::sendwavepacket(int length, Bit8u data[])
|
|||||||
SndCommand mySndCommand;
|
SndCommand mySndCommand;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
WRITELOG(WAVELOG(4), "sendwavepacket(%d, %p), head=%u", length, data, head);
|
BX_DEBUG(("sendwavepacket(%d, %p), head=%u", length, data, head));
|
||||||
|
|
||||||
// sanity check
|
// sanity check
|
||||||
if ((!WaveOpen) || (head - tail >= BX_SOUND_OSX_NBUF))
|
if ((!WaveOpen) || (head - tail >= BX_SOUND_OSX_NBUF))
|
||||||
@ -390,7 +388,7 @@ OSStatus MyACInputProc (AudioConverterRef inAudioConverter,
|
|||||||
|
|
||||||
void bx_sound_osx_c::nextbuffer (int *outDataSize, void **outData)
|
void bx_sound_osx_c::nextbuffer (int *outDataSize, void **outData)
|
||||||
{
|
{
|
||||||
WRITELOG(WAVELOG(4), "nextbuffer(), tail=%u", tail);
|
BX_DEBUG(("nextbuffer(), tail=%u", tail));
|
||||||
if (head - tail <= 0) {
|
if (head - tail <= 0) {
|
||||||
*outData = NULL;
|
*outData = NULL;
|
||||||
*outDataSize = 0;
|
*outDataSize = 0;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
// $Id: soundosx.h,v 1.5 2011-01-25 23:29:08 vruppert Exp $
|
// $Id: soundosx.h,v 1.6 2011-02-10 22:58:22 vruppert Exp $
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright (C) 2004-2011 The Bochs Project
|
// Copyright (C) 2004-2011 The Bochs Project
|
||||||
@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
class bx_sound_osx_c : public bx_sound_output_c {
|
class bx_sound_osx_c : public bx_sound_output_c {
|
||||||
public:
|
public:
|
||||||
bx_sound_osx_c(bx_sb16_c *dev);
|
bx_sound_osx_c(logfunctions *dev);
|
||||||
virtual ~bx_sound_osx_c();
|
virtual ~bx_sound_osx_c();
|
||||||
|
|
||||||
virtual int waveready();
|
virtual int waveready();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
// $Id: soundwin.cc,v 1.27 2011-01-25 23:29:08 vruppert Exp $
|
// $Id: soundwin.cc,v 1.28 2011-02-10 22:58:22 vruppert Exp $
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright (C) 2001-2011 The Bochs Project
|
// Copyright (C) 2001-2011 The Bochs Project
|
||||||
@ -26,18 +26,16 @@
|
|||||||
// is used to know when we are exporting symbols and when we are importing.
|
// is used to know when we are exporting symbols and when we are importing.
|
||||||
#define BX_PLUGGABLE
|
#define BX_PLUGGABLE
|
||||||
|
|
||||||
#include "iodev.h"
|
#include "bochs.h"
|
||||||
#define BX_SOUNDLOW
|
|
||||||
#include "sb16.h"
|
|
||||||
#include "soundmod.h"
|
|
||||||
|
|
||||||
#if defined(WIN32) && BX_SUPPORT_SB16
|
#if defined(WIN32) && BX_SUPPORT_SB16
|
||||||
|
|
||||||
|
#include "soundmod.h"
|
||||||
#include "soundwin.h"
|
#include "soundwin.h"
|
||||||
|
|
||||||
#define LOG_THIS device->
|
#define LOG_THIS device->
|
||||||
|
|
||||||
bx_sound_windows_c::bx_sound_windows_c(bx_sb16_c *dev)
|
bx_sound_windows_c::bx_sound_windows_c(logfunctions *dev)
|
||||||
:bx_sound_output_c(dev)
|
:bx_sound_output_c(dev)
|
||||||
{
|
{
|
||||||
MidiOpen = 0;
|
MidiOpen = 0;
|
||||||
@ -126,7 +124,7 @@ int bx_sound_windows_c::openmidioutput(char *mididev)
|
|||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
MidiOpen = 1;
|
MidiOpen = 1;
|
||||||
|
|
||||||
WRITELOG(MIDILOG(4), "midiOutOpen() = %d, MidiOpen: %d", ret, MidiOpen);
|
BX_DEBUG(("midiOutOpen() = %d, MidiOpen: %d", ret, MidiOpen));
|
||||||
|
|
||||||
return (MidiOpen == 1) ? BX_SOUND_OUTPUT_OK : BX_SOUND_OUTPUT_ERR;
|
return (MidiOpen == 1) ? BX_SOUND_OUTPUT_OK : BX_SOUND_OUTPUT_ERR;
|
||||||
}
|
}
|
||||||
@ -140,7 +138,7 @@ int bx_sound_windows_c::sendmidicommand(int delta, int command, int length, Bit8
|
|||||||
|
|
||||||
if ((command == 0xf0) || (command == 0xf7) || (length > 3))
|
if ((command == 0xf0) || (command == 0xf7) || (length > 3))
|
||||||
{
|
{
|
||||||
WRITELOG(WAVELOG(5), "SYSEX started, length %d", length);
|
BX_DEBUG(("SYSEX started, length %d", length));
|
||||||
ismidiready = 0; // until the buffer is done
|
ismidiready = 0; // until the buffer is done
|
||||||
memcpy(MidiData, data, length);
|
memcpy(MidiData, data, length);
|
||||||
MidiHeader->lpData = MidiData;
|
MidiHeader->lpData = MidiData;
|
||||||
@ -150,10 +148,10 @@ int bx_sound_windows_c::sendmidicommand(int delta, int command, int length, Bit8
|
|||||||
MidiHeader->dwFlags = 0;
|
MidiHeader->dwFlags = 0;
|
||||||
ret = midiOutPrepareHeader(MidiOut, MidiHeader, sizeof(*MidiHeader));
|
ret = midiOutPrepareHeader(MidiOut, MidiHeader, sizeof(*MidiHeader));
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
WRITELOG(MIDILOG(2), "midiOutPrepareHeader() = %d", ret);
|
BX_ERROR(("midiOutPrepareHeader() = %d", ret));
|
||||||
ret = midiOutLongMsg(MidiOut, MidiHeader, sizeof(*MidiHeader));
|
ret = midiOutLongMsg(MidiOut, MidiHeader, sizeof(*MidiHeader));
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
WRITELOG(MIDILOG(2), "midiOutLongMsg() = %d", ret);
|
BX_ERROR(("midiOutLongMsg() = %d", ret));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -163,7 +161,7 @@ int bx_sound_windows_c::sendmidicommand(int delta, int command, int length, Bit8
|
|||||||
msg |= (data[i] << (8 * (i + 1)));
|
msg |= (data[i] << (8 * (i + 1)));
|
||||||
|
|
||||||
ret = midiOutShortMsg(MidiOut, msg);
|
ret = midiOutShortMsg(MidiOut, msg);
|
||||||
WRITELOG(MIDILOG(4), "midiOutShortMsg(%x) = %d", msg, ret);
|
BX_DEBUG(("midiOutShortMsg(%x) = %d", msg, ret));
|
||||||
}
|
}
|
||||||
|
|
||||||
return (ret == 0) ? BX_SOUND_OUTPUT_OK : BX_SOUND_OUTPUT_ERR;
|
return (ret == 0) ? BX_SOUND_OUTPUT_OK : BX_SOUND_OUTPUT_ERR;
|
||||||
@ -181,7 +179,7 @@ int bx_sound_windows_c::closemidioutput()
|
|||||||
checkmidiready(); // to clear any pending SYSEX
|
checkmidiready(); // to clear any pending SYSEX
|
||||||
|
|
||||||
ret = midiOutClose(MidiOut);
|
ret = midiOutClose(MidiOut);
|
||||||
WRITELOG(MIDILOG(4), "midiOutClose() = %d", ret);
|
BX_DEBUG(("midiOutClose() = %d", ret));
|
||||||
MidiOpen = 0;
|
MidiOpen = 0;
|
||||||
|
|
||||||
return (ret == 0) ? BX_SOUND_OUTPUT_OK : BX_SOUND_OUTPUT_ERR;
|
return (ret == 0) ? BX_SOUND_OUTPUT_OK : BX_SOUND_OUTPUT_ERR;
|
||||||
@ -193,7 +191,7 @@ int bx_sound_windows_c::openwaveoutput(char *wavedev)
|
|||||||
// but currently only the wave mapper is supported
|
// but currently only the wave mapper is supported
|
||||||
UNUSED(wavedev);
|
UNUSED(wavedev);
|
||||||
|
|
||||||
WRITELOG(WAVELOG(4), "openwaveoutput(%s)", wavedev);
|
BX_DEBUG(("openwaveoutput(%s)", wavedev));
|
||||||
|
|
||||||
#ifdef usewaveOut
|
#ifdef usewaveOut
|
||||||
WaveDevice = (UINT) WAVEMAPPER;
|
WaveDevice = (UINT) WAVEMAPPER;
|
||||||
@ -260,7 +258,7 @@ int bx_sound_windows_c::playnextbuffer()
|
|||||||
{
|
{
|
||||||
char errormsg[4*MAXERRORLENGTH+1];
|
char errormsg[4*MAXERRORLENGTH+1];
|
||||||
waveOutGetErrorTextA(ret, errormsg, 4*MAXERRORLENGTH+1);
|
waveOutGetErrorTextA(ret, errormsg, 4*MAXERRORLENGTH+1);
|
||||||
WRITELOG(WAVELOG(5), "waveOutOpen: %s", errormsg);
|
BX_DEBUG(("waveOutOpen: %s", errormsg));
|
||||||
switch (tries) {
|
switch (tries) {
|
||||||
case 0: // maybe try a different frequency
|
case 0: // maybe try a different frequency
|
||||||
if (frequency < 15600)
|
if (frequency < 15600)
|
||||||
@ -270,7 +268,7 @@ int bx_sound_windows_c::playnextbuffer()
|
|||||||
else
|
else
|
||||||
frequency = 44100;
|
frequency = 44100;
|
||||||
|
|
||||||
WRITELOG(WAVELOG(4), "Couldn't open wave device (error %d), trying frequency %d", ret, frequency);
|
BX_DEBUG(("Couldn't open wave device (error %d), trying frequency %d", ret, frequency));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1: // or something else
|
case 1: // or something else
|
||||||
@ -279,18 +277,18 @@ int bx_sound_windows_c::playnextbuffer()
|
|||||||
bits = 8;
|
bits = 8;
|
||||||
bps = 1;
|
bps = 1;
|
||||||
|
|
||||||
WRITELOG(WAVELOG(4), "Couldn't open wave device again (error %d), trying 11KHz, mono, 8bit", ret);
|
BX_DEBUG(("Couldn't open wave device again (error %d), trying 11KHz, mono, 8bit", ret));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: // nope, doesn't work
|
case 2: // nope, doesn't work
|
||||||
WRITELOG(WAVELOG(2), "Couldn't open wave device (error %d)!", ret);
|
BX_ERROR(("Couldn't open wave device (error %d)!", ret));
|
||||||
return BX_SOUND_OUTPUT_ERR;
|
return BX_SOUND_OUTPUT_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
WRITELOG(WAVELOG(5), "The format was: wFormatTag=%d, nChannels=%d, nSamplesPerSec=%d,",
|
BX_DEBUG(("The format was: wFormatTag=%d, nChannels=%d, nSamplesPerSec=%d,",
|
||||||
waveformat.wf.wFormatTag, waveformat.wf.nChannels, waveformat.wf.nSamplesPerSec);
|
waveformat.wf.wFormatTag, waveformat.wf.nChannels, waveformat.wf.nSamplesPerSec));
|
||||||
WRITELOG(WAVELOG(5), " nAvgBytesPerSec=%d, nBlockAlign=%d, wBitsPerSample=%d",
|
BX_DEBUG((" nAvgBytesPerSec=%d, nBlockAlign=%d, wBitsPerSample=%d",
|
||||||
waveformat.wf.nAvgBytesPerSec, waveformat.wf.nBlockAlign, waveformat.wBitsPerSample);
|
waveformat.wf.nAvgBytesPerSec, waveformat.wf.nBlockAlign, waveformat.wBitsPerSample));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -304,7 +302,7 @@ int bx_sound_windows_c::playnextbuffer()
|
|||||||
for (bufnum=tailplay; bufnum != head;
|
for (bufnum=tailplay; bufnum != head;
|
||||||
bufnum++, bufnum &= BX_SOUND_WINDOWS_NMASK, tailplay=bufnum)
|
bufnum++, bufnum &= BX_SOUND_WINDOWS_NMASK, tailplay=bufnum)
|
||||||
{
|
{
|
||||||
WRITELOG(WAVELOG(5), "Playing buffer %d", bufnum);
|
BX_DEBUG(("Playing buffer %d", bufnum));
|
||||||
|
|
||||||
// prepare the wave header
|
// prepare the wave header
|
||||||
WaveHeader[bufnum]->lpData = WaveData[bufnum];
|
WaveHeader[bufnum]->lpData = WaveData[bufnum];
|
||||||
@ -317,7 +315,7 @@ int bx_sound_windows_c::playnextbuffer()
|
|||||||
ret = waveOutPrepareHeader(WaveOut, WaveHeader[bufnum], sizeof(*WaveHeader[bufnum]));
|
ret = waveOutPrepareHeader(WaveOut, WaveHeader[bufnum], sizeof(*WaveHeader[bufnum]));
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
{
|
{
|
||||||
WRITELOG(WAVELOG(2), "waveOutPrepareHeader = %d", ret);
|
BX_ERROR(("waveOutPrepareHeader = %d", ret));
|
||||||
return BX_SOUND_OUTPUT_ERR;
|
return BX_SOUND_OUTPUT_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -326,7 +324,7 @@ int bx_sound_windows_c::playnextbuffer()
|
|||||||
{
|
{
|
||||||
char errormsg[4*MAXERRORLENGTH+1];
|
char errormsg[4*MAXERRORLENGTH+1];
|
||||||
waveOutGetErrorTextA(ret, errormsg, 4*MAXERRORLENGTH+1);
|
waveOutGetErrorTextA(ret, errormsg, 4*MAXERRORLENGTH+1);
|
||||||
WRITELOG(WAVELOG(5), "waveOutWrite: %s", errormsg);
|
BX_DEBUG(("waveOutWrite: %s", errormsg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -335,7 +333,7 @@ int bx_sound_windows_c::playnextbuffer()
|
|||||||
|
|
||||||
int bx_sound_windows_c::startwaveplayback(int frequency, int bits, int stereo, int format)
|
int bx_sound_windows_c::startwaveplayback(int frequency, int bits, int stereo, int format)
|
||||||
{
|
{
|
||||||
WRITELOG(WAVELOG(4), "startwaveplayback(%d, %d, %d, %x)", frequency, bits, stereo, format);
|
BX_DEBUG(("startwaveplayback(%d, %d, %d, %x)", frequency, bits, stereo, format));
|
||||||
|
|
||||||
#ifdef usewaveOut
|
#ifdef usewaveOut
|
||||||
// check if any of the properties have changed
|
// check if any of the properties have changed
|
||||||
@ -383,7 +381,7 @@ int bx_sound_windows_c::sendwavepacket(int length, Bit8u data[])
|
|||||||
UINT ret;
|
UINT ret;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
WRITELOG(WAVELOG(4), "sendwavepacket(%d, %p)", length, data);
|
BX_DEBUG(("sendwavepacket(%d, %p)", length, data));
|
||||||
|
|
||||||
#ifdef usewaveOut
|
#ifdef usewaveOut
|
||||||
bufnum = head;
|
bufnum = head;
|
||||||
@ -397,7 +395,7 @@ int bx_sound_windows_c::sendwavepacket(int length, Bit8u data[])
|
|||||||
|
|
||||||
if (((bufnum + 1) & BX_SOUND_WINDOWS_NMASK) == tailfull)
|
if (((bufnum + 1) & BX_SOUND_WINDOWS_NMASK) == tailfull)
|
||||||
{ // this should not actually happen!
|
{ // this should not actually happen!
|
||||||
WRITELOG(WAVELOG(2), "Output buffer overflow! Not played. Iswaveready was %d", iswaveready);
|
BX_ERROR(("Output buffer overflow! Not played. Iswaveready was %d", iswaveready));
|
||||||
iswaveready = 0; // stop the output for a while
|
iswaveready = 0; // stop the output for a while
|
||||||
return BX_SOUND_OUTPUT_ERR;
|
return BX_SOUND_OUTPUT_ERR;
|
||||||
}
|
}
|
||||||
@ -407,8 +405,8 @@ int bx_sound_windows_c::sendwavepacket(int length, Bit8u data[])
|
|||||||
// check if more buffers are available, otherwise stall the emulator
|
// check if more buffers are available, otherwise stall the emulator
|
||||||
if (((bufnum + 2) & BX_SOUND_WINDOWS_NMASK) == tailfull)
|
if (((bufnum + 2) & BX_SOUND_WINDOWS_NMASK) == tailfull)
|
||||||
{
|
{
|
||||||
WRITELOG(WAVELOG(5), "Buffer status: Head %d, TailFull %d, TailPlay %d. Stall.",
|
BX_DEBUG(("Buffer status: Head %d, TailFull %d, TailPlay %d. Stall.",
|
||||||
head, tailfull, tailplay);
|
head, tailfull, tailplay));
|
||||||
iswaveready = 0;
|
iswaveready = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -426,7 +424,7 @@ int bx_sound_windows_c::sendwavepacket(int length, Bit8u data[])
|
|||||||
ret = sndPlaySoundA((LPCSTR) header, SND_SYNC | SND_MEMORY);
|
ret = sndPlaySoundA((LPCSTR) header, SND_SYNC | SND_MEMORY);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
{
|
{
|
||||||
WRITELOG(WAVELOG(3), "sndPlaySoundA: %d", ret);
|
BX_DEBUG(("sndPlaySoundA: %d", ret));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -435,7 +433,7 @@ int bx_sound_windows_c::sendwavepacket(int length, Bit8u data[])
|
|||||||
|
|
||||||
int bx_sound_windows_c::stopwaveplayback()
|
int bx_sound_windows_c::stopwaveplayback()
|
||||||
{
|
{
|
||||||
WRITELOG(WAVELOG(4), "stopwaveplayback()");
|
BX_DEBUG(("stopwaveplayback()"));
|
||||||
|
|
||||||
#ifdef usewaveOut
|
#ifdef usewaveOut
|
||||||
// this is handled by checkwaveready() when closing
|
// this is handled by checkwaveready() when closing
|
||||||
@ -452,7 +450,7 @@ int bx_sound_windows_c::stopwaveplayback()
|
|||||||
|
|
||||||
int bx_sound_windows_c::closewaveoutput()
|
int bx_sound_windows_c::closewaveoutput()
|
||||||
{
|
{
|
||||||
WRITELOG(WAVELOG(4), "closewaveoutput");
|
BX_DEBUG(("closewaveoutput"));
|
||||||
|
|
||||||
#ifdef usewaveOut
|
#ifdef usewaveOut
|
||||||
if (WaveOpen == 1)
|
if (WaveOpen == 1)
|
||||||
@ -480,7 +478,7 @@ void bx_sound_windows_c::checkmidiready()
|
|||||||
|
|
||||||
if ((MidiHeader->dwFlags & MHDR_DONE) != 0)
|
if ((MidiHeader->dwFlags & MHDR_DONE) != 0)
|
||||||
{
|
{
|
||||||
WRITELOG(MIDILOG(5), "SYSEX message done, midi ready again.");
|
BX_DEBUG(("SYSEX message done, midi ready again"));
|
||||||
ret = midiOutUnprepareHeader(MidiOut, MidiHeader, sizeof(*MidiHeader));
|
ret = midiOutUnprepareHeader(MidiOut, MidiHeader, sizeof(*MidiHeader));
|
||||||
ismidiready = 1;
|
ismidiready = 1;
|
||||||
}
|
}
|
||||||
@ -495,7 +493,7 @@ void bx_sound_windows_c::checkwaveready()
|
|||||||
((WaveHeader[bufnum]->dwFlags & WHDR_DONE) != 0);
|
((WaveHeader[bufnum]->dwFlags & WHDR_DONE) != 0);
|
||||||
bufnum++, bufnum &= BX_SOUND_WINDOWS_NMASK)
|
bufnum++, bufnum &= BX_SOUND_WINDOWS_NMASK)
|
||||||
{
|
{
|
||||||
WRITELOG(WAVELOG(5), "Buffer %d done.", bufnum);
|
BX_DEBUG(("Buffer %d done.", bufnum));
|
||||||
ret = waveOutUnprepareHeader(WaveOut, WaveHeader[bufnum], sizeof(*WaveHeader[bufnum]));
|
ret = waveOutUnprepareHeader(WaveOut, WaveHeader[bufnum], sizeof(*WaveHeader[bufnum]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -504,8 +502,8 @@ void bx_sound_windows_c::checkwaveready()
|
|||||||
// enable gathering data if a buffer is available
|
// enable gathering data if a buffer is available
|
||||||
if (((head + 2) & BX_SOUND_WINDOWS_NMASK) != tailfull)
|
if (((head + 2) & BX_SOUND_WINDOWS_NMASK) != tailfull)
|
||||||
{
|
{
|
||||||
WRITELOG(WAVELOG(5), "Buffer status: Head %d, TailFull %d, TailPlay %d. Ready.",
|
BX_DEBUG(("Buffer status: Head %d, TailFull %d, TailPlay %d. Ready.",
|
||||||
head, tailfull, tailplay);
|
head, tailfull, tailplay));
|
||||||
iswaveready = 1;
|
iswaveready = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
// $Id: soundwin.h,v 1.9 2011-01-25 23:29:08 vruppert Exp $
|
// $Id: soundwin.h,v 1.10 2011-02-10 22:58:22 vruppert Exp $
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright (C) 2001-2011 The Bochs Project
|
// Copyright (C) 2001-2011 The Bochs Project
|
||||||
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
#define BX_SOUND_WINDOWS_MAXSYSEXLEN 256 // maximum supported length of a sysex message
|
#define BX_SOUND_WINDOWS_MAXSYSEXLEN 256 // maximum supported length of a sysex message
|
||||||
|
|
||||||
#define BX_SOUND_WINDOWS_NBUF 4 // number of buffers for the output, must be power of 2 and >= 4
|
#define BX_SOUND_WINDOWS_NBUF 64 // number of buffers for the output, must be power of 2 and >= 4
|
||||||
#define BX_SOUND_WINDOWS_NMASK (BX_SOUND_WINDOWS_NBUF - 1)
|
#define BX_SOUND_WINDOWS_NMASK (BX_SOUND_WINDOWS_NBUF - 1)
|
||||||
|
|
||||||
#ifndef WAVEMAPPER
|
#ifndef WAVEMAPPER
|
||||||
@ -166,7 +166,7 @@ typedef struct {
|
|||||||
|
|
||||||
class bx_sound_windows_c : public bx_sound_output_c {
|
class bx_sound_windows_c : public bx_sound_output_c {
|
||||||
public:
|
public:
|
||||||
bx_sound_windows_c(bx_sb16_c *dev);
|
bx_sound_windows_c(logfunctions *dev);
|
||||||
virtual ~bx_sound_windows_c();
|
virtual ~bx_sound_windows_c();
|
||||||
|
|
||||||
virtual int waveready();
|
virtual int waveready();
|
||||||
|
Loading…
Reference in New Issue
Block a user