Setting default parameters in the init

bugfix-reset
Mike Lynch 2023-04-10 17:13:04 +10:00
parent 8c61b8dae8
commit fefc5b7eed
1 changed files with 16 additions and 1 deletions

View File

@ -7,7 +7,7 @@ Granulator {
SynthDef(
\grain_record,
{
arg in = 2, buffer = 0, mix = 0.25, record = 0.0;
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)
}
@ -55,6 +55,8 @@ Granulator {
^super.new.init(buflen, inb, outb, posb);
}
// note that the default values here have been hand-picked to match the TouchOSC
// defaults, which is Bad.
init { | abuflen, ainb, aoutb, aposb |
buflen = abuflen;
@ -63,6 +65,19 @@ Granulator {
posb = aposb;
server = Server.default;
mode = 0;
blur = 0;
size = 0.1;
trigger = 120;
dust = 0;
back = 0;
slope = 1;
chorus = 0;
detune = 0;
pitch = 0;
mix = 0.25;
pan = 0;
track = 0.5;
jitter = 0.25;
triggerb = Bus.control(server, 1);
pitchb = Bus.control(server, 1);
buffer = Buffer.alloc(server, server.sampleRate * buflen, 1);