Skip to content

Commit

Permalink
send reset all controllers and take it into account in sequencer
Browse files Browse the repository at this point in the history
  • Loading branch information
spessasus committed Nov 10, 2024
1 parent d5eccdc commit 3e66754
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 19 deletions.
14 changes: 6 additions & 8 deletions src/spessasynth_lib/sequencer/worklet_sequencer/play.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
import { getEvent, messageTypes, midiControllers } from "../../midi_parser/midi_message.js";
import { WorkletSequencerReturnMessageType } from "./sequencer_message.js";
import { MIDIticksToSeconds } from "../../midi_parser/basic_midi.js";
import { resetArray } from "../../synthetizer/worklet_system/worklet_utilities/controller_tables.js";


// an array with preset default values
const defaultControllerArray = new Int16Array(127);
// default values
defaultControllerArray[midiControllers.mainVolume] = 100;
defaultControllerArray[midiControllers.expressionController] = 127;
defaultControllerArray[midiControllers.pan] = 64;
defaultControllerArray[midiControllers.releaseTime] = 64;
defaultControllerArray[midiControllers.brightness] = 64;
defaultControllerArray[midiControllers.reverbDepth] = 0;
const defaultControllerArray = resetArray.slice(0, 128);

/**
* plays from start to the target time, excluding note messages (to get the synth to the correct state)
Expand Down Expand Up @@ -130,6 +124,10 @@ export function _playTo(time, ticks = undefined)
programs[channel].bank = ccV;
break;
}
else if (controllerNumber === midiControllers.resetAllControllers)
{
savedControllers[channel] = Array.from(defaultControllerArray);
}
if (this.sendMIDIMessages)
{
this.sendMIDICC(channel, controllerNumber, ccV);
Expand Down
Loading

0 comments on commit 3e66754

Please sign in to comment.