[Scummvm-git-logs] scummvm master -> 465fbc19f08e70f4093037c0eeebd959d9bb6a3a
dreammaster
dreammaster at scummvm.org
Sun Jul 11 21:45:24 UTC 2021
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
465fbc19f0 AGS: Implement audio stream seeking and getting length
Commit: 465fbc19f08e70f4093037c0eeebd959d9bb6a3a
https://github.com/scummvm/scummvm/commit/465fbc19f08e70f4093037c0eeebd959d9bb6a3a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2021-07-11T14:45:16-07:00
Commit Message:
AGS: Implement audio stream seeking and getting length
Changed paths:
engines/ags/engine/media/audio/sound_clip.cpp
diff --git a/engines/ags/engine/media/audio/sound_clip.cpp b/engines/ags/engine/media/audio/sound_clip.cpp
index b21f754559..298b3f01f5 100644
--- a/engines/ags/engine/media/audio/sound_clip.cpp
+++ b/engines/ags/engine/media/audio/sound_clip.cpp
@@ -96,7 +96,14 @@ bool SoundClipWaveBase::is_playing() const {
}
void SoundClipWaveBase::seek(int offset) {
- warning("TODO: SoundClipWaveBase::seek");
+ Audio::SeekableAudioStream *stream =
+ dynamic_cast<Audio::SeekableAudioStream *>(_stream);
+
+ if (stream) {
+ stream->seek(Audio::Timestamp(offset));
+ } else {
+ warning("Audio stream did not support seeking");
+ }
}
int SoundClipWaveBase::get_pos() {
@@ -108,8 +115,15 @@ int SoundClipWaveBase::get_pos_ms() {
}
int SoundClipWaveBase::get_length_ms() {
- warning("TODO: SoundClipWaveBase::get_length_ms");
- return 0;
+ Audio::SeekableAudioStream *stream =
+ dynamic_cast<Audio::SeekableAudioStream *>(_stream);
+
+ if (stream) {
+ return stream->getLength().msecs();
+ } else {
+ warning("Unable to determine audio stream length");
+ return 0;
+ }
}
void SoundClipWaveBase::set_volume(int volume) {
More information about the Scummvm-git-logs
mailing list