[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-dev] checkInputs



On Dec 27, 2004, at 11:21 AM, Julian Rohrhuber wrote:

	checkInputs { ^this.checkValidInputs }

	checkValidInputs {
		inputs.do({arg in,i;
			var argName;
			if(in.isValidUGenInput.not,{
				argName = this.argNameForInputAt(i) ? i;
				inputs.dump;
^"arg: '" ++ argName ++ "' has bad input:" + in;
			})
		});
		^nil

	}
	checkSameRateAsFirstInput {
		if (rate !== inputs.at(0).rate) {
^("first input is not" + rate + "rate: " + inputs.at(0) + inputs.at(0).rate);
		};
		^this.checkValidInputs
	}


OK. Other ugen implementations checkInputs still would need to have ^this.checkValidInputs added as well.



I've gone through them and committed them, here is the diff.
I did some testing, seems all fine.


cvs diff: Diffing .
Index: BufIO.sc
===================================================================
RCS file: /cvsroot/supercollider/SuperCollider3/build/SCClassLibrary/Common/Audio/BufIO.sc,v
retrieving revision 1.18
diff -p -b -B -r1.18 BufIO.sc
*** BufIO.sc    7 Feb 2004 19:12:36 -0000       1.18
--- BufIO.sc    27 Dec 2004 23:01:11 -0000
*************** BufRd : MultiOutUGen {
*** 64,70 ****
                if (rate == 'audio' and: {inputs.at(1).rate != 'audio'}, {
^("phase input is not audio rate: " + inputs.at(1) + inputs.at(1).rate);
                });
!               ^nil
        }
  }

--- 64,70 ----
                if (rate == 'audio' and: {inputs.at(1).rate != 'audio'}, {
^("phase input is not audio rate: " + inputs.at(1) + inputs.at(1).rate);
                });
!               ^this.checkValidInputs
        }
  }

*************** BufWr : UGen {
*** 83,89 ****
                if (rate == 'audio' and: {inputs.at(1).rate != 'audio'}, {
^("phase input is not audio rate: " + inputs.at(1) + inputs.at(1).rate);
                });
!               ^nil
        }
  }

--- 83,89 ----
                if (rate == 'audio' and: {inputs.at(1).rate != 'audio'}, {
^("phase input is not audio rate: " + inputs.at(1) + inputs.at(1).rate);
                });
!               ^this.checkValidInputs
        }
  }

Index: Demand.sc
===================================================================
RCS file: /cvsroot/supercollider/SuperCollider3/build/SCClassLibrary/Common/Audio/Demand.sc,v
retrieving revision 1.2
diff -p -b -B -r1.2 Demand.sc
*** Demand.sc   10 Dec 2004 18:42:07 -0000      1.2
--- Demand.sc   27 Dec 2004 23:01:11 -0000
*************** Demand : MultiOutUGen {
*** 12,17 ****
--- 12,30 ----
        checkInputs { ^this.checkSameRateAsFirstInput }
  }

+ DurDemand : Demand {
+
+       checkInputs {
+               ^if(inputs.at(0).rate === \demand) {
+ if (inputs.at(1).rate !== \demand and: { inputs.at(1).rate !== rate }) { + ("first input is not" + rate + "rate: " + inputs.at(1) + inputs.at(1).rate);
+                       }
+               } {
+                       super.checkInputs
+               }
+       }
+ }
+
  Dseries : UGen {
        *new { arg start = 1, step = 1, length = 100;
                ^this.multiNew('demand', length, start, step)
Index: DiskIO.sc
===================================================================
RCS file: /cvsroot/supercollider/SuperCollider3/build/SCClassLibrary/Common/Audio/DiskIO.sc,v
retrieving revision 1.4
diff -p -b -B -r1.4 DiskIO.sc
*** DiskIO.sc   7 Apr 2003 00:23:40 -0000       1.4
--- DiskIO.sc   27 Dec 2004 23:01:11 -0000
*************** DiskOut : UGen {
*** 14,20 ****
                                });
                        });
                });
!               ^nil
        }
  }

--- 14,20 ----
                                });
                        });
                });
!               ^this.checkValidInputs
        }
  }

Index: Filter.sc
===================================================================
RCS file: /cvsroot/supercollider/SuperCollider3/build/SCClassLibrary/Common/Audio/Filter.sc,v
retrieving revision 1.7
diff -p -b -B -r1.7 Filter.sc
*** Filter.sc   30 May 2003 16:34:57 -0000      1.7
--- Filter.sc   27 Dec 2004 23:01:14 -0000
*************** Median : Filter {
*** 191,197 ****
                                ^"input was not audio rate";
                        });
                });
!               ^nil
        }

  }
--- 191,197 ----
                                ^"input was not audio rate";
                        });
                });
!               ^this.checkValidInputs
        }

  }
Index: InOut.sc
===================================================================
RCS file: /cvsroot/supercollider/SuperCollider3/build/SCClassLibrary/Common/Audio/InOut.sc,v
retrieving revision 1.24
diff -p -b -B -r1.24 InOut.sc
*** InOut.sc    31 Jul 2004 17:12:40 -0000      1.24
--- InOut.sc    27 Dec 2004 23:01:17 -0000
*************** AbstractOut : UGen {
*** 160,166 ****
                                });
                        });
                });
!               ^nil
        }
*isOutputUGen { ^true }
--- 160,166 ----
                                });
                        });
                });
!               ^this.checkValidInputs
        }
*isOutputUGen { ^true }
*************** XOut : AbstractOut {
*** 239,245 ****
                                });
                        });
                });
!               ^nil
        }
  }

--- 239,245 ----
                                });
                        });
                });
!               ^this.checkValidInputs
        }
  }

Index: Osc.sc
===================================================================
RCS file: /cvsroot/supercollider/SuperCollider3/build/SCClassLibrary/Common/Audio/Osc.sc,v
retrieving revision 1.13
diff -p -b -B -r1.13 Osc.sc
*** Osc.sc      5 Nov 2003 11:38:08 -0000       1.13
--- Osc.sc      27 Dec 2004 23:01:20 -0000
*************** Select : UGen {
*** 223,229 ****
                                });
                        });
                });
!               ^nil
        }
  }

--- 223,229 ----
                                });
                        });
                });
!               ^this.checkValidInputs
        }
  }

Index: Pan.sc
===================================================================
RCS file: /cvsroot/supercollider/SuperCollider3/build/SCClassLibrary/Common/Audio/Pan.sc,v
retrieving revision 1.15
diff -p -b -B -r1.15 Pan.sc
*** Pan.sc      9 Dec 2004 14:33:01 -0000       1.15
--- Pan.sc      27 Dec 2004 23:01:20 -0000
*************** Panner : MultiOutUGen {
*** 9,15 ****
                                };
                        };
                 };
!               ^nil
        }
        checkInputs { ^this.checkNInputs(1) }
  }
--- 9,15 ----
                                };
                        };
                 };
!               ^this.checkValidInputs
        }
        checkInputs { ^this.checkNInputs(1) }
  }

Index: UGen.sc
===================================================================
RCS file: /cvsroot/supercollider/SuperCollider3/build/SCClassLibrary/Common/Audio/UGen.sc,v
retrieving revision 1.29
diff -p -b -B -r1.29 UGen.sc
*** UGen.sc     3 Dec 2004 05:12:00 -0000       1.29
--- UGen.sc     27 Dec 2004 23:01:29 -0000
*************** UGen : AbstractFunction {
*** 98,104 ****

        isValidUGenInput { ^true }
        numChannels { ^1 }
!       checkInputs {
                inputs.do({arg in,i;
                        var argName;
                        if(in.isValidUGenInput.not,{
--- 98,107 ----

        isValidUGenInput { ^true }
        numChannels { ^1 }
!
!
!       checkInputs { ^this.checkValidInputs }
!       checkValidInputs {
                inputs.do({arg in,i;
                        var argName;
                        if(in.isValidUGenInput.not,{
*************** UGen : AbstractFunction {
*** 113,120 ****
                if (rate !== inputs.at(0).rate) {
^("first input is not" + rate + "rate: " + inputs.at(0) + inputs.at(0).rate);
                };
!               ^nil
        }
        argNameForInputAt { arg i;
                var method;
method = this.class.class.findMethod(this.methodSelectorForRate);
--- 117,125 ----
                if (rate !== inputs.at(0).rate) {
^("first input is not" + rate + "rate: " + inputs.at(0) + inputs.at(0).rate);
                };
!               ^this.checkValidInputs
        }
+ argNameForInputAt { arg i;
                var method;
method = this.class.class.findMethod(this.methodSelectorForRate);
--








.