Update internal MUNT to version 2.7.0

This commit is contained in:
Alexander Babikov
2022-07-24 07:50:54 +05:00
parent 1bc4ae5337
commit be8784b17c
87 changed files with 3292 additions and 994 deletions

View File

@@ -1,5 +1,5 @@
/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
* Copyright (C) 2011-2020 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
* Copyright (C) 2011-2022 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@@ -59,10 +59,12 @@ Part::Part(Synth *useSynth, unsigned int usePartNum) {
}
currentInstr[0] = 0;
currentInstr[10] = 0;
volumeOverride = 255;
modulation = 0;
expression = 100;
pitchBend = 0;
activePartialCount = 0;
activeNonReleasingPolyCount = 0;
memset(patchCache, 0, sizeof(patchCache));
}
@@ -166,7 +168,7 @@ void Part::refresh() {
patchCache[t].reverb = patchTemp->patch.reverbSwitch > 0;
}
memcpy(currentInstr, timbreTemp->common.name, 10);
synth->newTimbreSet(partNum, patchTemp->patch.timbreGroup, patchTemp->patch.timbreNum, currentInstr);
synth->newTimbreSet(partNum);
updatePitchBenderRange();
}
@@ -317,7 +319,21 @@ void Part::setVolume(unsigned int midiVolume) {
}
Bit8u Part::getVolume() const {
return patchTemp->outputLevel;
return volumeOverride <= 100 ? volumeOverride : patchTemp->outputLevel;
}
void Part::setVolumeOverride(Bit8u volume) {
volumeOverride = volume;
// When volume is 0, we want the part to stop producing any sound at all.
// For that to achieve, we have to actually stop processing NoteOn MIDI messages; merely
// returning 0 volume is not enough - the output may still be generated at a very low level.
// But first, we have to stop all the currently playing polys. This behaviour may also help
// with performance issues, because parts muted this way barely consume CPU resources.
if (volume == 0) allSoundOff();
}
Bit8u Part::getVolumeOverride() const {
return volumeOverride;
}
Bit8u Part::getExpression() const {
@@ -380,6 +396,7 @@ void RhythmPart::noteOn(unsigned int midiKey, unsigned int velocity) {
synth->printDebug("%s: Attempted to play invalid key %d (velocity %d)", name, midiKey, velocity);
return;
}
synth->rhythmNotePlayed();
unsigned int key = midiKey;
unsigned int drumNum = key - 24;
int drumTimbreNum = rhythmTemp[drumNum].timbre;
@@ -609,6 +626,27 @@ void Part::partialDeactivated(Poly *poly) {
}
}
void RhythmPart::polyStateChanged(PolyState, PolyState) {}
void Part::polyStateChanged(PolyState oldState, PolyState newState) {
switch (newState) {
case POLY_Playing:
if (activeNonReleasingPolyCount++ == 0) synth->voicePartStateChanged(partNum, true);
break;
case POLY_Releasing:
case POLY_Inactive:
if (oldState == POLY_Playing || oldState == POLY_Held) {
if (--activeNonReleasingPolyCount == 0) synth->voicePartStateChanged(partNum, false);
}
break;
default:
break;
}
#ifdef MT32EMU_TRACE_POLY_STATE_CHANGES
synth->printDebug("Part %d: Changed poly state %d->%d, activeNonReleasingPolyCount=%d", partNum, oldState, newState, activeNonReleasingPolyCount);
#endif
}
PolyList::PolyList() : firstPoly(NULL), lastPoly(NULL) {}
bool PolyList::isEmpty() const {