alsa-gobject: Add shared library to operate ALSA rawmidi character device

GitHub pull_request - opened github at alsa-project.org
Thu Apr 9 13:58:17 CEST 2020


alsa-project/alsa-gobject pull request #16 was opened from takaswie:

This patchset is to add a new library, libalsarawmidi, to operate ALSA rawmidi
character device. This library is compatible with GObject Introspection.

ALSA rawmidi interface is designed to transfer MIDI messages. Userspace
application operate ALSA rawmidi character device for incoming/outgoing
transmission. The transmission line is abstracted as substream. One
character device is associated to several substreams. The application can
indicate subdevice to select a substream or a pair of substreams from them.

The library has ALSARawmidi.StreamPair to operate the character device.
Userspace application call ALSARawmidi.StreamPair.open() to open the chracter
device, select subdevice and attach the substreams to the device. After the
call, data transmission already starts. The application can call
ALSARawmidi.StreamPair.write_to_substream() to transfer MIDI message bytes.

The application can also call ALSARawmidi.StreamPair.read_from_substream()
to receive MIDI message bytes, but this call can be blocked till any
messages are actually received and available as a default. For polling,
GSource which ALSARawmidi.StreamPair.create_source() returns is useful.
The application can use it for GMainContext/GMainLoop. When any message
is available, ALSARawmidi.StreamPair emits 'handle-messages' GObject signal.
The application register its handler to the signal in advance, then
process the messages.

ALSARawmidi.StreamPair has the other methods to drain/drop running
substream:
 - ALSARawmidi.StreamPair.drain_substream() 
 - ALSARawmidi.StreamPair.drop_substream() 

ALSARawmidi.StreamPair has more methods to return GObject-derived objects
for information/status/parameters of substream:
 - ALSARawmidi.StreamPair.get_substream_info()
 - ALSARawmidi.StreamPair.get_substream_status() 
 - ALSARawmidi.StreamPair.set_substream_params() 

The library includes global method to query information about rawmidi:
 - ALSARawmidi.get_rawmidi_sysname()
 - ALSARawmidi.get_rawmidi_devnode()
 - ALSARawmidi.get_device_id_list()
 - ALSARawmidi.get_subdevice_id_list()
 - ALSARawmidi.get_substream_info()

Request URL   : https://github.com/alsa-project/alsa-gobject/pull/16
Patch URL     : https://github.com/alsa-project/alsa-gobject/pull/16.patch
Repository URL: https://github.com/alsa-project/alsa-gobject


More information about the Alsa-devel mailing list