aboutsummaryrefslogtreecommitdiff
path: root/pd/PureData.cs
blob: 2ff8cfe6ffbbbee88a4948c3cfb35f9ccb46a3c7 (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
using System;
using System.Runtime.CompilerServices; // for extern import

namespace PureData
{
    // PD core functions
    public class Core 
    {
        [MethodImplAttribute (MethodImplOptions.InternalCall)]
        public extern static void Post(string message);        

        [MethodImplAttribute (MethodImplOptions.InternalCall)]
        public extern static void PostError(string message);        

        [MethodImplAttribute (MethodImplOptions.InternalCall)]
        public extern static void PostBug(string message);        

        [MethodImplAttribute (MethodImplOptions.InternalCall)]
        public extern static void PostVerbose(string message);        

        [MethodImplAttribute (MethodImplOptions.InternalCall)]
        public extern static IntPtr GenSym(string sym);        

        [MethodImplAttribute (MethodImplOptions.InternalCall)]
        public extern static string EvalSym(Symbol sym);        
    }
    
    // This is the base class for a PD/CLR external
    public class External
        : Core
    {
        private readonly IntPtr ptr;
        
        protected virtual void MethodBang() { Post("No bang handler"); }

        protected virtual void MethodFloat(float f) { Post("No float handler"); }

        protected virtual void MethodSymbol(Symbol s) { Post("No symbol handler"); }

        protected virtual void MethodPointer(Pointer p) { Post("No pointer handler");}

        protected virtual void MethodList(Atom[] lst) { Post("No list handler"); }

        protected virtual void MethodAnything(Atom[] lst) { Post("No list handler"); }
    }
}