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.

Dependency Surface

Detected Declarations

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

Implementation Notes