diff options
author | Robin Gareus <robin@gareus.org> | 2019-10-21 15:52:16 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2019-10-21 16:08:22 +0200 |
commit | 35647577e09d46c76da0bd4873423cc6c71d25e1 (patch) | |
tree | e1c143bdeb5d57c6983bb381049d369c072c1d3e | |
parent | 3daf16dc3aa2d394cb3c03fd4490512735bd11a9 (diff) |
NO-OP: whitespace
-rw-r--r-- | gtk2_ardour/gtk_pianokeyboard.c | 669 | ||||
-rw-r--r-- | gtk2_ardour/gtk_pianokeyboard.h | 48 |
2 files changed, 354 insertions, 363 deletions
diff --git a/gtk2_ardour/gtk_pianokeyboard.c b/gtk2_ardour/gtk_pianokeyboard.c index c9a105b713..dec19a7edf 100644 --- a/gtk2_ardour/gtk_pianokeyboard.c +++ b/gtk2_ardour/gtk_pianokeyboard.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2007, 2008 Edward Tomasz NapieraĆa <trasz@FreeBSD.org> + * Copyright (c) 2007, 2008 Edward Tomasz NapieraĆa <trasz@FreeBSD.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,29 +32,29 @@ */ #include <assert.h> -#include <string.h> -#include <stdint.h> #include <math.h> +#include <stdint.h> +#include <string.h> #include <cairo/cairo.h> -#include <pango/pango.h> +# include <pango/pango.h> #include <pango/pangocairo.h> #ifndef M_PI -# define M_PI 3.14159265358979323846 +#define M_PI 3.14159265358979323846 #endif -#include <gtk/gtk.h> #include <gdk/gdkkeysyms.h> +#include <gtk/gtk.h> #include "gtk_pianokeyboard.h" #ifndef MIN -#define MIN(A,B) ((A) < (B)) ? (A) : (B) +# define MIN(A, B) ((A) < (B)) ? (A) : (B) #endif #ifndef MAX -#define MAX(A,B) ((A) > (B)) ? (A) : (B) +# define MAX(A, B) ((A) > (B)) ? (A) : (B) #endif #define PIANO_KEYBOARD_DEFAULT_WIDTH 730 @@ -70,15 +70,15 @@ enum { static guint piano_keyboard_signals[LAST_SIGNAL] = { 0 }; static void -draw_keyboard_cue(PianoKeyboard *pk, cairo_t* cr) +draw_keyboard_cue (PianoKeyboard* pk, cairo_t* cr) { int w = pk->notes[0].w; int h = pk->notes[0].h; - int first_note_in_lower_row = (pk->octave + 1) * 12; - int last_note_in_lower_row = (pk->octave + 2) * 12 - 1; + int first_note_in_lower_row = (pk->octave + 1) * 12; + int last_note_in_lower_row = (pk->octave + 2) * 12 - 1; int first_note_in_higher_row = (pk->octave + 2) * 12; - int last_note_in_higher_row = (pk->octave + 3) * 12 + 4; + int last_note_in_higher_row = (pk->octave + 3) * 12 + 4; first_note_in_lower_row = MIN (127, MAX (0, first_note_in_lower_row)); last_note_in_lower_row = MIN (127, MAX (0, last_note_in_lower_row)); @@ -99,14 +99,14 @@ draw_keyboard_cue(PianoKeyboard *pk, cairo_t* cr) static void queue_note_draw (PianoKeyboard* pk, int note) { - GdkWindow* w = GTK_WIDGET(pk)->window; + GdkWindow* w = GTK_WIDGET (pk)->window; if (w) { GdkRectangle r; - r.x = pk->notes[note].x; - r.y = 0; - r.width = pk->notes[note].w; + r.x = pk->notes[note].x; + r.y = 0; + r.width = pk->notes[note].w; r.height = pk->notes[note].h; gdk_window_invalidate_rect (w, &r, TRUE); @@ -114,16 +114,16 @@ queue_note_draw (PianoKeyboard* pk, int note) } static void -draw_note(PianoKeyboard *pk, cairo_t* cr, int note) +draw_note (PianoKeyboard* pk, cairo_t* cr, int note) { if (note < pk->min_note || note > pk->max_note) { return; } int is_white = pk->notes[note].white; - int x = pk->notes[note].x; - int w = pk->notes[note].w; - int h = pk->notes[note].h; + int x = pk->notes[note].x; + int w = pk->notes[note].w; + int h = pk->notes[note].h; if (pk->notes[note].pressed || pk->notes[note].sustained) { if (is_white) { @@ -150,7 +150,7 @@ draw_note(PianoKeyboard *pk, cairo_t* cr, int note) cairo_rectangle (cr, x, 0, w, h); cairo_fill (cr); - cairo_set_source_rgb(cr, 0.0f, 0.0f, 0.0f); /* black outline */ + cairo_set_source_rgb (cr, 0.0f, 0.0f, 0.0f); /* black outline */ cairo_rectangle (cr, x, 0, w, h); cairo_stroke (cr); @@ -159,44 +159,44 @@ draw_note(PianoKeyboard *pk, cairo_t* cr, int note) } if (pk->print_note_label && (note % 12) == 0) { - int tw, th; + int tw, th; char buf[32]; sprintf (buf, "ArdourMono %dpx", MAX (10, MIN (20, MIN (w / 2 + 3, h / 7)))); PangoFontDescription* font = pango_font_description_from_string (buf); sprintf (buf, "C%2d", (note / 12) - 1); - PangoLayout* pl = pango_cairo_create_layout(cr); - pango_layout_set_font_description(pl, font); + PangoLayout* pl = pango_cairo_create_layout (cr); + pango_layout_set_font_description (pl, font); pango_layout_set_text (pl, buf, -1); pango_layout_set_alignment (pl, PANGO_ALIGN_LEFT); pango_layout_get_pixel_size (pl, &tw, &th); if (th < w && tw < h * .3) { - cairo_save(cr); + cairo_save (cr); cairo_move_to (cr, x + (w - th) / 2, h - 3); cairo_rotate (cr, M_PI / -2.0); cairo_set_source_rgba (cr, .0, .0, .0, 1.0); - pango_cairo_show_layout(cr, pl); - cairo_restore(cr); + pango_cairo_show_layout (cr, pl); + cairo_restore (cr); } - g_object_unref(pl); + g_object_unref (pl); pango_font_description_free (font); } /* We need to redraw black keys that partially obscure the white one. */ if (note < NNOTES - 2 && !pk->notes[note + 1].white) { - draw_note(pk, cr, note + 1); + draw_note (pk, cr, note + 1); } if (note > 0 && !pk->notes[note - 1].white) { - draw_note(pk, cr, note - 1); + draw_note (pk, cr, note - 1); } } static int -press_key(PianoKeyboard *pk, int key, int vel) +press_key (PianoKeyboard* pk, int key, int vel) { - assert(key >= 0); - assert(key < NNOTES); + assert (key >= 0); + assert (key < NNOTES); pk->maybe_stop_sustained_notes = 0; @@ -212,23 +212,23 @@ press_key(PianoKeyboard *pk, int key, int vel) if (pk->monophonic && pk->last_key != key) { pk->notes[pk->last_key].pressed = 0; pk->notes[pk->last_key].sustained = 0; - queue_note_draw(pk, pk->last_key); + queue_note_draw (pk, pk->last_key); } pk->last_key = key; pk->notes[key].pressed = 1; - g_signal_emit_by_name(GTK_WIDGET(pk), "note-on", key, vel); - queue_note_draw(pk, key); + g_signal_emit_by_name (GTK_WIDGET (pk), "note-on", key, vel); + queue_note_draw (pk, key); return 1; } static int -release_key(PianoKeyboard *pk, int key) +release_key (PianoKeyboard* pk, int key) { - assert(key >= 0); - assert(key < NNOTES); + assert (key >= 0); + assert (key < NNOTES); pk->maybe_stop_sustained_notes = 0; @@ -243,8 +243,8 @@ release_key(PianoKeyboard *pk, int key) if (pk->notes[key].sustained) return 0; - g_signal_emit_by_name(GTK_WIDGET(pk), "note-off", key); - queue_note_draw(pk, key); + g_signal_emit_by_name (GTK_WIDGET (pk), "note-off", key); + queue_note_draw (pk, key); return 1; } @@ -252,45 +252,45 @@ release_key(PianoKeyboard *pk, int key) static void rest (PianoKeyboard* pk) { - g_signal_emit_by_name(GTK_WIDGET(pk), "rest"); + g_signal_emit_by_name (GTK_WIDGET (pk), "rest"); } static void -stop_unsustained_notes(PianoKeyboard *pk) +stop_unsustained_notes (PianoKeyboard* pk) { int i; for (i = 0; i < NNOTES; ++i) { if (pk->notes[i].pressed && !pk->notes[i].sustained) { pk->notes[i].pressed = 0; - g_signal_emit_by_name(GTK_WIDGET(pk), "note-off", i); - queue_note_draw(pk, i); + g_signal_emit_by_name (GTK_WIDGET (pk), "note-off", i); + queue_note_draw (pk, i); } } } static void -stop_sustained_notes(PianoKeyboard *pk) +stop_sustained_notes (PianoKeyboard* pk) { int i; for (i = 0; i < NNOTES; ++i) { if (pk->notes[i].sustained) { - pk->notes[i].pressed = 0; + pk->notes[i].pressed = 0; pk->notes[i].sustained = 0; - g_signal_emit_by_name(GTK_WIDGET(pk), "note-off", i); - queue_note_draw(pk, i); + g_signal_emit_by_name (GTK_WIDGET (pk), "note-off", i); + queue_note_draw (pk, i); } } } static int -key_binding(PianoKeyboard *pk, const char *key) +key_binding (PianoKeyboard* pk, const char* key) { gpointer notused, note; gboolean found; - assert(pk->key_bindings != NULL); + assert (pk->key_bindings != NULL); - found = g_hash_table_lookup_extended(pk->key_bindings, key, ¬used, ¬e); + found = g_hash_table_lookup_extended (pk->key_bindings, key, ¬used, ¬e); if (!found) return -1; @@ -299,163 +299,163 @@ key_binding(PianoKeyboard *pk, const char *key) } static void -bind_key(PianoKeyboard *pk, const char *key, int note) +bind_key (PianoKeyboard* pk, const char* key, int note) { - assert(pk->key_bindings != NULL); + assert (pk->key_bindings != NULL); - g_hash_table_insert(pk->key_bindings, (const gpointer)key, (gpointer)((intptr_t)note)); + g_hash_table_insert (pk->key_bindings, (const gpointer)key, (gpointer) ((intptr_t)note)); } static void -clear_notes(PianoKeyboard *pk) +clear_notes (PianoKeyboard* pk) { - assert(pk->key_bindings != NULL); + assert (pk->key_bindings != NULL); - g_hash_table_remove_all(pk->key_bindings); + g_hash_table_remove_all (pk->key_bindings); } static void -bind_keys_qwerty(PianoKeyboard *pk) +bind_keys_qwerty (PianoKeyboard* pk) { - clear_notes(pk); + clear_notes (pk); - bind_key(pk, "space", 128); + bind_key (pk, "space", 128); /* Lower keyboard row - "zxcvbnm". */ - bind_key(pk, "z", 12); /* C0 */ - bind_key(pk, "s", 13); - bind_key(pk, "x", 14); - bind_key(pk, "d", 15); - bind_key(pk, "c", 16); - bind_key(pk, "v", 17); - bind_key(pk, "g", 18); - bind_key(pk, "b", 19); - bind_key(pk, "h", 20); - bind_key(pk, "n", 21); - bind_key(pk, "j", 22); - bind_key(pk, "m", 23); + bind_key (pk, "z", 12); /* C0 */ + bind_key (pk, "s", 13); + bind_key (pk, "x", 14); + bind_key (pk, "d", 15); + bind_key (pk, "c", 16); + bind_key (pk, "v", 17); + bind_key (pk, "g", 18); + bind_key (pk, "b", 19); + bind_key (pk, "h", 20); + bind_key (pk, "n", 21); + bind_key (pk, "j", 22); + bind_key (pk, "m", 23); /* Upper keyboard row, first octave - "qwertyu". */ - bind_key(pk, "q", 24); - bind_key(pk, "2", 25); - bind_key(pk, "w", 26); - bind_key(pk, "3", 27); - bind_key(pk, "e", 28); - bind_key(pk, "r", 29); - bind_key(pk, "5", 30); - bind_key(pk, "t", 31); - bind_key(pk, "6", 32); - bind_key(pk, "y", 33); - bind_key(pk, "7", 34); - bind_key(pk, "u", 35); + bind_key (pk, "q", 24); + bind_key (pk, "2", 25); + bind_key (pk, "w", 26); + bind_key (pk, "3", 27); + bind_key (pk, "e", 28); + bind_key (pk, "r", 29); + bind_key (pk, "5", 30); + bind_key (pk, "t", 31); + bind_key (pk, "6", 32); + bind_key (pk, "y", 33); + bind_key (pk, "7", 34); + bind_key (pk, "u", 35); /* Upper keyboard row, the rest - "iop". */ - bind_key(pk, "i", 36); - bind_key(pk, "9", 37); - bind_key(pk, "o", 38); - bind_key(pk, "0", 39); - bind_key(pk, "p", 40); + bind_key (pk, "i", 36); + bind_key (pk, "9", 37); + bind_key (pk, "o", 38); + bind_key (pk, "0", 39); + bind_key (pk, "p", 40); } static void -bind_keys_qwertz(PianoKeyboard *pk) +bind_keys_qwertz (PianoKeyboard* pk) { - bind_keys_qwerty(pk); + bind_keys_qwerty (pk); /* The only difference between QWERTY and QWERTZ is that the "y" and "z" are swapped together. */ - bind_key(pk, "y", 12); - bind_key(pk, "z", 33); + bind_key (pk, "y", 12); + bind_key (pk, "z", 33); } static void -bind_keys_azerty(PianoKeyboard *pk) +bind_keys_azerty (PianoKeyboard* pk) { - clear_notes(pk); + clear_notes (pk); - bind_key(pk, "space", 128); + bind_key (pk, "space", 128); /* Lower keyboard row - "wxcvbn,". */ - bind_key(pk, "w", 12); /* C0 */ - bind_key(pk, "s", 13); - bind_key(pk, "x", 14); - bind_key(pk, "d", 15); - bind_key(pk, "c", 16); - bind_key(pk, "v", 17); - bind_key(pk, "g", 18); - bind_key(pk, "b", 19); - bind_key(pk, "h", 20); - bind_key(pk, "n", 21); - bind_key(pk, "j", 22); - bind_key(pk, "comma", 23); + bind_key (pk, "w", 12); /* C0 */ + bind_key (pk, "s", 13); + bind_key (pk, "x", 14); + bind_key (pk, "d", 15); + bind_key (pk, "c", 16); + bind_key (pk, "v", 17); + bind_key (pk, "g", 18); + bind_key (pk, "b", 19); + bind_key (pk, "h", 20); + bind_key (pk, "n", 21); + bind_key (pk, "j", 22); + bind_key (pk, "comma", 23); /* Upper keyboard row, first octave - "azertyu". */ - bind_key(pk, "a", 24); - bind_key(pk, "eacute", 25); - bind_key(pk, "z", 26); - bind_key(pk, "quotedbl", 27); - bind_key(pk, "e", 28); - bind_key(pk, "r", 29); - bind_key(pk, "parenleft", 30); - bind_key(pk, "t", 31); - bind_key(pk, "minus", 32); - bind_key(pk, "y", 33); - bind_key(pk, "egrave", 34); - bind_key(pk, "u", 35); + bind_key (pk, "a", 24); + bind_key (pk, "eacute", 25); + bind_key (pk, "z", 26); + bind_key (pk, "quotedbl", 27); + bind_key (pk, "e", 28); + bind_key (pk, "r", 29); + bind_key (pk, "parenleft", 30); + bind_key (pk, "t", 31); + bind_key (pk, "minus", 32); + bind_key (pk, "y", 33); + bind_key (pk, "egrave", 34); + bind_key (pk, "u", 35); /* Upper keyboard row, the rest - "iop". */ - bind_key(pk, "i", 36); - bind_key(pk, "ccedilla", 37); - bind_key(pk, "o", 38); - bind_key(pk, "agrave", 39); - bind_key(pk, "p", 40); + bind_key (pk, "i", 36); + bind_key (pk, "ccedilla", 37); + bind_key (pk, "o", 38); + bind_key (pk, "agrave", 39); + bind_key (pk, "p", 40); } static void -bind_keys_dvorak(PianoKeyboard *pk) +bind_keys_dvorak (PianoKeyboard* pk) { - clear_notes(pk); + clear_notes (pk); - bind_key(pk, "space", 128); + bind_key (pk, "space", 128); /* Lower keyboard row - ";qjkxbm". */ - bind_key(pk, "semicolon", 12); /* C0 */ - bind_key(pk, "o", 13); - bind_key(pk, "q", 14); - bind_key(pk, "e", 15); - bind_key(pk, "j", 16); - bind_key(pk, "k", 17); - bind_key(pk, "i", 18); - bind_key(pk, "x", 19); - bind_key(pk, "d", 20); - bind_key(pk, "b", 21); - bind_key(pk, "h", 22); - bind_key(pk, "m", 23); - bind_key(pk, "w", 24); /* overlaps with upper row */ - bind_key(pk, "n", 25); - bind_key(pk, "v", 26); - bind_key(pk, "s", 27); - bind_key(pk, "z", 28); + bind_key (pk, "semicolon", 12); /* C0 */ + bind_key (pk, "o", 13); + bind_key (pk, "q", 14); + bind_key (pk, "e", 15); + bind_key (pk, "j", 16); + bind_key (pk, "k", 17); + bind_key (pk, "i", 18); + bind_key (pk, "x", 19); + bind_key (pk, "d", 20); + bind_key (pk, "b", 21); + bind_key (pk, "h", 22); + bind_key (pk, "m", 23); + bind_key (pk, "w", 24); /* overlaps with upper row */ + bind_key (pk, "n", 25); + bind_key (pk, "v", 26); + bind_key (pk, "s", 27); + bind_key (pk, "z", 28); /* Upper keyboard row, first octave - "',.pyfg". */ - bind_key(pk, "apostrophe", 24); - bind_key(pk, "2", 25); - bind_key(pk, "comma", 26); - bind_key(pk, "3", 27); - bind_key(pk, "period", 28); - bind_key(pk, "p", 29); - bind_key(pk, "5", 30); - bind_key(pk, "y", 31); - bind_key(pk, "6", 32); - bind_key(pk, "f", 33); - bind_key(pk, "7", 34); - bind_key(pk, "g", 35); + bind_key (pk, "apostrophe", 24); + bind_key (pk, "2", 25); + bind_key (pk, "comma", 26); + bind_key (pk, "3", 27); + bind_key (pk, "period", 28); + bind_key (pk, "p", 29); + bind_key (pk, "5", 30); + bind_key (pk, "y", 31); + bind_key (pk, "6", 32); + bind_key (pk, "f", 33); + bind_key (pk, "7", 34); + bind_key (pk, "g", 35); /* Upper keyboard row, the rest - "crl". */ - bind_key(pk, "c", 36); - bind_key(pk, "9", 37); - bind_key(pk, "r", 38); - bind_key(pk, "0", 39); - bind_key(pk, "l", 40); + bind_key (pk, "c", 36); + bind_key (pk, "9", 37); + bind_key (pk, "r", 38); + bind_key (pk, "0", 39); + bind_key (pk, "l", 40); #if 0 bind_key(pk, "slash", 41); /* extra F */ bind_key(pk, "bracketright", 42); @@ -464,33 +464,33 @@ bind_keys_dvorak(PianoKeyboard *pk) } static gint -keyboard_event_handler(GtkWidget *mk, GdkEventKey *event, gpointer ignored) +keyboard_event_handler (GtkWidget* mk, GdkEventKey* event, gpointer ignored) { int note; char* key; guint keyval; - GdkKeymapKey kk; - PianoKeyboard* pk = PIANO_KEYBOARD(mk); + GdkKeymapKey kk; + PianoKeyboard* pk = PIANO_KEYBOARD (mk); - (void) ignored; + (void)ignored; /* We're not using event->keyval, because we need keyval with level set to 0. E.g. if user holds Shift and presses '7', we want to get a '7', not '&'. */ kk.keycode = event->hardware_keycode; - kk.level = 0; - kk.group = 0; + kk.level = 0; + kk.group = 0; - keyval = gdk_keymap_lookup_key(NULL, &kk); + keyval = gdk_keymap_lookup_key (NULL, &kk); - key = gdk_keyval_name(gdk_keyval_to_lower(keyval)); + key = gdk_keyval_name (gdk_keyval_to_lower (keyval)); if (key == NULL) { - g_message("gtk_keyval_name() returned NULL; please report this."); + g_message ("gtk_keyval_name() returned NULL; please report this."); return FALSE; } - note = key_binding(pk, key); + note = key_binding (pk, key); if (note < 0) { return FALSE; @@ -506,22 +506,22 @@ keyboard_event_handler(GtkWidget *mk, GdkEventKey *event, gpointer ignored) note += pk->octave * 12; - assert(note >= 0); - assert(note < NNOTES); + assert (note >= 0); + assert (note < NNOTES); if (event->type == GDK_KEY_PRESS) { - press_key(pk, note, pk->key_velocity); + press_key (pk, note, pk->key_velocity); } else if (event->type == GDK_KEY_RELEASE) { - release_key(pk, note); + release_key (pk, note); } return TRUE; } static int -get_note_for_xy (PianoKeyboard *pk, int x, int y) +get_note_for_xy (PianoKeyboard* pk, int x, int y) { - int height = GTK_WIDGET(pk)->allocation.height; + int height = GTK_WIDGET (pk)->allocation.height; int note; if (y <= ((height * 2) / 3)) { /* might be a black key */ @@ -550,7 +550,7 @@ get_note_for_xy (PianoKeyboard *pk, int x, int y) } static int -get_velocity_for_note_at_y(PianoKeyboard *pk, int note, int y) +get_velocity_for_note_at_y (PianoKeyboard* pk, int note, int y) { if (note < 0) { return 0; @@ -566,14 +566,14 @@ get_velocity_for_note_at_y(PianoKeyboard *pk, int note, int y) } static gboolean -mouse_button_event_handler(PianoKeyboard *pk, GdkEventButton *event, gpointer ignored) +mouse_button_event_handler (PianoKeyboard* pk, GdkEventButton* event, gpointer ignored) { int x = event->x; int y = event->y; int note = get_note_for_xy (pk, x, y); - (void) ignored; + (void)ignored; if (event->button != 1) return TRUE; @@ -584,7 +584,7 @@ mouse_button_event_handler(PianoKeyboard *pk, GdkEventButton *event, gpointer ig } if (pk->note_being_pressed_using_mouse >= 0) { - release_key(pk, pk->note_being_pressed_using_mouse); + release_key (pk, pk->note_being_pressed_using_mouse); } press_key (pk, note, get_velocity_for_note_at_y (pk, note, y)); @@ -592,10 +592,10 @@ mouse_button_event_handler(PianoKeyboard *pk, GdkEventButton *event, gpointer ig } else if (event->type == GDK_BUTTON_RELEASE) { if (note >= 0) { - release_key(pk, note); + release_key (pk, note); } else { if (pk->note_being_pressed_using_mouse >= 0) { - release_key(pk, pk->note_being_pressed_using_mouse); + release_key (pk, pk->note_being_pressed_using_mouse); } } pk->note_being_pressed_using_mouse = -1; @@ -605,11 +605,11 @@ mouse_button_event_handler(PianoKeyboard *pk, GdkEventButton *event, gpointer ig } static gboolean -mouse_motion_event_handler(PianoKeyboard *pk, GdkEventMotion *event, gpointer ignored) +mouse_motion_event_handler (PianoKeyboard* pk, GdkEventMotion* event, gpointer ignored) { int note; - (void) ignored; + (void)ignored; if ((event->state & GDK_BUTTON1_MASK) == 0) return TRUE; @@ -621,9 +621,9 @@ mouse_motion_event_handler(PianoKeyboard *pk, GdkEventMotion *event, gpointer ig if (note != pk->note_being_pressed_using_mouse && note >= 0) { if (pk->note_being_pressed_using_mouse >= 0) { - release_key(pk, pk->note_being_pressed_using_mouse); + release_key (pk, pk->note_being_pressed_using_mouse); } - press_key(pk, note, get_velocity_for_note_at_y (pk, note, y)); + press_key (pk, note, get_velocity_for_note_at_y (pk, note, y)); pk->note_being_pressed_using_mouse = note; } @@ -631,11 +631,11 @@ mouse_motion_event_handler(PianoKeyboard *pk, GdkEventMotion *event, gpointer ig } static gboolean -piano_keyboard_expose(GtkWidget *widget, GdkEventExpose *event) +piano_keyboard_expose (GtkWidget* widget, GdkEventExpose* event) { - int i; - PianoKeyboard *pk = PIANO_KEYBOARD(widget); - cairo_t* cr = gdk_cairo_create (GDK_DRAWABLE (GTK_WIDGET(pk)->window)); + int i; + PianoKeyboard* pk = PIANO_KEYBOARD (widget); + cairo_t* cr = gdk_cairo_create (GDK_DRAWABLE (GTK_WIDGET (pk)->window)); gdk_cairo_region (cr, event->region); cairo_clip (cr); @@ -643,18 +643,18 @@ piano_keyboard_expose(GtkWidget *widget, GdkEventExpose *event) for (i = 0; i < NNOTES; ++i) { GdkRectangle r; - r.x = pk->notes[i].x; - r.y = 0; - r.width = pk->notes[i].w; + r.x = pk->notes[i].x; + r.y = 0; + r.width = pk->notes[i].w; r.height = pk->notes[i].h; switch (gdk_region_rect_in (event->region, &r)) { - case GDK_OVERLAP_RECTANGLE_PART: - case GDK_OVERLAP_RECTANGLE_IN: - draw_note (pk, cr, i); - break; - default: - break; + case GDK_OVERLAP_RECTANGLE_PART: + case GDK_OVERLAP_RECTANGLE_IN: + draw_note (pk, cr, i); + break; + default: + break; } } @@ -664,11 +664,11 @@ piano_keyboard_expose(GtkWidget *widget, GdkEventExpose *event) } static void -piano_keyboard_size_request(GtkWidget* w, GtkRequisition *requisition) +piano_keyboard_size_request (GtkWidget* w, GtkRequisition* requisition) { - (void) w; + (void)w; - requisition->width = PIANO_KEYBOARD_DEFAULT_WIDTH; + requisition->width = PIANO_KEYBOARD_DEFAULT_WIDTH; requisition->height = PIANO_KEYBOARD_DEFAULT_HEIGHT; } @@ -693,18 +693,17 @@ static double black_key_left_shift (int key) { int note_in_octave = key % 12; - switch (note_in_octave) - { + switch (note_in_octave) { case 1: - return 2.0/3.0; + return 2.0 / 3.0; case 3: - return 1.0/3.0; + return 1.0 / 3.0; case 6: - return 2.0/3.0; + return 2.0 / 3.0; case 8: return 0.5; case 10: - return 1.0/3.0; + return 1.0 / 3.0; default: return 0; } @@ -712,49 +711,49 @@ black_key_left_shift (int key) } static void -recompute_dimensions (PianoKeyboard *pk) +recompute_dimensions (PianoKeyboard* pk) { int note; int number_of_white_keys = 0; - int skipped_white_keys = 0; + int skipped_white_keys = 0; for (note = pk->min_note; note <= pk->max_note; ++note) { - if (!is_black(note)) { + if (!is_black (note)) { ++number_of_white_keys; } } for (note = 0; note < pk->min_note; ++note) { - if (!is_black(note)) { + if (!is_black (note)) { ++skipped_white_keys; } } - int width = GTK_WIDGET(pk)->allocation.width; - int height = GTK_WIDGET(pk)->allocation.height; + int width = GTK_WIDGET (pk)->allocation.width; + int height = GTK_WIDGET (pk)->allocation.height; - int key_width = width / number_of_white_keys; + int key_width = width / number_of_white_keys; int black_key_width = key_width * 0.8; - int useful_width = number_of_white_keys * key_width; + int useful_width = number_of_white_keys * key_width; pk->widget_margin = (width - useful_width) / 2; int white_key; for (note = 0, white_key = -skipped_white_keys; note < NNOTES; ++note) { - if (is_black(note)) { + if (is_black (note)) { /* This note is black key. */ pk->notes[note].x = pk->widget_margin + - (white_key * key_width) - - (black_key_width * black_key_left_shift(note)); - pk->notes[note].w = black_key_width; - pk->notes[note].h = (height * 2) / 3; + (white_key * key_width) - + (black_key_width * black_key_left_shift (note)); + pk->notes[note].w = black_key_width; + pk->notes[note].h = (height * 2) / 3; pk->notes[note].white = 0; continue; } /* This note is white key. */ - pk->notes[note].x = pk->widget_margin + white_key * key_width; - pk->notes[note].w = key_width; - pk->notes[note].h = height; + pk->notes[note].x = pk->widget_margin + white_key * key_width; + pk->notes[note].w = key_width; + pk->notes[note].h = height; pk->notes[note].white = 1; white_key++; @@ -762,180 +761,177 @@ recompute_dimensions (PianoKeyboard *pk) } static void -piano_keyboard_size_allocate(GtkWidget *widget, GtkAllocation *allocation) +piano_keyboard_size_allocate (GtkWidget* widget, GtkAllocation* allocation) { /* XXX: Are these two needed? */ - g_return_if_fail(widget != NULL); - g_return_if_fail(allocation != NULL); + g_return_if_fail (widget != NULL); + g_return_if_fail (allocation != NULL); widget->allocation = *allocation; - recompute_dimensions(PIANO_KEYBOARD(widget)); + recompute_dimensions (PIANO_KEYBOARD (widget)); - if (GTK_WIDGET_REALIZED(widget)) { + if (GTK_WIDGET_REALIZED (widget)) { gdk_window_move_resize (widget->window, allocation->x, allocation->y, allocation->width, allocation->height); } } typedef void (*GMarshalFunc_VOID__INT_INT) (gpointer data1, - gint arg1, - gint arg2, + gint arg1, + gint arg2, gpointer data2); static void -g_cclosure_user_marshal_VOID__INT_INT (GClosure *closure, - GValue *return_value G_GNUC_UNUSED, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint G_GNUC_UNUSED, - gpointer marshal_data) +g_cclosure_user_marshal_VOID__INT_INT (GClosure* closure, + GValue* return_value G_GNUC_UNUSED, + guint n_param_values, + const GValue* param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) { - GCClosure *cc = (GCClosure *) closure; - gpointer data1, data2; - GMarshalFunc_VOID__INT_INT callback; - - g_return_if_fail (n_param_values == 3); - - if (G_CCLOSURE_SWAP_DATA (closure)) - { - data1 = closure->data; - data2 = g_value_peek_pointer (param_values + 0); - } - else - { - data1 = g_value_peek_pointer (param_values + 0); - data2 = closure->data; - } - callback = (GMarshalFunc_VOID__INT_INT) (marshal_data ? marshal_data : cc->callback); - - callback (data1, - (param_values + 1)->data[0].v_int, - (param_values + 2)->data[0].v_int, - data2); + GCClosure* cc = (GCClosure*)closure; + gpointer data1, data2; + GMarshalFunc_VOID__INT_INT callback; + + g_return_if_fail (n_param_values == 3); + + if (G_CCLOSURE_SWAP_DATA (closure)) { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } else { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__INT_INT) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + (param_values + 1)->data[0].v_int, + (param_values + 2)->data[0].v_int, + data2); } static void -piano_keyboard_class_init(PianoKeyboardClass *klass) +piano_keyboard_class_init (PianoKeyboardClass* klass) { GtkWidgetClass* widget_klass; /* Set up signals. */ piano_keyboard_signals[NOTE_ON_SIGNAL] = g_signal_new ("note-on", - G_TYPE_FROM_CLASS (klass), (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION), - 0, NULL, NULL, g_cclosure_user_marshal_VOID__INT_INT, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT); + G_TYPE_FROM_CLASS (klass), (GSignalFlags) (G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION), + 0, NULL, NULL, g_cclosure_user_marshal_VOID__INT_INT, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT); piano_keyboard_signals[NOTE_OFF_SIGNAL] = g_signal_new ("note-off", - G_TYPE_FROM_CLASS (klass), (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION), - 0, NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT); + G_TYPE_FROM_CLASS (klass), (GSignalFlags) (G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION), + 0, NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT); piano_keyboard_signals[REST_SIGNAL] = g_signal_new ("rest", - G_TYPE_FROM_CLASS (klass), (GSignalFlags)(G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION), - 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); + G_TYPE_FROM_CLASS (klass), (GSignalFlags) (G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION), + 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); - widget_klass = (GtkWidgetClass*) klass; + widget_klass = (GtkWidgetClass*)klass; - widget_klass->expose_event = piano_keyboard_expose; - widget_klass->size_request = piano_keyboard_size_request; + widget_klass->expose_event = piano_keyboard_expose; + widget_klass->size_request = piano_keyboard_size_request; widget_klass->size_allocate = piano_keyboard_size_allocate; } static void -piano_keyboard_init(GtkWidget *mk) +piano_keyboard_init (GtkWidget* mk) { - gtk_widget_add_events(mk, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK); + gtk_widget_add_events (mk, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK); - g_signal_connect(G_OBJECT(mk), "button-press-event", G_CALLBACK(mouse_button_event_handler), NULL); - g_signal_connect(G_OBJECT(mk), "button-release-event", G_CALLBACK(mouse_button_event_handler), NULL); - g_signal_connect(G_OBJECT(mk), "motion-notify-event", G_CALLBACK(mouse_motion_event_handler), NULL); - g_signal_connect(G_OBJECT(mk), "key-press-event", G_CALLBACK(keyboard_event_handler), NULL); - g_signal_connect(G_OBJECT(mk), "key-release-event", G_CALLBACK(keyboard_event_handler), NULL); + g_signal_connect (G_OBJECT (mk), "button-press-event", G_CALLBACK (mouse_button_event_handler), NULL); + g_signal_connect (G_OBJECT (mk), "button-release-event", G_CALLBACK (mouse_button_event_handler), NULL); + g_signal_connect (G_OBJECT (mk), "motion-notify-event", G_CALLBACK (mouse_motion_event_handler), NULL); + g_signal_connect (G_OBJECT (mk), "key-press-event", G_CALLBACK (keyboard_event_handler), NULL); + g_signal_connect (G_OBJECT (mk), "key-release-event", G_CALLBACK (keyboard_event_handler), NULL); } GType -piano_keyboard_get_type(void) +piano_keyboard_get_type (void) { static GType mk_type = 0; if (!mk_type) { static const GTypeInfo mk_info = { - sizeof(PianoKeyboardClass), + sizeof (PianoKeyboardClass), NULL, /* base_init */ NULL, /* base_finalize */ - (GClassInitFunc) piano_keyboard_class_init, + (GClassInitFunc)piano_keyboard_class_init, NULL, /* class_finalize */ NULL, /* class_data */ sizeof (PianoKeyboard), - 0, /* n_preallocs */ - (GInstanceInitFunc) piano_keyboard_init, - 0, /* value_table */ + 0, /* n_preallocs */ + (GInstanceInitFunc)piano_keyboard_init, + 0, /* value_table */ }; - mk_type = g_type_register_static(GTK_TYPE_DRAWING_AREA, "PianoKeyboard", &mk_info, (GTypeFlags)0); + mk_type = g_type_register_static (GTK_TYPE_DRAWING_AREA, "PianoKeyboard", &mk_info, (GTypeFlags)0); } return mk_type; } -GtkWidget * -piano_keyboard_new(void) +GtkWidget* +piano_keyboard_new (void) { - GtkWidget *widget = (GtkWidget*)gtk_type_new(piano_keyboard_get_type()); + GtkWidget* widget = (GtkWidget*)gtk_type_new (piano_keyboard_get_type ()); - PianoKeyboard *pk = PIANO_KEYBOARD(widget); + PianoKeyboard* pk = PIANO_KEYBOARD (widget); - pk->maybe_stop_sustained_notes = 0; - pk->sustain_new_notes = 0; - pk->enable_keyboard_cue = FALSE; - pk->highlight_grand_piano_range = FALSE; - pk->print_note_label = FALSE; - pk->octave = 4; - pk->octave_range = 7; + pk->maybe_stop_sustained_notes = 0; + pk->sustain_new_notes = 0; + pk->enable_keyboard_cue = FALSE; + pk->highlight_grand_piano_range = FALSE; + pk->print_note_label = FALSE; + pk->octave = 4; + pk->octave_range = 7; pk->note_being_pressed_using_mouse = -1; - pk->min_note = 0; - pk->max_note = 127; - pk->last_key = 0; - pk->monophonic = FALSE; + pk->min_note = 0; + pk->max_note = 127; + pk->last_key = 0; + pk->monophonic = FALSE; pk->min_velocity = 1; pk->max_velocity = 127; pk->key_velocity = 100; - memset((void *)pk->notes, 0, sizeof(struct PKNote) * NNOTES); + memset ((void*)pk->notes, 0, sizeof (struct PKNote) * NNOTES); - pk->key_bindings = g_hash_table_new(g_str_hash, g_str_equal); - bind_keys_qwerty(pk); + pk->key_bindings = g_hash_table_new (g_str_hash, g_str_equal); + bind_keys_qwerty (pk); return widget; } void -piano_keyboard_set_keyboard_cue (PianoKeyboard *pk, gboolean enabled) +piano_keyboard_set_keyboard_cue (PianoKeyboard* pk, gboolean enabled) { pk->enable_keyboard_cue = enabled; - gtk_widget_queue_draw(GTK_WIDGET(pk)); + gtk_widget_queue_draw (GTK_WIDGET (pk)); } void -piano_keyboard_set_grand_piano_highlight (PianoKeyboard *pk, gboolean enabled) +piano_keyboard_set_grand_piano_highlight (PianoKeyboard* pk, gboolean enabled) { pk->highlight_grand_piano_range = enabled; - gtk_widget_queue_draw(GTK_WIDGET(pk)); + gtk_widget_queue_draw (GTK_WIDGET (pk)); } void -piano_keyboard_show_note_label (PianoKeyboard *pk, gboolean enabled) +piano_keyboard_show_note_label (PianoKeyboard* pk, gboolean enabled) { pk->print_note_label = enabled; - gtk_widget_queue_draw(GTK_WIDGET(pk)); + gtk_widget_queue_draw (GTK_WIDGET (pk)); } void -piano_keyboard_set_monophonic(PianoKeyboard *pk, gboolean monophonic) +piano_keyboard_set_monophonic (PianoKeyboard* pk, gboolean monophonic) { pk->monophonic = monophonic; } void -piano_keyboard_set_velocities(PianoKeyboard *pk, int min_vel, int max_vel, int key_vel) +piano_keyboard_set_velocities (PianoKeyboard* pk, int min_vel, int max_vel, int key_vel) { if (min_vel <= max_vel && min_vel > 0 && max_vel < 128) { pk->min_velocity = min_vel; @@ -948,25 +944,25 @@ piano_keyboard_set_velocities(PianoKeyboard *pk, int min_vel, int max_vel, int k } void -piano_keyboard_sustain_press(PianoKeyboard *pk) +piano_keyboard_sustain_press (PianoKeyboard* pk) { if (!pk->sustain_new_notes) { - pk->sustain_new_notes = 1; + pk->sustain_new_notes = 1; pk->maybe_stop_sustained_notes = 1; } } void -piano_keyboard_sustain_release(PianoKeyboard *pk) +piano_keyboard_sustain_release (PianoKeyboard* pk) { if (pk->maybe_stop_sustained_notes) - stop_sustained_notes(pk); + stop_sustained_notes (pk); pk->sustain_new_notes = 0; } void -piano_keyboard_set_note_on(PianoKeyboard *pk, int note) +piano_keyboard_set_note_on (PianoKeyboard* pk, int note) { if (pk->notes[note].pressed == 0) { pk->notes[note].pressed = 1; @@ -975,19 +971,19 @@ piano_keyboard_set_note_on(PianoKeyboard *pk, int note) } void -piano_keyboard_set_note_off(PianoKeyboard *pk, int note) +piano_keyboard_set_note_off (PianoKeyboard* pk, int note) { if (pk->notes[note].pressed || pk->notes[note].sustained) { - pk->notes[note].pressed = 0; + pk->notes[note].pressed = 0; pk->notes[note].sustained = 0; queue_note_draw (pk, note); } } void -piano_keyboard_set_octave (PianoKeyboard *pk, int octave) +piano_keyboard_set_octave (PianoKeyboard* pk, int octave) { - stop_unsustained_notes(pk); + stop_unsustained_notes (pk); if (pk->octave < -1) { pk->octave = -1; @@ -997,13 +993,13 @@ piano_keyboard_set_octave (PianoKeyboard *pk, int octave) pk->octave = octave; piano_keyboard_set_octave_range (pk, pk->octave_range); - gtk_widget_queue_draw(GTK_WIDGET(pk)); + gtk_widget_queue_draw (GTK_WIDGET (pk)); } void -piano_keyboard_set_octave_range (PianoKeyboard *pk, int octave_range) +piano_keyboard_set_octave_range (PianoKeyboard* pk, int octave_range) { - stop_unsustained_notes(pk); + stop_unsustained_notes (pk); if (octave_range < 2) { octave_range = 2; @@ -1064,27 +1060,26 @@ piano_keyboard_set_octave_range (PianoKeyboard *pk, int octave_range) pk->min_note = MAX (0, pk->max_note - octave_range * 12); } - recompute_dimensions(pk); - gtk_widget_queue_draw(GTK_WIDGET(pk)); + recompute_dimensions (pk); + gtk_widget_queue_draw (GTK_WIDGET (pk)); } void -piano_keyboard_set_keyboard_layout(PianoKeyboard *pk, const char *layout) +piano_keyboard_set_keyboard_layout (PianoKeyboard* pk, const char* layout) { - assert(layout); - - if (!g_ascii_strcasecmp(layout, "QWERTY")) { - bind_keys_qwerty(pk); + assert (layout); - } else if (!g_ascii_strcasecmp(layout, "QWERTZ")) { - bind_keys_qwertz(pk); + if (!g_ascii_strcasecmp (layout, "QWERTY")) { + bind_keys_qwerty (pk); - } else if (!g_ascii_strcasecmp(layout, "AZERTY")) { - bind_keys_azerty(pk); + } else if (!g_ascii_strcasecmp (layout, "QWERTZ")) { + bind_keys_qwertz (pk); - } else if (!g_ascii_strcasecmp(layout, "DVORAK")) { - bind_keys_dvorak(pk); + } else if (!g_ascii_strcasecmp (layout, "AZERTY")) { + bind_keys_azerty (pk); + } else if (!g_ascii_strcasecmp (layout, "DVORAK")) { + bind_keys_dvorak (pk); } else { assert (0); } diff --git a/gtk2_ardour/gtk_pianokeyboard.h b/gtk2_ardour/gtk_pianokeyboard.h index 8e15ae9ef8..8414017e58 100644 --- a/gtk2_ardour/gtk_pianokeyboard.h +++ b/gtk2_ardour/gtk_pianokeyboard.h @@ -25,15 +25,15 @@ G_BEGIN_DECLS -#define TYPE_PIANO_KEYBOARD (piano_keyboard_get_type ()) -#define PIANO_KEYBOARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PIANO_KEYBOARD, PianoKeyboard)) -#define PIANO_KEYBOARD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PIANO_KEYBOARD, PianoKeyboardClass)) -#define IS_PIANO_KEYBOARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PIANO_KEYBOARD)) -#define IS_PIANO_KEYBOARD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PIANO_KEYBOARD)) -#define PIANO_KEYBOARD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PIANO_KEYBOARD, PianoKeyboardClass)) +#define TYPE_PIANO_KEYBOARD (piano_keyboard_get_type ()) +#define PIANO_KEYBOARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PIANO_KEYBOARD, PianoKeyboard)) +#define PIANO_KEYBOARD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PIANO_KEYBOARD, PianoKeyboardClass)) +#define IS_PIANO_KEYBOARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PIANO_KEYBOARD)) +#define IS_PIANO_KEYBOARD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PIANO_KEYBOARD)) +#define PIANO_KEYBOARD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PIANO_KEYBOARD, PianoKeyboardClass)) -typedef struct _PianoKeyboard PianoKeyboard; -typedef struct _PianoKeyboardClass PianoKeyboardClass; +typedef struct _PianoKeyboard PianoKeyboard; +typedef struct _PianoKeyboardClass PianoKeyboardClass; #define NNOTES (128) #define PIANO_MIN_NOTE 21 @@ -52,8 +52,7 @@ struct PKNote { int white; /* 1 if key is white; 0 otherwise. */ }; -struct _PianoKeyboard -{ +struct _PianoKeyboard { GtkDrawingArea da; int maybe_stop_sustained_notes; int sustain_new_notes; @@ -69,34 +68,31 @@ struct _PianoKeyboard int last_key; gboolean monophonic; struct PKNote notes[NNOTES]; - /* Table used to translate from PC keyboard character to MIDI note number. */ - GHashTable* key_bindings; + GHashTable* key_bindings; /**< Table used to translate from PC keyboard character to MIDI note number. */ int min_velocity; int max_velocity; int key_velocity; }; -struct _PianoKeyboardClass -{ +struct _PianoKeyboardClass { GtkDrawingAreaClass parent_class; }; GType piano_keyboard_get_type (void) G_GNUC_CONST; GtkWidget* piano_keyboard_new (void); -void piano_keyboard_sustain_press (PianoKeyboard *pk); -void piano_keyboard_sustain_release (PianoKeyboard *pk); -void piano_keyboard_set_note_on (PianoKeyboard *pk, int note); -void piano_keyboard_set_note_off (PianoKeyboard *pk, int note); -void piano_keyboard_set_keyboard_cue (PianoKeyboard *pk, gboolean enabled); -void piano_keyboard_set_grand_piano_highlight (PianoKeyboard *pk, gboolean enabled); -void piano_keyboard_show_note_label (PianoKeyboard *pk, gboolean enabled); -void piano_keyboard_set_monophonic (PianoKeyboard *pk, gboolean monophonic); -void piano_keyboard_set_octave (PianoKeyboard *pk, int octave); -void piano_keyboard_set_octave_range(PianoKeyboard *pk, int octave_range); - +void piano_keyboard_sustain_press (PianoKeyboard* pk); +void piano_keyboard_sustain_release (PianoKeyboard* pk); +void piano_keyboard_set_note_on (PianoKeyboard* pk, int note); +void piano_keyboard_set_note_off (PianoKeyboard* pk, int note); +void piano_keyboard_set_keyboard_cue (PianoKeyboard* pk, gboolean enabled); +void piano_keyboard_set_grand_piano_highlight (PianoKeyboard* pk, gboolean enabled); +void piano_keyboard_show_note_label (PianoKeyboard* pk, gboolean enabled); +void piano_keyboard_set_monophonic (PianoKeyboard* pk, gboolean monophonic); +void piano_keyboard_set_octave (PianoKeyboard* pk, int octave); +void piano_keyboard_set_octave_range (PianoKeyboard* pk, int octave_range); void piano_keyboard_set_keyboard_layout (PianoKeyboard* pk, const char* layout); -void piano_keyboard_set_velocities (PianoKeyboard *pk, int min_vel, int max_vel, int key_vel); +void piano_keyboard_set_velocities (PianoKeyboard* pk, int min_vel, int max_vel, int key_vel); G_END_DECLS |