diff options
author | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2024-04-22 11:07:43 +0000 |
---|---|---|
committer | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2024-04-22 11:07:43 +0000 |
commit | 674752453e07518bd19f3aa8b67131b0e2665973 (patch) | |
tree | f77748cf337c4f9d1dd6bb8e7e7e4e9ca152c2e9 /usr.bin/sndiod | |
parent | c3187db65945cea908fd12a79b6f4d50dc22952f (diff) |
sndiod: Use a 24-bit table for index to volume conversion.
Diffstat (limited to 'usr.bin/sndiod')
-rw-r--r-- | usr.bin/sndiod/dsp.c | 51 | ||||
-rw-r--r-- | usr.bin/sndiod/dsp.h | 4 |
2 files changed, 35 insertions, 20 deletions
diff --git a/usr.bin/sndiod/dsp.c b/usr.bin/sndiod/dsp.c index 57085b8dbbc..f3420d151cd 100644 --- a/usr.bin/sndiod/dsp.c +++ b/usr.bin/sndiod/dsp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dsp.c,v 1.19 2024/04/22 11:01:02 ratchov Exp $ */ +/* $OpenBSD: dsp.c,v 1.20 2024/04/22 11:07:42 ratchov Exp $ */ /* * Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org> * @@ -19,23 +19,38 @@ #include "utils.h" const int aparams_ctltovol[128] = { - 0, - 256, 266, 276, 287, 299, 310, 323, 335, - 348, 362, 376, 391, 406, 422, 439, 456, - 474, 493, 512, 532, 553, 575, 597, 621, - 645, 670, 697, 724, 753, 782, 813, 845, - 878, 912, 948, 985, 1024, 1064, 1106, 1149, - 1195, 1241, 1290, 1341, 1393, 1448, 1505, 1564, - 1625, 1689, 1756, 1825, 1896, 1971, 2048, 2128, - 2212, 2299, 2389, 2483, 2580, 2682, 2787, 2896, - 3010, 3128, 3251, 3379, 3511, 3649, 3792, 3941, - 4096, 4257, 4424, 4598, 4778, 4966, 5161, 5363, - 5574, 5793, 6020, 6256, 6502, 6757, 7023, 7298, - 7585, 7883, 8192, 8514, 8848, 9195, 9556, 9931, - 10321, 10726, 11148, 11585, 12040, 12513, 13004, 13515, - 14045, 14596, 15170, 15765, 16384, 17027, 17696, 18390, - 19112, 19863, 20643, 21453, 22295, 23170, 24080, 25025, - 26008, 27029, 28090, 29193, 30339, 31530, 32768 + 0, 65536, 68109, 70783, + 73562, 76450, 79451, 82570, + 85812, 89181, 92682, 96321, + 100102, 104032, 108116, 112361, + 116772, 121356, 126121, 131072, + 136218, 141566, 147123, 152899, + 158902, 165140, 171624, 178361, + 185364, 192641, 200204, 208064, + 216232, 224721, 233544, 242713, + 252241, 262144, 272436, 283131, + 294247, 305799, 317804, 330281, + 343247, 356723, 370728, 385282, + 400408, 416128, 432465, 449443, + 467088, 485425, 504482, 524288, + 544871, 566262, 588493, 611597, + 635608, 660561, 686495, 713446, + 741455, 770564, 800816, 832255, + 864929, 898885, 934175, 970850, + 1008965, 1048576, 1089742, 1132525, + 1176987, 1223194, 1271216, 1321123, + 1372989, 1426892, 1482910, 1541128, + 1601632, 1664511, 1729858, 1797771, + 1868350, 1941700, 2017930, 2097152, + 2179485, 2265049, 2353974, 2446389, + 2542432, 2642246, 2745978, 2853783, + 2965821, 3082257, 3203264, 3329021, + 3459716, 3595542, 3736700, 3883400, + 4035859, 4194304, 4358969, 4530099, + 4707947, 4892777, 5084864, 5284492, + 5491957, 5707567, 5931642, 6164513, + 6406527, 6658043, 6919432, 7191084, + 7473400, 7766800, 8071719, 8388608 }; const int resamp_filt[RESAMP_LENGTH / RESAMP_STEP + 1] = { diff --git a/usr.bin/sndiod/dsp.h b/usr.bin/sndiod/dsp.h index 69e1b7a63ba..d4f96a3cbae 100644 --- a/usr.bin/sndiod/dsp.h +++ b/usr.bin/sndiod/dsp.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dsp.h,v 1.13 2024/04/22 11:01:02 ratchov Exp $ */ +/* $OpenBSD: dsp.h,v 1.14 2024/04/22 11:07:42 ratchov Exp $ */ /* * Copyright (c) 2012 Alexandre Ratchov <alex@caoua.org> * @@ -107,7 +107,7 @@ struct cmap { int nch; }; -#define MIDI_TO_ADATA(m) (aparams_ctltovol[m] << (ADATA_BITS - 16)) +#define MIDI_TO_ADATA(m) (aparams_ctltovol[m]) extern const int aparams_ctltovol[128]; void aparams_init(struct aparams *); |