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

Reduce the amount of time spent installing instruments.

This commit is contained in:
Thomas Harte 2020-05-06 00:15:28 -04:00
parent 75315406bb
commit e12dc5d894
2 changed files with 12 additions and 4 deletions

View File

@ -27,6 +27,11 @@ OPLL::OPLL(Concurrency::DeferringAsyncTaskQueue &task_queue, int audio_divider,
phase_generators_[c + 9].reset();
});
}
// Set default instrument.
for(int c = 0; c < 9; ++c) {
install_instrument(c);
}
}
// MARK: - Machine-facing programmatic input.
@ -112,11 +117,14 @@ void OPLL::write_register(uint8_t address, uint8_t value) {
// instead nominate additional attenuations. This code reads those back
// from the stored instrument values.
case 0x30:
channels_[index].instrument = value >> 4;
channels_[index].attenuation = value & 0xf;
if(index < 6 || !rhythm_mode_enabled_) {
install_instrument(index);
// Install an instrument only if it's new.
if(channels_[index].instrument != value >> 4) {
channels_[index].instrument = value >> 4;
if(index < 6 || !rhythm_mode_enabled_) {
install_instrument(index);
}
}
return;
}

View File

@ -83,7 +83,7 @@ class OPLL: public OPLBase<OPLL> {
bool is_vrc7_ = false;
// Contains the current configuration of the custom instrument.
uint8_t custom_instrument_[8];
uint8_t custom_instrument_[8] = {0, 0, 0, 0, 0, 0, 0, 0};
// Helpers to push per-channel information.