From ed0031b621c6cf8824a9a3e588426907244aeb7e Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Tue, 18 Apr 2006 01:38:08 +0000 Subject: implemented class-based method management very fast native-to-managed transition most of the logic transferred to the CLR side svn path=/trunk/externals/clr/; revision=4931 --- Counter/Counter.cs | 31 ++++---- Counter/Counter.csproj | 212 +++++++++++++++++++++++++------------------------ 2 files changed, 124 insertions(+), 119 deletions(-) (limited to 'Counter') diff --git a/Counter/Counter.cs b/Counter/Counter.cs index 416cb3b..7b370d9 100755 --- a/Counter/Counter.cs +++ b/Counter/Counter.cs @@ -1,29 +1,32 @@ using System; +using PureData; /// /// Descrizione di riepilogo per Counter. /// public class Counter: - PureData.External + External { int i_count,i_down,i_up; float step; - public Counter(PureData.AtomList args) + public Counter() { } + + public Counter(Atom[] args) { - this.step = args.Count >= 3?(float)args[2]:1; + this.step = args.Length >= 3?(float)args[2]:1; - float f2 = args.Count >= 2?(float)args[1]:0; - float f1 = args.Count >= 1?(float)args[0]:0; + float f2 = args.Length >= 2?(float)args[1]:0; + float f1 = args.Length >= 1?(float)args[0]:0; - if(args.Count < 2) f2 = f1; + if(args.Length < 2) f2 = f1; this.i_down = (int)((f1f2)?f1:f2); this.i_count = this.i_down; - AddInlet(_list,new PureData.Symbol("bound")); + AddInlet(_list,new Symbol("bound")); AddInlet(ref step); AddOutlet(_float); @@ -33,14 +36,15 @@ public class Counter: // this function MUST exist private static void Setup(Counter obj) { - AddMethod(0,new Method(obj.Bang)); - AddMethod(0,"reset",new Method(obj.Reset)); - AddMethod(0,"set",new MethodFloat(obj.Set)); - AddMethod(0,"bound",new MethodList(obj.Bound)); + AddMethod(obj.Bang); + AddMethod(0,"reset",obj.Reset); + AddMethod(0,"set",obj.Set); + AddMethod(0,"bound",obj.Bound); } protected void Bang() { + float f = this.i_count; int step = (int)this.step; this.i_count += step; @@ -56,7 +60,7 @@ public class Counter: } } - Outlet(0,f); + Outlet(0,f); } protected void Reset() @@ -69,7 +73,7 @@ public class Counter: this.i_count = (int)f; } - protected void Bound(PureData.AtomList args) + protected void Bound(Atom[] args) { float f1 = (float)args[0]; float f2 = (float)args[1]; @@ -77,5 +81,4 @@ public class Counter: this.i_down = (int)((f1f2)?f1:f2); } - } diff --git a/Counter/Counter.csproj b/Counter/Counter.csproj index 4502d55..ab8a5eb 100644 --- a/Counter/Counter.csproj +++ b/Counter/Counter.csproj @@ -1,105 +1,107 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + Local + 8.0.50727 + 2.0 + {8CFEFB15-2A72-45B5-BC99-3BAFFB2B27C3} + Debug + AnyCPU + + + + + Counter + + + JScript + Grid + IE50 + false + Library + Counter + OnBuildSuccess + + + + + + + + + bin\Debug\ + false + 285212672 + false + + + DEBUG;TRACE + + + true + 4096 + false + + + false + false + false + false + 4 + full + prompt + + + bin\Debug\ + false + 285212672 + false + + + DEBUG;TRACE + + + false + 4096 + false + + + true + false + false + false + 4 + none + prompt + + + + System + + + System.Data + + + System.XML + + + PureData + {0015D5E7-B0FB-4F06-B334-225447D1F992} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + + + + + Code + + + Code + + + + + + + + + + \ No newline at end of file -- cgit v1.2.1