[Scummvm-cvs-logs] scummvm master -> bc298a58f53a9ac2f8e3b5b96da8d7541ad99c71
Littleboy
littleboy22 at gmail.com
Sat Jul 9 04:09:58 CEST 2011
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
63e2fe7e7b LASTEXPRESS: Have LastExpress_ADPCMStream inherit directly from Audio::ADPCMStream (as suggested by clone2727)
e7e689450b LASTEXPRESS: Prefix savegame filenames with "lastexpress"
bc298a58f5 LASTEXPRESS: Simplify SoundQueue::updateQueue()
Commit: 63e2fe7e7bc54f93cf47a5c85d6ca621d332a94a
https://github.com/scummvm/scummvm/commit/63e2fe7e7bc54f93cf47a5c85d6ca621d332a94a
Author: Littleboy (littleboy at users.sourceforge.net)
Date: 2011-07-08T19:03:28-07:00
Commit Message:
LASTEXPRESS: Have LastExpress_ADPCMStream inherit directly from Audio::ADPCMStream (as suggested by clone2727)
Changed paths:
engines/lastexpress/data/snd.cpp
diff --git a/engines/lastexpress/data/snd.cpp b/engines/lastexpress/data/snd.cpp
index 9e92ded..6845be8 100644
--- a/engines/lastexpress/data/snd.cpp
+++ b/engines/lastexpress/data/snd.cpp
@@ -352,10 +352,10 @@ static const int p2s[17] = { 0, 1, 1, 3, 1, 5, 3, 7, 1, 9, 5, 11, 3, 13, 7, 15,
// Last Express ADPCM is similar to MS IMA mono, but inverts its nibbles
// and does not have the 4 byte per channel requirement
-class LastExpress_ADPCMStream : public Audio::Ima_ADPCMStream {
+class LastExpress_ADPCMStream : public Audio::ADPCMStream {
public:
LastExpress_ADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, uint32 blockSize, int32 filterId) :
- Audio::Ima_ADPCMStream(stream, disposeAfterUse, size, 44100, 1, blockSize) {
+ Audio::ADPCMStream(stream, disposeAfterUse, size, 44100, 1, blockSize) {
_currentFilterId = -1;
_nextFilterId = filterId;
}
Commit: e7e689450b942b8328ab25a043a67ae2e392e46e
https://github.com/scummvm/scummvm/commit/e7e689450b942b8328ab25a043a67ae2e392e46e
Author: Littleboy (littleboy at users.sourceforge.net)
Date: 2011-07-08T19:03:32-07:00
Commit Message:
LASTEXPRESS: Prefix savegame filenames with "lastexpress"
Changed paths:
engines/lastexpress/game/savegame.cpp
diff --git a/engines/lastexpress/game/savegame.cpp b/engines/lastexpress/game/savegame.cpp
index ebada5d..57c18b5 100644
--- a/engines/lastexpress/game/savegame.cpp
+++ b/engines/lastexpress/game/savegame.cpp
@@ -45,12 +45,12 @@ namespace LastExpress {
static const struct {
const char *saveFile;
} gameInfo[6] = {
- {"blue.egg"},
- {"red.egg"},
- {"green.egg"},
- {"purple.egg"},
- {"teal.egg"},
- {"gold.egg"}
+ {"lastexpress-blue.egg"},
+ {"lastexpress-red.egg"},
+ {"lastexpress-green.egg"},
+ {"lastexpress-purple.egg"},
+ {"lastexpress-teal.egg"},
+ {"lastexpress-gold.egg"}
};
//////////////////////////////////////////////////////////////////////////
Commit: bc298a58f53a9ac2f8e3b5b96da8d7541ad99c71
https://github.com/scummvm/scummvm/commit/bc298a58f53a9ac2f8e3b5b96da8d7541ad99c71
Author: Littleboy (littleboy at users.sourceforge.net)
Date: 2011-07-08T19:03:34-07:00
Commit Message:
LASTEXPRESS: Simplify SoundQueue::updateQueue()
- Remove useless cache code
- Use helper function to get the proper sound entry
- Fix crash on using an invalid entry
Changed paths:
engines/lastexpress/shared.h
engines/lastexpress/sound/entry.cpp
engines/lastexpress/sound/queue.cpp
engines/lastexpress/sound/sound.cpp
diff --git a/engines/lastexpress/shared.h b/engines/lastexpress/shared.h
index 7b640c7..d60a498 100644
--- a/engines/lastexpress/shared.h
+++ b/engines/lastexpress/shared.h
@@ -84,29 +84,26 @@ enum SoundFlag {
};
enum SoundState {
- kSoundState0 = 0,
- kSoundState1 = 1,
- kSoundState2 = 2
+ kSoundStateNone = 0,
+ kSoundState1 = 1,
+ kSoundState2 = 2
};
enum SoundStatus {
+ kSoundStatusClear0 = 0x10,
+ kSoundStatusFilter = 0x1F,
kSoundStatus_20 = 0x20,
kSoundStatus_40 = 0x40,
+ kSoundStatusCached = 0x80,
kSoundStatus_180 = 0x180,
kSoundStatusClosed = 0x200,
kSoundStatus_400 = 0x400,
-
+ kSoundStatusClear4 = 0x800,
kSoundStatus_8000 = 0x8000,
kSoundStatus_20000 = 0x20000,
kSoundStatus_100000 = 0x100000,
kSoundStatus_20000000 = 0x20000000,
kSoundStatus_40000000 = 0x40000000,
-
- kSoundStatusClear0 = 0x10,
- kSoundStatusFilter = 0x1F,
- kSoundStatusCached = 0x80,
- kSoundStatusClear3 = 0x200,
- kSoundStatusClear4 = 0x800,
kSoundStatusClearAll = 0xFFFFFFE0
};
diff --git a/engines/lastexpress/sound/entry.cpp b/engines/lastexpress/sound/entry.cpp
index 87d8ccd..44cc68a 100644
--- a/engines/lastexpress/sound/entry.cpp
+++ b/engines/lastexpress/sound/entry.cpp
@@ -88,8 +88,8 @@ void SoundEntry::close() {
_status.status |= kSoundStatusClosed;
// Loop until ready
- while (!(_status.status1 & 4) && !(getSoundQueue()->getFlag() & 8) && (getSoundQueue()->getFlag() & 1))
- ; // empty loop body
+ //while (!(_status.status1 & 4) && !(getSoundQueue()->getFlag() & 8) && (getSoundQueue()->getFlag() & 1))
+ // ; // empty loop body
// The original game remove the entry from the cache here,
// but since we are called from within an iterator loop
@@ -290,7 +290,7 @@ bool SoundEntry::updateSound() {
}
}
}
- //if (status.status2 & 0x40 && !((uint32)_status.status & 0x180) && v1->soundBuffer)
+ //if (status.status2 & 0x40 && !((uint32)_status.status & 0x180) && v1->soundBuffer)
// Sound_FillSoundBuffer(v1);
}
result = true;
diff --git a/engines/lastexpress/sound/queue.cpp b/engines/lastexpress/sound/queue.cpp
index 0a6442c..33b4c06 100644
--- a/engines/lastexpress/sound/queue.cpp
+++ b/engines/lastexpress/sound/queue.cpp
@@ -102,80 +102,41 @@ void SoundQueue::removeFromQueue(Common::String filename) {
}
void SoundQueue::updateQueue() {
- //Common::StackLock locker(_mutex);
-
- //warning("[Sound::updateQueue] Not implemented");
-
- int maxPriority = 0;
- Common::List<SoundEntry *>::iterator lsnd;
- SoundEntry *msnd;
-
- bool loopedPlaying;
-
- loopedPlaying = 0;
- //++g_sound_flag;
+ Common::StackLock locker(_mutex);
- for (lsnd = _soundList.begin(); lsnd != _soundList.end(); ++lsnd) {
- if ((*lsnd)->getType() == kSoundType1)
- break;
- }
+ ++_flag;
- if (getSoundState() & 1) {
- if (!(*lsnd) || getFlags()->flag_3 || (*lsnd && (*lsnd)->getTime() > getSound()->getLoopingSoundDuration())) {
+ if (getSoundState() & kSoundState1) {
+ SoundEntry *entry = getEntry(kSoundType1);
+ if (!entry || getFlags()->flag_3 || (entry && entry->getTime() > getSound()->getLoopingSoundDuration())) {
getSound()->playLoopingSound(0x45);
} else {
if (getSound()->getData1() && getSound()->getData2() >= getSound()->getData1()) {
- (*lsnd)->update(getSound()->getData0());
+ entry->update(getSound()->getData0());
getSound()->setData1(0);
}
}
}
- msnd = NULL;
-
- for (lsnd = _soundList.begin(); lsnd != _soundList.end(); ++lsnd) {
- if ((*lsnd)->getStatus().status2 & 0x1) { // Sound is stopped
- // original code
- //if ((*lsnd)->soundBuffer)
- // Sound_RemoveSoundDataFromCache(*lsnd);
- //if ((*lsnd)->archive) {
- // Archive_SetStatusNotLoaded((*lsnd)->archive);
- // (*lsnd)->archive = 0;
- // (*lsnd)->field_28 = 3;
- //}
-
- if (_soundList.size() < 6) {
- if ((*lsnd)->getStatus().status1 & 0x1F) {
- int pri = (*lsnd)->getPriority() + ((*lsnd)->getStatus().status1 & 0x1F);
-
- if (pri > maxPriority) {
- msnd = *lsnd;
- maxPriority = pri;
- }
- }
- }
- }
+ for (Common::List<SoundEntry *>::iterator it = _soundList.begin(); it != _soundList.end(); ++it) {
+ SoundEntry *entry = *it;
- if (!(*lsnd)->updateSound() && !((*lsnd)->getStatus().status3 & 0x8)) {
- if (msnd == *lsnd) {
- maxPriority = 0;
- msnd = 0;
- }
- if (*lsnd) {
- (*lsnd)->close();
- SAFE_DELETE(*lsnd);
- lsnd = _soundList.reverse_erase(lsnd);
- }
+ // Original removes the entry data from the cache and sets the archive as not loaded
+ // and if the sound data buffer is not full, loads a new entry to be played based on
+ // its priority and filter id
+
+ if (!entry->updateSound() && !(entry->getStatus().status3 & 0x8)) {
+ entry->close();
+ SAFE_DELETE(entry);
+ it = _soundList.reverse_erase(it);
}
}
-
- // We don't need this
- //if (msnd)
- // msnd->updateEntryInternal();
+ // Original update the current entry, loading another set of samples to be decoded
getFlags()->flag_3 = 0;
- //--g_sound_flag;
+
+ --_flag;
}
void SoundQueue::resetQueue() {
@@ -209,17 +170,10 @@ void SoundQueue::resetQueue(SoundType type1, SoundType type2) {
}
void SoundQueue::clearQueue() {
- _flag |= 4;
-
- // FIXME: Wait a while for a flag to be set
- //for (int i = 0; i < 3000000; i++)
- // if (_flag & 8)
- // break;
+ Common::StackLock locker(_mutex);
_flag |= 8;
- Common::StackLock locker(_mutex);
-
for (Common::List<SoundEntry *>::iterator i = _soundList.begin(); i != _soundList.end(); ++i) {
SoundEntry *entry = (*i);
@@ -240,7 +194,7 @@ void SoundQueue::clearStatus() {
Common::StackLock locker(_mutex);
for (Common::List<SoundEntry *>::iterator i = _soundList.begin(); i != _soundList.end(); ++i)
- (*i)->setStatus((*i)->getStatus().status | kSoundStatusClear3);
+ (*i)->setStatus((*i)->getStatus().status | kSoundStatusClosed);
}
//////////////////////////////////////////////////////////////////////////
diff --git a/engines/lastexpress/sound/sound.cpp b/engines/lastexpress/sound/sound.cpp
index c04b6d3..2f7bb4a 100644
--- a/engines/lastexpress/sound/sound.cpp
+++ b/engines/lastexpress/sound/sound.cpp
@@ -1305,8 +1305,8 @@ void SoundManager::playLoopingSound(int param) {
int partNumber = 1;
int fnameLen = 6;
- if (_queue->getSoundState() & 1 && param >= 0x45 && param <= 0x46) {
- if (_queue->getSoundState() & 2) {
+ if (_queue->getSoundState() & kSoundState1 && param >= 0x45 && param <= 0x46) {
+ if (_queue->getSoundState() & kSoundState2) {
strcpy(tmp, "STEAM.SND");
_loopingSoundDuration = 32767;
More information about the Scummvm-git-logs
mailing list