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 XEEN_SOUND_H
23 #define XEEN_SOUND_H
24 
25 #include "audio/mixer.h"
26 #include "audio/audiostream.h"
27 #include "xeen/files.h"
28 #include "xeen/sound_driver.h"
29 
30 namespace Xeen {
31 
32 
33 class Sound {
34 private:
35  SoundDriver *_SoundDriver;
36  const byte *_effectsData;
37  Common::Array<uint16> _effectsOffsets;
38  const byte *_songData;
39  Audio::Mixer *_mixer;
40  Audio::SoundHandle _soundHandle;
41  byte _musicPercent;
42  int _musicVolume, _sfxVolume;
43 private:
47  void loadEffectsData();
48 
52  void update();
53 
57  void updateVolume();
58 public:
59  bool _fxOn;
60  bool _musicOn;
61  Common::String _currentMusic;
62  int _musicSide;
63  bool _subtitles;
64 public:
65  Sound(Audio::Mixer *mixer);
66  virtual ~Sound();
67 
71  void playFX(uint effectId);
72 
76  void stopFX();
77 
81  int songCommand(uint commandId, byte musicVolume = 0, byte sfxVolume = 0);
82 
86  void stopSong() { songCommand(STOP_SONG); }
87 
91  void setMusicPercent(byte percent);
92 
97 
101  void playSong(const Common::String &name, int param = 0);
102 
106  bool isMusicPlaying() const;
107 
111  void setMusicOn(bool isOn);
112 
116  void setFxOn(bool isOn);
117 
121  void updateSoundSettings();
122 
126  void stopAllAudio();
127 
131  void playSound(Common::SeekableReadStream &s, int unused = 0);
132 
136  void playSound(const Common::String &name, int unused = 0);
137 
141  void playSound(const Common::String &name, int ccNum, int unused);
142 
147  void stopSound();
148 
153  bool isSoundPlaying() const;
154 
158  void playVoice(const Common::String &name, int ccMode = -1);
159 };
160 
161 } // End of namespace Xeen
162 
163 #endif /* XEEN_SOUND_H */
Definition: sound.h:33
Definition: str.h:59
void playSong(Common::SeekableReadStream &stream)
void stopSong()
Definition: sound.h:86
Definition: stream.h:652
int songCommand(uint commandId, byte musicVolume=0, byte sfxVolume=0)
void updateSoundSettings()
void setMusicPercent(byte percent)
void playSound(Common::SeekableReadStream &s, int unused=0)
bool isSoundPlaying() const
Definition: mixer.h:49
Definition: mixer.h:61
Definition: sound_driver.h:52
void stopAllAudio()
void setFxOn(bool isOn)
void playVoice(const Common::String &name, int ccMode=-1)
void stopSound()
bool isMusicPlaying() const
void stopFX()
void setMusicOn(bool isOn)
void playFX(uint effectId)
Definition: character.h:33