mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-12-03 17:32:54 +00:00
Fix(?) dBm_pan_volume table
- The missing comma on the first line of dBm_pan_volume's definition looked suspicious, so I checked the MIDI specification at http://www.midi.org/techspecs/rp36.php and found the equations there gave different dB values than were in the table. So I rebuilt it using the equation given there: 20*log (sin (Pi /2* max(0,CC#10 – 1)/126))
This commit is contained in:
parent
268d2faaf6
commit
27bf86e1eb
1 changed files with 36 additions and 28 deletions
|
@ -303,33 +303,39 @@ static float dBm_volume[] = { -999999.999999f, -84.15214884f, -72.11094901f,
|
||||||
-0.5559443807f, -0.4152814317f, -0.2757483179f, -0.1373270335f, 0 };
|
-0.5559443807f, -0.4152814317f, -0.2757483179f, -0.1373270335f, 0 };
|
||||||
|
|
||||||
/* f: As per midi 2 standard */
|
/* f: As per midi 2 standard */
|
||||||
static float dBm_pan_volume[] = { -999999.999999f, -38.15389834f -32.13396282f,
|
static float dBm_pan_volume[127] = {
|
||||||
-28.61324502f, -26.1160207f, -24.179814f, -22.5986259f, -21.26257033f,
|
-999999.999999f, -87.6945020928f, -73.8331126923f, -65.7264009888f,
|
||||||
-20.10605521f, -19.08677237f, -18.17583419f, -17.35263639f, -16.60196565f,
|
-59.9763864074f, -55.5181788833f, -51.8774481743f, -48.8011722841f,
|
||||||
-15.91226889f, -15.2745658f, -14.6817375f, -14.12804519f, -13.60879499f,
|
-46.1383198371f, -43.7914727130f, -41.6941147218f, -39.7988027954f,
|
||||||
-13.12009875f, -12.65869962f, -12.22184237f, -11.80717543f, -11.41267571f,
|
-38.0705069530f, -36.4826252703f, -35.0144798827f, -33.6496789707f,
|
||||||
-11.03659017f, -10.67738981f, -10.33373306f, -10.00443638f, -9.6884504f,
|
-32.3750084716f, -31.1796603753f, -30.0546819321f, -28.9925739783f,
|
||||||
-9.384840381f, -9.092770127f, -8.811488624f, -8.540318866f, -8.278648457f,
|
-27.9869924122f, -27.0325225804f, -26.1245061976f, -25.2589067713f,
|
||||||
-8.025921658f, -7.781632628f, -7.545319633f, -7.316560087f, -7.094966257f,
|
-24.4322036893f, -23.6413079424f, -22.8834943857f, -22.1563467917f,
|
||||||
-6.880181552f, -6.671877289f, -6.46974987f, -6.273518306f, -6.082922045f,
|
-21.4577129008f, -20.7856673630f, -20.1384809653f, -19.5145949062f,
|
||||||
-5.897719045f, -5.717684082f, -5.542607236f, -5.372292553f, -5.206556845f,
|
-18.9125991563f, -18.3312141503f, -17.7692752119f, -17.2257192381f,
|
||||||
-5.045228616f, -4.888147106f, -4.735161423f, -4.586129765f, -4.44091872f,
|
-16.6995732597f, -16.1899445690f, -15.6960121652f, -15.2170193110f,
|
||||||
-4.299402626f, -4.161462998f, -4.026988004f, -3.895871989f, -3.76801504f,
|
-14.7522670314f, -14.3011084168f, -13.8629436112f, -13.4372153915f,
|
||||||
-3.643322591f, -3.52170506f, -3.403077519f, -3.287359388f, -3.174474158f,
|
-13.0234052546f, -12.6210299451f, -12.2296383638f, -11.8488088095f,
|
||||||
-3.064349129f, -2.956915181f, -2.852106549f, -2.749860626f, -2.650117773f,
|
-11.4781465116f, -11.1172814164f, -10.7658661983f, -10.4235744668f,
|
||||||
-2.55282115f, -2.457916557f, -2.36535228f, -2.27507896f, -2.187049463f,
|
-10.0900991491f, -9.7651510261f, -9.4484574055f, -9.1397609172f,
|
||||||
-2.101218759f, -2.017543814f, -1.935983486f,-1.856498429f, -1.779051001f,
|
-8.8388184168f, -8.5453999868f, -8.2592880250f, -7.9802764101f,
|
||||||
-1.703605184f, -1.630126502f, -1.558581949f, -1.48893992f, -1.421170148f,
|
-7.7081697387f, -7.4427826248f, -7.1839390567f, -6.9314718056f,
|
||||||
-1.35524364f, -1.291132623f, -1.228810491f, -1.168251755f, -1.109431992f,
|
-6.6852218807f, -6.4450380272f, -6.2107762624f, -5.9822994468f,
|
||||||
-1.052327808f, -0.9969167902f, -0.9431774708f, -0.8910892898f, -0.8406325604f,
|
-5.7594768878f, -5.5421839719f, -5.3303018237f, -5.1237169899f,
|
||||||
-0.7917884361f, -0.7445388804f, -0.6988666373f, -0.6547552046f, -0.612188808f,
|
-4.9223211445f, -4.7260108155f, -4.5346871303f, -4.3482555779f,
|
||||||
-0.5711523768f, -0.5316315211f, -0.4936125107f, -0.4570822543f, -0.4220282808f,
|
-4.1666257875f, -3.9897113219f, -3.8174294843f, -3.6497011373f,
|
||||||
-0.3884387214f, -0.3563022927f, -0.3256082808f, -0.2963465264f, -0.2685074109f,
|
-3.4864505345f, -3.3276051620f, -3.1730955900f, -3.0228553340f,
|
||||||
-0.2420818435f, -0.2170612483f, -0.1934375538f, -0.1712031815f, -0.1503510361f,
|
-2.8768207245f, -2.7349307844f, -2.5971271143f, -2.4633537845f,
|
||||||
-0.1308744964f, -0.1127674066f, -0.09602406855f, -0.08063923423f,
|
-2.3335572335f, -2.2076861725f, -2.0856914960f, -1.9675261968f,
|
||||||
-0.06660809932f, -0.05392629701f, -0.04258989258f, -0.03259537844f,
|
-1.8531452871f, -1.7425057233f, -1.6355663356f, -1.5322877618f,
|
||||||
-0.02393966977f, -0.01662010072f, -0.01063442111f, -0.005980793601f,
|
-1.4326323846f, -1.3365642732f, -1.2440491272f, -1.1550542250f,
|
||||||
-0.002657791522f, -0.000664397052f, 0 };
|
-1.0695483746f, -0.9875018671f, -0.9088864335f, -0.8336752037f,
|
||||||
|
-0.7618426682f, -0.6933646420f, -0.6282182304f, -0.5663817981f,
|
||||||
|
-0.5078349388f, -0.4525584478f, -0.4005342959f, -0.3517456058f,
|
||||||
|
-0.3061766293f, -0.2638127266f, -0.2246403475f, -0.1886470134f,
|
||||||
|
-0.1558213016f, -0.1261528303f, -0.0996322457f, -0.0762512098f,
|
||||||
|
-0.0560023899f, -0.0388794497f, -0.0248770409f, -0.0139907967f,
|
||||||
|
-0.0062173263f, -0.0015542108f, 0.0000000000f };
|
||||||
|
|
||||||
static unsigned int freq_table[] = { 837201792, 837685632, 838169728,
|
static unsigned int freq_table[] = { 837201792, 837685632, 838169728,
|
||||||
838653568, 839138240, 839623232, 840108480, 840593984, 841079680,
|
838653568, 839138240, 839623232, 840108480, 840593984, 841079680,
|
||||||
|
@ -1438,8 +1444,10 @@ void _WM_AdjustNoteVolumes(struct _mdi *mdi, unsigned char ch, struct _note *nte
|
||||||
#define VOL_DIVISOR 4.0
|
#define VOL_DIVISOR 4.0
|
||||||
volume_adj = ((float)WM_MasterVolume / 1024.0) / VOL_DIVISOR;
|
volume_adj = ((float)WM_MasterVolume / 1024.0) / VOL_DIVISOR;
|
||||||
|
|
||||||
|
// Pan 0 and 1 are both hard left so 64 can be centered
|
||||||
if (pan_ofs > 127) pan_ofs = 127;
|
if (pan_ofs > 127) pan_ofs = 127;
|
||||||
premix_dBm_left = dBm_pan_volume[(127-pan_ofs)];
|
if (--pan_ofs < 0) pan_ofs = 0;
|
||||||
|
premix_dBm_left = dBm_pan_volume[126-pan_ofs];
|
||||||
premix_dBm_right = dBm_pan_volume[pan_ofs];
|
premix_dBm_right = dBm_pan_volume[pan_ofs];
|
||||||
|
|
||||||
if (mdi->info.mixer_options & WM_MO_LOG_VOLUME) {
|
if (mdi->info.mixer_options & WM_MO_LOG_VOLUME) {
|
||||||
|
|
Loading…
Reference in a new issue