[prev in list] [next in list] [prev in thread] [next in thread]
List: bochs-cvs
Subject: [Bochs-cvs] [13509] trunk/bochs/iodev/sound
From: vruppert--- via Bochs-cvs <bochs-cvs () lists ! sourceforge ! net>
Date: 2018-05-15 18:51:42
Message-ID: 1526410302.945708.15267 () sfp-scm-6 ! v30 ! lw ! sourceforge ! com
[Download RAW message or body]
Revision: 13509
Author: vruppert
Date: 2018-05-15 18:51:41 +0000 (Tue, 15 May 2018)
Log Message:
-----------
Some small improvements for the DSP direct output (non-DMA) mode.
- Generate output in 16-bit stereo format.
- Stop non-DMA output mode after 0.1 seconds of silence.
Modified Paths:
--------------
trunk/bochs/iodev/sound/sb16.cc
trunk/bochs/iodev/sound/sb16.h
Modified: trunk/bochs/iodev/sound/sb16.cc
===================================================================
--- trunk/bochs/iodev/sound/sb16.cc 2018-05-14 18:17:04 UTC (rev 13508)
+++ trunk/bochs/iodev/sound/sb16.cc 2018-05-15 18:51:41 UTC (rev 13509)
@@ -339,6 +339,7 @@
DSP.irqpending = 0;
DSP.midiuartmode = 0;
DSP.nondma_mode = 0;
+ DSP.nondma_count = 0;
DSP.samplebyte = 0;
DSP.resetport = 1; // so that one call to dsp_reset is sufficient
dsp_reset(0); // (reset is 1 to 0 transition)
@@ -477,7 +478,8 @@
new bx_shadow_bool_c(dsp, "irqpending", &DSP.irqpending);
new bx_shadow_bool_c(dsp, "midiuartmode", &DSP.midiuartmode);
new bx_shadow_bool_c(dsp, "nondma_mode", &DSP.nondma_mode);
- new bx_shadow_num_c(dsp, "samplebyte", &DSP.samplebyte);
+ new bx_shadow_num_c(dsp, "nondma_count", &DSP.nondma_count);
+ new bx_shadow_num_c(dsp, "samplebyte", &DSP.samplebyte, BASE_HEX);
new bx_shadow_num_c(dsp, "testreg", &DSP.testreg, BASE_HEX);
bx_list_c *dma = new bx_list_c(dsp, "dma");
new bx_shadow_num_c(dma, "mode", &DSP.dma.mode);
@@ -607,7 +609,11 @@
}
}
} else {
- dsp_getsamplebyte(DSP.samplebyte);
+ dsp_getsamplebyte(0);
+ dsp_getsamplebyte(This->dsp.samplebyte);
+ dsp_getsamplebyte(0);
+ dsp_getsamplebyte(This->dsp.samplebyte);
+ This->dsp.nondma_count++;
}
}
@@ -626,10 +632,7 @@
{
writelog(WAVELOG(4), "DSP Reset port write value %x", value);
- if (DSP.nondma_mode) {
- bx_pc_system.deactivate_timer(DSP.timer_handle);
- DSP.nondma_mode = 0;
- }
+ dsp_disable_nondma();
// just abort high speed mode if it is set
if (DSP.dma.highspeed != 0)
@@ -851,13 +854,14 @@
// 1: 8bit sample
if (!DSP.nondma_mode) {
DSP.dma.param.samplerate = 22050;
- DSP.dma.param.bits = 8;
- DSP.dma.param.channels = 1;
+ DSP.dma.param.bits = 16;
+ DSP.dma.param.channels = 2;
DSP.dma.param.format = 1;
- DSP.dma.chunkcount = 2205;
+ DSP.dma.chunkcount = 8820;
DSP.dma.chunkindex = 0;
bx_pc_system.activate_timer(DSP.timer_handle, 45, 1);
DSP.nondma_mode = 1;
+ DSP.nondma_count = 0;
}
DSP.datain.get(&DSP.samplebyte);
break;
@@ -1258,10 +1262,8 @@
writelog(WAVELOG(4), "DMA initialized. Cmd %02x, mode %02x, length %d, comp %d",
command, mode, length, comp);
- if (DSP.nondma_mode) {
- bx_pc_system.deactivate_timer(DSP.timer_handle);
- DSP.nondma_mode = 0;
- }
+ dsp_disable_nondma();
+
if ((command >> 4) == 0xb) // 0xb? = 16 bit DMA
{
DSP.dma.param.bits = 16;
@@ -1395,6 +1397,14 @@
bx_pc_system.deactivate_timer(DSP.timer_handle);
}
+void bx_sb16_c::dsp_disable_nondma()
+{
+ if (DSP.nondma_mode) {
+ bx_pc_system.deactivate_timer(DSP.timer_handle);
+ DSP.nondma_mode = 0;
+ }
+}
+
// dsp_bufferstatus() checks if the DSP is ready for data/commands
Bit32u bx_sb16_c::dsp_bufferstatus()
{
@@ -1460,6 +1470,14 @@
// write a wave packet to the output device
void bx_sb16_c::dsp_sendwavepacket()
{
+ if (DSP.nondma_mode) {
+ if (DSP.nondma_count == 0) {
+ dsp_disable_nondma();
+ return;
+ }
+ DSP.nondma_count = 0;
+ }
+
if (DSP.dma.chunkindex == 0)
return;
Modified: trunk/bochs/iodev/sound/sb16.h
===================================================================
--- trunk/bochs/iodev/sound/sb16.h 2018-05-14 18:17:04 UTC (rev 13508)
+++ trunk/bochs/iodev/sound/sb16.h 2018-05-15 18:51:41 UTC (rev 13509)
@@ -179,12 +179,13 @@
// the DSP variables
struct bx_sb16_dsp_struct {
bx_sb16_buffer datain, dataout;
- Bit8u resetport; // last value written to the reset port
- Bit8u speaker,prostereo; // properties of the sound input/output
- bx_bool irqpending; // Is an IRQ pending (not ack'd)
- bx_bool midiuartmode; // Is the DSP in MIDI UART mode
- bx_bool nondma_mode; // Set if DSP command 0x10 active
- Bit8u samplebyte; // Current data from DSP command 0x10
+ Bit8u resetport; // last value written to the reset port
+ Bit8u speaker,prostereo; // properties of the sound input/output
+ bx_bool irqpending; // Is an IRQ pending (not ack'd)
+ bx_bool midiuartmode; // Is the DSP in MIDI UART mode
+ bx_bool nondma_mode; // Set if DSP command 0x10 active
+ Bit32u nondma_count; // Number of samples sent in non-DMA mode
+ Bit8u samplebyte; // Current data byte in non-DMA mode
Bit8u testreg;
struct bx_sb16_dsp_dma_struct {
// Properties of the current DMA transfer:
@@ -268,6 +269,7 @@
BX_SB16_SMF void dsp_dmadone(); // stop a DMA transfer
BX_SB16_SMF void dsp_enabledma(); // enable the transfer
BX_SB16_SMF void dsp_disabledma(); // temporarily disable DMA
+ BX_SB16_SMF void dsp_disable_nondma(); // disable DSP direct mode
static void dsp_dmatimer(void *);
static Bit32u sb16_adc_handler(void *, Bit32u len);
Bit32u dsp_adc_handler(Bit32u len);
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Bochs-cvs mailing list
Bochs-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bochs-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic