3
Copyright (C) 2000 Stefan Westerfeld
6
This library is free software; you can redistribute it and/or
7
modify it under the terms of the GNU Library General Public
8
License as published by the Free Software Foundation; either
9
version 2 of the License, or (at your option) any later version.
11
This library is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
Library General Public License for more details.
16
You should have received a copy of the GNU Library General Public License
17
along with this library; see the file COPYING.LIB. If not, write to
18
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19
Boston, MA 02111-1307, USA.
24
* DISCLAIMER: The interfaces in artsmidi.idl (and the derived .cc/.h files)
25
* DO NOT GUARANTEE BINARY COMPATIBILITY YET.
27
* They are intended for developers. You shouldn't expect that applications in
28
* binary form will be fully compatibile with further releases of these
34
/* This is modelled somewhat after
35
- the AudioManager concept
36
- the aRts-0.3.4.1 MidiPort concept
39
It adds timing as new feature compared to older implementation, and also
40
tries to do the full set of midi operations.
42
It's current state is "experimental", and "binary compatibility not kept".
46
* an absolute timestamp
53
* different status of a midi command
55
enum MidiCommandStatus {
57
mcsCommandMask = 0xf0,
58
mcsChannelMask = 0x0f,
63
mcsKeyPressure = 0xa0,
66
mcsChannelPressure = 0xd0,
71
* the following are to be used once status is (mcsParameter|channel):
73
enum MidiCommandParameter {
101
* the current absolute time (since the existence of the midi device)
103
readonly attribute TimeStamp time;
106
* processes a midi command
108
oneway void processCommand(MidiCommand command);
111
* processes a midi event
113
oneway void processEvent(MidiEvent event);
116
enum MidiClientDirection { mcdPlay, mcdRecord };
117
enum MidiClientType { mctDestination, mctApplication };
120
* information about a midi client
122
struct MidiClientInfo {
124
sequence<long> connections;
126
MidiClientDirection direction;
128
string title, autoRestoreID;
132
* a midi manager client
134
interface MidiClient {
135
readonly attribute MidiClientInfo info;
138
* you can change the title of your client on the fly - everything else
139
* (besides the actual assignment) is static
141
attribute string title;
144
* creates a new port through which the client can receive data from
147
void addInputPort(MidiPort port);
150
* creates a new port through which the client can send data to the
153
MidiPort addOutputPort();
158
void removePort(MidiPort port);
162
* Some general notes to the understanding of the midi manager. The midi
163
* manager has the task to intelligently assign applications to destinations.
165
* It is important to understand what it actually does to understand the
166
* distinction first, which is expressed through the "MidiClientType" of
169
* APPLICATIONS: An application is a user visible application, that produces
170
* or records midi data. It is important for the understanding of an
171
* application, that an application actually *wants* to be supplied with
172
* data, or wants to get its data played. Thus, adding an application to
173
* the midi manager is an implicit request: "go and find a place where to
174
* put the events to (or get the events from)".
176
* Examples for applications would be games or midi players.
178
* DESTINATIONS: A destination is a system service that plays or supplies
179
* midi data. The characteristic here is that a destination is something
180
* that is there if you need it.
182
* Examples for destinations might be might be a hardware device or an
183
* emulation of a hardware device (such as a virtual sampler).
185
* So the process is as follows:
186
* - destinations register themselves at the midi manager, and provide
187
* system services in that way
189
* - when the user starts an application (such as a midi player), the midi
190
* manager's task is to assign it to a suitable destination
192
* - the user can interact with the process by changing the way applications
193
* are assigned to destinations - the midi manager will try to learn
194
* what the user wants, and next time do a better job while assigning
196
* To actually record or play some data, you need to register a client first,
197
* and after that, you can add Input or Output "MidiPort"s to your client,
198
* so that you can actually send or receive events with them.
200
interface MidiManager { // SINGLETON: Arts_MidiManager
204
readonly attribute sequence<MidiClientInfo> clients;
209
* this creates a new MidiManagerClient
211
MidiClient addClient(MidiClientDirection direction, MidiClientType type,
212
string title, string autoRestoreID);
215
* connect two clients
217
void connect(long clientID, long destinationID);
220
* disconnect two clients
222
void disconnect(long clientID, long destinationID);
225
interface MidiTest : MidiPort {
228
interface RawMidiPort : MidiPort {
229
attribute string device;
230
attribute boolean input, output;
231
attribute boolean running;
236
* Midi Timer - can be used to provide timing for midi ports that have
237
* no "native" timing.
244
readonly attribute TimeStamp time;
247
* this will put the event into an event queue and send it to the port
248
* once the time for the event has been reached
250
oneway void queueEvent(MidiPort port, MidiEvent event);
254
* Uses the system time (i.e. gettimeofday() and similar) to provide midi
257
interface SystemMidiTimer : MidiTimer
262
* Uses the audio time (i.e. samples rendered to /dev/dsp) to provide midi
265
interface AudioMidiTimer : MidiTimer