^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (c) by Uros Bizjak <uros@kss-loka.si>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * OPL2/OPL3/OPL4 FM routines for internal percussion channels
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include "opl3_voice.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) static const char snd_opl3_drum_table[47] =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) OPL3_BASSDRUM_ON, OPL3_BASSDRUM_ON, OPL3_HIHAT_ON, /* 35 - 37 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) OPL3_SNAREDRUM_ON, OPL3_HIHAT_ON, OPL3_SNAREDRUM_ON, /* 38 - 40 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) OPL3_BASSDRUM_ON, OPL3_HIHAT_ON, OPL3_BASSDRUM_ON, /* 41 - 43 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) OPL3_HIHAT_ON, OPL3_TOMTOM_ON, OPL3_HIHAT_ON, /* 44 - 46 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) OPL3_TOMTOM_ON, OPL3_TOMTOM_ON, OPL3_CYMBAL_ON, /* 47 - 49 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) OPL3_TOMTOM_ON, OPL3_CYMBAL_ON, OPL3_CYMBAL_ON, /* 50 - 52 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) OPL3_CYMBAL_ON, OPL3_CYMBAL_ON, OPL3_CYMBAL_ON, /* 53 - 55 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) OPL3_HIHAT_ON, OPL3_CYMBAL_ON, OPL3_TOMTOM_ON, /* 56 - 58 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) OPL3_CYMBAL_ON, OPL3_TOMTOM_ON, OPL3_TOMTOM_ON, /* 59 - 61 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) OPL3_HIHAT_ON, OPL3_TOMTOM_ON, OPL3_TOMTOM_ON, /* 62 - 64 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) OPL3_TOMTOM_ON, OPL3_TOMTOM_ON, OPL3_TOMTOM_ON, /* 65 - 67 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) OPL3_TOMTOM_ON, OPL3_HIHAT_ON, OPL3_HIHAT_ON, /* 68 - 70 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) OPL3_HIHAT_ON, OPL3_HIHAT_ON, OPL3_TOMTOM_ON, /* 71 - 73 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) OPL3_TOMTOM_ON, OPL3_TOMTOM_ON, OPL3_TOMTOM_ON, /* 74 - 76 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) OPL3_TOMTOM_ON, OPL3_TOMTOM_ON, OPL3_TOMTOM_ON, /* 77 - 79 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) OPL3_CYMBAL_ON, OPL3_CYMBAL_ON /* 80 - 81 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) struct snd_opl3_drum_voice {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) int voice;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) int op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) unsigned char am_vib;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) unsigned char ksl_level;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) unsigned char attack_decay;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) unsigned char sustain_release;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) unsigned char feedback_connection;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) unsigned char wave_select;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) struct snd_opl3_drum_note {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) int voice;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) unsigned char fnum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) unsigned char octave_f;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) unsigned char feedback_connection;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) static const struct snd_opl3_drum_voice bass_op0 = {6, 0, 0x00, 0x32, 0xf8, 0x66, 0x30, 0x00};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) static const struct snd_opl3_drum_voice bass_op1 = {6, 1, 0x00, 0x03, 0xf6, 0x57, 0x30, 0x00};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) static const struct snd_opl3_drum_note bass_note = {6, 0x90, 0x09};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) static const struct snd_opl3_drum_voice hihat = {7, 0, 0x00, 0x03, 0xf0, 0x06, 0x20, 0x00};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) static const struct snd_opl3_drum_voice snare = {7, 1, 0x00, 0x03, 0xf0, 0x07, 0x20, 0x02};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) static const struct snd_opl3_drum_note snare_note = {7, 0xf4, 0x0d};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) static const struct snd_opl3_drum_voice tomtom = {8, 0, 0x02, 0x03, 0xf0, 0x06, 0x10, 0x00};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) static const struct snd_opl3_drum_note tomtom_note = {8, 0xf4, 0x09};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) static const struct snd_opl3_drum_voice cymbal = {8, 1, 0x04, 0x03, 0xf0, 0x06, 0x10, 0x00};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) * set drum voice characteristics
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) static void snd_opl3_drum_voice_set(struct snd_opl3 *opl3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) const struct snd_opl3_drum_voice *data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) unsigned char op_offset = snd_opl3_regmap[data->voice][data->op];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) unsigned char voice_offset = data->voice;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) unsigned short opl3_reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) /* Set OPL3 AM_VIB register */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) opl3_reg = OPL3_LEFT | (OPL3_REG_AM_VIB + op_offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) opl3->command(opl3, opl3_reg, data->am_vib);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) /* Set OPL3 KSL_LEVEL register */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) opl3_reg = OPL3_LEFT | (OPL3_REG_KSL_LEVEL + op_offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) opl3->command(opl3, opl3_reg, data->ksl_level);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) /* Set OPL3 ATTACK_DECAY register */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) opl3_reg = OPL3_LEFT | (OPL3_REG_ATTACK_DECAY + op_offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) opl3->command(opl3, opl3_reg, data->attack_decay);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) /* Set OPL3 SUSTAIN_RELEASE register */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) opl3_reg = OPL3_LEFT | (OPL3_REG_SUSTAIN_RELEASE + op_offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) opl3->command(opl3, opl3_reg, data->sustain_release);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) /* Set OPL3 FEEDBACK_CONNECTION register */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) opl3_reg = OPL3_LEFT | (OPL3_REG_FEEDBACK_CONNECTION + voice_offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) opl3->command(opl3, opl3_reg, data->feedback_connection);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) /* Select waveform */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) opl3_reg = OPL3_LEFT | (OPL3_REG_WAVE_SELECT + op_offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) opl3->command(opl3, opl3_reg, data->wave_select);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) * Set drum voice pitch
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) static void snd_opl3_drum_note_set(struct snd_opl3 *opl3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) const struct snd_opl3_drum_note *data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) unsigned char voice_offset = data->voice;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) unsigned short opl3_reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) /* Set OPL3 FNUM_LOW register */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) opl3_reg = OPL3_LEFT | (OPL3_REG_FNUM_LOW + voice_offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) opl3->command(opl3, opl3_reg, data->fnum);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) /* Set OPL3 KEYON_BLOCK register */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) opl3_reg = OPL3_LEFT | (OPL3_REG_KEYON_BLOCK + voice_offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) opl3->command(opl3, opl3_reg, data->octave_f);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) * Set drum voice volume and position
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) static void snd_opl3_drum_vol_set(struct snd_opl3 *opl3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) const struct snd_opl3_drum_voice *data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) int vel, struct snd_midi_channel *chan)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) unsigned char op_offset = snd_opl3_regmap[data->voice][data->op];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) unsigned char voice_offset = data->voice;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) unsigned char reg_val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) unsigned short opl3_reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) /* Set OPL3 KSL_LEVEL register */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) reg_val = data->ksl_level;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) snd_opl3_calc_volume(®_val, vel, chan);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) opl3_reg = OPL3_LEFT | (OPL3_REG_KSL_LEVEL + op_offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) opl3->command(opl3, opl3_reg, reg_val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) /* Set OPL3 FEEDBACK_CONNECTION register */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) /* Set output voice connection */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) reg_val = data->feedback_connection | OPL3_STEREO_BITS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) if (chan->gm_pan < 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) reg_val &= ~OPL3_VOICE_TO_RIGHT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) if (chan->gm_pan > 85)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) reg_val &= ~OPL3_VOICE_TO_LEFT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) opl3_reg = OPL3_LEFT | (OPL3_REG_FEEDBACK_CONNECTION + voice_offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) opl3->command(opl3, opl3_reg, reg_val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) * Loads drum voices at init time
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) void snd_opl3_load_drums(struct snd_opl3 *opl3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) snd_opl3_drum_voice_set(opl3, &bass_op0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) snd_opl3_drum_voice_set(opl3, &bass_op1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) snd_opl3_drum_note_set(opl3, &bass_note);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) snd_opl3_drum_voice_set(opl3, &hihat);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) snd_opl3_drum_voice_set(opl3, &snare);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) snd_opl3_drum_note_set(opl3, &snare_note);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) snd_opl3_drum_voice_set(opl3, &tomtom);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) snd_opl3_drum_note_set(opl3, &tomtom_note);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) snd_opl3_drum_voice_set(opl3, &cymbal);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) * Switch drum voice on or off
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) void snd_opl3_drum_switch(struct snd_opl3 *opl3, int note, int vel, int on_off,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) struct snd_midi_channel *chan)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) unsigned char drum_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) const struct snd_opl3_drum_voice *drum_voice;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) if (!(opl3->drum_reg & OPL3_PERCUSSION_ENABLE))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) if ((note < 35) || (note > 81))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) drum_mask = snd_opl3_drum_table[note - 35];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) if (on_off) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) switch (drum_mask) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) case OPL3_BASSDRUM_ON:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) drum_voice = &bass_op1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) case OPL3_HIHAT_ON:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) drum_voice = &hihat;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) case OPL3_SNAREDRUM_ON:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) drum_voice = &snare;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) case OPL3_TOMTOM_ON:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) drum_voice = &tomtom;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) case OPL3_CYMBAL_ON:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) drum_voice = &cymbal;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) drum_voice = &tomtom;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) snd_opl3_drum_vol_set(opl3, drum_voice, vel, chan);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) opl3->drum_reg |= drum_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) opl3->drum_reg &= ~drum_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) opl3->command(opl3, OPL3_LEFT | OPL3_REG_PERCUSSION,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) opl3->drum_reg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) }