ScummVM API documentation
mixer.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 AUDIO_MIXER_H
23#define AUDIO_MIXER_H
24
25#include "common/mutex.h"
26#include "common/types.h"
27#include "common/noncopyable.h"
28
29namespace Audio {
30
31class AudioStream;
32class Channel;
33class Timestamp;
34
50 friend class Channel;
51 friend class MixerImpl;
52 uint32 _val = 0xffffffff;
53
54public:
58 bool operator==(const SoundHandle &h) const { return _val == h._val; }
59
63 bool operator!=(const SoundHandle &h) const { return _val != h._val; }
64};
65
71public:
73 enum SoundType {
79 };
81 enum {
83 kMaxMixerVolume = 256
84 };
85
86public:
87 Mixer() {}
88 virtual ~Mixer() {}
89
90
91
104 virtual bool isReady() const = 0;
105
109 virtual Common::Mutex &mutex() = 0;
110
130 virtual void playStream(
131 SoundType type,
132 SoundHandle *handle,
133 AudioStream *stream,
134 int id = -1,
135 byte volume = kMaxChannelVolume,
136 int8 balance = 0,
137 DisposeAfterUse::Flag autofreeStream = DisposeAfterUse::YES,
138 bool permanent = false,
139 bool reverseStereo = false) = 0;
140
144 virtual void stopAll() = 0;
145
151 virtual void stopID(int id) = 0;
152
158 virtual void stopHandle(SoundHandle handle) = 0;
159
160
161
168 virtual void pauseAll(bool paused) = 0;
169
176 virtual void pauseID(int id, bool paused) = 0;
177
184 virtual void pauseHandle(SoundHandle handle, bool paused) = 0;
185
186
187
195 virtual bool isSoundIDActive(int id) const = 0;
196
204 virtual int getSoundID(SoundHandle handle) const = 0;
205
213 virtual bool isSoundHandleActive(SoundHandle handle) const = 0;
214
215
222 virtual void muteSoundType(SoundType type, bool mute) = 0;
223
229 virtual bool isSoundTypeMuted(SoundType type) const = 0;
230
237 virtual void setChannelVolume(SoundHandle handle, byte volume) = 0;
238
246 virtual byte getChannelVolume(SoundHandle handle) const = 0;
247
255 virtual void setChannelBalance(SoundHandle handle, int8 balance) = 0;
256
264 virtual int8 getChannelBalance(SoundHandle handle) const = 0;
265
272 virtual void setChannelFaderL(SoundHandle handle, uint8 faderL) = 0;
273
281 virtual uint8 getChannelFaderL(SoundHandle handle) const = 0;
282
289 virtual void setChannelFaderR(SoundHandle handle, uint8 faderR) = 0;
290
298 virtual uint8 getChannelFaderR(SoundHandle handle) const = 0;
299
306 virtual void setChannelRate(SoundHandle handle, uint32 rate) = 0;
307
315 virtual uint32 getChannelRate(SoundHandle handle) const = 0;
316
323 virtual void resetChannelRate(SoundHandle handle) = 0;
324
328 virtual uint32 getSoundElapsedTime(SoundHandle handle) const = 0;
329
333 virtual Timestamp getElapsedTime(SoundHandle handle) const = 0;
334
338 virtual void loopChannel(SoundHandle handle) = 0;
339
350 virtual bool hasActiveChannelOfType(SoundType type) const = 0;
351
358 virtual void setVolumeForSoundType(SoundType type, int volume) = 0;
359
367 virtual int getVolumeForSoundType(SoundType type) const = 0;
368
374 virtual uint getOutputRate() const = 0;
375
381 virtual bool getOutputStereo() const = 0;
382
392 virtual uint getOutputBufSize() const = 0;
393
401 virtual uint getOutputBytesPerSample() const = 0;
402
408 virtual bool getClamping() const = 0;
409};
410
412} // End of namespace Audio
413
414#endif
Definition: audiostream.h:50
Definition: mixer.h:70
virtual void setChannelFaderL(SoundHandle handle, uint8 faderL)=0
virtual uint getOutputBytesPerSample() const =0
virtual void resetChannelRate(SoundHandle handle)=0
virtual uint getOutputRate() const =0
virtual void setChannelFaderR(SoundHandle handle, uint8 faderR)=0
virtual bool isReady() const =0
virtual byte getChannelVolume(SoundHandle handle) const =0
virtual bool hasActiveChannelOfType(SoundType type) const =0
virtual int8 getChannelBalance(SoundHandle handle) const =0
virtual void pauseID(int id, bool paused)=0
virtual void setChannelBalance(SoundHandle handle, int8 balance)=0
virtual bool getOutputStereo() const =0
virtual int getVolumeForSoundType(SoundType type) const =0
virtual void loopChannel(SoundHandle handle)=0
virtual int getSoundID(SoundHandle handle) const =0
virtual void setChannelVolume(SoundHandle handle, byte volume)=0
virtual void muteSoundType(SoundType type, bool mute)=0
virtual void stopHandle(SoundHandle handle)=0
virtual void playStream(SoundType type, SoundHandle *handle, AudioStream *stream, int id=-1, byte volume=kMaxChannelVolume, int8 balance=0, DisposeAfterUse::Flag autofreeStream=DisposeAfterUse::YES, bool permanent=false, bool reverseStereo=false)=0
virtual void stopID(int id)=0
virtual uint32 getSoundElapsedTime(SoundHandle handle) const =0
virtual bool getClamping() const =0
virtual void pauseHandle(SoundHandle handle, bool paused)=0
virtual void stopAll()=0
virtual bool isSoundTypeMuted(SoundType type) const =0
virtual bool isSoundHandleActive(SoundHandle handle) const =0
virtual uint8 getChannelFaderR(SoundHandle handle) const =0
virtual Timestamp getElapsedTime(SoundHandle handle) const =0
@ kMaxChannelVolume
Definition: mixer.h:82
@ kMaxMixerVolume
Definition: mixer.h:83
virtual void pauseAll(bool paused)=0
virtual bool isSoundIDActive(int id) const =0
SoundType
Definition: mixer.h:73
@ kMusicSoundType
Definition: mixer.h:76
@ kSpeechSoundType
Definition: mixer.h:78
@ kSFXSoundType
Definition: mixer.h:77
@ kPlainSoundType
Definition: mixer.h:74
virtual Common::Mutex & mutex()=0
virtual void setVolumeForSoundType(SoundType type, int volume)=0
virtual void setChannelRate(SoundHandle handle, uint32 rate)=0
virtual uint8 getChannelFaderL(SoundHandle handle) const =0
virtual uint32 getChannelRate(SoundHandle handle) const =0
virtual uint getOutputBufSize() const =0
Definition: mixer_intern.h:58
Definition: mixer.h:49
bool operator!=(const SoundHandle &h) const
Definition: mixer.h:63
bool operator==(const SoundHandle &h) const
Definition: mixer.h:58
Definition: timestamp.h:83
Definition: mutex.h:67
Definition: noncopyable.h:39
Definition: system.h:39