aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorMax Horn2005-05-10 23:48:48 +0000
committerMax Horn2005-05-10 23:48:48 +0000
commit1a615346abab8f234c3dbd1c55e78b179bca9d87 (patch)
treef687ac73ffbfa29088a403b6311bb4db13265fde /sound
parent72f4c03b0b9a6918a359b967ebc400a2701981d9 (diff)
downloadscummvm-rg350-1a615346abab8f234c3dbd1c55e78b179bca9d87.tar.gz
scummvm-rg350-1a615346abab8f234c3dbd1c55e78b179bca9d87.tar.bz2
scummvm-rg350-1a615346abab8f234c3dbd1c55e78b179bca9d87.zip
Moved class SoundMixer to Audio::Mixer (didn't call the namespace 'Sound' because we already have many classes with that name)
svn-id: r18039
Diffstat (limited to 'sound')
-rw-r--r--sound/audiocd.h2
-rw-r--r--sound/audiostream.cpp10
-rw-r--r--sound/flac.cpp6
-rw-r--r--sound/mididrv.h12
-rw-r--r--sound/mixer.cpp95
-rw-r--r--sound/mixer.h19
-rw-r--r--sound/mp3.cpp6
-rw-r--r--sound/rate.cpp8
-rw-r--r--sound/softsynth/adlib.cpp6
-rw-r--r--sound/softsynth/emumidi.h4
-rw-r--r--sound/softsynth/fluidsynth.cpp8
-rw-r--r--sound/softsynth/mt32.cpp14
-rw-r--r--sound/softsynth/ym2612.cpp6
-rw-r--r--sound/voc.cpp2
-rw-r--r--sound/vorbis.cpp6
-rw-r--r--sound/wave.cpp10
16 files changed, 114 insertions, 100 deletions
diff --git a/sound/audiocd.h b/sound/audiocd.h
index 72bb3be389..9a2ffc4810 100644
--- a/sound/audiocd.h
+++ b/sound/audiocd.h
@@ -30,7 +30,7 @@
class DigitalTrackInfo {
public:
virtual bool error() = 0;
- virtual void play(SoundMixer *mixer, SoundHandle *handle, int startFrame, int duration) = 0;
+ virtual void play(Audio::Mixer *mixer, SoundHandle *handle, int startFrame, int duration) = 0;
virtual ~DigitalTrackInfo() { }
};
diff --git a/sound/audiostream.cpp b/sound/audiostream.cpp
index 2194267708..c9bd43e51c 100644
--- a/sound/audiostream.cpp
+++ b/sound/audiostream.cpp
@@ -186,11 +186,11 @@ int LinearMemoryStream<stereo, is16Bit, isUnsigned, isLE>::readBuffer(int16 *buf
return new LinearMemoryStream<STEREO, false, UNSIGNED, false>(rate, ptr, len, loopOffset, loopLen, autoFree)
AudioStream *makeLinearInputStream(int rate, byte flags, const byte *ptr, uint32 len, uint loopOffset, uint loopLen) {
- const bool isStereo = (flags & SoundMixer::FLAG_STEREO) != 0;
- const bool is16Bit = (flags & SoundMixer::FLAG_16BITS) != 0;
- const bool isUnsigned = (flags & SoundMixer::FLAG_UNSIGNED) != 0;
- const bool isLE = (flags & SoundMixer::FLAG_LITTLE_ENDIAN) != 0;
- const bool autoFree = (flags & SoundMixer::FLAG_AUTOFREE) != 0;
+ const bool isStereo = (flags & Audio::Mixer::FLAG_STEREO) != 0;
+ const bool is16Bit = (flags & Audio::Mixer::FLAG_16BITS) != 0;
+ const bool isUnsigned = (flags & Audio::Mixer::FLAG_UNSIGNED) != 0;
+ const bool isLE = (flags & Audio::Mixer::FLAG_LITTLE_ENDIAN) != 0;
+ const bool autoFree = (flags & Audio::Mixer::FLAG_AUTOFREE) != 0;
if (isStereo) {
if (isUnsigned) {
diff --git a/sound/flac.cpp b/sound/flac.cpp
index 412f4c8651..d0d6403252 100644
--- a/sound/flac.cpp
+++ b/sound/flac.cpp
@@ -750,7 +750,7 @@ public:
FlacTrackInfo(File *file);
~FlacTrackInfo();
bool error() { return _file == NULL; }
- void play(SoundMixer *mixer, SoundHandle *handle, int startFrame, int duration);
+ void play(Audio::Mixer *mixer, SoundHandle *handle, int startFrame, int duration);
};
FlacTrackInfo::FlacTrackInfo(File *file) : _file(NULL), _firstStream(NULL)
@@ -764,7 +764,7 @@ FlacTrackInfo::FlacTrackInfo(File *file) : _file(NULL), _firstStream(NULL)
delete tempStream;
}
-void FlacTrackInfo::play(SoundMixer *mixer, SoundHandle *handle, int startFrame, int duration) {
+void FlacTrackInfo::play(Audio::Mixer *mixer, SoundHandle *handle, int startFrame, int duration) {
if (error()) {
debug(1, "FlacTrackInfo::play: invalid state, method should not been called");
}
@@ -787,7 +787,7 @@ void FlacTrackInfo::play(SoundMixer *mixer, SoundHandle *handle, int startFrame,
flac->setLastSample(0);
if (flac->seekAbsolute(static_cast<FLAC__uint64>(startFrame) * (info.sample_rate / 75))) {
- mixer->playInputStream(SoundMixer::kMusicSoundType, handle, flac);
+ mixer->playInputStream(Audio::Mixer::kMusicSoundType, handle, flac);
return;
}
// startSample is beyond the existing Samples
diff --git a/sound/mididrv.h b/sound/mididrv.h
index 98b29747d2..7575916780 100644
--- a/sound/mididrv.h
+++ b/sound/mididrv.h
@@ -27,7 +27,9 @@
#include "common/timer.h"
class MidiChannel;
-class SoundMixer;
+namespace Audio {
+ class Mixer;
+}
namespace Common { class String; }
/** MIDI Driver Types */
@@ -190,19 +192,19 @@ public:
// Factory functions, for faster compile
extern MidiDriver *MidiDriver_NULL_create();
-extern MidiDriver *MidiDriver_ADLIB_create(SoundMixer *mixer);
+extern MidiDriver *MidiDriver_ADLIB_create(Audio::Mixer *mixer);
extern MidiDriver *MidiDriver_WIN_create();
extern MidiDriver *MidiDriver_SEQ_create();
extern MidiDriver *MidiDriver_QT_create();
extern MidiDriver *MidiDriver_CORE_create();
extern MidiDriver *MidiDriver_ETUDE_create();
extern MidiDriver *MidiDriver_ALSA_create();
-extern MidiDriver *MidiDriver_YM2612_create(SoundMixer *mixer);
+extern MidiDriver *MidiDriver_YM2612_create(Audio::Mixer *mixer);
#ifdef USE_FLUIDSYNTH
-extern MidiDriver *MidiDriver_FluidSynth_create(SoundMixer *mixer);
+extern MidiDriver *MidiDriver_FluidSynth_create(Audio::Mixer *mixer);
#endif
#ifdef USE_MT32EMU
-extern MidiDriver *MidiDriver_MT32_create(SoundMixer *mixer);
+extern MidiDriver *MidiDriver_MT32_create(Audio::Mixer *mixer);
#endif
extern MidiDriver *MidiDriver_YamahaPa1_create();
extern MidiDriver *MidiDriver_Zodiac_create();
diff --git a/sound/mixer.cpp b/sound/mixer.cpp
index 18b55746cf..b2d46322fa 100644
--- a/sound/mixer.cpp
+++ b/sound/mixer.cpp
@@ -34,6 +34,8 @@
#include "sound/vorbis.h"
+namespace Audio {
+
#pragma mark -
#pragma mark --- Channel classes ---
#pragma mark -
@@ -44,10 +46,10 @@
*/
class Channel {
public:
- const SoundMixer::SoundType _type;
+ const Mixer::SoundType _type;
SoundHandle _handle;
private:
- SoundMixer *_mixer;
+ Mixer *_mixer;
bool _autofreeStream;
bool _permanent;
byte _volume;
@@ -64,8 +66,8 @@ protected:
public:
- Channel(SoundMixer *mixer, SoundMixer::SoundType type, int id = -1);
- Channel(SoundMixer *mixer, SoundMixer::SoundType type, AudioStream *input, bool autofreeStream, bool reverseStereo = false, int id = -1, bool permanent = false);
+ Channel(Mixer *mixer, Mixer::SoundType type, int id = -1);
+ Channel(Mixer *mixer, Mixer::SoundType type, AudioStream *input, bool autofreeStream, bool reverseStereo = false, int id = -1, bool permanent = false);
virtual ~Channel();
void mix(int16 *data, uint len);
@@ -96,11 +98,11 @@ public:
#pragma mark -
-#pragma mark --- SoundMixer ---
+#pragma mark --- Mixer ---
#pragma mark -
-SoundMixer::SoundMixer() {
+Mixer::Mixer() {
_syst = &OSystem::instance();
_handleSeed = 0;
@@ -125,7 +127,7 @@ SoundMixer::SoundMixer() {
debug(1, "Output sample rate: %d Hz", _outputRate);
}
-SoundMixer::~SoundMixer() {
+Mixer::~Mixer() {
_syst->clearSoundCallback();
stopAll(true);
@@ -133,11 +135,11 @@ SoundMixer::~SoundMixer() {
_premixChannel = 0;
}
-bool SoundMixer::isPaused() {
+bool Mixer::isPaused() {
return _paused;
}
-void SoundMixer::setupPremix(AudioStream *stream, SoundType type) {
+void Mixer::setupPremix(AudioStream *stream, SoundType type) {
Common::StackLock lock(_mutex);
delete _premixChannel;
@@ -150,7 +152,7 @@ void SoundMixer::setupPremix(AudioStream *stream, SoundType type) {
_premixChannel = new Channel(this, type, stream, false);
}
-void SoundMixer::insertChannel(SoundHandle *handle, Channel *chan) {
+void Mixer::insertChannel(SoundHandle *handle, Channel *chan) {
int index = -1;
for (int i = 0; i != NUM_CHANNELS; i++) {
@@ -160,7 +162,7 @@ void SoundMixer::insertChannel(SoundHandle *handle, Channel *chan) {
}
}
if (index == -1) {
- warning("SoundMixer::out of mixer slots");
+ warning("Mixer::out of mixer slots");
delete chan;
return;
}
@@ -173,7 +175,7 @@ void SoundMixer::insertChannel(SoundHandle *handle, Channel *chan) {
}
}
-void SoundMixer::playRaw(SoundHandle *handle, void *sound, uint32 size, uint rate, byte flags,
+void Mixer::playRaw(SoundHandle *handle, void *sound, uint32 size, uint rate, byte flags,
int id, byte volume, int8 balance, uint32 loopStart, uint32 loopEnd, SoundType type) {
Common::StackLock lock(_mutex);
@@ -181,7 +183,7 @@ void SoundMixer::playRaw(SoundHandle *handle, void *sound, uint32 size, uint rat
if (id != -1) {
for (int i = 0; i != NUM_CHANNELS; i++)
if (_channels[i] != 0 && _channels[i]->getId() == id) {
- if ((flags & SoundMixer::FLAG_AUTOFREE) != 0)
+ if ((flags & Mixer::FLAG_AUTOFREE) != 0)
free(sound);
return;
}
@@ -189,7 +191,7 @@ void SoundMixer::playRaw(SoundHandle *handle, void *sound, uint32 size, uint rat
// Create the input stream
AudioStream *input;
- if (flags & SoundMixer::FLAG_LOOP) {
+ if (flags & Mixer::FLAG_LOOP) {
if (loopEnd == 0) {
input = makeLinearInputStream(rate, flags, (byte *)sound, size, 0, size);
} else {
@@ -201,13 +203,13 @@ void SoundMixer::playRaw(SoundHandle *handle, void *sound, uint32 size, uint rat
}
// Create the channel
- Channel *chan = new Channel(this, type, input, true, (flags & SoundMixer::FLAG_REVERSE_STEREO) != 0, id);
+ Channel *chan = new Channel(this, type, input, true, (flags & Mixer::FLAG_REVERSE_STEREO) != 0, id);
chan->setVolume(volume);
chan->setBalance(balance);
insertChannel(handle, chan);
}
-void SoundMixer::playInputStream(SoundType type, SoundHandle *handle, AudioStream *input,
+void Mixer::playInputStream(SoundType type, SoundHandle *handle, AudioStream *input,
int id, byte volume, int8 balance, bool autofreeStream, bool permanent) {
Common::StackLock lock(_mutex);
@@ -233,7 +235,7 @@ void SoundMixer::playInputStream(SoundType type, SoundHandle *handle, AudioStrea
insertChannel(handle, chan);
}
-void SoundMixer::mix(int16 *buf, uint len) {
+void Mixer::mix(int16 *buf, uint len) {
Common::StackLock lock(_mutex);
// zero the buf
@@ -255,15 +257,15 @@ void SoundMixer::mix(int16 *buf, uint len) {
}
}
-void SoundMixer::mixCallback(void *s, byte *samples, int len) {
+void Mixer::mixCallback(void *s, byte *samples, int len) {
assert(s);
assert(samples);
// Len is the number of bytes in the buffer; we divide it by
// four to get the number of samples (stereo 16 bit).
- ((SoundMixer *)s)->mix((int16 *)samples, len >> 2);
+ ((Mixer *)s)->mix((int16 *)samples, len >> 2);
}
-void SoundMixer::stopAll(bool force) {
+void Mixer::stopAll(bool force) {
Common::StackLock lock(_mutex);
for (int i = 0; i != NUM_CHANNELS; i++)
if (_channels[i] != 0) {
@@ -274,7 +276,7 @@ void SoundMixer::stopAll(bool force) {
}
}
-void SoundMixer::stopID(int id) {
+void Mixer::stopID(int id) {
Common::StackLock lock(_mutex);
for (int i = 0; i != NUM_CHANNELS; i++) {
if (_channels[i] != 0 && _channels[i]->getId() == id) {
@@ -284,7 +286,7 @@ void SoundMixer::stopID(int id) {
}
}
-void SoundMixer::stopHandle(SoundHandle handle) {
+void Mixer::stopHandle(SoundHandle handle) {
Common::StackLock lock(_mutex);
// Simply ignore stop requests for handles of sounds that already terminated
@@ -296,7 +298,7 @@ void SoundMixer::stopHandle(SoundHandle handle) {
_channels[index] = 0;
}
-void SoundMixer::setChannelVolume(SoundHandle handle, byte volume) {
+void Mixer::setChannelVolume(SoundHandle handle, byte volume) {
Common::StackLock lock(_mutex);
const int index = handle._val % NUM_CHANNELS;
@@ -306,7 +308,7 @@ void SoundMixer::setChannelVolume(SoundHandle handle, byte volume) {
_channels[index]->setVolume(volume);
}
-void SoundMixer::setChannelBalance(SoundHandle handle, int8 balance) {
+void Mixer::setChannelBalance(SoundHandle handle, int8 balance) {
Common::StackLock lock(_mutex);
const int index = handle._val % NUM_CHANNELS;
@@ -316,7 +318,7 @@ void SoundMixer::setChannelBalance(SoundHandle handle, int8 balance) {
_channels[index]->setBalance(balance);
}
-uint32 SoundMixer::getSoundElapsedTimeOfSoundID(int id) {
+uint32 Mixer::getSoundElapsedTimeOfSoundID(int id) {
Common::StackLock lock(_mutex);
for (int i = 0; i != NUM_CHANNELS; i++)
if (_channels[i] && _channels[i]->getId() == id)
@@ -324,7 +326,7 @@ uint32 SoundMixer::getSoundElapsedTimeOfSoundID(int id) {
return 0;
}
-uint32 SoundMixer::getSoundElapsedTime(SoundHandle handle) {
+uint32 Mixer::getSoundElapsedTime(SoundHandle handle) {
Common::StackLock lock(_mutex);
const int index = handle._val % NUM_CHANNELS;
@@ -334,11 +336,11 @@ uint32 SoundMixer::getSoundElapsedTime(SoundHandle handle) {
return _channels[index]->getElapsedTime();
}
-void SoundMixer::pauseAll(bool paused) {
+void Mixer::pauseAll(bool paused) {
_paused = paused;
}
-void SoundMixer::pauseID(int id, bool paused) {
+void Mixer::pauseID(int id, bool paused) {
Common::StackLock lock(_mutex);
for (int i = 0; i != NUM_CHANNELS; i++) {
if (_channels[i] != 0 && _channels[i]->getId() == id) {
@@ -348,7 +350,7 @@ void SoundMixer::pauseID(int id, bool paused) {
}
}
-void SoundMixer::pauseHandle(SoundHandle handle, bool paused) {
+void Mixer::pauseHandle(SoundHandle handle, bool paused) {
Common::StackLock lock(_mutex);
// Simply ignore pause/unpause requests for handles of sound that alreayd terminated
@@ -359,7 +361,7 @@ void SoundMixer::pauseHandle(SoundHandle handle, bool paused) {
_channels[index]->pause(paused);
}
-bool SoundMixer::isSoundIDActive(int id) {
+bool Mixer::isSoundIDActive(int id) {
Common::StackLock lock(_mutex);
for (int i = 0; i != NUM_CHANNELS; i++)
if (_channels[i] && _channels[i]->getId() == id)
@@ -367,7 +369,7 @@ bool SoundMixer::isSoundIDActive(int id) {
return false;
}
-int SoundMixer::getSoundID(SoundHandle handle) {
+int Mixer::getSoundID(SoundHandle handle) {
Common::StackLock lock(_mutex);
const int index = handle._val % NUM_CHANNELS;
if (_channels[index] && _channels[index]->_handle._val == handle._val)
@@ -375,13 +377,13 @@ int SoundMixer::getSoundID(SoundHandle handle) {
return 0;
}
-bool SoundMixer::isSoundHandleActive(SoundHandle handle) {
+bool Mixer::isSoundHandleActive(SoundHandle handle) {
Common::StackLock lock(_mutex);
const int index = handle._val % NUM_CHANNELS;
return _channels[index] && _channels[index]->_handle._val == handle._val;
}
-bool SoundMixer::hasActiveChannelOfType(SoundType type) {
+bool Mixer::hasActiveChannelOfType(SoundType type) {
Common::StackLock lock(_mutex);
for (int i = 0; i != NUM_CHANNELS; i++)
if (_channels[i] && _channels[i]->_type == type)
@@ -389,7 +391,7 @@ bool SoundMixer::hasActiveChannelOfType(SoundType type) {
return false;
}
-void SoundMixer::setVolumeForSoundType(SoundType type, int volume) {
+void Mixer::setVolumeForSoundType(SoundType type, int volume) {
assert(0 <= type && type < ARRAYSIZE(_volumeForSoundType));
// Check range
@@ -404,7 +406,7 @@ void SoundMixer::setVolumeForSoundType(SoundType type, int volume) {
_volumeForSoundType[type] = volume;
}
-int SoundMixer::getVolumeForSoundType(SoundType type) const {
+int Mixer::getVolumeForSoundType(SoundType type) const {
assert(0 <= type && type < ARRAYSIZE(_volumeForSoundType));
return _volumeForSoundType[type];
@@ -416,17 +418,17 @@ int SoundMixer::getVolumeForSoundType(SoundType type) const {
#pragma mark -
-Channel::Channel(SoundMixer *mixer, SoundMixer::SoundType type, int id)
+Channel::Channel(Mixer *mixer, Mixer::SoundType type, int id)
: _type(type), _mixer(mixer), _autofreeStream(true),
- _volume(SoundMixer::kMaxChannelVolume), _balance(0), _paused(false), _id(id), _samplesConsumed(0),
+ _volume(Mixer::kMaxChannelVolume), _balance(0), _paused(false), _id(id), _samplesConsumed(0),
_samplesDecoded(0), _mixerTimeStamp(0), _converter(0), _input(0) {
assert(mixer);
}
-Channel::Channel(SoundMixer *mixer, SoundMixer::SoundType type, AudioStream *input,
+Channel::Channel(Mixer *mixer, Mixer::SoundType type, AudioStream *input,
bool autofreeStream, bool reverseStereo, int id, bool permanent)
: _type(type), _mixer(mixer), _autofreeStream(autofreeStream),
- _volume(SoundMixer::kMaxChannelVolume), _balance(0), _paused(false), _id(id), _samplesConsumed(0),
+ _volume(Mixer::kMaxChannelVolume), _balance(0), _paused(false), _id(id), _samplesConsumed(0),
_samplesDecoded(0), _mixerTimeStamp(0), _converter(0), _input(input), _permanent(permanent) {
assert(mixer);
assert(input);
@@ -465,14 +467,14 @@ void Channel::mix(int16 *data, uint len) {
st_volume_t vol_l, vol_r;
if (_balance == 0) {
- vol_l = vol / SoundMixer::kMaxChannelVolume;
- vol_r = vol / SoundMixer::kMaxChannelVolume;
+ vol_l = vol / Mixer::kMaxChannelVolume;
+ vol_r = vol / Mixer::kMaxChannelVolume;
} else if (_balance < 0) {
- vol_l = vol / SoundMixer::kMaxChannelVolume;
- vol_r = ((127 + _balance) * vol) / (SoundMixer::kMaxChannelVolume * 127);
+ vol_l = vol / Mixer::kMaxChannelVolume;
+ vol_r = ((127 + _balance) * vol) / (Mixer::kMaxChannelVolume * 127);
} else {
- vol_l = ((127 - _balance) * vol) / (SoundMixer::kMaxChannelVolume * 127);
- vol_r = vol / SoundMixer::kMaxChannelVolume;
+ vol_l = ((127 - _balance) * vol) / (Mixer::kMaxChannelVolume * 127);
+ vol_r = vol / Mixer::kMaxChannelVolume;
}
_samplesConsumed = _samplesDecoded;
@@ -507,3 +509,6 @@ uint32 Channel::getElapsedTime() {
// FIXME: This won't work very well if the sound is paused.
return 1000 * seconds + milliseconds + delta;
}
+
+
+} // End of namespace Audio
diff --git a/sound/mixer.h b/sound/mixer.h
index dfa7573738..0293f3c394 100644
--- a/sound/mixer.h
+++ b/sound/mixer.h
@@ -29,19 +29,23 @@
class AudioStream;
-class Channel;
+namespace Audio {
+ class Channel;
+ class Mixer;
+}
class OSystem;
class SoundHandle {
- friend class Channel;
- friend class SoundMixer;
+ friend class Audio::Channel;
+ friend class Audio::Mixer;
uint32 _val;
public:
inline SoundHandle() : _val(0xFFFFFFFF) {}
};
+namespace Audio {
-class SoundMixer {
+class Mixer {
public:
enum {
/** unsigned samples (default: signed) */
@@ -101,8 +105,8 @@ private:
bool _mixerReady;
public:
- SoundMixer();
- ~SoundMixer();
+ Mixer();
+ ~Mixer();
@@ -304,4 +308,7 @@ private:
static void mixCallback(void *s, byte *samples, int len);
};
+
+} // End of namespace Audio
+
#endif
diff --git a/sound/mp3.cpp b/sound/mp3.cpp
index 3028c22421..8638e3265f 100644
--- a/sound/mp3.cpp
+++ b/sound/mp3.cpp
@@ -288,7 +288,7 @@ public:
MP3TrackInfo(File *file);
~MP3TrackInfo();
bool error() { return _error_flag; }
- void play(SoundMixer *mixer, SoundHandle *handle, int startFrame, int duration);
+ void play(Audio::Mixer *mixer, SoundHandle *handle, int startFrame, int duration);
};
@@ -363,7 +363,7 @@ error:
delete file;
}
-void MP3TrackInfo::play(SoundMixer *mixer, SoundHandle *handle, int startFrame, int duration) {
+void MP3TrackInfo::play(Audio::Mixer *mixer, SoundHandle *handle, int startFrame, int duration) {
unsigned int offset;
mad_timer_t durationTime;
@@ -383,7 +383,7 @@ void MP3TrackInfo::play(SoundMixer *mixer, SoundHandle *handle, int startFrame,
// Play it
AudioStream *input = new MP3InputStream(_file, durationTime);
- mixer->playInputStream(SoundMixer::kMusicSoundType, handle, input);
+ mixer->playInputStream(Audio::Mixer::kMusicSoundType, handle, input);
}
MP3TrackInfo::~MP3TrackInfo() {
diff --git a/sound/rate.cpp b/sound/rate.cpp
index b7ac1160d9..94db083225 100644
--- a/sound/rate.cpp
+++ b/sound/rate.cpp
@@ -168,10 +168,10 @@ int LinearRateConverter<stereo, reverseStereo>::flow(AudioStream &input, st_samp
}
// output left channel
- clampedAdd(*obuf++, (out[0] * (int)vol_l) / SoundMixer::kMaxMixerVolume);
+ clampedAdd(*obuf++, (out[0] * (int)vol_l) / Audio::Mixer::kMaxMixerVolume);
// output right channel
- clampedAdd(*obuf++, (out[1] * (int)vol_r) / SoundMixer::kMaxMixerVolume);
+ clampedAdd(*obuf++, (out[1] * (int)vol_r) / Audio::Mixer::kMaxMixerVolume);
// Increment output position
unsigned long tmp = opos_frac + opos_inc_frac;
@@ -238,10 +238,10 @@ public:
}
// output left channel
- clampedAdd(*obuf++, (tmp0 * (int)vol_l) / SoundMixer::kMaxMixerVolume);
+ clampedAdd(*obuf++, (tmp0 * (int)vol_l) / Audio::Mixer::kMaxMixerVolume);
// output right channel
- clampedAdd(*obuf++, (tmp1 * (int)vol_r) / SoundMixer::kMaxMixerVolume);
+ clampedAdd(*obuf++, (tmp1 * (int)vol_r) / Audio::Mixer::kMaxMixerVolume);
}
return (ST_SUCCESS);
}
diff --git a/sound/softsynth/adlib.cpp b/sound/softsynth/adlib.cpp
index d77c7e4992..5f0d0435bd 100644
--- a/sound/softsynth/adlib.cpp
+++ b/sound/softsynth/adlib.cpp
@@ -543,7 +543,7 @@ class MidiDriver_ADLIB : public MidiDriver_Emulated {
friend class AdlibPercussionChannel;
public:
- MidiDriver_ADLIB(SoundMixer *mixer);
+ MidiDriver_ADLIB(Audio::Mixer *mixer);
int open();
void close();
@@ -798,7 +798,7 @@ void AdlibPercussionChannel::noteOn(byte note, byte velocity) {
// MidiDriver method implementations
-MidiDriver_ADLIB::MidiDriver_ADLIB(SoundMixer *mixer)
+MidiDriver_ADLIB::MidiDriver_ADLIB(Audio::Mixer *mixer)
: MidiDriver_Emulated(mixer) {
uint i;
@@ -962,7 +962,7 @@ MidiChannel *MidiDriver_ADLIB::allocateChannel() {
return NULL;
}
-MidiDriver *MidiDriver_ADLIB_create(SoundMixer *mixer) {
+MidiDriver *MidiDriver_ADLIB_create(Audio::Mixer *mixer) {
return new MidiDriver_ADLIB(mixer);
}
diff --git a/sound/softsynth/emumidi.h b/sound/softsynth/emumidi.h
index 19e2e86476..9fd0113a7f 100644
--- a/sound/softsynth/emumidi.h
+++ b/sound/softsynth/emumidi.h
@@ -28,7 +28,7 @@
class MidiDriver_Emulated : public AudioStream, public MidiDriver {
protected:
bool _isOpen;
- SoundMixer *_mixer;
+ Audio::Mixer *_mixer;
private:
Common::Timer::TimerProc _timerProc;
@@ -44,7 +44,7 @@ protected:
int _baseFreq;
public:
- MidiDriver_Emulated(SoundMixer *mixer) : _mixer(mixer) {
+ MidiDriver_Emulated(Audio::Mixer *mixer) : _mixer(mixer) {
_isOpen = false;
_timerProc = 0;
diff --git a/sound/softsynth/fluidsynth.cpp b/sound/softsynth/fluidsynth.cpp
index 8c3c9cb99d..ba45d527ce 100644
--- a/sound/softsynth/fluidsynth.cpp
+++ b/sound/softsynth/fluidsynth.cpp
@@ -49,7 +49,7 @@ protected:
void generateSamples(int16 *buf, int len);
public:
- MidiDriver_FluidSynth(SoundMixer *mixer);
+ MidiDriver_FluidSynth(Mixer *mixer);
int open();
void close();
@@ -65,7 +65,7 @@ public:
// MidiDriver method implementations
-MidiDriver_FluidSynth::MidiDriver_FluidSynth(SoundMixer *mixer)
+MidiDriver_FluidSynth::MidiDriver_FluidSynth(Mixer *mixer)
: MidiDriver_Emulated(mixer) {
for (int i = 0; i < ARRAYSIZE(_midiChannels); i++) {
@@ -138,7 +138,7 @@ int MidiDriver_FluidSynth::open() {
MidiDriver_Emulated::open();
// The MT-32 emulator uses kSFXSoundType here. I don't know why.
- _mixer->playInputStream(SoundMixer::kMusicSoundType, &_handle, this, -1, 255, 0, false, true);
+ _mixer->playInputStream(Mixer::kMusicSoundType, &_handle, this, -1, 255, 0, false, true);
return 0;
}
@@ -206,7 +206,7 @@ MidiChannel *MidiDriver_FluidSynth::getPercussionChannel() {
return &_midiChannels[9];
}
-MidiDriver *MidiDriver_FluidSynth_create(SoundMixer *mixer) {
+MidiDriver *MidiDriver_FluidSynth_create(Mixer *mixer) {
return new MidiDriver_FluidSynth(mixer);
}
diff --git a/sound/softsynth/mt32.cpp b/sound/softsynth/mt32.cpp
index 58f13f45c6..a64bbe3251 100644
--- a/sound/softsynth/mt32.cpp
+++ b/sound/softsynth/mt32.cpp
@@ -56,7 +56,7 @@ protected:
public:
bool _initialising;
- MidiDriver_MT32(SoundMixer *mixer);
+ MidiDriver_MT32(Audio::Mixer *mixer);
virtual ~MidiDriver_MT32();
int open();
@@ -208,7 +208,7 @@ static int MT32_Report(void *userData, MT32Emu::ReportType type, const void *rep
//
////////////////////////////////////////
-MidiDriver_MT32::MidiDriver_MT32(SoundMixer *mixer) : MidiDriver_Emulated(mixer) {
+MidiDriver_MT32::MidiDriver_MT32(Audio::Mixer *mixer) : MidiDriver_Emulated(mixer) {
_channelMask = 0xFFFF; // Permit all 16 channels by default
uint i;
for (i = 0; i < ARRAYSIZE(_midiChannels); ++i) {
@@ -221,7 +221,7 @@ MidiDriver_MT32::MidiDriver_MT32(SoundMixer *mixer) : MidiDriver_Emulated(mixer)
_baseFreq = 10000;
// Unfortunately bugs in the emulator cause inaccurate tuning
// at rates other than 32KHz, thus we produce data at 32KHz and
- // rely on SoundMixer to convert.
+ // rely on Mixer to convert.
_outputRate = 32000; //_mixer->getOutputRate();
_initialising = false;
}
@@ -267,7 +267,7 @@ int MidiDriver_MT32::open() {
_initialising = false;
g_system->clearScreen();
g_system->updateScreen();
- _mixer->playInputStream(SoundMixer::kSFXSoundType, &_handle, this, -1, 255, 0, false, true);
+ _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_handle, this, -1, 255, 0, false, true);
return 0;
}
@@ -388,7 +388,7 @@ protected:
void sysEx(byte *msg, uint16 length);
public:
- MidiDriver_ThreadedMT32(SoundMixer *mixer);
+ MidiDriver_ThreadedMT32(Audio::Mixer *mixer);
void onTimer();
void close();
@@ -396,7 +396,7 @@ public:
};
-MidiDriver_ThreadedMT32::MidiDriver_ThreadedMT32(SoundMixer *mixer) : MidiDriver_MT32(mixer) {
+MidiDriver_ThreadedMT32::MidiDriver_ThreadedMT32(Audio::Mixer *mixer) : MidiDriver_MT32(mixer) {
_events = NULL;
_timer_proc = NULL;
}
@@ -468,7 +468,7 @@ void MidiDriver_ThreadedMT32::onTimer() {
//
////////////////////////////////////////
-MidiDriver *MidiDriver_MT32_create(SoundMixer *mixer) {
+MidiDriver *MidiDriver_MT32_create(Audio::Mixer *mixer) {
// HACK: It will stay here until engine plugin loader overhaul
if (ConfMan.hasKey("extrapath"))
Common::File::addDefaultDirectory(ConfMan.get("extrapath"));
diff --git a/sound/softsynth/ym2612.cpp b/sound/softsynth/ym2612.cpp
index 8d37ee8ec6..e37b50170e 100644
--- a/sound/softsynth/ym2612.cpp
+++ b/sound/softsynth/ym2612.cpp
@@ -168,7 +168,7 @@ protected:
void generateSamples(int16 *buf, int len);
public:
- MidiDriver_YM2612(SoundMixer *mixer);
+ MidiDriver_YM2612(Audio::Mixer *mixer);
virtual ~MidiDriver_YM2612();
int open();
@@ -710,7 +710,7 @@ void MidiChannel_YM2612::rate(uint16 r) {
//
////////////////////////////////////////
-MidiDriver_YM2612::MidiDriver_YM2612(SoundMixer *mixer)
+MidiDriver_YM2612::MidiDriver_YM2612(Audio::Mixer *mixer)
: MidiDriver_Emulated(mixer) {
_next_voice = 0;
@@ -903,6 +903,6 @@ void MidiDriver_YM2612::createLookupTables() {
//
////////////////////////////////////////
-MidiDriver *MidiDriver_YM2612_create(SoundMixer *mixer) {
+MidiDriver *MidiDriver_YM2612_create(Audio::Mixer *mixer) {
return new MidiDriver_YM2612(mixer);
}
diff --git a/sound/voc.cpp b/sound/voc.cpp
index 12c2c520a5..5df91afad3 100644
--- a/sound/voc.cpp
+++ b/sound/voc.cpp
@@ -135,6 +135,6 @@ AudioStream *makeVOCStream(Common::ReadStream &stream) {
if (!data)
return 0;
- return makeLinearInputStream(rate, SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_UNSIGNED, data, size, 0, 0);
+ return makeLinearInputStream(rate, Audio::Mixer::FLAG_AUTOFREE | Audio::Mixer::FLAG_UNSIGNED, data, size, 0, 0);
}
diff --git a/sound/vorbis.cpp b/sound/vorbis.cpp
index f2f7781220..a92867b660 100644
--- a/sound/vorbis.cpp
+++ b/sound/vorbis.cpp
@@ -52,7 +52,7 @@ public:
~VorbisTrackInfo();
bool openTrack();
bool error() { return _error_flag; }
- void play(SoundMixer *mixer, SoundHandle *handle, int startFrame, int duration);
+ void play(Audio::Mixer *mixer, SoundHandle *handle, int startFrame, int duration);
};
@@ -168,7 +168,7 @@ VorbisTrackInfo::~VorbisTrackInfo() {
#define VORBIS_TREMOR
#endif
-void VorbisTrackInfo::play(SoundMixer *mixer, SoundHandle *handle, int startFrame, int duration) {
+void VorbisTrackInfo::play(Audio::Mixer *mixer, SoundHandle *handle, int startFrame, int duration) {
bool err = openTrack();
assert(!err);
@@ -180,7 +180,7 @@ void VorbisTrackInfo::play(SoundMixer *mixer, SoundHandle *handle, int startFram
#endif
AudioStream *input = makeVorbisStream(&_ov_file, duration * ov_info(&_ov_file, -1)->rate / 75);
- mixer->playInputStream(SoundMixer::kMusicSoundType, handle, input);
+ mixer->playInputStream(Audio::Mixer::kMusicSoundType, handle, input);
}
DigitalTrackInfo *getVorbisTrack(int track) {
diff --git a/sound/wave.cpp b/sound/wave.cpp
index 9822201215..911c4cbdbe 100644
--- a/sound/wave.cpp
+++ b/sound/wave.cpp
@@ -109,18 +109,18 @@ bool loadWAVFromStream(Common::SeekableReadStream &stream, int &size, int &rate,
flags = 0;
if (bitsPerSample == 8) // 8 bit data is unsigned
- flags |= SoundMixer::FLAG_UNSIGNED;
+ flags |= Audio::Mixer::FLAG_UNSIGNED;
else if (bitsPerSample == 16) // 16 bit data is signed little endian
- flags |= (SoundMixer::FLAG_16BITS | SoundMixer::FLAG_LITTLE_ENDIAN);
+ flags |= (Audio::Mixer::FLAG_16BITS | Audio::Mixer::FLAG_LITTLE_ENDIAN);
else if (bitsPerSample == 4 && type == 17) // IMA ADPCM compressed. We decompress it
- flags |= (SoundMixer::FLAG_16BITS | SoundMixer::FLAG_LITTLE_ENDIAN);
+ flags |= (Audio::Mixer::FLAG_16BITS | Audio::Mixer::FLAG_LITTLE_ENDIAN);
else {
warning("getWavInfo: unsupported bitsPerSample %d", bitsPerSample);
return false;
}
if (numChannels == 2)
- flags |= SoundMixer::FLAG_STEREO;
+ flags |= Audio::Mixer::FLAG_STEREO;
else if (numChannels != 1) {
warning("getWavInfo: unsupported number of channels %d", numChannels);
return false;
@@ -166,7 +166,7 @@ AudioStream *makeWAVStream(Common::SeekableReadStream &stream) {
byte *data = (byte *)malloc(size);
assert(data);
stream.read(data, size);
- flags |= SoundMixer::FLAG_AUTOFREE;
+ flags |= Audio::Mixer::FLAG_AUTOFREE;
return makeLinearInputStream(rate, flags, data, size, 0, 0);
}