aboutsummaryrefslogtreecommitdiff
path: root/external
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2006-01-27 22:51:15 +0000
committerThomas Grill <xovo@users.sourceforge.net>2006-01-27 22:51:15 +0000
commite3e928fc5e974da358794f6a2bbe7a09febe163d (patch)
tree8b01f7c3bd5971776011a4f84d867de5c2b0924a /external
parent63b691c5179de0649cab2a7981dcf7ac01ec3cc0 (diff)
Counter external class with new layout, usign virtual functions
svn path=/trunk/externals/clr/; revision=4507
Diffstat (limited to 'external')
-rwxr-xr-xexternal/Counter.cs112
-rwxr-xr-xexternal/External.cs120
-rwxr-xr-xexternal/external.csproj8
3 files changed, 69 insertions, 171 deletions
diff --git a/external/Counter.cs b/external/Counter.cs
index 7dc8289..32f9409 100755
--- a/external/Counter.cs
+++ b/external/Counter.cs
@@ -1,52 +1,74 @@
using System;
-namespace PureData
+/// <summary>
+/// Descrizione di riepilogo per Counter.
+/// </summary>
+public class Counter:
+ PureData.External
{
- /// <summary>
- /// Descrizione di riepilogo per Counter.
- /// </summary>
- public class Counter
+ public 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));
- }
+ Post("Count");
+// EventFloat += new MethodFloat(MyFloat);
+ }
+
+ public Counter(PureData.Atom[] args)
+ {
+ Post("Count with args");
+
+// pd.AddInlet(x, "init", ParametersType.Float);
+// pd.AddOutlet(x, ParametersType.Float);
+ }
+
+ // this function MUST exist
+ public static void Main()
+ {
+ Post("Count.Main");
}
+
+/*
+ public void MyBang()
+ {
+ Post("Count-BANG");
+ }
+
+ public void MyFloat(float f)
+ {
+ Post(String.Format("Count-FLOAT {0}",f));
+ }
+*/
+ protected override void MethodBang()
+ {
+ Post("Count-BANG");
+ }
+
+ protected override void MethodFloat(float f)
+ {
+ Post("Count-FLOAT "+f.ToString());
+ }
+
+ protected override void MethodSymbol(PureData.Symbol s)
+ {
+ Post("Count-SYMBOL "+s.ToString());
+ }
+
+ /*
+ 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));
+ }
+
+*/
}
diff --git a/external/External.cs b/external/External.cs
deleted file mode 100755
index 7e5a69c..0000000
--- a/external/External.cs
+++ /dev/null
@@ -1,120 +0,0 @@
-using System;
-
-namespace PureData
-{
-
- public class External
- {
- private IntPtr x;
-
- public External()
- {
- }
-
- // this function MUST exist
- public void SetUp()
- {
- // now you can do what you like...
- Console.WriteLine("pointer set!");
- Console.WriteLine("setting selectors..");
- pd.AddSelector(x, "sel1", new pd.DelegateWithoutArguments(Sel1));
- pd.AddSelector(x, "sel2", new pd.DelegateWithoutArguments(Sel2));
- pd.AddSelector(x, "selFloat", new pd.DelegateFloat(SelFloat));
- pd.AddSelector(x, "selString", new pd.DelegateString(SelString));
- pd.AddSelector(x, "selGenericList", new pd.DelegateArray(SelGenericList));
- pd.AddSelector(x, new pd.DelegateArray(SelGenericList));
-
- pd.AddSelector(x, new pd.DelegateWithoutArguments(GetBang));
- pd.AddSelector(x, new pd.DelegateFloat(GetFloat));
- pd.AddSelector(x, new pd.DelegateString(GetSymbol));
-
- Console.WriteLine("selectors set");
- pd.AddOutlet(x, ParametersType.Float);
- pd.AddInlet(x, "selFloat", ParametersType.Float);
- }
-
- public void GetBang()
- {
- pd.PostMessage("GetBang invoked!");
- }
-
- public void GetFloat(float f)
- {
- pd.PostMessage("GetFloat invoked with " + f);
- }
-
- public void GetSymbol(ref string s)
- {
- pd.PostMessage("GetSymbol invoked with " + s);
- }
-
- public void Sel1()
- {
- pd.PostMessage("Sel1 invoked!");
- Atom [] a= new Atom[2];
-
- }
-
- public void Sel2()
- {
- pd.PostMessage("Sel2 invoked!");
-
- // testing outlets
- Atom[] atoms = new Atom[4];
- atoms[0] = new Atom(1.5f);
- atoms[1] = new Atom("ciao");
- atoms[2] = new Atom(2.5f);
- atoms[3] = new Atom("hello");
- pd.SendToOutlet(x, 0, atoms);
-
- }
-
- public void SelFloat(float f)
- {
- pd.PostMessage("SelFloat received " + f);
-
-
- }
-
- public void SelString(ref string s)
- {
- pd.PostMessage("SelString received " + s);
- }
-
- public void SelGenericList(Atom [] list)
- {
- Atom [] ret = new Atom[list.Length];
- for (int i = 0; i<list.Length; i++)
- {
- Atom a = (Atom) list[i];
- switch (a.type)
- {
- case (AtomType.Null):
- {
- pd.PostMessage("element null");
- break;
- }
- case (AtomType.Float):
- {
- pd.PostMessage("" + a.float_value);
- ret[i] = new Atom(a.float_value * 2);
- break;
- }
- case (AtomType.Symbol):
- {
- ret[i] = new Atom(a.string_value + "-edited");
- pd.PostMessage(a.string_value);
- break;
- }
- }
- }
- pd.SendToOutlet(x, 0, ret);
- }
-
-
-
- }
-
-
-
-}
diff --git a/external/external.csproj b/external/external.csproj
index f8de34b..4efc7fb 100755
--- a/external/external.csproj
+++ b/external/external.csproj
@@ -36,7 +36,7 @@
NoStdLib = "false"
NoWarn = ""
Optimize = "false"
- OutputPath = "bin\Debug\"
+ OutputPath = "..\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
@@ -83,6 +83,7 @@
Name = "PureData"
AssemblyName = "PureData"
HintPath = "..\PureData.dll"
+ Private = "False"
/>
</References>
</Build>
@@ -98,11 +99,6 @@
SubType = "Code"
BuildAction = "Compile"
/>
- <File
- RelPath = "External.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
</Include>
</Files>
</CSHARP>