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