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 SHERLOCK_SOUND_H
23#define SHERLOCK_SOUND_H
24
25#include "common/scummsys.h"
26#include "common/str.h"
27#include "audio/mixer.h"
28#include "access/files.h"
29
30namespace Sherlock {
31
32class SherlockEngine;
33
34enum WaitType {
35 WAIT_RETURN_IMMEDIATELY = 0, WAIT_FINISH = 1, WAIT_KBD_OR_FINISH = 2
36};
37
38#define MAX_MIXER_CHANNELS 10
39
40class Sound {
41private:
42 SherlockEngine *_vm;
43 Audio::Mixer *_mixer;
44 Audio::SoundHandle _scalpelEffectsHandle;
45 Audio::SoundHandle _aiffHandle;
46 Audio::SoundHandle _tattooEffectsHandle[MAX_MIXER_CHANNELS];
47 Audio::SoundHandle _speechHandle;
48 int _curPriority;
49
53 byte decodeSample(byte sample, byte& reference, int16& scale);
54
58 bool playSoundResource(const Common::Path &name, const Common::Path &libFilename,
60
64 Common::Path formFilename(const Common::Path &name);
65public:
66 bool _digitized;
67 int _voices;
68 bool _soundOn;
69 bool _speechOn;
70 bool _soundPlaying;
71 bool _speechPlaying;
72 int _soundVolume;
73
74 Common::String _talkSoundFile;
75public:
77
82
86 void loadSound(const Common::Path &name, int priority);
87
91 bool playSound(const Common::Path &name, WaitType waitType, int priority = 100, const Common::Path &libraryFilename = Common::Path());
92
96 void playAiff(const Common::Path &name, int volume = Audio::Mixer::kMaxChannelVolume, bool loop = false);
97
101 void stopAiff();
102
106 void playLoadedSound(int bufNum, WaitType waitType);
107
112
116 void stopSound();
117
118 void freeDigiSound();
119
124
128 void setVolume(int volume);
129
133 void playSpeech(const Common::Path &name);
134
139
144};
145
146} // End of namespace Sherlock
147
148#endif
149
Definition: mixer.h:70
@ kMaxChannelVolume
Definition: mixer.h:82
SoundType
Definition: mixer.h:73
Definition: mixer.h:49
Definition: path.h:52
Definition: str.h:59
Definition: sherlock.h:206
Definition: sound.h:40
void freeLoadedSounds()
void playLoadedSound(int bufNum, WaitType waitType)
bool isSpeechPlaying()
Audio::SoundHandle & getFreeSoundHandle()
void playAiff(const Common::Path &name, int volume=Audio::Mixer::kMaxChannelVolume, bool loop=false)
bool playSound(const Common::Path &name, WaitType waitType, int priority=100, const Common::Path &libraryFilename=Common::Path())
void syncSoundSettings()
void setVolume(int volume)
void loadSound(const Common::Path &name, int priority)
void playSpeech(const Common::Path &name)