ScummVM API documentation
soundcmd.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef SCI_SOUND_SOUNDCMD_H
23 #define SCI_SOUND_SOUNDCMD_H
24 
25 #include "common/list.h"
26 #include "audio/mididrv.h" // for MusicType
27 #include "sci/engine/state.h"
28 
29 namespace Sci {
30 
31 class Console;
32 class SciMusic;
33 class SoundCommandParser;
34 class MusicEntry;
35 
37 public:
38  SoundCommandParser(ResourceManager *resMan, SegManager *segMan, Kernel *kernel, AudioPlayer *audio, SciVersion soundVersion);
40 
41  // Functions used for game state loading
42  void clearPlayList();
43  void syncPlayList(Common::Serializer &s);
44  void reconstructPlayList();
45 
46  // Functions used for the ScummVM menus
47  void setMasterVolume(int vol);
48  void pauseAll(bool pause);
49  void resetGlobalPauseCounter();
50  bool isGlobalPauseActive() const;
51 #ifdef ENABLE_SCI32
52  void setVolume(const reg_t obj, const int vol);
53 #endif
54 
55  // Debug console functions
56  void startNewSound(int number);
57  void stopAllSounds();
58  void stopAllSamples();
59  void printPlayList(Console *con);
60  void printSongInfo(reg_t obj, Console *con);
61 
62  void processPlaySound(reg_t obj, bool playBed, bool restoring = false);
63  void processStopSound(reg_t obj, bool sampleFinishedPlaying);
64  void initSoundResource(MusicEntry *newSound);
65 
66  MusicType getMusicType() const;
67 
68  ResourceType getSoundResourceType(const uint16 resourceNo) const {
69  if (_useDigitalSFX && _resMan->testResource(ResourceId(kResourceTypeAudio, resourceNo)))
70  return kResourceTypeAudio;
71  else
72  return kResourceTypeSound;
73  }
74 
82  void updateSci0Cues();
83 
84  reg_t kDoSoundInit(EngineState *s, int argc, reg_t *argv);
85  reg_t kDoSoundPlay(EngineState *s, int argc, reg_t *argv);
86  reg_t kDoSoundMute(EngineState *s, int argc, reg_t *argv);
87  reg_t kDoSoundPause(EngineState *s, int argc, reg_t *argv);
88  reg_t kDoSoundResumeAfterRestore(EngineState *s, int argc, reg_t *argv);
89  reg_t kDoSoundStop(EngineState *s, int argc, reg_t *argv);
90  reg_t kDoSoundStopAll(EngineState *s, int argc, reg_t *argv);
91  reg_t kDoSoundDispose(EngineState *s, int argc, reg_t *argv);
92  reg_t kDoSoundMasterVolume(EngineState *s, int argc, reg_t *argv);
93  reg_t kDoSoundFade(EngineState *s, int argc, reg_t *argv);
94  reg_t kDoSoundGetPolyphony(EngineState *s, int argc, reg_t *argv);
95  reg_t kDoSoundUpdate(EngineState *s, int argc, reg_t *argv);
96  reg_t kDoSoundUpdateCues(EngineState *s, int argc, reg_t *argv);
97  reg_t kDoSoundSendMidi(EngineState *s, int argc, reg_t *argv);
98  reg_t kDoSoundGlobalReverb(EngineState *s, int argc, reg_t *argv);
99  reg_t kDoSoundSetHold(EngineState *s, int argc, reg_t *argv);
100  reg_t kDoSoundGetAudioCapability(EngineState *s, int argc, reg_t *argv);
101  reg_t kDoSoundSetVolume(EngineState *s, int argc, reg_t *argv);
102  reg_t kDoSoundSetPriority(EngineState *s, int argc, reg_t *argv);
103  reg_t kDoSoundSetLoop(EngineState *s, int argc, reg_t *argv);
104  reg_t kDoSoundSuspend(EngineState *s, int argc, reg_t *argv);
105 
106 private:
107  ResourceManager *_resMan;
108  SegManager *_segMan;
109  Kernel *_kernel;
110  SciMusic *_music;
111  AudioPlayer *_audio;
112  SciVersion _soundVersion;
113  // If true and an alternative digital sound effect exists, the digital
114  // sound effect is preferred instead
115  bool _useDigitalSFX;
116 
117  void processInitSound(reg_t obj);
118  void processDisposeSound(reg_t obj);
119  void processUpdateCues(reg_t obj);
120  int getSoundResourceId(reg_t obj);
121 
127  bool isUninterruptableSoundPlaying(reg_t obj);
128 };
129 
130 } // End of namespace Sci
131 
132 #endif // SCI_SOUND_SOUNDCMD_H
Definition: state.h:100
SciVersion
Definition: detection.h:133
MusicType
Definition: mididrv.h:44
Definition: music.h:176
Definition: kernel.h:157
Definition: serializer.h:79
Definition: resource.h:327
Resource * testResource(const ResourceId &id) const
Definition: audio.h:55
Definition: console.h:28
Definition: seg_manager.h:48
Definition: music.h:72
Definition: resource.h:161
Definition: soundcmd.h:36
Definition: vm_types.h:39
Definition: console.h:36