[Scummvm-cvs-logs] scummvm master -> 74cd6a4d269b1a0504f8ceada779ef28d89875a2
digitall
dgturner at iee.org
Sun Dec 16 17:06:52 CET 2012
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:
74cd6a4d26 TOUCHE: Fix external music to work with any music format.
Commit: 74cd6a4d269b1a0504f8ceada779ef28d89875a2
https://github.com/scummvm/scummvm/commit/74cd6a4d269b1a0504f8ceada779ef28d89875a2
Author: D G Turner (digitall at scummvm.org)
Date: 2012-12-16T08:03:32-08:00
Commit Message:
TOUCHE: Fix external music to work with any music format.
This also removes the direct dependency on vorbis.
Thanks to [md5] for the majority of this patch.
Changed paths:
engines/touche/touche.cpp
engines/touche/touche.h
diff --git a/engines/touche/touche.cpp b/engines/touche/touche.cpp
index ada1209..d03425a 100644
--- a/engines/touche/touche.cpp
+++ b/engines/touche/touche.cpp
@@ -33,7 +33,6 @@
#include "common/textconsole.h"
#include "audio/mixer.h"
-#include "audio/decoders/vorbis.h"
#include "engines/util.h"
#include "graphics/cursorman.h"
@@ -96,7 +95,6 @@ ToucheEngine::~ToucheEngine() {
delete _console;
stopMusic();
- _extMusicFile.close();
delete _midiPlayer;
}
@@ -3317,12 +3315,12 @@ bool ToucheEngine::canSaveGameStateCurrently() {
void ToucheEngine::initMusic() {
// Detect External Music Files
bool extMusic = true;
- for (int num = 0; num < 26; num++) {
- Common::String extMusicFilename = Common::String::format("track%02d.ogg", num+1);
- Common::File extMusicFile;
- if (!extMusicFile.open(extMusicFilename))
+ for (int num = 0; num < 26 && extMusic; num++) {
+ Common::String extMusicFilename = Common::String::format("track%02d", num+1);
+ Audio::SeekableAudioStream *musicStream = Audio::SeekableAudioStream::openStreamFile(extMusicFilename);
+ if (!musicStream)
extMusic = false;
- extMusicFile.close();
+ delete musicStream;
}
if (!extMusic) {
@@ -3343,12 +3341,12 @@ void ToucheEngine::startMusic(int num) {
_fData.seek(offs);
_midiPlayer->play(_fData, size, true);
} else {
- Common::String extMusicFilename = Common::String::format("track%02d.ogg", num);
- if (!_extMusicFile.open(extMusicFilename)) {
+ Common::String extMusicFilename = Common::String::format("track%02d", num);
+ _extMusicFileStream = Audio::SeekableAudioStream::openStreamFile(extMusicFilename);
+ if (!_extMusicFileStream) {
error("Unable to open %s for reading", extMusicFilename.c_str());
}
- Audio::SeekableAudioStream *musicStream = Audio::makeVorbisStream(&_extMusicFile, DisposeAfterUse::NO);
- Audio::LoopingAudioStream *loopStream = new Audio::LoopingAudioStream(musicStream, 0);
+ Audio::LoopingAudioStream *loopStream = new Audio::LoopingAudioStream(_extMusicFileStream, 0);
_mixer->playStream(Audio::Mixer::kMusicSoundType, &_musicHandle, loopStream);
_mixer->setChannelVolume(_musicHandle, _musicVolume);
}
@@ -3360,7 +3358,6 @@ void ToucheEngine::stopMusic() {
_midiPlayer->stop();
else {
_mixer->stopHandle(_musicHandle);
- _extMusicFile.close();
}
}
diff --git a/engines/touche/touche.h b/engines/touche/touche.h
index 6b04dfb..7901d0f 100644
--- a/engines/touche/touche.h
+++ b/engines/touche/touche.h
@@ -649,7 +649,7 @@ protected:
int _musicVolume;
Audio::SoundHandle _musicHandle;
- Common::File _extMusicFile;
+ Audio::SeekableAudioStream *_extMusicFileStream;
void initMusic();
public: // To allow access from console
More information about the Scummvm-git-logs
mailing list