Subversion Repositories svn.mios

Rev

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