|
|
## page was renamed from libgtkmusic
|
|
|
<<TableOfContents(2)>>
|
|
|
|
|
|
{{{#!wiki caution
|
|
|
'''Wiki will be moved to GitLab'''
|
|
|
|
|
|
This Wiki will soon be replaced by the one in the new project's page:
|
|
|
https://gitlab.gnome.org/GNOME/libgtkmusic/wikis/home
|
|
|
}}}
|
|
|
|
|
|
-----
|
|
|
|
|
|
|
|
|
== What's libgtkmusic? ==
|
|
|
|
|
|
libgtkmusic is a GTK+ library that provides widgets for displaying and
|
|
|
interacting with musical instruments views, as well as some utility functions.
|
|
|
It can be used for any kind of application that needs a musical instrument
|
|
|
view, such as virtual guitars, note detector, guitar training and games).
|
|
|
Currently it supports a highly customizable guitar and a piano.
|
|
|
|
|
|
{{attachment:guitar_widget.png|Guitar Widget|width=45%}}
|
|
|
{{attachment:piano_widget.png|Piano Widget|width=45%}}
|
|
|
|
|
|
== Installing ==
|
|
|
|
|
|
=== Building from source ===
|
|
|
|
|
|
Currently this is the only installation method. The source code can be accessed either through its
|
|
|
[[https://gitlab.gnome.org/GNOME/libgtkmusic|GitLab libgtkmusic Project]].
|
|
|
|
|
|
The library uses the [[mesonbuild.com|Meson build system]]. The instructions here provided assume the reader has a basic knowledge of GNU/Linux systems.
|
|
|
|
|
|
==== Installing Dependencies ====
|
|
|
|
|
|
Please make sure the following packages are installed:
|
|
|
|
|
|
|| '''Fedora''' || '''Debian or Ubuntu''' ||
|
|
|
|| vala || valac ||
|
|
|
|| pkgconf || pkg-config ||
|
|
|
|| libgee-devel || libgee-0.8-dev ||
|
|
|
|| meson || (outdated package; see below) ||
|
|
|
|||| git ||
|
|
|
|||| ninja-build ||
|
|
|
|
|
|
Please make sure that a recent meson version is installed (>= 0.44). In doubt, install via '''pip3'''
|
|
|
|
|
|
{{{
|
|
|
# apt-get install python3-pip
|
|
|
$ pip3 install --user --upgrade meson
|
|
|
}}}
|
|
|
|
|
|
To enable all build features, please also install the packages below:
|
|
|
|
|
|
|| '''Fedora''' || '''Debian or Ubuntu''' || '''Feature''' ||
|
|
|
|||| gobject-introspection || Allows use with other runtimes, such as Python ||
|
|
|
|| gobject-introspection-devel || libgirepository1.0-dev || (same as above) ||
|
|
|
|| libgee-devel || libgladeui-dev || Add libgtkmusic widgets to Glade designer ||
|
|
|
|||| valadoc || Generate Devhelp API reference via valadoc ||
|
|
|
|
|
|
|
|
|
==== Building the library ====
|
|
|
|
|
|
{{{
|
|
|
$ git clone https://gitlab.gnome.org/GNOME/libgtkmusic.git
|
|
|
$ cd libgtkmusic
|
|
|
$ meson build
|
|
|
$ cd build
|
|
|
$ ninja
|
|
|
# ninja install
|
|
|
}}}
|
|
|
|
|
|
If needed add the directory of the installed library to LD_EXPORT_PATH:
|
|
|
{{{
|
|
|
$ export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib/x86_64-linux-gnu"
|
|
|
}}}
|
|
|
|
|
|
== Usage ==
|
|
|
|
|
|
Provided that you've successfully installed the library and its GObject Introspection typelib, try out
|
|
|
this minimal Python example:
|
|
|
|
|
|
{{{#!highlight python
|
|
|
#!/usr/bin/env python3
|
|
|
import gi
|
|
|
gi.require_version('Gtk', '3.0')
|
|
|
gi.require_version('Gdk', '3.0')
|
|
|
gi.require_version('GtkMusic', '0.4')
|
|
|
|
|
|
from gi.repository import Gtk, Gdk, GtkMusic
|
|
|
|
|
|
def note_pressed(sender, widget, event, midi_code):
|
|
|
print('You pressed the note with MIDI code %d!' % midi_code)
|
|
|
|
|
|
win = Gtk.Window()
|
|
|
piano = GtkMusic.Piano()
|
|
|
|
|
|
piano.add_events(Gdk.EventMask.BUTTON_PRESS_MASK)
|
|
|
piano.connect('note_pressed', note_pressed)
|
|
|
win.connect('destroy', Gtk.main_quit)
|
|
|
|
|
|
win.add(piano)
|
|
|
|
|
|
win.show_all()
|
|
|
Gtk.main()
|
|
|
}}}
|
|
|
|
|
|
== API Reference ==
|
|
|
|
|
|
The API reference is currently hosted at [[http://leandromattioli.com/api/GtkMusic/]].
|
|
|
|
|
|
|
|
|
== Future ==
|
|
|
|
|
|
* --(Migration to GitLab)-- (DONE)
|
|
|
* Add other widgets (notably a drum kit)
|
|
|
|
|
|
== Getting in Touch ==
|
|
|
|
|
|
* Chat: `#libgtkmusic` at [[irc://irc.gnome.org/#libgtkmusic | irc.gnome.org]] and [[https://riot.im/app/#/room/#_gimpnet_#libgtkmusic:matrix.org | Riot]]
|
|
|
![piano_widget](uploads/1a38858949a6b5e95152b20b8dacd403/piano_widget.png) |
|
|
\ No newline at end of file |