Subversion Repositories svn.mios

Rev

Rev 712 | 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();
738 adamjking 39
        leadControl.add(new SIDSysexParameterControl(button, null, 0, patch,
40
                80, 0, 1, "Legato"));
41
        leadControl.add(new SIDSysexParameterControl(button, null, 0, patch,
42
                80, 2, 1, "Fingered Portamento"));
43
        leadControl.add(new SIDSysexParameterControl(button, null, 0, patch,
44
                80, 1, 1, "Wavetable only"));
45
        leadControl.add(new SIDSysexParameterControl(rotary, null, 0, patch,
46
                81, 0, 8, "Detune", "Detune oscillators"));
47
        leadControl.add(new SIDSysexParameterControl(rotary, null, 0, patch,
48
                83, 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++) {
738 adamjking 56
            lfoControl.add(new SIDSysexParameterControl(button, null, 0, patch,
57
                    192 + (5 * c), 0, 1, "On/Off", "Enable/disable LFO"));
58
            lfoControl.add(new SIDSysexParameterControl(button, null, 0, patch,
59
                    192 + (5 * c), 2, 1, "MIDI Sync",
60
                    "Global clock synchronisation"));
61
            lfoControl.add(new SIDSysexParameterControl(button, null, 0, patch,
62
                    192 + (5 * c), 3, 1, "Oneshot", "Oneshot mode"));
63
            lfoControl
64
                    .add(new SIDSysexParameterControl(lfoselect, null, 0,
65
                            patch, 192 + (5 * c), 4, 4, "Waveform",
66
                            "Select a waveform"));
67
            lfoControl.add(new SIDSysexParameterControl(rotary, null, -128,
68
                    patch, 193 + (5 * c), 0, 8, "Depth"));
69
            lfoControl.add(new SIDSysexParameterControl(rotary, null, 0, patch,
70
                    194 + (5 * c), 0, 8, "Rate"));
71
            lfoControl.add(new SIDSysexParameterControl(rotary, null, 0, patch,
72
                    195 + (5 * c), 0, 8, "Delay"));
73
            lfoControl.add(new SIDSysexParameterControl(rotary, null, 0, patch,
74
                    196 + (5 * c), 0, 8, "Phase"));
75
            lfoControl.add(new SIDSysexParameterControl(button, null, 0, patch,
76
                    321, (2 + c), 1, "Key Sync", "Reset LFO at key press"));
628 adamjking 77
        }
213 tk 78
        return lfoControl;
79
    }
628 adamjking 80
 
213 tk 81
    public static Vector createENV(Patch patch, int offset) {
628 adamjking 82
        Vector envControl = new Vector();
213 tk 83
        // Envelope
738 adamjking 84
        envControl.add(new SIDSysexParameterControl(combo, SIDSysexInfo.loop,
85
                0, patch, 224 + offset, 0, 3, "Loop Begin",
86
                "Envelope loop begin point"));
87
        envControl.add(new SIDSysexParameterControl(combo, SIDSysexInfo.loop,
88
                0, patch, 224 + offset, 4, 3, "Loop End",
89
                "Envelope loop end point"));
90
        envControl
91
                .add(new SIDSysexParameterControl(button, null, 0, patch,
92
                        224 + offset, 7, 1, "MIDI Sync",
93
                        "Global clock synchronisation"));
94
        envControl.add(new SIDSysexParameterControl(rotary, null, -128, patch,
95
                225 + offset, 0, 8, "Depth"));
96
        envControl.add(new SIDSysexParameterControl(rotary, null, 0, patch,
97
                226 + offset, 0, 8, "Delay"));
98
        envControl.add(new SIDSysexParameterControl(rotary, null, 0, patch,
99
                227 + offset, 0, 8, "Attack1", "Attack1 Rate"));
100
        envControl.add(new SIDSysexParameterControl(slider, null, 0, patch,
101
                228 + offset, 0, 8, "Attack Lvl", "Attack Level"));
102
        envControl.add(new SIDSysexParameterControl(rotary, null, 0, patch,
103
                229 + offset, 0, 8, "Attack2", "Attack2 Rate"));
104
        envControl.add(new SIDSysexParameterControl(rotary, null, 0, patch,
105
                230 + offset, 0, 8, "Decay1", "Decay1 Rate"));
106
        envControl.add(new SIDSysexParameterControl(slider, null, 0, patch,
107
                231 + offset, 0, 8, "Decay Lvl", "Decay Level"));
108
        envControl.add(new SIDSysexParameterControl(rotary, null, 0, patch,
109
                232 + offset, 0, 8, "Decay2", "Decay2 Rate"));
110
        envControl.add(new SIDSysexParameterControl(slider, null, 0, patch,
111
                233 + offset, 0, 8, "Sustain Lvl", "Sustain Level"));
112
        envControl.add(new SIDSysexParameterControl(rotary, null, 0, patch,
113
                234 + offset, 0, 8, "Release1", "Release1 Rate"));
114
        envControl.add(new SIDSysexParameterControl(slider, null, 0, patch,
115
                235 + offset, 0, 8, "Release Lvl", "Release Level"));
116
        envControl.add(new SIDSysexParameterControl(rotary, null, 0, patch,
117
                236 + offset, 0, 8, "Release2", "Release2 Rate"));
118
        envControl.add(new SIDSysexParameterControl(rotary, null, -128, patch,
119
                237 + offset, 0, 8, "Att.Curve", "Attack Curve"));
120
        envControl.add(new SIDSysexParameterControl(rotary, null, -128, patch,
121
                238 + offset, 0, 8, "Dec.Curve", "Decay Curve"));
122
        envControl.add(new SIDSysexParameterControl(rotary, null, -128, patch,
123
                239 + offset, 0, 8, "Rel.Curve", "Release Curve"));
213 tk 124
        return envControl;
125
    }
628 adamjking 126
 
213 tk 127
    public static Vector createMOD(Patch patch) {
628 adamjking 128
        Vector modControl = new Vector();
213 tk 129
        // Modulation paths
628 adamjking 130
        for (int c = 0; c < 8; c++) {
738 adamjking 131
            modControl.add(new SIDSysexParameterControl(combo, createSrcStr(),
132
                    0, patch, 256 + (8 * c), 0, 8, "Source 1"));
133
            modControl.add(new SIDSysexParameterControl(combo, createSrcStr(),
134
                    0, patch, 257 + (8 * c), 0, 8, "Source 2"));
135
            modControl.add(new SIDSysexParameterControl(combo,
136
                    SIDSysexInfo.operatorNames, 0, patch, 258 + (8 * c), 0, 4,
137
                    "Operator"));
138
            modControl.add(new SIDSysexParameterControl(button, null, 0, patch,
139
                    258 + (8 * c), 6, 1, "Invert 1/L", "Invert target 1/L"));
140
            modControl.add(new SIDSysexParameterControl(button, null, 0, patch,
141
                    258 + (8 * c), 7, 1, "Invert 2/R", "Invert target 2/R"));
142
            modControl.add(new SIDSysexParameterControl(rotary, null, -128,
143
                    patch, 259 + (8 * c), 0, 8, "Depth"));
144
            modControl.add(new SIDSysexParameterControl(combo,
145
                    SIDSysexInfo.tgtNames, 0, patch, 262 + (8 * c), 0, 8,
146
                    "Target 1"));
147
            modControl.add(new SIDSysexParameterControl(combo,
148
                    SIDSysexInfo.tgtNames, 0, patch, 263 + (8 * c), 0, 8,
149
                    "Target 2"));
150
            modControl.add(new SIDSysexParameterControl(button, null, 0, patch,
151
                    260 + (8 * c), 0, 1, "V1 Pitch",
152
                    "Direct assignment to pitch of left OSC1"));
153
            modControl.add(new SIDSysexParameterControl(button, null, 0, patch,
154
                    260 + (8 * c), 1, 1, "V2 Pitch",
155
                    "Direct assignment to pitch of left OSC2"));
156
            modControl.add(new SIDSysexParameterControl(button, null, 0, patch,
157
                    260 + (8 * c), 2, 1, "V3 Pitch",
158
                    "Direct assignment to pitch of left OSC3"));
159
            modControl.add(new SIDSysexParameterControl(button, null, 0, patch,
160
                    260 + (8 * c), 3, 1, "V1 PWM",
161
                    "Direct assignment to pulse width of left OSC1"));
162
            modControl.add(new SIDSysexParameterControl(button, null, 0, patch,
163
                    260 + (8 * c), 4, 1, "V2 PWM",
164
                    "Direct assignment to pulse width of left OSC2"));
165
            modControl.add(new SIDSysexParameterControl(button, null, 0, patch,
166
                    260 + (8 * c), 5, 1, "V3 PWM",
167
                    "Direct assignment to pulse width of left OSC3"));
168
            modControl.add(new SIDSysexParameterControl(button, null, 0, patch,
169
                    260 + (8 * c), 6, 1, "Cutoff L",
170
                    "Direct assignment to filter cutoff of left SID"));
171
            modControl.add(new SIDSysexParameterControl(button, null, 0, patch,
172
                    260 + (8 * c), 7, 1, "Volume L",
173
                    "Direct assignment to volume of left SID"));
174
            modControl.add(new SIDSysexParameterControl(button, null, 0, patch,
175
                    261 + (8 * c), 0, 1, "V4 Pitch",
176
                    "Direct assignment to pitch of right OSC1"));
177
            modControl.add(new SIDSysexParameterControl(button, null, 0, patch,
178
                    261 + (8 * c), 1, 1, "V5 Pitch",
179
                    "Direct assignment to pitch of right OSC2"));
180
            modControl.add(new SIDSysexParameterControl(button, null, 0, patch,
181
                    261 + (8 * c), 2, 1, "V6 Pitch",
182
                    "Direct assignment to pitch of right OSC3"));
183
            modControl.add(new SIDSysexParameterControl(button, null, 0, patch,
184
                    261 + (8 * c), 3, 1, "V4 PW",
185
                    "Direct assignment to pulse width of right OSC1"));
186
            modControl.add(new SIDSysexParameterControl(button, null, 0, patch,
187
                    261 + (8 * c), 4, 1, "V5 PW",
188
                    "Direct assignment to pulse width of right OSC2"));
189
            modControl.add(new SIDSysexParameterControl(button, null, 0, patch,
190
                    261 + (8 * c), 5, 1, "V6 PW",
191
                    "Direct assignment to pulse width of right OSC3"));
192
            modControl.add(new SIDSysexParameterControl(button, null, 0, patch,
193
                    261 + (8 * c), 6, 1, "Cutoff R",
194
                    "Direct assignment to filter cutoff of right SID"));
195
            modControl.add(new SIDSysexParameterControl(button, null, 0, patch,
196
                    261 + (8 * c), 7, 1, "Volume R",
197
                    "Direct assignment to volume of right SID"));
213 tk 198
        }
199
        return modControl;
200
    }
628 adamjking 201
 
213 tk 202
    public static Vector createTRIG(Patch patch) {
628 adamjking 203
        Vector trigControl = new Vector();
213 tk 204
        // Trigger matrix
628 adamjking 205
        for (int c = 0; c < 14; c++) {
738 adamjking 206
            trigControl.add(new SIDSysexParameterControl(simplebutton, null, 0,
207
                    patch, 320 + (3 * c), 0, 1, "OSC1 Left Ch"));
208
            trigControl.add(new SIDSysexParameterControl(simplebutton, null, 0,
209
                    patch, 320 + (3 * c), 1, 1, "OSC2 Left Ch"));
210
            trigControl.add(new SIDSysexParameterControl(simplebutton, null, 0,
211
                    patch, 320 + (3 * c), 2, 1, "OSC3 Left Ch"));
212
            trigControl.add(new SIDSysexParameterControl(simplebutton, null, 0,
213
                    patch, 320 + (3 * c), 3, 1, "OSC1 Right Ch"));
214
            trigControl.add(new SIDSysexParameterControl(simplebutton, null, 0,
215
                    patch, 320 + (3 * c), 4, 1, "OSC2 Right Ch"));
216
            trigControl.add(new SIDSysexParameterControl(simplebutton, null, 0,
217
                    patch, 320 + (3 * c), 5, 1, "OSC3 Right Ch"));
218
            trigControl.add(new SIDSysexParameterControl(simplebutton, null, 0,
219
                    patch, 320 + (3 * c), 6, 1, "ENV1 Attack"));
220
            trigControl.add(new SIDSysexParameterControl(simplebutton, null, 0,
221
                    patch, 320 + (3 * c), 7, 1, "ENV2 Attack"));
222
            trigControl.add(new SIDSysexParameterControl(simplebutton, null, 0,
223
                    patch, 321 + (3 * c), 0, 1, "ENV1 Release"));
224
            trigControl.add(new SIDSysexParameterControl(simplebutton, null, 0,
225
                    patch, 321 + (3 * c), 1, 1, "ENV2 Release"));
226
            trigControl.add(new SIDSysexParameterControl(simplebutton, null, 0,
227
                    patch, 321 + (3 * c), 2, 1, "LFO1 Reset"));
228
            trigControl.add(new SIDSysexParameterControl(simplebutton, null, 0,
229
                    patch, 321 + (3 * c), 3, 1, "LFO2 Reset"));
230
            trigControl.add(new SIDSysexParameterControl(simplebutton, null, 0,
231
                    patch, 321 + (3 * c), 4, 1, "LFO3 Reset"));
232
            trigControl.add(new SIDSysexParameterControl(simplebutton, null, 0,
233
                    patch, 321 + (3 * c), 5, 1, "LFO4 Reset"));
234
            trigControl.add(new SIDSysexParameterControl(simplebutton, null, 0,
235
                    patch, 321 + (3 * c), 6, 1, "LFO5 Reset"));
236
            trigControl.add(new SIDSysexParameterControl(simplebutton, null, 0,
237
                    patch, 321 + (3 * c), 7, 1, "LFO6 Reset"));
238
            trigControl.add(new SIDSysexParameterControl(simplebutton, null, 0,
239
                    patch, 322 + (3 * c), 0, 1, "WT1 Reset"));
240
            trigControl.add(new SIDSysexParameterControl(simplebutton, null, 0,
241
                    patch, 322 + (3 * c), 1, 1, "WT2 Reset"));
242
            trigControl.add(new SIDSysexParameterControl(simplebutton, null, 0,
243
                    patch, 322 + (3 * c), 2, 1, "WT3 Reset"));
244
            trigControl.add(new SIDSysexParameterControl(simplebutton, null, 0,
245
                    patch, 322 + (3 * c), 3, 1, "WT4 Reset"));
246
            trigControl.add(new SIDSysexParameterControl(simplebutton, null, 0,
247
                    patch, 322 + (3 * c), 4, 1, "WT1 Step"));
248
            trigControl.add(new SIDSysexParameterControl(simplebutton, null, 0,
249
                    patch, 322 + (3 * c), 5, 1, "WT2 Step"));
250
            trigControl.add(new SIDSysexParameterControl(simplebutton, null, 0,
251
                    patch, 322 + (3 * c), 6, 1, "WT3 Step"));
252
            trigControl.add(new SIDSysexParameterControl(simplebutton, null, 0,
253
                    patch, 322 + (3 * c), 7, 1, "WT4 Step"));
213 tk 254
        }
255
        return trigControl;
256
    }
628 adamjking 257
 
213 tk 258
    public static Vector createWT(Patch patch) {
628 adamjking 259
        Vector wtControl = new Vector();
213 tk 260
        // Wavetable sequencer
628 adamjking 261
        for (int c = 0; c < 4; c++) {
738 adamjking 262
            wtControl.add(new SIDSysexParameterControl(rotary,
263
                    createDividers(), 0, patch, 364 + (5 * c), 0, 6,
264
                    "Clock Divider", "Clock divider (sets tempo)"));
265
            wtControl.add(new SIDSysexParameterControl(button, null, 0, patch,
266
                    364 + (5 * c), 6, 1, "To Left Ch",
267
                    "Parameter forwarded to left channel"));
268
            wtControl.add(new SIDSysexParameterControl(button, null, 0, patch,
269
                    364 + (5 * c), 7, 1, "To Right Ch",
270
                    "Parameter forwarded to right channel"));
271
            wtControl.add(new SIDSysexParameterControl(combo,
272
                    SIDSysexInfo.leadParams, 0, patch, 365 + (5 * c), 0, 8,
273
                    "Assign", "Parameter assignment"));
274
            wtControl.add(new SIDSysexParameterControl(rotary, null, 0, patch,
275
                    366 + (5 * c), 0, 7, "Start Pos",
276
                    "Start position in wavetable"));
277
            wtControl.add(new SIDSysexParameterControl(button, null, 0, patch,
278
                    366 + (5 * c), 7, 1, "Pos Ctrl by MP",
279
                    "Position controlled by modulation path"));
280
            wtControl
281
                    .add(new SIDSysexParameterControl(rotary, null, 0, patch,
282
                            367 + (5 * c), 0, 7, "End Pos",
283
                            "End position in wavetable"));
284
            wtControl.add(new SIDSysexParameterControl(rotary, null, 0, patch,
285
                    368 + (5 * c), 0, 7, "Loop Pos",
286
                    "Loop position in wavetable"));
287
            wtControl.add(new SIDSysexParameterControl(button, null, 0, patch,
288
                    368 + (5 * c), 7, 1, "Oneshot"));
628 adamjking 289
        }
213 tk 290
        // Wavetable data
628 adamjking 291
        for (int c = 0; c < 128; c++) {
738 adamjking 292
            wtControl.add(new SIDSysexParameterControl(slider, null, 0, patch,
293
                    384 + c, 0, 8, Integer.toString(c)));
628 adamjking 294
        }
213 tk 295
        return wtControl;
296
    }
628 adamjking 297
 
213 tk 298
    private static String[] createSrcStr() {
299
        String[] srcStr = new String[256];
628 adamjking 300
        String[] srcNames = SIDSysexInfo.srcNames;
301
        for (int c = 0; c < srcStr.length; c++) {
213 tk 302
            if (c < srcNames.length) {
303
                srcStr[c] = srcNames[c];
628 adamjking 304
            } else if (c > 127) {
305
                srcStr[c] = Integer.toString(c - 128);
306
            } else {
213 tk 307
                srcStr[c] = "";
308
            }
309
        }
310
        return srcStr;
311
    }
712 tk 312
 
313
    public static String[] createDividers() {
314
        String[] s = new String[64];
315
        for (int i = 0; i < s.length; i++) {
316
            s[i] = Integer.toString(i + 1);
317
        }
318
        return s;
319
    }
320
 
213 tk 321
}