void playListTest() { int i; for (i = 0; i < 10; i++) { const char *cur, *next; PlayList_Quit(); PlayList_Init(); PlayList_Read("music"); if (numSongs != 2) { debug(LOG_ERROR, "Use the default playlist for selftest!"); } cur = PlayList_CurrentSong(); next = PlayList_NextSong(); assert(cur != NULL && next != NULL && cur != next); next = PlayList_NextSong(); assert(cur == next); // loop around assert(songList); assert(numSongs == 2); } fprintf(stdout, "\tPlaylist self-test: PASSED\n"); }
static void cdAudio_TrackFinished(const void *user_data) { const char *filename = PlayList_NextSong(); // This pointer is now officially invalidated; so set it to NULL cdStream = nullptr; if (filename == nullptr) { debug(LOG_ERROR, "Out of playlist?! was playing %s", (const char *)user_data); return; } if (!stopping && cdAudio_OpenTrack(filename)) { debug(LOG_SOUND, "Now playing %s (was playing %s)", filename, (const char *)user_data); } }