1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-23 03:32:32 +00:00

Hit up the other two kinds of audio generator.

This commit is contained in:
Thomas Harte 2016-10-07 17:10:00 -04:00
parent 002e923cf1
commit 922dd6a586
2 changed files with 16 additions and 6 deletions

View File

@ -19,12 +19,16 @@ Speaker::Speaker() :
void Speaker::set_volume(uint8_t volume) void Speaker::set_volume(uint8_t volume)
{ {
enqueue([=]() {
_volume = volume; _volume = volume;
});
} }
void Speaker::set_control(int channel, uint8_t value) void Speaker::set_control(int channel, uint8_t value)
{ {
enqueue([=]() {
_control_registers[channel] = value; _control_registers[channel] = value;
});
} }
// Source: VICE. Not original. // Source: VICE. Not original.

View File

@ -804,18 +804,24 @@ Atari2600::Speaker::~Speaker()
void Atari2600::Speaker::set_volume(int channel, uint8_t volume) void Atari2600::Speaker::set_volume(int channel, uint8_t volume)
{ {
enqueue([=]() {
_volume[channel] = volume & 0xf; _volume[channel] = volume & 0xf;
});
} }
void Atari2600::Speaker::set_divider(int channel, uint8_t divider) void Atari2600::Speaker::set_divider(int channel, uint8_t divider)
{ {
enqueue([=]() {
_divider[channel] = divider & 0x1f; _divider[channel] = divider & 0x1f;
_divider_counter[channel] = 0; _divider_counter[channel] = 0;
});
} }
void Atari2600::Speaker::set_control(int channel, uint8_t control) void Atari2600::Speaker::set_control(int channel, uint8_t control)
{ {
enqueue([=]() {
_control[channel] = control & 0xf; _control[channel] = control & 0xf;
});
} }
#define advance_poly4(c) _poly4_counter[channel] = (_poly4_counter[channel] >> 1) | (((_poly4_counter[channel] << 3) ^ (_poly4_counter[channel] << 2))&0x008) #define advance_poly4(c) _poly4_counter[channel] = (_poly4_counter[channel] >> 1) | (((_poly4_counter[channel] << 3) ^ (_poly4_counter[channel] << 2))&0x008)