es5503: fix interpretation of oscillator enable register. (GitHub bug #9045) [R. Belmont]

This commit is contained in:
arbee 2022-01-06 20:27:01 -05:00
parent 3745fcb690
commit 20adc731c2

View File

@ -2,7 +2,7 @@
// copyright-holders:R. Belmont
/*
ES5503 - Ensoniq ES5503 "DOC" emulator v2.1.2
ES5503 - Ensoniq ES5503 "DOC" emulator v2.1.3
By R. Belmont.
Copyright R. Belmont.
@ -33,6 +33,7 @@
2.1.2 (RB) - Fixed SoundSmith POLY.SYNTH inst where one-shot on the even oscillator and swap on the odd should loop.
Conversely, the intro voice in FTA Delta Demo has swap on the even and one-shot on the odd and doesn't
want to loop.
2.1.3 (RB) - Fixed oscillator enable register off-by-1 which caused everything to be half a step sharp.
*/
#include "emu.h"
@ -144,7 +145,7 @@ void es5503_device::sound_stream_update(sound_stream &stream, std::vector<read_s
for (int chan = 0; chan < output_channels; chan++)
{
for (osc = 0; osc < (oscsenabled+1); osc++)
for (osc = 0; osc < oscsenabled; osc++)
{
ES5503Osc *pOsc = &oscillators[osc];
@ -231,7 +232,7 @@ void es5503_device::device_start()
save_pointer(STRUCT_MEMBER(oscillators, irqpend), 32);
oscsenabled = 1;
output_rate = (clock() / 8) / (2 + oscsenabled);
output_rate = (clock() / 8) / (oscsenabled + 2);
m_stream = stream_alloc(0, output_channels, output_rate);
m_timer = timer_alloc(0, nullptr);
@ -239,7 +240,7 @@ void es5503_device::device_start()
void es5503_device::device_clock_changed()
{
output_rate = (clock() / 8) / (2 + oscsenabled);
output_rate = (clock() / 8) / (oscsenabled + 2);
m_stream->set_sample_rate(output_rate);
m_mix_buffer.resize((output_rate/50)*8);
@ -427,7 +428,9 @@ void es5503_device::write(offs_t offset, u8 data)
break;
case 0xe1: // oscillator enable
oscsenabled = (data>>1) & 0x1f;
// The number here is the number of oscillators to enable -1 times 2. You can never
// have zero oscilllators enabled. So a value of 62 enables all 32 oscillators.
oscsenabled = ((data>>1) & 0x3f) + 1;
notify_clock_changed();
break;