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 syncSoundSettings();
41  void loadVoc(Common::String vocFile, int32 startPos, int16 vocSize);
42  void autoPlayVoc(Common::String vocFile, int32 startPos, int16 vocSize);
43  void playVoc(Common::String vocFile, int32 startPos, uint vocSize);
44  void playVoc();
45  void stopVoc();
46  bool isVocPlaying();
47  void playMidi(Common::String fileName, bool loop);
48  void playMidi(byte *data, int size, bool loop);
49  void toggleMusic();
50  void beep(int32 frequency, int32 ms);
51  void waitForSoundEnd();
52  // Set game logic volume levels
53  void setSfxVolume(byte leftVol, byte rightVol);
54  void setMidiVolume(byte leftVol, byte rightVol);
55  void fadeOutMusic();
56  void fadeInMusic();
57  void setMasterVolume(byte leftVol, byte rightVol);
58  void setSfxBalance(bool left, bool right);
59  // Game logic volume settings
60  uint _rightSfxVol, _leftSfxVol;
61  uint _musicVolRight, _musicVolLeft;
62 
63 private:
64  // Apply game logic volume levels
65  void setSfxVolume(byte volume);
66  void setMusicVolume(byte volume);
67 
68  Audio::SoundHandle _soundHandle;
69  Audio::Mixer *_mixer;
70  MidiPlayer *_midiPlayer;
71  Audio::PCSpeaker *_speaker;
72 
73  Common::SeekableReadStream *_lastSrcStream = nullptr;
74  Audio::SeekableAudioStream *_audioStream = nullptr;
75 };
76 
77 } // End of namespace Tot
78 #endif
Definition: sound.h:34
Definition: str.h:59
Definition: stream.h:745
Definition: audiostream.h:212
Definition: mixer.h:49
Definition: midi.h:30
Definition: mixer.h:70
Definition: anims.h:26
Definition: pcspk.h:34