[SCM] gsequencer/master: merged patches related to Bug#857934

jkraehemann-guest at users.alioth.debian.org jkraehemann-guest at users.alioth.debian.org
Thu Mar 16 15:42:04 UTC 2017


The following commit has been merged in the master branch:
commit 085d9aa45b7ebe9ec7a1c81db50d4ca737f74238
Author: Joël Krähemann <jkraehemann-guest at users.alioth.debian.org>
Date:   Thu Mar 16 16:40:50 2017 +0100

    merged patches related to Bug#857934

diff --git a/debian/patches/fix-audio-loop.patch b/debian/patches/fix-audio-loop.patch
deleted file mode 100644
index 59b309b..0000000
--- a/debian/patches/fix-audio-loop.patch
+++ /dev/null
@@ -1,102 +0,0 @@
-Description: This patch is considered critical since it fixes mangled function
- availability to change	main loop frequency.
- The main loop which does audio computation has the same frequency as soundcard,
- sequencer, export, audio or channel thread. The frequency changes as you modify
- the buffer size or samplerate.
-Author: Joël Krähmann <jkraehemann at gmail.com>
-Applied-Upstream: 0.7.122.x, http://git.savannah.gnu.org/cgit/gsequencer.git
-Last-Update: 2017-02-05
---- a/ags/audio/thread/ags_audio_loop.c
-+++ b/ags/audio/thread/ags_audio_loop.c
-@@ -68,6 +68,8 @@
- guint ags_audio_loop_get_last_sync(AgsMainLoop *main_loop);
- gboolean ags_audio_loop_monitor(AgsMainLoop *main_loop,
- 				guint time_cycle, guint *time_spent);
-+void ags_audio_loop_change_frequency(AgsMainLoop *main_loop,
-+				     gdouble frequency);
- void ags_audio_loop_finalize(GObject *gobject);
- 
- void ags_audio_loop_start(AgsThread *thread);
-@@ -271,6 +273,7 @@
-   main_loop->get_last_sync = ags_audio_loop_get_last_sync;
-   main_loop->interrupt = NULL;
-   main_loop->monitor = ags_audio_loop_monitor;
-+  main_loop->change_frequency = ags_audio_loop_change_frequency;
- }
- 
- void
-@@ -592,6 +595,74 @@
-   }
- }
- 
-+void
-+ags_audio_loop_change_frequency(AgsMainLoop *main_loop,
-+				gdouble frequency)
-+{
-+  AgsThread *audio_loop, *thread;
-+
-+  audio_loop = AGS_THREAD(main_loop);
-+  
-+  g_object_set(audio_loop,
-+	       "frequency\0", frequency,
-+	       NULL);
-+
-+  /* reset soundcard thread */
-+  thread = audio_loop;
-+
-+  while(ags_thread_find_type(thread, AGS_TYPE_SOUNDCARD_THREAD) != NULL){
-+    g_object_set(thread,
-+		 "frequency\0", frequency,
-+		 NULL);
-+
-+    thread = g_atomic_pointer_get(&(thread->next));
-+  }
-+
-+  /* reset sequencer thread */
-+  thread = audio_loop;
-+
-+  while(ags_thread_find_type(thread, AGS_TYPE_SEQUENCER_THREAD) != NULL){
-+    g_object_set(thread,
-+		 "frequency\0", frequency,
-+		 NULL);
-+
-+    thread = g_atomic_pointer_get(&(thread->next));
-+  }
-+
-+  /* reset export thread */
-+  thread = audio_loop;
-+
-+  while(ags_thread_find_type(thread, AGS_TYPE_EXPORT_THREAD) != NULL){
-+    g_object_set(thread,
-+		 "frequency\0", frequency,
-+		 NULL);
-+
-+    thread = g_atomic_pointer_get(&(thread->next));
-+  }
-+
-+  /* reset audio thread */
-+  thread = audio_loop;
-+
-+  while(ags_thread_find_type(thread, AGS_TYPE_AUDIO_THREAD) != NULL){
-+    g_object_set(thread,
-+		 "frequency\0", frequency,
-+		 NULL);
-+
-+    thread = g_atomic_pointer_get(&(thread->next));
-+  }
-+
-+  /* reset channel thread */
-+  thread = audio_loop;
-+
-+  while(ags_thread_find_type(thread, AGS_TYPE_CHANNEL_THREAD) != NULL){
-+    g_object_set(thread,
-+		 "frequency\0", frequency,
-+		 NULL);
-+
-+    thread = g_atomic_pointer_get(&(thread->next));
-+  }
-+}
-+
- void
- ags_audio_loop_finalize(GObject *gobject)
- {
diff --git a/debian/patches/fix-broken-thread-frequency.diff b/debian/patches/fix-broken-thread-frequency.diff
new file mode 100644
index 0000000..9c44ada
--- /dev/null
+++ b/debian/patches/fix-broken-thread-frequency.diff
@@ -0,0 +1,609 @@
+--- a/ags/audio/task/ags_set_samplerate.c
++++ b/ags/audio/task/ags_set_samplerate.c
+@@ -20,6 +20,7 @@
+ #include <ags/audio/task/ags_set_samplerate.h>
+ 
+ #include <ags/object/ags_application_context.h>
++#include <ags/object/ags_main_loop.h>
+ #include <ags/object/ags_connectable.h>
+ #include <ags/object/ags_soundcard.h>
+ 
+@@ -366,11 +367,12 @@
+ 
+ void
+ ags_set_samplerate_soundcard(AgsSetSamplerate *set_samplerate, GObject *soundcard)
+-{
++{  
+   AgsApplicationContext *application_context;
+   
+   GList *list;
+ 
++  gdouble thread_frequency;
+   guint channels;
+   guint samplerate;
+   guint buffer_size;
+@@ -378,46 +380,62 @@
+ 
+   application_context = ags_soundcard_get_application_context(AGS_SOUNDCARD(soundcard));
+ 
+-  /*  */
+   ags_soundcard_get_presets(AGS_SOUNDCARD(soundcard),
+ 			    &channels,
+ 			    &samplerate,
+ 			    &buffer_size,
+ 			    &format);
+-  
+-  ags_soundcard_set_presets(AGS_SOUNDCARD(soundcard),
+-			    channels,
+-			    set_samplerate->samplerate,
+-			    buffer_size,
+-			    format);
+ 
+   /* reset soundcards */
+   list = ags_sound_provider_get_soundcard(AGS_SOUND_PROVIDER(application_context));
+ 
+-  while(list != NULL){
+-    if(list->data != soundcard){
+-      guint target_channels;
+-      guint target_samplerate;
+-      guint target_buffer_size;
+-      guint target_format;
+-
+-      ags_soundcard_get_presets(AGS_SOUNDCARD(list->data),
+-				&target_channels,
+-				&target_samplerate,
+-				&target_buffer_size,
+-				&target_format);
++  if(soundcard == list->data){
++    /* reset soundcards if applied to first soundcard */
++    ags_soundcard_set_presets(AGS_SOUNDCARD(soundcard),
++			      channels,
++			      set_samplerate->samplerate,
++			      buffer_size,
++			      format);
++
++    /* reset depending soundcards */
++    while(list != NULL){
++      if(list->data != soundcard){
++	guint target_channels;
++	guint target_samplerate;
++	guint target_buffer_size;
++	guint target_format;
++
++	ags_soundcard_get_presets(AGS_SOUNDCARD(list->data),
++				  &target_channels,
++				  &target_samplerate,
++				  &target_buffer_size,
++				  &target_format);
+       
+ 
+-      ags_soundcard_set_presets(AGS_SOUNDCARD(soundcard),
+-				target_channels,
+-				target_samplerate,
+-				buffer_size * (target_samplerate / set_samplerate->samplerate),
+-				target_format);
++	ags_soundcard_set_presets(AGS_SOUNDCARD(soundcard),
++				  target_channels,
++				  target_samplerate,
++				  buffer_size * (target_samplerate / set_samplerate->samplerate),
++				  target_format);
++      }
++
++      list = list->next;
+     }
++    
++    /* reset thread frequency */
++    thread_frequency = set_samplerate->samplerate / buffer_size + AGS_SOUNDCARD_DEFAULT_OVERCLOCK;
+ 
+-    list = list->next;
++    ags_main_loop_change_frequency(AGS_MAIN_LOOP(application_context->main_loop),
++				   thread_frequency);
++  }else{
++    /* it is not first soundcard */
++    ags_soundcard_set_presets(AGS_SOUNDCARD(soundcard),
++			      channels,
++			      set_samplerate->samplerate,
++			      buffer_size * (samplerate / set_samplerate->samplerate),
++			      format);
+   }
+-
++  
+   /* AgsAudio */
+   list = ags_soundcard_get_audio(AGS_SOUNDCARD(soundcard));
+ 
+--- a/ags/audio/task/ags_set_buffer_size.c
++++ b/ags/audio/task/ags_set_buffer_size.c
+@@ -20,6 +20,7 @@
+ #include <ags/audio/task/ags_set_buffer_size.h>
+ 
+ #include <ags/object/ags_application_context.h>
++#include <ags/object/ags_main_loop.h>
+ #include <ags/object/ags_connectable.h>
+ #include <ags/object/ags_soundcard.h>
+ 
+@@ -371,6 +372,7 @@
+   
+   GList *list;
+ 
++  gdouble thread_frequency;
+   guint channels;
+   guint samplerate;
+   guint buffer_size;
+@@ -378,46 +380,56 @@
+ 
+   application_context = ags_soundcard_get_application_context(AGS_SOUNDCARD(soundcard));
+   
+-  /*  */
+   ags_soundcard_get_presets(AGS_SOUNDCARD(soundcard),
+ 			    &channels,
+ 			    &samplerate,
+ 			    &buffer_size,
+ 			    &format);
+-
+-  ags_soundcard_set_presets(AGS_SOUNDCARD(soundcard),
+-			    channels,
+-			    samplerate,
+-			    set_buffer_size->buffer_size,
+-			    format);
+-
++    
+   /* reset soundcards */
+   list = ags_sound_provider_get_soundcard(AGS_SOUND_PROVIDER(application_context));
+ 
+-  while(list != NULL){
+-    if(list->data != soundcard){
+-      guint target_channels;
+-      guint target_samplerate;
+-      guint target_buffer_size;
+-      guint target_format;
+-
+-      ags_soundcard_get_presets(AGS_SOUNDCARD(list->data),
+-				&target_channels,
+-				&target_samplerate,
+-				&target_buffer_size,
+-				&target_format);
++  if(soundcard == list->data){
++    /* reset soundcards if applied to first soundcard */
++    ags_soundcard_set_presets(AGS_SOUNDCARD(soundcard),
++			      channels,
++			      samplerate,
++			      set_buffer_size->buffer_size,
++			      format);
++
++    while(list != NULL){
++      if(list->data != soundcard){
++	guint target_channels;
++	guint target_samplerate;
++	guint target_buffer_size;
++	guint target_format;
++
++	ags_soundcard_get_presets(AGS_SOUNDCARD(list->data),
++				  &target_channels,
++				  &target_samplerate,
++				  &target_buffer_size,
++				  &target_format);
+       
+ 
+-      ags_soundcard_set_presets(AGS_SOUNDCARD(soundcard),
+-				target_channels,
+-				target_samplerate,
+-				set_buffer_size->buffer_size * (target_samplerate / samplerate),
+-				target_format);
++	ags_soundcard_set_presets(AGS_SOUNDCARD(soundcard),
++				  target_channels,
++				  target_samplerate,
++				  set_buffer_size->buffer_size * (target_samplerate / samplerate),
++				  target_format);
++      }
++
++      list = list->next;
+     }
++    
++    /* reset thread frequency */
++    thread_frequency = samplerate / set_buffer_size->buffer_size + AGS_SOUNDCARD_DEFAULT_OVERCLOCK;
+ 
+-    list = list->next;
++    ags_main_loop_change_frequency(AGS_MAIN_LOOP(application_context->main_loop),
++				   thread_frequency);
++  }else{
++    g_warning("buffer size can only adjusted of your very first soundcard\0");
+   }
+-
++  
+   /* AgsAudio */
+   list = ags_soundcard_get_audio(AGS_SOUNDCARD(soundcard));
+ 
+--- a/ags/audio/thread/ags_export_thread.c
++++ b/ags/audio/thread/ags_export_thread.c
+@@ -25,6 +25,7 @@
+ #include <ags/thread/ags_mutex_manager.h>
+ 
+ #include <ags/audio/ags_devout.h>
++#include <ags/audio/jack/ags_jack_devout.h>
+ 
+ #include <math.h>
+ 
+@@ -250,6 +251,9 @@
+     {
+       GObject *soundcard;
+ 
++      guint samplerate;
++      guint buffer_size;
++
+       soundcard = (GObject *) g_value_get_object(value);
+ 
+       if(export_thread->soundcard != NULL){
+@@ -259,9 +263,22 @@
+       if(soundcard != NULL){
+ 	g_object_ref(G_OBJECT(soundcard));
+ 
++	ags_soundcard_get_presets(AGS_SOUNDCARD(soundcard),
++				  NULL,
++				  &samplerate,
++				  &buffer_size,
++				  NULL);
++	
++	g_object_set(export_thread,
++		     "frequency\0", ceil((gdouble) samplerate / (gdouble) buffer_size) + AGS_SOUNDCARD_DEFAULT_OVERCLOCK,
++		     NULL);
++
+ 	if(AGS_IS_DEVOUT(soundcard)){
+ 	  g_atomic_int_or(&(AGS_THREAD(export_thread)->flags),
+ 			  (AGS_THREAD_INTERMEDIATE_POST_SYNC));
++	}else if(AGS_IS_JACK_DEVOUT(soundcard)){
++	  g_atomic_int_and(&(AGS_THREAD(export_thread)->flags),
++			   (~AGS_THREAD_INTERMEDIATE_POST_SYNC));
+ 	}
+       }
+ 
+--- a/ags/object/ags_main_loop.c
++++ b/ags/object/ags_main_loop.c
+@@ -39,6 +39,7 @@
+ enum {
+   INTERRUPT,
+   MONITOR,
++  CHANGE_FREQUENCY,
+   LAST_SIGNAL,
+ };
+ 
+@@ -105,6 +106,25 @@
+ 		 g_cclosure_user_marshal_BOOLEAN__UINT_POINTER,
+ 		 G_TYPE_BOOLEAN, 2,
+ 		 G_TYPE_UINT, G_TYPE_POINTER);
++
++  /**
++   * AgsMainLoop::change-frequency:
++   * @main_loop: the #AgsMainLoop
++   * @frequency: the new frequency
++   *
++   * Change frequency.
++   * 
++   * Since: 0.7.122.2
++   */
++  main_loop_signals[CHANGE_FREQUENCY] =
++    g_signal_new("change-frequency\0",
++		 G_TYPE_FROM_INTERFACE(interface),
++		 G_SIGNAL_RUN_LAST,
++		 G_STRUCT_OFFSET(AgsMainLoopInterface, change_frequency),
++		 NULL, NULL,
++		 g_cclosure_marshal_VOID__DOUBLE,
++		 G_TYPE_NONE, 1,
++		 G_TYPE_DOUBLE);
+ }
+ 
+ /**
+@@ -348,3 +368,21 @@
+   return(has_monitor);
+ }
+ 
++/**
++ * ags_main_loop_change_frequency:
++ * @main_loop: the #AgsMainLoop
++ * @frequency: the new frequency
++ *
++ * Change frequency.
++ *
++ * Since: 0.7.122.2
++ */
++void
++ags_main_loop_change_frequency(AgsMainLoop *main_loop,
++			       gdouble frequency)
++{
++  g_signal_emit(main_loop,
++		main_loop_signals[CHANGE_FREQUENCY],
++		0,
++		frequency);
++}
+--- a/ags/object/ags_main_loop.h
++++ b/ags/object/ags_main_loop.h
+@@ -60,6 +60,9 @@
+ 		    guint time_cycle, guint *time_spent);
+   gboolean (*monitor)(AgsMainLoop *main_loop,
+ 		      guint time_cycle, guint *time_spent);
++
++  void (*change_frequency)(AgsMainLoop *main_loop,
++			   gdouble frequency);
+ };
+ 
+ GType ags_main_loop_get_type();
+@@ -84,4 +87,7 @@
+ gboolean ags_main_loop_monitor(AgsMainLoop *main_loop,
+ 			       guint time_cycle, guint *time_spent);
+ 
++void ags_main_loop_change_frequency(AgsMainLoop *main_loop,
++				    gdouble frequency);
++
+ #endif /*__AGS_MAIN_LOOP_H__*/
+--- a/ags/audio/thread/ags_audio_loop.c
++++ b/ags/audio/thread/ags_audio_loop.c
+@@ -68,6 +68,8 @@
+ guint ags_audio_loop_get_last_sync(AgsMainLoop *main_loop);
+ gboolean ags_audio_loop_monitor(AgsMainLoop *main_loop,
+ 				guint time_cycle, guint *time_spent);
++void ags_audio_loop_change_frequency(AgsMainLoop *main_loop,
++				     gdouble frequency);
+ void ags_audio_loop_finalize(GObject *gobject);
+ 
+ void ags_audio_loop_start(AgsThread *thread);
+@@ -271,6 +273,7 @@
+   main_loop->get_last_sync = ags_audio_loop_get_last_sync;
+   main_loop->interrupt = NULL;
+   main_loop->monitor = ags_audio_loop_monitor;
++  main_loop->change_frequency = ags_audio_loop_change_frequency;
+ }
+ 
+ void
+@@ -592,6 +595,74 @@
+   }
+ }
+ 
++void
++ags_audio_loop_change_frequency(AgsMainLoop *main_loop,
++				gdouble frequency)
++{
++  AgsThread *audio_loop, *thread;
++
++  audio_loop = AGS_THREAD(main_loop);
++  
++  g_object_set(audio_loop,
++	       "frequency\0", frequency,
++	       NULL);
++
++  /* reset soundcard thread */
++  thread = audio_loop;
++
++  while(ags_thread_find_type(thread, AGS_TYPE_SOUNDCARD_THREAD) != NULL){
++    g_object_set(thread,
++		 "frequency\0", frequency,
++		 NULL);
++
++    thread = g_atomic_pointer_get(&(thread->next));
++  }
++
++  /* reset sequencer thread */
++  thread = audio_loop;
++
++  while(ags_thread_find_type(thread, AGS_TYPE_SEQUENCER_THREAD) != NULL){
++    g_object_set(thread,
++		 "frequency\0", frequency,
++		 NULL);
++
++    thread = g_atomic_pointer_get(&(thread->next));
++  }
++
++  /* reset export thread */
++  thread = audio_loop;
++
++  while(ags_thread_find_type(thread, AGS_TYPE_EXPORT_THREAD) != NULL){
++    g_object_set(thread,
++		 "frequency\0", frequency,
++		 NULL);
++
++    thread = g_atomic_pointer_get(&(thread->next));
++  }
++
++  /* reset audio thread */
++  thread = audio_loop;
++
++  while(ags_thread_find_type(thread, AGS_TYPE_AUDIO_THREAD) != NULL){
++    g_object_set(thread,
++		 "frequency\0", frequency,
++		 NULL);
++
++    thread = g_atomic_pointer_get(&(thread->next));
++  }
++
++  /* reset channel thread */
++  thread = audio_loop;
++
++  while(ags_thread_find_type(thread, AGS_TYPE_CHANNEL_THREAD) != NULL){
++    g_object_set(thread,
++		 "frequency\0", frequency,
++		 NULL);
++
++    thread = g_atomic_pointer_get(&(thread->next));
++  }
++}
++
+ void
+ ags_audio_loop_finalize(GObject *gobject)
+ {
+--- a/ags/audio/recall/ags_delay_audio.c
++++ b/ags/audio/recall/ags_delay_audio.c
+@@ -42,10 +42,20 @@
+ void ags_delay_audio_set_ports(AgsPlugin *plugin, GList *port);
+ void ags_delay_audio_finalize(GObject *gobject);
+ 
++void ags_delay_audio_notify_audio_callback(GObject *gobject,
++					   GParamSpec *pspec,
++					   gpointer user_data);
+ void ags_delay_audio_notify_soundcard_callback(GObject *gobject,
+ 					       GParamSpec *pspec,
+ 					       gpointer user_data);
+ 
++void ags_delay_audio_notify_samplerate_callback(GObject *gobject,
++						GParamSpec *pspec,
++						gpointer user_data);
++void ags_delay_audio_notify_buffer_size_callback(GObject *gobject,
++						 GParamSpec *pspec,
++						 gpointer user_data);
++
+ gdouble ags_delay_audio_get_bpm(AgsTactable *tactable);
+ gdouble ags_delay_audio_get_tact(AgsTactable *tactable);
+ gdouble ags_delay_audio_get_sequencer_duration(AgsTactable *tactable);
+@@ -55,6 +65,8 @@
+ void ags_delay_audio_change_sequencer_duration(AgsTactable *tactable, gdouble duration);
+ void ags_delay_audio_change_notation_duration(AgsTactable *tactable, gdouble duration);
+ 
++void ags_delay_audio_refresh_delay(AgsDelayAudio *delay_audio);
++
+ /**
+  * SECTION:ags_delay_audio
+  * @short_description: delay audio 
+@@ -326,7 +338,11 @@
+   AGS_RECALL(delay_audio)->build_id = AGS_RECALL_DEFAULT_BUILD_ID;
+   AGS_RECALL(delay_audio)->xml_type = "ags-delay-audio\0";
+ 
+-  g_signal_connect_after(delay_audio, "notify::soundcard",
++  /* notify some properties to do final configuration */
++  g_signal_connect_after(delay_audio, "notify::audio\0",
++			 G_CALLBACK(ags_delay_audio_notify_audio_callback), NULL);
++
++  g_signal_connect_after(delay_audio, "notify::soundcard\0",
+ 			 G_CALLBACK(ags_delay_audio_notify_soundcard_callback), NULL);
+ }
+ 
+@@ -590,6 +606,30 @@
+ }
+ 
+ void
++ags_delay_audio_notify_audio_callback(GObject *gobject,
++				      GParamSpec *pspec,
++				      gpointer user_data)
++{
++  AgsDelayAudio *delay_audio;
++  
++  AgsAudio *audio;
++  
++  delay_audio = AGS_DELAY_AUDIO(gobject);
++
++  audio = AGS_RECALL_AUDIO(delay_audio)->audio;
++
++  if(audio == NULL){
++    return;
++  }
++
++  g_signal_connect_after(audio, "notify::samplerate\0",
++			 G_CALLBACK(ags_delay_audio_notify_samplerate_callback), delay_audio);
++
++  g_signal_connect_after(audio, "notify::buffer-size\0",
++			 G_CALLBACK(ags_delay_audio_notify_buffer_size_callback), delay_audio);
++}
++
++void
+ ags_delay_audio_notify_soundcard_callback(GObject *gobject,
+ 					  GParamSpec *pspec,
+ 					  gpointer user_data)
+@@ -606,6 +646,11 @@
+   delay_audio = AGS_DELAY_AUDIO(gobject);
+ 
+   soundcard = AGS_RECALL(delay_audio)->soundcard;
++
++  if(soundcard == NULL){
++    return;
++  }
++  
+   port = NULL;
+ 
+   /*  */
+@@ -706,6 +751,30 @@
+   AGS_RECALL(delay_audio)->port = port;
+ }
+ 
++void
++ags_delay_audio_notify_samplerate_callback(GObject *gobject,
++					   GParamSpec *pspec,
++					   gpointer user_data)
++{
++  AgsDelayAudio *delay_audio;
++  
++  delay_audio = AGS_DELAY_AUDIO(user_data);
++
++  ags_delay_audio_refresh_delay(delay_audio);
++}
++
++void
++ags_delay_audio_notify_buffer_size_callback(GObject *gobject,
++					    GParamSpec *pspec,
++					    gpointer user_data)
++{
++  AgsDelayAudio *delay_audio;
++  
++  delay_audio = AGS_DELAY_AUDIO(user_data);
++
++  ags_delay_audio_refresh_delay(delay_audio);
++}
++
+ gdouble
+ ags_delay_audio_get_bpm(AgsTactable *tactable)
+ {
+@@ -884,6 +953,59 @@
+ 
+   /* notation-duration */
+   g_value_reset(&value);
++
++  g_value_set_double(&value, ceil(AGS_NOTATION_DEFAULT_DURATION * delay));
++  ags_port_safe_write(delay_audio->notation_duration, &value);
++
++  /* sequencer-duration */
++  g_value_reset(&value);
++
++  g_value_set_double(&value, ceil(16.0 * delay));
++  ags_port_safe_write(delay_audio->sequencer_duration, &value);
++
++  /* -- finish adjust -- */
++
++  /* emit changed */
++  ags_delay_audio_sequencer_duration_changed(delay_audio);
++}
++
++void
++ags_delay_audio_refresh_delay(AgsDelayAudio *delay_audio)
++{
++  GObject *soundcard;
++
++  gdouble delay;
++  
++  GValue value = {0,};
++  
++  soundcard = AGS_RECALL(delay_audio)->soundcard;
++
++  if(soundcard == NULL){
++    return;
++  }
++  
++  delay = ags_soundcard_get_delay(AGS_SOUNDCARD(soundcard));
++  g_value_init(&value, G_TYPE_DOUBLE);
++
++  /* -- start adjust -- */
++  /* notation-delay */
++  g_value_reset(&value);
++
++  g_value_set_double(&value, delay);
++  ags_port_safe_write(delay_audio->notation_delay, &value);
++
++  //  g_message("notation delay = %f\0", notation_delay * (old_tact / new_tact));
++  
++  /* sequencer-delay */
++  g_value_reset(&value);
++
++  g_value_set_double(&value, delay);
++  ags_port_safe_write(delay_audio->sequencer_delay, &value);
++
++  //  g_message("sequencer delay = %f\0", sequencer_delay * (old_tact / new_tact));
++
++  /* notation-duration */
++  g_value_reset(&value);
+ 
+   g_value_set_double(&value, ceil(AGS_NOTATION_DEFAULT_DURATION * delay));
+   ags_port_safe_write(delay_audio->notation_duration, &value);
diff --git a/debian/patches/fix-delay-audio.patch b/debian/patches/fix-delay-audio.patch
deleted file mode 100644
index e0c1383..0000000
--- a/debian/patches/fix-delay-audio.patch
+++ /dev/null
@@ -1,184 +0,0 @@
-Description: This patch includes a fix against updating samplerate and buffer
- size. This is especially needed as doing configuration in place.
-Author: Joël Krähmann <jkraehemann at gmail.com>
-Applied-Upstream: 0.7.122.x, http://git.savannah.gnu.org/cgit/gsequencer.git
-Last-Update: 2017-02-10
---- a/ags/audio/recall/ags_delay_audio.c
-+++ b/ags/audio/recall/ags_delay_audio.c
-@@ -42,10 +42,20 @@
- void ags_delay_audio_set_ports(AgsPlugin *plugin, GList *port);
- void ags_delay_audio_finalize(GObject *gobject);
- 
-+void ags_delay_audio_notify_audio_callback(GObject *gobject,
-+					   GParamSpec *pspec,
-+					   gpointer user_data);
- void ags_delay_audio_notify_soundcard_callback(GObject *gobject,
- 					       GParamSpec *pspec,
- 					       gpointer user_data);
- 
-+void ags_delay_audio_notify_samplerate_callback(GObject *gobject,
-+						GParamSpec *pspec,
-+						gpointer user_data);
-+void ags_delay_audio_notify_buffer_size_callback(GObject *gobject,
-+						 GParamSpec *pspec,
-+						 gpointer user_data);
-+
- gdouble ags_delay_audio_get_bpm(AgsTactable *tactable);
- gdouble ags_delay_audio_get_tact(AgsTactable *tactable);
- gdouble ags_delay_audio_get_sequencer_duration(AgsTactable *tactable);
-@@ -55,6 +65,8 @@
- void ags_delay_audio_change_sequencer_duration(AgsTactable *tactable, gdouble duration);
- void ags_delay_audio_change_notation_duration(AgsTactable *tactable, gdouble duration);
- 
-+void ags_delay_audio_refresh_delay(AgsDelayAudio *delay_audio);
-+
- /**
-  * SECTION:ags_delay_audio
-  * @short_description: delay audio 
-@@ -326,7 +338,11 @@
-   AGS_RECALL(delay_audio)->build_id = AGS_RECALL_DEFAULT_BUILD_ID;
-   AGS_RECALL(delay_audio)->xml_type = "ags-delay-audio\0";
- 
--  g_signal_connect_after(delay_audio, "notify::soundcard",
-+  /* notify some properties to do final configuration */
-+  g_signal_connect_after(delay_audio, "notify::audio\0",
-+			 G_CALLBACK(ags_delay_audio_notify_audio_callback), NULL);
-+
-+  g_signal_connect_after(delay_audio, "notify::soundcard\0",
- 			 G_CALLBACK(ags_delay_audio_notify_soundcard_callback), NULL);
- }
- 
-@@ -590,6 +606,30 @@
- }
- 
- void
-+ags_delay_audio_notify_audio_callback(GObject *gobject,
-+				      GParamSpec *pspec,
-+				      gpointer user_data)
-+{
-+  AgsDelayAudio *delay_audio;
-+  
-+  AgsAudio *audio;
-+  
-+  delay_audio = AGS_DELAY_AUDIO(gobject);
-+
-+  audio = AGS_RECALL_AUDIO(delay_audio)->audio;
-+
-+  if(audio == NULL){
-+    return;
-+  }
-+
-+  g_signal_connect_after(audio, "notify::samplerate\0",
-+			 G_CALLBACK(ags_delay_audio_notify_samplerate_callback), delay_audio);
-+
-+  g_signal_connect_after(audio, "notify::buffer-size\0",
-+			 G_CALLBACK(ags_delay_audio_notify_buffer_size_callback), delay_audio);
-+}
-+
-+void
- ags_delay_audio_notify_soundcard_callback(GObject *gobject,
- 					  GParamSpec *pspec,
- 					  gpointer user_data)
-@@ -606,6 +646,11 @@
-   delay_audio = AGS_DELAY_AUDIO(gobject);
- 
-   soundcard = AGS_RECALL(delay_audio)->soundcard;
-+
-+  if(soundcard == NULL){
-+    return;
-+  }
-+  
-   port = NULL;
- 
-   /*  */
-@@ -706,6 +751,30 @@
-   AGS_RECALL(delay_audio)->port = port;
- }
- 
-+void
-+ags_delay_audio_notify_samplerate_callback(GObject *gobject,
-+					   GParamSpec *pspec,
-+					   gpointer user_data)
-+{
-+  AgsDelayAudio *delay_audio;
-+  
-+  delay_audio = AGS_DELAY_AUDIO(user_data);
-+
-+  ags_delay_audio_refresh_delay(delay_audio);
-+}
-+
-+void
-+ags_delay_audio_notify_buffer_size_callback(GObject *gobject,
-+					    GParamSpec *pspec,
-+					    gpointer user_data)
-+{
-+  AgsDelayAudio *delay_audio;
-+  
-+  delay_audio = AGS_DELAY_AUDIO(user_data);
-+
-+  ags_delay_audio_refresh_delay(delay_audio);
-+}
-+
- gdouble
- ags_delay_audio_get_bpm(AgsTactable *tactable)
- {
-@@ -884,6 +953,59 @@
- 
-   /* notation-duration */
-   g_value_reset(&value);
-+
-+  g_value_set_double(&value, ceil(AGS_NOTATION_DEFAULT_DURATION * delay));
-+  ags_port_safe_write(delay_audio->notation_duration, &value);
-+
-+  /* sequencer-duration */
-+  g_value_reset(&value);
-+
-+  g_value_set_double(&value, ceil(16.0 * delay));
-+  ags_port_safe_write(delay_audio->sequencer_duration, &value);
-+
-+  /* -- finish adjust -- */
-+
-+  /* emit changed */
-+  ags_delay_audio_sequencer_duration_changed(delay_audio);
-+}
-+
-+void
-+ags_delay_audio_refresh_delay(AgsDelayAudio *delay_audio)
-+{
-+  GObject *soundcard;
-+
-+  gdouble delay;
-+  
-+  GValue value = {0,};
-+  
-+  soundcard = AGS_RECALL(delay_audio)->soundcard;
-+
-+  if(soundcard == NULL){
-+    return;
-+  }
-+  
-+  delay = ags_soundcard_get_delay(AGS_SOUNDCARD(soundcard));
-+  g_value_init(&value, G_TYPE_DOUBLE);
-+
-+  /* -- start adjust -- */
-+  /* notation-delay */
-+  g_value_reset(&value);
-+
-+  g_value_set_double(&value, delay);
-+  ags_port_safe_write(delay_audio->notation_delay, &value);
-+
-+  //  g_message("notation delay = %f\0", notation_delay * (old_tact / new_tact));
-+  
-+  /* sequencer-delay */
-+  g_value_reset(&value);
-+
-+  g_value_set_double(&value, delay);
-+  ags_port_safe_write(delay_audio->sequencer_delay, &value);
-+
-+  //  g_message("sequencer delay = %f\0", sequencer_delay * (old_tact / new_tact));
-+
-+  /* notation-duration */
-+  g_value_reset(&value);
- 
-   g_value_set_double(&value, ceil(AGS_NOTATION_DEFAULT_DURATION * delay));
-   ags_port_safe_write(delay_audio->notation_duration, &value);
diff --git a/debian/patches/fix-export-thread.patch b/debian/patches/fix-export-thread.patch
deleted file mode 100644
index f1d884a..0000000
--- a/debian/patches/fix-export-thread.patch
+++ /dev/null
@@ -1,48 +0,0 @@
-Description: This patch is considered important since it fixes missing
- adjustment of refresh rate of the export thread.
-Author: Joël Krähmann <jkraehemann at gmail.com>
-Applied-Upstream: 0.7.122.x, http://git.savannah.gnu.org/cgit/gsequencer.git
-Last-Update: 2017-02-05
---- a/ags/audio/thread/ags_export_thread.c
-+++ b/ags/audio/thread/ags_export_thread.c
-@@ -25,6 +25,7 @@
- #include <ags/thread/ags_mutex_manager.h>
- 
- #include <ags/audio/ags_devout.h>
-+#include <ags/audio/jack/ags_jack_devout.h>
- 
- #include <math.h>
- 
-@@ -250,6 +251,9 @@
-     {
-       GObject *soundcard;
- 
-+      guint samplerate;
-+      guint buffer_size;
-+
-       soundcard = (GObject *) g_value_get_object(value);
- 
-       if(export_thread->soundcard != NULL){
-@@ -259,9 +263,22 @@
-       if(soundcard != NULL){
- 	g_object_ref(G_OBJECT(soundcard));
- 
-+	ags_soundcard_get_presets(AGS_SOUNDCARD(soundcard),
-+				  NULL,
-+				  &samplerate,
-+				  &buffer_size,
-+				  NULL);
-+	
-+	g_object_set(export_thread,
-+		     "frequency\0", ceil((gdouble) samplerate / (gdouble) buffer_size) + AGS_SOUNDCARD_DEFAULT_OVERCLOCK,
-+		     NULL);
-+
- 	if(AGS_IS_DEVOUT(soundcard)){
- 	  g_atomic_int_or(&(AGS_THREAD(export_thread)->flags),
- 			  (AGS_THREAD_INTERMEDIATE_POST_SYNC));
-+	}else if(AGS_IS_JACK_DEVOUT(soundcard)){
-+	  g_atomic_int_and(&(AGS_THREAD(export_thread)->flags),
-+			   (~AGS_THREAD_INTERMEDIATE_POST_SYNC));
- 	}
-       }
- 
diff --git a/debian/patches/fix-main-loop-c.patch b/debian/patches/fix-main-loop-c.patch
deleted file mode 100644
index dbe10c8..0000000
--- a/debian/patches/fix-main-loop-c.patch
+++ /dev/null
@@ -1,66 +0,0 @@
-Description: This patch is considered critical since it fixes mangled function
- availability to change	main loop frequency.
- The main loop which does audio computation has the same frequency as soundcard,
- sequencer, export, audio or channel thread. The frequency changes as you modify
- the buffer size or samplerate.
-Author: Joël Krähmann <jkraehemann at gmail.com>
-Applied-Upstream: 0.7.122.x, http://git.savannah.gnu.org/cgit/gsequencer.git
-Last-Update: 2017-02-05
---- a/ags/object/ags_main_loop.c
-+++ b/ags/object/ags_main_loop.c
-@@ -39,6 +39,7 @@
- enum {
-   INTERRUPT,
-   MONITOR,
-+  CHANGE_FREQUENCY,
-   LAST_SIGNAL,
- };
- 
-@@ -105,6 +106,25 @@
- 		 g_cclosure_user_marshal_BOOLEAN__UINT_POINTER,
- 		 G_TYPE_BOOLEAN, 2,
- 		 G_TYPE_UINT, G_TYPE_POINTER);
-+
-+  /**
-+   * AgsMainLoop::change-frequency:
-+   * @main_loop: the #AgsMainLoop
-+   * @frequency: the new frequency
-+   *
-+   * Change frequency.
-+   * 
-+   * Since: 0.7.122.2
-+   */
-+  main_loop_signals[CHANGE_FREQUENCY] =
-+    g_signal_new("change-frequency\0",
-+		 G_TYPE_FROM_INTERFACE(interface),
-+		 G_SIGNAL_RUN_LAST,
-+		 G_STRUCT_OFFSET(AgsMainLoopInterface, change_frequency),
-+		 NULL, NULL,
-+		 g_cclosure_marshal_VOID__DOUBLE,
-+		 G_TYPE_NONE, 1,
-+		 G_TYPE_DOUBLE);
- }
- 
- /**
-@@ -348,3 +368,21 @@
-   return(has_monitor);
- }
- 
-+/**
-+ * ags_main_loop_change_frequency:
-+ * @main_loop: the #AgsMainLoop
-+ * @frequency: the new frequency
-+ *
-+ * Change frequency.
-+ *
-+ * Since: 0.7.122.2
-+ */
-+void
-+ags_main_loop_change_frequency(AgsMainLoop *main_loop,
-+			       gdouble frequency)
-+{
-+  g_signal_emit(main_loop,
-+		main_loop_signals[CHANGE_FREQUENCY],
-+		0,
-+		frequency);
-+}
diff --git a/debian/patches/fix-main-loop-h.patch b/debian/patches/fix-main-loop-h.patch
deleted file mode 100644
index 17160c6..0000000
--- a/debian/patches/fix-main-loop-h.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-Description: This patch is considered critical since it fixes mangled function
- availability to change main loop frequency.
- The main loop which does audio computation has the same frequency as soundcard,
- sequencer, export, audio or channel thread. The frequency changes as you modify
- the buffer size or samplerate.
-Author: Joël Krähmann <jkraehemann at gmail.com>
-Applied-Upstream: 0.7.122.x, http://git.savannah.gnu.org/cgit/gsequencer.git
-Last-Update: 2017-02-05
---- a/ags/object/ags_main_loop.h
-+++ b/ags/object/ags_main_loop.h
-@@ -60,6 +60,9 @@
- 		    guint time_cycle, guint *time_spent);
-   gboolean (*monitor)(AgsMainLoop *main_loop,
- 		      guint time_cycle, guint *time_spent);
-+
-+  void (*change_frequency)(AgsMainLoop *main_loop,
-+			   gdouble frequency);
- };
- 
- GType ags_main_loop_get_type();
-@@ -84,4 +87,7 @@
- gboolean ags_main_loop_monitor(AgsMainLoop *main_loop,
- 			       guint time_cycle, guint *time_spent);
- 
-+void ags_main_loop_change_frequency(AgsMainLoop *main_loop,
-+				    gdouble frequency);
-+
- #endif /*__AGS_MAIN_LOOP_H__*/
diff --git a/debian/patches/fix-set-buffer-size.patch b/debian/patches/fix-set-buffer-size.patch
deleted file mode 100644
index 369a9e5..0000000
--- a/debian/patches/fix-set-buffer-size.patch
+++ /dev/null
@@ -1,108 +0,0 @@
-Description: This patch is considered critical since it fixes missing thread
- frequency change. As you modify the buffer size, you have to modify the
- refreshing rate of appropriate threads.
-Author: Joël Krähmann <jkraehemann at gmail.com>
-Applied-Upstream: 0.7.122.x, http://git.savannah.gnu.org/cgit/gsequencer.git
-Last-Update: 2017-02-05
---- a/ags/audio/task/ags_set_buffer_size.c
-+++ b/ags/audio/task/ags_set_buffer_size.c
-@@ -20,6 +20,7 @@
- #include <ags/audio/task/ags_set_buffer_size.h>
- 
- #include <ags/object/ags_application_context.h>
-+#include <ags/object/ags_main_loop.h>
- #include <ags/object/ags_connectable.h>
- #include <ags/object/ags_soundcard.h>
- 
-@@ -371,6 +372,7 @@
-   
-   GList *list;
- 
-+  gdouble thread_frequency;
-   guint channels;
-   guint samplerate;
-   guint buffer_size;
-@@ -378,46 +380,56 @@
- 
-   application_context = ags_soundcard_get_application_context(AGS_SOUNDCARD(soundcard));
-   
--  /*  */
-   ags_soundcard_get_presets(AGS_SOUNDCARD(soundcard),
- 			    &channels,
- 			    &samplerate,
- 			    &buffer_size,
- 			    &format);
--
--  ags_soundcard_set_presets(AGS_SOUNDCARD(soundcard),
--			    channels,
--			    samplerate,
--			    set_buffer_size->buffer_size,
--			    format);
--
-+    
-   /* reset soundcards */
-   list = ags_sound_provider_get_soundcard(AGS_SOUND_PROVIDER(application_context));
- 
--  while(list != NULL){
--    if(list->data != soundcard){
--      guint target_channels;
--      guint target_samplerate;
--      guint target_buffer_size;
--      guint target_format;
--
--      ags_soundcard_get_presets(AGS_SOUNDCARD(list->data),
--				&target_channels,
--				&target_samplerate,
--				&target_buffer_size,
--				&target_format);
-+  if(soundcard == list->data){
-+    /* reset soundcards if applied to first soundcard */
-+    ags_soundcard_set_presets(AGS_SOUNDCARD(soundcard),
-+			      channels,
-+			      samplerate,
-+			      set_buffer_size->buffer_size,
-+			      format);
-+
-+    while(list != NULL){
-+      if(list->data != soundcard){
-+	guint target_channels;
-+	guint target_samplerate;
-+	guint target_buffer_size;
-+	guint target_format;
-+
-+	ags_soundcard_get_presets(AGS_SOUNDCARD(list->data),
-+				  &target_channels,
-+				  &target_samplerate,
-+				  &target_buffer_size,
-+				  &target_format);
-       
- 
--      ags_soundcard_set_presets(AGS_SOUNDCARD(soundcard),
--				target_channels,
--				target_samplerate,
--				set_buffer_size->buffer_size * (target_samplerate / samplerate),
--				target_format);
-+	ags_soundcard_set_presets(AGS_SOUNDCARD(soundcard),
-+				  target_channels,
-+				  target_samplerate,
-+				  set_buffer_size->buffer_size * (target_samplerate / samplerate),
-+				  target_format);
-+      }
-+
-+      list = list->next;
-     }
-+    
-+    /* reset thread frequency */
-+    thread_frequency = samplerate / set_buffer_size->buffer_size + AGS_SOUNDCARD_DEFAULT_OVERCLOCK;
- 
--    list = list->next;
-+    ags_main_loop_change_frequency(AGS_MAIN_LOOP(application_context->main_loop),
-+				   thread_frequency);
-+  }else{
-+    g_warning("buffer size can only adjusted of your very first soundcard\0");
-   }
--
-+  
-   /* AgsAudio */
-   list = ags_soundcard_get_audio(AGS_SOUNDCARD(soundcard));
- 
diff --git a/debian/patches/fix-set-samplerate.patch b/debian/patches/fix-set-samplerate.patch
deleted file mode 100644
index 45a7abd..0000000
--- a/debian/patches/fix-set-samplerate.patch
+++ /dev/null
@@ -1,119 +0,0 @@
-Description: This patch is considered critical since it fixes missing changes
- to thread frequency. As you modify the samplerate, you have to modify the
- refreshing rate of the appropriate threads.
-Author: Joël Krähmann <jkraehemann at gmail.com>
-Applied-Upstream: 0.7.122.x, http://git.savannah.gnu.org/cgit/gsequencer.git
-Last-Update: 2017-02-05
---- a/ags/audio/task/ags_set_samplerate.c
-+++ b/ags/audio/task/ags_set_samplerate.c
-@@ -20,6 +20,7 @@
- #include <ags/audio/task/ags_set_samplerate.h>
- 
- #include <ags/object/ags_application_context.h>
-+#include <ags/object/ags_main_loop.h>
- #include <ags/object/ags_connectable.h>
- #include <ags/object/ags_soundcard.h>
- 
-@@ -366,11 +367,12 @@
- 
- void
- ags_set_samplerate_soundcard(AgsSetSamplerate *set_samplerate, GObject *soundcard)
--{
-+{  
-   AgsApplicationContext *application_context;
-   
-   GList *list;
- 
-+  gdouble thread_frequency;
-   guint channels;
-   guint samplerate;
-   guint buffer_size;
-@@ -378,46 +380,62 @@
- 
-   application_context = ags_soundcard_get_application_context(AGS_SOUNDCARD(soundcard));
- 
--  /*  */
-   ags_soundcard_get_presets(AGS_SOUNDCARD(soundcard),
- 			    &channels,
- 			    &samplerate,
- 			    &buffer_size,
- 			    &format);
--  
--  ags_soundcard_set_presets(AGS_SOUNDCARD(soundcard),
--			    channels,
--			    set_samplerate->samplerate,
--			    buffer_size,
--			    format);
- 
-   /* reset soundcards */
-   list = ags_sound_provider_get_soundcard(AGS_SOUND_PROVIDER(application_context));
- 
--  while(list != NULL){
--    if(list->data != soundcard){
--      guint target_channels;
--      guint target_samplerate;
--      guint target_buffer_size;
--      guint target_format;
--
--      ags_soundcard_get_presets(AGS_SOUNDCARD(list->data),
--				&target_channels,
--				&target_samplerate,
--				&target_buffer_size,
--				&target_format);
-+  if(soundcard == list->data){
-+    /* reset soundcards if applied to first soundcard */
-+    ags_soundcard_set_presets(AGS_SOUNDCARD(soundcard),
-+			      channels,
-+			      set_samplerate->samplerate,
-+			      buffer_size,
-+			      format);
-+
-+    /* reset depending soundcards */
-+    while(list != NULL){
-+      if(list->data != soundcard){
-+	guint target_channels;
-+	guint target_samplerate;
-+	guint target_buffer_size;
-+	guint target_format;
-+
-+	ags_soundcard_get_presets(AGS_SOUNDCARD(list->data),
-+				  &target_channels,
-+				  &target_samplerate,
-+				  &target_buffer_size,
-+				  &target_format);
-       
- 
--      ags_soundcard_set_presets(AGS_SOUNDCARD(soundcard),
--				target_channels,
--				target_samplerate,
--				buffer_size * (target_samplerate / set_samplerate->samplerate),
--				target_format);
-+	ags_soundcard_set_presets(AGS_SOUNDCARD(soundcard),
-+				  target_channels,
-+				  target_samplerate,
-+				  buffer_size * (target_samplerate / set_samplerate->samplerate),
-+				  target_format);
-+      }
-+
-+      list = list->next;
-     }
-+    
-+    /* reset thread frequency */
-+    thread_frequency = set_samplerate->samplerate / buffer_size + AGS_SOUNDCARD_DEFAULT_OVERCLOCK;
- 
--    list = list->next;
-+    ags_main_loop_change_frequency(AGS_MAIN_LOOP(application_context->main_loop),
-+				   thread_frequency);
-+  }else{
-+    /* it is not first soundcard */
-+    ags_soundcard_set_presets(AGS_SOUNDCARD(soundcard),
-+			      channels,
-+			      set_samplerate->samplerate,
-+			      buffer_size * (samplerate / set_samplerate->samplerate),
-+			      format);
-   }
--
-+  
-   /* AgsAudio */
-   list = ags_soundcard_get_audio(AGS_SOUNDCARD(soundcard));
- 
diff --git a/debian/patches/series b/debian/patches/series
index 9ac6fe7..1c10ee0 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,16 +1,10 @@
 fix-possible-division-by-zero.diff
 fix-matrix-callbacks.patch
-fix-delay-audio.patch
 fix-matrix.patch
 mangle-indicator-widget.patch
 fix-souncard-editor-callbacks.patch
-fix-export-thread.patch
-fix-set-buffer-size.patch
-fix-set-samplerate.patch
+fix-broken-thread-frequency.diff
 fix-record-midi-audio-run.patch
-fix-audio-loop.patch
-fix-main-loop-c.patch
-fix-main-loop-h.patch
 fix-jack-midiin.patch
 fix-xorg-application-context.patch
 fix-makefile-am.patch

-- 
gsequencer packaging



More information about the pkg-multimedia-commits mailing list