[libgtkmusic] Non-recursive automake adopted.



commit 53a5f8859339b0f41cc2e6f3c24d9445766d46f8
Author: Leandro Mattioli <leandro mattioli gmail com>
Date:   Fri Jul 6 12:02:42 2012 -0300

    Non-recursive automake adopted.

 test/TestsGuitar.c          |  247 +++++++++++++++++++++++++++++++++++++++++++
 test/TestsGuitar.vala       |   35 ++++++
 test/TestsMusicalNotes.c    |  158 +++++++++++++++++++++++++++
 test/TestsMusicalNotes.vala |   27 +++++
 test/TestsPiano.c           |  171 ++++++++++++++++++++++++++++++
 test/TestsPiano.vala        |   27 +++++
 6 files changed, 665 insertions(+), 0 deletions(-)
---
diff --git a/test/TestsGuitar.c b/test/TestsGuitar.c
new file mode 100644
index 0000000..a749128
--- /dev/null
+++ b/test/TestsGuitar.c
@@ -0,0 +1,247 @@
+/* TestsGuitar.c generated by valac 0.17.1, the Vala compiler
+ * generated from TestsGuitar.vala, do not modify */
+
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gtk/gtk.h>
+#include <gdk/gdk.h>
+#include <gtkmusic.h>
+#include <stdio.h>
+#include <float.h>
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+#include <gee.h>
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _gtk_music_guitar_string_unref0(var) ((var == NULL) ? NULL : (var = (gtk_music_guitar_string_unref (var), NULL)))
+
+
+
+void note_pressed_callback (GtkWidget* widget, GdkEventButton* event, GtkMusicGuitarPosition* pos);
+gint _vala_main (gchar** args, int args_length1);
+static void _note_pressed_callback_gtk_music_guitar_note_pressed (GtkMusicGuitar* _sender, GtkWidget* widget, GdkEventButton* event, GtkMusicGuitarPosition* pos, gpointer self);
+static void _gtk_main_quit_gtk_widget_destroy (GtkWidget* _sender, gpointer self);
+
+
+static gpointer _g_object_ref0 (gpointer self) {
+	return self ? g_object_ref (self) : NULL;
+}
+
+
+void note_pressed_callback (GtkWidget* widget, GdkEventButton* event, GtkMusicGuitarPosition* pos) {
+	GtkWidget* _tmp0_;
+	GtkMusicGuitar* _tmp1_;
+	GtkMusicGuitar* guitar;
+	FILE* _tmp2_;
+	GtkMusicGuitar* _tmp3_;
+	GtkMusicGuitarPosition* _tmp4_;
+	gchar* _tmp5_ = NULL;
+	gchar* _tmp6_;
+	FILE* _tmp7_;
+	GdkEventButton _tmp8_;
+	guint _tmp9_;
+	g_return_if_fail (widget != NULL);
+	g_return_if_fail (event != NULL);
+	g_return_if_fail (pos != NULL);
+	_tmp0_ = widget;
+	_tmp1_ = _g_object_ref0 (GTK_MUSIC_IS_GUITAR (_tmp0_) ? ((GtkMusicGuitar*) _tmp0_) : NULL);
+	guitar = _tmp1_;
+	_tmp2_ = stdout;
+	_tmp3_ = guitar;
+	_tmp4_ = pos;
+	_tmp5_ = gtk_music_guitar_position_to_note (_tmp3_, _tmp4_);
+	_tmp6_ = _tmp5_;
+	fprintf (_tmp2_, "You clicked a %s!\n", _tmp6_);
+	_g_free0 (_tmp6_);
+	_tmp7_ = stdout;
+	fflush (_tmp7_);
+	_tmp8_ = *event;
+	_tmp9_ = _tmp8_.button;
+	if (_tmp9_ == ((guint) 1)) {
+		GtkMusicGuitar* _tmp10_;
+		GtkMusicGuitarPosition* _tmp11_;
+		gushort _tmp12_;
+		GtkMusicGuitarPosition* _tmp13_;
+		gushort _tmp14_;
+		gfloat* _tmp15_ = NULL;
+		gfloat* _tmp16_;
+		gint _tmp16__length1;
+		_tmp10_ = guitar;
+		_tmp11_ = pos;
+		_tmp12_ = _tmp11_->stringIndex;
+		_tmp13_ = pos;
+		_tmp14_ = _tmp13_->fretIndex;
+		_tmp15_ = g_new0 (gfloat, 4);
+		_tmp15_[0] = 0.0f;
+		_tmp15_[1] = 0.0f;
+		_tmp15_[2] = 0.0f;
+		_tmp15_[3] = 1.0f;
+		_tmp16_ = _tmp15_;
+		_tmp16__length1 = 4;
+		gtk_music_guitar_mark_position (_tmp10_, _tmp12_, _tmp14_, _tmp16_, 4);
+		_tmp16_ = (g_free (_tmp16_), NULL);
+	} else {
+		GtkMusicGuitar* _tmp17_;
+		GtkMusicGuitarPosition* _tmp18_;
+		gushort _tmp19_;
+		GtkMusicGuitarPosition* _tmp20_;
+		gushort _tmp21_;
+		_tmp17_ = guitar;
+		_tmp18_ = pos;
+		_tmp19_ = _tmp18_->stringIndex;
+		_tmp20_ = pos;
+		_tmp21_ = _tmp20_->fretIndex;
+		gtk_music_guitar_unmark_position (_tmp17_, _tmp19_, _tmp21_);
+	}
+	_g_object_unref0 (guitar);
+}
+
+
+static void _note_pressed_callback_gtk_music_guitar_note_pressed (GtkMusicGuitar* _sender, GtkWidget* widget, GdkEventButton* event, GtkMusicGuitarPosition* pos, gpointer self) {
+	note_pressed_callback (widget, event, pos);
+}
+
+
+static void _gtk_main_quit_gtk_widget_destroy (GtkWidget* _sender, gpointer self) {
+	gtk_main_quit ();
+}
+
+
+gint _vala_main (gchar** args, int args_length1) {
+	gint result = 0;
+	GtkWindow* _tmp0_;
+	GtkWindow* _tmp1_;
+	GtkWindow* window;
+	GtkMusicGuitar* _tmp2_;
+	GtkMusicGuitar* _tmp3_;
+	GtkMusicGuitar* guitar;
+	GeeArrayList* _tmp4_;
+	gpointer _tmp5_ = NULL;
+	GtkMusicGuitarString* _tmp6_;
+	GeeArrayList* _tmp7_;
+	gpointer _tmp8_ = NULL;
+	GtkMusicGuitarString* _tmp9_;
+	gfloat* _tmp10_ = NULL;
+	gfloat* _tmp11_;
+	gint _tmp11__length1;
+	gfloat* _tmp12_ = NULL;
+	gfloat* _tmp13_;
+	gint _tmp13__length1;
+	gfloat* _tmp14_ = NULL;
+	gfloat* _tmp15_;
+	gint _tmp15__length1;
+	gfloat* _tmp16_ = NULL;
+	gfloat* _tmp17_;
+	gint _tmp17__length1;
+	gfloat* _tmp18_ = NULL;
+	gfloat* _tmp19_;
+	gint _tmp19__length1;
+	gfloat* _tmp20_ = NULL;
+	gfloat* _tmp21_;
+	gint _tmp21__length1;
+	gfloat* _tmp22_ = NULL;
+	gfloat* _tmp23_;
+	gint _tmp23__length1;
+	gtk_init (&args_length1, &args);
+	_tmp0_ = (GtkWindow*) gtk_window_new (GTK_WINDOW_TOPLEVEL);
+	_tmp1_ = g_object_ref_sink (_tmp0_);
+	window = _tmp1_;
+	_tmp2_ = gtk_music_guitar_new ();
+	_tmp3_ = g_object_ref_sink (_tmp2_);
+	guitar = _tmp3_;
+	g_signal_connect (guitar, "note-pressed", (GCallback) _note_pressed_callback_gtk_music_guitar_note_pressed, NULL);
+	_tmp4_ = guitar->guitarStrings;
+	_tmp5_ = gee_abstract_list_get ((GeeAbstractList*) _tmp4_, 0);
+	_tmp6_ = (GtkMusicGuitarString*) _tmp5_;
+	_tmp6_->vibrate = TRUE;
+	_gtk_music_guitar_string_unref0 (_tmp6_);
+	_tmp7_ = guitar->guitarStrings;
+	_tmp8_ = gee_abstract_list_get ((GeeAbstractList*) _tmp7_, 5);
+	_tmp9_ = (GtkMusicGuitarString*) _tmp8_;
+	_tmp9_->vibrate = TRUE;
+	_gtk_music_guitar_string_unref0 (_tmp9_);
+	gtk_music_guitar_start_animation (guitar);
+	_tmp10_ = g_new0 (gfloat, 4);
+	_tmp10_[0] = 0.4f;
+	_tmp10_[1] = 0.0f;
+	_tmp10_[2] = 0.0f;
+	_tmp10_[3] = 1.0f;
+	_tmp11_ = _tmp10_;
+	_tmp11__length1 = 4;
+	gtk_music_guitar_mark_position (guitar, (gushort) 0, (gushort) 0, _tmp11_, 4);
+	_tmp11_ = (g_free (_tmp11_), NULL);
+	_tmp12_ = g_new0 (gfloat, 4);
+	_tmp12_[0] = 0.0f;
+	_tmp12_[1] = 0.0f;
+	_tmp12_[2] = 0.0f;
+	_tmp12_[3] = 1.0f;
+	_tmp13_ = _tmp12_;
+	_tmp13__length1 = 4;
+	gtk_music_guitar_mark_position (guitar, (gushort) 1, (gushort) 1, _tmp13_, 4);
+	_tmp13_ = (g_free (_tmp13_), NULL);
+	_tmp14_ = g_new0 (gfloat, 4);
+	_tmp14_[0] = 0.0f;
+	_tmp14_[1] = 0.0f;
+	_tmp14_[2] = 0.0f;
+	_tmp14_[3] = 1.0f;
+	_tmp15_ = _tmp14_;
+	_tmp15__length1 = 4;
+	gtk_music_guitar_mark_position (guitar, (gushort) 2, (gushort) 1, _tmp15_, 4);
+	_tmp15_ = (g_free (_tmp15_), NULL);
+	_tmp16_ = g_new0 (gfloat, 4);
+	_tmp16_[0] = 0.0f;
+	_tmp16_[1] = 0.0f;
+	_tmp16_[2] = 0.0f;
+	_tmp16_[3] = 1.0f;
+	_tmp17_ = _tmp16_;
+	_tmp17__length1 = 4;
+	gtk_music_guitar_mark_position (guitar, (gushort) 3, (gushort) 0, _tmp17_, 4);
+	_tmp17_ = (g_free (_tmp17_), NULL);
+	_tmp18_ = g_new0 (gfloat, 4);
+	_tmp18_[0] = 0.0f;
+	_tmp18_[1] = 0.0f;
+	_tmp18_[2] = 0.0f;
+	_tmp18_[3] = 1.0f;
+	_tmp19_ = _tmp18_;
+	_tmp19__length1 = 4;
+	gtk_music_guitar_mark_position (guitar, (gushort) 5, (gushort) 3, _tmp19_, 4);
+	_tmp19_ = (g_free (_tmp19_), NULL);
+	_tmp20_ = g_new0 (gfloat, 4);
+	_tmp20_[0] = 0.0f;
+	_tmp20_[1] = 0.4f;
+	_tmp20_[2] = 0.0f;
+	_tmp20_[3] = 1.0f;
+	_tmp21_ = _tmp20_;
+	_tmp21__length1 = 4;
+	gtk_music_guitar_mark_note (guitar, "A3", _tmp21_, 4);
+	_tmp21_ = (g_free (_tmp21_), NULL);
+	_tmp22_ = g_new0 (gfloat, 4);
+	_tmp22_[0] = 0.0f;
+	_tmp22_[1] = 0.0f;
+	_tmp22_[2] = 0.4f;
+	_tmp22_[3] = 0.7f;
+	_tmp23_ = _tmp22_;
+	_tmp23__length1 = 4;
+	gtk_music_guitar_mark_note (guitar, "C", _tmp23_, 4);
+	_tmp23_ = (g_free (_tmp23_), NULL);
+	gtk_container_add ((GtkContainer*) window, (GtkWidget*) guitar);
+	g_signal_connect ((GtkWidget*) window, "destroy", (GCallback) _gtk_main_quit_gtk_widget_destroy, NULL);
+	gtk_widget_show_all ((GtkWidget*) window);
+	gtk_main ();
+	result = 0;
+	_g_object_unref0 (guitar);
+	_g_object_unref0 (window);
+	return result;
+}
+
+
+int main (int argc, char ** argv) {
+	g_type_init ();
+	return _vala_main (argv, argc);
+}
+
+
+
diff --git a/test/TestsGuitar.vala b/test/TestsGuitar.vala
new file mode 100644
index 0000000..41d6fae
--- /dev/null
+++ b/test/TestsGuitar.vala
@@ -0,0 +1,35 @@
+using Gtk;
+using GtkMusic;
+
+void note_pressed_callback(Widget widget, Gdk.EventButton event, 
+                           GuitarPosition pos) {
+    var guitar = widget as Guitar;
+    stdout.printf("You clicked a %s!\n", guitar.position_to_note(pos));
+    stdout.flush();
+    if(event.button == 1) //left-click
+        guitar.mark_position(pos.stringIndex, pos.fretIndex);
+    else
+        guitar.unmark_position(pos.stringIndex, pos.fretIndex);
+}
+
+int main(string[] args) {
+    Gtk.init (ref args);
+    var window = new Window ();
+    var guitar = new Guitar ();
+    guitar.note_pressed.connect(note_pressed_callback);
+    guitar.guitarStrings[0].vibrate = true;
+    guitar.guitarStrings[5].vibrate = true;
+    guitar.start_animation();
+    guitar.mark_position(0, 0, {0.4f, 0.0f, 0.0f, 1.0f});
+    guitar.mark_position(1, 1);
+    guitar.mark_position(2, 1);
+    guitar.mark_position(3, 0);
+    guitar.mark_position(5, 3);
+    guitar.mark_note("A3", {0.0f, 0.4f, 0.0f, 1.0f});
+    guitar.mark_note("C", {0.0f, 0.0f, 0.4f, 0.7f});
+    window.add (guitar);
+    window.destroy.connect (Gtk.main_quit);
+    window.show_all ();
+    Gtk.main ();
+    return 0;
+}
diff --git a/test/TestsMusicalNotes.c b/test/TestsMusicalNotes.c
new file mode 100644
index 0000000..2abd902
--- /dev/null
+++ b/test/TestsMusicalNotes.c
@@ -0,0 +1,158 @@
+/* TestsMusicalNotes.c generated by valac 0.17.1, the Vala compiler
+ * generated from TestsMusicalNotes.vala, do not modify */
+
+
+#include <glib.h>
+#include <glib-object.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <gtkmusic.h>
+
+#define _g_free0(var) (var = (g_free (var), NULL))
+#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
+
+
+
+gint _vala_main (gchar** args, int args_length1);
+
+
+gint _vala_main (gchar** args, int args_length1) {
+	gint result = 0;
+	gchar* currNote = NULL;
+	gushort currMidi = 0U;
+	GError * _inner_error_ = NULL;
+	{
+		gushort i;
+		i = (gushort) 21;
+		{
+			gboolean _tmp0_;
+			_tmp0_ = TRUE;
+			while (TRUE) {
+				gboolean _tmp1_;
+				gushort _tmp3_;
+				FILE* _tmp4_;
+				gushort _tmp5_;
+				FILE* _tmp6_;
+				_tmp1_ = _tmp0_;
+				if (!_tmp1_) {
+					gushort _tmp2_;
+					_tmp2_ = i;
+					i = _tmp2_ + 1;
+				}
+				_tmp0_ = FALSE;
+				_tmp3_ = i;
+				if (!(((gint) _tmp3_) < 34)) {
+					break;
+				}
+				_tmp4_ = stdout;
+				_tmp5_ = i;
+				fprintf (_tmp4_, "MIDI %u : ", (guint) _tmp5_);
+				_tmp6_ = stdout;
+				fflush (_tmp6_);
+				{
+					gushort _tmp7_;
+					gchar* _tmp8_ = NULL;
+					gchar* _tmp9_;
+					FILE* _tmp10_;
+					const gchar* _tmp11_;
+					_tmp7_ = i;
+					_tmp8_ = gtk_music_musical_notes_get_note_from_midi_code (_tmp7_, &_inner_error_);
+					_tmp9_ = _tmp8_;
+					if (_inner_error_ != NULL) {
+						if (_inner_error_->domain == GTK_MUSIC_MUSICAL_NOTE_ERROR) {
+							goto __catch0_gtk_music_musical_note_error;
+						}
+						_g_free0 (currNote);
+						g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
+						g_clear_error (&_inner_error_);
+						return 0;
+					}
+					_g_free0 (currNote);
+					currNote = _tmp9_;
+					_tmp10_ = stdout;
+					_tmp11_ = currNote;
+					fprintf (_tmp10_, "%s", _tmp11_);
+				}
+				goto __finally0;
+				__catch0_gtk_music_musical_note_error:
+				{
+					GError* m = NULL;
+					FILE* _tmp12_;
+					FILE* _tmp13_;
+					m = _inner_error_;
+					_inner_error_ = NULL;
+					_tmp12_ = stdout;
+					fprintf (_tmp12_, "Invalid MIDI code\n");
+					_tmp13_ = stdout;
+					fflush (_tmp13_);
+					_g_error_free0 (m);
+					continue;
+				}
+				__finally0:
+				if (_inner_error_ != NULL) {
+					_g_free0 (currNote);
+					g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
+					g_clear_error (&_inner_error_);
+					return 0;
+				}
+				{
+					const gchar* _tmp14_;
+					gushort _tmp15_ = 0U;
+					gushort _tmp16_;
+					FILE* _tmp17_;
+					gushort _tmp18_;
+					_tmp14_ = currNote;
+					_tmp15_ = gtk_music_musical_notes_get_note_as_midi_code (_tmp14_, &_inner_error_);
+					_tmp16_ = _tmp15_;
+					if (_inner_error_ != NULL) {
+						if (_inner_error_->domain == GTK_MUSIC_MUSICAL_NOTE_ERROR) {
+							goto __catch1_gtk_music_musical_note_error;
+						}
+						_g_free0 (currNote);
+						g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
+						g_clear_error (&_inner_error_);
+						return 0;
+					}
+					currMidi = _tmp16_;
+					_tmp17_ = stdout;
+					_tmp18_ = currMidi;
+					fprintf (_tmp17_, " (%u) \n", (guint) _tmp18_);
+				}
+				goto __finally1;
+				__catch1_gtk_music_musical_note_error:
+				{
+					GError* m = NULL;
+					FILE* _tmp19_;
+					FILE* _tmp20_;
+					m = _inner_error_;
+					_inner_error_ = NULL;
+					_tmp19_ = stdout;
+					fprintf (_tmp19_, "Invalid note\n");
+					_tmp20_ = stdout;
+					fflush (_tmp20_);
+					_g_error_free0 (m);
+				}
+				__finally1:
+				if (_inner_error_ != NULL) {
+					_g_free0 (currNote);
+					g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
+					g_clear_error (&_inner_error_);
+					return 0;
+				}
+			}
+		}
+	}
+	result = 0;
+	_g_free0 (currNote);
+	return result;
+}
+
+
+int main (int argc, char ** argv) {
+	g_type_init ();
+	return _vala_main (argv, argc);
+}
+
+
+
diff --git a/test/TestsMusicalNotes.vala b/test/TestsMusicalNotes.vala
new file mode 100644
index 0000000..bad9f53
--- /dev/null
+++ b/test/TestsMusicalNotes.vala
@@ -0,0 +1,27 @@
+using GtkMusic;
+
+int main(string[] args) {
+    string currNote;
+    ushort currMidi;
+    for(ushort i = 21; i < 34; i++) {
+        stdout.printf("MIDI %u : ", i); stdout.flush();
+
+        try {
+            currNote = MusicalNotes.get_note_from_midi_code(i);
+            stdout.printf("%s", currNote);
+        }
+        catch (MusicalNoteError m) {
+            stdout.printf("Invalid MIDI code\n"); stdout.flush();
+            continue;
+        }
+
+        try {
+            currMidi = MusicalNotes.get_note_as_midi_code(currNote);
+            stdout.printf(" (%u) \n", currMidi);
+        }
+        catch (MusicalNoteError m) {
+            stdout.printf("Invalid note\n"); stdout.flush();
+        }
+    }
+    return 0;
+}
diff --git a/test/TestsPiano.c b/test/TestsPiano.c
new file mode 100644
index 0000000..bf63dbb
--- /dev/null
+++ b/test/TestsPiano.c
@@ -0,0 +1,171 @@
+/* TestsPiano.c generated by valac 0.17.1, the Vala compiler
+ * generated from TestsPiano.vala, do not modify */
+
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gtk/gtk.h>
+#include <gdk/gdk.h>
+#include <gtkmusic.h>
+#include <stdio.h>
+#include <float.h>
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+
+
+
+void note_pressed_callback (GtkWidget* widget, GdkEventButton* event, gint key);
+gint _vala_main (gchar** args, int args_length1);
+static void _note_pressed_callback_gtk_music_piano_note_pressed (GtkMusicPiano* _sender, GtkWidget* widget, GdkEventButton* event, gint midi_note, gpointer self);
+static void _gtk_main_quit_gtk_widget_destroy (GtkWidget* _sender, gpointer self);
+
+
+static gpointer _g_object_ref0 (gpointer self) {
+	return self ? g_object_ref (self) : NULL;
+}
+
+
+void note_pressed_callback (GtkWidget* widget, GdkEventButton* event, gint key) {
+	GtkWidget* _tmp0_;
+	GtkMusicPiano* _tmp1_;
+	GtkMusicPiano* piano;
+	FILE* _tmp2_;
+	gint _tmp3_;
+	FILE* _tmp4_;
+	GdkEventButton _tmp5_;
+	guint _tmp6_;
+	g_return_if_fail (widget != NULL);
+	g_return_if_fail (event != NULL);
+	_tmp0_ = widget;
+	_tmp1_ = _g_object_ref0 (GTK_MUSIC_IS_PIANO (_tmp0_) ? ((GtkMusicPiano*) _tmp0_) : NULL);
+	piano = _tmp1_;
+	_tmp2_ = stdout;
+	_tmp3_ = key;
+	fprintf (_tmp2_, "You clicked key %d  ", _tmp3_);
+	_tmp4_ = stdout;
+	fflush (_tmp4_);
+	_tmp5_ = *event;
+	_tmp6_ = _tmp5_.button;
+	if (_tmp6_ == ((guint) 1)) {
+		GtkMusicPiano* _tmp7_;
+		gint _tmp8_;
+		gfloat* _tmp9_ = NULL;
+		gfloat* _tmp10_;
+		gint _tmp10__length1;
+		_tmp7_ = piano;
+		_tmp8_ = key;
+		_tmp9_ = g_new0 (gfloat, 4);
+		_tmp9_[0] = 0.0f;
+		_tmp9_[1] = 0.0f;
+		_tmp9_[2] = 0.5f;
+		_tmp9_[3] = 1.0f;
+		_tmp10_ = _tmp9_;
+		_tmp10__length1 = 4;
+		gtk_music_piano_mark_midi (_tmp7_, (gushort) _tmp8_, _tmp10_, 4);
+		_tmp10_ = (g_free (_tmp10_), NULL);
+	} else {
+		GtkMusicPiano* _tmp11_;
+		gint _tmp12_;
+		_tmp11_ = piano;
+		_tmp12_ = key;
+		gtk_music_piano_unmark_midi (_tmp11_, (gushort) _tmp12_);
+	}
+	_g_object_unref0 (piano);
+}
+
+
+static void _note_pressed_callback_gtk_music_piano_note_pressed (GtkMusicPiano* _sender, GtkWidget* widget, GdkEventButton* event, gint midi_note, gpointer self) {
+	note_pressed_callback (widget, event, midi_note);
+}
+
+
+static void _gtk_main_quit_gtk_widget_destroy (GtkWidget* _sender, gpointer self) {
+	gtk_main_quit ();
+}
+
+
+gint _vala_main (gchar** args, int args_length1) {
+	gint result = 0;
+	GtkWindow* _tmp0_;
+	GtkWindow* _tmp1_;
+	GtkWindow* window;
+	GtkMusicPiano* _tmp2_;
+	GtkMusicPiano* _tmp3_;
+	GtkMusicPiano* piano;
+	gfloat* _tmp4_ = NULL;
+	gfloat* _tmp5_;
+	gint _tmp5__length1;
+	gfloat* _tmp6_ = NULL;
+	gfloat* _tmp7_;
+	gint _tmp7__length1;
+	gfloat* _tmp8_ = NULL;
+	gfloat* _tmp9_;
+	gint _tmp9__length1;
+	gfloat* _tmp10_ = NULL;
+	gfloat* _tmp11_;
+	gint _tmp11__length1;
+	gtk_init (&args_length1, &args);
+	_tmp0_ = (GtkWindow*) gtk_window_new (GTK_WINDOW_TOPLEVEL);
+	_tmp1_ = g_object_ref_sink (_tmp0_);
+	window = _tmp1_;
+	_tmp2_ = gtk_music_piano_new ();
+	_tmp3_ = g_object_ref_sink (_tmp2_);
+	piano = _tmp3_;
+	g_signal_connect (piano, "note-pressed", (GCallback) _note_pressed_callback_gtk_music_piano_note_pressed, NULL);
+	_tmp4_ = g_new0 (gfloat, 4);
+	_tmp4_[0] = 0.0f;
+	_tmp4_[1] = 0.0f;
+	_tmp4_[2] = 0.5f;
+	_tmp4_[3] = 1.0f;
+	_tmp5_ = _tmp4_;
+	_tmp5__length1 = 4;
+	gtk_music_piano_mark_midi (piano, (gushort) 50, _tmp5_, 4);
+	_tmp5_ = (g_free (_tmp5_), NULL);
+	_tmp6_ = g_new0 (gfloat, 4);
+	_tmp6_[0] = 0.4f;
+	_tmp6_[1] = 0.0f;
+	_tmp6_[2] = 0.0f;
+	_tmp6_[3] = 1.0f;
+	_tmp7_ = _tmp6_;
+	_tmp7__length1 = 4;
+	gtk_music_piano_mark_midi (piano, (gushort) 51, _tmp7_, 4);
+	_tmp7_ = (g_free (_tmp7_), NULL);
+	_tmp8_ = g_new0 (gfloat, 4);
+	_tmp8_[0] = 0.0f;
+	_tmp8_[1] = 0.0f;
+	_tmp8_[2] = 0.5f;
+	_tmp8_[3] = 1.0f;
+	_tmp9_ = _tmp8_;
+	_tmp9__length1 = 4;
+	gtk_music_piano_mark_midi (piano, (gushort) 36, _tmp9_, 4);
+	_tmp9_ = (g_free (_tmp9_), NULL);
+	_tmp10_ = g_new0 (gfloat, 4);
+	_tmp10_[0] = 0.0f;
+	_tmp10_[1] = 0.0f;
+	_tmp10_[2] = 0.5f;
+	_tmp10_[3] = 1.0f;
+	_tmp11_ = _tmp10_;
+	_tmp11__length1 = 4;
+	gtk_music_piano_mark_midi (piano, (gushort) 59, _tmp11_, 4);
+	_tmp11_ = (g_free (_tmp11_), NULL);
+	gtk_container_add ((GtkContainer*) window, (GtkWidget*) piano);
+	g_signal_connect ((GtkWidget*) window, "destroy", (GCallback) _gtk_main_quit_gtk_widget_destroy, NULL);
+	gtk_widget_show_all ((GtkWidget*) window);
+	gtk_main ();
+	result = 0;
+	_g_object_unref0 (piano);
+	_g_object_unref0 (window);
+	return result;
+}
+
+
+int main (int argc, char ** argv) {
+	g_type_init ();
+	return _vala_main (argv, argc);
+}
+
+
+
diff --git a/test/TestsPiano.vala b/test/TestsPiano.vala
new file mode 100644
index 0000000..f484240
--- /dev/null
+++ b/test/TestsPiano.vala
@@ -0,0 +1,27 @@
+using Gtk;
+using GtkMusic;
+
+void note_pressed_callback(Widget widget, Gdk.EventButton event, int key) {
+    var piano = widget as Piano;
+    stdout.printf("You clicked key %d  ", key); stdout.flush();
+    if(event.button == 1)
+        piano.mark_midi((ushort) key);
+    else
+        piano.unmark_midi((ushort) key);
+}
+
+int main(string[] args) {
+    Gtk.init (ref args);
+    var window = new Window ();
+    var piano = new Piano ();
+    piano.note_pressed.connect(note_pressed_callback);
+    piano.mark_midi(50);
+    piano.mark_midi(51, {0.4f, 0.0f, 0.0f, 1.0f});
+    piano.mark_midi(36);
+    piano.mark_midi(59);
+    window.add(piano);
+    window.destroy.connect (Gtk.main_quit);
+    window.show_all ();
+    Gtk.main ();
+    return 0;
+}



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