1 /*(LGPL)
2 ---------------------------------------------------------------------------
3 	a_control.h - Group/Channel/Voice Control Implementation
4 ---------------------------------------------------------------------------
5  * Copyright (C) 2001, 2002, 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 _A_CONTROL_H_
23 #define _A_CONTROL_H_
24 
25 #include <string.h>
26 #include "a_struct.h"
27 
28 
29 /*----------------------------------------------------------
30 	Tools
31 ----------------------------------------------------------*/
32 
33 /* Controller bank copy macros */
acc_copy(accbank_t * to,accbank_t * from,unsigned first,unsigned last)34 static inline void acc_copy(accbank_t *to, accbank_t *from,
35 		unsigned first, unsigned last)
36 {
37 	memcpy(to + first, from + first, (last - first + 1) * sizeof(int));
38 }
39 
acc_copya(accbank_t * to,accbank_t * from)40 static inline void acc_copya(accbank_t *to, accbank_t *from)
41 {
42 	memcpy(to, from, sizeof(accbank_t));
43 }
44 
45 #define	ACC_IS_FIXEDPOINT(x)	(((x) >= ACC_PAN) && ((x) <= ACC_Z))
46 
47 #define	ACC_NOTRANSFORM_FIRST	ACC_GROUP
48 #define	ACC_NOTRANSFORM_LAST	ACC_SEND_BUS
49 #define	case_ACC_NOTRANSFORM	\
50 	case ACC_GROUP:		\
51 	case ACC_PRIORITY:	\
52 	case ACC_PATCH:		\
53 	case ACC_PRIM_BUS:	\
54 	case ACC_SEND_BUS
55 #define	for_ACC_NOTRANSFORM(x)	\
56 	for(x = ACC_NOTRANSFORM_FIRST; x <= ACC_NOTRANSFORM_LAST; ++x)
57 
58 #define	ACC_ADDTRANSFORM_FIRST	ACC_PAN
59 #define	ACC_ADDTRANSFORM_LAST	ACC_PITCH
60 #define	case_ACC_ADDTRANSFORM	\
61 	case ACC_PAN:		\
62 	case ACC_PITCH
63 #define	for_ACC_ADDTRANSFORM(x)	\
64 	for(x = ACC_ADDTRANSFORM_FIRST; x <= ACC_ADDTRANSFORM_LAST; ++x)
65 extern const int addtrans_min[2];
66 extern const int addtrans_max[2];
67 extern const int addtrans_bias[2];
68 
69 #define	ACC_MULTRANSFORM_FIRST	ACC_VOLUME
70 #define	ACC_MULTRANSFORM_LAST	ACC_SEND
71 #define	case_ACC_MULTRANSFORM	\
72 	case ACC_VOLUME:	\
73 	case ACC_SEND
74 #define	for_ACC_MULTRANSFORM(x)	\
75 	for(x = ACC_MULTRANSFORM_FIRST; x <= ACC_MULTRANSFORM_LAST; ++x)
76 
77 
78 /*----------------------------------------------------------
79 	Group Control
80 ----------------------------------------------------------*/
81 
82 /*
83  * Set a group control, and update all channels that belong
84  * to the group. (Expensive!)
85  */
86 void acc_group_set(unsigned gid, unsigned ctl, int arg);
87 
88 void audio_group_open(void);
89 void audio_group_close(void);
90 
91 #endif /*_A_CONTROL_H_*/
92