| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (c) by Uros Bizjak <uros@kss-loka.si> |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * OPL2/OPL3/OPL4 FM routines for internal percussion channels |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 8 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 9 | | - * (at your option) any later version. |
|---|
| 10 | | - * |
|---|
| 11 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 12 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | | - * GNU General Public License for more details. |
|---|
| 15 | | - * |
|---|
| 16 | | - * You should have received a copy of the GNU General Public License |
|---|
| 17 | | - * along with this program; if not, write to the Free Software |
|---|
| 18 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 19 | | - * |
|---|
| 20 | 6 | */ |
|---|
| 21 | 7 | |
|---|
| 22 | 8 | #include "opl3_voice.h" |
|---|
| 23 | 9 | |
|---|
| 24 | | -static char snd_opl3_drum_table[47] = |
|---|
| 10 | +static const char snd_opl3_drum_table[47] = |
|---|
| 25 | 11 | { |
|---|
| 26 | 12 | OPL3_BASSDRUM_ON, OPL3_BASSDRUM_ON, OPL3_HIHAT_ON, /* 35 - 37 */ |
|---|
| 27 | 13 | OPL3_SNAREDRUM_ON, OPL3_HIHAT_ON, OPL3_SNAREDRUM_ON, /* 38 - 40 */ |
|---|
| .. | .. |
|---|
| 61 | 47 | unsigned char feedback_connection; |
|---|
| 62 | 48 | }; |
|---|
| 63 | 49 | |
|---|
| 64 | | -static struct snd_opl3_drum_voice bass_op0 = {6, 0, 0x00, 0x32, 0xf8, 0x66, 0x30, 0x00}; |
|---|
| 65 | | -static struct snd_opl3_drum_voice bass_op1 = {6, 1, 0x00, 0x03, 0xf6, 0x57, 0x30, 0x00}; |
|---|
| 66 | | -static struct snd_opl3_drum_note bass_note = {6, 0x90, 0x09}; |
|---|
| 50 | +static const struct snd_opl3_drum_voice bass_op0 = {6, 0, 0x00, 0x32, 0xf8, 0x66, 0x30, 0x00}; |
|---|
| 51 | +static const struct snd_opl3_drum_voice bass_op1 = {6, 1, 0x00, 0x03, 0xf6, 0x57, 0x30, 0x00}; |
|---|
| 52 | +static const struct snd_opl3_drum_note bass_note = {6, 0x90, 0x09}; |
|---|
| 67 | 53 | |
|---|
| 68 | | -static struct snd_opl3_drum_voice hihat = {7, 0, 0x00, 0x03, 0xf0, 0x06, 0x20, 0x00}; |
|---|
| 54 | +static const struct snd_opl3_drum_voice hihat = {7, 0, 0x00, 0x03, 0xf0, 0x06, 0x20, 0x00}; |
|---|
| 69 | 55 | |
|---|
| 70 | | -static struct snd_opl3_drum_voice snare = {7, 1, 0x00, 0x03, 0xf0, 0x07, 0x20, 0x02}; |
|---|
| 71 | | -static struct snd_opl3_drum_note snare_note = {7, 0xf4, 0x0d}; |
|---|
| 56 | +static const struct snd_opl3_drum_voice snare = {7, 1, 0x00, 0x03, 0xf0, 0x07, 0x20, 0x02}; |
|---|
| 57 | +static const struct snd_opl3_drum_note snare_note = {7, 0xf4, 0x0d}; |
|---|
| 72 | 58 | |
|---|
| 73 | | -static struct snd_opl3_drum_voice tomtom = {8, 0, 0x02, 0x03, 0xf0, 0x06, 0x10, 0x00}; |
|---|
| 74 | | -static struct snd_opl3_drum_note tomtom_note = {8, 0xf4, 0x09}; |
|---|
| 59 | +static const struct snd_opl3_drum_voice tomtom = {8, 0, 0x02, 0x03, 0xf0, 0x06, 0x10, 0x00}; |
|---|
| 60 | +static const struct snd_opl3_drum_note tomtom_note = {8, 0xf4, 0x09}; |
|---|
| 75 | 61 | |
|---|
| 76 | | -static struct snd_opl3_drum_voice cymbal = {8, 1, 0x04, 0x03, 0xf0, 0x06, 0x10, 0x00}; |
|---|
| 62 | +static const struct snd_opl3_drum_voice cymbal = {8, 1, 0x04, 0x03, 0xf0, 0x06, 0x10, 0x00}; |
|---|
| 77 | 63 | |
|---|
| 78 | 64 | /* |
|---|
| 79 | 65 | * set drum voice characteristics |
|---|
| 80 | 66 | */ |
|---|
| 81 | 67 | static void snd_opl3_drum_voice_set(struct snd_opl3 *opl3, |
|---|
| 82 | | - struct snd_opl3_drum_voice *data) |
|---|
| 68 | + const struct snd_opl3_drum_voice *data) |
|---|
| 83 | 69 | { |
|---|
| 84 | 70 | unsigned char op_offset = snd_opl3_regmap[data->voice][data->op]; |
|---|
| 85 | 71 | unsigned char voice_offset = data->voice; |
|---|
| .. | .. |
|---|
| 114 | 100 | * Set drum voice pitch |
|---|
| 115 | 101 | */ |
|---|
| 116 | 102 | static void snd_opl3_drum_note_set(struct snd_opl3 *opl3, |
|---|
| 117 | | - struct snd_opl3_drum_note *data) |
|---|
| 103 | + const struct snd_opl3_drum_note *data) |
|---|
| 118 | 104 | { |
|---|
| 119 | 105 | unsigned char voice_offset = data->voice; |
|---|
| 120 | 106 | unsigned short opl3_reg; |
|---|
| .. | .. |
|---|
| 132 | 118 | * Set drum voice volume and position |
|---|
| 133 | 119 | */ |
|---|
| 134 | 120 | static void snd_opl3_drum_vol_set(struct snd_opl3 *opl3, |
|---|
| 135 | | - struct snd_opl3_drum_voice *data, |
|---|
| 121 | + const struct snd_opl3_drum_voice *data, |
|---|
| 136 | 122 | int vel, struct snd_midi_channel *chan) |
|---|
| 137 | 123 | { |
|---|
| 138 | 124 | unsigned char op_offset = snd_opl3_regmap[data->voice][data->op]; |
|---|
| .. | .. |
|---|
| 184 | 170 | struct snd_midi_channel *chan) |
|---|
| 185 | 171 | { |
|---|
| 186 | 172 | unsigned char drum_mask; |
|---|
| 187 | | - struct snd_opl3_drum_voice *drum_voice; |
|---|
| 173 | + const struct snd_opl3_drum_voice *drum_voice; |
|---|
| 188 | 174 | |
|---|
| 189 | 175 | if (!(opl3->drum_reg & OPL3_PERCUSSION_ENABLE)) |
|---|
| 190 | 176 | return; |
|---|