From: Takashi Iwai <tiwai@suse.de> To: alsa-devel@alsa-project.org Subject: [alsa-devel] [PATCH 21/68] ALSA: emux: More constifications Date: Sun, 5 Jan 2020 15:47:36 +0100 Message-ID: <20200105144823.29547-22-tiwai@suse.de> (raw) In-Reply-To: <20200105144823.29547-1-tiwai@suse.de> 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. Signed-off-by: Takashi Iwai <tiwai@suse.de> --- sound/synth/emux/emux_nrpn.c | 4 ++-- sound/synth/emux/emux_synth.c | 10 +++++----- sound/synth/emux/soundfont.c | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/sound/synth/emux/emux_nrpn.c b/sound/synth/emux/emux_nrpn.c index 1ac22676d464..7eed5791972c 100644 --- a/sound/synth/emux/emux_nrpn.c +++ b/sound/synth/emux/emux_nrpn.c @@ -63,7 +63,7 @@ static int send_converted_effect(const struct nrpn_conv_table *table, /* effect sensitivities for GS NRPN: * adjusted for chaos 8MB soundfonts */ -static int gs_sense[] = +static const int gs_sense[] = { DEF_FX_CUTOFF, DEF_FX_RESONANCE, DEF_FX_ATTACK, DEF_FX_RELEASE, DEF_FX_VIBRATE, DEF_FX_VIBDEPTH, DEF_FX_VIBDELAY @@ -72,7 +72,7 @@ static int gs_sense[] = /* effect sensitivies for XG controls: * adjusted for chaos 8MB soundfonts */ -static int xg_sense[] = +static const int xg_sense[] = { DEF_FX_CUTOFF, DEF_FX_RESONANCE, DEF_FX_ATTACK, DEF_FX_RELEASE, DEF_FX_VIBRATE, DEF_FX_VIBDEPTH, DEF_FX_VIBDELAY diff --git a/sound/synth/emux/emux_synth.c b/sound/synth/emux/emux_synth.c index 7c9eecd4d14e..a5385efcedb6 100644 --- a/sound/synth/emux/emux_synth.c +++ b/sound/synth/emux/emux_synth.c @@ -529,7 +529,7 @@ update_voice(struct snd_emux *emu, struct snd_emux_voice *vp, int update) #if 0 // not used /* table for volume target calculation */ -static unsigned short voltarget[16] = { +static const unsigned short voltarget[16] = { 0xEAC0, 0xE0C8, 0xD740, 0xCE20, 0xC560, 0xBD08, 0xB500, 0xAD58, 0xA5F8, 0x9EF0, 0x9830, 0x91C0, 0x8B90, 0x85A8, 0x8000, 0x7A90 }; @@ -616,7 +616,7 @@ setup_voice(struct snd_emux_voice *vp) /* * calculate pitch parameter */ -static unsigned char pan_volumes[256] = { +static const unsigned char pan_volumes[256] = { 0x00,0x03,0x06,0x09,0x0c,0x0f,0x12,0x14,0x17,0x1a,0x1d,0x20,0x22,0x25,0x28,0x2a, 0x2d,0x30,0x32,0x35,0x37,0x3a,0x3c,0x3f,0x41,0x44,0x46,0x49,0x4b,0x4d,0x50,0x52, 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) */ /* tables for volume->attenuation calculation */ -static unsigned char voltab1[128] = { +static const unsigned char voltab1[128] = { 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x2b, 0x29, 0x28, 0x27, 0x26, 0x25, 0x24, 0x23, 0x22, 0x21, 0x20, 0x1f, 0x1e, 0x1e, 0x1d, 0x1c, 0x1b, 0x1b, 0x1a, @@ -700,7 +700,7 @@ static unsigned char voltab1[128] = { 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static unsigned char voltab2[128] = { +static const unsigned char voltab2[128] = { 0x32, 0x31, 0x30, 0x2f, 0x2e, 0x2d, 0x2c, 0x2b, 0x2a, 0x2a, 0x29, 0x28, 0x27, 0x26, 0x25, 0x24, 0x24, 0x23, 0x22, 0x21, 0x21, 0x20, 0x1f, 0x1e, 0x1e, 0x1d, 0x1c, 0x1c, 0x1b, 0x1a, @@ -716,7 +716,7 @@ static unsigned char voltab2[128] = { 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static unsigned char expressiontab[128] = { +static const unsigned char expressiontab[128] = { 0x7f, 0x6c, 0x62, 0x5a, 0x54, 0x50, 0x4b, 0x48, 0x45, 0x42, 0x40, 0x3d, 0x3b, 0x39, 0x38, 0x36, 0x34, 0x33, 0x31, 0x30, 0x2f, 0x2d, 0x2c, 0x2b, 0x2a, 0x29, 0x28, 0x27, 0x26, 0x25, diff --git a/sound/synth/emux/soundfont.c b/sound/synth/emux/soundfont.c index dcc6a925a03e..9ebc711afa6b 100644 --- a/sound/synth/emux/soundfont.c +++ b/sound/synth/emux/soundfont.c @@ -751,7 +751,7 @@ load_data(struct snd_sf_list *sflist, const void __user *data, long count) /* log2_tbl[i] = log2(i+128) * 0x10000 */ -static int log_tbl[129] = { +static const int log_tbl[129] = { 0x70000, 0x702df, 0x705b9, 0x7088e, 0x70b5d, 0x70e26, 0x710eb, 0x713aa, 0x71663, 0x71918, 0x71bc8, 0x71e72, 0x72118, 0x723b9, 0x72655, 0x728ed, 0x72b80, 0x72e0e, 0x73098, 0x7331d, 0x7359e, 0x7381b, 0x73a93, 0x73d08, @@ -857,7 +857,7 @@ calc_gus_envelope_time(int rate, int start, int end) /* convert envelope time parameter to soundfont parameters */ /* attack & decay/release time table (msec) */ -static short attack_time_tbl[128] = { +static const short attack_time_tbl[128] = { 32767, 32767, 5989, 4235, 2994, 2518, 2117, 1780, 1497, 1373, 1259, 1154, 1058, 970, 890, 816, 707, 691, 662, 634, 607, 581, 557, 533, 510, 489, 468, 448, 429, 411, 393, 377, 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] = { 11, 11, 10, 10, 10, 9, 9, 8, 8, 8, 8, 7, 7, 7, 6, 0, }; -static short decay_time_tbl[128] = { +static const short decay_time_tbl[128] = { 32767, 32767, 22614, 15990, 11307, 9508, 7995, 6723, 5653, 5184, 4754, 4359, 3997, 3665, 3361, 3082, 2828, 2765, 2648, 2535, 2428, 2325, 2226, 2132, 2042, 1955, 1872, 1793, 1717, 1644, 1574, 1507, 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) /* search an index for specified time from given time table */ static int -calc_parm_search(int msec, short *table) +calc_parm_search(int msec, const short *table) { int left = 1, right = 127, mid; while (left < right) { -- 2.16.4 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
next prev parent reply index Thread overview: 69+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-01-05 14:47 [alsa-devel] [PATCH 00/68] ALSA: Constifications, take #2 Takashi Iwai 2020-01-05 14:47 ` [alsa-devel] [PATCH 01/68] ALSA: Allow const arrays for legacy resource management helpers Takashi Iwai 2020-01-05 14:47 ` [alsa-devel] [PATCH 02/68] ALSA: aoa: More constifications Takashi Iwai 2020-01-05 14:47 ` [alsa-devel] [PATCH 03/68] ALSA: hda/realtek - " Takashi Iwai 2020-01-05 14:47 ` [alsa-devel] [PATCH 04/68] ALSA: dummy: " Takashi Iwai 2020-01-05 14:47 ` [alsa-devel] [PATCH 05/68] ALSA: pcm: " Takashi Iwai 2020-01-05 14:47 ` [alsa-devel] [PATCH 06/68] ALSA: seq: " Takashi Iwai 2020-01-05 14:47 ` [alsa-devel] [PATCH 07/68] ALSA: vx: " Takashi Iwai 2020-01-05 14:47 ` [alsa-devel] [PATCH 08/68] ALSA: intel8x0: " Takashi Iwai 2020-01-05 14:47 ` [alsa-devel] [PATCH 09/68] ALSA: hda: " Takashi Iwai 2020-01-05 14:47 ` [alsa-devel] [PATCH 10/68] ALSA: ac97: " Takashi Iwai 2020-01-05 14:47 ` [alsa-devel] [PATCH 11/68] ALSA: usb-audio: " Takashi Iwai 2020-01-05 14:47 ` [alsa-devel] [PATCH 12/68] ALSA: caiaq: " Takashi Iwai 2020-01-05 14:47 ` [alsa-devel] [PATCH 13/68] ALSA: au88x0: " Takashi Iwai 2020-01-05 14:47 ` [alsa-devel] [PATCH 14/68] ALSA: emu10k1: " Takashi Iwai 2020-01-05 14:47 ` [alsa-devel] [PATCH 15/68] ALSA: riptide: " Takashi Iwai 2020-01-05 14:47 ` [alsa-devel] [PATCH 16/68] ALSA: ice1712: " Takashi Iwai 2020-01-05 14:47 ` [alsa-devel] [PATCH 17/68] ALSA: ppc: " Takashi Iwai 2020-01-05 14:47 ` [alsa-devel] [PATCH 18/68] ALSA: hdsp: " Takashi Iwai 2020-01-05 14:47 ` [alsa-devel] [PATCH 19/68] ALSA: hdspm: " Takashi Iwai 2020-01-05 14:47 ` [alsa-devel] [PATCH 20/68] ALSA: rme9652: " Takashi Iwai 2020-01-05 14:47 ` Takashi Iwai [this message] 2020-01-05 14:47 ` [alsa-devel] [PATCH 22/68] ALSA: usx2y: " Takashi Iwai 2020-01-05 14:47 ` [alsa-devel] [PATCH 23/68] ALSA: pcxhr: " Takashi Iwai 2020-01-05 14:47 ` [alsa-devel] [PATCH 24/68] ALSA: mixart: " Takashi Iwai 2020-01-05 14:47 ` [alsa-devel] [PATCH 25/68] ALSA: ymfpci: " Takashi Iwai 2020-01-05 14:47 ` [alsa-devel] [PATCH 26/68] ALSA: bcd2000: " Takashi Iwai 2020-01-05 14:47 ` [alsa-devel] [PATCH 27/68] ALSA: nm256: " Takashi Iwai 2020-01-05 14:47 ` [alsa-devel] [PATCH 28/68] ALSA: korg1212: " Takashi Iwai 2020-01-05 14:47 ` [alsa-devel] [PATCH 29/68] ALSA: cs46xx: " Takashi Iwai 2020-01-05 14:47 ` [alsa-devel] [PATCH 30/68] ALSA: ca0106: " Takashi Iwai 2020-01-05 14:47 ` [alsa-devel] [PATCH 31/68] ALSA: ctxfi: " Takashi Iwai 2020-01-05 14:47 ` [alsa-devel] [PATCH 32/68] ALSA: asihpi: " Takashi Iwai 2020-01-05 14:47 ` [alsa-devel] [PATCH 33/68] ALSA: atiixp: " Takashi Iwai 2020-01-05 14:47 ` [alsa-devel] [PATCH 34/68] ALSA: es1938: " Takashi Iwai 2020-01-05 14:47 ` [alsa-devel] [PATCH 35/68] ALSA: es1968: " Takashi Iwai 2020-01-05 14:47 ` [alsa-devel] [PATCH 36/68] ALSA: cmipci: " Takashi Iwai 2020-01-05 14:47 ` [alsa-devel] [PATCH 37/68] ALSA: sparc: " Takashi Iwai 2020-01-05 14:47 ` [alsa-devel] [PATCH 38/68] ALSA: info: " Takashi Iwai 2020-01-05 14:47 ` [alsa-devel] [PATCH 39/68] ALSA: jack: More constification Takashi Iwai 2020-01-05 14:47 ` [alsa-devel] [PATCH 40/68] ALSA: oss: More constifications Takashi Iwai 2020-01-05 14:47 ` [alsa-devel] [PATCH 41/68] ALSA: rawmidi: More constification Takashi Iwai 2020-01-05 14:47 ` [alsa-devel] [PATCH 42/68] ALSA: opl3: More constifications Takashi Iwai 2020-01-05 14:47 ` [alsa-devel] [PATCH 43/68] ALSA: cmi8328: " Takashi Iwai 2020-01-05 14:47 ` [alsa-devel] [PATCH 44/68] ALSA: cs423x: More constification Takashi Iwai 2020-01-05 14:48 ` [alsa-devel] [PATCH 45/68] ALSA: sb: More constifications Takashi Iwai 2020-01-05 14:48 ` [alsa-devel] [PATCH 46/68] ALSA: cmi8330: " Takashi Iwai 2020-01-05 14:48 ` [alsa-devel] [PATCH 47/68] ALSA: es1688: " Takashi Iwai 2020-01-05 14:48 ` [alsa-devel] [PATCH 48/68] ALSA: es18xx: " Takashi Iwai 2020-01-05 14:48 ` [alsa-devel] [PATCH 49/68] ALSA: gus: " Takashi Iwai 2020-01-05 14:48 ` [alsa-devel] [PATCH 50/68] ALSA: opti9xx: " Takashi Iwai 2020-01-05 14:48 ` [alsa-devel] [PATCH 51/68] ALSA: wss: " Takashi Iwai 2020-01-05 14:48 ` [alsa-devel] [PATCH 52/68] ALSA: sc6000: More constification Takashi Iwai 2020-01-05 14:48 ` [alsa-devel] [PATCH 53/68] ALSA: mts64: More constifications Takashi Iwai 2020-01-05 14:48 ` [alsa-devel] [PATCH 54/68] ALSA: aw2: " Takashi Iwai 2020-01-05 14:48 ` [alsa-devel] [PATCH 55/68] ALSA: lx6464es: " Takashi Iwai 2020-01-05 14:48 ` [alsa-devel] [PATCH 56/68] ALSA: arm: More constification Takashi Iwai 2020-01-05 14:48 ` [alsa-devel] [PATCH 57/68] ALSA: opl4: " Takashi Iwai 2020-01-05 14:48 ` [alsa-devel] [PATCH 58/68] ALSA: serial-u16550: " Takashi Iwai 2020-01-05 14:48 ` [alsa-devel] [PATCH 59/68] ALSA: ak4531: " Takashi Iwai 2020-01-05 14:48 ` [alsa-devel] [PATCH 60/68] ALSA: azt3328: " Takashi Iwai 2020-01-05 14:48 ` [alsa-devel] [PATCH 61/68] ALSA: cs4281: " Takashi Iwai 2020-01-05 14:48 ` [alsa-devel] [PATCH 62/68] ALSA: echoaudio: " Takashi Iwai 2020-01-05 14:48 ` [alsa-devel] [PATCH 63/68] ALSA: ens137x: " Takashi Iwai 2020-01-05 14:48 ` [alsa-devel] [PATCH 64/68] ALSA: fm801: " Takashi Iwai 2020-01-05 14:48 ` [alsa-devel] [PATCH 65/68] ALSA: via82xx: " Takashi Iwai 2020-01-05 14:48 ` [alsa-devel] [PATCH 66/68] ALSA: pdaudiocf: " Takashi Iwai 2020-01-05 14:48 ` [alsa-devel] [PATCH 67/68] ALSA: spi: " Takashi Iwai 2020-01-05 14:48 ` [alsa-devel] [PATCH 68/68] ALSA: sh: Fix compile warning wrt const Takashi Iwai
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200105144823.29547-22-tiwai@suse.de \ --to=tiwai@suse.de \ --cc=alsa-devel@alsa-project.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Alsa-Devel Archive on lore.kernel.org Archives are clonable: git clone --mirror https://lore.kernel.org/alsa-devel/0 alsa-devel/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 alsa-devel alsa-devel/ https://lore.kernel.org/alsa-devel \ alsa-devel@alsa-project.org public-inbox-index alsa-devel Example config snippet for mirrors Newsgroup available over NNTP: nntp://nntp.lore.kernel.org/org.alsa-project.alsa-devel AGPL code for this site: git clone https://public-inbox.org/public-inbox.git