Buffer-accessing units fail silently; maybe less silent?

View: New views
3 Messages — Rating Filter:   Alert me  

Buffer-accessing units fail silently; maybe less silent?

by Dan Stowell :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi -

>From the PlayBuf helpfile: "warning: if you supply a bufnum of a
buffer that has a different numChannels then you have specified to the
PlayBuf, it will fail silently."

Why silently? Wouldn't it be more helpful to warn?

Here's a patch that adds a warning (to the macros used by PlayBuf,
BufRd, RecordBuf, BufWr, ScopeOut). Warning can be suppressed using
server verbosity flag. Thoughts?

Dan


Index: /Users/danstowell/SuperCollider3/source/plugins/DelayUGens.cpp
===================================================================
--- /Users/danstowell/SuperCollider3/source/plugins/DelayUGens.cpp
 (revision 7343)
+++ /Users/danstowell/SuperCollider3/source/plugins/DelayUGens.cpp
 (working copy)
@@ -609,6 +609,9 @@
 #define SETUP_OUT \
        uint32 numOutputs = unit->mNumOutputs; \
        if (numOutputs > bufChannels) { \
+               if(unit->mWorld->mVerbosity > -1 && !unit->mDone){ \
+                       Print("buffer-reading unit channel mismatch:
numOutputs %i, buf has %i channels\n", numOutputs, bufChannels); \
+               } \
                 unit->mDone = true; \
                ClearUnitOutputs(unit, inNumSamples); \
                return; \
@@ -619,6 +622,9 @@
 #define SETUP_IN(offset) \
        uint32 numInputs = unit->mNumInputs - (uint32)offset; \
        if (numInputs != bufChannels) { \
+               if(unit->mWorld->mVerbosity > -1 && !unit->mDone){ \
+                       Print("buffer-writing unit channel mismatch:
numInputs %i, buf has %i channels\n", numInputs, bufChannels); \
+               } \
                 unit->mDone = true; \
                ClearUnitOutputs(unit, inNumSamples); \
                return; \

Index: /Users/danstowell/SuperCollider3/source/plugins/DelayUGens.cpp
===================================================================
--- /Users/danstowell/SuperCollider3/source/plugins/DelayUGens.cpp (revision 7343)
+++ /Users/danstowell/SuperCollider3/source/plugins/DelayUGens.cpp (working copy)
@@ -609,6 +609,9 @@
 #define SETUP_OUT \
  uint32 numOutputs = unit->mNumOutputs; \
  if (numOutputs > bufChannels) { \
+ if(unit->mWorld->mVerbosity > -1 && !unit->mDone){ \
+ Print("buffer-reading unit channel mismatch: numOutputs %i, buf has %i channels\n", numOutputs, bufChannels); \
+ } \
                 unit->mDone = true; \
  ClearUnitOutputs(unit, inNumSamples); \
  return; \
@@ -619,6 +622,9 @@
 #define SETUP_IN(offset) \
  uint32 numInputs = unit->mNumInputs - (uint32)offset; \
  if (numInputs != bufChannels) { \
+ if(unit->mWorld->mVerbosity > -1 && !unit->mDone){ \
+ Print("buffer-writing unit channel mismatch: numInputs %i, buf has %i channels\n", numInputs, bufChannels); \
+ } \
                 unit->mDone = true; \
  ClearUnitOutputs(unit, inNumSamples); \
  return; \

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

Re: Buffer-accessing units fail silently; maybe less silent?

by Josh Parmenter :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

great!

Josh

On Apr 28, 2008, at 8:07 AM, Dan Stowell wrote:

> Hi -
>
>> From the PlayBuf helpfile: "warning: if you supply a bufnum of a
> buffer that has a different numChannels then you have specified to the
> PlayBuf, it will fail silently."
>
> Why silently? Wouldn't it be more helpful to warn?
>
> Here's a patch that adds a warning (to the macros used by PlayBuf,
> BufRd, RecordBuf, BufWr, ScopeOut). Warning can be suppressed using
> server verbosity flag. Thoughts?
>
> Dan
>
>
> Index: /Users/danstowell/SuperCollider3/source/plugins/DelayUGens.cpp
> ===================================================================
> --- /Users/danstowell/SuperCollider3/source/plugins/DelayUGens.cpp
> (revision 7343)
> +++ /Users/danstowell/SuperCollider3/source/plugins/DelayUGens.cpp
> (working copy)
> @@ -609,6 +609,9 @@
> #define SETUP_OUT \
>        uint32 numOutputs = unit->mNumOutputs; \
>        if (numOutputs > bufChannels) { \
> +               if(unit->mWorld->mVerbosity > -1 && !unit->mDone){ \
> +                       Print("buffer-reading unit channel mismatch:
> numOutputs %i, buf has %i channels\n", numOutputs, bufChannels); \
> +               } \
>                 unit->mDone = true; \
>                ClearUnitOutputs(unit, inNumSamples); \
>                return; \
> @@ -619,6 +622,9 @@
> #define SETUP_IN(offset) \
>        uint32 numInputs = unit->mNumInputs - (uint32)offset; \
>        if (numInputs != bufChannels) { \
> +               if(unit->mWorld->mVerbosity > -1 && !unit->mDone){ \
> +                       Print("buffer-writing unit channel mismatch:
> numInputs %i, buf has %i channels\n", numInputs, bufChannels); \
> +               } \
>                 unit->mDone = true; \
>                ClearUnitOutputs(unit, inNumSamples); \
>                return; \
> <
> WarnChannelMismatch
> .patch.txt>_______________________________________________
> Sc-devel mailing list
> Sc-devel@...
> http://lists.create.ucsb.edu/mailman/listinfo/sc-devel

******************************************
/* Joshua D. Parmenter
http://www.realizedsound.net/josh/

“Every composer – at all times and in all cases – gives his own  
interpretation of how modern society is structured: whether actively  
or passively, consciously or unconsciously, he makes choices in this  
regard. He may be conservative or he may subject himself to continual  
renewal; or he may strive for a revolutionary, historical or social  
palingenesis." - Luigi Nono
*/

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

Re: Buffer-accessing units fail silently; maybe less silent?

by Dan Stowell :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2008/4/28 Josh Parmenter <josh@...>:
> great!

I thought so too ;) - helped me trace a problem in a fairly complex
bit of coding. Now committed (svn rev 7537)

Dan


>  On Apr 28, 2008, at 8:07 AM, Dan Stowell wrote:
>
>  > Hi -
>  >
>  >> From the PlayBuf helpfile: "warning: if you supply a bufnum of a
>  > buffer that has a different numChannels then you have specified to the
>  > PlayBuf, it will fail silently."
>  >
>  > Why silently? Wouldn't it be more helpful to warn?
>  >
>  > Here's a patch that adds a warning (to the macros used by PlayBuf,
>  > BufRd, RecordBuf, BufWr, ScopeOut). Warning can be suppressed using
>  > server verbosity flag. Thoughts?
>  >
>  > Dan
>  >
>  >
>  > Index: /Users/danstowell/SuperCollider3/source/plugins/DelayUGens.cpp
>  > ===================================================================
>  > --- /Users/danstowell/SuperCollider3/source/plugins/DelayUGens.cpp
>  > (revision 7343)
>  > +++ /Users/danstowell/SuperCollider3/source/plugins/DelayUGens.cpp
>  > (working copy)
>  > @@ -609,6 +609,9 @@
>  > #define SETUP_OUT \
>  >        uint32 numOutputs = unit->mNumOutputs; \
>  >        if (numOutputs > bufChannels) { \
>  > +               if(unit->mWorld->mVerbosity > -1 && !unit->mDone){ \
>  > +                       Print("buffer-reading unit channel mismatch:
>  > numOutputs %i, buf has %i channels\n", numOutputs, bufChannels); \
>  > +               } \
>  >                 unit->mDone = true; \
>  >                ClearUnitOutputs(unit, inNumSamples); \
>  >                return; \
>  > @@ -619,6 +622,9 @@
>  > #define SETUP_IN(offset) \
>  >        uint32 numInputs = unit->mNumInputs - (uint32)offset; \
>  >        if (numInputs != bufChannels) { \
>  > +               if(unit->mWorld->mVerbosity > -1 && !unit->mDone){ \
>  > +                       Print("buffer-writing unit channel mismatch:
>  > numInputs %i, buf has %i channels\n", numInputs, bufChannels); \
>  > +               } \
>  >                 unit->mDone = true; \
>  >                ClearUnitOutputs(unit, inNumSamples); \
>  >                return; \
>  > <
>  > WarnChannelMismatch
>  > .patch.txt>_______________________________________________
>  > Sc-devel mailing list
>  > Sc-devel@...
>  > http://lists.create.ucsb.edu/mailman/listinfo/sc-devel
>
>  ******************************************
>  /* Joshua D. Parmenter
>  http://www.realizedsound.net/josh/
>
>  "Every composer – at all times and in all cases – gives his own
>  interpretation of how modern society is structured: whether actively
>  or passively, consciously or unconsciously, he makes choices in this
>  regard. He may be conservative or he may subject himself to continual
>  renewal; or he may strive for a revolutionary, historical or social
>  palingenesis." - Luigi Nono
>  */
>
>  _______________________________________________
>  Sc-devel mailing list
>  Sc-devel@...
>  http://lists.create.ucsb.edu/mailman/listinfo/sc-devel
>



--
http://www.mcld.co.uk
_______________________________________________
Sc-devel mailing list
Sc-devel@...
http://lists.create.ucsb.edu/mailman/listinfo/sc-devel