« Return to Thread: [commit?] Output for DetectSilence

[commit?] Output for DetectSilence

by nescivi :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View in Thread

Hiho,

It would be useful to have an output to DetectSilence, so you can also use it
as a trigger for some other UGen.

It is quite straightforward and I have a test version running.

ok to commit?

sincerely,
Marije


Diff for plugin source (class file is appropriately changed too):

Index: Source/plugins/FilterUGens.cpp
===================================================================
--- Source/plugins/FilterUGens.cpp      (revision 7531)
+++ Source/plugins/FilterUGens.cpp      (working copy)
@@ -4254,6 +4254,7 @@
 {
        float thresh = unit->mThresh;
        int counter = unit->mCounter;
+       float val;

        // I thought of a better way to do this...
        /*
@@ -4271,20 +4272,24 @@
        }
        */
        float *in = IN(0);
+       float *out = OUT(0);
        for (int i=0; i<inNumSamples; ++i) {
                float val = fabs(*in++);
                if (val > thresh) {
                        counter = 0;
+                       *out++ = 0.f;
                        break;
                } else if (counter >= 0) {
                        if (++counter >= unit->mEndCounter) {
                                int doneAction = (int)ZIN0(3);
                                DoneAction(doneAction, unit);
-                               SETCALC(DetectSilence_done);
+                               *out++ = 1.f;
+//                             SETCALC(DetectSilence_done);
                        }
                }
        }
        unit->mCounter = counter;
+
 }

_______________________________________________
sc-dev mailing list
sc-dev@...
http://lists.create.ucsb.edu/mailman/listinfo/sc-dev

 « Return to Thread: [commit?] Output for DetectSilence

LightInTheBox - Buy quality products at wholesale price