include/sound/seq_midi_emul.h
Source file repositories/reference/linux-study-clean/include/sound/seq_midi_emul.h
File Facts
- System
- Linux kernel
- Corpus path
include/sound/seq_midi_emul.h- Extension
.h- Size
- 6785 bytes
- Lines
- 185
- Domain
- Driver Families
- Bucket
- include/sound
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
sound/seq_kernel.h
Detected Declarations
struct snd_midi_channelstruct snd_midi_channel_setstruct snd_midi_op
Annotated Snippet
struct snd_midi_channel {
void *private; /* A back pointer to driver data */
int number; /* The channel number */
int client; /* The client associated with this channel */
int port; /* The port associated with this channel */
unsigned char midi_mode; /* GM, GS, XG etc */
unsigned int
drum_channel:1, /* Drum channel */
param_type:1 /* RPN/NRPN */
;
unsigned char midi_aftertouch; /* Aftertouch (key pressure) */
unsigned char midi_pressure; /* Channel pressure */
unsigned char midi_program; /* Instrument number */
short midi_pitchbend; /* Pitch bend amount */
unsigned char control[128]; /* Current value of all controls */
unsigned char note[128]; /* Current status for all notes */
short gm_rpn_pitch_bend_range; /* Pitch bend range */
short gm_rpn_fine_tuning; /* Master fine tuning */
short gm_rpn_coarse_tuning; /* Master coarse tuning */
};
/*
* 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 {
void *private_data; /* Driver data */
int client; /* Client for this port */
int port; /* The port number */
unsigned char midi_mode; /* MIDI operating mode */
unsigned char gs_master_volume; /* SYSEX master volume: 0-127 */
unsigned char gs_chorus_mode;
unsigned char gs_reverb_mode;
int max_channels; /* Size of the channels array */
struct snd_midi_channel channels[] __counted_by(max_channels);
};
struct snd_midi_op {
void (*note_on)(void *private_data, int note, int vel, struct snd_midi_channel *chan);
void (*note_off)(void *private_data,int note, int vel, struct snd_midi_channel *chan); /* release note */
void (*key_press)(void *private_data, int note, int vel, struct snd_midi_channel *chan);
void (*note_terminate)(void *private_data, int note, struct snd_midi_channel *chan); /* terminate note immediately */
void (*control)(void *private_data, int type, struct snd_midi_channel *chan);
void (*nrpn)(void *private_data, struct snd_midi_channel *chan,
struct snd_midi_channel_set *chset);
void (*sysex)(void *private_data, unsigned char *buf, int len, int parsed,
struct snd_midi_channel_set *chset);
};
/*
* These defines are used so that pitchbend, aftertouch etc, can be
* distinguished from controller values.
*/
/* 0-127 controller values */
#define MIDI_CTL_PITCHBEND 0x80
#define MIDI_CTL_AFTERTOUCH 0x81
#define MIDI_CTL_CHAN_PRESSURE 0x82
/*
* 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 control[0]
#define gm_modulation control[1]
#define gm_breath control[2]
#define gm_foot_pedal control[4]
#define gm_portamento_time control[5]
#define gm_data_entry control[6]
#define gm_volume control[7]
#define gm_balance control[8]
#define gm_pan control[10]
#define gm_expression control[11]
#define gm_effect_control1 control[12]
#define gm_effect_control2 control[13]
#define gm_slider1 control[16]
#define gm_slider2 control[17]
Annotation
- Immediate include surface: `sound/seq_kernel.h`.
- Detected declarations: `struct snd_midi_channel`, `struct snd_midi_channel_set`, `struct snd_midi_op`.
- Atlas domain: Driver Families / include/sound.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.