1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
|
Description: The configuration from file is broken
This patch does apply correct frequency to audio threads.
Author: Joël Krähemann <jkraehemann@gmail.com>
Origin: upstream
Forwarded: not-needed
Applied-Upstream: 2.1.54
Last-Update: 2019-03-06
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- gsequencer.orig/ags/X/ags_xorg_application_context.c
+++ gsequencer/ags/X/ags_xorg_application_context.c
@@ -1781,18 +1781,24 @@
for(j = 0; j < xpath_object->nodesetval->nodeNr; j++){
if(node[j]->type == XML_ELEMENT_NODE){
+ ags_config_clear(config);
+ ags_simple_file_read_config(simple_file, node[j], &config);
+#if 0
buffer = xmlNodeGetContent(node[j]);
buffer_length = strlen(buffer);
+#endif
break;
}
}
+#if 0
if(buffer != NULL){
// ags_config_clear(ags_config_get_instance());
ags_config_load_from_data(ags_config_get_instance(),
buffer, buffer_length);
}
+#endif
i++;
--- gsequencer.orig/ags/X/file/ags_simple_file.c
+++ gsequencer/ags/X/file/ags_simple_file.c
@@ -1274,12 +1274,40 @@
void
ags_simple_file_read_config(AgsSimpleFile *simple_file, xmlNode *node, AgsConfig **ags_config)
{
+ AgsThread *main_loop;
+
+ AgsApplicationContext *application_context;
AgsConfig *gobject;
gchar *id;
+ gchar *str;
char *buffer;
gsize buffer_length;
+ gdouble samplerate;
+ guint buffer_size;
+ gdouble frequency;
+
+ auto void ags_simple_file_read_config_change_max_precision(AgsThread *thread,
+ gdouble max_precision);
+
+ void ags_simple_file_read_config_change_max_precision(AgsThread *thread,
+ gdouble max_precision)
+ {
+ AgsThread *current;
+
+ g_object_set(thread,
+ "max-precision", max_precision,
+ NULL);
+
+ current = g_atomic_pointer_get(&(thread->children));
+
+ while(current != NULL){
+ ags_simple_file_read_config_change_max_precision(current,
+ max_precision);
+ current = g_atomic_pointer_get(&(thread->next));
+ }
+ }
gobject = *ags_config;
gobject->version = xmlGetProp(node,
@@ -1288,6 +1316,8 @@
gobject->build_id = xmlGetProp(node,
AGS_FILE_BUILD_ID_PROP);
+ application_context = ags_application_context_get_instance();
+
buffer = xmlNodeGetContent(node);
buffer_length = xmlStrlen(buffer);
@@ -1295,6 +1325,30 @@
ags_config_load_from_data(gobject,
buffer, buffer_length);
+
+ /* max-precision */
+ main_loop = ags_concurrency_provider_get_main_loop(AGS_CONCURRENCY_PROVIDER(application_context));
+
+ str = ags_config_get_value(gobject,
+ AGS_CONFIG_THREAD,
+ "max-precision");
+ if(str != NULL){
+ gdouble max_precision;
+
+ /* change max precision */
+ max_precision = g_ascii_strtod(str,
+ NULL);
+
+ ags_simple_file_read_config_change_max_precision(main_loop,
+ max_precision);
+ }
+
+ samplerate = ags_soundcard_helper_config_get_samplerate(gobject);
+ buffer_size = ags_soundcard_helper_config_get_buffer_size(gobject);
+
+ frequency = ceil((gdouble) samplerate / (gdouble) buffer_size) + AGS_SOUNDCARD_DEFAULT_OVERCLOCK;
+ ags_main_loop_change_frequency(AGS_MAIN_LOOP(main_loop),
+ frequency);
}
void
|