xref: /openbmc/linux/sound/synth/emux/emux_voice.h (revision 75bf465f0bc33e9b776a46d6a1b9b990f5fb7c37)
1*1a59d1b8SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
21da177e4SLinus Torvalds #ifndef __EMUX_VOICE_H
31da177e4SLinus Torvalds #define __EMUX_VOICE_H
41da177e4SLinus Torvalds 
51da177e4SLinus Torvalds /*
61da177e4SLinus Torvalds  * A structure to keep track of each hardware voice
71da177e4SLinus Torvalds  *
81da177e4SLinus Torvalds  *  Copyright (C) 1999 Steve Ratcliffe
91da177e4SLinus Torvalds  *  Copyright (c) 1999-2000 Takashi Iwai <tiwai@suse.de>
101da177e4SLinus Torvalds  */
111da177e4SLinus Torvalds 
121da177e4SLinus Torvalds #include <linux/wait.h>
131da177e4SLinus Torvalds #include <linux/sched.h>
141da177e4SLinus Torvalds #include <sound/core.h>
151da177e4SLinus Torvalds #include <sound/emux_synth.h>
161da177e4SLinus Torvalds 
171da177e4SLinus Torvalds /* Prototypes for emux_seq.c */
1803da312aSTakashi Iwai int snd_emux_init_seq(struct snd_emux *emu, struct snd_card *card, int index);
1903da312aSTakashi Iwai void snd_emux_detach_seq(struct snd_emux *emu);
2003da312aSTakashi Iwai struct snd_emux_port *snd_emux_create_port(struct snd_emux *emu, char *name,
2103da312aSTakashi Iwai 					   int max_channels, int type,
2203da312aSTakashi Iwai 					   struct snd_seq_port_callback *callback);
2303da312aSTakashi Iwai void snd_emux_reset_port(struct snd_emux_port *port);
2403da312aSTakashi Iwai int snd_emux_event_input(struct snd_seq_event *ev, int direct, void *private,
2503da312aSTakashi Iwai 			 int atomic, int hop);
2603da312aSTakashi Iwai int snd_emux_inc_count(struct snd_emux *emu);
2703da312aSTakashi Iwai void snd_emux_dec_count(struct snd_emux *emu);
2803da312aSTakashi Iwai int snd_emux_init_virmidi(struct snd_emux *emu, struct snd_card *card);
2903da312aSTakashi Iwai int snd_emux_delete_virmidi(struct snd_emux *emu);
301da177e4SLinus Torvalds 
311da177e4SLinus Torvalds /* Prototypes for emux_synth.c */
3203da312aSTakashi Iwai void snd_emux_init_voices(struct snd_emux *emu);
331da177e4SLinus Torvalds 
341da177e4SLinus Torvalds void snd_emux_note_on(void *p, int note, int vel, struct snd_midi_channel *chan);
351da177e4SLinus Torvalds void snd_emux_note_off(void *p, int note, int vel, struct snd_midi_channel *chan);
361da177e4SLinus Torvalds void snd_emux_key_press(void *p, int note, int vel, struct snd_midi_channel *chan);
3703da312aSTakashi Iwai void snd_emux_terminate_note(void *p, int note, struct snd_midi_channel *chan);
381da177e4SLinus Torvalds void snd_emux_control(void *p, int type, struct snd_midi_channel *chan);
391da177e4SLinus Torvalds 
4003da312aSTakashi Iwai void snd_emux_sounds_off_all(struct snd_emux_port *port);
4103da312aSTakashi Iwai void snd_emux_update_channel(struct snd_emux_port *port,
4203da312aSTakashi Iwai 			     struct snd_midi_channel *chan, int update);
4303da312aSTakashi Iwai void snd_emux_update_port(struct snd_emux_port *port, int update);
441da177e4SLinus Torvalds 
4508352b20SKees Cook void snd_emux_timer_callback(struct timer_list *t);
461da177e4SLinus Torvalds 
471da177e4SLinus Torvalds /* emux_effect.c */
481da177e4SLinus Torvalds #ifdef SNDRV_EMUX_USE_RAW_EFFECT
4903da312aSTakashi Iwai void snd_emux_create_effect(struct snd_emux_port *p);
5003da312aSTakashi Iwai void snd_emux_delete_effect(struct snd_emux_port *p);
5103da312aSTakashi Iwai void snd_emux_clear_effect(struct snd_emux_port *p);
5203da312aSTakashi Iwai void snd_emux_setup_effect(struct snd_emux_voice *vp);
5303da312aSTakashi Iwai void snd_emux_send_effect_oss(struct snd_emux_port *port,
5403da312aSTakashi Iwai 			      struct snd_midi_channel *chan, int type, int val);
5503da312aSTakashi Iwai void snd_emux_send_effect(struct snd_emux_port *port,
5603da312aSTakashi Iwai 			  struct snd_midi_channel *chan, int type, int val, int mode);
571da177e4SLinus Torvalds #endif
581da177e4SLinus Torvalds 
591da177e4SLinus Torvalds /* emux_nrpn.c */
6003da312aSTakashi Iwai void snd_emux_sysex(void *private_data, unsigned char *buf, int len,
6103da312aSTakashi Iwai 		    int parsed, struct snd_midi_channel_set *chset);
6203da312aSTakashi Iwai int snd_emux_xg_control(struct snd_emux_port *port,
6303da312aSTakashi Iwai 			struct snd_midi_channel *chan, int param);
6403da312aSTakashi Iwai void snd_emux_nrpn(void *private_data, struct snd_midi_channel *chan,
6503da312aSTakashi Iwai 		   struct snd_midi_channel_set *chset);
661da177e4SLinus Torvalds 
671da177e4SLinus Torvalds /* emux_oss.c */
6803da312aSTakashi Iwai void snd_emux_init_seq_oss(struct snd_emux *emu);
6903da312aSTakashi Iwai void snd_emux_detach_seq_oss(struct snd_emux *emu);
701da177e4SLinus Torvalds 
711da177e4SLinus Torvalds /* emux_proc.c */
7252262b4aSTakashi Iwai #ifdef CONFIG_SND_PROC_FS
7303da312aSTakashi Iwai void snd_emux_proc_init(struct snd_emux *emu, struct snd_card *card, int device);
7403da312aSTakashi Iwai void snd_emux_proc_free(struct snd_emux *emu);
7552262b4aSTakashi Iwai #else
snd_emux_proc_init(struct snd_emux * emu,struct snd_card * card,int device)7652262b4aSTakashi Iwai static inline void snd_emux_proc_init(struct snd_emux *emu,
7752262b4aSTakashi Iwai 				      struct snd_card *card, int device) {}
snd_emux_proc_free(struct snd_emux * emu)7852262b4aSTakashi Iwai static inline void snd_emux_proc_free(struct snd_emux *emu) {}
791da177e4SLinus Torvalds #endif
801da177e4SLinus Torvalds 
811da177e4SLinus Torvalds #define STATE_IS_PLAYING(s) ((s) & SNDRV_EMUX_ST_ON)
821da177e4SLinus Torvalds 
831da177e4SLinus Torvalds /* emux_hwdep.c */
8403da312aSTakashi Iwai int snd_emux_init_hwdep(struct snd_emux *emu);
8503da312aSTakashi Iwai void snd_emux_delete_hwdep(struct snd_emux *emu);
861da177e4SLinus Torvalds 
871da177e4SLinus Torvalds #endif
88