Lines Matching refs:emu

26 static int get_zone(struct snd_emux *emu, struct snd_emux_port *port,
30 static void terminate_note1(struct snd_emux *emu, int note,
32 static void exclusive_note_off(struct snd_emux *emu, struct snd_emux_port *port,
34 static void terminate_voice(struct snd_emux *emu, struct snd_emux_voice *vp, int free);
35 static void update_voice(struct snd_emux *emu, struct snd_emux_voice *vp, int update);
48 struct snd_emux *emu; in snd_emux_note_on() local
59 emu = port->emu; in snd_emux_note_on()
60 if (snd_BUG_ON(!emu || !emu->ops.get_voice || !emu->ops.trigger)) in snd_emux_note_on()
64 nvoices = get_zone(emu, port, &note, vel, chan, table); in snd_emux_note_on()
72 exclusive_note_off(emu, port, zp->v.exclusiveClass); in snd_emux_note_on()
77 terminate_note1(emu, key, chan, 0); in snd_emux_note_on()
80 spin_lock_irqsave(&emu->voice_lock, flags); in snd_emux_note_on()
89 vp = emu->ops.get_voice(emu, port); in snd_emux_note_on()
93 emu->ops.terminate(vp); in snd_emux_note_on()
95 vp->time = emu->use_time++; in snd_emux_note_on()
110 if (emu->ops.prepare) { in snd_emux_note_on()
112 if (emu->ops.prepare(vp) >= 0) in snd_emux_note_on()
118 for (i = 0; i < emu->max_voices; i++) { in snd_emux_note_on()
119 vp = &emu->voices[i]; in snd_emux_note_on()
122 emu->ops.trigger(vp); in snd_emux_note_on()
127 spin_unlock_irqrestore(&emu->voice_lock, flags); in snd_emux_note_on()
148 struct snd_emux *emu; in snd_emux_note_off() local
157 emu = port->emu; in snd_emux_note_off()
158 if (snd_BUG_ON(!emu || !emu->ops.release)) in snd_emux_note_off()
161 spin_lock_irqsave(&emu->voice_lock, flags); in snd_emux_note_off()
162 for (ch = 0; ch < emu->max_voices; ch++) { in snd_emux_note_off()
163 vp = &emu->voices[ch]; in snd_emux_note_off()
174 if (! emu->timer_active) { in snd_emux_note_off()
175 mod_timer(&emu->tlist, jiffies + 1); in snd_emux_note_off()
176 emu->timer_active = 1; in snd_emux_note_off()
180 emu->ops.release(vp); in snd_emux_note_off()
183 spin_unlock_irqrestore(&emu->voice_lock, flags); in snd_emux_note_off()
193 struct snd_emux *emu = from_timer(emu, t, tlist); in snd_emux_timer_callback() local
198 spin_lock_irqsave(&emu->voice_lock, flags); in snd_emux_timer_callback()
199 for (ch = 0; ch < emu->max_voices; ch++) { in snd_emux_timer_callback()
200 vp = &emu->voices[ch]; in snd_emux_timer_callback()
205 emu->ops.release(vp); in snd_emux_timer_callback()
211 mod_timer(&emu->tlist, jiffies + 1); in snd_emux_timer_callback()
212 emu->timer_active = 1; in snd_emux_timer_callback()
214 emu->timer_active = 0; in snd_emux_timer_callback()
215 spin_unlock_irqrestore(&emu->voice_lock, flags); in snd_emux_timer_callback()
225 struct snd_emux *emu; in snd_emux_key_press() local
234 emu = port->emu; in snd_emux_key_press()
235 if (snd_BUG_ON(!emu || !emu->ops.update)) in snd_emux_key_press()
238 spin_lock_irqsave(&emu->voice_lock, flags); in snd_emux_key_press()
239 for (ch = 0; ch < emu->max_voices; ch++) { in snd_emux_key_press()
240 vp = &emu->voices[ch]; in snd_emux_key_press()
244 update_voice(emu, vp, SNDRV_EMUX_UPDATE_VOLUME); in snd_emux_key_press()
247 spin_unlock_irqrestore(&emu->voice_lock, flags); in snd_emux_key_press()
257 struct snd_emux *emu; in snd_emux_update_channel() local
265 emu = port->emu; in snd_emux_update_channel()
266 if (snd_BUG_ON(!emu || !emu->ops.update)) in snd_emux_update_channel()
269 spin_lock_irqsave(&emu->voice_lock, flags); in snd_emux_update_channel()
270 for (i = 0; i < emu->max_voices; i++) { in snd_emux_update_channel()
271 vp = &emu->voices[i]; in snd_emux_update_channel()
273 update_voice(emu, vp, update); in snd_emux_update_channel()
275 spin_unlock_irqrestore(&emu->voice_lock, flags); in snd_emux_update_channel()
284 struct snd_emux *emu; in snd_emux_update_port() local
292 emu = port->emu; in snd_emux_update_port()
293 if (snd_BUG_ON(!emu || !emu->ops.update)) in snd_emux_update_port()
296 spin_lock_irqsave(&emu->voice_lock, flags); in snd_emux_update_port()
297 for (i = 0; i < emu->max_voices; i++) { in snd_emux_update_port()
298 vp = &emu->voices[i]; in snd_emux_update_port()
300 update_voice(emu, vp, update); in snd_emux_update_port()
302 spin_unlock_irqrestore(&emu->voice_lock, flags); in snd_emux_update_port()
364 terminate_note1(struct snd_emux *emu, int note, struct snd_midi_channel *chan, int free) in terminate_note1() argument
370 spin_lock_irqsave(&emu->voice_lock, flags); in terminate_note1()
371 for (i = 0; i < emu->max_voices; i++) { in terminate_note1()
372 vp = &emu->voices[i]; in terminate_note1()
375 terminate_voice(emu, vp, free); in terminate_note1()
377 spin_unlock_irqrestore(&emu->voice_lock, flags); in terminate_note1()
387 struct snd_emux *emu; in snd_emux_terminate_note() local
394 emu = port->emu; in snd_emux_terminate_note()
395 if (snd_BUG_ON(!emu || !emu->ops.terminate)) in snd_emux_terminate_note()
398 terminate_note1(emu, note, chan, 1); in snd_emux_terminate_note()
406 snd_emux_terminate_all(struct snd_emux *emu) in snd_emux_terminate_all() argument
412 spin_lock_irqsave(&emu->voice_lock, flags); in snd_emux_terminate_all()
413 for (i = 0; i < emu->max_voices; i++) { in snd_emux_terminate_all()
414 vp = &emu->voices[i]; in snd_emux_terminate_all()
416 terminate_voice(emu, vp, 0); in snd_emux_terminate_all()
418 if (emu->ops.free_voice) in snd_emux_terminate_all()
419 emu->ops.free_voice(vp); in snd_emux_terminate_all()
420 if (emu->ops.reset) in snd_emux_terminate_all()
421 emu->ops.reset(emu, i); in snd_emux_terminate_all()
426 emu->use_time = 0; in snd_emux_terminate_all()
427 spin_unlock_irqrestore(&emu->voice_lock, flags); in snd_emux_terminate_all()
439 struct snd_emux *emu; in snd_emux_sounds_off_all() local
445 emu = port->emu; in snd_emux_sounds_off_all()
446 if (snd_BUG_ON(!emu || !emu->ops.terminate)) in snd_emux_sounds_off_all()
449 spin_lock_irqsave(&emu->voice_lock, flags); in snd_emux_sounds_off_all()
450 for (i = 0; i < emu->max_voices; i++) { in snd_emux_sounds_off_all()
451 vp = &emu->voices[i]; in snd_emux_sounds_off_all()
454 terminate_voice(emu, vp, 0); in snd_emux_sounds_off_all()
456 if (emu->ops.free_voice) in snd_emux_sounds_off_all()
457 emu->ops.free_voice(vp); in snd_emux_sounds_off_all()
458 if (emu->ops.reset) in snd_emux_sounds_off_all()
459 emu->ops.reset(emu, i); in snd_emux_sounds_off_all()
462 spin_unlock_irqrestore(&emu->voice_lock, flags); in snd_emux_sounds_off_all()
471 exclusive_note_off(struct snd_emux *emu, struct snd_emux_port *port, int exclass) in exclusive_note_off() argument
477 spin_lock_irqsave(&emu->voice_lock, flags); in exclusive_note_off()
478 for (i = 0; i < emu->max_voices; i++) { in exclusive_note_off()
479 vp = &emu->voices[i]; in exclusive_note_off()
482 terminate_voice(emu, vp, 0); in exclusive_note_off()
485 spin_unlock_irqrestore(&emu->voice_lock, flags); in exclusive_note_off()
493 terminate_voice(struct snd_emux *emu, struct snd_emux_voice *vp, int free) in terminate_voice() argument
495 emu->ops.terminate(vp); in terminate_voice()
496 vp->time = emu->use_time++; in terminate_voice()
502 if (free && emu->ops.free_voice) in terminate_voice()
503 emu->ops.free_voice(vp); in terminate_voice()
511 update_voice(struct snd_emux *emu, struct snd_emux_voice *vp, int update) in update_voice() argument
526 emu->ops.update(vp, update); in update_voice()
655 if (vp->emu->linear_panning) { in calc_pan()
848 offset += vp->emu->pitch_shift; in calc_pitch()
889 get_zone(struct snd_emux *emu, struct snd_emux_port *port, in get_zone() argument
906 return snd_soundfont_search_zone(emu->sflist, notep, vel, preset, bank, in get_zone()
914 snd_emux_init_voices(struct snd_emux *emu) in snd_emux_init_voices() argument
920 spin_lock_irqsave(&emu->voice_lock, flags); in snd_emux_init_voices()
921 for (i = 0; i < emu->max_voices; i++) { in snd_emux_init_voices()
922 vp = &emu->voices[i]; in snd_emux_init_voices()
928 vp->emu = emu; in snd_emux_init_voices()
929 vp->hw = emu->hw; in snd_emux_init_voices()
931 spin_unlock_irqrestore(&emu->voice_lock, flags); in snd_emux_init_voices()
936 void snd_emux_lock_voice(struct snd_emux *emu, int voice) in snd_emux_lock_voice() argument
940 spin_lock_irqsave(&emu->voice_lock, flags); in snd_emux_lock_voice()
941 if (emu->voices[voice].state == SNDRV_EMUX_ST_OFF) in snd_emux_lock_voice()
942 emu->voices[voice].state = SNDRV_EMUX_ST_LOCKED; in snd_emux_lock_voice()
946 voice, emu->voices[voice].state); in snd_emux_lock_voice()
947 spin_unlock_irqrestore(&emu->voice_lock, flags); in snd_emux_lock_voice()
954 void snd_emux_unlock_voice(struct snd_emux *emu, int voice) in snd_emux_unlock_voice() argument
958 spin_lock_irqsave(&emu->voice_lock, flags); in snd_emux_unlock_voice()
959 if (emu->voices[voice].state == SNDRV_EMUX_ST_LOCKED) in snd_emux_unlock_voice()
960 emu->voices[voice].state = SNDRV_EMUX_ST_OFF; in snd_emux_unlock_voice()
964 voice, emu->voices[voice].state); in snd_emux_unlock_voice()
965 spin_unlock_irqrestore(&emu->voice_lock, flags); in snd_emux_unlock_voice()