21 #include <linux/export.h>
39 static void lookup_voices(
struct snd_emux *emux,
struct snd_emu10k1 *
hw,
57 #define LIMITVALUE(x, a, b) do { if ((x) < (a)) (x) = (a); else if ((x) > (b)) (x) = (b); } while (0)
58 #define LIMITMAX(x, a) do {if ((x) > (a)) (x) = (a); } while (0)
67 .prepare = start_voice,
68 .trigger = trigger_voice,
69 .release = release_voice,
70 .update = update_voice,
71 .terminate = terminate_voice,
80 emux->
ops = emu10k1_ops;
101 lookup_voices(emu, hw, best, 1);
102 for (i = 0; i <
V_END; i++) {
103 if (best[i].
voice >= 0) {
106 if ((ch = vp->
ch) < 0) {
113 vp->
emu->num_voices--;
116 spin_unlock_irqrestore(&emu->
voice_lock, flags);
120 spin_unlock_irqrestore(&emu->
voice_lock, flags);
134 struct snd_emu10k1 *
hw;
137 dcysusv = 0x8000 | (
unsigned char)vp->
reg.parm.modrelease;
139 dcysusv = 0x8000 | (
unsigned char)vp->
reg.parm.volrelease | DCYSUSV_CHANNELENABLE_MASK;
150 struct snd_emu10k1 *
hw;
157 struct snd_emu10k1_memblk *emem;
158 emem = (
struct snd_emu10k1_memblk *)vp->
block;
159 if (emem->map_locked > 0)
170 struct snd_emu10k1 *
hw;
177 if (hw && (vp->
ch >= 0)) {
184 vp->
emu->num_voices--;
196 struct snd_emu10k1 *
hw;
223 lookup_voices(
struct snd_emux *
emu,
struct snd_emu10k1 *hw,
230 for (i = 0; i <
V_END; i++) {
272 if (val >= vp->
reg.loopstart)
291 struct snd_emu10k1 *
hw;
298 lookup_voices(emu, hw, best, 0);
299 for (i = 0; i <
V_END; i++) {
300 if (best[i].
voice >= 0) {
304 struct snd_emu10k1_voice *hwvoice;
307 vp->
ch = hwvoice->number;
326 unsigned int addr, mapped_offset;
328 struct snd_emu10k1 *
hw;
329 struct snd_emu10k1_memblk *emem;
337 emem = (
struct snd_emu10k1_memblk *)vp->
block;
345 mapped_offset = snd_emu10k1_memblk_offset(emem) >> 1;
346 vp->
reg.start += mapped_offset;
347 vp->
reg.end += mapped_offset;
348 vp->
reg.loopstart += mapped_offset;
349 vp->
reg.loopend += mapped_offset;
401 temp = vp->
reg.parm.reverb;
404 addr = vp->
reg.loopstart;
408 addr = vp->
reg.loopend;
409 temp = vp->
reg.parm.chorus;
412 temp = (temp <<24) | addr;
420 temp = (hw->silent_page.addr << 1) | MAP_PTI_MASK;
441 temp = ((
unsigned int)hw->silent_page.addr << 1) | MAP_PTI_MASK;
454 addr = vp->
reg.start;
455 temp = vp->
reg.parm.filterQ;
456 temp = (temp<<28) | addr;
458 temp |= CCCA_INTERPROM_0;
460 unsigned int shift = (vp->
apitch - 0xe000) >> 10;
464 temp |= CCCA_8BITSELECT;
480 unsigned int temp, ptarget;
481 struct snd_emu10k1 *
hw;
482 struct snd_emu10k1_memblk *emem;
486 emem = (
struct snd_emu10k1_memblk *)vp->
block;
487 if (! emem || emem->mapped_page < 0)
493 ptarget = IP_TO_CP(vp->
apitch);
496 temp = ptarget | (vp->
apan << 8) | vp->
aaux;
512 unsigned short fmmod;
517 pitch = (
char)(vp->
reg.parm.fmmod>>8);
518 cutoff = (vp->
reg.parm.fmmod & 0xff);
519 modulation = vp->
chan->gm_modulation + vp->
chan->midi_pressure;
520 pitch += (
MOD_SENSE * modulation) / 1200;
530 unsigned short fm2frq2;
535 pitch = (
char)(vp->
reg.parm.fm2frq2>>8);
536 freq = vp->
reg.parm.fm2frq2 & 0xff;
537 modulation = vp->
chan->gm_modulation + vp->
chan->midi_pressure;
538 pitch += (
MOD_SENSE * modulation) / 1200;
540 fm2frq2 = ((
unsigned char)pitch<<8) |
freq;
550 val |= (vp->
reg.parm.filterQ << 28);