# HG changeset patch # User Matti Hamalainen # Date 1189036353 -10800 # Node ID 75b8e7737bcd5eb435d4d7ea61e6600ba618f279 # Parent b46e7f445e88cd4f0fd9dedefab87a09f7c88539 Added support for SID-plugin specific Tuplez format string (see config dialog). Still need to add descriptions of the fields. diff -r b46e7f445e88 -r 75b8e7737bcd src/sid/xmms-sid.c --- a/src/sid/xmms-sid.c Wed Sep 05 22:44:25 2007 +0300 +++ b/src/sid/xmms-sid.c Thu Sep 06 02:52:33 2007 +0300 @@ -88,7 +88,7 @@ XS_MUTEX(xs_status); static XS_THREAD_T xs_decode_thread; -Tuple * xs_get_song_tuple_info(gchar *songFilename, gint subTune); +void xs_get_song_tuple_info(Tuple *pResult, t_xs_tuneinfo *pInfo, gint subTune); /* * Error messages @@ -460,11 +460,12 @@ /* Set song information for current subtune */ XSDEBUG("foobar #1\n"); xs_status.sidPlayer->plrUpdateSIDInfo(&xs_status); - XSDEBUG("foobar #2\n"); XS_MUTEX_UNLOCK(xs_status); - tmpTuple = xs_get_song_tuple_info(tmpTune->sidFilename, xs_status.currSong); - XSDEBUG("foobar #3\n"); - tmpTitle = tuple_formatter_process_string(tmpTuple, get_gentitle_format()); + tmpTuple = tuple_new_from_filename(tmpTune->sidFilename); + xs_get_song_tuple_info(tmpTuple, tmpTune, xs_status.currSong); + + tmpTitle = tuple_formatter_process_string(tmpTuple, + xs_cfg.titleOverride ? xs_cfg.titleFormat : get_gentitle_format()); XSDEBUG("foobar #4\n"); XS_MUTEX_LOCK(xs_status); @@ -655,29 +656,17 @@ /* Return song information Tuple */ -Tuple * xs_get_song_tuple_info(gchar *songFilename, gint subTune) +void xs_get_song_tuple_info(Tuple *pResult, t_xs_tuneinfo *pInfo, gint subTune) { - t_xs_tuneinfo *pInfo; - Tuple *pResult; - gchar *tmpStr; - - pResult = tuple_new_from_filename(songFilename); + gchar *tmpStr, tmpStr2[64]; - /* Get tune information from emulation engine */ - XS_MUTEX_LOCK(xs_status); - pInfo = xs_status.sidPlayer->plrGetSIDInfo(songFilename); - if (!pInfo) { - XS_MUTEX_UNLOCK(xs_status); - return pResult; - } - XS_MUTEX_UNLOCK(xs_status); - tuple_associate_string(pResult, "title", pInfo->sidName); tuple_associate_string(pResult, "artist", pInfo->sidComposer); tuple_associate_string(pResult, "genre", "SID-tune"); tuple_associate_string(pResult, "copyright", pInfo->sidCopyright); - tuple_associate_string(pResult, "format", pInfo->sidFormat); + tuple_associate_int(pResult, "subtunes", pInfo->nsubTunes); + tuple_associate_string(pResult, "sid-format", pInfo->sidFormat); switch (pInfo->sidModel) { case XS_SIDMODEL_6581: tmpStr = "6581"; break; @@ -686,7 +675,7 @@ default: tmpStr = "?"; break; } tuple_associate_string(pResult, "sid-model", tmpStr); - + /* Get sub-tune information, if available */ if (subTune < 0 || pInfo->startTune > pInfo->nsubTunes) subTune = pInfo->startTune; @@ -694,26 +683,61 @@ if ((subTune > 0) && (subTune <= pInfo->nsubTunes)) { gint tmpInt = pInfo->subTunes[subTune - 1].tuneLength; tuple_associate_int(pResult, "length", (tmpInt < 0) ? -1 : tmpInt * 1000); + + tmpInt = pInfo->subTunes[subTune - 1].tuneSpeed; + if (tmpInt > 0) { + switch (tmpInt) { + case XS_CLOCK_PAL: tmpStr = "PAL"; break; + case XS_CLOCK_NTSC: tmpStr = "NTSC"; break; + case XS_CLOCK_ANY: tmpStr = "ANY"; break; + case XS_CLOCK_VBI: tmpStr = "VBI"; break; + case XS_CLOCK_CIA: tmpStr = "CIA"; break; + default: + g_snprintf(tmpStr2, sizeof(tmpStr2), "%dHz", tmpInt); + tmpStr = tmpStr2; + break; + } + } else + tmpStr = "?"; + + tuple_associate_string(pResult, "sid-speed", tmpStr); } else subTune = 1; tuple_associate_int(pResult, "subtune", subTune); tuple_associate_int(pResult, "track-number", subTune); - /* Free tune information */ - xs_tuneinfo_free(pInfo); - return pResult; + if (xs_cfg.titleOverride) + tuple_associate_string(pResult, "formatter", xs_cfg.titleFormat); } Tuple * xs_get_song_tuple(gchar *songFilename) { - Tuple *pResult; + Tuple *tmpResult; gchar *tmpFilename; + t_xs_tuneinfo *tmpInfo; gint subTune; + /* Get information from URL */ xs_get_trackinfo(songFilename, &tmpFilename, &subTune); - pResult = xs_get_song_tuple_info(tmpFilename, subTune); + + tmpResult = tuple_new_from_filename(tmpFilename); + if (!tmpResult) { + g_free(tmpFilename); + return NULL; + } + + /* Get tune information from emulation engine */ + XS_MUTEX_LOCK(xs_status); + tmpInfo = xs_status.sidPlayer->plrGetSIDInfo(tmpFilename); + XS_MUTEX_UNLOCK(xs_status); g_free(tmpFilename); - return pResult; + if (!tmpInfo) + return tmpResult; + + xs_get_song_tuple_info(tmpResult, tmpInfo, subTune); + xs_tuneinfo_free(tmpInfo); + + return tmpResult; } diff -r b46e7f445e88 -r 75b8e7737bcd src/sid/xmms-sid.glade --- a/src/sid/xmms-sid.glade Wed Sep 05 22:44:25 2007 +0300 +++ b/src/sid/xmms-sid.glade Thu Sep 06 02:52:33 2007 +0300 @@ -2410,6 +2410,154 @@ + + 4 + True + 0 + 0.5 + GTK_SHADOW_ETCHED_IN + + + + 2 + True + False + 2 + + + + True + By enabling this option you can specify a custom Tuplez formatting string for SID-files. The SID-plugin specific Tuplez tags are described shortly below. + True + Override generic Tuplez format string + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + 0 + False + False + + + + + + True + False + 0 + + + + True + Tuplez format string for SID-files + True + True + True + 0 + + True + + False + + + 0 + False + False + + + + + + True + Descriptions of <i>SID-specific</i> Tuplez fields go here. <b>:D</b> + False + True + GTK_JUSTIFY_LEFT + True + False + 0.5 + 0.5 + 8 + 8 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + True + True + + + + + 0 + True + True + + + + + + + + True + Song title format: + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + label_item + + + + + False + True + + + + + + True + Title + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + tab + + + + True False @@ -2433,6 +2581,7 @@ True + If enabled, sub-tunes of each file will be added to playlist. If disabled, only the default sub-tune will be added. True Add sub-tunes to playlist True @@ -2453,8 +2602,9 @@ True + Only add sub-tunes that have a duration of at least specified time. True - Only tunes with specified minimum length + Only tunes with specified minimum duration True GTK_RELIEF_NORMAL True diff -r b46e7f445e88 -r 75b8e7737bcd src/sid/xs_config.c --- a/src/sid/xs_config.c Wed Sep 05 22:44:25 2007 +0300 +++ b/src/sid/xs_config.c Thu Sep 06 02:52:33 2007 +0300 @@ -127,10 +127,10 @@ #ifndef AUDACIOUS_PLUGIN { CTYPE_INT, &xs_cfg.subsongControl, "subsongControl" }, { CTYPE_BOOL, &xs_cfg.detectMagic, "detectMagic" }, +#endif { CTYPE_BOOL, &xs_cfg.titleOverride, "titleOverride" }, { CTYPE_STR, &xs_cfg.titleFormat, "titleFormat" }, -#endif { CTYPE_BOOL, &xs_cfg.subAutoEnable, "subAutoEnable" }, { CTYPE_BOOL, &xs_cfg.subAutoMinOnly, "subAutoMinOnly" }, @@ -191,10 +191,10 @@ { WTYPE_BGROUP, CTYPE_INT, "cfg_subctrl_patch", &xs_cfg.subsongControl, XS_SSC_PATCH }, { WTYPE_BUTTON, CTYPE_BOOL, "cfg_detectmagic", &xs_cfg.detectMagic, 0 }, +#endif { WTYPE_BUTTON, CTYPE_BOOL, "cfg_ftitle_override", &xs_cfg.titleOverride, 0 }, { WTYPE_TEXT, CTYPE_STR, "cfg_ftitle_format", &xs_cfg.titleFormat, 0 }, -#endif { WTYPE_BUTTON, CTYPE_BOOL, "cfg_subauto_enable", &xs_cfg.subAutoEnable, 0 }, { WTYPE_BUTTON, CTYPE_BOOL, "cfg_subauto_min_only", &xs_cfg.subAutoMinOnly, 0 }, @@ -275,7 +275,7 @@ xs_pstrcpy(&xs_cfg.stilDBPath, "~/C64Music/DOCUMENTS/STIL.txt"); xs_pstrcpy(&xs_cfg.hvscPath, "~/C64Music"); -#ifdef HAVE_SONG_POSITION +#if defined(HAVE_SONG_POSITION) && !defined(AUDACIOUS_PLUGIN) xs_cfg.subsongControl = XS_SSC_PATCH; #else xs_cfg.subsongControl = XS_SSC_POPUP; @@ -283,9 +283,7 @@ xs_cfg.detectMagic = FALSE; -#if defined(HAVE_XMMSEXTRA) || defined(AUDACIOUS_PLUGIN) - xs_cfg.titleOverride = FALSE; -#else +#ifndef HAVE_XMMSEXTRA xs_cfg.titleOverride = TRUE; #endif xs_pstrcpy(&xs_cfg.titleFormat, "%p - %t (%c) [%n/%N][%m/%C]"); @@ -1080,7 +1078,7 @@ gtk_widget_set_sensitive(LUW("cfg_filters_notebook"), isActive); } -#ifndef AUDACIOUS_PLUGIN + void xs_cfg_ftitle_override_toggled(GtkToggleButton * togglebutton, gpointer user_data) { gboolean isActive = GTK_TOGGLE_BUTTON(togglebutton)->active; @@ -1089,7 +1087,7 @@ gtk_widget_set_sensitive(LUW("cfg_ftitle_box"), isActive); } -#endif + void xs_cfg_emu_sidplay1_toggled(GtkToggleButton * togglebutton, gpointer user_data) { @@ -1290,18 +1288,16 @@ gtk_widget_set_sensitive(LUW("cfg_resid_frame"), FALSE); -#ifndef AUDACIOUS_PLUGIN -# ifndef HAVE_XMMSEXTRA +#if !defined(HAVE_XMMSEXTRA) && !defined(AUDACIOUS_PLUGIN) gtk_widget_set_sensitive(LUW("cfg_ftitle_override"), FALSE); xs_cfg.titleOverride = TRUE; -# endif -# ifdef HAVE_SONG_POSITION +#endif + +#if !defined(HAVE_SONG_POSITION) && !defined(AUDACIOUS_PLUGIN) gtk_widget_set_sensitive(LUW("cfg_subctrl_patch"), FALSE); -# endif +#endif xs_cfg_ftitle_override_toggled(GTK_TOGGLE_BUTTON(LUW("cfg_ftitle_override")), NULL); -#endif /* !AUDACIOUS_PLUGIN */ - xs_cfg_emu_filters_toggled(GTK_TOGGLE_BUTTON(LUW("cfg_emu_filters")), NULL); xs_cfg_emu_sidplay1_toggled(GTK_TOGGLE_BUTTON(LUW("cfg_emu_sidplay1")), NULL); xs_cfg_emu_sidplay2_toggled(GTK_TOGGLE_BUTTON(LUW("cfg_emu_sidplay2")), NULL); diff -r b46e7f445e88 -r 75b8e7737bcd src/sid/xs_genui.h --- a/src/sid/xs_genui.h Wed Sep 05 22:44:25 2007 +0300 +++ b/src/sid/xs_genui.h Thu Sep 06 02:52:33 2007 +0300 @@ -188,3 +188,7 @@ xs_confirmwin_delete (GtkWidget *widget, GdkEvent *event, gpointer user_data); + +void +xs_cfg_ftitle_override_toggled (GtkToggleButton *togglebutton, + gpointer user_data); diff -r b46e7f445e88 -r 75b8e7737bcd src/sid/xs_interface.c --- a/src/sid/xs_interface.c Wed Sep 05 22:44:25 2007 +0300 +++ b/src/sid/xs_interface.c Thu Sep 06 02:52:33 2007 +0300 @@ -173,6 +173,14 @@ GtkWidget *cfg_sld_dbbrowse; GtkWidget *label17; GtkWidget *w_label26; + GtkWidget *frame1; + GtkWidget *vbox1; + GtkWidget *cfg_ftitle_override; + GtkWidget *cfg_ftitle_box; + GtkWidget *cfg_ftitle_format; + GtkWidget *cfg_ftitle_descs; + GtkWidget *label29; + GtkWidget *w_label27; GtkWidget *w_vbox19; GtkWidget *w_frame31; GtkWidget *w_vbox35; @@ -1016,6 +1024,54 @@ gtk_notebook_set_tab_label (GTK_NOTEBOOK (cfg_notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (cfg_notebook), 4), w_label26); gtk_label_set_justify (GTK_LABEL (w_label26), GTK_JUSTIFY_CENTER); + frame1 = gtk_frame_new (NULL); + gtk_widget_set_name (frame1, "frame1"); + gtk_widget_show (frame1); + gtk_container_add (GTK_CONTAINER (cfg_notebook), frame1); + gtk_container_set_border_width (GTK_CONTAINER (frame1), 4); + + vbox1 = gtk_vbox_new (FALSE, 2); + gtk_widget_set_name (vbox1, "vbox1"); + gtk_widget_show (vbox1); + gtk_container_add (GTK_CONTAINER (frame1), vbox1); + gtk_container_set_border_width (GTK_CONTAINER (vbox1), 2); + + cfg_ftitle_override = gtk_check_button_new_with_mnemonic (_("Override generic Tuplez format string")); + gtk_widget_set_name (cfg_ftitle_override, "cfg_ftitle_override"); + gtk_widget_show (cfg_ftitle_override); + gtk_box_pack_start (GTK_BOX (vbox1), cfg_ftitle_override, FALSE, FALSE, 0); + gtk_tooltips_set_tip (tooltips, cfg_ftitle_override, _("By enabling this option you can specify a custom Tuplez formatting string for SID-files. The SID-plugin specific Tuplez tags are described shortly below."), NULL); + + cfg_ftitle_box = gtk_vbox_new (FALSE, 0); + gtk_widget_set_name (cfg_ftitle_box, "cfg_ftitle_box"); + gtk_widget_show (cfg_ftitle_box); + gtk_box_pack_start (GTK_BOX (vbox1), cfg_ftitle_box, TRUE, TRUE, 0); + + cfg_ftitle_format = gtk_entry_new (); + gtk_widget_set_name (cfg_ftitle_format, "cfg_ftitle_format"); + gtk_widget_show (cfg_ftitle_format); + gtk_box_pack_start (GTK_BOX (cfg_ftitle_box), cfg_ftitle_format, FALSE, FALSE, 0); + gtk_tooltips_set_tip (tooltips, cfg_ftitle_format, _("Tuplez format string for SID-files"), NULL); + gtk_entry_set_invisible_char (GTK_ENTRY (cfg_ftitle_format), 9679); + + cfg_ftitle_descs = gtk_label_new (_("Descriptions of SID-specific Tuplez fields go here. :D")); + gtk_widget_set_name (cfg_ftitle_descs, "cfg_ftitle_descs"); + gtk_widget_show (cfg_ftitle_descs); + gtk_box_pack_start (GTK_BOX (cfg_ftitle_box), cfg_ftitle_descs, TRUE, TRUE, 0); + gtk_label_set_use_markup (GTK_LABEL (cfg_ftitle_descs), TRUE); + gtk_label_set_line_wrap (GTK_LABEL (cfg_ftitle_descs), TRUE); + gtk_misc_set_padding (GTK_MISC (cfg_ftitle_descs), 8, 8); + + label29 = gtk_label_new (_("Song title format:")); + gtk_widget_set_name (label29, "label29"); + gtk_widget_show (label29); + gtk_frame_set_label_widget (GTK_FRAME (frame1), label29); + + w_label27 = gtk_label_new (_("Title")); + gtk_widget_set_name (w_label27, "w_label27"); + gtk_widget_show (w_label27); + gtk_notebook_set_tab_label (GTK_NOTEBOOK (cfg_notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (cfg_notebook), 5), w_label27); + w_vbox19 = gtk_vbox_new (FALSE, 0); gtk_widget_set_name (w_vbox19, "w_vbox19"); gtk_widget_show (w_vbox19); @@ -1037,11 +1093,13 @@ gtk_widget_set_name (cfg_subauto_enable, "cfg_subauto_enable"); gtk_widget_show (cfg_subauto_enable); gtk_box_pack_start (GTK_BOX (w_vbox35), cfg_subauto_enable, FALSE, FALSE, 0); + gtk_tooltips_set_tip (tooltips, cfg_subauto_enable, _("If enabled, sub-tunes of each file will be added to playlist. If disabled, only the default sub-tune will be added."), NULL); - cfg_subauto_min_only = gtk_check_button_new_with_mnemonic (_("Only tunes with specified minimum length ")); + cfg_subauto_min_only = gtk_check_button_new_with_mnemonic (_("Only tunes with specified minimum duration")); gtk_widget_set_name (cfg_subauto_min_only, "cfg_subauto_min_only"); gtk_widget_show (cfg_subauto_min_only); gtk_box_pack_start (GTK_BOX (w_vbox35), cfg_subauto_min_only, FALSE, FALSE, 0); + gtk_tooltips_set_tip (tooltips, cfg_subauto_min_only, _("Only add sub-tunes that have a duration of at least specified time."), NULL); cfg_subauto_box = gtk_hbox_new (FALSE, 2); gtk_widget_set_name (cfg_subauto_box, "cfg_subauto_box"); @@ -1171,7 +1229,7 @@ w_label3 = gtk_label_new (_("Misc")); gtk_widget_set_name (w_label3, "w_label3"); gtk_widget_show (w_label3); - gtk_notebook_set_tab_label (GTK_NOTEBOOK (cfg_notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (cfg_notebook), 5), w_label3); + gtk_notebook_set_tab_label (GTK_NOTEBOOK (cfg_notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (cfg_notebook), 6), w_label3); gtk_label_set_justify (GTK_LABEL (w_label3), GTK_JUSTIFY_CENTER); hbuttonbox1 = gtk_hbutton_box_new (); @@ -1247,6 +1305,9 @@ g_signal_connect ((gpointer) cfg_sld_dbbrowse, "clicked", G_CALLBACK (xs_cfg_sldb_browse), NULL); + g_signal_connect ((gpointer) cfg_ftitle_override, "toggled", + G_CALLBACK (xs_cfg_ftitle_override_toggled), + NULL); g_signal_connect ((gpointer) cfg_subauto_enable, "toggled", G_CALLBACK (xs_cfg_subauto_enable_toggled), NULL); @@ -1401,6 +1462,14 @@ GLADE_HOOKUP_OBJECT (xs_configwin, cfg_sld_dbbrowse, "cfg_sld_dbbrowse"); GLADE_HOOKUP_OBJECT (xs_configwin, label17, "label17"); GLADE_HOOKUP_OBJECT (xs_configwin, w_label26, "w_label26"); + GLADE_HOOKUP_OBJECT (xs_configwin, frame1, "frame1"); + GLADE_HOOKUP_OBJECT (xs_configwin, vbox1, "vbox1"); + GLADE_HOOKUP_OBJECT (xs_configwin, cfg_ftitle_override, "cfg_ftitle_override"); + GLADE_HOOKUP_OBJECT (xs_configwin, cfg_ftitle_box, "cfg_ftitle_box"); + GLADE_HOOKUP_OBJECT (xs_configwin, cfg_ftitle_format, "cfg_ftitle_format"); + GLADE_HOOKUP_OBJECT (xs_configwin, cfg_ftitle_descs, "cfg_ftitle_descs"); + GLADE_HOOKUP_OBJECT (xs_configwin, label29, "label29"); + GLADE_HOOKUP_OBJECT (xs_configwin, w_label27, "w_label27"); GLADE_HOOKUP_OBJECT (xs_configwin, w_vbox19, "w_vbox19"); GLADE_HOOKUP_OBJECT (xs_configwin, w_frame31, "w_frame31"); GLADE_HOOKUP_OBJECT (xs_configwin, w_vbox35, "w_vbox35");