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

Re: [commit?] Output for DetectSilence

by Dan Stowell :: Rate this Message:

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

Yes, looks like it should extend functionality without changing the
original function. Two queries:

* In your diff you do not write any output value when (val<thresh) yet
(counter < unit->mEndCounter), i.e. during a silence that isn't long
enough yet. You should probably add an "else *out++ = 0.f;"
* Should that "break" statement be removed?

Dan

2008/5/8 nescivi <nescivi@...>:

> 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
>



--
http://www.mcld.co.uk
_______________________________________________
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