diff --git a/soundlib/Sndmix.cpp b/soundlib/Sndmix.cpp index b3561e4cd6..4e4b2d04bf 100644 --- a/soundlib/Sndmix.cpp +++ b/soundlib/Sndmix.cpp @@ -2641,11 +2641,11 @@ void CSoundFile::ProcessMidiOut(CHANNELINDEX nChn) // Check for volume commands uint8 vol = 0xFF; if(chn.rowCommand.volcmd == VOLCMD_VOLUME) - vol = std::min(chn.rowCommand.vol, uint8(64)); + vol = std::min(chn.rowCommand.vol, uint8(64)) * 2u; else if(chn.rowCommand.command == CMD_VOLUME) - vol = std::min(chn.rowCommand.param, uint8(64)); + vol = std::min(chn.rowCommand.param, uint8(64)) * 2u; else if(chn.rowCommand.command == CMD_VOLUME8) - vol = static_cast((chn.rowCommand.param + 3u) / 4u); + vol = static_cast((chn.rowCommand.param + 1u) / 2u); const bool hasVolCommand = (vol != 0xFF); @@ -2659,7 +2659,7 @@ void CSoundFile::ProcessMidiOut(CHANNELINDEX nChn) SendMIDINote(nChn, realNote, static_cast(chn.nVolume)); } else if(hasVolCommand) { - pPlugin->MidiCC(MIDIEvents::MIDICC_Volume_Fine, vol, nChn); + pPlugin->MidiCC(MIDIEvents::MIDICC_Volume_Fine, vol / 2u, nChn); } return; } @@ -2673,7 +2673,7 @@ void CSoundFile::ProcessMidiOut(CHANNELINDEX nChn) switch(pIns->pluginVelocityHandling) { case PLUGIN_VELOCITYHANDLING_CHANNEL: - velocity = chn.nVolume; + velocity = hasVolCommand ? vol * 2 : chn.nVolume; break; default: break; @@ -2701,11 +2701,11 @@ void CSoundFile::ProcessMidiOut(CHANNELINDEX nChn) switch(pIns->pluginVolumeHandling) { case PLUGIN_VOLUMEHANDLING_DRYWET: - if(hasVolCommand) pPlugin->SetDryRatio(1.0f - (2 * vol) / 127.0f); + if(hasVolCommand) pPlugin->SetDryRatio(1.0f - vol / 127.0f); else pPlugin->SetDryRatio(1.0f - (2 * defaultVolume) / 127.0f); break; case PLUGIN_VOLUMEHANDLING_MIDI: - if(hasVolCommand) pPlugin->MidiCC(MIDIEvents::MIDICC_Volume_Coarse, std::min(uint8(127), static_cast(2 * vol)), nChn); + if(hasVolCommand) pPlugin->MidiCC(MIDIEvents::MIDICC_Volume_Coarse, std::min(uint8(127), vol), nChn); else pPlugin->MidiCC(MIDIEvents::MIDICC_Volume_Coarse, static_cast(std::min(uint32(127), static_cast(2 * defaultVolume))), nChn); break; default: