# HG changeset patch # User Matti Hamalainen # Date 1172207585 0 # Node ID ba80c052e425eb6699f038ed5523c2b80785534d # Parent 6490ceb38b6477900061aba414893e0f8d23148c Configuration widget naming cleanups and GUI-related improvements; Started planning and implementation of SIDPlay2 filter settings loading/saving and import/export functionality. diff -r 6490ceb38b64 -r ba80c052e425 src/xs_config.c --- a/src/xs_config.c Fri Feb 23 05:11:02 2007 +0000 +++ b/src/xs_config.c Fri Feb 23 05:13:05 2007 +0000 @@ -57,7 +57,7 @@ #include "xs_glade.h" #include "xs_interface.h" #include "xs_support.h" -#include "xs_curve.h" + /* * Global widgets @@ -147,15 +147,15 @@ { WTYPE_BGROUP, CTYPE_INT, "cfg_emu_clock_ntsc", &xs_cfg.clockSpeed, XS_CLOCK_NTSC }, { WTYPE_BGROUP, CTYPE_INT, "cfg_emu_clock_pal", &xs_cfg.clockSpeed, XS_CLOCK_PAL }, { WTYPE_BUTTON, CTYPE_BOOL, "cfg_emu_clock_force", &xs_cfg.forceSpeed, 0 }, -{ WTYPE_BUTTON, CTYPE_BOOL, "cfg_emu_sidplay2_opt", &xs_cfg.sid2OptLevel, 0 }, +{ WTYPE_BUTTON, CTYPE_BOOL, "cfg_emu_sp2_opt", &xs_cfg.sid2OptLevel, 0 }, -{ WTYPE_BGROUP, CTYPE_INT, "cfg_emu_sidplay2_resid",&xs_cfg.sid2Builder, XS_BLD_RESID }, -{ WTYPE_BGROUP, CTYPE_INT, "cfg_emu_sidplay2_hardsid",&xs_cfg.sid2Builder, XS_BLD_HARDSID }, +{ WTYPE_BGROUP, CTYPE_INT, "cfg_emu_sp2_resid", &xs_cfg.sid2Builder, XS_BLD_RESID }, +{ WTYPE_BGROUP, CTYPE_INT, "cfg_emu_sp2_hardsid", &xs_cfg.sid2Builder, XS_BLD_HARDSID }, { WTYPE_BUTTON, CTYPE_BOOL, "cfg_emu_filters", &xs_cfg.emulateFilters, 0 }, -{ WTYPE_SCALE, CTYPE_FLOAT, "cfg_emu_filt_fs", &xs_cfg.filterFs, 0 }, -{ WTYPE_SCALE, CTYPE_FLOAT, "cfg_emu_filt_fm", &xs_cfg.filterFm, 0 }, -{ WTYPE_SCALE, CTYPE_FLOAT, "cfg_emu_filt_ft", &xs_cfg.filterFt, 0 }, +{ WTYPE_SCALE, CTYPE_FLOAT, "cfg_sp1_filter_fs", &xs_cfg.filterFs, 0 }, +{ WTYPE_SCALE, CTYPE_FLOAT, "cfg_sp1_filter_fm", &xs_cfg.filterFm, 0 }, +{ WTYPE_SCALE, CTYPE_FLOAT, "cfg_sp1_filter_ft", &xs_cfg.filterFt, 0 }, { WTYPE_BUTTON, CTYPE_BOOL, "cfg_maxtime_enable", &xs_cfg.playMaxTimeEnable, 0 }, { WTYPE_BUTTON, CTYPE_BOOL, "cfg_maxtime_unknown", &xs_cfg.playMaxTimeUnknown, 0 }, @@ -187,8 +187,7 @@ static const gint xs_widtable_max = (sizeof(xs_widtable) / sizeof(t_xs_wid_item)); -/* - * Reset/initialize the configuration +/* Reset/initialize the configuration */ void xs_init_configuration(void) { @@ -280,8 +279,67 @@ } -/* - * Get the configuration (from file or default) +/* Filter configuration handling + */ +static t_xs_sid2_filter * xs_filter_load(XS_CONFIG_FILE *cfg, gchar *pcFilterName) +{ +} + +static gboolean xs_filter_save(XS_CONFIG_FILE *cfg, t_xs_sid2_filter *pFilter) +{ + gchar *tmpStr; + gint i; + +} + + +/* Filter exporting and importing. These functions export/import + * filter settings to/from SIDPlay2 INI-type files. + */ +static gboolean xs_filters_import(gchar *pcFilename, t_xs_sid2_filter **pFilters, gint *nFilters) +{ + +} + + +static gboolean xs_filters_export(gchar *pcFilename, t_xs_sid2_filter *pFilters, gint nFilters) +{ + FILE *outFile; + t_xs_sid2_filter *f = pFilters; + gint n; + + /* Open/create the file */ + if ((outFile = fopen(pcFilename, "wb")) == NULL) + return FALSE; + + /* Write each filter spec in "INI"-style format */ + for (n = 0; n < nFilters; n++) { + gint i; + + fprintf(outFile, + "[%s]\n" + "type=1\n" + "points=%d\n", + f->name, f->npoints); + + for (i = 0; i < f->npoints; i++) { + fprintf(outFile, + "point%d=%d,%d\n", + i + 1, + f->points[i].x, + f->points[i].y); + } + + fprintf(outFile, "\n"); + f++; + } + + fclose(outFile); + return TRUE; +} + + +/* Get the configuration (from file or default) */ void xs_read_configuration(void) { @@ -339,9 +397,7 @@ } - -/* - * Write the current configuration +/* Write the current configuration */ gint xs_write_configuration(void) { @@ -396,8 +452,7 @@ } -/* - * Configuration panel was canceled +/* Configuration panel was canceled */ void xs_cfg_cancel(void) { @@ -406,8 +461,7 @@ } -/* - * Configuration was accepted (OK), save the settings +/* Configuration was accepted, save the settings */ void xs_cfg_ok(void) { @@ -498,8 +552,7 @@ } -/* - * Reset filter settings to defaults +/* Reset filter settings to defaults */ void xs_cfg_filter_reset(GtkButton * button, gpointer user_data) { @@ -512,8 +565,7 @@ } -/* - * HVSC songlength-database file selector response-functions +/* HVSC songlength-database file selector response-functions */ void xs_cfg_sld_dbbrowse(GtkButton * button, gpointer user_data) { @@ -553,8 +605,7 @@ } -/* - * STIL-database file selector response-functions +/* STIL-database file selector response-functions */ void xs_cfg_stil_browse(GtkButton * button, gpointer user_data) { @@ -594,8 +645,7 @@ } -/* - * HVSC location selector response-functions +/* HVSC location selector response-functions */ void xs_cfg_hvsc_browse(GtkButton * button, gpointer user_data) { @@ -635,8 +685,7 @@ } -/* - * Selection toggle handlers +/* Selection toggle handlers */ void xs_cfg_emu_filters_toggled(GtkToggleButton * togglebutton, gpointer user_data) { @@ -654,9 +703,7 @@ (void) user_data; - gtk_widget_set_sensitive(LUW("cfg_ftitle_format"), isActive); - gtk_widget_set_sensitive(LUW("cfg_ftitle_desc1"), isActive); - gtk_widget_set_sensitive(LUW("cfg_ftitle_desc2"), isActive); + gtk_widget_set_sensitive(LUW("cfg_ftitle_box"), isActive); } @@ -675,21 +722,21 @@ gtk_widget_set_sensitive(LUW("cfg_emu_mem_real"), isActive); - gtk_widget_set_sensitive(LUW("cfg_sidplay2_grp"), isActive); - gtk_widget_set_sensitive(LUW("cfg_emu_sidplay2_opt"), isActive); + gtk_widget_set_sensitive(LUW("cfg_sidplay2_frame"), isActive); + gtk_widget_set_sensitive(LUW("cfg_emu_sp2_opt"), isActive); gtk_widget_set_sensitive(LUW("cfg_chn_autopan"), !isActive); #ifdef HAVE_RESID_BUILDER - gtk_widget_set_sensitive(LUW("cfg_emu_sidplay2_resid"), isActive); + gtk_widget_set_sensitive(LUW("cfg_emu_sp2_resid"), isActive); #else - gtk_widget_set_sensitive(LUW("cfg_emu_sidplay2_resid"), FALSE); + gtk_widget_set_sensitive(LUW("cfg_emu_sp2_resid"), FALSE); #endif #ifdef HAVE_HARDSID_BUILDER - gtk_widget_set_sensitive(LUW("cfg_emu_sidplay2_hardsid"), isActive); + gtk_widget_set_sensitive(LUW("cfg_emu_sp2_hardsid"), isActive); #else - gtk_widget_set_sensitive(LUW("cfg_emu_sidplay2_hardsid"), FALSE); + gtk_widget_set_sensitive(LUW("cfg_emu_sp2_hardsid"), FALSE); #endif } @@ -700,9 +747,7 @@ (void) user_data; - gtk_widget_set_sensitive(LUW("cfg_oversample_factor"), isActive); - gtk_widget_set_sensitive(LUW("cfg_oversample_label1"), isActive); - gtk_widget_set_sensitive(LUW("cfg_oversample_label2"), isActive); + gtk_widget_set_sensitive(LUW("cfg_oversample_box"), isActive); } @@ -712,9 +757,7 @@ (void) user_data; - gtk_widget_set_sensitive(LUW("cfg_mintime"), isActive); - gtk_widget_set_sensitive(LUW("cfg_mintime_label1"), isActive); - gtk_widget_set_sensitive(LUW("cfg_mintime_label2"), isActive); + gtk_widget_set_sensitive(LUW("cfg_mintime_box"), isActive); } @@ -726,9 +769,7 @@ (void) user_data; gtk_widget_set_sensitive(LUW("cfg_maxtime_unknown"), isActive); - gtk_widget_set_sensitive(LUW("cfg_maxtime"), isActive); - gtk_widget_set_sensitive(LUW("cfg_maxtime_label1"), isActive); - gtk_widget_set_sensitive(LUW("cfg_maxtime_label2"), isActive); + gtk_widget_set_sensitive(LUW("cfg_maxtime_box"), isActive); } @@ -738,9 +779,7 @@ (void) user_data; - gtk_widget_set_sensitive(LUW("cfg_sld_dbpath"), isActive); - gtk_widget_set_sensitive(LUW("cfg_sld_dbbrowse"), isActive); - gtk_widget_set_sensitive(LUW("cfg_sld_label1"), isActive); + gtk_widget_set_sensitive(LUW("cfg_sld_box"), isActive); } @@ -750,13 +789,8 @@ (void) user_data; - gtk_widget_set_sensitive(LUW("cfg_stil_dbpath"), isActive); - gtk_widget_set_sensitive(LUW("cfg_stil_browse"), isActive); - gtk_widget_set_sensitive(LUW("cfg_stil_label1"), isActive); - - gtk_widget_set_sensitive(LUW("cfg_hvsc_path"), isActive); - gtk_widget_set_sensitive(LUW("cfg_hvsc_browse"), isActive); - gtk_widget_set_sensitive(LUW("cfg_hvsc_label1"), isActive); + gtk_widget_set_sensitive(LUW("cfg_stil_box1"), isActive); + gtk_widget_set_sensitive(LUW("cfg_stil_box2"), isActive); } @@ -767,7 +801,7 @@ (void) user_data; gtk_widget_set_sensitive(LUW("cfg_subauto_min_only"), isActive); - gtk_widget_set_sensitive(LUW("cfg_subauto_mintime"), isActive); + gtk_widget_set_sensitive(LUW("cfg_subauto_box"), isActive); } @@ -778,7 +812,7 @@ (void) user_data; - gtk_widget_set_sensitive(LUW("cfg_subauto_mintime"), isActive); + gtk_widget_set_sensitive(LUW("cfg_subauto_box"), isActive); } @@ -814,8 +848,7 @@ } -/* - * Execute the configuration panel +/* Execute the configuration panel */ void xs_configure(void) { @@ -837,14 +870,16 @@ XS_MUTEX_LOCK(xs_cfg); /* Create the custom filter curve widget for libSIDPlay2 */ -/* c = xs_curve_new(); - gtk_widget_set_name(c, "cfg_filter2_curve"); + xs_curve_reset(XS_CURVE(c)); + + gtk_widget_set_name(c, "cfg_sp2_filter_curve"); gtk_widget_ref(c); - gtk_object_set_data_full(GTK_OBJECT(xs_configwin), "cfg_filter2_curve", c, (GtkDestroyNotify) gtk_widget_unref); + gtk_object_set_data_full(GTK_OBJECT(xs_configwin), "cfg_sp2_filter_curve", c, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show(c); - gtk_box_pack_start(GTK_BOX(LUW("cfg_box_sidplay2")), c, TRUE, TRUE, 4); -*/ + gtk_container_add(GTK_CONTAINER(LUW("cfg_sp2_filter_frame")), c); + //gtk_container_set_border_width(GTK_CONTAINER(c), 2); + /* Based on available optional parts, gray out options */ #ifndef HAVE_SIDPLAY1 @@ -871,7 +906,7 @@ #endif /* Update the widget sensitivities */ - gtk_widget_set_sensitive(LUW("cfg_resid_grp"), FALSE); + gtk_widget_set_sensitive(LUW("cfg_resid_frame"), FALSE); xs_cfg_emu_filters_toggled((GtkToggleButton *) LUW("cfg_emu_filters"), NULL); xs_cfg_ftitle_override_toggled((GtkToggleButton *) LUW("cfg_ftitle_override"), NULL); diff -r 6490ceb38b64 -r ba80c052e425 src/xs_config.h --- a/src/xs_config.h Fri Feb 23 05:11:02 2007 +0000 +++ b/src/xs_config.h Fri Feb 23 05:13:05 2007 +0000 @@ -2,13 +2,14 @@ #define XS_CONFIG_H #include "xmms-sid.h" +#include "xs_curve.h" #ifdef __cplusplus extern "C" { #endif -/* - * Configuration structure + +/* Configuration structure */ enum XS_EMUENGINE { XS_ENG_SIDPLAY1 = 1, @@ -66,31 +67,43 @@ }; +typedef struct { + t_xs_int_point points[XS_SIDPLAY2_NFPOINTS]; + gint npoints; + gchar *name; +} t_xs_sid2_filter; + + extern struct t_xs_cfg { /* General audio settings */ gint audioBitsPerSample; gint audioChannels; gint audioFrequency; - /* General libSIDPlay settings */ + gboolean oversampleEnable; + gint oversampleFactor; /* Factor of oversampling */ + + /* Emulation settings */ gboolean mos8580; /* TRUE = 8580, FALSE = 6581 */ gboolean forceModel; - gboolean emulateFilters; - gfloat filterFs; - gfloat filterFm; - gfloat filterFt; gint memoryMode; /* See XS_MPU-constants */ gint clockSpeed; /* PAL (50Hz) or NTSC (60Hz) */ gboolean forceSpeed; /* TRUE = force to given clockspeed */ gint playerEngine; /* Selected player engine */ + gboolean emulateFilters; + gfloat sid1FilterFs; + gfloat sid1FilterFm; + gfloat sid1FilterFt; + gint sid2OptLevel; /* SIDPlay2 emulation optimization */ gint sid2Builder; /* SIDPlay2 "builder" aka SID-emu */ - - gboolean oversampleEnable; - gint oversampleFactor; /* Factor of oversampling */ - + t_xs_sid2_filter sid2Filter; /* Current SIDPlay2 filter */ + t_xs_sid2_filter **sid2FilterPresets; + gint sid2NFilterPresets; + + /* Playing settings */ gboolean playMaxTimeEnable, playMaxTimeUnknown; /* Use max-time only when song-length is unknown */ @@ -121,8 +134,8 @@ XS_MUTEX_H(xs_cfg); -/* - * Configuration-file + +/* Configuration-file */ enum { CTYPE_INT = 1, @@ -157,16 +170,14 @@ } t_xs_wid_item; -/* - * Functions +/* Functions */ void xs_init_configuration(void); void xs_configure(void); void xs_read_configuration(void); gint xs_write_configuration(void); - #ifdef __cplusplus } #endif -#endif /* XS_CONFIG_H */ +#endif /* XS_CONFIG_H */ diff -r 6490ceb38b64 -r ba80c052e425 xmms-sid.glade --- a/xmms-sid.glade Fri Feb 23 05:11:02 2007 +0000 +++ b/xmms-sid.glade Fri Feb 23 05:13:05 2007 +0000 @@ -75,7 +75,7 @@ GtkFrame - w_frame4 + cfg_sndres_frame 4 0 @@ -127,7 +127,7 @@ GtkFrame - w_frame5 + cfg_channels_frame 4 0 @@ -195,7 +195,7 @@ GtkFrame - w_frame8 + cfg_samplerate_frame 4 0 @@ -285,7 +285,7 @@ GtkFrame - cfg_oversample_grp + cfg_oversample_frame 4 0 @@ -324,7 +324,7 @@ GtkHBox - w_hbox16 + cfg_oversample_box 2 False 4 @@ -427,7 +427,7 @@ GtkFrame - w_frame2 + cfg_clock_frame 4 0 @@ -496,7 +496,7 @@ GtkFrame - w_frame3 + cfg_sid_model_frame 4 0 @@ -565,7 +565,7 @@ GtkFrame - w_frame26 + cfg_emulib_frame 4 0 @@ -629,7 +629,7 @@ GtkFrame - w_frame1 + cfg_memmode_frame 4 0 @@ -731,7 +731,7 @@ GtkFrame - cfg_sidplay2_grp + cfg_sidplay2_frame 4 0 @@ -751,7 +751,7 @@ GtkCheckButton - cfg_emu_sidplay2_opt + cfg_emu_sp2_opt This setting can be used to enable libSIDPlay2's "optimization mode", which in downgrades the emulation from cycle-exact to something similar to frame-exact. The result is lower CPU usage, but worse accuracy. True @@ -766,7 +766,7 @@ GtkRadioButton - cfg_emu_sidplay2_resid + cfg_emu_sp2_resid reSID is the software SID-chip simulator based on SID reverse-engineering, created by Dag Lem. It is probably the closest thing to real SID available as software-only emulation. True @@ -782,7 +782,7 @@ GtkRadioButton - cfg_emu_sidplay2_hardsid + cfg_emu_sp2_hardsid HardSID is a EISA/PCI card for PC-compatibles, which can be fitted with a real SID-chip. Software can be used to control the HardSID and combined with software emulation of rest of C64 via libSIDPlay2 HardSID can be used to achieve "near 100%" similarity to real C64. For more information, see http://www.hardsid.com/ True @@ -800,7 +800,7 @@ GtkFrame - cfg_resid_grp + cfg_resid_frame 4 0 @@ -942,14 +942,14 @@ GtkHBox - cfg_box_sidplay1 + cfg_box_filter_sidplay1 4 False 0 GtkFrame - cfg_frm_fs + cfg_sp1_frm_fs 2 45 @@ -957,13 +957,13 @@ GTK_SHADOW_ETCHED_IN 0 - False + True True GtkVScale - cfg_emu_filt_fs + cfg_sp1_filter_fs True True GTK_POS_TOP @@ -980,7 +980,7 @@ GtkFrame - cfg_frm_fm + cfg_sp1_frm_fm 2 45 @@ -988,13 +988,13 @@ GTK_SHADOW_ETCHED_IN 0 - False + True True GtkVScale - cfg_emu_filt_fm + cfg_sp1_filter_fm True True GTK_POS_TOP @@ -1011,7 +1011,7 @@ GtkFrame - cfg_frm_ft + cfg_sp1_frm_ft 2 45 @@ -1019,13 +1019,13 @@ GTK_SHADOW_ETCHED_IN 0 - False + True True GtkVScale - cfg_emu_filt_ft + cfg_sp1_filter_ft True True GTK_POS_TOP @@ -1054,7 +1054,7 @@ GtkButton - cfg_filter_reset + cfg_sp1_filter_reset True clicked @@ -1086,16 +1086,93 @@ - GtkHBox - cfg_box_sidplay2 - 4 + GtkVBox + cfg_box_filter_sidplay2 False 0 + GtkHBox + cfg_sp_filter_controlbox + 2 + False + 0 + + 0 + False + False + + + + GtkCombo + cfg_sp2_filter_combo + False + True + False + True + False + 6581 (reSID) +8580 (reSID) +6581R1 (alankila) +6581R4 (alankila) + + + 0 + True + True + + + + GtkEntry + GtkCombo:entry + cfg_sp2_filter_combo_entry + True + True + True + 0 + 6581R1 (alankila) + + + + + GtkHButtonBox + hbuttonbox2 + GTK_BUTTONBOX_END + 0 + 85 + 27 + 7 + 0 + + 0 + True + True + + + + GtkButton + cfg_sp2_filter_load + True + True + + GTK_RELIEF_NORMAL + + + + GtkButton + cfg_sp2_filter_save + True + True + + GTK_RELIEF_NORMAL + + + + + GtkFrame - w_frame33 - 4 + cfg_sp2_filter_frame + 2 0 GTK_SHADOW_ETCHED_IN @@ -1109,106 +1186,6 @@ Placeholder - - - GtkVBox - w_vbox38 - False - 0 - - 0 - False - False - - - - GtkFrame - w_frame32 - 4 - - 0 - GTK_SHADOW_ETCHED_IN - - 0 - False - True - - - - GtkVBox - w_vboxbaz - 2 - False - 0 - - - GtkCombo - combo1 - False - True - False - True - False - 6581 (reSID) -8580 (reSID) -6581R1 (alankila) -6581R4 (alankila) - - - 0 - False - False - - - - GtkEntry - GtkCombo:entry - combo-entry1 - True - True - True - 0 - 6581R1 (alankila) - - - - - GtkHButtonBox - hbuttonbox2 - 2 - GTK_BUTTONBOX_SPREAD - 0 - 85 - 27 - 7 - 0 - - 0 - False - False - - - - GtkButton - button3 - True - True - - GTK_RELIEF_NORMAL - - - - GtkButton - button4 - True - True - - GTK_RELIEF_NORMAL - - - - - @@ -1287,7 +1264,7 @@ GtkHBox - w_hbox18 + cfg_mintime_box False 2 @@ -1418,7 +1395,7 @@ GtkHBox - w_hbox14 + cfg_maxtime_box False 2 @@ -1534,7 +1511,7 @@ GtkHBox - w_hbox13 + cfg_sld_box False 4 @@ -1660,7 +1637,7 @@ GtkHBox - w_hbox3 + cfg_stil_box1 False 0 @@ -1744,7 +1721,7 @@ GtkHBox - w_hbox17 + cfg_stil_box2 False 0 @@ -1843,10 +1820,10 @@ GtkVBox - w_vbox16 + vbox1 2 False - 2 + 0 GtkCheckButton @@ -1869,73 +1846,85 @@ - GtkEntry - cfg_ftitle_format - True - True - True - 0 - + GtkVBox + cfg_ftitle_box + False + 2 - 2 - False - False - - - - - GtkHBox - w_hbox9 - True - 0 - - 2 - False - False + 0 + True + True - GtkLabel - cfg_ftitle_desc1 - - GTK_JUSTIFY_LEFT - False - 0.04 - 0.5 - 0 - 0 + GtkEntry + cfg_ftitle_format + True + True + True + 0 + - 0 + 2 False False - GtkLabel - cfg_ftitle_desc2 - @@ -2107,7 +2096,7 @@ GtkHBox - w_hbox20 + cfg_subauto_box False 2 @@ -2994,4 +2983,20 @@ + + GtkWindow + window1 + window1 + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + False + True + False + + + Placeholder + + +