Skip to content

Commit

Permalink
Optimize program switching (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
MyBlackMIDIScore authored Aug 16, 2024
1 parent ea7ceaf commit 0892efe
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions core/src/channel/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,10 @@ impl VoiceChannel {
key.data.render_to(&mut key.audio_cache);
}

self.params
.channel_sf
.change_program(self.control_event_data.bank, self.control_event_data.preset);

out.fill(0.0);
match self.threadpool.as_ref() {
Some(pool) => {
Expand Down Expand Up @@ -336,10 +340,6 @@ impl VoiceChannel {
// Bank select
if !self.options.drums_only {
self.control_event_data.bank = value;
self.params.channel_sf.change_program(
self.control_event_data.bank,
self.control_event_data.preset,
);
}
}
0x64 => {
Expand Down Expand Up @@ -570,10 +570,6 @@ impl VoiceChannel {
}
ChannelAudioEvent::ProgramChange(preset) => {
self.control_event_data.preset = preset;
self.params.channel_sf.change_program(
self.control_event_data.bank,
self.control_event_data.preset,
);
}
},
ChannelEvent::Config(config) => self.params.process_config_event(config),
Expand Down

0 comments on commit 0892efe

Please sign in to comment.