summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author cam900 <dbtlrchl@naver.com>2020-02-13 19:49:18 +0900
committer cam900 <dbtlrchl@naver.com>2020-02-13 19:49:18 +0900
commit7a8fcae1d31ba8aaaf129bb58e2d11b1ef05dff5 (patch)
treef1400a48d9afb7c549689fbb07b53f1319349db0
parentdef2bf867c2c1b09eb23eb43640d79141f18355a (diff)
gus.cpp : Calculated GF1 sample rate
-rw-r--r--src/devices/bus/isa/gus.cpp21
-rw-r--r--src/devices/bus/isa/gus.h1
2 files changed, 10 insertions, 12 deletions
diff --git a/src/devices/bus/isa/gus.cpp b/src/devices/bus/isa/gus.cpp
index c4784b205b2..6acf2482270 100644
--- a/src/devices/bus/isa/gus.cpp
+++ b/src/devices/bus/isa/gus.cpp
@@ -33,14 +33,6 @@
//#define SAVE_WAVE_RAM 1
//#define LOG_SOUND 1
-static const uint16_t rate_table[33] =
-{
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 44100, 41160, 38587, 36317, 34300, 32494, 30870, 29400,
- 28063, 26843, 25725, 24696, 23746, 22866, 22050, 21289,
- 20580, 19916, 19293
-};
-
static const uint16_t volume_ramp_table[4] =
{
1, 8, 64, 512
@@ -411,7 +403,7 @@ void gf1_device::device_start()
m_wave_ram.resize(1024*1024);
memset(&m_wave_ram[0], 0, 1024*1024);
- m_stream = stream_alloc(0,2,44100);
+ m_stream = stream_alloc(0,2,clock() / (14 * 16));
// init timers
m_timer1 = timer_alloc(ADLIB_TIMER1);
@@ -458,7 +450,7 @@ void gf1_device::device_reset()
m_irq_source = 0xe0;
m_reg_ctrl = 0;
m_active_voices = 14;
- m_stream->set_sample_rate(44100);
+ m_stream->set_sample_rate(clock() / (m_active_voices * 16));
m_voltimer->adjust(attotime::zero,0,attotime::from_usec(1000/(1.6*m_active_voices)));
}
@@ -474,6 +466,11 @@ void gf1_device::device_stop()
fclose(f);
#endif
}
+
+void gf1_device::device_clock_changed()
+{
+ m_stream->set_sample_rate(clock() / (m_active_voices * 16));
+}
// ------------------------------------------------
// device I/O handlers
// ------------------------------------------------
@@ -743,10 +740,10 @@ WRITE8_MEMBER(gf1_device::global_reg_data_w)
m_active_voices = 14;
if(m_active_voices > 32)
m_active_voices = 32;
- m_stream->set_sample_rate(rate_table[m_active_voices]);
+ m_stream->set_sample_rate(clock() / (m_active_voices * 16));
m_voltimer->adjust(attotime::zero,0,attotime::from_usec(1000/(1.6*m_active_voices)));
}
- logerror("GUS: Active Voices write %02x (%d voices at %u Hz)\n", data, m_active_voices, rate_table[m_active_voices]);
+ logerror("GUS: Active Voices write %02x (%d voices at %u Hz)\n", data, m_active_voices, clock() / (m_active_voices * 16));
break;
case 0x41:
/* bit 0 - Enable the DMA channel.
diff --git a/src/devices/bus/isa/gus.h b/src/devices/bus/isa/gus.h
index 0009510b81f..d79dee72a29 100644
--- a/src/devices/bus/isa/gus.h
+++ b/src/devices/bus/isa/gus.h
@@ -155,6 +155,7 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_stop() override;
+ virtual void device_clock_changed() override;
virtual void update_irq() override;