Restart alsa-gi project as alsa-gobject project

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jaroslav,

Since Audio Mini Conference 2018, I continued to work for alsa-gi[1] in
my local to integrate toward better I/O libraries. However I realized
that its basic design includes some disadvantages to produce useful APIs.

I rethink the design and realize it better to wrap each of structures
in <sound/asound.h> simply. Then, I restart it as alsa-gobject[2].
At present, master branch includes a library, `libalsactl0` for the
most of I/O features in ALSA control interface, which is compatible with
GObject mechanism and GObject introspection.

Jaroslav, would you please delete the alsa-gi repository and fork
the master branch from my alsa-gobject repository, then apply enough
configurations to the new repository?


My repository includes four branches as well for ALSA
hwdep/rawmidi/timer/seq interfaces. The most of features in each
interface is already available via included libraries but under heavy
development.

I already start to test them with Python 3 (PyGObject) and they seem
work well. I also test them with Rust bindings generated by gtk-rs/gir[3]
tool. Near future I also publish Rust crates for further convenience.


For your interests, this Python 3 script is a sample to listen one
event from ALSA control character device. This simple program is not
terminated voluntarily or by sending UNIX signal, thus please generate
control event by alsamixer or amixer:

```
#!/usr/bin/env python3

import gi
gi.require_version('GLib', '2.0')
gi.require_version('ALSACtl', '0.0')
from gi.repository import GLib, ALSACtl

class MyCard(ALSACtl.Card):
    def __init__(self, card_id, ctx, dispatcher):
        super().__init__()
        self.open(card_id)

        self.create_source().attach(ctx)

        self.__dispatcher = dispatcher

    def do_handle_disconnection(self):
        self.__dispatcher.quit()

    def do_handle_elem_event(self, elem_id, events):
        # Print the first event and quit event loop.
        print(elem_id.get_iface().value_nick,
              elem_id.get_device_id(), elem_id.get_subdevice_id(),
              elem_id.get_name(), elem_id.get_index(),
              events.value_nicks)
        self.__dispatcher.quit()


ctx = GLib.MainContext.new()
dispatcher = GLib.MainLoop.new(ctx, False)
card = MyCard(0, ctx, dispatcher)

dispatcher.run()
```

[1] https://github.com/alsa-project/alsa-gi
[2] https://github.com/takaswie/alsa-gobject
[3] https://github.com/gtk-rs/gir


Regards

Takashi Sakamoto
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux