linux/include/sound/seq_midi_emul.h

/* SPDX-License-Identifier: GPL-2.0-or-later */
#ifndef __SOUND_SEQ_MIDI_EMUL_H
#define __SOUND_SEQ_MIDI_EMUL_H

/*
 *  Midi channel definition for optional channel management.
 *
 *  Copyright (C) 1999 Steve Ratcliffe
 */

#include <sound/seq_kernel.h>

/*
 * This structure is used to keep track of the current state on each
 * channel.  All drivers for hardware that does not understand midi
 * directly will probably need to use this structure.
 */
struct snd_midi_channel {};

/*
 * A structure that represets a set of channels bound to a port.  There
 * would usually be 16 channels per port.  But fewer could be used for
 * particular cases.
 * The channel set consists of information describing the client and
 * port for this midi synth and an array of snd_midi_channel structures.
 * A driver that had no need for snd_midi_channel could still use the
 * channel set type if it wished with the channel array null.
 */
struct snd_midi_channel_set {};

struct snd_midi_op {};

/*
 * These defines are used so that pitchbend, aftertouch etc, can be
 * distinguished from controller values.
 */
/* 0-127 controller values */
#define MIDI_CTL_PITCHBEND
#define MIDI_CTL_AFTERTOUCH
#define MIDI_CTL_CHAN_PRESSURE

/*
 * These names exist to allow symbolic access to the controls array.
 * The usage is eg: chan->gm_bank_select.  Another implementation would
 * be really have these members in the struct, and not the array.
 */
#define gm_bank_select
#define gm_modulation
#define gm_breath
#define gm_foot_pedal
#define gm_portamento_time
#define gm_data_entry
#define gm_volume
#define gm_balance
#define gm_pan
#define gm_expression
#define gm_effect_control1
#define gm_effect_control2
#define gm_slider1
#define gm_slider2
#define gm_slider3
#define gm_slider4

#define gm_bank_select_lsb
#define gm_modulation_wheel_lsb
#define gm_breath_lsb
#define gm_foot_pedal_lsb
#define gm_portamento_time_lsb
#define gm_data_entry_lsb
#define gm_volume_lsb
#define gm_balance_lsb
#define gm_pan_lsb
#define gm_expression_lsb
#define gm_effect_control1_lsb
#define gm_effect_control2_lsb

#define gm_sustain
#define gm_hold
#define gm_portamento
#define gm_sostenuto

/*
 * These macros give the complete value of the controls that consist
 * of coarse and fine pairs.  Of course the fine controls are seldom used
 * but there is no harm in being complete.
 */
#define SNDRV_GM_BANK_SELECT(cp)
#define SNDRV_GM_MODULATION_WHEEL(cp)
#define SNDRV_GM_BREATH(cp)
#define SNDRV_GM_FOOT_PEDAL(cp)
#define SNDRV_GM_PORTAMENTO_TIME(cp)
#define SNDRV_GM_DATA_ENTRY(cp)
#define SNDRV_GM_VOLUME(cp)
#define SNDRV_GM_BALANCE(cp)
#define SNDRV_GM_PAN(cp)
#define SNDRV_GM_EXPRESSION(cp)


/* MIDI mode */
#define SNDRV_MIDI_MODE_NONE
#define SNDRV_MIDI_MODE_GM
#define SNDRV_MIDI_MODE_GS
#define SNDRV_MIDI_MODE_XG
#define SNDRV_MIDI_MODE_MT32

/* MIDI note state */
#define SNDRV_MIDI_NOTE_OFF
#define SNDRV_MIDI_NOTE_ON
#define SNDRV_MIDI_NOTE_RELEASED
#define SNDRV_MIDI_NOTE_SOSTENUTO
 
#define SNDRV_MIDI_PARAM_TYPE_REGISTERED
#define SNDRV_MIDI_PARAM_TYPE_NONREGISTERED

/* SYSEX parse flag */
enum {};

/* Prototypes for midi_process.c */
void snd_midi_process_event(const struct snd_midi_op *ops,
			    struct snd_seq_event *ev,
			    struct snd_midi_channel_set *chanset);
void snd_midi_channel_set_clear(struct snd_midi_channel_set *chset);
struct snd_midi_channel_set *snd_midi_channel_alloc_set(int n);
void snd_midi_channel_free_set(struct snd_midi_channel_set *chset);

#endif /* __SOUND_SEQ_MIDI_EMUL_H */