diff options
Diffstat (limited to 'engines/sherlock')
-rw-r--r-- | engines/sherlock/module.mk | 1 | ||||
-rw-r--r-- | engines/sherlock/music.cpp | 284 | ||||
-rw-r--r-- | engines/sherlock/music.h | 95 | ||||
-rw-r--r-- | engines/sherlock/scalpel/darts.cpp | 10 | ||||
-rw-r--r-- | engines/sherlock/scalpel/scalpel.cpp | 23 | ||||
-rw-r--r-- | engines/sherlock/scene.cpp | 7 | ||||
-rw-r--r-- | engines/sherlock/settings.cpp | 15 | ||||
-rw-r--r-- | engines/sherlock/sherlock.cpp | 6 | ||||
-rw-r--r-- | engines/sherlock/sherlock.h | 2 | ||||
-rw-r--r-- | engines/sherlock/sound.cpp | 59 | ||||
-rw-r--r-- | engines/sherlock/sound.h | 28 |
11 files changed, 417 insertions, 113 deletions
diff --git a/engines/sherlock/module.mk b/engines/sherlock/module.mk index 2ded999ed1..701753d679 100644 --- a/engines/sherlock/module.mk +++ b/engines/sherlock/module.mk @@ -11,6 +11,7 @@ MODULE_OBJS = \ inventory.o \ journal.o \ map.o \ + music.o \ objects.o \ people.o \ resources.o \ diff --git a/engines/sherlock/music.cpp b/engines/sherlock/music.cpp new file mode 100644 index 0000000000..e52b22b977 --- /dev/null +++ b/engines/sherlock/music.cpp @@ -0,0 +1,284 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "common/config-manager.h" +#include "sherlock/sherlock.h" +#include "sherlock/music.h" + +namespace Sherlock { + +#define NUM_SONGS 45 + +/* This tells which song to play in each room, 0 = no song played */ +static const char ROOM_SONG[62] = { + 0, 20, 43, 6, 11, 2, 8, 15, 6, 28, + 6, 38, 7, 32, 16, 5, 8, 41, 9, 22, + 10, 23, 4, 39, 19, 24, 13, 27, 0, 30, + 3, 21, 26, 25, 16, 29, 1, 1, 18, 12, + 1, 17, 17, 31, 17, 34, 36, 7, 20, 20, + 33, 8, 44, 40, 42, 35, 0, 0, 0, 12, + 12 +}; + +static const char *const SONG_NAMES[NUM_SONGS] = { + "SINGERF", "CHEMIST", "TOBAC", "EQUEST", "MORTUARY", "DOCKS", "LSTUDY", + "LORD", "BOY", "PERFUM1", "BAKER1", "BAKER2", "OPERA1", "HOLMES", + "FFLAT", "OP1FLAT", "ZOO", "SROOM", "FLOWERS", "YARD", "TAXID", + "PUB1", "VICTIM", "RUGBY", "DORM", "SHERMAN", "LAWYER", "THEATRE", + "DETECT", "OPERA4", "POOL", "SOOTH", "ANNA1", "ANNA2", "PROLOG3", + "PAWNSHOP", "MUSICBOX", "MOZART1", "ROBHUNT", "PANCRAS1", "PANCRAS2", "LORDKILL", + "BLACKWEL", "RESCUE", "MAP" +}; + +MidiParser_SH::MidiParser_SH() { + _ppqn = 1; + setTempo(16667); + _data = nullptr; +} + +void MidiParser_SH::parseNextEvent(EventInfo &info) { + warning("parseNextEvent"); + + // An attempt to remap MT32 instruments to GMIDI. Only partially successful, it still + // does not sound even close to the real MT32. Oddly enough, on the actual hardware MT32 + // and SB sound very differently. + static const byte mt32Map[128] = { + 0, 1, 0, 2, 4, 4, 5, 3, /* 0-7 */ + 16, 17, 18, 16, 16, 19, 20, 21, /* 8-15 */ + 6, 6, 6, 7, 7, 7, 8, 112, /* 16-23 */ + 62, 62, 63, 63 , 38, 38, 39, 39, /* 24-31 */ + 88, 95, 52, 98, 97, 99, 14, 54, /* 32-39 */ + 102, 96, 53, 102, 81, 100, 14, 80, /* 40-47 */ + 48, 48, 49, 45, 41, 40, 42, 42, /* 48-55 */ + 43, 46, 45, 24, 25, 28, 27, 104, /* 56-63 */ + 32, 32, 34, 33, 36, 37, 35, 35, /* 64-71 */ + 79, 73, 72, 72, 74, 75, 64, 65, /* 72-79 */ + 66, 67, 71, 71, 68, 69, 70, 22, /* 80-87 */ + 56, 59, 57, 57, 60, 60, 58, 61, /* 88-95 */ + 61, 11, 11, 98, 14, 9, 14, 13, /* 96-103 */ + 12, 107, 107, 77, 78, 78, 76, 76, /* 104-111 */ + 47, 117, 127, 118, 118, 116, 115, 119, /* 112-119 */ + 115, 112, 55, 124, 123, 0, 14, 117 /* 120-127 */ + }; + + + info.start = _position._playPos; + info.delta = 0; + + info.event = *_position._playPos++; + warning("Event %x", info.event); + _position._runningStatus = info.event; + + switch (info.command()) { + case 0xC: { + int idx = *_position._playPos++; + info.basic.param1 = mt32Map[idx & 0x7f]; // remap MT32 to GM + info.basic.param2 = 0; + } + break; + case 0xD: + info.basic.param1 = *_position._playPos++; + info.basic.param2 = 0; + break; + + case 0xB: + info.basic.param1 = *_position._playPos++; + info.basic.param2 = *_position._playPos++; + info.length = 0; + break; + + case 0x8: + case 0x9: + case 0xA: + case 0xE: + info.basic.param1 = *(_position._playPos++); + info.basic.param2 = *(_position._playPos++); + if (info.command() == 0x9 && info.basic.param2 == 0) { + // NoteOn with param2==0 is a NoteOff + info.event = info.channel() | 0x80; + } + info.length = 0; + break; + case 0xF: + if (info.event == 0xFF) { + byte type = *(_position._playPos++); + switch(type) { + case 0x2F: + // End of Track + allNotesOff(); + stopPlaying(); + unloadMusic(); + return; + case 0x51: + warning("TODO: 0xFF / 0x51"); + return; + default: + warning("TODO: 0xFF / %x Unknown", type); + break; + } + } else if (info.event == 0xFC) { + allNotesOff(); + stopPlaying(); + unloadMusic(); + return; + } else { + warning("TODO: %x / Unknown", info.event); + break; + } + break; + default: + warning("MidiParser_SH::parseNextEvent: Unsupported event code %x", info.event); + break; + }// switch (info.command()) + + info.delta = *(_position._playPos++); +} + +bool MidiParser_SH::loadMusic(byte *data, uint32 size) { + warning("loadMusic"); + unloadMusic(); + + byte *pos = data; + + if (memcmp(" ", pos, 12)) { + warning("Expected header not found in music file"); + return false; + } + pos += 12; + byte headerSize = *pos; + pos += headerSize; + + _lastEvent = 0; + _trackEnd = data + size; + + _numTracks = 1; + _tracks[0] = pos; + + _ppqn = 1; + setTempo(16667); + setTrack(0); + + return true; +} + +/*----------------------------------------------------------------*/ + +Music::Music(SherlockEngine *vm, Audio::Mixer *mixer) : _vm(vm), _mixer(mixer) { + if (_vm->_interactiveFl) + _vm->_res->addToCache("MUSIC.LIB"); + + MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI | MDT_ADLIB | MDT_PREFER_GM); + _driver = MidiDriver::createMidi(dev); + assert(_driver); + + int ret = _driver->open(); + if (ret == 0) { + _driver->sendGMReset(); + _driver->setTimerCallback(&_midiParser, &_midiParser.timerCallback); + } + _midiParser.setMidiDriver(_driver); + _midiParser.setTimerRate(_driver->getBaseTempo()); +} + +bool Music::loadSong(int songNumber) { + warning("loadSong"); + + if(songNumber == 100) + songNumber = 55; + else if(songNumber == 70) + songNumber = 54; + + if((songNumber > 60) || (songNumber < 1)) + return false; + + songNumber = ROOM_SONG[songNumber]; + + if(songNumber == 0) + songNumber = 12; + + if((songNumber > NUM_SONGS) || (songNumber < 1)) + return false; + + Common::String songName = Common::String(SONG_NAMES[songNumber - 1]) + ".MUS"; + + freeSong(); // free any song that is currently loaded + + if (!playMusic(songName)) + return false; + + stopMusic(); + startSong(); + return true; +} + +void Music::syncMusicSettings() { + _musicOn = !ConfMan.getBool("mute") && !ConfMan.getBool("music_mute"); +} + +bool Music::playMusic(const Common::String &name) { + if (!_musicOn) + return false; + + warning("Sound::playMusic %s", name.c_str()); + Common::SeekableReadStream *stream = _vm->_res->load(name, "MUSIC.LIB"); + + byte *data = new byte[stream->size()]; + byte *ptr = data; + + stream->read(ptr, stream->size()); + Common::DumpFile outFile; + outFile.open(name + ".RAW"); + outFile.write(data, stream->size()); + outFile.flush(); + outFile.close(); + + _midiParser.loadMusic(data, stream->size()); + + return true; +} + +void Music::stopMusic() { + // TODO + warning("TODO: Sound::stopMusic"); + + _musicPlaying = false; +} + +void Music::startSong() { + if (!_musicOn) + return; + + // TODO + warning("TODO: Sound::startSong"); + _musicPlaying = true; +} + +void Music::freeSong() { + // TODO + warning("TODO: Sound::freeSong"); +} + +void Music::waitTimerRoland(uint time) { + // TODO + warning("TODO: Sound::waitTimerRoland"); +}} // End of namespace Sherlock + diff --git a/engines/sherlock/music.h b/engines/sherlock/music.h new file mode 100644 index 0000000000..51ee7bb84f --- /dev/null +++ b/engines/sherlock/music.h @@ -0,0 +1,95 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef SHERLOCK_MUSIC_H +#define SHERLOCK_MUSIC_H + +#include "audio/midiplayer.h" +#include "audio/midiparser.h" +#include "audio/mididrv.h" + +namespace Sherlock { + +class SherlockEngine; + +class MidiParser_SH : public MidiParser { +protected: + virtual void parseNextEvent(EventInfo &info); + + uint8 _beats; + uint8 _lastEvent; + byte *_data; + byte *_trackEnd; +public: + MidiParser_SH(); + virtual bool loadMusic(byte *data, uint32 size); +}; + +class Music : public Audio::MidiPlayer { +private: + SherlockEngine *_vm; + Audio::Mixer *_mixer; + MidiParser_SH _midiParser; + +public: + bool _musicPlaying; + bool _musicOn; +public: + Music(SherlockEngine *vm, Audio::Mixer *mixer); + + /** + * Saves sound-related settings + */ + void syncMusicSettings(); + + /** + * Load a specified song + */ + bool loadSong(int songNumber); + + /** + * Start playing a song + */ + void startSong(); + + /** + * Free any currently loaded song + */ + void freeSong(); + + /** + * Play the specified music resource + */ + bool playMusic(const Common::String &name); + + /** + * Stop playing the music + */ + void stopMusic(); + + void waitTimerRoland(uint time); +}; + +} // End of namespace Sherlock + +#endif + diff --git a/engines/sherlock/scalpel/darts.cpp b/engines/sherlock/scalpel/darts.cpp index b567d58ab4..8d78335a55 100644 --- a/engines/sherlock/scalpel/darts.cpp +++ b/engines/sherlock/scalpel/darts.cpp @@ -377,13 +377,13 @@ void Darts::erasePowerBars() { int Darts::doPowerBar(const Common::Point &pt, byte color, int goToPower, bool isVertical) { Events &events = *_vm->_events; Screen &screen = *_vm->_screen; - Sound &sound = *_vm->_sound; + Music &music = *_vm->_music; bool done; int idx = 0; events.clearEvents(); - if (sound._musicOn) - sound.waitTimerRoland(10); + if (music._musicOn) + music.waitTimerRoland(10); else events.delay(100); @@ -410,9 +410,9 @@ int Darts::doPowerBar(const Common::Point &pt, byte color, int goToPower, bool i screen.slamArea(pt.x + idx, pt.y, 1, 8); } - if (sound._musicOn) { + if (music._musicOn) { if (!(idx % 3)) - sound.waitTimerRoland(1); + music.waitTimerRoland(1); } else if (!(idx % 8)) events.wait(1); diff --git a/engines/sherlock/scalpel/scalpel.cpp b/engines/sherlock/scalpel/scalpel.cpp index 8354b22c2a..bee44bfb7d 100644 --- a/engines/sherlock/scalpel/scalpel.cpp +++ b/engines/sherlock/scalpel/scalpel.cpp @@ -22,6 +22,7 @@ #include "sherlock/scalpel/scalpel.h" #include "sherlock/sherlock.h" +#include "sherlock/music.h" #include "sherlock/animation.h" namespace Sherlock { @@ -428,13 +429,13 @@ void ScalpelEngine::showOpening() { return; _events->clearEvents(); - _sound->stopMusic(); + _music->stopMusic(); } bool ScalpelEngine::showCityCutscene() { byte palette[PALETTE_SIZE]; - _sound->playMusic("prolog1.mus"); + _music->playMusic("prolog1.mus"); _animation->_gfxLibraryFilename = "title.lib"; _animation->_soundLibraryFilename = "title.snd"; bool finished = _animation->play("26open1", 1, 255, true, 2); @@ -505,7 +506,7 @@ bool ScalpelEngine::showCityCutscene() { bool ScalpelEngine::showAlleyCutscene() { byte palette[PALETTE_SIZE]; - _sound->playMusic("prolog2.mus"); + _music->playMusic("prolog2.mus"); _animation->_gfxLibraryFilename = "TITLE.LIB"; _animation->_soundLibraryFilename = "TITLE.SND"; @@ -544,7 +545,7 @@ bool ScalpelEngine::showStreetCutscene() { _animation->_gfxLibraryFilename = "TITLE.LIB"; _animation->_soundLibraryFilename = "TITLE.SND"; - _sound->playMusic("PROLOG3.MUS"); + _music->playMusic("PROLOG3.MUS"); bool finished = _animation->play("14KICK", 1, 3, true, 2); @@ -590,7 +591,7 @@ bool ScalpelEngine::scrollCredits() { } bool ScalpelEngine::showOfficeCutscene() { - _sound->playMusic("PROLOG4.MUS"); + _music->playMusic("PROLOG4.MUS"); _animation->_gfxLibraryFilename = "TITLE2.LIB"; _animation->_soundLibraryFilename = "TITLE.SND"; @@ -668,12 +669,12 @@ void ScalpelEngine::showLBV(const Common::String &filename) { void ScalpelEngine::startScene() { if (_scene->_goToScene == OVERHEAD_MAP || _scene->_goToScene == OVERHEAD_MAP2) { // Show the map - if (_sound->_musicOn && _sound->loadSong(100)) - _sound->startSong(); + if (_music->_musicOn && _music->loadSong(100)) + _music->startSong(); _scene->_goToScene = _map->show(); - _sound->freeSong(); + _music->freeSong(); _people->_hSavedPos = Common::Point(-1, -1); _people->_hSavedFacing = -1; } @@ -689,8 +690,8 @@ void ScalpelEngine::startScene() { case RESCUE_ANNA: case MOOREHEAD_DEATH: case BRUMWELL_SUICIDE: - if (_sound->_musicOn && _sound->loadSong(_scene->_goToScene)) - _sound->startSong(); + if (_music->_musicOn && _music->loadSong(_scene->_goToScene)) + _music->startSong(); switch (_scene->_goToScene) { case BLACKWOOD_CAPTURE: @@ -790,7 +791,7 @@ void ScalpelEngine::startScene() { } // Free any song from the previous scene - _sound->freeSong(); + _music->freeSong(); break; case EXIT_GAME: diff --git a/engines/sherlock/scene.cpp b/engines/sherlock/scene.cpp index 39ec16ca7e..781e596f40 100644 --- a/engines/sherlock/scene.cpp +++ b/engines/sherlock/scene.cpp @@ -167,7 +167,7 @@ void Scene::freeScene() { _vm->_talk->freeTalkVars(); _vm->_inventory->freeInv(); - _vm->_sound->freeSong(); + _vm->_music->freeSong(); _vm->_sound->freeLoadedSounds(); if (!_loadingSavedGame) @@ -197,6 +197,7 @@ bool Scene::loadScene(const Common::String &filename) { SaveManager &saves = *_vm->_saves; Screen &screen = *_vm->_screen; Sound &sound = *_vm->_sound; + Music &music = *_vm->_music; UserInterface &ui = *_vm->_ui; bool flag; @@ -446,8 +447,8 @@ bool Scene::loadScene(const Common::String &filename) { checkInventory(); // Handle starting any music for the scene - if (sound._musicOn && sound.loadSong(_currentScene)) - sound.startSong(); + if (music._musicOn && music.loadSong(_currentScene)) + music.startSong(); // Load walking images if not already loaded people.loadWalk(); diff --git a/engines/sherlock/settings.cpp b/engines/sherlock/settings.cpp index e61f7a2246..397d882e0f 100644 --- a/engines/sherlock/settings.cpp +++ b/engines/sherlock/settings.cpp @@ -55,6 +55,7 @@ void Settings::drawInteface(bool flag) { People &people = *_vm->_people; Screen &screen = *_vm->_screen; Sound &sound = *_vm->_sound; + Music &music = *_vm->_music; UserInterface &ui = *_vm->_ui; Common::String tempStr; @@ -71,7 +72,7 @@ void Settings::drawInteface(bool flag) { screen.makeButton(Common::Rect(SETUP_POINTS[0][0], SETUP_POINTS[0][1], SETUP_POINTS[0][2], SETUP_POINTS[0][1] + 10), SETUP_POINTS[0][3] - screen.stringWidth("Exit") / 2, "Exit"); - tempStr = Common::String::format("Music %s", SETUP_STRS0[sound._musicOn]); + tempStr = Common::String::format("Music %s", SETUP_STRS0[music._musicOn]); screen.makeButton(Common::Rect(SETUP_POINTS[1][0], SETUP_POINTS[1][1], SETUP_POINTS[1][2], SETUP_POINTS[1][1] + 10), SETUP_POINTS[1][3] - screen.stringWidth(tempStr) / 2, tempStr); @@ -135,6 +136,7 @@ int Settings::drawButtons(const Common::Point &pt, int _key) { Events &events = *_vm->_events; People &people = *_vm->_people; Screen &screen = *_vm->_screen; + Music &music = *_vm->_music; Sound &sound = *_vm->_sound; UserInterface &ui = *_vm->_ui; int found = -1; @@ -154,7 +156,7 @@ int Settings::drawButtons(const Common::Point &pt, int _key) { // Print the button text switch (idx) { case 1: - tempStr = Common::String::format("Music %s", SETUP_STRS0[sound._musicOn]); + tempStr = Common::String::format("Music %s", SETUP_STRS0[music._musicOn]); screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr); break; case 2: @@ -208,6 +210,7 @@ void Settings::show(SherlockEngine *vm) { Scene &scene = *vm->_scene; Screen &screen = *vm->_screen; Sound &sound = *vm->_sound; + Music &music = *vm->_music; Talk &talk = *vm->_talk; UserInterface &ui = *vm->_ui; bool updateConfig = false; @@ -255,11 +258,11 @@ void Settings::show(SherlockEngine *vm) { if ((found == 1 && events._released) || ui._key == 'M') { // Toggle music - sound._musicOn = !sound._musicOn; - if (!sound._musicOn) - sound.stopMusic(); + music._musicOn = !music._musicOn; + if (!music._musicOn) + music.stopMusic(); else - sound.startSong(); + music.startSong(); updateConfig = true; settings.drawInteface(true); diff --git a/engines/sherlock/sherlock.cpp b/engines/sherlock/sherlock.cpp index db1083d195..9807c23fee 100644 --- a/engines/sherlock/sherlock.cpp +++ b/engines/sherlock/sherlock.cpp @@ -37,6 +37,7 @@ SherlockEngine::SherlockEngine(OSystem *syst, const SherlockGameDescription *gam _inventory = nullptr; _journal = nullptr; _map = nullptr; + _music = nullptr; _people = nullptr; _res = nullptr; _saves = nullptr; @@ -58,6 +59,7 @@ SherlockEngine::~SherlockEngine() { delete _events; delete _journal; delete _map; + delete _music; delete _people; delete _saves; delete _scene; @@ -92,6 +94,7 @@ void SherlockEngine::initialize() { _events = new Events(this); _inventory = new Inventory(this); _map = new Map(this); + _music = new Music(this, _mixer); _journal = new Journal(this); _people = new People(this); _saves = new SaveManager(this, _targetName); @@ -218,7 +221,7 @@ void SherlockEngine::loadConfig() { void SherlockEngine::saveConfig() { ConfMan.setBool("mute", !_sound->_digitized); - ConfMan.setBool("music_mute", !_sound->_musicOn); + ConfMan.setBool("music_mute", !_music->_musicOn); ConfMan.setBool("speech_mute", !_sound->_voices); ConfMan.setInt("font", _screen->fontNumber()); @@ -235,6 +238,7 @@ void SherlockEngine::syncSoundSettings() { // Load sound-related settings _sound->syncSoundSettings(); + _music->syncMusicSettings(); } void SherlockEngine::synchronize(Common::Serializer &s) { diff --git a/engines/sherlock/sherlock.h b/engines/sherlock/sherlock.h index 24a72076ef..2e85651700 100644 --- a/engines/sherlock/sherlock.h +++ b/engines/sherlock/sherlock.h @@ -38,6 +38,7 @@ #include "sherlock/inventory.h" #include "sherlock/journal.h" #include "sherlock/map.h" +#include "sherlock/music.h" #include "sherlock/people.h" #include "sherlock/resources.h" #include "sherlock/saveload.h" @@ -104,6 +105,7 @@ public: Inventory *_inventory; Journal *_journal; Map *_map; + Music *_music; People *_people; Resources *_res; SaveManager *_saves; diff --git a/engines/sherlock/sound.cpp b/engines/sherlock/sound.cpp index 1441b4c4aa..b9762d22de 100644 --- a/engines/sherlock/sound.cpp +++ b/engines/sherlock/sound.cpp @@ -52,7 +52,6 @@ static const uint8 creativeADPCM_AdjustMap[64] = { Sound::Sound(SherlockEngine *vm, Audio::Mixer *mixer) : _vm(vm), _mixer(mixer) { _digitized = false; - _musicPlaying = false; _voices = 0; _diskSoundPlaying = false; _soundPlaying = false; @@ -60,13 +59,11 @@ Sound::Sound(SherlockEngine *vm, Audio::Mixer *mixer) : _vm(vm), _mixer(mixer) { _curPriority = 0; _soundOn = true; - _musicOn = true; _speechOn = true; if (!_vm->_interactiveFl) _vm->_res->addToCache("TITLE.SND"); else { - _vm->_res->addToCache("MUSIC.LIB"); _vm->_res->addToCache("SND.SND"); if (!_vm->isDemo()) { @@ -78,7 +75,6 @@ Sound::Sound(SherlockEngine *vm, Audio::Mixer *mixer) : _vm(vm), _mixer(mixer) { void Sound::syncSoundSettings() { _digitized = !ConfMan.getBool("mute"); - _musicOn = !ConfMan.getBool("mute") && !ConfMan.getBool("music_mute"); _voices = !ConfMan.getBool("mute") && !ConfMan.getBool("speech_mute") ? 1 : 0; } @@ -201,66 +197,11 @@ void Sound::stopSound() { _mixer->stopHandle(_effectsHandle); } -void Sound::playMusic(const Common::String &name) { - if (!_musicOn) - return; - - // TODO - warning("Sound::playMusic %s", name.c_str()); - Common::SeekableReadStream *stream = _vm->_res->load(name, "MUSIC.LIB"); - - byte *data = new byte[stream->size()]; - byte *ptr = data; - stream->read(ptr, stream->size()); - Common::DumpFile outFile; - outFile.open(name + ".RAW"); - outFile.write(data, stream->size()); - outFile.flush(); - outFile.close(); - delete[] data; - - stopMusic(); - startSong(); -} - -void Sound::stopMusic() { - // TODO - warning("TODO: Sound::stopMusic"); - - _musicPlaying = false; -} - -int Sound::loadSong(int songNumber) { - // TODO - warning("TODO: Sound::loadSong"); - return 0; -} - -void Sound::startSong() { - if (!_musicOn) - return; - - // TODO - warning("TODO: Sound::startSong"); - - _musicPlaying = true; -} - -void Sound::freeSong() { - // TODO - warning("TODO: Sound::freeSong"); -} - void Sound::stopSndFuncPtr(int v1, int v2) { // TODO warning("TODO: Sound::stopSndFuncPtr"); } -void Sound::waitTimerRoland(uint time) { - // TODO - warning("TODO: Sound::waitTimerRoland"); -} - void Sound::freeDigiSound() { delete[] _digiBuf; _digiBuf = nullptr; diff --git a/engines/sherlock/sound.h b/engines/sherlock/sound.h index e0e56bc13c..2351bebd6e 100644 --- a/engines/sherlock/sound.h +++ b/engines/sherlock/sound.h @@ -49,10 +49,8 @@ private: byte decodeSample(byte sample, byte& reference, int16& scale); public: bool _digitized; - bool _musicPlaying; int _voices; bool _soundOn; - bool _musicOn; bool _speechOn; bool _diskSoundPlaying; bool _soundPlaying; @@ -91,33 +89,7 @@ public: */ void stopSound(); - /** - * Load a specified song - */ - int loadSong(int songNumber); - - /** - * Start playing a song - */ - void startSong(); - - /** - * Free any currently loaded song - */ - void freeSong(); - - /** - * Play the specified music resource - */ - void playMusic(const Common::String &name); - - /** - * Stop playing the music - */ - void stopMusic(); - void stopSndFuncPtr(int v1, int v2); - void waitTimerRoland(uint time); void freeDigiSound(); }; |