hc
2024-10-12 a5969cabbb4660eab42b6ef0412cbbd1200cf14d
kernel/sound/core/seq/seq_midi_emul.c
....@@ -1,24 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * GM/GS/XG midi module.
34 *
45 * Copyright (C) 1999 Steve Ratcliffe
56 *
67 * Based on awe_wave.c by Takashi Iwai
7
- *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation; either version 2 of the License, or
11
- * (at your option) any later version.
12
- *
13
- * This program is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- * GNU General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU General Public License
19
- * along with this program; if not, write to the Free Software
20
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
- *
228 */
239 /*
2410 * This module is used to keep track of the current midi state.
....@@ -44,22 +30,25 @@
4430 MODULE_LICENSE("GPL");
4531
4632 /* Prototypes for static functions */
47
-static void note_off(struct snd_midi_op *ops, void *drv,
33
+static void note_off(const struct snd_midi_op *ops, void *drv,
4834 struct snd_midi_channel *chan,
4935 int note, int vel);
50
-static void do_control(struct snd_midi_op *ops, void *private,
36
+static void do_control(const struct snd_midi_op *ops, void *private,
5137 struct snd_midi_channel_set *chset,
5238 struct snd_midi_channel *chan,
5339 int control, int value);
54
-static void rpn(struct snd_midi_op *ops, void *drv, struct snd_midi_channel *chan,
40
+static void rpn(const struct snd_midi_op *ops, void *drv,
41
+ struct snd_midi_channel *chan,
5542 struct snd_midi_channel_set *chset);
56
-static void nrpn(struct snd_midi_op *ops, void *drv, struct snd_midi_channel *chan,
43
+static void nrpn(const struct snd_midi_op *ops, void *drv,
44
+ struct snd_midi_channel *chan,
5745 struct snd_midi_channel_set *chset);
58
-static void sysex(struct snd_midi_op *ops, void *private, unsigned char *sysex,
46
+static void sysex(const struct snd_midi_op *ops, void *private,
47
+ unsigned char *sysex,
5948 int len, struct snd_midi_channel_set *chset);
60
-static void all_sounds_off(struct snd_midi_op *ops, void *private,
49
+static void all_sounds_off(const struct snd_midi_op *ops, void *private,
6150 struct snd_midi_channel *chan);
62
-static void all_notes_off(struct snd_midi_op *ops, void *private,
51
+static void all_notes_off(const struct snd_midi_op *ops, void *private,
6352 struct snd_midi_channel *chan);
6453 static void snd_midi_reset_controllers(struct snd_midi_channel *chan);
6554 static void reset_all_channels(struct snd_midi_channel_set *chset);
....@@ -80,7 +69,7 @@
8069 * be interpreted.
8170 */
8271 void
83
-snd_midi_process_event(struct snd_midi_op *ops,
72
+snd_midi_process_event(const struct snd_midi_op *ops,
8473 struct snd_seq_event *ev,
8574 struct snd_midi_channel_set *chanset)
8675 {
....@@ -243,7 +232,8 @@
243232 * release note
244233 */
245234 static void
246
-note_off(struct snd_midi_op *ops, void *drv, struct snd_midi_channel *chan,
235
+note_off(const struct snd_midi_op *ops, void *drv,
236
+ struct snd_midi_channel *chan,
247237 int note, int vel)
248238 {
249239 if (chan->gm_hold) {
....@@ -265,7 +255,8 @@
265255 * events that need to take place immediately to the driver.
266256 */
267257 static void
268
-do_control(struct snd_midi_op *ops, void *drv, struct snd_midi_channel_set *chset,
258
+do_control(const struct snd_midi_op *ops, void *drv,
259
+ struct snd_midi_channel_set *chset,
269260 struct snd_midi_channel *chan, int control, int value)
270261 {
271262 int i;
....@@ -318,7 +309,7 @@
318309 break;
319310 case MIDI_CTL_MSB_DATA_ENTRY:
320311 chan->control[MIDI_CTL_LSB_DATA_ENTRY] = 0;
321
- /* fall through */
312
+ fallthrough;
322313 case MIDI_CTL_LSB_DATA_ENTRY:
323314 if (chan->param_type == SNDRV_MIDI_PARAM_TYPE_REGISTERED)
324315 rpn(ops, drv, chan, chset);
....@@ -416,7 +407,7 @@
416407 * Process a rpn message.
417408 */
418409 static void
419
-rpn(struct snd_midi_op *ops, void *drv, struct snd_midi_channel *chan,
410
+rpn(const struct snd_midi_op *ops, void *drv, struct snd_midi_channel *chan,
420411 struct snd_midi_channel_set *chset)
421412 {
422413 int type;
....@@ -456,7 +447,7 @@
456447 * Process an nrpn message.
457448 */
458449 static void
459
-nrpn(struct snd_midi_op *ops, void *drv, struct snd_midi_channel *chan,
450
+nrpn(const struct snd_midi_op *ops, void *drv, struct snd_midi_channel *chan,
460451 struct snd_midi_channel_set *chset)
461452 {
462453 /* parse XG NRPNs here if possible */
....@@ -484,15 +475,15 @@
484475 * Process a sysex message.
485476 */
486477 static void
487
-sysex(struct snd_midi_op *ops, void *private, unsigned char *buf, int len,
478
+sysex(const struct snd_midi_op *ops, void *private, unsigned char *buf, int len,
488479 struct snd_midi_channel_set *chset)
489480 {
490481 /* GM on */
491
- static unsigned char gm_on_macro[] = {
482
+ static const unsigned char gm_on_macro[] = {
492483 0x7e,0x7f,0x09,0x01,
493484 };
494485 /* XG on */
495
- static unsigned char xg_on_macro[] = {
486
+ static const unsigned char xg_on_macro[] = {
496487 0x43,0x10,0x4c,0x00,0x00,0x7e,0x00,
497488 };
498489 /* GS prefix
....@@ -501,7 +492,7 @@
501492 * chorus mode: XX=0x01, YY=0x38, ZZ=0-7
502493 * master vol: XX=0x00, YY=0x04, ZZ=0-127
503494 */
504
- static unsigned char gs_pfx_macro[] = {
495
+ static const unsigned char gs_pfx_macro[] = {
505496 0x41,0x10,0x42,0x12,0x40,/*XX,YY,ZZ*/
506497 };
507498
....@@ -598,7 +589,8 @@
598589 * all sound off
599590 */
600591 static void
601
-all_sounds_off(struct snd_midi_op *ops, void *drv, struct snd_midi_channel *chan)
592
+all_sounds_off(const struct snd_midi_op *ops, void *drv,
593
+ struct snd_midi_channel *chan)
602594 {
603595 int n;
604596
....@@ -616,7 +608,8 @@
616608 * all notes off
617609 */
618610 static void
619
-all_notes_off(struct snd_midi_op *ops, void *drv, struct snd_midi_channel *chan)
611
+all_notes_off(const struct snd_midi_op *ops, void *drv,
612
+ struct snd_midi_channel *chan)
620613 {
621614 int n;
622615