1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-02-28 06:29:37 +00:00

Merge pull request #968 from TomHarte/DaveAudio

Dave: apply ring modulation during sync, too.
This commit is contained in:
Thomas Harte 2021-07-06 23:41:37 -04:00 committed by GitHub
commit c6fcd9a1eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 17 deletions

View File

@ -67,7 +67,7 @@ Analyser::Static::TargetList Analyser::Static::Enterprise::GetTargets(const Medi
if(!has_exdos_ini) { if(!has_exdos_ini) {
if(did_pick_file) { if(did_pick_file) {
target->loading_command = std::string("run \"") + selected_file->name + "." + selected_file->extension + "\""; target->loading_command = std::string("run \"") + selected_file->name + "." + selected_file->extension + "\"\n";
} else { } else {
target->loading_command = ":dir\n"; target->loading_command = ":dir\n";
} }

View File

@ -69,14 +69,12 @@ void Audio::set_sample_volume_range(int16_t range) {
} }
void Audio::update_channel(int c) { void Audio::update_channel(int c) {
if(channels_[c].sync) {
channels_[c].count = channels_[c].reload;
channels_[c].output <<= 1;
return;
}
auto output = channels_[c].output & 1; auto output = channels_[c].output & 1;
channels_[c].output <<= 1; channels_[c].output <<= 1;
if(channels_[c].sync) {
channels_[c].count = channels_[c].reload;
output = 0;
} else {
if(!channels_[c].count) { if(!channels_[c].count) {
channels_[c].count = channels_[c].reload; channels_[c].count = channels_[c].reload;
@ -84,16 +82,19 @@ void Audio::update_channel(int c) {
output ^= 1; output ^= 1;
else else
output = poly_state_[int(channels_[c].distortion)]; output = poly_state_[int(channels_[c].distortion)];
} else {
--channels_[c].count;
}
if(channels_[c].high_pass && (channels_[(c+1)%3].output&3) == 2) { if(channels_[c].high_pass && (channels_[(c+1)%3].output&3) == 2) {
output = 0; output = 0;
} }
}
// Ring modulation applies even when sync is enabled, per SIDBasic.
if(channels_[c].ring_modulate) { if(channels_[c].ring_modulate) {
output = ~(output ^ channels_[(c+2)%3].output) & 1; output = ~(output ^ channels_[(c+2)%3].output) & 1;
} }
} else {
--channels_[c].count;
}
channels_[c].output |= output; channels_[c].output |= output;
} }