blob: 7dc82892dda54eb65d4532110d34386b0dfe3b61 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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));
}
}
}
|