Description: fix clipboard and minor improvements The clipboard messes with the data structure of AgsNotation and AgsAutomation. This is fixed by the provided patch. Further some minor improvements seen upstream was applied. Author: Joel Krähemann Origin: upstream Forwarded: not-needed Applied-Upstream: http://git.savannah.nongnu.org/cgit/gsequencer.git/commit/?h=1.4.x&id=bcc44b23807c7ed6eaf96e369c8dcbdc92f1d9ba Last-Update: 2018-05-08 --- This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ --- a/ags/X/ags_export_soundcard.c +++ b/ags/X/ags_export_soundcard.c @@ -202,10 +202,7 @@ gtk_combo_box_text_append_text(export_soundcard->backend, "oss"); #endif - - gtk_combo_box_set_active(GTK_COMBO_BOX(export_soundcard->backend), - 0); - + /* sound card */ label = (GtkLabel *) g_object_new(GTK_TYPE_LABEL, "label", i18n("soundcard"), --- a/ags/X/ags_export_soundcard.h +++ b/ags/X/ags_export_soundcard.h @@ -32,9 +32,9 @@ #define AGS_IS_EXPORT_SOUNDCARD_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE((class), AGS_TYPE_EXPORT_SOUNDCARD)) #define AGS_EXPORT_SOUNDCARD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), AGS_TYPE_EXPORT_SOUNDCARD, AgsExportSoundcardClass)) -#define AGS_EXPORT_SOUNDCARD_FORMAT_WAV "wav\0" -#define AGS_EXPORT_SOUNDCARD_FORMAT_FLAC "flac\0" -#define AGS_EXPORT_SOUNDCARD_FORMAT_OGG "ogg\0" +#define AGS_EXPORT_SOUNDCARD_FORMAT_WAV "wav" +#define AGS_EXPORT_SOUNDCARD_FORMAT_FLAC "flac" +#define AGS_EXPORT_SOUNDCARD_FORMAT_OGG "ogg" typedef struct _AgsExportSoundcard AgsExportSoundcard; typedef struct _AgsExportSoundcardClass AgsExportSoundcardClass; --- a/ags/X/ags_export_window_callbacks.c +++ b/ags/X/ags_export_window_callbacks.c @@ -85,6 +85,10 @@ /* show all */ gtk_widget_show_all(hbox); + gtk_combo_box_set_active(GTK_COMBO_BOX(export_soundcard->backend), + 0); + gtk_combo_box_set_active(GTK_COMBO_BOX(export_soundcard->card), + 0); } void --- a/ags/X/ags_notation_editor.c +++ b/ags/X/ags_notation_editor.c @@ -647,6 +647,8 @@ }else{ notation = ags_notation_new(machine->audio, i); + notation->timestamp->timer.ags_offset.offset = timestamp->timer.ags_offset.offset; + machine->audio->notation = ags_notation_add(machine->audio->notation, notation); } --- a/ags/audio/ags_automation.c +++ b/ags/audio/ags_automation.c @@ -1157,6 +1157,7 @@ g_object_ref(acceleration); if(use_selection_list){ + acceleration->flags |= AGS_ACCELERATION_IS_SELECTED; automation->selection = g_list_insert_sorted(automation->selection, acceleration, (GCompareFunc) ags_automation_add_acceleration_compare_function); @@ -1365,22 +1366,20 @@ void ags_automation_free_selection(AgsAutomation *automation) { - AgsAcceleration *acceleration; GList *list; list = automation->selection; while(list != NULL){ - acceleration = AGS_ACCELERATION(list->data); - acceleration->flags &= (~AGS_ACCELERATION_IS_SELECTED); - g_object_unref(G_OBJECT(acceleration)); + AGS_ACCELERATION(list->data)->flags &= (~AGS_ACCELERATION_IS_SELECTED); list = list->next; } - list = automation->selection; + g_list_free_full(automation->selection, + g_object_unref); + automation->selection = NULL; - g_list_free(list); } /** @@ -1412,12 +1411,12 @@ } }else{ /* add to or replace selection */ - acceleration->flags |= AGS_ACCELERATION_IS_SELECTED; - g_object_ref(acceleration); - if(replace_current_selection){ GList *list; + acceleration->flags |= AGS_ACCELERATION_IS_SELECTED; + g_object_ref(acceleration); + list = g_list_alloc(); list->data = acceleration; @@ -1449,7 +1448,7 @@ acceleration = ags_automation_find_point(automation, x, y, - FALSE); + TRUE); if(acceleration != NULL){ acceleration->flags &= (~AGS_ACCELERATION_IS_SELECTED); @@ -1481,8 +1480,9 @@ list = region; while(list != NULL){ - AGS_ACCELERATION(list->data)->flags |= AGS_ACCELERATION_IS_SELECTED; - g_object_ref(G_OBJECT(list->data)); + ags_automation_add_acceleration(automation, + list->data, + TRUE); list = list->next; } @@ -1493,8 +1493,6 @@ acceleration = AGS_ACCELERATION(region->data); if(!ags_automation_is_acceleration_selected(automation, acceleration)){ - acceleration->flags |= AGS_ACCELERATION_IS_SELECTED; - g_object_ref(G_OBJECT(acceleration)); ags_automation_add_acceleration(automation, acceleration, TRUE); @@ -1556,9 +1554,8 @@ } acceleration = automation->acceleration; - acceleration = acceleration->next; - while(acceleration->next != NULL){ + while(acceleration != NULL){ AGS_ACCELERATION(acceleration->data)->flags |= AGS_ACCELERATION_IS_SELECTED; acceleration = acceleration->next; @@ -1581,6 +1578,7 @@ AgsAcceleration *acceleration; xmlNode *automation_node, *current_acceleration; + xmlNode *timestamp_node; GList *selection; @@ -1599,6 +1597,19 @@ xmlNewProp(automation_node, "control-name", automation->control_name); xmlNewProp(automation_node, "line", g_strdup_printf("%u", automation->line)); + /* timestamp */ + if(automation->timestamp != NULL){ + timestamp_node = xmlNewNode(NULL, + BAD_CAST "timestamp"); + xmlAddChild(automation_node, + timestamp_node); + + xmlNewProp(timestamp_node, + BAD_CAST "offset", + BAD_CAST (g_strdup_printf("%u", AGS_TIMESTAMP(automation->timestamp)->timer.ags_offset.offset))); + } + + /* selection */ selection = automation->selection; if(selection != NULL){ @@ -1844,7 +1855,8 @@ /* add acceleration */ if(!match_timestamp || - x_val < automation->timestamp->timer.ags_offset.offset + AGS_AUTOMATION_DEFAULT_OFFSET){ + (x_val >= automation->timestamp->timer.ags_offset.offset && + x_val < automation->timestamp->timer.ags_offset.offset + AGS_AUTOMATION_DEFAULT_OFFSET)){ acceleration = ags_acceleration_new(); acceleration->x = x_val; @@ -2242,7 +2254,7 @@ !g_ascii_strcasecmp(AGS_AUTOMATION(automation->data)->control_name, specifier) && AGS_AUTOMATION(automation->data)->channel_type == channel_type && - AGS_AUTOMATION(automation->data)->line == AGS_AUTOMATION(automation->data)->line){ + AGS_AUTOMATION(automation->data)->line == line){ break; } @@ -2309,6 +2321,8 @@ } ret_x = AGS_ACCELERATION(acceleration->data)->x; + }else{ + return(G_MAXUINT); } if(!port->port_value_is_pointer){ --- a/ags/audio/ags_notation.c +++ b/ags/audio/ags_notation.c @@ -943,6 +943,7 @@ g_object_ref(note); if(use_selection_list){ + note->flags |= AGS_NOTE_IS_SELECTED; notation->selection = g_list_insert_sorted(notation->selection, note, (GCompareFunc) ags_note_sort_func); @@ -1276,6 +1277,16 @@ void ags_notation_free_selection(AgsNotation *notation) { + GList *list; + + list = notation->selection; + + while(list != NULL){ + AGS_NOTE(list->data)->flags &= (~AGS_NOTE_IS_SELECTED); + + list = list->next; + } + g_list_free_full(notation->selection, g_object_unref); @@ -1300,13 +1311,12 @@ list = notation->notes; while(list != NULL){ - AGS_NOTE(list->data)->flags |= AGS_NOTE_IS_SELECTED; - g_object_ref(G_OBJECT(list->data)); + ags_notation_add_note(notation, + list->data, + TRUE); list = list->next; } - - notation->selection = g_list_copy(notation->notes); } /** @@ -1338,12 +1348,12 @@ } }else{ /* add to or replace selection */ - note->flags |= AGS_NOTE_IS_SELECTED; - g_object_ref(note); - if(replace_current_selection){ GList *list; + note->flags |= AGS_NOTE_IS_SELECTED; + g_object_ref(note); + list = g_list_alloc(); list->data = note; @@ -1421,9 +1431,10 @@ list = region; while(list != NULL){ - AGS_NOTE(list->data)->flags |= AGS_NOTE_IS_SELECTED; - g_object_ref(G_OBJECT(list->data)); - + ags_notation_add_note(notation, + list->data, + TRUE); + list = list->next; } @@ -1433,8 +1444,6 @@ note = AGS_NOTE(region->data); if(!ags_notation_is_note_selected(notation, note)){ - note->flags |= AGS_NOTE_IS_SELECTED; - g_object_ref(G_OBJECT(note)); ags_notation_add_note(notation, note, TRUE); @@ -1882,7 +1891,8 @@ /* add note */ if(!match_timestamp || - x0_val < notation->timestamp->timer.ags_offset.offset + AGS_NOTATION_DEFAULT_OFFSET){ + (x0_val >= notation->timestamp->timer.ags_offset.offset && + x0_val < notation->timestamp->timer.ags_offset.offset + AGS_NOTATION_DEFAULT_OFFSET)){ note = ags_note_new(); note->x[0] = x0_val; --- a/ags/audio/ags_notation.h +++ b/ags/audio/ags_notation.h @@ -45,7 +45,7 @@ #define AGS_NOTATION_DEFAULT_LENGTH (65535.0 / AGS_NOTATION_TICS_PER_BEAT - AGS_NOTATION_MAXIMUM_NOTE_LENGTH) #define AGS_NOTATION_DEFAULT_JIFFIE (60.0 / AGS_NOTATION_DEFAULT_BPM / AGS_NOTATION_TICS_PER_BEAT) #define AGS_NOTATION_DEFAULT_DURATION (AGS_NOTATION_DEFAULT_LENGTH * AGS_NOTATION_DEFAULT_JIFFIE * AGS_MICROSECONDS_PER_SECOND) -#define AGS_NOTATION_DEFAULT_OFFSET (64 * (1 / AGS_NOTATION_MINIMUM_NOTE_LENGTH)) +#define AGS_NOTATION_DEFAULT_OFFSET (64 * (1.0 / AGS_NOTATION_MINIMUM_NOTE_LENGTH)) #define AGS_NOTATION_CLIPBOARD_VERSION "1.2.0" #define AGS_NOTATION_CLIPBOARD_TYPE "AgsNotationClipboardXml" --- a/ags/audio/ags_recall_dssi.c +++ b/ags/audio/ags_recall_dssi.c @@ -564,6 +564,10 @@ DSSI_Descriptor_Function dssi_descriptor; DSSI_Descriptor *plugin_descriptor; + if(!AGS_IS_RECALL_DSSI(recall_dssi)){ + return; + } + /* */ dssi_plugin = ags_dssi_manager_find_dssi_plugin(ags_dssi_manager_get_instance(), recall_dssi->filename, recall_dssi->effect); --- a/ags/audio/ags_recall_lv2.c +++ b/ags/audio/ags_recall_lv2.c @@ -697,8 +697,7 @@ LV2_Descriptor_Function lv2_descriptor; LV2_Descriptor *plugin_descriptor; - if(recall_lv2 == NULL || - !AGS_RECALL_LV2(recall_lv2)){ + if(!AGS_IS_RECALL_LV2(recall_lv2)){ return; } --- a/ags/audio/ags_recycling.c +++ b/ags/audio/ags_recycling.c @@ -675,6 +675,9 @@ g_object_unref); recycling->audio_signal = NULL; + + /* call parent */ + G_OBJECT_CLASS(ags_recycling_parent_class)->dispose(gobject); } void --- a/ags/audio/pulse/ags_pulse_client.c +++ b/ags/audio/pulse/ags_pulse_client.c @@ -757,8 +757,10 @@ if(pulse_client->context == NULL){ return; } - + +#ifdef AGS_WITH_PULSE pa_context_disconnect(pulse_client->context); +#endif pulse_client->flags &= (~AGS_PULSE_CLIENT_ACTIVATED); } --- a/ags/audio/task/ags_export_output.c +++ b/ags/audio/task/ags_export_output.c @@ -494,6 +494,10 @@ tic = export_output->tic; + if(soundcard == NULL){ + return; + } + /* get soundcard mutex */ pthread_mutex_lock(application_mutex); --- a/ags/plugin/ags_lv2_plugin.c +++ b/ags/plugin/ags_lv2_plugin.c @@ -2010,7 +2010,8 @@ } while(lv2_plugin != NULL){ - if(!g_ascii_strcasecmp(pname, + if(AGS_LV2_PLUGIN(lv2_plugin->data)->pname != NULL && + !g_ascii_strcasecmp(pname, AGS_LV2_PLUGIN(lv2_plugin->data)->pname)){ return(lv2_plugin); } --- a/ags/audio/ags_recall_ladspa.c +++ b/ags/audio/ags_recall_ladspa.c @@ -574,6 +574,10 @@ LADSPA_Descriptor_Function ladspa_descriptor; LADSPA_Descriptor *plugin_descriptor; + if(!AGS_IS_RECALL_LADSPA(recall_ladspa)){ + return; + } + /* */ ladspa_plugin = ags_ladspa_manager_find_ladspa_plugin(ags_ladspa_manager_get_instance(), recall_ladspa->filename, recall_ladspa->effect);