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;
628 adamjking 22
 
213 tk 23
import java.util.Vector;
24
 
25
import org.midibox.sidlibr.Patch;
26
 
27
public class DrumSpecs {
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;
36
    private static int simplerotary = 7;
628 adamjking 37
 
213 tk 38
    public static Vector createDrumInstr(Patch patch) {
39
        Vector drumInstrControl = new Vector();
628 adamjking 40
 
41
        for (int i = 0; i < 16; i++) {
42
            drumInstrControl.add(new SIDSysexParameterControl(rotary,
43
                    SIDSysexInfo.voiceAssign, patch, 96 + (10 * i), 4, 4,
44
                    "Voice Assign", "Voice assignment"));
45
            drumInstrControl.add(new SIDSysexParameterControl(rotary,
46
                    SIDSysexInfo.drumModel, patch, 97 + (10 * i), 0, 8,
47
                    "Drum Model"));
48
            drumInstrControl.add(new SIDSysexParameterControl(slider, null,
49
                    patch, 98 + (10 * i), 4, 4, "Attack", "DCA Attack Rate"));
50
            drumInstrControl.add(new SIDSysexParameterControl(slider, null,
51
                    patch, 98 + (10 * i), 0, 4, "Decay", "DCA Decay Rate"));
52
            drumInstrControl
53
                    .add(new SIDSysexParameterControl(slider, null, patch,
54
                            99 + (10 * i), 4, 4, "Sustain", "DCA Sustain Level"));
55
            drumInstrControl.add(new SIDSysexParameterControl(slider, null,
56
                    patch, 99 + (10 * i), 0, 4, "Release", "DCA Release Rate"));
57
            drumInstrControl.add(new SIDSysexParameterControl(rotary, null,
58
                    patch, 100 + (10 * i), 0, -8, "Tune"));
59
            drumInstrControl.add(new SIDSysexParameterControl(rotary, null,
60
                    patch, 101 + (10 * i), 0, -8, "Gatelength",
61
                    "Parameter #1: Gatelength"));
62
            drumInstrControl.add(new SIDSysexParameterControl(rotary, null,
63
                    patch, 102 + (10 * i), 0, -8, "Speed",
64
                    "Parameter #2: Speed"));
65
            drumInstrControl.add(new SIDSysexParameterControl(rotary, null,
66
                    patch, 103 + (10 * i), 0, -8, "Param #3",
67
                    "Parameter #3: depends on Drum Model"));
68
            drumInstrControl.add(new SIDSysexParameterControl(combo,
69
                    SIDSysexInfo.drumParams, patch, 104 + (10 * i), 0, 8,
70
                    "Velocity Assign", "Velocity parameter assignment"));
71
        }
213 tk 72
        return drumInstrControl;
73
    }
628 adamjking 74
 
213 tk 75
    public static Vector createSEQ(Patch patch) {
628 adamjking 76
        Vector seqControl = new Vector();
213 tk 77
        // Sequencer
628 adamjking 78
        seqControl.add(new SIDSysexParameterControl(rotary, null, patch, 80, 0,
79
                6, "Clock Divider", "Clock divider (sets tempo)"));
80
        seqControl.add(new SIDSysexParameterControl(button, null, patch, 80, 6,
81
                1, "Manual/Seq", "MIDI Note playing/Sequencer mode"));
82
        seqControl.add(new SIDSysexParameterControl(button, null, patch, 80, 7,
83
                1, "Pattern Sync", "Pattern changes synchronised to measure"));
84
        seqControl.add(new SIDSysexParameterControl(combo, SIDSysexInfo.seq,
85
                patch, 81, 0, 4, "Sequence", "Sequencer number"));
86
        seqControl.add(new SIDSysexParameterControl(rotary, createSteps(),
87
                patch, 83, 0, 4, "Steps", "Number of steps"));
213 tk 88
        return seqControl;
89
    }
628 adamjking 90
 
213 tk 91
    public static Vector createSEQData(Patch patch) {
628 adamjking 92
        Vector seqDataControl = new Vector();
213 tk 93
        // Sequence 1-8
628 adamjking 94
        for (int seq = 0; seq < 8; seq++) {
213 tk 95
            // Channels 1-8
628 adamjking 96
            for (int ch = 0; ch < 8; ch++) {
97
                int offset = 4 * (ch + (8 * seq));
213 tk 98
                // Steps: 1-16
628 adamjking 99
                for (int s = 0; s < 16; s++) {
100
                    if (s < 8) {
101
                        seqDataControl.add(new SIDSysexParameterControl(
102
                                simplebutton, null, patch, 256 + offset, s, 1,
103
                                "Gate" + Integer.toString(s)
104
                                        + Integer.toString(ch)));
213 tk 105
                    } else {
628 adamjking 106
                        seqDataControl.add(new SIDSysexParameterControl(
107
                                simplebutton, null, patch, 258 + offset, s - 8,
108
                                1, "Gate" + Integer.toString(s)
109
                                        + Integer.toString(ch)));
110
                    }
213 tk 111
                }
628 adamjking 112
                for (int s = 0; s < 16; s++) {
113
                    if (s < 8) {
114
                        seqDataControl.add(new SIDSysexParameterControl(
115
                                simplebutton, null, patch, 257 + offset, s, 1,
116
                                "Accent" + Integer.toString(s)
117
                                        + Integer.toString(ch)));
213 tk 118
                    } else {
628 adamjking 119
                        seqDataControl.add(new SIDSysexParameterControl(
120
                                simplebutton, null, patch, 259 + offset, s - 8,
121
                                1, "Accent" + Integer.toString(s)
122
                                        + Integer.toString(ch)));
123
                    }
213 tk 124
                }
628 adamjking 125
 
213 tk 126
            }
127
        }
128
        return seqDataControl;
129
    }
628 adamjking 130
 
213 tk 131
    public static String[] createSteps() {
132
        String[] s = new String[16];
628 adamjking 133
        for (int i = 0; i < s.length; i++) {
134
            s[i] = Integer.toString(i + 1);
213 tk 135
        }
136
        return s;
137
    }
138
}