aboutsummaryrefslogtreecommitdiff
path: root/src/adlmidi_midiplay.cpp
diff options
context:
space:
mode:
authorJP Cimalando <jpcima@users.noreply.github.com>2018-06-22 19:08:17 +0200
committerJP Cimalando <jpcima@users.noreply.github.com>2018-06-22 19:08:17 +0200
commit2e88f9b9303ce1b9ef5512d6b84b3bb190dbfe75 (patch)
tree6d0a28dbb4eacc94245969076fc105b61e57a998 /src/adlmidi_midiplay.cpp
parentfaaab13482d1e8334712232b7f64a59ec8ae6f07 (diff)
downloadlibADLMIDI-2e88f9b9303ce1b9ef5512d6b84b3bb190dbfe75.tar.gz
libADLMIDI-2e88f9b9303ce1b9ef5512d6b84b3bb190dbfe75.tar.bz2
libADLMIDI-2e88f9b9303ce1b9ef5512d6b84b3bb190dbfe75.zip
simplify the volume formula
Diffstat (limited to 'src/adlmidi_midiplay.cpp')
-rw-r--r--src/adlmidi_midiplay.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/adlmidi_midiplay.cpp b/src/adlmidi_midiplay.cpp
index a6fc2a5..5637da4 100644
--- a/src/adlmidi_midiplay.cpp
+++ b/src/adlmidi_midiplay.cpp
@@ -1046,7 +1046,7 @@ void MIDIplay::NoteUpdate(uint16_t MidCh,
//volume = (int)(volume * std::sqrt( (double) ch[c].users.size() ));
// The formula below: SOLVE(V=127^4 * 2^( (A-63.49999) / 8), A)
- volume = volume > (8725 * 127) ? static_cast<uint32_t>(std::log(static_cast<double>(volume) * (1.0 / 127.0)) * 11.541561 + (0.5 - 104.22845)) : 0;
+ volume = volume > (8725 * 127) ? static_cast<uint32_t>(std::log(static_cast<double>(volume)) * 11.541560327111707 - 1.601379199767093e+02) : 0;
// The incorrect formula below: SOLVE(V=127^4 * (2^(A/63)-1), A)
//opl.Touch_Real(c, volume>(11210*127) ? 91.61112 * std::log((4.8819E-7/127)*volume + 1.0)+0.5 : 0);