Subversion Repositories svn.mios

Rev

Rev 254 | 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.gui.drum;
22
 
23
import java.awt.BorderLayout;
24
import java.awt.GridBagConstraints;
25
import java.awt.GridBagLayout;
26
import java.awt.GridLayout;
27
import java.util.Vector;
28
 
29
import javax.swing.BorderFactory;
30
import javax.swing.BoxLayout;
31
import javax.swing.JPanel;
32
 
628 adamjking 33
import org.midibox.sidedit.gui.controls.SIDSysexParameterControlGUI;
34
import org.midibox.sidedit.gui.controls.SIDSysexParameterControlKnob;
35
 
36
public class DrumInstrumentGUI extends JPanel {
37
    private int[] snapvals1 = { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
38
    private int[] snapvals2 = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
39
            14, 15, 16, 17, 18, 19 };
40
 
213 tk 41
    protected DrumInstrumentGUI(Vector V1GUIv, boolean second) {
42
        setLayout(new BorderLayout());
43
        this.setOpaque(false);
628 adamjking 44
 
213 tk 45
        JPanel panel = new JPanel();
46
        panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
47
        panel.setOpaque(false);
628 adamjking 48
 
213 tk 49
        JPanel panel1 = new JPanel();
628 adamjking 50
        panel1.setLayout(new GridLayout(4, 2));
213 tk 51
        panel1.setOpaque(false);
628 adamjking 52
 
213 tk 53
        if (!second) {
628 adamjking 54
            panel1.add(createVoice(V1GUIv, "Drum 1 (ch1 primary)", 0));
55
            panel1.add(createVoice(V1GUIv, "Drum 2 (ch1 seconday)", 11));
56
            panel1.add(createVoice(V1GUIv, "Drum 3 (ch2 primary)", 22));
57
            panel1.add(createVoice(V1GUIv, "Drum 4 (ch2 seconday)", 33));
58
            panel1.add(createVoice(V1GUIv, "Drum 5 (ch3 primary)", 44));
59
            panel1.add(createVoice(V1GUIv, "Drum 6 (ch3 seconday)", 55));
60
            panel1.add(createVoice(V1GUIv, "Drum 7 (ch4 primary)", 66));
61
            panel1.add(createVoice(V1GUIv, "Drum 8 (ch4 seconday)", 77));
213 tk 62
        } else {
628 adamjking 63
            panel1.add(createVoice(V1GUIv, "Drum 9 (ch5 primary)", 88));
64
            panel1.add(createVoice(V1GUIv, "Drum 10 (ch5 seconday)", 99));
65
            panel1.add(createVoice(V1GUIv, "Drum 11 (ch6 primary)", 110));
66
            panel1.add(createVoice(V1GUIv, "Drum 12 (ch6 seconday)", 121));
67
            panel1.add(createVoice(V1GUIv, "Drum 13 (ch7 primary)", 132));
68
            panel1.add(createVoice(V1GUIv, "Drum 14 (ch7 seconday)", 143));
69
            panel1.add(createVoice(V1GUIv, "Drum 15 (ch8 primary)", 154));
70
            panel1.add(createVoice(V1GUIv, "Drum 16 (ch8 seconday)", 165));
213 tk 71
        }
72
        panel.add(panel1);
628 adamjking 73
        this.add(panel, BorderLayout.NORTH);
213 tk 74
    }
628 adamjking 75
 
213 tk 76
    protected JPanel createVoice(Vector vGUI, String s, int offset) {
77
        JPanel voicePanel = new JPanel();
78
        voicePanel.setLayout(new GridBagLayout());
79
        voicePanel.setBorder(BorderFactory.createEtchedBorder());
80
        voicePanel.setBorder(BorderFactory.createTitledBorder(s));
81
        voicePanel.setOpaque(false);
628 adamjking 82
 
83
        GridBagConstraints c = new GridBagConstraints();
213 tk 84
        c.fill = GridBagConstraints.HORIZONTAL;
628 adamjking 85
        c.ipadx = 5;
213 tk 86
        c.ipady = 5;
628 adamjking 87
 
88
        // Voice assign
89
        c.gridx = 0;
90
        c.gridy = 0;
91
        c.gridwidth = 1;
92
        c.gridheight = 1;
93
        voicePanel.add(
94
                (SIDSysexParameterControlGUI) vGUI.elementAt(0 + offset), c);
95
        ((SIDSysexParameterControlKnob) vGUI.elementAt(0 + offset))
96
                .setSnapvals(snapvals1);
97
        ((SIDSysexParameterControlKnob) vGUI.elementAt(0 + offset))
98
                .setSnap(true);
99
        c.gridx = 1;
100
        c.gridy = 0;
101
        c.gridwidth = 1;
102
        c.gridheight = 1;
103
        voicePanel.add(
104
                (SIDSysexParameterControlGUI) vGUI.elementAt(1 + offset), c);
105
        ((SIDSysexParameterControlKnob) vGUI.elementAt(1 + offset))
106
                .setSnapvals(snapvals2);
107
        ((SIDSysexParameterControlKnob) vGUI.elementAt(1 + offset))
108
                .setSnap(true);
109
        c.gridx = 2;
110
        c.gridy = 0;
111
        c.gridwidth = 2;
112
        c.gridheight = 1;
113
        voicePanel.add((SIDSysexParameterControlGUI) vGUI
114
                .elementAt(10 + offset), c);
115
 
213 tk 116
        // Knobs
628 adamjking 117
        c.gridx = 0;
118
        c.gridy = 1;
119
        c.gridwidth = 1;
120
        c.gridheight = 1;
121
        voicePanel.add(
122
                (SIDSysexParameterControlGUI) vGUI.elementAt(6 + offset), c);
123
        c.gridx = 1;
124
        c.gridy = 1;
125
        c.gridwidth = 1;
126
        c.gridheight = 1;
127
        voicePanel.add(
128
                (SIDSysexParameterControlGUI) vGUI.elementAt(7 + offset), c);
129
        c.gridx = 2;
130
        c.gridy = 1;
131
        c.gridwidth = 1;
132
        c.gridheight = 1;
133
        voicePanel.add(
134
                (SIDSysexParameterControlGUI) vGUI.elementAt(8 + offset), c);
135
        c.gridx = 3;
136
        c.gridy = 1;
137
        c.gridwidth = 1;
138
        c.gridheight = 1;
139
        voicePanel.add(
140
                (SIDSysexParameterControlGUI) vGUI.elementAt(9 + offset), c);
141
 
213 tk 142
        // ADSR
628 adamjking 143
        c.gridx = 4;
144
        c.gridy = 0;
145
        c.gridwidth = 1;
146
        c.gridheight = 2;
147
        voicePanel.add(
148
                (SIDSysexParameterControlGUI) vGUI.elementAt(2 + offset), c);
149
        c.gridx = 5;
150
        c.gridy = 0;
151
        c.gridwidth = 1;
152
        c.gridheight = 2;
153
        voicePanel.add(
154
                (SIDSysexParameterControlGUI) vGUI.elementAt(3 + offset), c);
155
        c.gridx = 6;
156
        c.gridy = 0;
157
        c.gridwidth = 1;
158
        c.gridheight = 2;
159
        voicePanel.add(
160
                (SIDSysexParameterControlGUI) vGUI.elementAt(4 + offset), c);
161
        c.gridx = 7;
162
        c.gridy = 0;
163
        c.gridwidth = 1;
164
        c.gridheight = 2;
165
        voicePanel.add(
166
                (SIDSysexParameterControlGUI) vGUI.elementAt(5 + offset), c);
167
 
213 tk 168
        return voicePanel;
628 adamjking 169
    }
213 tk 170
}