ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

mixer.h

Go to the documentation of this file.
00001 /* ScummVM - Graphic Adventure Engine
00002  *
00003  * ScummVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the COPYRIGHT
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #ifndef AUDIO_MIXER_H
00024 #define AUDIO_MIXER_H
00025 
00026 #include "common/types.h"
00027 #include "common/noncopyable.h"
00028 
00029 namespace Audio {
00030 
00031 class AudioStream;
00032 class Channel;
00033 class Timestamp;
00034 
00041 class SoundHandle {
00042     friend class Channel;
00043     friend class MixerImpl;
00044     uint32 _val;
00045 public:
00046     inline SoundHandle() : _val(0xFFFFFFFF) {}
00047 };
00048 
00053 class Mixer : Common::NonCopyable {
00054 public:
00055     enum SoundType {
00056         kPlainSoundType = 0,
00057 
00058         kMusicSoundType = 1,
00059         kSFXSoundType = 2,
00060         kSpeechSoundType = 3
00061     };
00062 
00063     enum {
00064         kMaxChannelVolume = 255,
00065         kMaxMixerVolume = 256
00066     };
00067 
00068 public:
00069     Mixer() {}
00070     virtual ~Mixer() {}
00071 
00072 
00073 
00084     virtual bool isReady() const = 0;
00085 
00086 
00107     virtual void playStream(
00108         SoundType type,
00109         SoundHandle *handle,
00110         AudioStream *stream,
00111         int id = -1,
00112         byte volume = kMaxChannelVolume,
00113         int8 balance = 0,
00114         DisposeAfterUse::Flag autofreeStream = DisposeAfterUse::YES,
00115         bool permanent = false,
00116         bool reverseStereo = false) = 0;
00117 
00121     virtual void stopAll() = 0;
00122 
00128     virtual void stopID(int id) = 0;
00129 
00135     virtual void stopHandle(SoundHandle handle) = 0;
00136 
00137 
00138 
00145     virtual void pauseAll(bool paused) = 0;
00146 
00153     virtual void pauseID(int id, bool paused) = 0;
00154 
00161     virtual void pauseHandle(SoundHandle handle, bool paused) = 0;
00162 
00163 
00164 
00171     virtual bool isSoundIDActive(int id) = 0;
00172 
00179     virtual int getSoundID(SoundHandle handle) = 0;
00180 
00187     virtual bool isSoundHandleActive(SoundHandle handle) = 0;
00188 
00189 
00196     virtual void muteSoundType(SoundType type, bool mute) = 0;
00197 
00203     virtual bool isSoundTypeMuted(SoundType type) const = 0;
00204 
00211     virtual void setChannelVolume(SoundHandle handle, byte volume) = 0;
00212 
00219     virtual byte getChannelVolume(SoundHandle handle) = 0;
00220 
00228     virtual void setChannelBalance(SoundHandle handle, int8 balance) = 0;
00229 
00236     virtual int8 getChannelBalance(SoundHandle handle) = 0;
00237 
00241     virtual uint32 getSoundElapsedTime(SoundHandle handle) = 0;
00242 
00246     virtual Timestamp getElapsedTime(SoundHandle handle) = 0;
00247 
00256     virtual bool hasActiveChannelOfType(SoundType type) = 0;
00257 
00264     virtual void setVolumeForSoundType(SoundType type, int volume) = 0;
00265 
00272     virtual int getVolumeForSoundType(SoundType type) const = 0;
00273 
00279     virtual uint getOutputRate() const = 0;
00280 };
00281 
00282 
00283 } // End of namespace Audio
00284 
00285 #endif


Generated on Sat Feb 16 2019 05:00:58 for ResidualVM by doxygen 1.7.1
curved edge   curved edge