Fixes for multitrack

bugfix-reset
Mike Lynch 2023-09-30 15:01:01 +10:00
parent fefc5b7eed
commit aeb95f1343
1 changed files with 13 additions and 11 deletions

View File

@ -1,22 +1,22 @@
Granulator { Granulator {
var <buflen, <inb, <outb, <>posb, <triggerb, <pitchb, <>modb, <buffer, <recorder, <grains, <triggersynth, <pitchsynth, server, mode, record, gain, mix, speed, trigger, size, blur, dust, slope, back, chorus, detune, pitch, pan, track, jitter; var <buflen, <inb, <outb, <>posb, <triggerb, <pitchb, <rectriggerb, <modb, <buffer, <recorder, <grains, <triggersynth, <pitchsynth, server, mode, record, gain, mix, speed, trigger, size, blur, dust, slope, back, chorus, detune, pitch, pan, track, jitter;
*init { *init {
SynthDef( SynthDef(
\grain_record, \grain_record,
{ {
arg in = 2, buffer = 0, mix = 0.5, record = 0.0; arg in = 2, trigger = 0, buffer = 0, mix = 0.5, record = 0.0;
var insig = record * In.ar(in, 1); var insig = record * In.ar(in, 1), trigsig = In.kr(trigger, 1);
RecordBuf.ar(insig, buffer, 0, mix, 1 - mix, loop: 1) RecordBuf.ar(insig, buffer, 0, mix, 1 - mix, loop: 1, trigger: trigsig)
} }
).add(); ).add();
SynthDef( SynthDef(
\grain_play, \grain_play,
{ {
arg out=0, buffer, blen, pitchb, triggerb, posb, modb, size=0.1, amp=0.5, pan=0, track=0.25, jitter=0, blur=0.0; arg out=0, buffer, blen, pitchb, triggerb, posb, rectriggerb, modb, size=0.1, amp=0.5, pan=0, track=0.25, jitter=0, blur=0.0;
var pitch, trigger, pos, pans, grains; var pitch, trigger, pos, pans, grains;
trigger = In.kr(triggerb); trigger = In.kr(triggerb);
pitch = In.kr(pitchb); pitch = In.kr(pitchb);
@ -51,18 +51,19 @@ Granulator {
).add(); ).add();
} }
*new { | buflen, inb, outb, posb | *new { | buflen, inb, outb, posb, rectriggerb |
^super.new.init(buflen, inb, outb, posb); ^super.new.init(buflen, inb, outb, posb, rectriggerb);
} }
// note that the default values here have been hand-picked to match the TouchOSC // note that the default values here have been hand-picked to match the TouchOSC
// defaults, which is Bad. // defaults, which is Bad.
init { | abuflen, ainb, aoutb, aposb | init { | abuflen, ainb, aoutb, aposb, arectriggerb |
buflen = abuflen; buflen = abuflen;
inb = ainb; inb = ainb;
outb = aoutb; outb = aoutb;
posb = aposb; posb = aposb;
rectriggerb = arectriggerb;
server = Server.default; server = Server.default;
mode = 0; mode = 0;
blur = 0; blur = 0;
@ -70,7 +71,7 @@ Granulator {
trigger = 120; trigger = 120;
dust = 0; dust = 0;
back = 0; back = 0;
slope = 1; slope = 0;
chorus = 0; chorus = 0;
detune = 0; detune = 0;
pitch = 0; pitch = 0;
@ -84,7 +85,8 @@ Granulator {
recorder = Synth.new(\grain_record, [ recorder = Synth.new(\grain_record, [
\in, inb, \in, inb,
\buffer, buffer, \buffer, buffer,
\record, 0 \record, 0,
\trigger, rectriggerb
], server, \addToTail); ], server, \addToTail);
triggersynth = Synth.new(\grain_trigger, [ \out, triggerb ]); triggersynth = Synth.new(\grain_trigger, [ \out, triggerb ]);
pitchsynth = Synth.new(\grain_pitch, [ \out, pitchb, \triggerb, triggerb, \posb, posb ]); pitchsynth = Synth.new(\grain_pitch, [ \out, pitchb, \triggerb, triggerb, \posb, posb ]);
@ -130,7 +132,7 @@ Granulator {
jitter { ^jitter } jitter { ^jitter }
mode_ { | v | mode = v; } // todo - playback mode in this class? mode_ { | v | mode = v; } // todo - playback mode in this class?
record_ { | v | record = v; recorder.set(\record, v); } record_ { | v | record = v; recorder.set(\record, v);}
mix_ { | v | mix = v; recorder.set(\mix, v); } mix_ { | v | mix = v; recorder.set(\mix, v); }
gain_ { | v | gain = v; grains.set(\amp, v); } gain_ { | v | gain = v; grains.set(\amp, v); }
size_ { | v | size = v; grains.set(\size, v); } size_ { | v | size = v; grains.set(\size, v); }