162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci#ifndef __EMUX_VOICE_H
362306a36Sopenharmony_ci#define __EMUX_VOICE_H
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci/*
662306a36Sopenharmony_ci * A structure to keep track of each hardware voice
762306a36Sopenharmony_ci *
862306a36Sopenharmony_ci *  Copyright (C) 1999 Steve Ratcliffe
962306a36Sopenharmony_ci *  Copyright (c) 1999-2000 Takashi Iwai <tiwai@suse.de>
1062306a36Sopenharmony_ci */
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci#include <linux/wait.h>
1362306a36Sopenharmony_ci#include <linux/sched.h>
1462306a36Sopenharmony_ci#include <sound/core.h>
1562306a36Sopenharmony_ci#include <sound/emux_synth.h>
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci/* Prototypes for emux_seq.c */
1862306a36Sopenharmony_ciint snd_emux_init_seq(struct snd_emux *emu, struct snd_card *card, int index);
1962306a36Sopenharmony_civoid snd_emux_detach_seq(struct snd_emux *emu);
2062306a36Sopenharmony_cistruct snd_emux_port *snd_emux_create_port(struct snd_emux *emu, char *name,
2162306a36Sopenharmony_ci					   int max_channels, int type,
2262306a36Sopenharmony_ci					   struct snd_seq_port_callback *callback);
2362306a36Sopenharmony_civoid snd_emux_reset_port(struct snd_emux_port *port);
2462306a36Sopenharmony_ciint snd_emux_event_input(struct snd_seq_event *ev, int direct, void *private,
2562306a36Sopenharmony_ci			 int atomic, int hop);
2662306a36Sopenharmony_ciint snd_emux_inc_count(struct snd_emux *emu);
2762306a36Sopenharmony_civoid snd_emux_dec_count(struct snd_emux *emu);
2862306a36Sopenharmony_ciint snd_emux_init_virmidi(struct snd_emux *emu, struct snd_card *card);
2962306a36Sopenharmony_ciint snd_emux_delete_virmidi(struct snd_emux *emu);
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci/* Prototypes for emux_synth.c */
3262306a36Sopenharmony_civoid snd_emux_init_voices(struct snd_emux *emu);
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_civoid snd_emux_note_on(void *p, int note, int vel, struct snd_midi_channel *chan);
3562306a36Sopenharmony_civoid snd_emux_note_off(void *p, int note, int vel, struct snd_midi_channel *chan);
3662306a36Sopenharmony_civoid snd_emux_key_press(void *p, int note, int vel, struct snd_midi_channel *chan);
3762306a36Sopenharmony_civoid snd_emux_terminate_note(void *p, int note, struct snd_midi_channel *chan);
3862306a36Sopenharmony_civoid snd_emux_control(void *p, int type, struct snd_midi_channel *chan);
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_civoid snd_emux_sounds_off_all(struct snd_emux_port *port);
4162306a36Sopenharmony_civoid snd_emux_update_channel(struct snd_emux_port *port,
4262306a36Sopenharmony_ci			     struct snd_midi_channel *chan, int update);
4362306a36Sopenharmony_civoid snd_emux_update_port(struct snd_emux_port *port, int update);
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_civoid snd_emux_timer_callback(struct timer_list *t);
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci/* emux_effect.c */
4862306a36Sopenharmony_ci#ifdef SNDRV_EMUX_USE_RAW_EFFECT
4962306a36Sopenharmony_civoid snd_emux_create_effect(struct snd_emux_port *p);
5062306a36Sopenharmony_civoid snd_emux_delete_effect(struct snd_emux_port *p);
5162306a36Sopenharmony_civoid snd_emux_clear_effect(struct snd_emux_port *p);
5262306a36Sopenharmony_civoid snd_emux_setup_effect(struct snd_emux_voice *vp);
5362306a36Sopenharmony_civoid snd_emux_send_effect_oss(struct snd_emux_port *port,
5462306a36Sopenharmony_ci			      struct snd_midi_channel *chan, int type, int val);
5562306a36Sopenharmony_civoid snd_emux_send_effect(struct snd_emux_port *port,
5662306a36Sopenharmony_ci			  struct snd_midi_channel *chan, int type, int val, int mode);
5762306a36Sopenharmony_ci#endif
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_ci/* emux_nrpn.c */
6062306a36Sopenharmony_civoid snd_emux_sysex(void *private_data, unsigned char *buf, int len,
6162306a36Sopenharmony_ci		    int parsed, struct snd_midi_channel_set *chset);
6262306a36Sopenharmony_ciint snd_emux_xg_control(struct snd_emux_port *port,
6362306a36Sopenharmony_ci			struct snd_midi_channel *chan, int param);
6462306a36Sopenharmony_civoid snd_emux_nrpn(void *private_data, struct snd_midi_channel *chan,
6562306a36Sopenharmony_ci		   struct snd_midi_channel_set *chset);
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ci/* emux_oss.c */
6862306a36Sopenharmony_civoid snd_emux_init_seq_oss(struct snd_emux *emu);
6962306a36Sopenharmony_civoid snd_emux_detach_seq_oss(struct snd_emux *emu);
7062306a36Sopenharmony_ci
7162306a36Sopenharmony_ci/* emux_proc.c */
7262306a36Sopenharmony_ci#ifdef CONFIG_SND_PROC_FS
7362306a36Sopenharmony_civoid snd_emux_proc_init(struct snd_emux *emu, struct snd_card *card, int device);
7462306a36Sopenharmony_civoid snd_emux_proc_free(struct snd_emux *emu);
7562306a36Sopenharmony_ci#else
7662306a36Sopenharmony_cistatic inline void snd_emux_proc_init(struct snd_emux *emu,
7762306a36Sopenharmony_ci				      struct snd_card *card, int device) {}
7862306a36Sopenharmony_cistatic inline void snd_emux_proc_free(struct snd_emux *emu) {}
7962306a36Sopenharmony_ci#endif
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_ci#define STATE_IS_PLAYING(s) ((s) & SNDRV_EMUX_ST_ON)
8262306a36Sopenharmony_ci
8362306a36Sopenharmony_ci/* emux_hwdep.c */
8462306a36Sopenharmony_ciint snd_emux_init_hwdep(struct snd_emux *emu);
8562306a36Sopenharmony_civoid snd_emux_delete_hwdep(struct snd_emux *emu);
8662306a36Sopenharmony_ci
8762306a36Sopenharmony_ci#endif
88