annotate src/OSS4/configure.c @ 3196:0f7180e3b163

alsa-ng: Enforce a minimum buffer size of 500ms.
author William Pitcock <nenolod@atheme.org>
date Sun, 12 Jul 2009 08:30:13 -0500
parents 9ec8a613a1d6
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1214
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
1 /* BMP - Cross-platform multimedia player
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
2 * Copyright (C) 2003-2004 BMP development team.
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
3 *
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
4 * Based on XMMS:
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
5 * Copyright (C) 1998-2003 XMMS development team.
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
6 *
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
10 * (at your option) any later version.
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
11 *
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
15 * GNU General Public License for more details.
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
16 *
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
20 */
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
21
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
22 #include "OSS4.h"
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
23
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
24 #include <glib.h>
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
25 #include <gtk/gtk.h>
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
26 #include <stdio.h>
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
27 #include <string.h>
2971
3134a0987162 - changed include path from audacious to audlegacy.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2523
diff changeset
28 #include <audlegacy/plugin.h>
3134a0987162 - changed include path from audacious to audlegacy.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2523
diff changeset
29 #include <audlegacy/i18n.h>
3049
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
30 #include <sys/ioctl.h>
1214
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
31
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
32 static GtkWidget *configure_win = NULL;
1245
a18b7cdc505d stripped down the config dialog, added an option for the save dmix volume
Cristi Magherusan <majeru@atheme-project.org>
parents: 1214
diff changeset
33 static GtkWidget *mixer_save_check,*buffer_size_spin, *buffer_pre_spin;
1214
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
34 static GtkWidget *adevice_use_alt_check, *audio_alt_device_entry;
1245
a18b7cdc505d stripped down the config dialog, added an option for the save dmix volume
Cristi Magherusan <majeru@atheme-project.org>
parents: 1214
diff changeset
35 static gint audio_device;
1214
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
36
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
37 static void
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
38 configure_win_ok_cb(GtkWidget * w, gpointer data)
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
39 {
2523
769e17da93dd Replaced s/ConfigDb/mcs_handle_t/g, as per changes in the core.
Matti Hamalainen <ccr@tnsp.org>
parents: 2501
diff changeset
40 mcs_handle_t *db;
1214
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
41
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
42 oss_cfg.audio_device = audio_device;
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
43 oss_cfg.buffer_size =
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
44 gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(buffer_size_spin));
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
45 oss_cfg.prebuffer =
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
46 gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(buffer_pre_spin));
1245
a18b7cdc505d stripped down the config dialog, added an option for the save dmix volume
Cristi Magherusan <majeru@atheme-project.org>
parents: 1214
diff changeset
47 oss_cfg.save_volume =
1214
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
48 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
1245
a18b7cdc505d stripped down the config dialog, added an option for the save dmix volume
Cristi Magherusan <majeru@atheme-project.org>
parents: 1214
diff changeset
49 (mixer_save_check));
a18b7cdc505d stripped down the config dialog, added an option for the save dmix volume
Cristi Magherusan <majeru@atheme-project.org>
parents: 1214
diff changeset
50
1214
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
51 oss_cfg.use_alt_audio_device =
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
52 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
53 (adevice_use_alt_check));
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
54 g_free(oss_cfg.alt_audio_device);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
55 oss_cfg.alt_audio_device =
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
56 gtk_editable_get_chars(GTK_EDITABLE(audio_alt_device_entry), 0, -1);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
57 g_strstrip(oss_cfg.alt_audio_device);
1245
a18b7cdc505d stripped down the config dialog, added an option for the save dmix volume
Cristi Magherusan <majeru@atheme-project.org>
parents: 1214
diff changeset
58
1214
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
59 if (oss_cfg.use_alt_audio_device)
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
60 /* do a minimum of sanity checking */
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
61 if (oss_cfg.alt_audio_device[0] != '/')
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
62 oss_cfg.use_alt_audio_device = FALSE;
1245
a18b7cdc505d stripped down the config dialog, added an option for the save dmix volume
Cristi Magherusan <majeru@atheme-project.org>
parents: 1214
diff changeset
63
2124
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 1978
diff changeset
64 db = aud_cfg_db_open();
1214
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
65
2124
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 1978
diff changeset
66 aud_cfg_db_set_int(db, "OSS", "audio_device", oss_cfg.audio_device);
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 1978
diff changeset
67 aud_cfg_db_set_int(db, "OSS", "buffer_size", oss_cfg.buffer_size);
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 1978
diff changeset
68 aud_cfg_db_set_int(db, "OSS", "prebuffer", oss_cfg.prebuffer);
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 1978
diff changeset
69 aud_cfg_db_set_bool(db, "OSS", "save_volume", oss_cfg.save_volume);
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 1978
diff changeset
70 aud_cfg_db_set_bool(db, "OSS", "use_alt_audio_device",
1214
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
71 oss_cfg.use_alt_audio_device);
2124
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 1978
diff changeset
72 aud_cfg_db_set_string(db, "OSS", "alt_audio_device",
1214
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
73 oss_cfg.alt_audio_device);
2124
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 1978
diff changeset
74 aud_cfg_db_close(db);
1214
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
75 }
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
76
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
77 static void
3049
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
78 configure_win_audio_dev_cb(GtkWidget * widget, gpointer data)
1214
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
79 {
3049
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
80 audio_device = GPOINTER_TO_INT(data);
1214
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
81 }
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
82
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
83 static void
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
84 audio_device_toggled(GtkToggleButton * widget, gpointer data)
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
85 {
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
86 gboolean use_alt_audio_device = gtk_toggle_button_get_active(widget);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
87 gtk_widget_set_sensitive(GTK_WIDGET(data), !use_alt_audio_device);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
88 gtk_widget_set_sensitive(audio_alt_device_entry, use_alt_audio_device);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
89 }
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
90
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
91 static void
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
92 scan_devices(gchar * type, GtkWidget * option_menu, GtkSignalFunc sigfunc)
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
93 {
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
94 GtkWidget *menu, *item;
3049
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
95 oss_sysinfo sysinfo;
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
96 gint mixerfd = -1;
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
97 gint i, acc;
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
98
1214
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
99 menu = gtk_menu_new();
3049
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
100
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
101 /*
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
102 * Open the mixer device used for calling SNDCTL_SYSINFO and
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
103 * SNDCTL_AUDIOINFO.
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
104 */
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
105 if ((mixerfd = open(DEFAULT_MIXER, O_RDWR, 0)) == -1)
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
106 {
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
107 perror(DEFAULT_MIXER);
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
108 oss_describe_error();
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
109 }
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
110 else
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
111 {
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
112 if (ioctl(mixerfd, SNDCTL_SYSINFO, &sysinfo) == -1)
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
113 {
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
114 perror("SNDCTL_SYSINFO");
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
115 oss_describe_error();
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
116 close(mixerfd);
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
117 }
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
118 else
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
119 {
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
120 for (i = 0; i < sysinfo.numaudios; i++)
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
121 {
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
122 oss_audioinfo ainfo;
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
123 ainfo.dev = i;
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
124
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
125 if (ioctl(mixerfd, SNDCTL_AUDIOINFO, &ainfo) == -1)
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
126 {
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
127 perror("SNDCTL_AUDIOINFO");
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
128 oss_describe_error();
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
129 close(mixerfd);
1214
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
130 }
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
131 else
3049
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
132 {
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
133 acc = ainfo.caps & (PCM_CAP_INPUT | PCM_CAP_OUTPUT);
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
134
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
135 switch (acc)
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
136 {
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
137 case PCM_CAP_OUTPUT:
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
138 item = gtk_menu_item_new_with_label(g_strdup_printf("%d. %s (OUTPUT)", i, ainfo.name));
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
139 break;
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
140
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
141 case PCM_CAP_INPUT | PCM_CAP_OUTPUT:
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
142 item = gtk_menu_item_new_with_label(g_strdup_printf("%d. %s (INPUT/OUTPUT)", i, ainfo.name));
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
143 break;
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
144
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
145 case PCM_CAP_INPUT:
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
146 item = gtk_menu_item_new_with_label(g_strdup_printf("%d. %s (INPUT)", i, ainfo.name));
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
147 break;
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
148
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
149 default:
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
150 continue;
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
151 }
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
152
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
153 gtk_widget_show(item);
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
154 gtk_menu_append(GTK_MENU(menu), item);
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
155
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
156 g_signal_connect(G_OBJECT(item), "activate",
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
157 G_CALLBACK(sigfunc), GINT_TO_POINTER(i));
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
158 }
1214
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
159 }
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
160
3049
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
161 close(mixerfd);
1214
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
162 }
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
163 }
3049
9ec8a613a1d6 More OSS4 plugin changes
Michal Lipski <tallica@o2.pl>
parents: 2971
diff changeset
164
1214
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
165 gtk_option_menu_set_menu(GTK_OPTION_MENU(option_menu), menu);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
166 }
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
167
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
168 void
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
169 oss_configure(void)
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
170 {
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
171 GtkWidget *vbox, *notebook;
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
172 GtkWidget *dev_vbox, *adevice_frame, *adevice_box, *adevice;
1973
f86cb7fc1d4f Add -pipe -Wall if gcc and fix a few warnings.
Jonathan Schleifer <js@h3c.de>
parents: 1245
diff changeset
173 /* GtkWidget *mdevice_frame, *mdevice_box, *mdevice; */
1214
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
174 GtkWidget *buffer_frame, *buffer_vbox, *buffer_table;
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
175 GtkWidget *buffer_size_box, *buffer_size_label;
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
176 GtkObject *buffer_size_adj, *buffer_pre_adj;
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
177 GtkWidget *buffer_pre_box, *buffer_pre_label;
1245
a18b7cdc505d stripped down the config dialog, added an option for the save dmix volume
Cristi Magherusan <majeru@atheme-project.org>
parents: 1214
diff changeset
178 GtkWidget *audio_alt_box;
1214
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
179 GtkWidget *bbox, *ok, *cancel;
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
180 GtkWidget *mixer_table, *mixer_frame;
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
181
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
182 if (configure_win) {
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
183 gtk_window_present(GTK_WINDOW(configure_win));
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
184 return;
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
185 }
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
186
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
187 configure_win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
188 g_signal_connect(G_OBJECT(configure_win), "destroy",
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
189 G_CALLBACK(gtk_widget_destroyed), &configure_win);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
190 gtk_window_set_title(GTK_WINDOW(configure_win),
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
191 _("OSS Driver configuration"));
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
192 gtk_window_set_type_hint(GTK_WINDOW(configure_win),
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
193 GDK_WINDOW_TYPE_HINT_DIALOG);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
194 gtk_window_set_resizable(GTK_WINDOW(configure_win), FALSE);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
195 gtk_window_set_position(GTK_WINDOW(configure_win), GTK_WIN_POS_CENTER);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
196 gtk_container_border_width(GTK_CONTAINER(configure_win), 10);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
197
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
198 vbox = gtk_vbox_new(FALSE, 10);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
199 gtk_container_add(GTK_CONTAINER(configure_win), vbox);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
200
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
201 notebook = gtk_notebook_new();
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
202 gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
203
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
204 dev_vbox = gtk_vbox_new(FALSE, 5);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
205 gtk_container_set_border_width(GTK_CONTAINER(dev_vbox), 5);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
206
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
207 adevice_frame = gtk_frame_new(_("Audio device:"));
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
208 gtk_box_pack_start(GTK_BOX(dev_vbox), adevice_frame, FALSE, FALSE, 0);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
209
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
210 adevice_box = gtk_vbox_new(FALSE, 5);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
211 gtk_container_set_border_width(GTK_CONTAINER(adevice_box), 5);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
212 gtk_container_add(GTK_CONTAINER(adevice_frame), adevice_box);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
213
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
214 adevice = gtk_option_menu_new();
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
215 gtk_box_pack_start(GTK_BOX(adevice_box), adevice, TRUE, TRUE, 0);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
216 #if defined(HAVE_NEWPCM)
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
217 scan_devices("Installed devices:", adevice,
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
218 GTK_SIGNAL_FUNC(configure_win_audio_dev_cb));
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
219 #else
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
220 scan_devices("Audio devices:", adevice,
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
221 GTK_SIGNAL_FUNC(configure_win_audio_dev_cb));
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
222 #endif
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
223 audio_device = oss_cfg.audio_device;
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
224 gtk_option_menu_set_history(GTK_OPTION_MENU(adevice),
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
225 oss_cfg.audio_device);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
226 audio_alt_box = gtk_hbox_new(FALSE, 0);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
227 gtk_box_pack_start_defaults(GTK_BOX(adevice_box), audio_alt_box);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
228 adevice_use_alt_check =
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
229 gtk_check_button_new_with_label(_("Use alternate device:"));
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
230 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(adevice_use_alt_check),
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
231 oss_cfg.use_alt_audio_device);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
232 g_signal_connect(G_OBJECT(adevice_use_alt_check), "toggled",
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
233 G_CALLBACK(audio_device_toggled), adevice);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
234 gtk_box_pack_start(GTK_BOX(audio_alt_box), adevice_use_alt_check,
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
235 FALSE, FALSE, 0);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
236 audio_alt_device_entry = gtk_entry_new();
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
237 if (oss_cfg.alt_audio_device != NULL)
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
238 gtk_entry_set_text(GTK_ENTRY(audio_alt_device_entry),
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
239 oss_cfg.alt_audio_device);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
240 else
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
241 gtk_entry_set_text(GTK_ENTRY(audio_alt_device_entry), DEV_DSP);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
242 gtk_box_pack_start_defaults(GTK_BOX(audio_alt_box),
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
243 audio_alt_device_entry);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
244
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
245 if (oss_cfg.use_alt_audio_device)
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
246 gtk_widget_set_sensitive(adevice, FALSE);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
247 else
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
248 gtk_widget_set_sensitive(audio_alt_device_entry, FALSE);
1245
a18b7cdc505d stripped down the config dialog, added an option for the save dmix volume
Cristi Magherusan <majeru@atheme-project.org>
parents: 1214
diff changeset
249
1214
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
250 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), dev_vbox,
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
251 gtk_label_new(_("Devices")));
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
252
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
253 buffer_frame = gtk_frame_new(_("Buffering:"));
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
254 gtk_container_set_border_width(GTK_CONTAINER(buffer_frame), 5);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
255
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
256 buffer_vbox = gtk_vbox_new(FALSE, 0);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
257 gtk_container_add(GTK_CONTAINER(buffer_frame), buffer_vbox);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
258
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
259 buffer_table = gtk_table_new(2, 1, TRUE);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
260 gtk_container_set_border_width(GTK_CONTAINER(buffer_table), 5);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
261 gtk_box_pack_start(GTK_BOX(buffer_vbox), buffer_table, FALSE, FALSE, 0);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
262
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
263 buffer_size_box = gtk_hbox_new(FALSE, 5);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
264 gtk_table_attach_defaults(GTK_TABLE(buffer_table), buffer_size_box, 0,
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
265 1, 0, 1);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
266 buffer_size_label = gtk_label_new(_("Buffer size (ms):"));
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
267 gtk_box_pack_start(GTK_BOX(buffer_size_box), buffer_size_label, FALSE,
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
268 FALSE, 0);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
269 buffer_size_adj =
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
270 gtk_adjustment_new(oss_cfg.buffer_size, 200, 10000, 100, 100, 100);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
271 buffer_size_spin =
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
272 gtk_spin_button_new(GTK_ADJUSTMENT(buffer_size_adj), 8, 0);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
273 gtk_widget_set_usize(buffer_size_spin, 60, -1);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
274 gtk_box_pack_start(GTK_BOX(buffer_size_box), buffer_size_spin, FALSE,
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
275 FALSE, 0);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
276
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
277 buffer_pre_box = gtk_hbox_new(FALSE, 5);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
278 gtk_table_attach_defaults(GTK_TABLE(buffer_table), buffer_pre_box, 1,
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
279 2, 0, 1);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
280 buffer_pre_label = gtk_label_new(_("Pre-buffer (percent):"));
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
281 gtk_box_pack_start(GTK_BOX(buffer_pre_box), buffer_pre_label, FALSE,
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
282 FALSE, 0);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
283 buffer_pre_adj = gtk_adjustment_new(oss_cfg.prebuffer, 0, 90, 1, 1, 1);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
284 buffer_pre_spin =
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
285 gtk_spin_button_new(GTK_ADJUSTMENT(buffer_pre_adj), 1, 0);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
286 gtk_widget_set_usize(buffer_pre_spin, 60, -1);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
287 gtk_box_pack_start(GTK_BOX(buffer_pre_box), buffer_pre_spin, FALSE,
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
288 FALSE, 0);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
289
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
290 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), buffer_frame,
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
291 gtk_label_new(_("Buffering")));
1245
a18b7cdc505d stripped down the config dialog, added an option for the save dmix volume
Cristi Magherusan <majeru@atheme-project.org>
parents: 1214
diff changeset
292
1214
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
293 mixer_frame = gtk_frame_new(_("Mixer Settings:"));
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
294 gtk_container_set_border_width(GTK_CONTAINER(mixer_frame), 5);
1245
a18b7cdc505d stripped down the config dialog, added an option for the save dmix volume
Cristi Magherusan <majeru@atheme-project.org>
parents: 1214
diff changeset
295 mixer_table = gtk_table_new(1, 1, TRUE);
1214
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
296 gtk_container_add(GTK_CONTAINER(mixer_frame), mixer_table);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
297 gtk_container_set_border_width(GTK_CONTAINER(mixer_table), 5);
1245
a18b7cdc505d stripped down the config dialog, added an option for the save dmix volume
Cristi Magherusan <majeru@atheme-project.org>
parents: 1214
diff changeset
298 mixer_save_check =
a18b7cdc505d stripped down the config dialog, added an option for the save dmix volume
Cristi Magherusan <majeru@atheme-project.org>
parents: 1214
diff changeset
299 gtk_check_button_new_with_label(_("Save VMIX volume between sessions"));
a18b7cdc505d stripped down the config dialog, added an option for the save dmix volume
Cristi Magherusan <majeru@atheme-project.org>
parents: 1214
diff changeset
300 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mixer_save_check),
a18b7cdc505d stripped down the config dialog, added an option for the save dmix volume
Cristi Magherusan <majeru@atheme-project.org>
parents: 1214
diff changeset
301 oss_cfg.save_volume);
1214
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
302 gtk_table_attach_defaults(GTK_TABLE(mixer_table),
1245
a18b7cdc505d stripped down the config dialog, added an option for the save dmix volume
Cristi Magherusan <majeru@atheme-project.org>
parents: 1214
diff changeset
303 mixer_save_check, 0, 1, 0, 1);
1214
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
304 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), mixer_frame,
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
305 gtk_label_new(_("Mixer")));
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
306
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
307 bbox = gtk_hbutton_box_new();
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
308 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
309 gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
310 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
311
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
312 cancel = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
313 g_signal_connect_swapped(G_OBJECT(cancel), "clicked",
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
314 G_CALLBACK(gtk_widget_destroy),
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
315 GTK_OBJECT(configure_win));
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
316 GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
317 gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
318
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
319 ok = gtk_button_new_from_stock(GTK_STOCK_APPLY);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
320 g_signal_connect(G_OBJECT(ok), "clicked",
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
321 G_CALLBACK(configure_win_ok_cb), NULL);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
322 GTK_WIDGET_SET_FLAGS(ok, GTK_CAN_DEFAULT);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
323 gtk_box_pack_start(GTK_BOX(bbox), ok, TRUE, TRUE, 0);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
324 gtk_widget_grab_default(ok);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
325
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
326 gtk_widget_show_all(configure_win);
2a722c3ccd9e damn, I forgot to 'hg add' the sources
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
327 }