static GtkWidget * alsa_getwidget (void *dp) { alsa_driver * const d = dp; prefs_init_from_structure(d); return d->configwidget; }
static gboolean oss_loadsettings (void *dp, prefs_node *f) { oss_driver * const d = dp; prefs_get_string(f, "oss-devdsp", d->p_devdsp); prefs_get_int(f, "oss-resolution", &d->p_resolution); prefs_get_int(f, "oss-channels", &d->p_channels); prefs_get_int(f, "oss-mixfreq", &d->p_mixfreq); prefs_get_int(f, "oss-fragsize", &d->p_fragsize); prefs_init_from_structure(d); return TRUE; }
static gboolean alsa_loadsettings (void *dp, prefs_node *f) { alsa_driver * const d = dp; guint i; gchar buf[32]; //!!! Port all preferences to gchar, gint, etc... if(prefs_get_string(f, "alsa1x-device", buf)) { g_free(d->device); d->device = g_strdup(buf); } prefs_get_int(f, "alsa1x-resolution", &d->bits); prefs_get_int(f, "alsa1x-stereo", &d->stereo); prefs_get_int(f, "alsa1x-playrate", &d->playrate); prefs_get_int(f, "alsa1x-buffer_size", &d->buffer_size); prefs_get_int(f, "alsa1x-num_periods", &d->num_periods); prefs_get_int(f, "alsa1x-can_8", &d->can8); prefs_get_int(f, "alsa1x-can_16", &d->can16); prefs_get_int(f, "alsa1x-can_mono", &d->canmono); prefs_get_int(f, "alsa1x-can_stereo", &d->canstereo); prefs_get_int(f, "alsa1x-signedness_8", &d->signedness8); prefs_get_int(f, "alsa1x-signedness_16", &d->signedness16); prefs_get_int(f, "alsa1x-period_size_min", (int *)&d->persizemin); prefs_get_int(f, "alsa1x-period_size_max", (int *)&d->persizemax); for(i = 0; i < NUM_FORMATS; i++) { g_sprintf(buf, "alsa1x-devcap[%u].minfreq", i); prefs_get_int(f, buf, &d->devcap[i].minfreq); g_sprintf(buf, "alsa1x-devcap[%u].maxfreq", i); prefs_get_int(f, buf, &d->devcap[i].maxfreq); g_sprintf(buf, "alsa1x-devcap[%u].minbufsize", i); prefs_get_int(f, buf, (int *)&d->devcap[i].minbufsize); g_sprintf(buf, "alsa1x-devcap[%u].maxbufsize", i); prefs_get_int(f, buf, (int *)&d->devcap[i].maxbufsize); } prefs_get_int(f, "alsa1x-verbose", (int *)&d->verbose); prefs_get_str_array(f, "alsa1x-device-list", load_dev_func, d); gtk_combo_box_set_active(GTK_COMBO_BOX(d->alsa_device), 0); prefs_init_from_structure(d); return TRUE; }
static gboolean alsa_loadsettings (void *dp, prefs_node *f) { alsa_driver * const d = dp; prefs_get_int(f, "alsa-resolution", &d->p_resolution); prefs_get_int(f, "alsa-channels", &d->p_channels); prefs_get_int(f, "alsa-mixfreq", &d->p_mixfreq); prefs_get_int(f, "alsa-fragsize", &d->p_fragsize); prefs_get_int(f, "alsa-card", &d->card_number); prefs_get_int(f, "alsa-device", &d->device_number); prefs_init_from_structure(d); return TRUE; }
static void alsa_make_config_widgets (alsa_driver *d) { GtkWidget *thing, *mainbox, *box2, *box3, *alsa_card, *alsa_device; static const char *resolutionlabels[] = { "8 bits", "16 bits", NULL }; static const char *channelslabels[] = { "Mono", "Stereo", NULL }; static const char *mixfreqlabels[] = { "8000", "16000", "22050", "44100", NULL }; d->configwidget = mainbox = gtk_vbox_new(FALSE, 2); thing = gtk_label_new(_("These changes won't take effect until you restart playing.")); gtk_widget_show(thing); gtk_box_pack_start(GTK_BOX(mainbox), thing, FALSE, TRUE, 0); thing = gtk_hseparator_new(); gtk_widget_show(thing); gtk_box_pack_start(GTK_BOX(mainbox), thing, FALSE, TRUE, 0); box2 = gtk_hbox_new(FALSE, 4); gtk_widget_show(box2); gtk_box_pack_start(GTK_BOX(mainbox), box2, FALSE, TRUE, 0); thing = gtk_label_new(_("Resolution:")); gtk_widget_show(thing); gtk_box_pack_start(GTK_BOX(box2), thing, FALSE, TRUE, 0); add_empty_hbox(box2); make_radio_group_full(resolutionlabels, box2, d->prefs_resolution_w, FALSE, TRUE, (void(*)())prefs_resolution_changed, d); box2 = gtk_hbox_new(FALSE, 4); gtk_widget_show(box2); gtk_box_pack_start(GTK_BOX(mainbox), box2, FALSE, TRUE, 0); thing = gtk_label_new(_("Channels:")); gtk_widget_show(thing); gtk_box_pack_start(GTK_BOX(box2), thing, FALSE, TRUE, 0); add_empty_hbox(box2); make_radio_group_full(channelslabels, box2, d->prefs_channels_w, FALSE, TRUE, (void(*)())prefs_channels_changed, d); box2 = gtk_hbox_new(FALSE, 4); gtk_widget_show(box2); gtk_box_pack_start(GTK_BOX(mainbox), box2, FALSE, TRUE, 0); thing = gtk_label_new(_("Frequency [Hz]:")); gtk_widget_show(thing); gtk_box_pack_start(GTK_BOX(box2), thing, FALSE, TRUE, 0); add_empty_hbox(box2); make_radio_group_full(mixfreqlabels, box2, d->prefs_mixfreq_w, FALSE, TRUE, (void(*)())prefs_mixfreq_changed, d); box2 = gtk_hbox_new(FALSE, 4); gtk_widget_show(box2); gtk_box_pack_start(GTK_BOX(mainbox), box2, FALSE, TRUE, 0); thing = gtk_label_new(_("Buffer Size:")); gtk_widget_show(thing); gtk_box_pack_start(GTK_BOX(box2), thing, FALSE, TRUE, 0); add_empty_hbox(box2); box3 = gtk_vbox_new(FALSE, 2); gtk_box_pack_start(GTK_BOX(box2), box3, FALSE, TRUE, 0); gtk_widget_show(box3); d->bufsizespin_w = thing = gtk_spin_button_new(GTK_ADJUSTMENT(gtk_adjustment_new(d->fragsize, 64.0, 16384.0, 64.0, 0.0, 0.0)), 0, 0); gtk_box_pack_start(GTK_BOX(box3), thing, FALSE, TRUE, 0); gtk_widget_show(thing); g_signal_connect(thing, "value-changed", G_CALLBACK(prefs_fragsize_changed), d); d->bufsizelabel_w = thing = gtk_label_new(""); gtk_box_pack_start(GTK_BOX(box3), thing, FALSE, TRUE, 0); gtk_widget_show(thing); box2 = gtk_hbox_new(FALSE, 4); gtk_widget_show(box2); gtk_box_pack_start(GTK_BOX(mainbox), box2, FALSE, TRUE, 0); add_empty_hbox(box2); d->estimatelabel_w = thing = gtk_label_new(""); gtk_box_pack_start(GTK_BOX(box2), thing, FALSE, TRUE, 0); gtk_widget_show(thing); add_empty_hbox(box2); box2 = gtk_hbox_new(FALSE, 4); gtk_widget_show(box2); gtk_box_pack_start(GTK_BOX(mainbox), box2, FALSE, TRUE, 0); alsa_card = gtk_label_new(_("ALSA card number:")); gtk_widget_show(alsa_card); gtk_box_pack_start(GTK_BOX(box2), alsa_card, FALSE, TRUE, 0); add_empty_hbox(box2); d->alsacardspin_w = alsa_card = gtk_spin_button_new(GTK_ADJUSTMENT(gtk_adjustment_new(d->card_number, 0.0, 256.0, 1.0, 1.0, 0.0)), 0, 0); gtk_box_pack_start(GTK_BOX(box2), alsa_card, FALSE, TRUE, 0); gtk_widget_show(alsa_card); g_signal_connect(alsa_card, "value-changed", G_CALLBACK(prefs_alsacard_changed), d); box2 = gtk_hbox_new(FALSE, 4); gtk_widget_show(box2); gtk_box_pack_start(GTK_BOX(mainbox), box2, FALSE, TRUE, 0); alsa_device = gtk_label_new(_("ALSA device number:")); gtk_widget_show(alsa_device); gtk_box_pack_start(GTK_BOX(box2), alsa_device, FALSE, TRUE, 0); add_empty_hbox(box2); d->alsadevicespin_w = alsa_device = gtk_spin_button_new(GTK_ADJUSTMENT(gtk_adjustment_new(d->device_number, 0.0, 256.0, 1.0, 1.0, 0.0)), 0, 0); gtk_box_pack_start(GTK_BOX(box2), alsa_device, FALSE, TRUE, 0); gtk_widget_show(alsa_device); g_signal_connect(alsa_device, "value-changed", G_CALLBACK(prefs_alsadevice_changed), d); prefs_init_from_structure(d); }
static void oss_make_config_widgets (oss_driver *d) { GtkWidget *thing, *mainbox, *box2, *box3; static const char *resolutionlabels[] = { "8 bits", "16 bits", NULL }; static const char *channelslabels[] = { "Mono", "Stereo", NULL }; static const char *mixfreqlabels[] = { "8000", "16000", "22050", "44100", NULL }; d->configwidget = mainbox = gtk_vbox_new(FALSE, 2); thing = gtk_label_new(_("These changes won't take effect until you restart playing.")); gtk_widget_show(thing); gtk_box_pack_start(GTK_BOX(mainbox), thing, FALSE, TRUE, 0); thing = gtk_hseparator_new(); gtk_widget_show(thing); gtk_box_pack_start(GTK_BOX(mainbox), thing, FALSE, TRUE, 0); box2 = gtk_hbox_new(FALSE, 4); gtk_widget_show(box2); gtk_box_pack_start(GTK_BOX(mainbox), box2, FALSE, TRUE, 0); thing = gtk_label_new(_("Output device (e.g. '/dev/dsp'):")); gtk_widget_show(thing); gtk_box_pack_start(GTK_BOX(box2), thing, FALSE, TRUE, 0); add_empty_hbox(box2); thing = gtk_entry_new_with_max_length(126); gtk_widget_show(thing); gtk_box_pack_start(GTK_BOX(box2), thing, FALSE, TRUE, 0); gtk_entry_set_text(GTK_ENTRY(thing), d->p_devdsp); g_signal_connect_after(thing, "changed", G_CALLBACK(oss_devdsp_changed), d); d->prefs_devdsp_w = thing; box2 = gtk_hbox_new(FALSE, 4); gtk_widget_show(box2); gtk_box_pack_start(GTK_BOX(mainbox), box2, FALSE, TRUE, 0); thing = gtk_label_new(_("Resolution:")); gtk_widget_show(thing); gtk_box_pack_start(GTK_BOX(box2), thing, FALSE, TRUE, 0); add_empty_hbox(box2); make_radio_group_full(resolutionlabels, box2, d->prefs_resolution_w, FALSE, TRUE, (void(*)())prefs_resolution_changed, d); box2 = gtk_hbox_new(FALSE, 4); gtk_widget_show(box2); gtk_box_pack_start(GTK_BOX(mainbox), box2, FALSE, TRUE, 0); thing = gtk_label_new(_("Channels:")); gtk_widget_show(thing); gtk_box_pack_start(GTK_BOX(box2), thing, FALSE, TRUE, 0); add_empty_hbox(box2); make_radio_group_full(channelslabels, box2, d->prefs_channels_w, FALSE, TRUE, (void(*)())prefs_channels_changed, d); box2 = gtk_hbox_new(FALSE, 4); gtk_widget_show(box2); gtk_box_pack_start(GTK_BOX(mainbox), box2, FALSE, TRUE, 0); thing = gtk_label_new(_("Frequency [Hz]:")); gtk_widget_show(thing); gtk_box_pack_start(GTK_BOX(box2), thing, FALSE, TRUE, 0); add_empty_hbox(box2); make_radio_group_full(mixfreqlabels, box2, d->prefs_mixfreq_w, FALSE, TRUE, (void(*)())prefs_mixfreq_changed, d); box2 = gtk_hbox_new(FALSE, 4); gtk_widget_show(box2); gtk_box_pack_start(GTK_BOX(mainbox), box2, FALSE, TRUE, 0); thing = gtk_label_new(_("Buffer Size:")); gtk_widget_show(thing); gtk_box_pack_start(GTK_BOX(box2), thing, FALSE, TRUE, 0); add_empty_hbox(box2); box3 = gtk_vbox_new(FALSE, 2); gtk_box_pack_start(GTK_BOX(box2), box3, FALSE, TRUE, 0); gtk_widget_show(box3); d->bufsizespin_w = thing = gtk_spin_button_new(GTK_ADJUSTMENT(gtk_adjustment_new(5.0, 5.0, 15.0, 1.0, 1.0, 0.0)), 0, 0); gtk_box_pack_start(GTK_BOX(box3), thing, FALSE, TRUE, 0); gtk_widget_show(thing); g_signal_connect(thing, "value-changed", G_CALLBACK(prefs_fragsize_changed), d); d->bufsizelabel_w = thing = gtk_label_new(""); gtk_box_pack_start(GTK_BOX(box3), thing, FALSE, TRUE, 0); gtk_widget_show(thing); box2 = gtk_hbox_new(FALSE, 4); gtk_widget_show(box2); gtk_box_pack_start(GTK_BOX(mainbox), box2, FALSE, TRUE, 0); add_empty_hbox(box2); d->estimatelabel_w = thing = gtk_label_new(""); gtk_box_pack_start(GTK_BOX(box2), thing, FALSE, TRUE, 0); gtk_widget_show(thing); add_empty_hbox(box2); prefs_init_from_structure(d); }