Subversion Repositories svn.mios

Rev

Rev 738 | 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;
628 adamjking 24
 
213 tk 25
import org.midibox.sidlibr.Patch;
26
 
628 adamjking 27
public class EngineSpecs {
213 tk 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 getEngine(Patch patch) {
38
        Vector engine = new Vector();
666 rutgerv 39
        if (patch.isEnsemble()) {
738 adamjking 40
            engine.add(EnsembleSpecs.createENSSID(patch, 0)); // 1: Ensemble
808 adamjking 41
            // settings for
42
            // SID1
738 adamjking 43
            engine.add(EnsembleSpecs.createENSSID(patch, 64)); // 2: Ensemble
808 adamjking 44
            // settings for
45
            // SID2
738 adamjking 46
            engine.add(EnsembleSpecs.createENSSID(patch, 128)); // 3: Ensemble
808 adamjking 47
            // settings for
48
            // SID3
738 adamjking 49
            engine.add(EnsembleSpecs.createENSSID(patch, 192)); // 4: Ensemble
808 adamjking 50
            // settings for
51
            // SID4
666 rutgerv 52
        } else {
53
            if (patch.getEngine() == patch.LEAD) {
54
                // Lead engine
55
                engine.add(createGlobal(patch, SIDSysexInfo.leadParams)); // 0:
56
                // Global
57
                // parameters
58
                engine.add(createExt(patch)); // 1: External parameters
59
                engine.add(createFilter(patch, 0)); // 2: Filter Left
60
                engine.add(createFilter(patch, 6)); // 3: Filter right
61
                engine.add(LeadSpecs.createMSTR(patch)); // 4: Master settings
62
                engine.add(createVoice(patch, 0)); // 5: Voice 1 Left
63
                engine.add(createVoice(patch, 16)); // 6: Voice 2 Left
64
                engine.add(createVoice(patch, 32)); // 7: Voice 3 Left
65
                engine.add(createVoice(patch, 48)); // 8: Voice 4 Right
66
                engine.add(createVoice(patch, 64)); // 9: Voice 5 Right
67
                engine.add(createVoice(patch, 80)); // 10: Voice 6 Right
738 adamjking 68
                engine.add(LeadSpecs.createLFO(patch)); // 11: LFO's
69
                engine.add(LeadSpecs.createENV(patch, 0)); // 12: Envelope 1
706 rutgerv 70
                engine.add(LeadSpecs.createENV(patch, 16)); // 13: Envelope 2
738 adamjking 71
                engine.add(LeadSpecs.createMOD(patch)); // 14: Modulation paths
72
                engine.add(LeadSpecs.createTRIG(patch)); // 15: Trigger matrix
73
                engine.add(LeadSpecs.createWT(patch)); // 16: Wavetable
808 adamjking 74
                // sequencer
666 rutgerv 75
            } else if (patch.getEngine() == patch.BASSLINE) {
76
                // Bassline
738 adamjking 77
                engine.add(createGlobal(patch, SIDSysexInfo.basslineParams));// 0:
808 adamjking 78
                // Global
79
                // parameters
738 adamjking 80
                engine.add(createExt(patch)); // 1: External parameters
81
                engine.add(createFilter(patch, 0)); // 2: Filter Left
82
                engine.add(createFilter(patch, 6)); // 3: Filter right
83
                engine.add(createVoice(patch, 0)); // 4: Left Oscillator
84
                engine.add(createVoice(patch, 80)); // 5: Right Oscillator
85
                engine.add(BasslineSpecs.createMSTRBOTH(patch));// 6: Right
808 adamjking 86
                // Oscillator
738 adamjking 87
                engine.add(BasslineSpecs.createMSTR(patch, 0)); // 7: Left
808 adamjking 88
                // master set
738 adamjking 89
                engine.add(BasslineSpecs.createMSTR(patch, 80));// 8: Right
808 adamjking 90
                // master set
738 adamjking 91
                engine.add(BasslineSpecs.createLFO(patch, 0)); // 9: Left LFO's
92
                engine.add(BasslineSpecs.createLFO(patch, 80)); // 10: Right
808 adamjking 93
                // LFO's
738 adamjking 94
                engine.add(BasslineSpecs.createENV(patch, 0)); // 11: Left
808 adamjking 95
                // Envelope
738 adamjking 96
                engine.add(BasslineSpecs.createENV(patch, 80)); // 12: Right
808 adamjking 97
                // Envelope
738 adamjking 98
                engine.add(BasslineSpecs.createSEQ(patch, 0)); // 13: Left
808 adamjking 99
                // Sequencer
738 adamjking 100
                engine.add(BasslineSpecs.createSEQ(patch, 80)); // 14: Right
808 adamjking 101
                // Sequencer
710 rutgerv 102
                engine.add(BasslineSpecs.createSEQData(patch)); // 15: Sequencer
666 rutgerv 103
                // data
104
            } else if (patch.getEngine() == patch.DRUM) {
105
                // Drum
106
                engine.add(createGlobal(patch, SIDSysexInfo.drumParams)); // 0:
107
                // Global
108
                // parameters
109
                engine.add(createExt(patch)); // 1: External parameters
110
                engine.add(createFilter(patch, 0)); // 2: Filter Left
111
                engine.add(createFilter(patch, 6)); // 3: Filter right
738 adamjking 112
                engine.add(DrumSpecs.createDrumInstr(patch)); // 4: Drum
808 adamjking 113
                // Instruments
666 rutgerv 114
                engine.add(DrumSpecs.createSEQ(patch)); // 5: Sequencer
115
                engine.add(DrumSpecs.createSEQData(patch)); // 6: Sequencer data
116
            } else if (patch.getEngine() == patch.MULTI) {
117
                // Multi
118
                engine.add(createGlobal(patch, SIDSysexInfo.multiParams)); // 0:
119
                // Global
120
                // parameters
121
                engine.add(createExt(patch)); // 1: External parameters
122
                engine.add(createFilter(patch, 0)); // 2: Filter Left
123
                engine.add(createFilter(patch, 6)); // 3: Filter right
124
                engine.add(createVoice(patch, 0)); // 4: Inst.1 Voice
125
                engine.add(createVoice(patch, 48)); // 5: Inst.2 Voice
126
                engine.add(createVoice(patch, 96)); // 6: Inst.3 Voice
127
                engine.add(createVoice(patch, 144)); // 7: Inst.4 Voice
128
                engine.add(createVoice(patch, 192)); // 8: Inst.5 Voice
129
                engine.add(createVoice(patch, 240)); // 9: Inst.6 Voice
130
                engine.add(MultiSpecs.createInstrument(patch, 0)); // 10: Inst.1
131
                // Rest
738 adamjking 132
                engine.add(MultiSpecs.createInstrument(patch, 48)); // 11:
808 adamjking 133
                // Inst.2
666 rutgerv 134
                // Rest
738 adamjking 135
                engine.add(MultiSpecs.createInstrument(patch, 96)); // 12:
808 adamjking 136
                // Inst.3
666 rutgerv 137
                // Rest
738 adamjking 138
                engine.add(MultiSpecs.createInstrument(patch, 144)); // 13:
808 adamjking 139
                // Inst.4
666 rutgerv 140
                // Rest
738 adamjking 141
                engine.add(MultiSpecs.createInstrument(patch, 192)); // 14:
808 adamjking 142
                // Inst.5
666 rutgerv 143
                // Rest
738 adamjking 144
                engine.add(MultiSpecs.createInstrument(patch, 240)); // 15:
808 adamjking 145
                // Inst.6
666 rutgerv 146
                // Rest
738 adamjking 147
                engine.add(MultiSpecs.createWTdata(patch)); // 16: Wavetable
808 adamjking 148
                // data
666 rutgerv 149
            }
213 tk 150
        }
151
        return engine;
152
    }
738 adamjking 153
 
213 tk 154
    private static Vector createGlobal(Patch patch, String[] engineParams) {
155
        Vector globalControl = new Vector();
156
 
738 adamjking 157
        globalControl.add(new SIDSysexParameterControl(combo,
158
                SIDSysexInfo.sidRestrict, 0, patch, 17, 0, 2, "SID type",
159
                "SID chip type to be used"));
160
        globalControl.add(new SIDSysexParameterControl(combo,
161
                SIDSysexInfo.monoStereo, 0, patch, 17, 3, 1, "Stereo",
162
                "To be used in stereo"));
163
        globalControl.add(new SIDSysexParameterControl(combo,
164
                SIDSysexInfo.caps, 0, patch, 17, 4, 4, "Filter caps",
165
                "Type of filter capacitors to be used"));
166
        globalControl.add(new SIDSysexParameterControl(button, null, 0, patch,
167
                18, 0, 1, "ABW", "Workaround for the SID's ADSR-bug"));
168
        globalControl.add(new SIDSysexParameterControl(rotary, null, 0, patch,
169
                82, 0, 7, "Volume"));
628 adamjking 170
 
171
        for (int c = 0; c < 8; c++) {
738 adamjking 172
            globalControl.add(new SIDSysexParameterControl(combo, engineParams,
173
                    0, patch, 24 + (5 * c), 0, 8, "Assign 1",
174
                    "Assign this control to a parameter"));
175
            globalControl.add(new SIDSysexParameterControl(combo, engineParams,
176
                    0, patch, 25 + (5 * c), 0, 8, "Assign 2",
177
                    "Assign this control to a parameter"));
178
            globalControl.add(new SIDSysexParameterControl(rotary, null, 0,
179
                    patch, 26 + (5 * c), 0, 8, "Init.", "Initial value"));
180
            globalControl.add(new SIDSysexParameterControl(rotary, null, 0,
181
                    patch, 27 + (5 * c), 0, 8, "Min.", "Minimum value"));
182
            globalControl.add(new SIDSysexParameterControl(rotary, null, 0,
183
                    patch, 28 + (5 * c), 0, 8, "Max.", "Maximum value"));
213 tk 184
        }
628 adamjking 185
 
213 tk 186
        return globalControl;
187
    }
628 adamjking 188
 
213 tk 189
    private static Vector createVoice(Patch patch, int offset) {
190
        Vector voiceControl = new Vector();
191
        // Single voice
738 adamjking 192
        voiceControl.add(new SIDSysexParameterControl(combo,
193
                SIDSysexInfo.porta, 0, patch, 96 + offset, 0, 2, "Portamento",
194
                "Portamento type"));
195
        voiceControl.add(new SIDSysexParameterControl(button, null, 0, patch,
196
                96 + offset, 2, 1, "GAE", "Gate Always Enabled"));
197
        voiceControl.add(new SIDSysexParameterControl(waveselect, null, 0,
198
                patch, 97 + offset, 0, 8, "Waveform", "Select a waveform"));
199
        voiceControl.add(new SIDSysexParameterControl(slider, null, 0, patch,
200
                98 + offset, 4, 4, "Attack", "SID's DCA Attack rate"));
201
        voiceControl.add(new SIDSysexParameterControl(slider, null, 0, patch,
202
                98 + offset, 0, 4, "Decay", "SID's DCA Decay rate"));
203
        voiceControl.add(new SIDSysexParameterControl(slider, null, 0, patch,
204
                99 + offset, 4, 4, "Sustain", "SID's DCA Sustain level"));
205
        voiceControl.add(new SIDSysexParameterControl(slider, null, 0, patch,
206
                99 + offset, 0, 4, "Release", "SID's DCA Release rate"));
207
        voiceControl.add(new SIDSysexParameterControl(rotary, null, 0, patch,
208
                100 + offset, 0, 12, "Pulse Width", "Pulse Width"));
209
        voiceControl.add(new SIDSysexParameterControl(rotary, null, 0, patch,
210
                102 + offset, 0, 8, "Accent", "Bassline Accent")); // SwinSID
628 adamjking 211
        // Phase...
738 adamjking 212
        voiceControl.add(new SIDSysexParameterControl(slider, null, 0, patch,
213
                103 + offset, 0, 8, "Delay", "DCA Envelope delay"));
214
        voiceControl.add(new SIDSysexParameterControl(rotary, null, -64, patch,
215
                104 + offset, 0, 7, "Transpose"));
216
        voiceControl.add(new SIDSysexParameterControl(rotary, null, -128,
217
                patch, 105 + offset, 0, 8, "Finetune"));
218
        voiceControl.add(new SIDSysexParameterControl(rotary, null, 0, patch,
219
                106 + offset, 0, 7, "Pitchrange", "Range of the Pitch Bender"));
220
        voiceControl.add(new SIDSysexParameterControl(rotary, null, 0, patch,
221
                107 + offset, 0, 8, "Porta. Rate", "Portamento speed"));
628 adamjking 222
        // Arpeggiator
738 adamjking 223
        voiceControl.add(new SIDSysexParameterControl(button, null, 0, patch,
224
                108 + offset, 0, 1, "Arp On/Off",
225
                "Enables/disables the arpeggiator"));
226
        voiceControl.add(new SIDSysexParameterControl(combo,
227
                SIDSysexInfo.direction, 0, patch, 108 + offset, 1, 3,
228
                "Direction", "Direction of the arpeggio"));
229
        voiceControl.add(new SIDSysexParameterControl(button, null, 0, patch,
230
                108 + offset, 4, 1, "Sorted", "Sort notes"));
231
        voiceControl.add(new SIDSysexParameterControl(button, null, 0, patch,
232
                108 + offset, 5, 1, "Hold", "Hold the last arpeggio"));
233
        voiceControl
234
                .add(new SIDSysexParameterControl(button, null, 0, patch,
235
                        108 + offset, 6, 1, "Key Sync",
236
                        "Synchronize with key presses"));
237
        voiceControl.add(new SIDSysexParameterControl(button, null, 0, patch,
238
                108 + offset, 7, 1, "Constant Cycle",
239
                "Constant arpeggiator cycle"));
240
        voiceControl.add(new SIDSysexParameterControl(rotary, createDividers(),
241
                0, patch, 109 + offset, 0, 6, "Speed Divider",
242
                "Speed divider (sets the tempo)"));
243
        voiceControl.add(new SIDSysexParameterControl(button, null, 0, patch,
244
                109 + offset, 6, 1, "Easy Chord")); // 21
245
        voiceControl.add(new SIDSysexParameterControl(button, null, 0, patch,
246
                109 + offset, 7, 1, "Oneshot")); // 22
247
        voiceControl
248
                .add(new SIDSysexParameterControl(rotary, createGatelength(),
249
                        0, patch, 110 + offset, 0, 5, "Gatelength")); // 23
250
        voiceControl.add(new SIDSysexParameterControl(rotary, null, 1, patch,
251
                110 + offset, 5, 3, "Octave Range")); // 24
628 adamjking 252
        // SwinSID
738 adamjking 253
        voiceControl.add(new SIDSysexParameterControl(rotary, null, 0, patch,
254
                111 + offset, 0, 4, "Waveform OSC2",
255
                "Waveform of second oscillator"));
256
        voiceControl.add(new SIDSysexParameterControl(button, null, 0, patch,
257
                111 + offset, 4, 1, "Enable OSC2", "Enable second oscillator"));
258
        voiceControl.add(new SIDSysexParameterControl(button, null, 0, patch,
259
                111 + offset, 5, 1, "x2 pitch", "scale pitch"));
260
        voiceControl.add(new SIDSysexParameterControl(button, null, 0, patch,
261
                111 + offset, 6, 1, "Rev. Waveform", "Reverse Waveform"));
262
        voiceControl.add(new SIDSysexParameterControl(rotary, null, 0, patch,
263
                102 + offset, 0, 8, "Phase"));
213 tk 264
        return voiceControl;
265
    }
628 adamjking 266
 
213 tk 267
    private static Vector createFilter(Patch patch, int offset) {
268
        Vector filterControl = new Vector();
738 adamjking 269
        filterControl.add(new SIDSysexParameterControl(rotary, null, 0, patch,
270
                85 + offset, 0, 12, "Cutoff", "Cutoff frequency"));
271
        filterControl.add(new SIDSysexParameterControl(rotary, null, 0, patch,
272
                87 + offset, 0, 8, "Resonance"));
273
        filterControl.add(new SIDSysexParameterControl(rotary, null, 0, patch,
274
                88 + offset, 0, 8, "Keytrack", "Key tracking"));
275
        filterControl.add(new SIDSysexParameterControl(button, null, 0, patch,
276
                84 + offset, 0, 1, "OSC1->Filt", "OSC1 routed through filter"));
277
        filterControl.add(new SIDSysexParameterControl(button, null, 0, patch,
278
                84 + offset, 1, 1, "OSC2->Filt", "OSC2 routed through filter"));
279
        filterControl.add(new SIDSysexParameterControl(button, null, 0, patch,
280
                84 + offset, 2, 1, "OSC3->Filt", "OSC3 routed through filter"));
281
        filterControl.add(new SIDSysexParameterControl(button, null, 0, patch,
282
                84 + offset, 3, 1, "EXT->Filter",
283
                "External input routed through filter"));
284
        filterControl.add(new SIDSysexParameterControl(button, null, 0, patch,
285
                84 + offset, 4, 1, "Low  Pass", "Low pass filter"));
286
        filterControl.add(new SIDSysexParameterControl(button, null, 0, patch,
287
                84 + offset, 5, 1, "Band Pass", "Band pass filter"));
288
        filterControl.add(new SIDSysexParameterControl(button, null, 0, patch,
289
                84 + offset, 6, 1, "High Pass", "High pass filter"));
290
        filterControl.add(new SIDSysexParameterControl(button, null, 0, patch,
291
                84 + offset, 7, 1, "OSC3 off", "Turn off oscillator 3"));
292
        filterControl.add(new SIDSysexParameterControl(button, null, 0, patch,
293
                86 + offset, 7, 1, "FIP", "Filter Interpolation"));
213 tk 294
        return filterControl;
295
    }
628 adamjking 296
 
213 tk 297
    private static Vector createExt(Patch patch) {
298
        Vector extControl = new Vector();
299
        // External switches 1-8
738 adamjking 300
        extControl.add(new SIDSysexParameterControl(button, null, 0, patch, 20,
301
                7, 1, "Switch 1", "External Switch 1"));
302
        extControl.add(new SIDSysexParameterControl(button, null, 0, patch, 20,
303
                6, 1, "Switch 2", "External Switch 2"));
304
        extControl.add(new SIDSysexParameterControl(button, null, 0, patch, 20,
305
                5, 1, "Switch 3", "External Switch 3"));
306
        extControl.add(new SIDSysexParameterControl(button, null, 0, patch, 20,
307
                4, 1, "Switch 4", "External Switch 4"));
308
        extControl.add(new SIDSysexParameterControl(button, null, 0, patch, 20,
309
                3, 1, "Switch 5", "External Switch 5"));
310
        extControl.add(new SIDSysexParameterControl(button, null, 0, patch, 20,
311
                2, 1, "Switch 6", "External Switch 6"));
312
        extControl.add(new SIDSysexParameterControl(button, null, 0, patch, 20,
313
                1, 1, "Switch 7", "External Switch 7"));
314
        extControl.add(new SIDSysexParameterControl(button, null, 0, patch, 20,
315
                0, 1, "Switch 8", "External Switch 8"));
213 tk 316
        // External Parameter CV 1-8
738 adamjking 317
        extControl.add(new SIDSysexParameterControl(rotary, null, 0, patch, 64,
318
                0, 16, "Ext.CV 1", "External Parameter CV 1"));
319
        extControl.add(new SIDSysexParameterControl(rotary, null, 0, patch, 66,
320
                0, 16, "Ext.CV 2", "External Parameter CV 2"));
321
        extControl.add(new SIDSysexParameterControl(rotary, null, 0, patch, 68,
322
                0, 16, "Ext.CV 3", "External Parameter CV 3"));
323
        extControl.add(new SIDSysexParameterControl(rotary, null, 0, patch, 70,
324
                0, 16, "Ext.CV 4", "External Parameter CV 4"));
325
        extControl.add(new SIDSysexParameterControl(rotary, null, 0, patch, 72,
326
                0, 16, "Ext.CV 5", "External Parameter CV 5"));
327
        extControl.add(new SIDSysexParameterControl(rotary, null, 0, patch, 74,
328
                0, 16, "Ext.CV 6", "External Parameter CV 6"));
329
        extControl.add(new SIDSysexParameterControl(rotary, null, 0, patch, 76,
330
                0, 16, "Ext.CV 7", "External Parameter CV 7"));
331
        extControl.add(new SIDSysexParameterControl(rotary, null, 0, patch, 78,
332
                0, 16, "Ext.CV 8", "External Parameter CV 8"));
213 tk 333
        return extControl;
334
    }
628 adamjking 335
 
712 tk 336
    public static String[] createDividers() {
337
        String[] s = new String[64];
338
        for (int i = 0; i < s.length; i++) {
339
            s[i] = Integer.toString(i + 1);
340
        }
341
        return s;
342
    }
343
 
344
    public static String[] createGatelength() {
345
        String[] s = new String[32];
346
        for (int i = 0; i < s.length; i++) {
347
            s[i] = Integer.toString(i + 1);
348
        }
349
        return s;
350
    }
351
 
213 tk 352
}