aboutsummaryrefslogtreecommitdiff
path: root/external/Counter.cs
diff options
context:
space:
mode:
authorDavide Morelli <morellid@users.sourceforge.net>2006-01-16 16:48:18 +0000
committerDavide Morelli <morellid@users.sourceforge.net>2006-01-16 16:48:18 +0000
commit3e4b264ddb771f7657d6c070599d7c8af3d90f15 (patch)
tree83462ea826277f10f460766eac545497a165f5fb /external/Counter.cs
parent447a1fe81422c021e33787ba11c56fa34d379c9d (diff)
checking in the second example: Counter
svn path=/trunk/externals/clr/; revision=4425
Diffstat (limited to 'external/Counter.cs')
-rwxr-xr-xexternal/Counter.cs52
1 files changed, 52 insertions, 0 deletions
diff --git a/external/Counter.cs b/external/Counter.cs
new file mode 100755
index 0000000..7dc8289
--- /dev/null
+++ b/external/Counter.cs
@@ -0,0 +1,52 @@
+using System;
+
+namespace PureData
+{
+ /// <summary>
+ /// Descrizione di riepilogo per Counter.
+ /// </summary>
+ public class Counter
+ {
+ private IntPtr x;
+
+ int curr = 0;
+
+ public Counter()
+ {
+ curr = 0;
+ }
+
+ public Counter(float f)
+ {
+ curr = (int) f;
+ }
+
+ // this function MUST exist
+ public void SetUp()
+ {
+ pd.AddSelector(x, "init", new pd.DelegateFloat(Init));
+ pd.AddSelector(x, new pd.DelegateWithoutArguments(SendOut));
+ pd.AddSelector(x, new pd.DelegateFloat(Sum));
+ pd.AddInlet(x, "init", ParametersType.Float);
+ pd.AddOutlet(x, ParametersType.Float);
+
+ }
+
+ public void Init(float f)
+ {
+ curr = (int) f;
+ }
+
+ public void SendOut()
+ {
+ pd.SendToOutlet(x, 0, new Atom(curr));
+ }
+
+ public void Sum(float f)
+ {
+ curr += (int) f;
+ pd.SendToOutlet(x, 0, new Atom(curr));
+ }
+
+ }
+}