mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-18 16:03:05 +00:00
PRIVATE: improved SyncSound implementation
This commit is contained in:
parent
5000a24d72
commit
715e9c6d70
@ -112,6 +112,13 @@ static void fSyncSound(ArgArray args) {
|
||||
|
||||
if (s != "\"\"") {
|
||||
g_private->playSound(s, 1, true, false);
|
||||
while (g_private->isSoundActive())
|
||||
g_private->ignoreEvents();
|
||||
|
||||
uint32 i = 100;
|
||||
while(i--) // one second extra
|
||||
g_private->ignoreEvents();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -299,6 +299,13 @@ Common::Error PrivateEngine::run() {
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
void PrivateEngine::ignoreEvents() {
|
||||
Common::Event event;
|
||||
g_system->getEventManager()->pollEvent(event);
|
||||
g_system->updateScreen();
|
||||
g_system->delayMillis(10);
|
||||
}
|
||||
|
||||
void PrivateEngine::initFuncs() {
|
||||
for (const Private::FuncTable *fnc = funcTable; fnc->name; fnc++) {
|
||||
Common::String name(fnc->name);
|
||||
@ -987,6 +994,10 @@ void PrivateEngine::playSound(const Common::String &name, uint loops, bool stopO
|
||||
_mixer->playStream(Audio::Mixer::kSFXSoundType, sh, stream, -1, Audio::Mixer::kMaxChannelVolume);
|
||||
}
|
||||
|
||||
bool PrivateEngine::isSoundActive() {
|
||||
return _mixer->isSoundIDActive(-1);
|
||||
}
|
||||
|
||||
void PrivateEngine::playVideo(const Common::String &name) {
|
||||
debugC(1, kPrivateDebugFunction, "%s(%s)", __FUNCTION__, name.c_str());
|
||||
//stopSound(true);
|
||||
|
@ -186,6 +186,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
void ignoreEvents();
|
||||
Common::Error loadGameStream(Common::SeekableReadStream *stream) override;
|
||||
Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave = false) override;
|
||||
void syncGameStream(Common::Serializer &s);
|
||||
@ -271,6 +272,7 @@ public:
|
||||
// Sounds
|
||||
void playSound(const Common::String &, uint, bool, bool);
|
||||
void stopSound(bool);
|
||||
bool isSoundActive();
|
||||
bool _noStopSounds;
|
||||
|
||||
Common::String getPaperShuffleSound();
|
||||
|
Loading…
x
Reference in New Issue
Block a user