mirror of
https://github.com/holub/mame
synced 2025-04-24 09:20:02 +03:00
gus.cpp : Calculated GF1 sample rate
This commit is contained in:
parent
def2bf867c
commit
7a8fcae1d3
@ -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.
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user