// // Play // // Play a redbook track (request is wrapped, so returns track number started) // U32 Play(U32 newTrack) { if (initialized && driver) { // Get number of tracks on disc U32 count = AIL_redbook_tracks(driver); // Clip track into acceptable range if ((newTrack > count) || (newTrack < minTrack)) { newTrack = minTrack; } // If we ended up with a valid track number, start it playing if (newTrack >= 1 && newTrack <= count) { U32 start, end; // Get track info AIL_redbook_track_info(driver, newTrack, &start, &end); // Start it playing AIL_redbook_play(driver, start, end); // Update our track count track = newTrack; // Set next scan to be just past when this track ends pollTime = AIL_ms_count() + (end - start) + POLL_ERROR; // We're rockin, so turn on track searching search = TRUE; } else { // Probably a data cd search = FALSE; // Stop cd playing Stop(); } } return (track); }
void SoundManager::StartMusic(const sint32 &InTrackNum) { m_stopRedbookTemporarily = FALSE; if (!g_theProfileDB->IsUseRedbookAudio() || !c3files_HasCD()) return; if (m_noSound) return; if (m_usePlaySound) return; if (m_curTrack == -1) return; #if defined(USE_SDL) if (!m_cdrom) { return; } CDstatus status = SDL_CDStatus(m_cdrom); if ((CD_ERROR == status) || (!CD_INDRIVE(status))) { return; } sint32 const numTracks = m_cdrom->numtracks; #else if (!m_redbook) { return; } U32 status = AIL_redbook_status(m_redbook); if (status == REDBOOK_ERROR) { return; } if (AIL_redbook_track(m_redbook)) { AIL_redbook_stop(m_redbook); } sint32 const numTracks = AIL_redbook_tracks(m_redbook); #endif if (numTracks <= s_startTrack) return; m_numTracks = numTracks; sint32 trackNum = InTrackNum; if (trackNum < 0) trackNum = 0; if (trackNum > m_numTracks) trackNum = m_numTracks; m_curTrack = trackNum; #if defined(USE_SDL) SDL_CDPlayTracks(m_cdrom, trackNum, 0, 1, 0); #else U32 start; U32 end; AIL_redbook_track_info(m_redbook, trackNum, &start, &end); // Why? TerminateAllSounds(); AIL_redbook_play(m_redbook, start, end); #endif }
// // TrackCount // // The number of tracks on the current audio device // U32 TrackCount() { return((initialized && driver) ? AIL_redbook_tracks(driver) : 0); }