1 
2 /*
3  *  Diverse Bristol audio routines.
4  *  Copyright (c) by Nick Copeland <nickycopeland@hotmail.com> 1996,2012
5  *
6  *
7  *   This program is free software; you can redistribute it and/or modify
8  *   it under the terms of the GNU General Public License as published by
9  *   the Free Software Foundation; either version 3 of the License, or
10  *   (at your option) any later version.
11  *
12  *   This program is distributed in the hope that it will be useful,
13  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *   GNU General Public License for more details.
16  *
17  *   You should have received a copy of the GNU General Public License
18  *   along with this program; if not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef BRIGHTONMINI_H
23 #define BRIGHTONMINI_H
24 
25 #include "brighton.h"
26 #include "brightoninternals.h"
27 #include "bristol.h"
28 
29 #define BRIGHTON_POLYPHONIC 0
30 #define BRIGHTON_LNP 1
31 #define BRIGHTON_HNP 2
32 
33 extern int configureGlobals();
34 extern int initConnection();
35 
36 extern void cleanupBristol();
37 extern void cleanupBristolQuietly();
38 
39 extern int bristolMidiSendControlMsg();
40 extern int bristolMidiSendNRP();
41 extern int bristolMidiSendRP();
42 extern int bristolMidiSendMsg();
43 extern int destroySynth(brightonWindow *);
44 
45 typedef int (*synthRoutine)(void *, int, int, int, int, int);
46 typedef int (*saveRoutine)(void *, char *, char *, int, int);
47 typedef int (*loadRoutine)(void *, char *, char *, int, int, int, int);
48 
49 typedef struct miniDispatch {
50 	int controller;
51 	int operator;
52 	int other1;
53 	int other2;
54 	synthRoutine routine;
55 } dispatcher;
56 
57 typedef struct Memory {
58 	char algo[32];
59 	char name[32];
60 	short count;
61 	short vers;
62 	short active;
63 	short pad;
64 	float *param;
65 } memory;
66 
67 #define BRISTOL_NOCALLS		0x01
68 #define BRISTOL_STAT		0x02
69 #define BRISTOL_FORCE		0x04
70 #define BRISTOL_SID2		0x08
71 #define BRISTOL_SEQLOAD		0x10
72 #define BRISTOL_SEQFORCE	0x20
73 
74 #define OPERATIONAL			0x00000001
75 #define BANK_SELECT			0x00000002
76 #define MEM_LOADING			0x00000004
77 #define SUPPRESS			0x00000008
78 #define NO_KEYTRACK			0x00000010
79 #define REQ_MIDI_DEBUG		0x00000020
80 #define MIDI_NRP			0x00000040
81 #define REQ_MIDI_DEBUG2		0x00000080
82 #define REQ_EXIT			0x00000100
83 #define REQ_FORWARD			0x00000200
84 #define REQ_LOCAL_FORWARD	0x00000400
85 #define REQ_REMOTE_FORWARD	0x00000800
86 #define REQ_DEBUG_MASK		0x0000f000
87 #define REQ_DEBUG_1			0x00001000
88 #define REQ_DEBUG_2			0x00002000
89 #define REQ_DEBUG_3			0x00004000
90 #define REQ_DEBUG_4			0x00008000
91 #define LADI_ENABLE			0x00010000
92 #define GUI_NRP				0x00020000
93 #define NO_LATCHING_KEYS	0x00040000
94 
95 typedef struct GuiSynth {
96 	struct GuiSynth *next, *last;
97 	unsigned int flags;
98 	char name[32];
99 	int sid;
100 	int sid2; /* for GUIs with dual manual connections. */
101 	int midichannel;
102 	int velocity;
103 	int synthtype;
104 	int voices;
105 	brightonWindow *win;
106 	int mbi;
107 	int bank;
108 	int location;
109 	int panel;
110 	int transpose;
111 	memory mem;
112 	memory seq1;
113 	memory seq2;
114 	brightonApp *resources;
115 	dispatcher *dispatch;
116 	struct guiSynth *second; /* Dual manual keyboards */
117 	struct guimain *manual; /* Dual manual keyboards */
118 	int gain;
119 	int detune;
120 	int pwd;
121 	int keypanel;
122 	int keypanel2;
123 	int lowkey;
124 	int highkey;
125 	int glide;
126 	int lwf;
127 	int notepref;
128 	int notetrig;
129 	int legatovelocity;
130 	saveRoutine saveMemory;
131 	loadRoutine loadMemory;
132 	int firstDev;
133 	int cmem;
134 	int lmem;
135 	/* LADI support */
136 	int ladimode;
137 	int ladimem;
138 	char *ladiStateFile;
139 } guiSynth;
140 
141 #define BRIGHTON_NOENGINE 0x80000000
142 #define BRIGHTON_NRP	 0x40000000
143 
144 typedef struct guiMain {
145 	unsigned int flags;
146 	char *home;
147 	int controlfd;
148 	int enginePID;
149 	int libtest;
150 	int voices;
151 	guiSynth *synths;
152 	char *host;
153 	int port;
154 	int manualfd;
155 	struct guiMain *manual;
156 } guimain;
157 
158 extern guiSynth *findSynth(guiSynth *, brightonWindow *);
159 extern int bristolMemoryImport(int, char *, char *);
160 extern int bristolMemoryExport(int, char *, char *);
161 extern int loadMemory(guiSynth *, char *, char *,  int, int, int, int);
162 extern int loadSequence(memory *, char *, int, int);
163 extern int chordInsert(arpeggiatorMemory *, int, int);
164 extern int seqInsert(arpeggiatorMemory *, int, int);
165 extern int fillSequencer(guiSynth *, arpeggiatorMemory *, int);
166 extern int saveSequence(guiSynth *, char *, int, int);
167 extern int saveMemory(guiSynth *, char *, char *, int, int);
168 extern int displayText(guiSynth *, char *, int, int);
169 extern void displayPanel(guiSynth *, char *, int, int, int);
170 extern int displayPanelText(guiSynth *, char *, int, int, int);
171 
172 extern void brightonReadConfiguration(brightonWindow *, brightonApp *, int, char *, char *);
173 extern void brightonWriteConfiguration(brightonWindow *, char *, int, char *);
174 
175 extern int doAlarm();
176 
177 #endif /* BRIGHTONMINI_H */
178 
179