Lines Matching refs:emu

40 static int get_zone(struct snd_emux *emu, struct snd_emux_port *port,
44 static void terminate_note1(struct snd_emux *emu, int note,
46 static void exclusive_note_off(struct snd_emux *emu, struct snd_emux_port *port,
48 static void terminate_voice(struct snd_emux *emu, struct snd_emux_voice *vp, int free);
49 static void update_voice(struct snd_emux *emu, struct snd_emux_voice *vp, int update);
62 struct snd_emux *emu; in snd_emux_note_on() local
73 emu = port->emu; in snd_emux_note_on()
74 if (snd_BUG_ON(!emu || !emu->ops.get_voice || !emu->ops.trigger)) in snd_emux_note_on()
78 nvoices = get_zone(emu, port, &note, vel, chan, table); in snd_emux_note_on()
86 exclusive_note_off(emu, port, zp->v.exclusiveClass); in snd_emux_note_on()
91 terminate_note1(emu, key, chan, 0); in snd_emux_note_on()
94 spin_lock_irqsave(&emu->voice_lock, flags); in snd_emux_note_on()
103 vp = emu->ops.get_voice(emu, port); in snd_emux_note_on()
107 emu->ops.terminate(vp); in snd_emux_note_on()
109 vp->time = emu->use_time++; in snd_emux_note_on()
124 if (emu->ops.prepare) { in snd_emux_note_on()
126 if (emu->ops.prepare(vp) >= 0) in snd_emux_note_on()
132 for (i = 0; i < emu->max_voices; i++) { in snd_emux_note_on()
133 vp = &emu->voices[i]; in snd_emux_note_on()
136 emu->ops.trigger(vp); in snd_emux_note_on()
141 spin_unlock_irqrestore(&emu->voice_lock, flags); in snd_emux_note_on()
162 struct snd_emux *emu; in snd_emux_note_off() local
171 emu = port->emu; in snd_emux_note_off()
172 if (snd_BUG_ON(!emu || !emu->ops.release)) in snd_emux_note_off()
175 spin_lock_irqsave(&emu->voice_lock, flags); in snd_emux_note_off()
176 for (ch = 0; ch < emu->max_voices; ch++) { in snd_emux_note_off()
177 vp = &emu->voices[ch]; in snd_emux_note_off()
188 if (! emu->timer_active) { in snd_emux_note_off()
189 mod_timer(&emu->tlist, jiffies + 1); in snd_emux_note_off()
190 emu->timer_active = 1; in snd_emux_note_off()
194 emu->ops.release(vp); in snd_emux_note_off()
197 spin_unlock_irqrestore(&emu->voice_lock, flags); in snd_emux_note_off()
207 struct snd_emux *emu = (struct snd_emux *) data; in snd_emux_timer_callback() local
212 spin_lock_irqsave(&emu->voice_lock, flags); in snd_emux_timer_callback()
213 for (ch = 0; ch < emu->max_voices; ch++) { in snd_emux_timer_callback()
214 vp = &emu->voices[ch]; in snd_emux_timer_callback()
219 emu->ops.release(vp); in snd_emux_timer_callback()
225 mod_timer(&emu->tlist, jiffies + 1); in snd_emux_timer_callback()
226 emu->timer_active = 1; in snd_emux_timer_callback()
228 emu->timer_active = 0; in snd_emux_timer_callback()
229 spin_unlock_irqrestore(&emu->voice_lock, flags); in snd_emux_timer_callback()
239 struct snd_emux *emu; in snd_emux_key_press() local
248 emu = port->emu; in snd_emux_key_press()
249 if (snd_BUG_ON(!emu || !emu->ops.update)) in snd_emux_key_press()
252 spin_lock_irqsave(&emu->voice_lock, flags); in snd_emux_key_press()
253 for (ch = 0; ch < emu->max_voices; ch++) { in snd_emux_key_press()
254 vp = &emu->voices[ch]; in snd_emux_key_press()
258 update_voice(emu, vp, SNDRV_EMUX_UPDATE_VOLUME); in snd_emux_key_press()
261 spin_unlock_irqrestore(&emu->voice_lock, flags); in snd_emux_key_press()
271 struct snd_emux *emu; in snd_emux_update_channel() local
279 emu = port->emu; in snd_emux_update_channel()
280 if (snd_BUG_ON(!emu || !emu->ops.update)) in snd_emux_update_channel()
283 spin_lock_irqsave(&emu->voice_lock, flags); in snd_emux_update_channel()
284 for (i = 0; i < emu->max_voices; i++) { in snd_emux_update_channel()
285 vp = &emu->voices[i]; in snd_emux_update_channel()
287 update_voice(emu, vp, update); in snd_emux_update_channel()
289 spin_unlock_irqrestore(&emu->voice_lock, flags); in snd_emux_update_channel()
298 struct snd_emux *emu; in snd_emux_update_port() local
306 emu = port->emu; in snd_emux_update_port()
307 if (snd_BUG_ON(!emu || !emu->ops.update)) in snd_emux_update_port()
310 spin_lock_irqsave(&emu->voice_lock, flags); in snd_emux_update_port()
311 for (i = 0; i < emu->max_voices; i++) { in snd_emux_update_port()
312 vp = &emu->voices[i]; in snd_emux_update_port()
314 update_voice(emu, vp, update); in snd_emux_update_port()
316 spin_unlock_irqrestore(&emu->voice_lock, flags); in snd_emux_update_port()
378 terminate_note1(struct snd_emux *emu, int note, struct snd_midi_channel *chan, int free) in terminate_note1() argument
384 spin_lock_irqsave(&emu->voice_lock, flags); in terminate_note1()
385 for (i = 0; i < emu->max_voices; i++) { in terminate_note1()
386 vp = &emu->voices[i]; in terminate_note1()
389 terminate_voice(emu, vp, free); in terminate_note1()
391 spin_unlock_irqrestore(&emu->voice_lock, flags); in terminate_note1()
401 struct snd_emux *emu; in snd_emux_terminate_note() local
408 emu = port->emu; in snd_emux_terminate_note()
409 if (snd_BUG_ON(!emu || !emu->ops.terminate)) in snd_emux_terminate_note()
412 terminate_note1(emu, note, chan, 1); in snd_emux_terminate_note()
420 snd_emux_terminate_all(struct snd_emux *emu) in snd_emux_terminate_all() argument
426 spin_lock_irqsave(&emu->voice_lock, flags); in snd_emux_terminate_all()
427 for (i = 0; i < emu->max_voices; i++) { in snd_emux_terminate_all()
428 vp = &emu->voices[i]; in snd_emux_terminate_all()
430 terminate_voice(emu, vp, 0); in snd_emux_terminate_all()
432 if (emu->ops.free_voice) in snd_emux_terminate_all()
433 emu->ops.free_voice(vp); in snd_emux_terminate_all()
434 if (emu->ops.reset) in snd_emux_terminate_all()
435 emu->ops.reset(emu, i); in snd_emux_terminate_all()
440 emu->use_time = 0; in snd_emux_terminate_all()
441 spin_unlock_irqrestore(&emu->voice_lock, flags); in snd_emux_terminate_all()
453 struct snd_emux *emu; in snd_emux_sounds_off_all() local
459 emu = port->emu; in snd_emux_sounds_off_all()
460 if (snd_BUG_ON(!emu || !emu->ops.terminate)) in snd_emux_sounds_off_all()
463 spin_lock_irqsave(&emu->voice_lock, flags); in snd_emux_sounds_off_all()
464 for (i = 0; i < emu->max_voices; i++) { in snd_emux_sounds_off_all()
465 vp = &emu->voices[i]; in snd_emux_sounds_off_all()
468 terminate_voice(emu, vp, 0); in snd_emux_sounds_off_all()
470 if (emu->ops.free_voice) in snd_emux_sounds_off_all()
471 emu->ops.free_voice(vp); in snd_emux_sounds_off_all()
472 if (emu->ops.reset) in snd_emux_sounds_off_all()
473 emu->ops.reset(emu, i); in snd_emux_sounds_off_all()
476 spin_unlock_irqrestore(&emu->voice_lock, flags); in snd_emux_sounds_off_all()
485 exclusive_note_off(struct snd_emux *emu, struct snd_emux_port *port, int exclass) in exclusive_note_off() argument
491 spin_lock_irqsave(&emu->voice_lock, flags); in exclusive_note_off()
492 for (i = 0; i < emu->max_voices; i++) { in exclusive_note_off()
493 vp = &emu->voices[i]; in exclusive_note_off()
496 terminate_voice(emu, vp, 0); in exclusive_note_off()
499 spin_unlock_irqrestore(&emu->voice_lock, flags); in exclusive_note_off()
507 terminate_voice(struct snd_emux *emu, struct snd_emux_voice *vp, int free) in terminate_voice() argument
509 emu->ops.terminate(vp); in terminate_voice()
510 vp->time = emu->use_time++; in terminate_voice()
516 if (free && emu->ops.free_voice) in terminate_voice()
517 emu->ops.free_voice(vp); in terminate_voice()
525 update_voice(struct snd_emux *emu, struct snd_emux_voice *vp, int update) in update_voice() argument
540 emu->ops.update(vp, update); in update_voice()
669 if (vp->emu->linear_panning) { in calc_pan()
862 offset += vp->emu->pitch_shift; in calc_pitch()
903 get_zone(struct snd_emux *emu, struct snd_emux_port *port, in get_zone() argument
920 return snd_soundfont_search_zone(emu->sflist, notep, vel, preset, bank, in get_zone()
928 snd_emux_init_voices(struct snd_emux *emu) in snd_emux_init_voices() argument
934 spin_lock_irqsave(&emu->voice_lock, flags); in snd_emux_init_voices()
935 for (i = 0; i < emu->max_voices; i++) { in snd_emux_init_voices()
936 vp = &emu->voices[i]; in snd_emux_init_voices()
942 vp->emu = emu; in snd_emux_init_voices()
943 vp->hw = emu->hw; in snd_emux_init_voices()
945 spin_unlock_irqrestore(&emu->voice_lock, flags); in snd_emux_init_voices()
950 void snd_emux_lock_voice(struct snd_emux *emu, int voice) in snd_emux_lock_voice() argument
954 spin_lock_irqsave(&emu->voice_lock, flags); in snd_emux_lock_voice()
955 if (emu->voices[voice].state == SNDRV_EMUX_ST_OFF) in snd_emux_lock_voice()
956 emu->voices[voice].state = SNDRV_EMUX_ST_LOCKED; in snd_emux_lock_voice()
960 voice, emu->voices[voice].state); in snd_emux_lock_voice()
961 spin_unlock_irqrestore(&emu->voice_lock, flags); in snd_emux_lock_voice()
968 void snd_emux_unlock_voice(struct snd_emux *emu, int voice) in snd_emux_unlock_voice() argument
972 spin_lock_irqsave(&emu->voice_lock, flags); in snd_emux_unlock_voice()
973 if (emu->voices[voice].state == SNDRV_EMUX_ST_LOCKED) in snd_emux_unlock_voice()
974 emu->voices[voice].state = SNDRV_EMUX_ST_OFF; in snd_emux_unlock_voice()
978 voice, emu->voices[voice].state); in snd_emux_unlock_voice()
979 spin_unlock_irqrestore(&emu->voice_lock, flags); in snd_emux_unlock_voice()