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