[SCM] gsequencer/upstream: fixed bank index and enhanced AgsDrum banks

jkraehemann-guest at users.alioth.debian.org jkraehemann-guest at users.alioth.debian.org
Sun Jun 14 16:07:00 UTC 2015


The following commit has been merged in the upstream branch:
commit c3f1887a7d1c0a51c10ede16ba5526b6393c95ef
Author: Joël Krähemann <weedlight at gmail.com>
Date:   Fri Apr 10 13:58:49 2015 +0000

    fixed bank index and enhanced AgsDrum banks

diff --git a/src/ags/X/machine/ags_drum.c b/src/ags/X/machine/ags_drum.c
index 47b1b9f..9d523e9 100644
--- a/src/ags/X/machine/ags_drum.c
+++ b/src/ags/X/machine/ags_drum.c
@@ -116,8 +116,6 @@ static gpointer ags_drum_parent_class = NULL;
 
 static AgsConnectableInterface *ags_drum_parent_connectable_interface;
 
-const char *AGS_DRUM_INDEX = "AgsDrumIndex";
-
 GType
 ags_drum_get_type(void)
 {
@@ -317,10 +315,11 @@ ags_drum_init(AgsDrum *drum)
 
   for(i = 0; i < 3; i++)
     for(j = 0; j < 4; j++){
+      drum->index1[4 * i + j] = (GtkToggleButton *) gtk_toggle_button_new_with_label(g_strdup_printf("%d\0",
+												     (4 * i) + (j + 1)));
       gtk_table_attach_defaults(table1,
-				(GtkWidget *) (drum->index1[i * 4 + j] = (GtkToggleButton *) gtk_toggle_button_new()),
-				j, j +1, i, i +1);
-      g_object_set_data((GObject *) drum->index1[i * 4 + j], AGS_DRUM_INDEX, GUINT_TO_POINTER(i * 4 + j));
+				(GtkWidget *) (drum->index1[4 * i + j]),
+				j, j + 1, i, i + 1);
     }
 
   drum->selected1 = drum->index1[0];
@@ -329,10 +328,11 @@ ags_drum_init(AgsDrum *drum)
   drum->selected0 = NULL;
 
   for(j = 0; j < 4; j++){
+    drum->index0[j] = (GtkToggleButton *) gtk_toggle_button_new_with_label(g_strdup_printf("%c\0",
+											   'a' + j));
     gtk_table_attach_defaults(table1,
-			      (GtkWidget *) (drum->index0[j] = (GtkToggleButton *) gtk_toggle_button_new()),
-			      j, j +1, 4, 5);
-    g_object_set_data((GObject *) drum->index0[j], AGS_DRUM_INDEX, GUINT_TO_POINTER(j));
+			      (GtkWidget *) (drum->index0[j]),
+			      j, j + 1, 4, 5);
   }
 
   drum->selected0 = drum->index0[0];
@@ -355,7 +355,12 @@ ags_drum_init(AgsDrum *drum)
 
   drum->led =
     hbox = (GtkHBox *) gtk_hbox_new(FALSE, 16);
-  gtk_table_attach_defaults(table0, (GtkWidget *) hbox, 3, 15, 1, 2);
+  gtk_table_attach(table0,
+		   (GtkWidget *) hbox,
+		   3, 15,
+		   1, 2,
+		   0, 0,
+		   0, 0);
 
   for(i = 0; i < 16; i++){
     toggle_button = (GtkToggleButton *) ags_led_new();
@@ -366,7 +371,12 @@ ags_drum_init(AgsDrum *drum)
   /* pattern */
   drum->pattern =
     hbox = (GtkHBox *) gtk_hbox_new(FALSE, 0);
-  gtk_table_attach_defaults(table0, (GtkWidget *) hbox, 3, 15, 2, 3);
+  gtk_table_attach(table0,
+		   (GtkWidget *) hbox,
+		   3, 15,
+		   2, 3,
+		   0, 0,
+		   0, 0);
 
   for(i = 0; i < 16; i++){
     toggle_button = (GtkToggleButton *) gtk_toggle_button_new();
diff --git a/src/ags/X/machine/ags_drum_callbacks.c b/src/ags/X/machine/ags_drum_callbacks.c
index 07d19e2..9081bad 100644
--- a/src/ags/X/machine/ags_drum_callbacks.c
+++ b/src/ags/X/machine/ags_drum_callbacks.c
@@ -176,7 +176,6 @@ ags_drum_index0_callback(GtkWidget *widget, AgsDrum *drum)
       AgsCopyPatternAudio *copy_pattern_audio;
       GList *list;
       guint64 index0;
-      guint i;
       
       toggle_button = drum->selected0;
       drum->selected0 = NULL;
@@ -187,9 +186,7 @@ ags_drum_index0_callback(GtkWidget *widget, AgsDrum *drum)
 				  AGS_TYPE_COPY_PATTERN_AUDIO);
 
       /* calculate index 0 */
-      for(i = 0; i < 4 && drum->selected0 != drum->index0[i]; i++);
-
-      index0 = i;
+      index0 = ((guint) drum->selected0->button.label_text[0] - 'a');
 
       if(list != NULL){
 	GValue value = {0,};
@@ -238,7 +235,6 @@ ags_drum_index1_callback(GtkWidget *widget, AgsDrum *drum)
       AgsCopyPatternAudio *copy_pattern_audio;
       GList *list;
       guint64 index1;
-      guint i;
       
       toggle_button = drum->selected1;
       drum->selected1 = NULL;
@@ -249,9 +245,7 @@ ags_drum_index1_callback(GtkWidget *widget, AgsDrum *drum)
 				  AGS_TYPE_COPY_PATTERN_AUDIO);
 
       /* calculate index 1 */
-      for(i = 0; i < 12 && drum->selected1 != drum->index1[i]; i++);
-  
-      index1 = i;
+      index1 = ((guint) g_ascii_strtoull(drum->selected1->button.label_text, NULL, 10)) - 1;
 
       if(list != NULL){
 	GValue value = {0,};
@@ -324,15 +318,11 @@ ags_drum_pad_callback(GtkWidget *toggle_button, AgsDrum *drum)
   g_list_free(list_start);
 
   /* calculate index 0 */
-  for(i = 0; i < 4 && drum->selected0 != drum->index0[i]; i++);
-
-  index0 = i;
-
+  index0 = ((guint) drum->selected0->button.label_text[0] - 'a');
+  
   /* calculate index 1 */
-  for(i = 0; i < 12 && drum->selected1 != drum->index1[i]; i++);
+  index1 = ((guint) g_ascii_strtoull(drum->selected1->button.label_text, NULL, 10)) - 1;
   
-  index1 = i;
-
   /* calculate offset / page */
   list_start = 
     list = gtk_container_get_children((GtkContainer *) drum->offset);
diff --git a/src/ags/X/machine/ags_matrix.c b/src/ags/X/machine/ags_matrix.c
index dc18783..a21906d 100644
--- a/src/ags/X/machine/ags_matrix.c
+++ b/src/ags/X/machine/ags_matrix.c
@@ -713,7 +713,6 @@ void
 ags_matrix_input_map_recall(AgsMatrix *matrix, guint input_pad_start)
 {
   AgsAudio *audio;
-  AgsPattern *pattern;
   AgsChannel *source, *current, *destination;
 
   AgsBufferChannel *buffer_channel;
diff --git a/src/ags/X/machine/ags_matrix_callbacks.c b/src/ags/X/machine/ags_matrix_callbacks.c
index f742bfb..83780ef 100644
--- a/src/ags/X/machine/ags_matrix_callbacks.c
+++ b/src/ags/X/machine/ags_matrix_callbacks.c
@@ -80,7 +80,9 @@ ags_matrix_index_callback(GtkWidget *widget, AgsMatrix *matrix)
     if(GTK_TOGGLE_BUTTON(widget) != matrix->selected){
       AgsAudio *audio;
       AgsCopyPatternAudio *recall_copy_pattern_audio, *play_copy_pattern_audio;
+
       GList *list;
+      guint64 index1;
       GValue play_value = {0,};
       GValue recall_value = {0,};
 
@@ -95,7 +97,8 @@ ags_matrix_index_callback(GtkWidget *widget, AgsMatrix *matrix)
       matrix->selected = (GtkToggleButton*) widget;
       ags_matrix_draw_matrix(matrix);
 
-      /* modify port */
+      /*  */
+      index1 = ((guint) g_ascii_strtoull(matrix->selected->button.label_text, NULL, 10)) - 1;
 
       /* recall */
       list = ags_recall_find_type(audio->recall, AGS_TYPE_COPY_PATTERN_AUDIO);
@@ -105,7 +108,7 @@ ags_matrix_index_callback(GtkWidget *widget, AgsMatrix *matrix)
       }
 
       g_value_init(&recall_value, G_TYPE_UINT64);
-      g_value_set_uint64(&recall_value, strtol(matrix->selected->button.label_text, NULL, 10) - 1);
+      g_value_set_uint64(&recall_value, index1);
 
       ags_port_safe_write(recall_copy_pattern_audio->bank_index_1, &recall_value);
 
@@ -134,15 +137,18 @@ ags_matrix_drawing_area_button_press_callback(GtkWidget *widget, GdkEventButton
     AgsTogglePatternBit *toggle_pattern_bit;
     AgsChannel *channel;
     guint i, j;
-
+    guint index1;
+    
     i = (guint) floor((double) event->y / (double) AGS_MATRIX_CELL_HEIGHT);
     j = (guint) floor((double) event->x / (double) AGS_MATRIX_CELL_WIDTH);
 
+    index1 = ((guint) g_ascii_strtoull(matrix->selected->button.label_text, NULL, 10)) - 1;
+    
     channel = ags_channel_nth(AGS_MACHINE(matrix)->audio->input, i + (guint) matrix->adjustment->value);
 
     toggle_pattern_bit = ags_toggle_pattern_bit_new(channel->pattern->data,
 						    i + (guint) matrix->adjustment->value,
-						    0, strtol(matrix->selected->button.label_text, NULL, 10) - 1,
+						    0, index1,
 						    j);
     g_signal_connect(G_OBJECT(toggle_pattern_bit), "refresh-gui\0",
 		     G_CALLBACK(ags_matrix_refresh_gui_callback), matrix);
diff --git a/src/ags/audio/ags_pattern.c b/src/ags/audio/ags_pattern.c
index cd084b0..1694217 100644
--- a/src/ags/audio/ags_pattern.c
+++ b/src/ags/audio/ags_pattern.c
@@ -178,7 +178,7 @@ ags_pattern_class_init(AgsPatternClass *pattern)
 				 0,
 				 G_PARAM_READABLE | G_PARAM_WRITABLE);
   g_object_class_install_property(gobject,
-				  PROP_OFFSET,
+				  PROP_FIRST_INDEX,
 				  param_spec);
 
   /**
@@ -195,7 +195,7 @@ ags_pattern_class_init(AgsPatternClass *pattern)
 				 0,
 				 G_PARAM_READABLE | G_PARAM_WRITABLE);
   g_object_class_install_property(gobject,
-				  PROP_OFFSET,
+				  PROP_SECOND_INDEX,
 				  param_spec);
 
   /**
diff --git a/src/ags/audio/recall/ags_copy_pattern_channel_run.c b/src/ags/audio/recall/ags_copy_pattern_channel_run.c
index 9c89352..752bcc0 100644
--- a/src/ags/audio/recall/ags_copy_pattern_channel_run.c
+++ b/src/ags/audio/recall/ags_copy_pattern_channel_run.c
@@ -408,7 +408,7 @@ ags_copy_pattern_channel_run_sequencer_alloc_callback(AgsDelayAudioRun *delay_au
   
   ags_port_safe_set_property(copy_pattern_channel->pattern,
 			     "second-index\0", &j_value);
-
+  
   /* read pattern port - current bit */
   g_value_init(&current_bit_value, G_TYPE_BOOLEAN);
   ags_port_safe_get_property(copy_pattern_channel->pattern,

-- 
gsequencer packaging



More information about the pkg-multimedia-commits mailing list