Skip to content

Commit 55a6921

Browse files
committed
ALSA: emux: More constifications
Apply const prefix to each possible place: the MIDI data definitions, the static tables for volume parameters, etc. Just for minor optimization and no functional changes. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 1e393ef commit 55a6921

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

sound/synth/emux/emux_nrpn.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ static int send_converted_effect(const struct nrpn_conv_table *table,
6363
/* effect sensitivities for GS NRPN:
6464
* adjusted for chaos 8MB soundfonts
6565
*/
66-
static int gs_sense[] =
66+
static const int gs_sense[] =
6767
{
6868
DEF_FX_CUTOFF, DEF_FX_RESONANCE, DEF_FX_ATTACK, DEF_FX_RELEASE,
6969
DEF_FX_VIBRATE, DEF_FX_VIBDEPTH, DEF_FX_VIBDELAY
@@ -72,7 +72,7 @@ static int gs_sense[] =
7272
/* effect sensitivies for XG controls:
7373
* adjusted for chaos 8MB soundfonts
7474
*/
75-
static int xg_sense[] =
75+
static const int xg_sense[] =
7676
{
7777
DEF_FX_CUTOFF, DEF_FX_RESONANCE, DEF_FX_ATTACK, DEF_FX_RELEASE,
7878
DEF_FX_VIBRATE, DEF_FX_VIBDEPTH, DEF_FX_VIBDELAY

sound/synth/emux/emux_synth.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ update_voice(struct snd_emux *emu, struct snd_emux_voice *vp, int update)
529529

530530
#if 0 // not used
531531
/* table for volume target calculation */
532-
static unsigned short voltarget[16] = {
532+
static const unsigned short voltarget[16] = {
533533
0xEAC0, 0xE0C8, 0xD740, 0xCE20, 0xC560, 0xBD08, 0xB500, 0xAD58,
534534
0xA5F8, 0x9EF0, 0x9830, 0x91C0, 0x8B90, 0x85A8, 0x8000, 0x7A90
535535
};
@@ -616,7 +616,7 @@ setup_voice(struct snd_emux_voice *vp)
616616
/*
617617
* calculate pitch parameter
618618
*/
619-
static unsigned char pan_volumes[256] = {
619+
static const unsigned char pan_volumes[256] = {
620620
0x00,0x03,0x06,0x09,0x0c,0x0f,0x12,0x14,0x17,0x1a,0x1d,0x20,0x22,0x25,0x28,0x2a,
621621
0x2d,0x30,0x32,0x35,0x37,0x3a,0x3c,0x3f,0x41,0x44,0x46,0x49,0x4b,0x4d,0x50,0x52,
622622
0x54,0x57,0x59,0x5b,0x5d,0x60,0x62,0x64,0x66,0x68,0x6a,0x6c,0x6f,0x71,0x73,0x75,
@@ -684,7 +684,7 @@ calc_pan(struct snd_emux_voice *vp)
684684
*/
685685

686686
/* tables for volume->attenuation calculation */
687-
static unsigned char voltab1[128] = {
687+
static const unsigned char voltab1[128] = {
688688
0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63,
689689
0x63, 0x2b, 0x29, 0x28, 0x27, 0x26, 0x25, 0x24, 0x23, 0x22,
690690
0x21, 0x20, 0x1f, 0x1e, 0x1e, 0x1d, 0x1c, 0x1b, 0x1b, 0x1a,
@@ -700,7 +700,7 @@ static unsigned char voltab1[128] = {
700700
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
701701
};
702702

703-
static unsigned char voltab2[128] = {
703+
static const unsigned char voltab2[128] = {
704704
0x32, 0x31, 0x30, 0x2f, 0x2e, 0x2d, 0x2c, 0x2b, 0x2a, 0x2a,
705705
0x29, 0x28, 0x27, 0x26, 0x25, 0x24, 0x24, 0x23, 0x22, 0x21,
706706
0x21, 0x20, 0x1f, 0x1e, 0x1e, 0x1d, 0x1c, 0x1c, 0x1b, 0x1a,
@@ -716,7 +716,7 @@ static unsigned char voltab2[128] = {
716716
0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00
717717
};
718718

719-
static unsigned char expressiontab[128] = {
719+
static const unsigned char expressiontab[128] = {
720720
0x7f, 0x6c, 0x62, 0x5a, 0x54, 0x50, 0x4b, 0x48, 0x45, 0x42,
721721
0x40, 0x3d, 0x3b, 0x39, 0x38, 0x36, 0x34, 0x33, 0x31, 0x30,
722722
0x2f, 0x2d, 0x2c, 0x2b, 0x2a, 0x29, 0x28, 0x27, 0x26, 0x25,

sound/synth/emux/soundfont.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ load_data(struct snd_sf_list *sflist, const void __user *data, long count)
751751

752752

753753
/* log2_tbl[i] = log2(i+128) * 0x10000 */
754-
static int log_tbl[129] = {
754+
static const int log_tbl[129] = {
755755
0x70000, 0x702df, 0x705b9, 0x7088e, 0x70b5d, 0x70e26, 0x710eb, 0x713aa,
756756
0x71663, 0x71918, 0x71bc8, 0x71e72, 0x72118, 0x723b9, 0x72655, 0x728ed,
757757
0x72b80, 0x72e0e, 0x73098, 0x7331d, 0x7359e, 0x7381b, 0x73a93, 0x73d08,
@@ -857,7 +857,7 @@ calc_gus_envelope_time(int rate, int start, int end)
857857
/* convert envelope time parameter to soundfont parameters */
858858

859859
/* attack & decay/release time table (msec) */
860-
static short attack_time_tbl[128] = {
860+
static const short attack_time_tbl[128] = {
861861
32767, 32767, 5989, 4235, 2994, 2518, 2117, 1780, 1497, 1373, 1259, 1154, 1058, 970, 890, 816,
862862
707, 691, 662, 634, 607, 581, 557, 533, 510, 489, 468, 448, 429, 411, 393, 377,
863863
361, 345, 331, 317, 303, 290, 278, 266, 255, 244, 234, 224, 214, 205, 196, 188,
@@ -868,7 +868,7 @@ static short attack_time_tbl[128] = {
868868
11, 11, 10, 10, 10, 9, 9, 8, 8, 8, 8, 7, 7, 7, 6, 0,
869869
};
870870

871-
static short decay_time_tbl[128] = {
871+
static const short decay_time_tbl[128] = {
872872
32767, 32767, 22614, 15990, 11307, 9508, 7995, 6723, 5653, 5184, 4754, 4359, 3997, 3665, 3361, 3082,
873873
2828, 2765, 2648, 2535, 2428, 2325, 2226, 2132, 2042, 1955, 1872, 1793, 1717, 1644, 1574, 1507,
874874
1443, 1382, 1324, 1267, 1214, 1162, 1113, 1066, 978, 936, 897, 859, 822, 787, 754, 722,
@@ -891,7 +891,7 @@ snd_sf_calc_parm_hold(int msec)
891891

892892
/* search an index for specified time from given time table */
893893
static int
894-
calc_parm_search(int msec, short *table)
894+
calc_parm_search(int msec, const short *table)
895895
{
896896
int left = 1, right = 127, mid;
897897
while (left < right) {

0 commit comments

Comments
 (0)