diff options
author | Max Horn | 2005-05-10 23:48:48 +0000 |
---|---|---|
committer | Max Horn | 2005-05-10 23:48:48 +0000 |
commit | 1a615346abab8f234c3dbd1c55e78b179bca9d87 (patch) | |
tree | f687ac73ffbfa29088a403b6311bb4db13265fde /scumm | |
parent | 72f4c03b0b9a6918a359b967ebc400a2701981d9 (diff) | |
download | scummvm-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 'scumm')
-rw-r--r-- | scumm/imuse_digi/dimuse.cpp | 24 | ||||
-rw-r--r-- | scumm/imuse_digi/dimuse_script.cpp | 2 | ||||
-rw-r--r-- | scumm/imuse_digi/dimuse_track.cpp | 24 | ||||
-rw-r--r-- | scumm/input.cpp | 4 | ||||
-rw-r--r-- | scumm/player_mod.cpp | 2 | ||||
-rw-r--r-- | scumm/player_mod.h | 3 | ||||
-rw-r--r-- | scumm/player_nes.h | 6 | ||||
-rw-r--r-- | scumm/player_v2.h | 6 | ||||
-rw-r--r-- | scumm/player_v2a.h | 2 | ||||
-rw-r--r-- | scumm/player_v3a.h | 2 | ||||
-rw-r--r-- | scumm/script_v8.cpp | 6 | ||||
-rw-r--r-- | scumm/scumm.cpp | 6 | ||||
-rw-r--r-- | scumm/smush/smush_mixer.cpp | 10 | ||||
-rw-r--r-- | scumm/smush/smush_mixer.h | 4 | ||||
-rw-r--r-- | scumm/smush/smush_player.cpp | 8 | ||||
-rw-r--r-- | scumm/sound.cpp | 22 |
16 files changed, 67 insertions, 64 deletions
diff --git a/scumm/imuse_digi/dimuse.cpp b/scumm/imuse_digi/dimuse.cpp index 0dc5764375..20165f41a8 100644 --- a/scumm/imuse_digi/dimuse.cpp +++ b/scumm/imuse_digi/dimuse.cpp @@ -171,19 +171,19 @@ void IMuseDigital::saveOrLoad(Serializer *ser) { track->iteration = freq * channels; track->mixerFlags = 0; if (channels == 2) - track->mixerFlags = SoundMixer::FLAG_STEREO | SoundMixer::FLAG_REVERSE_STEREO; + track->mixerFlags = Audio::Mixer::FLAG_STEREO | Audio::Mixer::FLAG_REVERSE_STEREO; if ((bits == 12) || (bits == 16)) { - track->mixerFlags |= SoundMixer::FLAG_16BITS; + track->mixerFlags |= Audio::Mixer::FLAG_16BITS; track->iteration *= 2; } else if (bits == 8) { - track->mixerFlags |= SoundMixer::FLAG_UNSIGNED; + track->mixerFlags |= Audio::Mixer::FLAG_UNSIGNED; } else error("IMuseDigital::saveOrLoad(): Can't handle %d bit samples", bits); #ifdef SCUMM_LITTLE_ENDIAN if (track->compressed) - track->mixerFlags |= SoundMixer::FLAG_LITTLE_ENDIAN; + track->mixerFlags |= Audio::Mixer::FLAG_LITTLE_ENDIAN; #endif int32 streamBufferSize = track->iteration; @@ -192,14 +192,14 @@ void IMuseDigital::saveOrLoad(Serializer *ser) { const int pan = (track->pan != 64) ? 2 * track->pan - 127 : 0; const int vol = track->vol / 1000; - SoundMixer::SoundType type = SoundMixer::kPlainSoundType; + Audio::Mixer::SoundType type = Audio::Mixer::kPlainSoundType; if (track->volGroupId == 1) - type = SoundMixer::kSpeechSoundType; + type = Audio::Mixer::kSpeechSoundType; if (track->volGroupId == 2) - type = SoundMixer::kSFXSoundType; + type = Audio::Mixer::kSFXSoundType; if (track->volGroupId == 3) - type = SoundMixer::kMusicSoundType; + type = Audio::Mixer::kMusicSoundType; _vm->_mixer->playInputStream(type, &track->handle, track->stream, -1, vol, pan, false); } @@ -246,14 +246,14 @@ void IMuseDigital::callback() { const int pan = (track->pan != 64) ? 2 * track->pan - 127 : 0; const int vol = track->vol / 1000; - SoundMixer::SoundType type = SoundMixer::kPlainSoundType; + Audio::Mixer::SoundType type = Audio::Mixer::kPlainSoundType; if (track->volGroupId == 1) - type = SoundMixer::kSpeechSoundType; + type = Audio::Mixer::kSpeechSoundType; if (track->volGroupId == 2) - type = SoundMixer::kSFXSoundType; + type = Audio::Mixer::kSFXSoundType; if (track->volGroupId == 3) - type = SoundMixer::kMusicSoundType; + type = Audio::Mixer::kMusicSoundType; if (track->stream) { byte *data = NULL; diff --git a/scumm/imuse_digi/dimuse_script.cpp b/scumm/imuse_digi/dimuse_script.cpp index 315ac03c0c..b7f3691e35 100644 --- a/scumm/imuse_digi/dimuse_script.cpp +++ b/scumm/imuse_digi/dimuse_script.cpp @@ -170,7 +170,7 @@ void IMuseDigital::flushTracks() { track->stream->finish(); } if (track->stream->endOfStream() - || _vm->_mixer->isPaused() // hack for paused SoundMixer + || _vm->_mixer->isPaused() // hack for paused Mixer || _vm->_insaneRunning) { // INSANE hack for sync timer mode _vm->_mixer->stopHandle(track->handle); delete track->stream; diff --git a/scumm/imuse_digi/dimuse_track.cpp b/scumm/imuse_digi/dimuse_track.cpp index 06a03e6227..5a32beff1a 100644 --- a/scumm/imuse_digi/dimuse_track.cpp +++ b/scumm/imuse_digi/dimuse_track.cpp @@ -140,19 +140,19 @@ void IMuseDigital::startSound(int soundId, const char *soundName, int soundType, track->iteration = freq * channels; if (channels == 2) - track->mixerFlags = SoundMixer::FLAG_STEREO | SoundMixer::FLAG_REVERSE_STEREO; + track->mixerFlags = Audio::Mixer::FLAG_STEREO | Audio::Mixer::FLAG_REVERSE_STEREO; if ((bits == 12) || (bits == 16)) { - track->mixerFlags |= SoundMixer::FLAG_16BITS; + track->mixerFlags |= Audio::Mixer::FLAG_16BITS; track->iteration *= 2; } else if (bits == 8) { - track->mixerFlags |= SoundMixer::FLAG_UNSIGNED; + track->mixerFlags |= Audio::Mixer::FLAG_UNSIGNED; } else error("IMuseDigital::startSound(): Can't handle %d bit samples", bits); #ifdef SCUMM_LITTLE_ENDIAN if (track->compressed) - track->mixerFlags |= SoundMixer::FLAG_LITTLE_ENDIAN; + track->mixerFlags |= Audio::Mixer::FLAG_LITTLE_ENDIAN; #endif } @@ -163,14 +163,14 @@ void IMuseDigital::startSound(int soundId, const char *soundName, int soundType, } else { const int pan = (track->pan != 64) ? 2 * track->pan - 127 : 0; const int vol = track->vol / 1000; - SoundMixer::SoundType type = SoundMixer::kPlainSoundType; + Audio::Mixer::SoundType type = Audio::Mixer::kPlainSoundType; if (track->volGroupId == 1) - type = SoundMixer::kSpeechSoundType; + type = Audio::Mixer::kSpeechSoundType; if (track->volGroupId == 2) - type = SoundMixer::kSFXSoundType; + type = Audio::Mixer::kSFXSoundType; if (track->volGroupId == 3) - type = SoundMixer::kMusicSoundType; + type = Audio::Mixer::kMusicSoundType; // setup 1 second stream wrapped buffer int32 streamBufferSize = track->iteration; @@ -340,14 +340,14 @@ IMuseDigital::Track *IMuseDigital::cloneToFadeOutTrack(Track *track, int fadeDel fadeTrack->volFadeStep = (fadeTrack->volFadeDest - fadeTrack->vol) * 60 * (1000 / _callbackFps) / (1000 * fadeDelay); fadeTrack->volFadeUsed = true; - SoundMixer::SoundType type = SoundMixer::kPlainSoundType; + Audio::Mixer::SoundType type = Audio::Mixer::kPlainSoundType; if (fadeTrack->volGroupId == 1) - type = SoundMixer::kSpeechSoundType; + type = Audio::Mixer::kSpeechSoundType; if (fadeTrack->volGroupId == 2) - type = SoundMixer::kSFXSoundType; + type = Audio::Mixer::kSFXSoundType; if (fadeTrack->volGroupId == 3) - type = SoundMixer::kMusicSoundType; + type = Audio::Mixer::kMusicSoundType; // setup 1 second stream wrapped buffer int32 streamBufferSize = fadeTrack->iteration; diff --git a/scumm/input.cpp b/scumm/input.cpp index dd2f29cafe..29b3ddfef8 100644 --- a/scumm/input.cpp +++ b/scumm/input.cpp @@ -448,8 +448,8 @@ void ScummEngine::processKbd(bool smushMode) { vol = runDialog(dlg); vol *= 16; - if (vol > SoundMixer::kMaxMixerVolume) - vol = SoundMixer::kMaxMixerVolume; + if (vol > Audio::Mixer::kMaxMixerVolume) + vol = Audio::Mixer::kMaxMixerVolume; ConfMan.set("music_volume", vol); setupVolumes(); diff --git a/scumm/player_mod.cpp b/scumm/player_mod.cpp index fd915622cb..1649d98c3c 100644 --- a/scumm/player_mod.cpp +++ b/scumm/player_mod.cpp @@ -91,7 +91,7 @@ void Player_MOD::startChannel(int id, void *data, int size, int rate, uint8 vol, _channels[i].vol = vol; _channels[i].pan = pan; _channels[i].freq = rate; - _channels[i].input = makeLinearInputStream(rate, SoundMixer::FLAG_AUTOFREE | (loopStart != loopEnd ? SoundMixer::FLAG_LOOP : 0), (const byte*)data, size, loopStart, loopEnd - loopStart); + _channels[i].input = makeLinearInputStream(rate, Audio::Mixer::FLAG_AUTOFREE | (loopStart != loopEnd ? Audio::Mixer::FLAG_LOOP : 0), (const byte*)data, size, loopStart, loopEnd - loopStart); _channels[i].converter = makeRateConverter(rate, _mixer->getOutputRate(), false, false); } diff --git a/scumm/player_mod.h b/scumm/player_mod.h index 9a6e5449ca..e211aa1cf4 100644 --- a/scumm/player_mod.h +++ b/scumm/player_mod.h @@ -26,7 +26,6 @@ #include "scumm/scumm.h" #include "sound/audiostream.h" -class AudioStream; class RateConverter; namespace Scumm { @@ -74,7 +73,7 @@ private: AudioStream *input; }; - SoundMixer *_mixer; + Audio::Mixer *_mixer; uint32 _mixamt; uint32 _mixpos; diff --git a/scumm/player_nes.h b/scumm/player_nes.h index 6674ff080a..1c5ec00c5e 100644 --- a/scumm/player_nes.h +++ b/scumm/player_nes.h @@ -27,7 +27,9 @@ #include "scumm/music.h" #include "sound/audiostream.h" -class SoundMixer; +namespace Audio { + class Mixer; +} namespace Scumm { @@ -69,7 +71,7 @@ private: void do_mix(int16 *buf, uint len); ScummEngine *_vm; - SoundMixer *_mixer; + Audio::Mixer *_mixer; int _sample_rate; int _samples_per_frame; int _current_sample; diff --git a/scumm/player_v2.h b/scumm/player_v2.h index 045e8f1aa6..b87f9c3f7d 100644 --- a/scumm/player_v2.h +++ b/scumm/player_v2.h @@ -28,7 +28,9 @@ #include "scumm/music.h" #include "sound/audiostream.h" -class SoundMixer; +namespace Audio { + class Mixer; +} namespace Scumm { @@ -96,7 +98,7 @@ public: protected: bool _isV3Game; - SoundMixer *_mixer; + Audio::Mixer *_mixer; ScummEngine *_vm; bool _pcjr; diff --git a/scumm/player_v2a.h b/scumm/player_v2a.h index 9462e7c50f..ffc821ad0b 100644 --- a/scumm/player_v2a.h +++ b/scumm/player_v2a.h @@ -27,7 +27,7 @@ #include "scumm/music.h" #include "scumm/player_mod.h" -class SoundMixer; +class Mixer; namespace Scumm { diff --git a/scumm/player_v3a.h b/scumm/player_v3a.h index 31fe4d8840..5c92ea90de 100644 --- a/scumm/player_v3a.h +++ b/scumm/player_v3a.h @@ -27,7 +27,7 @@ #include "scumm/music.h" #include "scumm/player_mod.h" -class SoundMixer; +class Mixer; namespace Scumm { diff --git a/scumm/script_v8.cpp b/scumm/script_v8.cpp index 8db393bc75..305d538fbc 100644 --- a/scumm/script_v8.cpp +++ b/scumm/script_v8.cpp @@ -1384,13 +1384,13 @@ void ScummEngine_v8::o8_kernelGetFunctions() { } break; case 0xDD: // getGroupSfxVol - push(_mixer->getVolumeForSoundType(SoundMixer::kSFXSoundType) / 2); + push(_mixer->getVolumeForSoundType(Audio::Mixer::kSFXSoundType) / 2); break; case 0xDE: // getGroupVoiceVol - push(_mixer->getVolumeForSoundType(SoundMixer::kSpeechSoundType) / 2); + push(_mixer->getVolumeForSoundType(Audio::Mixer::kSpeechSoundType) / 2); break; case 0xDF: // getGroupMusicVol - push(_mixer->getVolumeForSoundType(SoundMixer::kMusicSoundType) / 2); + push(_mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) / 2); break; case 0xE0: // readRegistryValue { diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp index 38350d1e4b..8e0710c2d5 100644 --- a/scumm/scumm.cpp +++ b/scumm/scumm.cpp @@ -1879,9 +1879,9 @@ void ScummEngine::setupVolumes() { _musicEngine->setMusicVolume(soundVolumeMusic); } - _mixer->setVolumeForSoundType(SoundMixer::kSFXSoundType, soundVolumeSfx); - _mixer->setVolumeForSoundType(SoundMixer::kMusicSoundType, soundVolumeMusic); - _mixer->setVolumeForSoundType(SoundMixer::kSpeechSoundType, soundVolumeSpeech); + _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, soundVolumeSfx); + _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, soundVolumeMusic); + _mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, soundVolumeSpeech); } diff --git a/scumm/smush/smush_mixer.cpp b/scumm/smush/smush_mixer.cpp index c97d8c23ee..b24761ff72 100644 --- a/scumm/smush/smush_mixer.cpp +++ b/scumm/smush/smush_mixer.cpp @@ -33,7 +33,7 @@ namespace Scumm { -SmushMixer::SmushMixer(SoundMixer *m) : +SmushMixer::SmushMixer(Audio::Mixer *m) : _mixer(m), _soundFrequency(22050) { for (int32 i = 0; i < NUM_CHANNELS; i++) { @@ -109,27 +109,27 @@ bool SmushMixer::handleFrame() { _channels[i].chan->getParameters(rate, stereo, is_16bit, vol, pan); int32 size = _channels[i].chan->availableSoundData(); - byte flags = stereo ? SoundMixer::FLAG_STEREO : 0; + byte flags = stereo ? Audio::Mixer::FLAG_STEREO : 0; if (is_16bit) { data = malloc(size * (stereo ? 2 : 1) * 4); _channels[i].chan->getSoundData((int16 *)data, size); size *= stereo ? 4 : 2; - flags |= SoundMixer::FLAG_16BITS; + flags |= Audio::Mixer::FLAG_16BITS; } else { data = malloc(size * (stereo ? 2 : 1) * 2); _channels[i].chan->getSoundData((int8 *)data, size); size *= stereo ? 2 : 1; - flags |= SoundMixer::FLAG_UNSIGNED; + flags |= Audio::Mixer::FLAG_UNSIGNED; } if (_mixer->isReady()) { if (!_channels[i].stream) { _channels[i].stream = makeAppendableAudioStream(rate, flags, 500000); - _mixer->playInputStream(SoundMixer::kSFXSoundType, &_channels[i].handle, _channels[i].stream); + _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_channels[i].handle, _channels[i].stream); } _mixer->setChannelVolume(_channels[i].handle, vol); _mixer->setChannelBalance(_channels[i].handle, pan); diff --git a/scumm/smush/smush_mixer.h b/scumm/smush/smush_mixer.h index 5e56103190..0f6417f721 100644 --- a/scumm/smush/smush_mixer.h +++ b/scumm/smush/smush_mixer.h @@ -35,7 +35,7 @@ class SmushMixer { }; private: - SoundMixer *_mixer; + Audio::Mixer *_mixer; struct channels { int id; SmushChannel *chan; @@ -49,7 +49,7 @@ private: public: - SmushMixer(SoundMixer *); + SmushMixer(Audio::Mixer *); virtual ~SmushMixer(); SmushChannel *findChannel(int32 track); void addChannel(SmushChannel *c); diff --git a/scumm/smush/smush_player.cpp b/scumm/smush/smush_player.cpp index e49cf081bc..24c11d6bc5 100644 --- a/scumm/smush/smush_player.cpp +++ b/scumm/smush/smush_player.cpp @@ -511,8 +511,8 @@ void SmushPlayer::handleIACT(Chunk &b) { } while (--count); if (!_IACTstream) { - _IACTstream = makeAppendableAudioStream(22050, SoundMixer::FLAG_STEREO | SoundMixer::FLAG_16BITS, 400000); - _vm->_mixer->playInputStream(SoundMixer::kSFXSoundType, &_IACTchannel, _IACTstream); + _IACTstream = makeAppendableAudioStream(22050, Audio::Mixer::FLAG_STEREO | Audio::Mixer::FLAG_16BITS, 400000); + _vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_IACTchannel, _IACTstream); } _IACTstream->append(output_data, 0x1000); @@ -1187,7 +1187,7 @@ void SmushPlayer::tryCmpFile(const char *filename) { if (_compressedFile.isOpen()) { int size = _compressedFile.size(); _compressedFileMode = true; - _vm->_mixer->playInputStream(SoundMixer::kSFXSoundType, &_compressedFileSoundHandle, makeMP3Stream(&_compressedFile, size)); + _vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_compressedFileSoundHandle, makeMP3Stream(&_compressedFile, size)); return; } #endif @@ -1198,7 +1198,7 @@ void SmushPlayer::tryCmpFile(const char *filename) { if (_compressedFile.isOpen()) { int size = _compressedFile.size(); _compressedFileMode = true; - _vm->_mixer->playInputStream(SoundMixer::kSFXSoundType, &_compressedFileSoundHandle, makeVorbisStream(&_compressedFile, size)); + _vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_compressedFileSoundHandle, makeVorbisStream(&_compressedFile, size)); return; } #endif diff --git a/scumm/sound.cpp b/scumm/sound.cpp index 63f2af0b2c..f0380b5bd6 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -223,7 +223,7 @@ void Sound::playSound(int soundID, int heOffset, int heChannel, int heFlags) { char *sound; int size = -1; int rate; - byte flags = SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE; + byte flags = Audio::Mixer::FLAG_UNSIGNED | Audio::Mixer::FLAG_AUTOFREE; if (heChannel == -1) { heChannel = 1; @@ -337,7 +337,7 @@ void Sound::playSound(int soundID, int heOffset, int heChannel, int heFlags) { if (heFlags & 1) { // TODO - // flags |= SoundMixer::FLAG_LOOP; + // flags |= Audio::Mixer::FLAG_LOOP; } // Allocate a sound buffer, copy the data into it, and play @@ -353,7 +353,7 @@ void Sound::playSound(int soundID, int heOffset, int heChannel, int heFlags) { size = READ_BE_UINT32(ptr+4) - 8; rate = 22050; - flags = SoundMixer::FLAG_AUTOFREE; + flags = Audio::Mixer::FLAG_AUTOFREE; // Allocate a sound buffer, copy the data into it, and play sound = (char *)malloc(size); @@ -482,7 +482,7 @@ void Sound::playSound(int soundID, int heOffset, int heChannel, int heFlags) { size -= waveSize; if (loopEnd > 0) - flags |= SoundMixer::FLAG_LOOP; + flags |= Audio::Mixer::FLAG_LOOP; _vm->_mixer->playRaw(NULL, sound, waveSize, rate, flags, soundID, 255, 0, loopStart, loopEnd); } @@ -546,7 +546,7 @@ void Sound::playSound(int soundID, int heOffset, int heChannel, int heFlags) { sound = (char *)malloc(size); int vol = ptr[24] * 4; memcpy(sound, ptr + READ_BE_UINT16(ptr + 8), size); - _vm->_mixer->playRaw(NULL, sound, size, rate, SoundMixer::FLAG_AUTOFREE, soundID, vol, 0); + _vm->_mixer->playRaw(NULL, sound, size, rate, Audio::Mixer::FLAG_AUTOFREE, soundID, vol, 0); } else { @@ -806,7 +806,7 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, SoundHandle *handl //_vm->_imuseDigital->stopSound(kTalkSoundID); _vm->_imuseDigital->startVoice(kTalkSoundID, input); } else { - _vm->_mixer->playInputStream(SoundMixer::kSFXSoundType, handle, input, id); + _vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, input, id); } } } @@ -1189,7 +1189,7 @@ ScummFile *Sound::openSfxFile() { } bool Sound::isSfxFinished() const { - return !_vm->_mixer->hasActiveChannelOfType(SoundMixer::kSFXSoundType); + return !_vm->_mixer->hasActiveChannelOfType(Audio::Mixer::kSFXSoundType); } // We use a real timer in an attempt to get better sync with CD tracks. This is @@ -2436,10 +2436,10 @@ void AppendableMemoryStream<stereo, is16Bit, isUnsigned, isLE>::append(const byt return new AppendableMemoryStream<STEREO, false, UNSIGNED, false>(rate, len) AppendableAudioStream *makeAppendableAudioStream(int rate, byte _flags, uint32 len) { - 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 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; if (isStereo) { if (isUnsigned) { |