2009-11-12 15:24:11 +00:00
|
|
|
/* 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 SCI_SOUNDCMD_H
|
|
|
|
#define SCI_SOUNDCMD_H
|
|
|
|
|
2009-11-15 14:14:49 +00:00
|
|
|
#include "common/list.h"
|
2011-02-09 01:09:01 +00:00
|
|
|
#include "audio/mididrv.h" // for MusicType
|
2009-11-12 15:24:11 +00:00
|
|
|
#include "sci/engine/state.h"
|
|
|
|
|
|
|
|
namespace Sci {
|
|
|
|
|
2009-12-28 20:10:15 +00:00
|
|
|
class Console;
|
2009-11-15 14:14:49 +00:00
|
|
|
class SciMusic;
|
2009-11-12 15:24:11 +00:00
|
|
|
class SoundCommandParser;
|
2011-09-26 19:57:50 +03:00
|
|
|
class MusicEntry;
|
2010-07-09 12:06:41 +00:00
|
|
|
//typedef void (SoundCommandParser::*SoundCommand)(reg_t obj, int16 value);
|
2009-11-12 15:24:11 +00:00
|
|
|
|
2010-07-09 12:06:41 +00:00
|
|
|
//struct MusicEntryCommand {
|
|
|
|
// MusicEntryCommand(const char *d, SoundCommand c) : sndCmd(c), desc(d) {}
|
|
|
|
// SoundCommand sndCmd;
|
|
|
|
// const char *desc;
|
|
|
|
//};
|
2009-11-12 15:24:11 +00:00
|
|
|
|
|
|
|
class SoundCommandParser {
|
|
|
|
public:
|
2010-01-18 22:39:56 +00:00
|
|
|
SoundCommandParser(ResourceManager *resMan, SegManager *segMan, Kernel *kernel, AudioPlayer *audio, SciVersion soundVersion);
|
2009-11-12 15:24:11 +00:00
|
|
|
~SoundCommandParser();
|
|
|
|
|
2010-07-09 12:06:41 +00:00
|
|
|
//reg_t parseCommand(int argc, reg_t *argv, reg_t acc);
|
2010-01-23 14:39:03 +00:00
|
|
|
|
|
|
|
// Functions used for game state loading
|
2009-12-28 20:10:15 +00:00
|
|
|
void clearPlayList();
|
|
|
|
void syncPlayList(Common::Serializer &s);
|
2010-10-31 20:57:50 +00:00
|
|
|
void reconstructPlayList();
|
2010-01-23 14:39:03 +00:00
|
|
|
|
|
|
|
// Functions used for the ScummVM menus
|
2010-01-12 00:51:37 +00:00
|
|
|
void setMasterVolume(int vol);
|
2010-01-21 21:28:32 +00:00
|
|
|
void pauseAll(bool pause);
|
2009-12-25 13:18:48 +00:00
|
|
|
|
2010-01-23 14:39:03 +00:00
|
|
|
// Debug console functions
|
|
|
|
void startNewSound(int number);
|
|
|
|
void stopAllSounds();
|
|
|
|
void printPlayList(Console *con);
|
|
|
|
void printSongInfo(reg_t obj, Console *con);
|
|
|
|
|
2010-07-09 12:06:41 +00:00
|
|
|
void processPlaySound(reg_t obj);
|
|
|
|
void processStopSound(reg_t obj, bool sampleFinishedPlaying);
|
2011-09-26 19:57:50 +03:00
|
|
|
void initSoundResource(MusicEntry *newSound);
|
2010-07-09 12:06:41 +00:00
|
|
|
|
2010-09-02 21:50:00 +00:00
|
|
|
MusicType getMusicType() const;
|
|
|
|
|
2010-01-01 16:05:26 +00:00
|
|
|
/**
|
|
|
|
* Synchronizes the current state of the music list to the rest of the engine, so that
|
|
|
|
* the changes that the sound thread makes to the music are registered with the engine
|
|
|
|
* scripts. In SCI0, we invoke this from kAnimate (which is called very often). SCI01
|
|
|
|
* and later have a specific callback function, cmdUpdateCues, which is called regularly
|
|
|
|
* by the engine scripts themselves, so the engine itself polls for changes to the music
|
|
|
|
*/
|
SCI/new music code:
- Resolved a deadlock with the mixer, and added appropriate mutexes (a result of the fact that SCI mixes MIDI and digital audio in the same list)
- Fixed sound playing when loading games, by properly resetting the MIDI driver
- Reverted savegame version to 14 - the changes in versions 15 and 16 don't have any effect on the currently enabled old music code, and the new music code is disabled by default, and is still prone to changes
- Now saving/loading signal, loop and hold for each sound, as well as reverb
- Added stub code for setting reverb and channel hold
- The signal, loop and hold values of each song are cached, like in SSCI and like what happens in Greg's SCI implementation. This allows a clear separation of the engine code from the rest of the engine. Reverted commits 46792 and 46797
- Removed duplicate song list accessing code
- Song cues are now updated in kAnimate for SCI0, like the old music code does, to compensate for the fact that SCI0 didn't poll for music changes via cmdUpdateCues, like what SCI01 and newer do
- Cleanup
svn-id: r46812
2010-01-01 06:41:52 +00:00
|
|
|
void updateSci0Cues();
|
|
|
|
|
2010-07-09 12:06:41 +00:00
|
|
|
reg_t kDoSoundInit(int argc, reg_t *argv, reg_t acc);
|
|
|
|
reg_t kDoSoundPlay(int argc, reg_t *argv, reg_t acc);
|
2010-08-02 21:20:43 +00:00
|
|
|
reg_t kDoSoundRestore(int argc, reg_t *argv, reg_t acc);
|
2010-07-09 12:06:41 +00:00
|
|
|
reg_t kDoSoundMute(int argc, reg_t *argv, reg_t acc);
|
|
|
|
reg_t kDoSoundPause(int argc, reg_t *argv, reg_t acc);
|
2010-07-20 11:17:33 +00:00
|
|
|
reg_t kDoSoundResumeAfterRestore(int argc, reg_t *argv, reg_t acc);
|
2010-07-09 12:06:41 +00:00
|
|
|
reg_t kDoSoundStop(int argc, reg_t *argv, reg_t acc);
|
|
|
|
reg_t kDoSoundStopAll(int argc, reg_t *argv, reg_t acc);
|
|
|
|
reg_t kDoSoundDispose(int argc, reg_t *argv, reg_t acc);
|
|
|
|
reg_t kDoSoundMasterVolume(int argc, reg_t *argv, reg_t acc);
|
|
|
|
reg_t kDoSoundFade(int argc, reg_t *argv, reg_t acc);
|
|
|
|
reg_t kDoSoundGetPolyphony(int argc, reg_t *argv, reg_t acc);
|
|
|
|
reg_t kDoSoundUpdate(int argc, reg_t *argv, reg_t acc);
|
|
|
|
reg_t kDoSoundUpdateCues(int argc, reg_t *argv, reg_t acc);
|
|
|
|
reg_t kDoSoundSendMidi(int argc, reg_t *argv, reg_t acc);
|
2010-11-24 14:21:31 +00:00
|
|
|
reg_t kDoSoundGlobalReverb(int argc, reg_t *argv, reg_t acc);
|
2010-07-09 12:06:41 +00:00
|
|
|
reg_t kDoSoundSetHold(int argc, reg_t *argv, reg_t acc);
|
2010-08-02 21:20:43 +00:00
|
|
|
reg_t kDoSoundDummy(int argc, reg_t *argv, reg_t acc);
|
2010-07-09 12:06:41 +00:00
|
|
|
reg_t kDoSoundGetAudioCapability(int argc, reg_t *argv, reg_t acc);
|
|
|
|
reg_t kDoSoundSetVolume(int argc, reg_t *argv, reg_t acc);
|
|
|
|
reg_t kDoSoundSetPriority(int argc, reg_t *argv, reg_t acc);
|
|
|
|
reg_t kDoSoundSetLoop(int argc, reg_t *argv, reg_t acc);
|
|
|
|
reg_t kDoSoundSuspend(int argc, reg_t *argv, reg_t acc);
|
|
|
|
|
2009-12-25 13:18:48 +00:00
|
|
|
private:
|
2010-07-09 12:06:41 +00:00
|
|
|
//typedef Common::Array<MusicEntryCommand *> SoundCommandContainer;
|
|
|
|
//SoundCommandContainer _soundCommands;
|
2009-11-12 15:24:11 +00:00
|
|
|
ResourceManager *_resMan;
|
|
|
|
SegManager *_segMan;
|
2010-01-18 22:39:56 +00:00
|
|
|
Kernel *_kernel;
|
2009-12-28 20:10:15 +00:00
|
|
|
SciMusic *_music;
|
2009-11-12 15:24:11 +00:00
|
|
|
AudioPlayer *_audio;
|
2009-12-25 13:13:42 +00:00
|
|
|
SciVersion _soundVersion;
|
2011-12-28 13:07:14 +02:00
|
|
|
// If true and an alternative digital sound effect exists, the digital
|
|
|
|
// sound effect is preferred instead
|
|
|
|
bool _useDigitalSFX;
|
2010-07-09 12:06:41 +00:00
|
|
|
|
|
|
|
void processInitSound(reg_t obj);
|
|
|
|
void processDisposeSound(reg_t obj);
|
|
|
|
void processUpdateCues(reg_t obj);
|
2011-08-25 02:52:58 +03:00
|
|
|
int getSoundResourceId(reg_t obj);
|
2009-11-12 15:24:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // End of namespace Sci
|
|
|
|
|
|
|
|
#endif // SCI_SOUNDCMD_H
|