#include "emux_voice.h"
#include <sound/asoundef.h>
-#define NELEM(arr) (sizeof(arr)/sizeof((arr)[0]))
-
/*
* conversion from NRPN/control parameters to Emu8000 raw parameters
*/
/* NRPN / CC -> Emu8000 parameter converter */
-typedef struct {
+struct nrpn_conv_table {
int control;
int effect;
int (*convert)(int val);
-} nrpn_conv_table;
+};
/* effect sensitivity */
* convert NRPN/control values
*/
-static int send_converted_effect(nrpn_conv_table *table, int num_tables,
- snd_emux_port_t *port, snd_midi_channel_t *chan,
+static int send_converted_effect(struct nrpn_conv_table *table, int num_tables,
+ struct snd_emux_port *port,
+ struct snd_midi_channel *chan,
int type, int val, int mode)
{
int i, cval;
}
-static nrpn_conv_table awe_effects[] =
+static struct nrpn_conv_table awe_effects[] =
{
{ 0, EMUX_FX_LFO1_DELAY, fx_lfo1_delay},
{ 1, EMUX_FX_LFO1_FREQ, fx_lfo1_freq},
{26, EMUX_FX_REVERB, fx_reverb},
};
-static int num_awe_effects = NELEM(awe_effects);
-
/*
* GS(SC88) NRPN effects; still experimental
return -(val - 64) * gs_sense[FX_VIBDELAY] / 50;
}
-static nrpn_conv_table gs_effects[] =
+static struct nrpn_conv_table gs_effects[] =
{
{32, EMUX_FX_CUTOFF, gs_cutoff},
{33, EMUX_FX_FILTERQ, gs_filterQ},
{10, EMUX_FX_LFO1_DELAY, gs_vib_delay},
};
-static int num_gs_effects = NELEM(gs_effects);
-
/*
* NRPN events
*/
void
-snd_emux_nrpn(void *p, snd_midi_channel_t *chan, snd_midi_channel_set_t *chset)
+snd_emux_nrpn(void *p, struct snd_midi_channel *chan,
+ struct snd_midi_channel_set *chset)
{
- snd_emux_port_t *port;
+ struct snd_emux_port *port;
- port = snd_magic_cast(snd_emux_port_t, p, return);
+ port = p;
snd_assert(port != NULL, return);
snd_assert(chan != NULL, return);
chan->control[MIDI_CTL_LSB_DATA_ENTRY];
val -= 8192;
send_converted_effect
- (awe_effects, num_awe_effects,
+ (awe_effects, ARRAY_SIZE(awe_effects),
port, chan, chan->control[MIDI_CTL_NONREG_PARM_NUM_LSB],
val, EMUX_FX_FLAG_SET);
return;
/* only MSB is valid */
val = chan->control[MIDI_CTL_MSB_DATA_ENTRY];
send_converted_effect
- (gs_effects, num_gs_effects,
+ (gs_effects, ARRAY_SIZE(gs_effects),
port, chan, chan->control[MIDI_CTL_NONREG_PARM_NUM_LSB],
val, EMUX_FX_FLAG_ADD);
return;
return -(val - 64) * xg_sense[FX_RELEASE] / 64;
}
-static nrpn_conv_table xg_effects[] =
+static struct nrpn_conv_table xg_effects[] =
{
{71, EMUX_FX_CUTOFF, xg_cutoff},
{74, EMUX_FX_FILTERQ, xg_filterQ},
{73, EMUX_FX_ENV2_ATTACK, xg_attack},
};
-static int num_xg_effects = NELEM(xg_effects);
-
int
-snd_emux_xg_control(snd_emux_port_t *port, snd_midi_channel_t *chan, int param)
+snd_emux_xg_control(struct snd_emux_port *port, struct snd_midi_channel *chan,
+ int param)
{
- return send_converted_effect(xg_effects, num_xg_effects,
+ return send_converted_effect(xg_effects, ARRAY_SIZE(xg_effects),
port, chan, param,
chan->control[param],
EMUX_FX_FLAG_ADD);
* receive sysex
*/
void
-snd_emux_sysex(void *p, unsigned char *buf, int len, int parsed, snd_midi_channel_set_t *chset)
+snd_emux_sysex(void *p, unsigned char *buf, int len, int parsed,
+ struct snd_midi_channel_set *chset)
{
- snd_emux_port_t *port;
- snd_emux_t *emu;
+ struct snd_emux_port *port;
+ struct snd_emux *emu;
- port = snd_magic_cast(snd_emux_port_t, p, return);
+ port = p;
snd_assert(port != NULL, return);
snd_assert(chset != NULL, return);
emu = port->emu;