changed comment style

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2861 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
mahlzeit
2003-03-02 11:38:34 +00:00
parent 8377310bbd
commit 76bb80302f
5 changed files with 97 additions and 163 deletions
+2 -4
View File
@@ -1,9 +1,7 @@
/** /*
* @file debug.h
*
* Debug macros for the Midi Kit * Debug macros for the Midi Kit
* *
* @author Matthijs Hollemans * Copyright (c) 2002-2003 Matthijs Hollemans
*/ */
#ifndef MIDI_DEBUG_H #ifndef MIDI_DEBUG_H
+30 -50
View File
@@ -1,89 +1,69 @@
/** /*
* @file protocol.h
*
* Definitions for the communications protocol between * Definitions for the communications protocol between
* libmidi2.so and the midi_server. * libmidi2.so and the midi_server.
* *
* @author Matthijs Hollemans * Copyright (c) 2002-2003 Matthijs Hollemans
*/ */
#ifndef MIDI_PROTOCOL_H #ifndef MIDI_PROTOCOL_H
#define MIDI_PROTOCOL_H #define MIDI_PROTOCOL_H
/** MIME signature of the midi_server application. */ // MIME signature of the midi_server application. */
#define MIDI_SERVER_SIGNATURE "application/x-vnd.OpenBeOS.midi-server" #define MIDI_SERVER_SIGNATURE "application/x-vnd.OpenBeOS.midi-server"
/** Timeout for delivering and responding to messages (microseconds). */ // Timeout for delivering and responding to messages (microseconds). */
#define TIMEOUT 2000000 #define TIMEOUT 2000000
/** Received when a new app starts using the Midi Kit. */ // Received when a new app starts using the Midi Kit. */
#define MSG_REGISTER_APP 'Mapp' #define MSG_REGISTER_APP 'Mapp'
/** Sent when we have completed a "register app" request. */ // Sent when we have completed a "register app" request. */
#define MSG_APP_REGISTERED 'mAPP' #define MSG_APP_REGISTERED 'mAPP'
/** Received when an app creates a new local endpoint. */ // Received when an app creates a new local endpoint. */
#define MSG_CREATE_ENDPOINT 'Mnew' #define MSG_CREATE_ENDPOINT 'Mnew'
/** // Sent to all other applications when an app creates a
* Sent to all other applications when an app creates a // new endpoint. Also sent when an application registers
* new endpoint. Also sent when an application registers // with the midi_server (MSG_REGISTER_APP).
* with the midi_server (MSG_REGISTER_APP).
*/
#define MSG_ENDPOINT_CREATED 'mNEW' #define MSG_ENDPOINT_CREATED 'mNEW'
/** Received when an app deletes a local endpoint. */ // Received when an app deletes a local endpoint. */
#define MSG_DELETE_ENDPOINT 'Mdel' #define MSG_DELETE_ENDPOINT 'Mdel'
/** // The midi_server sends this message to itself when an app
* The midi_server sends this message to itself when an app // dies and its endpoints must be removed from the roster.
* dies and its endpoints must be removed from the roster.
*/
#define MSG_PURGE_ENDPOINT 'Mdie' #define MSG_PURGE_ENDPOINT 'Mdie'
/** // Sent to all applications when an endpoint is deleted,
* Sent to all applications when an endpoint is deleted, // either by the app that owned it, or by the midi_server
* either by the app that owned it, or by the midi_server // if the owner app has died.
* if the owner app has died.
*/
#define MSG_ENDPOINT_DELETED 'mDEL' #define MSG_ENDPOINT_DELETED 'mDEL'
/** // Received when an app changes the attributes of one
* Received when an app changes the attributes of one // of its local endpoints.
* of its local endpoints.
*/
#define MSG_CHANGE_ENDPOINT 'Mchg' #define MSG_CHANGE_ENDPOINT 'Mchg'
/** // Sent to all other applications when an app changes
* Sent to all other applications when an app changes // the attributes of one of its local endpoints.
* the attributes of one of its local endpoints.
*/
#define MSG_ENDPOINT_CHANGED 'mCHG' #define MSG_ENDPOINT_CHANGED 'mCHG'
/** // Received when an app wants to establish a connection
* Received when an app wants to establish a connection // between a producer and a consumer.
* between a producer and a consumer.
*/
#define MSG_CONNECT_ENDPOINTS 'Mcon' #define MSG_CONNECT_ENDPOINTS 'Mcon'
/** // Sent to all other applications when an app establishes
* Sent to all other applications when an app establishes // a connection between a producer and a consumer. Like
* a connection between a producer and a consumer. Like // MSG_ENDPOINT_CREATED, this notification is also sent to
* MSG_ENDPOINT_CREATED, this notification is also sent to // applications when they register with the midi_server.
* applications when they register with the midi_server.
*/
#define MSG_ENDPOINTS_CONNECTED 'mCON' #define MSG_ENDPOINTS_CONNECTED 'mCON'
/** // Received when an app wants to break a connection
* Received when an app wants to break a connection // between a producer and a consumer.
* between a producer and a consumer.
*/
#define MSG_DISCONNECT_ENDPOINTS 'Mdis' #define MSG_DISCONNECT_ENDPOINTS 'Mdis'
/** // Sent to all other applications when an app breaks
* Sent to all other applications when an app breaks // a connection between a producer and a consumer.
* a connection between a producer and a consumer.
*/
#define MSG_ENDPOINTS_DISCONNECTED 'mDIS' #define MSG_ENDPOINTS_DISCONNECTED 'mDIS'
#endif // MIDI_PROTOCOL_H #endif // MIDI_PROTOCOL_H
+2 -6
View File
@@ -1,9 +1,5 @@
/** /*
* @file MidiServerApp.cpp * Copyright (c) 2002-2003 Matthijs Hollemans
*
* Implementation of the MidiServerApp class.
*
* @author Matthijs Hollemans
*/ */
#include <Alert.h> #include <Alert.h>
+45 -73
View File
@@ -1,7 +1,5 @@
/** /*
* @file MidiServerApp.h * Copyright (c) 2002-2003 Matthijs Hollemans
*
* @author Matthijs Hollemans
*/ */
#ifndef MIDI_SERVER_APP_H #ifndef MIDI_SERVER_APP_H
@@ -13,12 +11,10 @@
struct app_t; struct app_t;
struct endpoint_t; struct endpoint_t;
/** // The heart of the midi_server. This BApplication subclass
* The heart of the midi_server. This BApplication subclass // keeps the roster of endpoints and applications, processes
* keeps the roster of endpoints and applications, processes // incoming messages from libmidi2.so, and notifies the apps
* incoming messages from libmidi2.so, and notifies the apps // when something interesting happens.
* when something interesting happens.
*/
class MidiServerApp : public BApplication class MidiServerApp : public BApplication
{ {
public: public:
@@ -40,93 +36,69 @@ private:
void OnChangeEndpoint(BMessage* msg); void OnChangeEndpoint(BMessage* msg);
void OnConnectDisconnect(BMessage* msg); void OnConnectDisconnect(BMessage* msg);
/** // Sends an app MSG_ENDPOINT_CREATED notifications for
* Sends an app MSG_ENDPOINT_CREATED notifications for // all current endpoints. Used when the app registers.
* all current endpoints. Used when the app registers.
*/
bool SendAllEndpoints(app_t* app); bool SendAllEndpoints(app_t* app);
/** // Sends an app MSG_ENDPOINTS_CONNECTED notifications for
* Sends an app MSG_ENDPOINTS_CONNECTED notifications for // all current connections. Used when the app registers.
* all current connections. Used when the app registers.
*/
bool SendAllConnections(app_t* app); bool SendAllConnections(app_t* app);
/** // Adds the specified endpoint to the roster, and notifies
* Adds the specified endpoint to the roster, and notifies // all other applications about this event.
* all other applications about this event.
*/
void AddEndpoint(BMessage* msg, endpoint_t* endp); void AddEndpoint(BMessage* msg, endpoint_t* endp);
/** // Removes an endpoint from the roster, and notifies all
* Removes an endpoint from the roster, and notifies all // other apps about this event. "app" is the application
* other apps about this event. "app" is the application // that the endpoint belongs to; if it is NULL, the app
* that the endpoint belongs to; if it is NULL, the app // no longer exists and we're purging the endpoint.
* no longer exists and we're purging the endpoint.
*/
void RemoveEndpoint(app_t* app, endpoint_t* endp); void RemoveEndpoint(app_t* app, endpoint_t* endp);
/** // Removes a consumer from the list of connections of
* Removes a consumer from the list of connections of // all the producers it is connected to, just before
* all the producers it is connected to, just before // we remove it from the roster.
* we remove it from the roster.
*/
void DisconnectDeadConsumer(endpoint_t* cons); void DisconnectDeadConsumer(endpoint_t* cons);
/** Fills up a MSG_ENDPOINT_CREATED message. */ // Fills up a MSG_ENDPOINT_CREATED message.
void MakeCreatedNotification(BMessage* msg, endpoint_t* endp); void MakeCreatedNotification(BMessage* msg, endpoint_t* endp);
/** Fills up a MSG_ENDPOINTS_(DIS)CONNECTED message. */ // Fills up a MSG_ENDPOINTS_(DIS)CONNECTED message.
void MakeConnectedNotification( void MakeConnectedNotification(
BMessage* msg, endpoint_t* prod, endpoint_t* cons, bool mustConnect); BMessage* msg, endpoint_t* prod, endpoint_t* cons, bool mustConnect);
/** // Figures out which application a message came from.
* Figures out which application a message came from. // Returns NULL if the application is not registered.
* Returns NULL if the application is not registered.
*/
app_t* WhichApp(BMessage* msg); app_t* WhichApp(BMessage* msg);
/** // Looks at the "midi:id" field from a message, and returns
* Looks at the "midi:id" field from a message, and returns // the endpoint object that corresponds to that ID. It also
* the endpoint object that corresponds to that ID. It also // checks whether the application specified by "app" really
* checks whether the application specified by "app" really // owns the endpoint. Returns NULL on error.
* owns the endpoint. Returns NULL on error.
*/
endpoint_t* WhichEndpoint(BMessage* msg, app_t* app); endpoint_t* WhichEndpoint(BMessage* msg, app_t* app);
/** // Returns the endpoint with the specified ID, or
* Returns the endpoint with the specified ID, or // NULL if no such endpoint exists on the roster.
* NULL if no such endpoint exists on the roster.
*/
endpoint_t* FindEndpoint(int32 id); endpoint_t* FindEndpoint(int32 id);
/** // Sends notification messages to all registered apps,
* Sends notification messages to all registered apps, // except to the application that triggered the event.
* except to the application that triggered the event. // The "except" app is allowed to be NULL.
* The "except" app is allowed to be NULL.
*/
void NotifyAll(BMessage* msg, app_t* except); void NotifyAll(BMessage* msg, app_t* except);
/** // Sends a notification message to an application, which is
* Sends a notification message to an application, which is // not necessarily registered yet. Applications never reply
* not necessarily registered yet. Applications never reply // to such notification messages.
* to such notification messages.
*/
bool SendNotification(app_t* app, BMessage* msg); bool SendNotification(app_t* app, BMessage* msg);
/** // Sends a reply to a request made by an application.
* Sends a reply to a request made by an application. // If "app" is NULL, the application is not registered
* If "app" is NULL, the application is not registered // (and the reply should contain an error code).
* (and the reply should contain an error code).
*/
bool SendReply(app_t* app, BMessage* msg, BMessage* reply); bool SendReply(app_t* app, BMessage* msg, BMessage* reply);
/** // Removes an app and all of its endpoints from the roster
* Removes an app and all of its endpoints from the roster // if a reply or notification message cannot be delivered.
* if a reply or notification message cannot be delivered. // (Waiting for communications to fail is actually our only
* (Waiting for communications to fail is actually our only // way to get rid of stale endpoints.)
* way to get rid of stale endpoints.)
*/
void DeliveryError(app_t* app); void DeliveryError(app_t* app);
int32 CountApps(); int32 CountApps();
@@ -138,13 +110,13 @@ private:
int32 CountConnections(endpoint_t* prod); int32 CountConnections(endpoint_t* prod);
endpoint_t* ConnectionAt(endpoint_t* prod, int32 index); endpoint_t* ConnectionAt(endpoint_t* prod, int32 index);
/** The registered applications. */ // The registered applications.
BList apps; BList apps;
/** All the endpoints in the system. */ // All the endpoints in the system.
BList endpoints; BList endpoints;
/** The ID we will assign to the next new endpoint. */ // The ID we will assign to the next new endpoint.
int32 nextId; int32 nextId;
#ifdef DEBUG #ifdef DEBUG
+18 -30
View File
@@ -1,9 +1,5 @@
/** /*
* @file ServerDefs.h * Copyright (c) 2002-2003 Matthijs Hollemans
*
* Additional data types used by MidiServerApp.
*
* @author Matthijs Hollemans
*/ */
#ifndef MIDI_SERVER_DEFS_H #ifndef MIDI_SERVER_DEFS_H
@@ -14,17 +10,15 @@
#include <Messenger.h> #include <Messenger.h>
#include <String.h> #include <String.h>
/** Describes an application that registered with the midi_server. */ // Describes an application that registered with the midi_server.
struct app_t struct app_t
{ {
/** For sending notifications to the app. */ // For sending notifications to the app.
BMessenger messenger; BMessenger messenger;
}; };
/** // Describes a MIDI endpoint. The endpoint_t structure is
* Describes a MIDI endpoint. The endpoint_t structure is // used to describe both consumer and producer endpoints.
* used to describe both consumer and producer endpoints.
*/
struct endpoint_t struct endpoint_t
{ {
#ifdef DEBUG #ifdef DEBUG
@@ -34,40 +28,34 @@ struct endpoint_t
} }
#endif #endif
/** The application that owns this endpoint. */ // The application that owns this endpoint.
app_t* app; app_t* app;
/** // The endpoint's system-wide ID, which is assigned
* The endpoint's system-wide ID, which is assigned // by the midi_server when the endpoint is created.
* by the midi_server when the endpoint is created.
*/
int32 id; int32 id;
/** Is this a consumer or producer endpoint? */ // Is this a consumer or producer endpoint?
bool consumer; bool consumer;
/** Whether this endpoint is visible to all applications. */ // Whether this endpoint is visible to all applications.
bool registered; bool registered;
/** The endpoint's human-readable name. */ // The endpoint's human-readable name.
BString name; BString name;
/** User-defined attributes. */ // User-defined attributes.
BMessage properties; BMessage properties;
/** The port that accepts MIDI events (consumer only). */ // The port that accepts MIDI events (consumer only).
port_id port; port_id port;
/** // How long it takes this endpoint to process incoming
* How long it takes this endpoint to process incoming // MIDI events (consumer only).
* MIDI events (consumer only).
*/
bigtime_t latency; bigtime_t latency;
/** // Which consumers this endpoint sprays outgoing MIDI
* Which consumers this endpoint sprays outgoing MIDI // events to (producer only).
* events to (producer only).
*/
BList connections; BList connections;
}; };