Skip to content

Commit

Permalink
[Fix] Instrument synth: Enable fast volume ramping on various volume …
Browse files Browse the repository at this point in the history
…commands.

git-svn-id: https://source.openmpt.org/svn/openmpt/trunk/OpenMPT@22047 56274372-70c3-4bfc-bfc3-4c3a0b034d27
  • Loading branch information
sagamusix committed Nov 1, 2024
1 parent c9f8b99 commit 0de3761
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions soundlib/InstrumentSynth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,7 @@ bool InstrumentSynth::States::State::EvaluateEvent(const Event &event, PlayState
return false;
case Event::Type::GTK_SetVolume:
m_volumeFactor = event.u16;
chn.dwFlags.set(CHN_FASTVOLRAMP);
return false;
case Event::Type::GTK_SetPitch:
m_gtkPitch = event.u16;
Expand Down Expand Up @@ -637,6 +638,7 @@ bool InstrumentSynth::States::State::EvaluateEvent(const Event &event, PlayState
case Event::Type::Puma_VolumeRamp:
m_ticksRemain = event.Byte2();
m_volumeAdd = static_cast<int16>(event.Byte0() * 256 - 16384);
chn.dwFlags.set(CHN_FASTVOLRAMP);
return true;
case Event::Type::Puma_StopVoice:
chn.nRealVolume = 0;
Expand All @@ -657,6 +659,7 @@ bool InstrumentSynth::States::State::EvaluateEvent(const Event &event, PlayState
case Event::Type::Mupp_SetWaveform:
ChannelSetSample(chn, sndFile, static_cast<SAMPLEINDEX>(32 + event.Byte0() * 28 + event.Byte1()));
m_volumeFactor = static_cast<uint16>(std::min(event.Byte2() & 0x7F, 64) * 256u);
chn.dwFlags.set(CHN_FASTVOLRAMP);
return true;

case Event::Type::MED_DefineArpeggio:
Expand All @@ -683,6 +686,7 @@ bool InstrumentSynth::States::State::EvaluateEvent(const Event &event, PlayState
return false;
case Event::Type::MED_SetVolume:
m_volumeFactor = event.u8 * 256u;
chn.dwFlags.set(CHN_FASTVOLRAMP);
return true;
case Event::Type::MED_SetWaveform:
if(chn.pModInstrument)
Expand Down Expand Up @@ -765,6 +769,7 @@ bool InstrumentSynth::States::State::EvaluateEvent(const Event &event, PlayState
return false;
case Event::Type::FTM_SetVolume:
chn.nGlobalVol = std::min(event.u8, uint8(64));
chn.dwFlags.set(CHN_FASTVOLRAMP);
return false;
case Event::Type::FTM_AddVolume:
chn.nGlobalVol = static_cast<uint8>(std::clamp(chn.nGlobalVol + event.i16, 0, 64));
Expand Down

0 comments on commit 0de3761

Please sign in to comment.