/usr/include/faust/dsp/dsp-combiner.h is in faust-common 0.9.95~repack1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | /************************************************************************
IMPORTANT NOTE : this file contains two clearly delimited sections :
the ARCHITECTURE section (in two parts) and the USER section. Each section
is governed by its own copyright and license. Please check individually
each section for license and copyright information.
*************************************************************************/
/*******************BEGIN ARCHITECTURE SECTION (part 1/2)****************/
/************************************************************************
FAUST Architecture File
Copyright (C) 2003-2011 GRAME, Centre National de Creation Musicale
---------------------------------------------------------------------
This Architecture section is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 3 of
the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; If not, see <http://www.gnu.org/licenses/>.
EXCEPTION : As a special exception, you may create a larger work
that contains this FAUST architecture section and distribute
that work under terms of your choice, so long as this FAUST
architecture section is not modified.
************************************************************************
************************************************************************/
#ifndef __dsp_combiner__
#define __dsp_combiner__
#include <string.h>
#include <assert.h>
#include "faust/dsp/dsp.h"
// Combine two DSP in sequence
class dsp_sequencer : public dsp {
private:
dsp* fDSP1;
dsp* fDSP2;
FAUSTFLOAT** fSeqBuffer;
public:
dsp_sequencer(dsp* dsp1, dsp* dsp2, int buffer_size = 4096)
:fDSP1(dsp1), fDSP2(dsp2)
{
assert(fDSP1->getNumOutputs() == fDSP2->getNumInputs());
fSeqBuffer = new FAUSTFLOAT*[fDSP1->getNumOutputs()];
for (int i = 0; i < fDSP1->getNumOutputs(); i++) {
fSeqBuffer[i] = new FAUSTFLOAT[buffer_size];
}
}
virtual ~dsp_sequencer()
{
for (int i = 0; i < fDSP1->getNumOutputs(); i++) {
delete [] fSeqBuffer[i];
}
delete [] fSeqBuffer;
delete fDSP1;
delete fDSP2;
}
virtual int getNumInputs() { return fDSP1->getNumInputs(); }
virtual int getNumOutputs() { return fDSP2->getNumOutputs(); }
virtual void buildUserInterface(UI* ui_interface)
{
ui_interface->openTabBox("Sequencer");
ui_interface->openVerticalBox("DSP1");
fDSP1->buildUserInterface(ui_interface);
ui_interface->closeBox();
ui_interface->openVerticalBox("DSP2");
fDSP2->buildUserInterface(ui_interface);
ui_interface->closeBox();
ui_interface->closeBox();
}
virtual int getSampleRate()
{
return fDSP1->getSampleRate();
}
virtual void init(int samplingRate)
{
fDSP1->init(samplingRate);
fDSP2->init(samplingRate);
}
virtual void instanceInit(int samplingRate)
{
fDSP1->instanceInit(samplingRate);
fDSP2->instanceInit(samplingRate);
}
virtual void instanceConstants(int samplingRate)
{
fDSP1->instanceConstants(samplingRate);
fDSP2->instanceConstants(samplingRate);
}
virtual void instanceResetUserInterface()
{
fDSP1->instanceResetUserInterface();
fDSP2->instanceResetUserInterface();
}
virtual void instanceClear()
{
fDSP1->instanceClear();
fDSP2->instanceClear();
}
virtual dsp* clone()
{
return new dsp_sequencer(fDSP1->clone(), fDSP2->clone());
}
virtual void metadata(Meta* m)
{
fDSP1->metadata(m);
fDSP2->metadata(m);
}
virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs)
{
fDSP1->compute(count, inputs, fSeqBuffer);
fDSP2->compute(count, fSeqBuffer, outputs);
}
virtual void compute(double date_usec, int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { compute(count, inputs, outputs); }
};
// Combine two DSP in parallel
class dsp_parallelizer : public dsp {
private:
dsp* fDSP1;
dsp* fDSP2;
public:
dsp_parallelizer(dsp* dsp1, dsp* dsp2, int buffer_size = 4096)
:fDSP1(dsp1), fDSP2(dsp2)
{}
virtual ~dsp_parallelizer()
{
delete fDSP1;
delete fDSP2;
}
virtual int getNumInputs() { return fDSP1->getNumInputs() + fDSP2->getNumInputs(); }
virtual int getNumOutputs() { return fDSP1->getNumOutputs() + fDSP2->getNumOutputs(); }
virtual void buildUserInterface(UI* ui_interface)
{
ui_interface->openTabBox("Parallelizer");
ui_interface->openVerticalBox("DSP1");
fDSP1->buildUserInterface(ui_interface);
ui_interface->closeBox();
ui_interface->openVerticalBox("DSP2");
fDSP2->buildUserInterface(ui_interface);
ui_interface->closeBox();
ui_interface->closeBox();
}
virtual int getSampleRate()
{
return fDSP1->getSampleRate();
}
virtual void init(int samplingRate)
{
fDSP1->init(samplingRate);
fDSP2->init(samplingRate);
}
virtual void instanceInit(int samplingRate)
{
fDSP1->instanceInit(samplingRate);
fDSP2->instanceInit(samplingRate);
}
virtual void instanceConstants(int samplingRate)
{
fDSP1->instanceConstants(samplingRate);
fDSP2->instanceConstants(samplingRate);
}
virtual void instanceResetUserInterface()
{
fDSP1->instanceResetUserInterface();
fDSP2->instanceResetUserInterface();
}
virtual void instanceClear()
{
fDSP1->instanceClear();
fDSP2->instanceClear();
}
virtual dsp* clone()
{
return new dsp_parallelizer(fDSP1->clone(), fDSP2->clone());
}
virtual void metadata(Meta* m)
{
fDSP1->metadata(m);
fDSP2->metadata(m);
}
virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs)
{
fDSP1->compute(count, inputs, outputs);
// Shift inputs/outputs channels for fDSP2
FAUSTFLOAT** inputs_dsp2 = (FAUSTFLOAT**)alloca(fDSP2->getNumInputs() * sizeof(FAUSTFLOAT*));
for (int chan = 0; chan < fDSP2->getNumInputs(); chan++) {
inputs_dsp2[chan] = inputs[fDSP1->getNumInputs() + chan];
}
FAUSTFLOAT** outputs_dsp2 = (FAUSTFLOAT**)alloca(fDSP2->getNumOutputs() * sizeof(FAUSTFLOAT*));
for (int chan = 0; chan < fDSP2->getNumOutputs(); chan++) {
outputs_dsp2[chan] = inputs[fDSP1->getNumOutputs() + chan];
}
fDSP2->compute(count, inputs_dsp2, outputs_dsp2);
}
virtual void compute(double date_usec, int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { compute(count, inputs, outputs); }
};
#endif
|