sound/synth/emux/emux_nrpn.c
Source file repositories/reference/linux-study-clean/sound/synth/emux/emux_nrpn.c
File Facts
- System
- Linux kernel
- Corpus path
sound/synth/emux/emux_nrpn.c- Extension
.c- Size
- 9344 bytes
- Lines
- 387
- Domain
- Driver Families
- Bucket
- sound/synth
- 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
emux_voice.hsound/asoundef.h
Detected Declarations
struct nrpn_conv_tablefunction send_converted_effectfunction fx_delayfunction fx_attackfunction fx_holdfunction fx_decayfunction fx_the_valuefunction fx_twice_valuefunction fx_conv_pitchfunction fx_conv_Qfunction gs_cutofffunction gs_filterQfunction gs_attackfunction gs_decayfunction gs_releasefunction gs_vib_ratefunction gs_vib_depthfunction gs_vib_delayfunction snd_emux_nrpnfunction xg_cutofffunction xg_filterQfunction xg_attackfunction xg_releasefunction snd_emux_xg_controlfunction snd_emux_sysex
Annotated Snippet
struct nrpn_conv_table {
int control;
int effect;
int (*convert)(int val);
};
/* effect sensitivity */
#define FX_CUTOFF 0
#define FX_RESONANCE 1
#define FX_ATTACK 2
#define FX_RELEASE 3
#define FX_VIBRATE 4
#define FX_VIBDEPTH 5
#define FX_VIBDELAY 6
#define FX_NUMS 7
/*
* convert NRPN/control values
*/
static int send_converted_effect(const 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;
for (i = 0; i < num_tables; i++) {
if (table[i].control == type) {
cval = table[i].convert(val);
snd_emux_send_effect(port, chan, table[i].effect,
cval, mode);
return 1;
}
}
return 0;
}
#define DEF_FX_CUTOFF 170
#define DEF_FX_RESONANCE 6
#define DEF_FX_ATTACK 50
#define DEF_FX_RELEASE 50
#define DEF_FX_VIBRATE 30
#define DEF_FX_VIBDEPTH 4
#define DEF_FX_VIBDELAY 1500
/* effect sensitivities for GS NRPN:
* adjusted for chaos 8MB soundfonts
*/
static const int gs_sense[] =
{
DEF_FX_CUTOFF, DEF_FX_RESONANCE, DEF_FX_ATTACK, DEF_FX_RELEASE,
DEF_FX_VIBRATE, DEF_FX_VIBDEPTH, DEF_FX_VIBDELAY
};
/* effect sensitivities for XG controls:
* adjusted for chaos 8MB soundfonts
*/
static const int xg_sense[] =
{
DEF_FX_CUTOFF, DEF_FX_RESONANCE, DEF_FX_ATTACK, DEF_FX_RELEASE,
DEF_FX_VIBRATE, DEF_FX_VIBDEPTH, DEF_FX_VIBDELAY
};
/*
* AWE32 NRPN effects
*/
static int fx_delay(int val);
static int fx_attack(int val);
static int fx_hold(int val);
static int fx_decay(int val);
static int fx_the_value(int val);
static int fx_twice_value(int val);
static int fx_conv_pitch(int val);
static int fx_conv_Q(int val);
/* function for each NRPN */ /* [range] units */
#define fx_env1_delay fx_delay /* [0,5900] 4msec */
#define fx_env1_attack fx_attack /* [0,5940] 1msec */
#define fx_env1_hold fx_hold /* [0,8191] 1msec */
#define fx_env1_decay fx_decay /* [0,5940] 4msec */
#define fx_env1_release fx_decay /* [0,5940] 4msec */
#define fx_env1_sustain fx_the_value /* [0,127] 0.75dB */
#define fx_env1_pitch fx_the_value /* [-127,127] 9.375cents */
#define fx_env1_cutoff fx_the_value /* [-127,127] 56.25cents */
#define fx_env2_delay fx_delay /* [0,5900] 4msec */
Annotation
- Immediate include surface: `emux_voice.h`, `sound/asoundef.h`.
- Detected declarations: `struct nrpn_conv_table`, `function send_converted_effect`, `function fx_delay`, `function fx_attack`, `function fx_hold`, `function fx_decay`, `function fx_the_value`, `function fx_twice_value`, `function fx_conv_pitch`, `function fx_conv_Q`.
- Atlas domain: Driver Families / sound/synth.
- 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.