Class

ALSARawmidiStreamPair

Description [src]

class ALSARawmidi.StreamPair : GObject.Object {
  parent_instance: GObject
}

GObject-derived object to express a pair of Rawmidi stream. A ALSARawmidiStreamPair is a GObject-derived object to express a pair of Rawmidi stream to which substreams are attached. The substream is pointed by the combination of the numeric identifier of device, subdevice, and direction. When the call of alsarawmidi_stream_pair_open() with the combination, corresponding substreams are attached to the object. Then the object maintains file descriptor till object destruction. The call of alsarawmidi_stream_pair_create_source() returns the instance of GSource. Once attached to the GSource, GMainContext / GMainLoop is available as event dispatcher. The ALSARawmidiStreamPair::handle-messages signal is emitted in the event dispatcher to notify the intermediate buffer of capture substream has available messages. The call of alsarawmidi_stream_pair_read_from_substream() fills the given buffer with the available messages. The call of alsarawmidi_stream_pair_write_to_substream() write messages in the given buffer into the intermediate buffer of playback substream. The call of alsarawmidi_stream_pair_get_substream_status() is available to check the space in the intermediate buffer according to direction argument.

Ancestors

Constructors

alsarawmidi_stream_pair_new

Allocate and return an instance of ALSARawmidiStreamPair.

Instance methods

alsarawmidi_stream_pair_create_source

Allocate GSource structure to handle events from ALSA rawmidi character device for input substream. In each iteration of GMainContext, the read(2) system call is executed to dispatch control event for ALSARawmidiStreamPair::handle-messages signal, according to the result of poll(2) system call.

alsarawmidi_stream_pair_drain_substream
No description available.
alsarawmidi_stream_pair_drop_substream
No description available.
alsarawmidi_stream_pair_get_protocol_version

Get the version of rawmidi protocol currently used. The version is expressed as the array with three elements; major, minor, and micro version in the order. The length of major version is 16 bit, the length of minor and micro version is 8 bit each.

alsarawmidi_stream_pair_get_substream_info

Get information of substream attached to the stream pair.

alsarawmidi_stream_pair_get_substream_status

Retrieve status of substream for given direction, which is attached to the pair of streams.

alsarawmidi_stream_pair_open

Open file descriptor for a pair of streams to attach input/output substreams corresponding to the given subdevice.

alsarawmidi_stream_pair_read_from_substream

Copy data from intermediate buffer to given buffer for substream attached to the pair of streams. In a case that the instance is opened without O_NONBLOCK flag and the intermediate buffer has no data, call of the API is blocked till any data is available.

alsarawmidi_stream_pair_set_substream_params

Set parameters of substream for given direction, which is attached to the pair of streams.

alsarawmidi_stream_pair_write_to_substream

Copy data from given buffer to intermediate buffer for substream attached to the pair of streams. In a case that the instance is opened without O_NONBLOCK flag and the intermediate buffer is full, call of the API is blocked till the buffer has space for the data.

Methods inherited from GObject (43)

Please see GObject for a full list of methods.

Properties

ALSARawmidi.StreamPair:devnode

The full path to special file of rawmidi character device.

Signals

ALSARawmidi.StreamPair::handle-disconnection

When the sound card is not available anymore due to unbinding driver or hot unplugging, this signal is emit. The owner of this object should call g_object_unref() as quickly as possible to release ALSA rawmidi character device.

ALSARawmidi.StreamPair::handle-messages

When any input message is available, this event is emit.

Signals inherited from GObject (1)
GObject.Object::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

Class structure

struct ALSARawmidiStreamPairClass {
  GObjectClass parent_class;
  void (* handle_messages) (
    ALSARawmidiStreamPair* self
  );
  void (* handle_disconnection) (
    ALSARawmidiStreamPair* self
  );
  
}
Class members
parent_class
GObjectClass
  No description available.
handle_messages
void (* handle_messages) (
    ALSARawmidiStreamPair* self
  )
  No description available.
handle_disconnection
void (* handle_disconnection) (
    ALSARawmidiStreamPair* self
  )
  No description available.

Virtual methods

ALSARawmidi.StreamPairClass.handle_disconnection

Class closure for the ALSARawmidiStreamPair::handle-disconnection signal.

ALSARawmidi.StreamPairClass.handle_messages

Class closure for the ALSARawmidiStreamPair::handle-messages singal.