# HG changeset patch # User Matti Hamalainen # Date 1056849421 0 # Node ID d3bb914e3af321cc9278dd204336fe5c55ad9ac2 # Parent 05220299c6e81a9db1a340a44a345c08ca773cb4 Fixes for sidplay2 stuff diff -r 05220299c6e8 -r d3bb914e3af3 src/xmms-sid.cc --- a/src/xmms-sid.cc Sun Jun 22 12:10:01 2003 +0000 +++ b/src/xmms-sid.cc Sun Jun 29 01:17:01 2003 +0000 @@ -77,6 +77,8 @@ pthread_mutex_t xs_mutex = PTHREAD_MUTEX_INITIALIZER; +gchar *xs_filetitle_get(gchar *, t_xs_tuneinfo *, gint); + /* * Create sub-song control window */ @@ -107,8 +109,6 @@ xs_read_configuration(); - add_pixmap_directory(PACKAGE_DATA_DIR "/pixmaps"); - /* Initialize status */ xs_status.isError = FALSE; xs_status.isPlaying = FALSE; @@ -426,13 +426,12 @@ /* Configure rest of the emulation */ - xs_emuConf.precision = xs_cfg.fmtBitsPerSample; - xs_emuConf.frequency = xs_cfg.fmtFrequency; - xs_emuConf.clockForced = xs_cfg.forceSpeed; - xs_emuConf.optimisation = xs_cfg.optimiseLevel; - xs_emuConf.sidModel = (xs_cfg.mos8580) ? SID2_MOS8580 : SID2_MOS6581; - xs_emuConf.sidDefault = SID2_MOS6581; - xs_emuConf.sidSamples = emulation.sidSamples; + xs_emuConf.precision = xs_cfg.fmtBitsPerSample; + xs_emuConf.frequency = xs_cfg.fmtFrequency; + xs_emuConf.clockForced = xs_cfg.forceSpeed; + xs_emuConf.optimisation = (xs_cfg.optimiseLevel) ? 1 : 0; + xs_emuConf.sidDefault = xs_emuConf.sidModel = (xs_cfg.mos8580) ? SID2_MOS8580 : SID2_MOS6581; + xs_emuConf.sidSamples = TRUE; // FIXME FIX ME, make configurable! #ifdef HAVE_UNSIGNEDPCM #ifdef WORDS_BIGENDIAN @@ -555,7 +554,8 @@ void xs_get_song_info(char *songFilename, char **songTitle, int *songLength) { t_xs_tuneinfo sidInf; - t_xs_tune *testTune = new sidTune(songFilename); + t_xs_tune *testTune = new t_xs_tune(songFilename); + gint tmpInt; /* Check if the tune exists and is readable */ if (!testTune) return; @@ -570,10 +570,14 @@ delete testTune; /* Get titlestring */ - *songTitle = NULL; + *songTitle = xs_filetitle_get(songFilename, &sidInf, sidInf.startSong); /* Get song length (in milliseconds), negative if no known length */ - *songLength = xs_songlen_get(songFilename, sidInf.startSong) * 1000; + tmpInt = xs_songlen_get(songFilename, sidInf.startSong); + if (tmpInt >= 0) + *songLength = (tmpInt * 1000); + else + *songLength = -1; } @@ -581,17 +585,24 @@ * Create the SID-tune description string from the tune's information * formatted by the user-specified format-string. */ -gchar *xs_filetitle_get(gchar *pcFilename, void *pfInfo, gint iSubTune) +gchar *xs_filetitle_get(gchar *pcFilename, t_xs_tuneinfo *pfInfo, gint iSubTune) { gint j, iLength; gchar *pcStr, *pcResult; - t_xs_tuneinfo *finfo = (t_xs_tuneinfo *) pfInfo; #ifdef HAVE_XMMSEXTRA TitleInput *ptInput; #endif // FIXME FIXME: get STIL-info + /* Check the info strings */ + if (pfInfo->numberOfInfoStrings < 3) + { + if (pfInfo->numberOfInfoStrings < 1) + return 0; + + return g_strdup(pfInfo->infoString[0]); + } #ifdef HAVE_XMMSEXTRA /* Check if the titles are overridden or not */ @@ -606,37 +617,32 @@ ptInput->__version = XMMS_TITLEINPUT_VERSION; /* Create the input fields */ - ptInput->file_name = pcFilename; - ptInput->file_ext = pcFilename; - ptInput->file_path = pcFilename; + ptInput->file_name = pfInfo->dataFileName; + ptInput->file_ext = g_strdup("sid"); + ptInput->file_path = pfInfo->path; - ptInput->track_name = finfo->nameString; + ptInput->track_name = pfInfo->infoString[0]; ptInput->track_number = iSubTune; ptInput->album_name = NULL; - ptInput->performer = finfo->authorString; - xs_strcalloc(&ptInput->date, ""); + ptInput->performer = pfInfo->infoString[1]; + ptInput->date = g_strdup((pfInfo->sidModel == SIDTUNE_SIDMODEL_6581) ? "6581" : "8580"); + ptInput->year = 0; - xs_strcalloc(&ptInput->genre, "SID-tune"); - ptInput->comment = finfo->copyrightString; + ptInput->genre = g_strdup("SID-tune"); + ptInput->comment = pfInfo->infoString[2]; /* Create the string */ pcResult = xmms_get_titlestring(xmms_get_gentitle_format(), ptInput); /* Dispose all allocated memory */ + g_free(ptInput->file_ext); g_free(ptInput->date); g_free(ptInput->genre); g_free(ptInput); - } else { + } + else #endif - /* Check the info strings */ - if (finfo->numberOfInfoStrings != 3) - { - if (finfo->numberOfInfoStrings < 1) - return 0; - - return g_strdup(finfo->infoString[0]); - } - + { /* Estimate the length of the string */ pcStr = xs_cfg.titleFormat; iLength = 0; @@ -645,10 +651,10 @@ if (*pcStr == '%') { switch (*(++pcStr)) { - case '1': iLength += strlen(finfo->authorString); break; - case '2': iLength += strlen(finfo->nameString); break; - case '3': iLength += strlen(finfo->copyrightString); break; - case '4': iLength += strlen(finfo->formatString); break; + case '1': iLength += strlen(pfInfo->infoString[1]); break; + case '2': iLength += strlen(pfInfo->infoString[0]); break; + case '3': iLength += strlen(pfInfo->infoString[2]); break; + case '4': iLength += strlen(pfInfo->formatString); break; case '%': iLength++; } } else @@ -658,7 +664,7 @@ /* Allocate memory */ pcResult = (gchar *) g_malloc(iLength + 2); if (pcResult == NULL) - return g_strdup(finfo->infoString[0]); + return g_strdup(pfInfo->infoString[0]); /* Create the string */ pcStr = xs_cfg.titleFormat; @@ -668,10 +674,10 @@ if (*pcStr == '%') { switch (*(++pcStr)) { - case '1': xs_strpcat(pcResult, &j, finfo->authorString); break; - case '2': xs_strpcat(pcResult, &j, finfo->nameString); break; - case '3': xs_strpcat(pcResult, &j, finfo->copyrightString); break; - case '4': xs_strpcat(pcResult, &j, finfo->formatString); break; + case '1': xs_strpcat(pcResult, &j, pfInfo->infoString[1]); break; + case '2': xs_strpcat(pcResult, &j, pfInfo->infoString[0]); break; + case '3': xs_strpcat(pcResult, &j, pfInfo->infoString[2]); break; + case '4': xs_strpcat(pcResult, &j, pfInfo->formatString); break; case '%': pcResult[j++] = '%'; break; } } else @@ -679,9 +685,7 @@ } pcResult[j] = 0; -#ifdef HAVE_XMMSEXTRA } -#endif return pcResult; } diff -r 05220299c6e8 -r d3bb914e3af3 src/xs_config.c --- a/src/xs_config.c Sun Jun 22 12:10:01 2003 +0000 +++ b/src/xs_config.c Sun Jun 29 01:17:01 2003 +0000 @@ -52,7 +52,7 @@ {CTYPE_INT, &xs_cfg.memoryMode, "memoryMode"}, {CTYPE_INT, &xs_cfg.clockSpeed, "clockSpeed"}, {CTYPE_BOOL, &xs_cfg.forceSpeed, "forceSpeed"}, - + {CTYPE_INT, &xs_cfg.optimiseLevel, "optimiseLevel"}, {CTYPE_BOOL, &xs_cfg.oversampleEnable, "oversampleEnable"}, {CTYPE_INT, &xs_cfg.oversampleFactor, "oversampleFactor"}, @@ -100,6 +100,8 @@ { 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.optimiseLevel, 0 }, + { WTYPE_BUTTON, CTYPE_BOOL, "cfg_sld_usemaxtime", &xs_cfg.playMaxTimeEnable, 0 }, { WTYPE_SPIN, CTYPE_INT, "cfg_sld_maxtime", &xs_cfg.playMaxTime, 0 }, { WTYPE_BUTTON, CTYPE_BOOL, "cfg_sld_enable", &xs_cfg.songlenDBEnable, 0 }, @@ -160,7 +162,7 @@ xs_cfg.clockSpeed = XS_CLOCK_PAL; xs_cfg.forceSpeed = FALSE; - + xs_cfg.optimiseLevel = FALSE; xs_cfg.oversampleEnable = FALSE; xs_cfg.oversampleFactor = XS_MIN_OVERSAMPLE; diff -r 05220299c6e8 -r d3bb914e3af3 src/xs_config.h --- a/src/xs_config.h Sun Jun 22 12:10:01 2003 +0000 +++ b/src/xs_config.h Sun Jun 29 01:17:01 2003 +0000 @@ -49,7 +49,6 @@ gint fmtChannels; gint fmtFrequency; - /* General libSIDPlay settings */ gboolean mos8580; /* TRUE = 8580, FALSE = 6581 */ gboolean emulateFilters; @@ -59,11 +58,10 @@ gint memoryMode; /* See XS_MPU-constants */ gint clockSpeed; /* PAL (50Hz) or NTSC (60Hz) */ gboolean forceSpeed; /* TRUE = force to given clockspeed */ - + gboolean optimiseLevel; /* SIDPlay2 emulation optimization */ gboolean oversampleEnable; gint oversampleFactor; /* Factor of oversampling */ - /* Playing settings */ gboolean playMaxTimeEnable; gint playMaxTime; /* MAX playtime in seconds */