diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2010-08-02 21:52:21 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2010-08-02 21:52:21 +0000 |
commit | e0edca5a2abd65d869348e4bddb9d07ecc156450 (patch) | |
tree | 3ebb98c670729ee017b4245c4e003f2d013df773 /gtk2_ardour/gtk_pianokeyboard.h | |
parent | 8b0354f91003582c4eafc4f2e1ef7ab2daba22e7 (diff) |
first, incomplete pass at step entry dialog, along with various SVG and PNG files for notes and dynamics notation
git-svn-id: svn://localhost/ardour2/branches/3.0@7529 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/gtk_pianokeyboard.h')
-rw-r--r-- | gtk2_ardour/gtk_pianokeyboard.h | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/gtk2_ardour/gtk_pianokeyboard.h b/gtk2_ardour/gtk_pianokeyboard.h new file mode 100644 index 0000000000..27d9a8a5c2 --- /dev/null +++ b/gtk2_ardour/gtk_pianokeyboard.h @@ -0,0 +1,66 @@ +#ifndef __PIANO_KEYBOARD_H__ +#define __PIANO_KEYBOARD_H__ + +#include <glib.h> +#include <gtk/gtkdrawingarea.h> + +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)) + +typedef struct _PianoKeyboard PianoKeyboard; +typedef struct _PianoKeyboardClass PianoKeyboardClass; + +#define NNOTES 127 + +#define OCTAVE_MIN -1 +#define OCTAVE_MAX 7 + +struct Note { + int pressed; /* 1 if key is in pressed down state. */ + int sustained; /* 1 if note is sustained. */ + int x; /* Distance between the left edge of the key + * and the left edge of the widget, in pixels. */ + int w; /* Width of the key, in pixels. */ + int h; /* Height of the key, in pixels. */ + int white; /* 1 if key is white; 0 otherwise. */ +}; + +struct _PianoKeyboard +{ + GtkDrawingArea da; + int maybe_stop_sustained_notes; + int sustain_new_notes; + int enable_keyboard_cue; + int octave; + int widget_margin; + int note_being_pressed_using_mouse; + volatile struct Note notes[NNOTES]; + /* Table used to translate from PC keyboard character to MIDI note number. */ + GHashTable *key_bindings; +}; + +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, int enabled); +void piano_keyboard_set_octave (PianoKeyboard *pk, int octave); +gboolean piano_keyboard_set_keyboard_layout (PianoKeyboard *pk, const char *layout); + +G_END_DECLS + +#endif /* __PIANO_KEYBOARD_H__ */ + |