Streams MIDI events to connected consumers. More...
#include <MidiProducer.h>
Inherits BMidiEndpoint.
Inherited by BMidiLocalProducer.
Public Member Functions | |
status_t | Connect (BMidiConsumer *cons) |
Connects a consumer to this producer. | |
BList * | Connections () const |
Returns a list with all connected consumers. | |
status_t | Disconnect (BMidiConsumer *cons) |
Disconnects a consumer from this producer. | |
bool | IsConnected (BMidiConsumer *cons) const |
Determines whether a consumer is connected to this producer. | |
Public Member Functions inherited from BMidiEndpoint | |
status_t | Acquire () |
Increments the endpoint's reference count. | |
status_t | GetProperties (BMessage *properties) const |
Reads the properties of the endpoint. | |
int32 | ID () const |
Returns the ID of the endpoint. | |
bool | IsConsumer () const |
Determines whether this endpoint is a BMidiConsumer. | |
bool | IsLocal () const |
Determines whether this endpoint represents a local object. | |
bool | IsPersistent () const |
Not used. | |
bool | IsProducer () const |
Determines whether this endpoint is a BMidiProducer. | |
bool | IsRemote () const |
Determines whether this endpoint is a proxy for a remote object. | |
bool | IsValid () const |
Determines whether the endpoint still exists. | |
const char * | Name () const |
Returns the name of the endpoint. | |
status_t | Register () |
Publishes the endpoint on the roster. | |
status_t | Release () |
Decrements the endpoint's reference count. | |
void | SetName (const char *name) |
Changes the name of the endpoint. | |
status_t | SetProperties (const BMessage *properties) |
Changes the properties of the endpoint. | |
status_t | Unregister () |
Hides the endpoint from the roster/. | |
Streams MIDI events to connected consumers.
A producer is an object that generate a stream of MIDI events. Each producer has a list of BMidiConsumer objects to which it is connected, and may be asked to connect to or disconnect from a BMidiConsumer. A producer can spray its events to multiple consumers at the same time. A BMidiProducer either represents a local producer, i.e. a class extending from BMidiLocalProducer, or is a proxy for a remote object published by another app.
status_t BMidiProducer::Connect | ( | BMidiConsumer * | cons | ) |
Connects a consumer to this producer.
Establishes a connection between this producer and the specified consumer endpoint. From now on, any events that this producer sprays will be sent to that consumer. You may connect multiple consumers to a producer.
B_ERROR
if you try to connect the same producer and consumer more than once.BList * BMidiProducer::Connections | ( | ) | const |
Returns a list with all connected consumers.
Returns a BList with pointers to BMidiEndpoint objects for all consumers that are connected to this producer. You can examine the contents of the list as follows:
Every time you call this function, a new BList is allocated. The caller (that is you) is responsible for freeing this list. The BMidiEndpoint objects in the list have their reference counts bumped, so you need to Release() them before you delete the list or they will go all leaky on you.
status_t BMidiProducer::Disconnect | ( | BMidiConsumer * | cons | ) |
Disconnects a consumer from this producer.
Terminates the connection between this producer and the specified consumer endpoint. From now on, any events that this producer sprays no longer go to that consumer.
bool BMidiProducer::IsConnected | ( | BMidiConsumer * | cons | ) | const |
Determines whether a consumer is connected to this producer.