[Scummvm-cvs-logs] CVS: scummvm config-file.cpp,1.3,1.4 scumm.h,1.148,1.149 scummvm.cpp,1.130,1.131 sound.cpp,1.61,1.62
Lionel Ulmer
bbrox at users.sourceforge.net
Sun Apr 28 14:54:03 CEST 2002
Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv29816
Modified Files:
config-file.cpp scumm.h scummvm.cpp sound.cpp
Log Message:
MI1 CD audio should work better now. Still a bit flaky but should be
better than before :-)
Index: config-file.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/config-file.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** config-file.cpp 28 Apr 2002 00:56:06 -0000 1.3
--- config-file.cpp 28 Apr 2002 14:01:39 -0000 1.4
***************
*** 73,78 ****
hashconfig::~hashconfig()
{
- int i;
-
Scumm::free(domain);
}
--- 73,76 ----
Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm.h,v
retrieving revision 1.148
retrieving revision 1.149
diff -C2 -d -r1.148 -r1.149
*** scumm.h 28 Apr 2002 00:56:52 -0000 1.148
--- scumm.h 28 Apr 2002 14:01:39 -0000 1.149
***************
*** 977,981 ****
/* used for mp3 CD music */
! int _current_cache;
int _cached_tracks[CACHE_TRACKS];
struct mad_header _mad_header[CACHE_TRACKS];
--- 977,981 ----
/* used for mp3 CD music */
! int _current_cache;
int _cached_tracks[CACHE_TRACKS];
struct mad_header _mad_header[CACHE_TRACKS];
***************
*** 983,989 ****
--- 983,993 ----
FILE* _mp3_tracks[CACHE_TRACKS];
int _mp3_index;
+ bool _mp3_cd_playing;
int getCachedTrack(int track);
int playMP3CDTrack(int track, int num_loops, int start, int delay);
+ int stopMP3CD();
+ int updateMP3CD();
+ int pollMP3CD();
#endif
Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scummvm.cpp,v
retrieving revision 1.130
retrieving revision 1.131
diff -C2 -d -r1.130 -r1.131
*** scummvm.cpp 28 Apr 2002 06:51:23 -0000 1.130
--- scummvm.cpp 28 Apr 2002 14:01:39 -0000 1.131
***************
*** 1213,1218 ****
}
}
!
! _system->update_cdrom(); /* Loop CD Audio if needed */
if (_system->get_msecs() >= start_time + msec_delay)
break;
--- 1213,1220 ----
}
}
! #ifdef COMPRESSED_SOUND_FILE
! if (updateMP3CD() == -1)
! #endif
! _system->update_cdrom(); /* Loop CD Audio if needed */
if (_system->get_msecs() >= start_time + msec_delay)
break;
Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound.cpp,v
retrieving revision 1.61
retrieving revision 1.62
diff -C2 -d -r1.61 -r1.62
*** sound.cpp 27 Apr 2002 07:42:14 -0000 1.61
--- sound.cpp 28 Apr 2002 14:01:39 -0000 1.62
***************
*** 276,280 ****
if (sound == current_cd_sound)
! return _system->poll_cdrom();
i = _soundQue2Pos;
--- 276,285 ----
if (sound == current_cd_sound)
! #ifdef COMPRESSED_SOUND_FILE
! if (pollMP3CD())
! return 1;
! else
! #endif
! return _system->poll_cdrom();
i = _soundQue2Pos;
***************
*** 324,328 ****
if (a == current_cd_sound) {
current_cd_sound = 0;
! _system->stop_cdrom();
}
--- 329,336 ----
if (a == current_cd_sound) {
current_cd_sound = 0;
! #ifdef COMPRESSED_SOUND_FILE
! if (stopMP3CD() == -1)
! #endif
! _system->stop_cdrom();
}
***************
*** 342,346 ****
if (current_cd_sound != 0) {
current_cd_sound = 0;
! _system->stop_cdrom();
}
--- 350,357 ----
if (current_cd_sound != 0) {
current_cd_sound = 0;
! #ifdef COMPRESSED_SOUND_FILE
! if (stopMP3CD() == -1)
! #endif
! _system->stop_cdrom();
}
***************
*** 724,732 ****
mad_timer_t duration;
if (_soundsPaused)
return 0;
! if (!num_loops && !start) {
! _mixer->stop(_mp3_index);
return 0;
}
--- 735,744 ----
mad_timer_t duration;
+ g_scumm->_vars[g_scumm->VAR_MI1_TIMER] = 0;
+
if (_soundsPaused)
return 0;
! if ((num_loops == 0) && (start == 0)) {
return 0;
}
***************
*** 750,756 ****
fseek(_mp3_tracks[index], offset, SEEK_SET);
! _mp3_index = _mixer->play_mp3_cdtrack(NULL, _mp3_index, _mp3_tracks[index], duration);
return 0;
}
#endif
--- 762,799 ----
fseek(_mp3_tracks[index], offset, SEEK_SET);
! if (_mp3_cd_playing == true)
! _mixer->stop(_mp3_index);
! _mp3_index = _mixer->play_mp3_cdtrack(NULL, _mp3_tracks[index], duration);
! _mp3_cd_playing = true;
return 0;
}
+ int Scumm::stopMP3CD() {
+ if (_mp3_cd_playing == true) {
+ _mixer->stop(_mp3_index);
+ _mp3_cd_playing = false;
+ return 0;
+ }
+ return -1;
+ }
+
+ int Scumm::pollMP3CD() {
+ if (_mp3_cd_playing == true)
+ return 1;
+ return 0;
+ }
+
+ int Scumm::updateMP3CD() {
+ if (_mp3_cd_playing == false)
+ return -1;
+
+ if (_mixer->_channels[_mp3_index] == NULL) {
+ warning("Error in MP3 decoding");
+ return -1;
+ }
+
+ if (_mixer->_channels[_mp3_index]->sound_finished())
+ stopMP3CD();
+ return 0;
+ }
#endif
More information about the Scummvm-git-logs
mailing list