hc
2024-10-12 a5969cabbb4660eab42b6ef0412cbbd1200cf14d
kernel/sound/synth/emux/soundfont.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Soundfont generic routines.
34 * It is intended that these should be used by any driver that is willing
....@@ -5,20 +6,6 @@
56 *
67 * Copyright (C) 1999 Steve Ratcliffe
78 * Copyright (c) 1999-2000 Takashi Iwai <tiwai@suse.de>
8
- *
9
- * This program is free software; you can redistribute it and/or modify
10
- * it under the terms of the GNU General Public License as published by
11
- * the Free Software Foundation; either version 2 of the License, or
12
- * (at your option) any later version.
13
- *
14
- * This program is distributed in the hope that it will be useful,
15
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
- * GNU General Public License for more details.
18
- *
19
- * You should have received a copy of the GNU General Public License
20
- * along with this program; if not, write to the Free Software
21
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
229 */
2310 /*
2411 * Deal with reading in of a soundfont. Code follows the OSS way
....@@ -764,7 +751,7 @@
764751
765752
766753 /* log2_tbl[i] = log2(i+128) * 0x10000 */
767
-static int log_tbl[129] = {
754
+static const int log_tbl[129] = {
768755 0x70000, 0x702df, 0x705b9, 0x7088e, 0x70b5d, 0x70e26, 0x710eb, 0x713aa,
769756 0x71663, 0x71918, 0x71bc8, 0x71e72, 0x72118, 0x723b9, 0x72655, 0x728ed,
770757 0x72b80, 0x72e0e, 0x73098, 0x7331d, 0x7359e, 0x7381b, 0x73a93, 0x73d08,
....@@ -856,6 +843,8 @@
856843 int r, p, t;
857844 r = (3 - ((rate >> 6) & 3)) * 3;
858845 p = rate & 0x3f;
846
+ if (!p)
847
+ p = 1;
859848 t = end - start;
860849 if (t < 0) t = -t;
861850 if (13 > r)
....@@ -868,7 +857,7 @@
868857 /* convert envelope time parameter to soundfont parameters */
869858
870859 /* attack & decay/release time table (msec) */
871
-static short attack_time_tbl[128] = {
860
+static const short attack_time_tbl[128] = {
872861 32767, 32767, 5989, 4235, 2994, 2518, 2117, 1780, 1497, 1373, 1259, 1154, 1058, 970, 890, 816,
873862 707, 691, 662, 634, 607, 581, 557, 533, 510, 489, 468, 448, 429, 411, 393, 377,
874863 361, 345, 331, 317, 303, 290, 278, 266, 255, 244, 234, 224, 214, 205, 196, 188,
....@@ -879,7 +868,7 @@
879868 11, 11, 10, 10, 10, 9, 9, 8, 8, 8, 8, 7, 7, 7, 6, 0,
880869 };
881870
882
-static short decay_time_tbl[128] = {
871
+static const short decay_time_tbl[128] = {
883872 32767, 32767, 22614, 15990, 11307, 9508, 7995, 6723, 5653, 5184, 4754, 4359, 3997, 3665, 3361, 3082,
884873 2828, 2765, 2648, 2535, 2428, 2325, 2226, 2132, 2042, 1955, 1872, 1793, 1717, 1644, 1574, 1507,
885874 1443, 1382, 1324, 1267, 1214, 1162, 1113, 1066, 978, 936, 897, 859, 822, 787, 754, 722,
....@@ -902,7 +891,7 @@
902891
903892 /* search an index for specified time from given time table */
904893 static int
905
-calc_parm_search(int msec, short *table)
894
+calc_parm_search(int msec, const short *table)
906895 {
907896 int left = 1, right = 127, mid;
908897 while (left < right) {