1/*
2 * Copyright (c) 2002-2003 Matthijs Hollemans
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 */
22
23#ifndef MIDI_SERVER_DEFS_H
24#define MIDI_SERVER_DEFS_H
25
26#include <List.h>
27#include <Message.h>
28#include <Messenger.h>
29#include <String.h>
30
31// Describes an application that registered with the midi_server.
32struct app_t
33{
34	// For sending notifications to the app.
35	BMessenger messenger;
36};
37
38// Describes a MIDI endpoint. The endpoint_t structure is
39// used to describe both consumer and producer endpoints.
40struct endpoint_t
41{
42#ifdef DEBUG
43	endpoint_t()
44	{
45		app = (app_t*) 0xbaadc0de;
46	}
47#endif
48
49	// The application that owns this endpoint.
50	app_t* app;
51
52	// The endpoint's system-wide ID, which is assigned
53	// by the midi_server when the endpoint is created.
54	int32 id;
55
56	// Is this a consumer or producer endpoint?
57	bool consumer;
58
59	// Whether this endpoint is visible to all applications.
60	bool registered;
61
62	// The endpoint's human-readable name.
63	BString name;
64
65	// User-defined attributes.
66	BMessage properties;
67
68	// The port that accepts MIDI events (consumer only).
69	port_id port;
70
71	// How long it takes this endpoint to process incoming
72	// MIDI events (consumer only).
73	bigtime_t latency;
74
75	// Which consumers this endpoint sprays outgoing MIDI
76	// events to (producer only).
77	BList connections;
78};
79
80#endif // MIDI_SERVER_DEFS_H
81