aboutsummaryrefslogtreecommitdiff
path: root/audio
diff options
context:
space:
mode:
authorjohndoe1232014-01-30 20:18:55 +0100
committerjohndoe1232014-01-30 20:18:55 +0100
commitcf51529cfd0fedb33b1b0c70beb59997b21cfc5b (patch)
tree1df30e23c7f1eac7ca4a8ddfba40c89c2577dda7 /audio
parent542197a891eac799855571fe2849e0dca43bdd2b (diff)
parent462f7c1c24a48b7555316a3afae357bad14cc14b (diff)
downloadscummvm-rg350-cf51529cfd0fedb33b1b0c70beb59997b21cfc5b.tar.gz
scummvm-rg350-cf51529cfd0fedb33b1b0c70beb59997b21cfc5b.tar.bz2
scummvm-rg350-cf51529cfd0fedb33b1b0c70beb59997b21cfc5b.zip
Merge remote-tracking branch 'origin/master' into bbvs
Diffstat (limited to 'audio')
-rw-r--r--audio/decoders/voc.cpp2
-rw-r--r--audio/midiparser.cpp22
-rw-r--r--audio/midiparser.h2
-rw-r--r--audio/softsynth/eas.cpp2
-rw-r--r--audio/softsynth/fluidsynth.cpp3
-rw-r--r--audio/softsynth/mt32.cpp14
6 files changed, 18 insertions, 27 deletions
diff --git a/audio/decoders/voc.cpp b/audio/decoders/voc.cpp
index fa330c6f2c..ec589533eb 100644
--- a/audio/decoders/voc.cpp
+++ b/audio/decoders/voc.cpp
@@ -559,7 +559,7 @@ SeekableAudioStream *makeVOCStream(Common::SeekableReadStream *stream, byte flag
SeekableAudioStream *audioStream = new VocStream(stream, (flags & Audio::FLAG_UNSIGNED) != 0, disposeAfterUse);
- if (audioStream && audioStream->endOfData()) {
+ if (audioStream->endOfData()) {
delete audioStream;
return 0;
} else {
diff --git a/audio/midiparser.cpp b/audio/midiparser.cpp
index 2454575413..61f82c4ca4 100644
--- a/audio/midiparser.cpp
+++ b/audio/midiparser.cpp
@@ -214,13 +214,16 @@ void MidiParser::onTimer() {
activeNote(info.channel(), info.basic.param1, true);
}
- processEvent(info);
-
- if (_abortParse)
- break;
+ // Player::metaEvent() in SCUMM will delete the parser object,
+ // so return immediately if that might have happened.
+ bool ret = processEvent(info);
+ if (!ret)
+ return;
- _position._lastEventTime = eventTime;
- parseNextEvent(_nextEvent);
+ if (!_abortParse) {
+ _position._lastEventTime = eventTime;
+ parseNextEvent(_nextEvent);
+ }
}
if (!_abortParse) {
@@ -229,7 +232,7 @@ void MidiParser::onTimer() {
}
}
-void MidiParser::processEvent(const EventInfo &info, bool fireEvents) {
+bool MidiParser::processEvent(const EventInfo &info, bool fireEvents) {
if (info.event == 0xF0) {
// SysEx event
// Check for trailing 0xF7 -- if present, remove it.
@@ -252,8 +255,7 @@ void MidiParser::processEvent(const EventInfo &info, bool fireEvents) {
if (fireEvents)
_driver->metaEvent(info.ext.type, info.ext.data, (uint16)info.length);
}
- _abortParse = true;
- return;
+ return false;
} else if (info.ext.type == 0x51) {
if (info.length >= 3) {
setTempo(info.ext.data[0] << 16 | info.ext.data[1] << 8 | info.ext.data[2]);
@@ -265,6 +267,8 @@ void MidiParser::processEvent(const EventInfo &info, bool fireEvents) {
if (fireEvents)
sendToDriver(info.event, info.basic.param1, info.basic.param2);
}
+
+ return true;
}
diff --git a/audio/midiparser.h b/audio/midiparser.h
index 05d0cbe1db..9499d01512 100644
--- a/audio/midiparser.h
+++ b/audio/midiparser.h
@@ -294,7 +294,7 @@ protected:
virtual void resetTracking();
virtual void allNotesOff();
virtual void parseNextEvent(EventInfo &info) = 0;
- virtual void processEvent(const EventInfo &info, bool fireEvents = true);
+ virtual bool processEvent(const EventInfo &info, bool fireEvents = true);
void activeNote(byte channel, byte note, bool active);
void hangingNote(byte channel, byte note, uint32 ticksLeft, bool recycle = true);
diff --git a/audio/softsynth/eas.cpp b/audio/softsynth/eas.cpp
index ea79b25329..0631df2a7c 100644
--- a/audio/softsynth/eas.cpp
+++ b/audio/softsynth/eas.cpp
@@ -305,7 +305,7 @@ int MidiDriver_EAS::open() {
warning("error opening EAS dump file");
#endif
- g_system->getMixer()->playStream(Audio::Mixer::kMusicSoundType,
+ g_system->getMixer()->playStream(Audio::Mixer::kPlainSoundType,
&_soundHandle, this, -1,
Audio::Mixer::kMaxChannelVolume, 0,
DisposeAfterUse::NO, true);
diff --git a/audio/softsynth/fluidsynth.cpp b/audio/softsynth/fluidsynth.cpp
index efcf1be615..218a06ecc0 100644
--- a/audio/softsynth/fluidsynth.cpp
+++ b/audio/softsynth/fluidsynth.cpp
@@ -184,8 +184,7 @@ int MidiDriver_FluidSynth::open() {
MidiDriver_Emulated::open();
- // The MT-32 emulator uses kSFXSoundType here. I don't know why.
- _mixer->playStream(Audio::Mixer::kMusicSoundType, &_mixerSoundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
+ _mixer->playStream(Audio::Mixer::kPlainSoundType, &_mixerSoundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
return 0;
}
diff --git a/audio/softsynth/mt32.cpp b/audio/softsynth/mt32.cpp
index 29f5e3577c..7f46e926bc 100644
--- a/audio/softsynth/mt32.cpp
+++ b/audio/softsynth/mt32.cpp
@@ -80,15 +80,6 @@ protected:
void showLCDMessage(const char *message) {
g_system->displayMessageOnOSD(message);
}
- void onDeviceReset() {}
- void onDeviceReconfig() {}
- void onNewReverbMode(Bit8u /* mode */) {}
- void onNewReverbTime(Bit8u /* time */) {}
- void onNewReverbLevel(Bit8u /* level */) {}
- void onPartStateChanged(int /* partNum */, bool /* isActive */) {}
- void onPolyStateChanged(int /* partNum */) {}
- void onPartialStateChanged(int /* partialNum */, int /* oldPartialPhase */, int /* newPartialPhase */) {}
- void onProgramChanged(int /* partNum */, char * /* patchName */) {}
};
} // end of namespace MT32Emu
@@ -230,7 +221,7 @@ int MidiDriver_MT32::open() {
g_system->updateScreen();
- _mixer->playStream(Audio::Mixer::kSFXSoundType, &_mixerSoundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
+ _mixer->playStream(Audio::Mixer::kPlainSoundType, &_mixerSoundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
return 0;
}
@@ -460,9 +451,6 @@ bool MT32EmuMusicPlugin::checkDevice(MidiDriver::DeviceHandle) const {
}
Common::Error MT32EmuMusicPlugin::createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle) const {
- if (ConfMan.hasKey("extrapath"))
- SearchMan.addDirectory("extrapath", ConfMan.get("extrapath"));
-
*mididriver = new MidiDriver_MT32(g_system->getMixer());
return Common::kNoError;