diff options
author | Davide Morelli <morellid@users.sourceforge.net> | 2006-01-16 16:48:18 +0000 |
---|---|---|
committer | Davide Morelli <morellid@users.sourceforge.net> | 2006-01-16 16:48:18 +0000 |
commit | 3e4b264ddb771f7657d6c070599d7c8af3d90f15 (patch) | |
tree | 83462ea826277f10f460766eac545497a165f5fb /external/Counter.cs | |
parent | 447a1fe81422c021e33787ba11c56fa34d379c9d (diff) |
checking in the second example: Counter
svn path=/trunk/externals/clr/; revision=4425
Diffstat (limited to 'external/Counter.cs')
-rwxr-xr-x | external/Counter.cs | 52 |
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));
+ }
+
+ }
+}
|