1 /*(LGPL)
2 ---------------------------------------------------------------------------
3 	asynccmd.h - Asynchronous Command Interface for the audio engine
4 ---------------------------------------------------------------------------
5  * Copyright (C) 2001-2003, 2007 David Olofson
6  *
7  * This program is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU Lesser General Public License as published by
9  * the Free Software Foundation; either version 2.1 of the License, or (at
10  * your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this program; if not, write to the Free Software Foundation,
19  * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  */
21 
22 #ifndef	_ASYNCCMD_H_
23 #define	_ASYNCCMD_H_
24 
25 #include "sfifo.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 #define	MAX_COMMANDS	128
32 
33 /*----------------------------------------------------------
34 	Asynchronous command interface stuff
35 ----------------------------------------------------------*/
36 
37 typedef struct
38 {
39 	enum
40 	{
41 		CMD_STOP = 0,
42 		CMD_STOP_ALL,
43 		CMD_PLAY,
44 		CMD_CCONTROL,	/* Channel Control */
45 		CMD_GCONTROL,	/* Group Control */
46 		CMD_MCONTROL,	/* Mixer Control */
47 		CMD_WAIT	/* Advance Audio Time */
48 	} action;
49 	signed char	cid;
50 	unsigned char	index;
51 	int		tag;
52 	int		arg1;
53 	int		arg2;
54 } command_t;
55 
56 extern sfifo_t commands;
57 
58 
59 /*----------------------------------------------------------
60 	Mixer Control
61 ----------------------------------------------------------*/
62 void audio_bus_controlf(unsigned bus, unsigned slot, unsigned ctl, float arg);
63 void audio_bus_control(unsigned bus, unsigned slot, unsigned ctl, int arg);
64 
65 
66 /*----------------------------------------------------------
67 	Group Control
68 ----------------------------------------------------------*/
69 //void audio_group_default(unsigned gid, unsigned ctl, int arg);
70 
71 void audio_group_stop(unsigned gid);
72 void audio_group_controlf(unsigned gid, unsigned ctl, float arg);
73 void audio_group_control(unsigned gid, unsigned ctl, int arg);
74 
75 
76 /*----------------------------------------------------------
77 	Channel Control
78 ----------------------------------------------------------*/
79 void audio_channel_play(int cid, int tag, int pitch, int velocity);
80 void audio_channel_controlf(int cid, int tag, int ctl, float arg);
81 void audio_channel_control(int cid, int tag, int ctl, int arg);
82 void audio_channel_stop(int cid, int tag);	/* -1 to stop all */
83 
84 /*
85 FIXME: Broken API. Broken implementation. It just "seems" to work.
86 */
87 int audio_channel_playing(int cid);
88 
89 /*
90  * Set audio time for subsequent calls to 'ms'.
91  */
92 void audio_bump(unsigned ms);
93 
94 #ifdef __cplusplus
95 };
96 #endif
97 
98 #endif /*_ASYNCCMD_H_*/
99