[Scummvm-git-logs] scummvm master -> f7d13fdd353faa853ccaf35daba604427bb8c590
OMGPizzaGuy
noreply at scummvm.org
Sun Jan 21 14:44:09 UTC 2024
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
d89c9e1523 ULTIMA8: Remove unused audio related code
f7d13fdd35 ULTIMA8: Adjust audio channel rate using pitch shift variable
Commit: d89c9e152374f7355d3bd9dee50d3229b262cb32
https://github.com/scummvm/scummvm/commit/d89c9e152374f7355d3bd9dee50d3229b262cb32
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2024-01-21T08:42:56-06:00
Commit Message:
ULTIMA8: Remove unused audio related code
Changed paths:
engines/ultima/ultima8/audio/audio_channel.cpp
engines/ultima/ultima8/audio/audio_channel.h
engines/ultima/ultima8/audio/audio_mixer.cpp
engines/ultima/ultima8/audio/audio_mixer.h
diff --git a/engines/ultima/ultima8/audio/audio_channel.cpp b/engines/ultima/ultima8/audio/audio_channel.cpp
index a80e05311a1..3c0b6ba04f7 100644
--- a/engines/ultima/ultima8/audio/audio_channel.cpp
+++ b/engines/ultima/ultima8/audio/audio_channel.cpp
@@ -97,10 +97,6 @@ void AudioChannel::playSample(AudioSample *sample, int loop, int priority, bool
_mixer->pauseHandle(_soundHandle, true);
}
-void AudioChannel::playMusicStream(Audio::AudioStream *stream) {
- _mixer->playStream(Audio::Mixer::kMusicSoundType, &_soundHandle, stream);
-}
-
bool AudioChannel::isPlaying() {
if (!_mixer->isSoundHandleActive(_soundHandle))
_sample = nullptr;
@@ -118,12 +114,5 @@ void AudioChannel::setPaused(bool paused) {
_mixer->pauseHandle(_soundHandle, paused);
}
-void AudioChannel::decompressNextFrame() {
- // Get next frame of data
- uint8 *playData = &_playData[0];
- uint8 *src2 = playData + _decompressorSize + (_frameSize * (1 - _frameEvenOdd));
- (void)_sample->decompressFrame(playData, src2);
-}
-
} // End of namespace Ultima8
} // End of namespace Ultima
diff --git a/engines/ultima/ultima8/audio/audio_channel.h b/engines/ultima/ultima8/audio/audio_channel.h
index 2ad47c4bc28..32ca3dde83c 100644
--- a/engines/ultima/ultima8/audio/audio_channel.h
+++ b/engines/ultima/ultima8/audio/audio_channel.h
@@ -50,11 +50,7 @@ private:
uint32 _pitchShift; // AudioProcess::PITCH_SHIFT_NONE = no shift
int _priority; // anything.
bool _paused; // true/false
-private:
- /**
- * Decompresses the next frame of sample data
- */
- void decompressNextFrame();
+
public:
AudioChannel(Audio::Mixer *mixer, uint32 sampleRate, bool stereo);
~AudioChannel(void);
@@ -64,24 +60,8 @@ public:
void playSample(AudioSample *sample, int loop, int priority, bool paused,
bool isSpeech, uint32 pitchShift, int lvol, int rvol);
- void playMusicStream(Audio::AudioStream *stream);
-
bool isPlaying();
- void setPitchShift(int pitchShift) {
- _pitchShift = pitchShift;
- }
- uint32 getPitchShift() const {
- return _pitchShift;
- }
-
- void setLoop(int loop) {
- _loop = loop;
- }
- int32 getLoop() const {
- return _loop;
- }
-
void setVolume(int lvol, int rvol) {
_lVol = lvol;
_rVol = rvol;
diff --git a/engines/ultima/ultima8/audio/audio_mixer.cpp b/engines/ultima/ultima8/audio/audio_mixer.cpp
index f9ce18847f2..6fdf994152c 100644
--- a/engines/ultima/ultima8/audio/audio_mixer.cpp
+++ b/engines/ultima/ultima8/audio/audio_mixer.cpp
@@ -73,26 +73,15 @@ AudioMixer::~AudioMixer(void) {
delete _channels[idx];
}
-void AudioMixer::Lock() {
- // No implementation
-}
-
-void AudioMixer::Unlock() {
- // No implementation
-}
void AudioMixer::reset() {
_mixer->stopAll();
- Unlock();
}
int AudioMixer::playSample(AudioSample *sample, int loop, int priority, bool paused, bool isSpeech, uint32 pitch_shift, int lvol, int rvol, bool ambient) {
int lowest = -1;
int lowprior = 65536;
- // Lock the audio
- Lock();
-
int i;
const int minchan = (ambient ? BASE_CHANNEL_COUNT : 0);
const int maxchan = (ambient ? TOTAL_CHANNEL_COUNT : BASE_CHANNEL_COUNT);
@@ -112,9 +101,6 @@ int AudioMixer::playSample(AudioSample *sample, int loop, int priority, bool pau
else
lowest = -1;
- // Unlock
- Unlock();
-
return lowest;
}
@@ -122,12 +108,8 @@ bool AudioMixer::isPlaying(int chan) {
if (chan >= TOTAL_CHANNEL_COUNT || chan < 0)
return false;
- Lock();
-
bool playing = _channels[chan]->isPlaying();
- Unlock();
-
return playing;
}
@@ -135,34 +117,22 @@ void AudioMixer::stopSample(int chan) {
if (chan >= TOTAL_CHANNEL_COUNT || chan < 0)
return;
- Lock();
-
_channels[chan]->stop();
-
- Unlock();
}
void AudioMixer::setPaused(int chan, bool paused) {
if (chan >= TOTAL_CHANNEL_COUNT || chan < 0)
return;
- Lock();
-
_channels[chan]->setPaused(paused);
-
- Unlock();
}
bool AudioMixer::isPaused(int chan) {
if (chan >= TOTAL_CHANNEL_COUNT|| chan < 0)
return false;
- Lock();
-
bool ret = _channels[chan]->isPaused();
- Unlock();
-
return ret;
}
@@ -170,22 +140,14 @@ void AudioMixer::setVolume(int chan, int lvol, int rvol) {
if (chan >= TOTAL_CHANNEL_COUNT || chan < 0)
return;
- Lock();
-
_channels[chan]->setVolume(lvol, rvol);
-
- Unlock();
}
void AudioMixer::getVolume(int chan, int &lvol, int &rvol) {
if (chan >= TOTAL_CHANNEL_COUNT || chan < 0)
return;
- Lock();
-
_channels[chan]->getVolume(lvol, rvol);
-
- Unlock();
}
void AudioMixer::openMidiOutput() {
diff --git a/engines/ultima/ultima8/audio/audio_mixer.h b/engines/ultima/ultima8/audio/audio_mixer.h
index fa52e50e377..653b55e3a84 100644
--- a/engines/ultima/ultima8/audio/audio_mixer.h
+++ b/engines/ultima/ultima8/audio/audio_mixer.h
@@ -40,8 +40,6 @@ private:
MidiPlayer *_midiPlayer;
Common::Array<AudioChannel *> _channels;
- void Lock();
- void Unlock();
public:
AudioMixer(Audio::Mixer *mixer);
~AudioMixer();
Commit: f7d13fdd353faa853ccaf35daba604427bb8c590
https://github.com/scummvm/scummvm/commit/f7d13fdd353faa853ccaf35daba604427bb8c590
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2024-01-21T08:42:56-06:00
Commit Message:
ULTIMA8: Adjust audio channel rate using pitch shift variable
Changed paths:
engines/ultima/ultima8/audio/audio_channel.cpp
diff --git a/engines/ultima/ultima8/audio/audio_channel.cpp b/engines/ultima/ultima8/audio/audio_channel.cpp
index 3c0b6ba04f7..a1df353ea2d 100644
--- a/engines/ultima/ultima8/audio/audio_channel.cpp
+++ b/engines/ultima/ultima8/audio/audio_channel.cpp
@@ -21,6 +21,7 @@
#include "ultima/ultima8/misc/common_types.h"
#include "ultima/ultima8/audio/audio_channel.h"
+#include "ultima/ultima8/audio/audio_process.h"
#include "ultima/ultima8/audio/audio_sample.h"
#include "common/memstream.h"
#include "audio/audiostream.h"
@@ -92,7 +93,10 @@ void AudioChannel::playSample(AudioSample *sample, int loop, int priority, bool
// Play it
int vol = (_lVol + _rVol) / 2; // range is 0 ~ 255
int balance = (_rVol - _lVol) / 2; // range is -127 ~ +127
+
_mixer->playStream(isSpeech ? Audio::Mixer::kSpeechSoundType : Audio::Mixer::kSFXSoundType, &_soundHandle, stream, -1, vol, balance);
+ if (_pitchShift != AudioProcess::PITCH_SHIFT_NONE)
+ _mixer->setChannelRate(_soundHandle, stream->getRate() * pitchShift / AudioProcess::PITCH_SHIFT_NONE);
if (paused)
_mixer->pauseHandle(_soundHandle, true);
}
More information about the Scummvm-git-logs
mailing list