diff --git a/Components/6560/6560.cpp b/Components/6560/6560.cpp index 7bb013ebb..8882decd3 100644 --- a/Components/6560/6560.cpp +++ b/Components/6560/6560.cpp @@ -19,12 +19,16 @@ Speaker::Speaker() : void Speaker::set_volume(uint8_t volume) { - _volume = volume; + enqueue([=]() { + _volume = volume; + }); } void Speaker::set_control(int channel, uint8_t value) { - _control_registers[channel] = value; + enqueue([=]() { + _control_registers[channel] = value; + }); } // Source: VICE. Not original. diff --git a/Machines/Atari2600/Atari2600.cpp b/Machines/Atari2600/Atari2600.cpp index 8970ad2d1..72b4c2bca 100644 --- a/Machines/Atari2600/Atari2600.cpp +++ b/Machines/Atari2600/Atari2600.cpp @@ -804,18 +804,24 @@ Atari2600::Speaker::~Speaker() void Atari2600::Speaker::set_volume(int channel, uint8_t volume) { - _volume[channel] = volume & 0xf; + enqueue([=]() { + _volume[channel] = volume & 0xf; + }); } void Atari2600::Speaker::set_divider(int channel, uint8_t divider) { - _divider[channel] = divider & 0x1f; - _divider_counter[channel] = 0; + enqueue([=]() { + _divider[channel] = divider & 0x1f; + _divider_counter[channel] = 0; + }); } void Atari2600::Speaker::set_control(int channel, uint8_t control) { - _control[channel] = control & 0xf; + enqueue([=]() { + _control[channel] = control & 0xf; + }); } #define advance_poly4(c) _poly4_counter[channel] = (_poly4_counter[channel] >> 1) | (((_poly4_counter[channel] << 3) ^ (_poly4_counter[channel] << 2))&0x008)