mirror of
https://github.com/TomHarte/CLK.git
synced 2024-07-04 18:29:40 +00:00
Reduce the amount of time spent installing instruments.
This commit is contained in:
parent
75315406bb
commit
e12dc5d894
@ -27,6 +27,11 @@ OPLL::OPLL(Concurrency::DeferringAsyncTaskQueue &task_queue, int audio_divider,
|
|||||||
phase_generators_[c + 9].reset();
|
phase_generators_[c + 9].reset();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set default instrument.
|
||||||
|
for(int c = 0; c < 9; ++c) {
|
||||||
|
install_instrument(c);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Machine-facing programmatic input.
|
// 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
|
// instead nominate additional attenuations. This code reads those back
|
||||||
// from the stored instrument values.
|
// from the stored instrument values.
|
||||||
case 0x30:
|
case 0x30:
|
||||||
channels_[index].instrument = value >> 4;
|
|
||||||
channels_[index].attenuation = value & 0xf;
|
channels_[index].attenuation = value & 0xf;
|
||||||
|
|
||||||
if(index < 6 || !rhythm_mode_enabled_) {
|
// Install an instrument only if it's new.
|
||||||
install_instrument(index);
|
if(channels_[index].instrument != value >> 4) {
|
||||||
|
channels_[index].instrument = value >> 4;
|
||||||
|
if(index < 6 || !rhythm_mode_enabled_) {
|
||||||
|
install_instrument(index);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ class OPLL: public OPLBase<OPLL> {
|
|||||||
bool is_vrc7_ = false;
|
bool is_vrc7_ = false;
|
||||||
|
|
||||||
// Contains the current configuration of the custom instrument.
|
// 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.
|
// Helpers to push per-channel information.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user