36
40
#include "remote.h"
37
#include "callbacks.h"
42
#include "v4linterface.h"
39
45
extern audio_backend_info esd_backend;
48
extern audio_backend_info arts_backend;
41
51
extern audio_backend_info oss_backend;
44
extern audio_backend_info arts_backend;
47
static audio_backend_info *backends [] =
58
#define num_backends (sizeof(backends)/sizeof(backends[0]))
60
typedef struct mhandle {
61
gint owner; /* backend owning this handle */
62
gpointer handle; /* for the backend */
55
gpointer handle; /* for the backend */
56
audio_backend_info * backend;
65
59
void mixer_setup ( void )
67
int cur_line = zcg_int(NULL, "record_source");
70
return; /* Use system settings */
74
mixer_set_recording_line(cur_line);
75
mixer_set_volume(cur_line, zcg_int(NULL, "record_volume"));
62
if (mixer && mixer_line)
65
tv_mixer_line_set_volume (mixer->rec_gain,
66
mixer->rec_gain->reset,
67
mixer->rec_gain->reset);
69
tv_mixer_line_record (mixer_line, /* exclusive */ TRUE);
80
open_audio_device (gboolean stereo, gint rate, enum audio_format
74
open_audio_device (gboolean stereo, guint rate, enum audio_format
83
gint cur_backend = zcg_int(NULL, "backend");
84
gpointer handle = backends[cur_backend]->open(stereo, rate, format);
77
const gchar *audio_source;
78
audio_backend_info *backend;
82
audio_source = zcg_char (NULL, "audio_source");
91
else if (0 == strcmp (audio_source, "esd"))
92
backend = &esd_backend;
95
else if (0 == strcmp (audio_source, "arts"))
96
backend = &arts_backend;
99
else if (0 == strcmp (audio_source, "kernel"))
100
backend = &oss_backend;
106
handle = backend->open (stereo, rate, format);
89
ShowBox(_("Cannot open the configured audio device.\n"
110
ShowBox(("Cannot open the configured audio device.\n"
90
111
"You might want to setup another kind of audio\n"
91
112
"device in the Properties dialog."),
92
GNOME_MESSAGE_BOX_WARNING);
113
GTK_MESSAGE_WARNING);
96
mhandle = (struct mhandle *) g_malloc0(sizeof(*mhandle));
97
mhandle->handle = handle;
98
mhandle->owner = cur_backend;
117
mh = g_malloc0 (sizeof (*mh));
119
mh->backend = backend;
100
/* make sure we record from the appropiate source */
121
/* Make sure we record from the appropiate source. */
107
128
close_audio_device (gpointer handle)
109
mhandle *mhandle = (struct mhandle *) handle;
111
backends[mhandle->owner]->close(mhandle->handle);
130
mhandle *mh = handle;
132
mh->backend->close (mh->handle);
117
read_audio_data (gpointer handle, gpointer dest, gint num_bytes,
138
read_audio_data (gpointer handle, gpointer dest, guint num_bytes,
118
139
double *timestamp)
120
mhandle *mhandle = (struct mhandle *) handle;
122
backends[mhandle->owner]->read(mhandle->handle, dest, num_bytes,
127
on_backend_activate (GtkObject *menuitem,
130
gint index = GPOINTER_TO_INT(pindex);
131
GtkObject * audio_backends =
132
GTK_OBJECT(gtk_object_get_user_data(menuitem));
134
GPOINTER_TO_INT(gtk_object_get_data(audio_backends, "cur_sel"));
136
(GtkWidget**)gtk_object_get_data(audio_backends, "boxes");
138
if (cur_sel == index)
141
gtk_object_set_data(audio_backends, "cur_sel", pindex);
142
gtk_widget_hide(boxes[cur_sel]);
143
gtk_widget_set_sensitive(boxes[cur_sel], FALSE);
145
gtk_widget_show(boxes[index]);
146
gtk_widget_set_sensitive(boxes[index], TRUE);
150
build_mixer_lines (GtkWidget *optionmenu)
152
GtkMenu *menu = GTK_MENU
153
(gtk_option_menu_get_menu(GTK_OPTION_MENU(optionmenu)));
158
for (i=0;(label = mixer_get_description(i));i++)
160
menuitem = gtk_menu_item_new_with_label(label);
162
gtk_widget_show(menuitem);
163
gtk_menu_append(menu, menuitem);
168
on_record_source_changed (GtkWidget *optionmenu,
175
gtk_widget_set_sensitive(GTK_WIDGET(hscale), cur_sel);
180
/* note that it's cur_sel-1, the 0 entry is "Use system settings" */
181
g_assert(!mixer_get_bounds(cur_sel-1, &min, &max));
183
adj = gtk_range_get_adjustment(hscale);
188
gtk_adjustment_changed(adj);
193
audio_setup (GtkWidget *page)
196
GtkWidget *audio_backends =
197
lookup_widget(page, "audio_backends");
198
GtkWidget **boxes = (GtkWidget**)g_malloc0(num_backends*sizeof(boxes[0]));
199
GtkWidget *vbox39 = lookup_widget(page, "vbox39");
201
GtkWidget *menu = gtk_menu_new();
202
guint cur_backend = zcg_int(NULL, "backend");
203
GtkWidget *record_source = lookup_widget(page, "record_source");
204
gint cur_input = zcg_int(NULL, "record_source");
205
GtkWidget *record_volume = lookup_widget(page, "record_volume");
208
/* Hook on dialog destruction so there's no mem leak */
209
gtk_object_set_data_full(GTK_OBJECT (audio_backends), "boxes", boxes,
210
(GtkDestroyNotify)g_free);
212
for (i=0; i<num_backends; i++)
214
menuitem = gtk_menu_item_new_with_label(_(backends[i]->name));
215
gtk_signal_connect(GTK_OBJECT(menuitem), "activate",
216
GTK_SIGNAL_FUNC(on_backend_activate),
218
gtk_menu_append(GTK_MENU(menu), menuitem);
219
gtk_object_set_user_data(GTK_OBJECT(menuitem), audio_backends);
220
gtk_widget_show(menuitem);
222
boxes[i] = gtk_vbox_new(FALSE, 3);
223
if (backends[i]->add_props)
224
backends[i]->add_props(GTK_BOX(boxes[i]));
225
gtk_box_pack_start(GTK_BOX(vbox39), boxes[i], FALSE, FALSE, 0);
226
if (i == cur_backend)
227
gtk_widget_show(boxes[i]);
229
gtk_widget_set_sensitive(boxes[i], FALSE);
232
gtk_option_menu_set_menu(GTK_OPTION_MENU (audio_backends), menu);
233
gtk_option_menu_set_history(GTK_OPTION_MENU (audio_backends),
235
gtk_object_set_data(GTK_OBJECT (audio_backends), "cur_sel",
236
GINT_TO_POINTER(cur_backend));
238
/* Avoid noise while changing channels */
239
widget = lookup_widget(page, "checkbutton1");
240
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget),
241
zconf_get_boolean(NULL, "/zapping/options/main/avoid_noise"));
243
/* Force mixer for volume control */
244
widget = lookup_widget(page, "force_mixer");
245
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget),
246
zconf_get_boolean(NULL, "/zapping/options/audio/force_mixer"));
248
/* Start zapping muted */
249
widget = lookup_widget(page, "checkbutton3");
250
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget),
251
zconf_get_boolean(NULL, "/zapping/options/main/start_muted"));
253
/* Recording source and volume */
254
build_mixer_lines(record_source);
255
z_option_menu_set_active(record_source, cur_input);
256
gtk_signal_connect(GTK_OBJECT(record_source), "changed",
257
GTK_SIGNAL_FUNC(on_record_source_changed),
259
on_record_source_changed(record_source,
260
z_option_menu_get_active(record_source),
261
GTK_RANGE(record_volume));
263
gtk_adjustment_set_value(gtk_range_get_adjustment(GTK_RANGE(record_volume)),
264
zcg_int(NULL, "record_volume"));
268
audio_apply (GtkWidget *page)
271
GtkWidget *audio_backends;
274
GtkWidget *record_source;
275
GtkWidget *record_volume;
277
widget = lookup_widget(page, "checkbutton1"); /* avoid noise */
278
zconf_set_boolean(gtk_toggle_button_get_active(
279
GTK_TOGGLE_BUTTON(widget)), "/zapping/options/main/avoid_noise");
281
widget = lookup_widget(page, "force_mixer");
282
zconf_set_boolean(gtk_toggle_button_get_active(
283
GTK_TOGGLE_BUTTON(widget)), "/zapping/options/audio/force_mixer");
285
widget = lookup_widget(page, "checkbutton3"); /* start muted */
286
zconf_set_boolean(gtk_toggle_button_get_active(
287
GTK_TOGGLE_BUTTON(widget)), "/zapping/options/main/start_muted");
289
/* Apply the properties */
290
audio_backends = lookup_widget(page, "audio_backends");
291
selected = z_option_menu_get_active(audio_backends);
292
boxes = (GtkWidget**)gtk_object_get_data(GTK_OBJECT(audio_backends),
295
if (backends[selected]->apply_props)
296
backends[selected]->apply_props(GTK_BOX(boxes[selected]));
298
zcs_int(selected, "backend");
300
record_source = lookup_widget(page, "record_source");
301
zcs_int(z_option_menu_get_active(record_source), "record_source");
303
record_volume = lookup_widget(page, "record_volume");
304
zcs_int((int) gtk_range_get_adjustment(GTK_RANGE(record_volume))->value,
309
add (GnomeDialog *dialog)
311
SidebarEntry general_options[] = {
312
{ N_("Audio"), ICON_ZAPPING, "gnome-grecord.png", "vbox39",
313
audio_setup, audio_apply }
315
SidebarGroup groups[] = {
316
{ N_("General Options"), general_options, acount(general_options) }
319
standard_properties_add(dialog, groups, acount(groups), "zapping.glade");
322
extern tveng_device_info * main_info;
325
audio_set_mute (gint mute)
327
int cur_line = zcg_int (NULL, "record_source");
328
gboolean force = zcg_bool (NULL, "force_mixer");
330
if (main_info->audio_mutable && !force)
332
if (tveng_set_mute (!!mute, main_info) < 0)
334
printv ("tveng_set_mute failed\n");
338
else if (cur_line > 0) /* !use system settings */
340
if (mixer_set_mute (cur_line - 1, !!mute) < 0)
342
printv ("mixer_set_mute failed\n");
346
tveng_set_mute (0, main_info);
353
audio_get_mute (gint * mute)
355
int cur_line = zcg_int (NULL, "record_source");
356
gboolean force = zcg_bool (NULL, "force_mixer");
358
if (main_info->audio_mutable && !force)
360
if ((*mute = tveng_get_mute (main_info)) < 0)
362
printv ("tveng_get_mute failed\n");
366
else if (cur_line > 0) /* !use system settings */
368
if ((*mute = mixer_get_mute (cur_line - 1)) < 0)
370
printv ("mixer_get_mute failed\n");
141
mhandle *mh = handle;
143
mh->backend->read (mh->handle,
144
dest, num_bytes, timestamp);
151
#ifndef AUDIO_MIXER_LOG_FP
152
#define AUDIO_MIXER_LOG_FP 0 /* stderr */
156
general_audio_apply (GtkWidget * page)
161
widget = lookup_widget (page, "general-audio-start-muted");
162
active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
163
zconf_set_boolean (active, "/zapping/options/main/start_muted");
165
widget = lookup_widget (page, "general-audio-quit-muted");
166
active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
167
zconf_set_boolean (active, "/zapping/options/main/quit_muted");
169
widget = lookup_widget (page, "general-audio-mute-chsw");
170
active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
171
zconf_set_boolean (active, "/zapping/options/main/avoid_noise");
175
general_audio_setup (GtkWidget * page)
180
zconf_get_boolean (&active, "/zapping/options/main/start_muted");
181
widget = lookup_widget (page, "general-audio-start-muted");
182
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), active);
184
zconf_get_boolean (&active, "/zapping/options/main/quit_muted");
185
widget = lookup_widget (page, "general-audio-quit-muted");
186
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), active);
188
zconf_get_boolean (&active, "/zapping/options/main/avoid_noise");
189
widget = lookup_widget (page, "general-audio-mute-chsw");
190
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), active);
194
devices_audio_source_apply (GtkWidget * page)
197
const gchar *audio_source;
200
audio_source = "none";
202
widget = lookup_widget (page, "devices-audio-gnome");
203
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
205
audio_source = "esd";
210
widget = lookup_widget (page, "devices-audio-kde");
211
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
213
audio_source = "arts";
219
widget = lookup_widget (page, "devices-audio-kernel");
220
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
221
audio_source = "kernel";
226
zcs_char (audio_source, "audio_source");
228
widget = lookup_widget (page, "devices-audio-kernel-table");
229
if ((n = z_device_entry_selected (widget)))
230
zcs_char (n->device, "pcm_device");
234
devices_audio_mixer_apply (GtkWidget * page)
240
widget = lookup_widget (page, "devices-audio-mixer");
241
active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
242
zconf_set_boolean (active, "/zapping/options/audio/force_mixer");
244
widget = lookup_widget (page, "devices-audio-mixer-table");
246
if ((n = z_device_entry_selected (widget)))
251
zcs_char (n->device, "mixer_device");
253
widget = g_object_get_data (G_OBJECT (widget), "mixer_lines");
257
index = z_option_menu_get_active (widget);
259
for (l = PARENT (n, tv_mixer, node)->inputs; l; l = l->_next)
262
zcs_int ((int) l->hash, "mixer_input");
270
devices_audio_apply (GtkWidget * page)
272
tveng_tc_control *tcc;
275
devices_audio_source_apply (page);
276
devices_audio_mixer_apply (page);
278
store_control_values (zapping->info, &tcc, &num_controls);
279
startup_mixer (zapping->info);
280
update_control_box (zapping->info);
281
load_control_values (zapping->info, tcc, num_controls);
285
on_enable_device_entry_toggled (GtkToggleButton * toggle_button,
290
active = gtk_toggle_button_get_active (toggle_button);
292
gtk_widget_set_sensitive (widget, active);
295
z_device_entry_grab_focus (widget);
298
static tv_device_node *
299
devices_audio_kernel_open (GtkWidget * table _unused_,
300
tv_device_node * list,
302
gpointer user_data _unused_)
306
if ((n = tv_device_node_find (list, name)))
309
/* FIXME report errors */
310
if ((n = oss_pcm_open (NULL, NULL, name)))
317
devices_audio_source_setup (GtkWidget * page)
319
GtkWidget *alignment;
322
tv_device_node *list;
323
const gchar *audio_source;
325
audio_source = zcg_char (NULL, "audio_source");
329
widget = lookup_widget (page, "devices-audio-none");
330
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
332
widget = lookup_widget (page, "devices-audio-gnome");
333
if (0 == strcmp (audio_source, "esd"))
334
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
336
widget = lookup_widget (page, "devices-audio-kde");
338
if (0 == strcmp (audio_source, "arts"))
339
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
341
gtk_widget_set_sensitive (widget, FALSE);
344
widget = lookup_widget (page, "devices-audio-kernel");
346
if (0 == strcmp (audio_source, "kernel"))
347
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
350
list = oss_pcm_scan (NULL, NULL);
352
alignment = lookup_widget (page, "devices-audio-kernel-alignment");
354
table = z_device_entry_new (/* prompt */ NULL,
356
zcg_char (NULL, "pcm_device"),
357
devices_audio_kernel_open, NULL,
358
/* user_data */ NULL);
359
gtk_widget_show (table);
360
gtk_container_add (GTK_CONTAINER (alignment), table);
361
register_widget (NULL, table, "devices-audio-kernel-table");
363
g_signal_connect (G_OBJECT (widget), "toggled",
364
G_CALLBACK (on_enable_device_entry_toggled), table);
365
on_enable_device_entry_toggled (GTK_TOGGLE_BUTTON (widget), table);
366
#else /* !HAVE_OSS */
367
gtk_widget_set_sensitive (widget, FALSE);
372
devices_audio_mixer_select (GtkWidget * table,
374
gpointer user_data _unused_)
377
GtkWidget *optionmenu;
379
if ((optionmenu = g_object_get_data (G_OBJECT (table), "mixer_lines")))
381
gtk_widget_destroy (optionmenu);
389
guint hash = (guint) -1;
392
mixer = PARENT (n, tv_mixer, node);
393
g_assert (mixer->inputs != NULL);
395
if (0 == strcmp (zcg_char (NULL, "mixer_device"), n->device))
396
hash = zcg_int (NULL, "mixer_input");
398
optionmenu = gtk_option_menu_new ();
399
gtk_widget_show (optionmenu);
401
menu = gtk_menu_new ();
402
gtk_widget_show (menu);
403
gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu), menu);
407
for (line = mixer->inputs; line; line = line->_next)
409
GtkWidget *menu_item;
411
menu_item = gtk_menu_item_new_with_label (line->label);
412
gtk_widget_show (menu_item);
413
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
415
if (index == 0 || line->hash == hash)
416
gtk_option_menu_set_history (GTK_OPTION_MENU (optionmenu), index);
421
if (mixer->inputs->_next == NULL)
422
gtk_widget_set_sensitive (GTK_WIDGET (optionmenu), FALSE);
424
gtk_table_attach (GTK_TABLE (table), optionmenu, 1, 1 + 1, 3, 3 + 1,
425
GTK_FILL | GTK_EXPAND, 0, 0, 0);
428
g_object_set_data (G_OBJECT (table), "mixer_lines", optionmenu);
431
static tv_device_node *
432
devices_audio_mixer_open (GtkWidget * table _unused_,
433
tv_device_node * list,
435
gpointer user_data _unused_)
440
if ((n = tv_device_node_find (list, name)))
443
/* FIXME report errors */
444
if ((m = tv_mixer_open (AUDIO_MIXER_LOG_FP, name)))
446
if (m->inputs != NULL)
456
devices_audio_mixer_setup (GtkWidget * page)
459
tv_device_node *list, *n;
460
GtkWidget *checkbutton;
461
GtkWidget *alignment;
465
m = tv_mixer_scan (AUDIO_MIXER_LOG_FP);
466
list = m ? &m->node : NULL;
468
/* Remove tv card mixer interfaces, these are special
469
and we fall back to them automatically. */
472
if (PARENT (n, tv_mixer, node)->inputs == NULL)
474
tv_device_node *next;
477
tv_device_node_delete (&list, n, FALSE);
486
checkbutton = lookup_widget (page, "devices-audio-mixer");
487
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbutton),
488
zcg_bool (NULL, "force_mixer"));
490
alignment = lookup_widget (page, "devices-audio-mixer-alignment");
492
table = z_device_entry_new (/* prompt */ NULL,
494
zcg_char (NULL, "mixer_device"),
495
devices_audio_mixer_open,
496
devices_audio_mixer_select,
497
/* user_data */ NULL);
498
gtk_widget_show (table);
499
gtk_container_add (GTK_CONTAINER (alignment), table);
500
register_widget (NULL, table, "devices-audio-mixer-table");
502
g_signal_connect (G_OBJECT (checkbutton), "toggled",
503
G_CALLBACK (on_enable_device_entry_toggled), table);
504
on_enable_device_entry_toggled (GTK_TOGGLE_BUTTON (checkbutton), table);
506
/* TRANSLATORS: Soundcard mixer line. */
507
label = gtk_label_new (_("Input:"));
508
gtk_widget_show (label);
509
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
510
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
511
gtk_misc_set_padding (GTK_MISC (label), 3, 3);
512
gtk_table_attach (GTK_TABLE (table), label,
519
devices_audio_setup (GtkWidget * page)
521
devices_audio_source_setup (page);
522
devices_audio_mixer_setup (page);
526
properties_add (GtkDialog * dialog)
528
SidebarEntry devices [] = {
529
{ N_("Audio"), "gnome-grecord.png", "vbox53",
530
devices_audio_setup, devices_audio_apply,
531
.help_link_id = "zapping-settings-audio-device" }
533
SidebarEntry general [] = {
534
{ N_("Audio"), "gnome-grecord.png", "vbox39",
535
general_audio_setup, general_audio_apply,
536
.help_link_id = "zapping-settings-audio-options" }
538
SidebarGroup groups [] = {
539
{ N_("Devices"), devices, G_N_ELEMENTS (devices) },
540
{ N_("General Options"), general, G_N_ELEMENTS (general) }
543
standard_properties_add (dialog, groups, G_N_ELEMENTS (groups),
551
static guint quiet_timeout_id = NO_SOURCE_ID;
379
volume_incr_cmd (GtkWidget * widget,
384
int cur_line = zcg_int (NULL, "record_source");
385
int min, max, range, step, cur;
389
value = strtol (argv[1], NULL, 0);
391
if (value < -100 || value > +100)
397
cur_line--; /* 0 is "system setting" */
399
if (mixer_get_bounds (cur_line, &min, &max) == -1)
402
range = max - min + 1;
403
step = (int)(((double) value) * range / 100.0);
404
if (value != 0 && step == 0)
405
step = (value >> 31) | 1;
407
cur = zcg_int(NULL, "record_volume");
416
if (mixer_set_volume(cur_line, cur) == -1)
419
zcs_int(cur, "record_volume");
422
/* NLS: Record volume */
423
osd_render_sgml(NULL, _("<blue>%3d %%</blue>"),
424
(cur - min) * 100 / range);
554
quiet_timeout (gpointer user_data _unused_)
556
tv_quiet_set (zapping->info, FALSE);
557
return FALSE; /* don't call again */
561
reset_quiet (tveng_device_info * info _unused_,
564
if (quiet_timeout_id > 0)
565
g_source_remove (quiet_timeout_id);
570
g_timeout_add (delay /* ms */, (GSourceFunc) quiet_timeout, NULL);
574
tv_quiet_set (zapping->info, FALSE);
579
* Global mute function. XXX switch to callbacks.
580
* mode: 0=sound, 1=mute, 2=toggle, 3=just update GUI
581
* controls: update controls box
582
* osd: show state on screen
586
gboolean controls _unused_,
589
static gboolean recursion = FALSE;
597
/* Get current state */
601
mute = tv_mute_get (zapping->info, TRUE);
614
if (-1 == tv_mute_set (zapping->info, mute))
622
action = gtk_action_group_get_action (zapping->generic_action_group,
624
if (mute != gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)))
625
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), mute);
629
BonoboDockItem *dock_item;
631
dock_item = gnome_app_get_dock_item_by_name
632
(&zapping->app, GNOME_APP_TOOLBAR_NAME);
634
if (DISPLAY_MODE_BACKGROUND == zapping->display_mode
635
|| DISPLAY_MODE_FULLSCREEN == zapping->display_mode
637
|| !GTK_WIDGET_VISIBLE (GTK_WIDGET (dock_item)))
638
osd_render_markup_printf (NULL, mute ?
639
_("<span foreground=\"blue\">Audio off</span>") :
640
_("<span foreground=\"yellow\">Audio on</span>"));
653
py_mute (PyObject * self _unused_,
656
int value = 2; /* toggle by default */
658
if (!ParseTuple (args, "|i", &value))
660
g_warning ("zapping.mute(|i)");
664
set_mute (value, TRUE, TRUE);
430
669
void startup_audio ( void )
434
property_handler audio_handler =
671
static const property_handler audio_handler = {
672
.add = properties_add,
439
prepend_property_handler(&audio_handler);
441
zcc_int(0, "Default audio backend", "backend");
442
zcc_int(0, "Recording source", "record_source");
443
zcc_int(0xffff, "Recording volume", "record_volume");
445
for (i=0; i<num_backends; i++)
446
if (backends[i]->init)
449
cmd_register ("mute", mute_cmd, NULL);
450
cmd_register ("volume_incr", volume_incr_cmd, NULL);
675
prepend_property_handler (&audio_handler);
677
zcc_char ("kernel", "PCM recording source", "audio_source");
678
zcc_char ("/dev/dsp", "PCM recording kernel device", "pcm_device");
680
zcc_char ("", "Mixer device", "mixer_device");
681
zcc_int (-1, "Mixer input line (hash)", "mixer_input");
683
zconf_create_boolean (FALSE, "Mute when Zapping is started",
684
"/zapping/options/main/start_muted");
685
zconf_create_boolean (TRUE, "Mute on exit",
686
"/zapping/options/main/quit_muted");
687
zconf_create_boolean (TRUE, "Mute when changing channels",
688
"/zapping/options/main/avoid_noise");
691
if (esd_backend.init)
695
if (arts_backend.init)
696
arts_backend.init ();
699
if (oss_backend.init)
703
cmd_register ("mute", py_mute, METH_VARARGS,
704
("Mute/unmute"), "zapping.mute()",
705
("Mute"), "zapping.mute(1)",
706
("Unmute"), "zapping.mute(0)");
453
709
void shutdown_audio ( void )
457
for (i=0; i<num_backends; i++)
458
if (backends[i]->shutdown)
459
backends[i]->shutdown();
712
if (esd_backend.shutdown)
713
esd_backend.shutdown ();
716
if (arts_backend.shutdown)
717
arts_backend.shutdown ();
720
if (oss_backend.shutdown)
721
oss_backend.shutdown ();