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 SNATCHER_SOUND_H
23#define SNATCHER_SOUND_H
24
25#include "common/platform.h"
26#include "snatcher/saveflags.h"
27
28namespace Audio {
29class Mixer;
30} // namespace Audio
31
32namespace Common {
33class SeekableReadStream;
34class SeekableWriteStream;
35} // namespace Common
36
37namespace Snatcher {
38
39class SoundDevice;
40class FIO;
41
43public:
44 SoundEngine(FIO *fio, Common::Platform platform, int soundOptions);
46
47 bool init(Audio::Mixer *mixer);
48
49 void cdaPlay(int track);
50 void cdaStop();
51 bool cdaIsPlaying() const;
52 uint32 cdaGetTime() const;
53 void cdaRestore();
54
55 struct FMStatus {
56 FMStatus() : music(0), sfx(0), sync(0), blocked(0), reduceVol2(0) {}
57 uint8 music;
58 uint8 sfx;
59 uint8 sync;
60 uint8 blocked;
61 uint8 reduceVol2;
62 };
63
64 void fmSendCommand(int cmd, int restoreVolume, int trackType = 0);
65 const FMStatus &fmGetStatus() const;
66 void fmBlock(int block) { _fmStatus.blocked = block; }
67
68 struct PCMStatus {
69 PCMStatus() : statusBits(0), blocked(0), resourceId(-1), resourceId2(-1) {}
70 uint8 statusBits;
71 uint8 blocked;
72 int16 resourceId;
73 int16 resourceId2;
74 };
75
76 void pcmSendCommand(int cmd, int arg);
77 void pcmInitSound(int sndId);
78 const PCMStatus &pcmGetStatus() const;
79 void pcmBlock(int block) { _pcmStatus.blocked = block; }
80
81 void pause(bool toggle);
82 void update();
83
84 void reduceVolume2(bool enable);
85
86 void setMusicVolume(int vol);
87 void setSoundEffectVolume(int vol);
88
89 void loadState(Common::SeekableReadStream *in, SaveFlags flags);
90 void saveState(Common::SeekableWriteStream *out, SaveFlags flags);
91
92private:
93 FMStatus _fmStatus;
94 PCMStatus _pcmStatus;
95 SoundDevice *_dev;
96
97 int16 _cdaRestoreTrack;
98 uint32 _cdaRestoreTime;
99};
100
101} // End of namespace Snatcher
102
103#endif // SNATCHER_SOUND_H
Definition: mixer.h:70
Definition: stream.h:745
Definition: stream.h:351
Definition: resource.h:121
Definition: sound_device.h:36
Definition: sound.h:42
Platform
Definition: platform.h:93
Definition: system.h:39
Definition: algorithm.h:29
Definition: sound.h:55
Definition: sound.h:68