[SCM] gsequencer/master: Imported Debian patch 0.4.2-69-1
jkraehemann-guest at users.alioth.debian.org
jkraehemann-guest at users.alioth.debian.org
Fri Jun 19 16:28:00 UTC 2015
The following commit has been merged in the master branch:
commit 04a3ec0f70a6be278428d7dda2817454667aebd9
Author: Joël Krähemann (Maintainer of Advanced Gtk+ Sequencer) <jkraehemann at gmail.com>
Date: Thu Jun 11 11:52:06 2015 +0200
Imported Debian patch 0.4.2-69-1
diff --git a/src/ags/X/ags_audio_preferences.c b/src/ags/X/ags_audio_preferences.c
index 7392bea..170ac74 100644
--- a/src/ags/X/ags_audio_preferences.c
+++ b/src/ags/X/ags_audio_preferences.c
@@ -312,7 +312,9 @@ ags_audio_preferences_apply(AgsApplicable *applicable)
¤t,
0,
&value);
- str = g_strdup(g_value_get_string(&value));
+
+ //FIXME:JK: work-around for alsa-handle
+ str = g_strdup_printf("%s,0", g_value_get_string(&value));
g_message("%s\0", str);
ags_config_set(config,
AGS_CONFIG_DEVOUT,
@@ -360,7 +362,7 @@ ags_audio_preferences_reset(AgsApplicable *applicable)
GtkTreeIter current;
GList *card_id, *card_name;
GValue value = {0,};
- char *device, *str;
+ char *device, *str, *tmp;
guint nth;
gboolean found_card;
int card_num;
@@ -382,14 +384,20 @@ ags_audio_preferences_reset(AgsApplicable *applicable)
str = ags_config_get(config,
AGS_CONFIG_DEVOUT,
"alsa-handle\0");
+ g_message("%s\0", str);
nth = 0;
found_card = FALSE;
while(card_id != NULL){
- if(!g_ascii_strcasecmp(card_id->data,
+ //FIXME:JK: work-around for alsa-handle
+ tmp = g_strdup_printf("%s,0\0",
+ card_id->data);
+ if(!g_ascii_strcasecmp(tmp,
str)){
found_card = TRUE;
}
+
+ g_free(tmp);
if(!found_card){
nth++;
@@ -418,9 +426,6 @@ ags_audio_preferences_reset(AgsApplicable *applicable)
"buffer_size\0", &buffer_size,
NULL);
-
- error = NULL;
-
/* */
gtk_spin_button_set_value(audio_preferences->audio_channels,
(gdouble) channels);
@@ -442,6 +447,8 @@ ags_audio_preferences_reset(AgsApplicable *applicable)
0,
&value);
str = g_strdup(g_value_get_string(&value));
+
+ error = NULL;
ags_devout_pcm_info(str,
&channels_min, &channels_max,
&rate_min, &rate_max,
diff --git a/src/ags/X/ags_audio_preferences.h b/src/ags/X/ags_audio_preferences.h
index e744c49..367335f 100644
--- a/src/ags/X/ags_audio_preferences.h
+++ b/src/ags/X/ags_audio_preferences.h
@@ -34,7 +34,7 @@ typedef struct _AgsAudioPreferencesClass AgsAudioPreferencesClass;
struct _AgsAudioPreferences
{
GtkVBox vbox;
-
+
GtkComboBox *card;
GtkSpinButton *audio_channels;
GtkSpinButton *samplerate;
diff --git a/src/ags/X/ags_audio_preferences_callbacks.c b/src/ags/X/ags_audio_preferences_callbacks.c
index 798fdd0..8c112ff 100644
--- a/src/ags/X/ags_audio_preferences_callbacks.c
+++ b/src/ags/X/ags_audio_preferences_callbacks.c
@@ -77,8 +77,14 @@ ags_audio_preferences_card_changed_callback(GtkComboBox *combo,
AgsSetOutputDevice *set_output_device;
GtkListStore *model;
GtkTreeIter current;
+ gchar *str;
+ guint channels, channels_min, channels_max;
+ guint rate, rate_min, rate_max;
+ guint buffer_size, buffer_size_min, buffer_size_max;
GValue value = {0,};
-
+
+ GError *error;
+
window = AGS_WINDOW(AGS_PREFERENCES(gtk_widget_get_ancestor(GTK_WIDGET(audio_preferences),
AGS_TYPE_PREFERENCES))->window);
devout = AGS_DEVOUT(window->devout);
@@ -95,16 +101,49 @@ ags_audio_preferences_card_changed_callback(GtkComboBox *combo,
0,
&value);
+ str = g_strdup(g_value_get_string(&value));
+
/* create set output device task */
set_output_device = ags_set_output_device_new((GObject *) devout,
- g_strdup(g_value_get_string(&value)));
+ str);
/* append AgsSetOutputDevice */
ags_task_thread_append_task(AGS_TASK_THREAD(AGS_AUDIO_LOOP(AGS_MAIN(devout->ags_main)->main_loop)->task_thread),
AGS_TASK(set_output_device));
/* reset dialog */
- ags_audio_preferences_reset(audio_preferences);
+ error = NULL;
+ ags_devout_pcm_info(str,
+ &channels_min, &channels_max,
+ &rate_min, &rate_max,
+ &buffer_size_min, &buffer_size_max,
+ &error);
+
+ if(error != NULL){
+ GtkMessageDialog *dialog;
+
+ dialog = (GtkMessageDialog *) gtk_message_dialog_new((GtkWindow *) gtk_widget_get_ancestor(GTK_WIDGET(audio_preferences),
+ AGS_TYPE_PREFERENCES),
+ GTK_DIALOG_MODAL,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ "%s\0", error->message);
+ gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_widget_destroy(GTK_WIDGET(dialog));
+
+ gtk_spin_button_set_range(audio_preferences->audio_channels, 0.0, 24.0);
+ gtk_spin_button_set_range(audio_preferences->samplerate, 1.0, 192000.0);
+ gtk_spin_button_set_range(audio_preferences->buffer_size, 1.0, 65535.0);
+
+ return;
+ }
+
+ gtk_spin_button_set_range(audio_preferences->audio_channels,
+ channels_min, channels_max);
+ gtk_spin_button_set_range(audio_preferences->samplerate,
+ rate_min, rate_max);
+ gtk_spin_button_set_range(audio_preferences->buffer_size,
+ buffer_size_min, buffer_size_max);
}
void
diff --git a/src/ags/audio/ags_config.c b/src/ags/audio/ags_config.c
index 1483cdb..8be1774 100644
--- a/src/ags/audio/ags_config.c
+++ b/src/ags/audio/ags_config.c
@@ -223,7 +223,7 @@ ags_config_load_defaults(AgsConfig *config)
ags_config_set(config, ags_config_devout, "buffer-size\0", "940\0");
ags_config_set(config, ags_config_devout, "pcm-channels\0", "2\0");
ags_config_set(config, ags_config_devout, "dsp-channels\0", "2\0");
- ags_config_set(config, ags_config_devout, "alsa-handle\0", "hw:0\0");
+ ags_config_set(config, ags_config_devout, "alsa-handle\0", "hw:0,0\0");
ags_config_set(config, ags_config_recall, "auto-sense\0", "true\0");
}
@@ -495,10 +495,10 @@ ags_config_set(AgsConfig *config, gchar *group, gchar *key, gchar *value)
"alsa-handle\0",
11)){
gchar *alsa_handle;
-
+
alsa_handle = value;
g_object_set(G_OBJECT(devout),
- "device\0", alsa_handle,
+ "device\0", g_strdup_printf("%s\0", alsa_handle),
NULL);
}
}
diff --git a/src/ags/audio/ags_devout.c b/src/ags/audio/ags_devout.c
index 1a7182c..663f9d0 100644
--- a/src/ags/audio/ags_devout.c
+++ b/src/ags/audio/ags_devout.c
@@ -924,8 +924,8 @@ ags_devout_list_cards(GList **card_id, GList **card_name)
snd_ctl_t *card_handle;
snd_ctl_card_info_t *card_info;
char *name;
- gchar *str;
- int card_num;
+ gchar *str, *tmp;
+ int card_num, dev_num;
int error;
*card_id = NULL;
@@ -943,9 +943,10 @@ ags_devout_list_cards(GList **card_id, GList **card_name)
continue;
}
- str = g_strdup_printf("hw:%i\0", card_num);
+ tmp =
+ str = g_strdup_printf("hw:%i\0", card_num);
error = snd_ctl_open(&card_handle, str, 0);
-
+
if(error < 0){
continue;
}
@@ -991,6 +992,7 @@ ags_devout_pcm_info(char *card_id,
guint *buffer_size_min, guint *buffer_size_max,
GError **error)
{
+ char *str;
int rc;
snd_pcm_t *handle;
snd_pcm_hw_params_t *params;
@@ -1002,7 +1004,7 @@ ags_devout_pcm_info(char *card_id,
/* Open PCM device for playback. */
handle = NULL;
-
+
rc = snd_pcm_open(&handle, card_id, SND_PCM_STREAM_PLAYBACK, 0);
if(rc < 0) {
diff --git a/src/ags/main.c b/src/ags/main.c
index 4bfa1b7..54f45a5 100644
--- a/src/ags/main.c
+++ b/src/ags/main.c
@@ -821,7 +821,8 @@ main(int argc, char **argv)
if(!strncmp(argv[i], "--help\0", 7)){
printf("GSequencer `ags` is an audio sequencer and notation editor\n\n\0");
- printf("Usage:\n\t%s\n\t%s\n\t%s\n\t%s\n\nReport bugs to <jkraehemann at gmail.com>\n\0",
+ printf("Usage:\n\t%s\n\t%s\n\t%s\n\t%s\n\n",
+ "Report bugs to <jkraehemann at gmail.com>\n\0",
"--filename file open file\0",
"--single-thread run in single thread mode\0",
"--help display this help and exit\0",
--
gsequencer packaging
More information about the pkg-multimedia-commits
mailing list