aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/agos/event.cpp4
-rw-r--r--engines/agos/res_snd.cpp2
-rw-r--r--engines/cine/main_loop.cpp2
-rw-r--r--engines/cine/sound.cpp4
-rw-r--r--engines/drascula/drascula.cpp4
-rw-r--r--engines/drascula/sound.cpp2
-rw-r--r--engines/gob/gob.cpp4
-rw-r--r--engines/groovie/groovie.cpp6
-rw-r--r--engines/kyra/sound_towns.cpp27
-rw-r--r--engines/made/made.cpp6
-rw-r--r--engines/sci/sound/audio.cpp9
-rw-r--r--engines/sci/sound/audio.h1
-rw-r--r--engines/scumm/scumm.cpp5
-rw-r--r--engines/scumm/sound.cpp2
-rw-r--r--engines/teenagent/teenagent.cpp4
-rw-r--r--engines/tinsel/tinsel.cpp6
16 files changed, 50 insertions, 38 deletions
diff --git a/engines/agos/event.cpp b/engines/agos/event.cpp
index 95bcc68234..5240cdd771 100644
--- a/engines/agos/event.cpp
+++ b/engines/agos/event.cpp
@@ -427,7 +427,7 @@ void AGOSEngine::delay(uint amount) {
uint32 cur = start;
uint this_delay, vgaPeriod;
- _system->getAudioCDManager()->updateCD();
+ _system->getAudioCDManager()->update();
_debugger->onFrame();
@@ -538,7 +538,7 @@ void AGOSEngine::delay(uint amount) {
if (_leftButton == 1)
_leftButtonCount++;
- _system->getAudioCDManager()->updateCD();
+ _system->getAudioCDManager()->update();
_system->updateScreen();
diff --git a/engines/agos/res_snd.cpp b/engines/agos/res_snd.cpp
index d04f1735d6..3a092e652c 100644
--- a/engines/agos/res_snd.cpp
+++ b/engines/agos/res_snd.cpp
@@ -228,7 +228,7 @@ void AGOSEngine_Simon1::playMusic(uint16 music, uint16 track) {
// Support for compressed music from the ScummVM Music Enhancement Project
_system->getAudioCDManager()->stop();
- _system->getAudioCDManager()->play(music + 1, -1, 0, 0);
+ _system->getAudioCDManager()->play(music + 1, -1, 0, 0, true);
if (_system->getAudioCDManager()->isPlaying())
return;
diff --git a/engines/cine/main_loop.cpp b/engines/cine/main_loop.cpp
index e52fc464d5..19a2d8a82e 100644
--- a/engines/cine/main_loop.cpp
+++ b/engines/cine/main_loop.cpp
@@ -222,7 +222,7 @@ void manageEvents() {
mouseData.left = mouseLeft;
mouseData.right = mouseRight;
- g_system->getAudioCDManager()->updateCD();
+ g_system->getAudioCDManager()->update();
}
void getMouseData(uint16 param, uint16 *pButton, uint16 *pX, uint16 *pY) {
diff --git a/engines/cine/sound.cpp b/engines/cine/sound.cpp
index 7cab067371..a8b4c085ff 100644
--- a/engines/cine/sound.cpp
+++ b/engines/cine/sound.cpp
@@ -939,6 +939,10 @@ PCSound::PCSound(Audio::Mixer *mixer, CineEngine *vm)
}
_player = new PCSoundFxPlayer(_soundDriver);
+
+ // Ensure the CD is open
+ if (_vm->getGameType() == GType_FW && (_vm->getFeatures() & GF_CD))
+ g_system->getAudioCDManager()->open();
}
PCSound::~PCSound() {
diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp
index c72d77c281..9ac9031fb7 100644
--- a/engines/drascula/drascula.cpp
+++ b/engines/drascula/drascula.cpp
@@ -183,9 +183,7 @@ DrasculaEngine::DrasculaEngine(OSystem *syst, const DrasculaGameDescription *gam
const Common::FSNode gameDataDir(ConfMan.get("path"));
SearchMan.addSubDirectoryMatching(gameDataDir, "audio");
- int cd_num = ConfMan.getInt("cdrom");
- if (cd_num >= 0)
- _system->getAudioCDManager()->openCD(cd_num);
+ _system->getAudioCDManager()->open();
_lang = kEnglish;
diff --git a/engines/drascula/sound.cpp b/engines/drascula/sound.cpp
index 148dae76f5..c576b37660 100644
--- a/engines/drascula/sound.cpp
+++ b/engines/drascula/sound.cpp
@@ -133,7 +133,7 @@ void DrasculaEngine::stopMusic() {
}
void DrasculaEngine::updateMusic() {
- _system->getAudioCDManager()->updateCD();
+ _system->getAudioCDManager()->update();
}
int DrasculaEngine::musicStatus() {
diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp
index 24bdb858d8..d995f26d9f 100644
--- a/engines/gob/gob.cpp
+++ b/engines/gob/gob.cpp
@@ -296,9 +296,7 @@ Common::Error GobEngine::run() {
if (isCD())
checkCD();
- int cd_num = ConfMan.getInt("cdrom");
- if (cd_num >= 0)
- _system->getAudioCDManager()->openCD(cd_num);
+ _system->getAudioCDManager()->open();
_global->_debugFlag = 1;
_video->_doRangeClamp = true;
diff --git a/engines/groovie/groovie.cpp b/engines/groovie/groovie.cpp
index 2021cef6e8..bbc290eccf 100644
--- a/engines/groovie/groovie.cpp
+++ b/engines/groovie/groovie.cpp
@@ -257,11 +257,7 @@ Common::Error GroovieEngine::run() {
// the same cd
if (getPlatform() != Common::kPlatformIOS) {
checkCD();
-
- // Initialize the CD
- int cd_num = ConfMan.getInt("cdrom");
- if (cd_num >= 0)
- _system->getAudioCDManager()->openCD(cd_num);
+ _system->getAudioCDManager()->open();
}
while (!shouldQuit()) {
diff --git a/engines/kyra/sound_towns.cpp b/engines/kyra/sound_towns.cpp
index 65ab4f31ef..646f908b94 100644
--- a/engines/kyra/sound_towns.cpp
+++ b/engines/kyra/sound_towns.cpp
@@ -68,11 +68,14 @@ bool SoundTowns::init() {
_player->driver()->intf()->callback(70, 0x33);*/
_player->driver()->setOutputVolume(1, 118, 118);
+ // Initialize CD for audio
+ g_system->getAudioCDManager()->open();
+
return true;
}
void SoundTowns::process() {
- g_system->getAudioCDManager()->updateCD();
+ g_system->getAudioCDManager()->update();
}
void SoundTowns::playTrack(uint8 track) {
@@ -95,7 +98,7 @@ void SoundTowns::playTrack(uint8 track) {
if (_musicEnabled == 2 && trackNum != -1) {
_player->driver()->setOutputVolume(1, 118, 118);
g_system->getAudioCDManager()->play(trackNum + 1, loop ? -1 : 1, 0, 0);
- g_system->getAudioCDManager()->updateCD();
+ g_system->getAudioCDManager()->update();
_cdaPlaying = true;
} else if (_musicEnabled) {
playEuphonyTrack(READ_LE_UINT32(&res()->cdaTable[tTableIndex]), loop);
@@ -108,7 +111,7 @@ void SoundTowns::playTrack(uint8 track) {
void SoundTowns::haltTrack() {
_lastTrack = -1;
g_system->getAudioCDManager()->stop();
- g_system->getAudioCDManager()->updateCD();
+ g_system->getAudioCDManager()->update();
_cdaPlaying = false;
for (int i = 0; i < 6; i++)
@@ -407,6 +410,10 @@ bool SoundPC98::init() {
_driver = new TownsPC98_AudioDriver(_mixer, TownsPC98_AudioDriver::kType26);
bool reslt = _driver->init();
updateVolumeSettings();
+
+ // Initialize CD for audio
+ g_system->getAudioCDManager()->open();
+
return reslt;
}
@@ -471,7 +478,7 @@ void SoundPC98::playTrack(uint8 track) {
void SoundPC98::haltTrack() {
_lastTrack = -1;
g_system->getAudioCDManager()->stop();
- g_system->getAudioCDManager()->updateCD();
+ g_system->getAudioCDManager()->update();
_driver->reset();
}
@@ -529,6 +536,10 @@ bool SoundTownsPC98_v2::init() {
if (_resInfo[_currentResourceSet])
if (_resInfo[_currentResourceSet]->cdaTableSize)
_vm->checkCD();
+
+ // Initialize CD for audio
+ bool hasRealCD = g_system->getAudioCDManager()->open();
+
// FIXME: While checking for 'track1.XXX(X)' looks like
// a good idea, we should definitely not be doing this
// here. Basically our filenaming scheme could change
@@ -538,7 +549,7 @@ bool SoundTownsPC98_v2::init() {
// check if we have access to CD audio.
Resource *r = _vm->resource();
if (_musicEnabled &&
- (r->exists("track1.mp3") || r->exists("track1.ogg") || r->exists("track1.flac") || r->exists("track1.fla")
+ (hasRealCD || r->exists("track1.mp3") || r->exists("track1.ogg") || r->exists("track1.flac") || r->exists("track1.fla")
|| r->exists("track01.mp3") || r->exists("track01.ogg") || r->exists("track01.flac") || r->exists("track01.fla")))
_musicEnabled = 2;
else
@@ -580,7 +591,7 @@ void SoundTownsPC98_v2::loadSoundFile(Common::String file) {
}
void SoundTownsPC98_v2::process() {
- g_system->getAudioCDManager()->updateCD();
+ g_system->getAudioCDManager()->update();
}
void SoundTownsPC98_v2::playTrack(uint8 track) {
@@ -610,7 +621,7 @@ void SoundTownsPC98_v2::playTrack(uint8 track) {
if (_musicEnabled == 2 && trackNum != -1) {
g_system->getAudioCDManager()->play(trackNum+1, _driver->looping() ? -1 : 1, 0, 0);
- g_system->getAudioCDManager()->updateCD();
+ g_system->getAudioCDManager()->update();
} else if (_musicEnabled) {
_driver->cont();
}
@@ -621,7 +632,7 @@ void SoundTownsPC98_v2::playTrack(uint8 track) {
void SoundTownsPC98_v2::haltTrack() {
_lastTrack = -1;
g_system->getAudioCDManager()->stop();
- g_system->getAudioCDManager()->updateCD();
+ g_system->getAudioCDManager()->update();
_driver->reset();
}
diff --git a/engines/made/made.cpp b/engines/made/made.cpp
index ab07ef757b..f1539297ee 100644
--- a/engines/made/made.cpp
+++ b/engines/made/made.cpp
@@ -67,9 +67,7 @@ MadeEngine::MadeEngine(OSystem *syst, const MadeGameDescription *gameDesc) : Eng
_console = new MadeConsole(this);
- int cd_num = ConfMan.getInt("cdrom");
- if (cd_num >= 0)
- _system->getAudioCDManager()->openCD(cd_num);
+ _system->getAudioCDManager()->open();
_pmvPlayer = new PmvPlayer(this, _mixer);
_res = new ResourceReader();
@@ -270,7 +268,7 @@ void MadeEngine::handleEvents() {
}
}
- _system->getAudioCDManager()->updateCD();
+ _system->getAudioCDManager()->update();
}
diff --git a/engines/sci/sound/audio.cpp b/engines/sci/sound/audio.cpp
index 57f0415285..a74bfa245f 100644
--- a/engines/sci/sound/audio.cpp
+++ b/engines/sci/sound/audio.cpp
@@ -28,6 +28,7 @@
#include "backends/audiocd/audiocd.h"
+#include "common/config-manager.h"
#include "common/file.h"
#include "common/memstream.h"
#include "common/system.h"
@@ -44,7 +45,7 @@
namespace Sci {
AudioPlayer::AudioPlayer(ResourceManager *resMan) : _resMan(resMan), _audioRate(11025),
- _syncResource(NULL), _syncOffset(0), _audioCdStart(0) {
+ _syncResource(NULL), _syncOffset(0), _audioCdStart(0), _initCD(false) {
_mixer = g_system->getMixer();
_wPlayFlag = false;
@@ -511,6 +512,12 @@ void AudioPlayer::stopSoundSync() {
}
int AudioPlayer::audioCdPlay(int track, int start, int duration) {
+ if (!_initCD) {
+ // Initialize CD mode if we haven't already
+ g_system->getAudioCDManager()->open();
+ _initCD = true;
+ }
+
if (getSciVersion() == SCI_VERSION_1_1) {
// King's Quest VI CD Audio format
_audioCdStart = g_system->getMillis();
diff --git a/engines/sci/sound/audio.h b/engines/sci/sound/audio.h
index 9e65d6e0c8..4a8b26567d 100644
--- a/engines/sci/sound/audio.h
+++ b/engines/sci/sound/audio.h
@@ -97,6 +97,7 @@ private:
uint _syncOffset;
uint32 _audioCdStart;
bool _wPlayFlag;
+ bool _initCD;
};
} // End of namespace Sci
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index 89d2d3dc72..d9148ed300 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -1275,10 +1275,7 @@ void ScummEngine::setupScumm() {
// On some systems it's not safe to run CD audio games from the CD.
if (_game.features & GF_AUDIOTRACKS && !Common::File::exists("CDDA.SOU")) {
checkCD();
-
- int cd_num = ConfMan.getInt("cdrom");
- if (cd_num >= 0)
- _system->getAudioCDManager()->openCD(cd_num);
+ _system->getAudioCDManager()->open();
}
// Create the sound manager
diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp
index 4d70ee8482..404bdd022c 100644
--- a/engines/scumm/sound.cpp
+++ b/engines/scumm/sound.cpp
@@ -1093,7 +1093,7 @@ int Sound::pollCD() const {
void Sound::updateCD() {
if (!_isLoomSteam)
- g_system->getAudioCDManager()->updateCD();
+ g_system->getAudioCDManager()->update();
}
AudioCDManager::Status Sound::getCDStatus() {
diff --git a/engines/teenagent/teenagent.cpp b/engines/teenagent/teenagent.cpp
index d5a8b8e2dc..4dc785754c 100644
--- a/engines/teenagent/teenagent.cpp
+++ b/engines/teenagent/teenagent.cpp
@@ -545,6 +545,10 @@ Common::Error TeenAgentEngine::run() {
syncSoundSettings();
+ // Initialize CD audio
+ if (_gameDescription->flags & ADGF_CD)
+ g_system->getAudioCDManager()->open();
+
setMusic(1);
_mixer->playStream(Audio::Mixer::kMusicSoundType, &_musicHandle, music, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, false);
diff --git a/engines/tinsel/tinsel.cpp b/engines/tinsel/tinsel.cpp
index 2adddca4fd..1b733a08ba 100644
--- a/engines/tinsel/tinsel.cpp
+++ b/engines/tinsel/tinsel.cpp
@@ -841,9 +841,7 @@ TinselEngine::TinselEngine(OSystem *syst, const TinselGameDescription *gameDesc)
if (!scumm_stricmp(g->gameid, gameid))
_gameId = g->id;
- int cd_num = ConfMan.getInt("cdrom");
- if (cd_num >= 0)
- _system->getAudioCDManager()->openCD(cd_num);
+ _system->getAudioCDManager()->open();
_mousePos.x = 0;
_mousePos.y = 0;
@@ -975,7 +973,7 @@ Common::Error TinselEngine::run() {
// Check for time to do next game cycle
if ((g_system->getMillis() > timerVal + GAME_FRAME_DELAY)) {
timerVal = g_system->getMillis();
- _system->getAudioCDManager()->updateCD();
+ _system->getAudioCDManager()->update();
NextGameCycle();
}