.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * GM/GS/XG midi module. |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (C) 1999 Steve Ratcliffe |
---|
5 | 6 | * |
---|
6 | 7 | * 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 | | - * |
---|
22 | 8 | */ |
---|
23 | 9 | /* |
---|
24 | 10 | * This module is used to keep track of the current midi state. |
---|
.. | .. |
---|
44 | 30 | MODULE_LICENSE("GPL"); |
---|
45 | 31 | |
---|
46 | 32 | /* 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, |
---|
48 | 34 | struct snd_midi_channel *chan, |
---|
49 | 35 | 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, |
---|
51 | 37 | struct snd_midi_channel_set *chset, |
---|
52 | 38 | struct snd_midi_channel *chan, |
---|
53 | 39 | 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, |
---|
55 | 42 | 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, |
---|
57 | 45 | 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, |
---|
59 | 48 | 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, |
---|
61 | 50 | 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, |
---|
63 | 52 | struct snd_midi_channel *chan); |
---|
64 | 53 | static void snd_midi_reset_controllers(struct snd_midi_channel *chan); |
---|
65 | 54 | static void reset_all_channels(struct snd_midi_channel_set *chset); |
---|
.. | .. |
---|
80 | 69 | * be interpreted. |
---|
81 | 70 | */ |
---|
82 | 71 | void |
---|
83 | | -snd_midi_process_event(struct snd_midi_op *ops, |
---|
| 72 | +snd_midi_process_event(const struct snd_midi_op *ops, |
---|
84 | 73 | struct snd_seq_event *ev, |
---|
85 | 74 | struct snd_midi_channel_set *chanset) |
---|
86 | 75 | { |
---|
.. | .. |
---|
243 | 232 | * release note |
---|
244 | 233 | */ |
---|
245 | 234 | 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, |
---|
247 | 237 | int note, int vel) |
---|
248 | 238 | { |
---|
249 | 239 | if (chan->gm_hold) { |
---|
.. | .. |
---|
265 | 255 | * events that need to take place immediately to the driver. |
---|
266 | 256 | */ |
---|
267 | 257 | 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, |
---|
269 | 260 | struct snd_midi_channel *chan, int control, int value) |
---|
270 | 261 | { |
---|
271 | 262 | int i; |
---|
.. | .. |
---|
318 | 309 | break; |
---|
319 | 310 | case MIDI_CTL_MSB_DATA_ENTRY: |
---|
320 | 311 | chan->control[MIDI_CTL_LSB_DATA_ENTRY] = 0; |
---|
321 | | - /* fall through */ |
---|
| 312 | + fallthrough; |
---|
322 | 313 | case MIDI_CTL_LSB_DATA_ENTRY: |
---|
323 | 314 | if (chan->param_type == SNDRV_MIDI_PARAM_TYPE_REGISTERED) |
---|
324 | 315 | rpn(ops, drv, chan, chset); |
---|
.. | .. |
---|
416 | 407 | * Process a rpn message. |
---|
417 | 408 | */ |
---|
418 | 409 | 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, |
---|
420 | 411 | struct snd_midi_channel_set *chset) |
---|
421 | 412 | { |
---|
422 | 413 | int type; |
---|
.. | .. |
---|
456 | 447 | * Process an nrpn message. |
---|
457 | 448 | */ |
---|
458 | 449 | 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, |
---|
460 | 451 | struct snd_midi_channel_set *chset) |
---|
461 | 452 | { |
---|
462 | 453 | /* parse XG NRPNs here if possible */ |
---|
.. | .. |
---|
484 | 475 | * Process a sysex message. |
---|
485 | 476 | */ |
---|
486 | 477 | 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, |
---|
488 | 479 | struct snd_midi_channel_set *chset) |
---|
489 | 480 | { |
---|
490 | 481 | /* GM on */ |
---|
491 | | - static unsigned char gm_on_macro[] = { |
---|
| 482 | + static const unsigned char gm_on_macro[] = { |
---|
492 | 483 | 0x7e,0x7f,0x09,0x01, |
---|
493 | 484 | }; |
---|
494 | 485 | /* XG on */ |
---|
495 | | - static unsigned char xg_on_macro[] = { |
---|
| 486 | + static const unsigned char xg_on_macro[] = { |
---|
496 | 487 | 0x43,0x10,0x4c,0x00,0x00,0x7e,0x00, |
---|
497 | 488 | }; |
---|
498 | 489 | /* GS prefix |
---|
.. | .. |
---|
501 | 492 | * chorus mode: XX=0x01, YY=0x38, ZZ=0-7 |
---|
502 | 493 | * master vol: XX=0x00, YY=0x04, ZZ=0-127 |
---|
503 | 494 | */ |
---|
504 | | - static unsigned char gs_pfx_macro[] = { |
---|
| 495 | + static const unsigned char gs_pfx_macro[] = { |
---|
505 | 496 | 0x41,0x10,0x42,0x12,0x40,/*XX,YY,ZZ*/ |
---|
506 | 497 | }; |
---|
507 | 498 | |
---|
.. | .. |
---|
598 | 589 | * all sound off |
---|
599 | 590 | */ |
---|
600 | 591 | 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) |
---|
602 | 594 | { |
---|
603 | 595 | int n; |
---|
604 | 596 | |
---|
.. | .. |
---|
616 | 608 | * all notes off |
---|
617 | 609 | */ |
---|
618 | 610 | 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) |
---|
620 | 613 | { |
---|
621 | 614 | int n; |
---|
622 | 615 | |
---|