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  bool isDigitalSamplePlaying() const;
85 
86  reg_t kDoSoundInit(EngineState *s, int argc, reg_t *argv);
87  reg_t kDoSoundPlay(EngineState *s, int argc, reg_t *argv);
88  reg_t kDoSoundMute(EngineState *s, int argc, reg_t *argv);
89  reg_t kDoSoundPause(EngineState *s, int argc, reg_t *argv);
90  reg_t kDoSoundResumeAfterRestore(EngineState *s, int argc, reg_t *argv);
91  reg_t kDoSoundStop(EngineState *s, int argc, reg_t *argv);
92  reg_t kDoSoundStopAll(EngineState *s, int argc, reg_t *argv);
93  reg_t kDoSoundDispose(EngineState *s, int argc, reg_t *argv);
94  reg_t kDoSoundMasterVolume(EngineState *s, int argc, reg_t *argv);
95  reg_t kDoSoundFade(EngineState *s, int argc, reg_t *argv);
96  reg_t kDoSoundGetPolyphony(EngineState *s, int argc, reg_t *argv);
97  reg_t kDoSoundUpdate(EngineState *s, int argc, reg_t *argv);
98  reg_t kDoSoundUpdateCues(EngineState *s, int argc, reg_t *argv);
99  reg_t kDoSoundSendMidi(EngineState *s, int argc, reg_t *argv);
100  reg_t kDoSoundGlobalReverb(EngineState *s, int argc, reg_t *argv);
101  reg_t kDoSoundSetHold(EngineState *s, int argc, reg_t *argv);
102  reg_t kDoSoundGetAudioCapability(EngineState *s, int argc, reg_t *argv);
103  reg_t kDoSoundSetVolume(EngineState *s, int argc, reg_t *argv);
104  reg_t kDoSoundSetPriority(EngineState *s, int argc, reg_t *argv);
105  reg_t kDoSoundSetLoop(EngineState *s, int argc, reg_t *argv);
106  reg_t kDoSoundSuspend(EngineState *s, int argc, reg_t *argv);
107 
108 private:
109  ResourceManager *_resMan;
110  SegManager *_segMan;
111  Kernel *_kernel;
112  SciMusic *_music;
113  AudioPlayer *_audio;
114  SciVersion _soundVersion;
115  // If true and an alternative digital sound effect exists, the digital
116  // sound effect is preferred instead
117  bool _useDigitalSFX;
118 
119  void processInitSound(reg_t obj);
120  void processDisposeSound(reg_t obj);
121  void processUpdateCues(reg_t obj);
122  uint16 getSoundResourceId(reg_t obj);
123 
129  bool isUninterruptableSoundPlaying(reg_t obj);
130 };
131 
132 } // End of namespace Sci
133 
134 #endif // SCI_SOUND_SOUNDCMD_H
Definition: state.h:100
SciVersion
Definition: detection.h:134
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