diff options
Diffstat (limited to 'sound/synth/emux/emux_effect.c')
| -rw-r--r-- | sound/synth/emux/emux_effect.c | 58 |
1 files changed, 25 insertions, 33 deletions
diff --git a/sound/synth/emux/emux_effect.c b/sound/synth/emux/emux_effect.c index 9ac0bf531b4b..bfe383fa90ba 100644 --- a/sound/synth/emux/emux_effect.c +++ b/sound/synth/emux/emux_effect.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-or-later /* * Midi synth routines for the Emu8k/Emu10k1 * @@ -5,21 +6,6 @@ * Copyright (c) 1999-2000 Takashi Iwai <tiwai@suse.de> * * Contains code based on awe_wave.c by Takashi Iwai - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * */ #include "emux_voice.h" @@ -182,7 +168,6 @@ snd_emux_send_effect(struct snd_emux_port *port, struct snd_midi_channel *chan, unsigned char *srcp, *origp; struct snd_emux *emu; struct snd_emux_effect_table *fx; - unsigned long flags; emu = port->emu; fx = chan->private; @@ -195,7 +180,10 @@ snd_emux_send_effect(struct snd_emux_port *port, struct snd_midi_channel *chan, fx->flag[type] = mode; /* do we need to modify the register in realtime ? */ - if (! parm_defs[type].update || (offset = parm_defs[type].offset) < 0) + if (!parm_defs[type].update) + return; + offset = parm_defs[type].offset; + if (offset < 0) return; #ifdef SNDRV_LITTLE_ENDIAN @@ -206,22 +194,22 @@ snd_emux_send_effect(struct snd_emux_port *port, struct snd_midi_channel *chan, offset++; #endif /* modify the register values */ - spin_lock_irqsave(&emu->voice_lock, flags); - for (i = 0; i < emu->max_voices; i++) { - struct snd_emux_voice *vp = &emu->voices[i]; - if (!STATE_IS_PLAYING(vp->state) || vp->chan != chan) - continue; - srcp = (unsigned char*)&vp->reg.parm + offset; - origp = (unsigned char*)&vp->zone->v.parm + offset; - if (parm_defs[i].type & PARM_IS_BYTE) { - *srcp = *origp; - effect_set_byte(srcp, chan, type); - } else { - *(unsigned short*)srcp = *(unsigned short*)origp; - effect_set_word((unsigned short*)srcp, chan, type); + scoped_guard(spinlock_irqsave, &emu->voice_lock) { + for (i = 0; i < emu->max_voices; i++) { + struct snd_emux_voice *vp = &emu->voices[i]; + if (!STATE_IS_PLAYING(vp->state) || vp->chan != chan) + continue; + srcp = (unsigned char *)&vp->reg.parm + offset; + origp = (unsigned char *)&vp->zone->v.parm + offset; + if (parm_defs[i].type & PARM_IS_BYTE) { + *srcp = *origp; + effect_set_byte(srcp, chan, type); + } else { + *(unsigned short *)srcp = *(unsigned short *)origp; + effect_set_word((unsigned short *)srcp, chan, type); + } } } - spin_unlock_irqrestore(&emu->voice_lock, flags); /* activate them */ snd_emux_update_channel(port, chan, parm_defs[type].update); @@ -237,13 +225,17 @@ snd_emux_setup_effect(struct snd_emux_voice *vp) unsigned char *srcp; int i; - if (! (fx = chan->private)) + fx = chan->private; + if (!fx) return; /* modify the register values via effect table */ for (i = 0; i < EMUX_FX_END; i++) { int offset; - if (! fx->flag[i] || (offset = parm_defs[i].offset) < 0) + if (!fx->flag[i]) + continue; + offset = parm_defs[i].offset; + if (offset < 0) continue; #ifdef SNDRV_LITTLE_ENDIAN if (parm_defs[i].type & PARM_IS_ALIGN_HI) |
