Lines Matching +full:8 +full:- +full:ch
1 // SPDX-License-Identifier: GPL-2.0-or-later
42 * macro evaluates its args more than once, so changed to upper-case.
68 emux->ops = emu10k1_ops; in snd_emu10k1_ops_setup()
87 emu = hw->synth; in snd_emu10k1_synth_get_voice()
92 int ch; in snd_emu10k1_synth_get_voice() local
93 vp = &emu->voices[best[i].voice]; in snd_emu10k1_synth_get_voice()
94 ch = vp->ch; in snd_emu10k1_synth_get_voice()
95 if (ch < 0) { in snd_emu10k1_synth_get_voice()
97 dev_warn(emu->card->dev, in snd_emu10k1_synth_get_voice()
98 "synth_get_voice: ch < 0 (%d) ??", i); in snd_emu10k1_synth_get_voice()
102 vp->emu->num_voices--; in snd_emu10k1_synth_get_voice()
103 vp->ch = -1; in snd_emu10k1_synth_get_voice()
104 vp->state = SNDRV_EMUX_ST_OFF; in snd_emu10k1_synth_get_voice()
105 return ch; in snd_emu10k1_synth_get_voice()
110 return -ENOMEM; in snd_emu10k1_synth_get_voice()
122 hw = vp->hw; in release_voice()
123 snd_emu10k1_ptr_write_multiple(hw, vp->ch, in release_voice()
124 DCYSUSM, (unsigned char)vp->reg.parm.modrelease | DCYSUSM_PHASE1_MASK, in release_voice()
125 …DCYSUSV, (unsigned char)vp->reg.parm.volrelease | DCYSUSV_PHASE1_MASK | DCYSUSV_CHANNELENABLE_MASK, in release_voice()
140 hw = vp->hw; in terminate_voice()
141 snd_emu10k1_ptr_write_multiple(hw, vp->ch, in terminate_voice()
148 if (vp->block) { in terminate_voice()
150 emem = (struct snd_emu10k1_memblk *)vp->block; in terminate_voice()
151 if (emem->map_locked > 0) in terminate_voice()
152 emem->map_locked--; in terminate_voice()
164 hw = vp->hw; in free_voice()
169 if (hw && (vp->ch >= 0)) { in free_voice()
170 snd_emu10k1_voice_free(hw, &hw->voices[vp->ch]); in free_voice()
171 vp->emu->num_voices--; in free_voice()
172 vp->ch = -1; in free_voice()
185 hw = vp->hw; in update_voice()
187 snd_emu10k1_ptr_write(hw, IFATN_ATTENUATION, vp->ch, vp->avol); in update_voice()
189 snd_emu10k1_ptr_write(hw, IP, vp->ch, vp->apitch); in update_voice()
191 snd_emu10k1_ptr_write(hw, PTRX_FXSENDAMOUNT_A, vp->ch, vp->apan); in update_voice()
192 snd_emu10k1_ptr_write(hw, PTRX_FXSENDAMOUNT_B, vp->ch, vp->aaux); in update_voice()
195 snd_emu10k1_ptr_write(hw, FMMOD, vp->ch, make_fmmod(vp)); in update_voice()
197 snd_emu10k1_ptr_write(hw, TREMFRQ, vp->ch, vp->reg.parm.tremfrq); in update_voice()
199 snd_emu10k1_ptr_write(hw, FM2FRQ2, vp->ch, make_fm2frq2(vp)); in update_voice()
201 snd_emu10k1_ptr_write(hw, CCCA_RESONANCE, vp->ch, vp->reg.parm.filterQ); in update_voice()
206 * look up voice table - get the best voice in order of preference
218 best[i].time = (unsigned int)-1; /* XXX MAX_?INT really */ in lookup_voices()
219 best[i].voice = -1; in lookup_voices()
226 for (i = 0; i < emu->max_voices; i++) { in lookup_voices()
229 vp = &emu->voices[i]; in lookup_voices()
230 state = vp->state; in lookup_voices()
232 if (vp->ch < 0) { in lookup_voices()
243 val = snd_emu10k1_ptr_read(hw, CVCF_CURRENTVOL, vp->ch); in lookup_voices()
255 /* check if sample is finished playing (non-looping only) */ in lookup_voices()
257 (vp->reg.sample_mode & SNDRV_SFNT_SAMPLE_SINGLESHOT)) { in lookup_voices()
258 val = snd_emu10k1_ptr_read(hw, CCCA_CURRADDR, vp->ch) - 64; in lookup_voices()
259 if (val >= vp->reg.loopstart) in lookup_voices()
263 if (vp->time < bp->time) { in lookup_voices()
264 bp->time = vp->time; in lookup_voices()
265 bp->voice = i; in lookup_voices()
273 * emu->voice_lock is already held.
283 hw = emu->hw; in get_voice()
288 vp = &emu->voices[best[i].voice]; in get_voice()
289 if (vp->ch < 0) { in get_voice()
294 vp->ch = hwvoice->number; in get_voice()
295 emu->num_voices++; in get_voice()
312 int ch; in start_voice() local
319 hw = vp->hw; in start_voice()
320 ch = vp->ch; in start_voice()
321 if (snd_BUG_ON(ch < 0)) in start_voice()
322 return -EINVAL; in start_voice()
323 chan = vp->chan; in start_voice()
325 emem = (struct snd_emu10k1_memblk *)vp->block; in start_voice()
327 return -EINVAL; in start_voice()
328 emem->map_locked++; in start_voice()
330 /* dev_err(hw->card->devK, "emu: cannot map!\n"); */ in start_voice()
331 return -ENOMEM; in start_voice()
334 vp->reg.start += mapped_offset; in start_voice()
335 vp->reg.end += mapped_offset; in start_voice()
336 vp->reg.loopstart += mapped_offset; in start_voice()
337 vp->reg.loopend += mapped_offset; in start_voice()
341 if (hw->audigy) { in start_voice()
342 temp = FXBUS_MIDI_LEFT | (FXBUS_MIDI_RIGHT << 8) | in start_voice()
344 snd_emu10k1_ptr_write(hw, A_FXRT1, ch, temp); in start_voice()
348 snd_emu10k1_ptr_write(hw, FXRT, ch, temp); in start_voice()
351 temp = vp->reg.parm.reverb; in start_voice()
352 temp += (int)vp->chan->control[MIDI_CTL_E1_REVERB_DEPTH] * 9 / 10; in start_voice()
354 addr = vp->reg.loopstart; in start_voice()
357 addr = vp->reg.loopend; in start_voice()
358 temp = vp->reg.parm.chorus; in start_voice()
359 temp += (int)chan->control[MIDI_CTL_E3_CHORUS_DEPTH] * 9 / 10; in start_voice()
363 …map = (hw->silent_page.addr << hw->address_mode) | (hw->address_mode ? MAP_PTI_MASK1 : MAP_PTI_MAS… in start_voice()
365 addr = vp->reg.start + 64; in start_voice()
366 temp = vp->reg.parm.filterQ; in start_voice()
368 if (vp->apitch < 0xe400) in start_voice()
371 unsigned int shift = (vp->apitch - 0xe000) >> 10; in start_voice()
374 if (vp->reg.sample_mode & SNDRV_SFNT_SAMPLE_8BITS) in start_voice()
377 vtarget = (unsigned int)vp->vtarget << 16; in start_voice()
379 snd_emu10k1_ptr_write_multiple(hw, ch, in start_voice()
388 IP, vp->apitch, in start_voice()
391 ENVVAL, vp->reg.parm.moddelay, in start_voice()
392 ATKHLDM, vp->reg.parm.modatkhld, in start_voice()
393 DCYSUSM, vp->reg.parm.moddcysus, in start_voice()
394 ENVVOL, vp->reg.parm.voldelay, in start_voice()
395 ATKHLDV, vp->reg.parm.volatkhld, in start_voice()
400 IFATN, (unsigned int)vp->acutoff << 8 | (unsigned char)vp->avol, in start_voice()
403 PEFE, vp->reg.parm.pefe, in start_voice()
406 LFOVAL1, vp->reg.parm.lfo1delay, in start_voice()
407 LFOVAL2, vp->reg.parm.lfo2delay, in start_voice()
412 TREMFRQ, vp->reg.parm.tremfrq, in start_voice()
416 /* reverb and loop start (reverb 8bit, MSB) */ in start_voice()
419 /* chorus & loop end (chorus 8bit, MSB) */ in start_voice()
437 VTFT, vtarget | vp->ftarget, in start_voice()
442 hw->voices[ch].dirty = 1; in start_voice()
456 hw = vp->hw; in trigger_voice()
458 emem = (struct snd_emu10k1_memblk *)vp->block; in trigger_voice()
459 if (! emem || emem->mapped_page < 0) in trigger_voice()
463 ptarget = (unsigned int)vp->ptarget << 16; in trigger_voice()
465 ptarget = IP_TO_CP(vp->apitch); in trigger_voice()
467 snd_emu10k1_ptr_write_multiple(hw, vp->ch, in trigger_voice()
469 PTRX, ptarget | (vp->apan << 8) | vp->aaux, in trigger_voice()
475 DCYSUSV, vp->reg.parm.voldcysus | DCYSUSV_CHANNELENABLE_MASK, in trigger_voice()
490 pitch = (char)(vp->reg.parm.fmmod>>8); in make_fmmod()
491 cutoff = (vp->reg.parm.fmmod & 0xff); in make_fmmod()
492 modulation = vp->chan->gm_modulation + vp->chan->midi_pressure; in make_fmmod()
494 LIMITVALUE(pitch, -128, 127); in make_fmmod()
495 return ((unsigned char)pitch << 8) | cutoff; in make_fmmod()
506 pitch = (char)(vp->reg.parm.fm2frq2>>8); in make_fm2frq2()
507 freq = vp->reg.parm.fm2frq2 & 0xff; in make_fm2frq2()
508 modulation = vp->chan->gm_modulation + vp->chan->midi_pressure; in make_fm2frq2()
510 LIMITVALUE(pitch, -128, 127); in make_fm2frq2()
511 return ((unsigned char)pitch << 8) | freq; in make_fm2frq2()
516 struct snd_emu10k1 *hw = emu->hw; in get_pitch_shift()
518 return (hw->card_capabilities->emu_model && in get_pitch_shift()
519 hw->emu1010.word_clock == 44100) ? 0 : -501; in get_pitch_shift()