]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - sound/synth/emux/emux_synth.c
ALSA: Kill snd_assert() in other places
[linux-2.6-omap-h63xx.git] / sound / synth / emux / emux_synth.c
index 24705d15ebd80e89b58e9c7c66885e2729490f2c..2cc6f6f7906574f77bc471cfc7405085c98434e1 100644 (file)
@@ -66,12 +66,12 @@ snd_emux_note_on(void *p, int note, int vel, struct snd_midi_channel *chan)
        struct snd_emux_port *port;
 
        port = p;
-       snd_assert(port != NULL && chan != NULL, return);
+       if (snd_BUG_ON(!port || !chan))
+               return;
 
        emu = port->emu;
-       snd_assert(emu != NULL, return);
-       snd_assert(emu->ops.get_voice != NULL, return);
-       snd_assert(emu->ops.trigger != NULL, return);
+       if (snd_BUG_ON(!emu || !emu->ops.get_voice || !emu->ops.trigger))
+               return;
 
        key = note; /* remember the original note */
        nvoices = get_zone(emu, port, &note, vel, chan, table);
@@ -164,11 +164,12 @@ snd_emux_note_off(void *p, int note, int vel, struct snd_midi_channel *chan)
        struct snd_emux_port *port;
 
        port = p;
-       snd_assert(port != NULL && chan != NULL, return);
+       if (snd_BUG_ON(!port || !chan))
+               return;
 
        emu = port->emu;
-       snd_assert(emu != NULL, return);
-       snd_assert(emu->ops.release != NULL, return);
+       if (snd_BUG_ON(!emu || !emu->ops.release))
+               return;
 
        spin_lock_irqsave(&emu->voice_lock, flags);
        for (ch = 0; ch < emu->max_voices; ch++) {
@@ -242,11 +243,12 @@ snd_emux_key_press(void *p, int note, int vel, struct snd_midi_channel *chan)
        struct snd_emux_port *port;
 
        port = p;
-       snd_assert(port != NULL && chan != NULL, return);
+       if (snd_BUG_ON(!port || !chan))
+               return;
 
        emu = port->emu;
-       snd_assert(emu != NULL, return);
-       snd_assert(emu->ops.update != NULL, return);
+       if (snd_BUG_ON(!emu || !emu->ops.update))
+               return;
 
        spin_lock_irqsave(&emu->voice_lock, flags);
        for (ch = 0; ch < emu->max_voices; ch++) {
@@ -276,8 +278,8 @@ snd_emux_update_channel(struct snd_emux_port *port, struct snd_midi_channel *cha
                return;
 
        emu = port->emu;
-       snd_assert(emu != NULL, return);
-       snd_assert(emu->ops.update != NULL, return);
+       if (snd_BUG_ON(!emu || !emu->ops.update))
+               return;
 
        spin_lock_irqsave(&emu->voice_lock, flags);
        for (i = 0; i < emu->max_voices; i++) {
@@ -303,8 +305,8 @@ snd_emux_update_port(struct snd_emux_port *port, int update)
                return;
 
        emu = port->emu;
-       snd_assert(emu != NULL, return);
-       snd_assert(emu->ops.update != NULL, return);
+       if (snd_BUG_ON(!emu || !emu->ops.update))
+               return;
 
        spin_lock_irqsave(&emu->voice_lock, flags);
        for (i = 0; i < emu->max_voices; i++) {
@@ -317,7 +319,7 @@ snd_emux_update_port(struct snd_emux_port *port, int update)
 
 
 /*
- * Deal with a controler type event.  This includes all types of
+ * Deal with a controller type event.  This includes all types of
  * control events, not just the midi controllers
  */
 void
@@ -326,7 +328,8 @@ snd_emux_control(void *p, int type, struct snd_midi_channel *chan)
        struct snd_emux_port *port;
 
        port = p;
-       snd_assert(port != NULL && chan != NULL, return);
+       if (snd_BUG_ON(!port || !chan))
+               return;
 
        switch (type) {
        case MIDI_CTL_MSB_MAIN_VOLUME:
@@ -341,8 +344,12 @@ snd_emux_control(void *p, int type, struct snd_midi_channel *chan)
        case MIDI_CTL_SOFT_PEDAL:
 #ifdef SNDRV_EMUX_USE_RAW_EFFECT
                /* FIXME: this is an emulation */
-               snd_emux_send_effect(port, chan, EMUX_FX_CUTOFF, -160,
+               if (chan->control[type] >= 64)
+                       snd_emux_send_effect(port, chan, EMUX_FX_CUTOFF, -160,
                                     EMUX_FX_FLAG_ADD);
+               else
+                       snd_emux_send_effect(port, chan, EMUX_FX_CUTOFF, 0,
+                                    EMUX_FX_FLAG_OFF);
 #endif
                break;
 
@@ -396,11 +403,12 @@ snd_emux_terminate_note(void *p, int note, struct snd_midi_channel *chan)
        struct snd_emux_port *port;
 
        port = p;
-       snd_assert(port != NULL && chan != NULL, return);
+       if (snd_BUG_ON(!port || !chan))
+               return;
 
        emu = port->emu;
-       snd_assert(emu != NULL, return);
-       snd_assert(emu->ops.terminate != NULL, return);
+       if (snd_BUG_ON(!emu || !emu->ops.terminate))
+               return;
 
        terminate_note1(emu, note, chan, 1);
 }
@@ -434,6 +442,7 @@ snd_emux_terminate_all(struct snd_emux *emu)
        spin_unlock_irqrestore(&emu->voice_lock, flags);
 }
 
+EXPORT_SYMBOL(snd_emux_terminate_all);
 
 /*
  * Terminate all voices associated with the given port
@@ -446,10 +455,11 @@ snd_emux_sounds_off_all(struct snd_emux_port *port)
        struct snd_emux_voice *vp;
        unsigned long flags;
 
-       snd_assert(port != NULL, return);
+       if (snd_BUG_ON(!port))
+               return;
        emu = port->emu;
-       snd_assert(emu != NULL, return);
-       snd_assert(emu->ops.terminate != NULL, return);
+       if (snd_BUG_ON(!emu || !emu->ops.terminate))
+               return;
 
        spin_lock_irqsave(&emu->voice_lock, flags);
        for (i = 0; i < emu->max_voices; i++) {
@@ -951,6 +961,8 @@ void snd_emux_lock_voice(struct snd_emux *emu, int voice)
        spin_unlock_irqrestore(&emu->voice_lock, flags);
 }
 
+EXPORT_SYMBOL(snd_emux_lock_voice);
+
 /*
  */
 void snd_emux_unlock_voice(struct snd_emux *emu, int voice)
@@ -965,3 +977,5 @@ void snd_emux_unlock_voice(struct snd_emux *emu, int voice)
                           voice, emu->voices[voice].state);
        spin_unlock_irqrestore(&emu->voice_lock, flags);
 }
+
+EXPORT_SYMBOL(snd_emux_unlock_voice);