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  _currentMusic.clear();
92  songCommand(STOP_SONG);
93  }
94 
98  void setMusicPercent(byte percent);
99 
103  void playSong(Common::SeekableReadStream &stream);
104 
108  void playSong(const Common::Path &name, int param = 0);
109 
113  bool isMusicPlaying() const;
114 
118  void setMusicOn(bool isOn);
119 
123  void setFxOn(bool isOn);
124 
128  void updateSoundSettings();
129 
133  void stopAllAudio();
134 
138  void playSound(Common::SeekableReadStream &s, int unused = 0);
139 
143  void playSound(const Common::Path &name, int unused = 0);
144 #ifdef ENABLE_XEEN
145 
148  void playSound(const Common::Path &name, int ccNum, int unused);
149 #endif
150 
154  void stopSound();
155 
160  bool isSoundPlaying() const;
161 
165 #ifdef ENABLE_XEEN
166  void playVoice(const Common::Path &name, int ccMode = -1);
167 #else
168  void playVoice(const Common::Path &name);
169 #endif
170 };
171 
172 } // namespace Xeen
173 } // namespace Shared
174 } // namespace MM
175 
176 #endif
void setMusicPercent(byte percent)
void stopSong()
Definition: sound.h:90
bool isSoundPlaying() const
void clear()
Definition: path.h:279
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:70
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)