vgmplay: Disable POKEY and QSound devices if not required

This commit is contained in:
AJR 2018-03-22 17:14:28 -04:00
parent e6f15f526e
commit 9eb8c177bb
3 changed files with 17 additions and 12 deletions

View File

@ -201,8 +201,6 @@ void pokey_device::device_start()
//int sample_rate = clock(); //int sample_rate = clock();
int i; int i;
m_clock_period = attotime::from_hz(clock());
/* Setup channels */ /* Setup channels */
for (i=0; i<POKEY_CHANNELS; i++) for (i=0; i<POKEY_CHANNELS; i++)
{ {
@ -364,12 +362,15 @@ void pokey_device::device_post_load()
void pokey_device::device_clock_changed() void pokey_device::device_clock_changed()
{ {
m_clock_period = attotime::from_hz(clock()); m_clock_period = clocks_to_attotime(1);
if (m_stream != nullptr) if (clock() != 0)
m_stream->set_sample_rate(clock()); {
else if (m_stream != nullptr)
m_stream = stream_alloc(0, 1, clock()); m_stream->set_sample_rate(clock());
else
m_stream = stream_alloc(0, 1, clock());
}
} }
//------------------------------------------------- //-------------------------------------------------

View File

@ -465,11 +465,11 @@ void device_execute_interface::interface_pre_reset()
// reset the total number of cycles // reset the total number of cycles
m_totalcycles = 0; m_totalcycles = 0;
// enable all devices (except for disabled devices) // enable all devices (except for disabled and unclocked devices)
if (!disabled()) if (disabled())
resume(SUSPEND_ANY_REASON);
else
suspend(SUSPEND_REASON_DISABLE, true); suspend(SUSPEND_REASON_DISABLE, true);
else if (device().clock() != 0)
resume(SUSPEND_ANY_REASON);
} }

View File

@ -1119,7 +1119,11 @@ uint8_t vgmplay_state::r8(int off) const
void vgmplay_state::machine_start() void vgmplay_state::machine_start()
{ {
//m_nescpu-> // Disable executing devices if not required
m_pokey[0]->set_unscaled_clock(0);
m_pokey[1]->set_unscaled_clock(0);
m_qsound->set_unscaled_clock(0);
uint32_t size = 0; uint32_t size = 0;
if(m_file->exists() && m_file->length() > 0) { if(m_file->exists() && m_file->length() > 0) {
size = m_file->length(); size = m_file->length();