Mercurial > audlegacy-plugins
comparison src/sid/xmms-sid.c @ 1564:5e4393a4c099
Start of major Aud-SID Tuples vs XMMS-SID cleanup.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 03 Sep 2007 01:26:49 +0300 |
parents | c3b8dedeedc5 |
children | e566e18e9e3d |
comparison
equal
deleted
inserted
replaced
1563:828f45d8e8f8 | 1564:5e4393a4c099 |
---|---|
31 #include <gtk/gtk.h> | 31 #include <gtk/gtk.h> |
32 | 32 |
33 #include "xs_config.h" | 33 #include "xs_config.h" |
34 #include "xs_length.h" | 34 #include "xs_length.h" |
35 #include "xs_stil.h" | 35 #include "xs_stil.h" |
36 #include "xs_title.h" | |
37 #include "xs_filter.h" | 36 #include "xs_filter.h" |
38 #include "xs_fileinfo.h" | 37 #include "xs_fileinfo.h" |
39 #include "xs_interface.h" | 38 #include "xs_interface.h" |
40 #include "xs_glade.h" | 39 #include "xs_glade.h" |
41 #include "xs_player.h" | 40 #include "xs_player.h" |
322 InputPlayback *pb = argPointer; | 321 InputPlayback *pb = argPointer; |
323 t_xs_status myStatus; | 322 t_xs_status myStatus; |
324 t_xs_tuneinfo *myTune; | 323 t_xs_tuneinfo *myTune; |
325 gboolean audioOpen = FALSE, doPlay = FALSE, isFound = FALSE; | 324 gboolean audioOpen = FALSE, doPlay = FALSE, isFound = FALSE; |
326 gint audioGot, songLength, i; | 325 gint audioGot, songLength, i; |
327 gchar *audioBuffer = NULL, *oversampleBuffer = NULL, *tmpTitle; | 326 gchar *audioBuffer = NULL, *oversampleBuffer = NULL; |
327 Tuple *tmpTitle; | |
328 | 328 |
329 (void) argPointer; | 329 (void) argPointer; |
330 | 330 |
331 /* Initialize */ | 331 /* Initialize */ |
332 XSDEBUG("entering player thread\n"); | 332 XSDEBUG("entering player thread\n"); |
447 audioOpen = TRUE; | 447 audioOpen = TRUE; |
448 | 448 |
449 /* Set song information for current subtune */ | 449 /* Set song information for current subtune */ |
450 XSDEBUG("set tune info\n"); | 450 XSDEBUG("set tune info\n"); |
451 myStatus.sidPlayer->plrUpdateSIDInfo(&myStatus); | 451 myStatus.sidPlayer->plrUpdateSIDInfo(&myStatus); |
452 /* | |
452 tmpTitle = xs_make_titlestring(myTune, myStatus.currSong); | 453 tmpTitle = xs_make_titlestring(myTune, myStatus.currSong); |
453 | 454 |
454 xs_plugin_ip.set_info( | 455 xs_plugin_ip.set_info( |
455 tmpTitle, | 456 tmpTitle, |
456 (songLength > 0) ? (songLength * 1000) : 0, | 457 (songLength > 0) ? (songLength * 1000) : 0, |
457 -1, | 458 -1, |
458 myStatus.audioFrequency, | 459 myStatus.audioFrequency, |
459 myStatus.audioChannels); | 460 myStatus.audioChannels); |
460 | 461 |
461 g_free(tmpTitle); | 462 g_free(tmpTitle); |
462 | 463 */ |
463 XSDEBUG("playing\n"); | 464 XSDEBUG("playing\n"); |
464 | 465 |
465 /* | 466 /* |
466 * Play the subtune | 467 * Play the subtune |
467 */ | 468 */ |
929 /* Return output time reported by audio output plugin */ | 930 /* Return output time reported by audio output plugin */ |
930 return pb->output->output_time(); | 931 return pb->output->output_time(); |
931 } | 932 } |
932 | 933 |
933 | 934 |
935 #ifndef AUDACIOUS_PLUGIN | |
934 /* Return song information: called by XMMS when initially loading the playlist. | 936 /* Return song information: called by XMMS when initially loading the playlist. |
935 * Subsequent changes to information are made by the player thread, | 937 * Subsequent changes to information are made by the player thread, |
936 * which uses xs_plugin_ip.set_info(); | 938 * which uses xs_plugin_ip.set_info(); |
937 */ | 939 */ |
938 void xs_get_song_info(gchar * songFilename, gchar ** songTitle, gint * songLength) | 940 void xs_get_song_info(gchar * songFilename, gchar ** songTitle, gint * songLength) |
964 /* Free tune information */ | 966 /* Free tune information */ |
965 xs_tuneinfo_free(pInfo); | 967 xs_tuneinfo_free(pInfo); |
966 XS_MUTEX_UNLOCK(xs_status); | 968 XS_MUTEX_UNLOCK(xs_status); |
967 } | 969 } |
968 | 970 |
969 | 971 #else |
970 t_xs_tuple * xs_get_song_tuple(gchar *songFilename) | 972 |
973 Tuple * xs_get_song_tuple(gchar *songFilename) | |
971 { | 974 { |
972 t_xs_tuneinfo *pInfo; | 975 t_xs_tuneinfo *pInfo; |
973 t_xs_tuple *pResult = NULL; | 976 Tuple *pResult; |
974 | 977 gchar *tmpStr; |
975 XS_MUTEX_LOCK(xs_status); | 978 |
979 XS_MUTEX_LOCK(xs_status); | |
980 | |
981 pResult = tuple_new_from_filename(songFilename); | |
976 | 982 |
977 /* Get tune information from emulation engine */ | 983 /* Get tune information from emulation engine */ |
978 pInfo = xs_status.sidPlayer->plrGetSIDInfo(songFilename); | 984 pInfo = xs_status.sidPlayer->plrGetSIDInfo(songFilename); |
979 if (!pInfo) { | 985 if (!pInfo) { |
980 XS_MUTEX_UNLOCK(xs_status); | 986 XS_MUTEX_UNLOCK(xs_status); |
981 return NULL; | 987 return pResult; |
982 } | 988 } |
989 | |
990 tuple_associate_string(pResult, "title", pInfo->sidName); | |
991 tuple_associate_string(pResult, "artist", pInfo->sidComposer); | |
992 tuple_associate_int(pResult, "track-number", pInfo->startTune); | |
993 tuple_associate_string(pResult, "genre", "SID-tune"); | |
994 tuple_associate_string(pResult, "copyright", pInfo->sidCopyright); | |
995 tuple_associate_string(pResult, "format", pInfo->sidFormat); | |
996 tuple_associate_int(pResult, "subtunes", pInfo->nsubTunes); | |
997 | |
998 switch (pInfo->sidModel) { | |
999 case XS_SIDMODEL_6581: tmpStr = "6581"; break; | |
1000 case XS_SIDMODEL_8580: tmpStr = "8580"; break; | |
1001 case XS_SIDMODEL_ANY: tmpStr = "ANY"; break; | |
1002 default: tmpStr = "?"; break; | |
1003 } | |
1004 tuple_associate_string(pResult, "sid-model", tmpStr); | |
983 | 1005 |
984 /* Get sub-tune information, if available */ | 1006 /* Get sub-tune information, if available */ |
985 if ((pInfo->startTune > 0) && (pInfo->startTune <= pInfo->nsubTunes)) { | 1007 if ((pInfo->startTune > 0) && (pInfo->startTune <= pInfo->nsubTunes)) { |
986 gint tmpInt; | 1008 gint tmpInt = pInfo->subTunes[pInfo->startTune-1].tuneLength; |
1009 tuple_associate_int(pResult, "length", (tmpInt < 0) ? -1 : tmpInt * 1000); | |
987 | 1010 |
988 pResult = xs_make_titletuple(pInfo, pInfo->startTune); | |
989 | |
990 tmpInt = pInfo->subTunes[pInfo->startTune-1].tuneLength; | |
991 #ifdef AUDACIOUS_PLUGIN | |
992 if (tmpInt < 0) | |
993 tuple_associate_int(pResult, "length", -1); | |
994 else | |
995 tuple_associate_int(pResult, "length", tmpInt * 1000); | |
996 #else | |
997 if (tmpInt < 0) | |
998 pResult->length = -1; | |
999 else | |
1000 pResult->length = (tmpInt * 1000); | |
1001 #endif | |
1002 } | 1011 } |
1003 | 1012 |
1004 /* Free tune information */ | 1013 /* Free tune information */ |
1005 xs_tuneinfo_free(pInfo); | 1014 xs_tuneinfo_free(pInfo); |
1006 | |
1007 XS_MUTEX_UNLOCK(xs_status); | 1015 XS_MUTEX_UNLOCK(xs_status); |
1008 | |
1009 return pResult; | 1016 return pResult; |
1010 } | 1017 } |
1018 #endif | |
1011 | 1019 |
1012 | 1020 |
1013 /* Allocate a new tune information structure | 1021 /* Allocate a new tune information structure |
1014 */ | 1022 */ |
1015 t_xs_tuneinfo *xs_tuneinfo_new(const gchar * pcFilename, | 1023 t_xs_tuneinfo *xs_tuneinfo_new(const gchar * pcFilename, |