ScummVM API documentation
sound_device.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_DEVICE_H
23#define SNATCHER_SOUND_DEVICE_H
24
25#include "common/platform.h"
26
27namespace Audio {
28class Mixer;
29}
30
31namespace Snatcher {
32
33class FIO;
34
36public:
37 virtual ~SoundDevice() {}
38
39 enum InitResult : int {
40 kDeviceOk = 0,
41 kDriverInitFailed = 1,
42 kAudioCDInitFailed = 2,
43 kLoadDataFailed = 3
44 };
45
46 virtual InitResult init(Audio::Mixer *mixer) = 0;
47
48 virtual bool cdaPlay(int track, uint32 bcdTime = 0) = 0;
49 virtual void cdaStop() = 0;
50 virtual bool cdaIsPlaying() const = 0;
51 virtual int cdaGetCurTrack() const = 0;
52 virtual uint32 cdaGetTime() const = 0;
53
54 virtual void fmSendCommand(int cmd, int arg) = 0;
55 virtual uint8 fmGetStatus() const = 0;
56
57 virtual void pcmSendCommand(int cmd, int arg) = 0;
58 virtual void pcmInitSound(int sndId) = 0;
59 virtual uint8 pcmGetStatus() const = 0;
60 virtual int16 pcmGetResourceId() const = 0;
61
62 virtual void pause(bool toggle) = 0;
63 virtual void update() = 0;
64
65 virtual void reduceVolume2(bool enable) = 0;
66
67 virtual void setMusicVolume(int vol) = 0;
68 virtual void setSoundEffectVolume(int vol) = 0;
69
70protected:
71 SoundDevice() : _musicStartTime(0) {}
72
73 uint32 _musicStartTime;
74
75private:
76 static SoundDevice *createSegaSoundDevice(FIO *fio);
77
78public:
79 static SoundDevice *create(FIO *fio, Common::Platform platform, int soundOptions);
80};
81
82} // End of namespace Snatcher
83
84#endif // SNATCHER_SOUND_DEVICE_H
Definition: mixer.h:70
Definition: resource.h:121
Definition: sound_device.h:35
Platform
Definition: platform.h:93
Definition: system.h:39