3838pdspADSR::pdspADSR () : PatchObject(" ADSR envelope" ){
3939
4040 this ->numInlets = 6 ;
41- this ->numOutlets = 1 ;
41+ this ->numOutlets = 2 ;
4242
4343 _inletParams[0 ] = new ofSoundBuffer (); // audio input
4444
@@ -54,6 +54,8 @@ pdspADSR::pdspADSR() : PatchObject("ADSR envelope"){
5454 *(float *)&_inletParams[5 ] = 0 .0f ;
5555
5656 _outletParams[0 ] = new ofSoundBuffer (); // audio output
57+ _outletParams[1 ] = new float (); // ADSR func
58+ *(float *)&_outletParams[1 ] = 0 .0f ;
5759
5860 this ->initInletsState ();
5961
@@ -88,6 +90,7 @@ void pdspADSR::newObject(){
8890 this ->addInlet (VP_LINK_NUMERIC," S" );
8991 this ->addInlet (VP_LINK_NUMERIC," R" );
9092 this ->addOutlet (VP_LINK_AUDIO," envelopedSignal" );
93+ this ->addOutlet (VP_LINK_NUMERIC," envelope" );
9194
9295 this ->setCustomVar (attackHardness," ATTACK_CURVE" );
9396 this ->setCustomVar (releaseHardness," RELEASE_CURVE" );
@@ -119,6 +122,7 @@ void pdspADSR::setupAudioOutObjectContent(pdsp::Engine &engine){
119122
120123// --------------------------------------------------------------
121124void pdspADSR::updateObjectContent (map<int ,shared_ptr<PatchObject>> &patchObjects){
125+ unusedArgs (patchObjects);
122126
123127 env.set (attackDuration,decayDuration,sustainLevel,releaseDuration);
124128 env.setAttackCurve (attackHardness);
@@ -172,6 +176,8 @@ void pdspADSR::updateObjectContent(map<int,shared_ptr<PatchObject>> &patchObject
172176
173177// --------------------------------------------------------------
174178void pdspADSR::drawObjectContent (ofTrueTypeFont *font, shared_ptr<ofBaseGLRenderer>& glRenderer){
179+ unusedArgs (font,glRenderer);
180+
175181 ofSetColor (255 );
176182
177183}
@@ -240,6 +246,8 @@ void pdspADSR::drawObjectNodeConfig(){
240246
241247// --------------------------------------------------------------
242248void pdspADSR::removeObjectContent (bool removeFileFromData){
249+ unusedArgs (removeFileFromData);
250+
243251 for (map<int ,pdsp::PatchNode>::iterator it = this ->pdspIn .begin (); it != this ->pdspIn .end (); it++ ){
244252 it->second .disconnectAll ();
245253 }
@@ -264,6 +272,11 @@ void pdspADSR::loadAudioSettings(){
264272
265273// --------------------------------------------------------------
266274void pdspADSR::audioOutObject (ofSoundBuffer &outputBuffer){
275+ unusedArgs (outputBuffer);
276+
277+ // output envelope func
278+ *(float *)&_outletParams[1 ] = env.meter_output ();
279+
267280 // SIGNAL BUFFER
268281 static_cast <ofSoundBuffer *>(_outletParams[0 ])->copyFrom (scope.getBuffer ().data (), bufferSize, 1 , sampleRate);
269282}
0 commit comments