diff options
Diffstat (limited to 'audio')
-rw-r--r-- | audio/audiostream.cpp | 8 | ||||
-rw-r--r-- | audio/decoders/adpcm.cpp | 2 | ||||
-rw-r--r-- | audio/decoders/adpcm.h | 8 | ||||
-rw-r--r-- | audio/fmopl.cpp | 2 | ||||
-rw-r--r-- | audio/midiparser.cpp | 1 | ||||
-rw-r--r-- | audio/midiparser_smf.cpp | 2 | ||||
-rw-r--r-- | audio/midiparser_xmidi.cpp | 7 | ||||
-rw-r--r-- | audio/mixer.cpp | 6 | ||||
-rw-r--r-- | audio/mixer_intern.h | 1 | ||||
-rw-r--r-- | audio/mods/paula.cpp | 9 | ||||
-rw-r--r-- | audio/softsynth/mt32.cpp | 6 |
11 files changed, 40 insertions, 12 deletions
diff --git a/audio/audiostream.cpp b/audio/audiostream.cpp index 2d65d4afef..8bd4b95c49 100644 --- a/audio/audiostream.cpp +++ b/audio/audiostream.cpp @@ -98,6 +98,10 @@ LoopingAudioStream::LoopingAudioStream(RewindableAudioStream *stream, uint loops // TODO: Properly indicate error _loops = _completeIterations = 1; } + if (stream->endOfData()) { + // Apparently this is an empty stream + _loops = _completeIterations = 1; + } } int LoopingAudioStream::readBuffer(int16 *buffer, const int numSamples) { @@ -118,6 +122,10 @@ int LoopingAudioStream::readBuffer(int16 *buffer, const int numSamples) { _loops = _completeIterations = 1; return samplesRead; } + if (_parent->endOfData()) { + // Apparently this is an empty stream + _loops = _completeIterations = 1; + } return samplesRead + readBuffer(buffer + samplesRead, remainingSamples); } diff --git a/audio/decoders/adpcm.cpp b/audio/decoders/adpcm.cpp index f069ee3417..61b0abaaca 100644 --- a/audio/decoders/adpcm.cpp +++ b/audio/decoders/adpcm.cpp @@ -433,7 +433,7 @@ int16 Ima_ADPCMStream::decodeIMA(byte code, int channel) { return samp; } -RewindableAudioStream *makeADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, typesADPCM type, int rate, int channels, uint32 blockAlign) { +RewindableAudioStream *makeADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, ADPCMType type, int rate, int channels, uint32 blockAlign) { // If size is 0, report the entire size of the stream if (!size) size = stream->size(); diff --git a/audio/decoders/adpcm.h b/audio/decoders/adpcm.h index ac8d529917..d3c46574bf 100644 --- a/audio/decoders/adpcm.h +++ b/audio/decoders/adpcm.h @@ -51,7 +51,7 @@ class RewindableAudioStream; // http://wiki.multimedia.cx/index.php?title=Category:ADPCM_Audio_Codecs // Usually, if the audio stream we're trying to play has the FourCC header // string intact, it's easy to discern which encoding is used -enum typesADPCM { +enum ADPCMType { kADPCMOki, // Dialogic/Oki ADPCM (aka VOX) kADPCMMSIma, // Microsoft IMA ADPCM kADPCMMS, // Microsoft ADPCM @@ -76,9 +76,9 @@ enum typesADPCM { RewindableAudioStream *makeADPCMStream( Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, - uint32 size, typesADPCM type, - int rate = 22050, - int channels = 2, + uint32 size, ADPCMType type, + int rate, + int channels, uint32 blockAlign = 0); } // End of namespace Audio diff --git a/audio/fmopl.cpp b/audio/fmopl.cpp index da655643a7..d2fe7dc0e8 100644 --- a/audio/fmopl.cpp +++ b/audio/fmopl.cpp @@ -137,7 +137,7 @@ OPL *Config::create(DriverId driver, OplType type) { return new MAME::OPL(); else warning("MAME OPL emulator only supports OPL2 emulation"); - return 0; + return 0; #ifndef DISABLE_DOSBOX_OPL case kDOSBox: diff --git a/audio/midiparser.cpp b/audio/midiparser.cpp index eec32c05d1..9c144c2479 100644 --- a/audio/midiparser.cpp +++ b/audio/midiparser.cpp @@ -46,6 +46,7 @@ _numTracks(0), _activeTrack(255), _abortParse(0) { memset(_activeNotes, 0, sizeof(_activeNotes)); + memset(_tracks, 0, sizeof(_tracks)); _nextEvent.start = NULL; _nextEvent.delta = 0; _nextEvent.event = 0; diff --git a/audio/midiparser_smf.cpp b/audio/midiparser_smf.cpp index 4b0913cbfe..6c64d1e601 100644 --- a/audio/midiparser_smf.cpp +++ b/audio/midiparser_smf.cpp @@ -56,8 +56,10 @@ void MidiParser_SMF::property(int prop, int value) { switch (prop) { case mpMalformedPitchBends: _malformedPitchBends = (value > 0); + break; default: MidiParser::property(prop, value); + break; } } diff --git a/audio/midiparser_xmidi.cpp b/audio/midiparser_xmidi.cpp index 11690b0214..fcb45fa5ad 100644 --- a/audio/midiparser_xmidi.cpp +++ b/audio/midiparser_xmidi.cpp @@ -47,8 +47,13 @@ protected: uint32 readVLQ2(byte * &data); void parseNextEvent(EventInfo &info); + virtual void resetTracking() { + MidiParser::resetTracking(); + _loopCount = -1; + } + public: - MidiParser_XMIDI(XMidiCallbackProc proc, void *data) : _callbackProc(proc), _callbackData(data) {} + MidiParser_XMIDI(XMidiCallbackProc proc, void *data) : _callbackProc(proc), _callbackData(data), _loopCount(-1) {} ~MidiParser_XMIDI() { } bool loadMusic(byte *data, uint32 size); diff --git a/audio/mixer.cpp b/audio/mixer.cpp index 965766170d..8ff364b98d 100644 --- a/audio/mixer.cpp +++ b/audio/mixer.cpp @@ -171,9 +171,9 @@ private: #pragma mark --- Mixer --- #pragma mark - - +// TODO: parameter "system" is unused MixerImpl::MixerImpl(OSystem *system, uint sampleRate) - : _syst(system), _mutex(), _sampleRate(sampleRate), _mixerReady(false), _handleSeed(0), _soundTypeSettings() { + : _mutex(), _sampleRate(sampleRate), _mixerReady(false), _handleSeed(0), _soundTypeSettings() { assert(sampleRate > 0); @@ -491,7 +491,7 @@ Channel::Channel(Mixer *mixer, Mixer::SoundType type, AudioStream *stream, DisposeAfterUse::Flag autofreeStream, bool reverseStereo, int id, bool permanent) : _type(type), _mixer(mixer), _id(id), _permanent(permanent), _volume(Mixer::kMaxChannelVolume), _balance(0), _pauseLevel(0), _samplesConsumed(0), _samplesDecoded(0), _mixerTimeStamp(0), - _pauseStartTime(0), _pauseTime(0), _converter(0), + _pauseStartTime(0), _pauseTime(0), _converter(0), _volL(0), _volR(0), _stream(stream, autofreeStream) { assert(mixer); assert(stream); diff --git a/audio/mixer_intern.h b/audio/mixer_intern.h index c6dfa55ada..fce13a9812 100644 --- a/audio/mixer_intern.h +++ b/audio/mixer_intern.h @@ -54,7 +54,6 @@ private: NUM_CHANNELS = 16 }; - OSystem *_syst; Common::Mutex _mutex; const uint _sampleRate; diff --git a/audio/mods/paula.cpp b/audio/mods/paula.cpp index 4b49d6e750..d655428ed0 100644 --- a/audio/mods/paula.cpp +++ b/audio/mods/paula.cpp @@ -132,7 +132,14 @@ int Paula::readBufferIntern(int16 *buffer, const int numSamples) { Channel &ch = _voice[voice]; int16 *p = buffer; int neededSamples = nSamples; - assert(ch.offset.int_off < ch.length); + + // NOTE: A Protracker (or other module format) player might actually + // push the offset past the sample length in its interrupt(), in which + // case the first mixBuffer() call should not mix anything, and the loop + // should be triggered. + // Thus, doing an assert(ch.offset.int_off < ch.length) here is wrong. + // An example where this happens is a certain Protracker module played + // by the OS/2 version of Hopkins FBI. // Mix the generated samples into the output buffer neededSamples -= mixBuffer<stereo>(p, ch.data, ch.offset, rate, neededSamples, ch.length, ch.volume, ch.panning); diff --git a/audio/softsynth/mt32.cpp b/audio/softsynth/mt32.cpp index d9744924aa..3ae8e14b36 100644 --- a/audio/softsynth/mt32.cpp +++ b/audio/softsynth/mt32.cpp @@ -156,6 +156,12 @@ MidiDriver_MT32::MidiDriver_MT32(Audio::Mixer *mixer) : MidiDriver_Emulated(mixe // rely on Mixer to convert. _outputRate = 32000; //_mixer->getOutputRate(); _initializing = false; + + // Initialized in open() + _controlROM = NULL; + _pcmROM = NULL; + _controlFile = NULL; + _pcmFile = NULL; } MidiDriver_MT32::~MidiDriver_MT32() { |