Patch 625904: CD Looping

svn-id: r5199
This commit is contained in:
James Brown 2002-10-20 13:17:43 +00:00
parent c7ef00571b
commit 628eea3de4
3 changed files with 28 additions and 5 deletions

View File

@ -825,8 +825,11 @@ void OSystem_SDL_Common::play_cdrom(int track, int num_loops, int start_frame, i
cd_num_loops = num_loops;
cd_start_frame = start_frame;
SDL_CDStatus(_cdrom);
SDL_CDPlayTracks(_cdrom, track, start_frame, 0, end_frame);
SDL_CDStatus(_cdrom);
if (start_frame == 0 && end_frame == 0)
SDL_CDPlayTracks(_cdrom, track, 0, 1, 0);
else
SDL_CDPlayTracks(_cdrom, track, start_frame, 0, end_frame);
cd_end_frame = end_frame;
cd_stop_time = 0;
cd_end_time = SDL_GetTicks() + _cdrom->track[track].length * 1000 / CD_FPS;
@ -863,7 +866,10 @@ void OSystem_SDL_Common::update_cdrom() {
cd_num_loops--;
if (cd_num_loops != 0) {
SDL_CDPlayTracks(_cdrom, cd_track, cd_start_frame, 0, cd_end_frame);
if (cd_start_frame == 0 && cd_end_frame == 0)
SDL_CDPlayTracks(_cdrom, cd_track, 0, 1, 0);
else
SDL_CDPlayTracks(_cdrom, cd_track, cd_start_frame, 0, cd_end_frame);
cd_end_time = SDL_GetTicks() + _cdrom->track[cd_track].length * 1000 / CD_FPS;
}
}

View File

@ -1349,6 +1349,10 @@ int Sound::playMP3CDTrack(int track, int num_loops, int start, int delay) {
_scumm->_mixer->stop(_mp3_index);
_mp3_index = _scumm->_mixer->playMP3CDTrack(NULL, _mp3_tracks[index], duration);
_mp3_cd_playing = true;
_mp3_cd_track = track;
_mp3_cd_num_loops = num_loops;
_mp3_cd_start = start;
_mp3_cd_delay = delay;
return 0;
}
@ -1356,6 +1360,10 @@ int Sound::stopMP3CD() {
if (_mp3_cd_playing == true) {
_scumm->_mixer->stop(_mp3_index);
_mp3_cd_playing = false;
_mp3_cd_track = 0;
_mp3_cd_num_loops = 0;
_mp3_cd_start = 0;
_mp3_cd_delay = 0;
return 0;
}
return -1;
@ -1376,8 +1384,13 @@ int Sound::updateMP3CD() {
return -1;
}
if (_scumm->_mixer->_channels[_mp3_index]->soundFinished())
stopMP3CD();
if (_scumm->_mixer->_channels[_mp3_index]->soundFinished()) {
if (_mp3_cd_num_loops == -1 || --_mp3_cd_num_loops > 0)
playMP3CDTrack(_mp3_cd_track, _mp3_cd_num_loops, _mp3_cd_start, _mp3_cd_delay);
else
stopMP3CD();
}
return 0;
}
#endif

View File

@ -78,6 +78,10 @@ enum {
long _mp3_size[CACHE_TRACKS];
File *_mp3_tracks[CACHE_TRACKS];
int _mp3_index;
int _mp3_cd_track;
int _mp3_cd_start;
int _mp3_cd_delay;
int _mp3_cd_num_loops;
bool _mp3_cd_playing;
#endif