diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/sfx/midiparser.cpp | 18 | ||||
-rw-r--r-- | engines/sci/sfx/midiparser.h | 2 | ||||
-rw-r--r-- | engines/sci/sfx/music.cpp | 55 | ||||
-rw-r--r-- | engines/sci/sfx/music.h | 7 |
4 files changed, 31 insertions, 51 deletions
diff --git a/engines/sci/sfx/midiparser.cpp b/engines/sci/sfx/midiparser.cpp index dd7c9ad4e9..a048cdcfd8 100644 --- a/engines/sci/sfx/midiparser.cpp +++ b/engines/sci/sfx/midiparser.cpp @@ -31,7 +31,7 @@ namespace Sci { static const int nMidiParams[] = { 2, 2, 2, 2, 1, 1, 2, 0 }; -//--------------------------------------------- + // MidiParser_SCI // MidiParser_SCI::MidiParser_SCI() : @@ -45,11 +45,11 @@ MidiParser_SCI::MidiParser_SCI() : _signalSet = false; _signalToSet = 0; } -//--------------------------------------------- + MidiParser_SCI::~MidiParser_SCI() { unloadMusic(); } -//--------------------------------------------- + bool MidiParser_SCI::loadMusic(SoundResource::Track *track, MusicEntry *psnd, int channelFilterMask, SciVersion soundVersion) { unloadMusic(); _track = track; @@ -220,7 +220,7 @@ void MidiParser_SCI::parseNextEvent(EventInfo &info) { }// switch (info.command()) } -//---------------------------------------- + byte MidiParser_SCI::midiGetNextChannel(long ticker) { byte curr = 0xFF; long closest = ticker + 1000000, next = 0; @@ -240,7 +240,7 @@ byte MidiParser_SCI::midiGetNextChannel(long ticker) { return curr; } -//---------------------------------------- + byte *MidiParser_SCI::midiMixChannels() { int totalSize = 0; byte **dataPtr = new byte *[_track->channelCount]; @@ -318,8 +318,9 @@ byte *MidiParser_SCI::midiMixChannels() { return _mixedData; } -// This is used for SCI0 sound-data. SCI0 only has one stream that may contain several channels and according to output -// device we remove certain channels from that data +// This is used for SCI0 sound-data. SCI0 only has one stream that may +// contain several channels and according to output device we remove +// certain channels from that data. byte *MidiParser_SCI::midiFilterChannels(int channelMask) { SoundResource::Channel *channel = &_track->channels[0]; byte *channelData = channel->data; @@ -437,4 +438,5 @@ void MidiParser_SCI::setVolume(byte bVolume) { _driver->send(0xB0 + _track->channels[i].number, 7, _volume); } } -} // end of namespace SCI + +} // End of namespace Sci diff --git a/engines/sci/sfx/midiparser.h b/engines/sci/sfx/midiparser.h index f98a0f5faf..7f4945fdcf 100644 --- a/engines/sci/sfx/midiparser.h +++ b/engines/sci/sfx/midiparser.h @@ -80,6 +80,6 @@ protected: int16 _signalToSet; }; -} // end of namespace +} // End of namespace Sci #endif diff --git a/engines/sci/sfx/music.cpp b/engines/sci/sfx/music.cpp index f54b1c43c2..8d2beff59f 100644 --- a/engines/sci/sfx/music.cpp +++ b/engines/sci/sfx/music.cpp @@ -55,7 +55,7 @@ SciMusic::~SciMusic() { delete _pMidiDrv; } } -//---------------------------------------- + void SciMusic::init() { // system init _pMixer = g_system->getMixer(); @@ -102,28 +102,7 @@ void SciMusic::init() { warning("Can't initialise music driver"); _bMultiMidi = ConfMan.getBool("multi_midi"); } -//---------------------------------------- -bool SciMusic::saveState(Common::OutSaveFile *pFile) { - // TODO -#if 0 - pFile->writeString("AUDIO\n"); - // playlist - int sz = _playList.size(); - pFile->writeUint16LE(sz); - for(int i = 0; i < sz; i++) { - pFile->writeUint16LE(ptr2heap((byte*)_playList[i])); - // member variable - pFile->writeUint16LE(_audVolNum); - pFile->writeByte(_langID); - pFile->writeUint16LE(_audioType); - pFile->writeUint16LE(_audioRate); - // TODO: current playing stream (hCurrentAud) info - } -#endif - return true; -} -//---------------------------------------- void SciMusic::clearPlayList() { _pMixer->stopAll(); @@ -132,7 +111,7 @@ void SciMusic::clearPlayList() { soundKill(_playList[0]); } } -//---------------------------------------- + void SciMusic::stopAll() { SegManager *segMan = ((SciEngine *)g_engine)->getEngineState()->_segMan; // HACK @@ -146,12 +125,12 @@ void SciMusic::stopAll() { soundStop(_playList[i]); } } -//---------------------------------------- + void SciMusic::miditimerCallback(void *p) { SciMusic* aud = (SciMusic *)p; aud->onTimer(); } -//---------------------------------------- + uint16 SciMusic::soundGetVoices() { switch (_midiType) { case MD_PCSPK: @@ -166,7 +145,7 @@ uint16 SciMusic::soundGetVoices() { return 1; } } -//---------------------------------------- + void SciMusic::sortPlayList() { MusicEntry ** pData = _playList.begin(); qsort(pData, _playList.size(), sizeof(MusicEntry *), &f_compare); @@ -291,7 +270,7 @@ void SciMusic::loadPatchMT32() { } #endif -//---------------------------------------- + void SciMusic::soundInitSnd(MusicEntry *pSnd) { SoundResource::Track *track = NULL; int channelFilterMask = 0; @@ -344,7 +323,7 @@ void SciMusic::soundInitSnd(MusicEntry *pSnd) { } } } -//---------------------------------------- + void SciMusic::onTimer() { Common::StackLock lock(_mutex); @@ -378,7 +357,7 @@ void SciMusic::onTimer() { } }//for() } -//--------------------------------------------- + void SciMusic::doFade(MusicEntry *pSnd) { // This is called from inside onTimer, where the mutex is already locked @@ -396,7 +375,7 @@ void SciMusic::doFade(MusicEntry *pSnd) { } } -//--------------------------------------------- + void SciMusic::soundPlay(MusicEntry *pSnd) { uint sz = _playList.size(), i; // searching if sound is already in _playList @@ -418,7 +397,7 @@ void SciMusic::soundPlay(MusicEntry *pSnd) { pSnd->status = kSoundPlaying; } -//--------------------------------------------- + void SciMusic::soundStop(MusicEntry *pSnd) { pSnd->status = kSoundStopped; if (pSnd->pStreamAud) @@ -426,19 +405,19 @@ void SciMusic::soundStop(MusicEntry *pSnd) { if (pSnd->pMidiParser) pSnd->pMidiParser->stop(); } -//--------------------------------------------- + void SciMusic::soundSetVolume(MusicEntry *pSnd, byte volume) { if (pSnd->pStreamAud) _pMixer->setChannelVolume(pSnd->hCurrentAud, volume); else if (pSnd->pMidiParser) pSnd->pMidiParser->setVolume(volume); } -//--------------------------------------------- + void SciMusic::soundSetPriority(MusicEntry *pSnd, byte prio) { pSnd->prio = prio; sortPlayList(); } -//--------------------------------------------- + void SciMusic::soundKill(MusicEntry *pSnd) { pSnd->status = kSoundStopped; @@ -463,7 +442,7 @@ void SciMusic::soundKill(MusicEntry *pSnd) { } } } -//--------------------------------------------- + void SciMusic::soundPause(MusicEntry *pSnd) { pSnd->status = kSoundPaused; if (pSnd->pStreamAud) @@ -472,11 +451,11 @@ void SciMusic::soundPause(MusicEntry *pSnd) { pSnd->pMidiParser->pause(); } -//--------------------------------------------- + uint16 SciMusic::soundGetMasterVolume() { return (_pMixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) + 8) * 0xF / Audio::Mixer::kMaxMixerVolume; } -//--------------------------------------------- + void SciMusic::soundSetMasterVolume(uint16 vol) { vol = vol & 0xF; // 0..15 vol = vol * Audio::Mixer::kMaxMixerVolume / 0xF; @@ -516,4 +495,4 @@ void SciMusic::reconstructPlayList(int savegame_version) { } } -} // end of namespace SCI +} // End of namespace Sci diff --git a/engines/sci/sfx/music.h b/engines/sci/sfx/music.h index 9b4b25268c..cb220cc25a 100644 --- a/engines/sci/sfx/music.h +++ b/engines/sci/sfx/music.h @@ -98,7 +98,6 @@ public: void loadPatch(); #endif void onTimer(); - bool saveState(Common::OutSaveFile *pFile); void clearPlayList(); void stopAll(); @@ -112,13 +111,13 @@ public: void soundSetPriority(MusicEntry *pSnd, byte prio); uint16 soundGetMasterVolume(); void soundSetMasterVolume(uint16 vol); - uint16 soundGetSoundOn() { return _soundOn; } + uint16 soundGetSoundOn() const { return _soundOn; } void soundSetSoundOn(bool soundOnFlag) { _soundOn = soundOnFlag; _pMidiDrv->playSwitch(soundOnFlag); } uint16 soundGetVoices(); - uint32 soundGetTempo() { return _dwTempo; } + uint32 soundGetTempo() const { return _dwTempo; } MusicEntry *getSlot(reg_t obj) { for (uint32 i = 0; i < _playList.size(); i++) { @@ -173,6 +172,6 @@ private: bool _inCriticalSection; }; -} // end of namespace +} // End of namespace Sci #endif |