Skip to content

Instantly share code, notes, and snippets.

@scztt
Created June 13, 2019 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scztt/bf1796eebe015640df7bf6c1425d4906 to your computer and use it in GitHub Desktop.
Save scztt/bf1796eebe015640df7bf6c1425d4906 to your computer and use it in GitHub Desktop.
+SynthDef {
// buildForProxy {}
numChannels {
^(desc !? (_.numChannels))
}
rate {
^(desc !? (_.rate));
}
}
+SynthDesc {
prFindProxyOutputs {
^outputs.select {
|o|
o.startingChannel == \out
}
}
numChannels {
var channels = nil;
this.prFindProxyOutputs.do {
|out|
channels = max(out.numberOfChannels, channels ?? 1);
};
^channels
}
rate {
this.prFindProxyOutputs.do {
|out|
^out.rate;
};
^nil
}
}
+SynthControl {
build { | proxy, orderIndex |
var rate, desc, numChannels;
desc = this.synthDesc;
if(desc.notNil) {
canFreeSynth = desc.canFreeSynth;
canReleaseSynth = desc.hasGate && canFreeSynth;
};
if(proxy.isNeutral) {
rate = desc.rate;
};
numChannels = desc.numChannels;
^proxy.initBus(rate, numChannels)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment