summaryrefslogtreecommitdiffstats
path: root/arts/runtime/artsbuilder.idl
blob: 42ff393aee12d012f0890c2038919589fd52a962 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
/*
 * DISCLAIMER: The interfaces in artsbuilder.idl (and the derived .cc/.h files)
 *             DO NOT GUARANTEE BINARY COMPATIBILITY YET.
 *
 * They are intended for developers. You shouldn't expect that applications in
 * binary form will be fully compatibile with further releases of these
 * interfaces.
 */

#include <core.idl>
#include <artsflow.idl>
module Arts {
	/*
	 * incoming or outgoing port?
	 */
	enum PortDirection {input, output};

	/**
	 * ConnType (maybe obsolete)
	 *
	 * ConnType: (connection type) this is wether this value is used
	 *
	 * - once (such as a filename of a waveplugin)  -> property
	 *   this implies that the allowed connection is only value
	 *
	 * - event based (such as midi events)          -> event
	 *   when events arrive, they are processed, when no events arrive,
	 *	 don't care
	 *
	 * - stream based (such as audio streams)       -> stream
	 *   every calculation of the module consumes/creates a sample
     *   that means: no data = no calculation possible
	 *
	 * WARNING: This is part of the artsbuilder dynamic programming interface 
	 * as the MCOP port isn't there yet, this stuff may change
	 */ 
	enum PortConnType { conn_stream, conn_event, conn_property};

	/**
	 * PortType (maybe obsolete)
	 *
	 * isMultiPort specifies if the port can take multiple incoming
	 * connections or not. This is only relevant/allowed for input ports,
	 * the output of all output ports may be connected to any amount of
	 * receivers.
	 *
	 * Ports which can take multiple connections are handled differently
	 * internally. (Also, artsbuilder needs to know whether to allow multi-
	 * connections or not).
	 *
	 * WARNING: This is part of the artsbuilder dynamic programming interface 
	 * as the MCOP port isn't there yet, this stuff may change
	 */
	struct PortType {
		PortDirection direction;
		string dataType;
		PortConnType connType;
		boolean isMultiPort;
	};

	struct ModuleInfo {
		string name;

		//--- internal information:
		// ports, first the input ports, then the output ports
		sequence<PortType> ports;
		sequence<string>   portnames;
		boolean isInterface;
		boolean isStructure;
	};

	interface PortDesc;
	interface ModuleDesc;
	interface StructureDesc;
	interface StructurePortDesc;

	interface PortDesc {
		// internal:
		void constructor(ModuleDesc parent, string name, PortType type);

		// ID is guaranteed to be unique in the structure the port belongs to
		readonly attribute long ID;
		readonly attribute ModuleDesc parent;

		// Name is guaranteed to be unique for each module (no two in/out-
		// ports with the same name allowed)
		readonly attribute string name;
		readonly attribute PortType type;

		/*
		 * - for input channels, one of those must be true (only event
		 *   channels may remain unconnected),
		 * - for output channels, only isConnected may be set
		 *
		 * only one of them may be set, not both
		 */
		readonly attribute boolean isConnected;
		attribute boolean hasValue;	// set to false is only allowed writing

		// connections, used when isConnected is true
		readonly attribute sequence<PortDesc> connections;

		// to be used as const value when hasValue is true
		attribute float  floatValue;
		attribute string stringValue;

		// the value as "any"
		attribute Any	 value;

		boolean connectTo(PortDesc port);
		void disconnectFrom(PortDesc port);
		void disconnectAll();

		sequence<string> saveToList();
		void loadFromList(sequence<string> list);

		// never call this by hand, it will only be used by the module:
		void internalConnectInput(PortDesc port);
		void internalReConnect(sequence<PortDesc> allports);

		readonly attribute long internalOldID;
	};

	interface ModuleDesc {
		// internal
		void constructor(StructureDesc parent, ModuleInfo info);

		// ID is guaranteed to be unique in the structure the module belongs to
		readonly attribute long ID;
		readonly attribute StructureDesc parent;

		readonly attribute string name;
		readonly attribute sequence<PortDesc> ports;
		readonly attribute long x, y, width, height;
		readonly attribute boolean isInterface, isStructure;

		boolean moveTo(long x, long y);	// returns true when successful

		PortDesc findPort(string name);
		sequence<string> saveToList();
		void loadFromList(sequence<string> list);
	};

	interface StructureDesc {
		// internal:
		long obtainID();	// only to be used as module or port

		// public:
		readonly attribute boolean valid;
		attribute string name;
		readonly attribute sequence<ModuleDesc> modules;
		readonly attribute sequence<StructurePortDesc> ports;
		readonly attribute sequence<string> inheritedInterfaces;

		sequence<string> saveToList();
		void loadFromList(sequence<string> list);

		/**
		 * deletes all components in the structure
		 */
		void clear();

		ModuleDesc createModuleDesc(ModuleInfo info);
		void freeModuleDesc(ModuleDesc moduledesc);

		/**
		 * publishing (HMM)
		 */
		readonly attribute ModuleInfo externalInterface;

		// External Interface Ports:
		StructurePortDesc createStructurePortDesc(PortType type,
														string name);
		void freeStructurePortDesc(StructurePortDesc portdesc);
		void moveStructurePortDesc(StructurePortDesc portdesc,
												long newposition);

		// you will need to add the structure ports yourself
		void addInheritedInterface(string iface);

		// this will remove the associated structure ports
		void removeInheritedInterface(string iface);
	};

	interface StructurePortDesc : PortDesc {
		// internal
		void constructor(StructureDesc parent, string name, PortType type);

		// Position: how the port is positioned when the structure is used
		// as module - 0 is leftmost, higher numbers are more right
		readonly attribute long x, y, position;
		readonly attribute StructureDesc parentStructure;

		// if the port is associated with an inherited interface of the
		// parent structure, then it should be setup here
		attribute string inheritedInterface;
	
		boolean moveTo(long x, long y);	// returns true when successful

		void lowerPosition();			// will move the port more left
		void raisePosition();			// will move the port more right
		void rename(string newname);

		// only used by the structure to reorder the ports
		void internalSetPosition(long position);
	};

	interface ObjectFactory {
		object createObject(string name);
	};

	interface LocalFactory : ObjectFactory {
	};

	interface StructureBuilder {
		void addFactory(ObjectFactory factory);
		object createObject(StructureDesc structure);
		ModuleDef createTypeInfo(StructureDesc structure);
	};

	interface ArtsBuilderLoader : Loader {
	};

	interface Structure : SynthModule {
		void run();
		void halt();
	};
};