7 #ifndef PDSP_CORE_BASICNODES_H_INCLUDED 8 #define PDSP_CORE_BASICNODES_H_INCLUDED 17 #include "../pdspFunctions.h" 18 #include "../pdspConstants.h" 19 #include "../../math/header.h" 20 #include "Preparable.h" 24 #include "../../flags.h" 42 OutputData( OutputNode* node,
bool multiply,
float multiplier )
43 : node( node ), multiply( multiply ), multiplier( multiplier ) { };
54 NamedInput(
const char* tag, InputNode* pInput ) : tag( tag ), input( pInput ) {};
62 NamedOutput(
const char* tag, OutputNode* pOutput ) : tag( tag ), output( pOutput ) {};
93 void resetInputToDefault();
97 void resetOutputToDefault();
124 void disconnectOut();
129 void disconnectAll();
144 std::vector<std::string> getInputsList();
149 std::vector<std::string> getOutputsList();
160 void addOutput(
const char* tag,
OutputNode & output );
169 void addInput(
const char* tag,
InputNode & input );
178 void addModuleOutput(
const char* tag,
Patchable & unit );
187 void addModuleInput(
const char* tag,
Patchable & unit );
192 [[deprecated(
"Replaced by addModuleOutput() for a less ambigous nomenclature")]]
193 void addUnitOutput(
const char* tag,
Patchable & unit );
195 [[deprecated(
"Replaced by addModuleInput() for a less ambigous nomenclature")]]
196 void addUnitInput(
const char* tag,
Patchable & unit );
202 std::vector<NamedInput> inputs;
203 std::vector<NamedOutput> outputs;
205 static NullInput invalidInput;
206 static NullOutput invalidOutput;
211 void clearAllAddedNodes();
229 Unit& operator= (
const Unit & other);
239 virtual void setOversampleLevel(
int newOversampleLevel );
244 int getOversampleLevel()
const;
254 virtual void process(
int bufferSize ) noexcept = 0;
263 virtual void prepareUnit(
int expectedBufferSize,
double sampleRate ) = 0;
271 virtual void releaseResources( )
override = 0;
280 void prepareToPlay(
int expectedBufferSize,
double sampleRate )
override;
291 const float* processInput(
InputNode& node,
int& stateNow );
300 float processAndGetSingleValue(
InputNode& input,
int pos );
311 float* getOutputBufferToFill(
OutputNode& node );
320 void setControlRateOutput(
OutputNode& node,
float scalarValue );
333 void updateOutputNodes();
357 friend class OutputData;
390 void disconnectAll();
395 virtual float getCRValue()
const;
400 const float* getBuffer()
const;
405 const int getState()
const;
410 const std::vector<InputNode*> & getOutputs()
const;
425 const int getOversampleLevel()
const;
430 OutputNode& setMultiplyOnConnection(
float multiplier );
435 static const int getGlobalProcessingTurnId();
449 void prepareToPlay(
int expectedBufferSize,
double sampleRate )
override;
450 void releaseResources()
override;
451 virtual void setOversampleLevel(
int newOversample );
453 virtual bool exists();
456 void removeOutputFromList(
InputNode* toRemove );
459 std::vector<InputNode*> outputs;
461 static std::atomic<int> globalProcessingTurnId;
465 static void setTurn(
int newTurn ) ;
467 static void nextTurn();
470 Unit* getParent()
const;
471 void setParent(
Unit* parent );
475 float nextMultiplier;
477 int lastProcessedTurnId;
502 float getCRValue()
const override;
508 void set(
float value );
522 void prepareToPlay(
int expectedBufferSize,
double sampleRate )
override;
523 void releaseResources()
override;
524 void setOversampleLevel(
int newOversample )
override;
525 std::atomic<float> nodeValue;
567 virtual void disconnect(
OutputNode& outputNode );
572 virtual void disconnectAll();
580 virtual void connectFloat(
float value );
585 void disconnectFloat();
590 const float* getBuffer()
const;
595 const int getState()
const;
603 void setDefaultValue(
float newDefault );
616 void enableBoundaries(
float lo,
float hi );
621 void disableBoundaries();
626 int getRequiredOversampleLevel()
const;
632 virtual void setRequiredOversampleLevel(
int newOversample );
636 void prepareToPlay(
int expectedBufferSize,
double sampleRate )
override;
637 void releaseResources()
override;
638 void process() noexcept;
640 virtual void removeInputUnilateral(
const OutputNode& outputNode );
642 virtual bool exists();
648 bool clampToBoundaries;
653 std::vector<OutputData> inputs;
655 bool internalScalarIsConnected;
663 int requiredOversampleLevel;
675 virtual bool exists()
override {
690 bool exists()
override {
694 void prepareToPlay(
int expectedBufferSize,
double sampleRate )
override {}
695 void releaseResources()
override {}
707 #endif // BASICNODES_H_INCLUDED A Unit with no dsp inside, it let you switch between different connected inputs and process and pass ...
Definition: Switch.h:20
Abstract class for implementing Units.
Definition: BasicNodes.h:223
Abstract class to implement upsampling resamplers.
Definition: UpSampler.h:18
Abstract class for implementing Units and Modules.
Definition: BasicNodes.h:82
Abstract class to implement downsampling resamplers.
Definition: DownSampler.h:16
Thread-safe value control with smoothing.
Definition: SequencerBridge.h:11
A Unit with no dsp inside, it just pass it's input to the output. Patching float to this Unit is thre...
Definition: PatchNode.h:41
Output of a Unit, contains a buffer of rendered floats and has a variable state flag.
Definition: BasicNodes.h:354
An OutputNode that is always set at control rate with a set value. Setting or patching float to this ...
Definition: BasicNodes.h:490
The bridge between pdsp and the audio callback.
Definition: Processor.h:21
Definition: Preparable.h:36