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

mixer_intern.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_INTERN_H
00024 #define AUDIO_MIXER_INTERN_H
00025 
00026 #include "common/scummsys.h"
00027 #include "common/mutex.h"
00028 #include "audio/mixer.h"
00029 
00030 namespace Audio {
00031 
00051 class MixerImpl : public Mixer {
00052 private:
00053     enum {
00054         NUM_CHANNELS = 32 // ResidualVM specific
00055     };
00056 
00057     Common::Mutex _mutex;
00058 
00059     const uint _sampleRate;
00060     bool _mixerReady;
00061     uint32 _handleSeed;
00062 
00063     struct SoundTypeSettings {
00064         SoundTypeSettings() : mute(false), volume(kMaxMixerVolume) {}
00065 
00066         bool mute;
00067         int volume;
00068     };
00069 
00070     SoundTypeSettings _soundTypeSettings[4];
00071     Channel *_channels[NUM_CHANNELS];
00072 
00073 
00074 public:
00075 
00076     MixerImpl(OSystem *system, uint sampleRate);
00077     ~MixerImpl();
00078 
00079     virtual bool isReady() const { return _mixerReady; }
00080 
00081     virtual void playStream(
00082         SoundType type,
00083         SoundHandle *handle,
00084         AudioStream *input,
00085         int id, byte volume, int8 balance,
00086         DisposeAfterUse::Flag autofreeStream,
00087         bool permanent,
00088         bool reverseStereo);
00089 
00090     virtual void stopAll();
00091     virtual void stopID(int id);
00092     virtual void stopHandle(SoundHandle handle);
00093 
00094     virtual void pauseAll(bool paused);
00095     virtual void pauseID(int id, bool paused);
00096     virtual void pauseHandle(SoundHandle handle, bool paused);
00097 
00098     virtual bool isSoundIDActive(int id);
00099     virtual int getSoundID(SoundHandle handle);
00100 
00101     virtual bool isSoundHandleActive(SoundHandle handle);
00102 
00103     virtual void muteSoundType(SoundType type, bool mute);
00104     virtual bool isSoundTypeMuted(SoundType type) const;
00105 
00106     virtual void setChannelVolume(SoundHandle handle, byte volume);
00107     virtual byte getChannelVolume(SoundHandle handle);
00108     virtual void setChannelBalance(SoundHandle handle, int8 balance);
00109     virtual int8 getChannelBalance(SoundHandle handle);
00110 
00111     virtual uint32 getSoundElapsedTime(SoundHandle handle);
00112     virtual Timestamp getElapsedTime(SoundHandle handle);
00113 
00114     virtual bool hasActiveChannelOfType(SoundType type);
00115 
00116     virtual void setVolumeForSoundType(SoundType type, int volume);
00117     virtual int getVolumeForSoundType(SoundType type) const;
00118 
00119     virtual uint getOutputRate() const;
00120 
00121 protected:
00122     void insertChannel(SoundHandle *handle, Channel *chan);
00123 
00124 public:
00134     int mixCallback(byte *samples, uint len);
00135 
00141     void setReady(bool ready);
00142 };
00143 
00144 
00145 } // End of namespace Audio
00146 
00147 #endif


Generated on Sat Jul 20 2019 05:00:43 for ResidualVM by doxygen 1.7.1
curved edge   curved edge