aboutsummaryrefslogtreecommitdiff
path: root/external
diff options
context:
space:
mode:
Diffstat (limited to 'external')
-rwxr-xr-xexternal/External.cs20
-rwxr-xr-xexternal/pd.cs30
2 files changed, 44 insertions, 6 deletions
diff --git a/external/External.cs b/external/External.cs
index bc3d361..f09487d 100755
--- a/external/External.cs
+++ b/external/External.cs
@@ -89,16 +89,32 @@ namespace PureData
}
}
+
+ public void SelGenericList(Atom a)
+ {
+ Console.WriteLine("a is type " + a.type);
+ Console.WriteLine("float = " + a.float_value);
+ Console.WriteLine("stringa = " + a.string_value);
+ }
+
+/*
public void SelGenericList(Atom [] list)
{
pd.PostMessage("SetStringList received a " + list.Length + " long list");
for (int i = 0; i<list.Length; i++)
{
Atom a = (Atom) list[i];
- pd.PostMessage("list[" + i + "] is type " + a.type + " stringa = " + a.string_value);
- // pd.PostMessage("float " + i + " = " + list[i]);
+ Console.WriteLine("a is type " + a.type);
+ Console.WriteLine("float = " + a.float_value);
+ Console.WriteLine("stringa = " + a.string_value);
+ pd.PostMessage("a is type " + a.type);
+ pd.PostMessage("float = " + a.float_value);
+ pd.PostMessage("stringa = " + a.string_value);
+
}
+
}
+*/
public int test(int a)
{
diff --git a/external/pd.cs b/external/pd.cs
index 67befdf..33f7f1f 100755
--- a/external/pd.cs
+++ b/external/pd.cs
@@ -71,13 +71,35 @@ typedef struct atom_simple
public enum AtomType {Null = 0, Float=1, Symbol=2};
[StructLayout (LayoutKind.Explicit)]
- public struct Atom
+// [StructLayout (LayoutKind.Sequential)]
+ public class Atom
{
//[FieldOffset (0)] AtomType type;
- [FieldOffset (0)] public int type;
+ //[FieldOffset (0)] public int type;
+ [FieldOffset (0)]
+ public int type;
/* union members */
- [FieldOffset (4)] public long string_value;
- [FieldOffset (4)] public float float_value;
+ [FieldOffset (4)]
+ public float float_value;
+
+// [FieldOffset (4)]
+ [FieldOffset (8)]
+ public string string_value;
+
+
+
+ public Atom(string string_value)
+ {
+ this.type = 2;
+ this.float_value = 0;
+ this.string_value = string_value;
+ }
+ public Atom(float float_value)
+ {
+ this.type = 1;
+ this.string_value = "";
+ this.float_value = float_value;
+ }
}