Subversion Repositories svn.mios

Rev

Rev 303 | Rev 696 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
213 tk 1
/*
2
 * @(#)SIDV2librarian.java  beta1   2008/01/21
3
 *
4
 * Copyright (C) 2008    Rutger Vlek (rutgervlek@hotmail.com)
5
 *
6
 * This application is free software; you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation; either version 2 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * This application is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this application; if not, write to the Free Software
18
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
 */
20
 
21
package org.midibox.sidedit;
22
 
23
import java.util.Vector;
24
 
25
import org.midibox.sidlibr.Patch;
26
 
27
public class LeadSpecs {
28
    // Control types:
29
    private static int rotary = 0;
30
    private static int button = 1;
31
    private static int simplebutton = 2;
628 adamjking 32
    private static int slider = 3;
33
    private static int waveselect = 4;
213 tk 34
    private static int lfoselect = 5;
35
    private static int combo = 6;
628 adamjking 36
 
213 tk 37
    public static Vector createMSTR(Patch patch) {
628 adamjking 38
        Vector leadControl = new Vector();
39
        leadControl.add(new SIDSysexParameterControl(button, null, patch, 80,
40
                0, 1, "Legato"));
41
        leadControl.add(new SIDSysexParameterControl(button, null, patch, 80,
42
                2, 1, "Fingered Portamento"));
43
        leadControl.add(new SIDSysexParameterControl(button, null, patch, 80,
44
                1, 1, "Wavetable only"));
45
        leadControl.add(new SIDSysexParameterControl(rotary, null, patch, 81,
46
                0, 8, "Detune", "Detune oscillators"));
47
        leadControl.add(new SIDSysexParameterControl(rotary, null, patch, 83,
48
                0, 8, "Phase Offset", "Oscillators phase offset "));
213 tk 49
        return leadControl;
50
    }
628 adamjking 51
 
213 tk 52
    public static Vector createLFO(Patch patch) {
53
        Vector lfoControl = new Vector();
54
        // LFO
628 adamjking 55
        for (int c = 0; c < 6; c++) {
56
            lfoControl.add(new SIDSysexParameterControl(button, null, patch,
57
                    192 + (5 * c), 0, 1, "On/Off", "Enable/disable LFO"));
58
            lfoControl.add(new SIDSysexParameterControl(button, null, patch,
59
                    192 + (5 * c), 2, 1, "MIDI Sync",
60
                    "Global clock synchronisation"));
61
            lfoControl.add(new SIDSysexParameterControl(button, null, patch,
62
                    192 + (5 * c), 3, 1, "Oneshot", "Oneshot mode"));
63
            lfoControl.add(new SIDSysexParameterControl(lfoselect, null, patch,
64
                    192 + (5 * c), 4, 4, "Waveform", "Select a waveform"));
65
            lfoControl.add(new SIDSysexParameterControl(rotary, null, patch,
66
                    193 + (5 * c), 0, -8, "Depth"));
67
            lfoControl.add(new SIDSysexParameterControl(rotary,
68
                    createRateStr(), patch, 194 + (5 * c), 0, 8, "Rate"));
69
            lfoControl.add(new SIDSysexParameterControl(rotary, null, patch,
70
                    195 + (5 * c), 0, 8, "Delay"));
71
            lfoControl.add(new SIDSysexParameterControl(rotary, null, patch,
72
                    196 + (5 * c), 0, 8, "Phase"));
73
            lfoControl.add(new SIDSysexParameterControl(button, null, patch,
74
                    321, (2 + c), 1, "Key Sync", "Reset LFO at key press"));
75
        }
213 tk 76
        return lfoControl;
77
    }
628 adamjking 78
 
213 tk 79
    public static Vector createENV(Patch patch, int offset) {
628 adamjking 80
        Vector envControl = new Vector();
213 tk 81
        // Envelope
628 adamjking 82
        envControl.add(new SIDSysexParameterControl(combo, SIDSysexInfo.loop,
83
                patch, 224 + offset, 0, 3, "Loop Begin",
84
                "Envelope loop begin point"));
85
        envControl.add(new SIDSysexParameterControl(combo, SIDSysexInfo.loop,
86
                patch, 224 + offset, 4, 3, "Loop End",
87
                "Envelope loop end point"));
88
        envControl
89
                .add(new SIDSysexParameterControl(button, null, patch,
90
                        224 + offset, 7, 1, "MIDI Sync",
91
                        "Global clock synchronisation"));
92
        envControl.add(new SIDSysexParameterControl(rotary, null, patch,
93
                225 + offset, 0, -8, "Depth"));
94
        envControl.add(new SIDSysexParameterControl(rotary, null, patch,
95
                226 + offset, 0, 8, "Delay"));
96
        envControl.add(new SIDSysexParameterControl(rotary, null, patch,
97
                227 + offset, 0, 8, "Attack1", "Attack1 Rate"));
98
        envControl.add(new SIDSysexParameterControl(slider, null, patch,
99
                228 + offset, 0, 8, "Attack Lvl", "Attack Level"));
100
        envControl.add(new SIDSysexParameterControl(rotary, null, patch,
101
                229 + offset, 0, 8, "Attack2", "Attack2 Rate"));
102
        envControl.add(new SIDSysexParameterControl(rotary, null, patch,
103
                230 + offset, 0, 8, "Decay1", "Decay1 Rate"));
104
        envControl.add(new SIDSysexParameterControl(slider, null, patch,
105
                231 + offset, 0, 8, "Decay Lvl", "Decay Level"));
106
        envControl.add(new SIDSysexParameterControl(rotary, null, patch,
107
                232 + offset, 0, 8, "Decay2", "Decay2 Rate"));
108
        envControl.add(new SIDSysexParameterControl(slider, null, patch,
109
                233 + offset, 0, 8, "Sustain Lvl", "Sustain Level"));
110
        envControl.add(new SIDSysexParameterControl(rotary, null, patch,
111
                234 + offset, 0, 8, "Release1", "Release1 Rate"));
112
        envControl.add(new SIDSysexParameterControl(slider, null, patch,
113
                235 + offset, 0, 8, "Release Lvl", "Release Level"));
114
        envControl.add(new SIDSysexParameterControl(rotary, null, patch,
115
                236 + offset, 0, 8, "Release2", "Release2 Rate"));
116
        envControl.add(new SIDSysexParameterControl(rotary, null, patch,
117
                237 + offset, 0, -8, "Att.Curve", "Attack Curve"));
118
        envControl.add(new SIDSysexParameterControl(rotary, null, patch,
119
                238 + offset, 0, -8, "Dec.Curve", "Decay Curve"));
120
        envControl.add(new SIDSysexParameterControl(rotary, null, patch,
121
                239 + offset, 0, -8, "Rel.Curve", "Release Curve"));
213 tk 122
        return envControl;
123
    }
628 adamjking 124
 
213 tk 125
    public static Vector createMOD(Patch patch) {
628 adamjking 126
        Vector modControl = new Vector();
213 tk 127
        // Modulation paths
628 adamjking 128
        for (int c = 0; c < 8; c++) {
129
            modControl.add(new SIDSysexParameterControl(combo, createSrcStr(),
130
                    patch, 256 + (8 * c), 0, 8, "Source 1"));
131
            modControl.add(new SIDSysexParameterControl(combo, createSrcStr(),
132
                    patch, 257 + (8 * c), 0, 8, "Source 2"));
133
            modControl.add(new SIDSysexParameterControl(combo,
134
                    SIDSysexInfo.operatorNames, patch, 258 + (8 * c), 0, 4,
135
                    "Operator"));
136
            modControl.add(new SIDSysexParameterControl(button, null, patch,
137
                    258 + (8 * c), 6, 1, "Invert 1/L", "Invert target 1/L"));
138
            modControl.add(new SIDSysexParameterControl(button, null, patch,
139
                    258 + (8 * c), 7, 1, "Invert 2/R", "Invert target 2/R"));
140
            modControl.add(new SIDSysexParameterControl(rotary, null, patch,
141
                    259 + (8 * c), 0, -8, "Depth"));
142
            modControl.add(new SIDSysexParameterControl(combo,
143
                    SIDSysexInfo.tgtNames, patch, 262 + (8 * c), 0, 8,
144
                    "Target 1"));
145
            modControl.add(new SIDSysexParameterControl(combo,
146
                    SIDSysexInfo.tgtNames, patch, 263 + (8 * c), 0, 8,
147
                    "Target 2"));
148
            modControl.add(new SIDSysexParameterControl(button, null, patch,
149
                    260 + (8 * c), 0, 1, "V1 Pitch",
150
                    "Direct assignment to pitch of left OSC1"));
151
            modControl.add(new SIDSysexParameterControl(button, null, patch,
152
                    260 + (8 * c), 1, 1, "V2 Pitch",
153
                    "Direct assignment to pitch of left OSC2"));
154
            modControl.add(new SIDSysexParameterControl(button, null, patch,
155
                    260 + (8 * c), 2, 1, "V3 Pitch",
156
                    "Direct assignment to pitch of left OSC3"));
157
            modControl.add(new SIDSysexParameterControl(button, null, patch,
158
                    260 + (8 * c), 3, 1, "V1 PWM",
159
                    "Direct assignment to pulse width of left OSC1"));
160
            modControl.add(new SIDSysexParameterControl(button, null, patch,
161
                    260 + (8 * c), 4, 1, "V2 PWM",
162
                    "Direct assignment to pulse width of left OSC2"));
163
            modControl.add(new SIDSysexParameterControl(button, null, patch,
164
                    260 + (8 * c), 5, 1, "V3 PWM",
165
                    "Direct assignment to pulse width of left OSC3"));
166
            modControl.add(new SIDSysexParameterControl(button, null, patch,
167
                    260 + (8 * c), 6, 1, "Cutoff L",
168
                    "Direct assignment to filter cutoff of left SID"));
169
            modControl.add(new SIDSysexParameterControl(button, null, patch,
170
                    260 + (8 * c), 7, 1, "Volume L",
171
                    "Direct assignment to volume of left SID"));
172
            modControl.add(new SIDSysexParameterControl(button, null, patch,
173
                    261 + (8 * c), 0, 1, "V4 Pitch",
174
                    "Direct assignment to pitch of right OSC1"));
175
            modControl.add(new SIDSysexParameterControl(button, null, patch,
176
                    261 + (8 * c), 1, 1, "V5 Pitch",
177
                    "Direct assignment to pitch of right OSC2"));
178
            modControl.add(new SIDSysexParameterControl(button, null, patch,
179
                    261 + (8 * c), 2, 1, "V6 Pitch",
180
                    "Direct assignment to pitch of right OSC3"));
181
            modControl.add(new SIDSysexParameterControl(button, null, patch,
182
                    261 + (8 * c), 3, 1, "V4 PW",
183
                    "Direct assignment to pulse width of right OSC1"));
184
            modControl.add(new SIDSysexParameterControl(button, null, patch,
185
                    261 + (8 * c), 4, 1, "V5 PW",
186
                    "Direct assignment to pulse width of right OSC2"));
187
            modControl.add(new SIDSysexParameterControl(button, null, patch,
188
                    261 + (8 * c), 5, 1, "V6 PW",
189
                    "Direct assignment to pulse width of right OSC3"));
190
            modControl.add(new SIDSysexParameterControl(button, null, patch,
191
                    261 + (8 * c), 6, 1, "Cutoff R",
192
                    "Direct assignment to filter cutoff of right SID"));
193
            modControl.add(new SIDSysexParameterControl(button, null, patch,
194
                    261 + (8 * c), 7, 1, "Volume R",
195
                    "Direct assignment to volume of right SID"));
213 tk 196
        }
197
        return modControl;
198
    }
628 adamjking 199
 
213 tk 200
    public static Vector createTRIG(Patch patch) {
628 adamjking 201
        Vector trigControl = new Vector();
213 tk 202
        // Trigger matrix
628 adamjking 203
        for (int c = 0; c < 14; c++) {
204
            trigControl.add(new SIDSysexParameterControl(simplebutton, null,
205
                    patch, 320 + (3 * c), 0, 1, "OSC1 Left Ch"));
206
            trigControl.add(new SIDSysexParameterControl(simplebutton, null,
207
                    patch, 320 + (3 * c), 1, 1, "OSC2 Left Ch"));
208
            trigControl.add(new SIDSysexParameterControl(simplebutton, null,
209
                    patch, 320 + (3 * c), 2, 1, "OSC3 Left Ch"));
210
            trigControl.add(new SIDSysexParameterControl(simplebutton, null,
211
                    patch, 320 + (3 * c), 3, 1, "OSC1 Right Ch"));
212
            trigControl.add(new SIDSysexParameterControl(simplebutton, null,
213
                    patch, 320 + (3 * c), 4, 1, "OSC2 Right Ch"));
214
            trigControl.add(new SIDSysexParameterControl(simplebutton, null,
215
                    patch, 320 + (3 * c), 5, 1, "OSC3 Right Ch"));
216
            trigControl.add(new SIDSysexParameterControl(simplebutton, null,
217
                    patch, 320 + (3 * c), 6, 1, "ENV1 Attack"));
218
            trigControl.add(new SIDSysexParameterControl(simplebutton, null,
219
                    patch, 320 + (3 * c), 7, 1, "ENV2 Attack"));
220
            trigControl.add(new SIDSysexParameterControl(simplebutton, null,
221
                    patch, 321 + (3 * c), 0, 1, "ENV1 Release"));
222
            trigControl.add(new SIDSysexParameterControl(simplebutton, null,
223
                    patch, 321 + (3 * c), 1, 1, "ENV2 Release"));
224
            trigControl.add(new SIDSysexParameterControl(simplebutton, null,
225
                    patch, 321 + (3 * c), 2, 1, "LFO1 Reset"));
226
            trigControl.add(new SIDSysexParameterControl(simplebutton, null,
227
                    patch, 321 + (3 * c), 3, 1, "LFO2 Reset"));
228
            trigControl.add(new SIDSysexParameterControl(simplebutton, null,
229
                    patch, 321 + (3 * c), 4, 1, "LFO3 Reset"));
230
            trigControl.add(new SIDSysexParameterControl(simplebutton, null,
231
                    patch, 321 + (3 * c), 5, 1, "LFO4 Reset"));
232
            trigControl.add(new SIDSysexParameterControl(simplebutton, null,
233
                    patch, 321 + (3 * c), 6, 1, "LFO5 Reset"));
234
            trigControl.add(new SIDSysexParameterControl(simplebutton, null,
235
                    patch, 321 + (3 * c), 7, 1, "LFO6 Reset"));
236
            trigControl.add(new SIDSysexParameterControl(simplebutton, null,
237
                    patch, 322 + (3 * c), 0, 1, "WT1 Reset"));
238
            trigControl.add(new SIDSysexParameterControl(simplebutton, null,
239
                    patch, 322 + (3 * c), 1, 1, "WT2 Reset"));
240
            trigControl.add(new SIDSysexParameterControl(simplebutton, null,
241
                    patch, 322 + (3 * c), 2, 1, "WT3 Reset"));
242
            trigControl.add(new SIDSysexParameterControl(simplebutton, null,
243
                    patch, 322 + (3 * c), 3, 1, "WT4 Reset"));
244
            trigControl.add(new SIDSysexParameterControl(simplebutton, null,
245
                    patch, 322 + (3 * c), 4, 1, "WT1 Step"));
246
            trigControl.add(new SIDSysexParameterControl(simplebutton, null,
247
                    patch, 322 + (3 * c), 5, 1, "WT2 Step"));
248
            trigControl.add(new SIDSysexParameterControl(simplebutton, null,
249
                    patch, 322 + (3 * c), 6, 1, "WT3 Step"));
250
            trigControl.add(new SIDSysexParameterControl(simplebutton, null,
251
                    patch, 322 + (3 * c), 7, 1, "WT4 Step"));
213 tk 252
        }
253
        return trigControl;
254
    }
628 adamjking 255
 
213 tk 256
    public static Vector createWT(Patch patch) {
628 adamjking 257
        Vector wtControl = new Vector();
213 tk 258
        // Wavetable sequencer
628 adamjking 259
        for (int c = 0; c < 4; c++) {
260
            wtControl.add(new SIDSysexParameterControl(rotary, null, patch,
261
                    364 + (5 * c), 0, 6, "Clock Divider",
262
                    "Clock divider (sets tempo)"));
263
            wtControl.add(new SIDSysexParameterControl(button, null, patch,
264
                    364 + (5 * c), 6, 1, "To Left Ch",
265
                    "Parameter forwarded to left channel"));
266
            wtControl.add(new SIDSysexParameterControl(button, null, patch,
267
                    364 + (5 * c), 7, 1, "To Right Ch",
268
                    "Parameter forwarded to right channel"));
269
            wtControl.add(new SIDSysexParameterControl(combo,
270
                    SIDSysexInfo.leadParams, patch, 365 + (5 * c), 0, 8,
271
                    "Assign", "Parameter assignment"));
272
            wtControl.add(new SIDSysexParameterControl(rotary, null, patch,
273
                    366 + (5 * c), 0, 7, "Start Pos",
274
                    "Start position in wavetable"));
275
            wtControl.add(new SIDSysexParameterControl(button, null, patch,
276
                    366 + (5 * c), 7, 1, "Pos Ctrl by MP",
277
                    "Position controlled by modulation path"));
278
            wtControl
279
                    .add(new SIDSysexParameterControl(rotary, null, patch,
280
                            367 + (5 * c), 0, 7, "End Pos",
281
                            "End position in wavetable"));
282
            wtControl.add(new SIDSysexParameterControl(rotary, null, patch,
283
                    368 + (5 * c), 0, 7, "Loop Pos",
284
                    "Loop position in wavetable"));
285
            wtControl.add(new SIDSysexParameterControl(button, null, patch,
286
                    368 + (5 * c), 7, 1, "Oneshot"));
287
        }
213 tk 288
        // Wavetable data
628 adamjking 289
        for (int c = 0; c < 128; c++) {
290
            wtControl.add(new SIDSysexParameterControl(slider, null, patch,
291
                    384 + c, 0, 8, Integer.toString(c)));
292
        }
213 tk 293
        return wtControl;
294
    }
628 adamjking 295
 
213 tk 296
    private static String[] createRateStr() {
628 adamjking 297
        String[] rateStr = new String[256];
298
        for (int c = 0; c < rateStr.length; c++) {
299
 
213 tk 300
            if (c < 245) {
301
                rateStr[c] = Integer.toString(c);
628 adamjking 302
            } else {
303
                rateStr[c] = SIDSysexInfo.rates[c - 245];
213 tk 304
            }
305
        }
306
        return rateStr;
307
    }
628 adamjking 308
 
213 tk 309
    private static String[] createSrcStr() {
310
        String[] srcStr = new String[256];
628 adamjking 311
        String[] srcNames = SIDSysexInfo.srcNames;
312
        for (int c = 0; c < srcStr.length; c++) {
213 tk 313
            if (c < srcNames.length) {
314
                srcStr[c] = srcNames[c];
628 adamjking 315
            } else if (c > 127) {
316
                srcStr[c] = Integer.toString(c - 128);
317
            } else {
213 tk 318
                srcStr[c] = "";
319
            }
320
        }
321
        return srcStr;
322
    }
323
}