local f1Osc = self:addObject("f1Osc", libcore.SineOscillator())
local fdbk = self:addObject("fdbk", app.GainBias())
local fdbkRange = self:addObject("fdbkRange", app.MinMax())
[...]
connect(fdbk, "Out", f1Osc, "Feedback")
connect(fdbk, "Out", fdbkRange, "In")
self:addMonoBranch("fdbk", fdbk, "In", fdbk, "Out")
is equivalent to:
local f1Osc = self:addObject("f1Osc", libcore.SineOscillator())
local fdbk = self:addObject("fdbk", app.ParameterAdapter())
[...]
tie (f1Osc, "Feedback", fdbk, "Out")
self:addMonoBranch("fdbk", fdbk, "In", fdbk, "Out")
?
thanks!
this question came up when I was trying to read others’ code, and I could not guess which is the preferred way — they seem to be used interchangeably. Of course, I might have missed something.
The 2 patterns are similar in spirit but not equivalent.
The top pattern has no (frame-rate) parameters involved, instead everything is audio-rate. The bottom pattern has a bug and would only work if libcore.SineOscillator exposed FeedBack as a Parameter instead of an Inlet. Specifically, you can only connect outlets to inlets, and tie parameters to parameters. In this line,
tie (f1Osc, "Feedback", fdbk, "Out")
you are attempting to tie an Inlet to a Parameter.
The purpose of the ParameterAdapter is to control an object’s (frame-rate) parameter with an (audio-rate) GainBias sub-chain. It is up to the designer of the object to decide which control variables should be audio-rate (and hence implemented as expensive Inlets) and which can be frame-rate (and hence implemented as cheap Parameters).
TLDR
Inlets and Outlets are audio-rate.
Parameters are frame-rate.
ParameterAdapter is an (object) adapter that enables a GainBias audio-rate sub-chain control a Parameter.