annotate Plugins/Output/alsa/configure.c @ 249:a4566101cab4 trunk

[svn] Add two missing casts and update the player buffer description from XMMS to Audacious.
author chainsaw
date Sat, 03 Dec 2005 09:14:33 -0800
parents acae8fa925c3
children 6bafb1360398
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1 /* XMMS - ALSA output plugin
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
2 * Copyright (C) 2001-2003 Matthieu Sozeau <mattam@altern.org>
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
3 * Copyright (C) 2003-2005 Haavard Kvaalen
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
4 *
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
5 * This program is free software; you can redistribute it and/or modify
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
7 * the Free Software Foundation; either version 2 of the License, or
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
8 * (at your option) any later version.
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
9 *
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
13 * GNU General Public License for more details.
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
14 *
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
16 * along with this program; if not, write to the Free Software
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
18 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
19 #include "alsa.h"
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
20 #include <stdio.h>
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
21
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
22 static GtkWidget *configure_win = NULL;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
23 static GtkWidget *buffer_time_spin, *period_time_spin;
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
24 static GtkWidget *softvolume_toggle_button, *thread_buffer_time_spin;
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
25
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
26 static GtkWidget *devices_combo, *mixer_devices_combo;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
27
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
28 static int current_mixer_card;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
29
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
30 #define GET_SPIN_INT(spin) \
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
31 gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin))
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
32 #define GET_TOGGLE(tb) gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(tb))
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
33 #define GET_CHARS(edit) gtk_editable_get_chars(GTK_EDITABLE(edit), 0, -1)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
34
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
35 static void configure_win_ok_cb(GtkWidget * w, gpointer data)
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
36 {
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
37 g_free(alsa_cfg.pcm_device);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
38 alsa_cfg.pcm_device = GET_CHARS(GTK_COMBO(devices_combo)->entry);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
39 alsa_cfg.buffer_time = GET_SPIN_INT(buffer_time_spin);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
40 alsa_cfg.period_time = GET_SPIN_INT(period_time_spin);
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
41 alsa_cfg.thread_buffer_time = GET_SPIN_INT(thread_buffer_time_spin);
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
42 alsa_cfg.soft_volume = GET_TOGGLE(softvolume_toggle_button);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
43 alsa_cfg.mixer_card = current_mixer_card;
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
44 alsa_cfg.mixer_device = GET_CHARS(GTK_COMBO(mixer_devices_combo)->entry);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
45
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
46 alsa_save_config();
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
47 gtk_widget_destroy(configure_win);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
48 }
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
49
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
50 void alsa_save_config(void)
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
51 {
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
52 ConfigDb *cfgfile = bmp_cfg_db_open();
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
53
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
54 bmp_cfg_db_set_int(cfgfile, "ALSA", "buffer_time", alsa_cfg.buffer_time);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
55 bmp_cfg_db_set_int(cfgfile, "ALSA", "period_time", alsa_cfg.period_time);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
56 bmp_cfg_db_set_int(cfgfile, "ALSA", "thread_buffer_time", alsa_cfg.thread_buffer_time);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
57 bmp_cfg_db_set_string(cfgfile,"ALSA","pcm_device", alsa_cfg.pcm_device);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
58 bmp_cfg_db_set_int(cfgfile, "ALSA", "mixer_card", alsa_cfg.mixer_card);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
59 bmp_cfg_db_set_string(cfgfile,"ALSA","mixer_device", alsa_cfg.mixer_device);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
60 bmp_cfg_db_set_bool(cfgfile, "ALSA", "soft_volume",
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
61 alsa_cfg.soft_volume);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
62 bmp_cfg_db_set_int(cfgfile, "ALSA", "volume_left", alsa_cfg.vol.left);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
63 bmp_cfg_db_set_int(cfgfile, "ALSA", "volume_right", alsa_cfg.vol.right);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
64 bmp_cfg_db_close(cfgfile);
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
65 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
66
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
67 static int get_cards(GtkOptionMenu *omenu, GtkSignalFunc cb, int active)
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
68 {
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
69 GtkWidget *menu, *item;
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
70 int card = -1, err, set = 0, curr = -1;
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
71
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
72 menu = gtk_menu_new();
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
73 if ((err = snd_card_next(&card)) != 0)
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
74 g_warning("snd_next_card() failed: %s", snd_strerror(-err));
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
75
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
76 while (card > -1)
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
77 {
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
78 char *label;
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
79
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
80 curr++;
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
81 if (card == active)
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
82 set = curr;
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
83 if ((err = snd_card_get_name(card, &label)) != 0)
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
84 {
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
85 g_warning("snd_carg_get_name() failed: %s",
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
86 snd_strerror(-err));
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
87 break;
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
88 }
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
89
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
90 item = gtk_menu_item_new_with_label(label);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
91 gtk_signal_connect(GTK_OBJECT(item), "activate", cb,
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
92 GINT_TO_POINTER(card));
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
93 gtk_widget_show(item);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
94 gtk_menu_append(GTK_MENU(menu), item);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
95 if ((err = snd_card_next(&card)) != 0)
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
96 {
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
97 g_warning("snd_next_card() failed: %s",
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
98 snd_strerror(-err));
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
99 break;
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
100 }
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
101 }
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
102
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
103 gtk_option_menu_set_menu(omenu, menu);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
104 return set;
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
105 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
106
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
107 static int get_mixer_devices(GtkCombo *combo, int card)
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
108 {
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
109 GList *items = NULL;
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
110 int err;
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
111 snd_mixer_t *mixer;
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
112 snd_mixer_elem_t *current;
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
113
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
114 if ((err = alsa_get_mixer(&mixer, card)) < 0)
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
115 return err;
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
116
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
117 current = snd_mixer_first_elem(mixer);
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
118
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
119 while (current)
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
120 {
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
121 const char *sname = snd_mixer_selem_get_name(current);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
122 if (snd_mixer_selem_is_active(current) &&
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
123 snd_mixer_selem_has_playback_volume(current))
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
124 items = g_list_append(items, g_strdup(sname));
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
125 current = snd_mixer_elem_next(current);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
126 }
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
127
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
128 gtk_combo_set_popdown_strings(combo, items);
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
129
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
130 return 0;
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
131 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
132
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
133 static void get_devices_for_card(GtkCombo *combo, int card)
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
134 {
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
135 GtkWidget *item;
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
136 int pcm_device = -1, err;
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
137 snd_pcm_info_t *pcm_info;
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
138 snd_ctl_t *ctl;
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
139 char dev[64], *card_name;
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
140
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
141 sprintf(dev, "hw:%i", card);
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
142
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
143 if ((err = snd_ctl_open(&ctl, dev, 0)) < 0)
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
144 {
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
145 printf("snd_ctl_open() failed: %s", snd_strerror(-err));
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
146 return;
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
147 }
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
148
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
149 if ((err = snd_card_get_name(card, &card_name)) != 0)
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
150 {
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
151 g_warning("snd_card_get_name() failed: %s", snd_strerror(-err));
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
152 card_name = _("Unknown soundcard");
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
153 }
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
154
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
155 snd_pcm_info_alloca(&pcm_info);
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
156
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
157 for (;;)
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
158 {
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
159 char *device, *descr;
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
160 if ((err = snd_ctl_pcm_next_device(ctl, &pcm_device)) < 0)
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
161 {
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
162 g_warning("snd_ctl_pcm_next_device() failed: %s",
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
163 snd_strerror(-err));
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
164 pcm_device = -1;
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
165 }
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
166 if (pcm_device < 0)
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
167 break;
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
168
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
169 snd_pcm_info_set_device(pcm_info, pcm_device);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
170 snd_pcm_info_set_subdevice(pcm_info, 0);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
171 snd_pcm_info_set_stream(pcm_info, SND_PCM_STREAM_PLAYBACK);
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
172
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
173 if ((err = snd_ctl_pcm_info(ctl, pcm_info)) < 0)
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
174 {
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
175 if (err != -ENOENT)
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
176 g_warning("get_devices_for_card(): "
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
177 "snd_ctl_pcm_info() "
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
178 "failed (%d:%d): %s.", card,
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
179 pcm_device, snd_strerror(-err));
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
180 continue;
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
181 }
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
182
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
183 device = g_strdup_printf("hw:%d,%d", card, pcm_device);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
184 descr = g_strconcat(card_name, ": ",
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
185 snd_pcm_info_get_name(pcm_info),
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
186 " (", device, ")", NULL);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
187 item = gtk_list_item_new_with_label(descr);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
188 gtk_widget_show(item);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
189 g_free(descr);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
190 gtk_combo_set_item_string(combo, GTK_ITEM(item), device);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
191 g_free(device);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
192 gtk_container_add(GTK_CONTAINER(combo->list), item);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
193 }
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
194
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
195 snd_ctl_close(ctl);
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
196 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
197
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
198
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
199
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
200 static void get_devices(GtkCombo *combo)
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
201 {
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
202 GtkWidget *item;
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
203 int card = -1;
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
204 int err = 0;
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
205 char *descr;
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
206
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
207 descr = g_strdup_printf(_("Default PCM device (%s)"), "default");
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
208 item = gtk_list_item_new_with_label(descr);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
209 gtk_widget_show(item);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
210 g_free(descr);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
211 gtk_combo_set_item_string(combo, GTK_ITEM(item), "default");
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
212 gtk_container_add(GTK_CONTAINER(combo->list), item);
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
213
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
214 if ((err = snd_card_next(&card)) != 0)
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
215 {
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
216 g_warning("snd_next_card() failed: %s", snd_strerror(-err));
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
217 return;
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
218 }
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
219
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
220 while (card > -1)
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
221 {
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
222 get_devices_for_card(combo, card);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
223 if ((err = snd_card_next(&card)) != 0)
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
224 {
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
225 g_warning("snd_next_card() failed: %s",
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
226 snd_strerror(-err));
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
227 break;
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
228 }
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
229 }
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
230 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
231
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
232 static void mixer_card_cb(GtkWidget * widget, gpointer card)
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
233 {
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
234 if (current_mixer_card == GPOINTER_TO_INT(card))
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
235 return;
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
236 current_mixer_card = GPOINTER_TO_INT(card);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
237 get_mixer_devices(GTK_COMBO(mixer_devices_combo),
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
238 current_mixer_card);
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
239 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
240
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
241 static void softvolume_toggle_cb(GtkToggleButton * widget, gpointer data)
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
242 {
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
243 gboolean softvolume = gtk_toggle_button_get_active(widget);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
244 gtk_widget_set_sensitive(GTK_WIDGET(data), !softvolume);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
245 gtk_widget_set_sensitive(mixer_devices_combo, !softvolume);
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
246 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
247
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
248 void alsa_configure(void)
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
249 {
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
250 GtkWidget *vbox, *notebook;
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
251 GtkWidget *dev_vbox, *adevice_frame, *adevice_box;
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
252 GtkWidget *mixer_frame, *mixer_box, *mixer_table, *mixer_card_om;
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
253 GtkWidget *mixer_card_label, *mixer_device_label;
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
254 GtkWidget *advanced_vbox, *card_vbox;
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
255 GtkWidget *buffer_frame, *buffer_vbox, *buffer_table;
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
256 GtkWidget *card_frame, *buffer_time_label, *period_time_label;
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
257 GtkWidget *thread_buffer_time_label;
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
258 GtkObject *buffer_time_adj, *period_time_adj, *thread_buffer_time_adj;
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
259 GtkWidget *bbox, *ok, *cancel;
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
260
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
261 int mset;
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
262
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
263 if (configure_win)
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
264 {
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
265 gdk_window_raise(configure_win->window);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
266 return;
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
267 }
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
268
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
269 configure_win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
270 gtk_signal_connect(GTK_OBJECT(configure_win), "destroy",
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
271 GTK_SIGNAL_FUNC(gtk_widget_destroyed),
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
272 &configure_win);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
273 gtk_window_set_title(GTK_WINDOW(configure_win),
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
274 _("ALSA Driver configuration"));
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
275 gtk_window_set_policy(GTK_WINDOW(configure_win),
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
276 FALSE, TRUE, FALSE);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
277 gtk_container_border_width(GTK_CONTAINER(configure_win), 10);
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
278
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
279 vbox = gtk_vbox_new(FALSE, 10);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
280 gtk_container_add(GTK_CONTAINER(configure_win), vbox);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
281
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
282 notebook = gtk_notebook_new();
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
283 gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
284
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
285 dev_vbox = gtk_vbox_new(FALSE, 5);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
286 gtk_container_set_border_width(GTK_CONTAINER(dev_vbox), 5);
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
287
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
288 adevice_frame = gtk_frame_new(_("Audio device:"));
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
289 gtk_box_pack_start(GTK_BOX(dev_vbox), adevice_frame, FALSE, FALSE, 0);
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
290
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
291 adevice_box = gtk_vbox_new(FALSE, 5);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
292 gtk_container_set_border_width(GTK_CONTAINER(adevice_box), 5);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
293 gtk_container_add(GTK_CONTAINER(adevice_frame), adevice_box);
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
294
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
295 devices_combo = gtk_combo_new();
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
296 gtk_box_pack_start(GTK_BOX(adevice_box), devices_combo,
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
297 FALSE, FALSE, 0);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
298 get_devices(GTK_COMBO(devices_combo));
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
299 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(devices_combo)->entry),
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
300 alsa_cfg.pcm_device);
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
301
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
302 mixer_frame = gtk_frame_new(_("Mixer:"));
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
303 gtk_box_pack_start(GTK_BOX(dev_vbox), mixer_frame, FALSE, FALSE, 0);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
304
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
305 mixer_box = gtk_vbox_new(FALSE, 5);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
306 gtk_container_set_border_width(GTK_CONTAINER(mixer_box), 5);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
307 gtk_container_add(GTK_CONTAINER(mixer_frame), mixer_box);
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
308
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
309 softvolume_toggle_button = gtk_check_button_new_with_label(
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
310 _("Use software volume control"));
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
311
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
312 gtk_box_pack_start(GTK_BOX(mixer_box), softvolume_toggle_button,
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
313 FALSE, FALSE, 0);
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
314
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
315 mixer_table = gtk_table_new(2, 2, FALSE);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
316 gtk_table_set_row_spacings(GTK_TABLE(mixer_table), 5);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
317 gtk_table_set_col_spacings(GTK_TABLE(mixer_table), 5);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
318 gtk_box_pack_start(GTK_BOX(mixer_box), mixer_table, FALSE, FALSE, 0);
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
319
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
320 mixer_card_label = gtk_label_new(_("Mixer card:"));
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
321 gtk_label_set_justify(GTK_LABEL(mixer_card_label), GTK_JUSTIFY_LEFT);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
322 gtk_misc_set_alignment(GTK_MISC(mixer_card_label), 0, 0.5);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
323 gtk_table_attach(GTK_TABLE(mixer_table), mixer_card_label,
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
324 0, 1, 0, 1, GTK_FILL, 0, 0, 0);
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
325
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
326 mixer_card_om = gtk_option_menu_new();
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
327 mset = get_cards(GTK_OPTION_MENU(mixer_card_om),
249
a4566101cab4 [svn] Add two missing casts and update the player buffer description from XMMS to Audacious.
chainsaw
parents: 246
diff changeset
328 (GtkSignalFunc)mixer_card_cb, alsa_cfg.mixer_card);
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
329
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
330 gtk_table_attach(GTK_TABLE(mixer_table), mixer_card_om,
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
331 1, 2, 0, 1, GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
332
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
333 mixer_device_label = gtk_label_new(_("Mixer device:"));
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
334 gtk_label_set_justify(GTK_LABEL(mixer_device_label), GTK_JUSTIFY_LEFT);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
335 gtk_misc_set_alignment(GTK_MISC(mixer_device_label), 0, 0.5);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
336 gtk_table_attach(GTK_TABLE(mixer_table), mixer_device_label,
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
337 0, 1, 1, 2, GTK_FILL, 0, 0, 0);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
338 mixer_devices_combo = gtk_combo_new();
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
339 gtk_option_menu_set_history(GTK_OPTION_MENU(mixer_card_om), mset);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
340 get_mixer_devices(GTK_COMBO(mixer_devices_combo), alsa_cfg.mixer_card);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
341 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(mixer_devices_combo)->entry),
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
342 alsa_cfg.mixer_device);
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
343
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
344 gtk_table_attach(GTK_TABLE(mixer_table), mixer_devices_combo,
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
345 1, 2, 1, 2, GTK_FILL | GTK_EXPAND, 0, 0, 0);
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
346
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
347 gtk_signal_connect(GTK_OBJECT(softvolume_toggle_button), "toggled",
246
acae8fa925c3 [svn] Add casts to callbacks in signal handlers to avoid warning. GCC would like a return statement too.
chainsaw
parents: 211
diff changeset
348 (GCallback)softvolume_toggle_cb, mixer_card_om);
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
349 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(softvolume_toggle_button),
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
350 alsa_cfg.soft_volume);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
351
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
352 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), dev_vbox,
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
353 gtk_label_new(_("Device settings")));
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
354
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
355
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
356 advanced_vbox = gtk_vbox_new(FALSE, 0);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
357 gtk_container_set_border_width(GTK_CONTAINER(advanced_vbox), 5);
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
358
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
359 card_frame = gtk_frame_new(_("Soundcard:"));
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
360 gtk_box_pack_start_defaults(GTK_BOX(advanced_vbox), card_frame);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
361
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
362 card_vbox = gtk_vbox_new(FALSE, 0);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
363 gtk_container_add(GTK_CONTAINER(card_frame), card_vbox);
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
364
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
365 gtk_container_set_border_width(GTK_CONTAINER(card_vbox), 5);
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
366
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
367 buffer_table = gtk_table_new(2, 2, TRUE);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
368 gtk_table_set_row_spacings(GTK_TABLE(buffer_table), 5);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
369 gtk_table_set_col_spacings(GTK_TABLE(buffer_table), 5);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
370 gtk_box_pack_start_defaults(GTK_BOX(card_vbox), buffer_table);
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
371
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
372 buffer_time_label = gtk_label_new(_("Buffer time (ms):"));
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
373 gtk_label_set_justify(GTK_LABEL(buffer_time_label), GTK_JUSTIFY_LEFT);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
374 gtk_misc_set_alignment(GTK_MISC(buffer_time_label), 0, 0.5);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
375 gtk_table_attach(GTK_TABLE(buffer_table), buffer_time_label,
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
376 0, 1, 0, 1, GTK_FILL, 0, 0, 0);
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
377
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
378 buffer_time_adj = gtk_adjustment_new(alsa_cfg.buffer_time,
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
379 200, 10000, 100, 100, 100);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
380 buffer_time_spin = gtk_spin_button_new(GTK_ADJUSTMENT(buffer_time_adj),
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
381 8, 0);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
382 gtk_widget_set_usize(buffer_time_spin, 60, -1);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
383 gtk_table_attach(GTK_TABLE(buffer_table), buffer_time_spin,
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
384 1, 2, 0, 1, 0, 0, 0, 0);
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
385
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
386 period_time_label = gtk_label_new(_("Period time (ms):"));
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
387 gtk_label_set_justify(GTK_LABEL(period_time_label), GTK_JUSTIFY_LEFT);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
388 gtk_misc_set_alignment(GTK_MISC(period_time_label), 0, 0.5);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
389 gtk_table_attach(GTK_TABLE(buffer_table), period_time_label,
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
390 0, 1, 1, 2, GTK_FILL, 0, 0, 0);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
391 period_time_adj = gtk_adjustment_new(alsa_cfg.period_time,
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
392 1, 500, 1, 100, 100);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
393 period_time_spin = gtk_spin_button_new(GTK_ADJUSTMENT(period_time_adj),
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
394 8, 0);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
395
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
396 gtk_widget_set_usize(period_time_spin, 60, -1);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
397 gtk_table_attach(GTK_TABLE(buffer_table), period_time_spin,
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
398 1, 2, 1, 2, 0, 0, 0, 0);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
399
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
400
249
a4566101cab4 [svn] Add two missing casts and update the player buffer description from XMMS to Audacious.
chainsaw
parents: 246
diff changeset
401 buffer_frame = gtk_frame_new(_("Audacious:"));
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
402 gtk_box_pack_start_defaults(GTK_BOX(advanced_vbox), buffer_frame);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
403
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
404 buffer_vbox = gtk_vbox_new(FALSE, 0);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
405 gtk_container_add(GTK_CONTAINER(buffer_frame), buffer_vbox);
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
406
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
407 gtk_container_set_border_width(GTK_CONTAINER(buffer_vbox), 5);
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
408
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
409 buffer_table = gtk_table_new(1, 2, TRUE);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
410 gtk_table_set_row_spacings(GTK_TABLE(buffer_table), 5);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
411 gtk_table_set_col_spacings(GTK_TABLE(buffer_table), 5);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
412 gtk_box_pack_start_defaults(GTK_BOX(buffer_vbox), buffer_table);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
413
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
414 thread_buffer_time_label = gtk_label_new(_("Buffer time (ms):"));
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
415 gtk_label_set_justify(GTK_LABEL(thread_buffer_time_label), GTK_JUSTIFY_LEFT);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
416 gtk_misc_set_alignment(GTK_MISC(thread_buffer_time_label), 0, 0.5);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
417 gtk_table_attach(GTK_TABLE(buffer_table), thread_buffer_time_label,
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
418 0, 1, 0, 1, GTK_FILL, 0, 0, 0);
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
419 thread_buffer_time_adj = gtk_adjustment_new(alsa_cfg.thread_buffer_time,
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
420 1000, 10000, 100, 100, 100);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
421 thread_buffer_time_spin =
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
422 gtk_spin_button_new(GTK_ADJUSTMENT(thread_buffer_time_adj), 8, 0);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
423
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
424 gtk_widget_set_usize(thread_buffer_time_spin, 60, -1);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
425 gtk_table_attach(GTK_TABLE(buffer_table), thread_buffer_time_spin,
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
426 1, 2, 0, 1, 0, 0, 0, 0);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
427
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
428 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), advanced_vbox,
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
429 gtk_label_new(_("Advanced settings")));
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
430
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
431 bbox = gtk_hbutton_box_new();
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
432 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
433 gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
434 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0);
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
435
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
436 ok = gtk_button_new_with_label(_("OK"));
246
acae8fa925c3 [svn] Add casts to callbacks in signal handlers to avoid warning. GCC would like a return statement too.
chainsaw
parents: 211
diff changeset
437 gtk_signal_connect(GTK_OBJECT(ok), "clicked", (GCallback)configure_win_ok_cb, NULL);
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
438 GTK_WIDGET_SET_FLAGS(ok, GTK_CAN_DEFAULT);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
439 gtk_box_pack_start(GTK_BOX(bbox), ok, TRUE, TRUE, 0);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
440 gtk_widget_grab_default(ok);
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
441
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
442 cancel = gtk_button_new_with_label(_("Cancel"));
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
443 gtk_signal_connect_object(GTK_OBJECT(cancel), "clicked",
246
acae8fa925c3 [svn] Add casts to callbacks in signal handlers to avoid warning. GCC would like a return statement too.
chainsaw
parents: 211
diff changeset
444 (GCallback)gtk_widget_destroy, GTK_OBJECT(configure_win));
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
445 GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT);
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
446 gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0);
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
447
211
0b48662886e9 [svn] Sync ALSA plugin with enhancements/patches from Fatal (XMMS cvs)
nenolod
parents: 61
diff changeset
448 gtk_widget_show_all(configure_win);
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
449 }