diff options
author | Andrew Kurushin | 2006-03-24 18:15:57 +0000 |
---|---|---|
committer | Andrew Kurushin | 2006-03-24 18:15:57 +0000 |
commit | 9586f11bdfeb0165723d6a8ba0a21326faff83f3 (patch) | |
tree | bcefb9c53b53680c4dfd9b72fb4bd01e464bbd15 | |
parent | 7569f796ec0a0cee5b19440e9dfe4c35696c8e60 (diff) | |
download | scummvm-rg350-9586f11bdfeb0165723d6a8ba0a21326faff83f3.tar.gz scummvm-rg350-9586f11bdfeb0165723d6a8ba0a21326faff83f3.tar.bz2 scummvm-rg350-9586f11bdfeb0165723d6a8ba0a21326faff83f3.zip |
fix ITE SUNSPOT music loop
svn-id: r21439
-rw-r--r-- | engines/saga/music.cpp | 24 | ||||
-rw-r--r-- | engines/saga/resnames.h | 1 |
2 files changed, 18 insertions, 7 deletions
diff --git a/engines/saga/music.cpp b/engines/saga/music.cpp index 921c1a9f1a..52ebc51440 100644 --- a/engines/saga/music.cpp +++ b/engines/saga/music.cpp @@ -24,6 +24,7 @@ #include "saga/saga.h" #include "saga/rscfile.h" +#include "saga/resnames.h" #include "saga/music.h" #include "saga/stream.h" #include "sound/audiostream.h" @@ -82,7 +83,7 @@ private: } public: - RAWInputStream(SagaEngine *vm, ResourceContext *context, uint32 resourceId, bool looping); + RAWInputStream(SagaEngine *vm, ResourceContext *context, uint32 resourceId, bool looping, uint32 loopStart); int readBuffer(int16 *buffer, const int numSamples); @@ -91,7 +92,7 @@ public: int getRate() const { return _musicInfo->frequency; } }; -RAWInputStream::RAWInputStream(SagaEngine *vm, ResourceContext *context, uint32 resourceId, bool looping) +RAWInputStream::RAWInputStream(SagaEngine *vm, ResourceContext *context, uint32 resourceId, bool looping, uint32 loopStart) : _context(context), _finished(false), _looping(looping), _bufferEnd(_buf + BUFFER_SIZE) { ResourceData * resourceData; @@ -105,9 +106,11 @@ RAWInputStream::RAWInputStream(SagaEngine *vm, ResourceContext *context, uint32 } // Determine the end position - _startPos = resourceData->offset; - _endPos = _startPos + resourceData->size; - _filePos = _startPos; + _filePos = resourceData->offset; + _endPos = _filePos + resourceData->size; + _startPos = _filePos + loopStart; + if (_startPos >= _endPos) + _startPos = _filePos; // Read in initial data refill(); @@ -375,7 +378,8 @@ void Music::play(uint32 resourceId, MusicFlags flags) { MidiParser *parser; ResourceContext *context; byte *resourceData; - size_t resourceSize; + size_t resourceSize; + uint32 loopStart; debug(2, "Music::play %d, %d", resourceId, flags); @@ -420,7 +424,13 @@ void Music::play(uint32 resourceId, MusicFlags flags) { if (resourceId >= 9 && resourceId <= 34) { if (_musicContext != NULL) { //TODO: check resource size - audioStream = new RAWInputStream(_vm, _musicContext, resourceId - 9, flags == MUSIC_LOOP); + loopStart = 0; + // fix ITE sunstatm score + if ((_vm->getGameType() == GType_ITE) && (resourceId == MUSIC_SUNSPOT)) { + loopStart = 4 * 18727; + } + + audioStream = new RAWInputStream(_vm, _musicContext, resourceId - 9, flags == MUSIC_LOOP, loopStart); } } } diff --git a/engines/saga/resnames.h b/engines/saga/resnames.h index 01522a9ca7..21c332e066 100644 --- a/engines/saga/resnames.h +++ b/engines/saga/resnames.h @@ -178,6 +178,7 @@ namespace Saga { // MUSIC #define MUSIC_1 9 #define MUSIC_2 10 +#define MUSIC_SUNSPOT 26 // TODO: If the sound effects are numbered sequentially, we don't really need // these constants. But for now they might be useful for debugging. |