ScummVM API documentation
sound.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 MM_SHARED_XEEN_SOUND_H
23 #define MM_SHARED_XEEN_SOUND_H
24 
25 #include "audio/mididrv.h"
26 #include "audio/mixer.h"
27 #include "audio/audiostream.h"
28 #include "mm/shared/xeen/file.h"
29 #include "mm/shared/xeen/sound_driver.h"
30 
31 namespace MM {
32 namespace Shared {
33 namespace Xeen {
34 
35 class Sound {
36 private:
37  SoundDriver *_SoundDriver;
38  const byte *_effectsData;
39  Common::Array<uint16> _effectsOffsets;
40  Common::Array<uint16> _patchesOffsetsMT32;
41  const byte *_songData;
42  Audio::Mixer *_mixer;
43  Audio::SoundHandle _soundHandle;
44  byte _musicPercent;
45  int _musicVolume, _sfxVolume;
46 private:
50  void loadEffectsData();
51 
55  void update();
56 
60  void updateVolume();
61 public:
62  bool _fxOn;
63  bool _musicOn;
64  Common::Path _currentMusic;
65  int _musicSide;
66  bool _subtitles;
67  MusicType musicType;
68 public:
69  Sound(Audio::Mixer *mixer);
70  virtual ~Sound();
71 
75  void playFX(uint effectId);
76 
80  void stopFX(bool force = false);
81 
85  int songCommand(uint commandId, byte musicVolume = 0, byte sfxVolume = 0);
86 
90  void stopSong() {
91  songCommand(STOP_SONG);
92  }
93 
97  void setMusicPercent(byte percent);
98 
102  void playSong(Common::SeekableReadStream &stream);
103 
107  void playSong(const Common::Path &name, int param = 0);
108 
112  bool isMusicPlaying() const;
113 
117  void setMusicOn(bool isOn);
118 
122  void setFxOn(bool isOn);
123 
127  void updateSoundSettings();
128 
132  void stopAllAudio();
133 
137  void playSound(Common::SeekableReadStream &s, int unused = 0);
138 
142  void playSound(const Common::Path &name, int unused = 0);
143 #ifdef ENABLE_XEEN
144 
147  void playSound(const Common::Path &name, int ccNum, int unused);
148 #endif
149 
153  void stopSound();
154 
159  bool isSoundPlaying() const;
160 
164 #ifdef ENABLE_XEEN
165  void playVoice(const Common::Path &name, int ccMode = -1);
166 #else
167  void playVoice(const Common::Path &name);
168 #endif
169 };
170 
171 } // namespace Xeen
172 } // namespace Shared
173 } // namespace MM
174 
175 #endif
void setMusicPercent(byte percent)
void stopSong()
Definition: sound.h:90
bool isSoundPlaying() const
MusicType
Definition: mididrv.h:44
void playSong(Common::SeekableReadStream &stream)
Definition: path.h:52
int songCommand(uint commandId, byte musicVolume=0, byte sfxVolume=0)
Definition: stream.h:745
Definition: mixer.h:49
void playFX(uint effectId)
Definition: mixer.h:59
void setMusicOn(bool isOn)
Definition: detection.h:27
void playVoice(const Common::Path &name)
void playSound(Common::SeekableReadStream &s, int unused=0)
Definition: sound_driver.h:56
void stopFX(bool force=false)
Definition: sound.h:35
bool isMusicPlaying() const
void setFxOn(bool isOn)