aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Kołodziejski2008-01-16 22:20:34 +0000
committerPaweł Kołodziejski2008-01-16 22:20:34 +0000
commitbd32e7a6b0c471c2c7fc250742ca241d72ecfee7 (patch)
treeec52918049e32903ea6c231290d06bd8d18102f4
parent6b330411722ea543bce081f04c3fa4708e365159 (diff)
downloadscummvm-rg350-bd32e7a6b0c471c2c7fc250742ca241d72ecfee7.tar.gz
scummvm-rg350-bd32e7a6b0c471c2c7fc250742ca241d72ecfee7.tar.bz2
scummvm-rg350-bd32e7a6b0c471c2c7fc250742ca241d72ecfee7.zip
experimental seek in compressed streams in dimuse in time ms resolution
svn-id: r30521
-rw-r--r--engines/scumm/imuse_digi/dimuse.cpp4
-rw-r--r--engines/scumm/imuse_digi/dimuse_sndmgr.cpp10
2 files changed, 8 insertions, 6 deletions
diff --git a/engines/scumm/imuse_digi/dimuse.cpp b/engines/scumm/imuse_digi/dimuse.cpp
index af4f91af71..778c1a6593 100644
--- a/engines/scumm/imuse_digi/dimuse.cpp
+++ b/engines/scumm/imuse_digi/dimuse.cpp
@@ -177,13 +177,13 @@ void IMuseDigital::saveOrLoad(Serializer *ser) {
continue;
}
- if (track->sndDataExtComp) {
+/* if (track->sndDataExtComp) {
track->regionOffset = 0;
}
track->sndDataExtComp = _sound->isSndDataExtComp(track->soundDesc);
if (track->sndDataExtComp) {
track->regionOffset = 0;
- }
+ }*/
track->dataOffset = _sound->getRegionOffset(track->soundDesc, track->curRegion);
int bits = _sound->getBits(track->soundDesc);
int channels = _sound->getChannels(track->soundDesc);
diff --git a/engines/scumm/imuse_digi/dimuse_sndmgr.cpp b/engines/scumm/imuse_digi/dimuse_sndmgr.cpp
index db18f966c7..d34d27e456 100644
--- a/engines/scumm/imuse_digi/dimuse_sndmgr.cpp
+++ b/engines/scumm/imuse_digi/dimuse_sndmgr.cpp
@@ -654,6 +654,7 @@ int32 ImuseDigiSndMgr::getDataFromRegion(SoundDesc *soundDesc, int region, byte
*buf = new byte[size];
assert(*buf);
char fileName[24];
+ int offsetMs = ((offset * 8 * 1000) / soundDesc->bits) / (soundDesc->channels * soundDesc->freq);
sprintf(fileName, "%s_reg%03d", soundDesc->name, region);
if (scumm_stricmp(fileName, soundDesc->lastFileName) != 0) {
int32 offs = 0, len = 0;
@@ -695,25 +696,26 @@ int32 ImuseDigiSndMgr::getDataFromRegion(SoundDesc *soundDesc, int region, byte
assert(tmp);
#ifdef USE_FLAC
if (soundMode == 3)
- soundDesc->compressedStream = Audio::makeFlacStream(tmp, true);
+ soundDesc->compressedStream = Audio::makeFlacStream(tmp, true, offsetMs);
#endif
#ifdef USE_VORBIS
if (soundMode == 2)
- soundDesc->compressedStream = Audio::makeVorbisStream(tmp, true);
+ soundDesc->compressedStream = Audio::makeVorbisStream(tmp, true, offsetMs);
#endif
#ifdef USE_MAD
if (soundMode == 1)
- soundDesc->compressedStream = Audio::makeMP3Stream(tmp, true);
+ soundDesc->compressedStream = Audio::makeMP3Stream(tmp, true, offsetMs);
#endif
assert(soundDesc->compressedStream);
}
strcpy(soundDesc->lastFileName, fileName);
}
size = soundDesc->compressedStream->readBuffer((int16 *)*buf, size / 2) * 2;
- if (soundDesc->compressedStream->endOfData()) {
+ if (soundDesc->compressedStream->endOfData() || soundDesc->endFlag) {
delete soundDesc->compressedStream;
soundDesc->compressedStream = NULL;
soundDesc->lastFileName[0] = 0;
+ soundDesc->endFlag = true;
}
}