Skip to content

Commit

Permalink
Fix output handling and faust2sc.
Browse files Browse the repository at this point in the history
  • Loading branch information
sletz committed Jan 29, 2024
1 parent 2270a8e commit 8715622
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
13 changes: 6 additions & 7 deletions architecture/supercollider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,12 +434,10 @@ inline static void Faust_updateOutputControls(Faust* unit, int inNumSamples)
size_t numControlOutput = unit->mNumControlOutput;
int curControl = unit->mDSP->getNumOutputs();
for (int i = 0; i < numControlOutput; ++i) {
// Copy one value
// OUT0(curControl) = unit->getOutputControl(i)->updateOutput();
// fillBuffer(OUT(curControl), inNumSamples, unit->getOutputControl(i));
// Copy control on the entire control buffer
Control* control = unit->getOutputControl(i);
// TODO : this crash
//if (control) fillBuffer(OUT(curControl), inNumSamples, control->updateOutput());
fillBuffer(OUT(curControl), inNumSamples, unit->getOutputControl(i)->updateOutput());
curControl++;
}
}
Expand Down Expand Up @@ -505,6 +503,9 @@ void Faust_Ctor(Faust* unit) // module constructor

Print("Faust unit->mNumControlInput %d\n", unit->mNumControlInput);
Print("Faust unit->mNumControlOutput %d\n", unit->mNumControlOutput);

Print("Faust unit->mNumInputs %d\n", unit->mNumInputs);
Print("Faust unit->mNumOutputs %d\n", unit->mNumOutputs);

ControlAllocator ca(unit->mControls);
unit->mDSP->buildUserInterface(&ca);
Expand All @@ -518,9 +519,7 @@ void Faust_Ctor(Faust* unit) // module constructor

// Check input/output channel configuration
const size_t numInputs = unit->mDSP->getNumInputs() + unit->mNumControlInput;
const size_t numOutputs = unit->mDSP->getNumOutputs();
// The control outputs are not part of unit->mNumOutputs ?
//const size_t numOutputs = unit->mDSP->getNumOutputs() + unit->mNumControlOutput;
const size_t numOutputs = unit->mDSP->getNumOutputs() + unit->mNumControlOutput;

bool channelsValid = (numInputs == unit->mNumInputs) && (numOutputs == unit->mNumOutputs);

Expand Down
7 changes: 5 additions & 2 deletions tools/faust2sc-1.0.0/faust2sc
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ module Faust
def total_inputs
inputs + ui.active_widgets.size
end
def total_outputs
outputs + ui.passive_widgets.size
end
def Plugin::from_file(path)
self.new(path, REXML::Document.new(File.open(path) { |io| io.read }))
end
Expand Down Expand Up @@ -367,10 +370,10 @@ module Faust
@plugin.inputs
end
def outputs
@plugin.outputs
@plugin.total_outputs
end
def superclass_name
@plugin.outputs > 1 ? "MultiOutUGen" : "UGen"
@plugin.total_outputs > 1 ? "MultiOutUGen" : "UGen"
end
def input_names
(1..self.inputs).collect { |i| "in#{i}" }
Expand Down

0 comments on commit 8715622

Please sign in to comment.