sound/synth/emux/emux_effect.c
Source file repositories/reference/linux-study-clean/sound/synth/emux/emux_effect.c
File Facts
- System
- Linux kernel
- Corpus path
sound/synth/emux/emux_effect.c- Extension
.c- Size
- 8883 bytes
- Lines
- 303
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
emux_voice.hlinux/slab.h
Detected Declarations
function effect_set_bytefunction effect_set_wordfunction effect_get_offsetfunction snd_emux_send_effect_ossfunction snd_emux_send_effectfunction snd_emux_setup_effectfunction snd_emux_create_effectfunction snd_emux_delete_effectfunction snd_emux_clear_effect
Annotated Snippet
if (parm_defs[i].type & PARM_IS_BYTE) {
*srcp = *origp;
effect_set_byte(srcp, chan, type);
} else {
*(unsigned short *)srcp = *(unsigned short *)origp;
effect_set_word((unsigned short *)srcp, chan, type);
}
}
}
/* activate them */
snd_emux_update_channel(port, chan, parm_defs[type].update);
}
/* copy wavetable registers to voice table */
void
snd_emux_setup_effect(struct snd_emux_voice *vp)
{
struct snd_midi_channel *chan = vp->chan;
struct snd_emux_effect_table *fx;
unsigned char *srcp;
int i;
fx = chan->private;
if (!fx)
return;
/* modify the register values via effect table */
for (i = 0; i < EMUX_FX_END; i++) {
int offset;
if (!fx->flag[i])
continue;
offset = parm_defs[i].offset;
if (offset < 0)
continue;
#ifdef SNDRV_LITTLE_ENDIAN
if (parm_defs[i].type & PARM_IS_ALIGN_HI)
offset++;
#else
if (parm_defs[i].type & PARM_IS_ALIGN_LO)
offset++;
#endif
srcp = (unsigned char*)&vp->reg.parm + offset;
if (parm_defs[i].type & PARM_IS_BYTE)
effect_set_byte(srcp, chan, i);
else
effect_set_word((unsigned short*)srcp, chan, i);
}
/* correct sample and loop points */
vp->reg.start += effect_get_offset(chan, EMUX_FX_SAMPLE_START,
EMUX_FX_COARSE_SAMPLE_START,
vp->reg.sample_mode);
vp->reg.loopstart += effect_get_offset(chan, EMUX_FX_LOOP_START,
EMUX_FX_COARSE_LOOP_START,
vp->reg.sample_mode);
vp->reg.loopend += effect_get_offset(chan, EMUX_FX_LOOP_END,
EMUX_FX_COARSE_LOOP_END,
vp->reg.sample_mode);
}
/*
* effect table
*/
void
snd_emux_create_effect(struct snd_emux_port *p)
{
int i;
p->effect = kzalloc_objs(struct snd_emux_effect_table,
p->chset.max_channels);
if (p->effect) {
for (i = 0; i < p->chset.max_channels; i++)
p->chset.channels[i].private = p->effect + i;
} else {
for (i = 0; i < p->chset.max_channels; i++)
p->chset.channels[i].private = NULL;
}
}
void
snd_emux_delete_effect(struct snd_emux_port *p)
{
kfree(p->effect);
p->effect = NULL;
}
void
Annotation
- Immediate include surface: `emux_voice.h`, `linux/slab.h`.
- Detected declarations: `function effect_set_byte`, `function effect_set_word`, `function effect_get_offset`, `function snd_emux_send_effect_oss`, `function snd_emux_send_effect`, `function snd_emux_setup_effect`, `function snd_emux_create_effect`, `function snd_emux_delete_effect`, `function snd_emux_clear_effect`.
- 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.