Base class for all MIDI endpoints. More...
|Increments the endpoint's reference count. More...|
|status_t||GetProperties (BMessage *properties) const|
|Reads the properties of the endpoint. More...|
|int32||ID () const|
|Returns the ID of the endpoint. More...|
|bool||IsConsumer () const|
|Determines whether this endpoint is a BMidiConsumer. More...|
|bool||IsLocal () const|
|Determines whether this endpoint represents a local object. More...|
|bool||IsPersistent () const|
|Not used. More...|
|bool||IsProducer () const|
|Determines whether this endpoint is a BMidiProducer. More...|
|bool||IsRemote () const|
|Determines whether this endpoint is a proxy for a remote object. More...|
|bool||IsValid () const|
|Determines whether the endpoint still exists. More...|
|const char *||Name () const|
|Returns the name of the endpoint. More...|
|Publishes the endpoint on the roster. More...|
|Decrements the endpoint's reference count. More...|
|void||SetName (const char *name)|
|Changes the name of the endpoint. More...|
|status_t||SetProperties (const BMessage *properties)|
|Changes the properties of the endpoint. More...|
|Hides the endpoint from the roster/. More...|
Base class for all MIDI endpoints.
BMidiEndpoint is the abstract base class that represents either a producer or consumer endpoint. It may be used to obtain the state, name, properties, or system-wide ID of the object. BMidiEndpoint also provides the ability to change the name and properties of endpoints that were created locally.
Remember, you cannot call the destructor of BMidiEndpoint and its subclasses directly. Endpoint objects are destructed automatically when their reference count drops to zero. If necessary, the destructor of a local endpoint first breaks off any connections and Unregister()'s the endpoint before it is deleted. However, for good style and bonus points you should really Disconnect() and Unregister() the object yourself and not rely on the destructor to do this.
Increments the endpoint's reference count.
Each BMidiEndpoint has a reference count associated with it, so that BMidiRoster can do proper bookkeeping. Acquire() increments this reference count, and Release() decrements it. Once the count reaches zero, the endpoint is deleted.
When you are done with the endpoint, whether local or remote, you should always Release() it!
Upon construction, local endpoints start with a reference count of 1. Any objects you obtain from BMidiRoster using the NextXXX() or FindXXX() functions have their reference counts incremented in the process. If you forget to call Release(), the objects won't be properly cleaned up and you'll make a fool out of yourself.
Typically, you don't need to call Acquire(), unless you have two disparate parts of your application working with the same endpoint, and you don't want to have to keep track of who needs to Release() the endpoint. Now you simply have both of them release it.
Returns the ID of the endpoint.
An ID uniquely identifies an endpoint in the system. The ID is a signed 32-bit number that is assigned by the Midi Server when the endpoint is created. (So even if a local endpoint is not published, it still has a unique ID.) Valid IDs range from 1 to 0x7FFFFFFF, the largest value an int32 can have. 0 and negative values are not valid IDs.
The purpose of this function is unclear, and as a result it doesn't do anything in the Haiku Midi Kit implementation.
Determines whether this endpoint is a proxy for a remote object.
An endpoint is "remote" when it is created by another application. Obviously, the remote object is Register()'ed as well, otherwise you would not be able to see it.
Determines whether the endpoint still exists.
Suppose you obtained a proxy object for a remote endpoint by querying the BMidiRoster. What if the application that published this endpoint quits, or less drastically, Unregister()'s that endpoint? Even though you still have a BMidiEndpoint proxy object, the real endpoint no longer exists. You can use IsValid() to check for this.
Don't worry, operations on invalid objects, such as GetProperties(), will return an error code (typically B_ERROR), but not cause a crash. Local objects are always are considered to be valid, even if you did not Register() them. (The only time a local endpoint is not valid is when there was a problem constructing it.)
If the application that created the remote endpoint crashes, then there is no guarantee that the Midi Server immediately recognizes this. In that case, IsValid() may still return true. Eventually, the stale endpoint will be removed from the roster, though. From then on, IsValid() correctly returns
|const char * BMidiEndpoint::Name||(||)||const|
Publishes the endpoint on the roster.
MIDI objects created by an application are invisible to other applications until they are published. To publish an object use the Register() method. The corresponding Unregister() method will cause an object to once again become invisible to remote applications.
Although it is considered bad style, calling Register() on local endpoints that are already registered won't mess things up. The Midi Server will simply ignore your request. Likewise for Unregister()'ing more than once. Attempts to Register() or Unregister() remote endpoints will fail, of course.
If you are watching , you will not receive notifications for any local endpoints you register or unregister. Of course, other applications will be notified about your endpoints.
Existing connections will not be broken when an object is unregistered, but future remote connections will be denied. When objects are destroyed, they automatically become unregistered.
B_ERROR) if something went wrong.
Decrements the endpoint's reference count.
|void BMidiEndpoint::SetName||(||const char *||name||)|
Changes the name of the endpoint.
Names don't have to be unique, but it is recommended that you give any endpoints you publish meaningful and unique names, so users can easily recognize what each endpoint does. There is no limit to the size of endpoint names.
Even though you can call this function on both remote and local objects, you are only allowed to change the names of local endpoints; SetName() calls on remote endpoints are ignored.
|name||The new name. If you pass |
Changes the properties of the endpoint.
Endpoints can have properties, which is any kind of information that might be useful to associate with a MIDI object. The properties are stored in a BMessage.
You are only allowed to call SetProperties() on a local object.
Properties should follow a protocol, so different applications will know how to read each other's properties. The current protocol is very limited – it only allows you to associate icons with your endpoints. Be planned to publish a more complete protocol that included additional information, such as vendor/model names, copyright/version info, category, etc., but they never got around to it.
|property||Vector icon (raw data)|
This vector icon is available under Haiku only, and comes as raw data, not a BBitmap. Before being able to display it, you first must render the vector icon in the size of your choice.
|property||Large (32x32) icon|
|property||Small (16x16) icon|
The MidiUtil package (downloadable from the OpenBeOS website) contains a number of convenient functions to associate icons with endpoints, so you don't have to write that code all over again.