xref: /haiku/src/servers/midi/ServerDefs.h (revision 263f2c6006d1723e5bf3383058b23c40e251722d)
176bb8030Smahlzeit /*
276bb8030Smahlzeit  * Copyright (c) 2002-2003 Matthijs Hollemans
3*263f2c60Smahlzeit  *
4*263f2c60Smahlzeit  * Permission is hereby granted, free of charge, to any person obtaining a
5*263f2c60Smahlzeit  * copy of this software and associated documentation files (the "Software"),
6*263f2c60Smahlzeit  * to deal in the Software without restriction, including without limitation
7*263f2c60Smahlzeit  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8*263f2c60Smahlzeit  * and/or sell copies of the Software, and to permit persons to whom the
9*263f2c60Smahlzeit  * Software is furnished to do so, subject to the following conditions:
10*263f2c60Smahlzeit  *
11*263f2c60Smahlzeit  * The above copyright notice and this permission notice shall be included in
12*263f2c60Smahlzeit  * all copies or substantial portions of the Software.
13*263f2c60Smahlzeit  *
14*263f2c60Smahlzeit  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15*263f2c60Smahlzeit  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16*263f2c60Smahlzeit  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17*263f2c60Smahlzeit  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18*263f2c60Smahlzeit  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19*263f2c60Smahlzeit  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20*263f2c60Smahlzeit  * DEALINGS IN THE SOFTWARE.
2153284a9fSmahlzeit  */
2253284a9fSmahlzeit 
2353284a9fSmahlzeit #ifndef MIDI_SERVER_DEFS_H
2453284a9fSmahlzeit #define MIDI_SERVER_DEFS_H
2553284a9fSmahlzeit 
2653284a9fSmahlzeit #include <List.h>
2753284a9fSmahlzeit #include <Message.h>
2853284a9fSmahlzeit #include <Messenger.h>
2953284a9fSmahlzeit #include <String.h>
3053284a9fSmahlzeit 
3176bb8030Smahlzeit // Describes an application that registered with the midi_server.
3253284a9fSmahlzeit struct app_t
3353284a9fSmahlzeit {
3476bb8030Smahlzeit 	// For sending notifications to the app.
3553284a9fSmahlzeit 	BMessenger messenger;
3653284a9fSmahlzeit };
3753284a9fSmahlzeit 
3876bb8030Smahlzeit // Describes a MIDI endpoint. The endpoint_t structure is
3976bb8030Smahlzeit // used to describe both consumer and producer endpoints.
4053284a9fSmahlzeit struct endpoint_t
4153284a9fSmahlzeit {
4253284a9fSmahlzeit #ifdef DEBUG
endpoint_tendpoint_t4353284a9fSmahlzeit 	endpoint_t()
4453284a9fSmahlzeit 	{
4553284a9fSmahlzeit 		app = (app_t*) 0xbaadc0de;
4653284a9fSmahlzeit 	}
4753284a9fSmahlzeit #endif
4853284a9fSmahlzeit 
4976bb8030Smahlzeit 	// The application that owns this endpoint.
5053284a9fSmahlzeit 	app_t* app;
5153284a9fSmahlzeit 
5276bb8030Smahlzeit 	// The endpoint's system-wide ID, which is assigned
5376bb8030Smahlzeit 	// by the midi_server when the endpoint is created.
5453284a9fSmahlzeit 	int32 id;
5553284a9fSmahlzeit 
5676bb8030Smahlzeit 	// Is this a consumer or producer endpoint?
5753284a9fSmahlzeit 	bool consumer;
5853284a9fSmahlzeit 
5976bb8030Smahlzeit 	// Whether this endpoint is visible to all applications.
6053284a9fSmahlzeit 	bool registered;
6153284a9fSmahlzeit 
6276bb8030Smahlzeit 	// The endpoint's human-readable name.
6353284a9fSmahlzeit 	BString name;
6453284a9fSmahlzeit 
6576bb8030Smahlzeit 	// User-defined attributes.
6653284a9fSmahlzeit 	BMessage properties;
6753284a9fSmahlzeit 
6876bb8030Smahlzeit 	// The port that accepts MIDI events (consumer only).
6953284a9fSmahlzeit 	port_id port;
7053284a9fSmahlzeit 
7176bb8030Smahlzeit 	// How long it takes this endpoint to process incoming
7276bb8030Smahlzeit 	// MIDI events (consumer only).
7353284a9fSmahlzeit 	bigtime_t latency;
7453284a9fSmahlzeit 
7576bb8030Smahlzeit 	// Which consumers this endpoint sprays outgoing MIDI
7676bb8030Smahlzeit 	// events to (producer only).
7753284a9fSmahlzeit 	BList connections;
7853284a9fSmahlzeit };
7953284a9fSmahlzeit 
8053284a9fSmahlzeit #endif // MIDI_SERVER_DEFS_H
81