diff options
Diffstat (limited to 'audio')
-rw-r--r-- | audio/mixer.cpp | 21 | ||||
-rw-r--r-- | audio/softsynth/fluidsynth.cpp | 2 | ||||
-rw-r--r-- | audio/softsynth/mt32.cpp | 3 | ||||
-rw-r--r-- | audio/softsynth/mt32/Part.cpp | 6 | ||||
-rw-r--r-- | audio/softsynth/mt32/Partial.cpp | 1 | ||||
-rw-r--r-- | audio/softsynth/mt32/Synth.cpp | 17 | ||||
-rw-r--r-- | audio/softsynth/mt32/Synth.h | 8 | ||||
-rw-r--r-- | audio/softsynth/mt32/TVA.cpp | 6 |
8 files changed, 25 insertions, 39 deletions
diff --git a/audio/mixer.cpp b/audio/mixer.cpp index 8ff364b98d..9e6e4596e2 100644 --- a/audio/mixer.cpp +++ b/audio/mixer.cpp @@ -20,6 +20,8 @@ * */ +#include "gui/EventRecorder.h" + #include "common/util.h" #include "common/system.h" #include "common/textconsole.h" @@ -427,6 +429,11 @@ void MixerImpl::pauseHandle(SoundHandle handle, bool paused) { bool MixerImpl::isSoundIDActive(int id) { Common::StackLock lock(_mutex); + +#ifdef ENABLE_EVENTRECORDER + g_eventRec.updateSubsystems(); +#endif + for (int i = 0; i != NUM_CHANNELS; i++) if (_channels[i] && _channels[i]->getId() == id) return true; @@ -443,6 +450,11 @@ int MixerImpl::getSoundID(SoundHandle handle) { bool MixerImpl::isSoundHandleActive(SoundHandle handle) { Common::StackLock lock(_mutex); + +#ifdef ENABLE_EVENTRECORDER + g_eventRec.updateSubsystems(); +#endif + const int index = handle._val % NUM_CHANNELS; return _channels[index] && _channels[index]->getHandle()._val == handle._val; } @@ -556,12 +568,12 @@ void Channel::pause(bool paused) { _pauseLevel++; if (_pauseLevel == 1) - _pauseStartTime = g_system->getMillis(); + _pauseStartTime = g_system->getMillis(true); } else if (_pauseLevel > 0) { _pauseLevel--; if (!_pauseLevel) { - _pauseTime = (g_system->getMillis() - _pauseStartTime); + _pauseTime = (g_system->getMillis(true) - _pauseStartTime); _pauseStartTime = 0; } } @@ -579,7 +591,7 @@ Timestamp Channel::getElapsedTime() { if (isPaused()) delta = _pauseStartTime - _mixerTimeStamp; else - delta = g_system->getMillis() - _mixerTimeStamp - _pauseTime; + delta = g_system->getMillis(true) - _mixerTimeStamp - _pauseTime; // Convert the number of samples into a time duration. @@ -599,13 +611,12 @@ int Channel::mix(int16 *data, uint len) { assert(_stream); int res = 0; - if (_stream->endOfData()) { // TODO: call drain method } else { assert(_converter); _samplesConsumed = _samplesDecoded; - _mixerTimeStamp = g_system->getMillis(); + _mixerTimeStamp = g_system->getMillis(true); _pauseTime = 0; res = _converter->flow(*_stream, data, len, _volL, _volR); _samplesDecoded += res; diff --git a/audio/softsynth/fluidsynth.cpp b/audio/softsynth/fluidsynth.cpp index 518e260175..efcf1be615 100644 --- a/audio/softsynth/fluidsynth.cpp +++ b/audio/softsynth/fluidsynth.cpp @@ -163,7 +163,7 @@ int MidiDriver_FluidSynth::open() { Common::String interpolation = ConfMan.get("fluidsynth_misc_interpolation"); int interpMethod = FLUID_INTERP_4THORDER; - + if (interpolation == "none") { interpMethod = FLUID_INTERP_NONE; } else if (interpolation == "linear") { diff --git a/audio/softsynth/mt32.cpp b/audio/softsynth/mt32.cpp index 00d0469356..29f5e3577c 100644 --- a/audio/softsynth/mt32.cpp +++ b/audio/softsynth/mt32.cpp @@ -62,7 +62,8 @@ protected: // Callback for debug messages, in vprintf() format void printDebug(const char *fmt, va_list list) { - debug(4, fmt, list); + Common::String out = Common::String::vformat(fmt, list); + debug(4, "%s", out.c_str()); } // Callbacks for reporting various errors and information diff --git a/audio/softsynth/mt32/Part.cpp b/audio/softsynth/mt32/Part.cpp index 62ba346c35..88404316eb 100644 --- a/audio/softsynth/mt32/Part.cpp +++ b/audio/softsynth/mt32/Part.cpp @@ -175,6 +175,7 @@ void Part::refresh() { patchCache[t].reverb = patchTemp->patch.reverbSwitch > 0; } memcpy(currentInstr, timbreTemp->common.name, 10); + synth->newTimbreSet(partNum, patchTemp->patch.timbreGroup, currentInstr); updatePitchBenderRange(); } @@ -207,7 +208,6 @@ void RhythmPart::setTimbre(TimbreParam * /*timbre*/) { void Part::setTimbre(TimbreParam *timbre) { *timbreTemp = *timbre; - synth->newTimbreSet(partNum, timbre->common.name); } unsigned int RhythmPart::getAbsTimbreNum() const { @@ -533,7 +533,6 @@ void Part::playPoly(const PatchCache cache[4], const MemParams::RhythmTemp *rhyt #if MT32EMU_MONITOR_PARTIALS > 1 synth->printPartialUsage(); #endif - synth->partStateChanged(partNum, true); synth->polyStateChanged(partNum); } @@ -614,9 +613,6 @@ void Part::partialDeactivated(Poly *poly) { freePolys.prepend(poly); synth->polyStateChanged(partNum); } - if (activePartialCount == 0) { - synth->partStateChanged(partNum, false); - } } //#define POLY_LIST_DEBUG diff --git a/audio/softsynth/mt32/Partial.cpp b/audio/softsynth/mt32/Partial.cpp index a0aec90ec4..b80a028515 100644 --- a/audio/softsynth/mt32/Partial.cpp +++ b/audio/softsynth/mt32/Partial.cpp @@ -87,7 +87,6 @@ void Partial::deactivate() { if (poly != NULL) { poly->partialDeactivated(this); } - synth->partialStateChanged(this, tva->getPhase(), TVA_PHASE_DEAD); #if MT32EMU_MONITOR_PARTIALS > 2 synth->printDebug("[+%lu] [Partial %d] Deactivated", sampleNum, debugPartialNum); synth->printPartialUsage(sampleNum); diff --git a/audio/softsynth/mt32/Synth.cpp b/audio/softsynth/mt32/Synth.cpp index b7af992b99..1e1be06bc9 100644 --- a/audio/softsynth/mt32/Synth.cpp +++ b/audio/softsynth/mt32/Synth.cpp @@ -201,25 +201,12 @@ void ReportHandler::printDebug(const char *fmt, va_list list) { printf("\n"); } -void Synth::partStateChanged(int partNum, bool isPartActive) { - reportHandler->onPartStateChanged(partNum, isPartActive); -} - void Synth::polyStateChanged(int partNum) { reportHandler->onPolyStateChanged(partNum); } -void Synth::partialStateChanged(const Partial * const partial, int oldPartialPhase, int newPartialPhase) { - for (int i = 0; i < MT32EMU_MAX_PARTIALS; i++) { - if (getPartial(i) == partial) { - reportHandler->onPartialStateChanged(i, oldPartialPhase, newPartialPhase); - break; - } - } -} - -void Synth::newTimbreSet(int partNum, char patchName[]) { - reportHandler->onProgramChanged(partNum, patchName); +void Synth::newTimbreSet(int partNum, Bit8u timbreGroup, const char patchName[]) { + reportHandler->onProgramChanged(partNum, timbreGroup, patchName); } void Synth::printDebug(const char *fmt, ...) { diff --git a/audio/softsynth/mt32/Synth.h b/audio/softsynth/mt32/Synth.h index 56e88e6156..b85e7ae507 100644 --- a/audio/softsynth/mt32/Synth.h +++ b/audio/softsynth/mt32/Synth.h @@ -249,10 +249,10 @@ protected: virtual void onNewReverbMode(Bit8u /* mode */) {} virtual void onNewReverbTime(Bit8u /* time */) {} virtual void onNewReverbLevel(Bit8u /* level */) {} - virtual void onPartStateChanged(int /* partNum */, bool /* isActive */) {} + virtual void onPartStateChanged(int /* partNum */, bool /* hasActiveNonReleasingPolys */) {} virtual void onPolyStateChanged(int /* partNum */) {} virtual void onPartialStateChanged(int /* partialNum */, int /* oldPartialPhase */, int /* newPartialPhase */) {} - virtual void onProgramChanged(int /* partNum */, char * /* patchName */) {} + virtual void onProgramChanged(int /* partNum */, int /* bankNum */, const char * /* patchName */) {} }; class Synth { @@ -370,10 +370,8 @@ private: void printPartialUsage(unsigned long sampleOffset = 0); - void partStateChanged(int partNum, bool isPartActive); void polyStateChanged(int partNum); - void partialStateChanged(const Partial * const partial, int oldPartialPhase, int newPartialPhase); - void newTimbreSet(int partNum, char patchName[]); + void newTimbreSet(int partNum, Bit8u timbreGroup, const char patchName[]); void printDebug(const char *fmt, ...); public: diff --git a/audio/softsynth/mt32/TVA.cpp b/audio/softsynth/mt32/TVA.cpp index 65e5256048..5438471fa4 100644 --- a/audio/softsynth/mt32/TVA.cpp +++ b/audio/softsynth/mt32/TVA.cpp @@ -34,9 +34,6 @@ TVA::TVA(const Partial *usePartial, LA32Ramp *useAmpRamp) : } void TVA::startRamp(Bit8u newTarget, Bit8u newIncrement, int newPhase) { - if (newPhase != phase) { - partial->getSynth()->partialStateChanged(partial, phase, newPhase); - } target = newTarget; phase = newPhase; ampRamp->startRamp(newTarget, newIncrement); @@ -46,9 +43,6 @@ void TVA::startRamp(Bit8u newTarget, Bit8u newIncrement, int newPhase) { } void TVA::end(int newPhase) { - if (newPhase != phase) { - partial->getSynth()->partialStateChanged(partial, phase, newPhase); - } phase = newPhase; playing = false; #if MT32EMU_MONITOR_TVA >= 1 |