Skip to content

Commit

Permalink
protosynth: fix glide issue + presets
Browse files Browse the repository at this point in the history
  • Loading branch information
JoepVanlier committed May 22, 2024
1 parent 456c03c commit f670ea8
Show file tree
Hide file tree
Showing 3 changed files with 5,597 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ function midi_sample(respond_to_notes)
instance(note_next, curSample, note_ptr, notes_remain, notes_on, note, velocity,
active_note_mem, active_note_vel, active_note_state, note_history, note_release_mem, release_idx,
cur_cc, cc_target, max_notes, modwheel, pitchbend, last_vel, last_slot)
local(i, i2, found, current_item, change, not_released)
local(i, i2, found, found_note_history_entry, current_item, change, not_released)
global(MAX_STRING, voice_thievery, glide)
(
change = 0;
Expand All @@ -210,7 +210,7 @@ global(MAX_STRING, voice_thievery, glide)
// and flag it as newpress
not_released = active_note_vel[i] > 0; // Positive indicates that it's not been released yet.

((abs(active_note_mem[i]) == note) && (not_released || glide)) ? (
((abs(active_note_mem[i]) == note) && not_released) ? (
found = 1;
active_note_state[i] = 1;
active_note_vel[i] = velocity;
Expand All @@ -221,6 +221,7 @@ global(MAX_STRING, voice_thievery, glide)
);
i += 1;
);

// This note is not playing yet.
!found ? (
// Find empty slot
Expand All @@ -245,7 +246,7 @@ global(MAX_STRING, voice_thievery, glide)
i += 1;
);

// Try cycling through released notes next
// Try cycling through released notes
(found > MAX_NOTES) ? (
i = 0;
i2 = 90071992547409; // 9007199254740992;
Expand All @@ -263,16 +264,27 @@ global(MAX_STRING, voice_thievery, glide)

// We are about to recycle an existing one, so we need to drop the old one from the note history
(found < MAX_NOTES) ? (
i2 = found;
loop(max_notes,
note_history[i2] = note_history[i2 + 1];
i2 += 1;
// We need to find where in the note history this one was stored previously
i = 0;
found_note_history_entry = 1337;
while((found_note_history_entry == 1337) && (i <= notes_on))
(
(note_history[i] == found) ? (found_note_history_entry = i);
i += 1;
);

(found_note_history_entry < notes_on) ? (
i2 = found_note_history_entry;
loop(max_notes,
note_history[i2] = note_history[i2 + 1];
i2 += 1;
);
notes_on -= 1;
);
notes_on -= 1;
);
);

(found <= MAX_NOTES) ? (
(found <= MAX_NOTES) ? (
note_history[notes_on] = found;
notes_on += 1;
// Add note to list of active notes
Expand All @@ -282,6 +294,7 @@ global(MAX_STRING, voice_thievery, glide)
active_note_state[found] = 1; /* Press state */
);
);

change = 1;
) : (
note_ptr += 1;
Expand Down
5 changes: 2 additions & 3 deletions protosynth/saike_protosynth.jsfx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
desc:Saike Protosynth
options:maxmem=32000000
tags: instrument, synth, generator, synthesizer
version: 0.25
version: 0.26
author: Joep Vanlier
changelog: Add wavetable support.
changelog: Fix issue with glide in new voice stealing implementation.
license: MIT
provides:
protosynth_dependencies/*
saike_protosynth.jsfx.rpl


<?
tuning_basic = 0.5;
Expand Down
Loading

0 comments on commit f670ea8

Please sign in to comment.