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 #ifndef TOT_SOUND_H
22 #define TOT_SOUND_H
23 
24 #include "audio/decoders/raw.h"
25 #include "audio/softsynth/pcspk.h"
26 #include "audio/mixer.h"
27 #include "common/file.h"
28 
29 #include "tot/midi.h"
30 
31 namespace Tot {
32 const int kSfxId = 1;
33 
34 class SoundManager {
35 public:
36  SoundManager(Audio::Mixer *mixer);
37  ~SoundManager();
38 
39  void init();
40  void loadVoc(Common::String vocFile, int32 startPos, int16 vocSize);
41  void autoPlayVoc(Common::String vocFile, int32 startPos, int16 vocSize);
42  void playVoc(Common::String vocFile, int32 startPos, uint vocSize);
43  void playVoc();
44  void stopVoc();
45  bool isVocPlaying();
46  void playMidi(Common::String fileName, bool loop);
47  void playMidi(byte *data, int size, bool loop);
48  void toggleMusic();
49  void beep(int32 frequency, int32 ms);
50  void waitForSoundEnd();
51  void setSfxVolume(byte leftVol, byte rightVol);
52  void setMidiVolume(byte leftVol, byte rightVol);
53  void fadeOutMusic();
54  void fadeInMusic();
55  void setMasterVolume(byte leftVol, byte rightVol);
56  void setSfxBalance(bool left, bool right);
57  uint _rightSfxVol, _leftSfxVol;
58  uint _musicVolRight, _musicVolLeft;
59 
60 private:
61  void setSfxVolume(byte volume);
62  void setMusicVolume(byte volume);
63 
64  Audio::SoundHandle _soundHandle;
65  Audio::Mixer *_mixer;
66  MidiPlayer *_midiPlayer;
67  Audio::PCSpeaker *_speaker;
68 
69  Common::SeekableReadStream *_lastSrcStream = nullptr;
70  Audio::SeekableAudioStream *_audioStream = nullptr;
71 };
72 
73 } // End of namespace Tot
74 #endif
Definition: sound.h:34
Definition: str.h:59
Definition: stream.h:745
Definition: audiostream.h:212
Definition: mixer.h:49
Definition: midi.h:44
Definition: mixer.h:70
Definition: anims.h:26
Definition: pcspk.h:34