andrewm@0
|
1 /*
|
andrewm@0
|
2 ==============================================================================
|
andrewm@0
|
3
|
andrewm@0
|
4 This is an automatically generated GUI class created by the Introjucer!
|
andrewm@0
|
5
|
andrewm@0
|
6 Be careful when adding custom code to these files, as only the code within
|
andrewm@0
|
7 the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded
|
andrewm@0
|
8 and re-saved.
|
andrewm@0
|
9
|
andrewm@0
|
10 Created with Introjucer version: 3.1.0
|
andrewm@0
|
11
|
andrewm@0
|
12 ------------------------------------------------------------------------------
|
andrewm@0
|
13
|
andrewm@0
|
14 The Introjucer is part of the JUCE library - "Jules' Utility Class Extensions"
|
andrewm@0
|
15 Copyright 2004-13 by Raw Material Software Ltd.
|
andrewm@0
|
16
|
andrewm@0
|
17 ==============================================================================
|
andrewm@0
|
18 */
|
andrewm@0
|
19
|
andrewm@0
|
20 //[Headers] You can add your own extra header files here...
|
andrewm@50
|
21 #ifndef TOUCHKEYS_NO_GUI
|
andrewm@0
|
22 //[/Headers]
|
andrewm@0
|
23
|
andrewm@0
|
24 #include "KeyboardZoneComponent.h"
|
andrewm@0
|
25
|
andrewm@0
|
26
|
andrewm@0
|
27 //[MiscUserDefs] You can add your own user definitions and misc code here...
|
andrewm@0
|
28 //[/MiscUserDefs]
|
andrewm@0
|
29
|
andrewm@0
|
30 //==============================================================================
|
andrewm@0
|
31 KeyboardZoneComponent::KeyboardZoneComponent ()
|
andrewm@0
|
32 : controller_(0), keyboardSegment_(0)
|
andrewm@0
|
33 {
|
andrewm@5
|
34 addAndMakeVisible (mappingListComponent = new MappingListComponent());
|
andrewm@0
|
35 addAndMakeVisible (midiOutputGroupComponent = new GroupComponent ("MIDI input group",
|
andrewm@0
|
36 "MIDI Output"));
|
andrewm@0
|
37
|
andrewm@0
|
38 addAndMakeVisible (midiOutputDeviceComboBox = new ComboBox ("MIDI input combo box"));
|
andrewm@0
|
39 midiOutputDeviceComboBox->setEditableText (false);
|
andrewm@0
|
40 midiOutputDeviceComboBox->setJustificationType (Justification::centredLeft);
|
andrewm@0
|
41 midiOutputDeviceComboBox->setTextWhenNothingSelected (String::empty);
|
andrewm@0
|
42 midiOutputDeviceComboBox->setTextWhenNoChoicesAvailable ("(no choices)");
|
andrewm@0
|
43 midiOutputDeviceComboBox->addListener (this);
|
andrewm@0
|
44
|
andrewm@0
|
45 addAndMakeVisible (label4 = new Label ("new label",
|
andrewm@0
|
46 "Device:"));
|
andrewm@0
|
47 label4->setFont (Font (15.00f, Font::plain));
|
andrewm@0
|
48 label4->setJustificationType (Justification::centredLeft);
|
andrewm@0
|
49 label4->setEditable (false, false, false);
|
andrewm@0
|
50 label4->setColour (TextEditor::textColourId, Colours::black);
|
andrewm@0
|
51 label4->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
|
andrewm@0
|
52
|
andrewm@0
|
53 addAndMakeVisible (label5 = new Label ("new label",
|
andrewm@0
|
54 "Mode:"));
|
andrewm@0
|
55 label5->setFont (Font (15.00f, Font::plain));
|
andrewm@0
|
56 label5->setJustificationType (Justification::centredLeft);
|
andrewm@0
|
57 label5->setEditable (false, false, false);
|
andrewm@0
|
58 label5->setColour (TextEditor::textColourId, Colours::black);
|
andrewm@0
|
59 label5->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
|
andrewm@0
|
60
|
andrewm@0
|
61 addAndMakeVisible (midiOutputModeComboBox = new ComboBox ("MIDI input combo box"));
|
andrewm@0
|
62 midiOutputModeComboBox->setEditableText (false);
|
andrewm@0
|
63 midiOutputModeComboBox->setJustificationType (Justification::centredLeft);
|
andrewm@0
|
64 midiOutputModeComboBox->setTextWhenNothingSelected (String::empty);
|
andrewm@0
|
65 midiOutputModeComboBox->setTextWhenNoChoicesAvailable ("(no choices)");
|
andrewm@0
|
66 midiOutputModeComboBox->addListener (this);
|
andrewm@0
|
67
|
andrewm@0
|
68 addAndMakeVisible (midiOutputVoiceStealingButton = new ToggleButton ("Voice stealing button"));
|
andrewm@0
|
69 midiOutputVoiceStealingButton->setButtonText ("Voice stealing");
|
andrewm@0
|
70 midiOutputVoiceStealingButton->addListener (this);
|
andrewm@0
|
71
|
andrewm@0
|
72 addAndMakeVisible (label2 = new Label ("new label",
|
andrewm@0
|
73 "Channels:"));
|
andrewm@0
|
74 label2->setFont (Font (15.00f, Font::plain));
|
andrewm@0
|
75 label2->setJustificationType (Justification::centredLeft);
|
andrewm@0
|
76 label2->setEditable (false, false, false);
|
andrewm@0
|
77 label2->setColour (TextEditor::textColourId, Colours::black);
|
andrewm@0
|
78 label2->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
|
andrewm@0
|
79
|
andrewm@0
|
80 addAndMakeVisible (midiOutputChannelLowEditor = new TextEditor ("new text editor"));
|
andrewm@0
|
81 midiOutputChannelLowEditor->setMultiLine (false);
|
andrewm@0
|
82 midiOutputChannelLowEditor->setReturnKeyStartsNewLine (false);
|
andrewm@0
|
83 midiOutputChannelLowEditor->setReadOnly (false);
|
andrewm@0
|
84 midiOutputChannelLowEditor->setScrollbarsShown (true);
|
andrewm@0
|
85 midiOutputChannelLowEditor->setCaretVisible (true);
|
andrewm@0
|
86 midiOutputChannelLowEditor->setPopupMenuEnabled (true);
|
andrewm@0
|
87 midiOutputChannelLowEditor->setText (String::empty);
|
andrewm@0
|
88
|
andrewm@0
|
89 addAndMakeVisible (midiOutputChannelHighEditor = new TextEditor ("new text editor"));
|
andrewm@0
|
90 midiOutputChannelHighEditor->setMultiLine (false);
|
andrewm@0
|
91 midiOutputChannelHighEditor->setReturnKeyStartsNewLine (false);
|
andrewm@0
|
92 midiOutputChannelHighEditor->setReadOnly (false);
|
andrewm@0
|
93 midiOutputChannelHighEditor->setScrollbarsShown (true);
|
andrewm@0
|
94 midiOutputChannelHighEditor->setCaretVisible (true);
|
andrewm@0
|
95 midiOutputChannelHighEditor->setPopupMenuEnabled (true);
|
andrewm@0
|
96 midiOutputChannelHighEditor->setText (String::empty);
|
andrewm@0
|
97
|
andrewm@0
|
98 addAndMakeVisible (label3 = new Label ("new label",
|
andrewm@0
|
99 "to"));
|
andrewm@0
|
100 label3->setFont (Font (15.00f, Font::plain));
|
andrewm@0
|
101 label3->setJustificationType (Justification::centredLeft);
|
andrewm@0
|
102 label3->setEditable (false, false, false);
|
andrewm@0
|
103 label3->setColour (TextEditor::textColourId, Colours::black);
|
andrewm@0
|
104 label3->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
|
andrewm@0
|
105
|
andrewm@0
|
106 addAndMakeVisible (midiOutputGroupComponent2 = new GroupComponent ("MIDI input group",
|
andrewm@0
|
107 "Range"));
|
andrewm@0
|
108
|
andrewm@0
|
109 addAndMakeVisible (label7 = new Label ("new label",
|
andrewm@0
|
110 "to"));
|
andrewm@0
|
111 label7->setFont (Font (15.00f, Font::plain));
|
andrewm@0
|
112 label7->setJustificationType (Justification::centredLeft);
|
andrewm@0
|
113 label7->setEditable (false, false, false);
|
andrewm@0
|
114 label7->setColour (TextEditor::textColourId, Colours::black);
|
andrewm@0
|
115 label7->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
|
andrewm@0
|
116
|
andrewm@0
|
117 addAndMakeVisible (rangeLowComboBox = new ComboBox ("range low combo box"));
|
andrewm@0
|
118 rangeLowComboBox->setEditableText (true);
|
andrewm@0
|
119 rangeLowComboBox->setJustificationType (Justification::centredLeft);
|
andrewm@0
|
120 rangeLowComboBox->setTextWhenNothingSelected (String::empty);
|
andrewm@0
|
121 rangeLowComboBox->setTextWhenNoChoicesAvailable ("(no choices)");
|
andrewm@0
|
122 rangeLowComboBox->addListener (this);
|
andrewm@0
|
123
|
andrewm@0
|
124 addAndMakeVisible (rangeHighComboBox = new ComboBox ("range high combo combo box"));
|
andrewm@0
|
125 rangeHighComboBox->setEditableText (true);
|
andrewm@0
|
126 rangeHighComboBox->setJustificationType (Justification::centredLeft);
|
andrewm@0
|
127 rangeHighComboBox->setTextWhenNothingSelected (String::empty);
|
andrewm@0
|
128 rangeHighComboBox->setTextWhenNoChoicesAvailable ("(no choices)");
|
andrewm@0
|
129 rangeHighComboBox->addListener (this);
|
andrewm@0
|
130
|
andrewm@0
|
131 addAndMakeVisible (label6 = new Label ("new label",
|
andrewm@0
|
132 "Transpose:"));
|
andrewm@0
|
133 label6->setFont (Font (15.00f, Font::plain));
|
andrewm@0
|
134 label6->setJustificationType (Justification::centredLeft);
|
andrewm@0
|
135 label6->setEditable (false, false, false);
|
andrewm@0
|
136 label6->setColour (TextEditor::textColourId, Colours::black);
|
andrewm@0
|
137 label6->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
|
andrewm@0
|
138
|
andrewm@0
|
139 addAndMakeVisible (midiOutputTransposeEditor = new TextEditor ("transposition text editor"));
|
andrewm@0
|
140 midiOutputTransposeEditor->setMultiLine (false);
|
andrewm@0
|
141 midiOutputTransposeEditor->setReturnKeyStartsNewLine (false);
|
andrewm@0
|
142 midiOutputTransposeEditor->setReadOnly (false);
|
andrewm@0
|
143 midiOutputTransposeEditor->setScrollbarsShown (true);
|
andrewm@0
|
144 midiOutputTransposeEditor->setCaretVisible (true);
|
andrewm@0
|
145 midiOutputTransposeEditor->setPopupMenuEnabled (true);
|
andrewm@0
|
146 midiOutputTransposeEditor->setText (String::empty);
|
andrewm@0
|
147
|
andrewm@0
|
148 addAndMakeVisible (label8 = new Label ("new label",
|
andrewm@0
|
149 "Mappings:"));
|
andrewm@0
|
150 label8->setFont (Font (15.00f, Font::plain));
|
andrewm@0
|
151 label8->setJustificationType (Justification::centredLeft);
|
andrewm@0
|
152 label8->setEditable (false, false, false);
|
andrewm@0
|
153 label8->setColour (TextEditor::textColourId, Colours::black);
|
andrewm@0
|
154 label8->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
|
andrewm@0
|
155
|
andrewm@0
|
156 addAndMakeVisible (addMappingButton = new TextButton ("add mapping button"));
|
andrewm@0
|
157 addMappingButton->setButtonText ("Add Mapping...");
|
andrewm@0
|
158 addMappingButton->addListener (this);
|
andrewm@0
|
159
|
andrewm@5
|
160 addAndMakeVisible (label9 = new Label ("new label",
|
andrewm@5
|
161 "Pitchwheel range:"));
|
andrewm@5
|
162 label9->setFont (Font (15.00f, Font::plain));
|
andrewm@5
|
163 label9->setJustificationType (Justification::centredLeft);
|
andrewm@5
|
164 label9->setEditable (false, false, false);
|
andrewm@5
|
165 label9->setColour (TextEditor::textColourId, Colours::black);
|
andrewm@5
|
166 label9->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
|
andrewm@5
|
167
|
andrewm@5
|
168 addAndMakeVisible (pitchWheelRangeEditor = new TextEditor ("pitch wheel range editor"));
|
andrewm@5
|
169 pitchWheelRangeEditor->setMultiLine (false);
|
andrewm@5
|
170 pitchWheelRangeEditor->setReturnKeyStartsNewLine (false);
|
andrewm@5
|
171 pitchWheelRangeEditor->setReadOnly (false);
|
andrewm@5
|
172 pitchWheelRangeEditor->setScrollbarsShown (true);
|
andrewm@5
|
173 pitchWheelRangeEditor->setCaretVisible (true);
|
andrewm@5
|
174 pitchWheelRangeEditor->setPopupMenuEnabled (true);
|
andrewm@5
|
175 pitchWheelRangeEditor->setText (String::empty);
|
andrewm@5
|
176
|
andrewm@5
|
177 addAndMakeVisible (keyboardControllersButton = new TextButton ("keyboard controllers button"));
|
andrewm@8
|
178 keyboardControllersButton->setButtonText (" Controllers...");
|
andrewm@5
|
179 keyboardControllersButton->addListener (this);
|
andrewm@5
|
180
|
andrewm@0
|
181
|
andrewm@0
|
182 //[UserPreSize]
|
andrewm@0
|
183 // Add modes to MIDI mode toggle box
|
andrewm@0
|
184 midiOutputModeComboBox->addItem("Passthrough", MidiKeyboardSegment::ModePassThrough + kMidiOutputModeComboBoxOffset);
|
andrewm@0
|
185 midiOutputModeComboBox->addItem("Monophonic", MidiKeyboardSegment::ModeMonophonic + kMidiOutputModeComboBoxOffset);
|
andrewm@0
|
186 midiOutputModeComboBox->addItem("Polyphonic", MidiKeyboardSegment::ModePolyphonic + kMidiOutputModeComboBoxOffset);
|
andrewm@0
|
187
|
andrewm@0
|
188 // Populate the range combo boxes with notes of the 88-key keyboard
|
andrewm@0
|
189 for(int note = 12; note <= 127; note++) {
|
andrewm@0
|
190 rangeLowComboBox->addItem(MainApplicationController::midiNoteName(note).c_str(), note);
|
andrewm@0
|
191 rangeHighComboBox->addItem(MainApplicationController::midiNoteName(note).c_str(), note);
|
andrewm@0
|
192 }
|
andrewm@0
|
193
|
andrewm@39
|
194 lastSelectedMidiOutputID_ = kInvalidMidiOutputId;
|
andrewm@0
|
195
|
andrewm@0
|
196 //[/UserPreSize]
|
andrewm@0
|
197
|
andrewm@0
|
198 setSize (552, 400);
|
andrewm@0
|
199
|
andrewm@0
|
200
|
andrewm@0
|
201 //[Constructor] You can add your own custom stuff here..
|
andrewm@0
|
202 midiOutputChannelLowEditor->addListener(this);
|
andrewm@0
|
203 midiOutputChannelHighEditor->addListener(this);
|
andrewm@0
|
204 midiOutputTransposeEditor->addListener(this);
|
andrewm@5
|
205 pitchWheelRangeEditor->addListener(this);
|
andrewm@0
|
206 addMappingButton->setTriggeredOnMouseDown(true);
|
andrewm@5
|
207 keyboardControllersButton->setTriggeredOnMouseDown(true);
|
andrewm@0
|
208 //[/Constructor]
|
andrewm@0
|
209 }
|
andrewm@0
|
210
|
andrewm@0
|
211 KeyboardZoneComponent::~KeyboardZoneComponent()
|
andrewm@0
|
212 {
|
andrewm@0
|
213 //[Destructor_pre]. You can add your own custom destruction code here..
|
andrewm@0
|
214 //[/Destructor_pre]
|
andrewm@0
|
215
|
andrewm@5
|
216 mappingListComponent = nullptr;
|
andrewm@0
|
217 midiOutputGroupComponent = nullptr;
|
andrewm@0
|
218 midiOutputDeviceComboBox = nullptr;
|
andrewm@0
|
219 label4 = nullptr;
|
andrewm@0
|
220 label5 = nullptr;
|
andrewm@0
|
221 midiOutputModeComboBox = nullptr;
|
andrewm@0
|
222 midiOutputVoiceStealingButton = nullptr;
|
andrewm@0
|
223 label2 = nullptr;
|
andrewm@0
|
224 midiOutputChannelLowEditor = nullptr;
|
andrewm@0
|
225 midiOutputChannelHighEditor = nullptr;
|
andrewm@0
|
226 label3 = nullptr;
|
andrewm@0
|
227 midiOutputGroupComponent2 = nullptr;
|
andrewm@0
|
228 label7 = nullptr;
|
andrewm@0
|
229 rangeLowComboBox = nullptr;
|
andrewm@0
|
230 rangeHighComboBox = nullptr;
|
andrewm@0
|
231 label6 = nullptr;
|
andrewm@0
|
232 midiOutputTransposeEditor = nullptr;
|
andrewm@0
|
233 label8 = nullptr;
|
andrewm@0
|
234 addMappingButton = nullptr;
|
andrewm@5
|
235 label9 = nullptr;
|
andrewm@5
|
236 pitchWheelRangeEditor = nullptr;
|
andrewm@5
|
237 keyboardControllersButton = nullptr;
|
andrewm@0
|
238
|
andrewm@0
|
239
|
andrewm@0
|
240 //[Destructor]. You can add your own custom destruction code here..
|
andrewm@0
|
241 //[/Destructor]
|
andrewm@0
|
242 }
|
andrewm@0
|
243
|
andrewm@0
|
244 //==============================================================================
|
andrewm@0
|
245 void KeyboardZoneComponent::paint (Graphics& g)
|
andrewm@0
|
246 {
|
andrewm@0
|
247 //[UserPrePaint] Add your own custom painting code here..
|
andrewm@0
|
248 //[/UserPrePaint]
|
andrewm@0
|
249
|
andrewm@0
|
250 g.fillAll (Colour (0xffd2d2d2));
|
andrewm@0
|
251
|
andrewm@0
|
252 //[UserPaint] Add your own custom painting code here..
|
andrewm@0
|
253 //[/UserPaint]
|
andrewm@0
|
254 }
|
andrewm@0
|
255
|
andrewm@0
|
256 void KeyboardZoneComponent::resized()
|
andrewm@0
|
257 {
|
andrewm@5
|
258 mappingListComponent->setBounds (0, 168, 552, 260);
|
andrewm@0
|
259 midiOutputGroupComponent->setBounds (200, 8, 344, 128);
|
andrewm@0
|
260 midiOutputDeviceComboBox->setBounds (264, 32, 264, 24);
|
andrewm@0
|
261 label4->setBounds (208, 32, 55, 24);
|
andrewm@0
|
262 label5->setBounds (208, 64, 55, 24);
|
andrewm@0
|
263 midiOutputModeComboBox->setBounds (264, 64, 152, 24);
|
andrewm@0
|
264 midiOutputVoiceStealingButton->setBounds (424, 64, 112, 24);
|
andrewm@0
|
265 label2->setBounds (208, 96, 56, 24);
|
andrewm@0
|
266 midiOutputChannelLowEditor->setBounds (264, 96, 32, 24);
|
andrewm@0
|
267 midiOutputChannelHighEditor->setBounds (320, 96, 32, 24);
|
andrewm@0
|
268 label3->setBounds (296, 96, 32, 24);
|
andrewm@0
|
269 midiOutputGroupComponent2->setBounds (8, 8, 184, 128);
|
andrewm@0
|
270 label7->setBounds (88, 32, 32, 24);
|
andrewm@0
|
271 rangeLowComboBox->setBounds (24, 32, 64, 24);
|
andrewm@0
|
272 rangeHighComboBox->setBounds (112, 32, 64, 24);
|
andrewm@0
|
273 label6->setBounds (392, 96, 80, 24);
|
andrewm@0
|
274 midiOutputTransposeEditor->setBounds (472, 96, 56, 24);
|
andrewm@0
|
275 label8->setBounds (8, 144, 88, 24);
|
andrewm@0
|
276 addMappingButton->setBounds (440, 144, 104, 20);
|
andrewm@5
|
277 label9->setBounds (24, 68, 104, 24);
|
andrewm@5
|
278 pitchWheelRangeEditor->setBounds (128, 68, 48, 24);
|
andrewm@5
|
279 keyboardControllersButton->setBounds (24, 100, 152, 20);
|
andrewm@31
|
280
|
andrewm@0
|
281 //[UserResized] Add your own custom resize handling here..
|
andrewm@31
|
282
|
andrewm@31
|
283 // Resize the mapping list to fit the bottom of the window
|
andrewm@38
|
284 juce::Rectangle<int> const& ourBounds = getBounds();
|
andrewm@38
|
285 juce::Rectangle<int> mappingBounds = mappingListComponent->getBounds();
|
andrewm@31
|
286 mappingBounds.setHeight(ourBounds.getHeight() - mappingBounds.getY());
|
andrewm@31
|
287 mappingListComponent->setBounds(mappingBounds);
|
andrewm@31
|
288
|
andrewm@0
|
289 //[/UserResized]
|
andrewm@0
|
290 }
|
andrewm@0
|
291
|
andrewm@0
|
292 void KeyboardZoneComponent::comboBoxChanged (ComboBox* comboBoxThatHasChanged)
|
andrewm@0
|
293 {
|
andrewm@0
|
294 //[UsercomboBoxChanged_Pre]
|
andrewm@0
|
295 if(keyboardSegment_ == 0 || controller_ == 0)
|
andrewm@0
|
296 return;
|
andrewm@0
|
297 //[/UsercomboBoxChanged_Pre]
|
andrewm@0
|
298
|
andrewm@0
|
299 if (comboBoxThatHasChanged == midiOutputDeviceComboBox)
|
andrewm@0
|
300 {
|
andrewm@0
|
301 //[UserComboBoxCode_midiOutputDeviceComboBox] -- add your combo box handling code here..
|
andrewm@0
|
302
|
andrewm@0
|
303 // Look up the selected ID, remembering that Juce indices start at 1 and the first of
|
andrewm@0
|
304 // these is "Disabled" followed by "Virtual Output Port"
|
andrewm@0
|
305 int selection = midiOutputDeviceComboBox->getSelectedId() - kMidiOutputDeviceComboBoxOffset;
|
andrewm@0
|
306 if(selection == 1 - kMidiOutputDeviceComboBoxOffset) { // Disabled
|
andrewm@0
|
307 controller_->disableMIDIOutputPort(keyboardSegment_->outputPort());
|
andrewm@0
|
308 }
|
andrewm@0
|
309 else if(selection == 2 - kMidiOutputDeviceComboBoxOffset) { // Virtual output
|
andrewm@20
|
310 #ifndef JUCE_WINDOWS
|
andrewm@0
|
311 char st[20];
|
andrewm@0
|
312 snprintf(st, 20, "TouchKeys %d", keyboardSegment_->outputPort());
|
andrewm@0
|
313 controller_->enableMIDIOutputVirtualPort(keyboardSegment_->outputPort(), st);
|
andrewm@20
|
314 #endif
|
andrewm@0
|
315 }
|
andrewm@0
|
316 else if(selection >= 0 && selection < midiOutputDeviceIDs_.size()) {
|
andrewm@0
|
317 int deviceId = midiOutputDeviceIDs_[selection];
|
andrewm@0
|
318 controller_->enableMIDIOutputPort(keyboardSegment_->outputPort(), deviceId);
|
andrewm@0
|
319 }
|
andrewm@0
|
320 //[/UserComboBoxCode_midiOutputDeviceComboBox]
|
andrewm@0
|
321 }
|
andrewm@0
|
322 else if (comboBoxThatHasChanged == midiOutputModeComboBox)
|
andrewm@0
|
323 {
|
andrewm@0
|
324 //[UserComboBoxCode_midiOutputModeComboBox] -- add your combo box handling code here..
|
andrewm@0
|
325 int mode = midiOutputModeComboBox->getSelectedId() - kMidiOutputModeComboBoxOffset;
|
andrewm@0
|
326 keyboardSegment_->setMode(mode);
|
andrewm@0
|
327 //[/UserComboBoxCode_midiOutputModeComboBox]
|
andrewm@0
|
328 }
|
andrewm@0
|
329 else if (comboBoxThatHasChanged == rangeLowComboBox)
|
andrewm@0
|
330 {
|
andrewm@0
|
331 //[UserComboBoxCode_rangeLowComboBox] -- add your combo box handling code here..
|
andrewm@0
|
332 updateSegmentRange();
|
andrewm@0
|
333 //[/UserComboBoxCode_rangeLowComboBox]
|
andrewm@0
|
334 }
|
andrewm@0
|
335 else if (comboBoxThatHasChanged == rangeHighComboBox)
|
andrewm@0
|
336 {
|
andrewm@0
|
337 //[UserComboBoxCode_rangeHighComboBox] -- add your combo box handling code here..
|
andrewm@0
|
338 updateSegmentRange();
|
andrewm@0
|
339 //[/UserComboBoxCode_rangeHighComboBox]
|
andrewm@0
|
340 }
|
andrewm@0
|
341
|
andrewm@0
|
342 //[UsercomboBoxChanged_Post]
|
andrewm@0
|
343 //[/UsercomboBoxChanged_Post]
|
andrewm@0
|
344 }
|
andrewm@0
|
345
|
andrewm@0
|
346 void KeyboardZoneComponent::buttonClicked (Button* buttonThatWasClicked)
|
andrewm@0
|
347 {
|
andrewm@0
|
348 //[UserbuttonClicked_Pre]
|
andrewm@0
|
349 if(keyboardSegment_ == 0)
|
andrewm@0
|
350 return;
|
andrewm@0
|
351 //[/UserbuttonClicked_Pre]
|
andrewm@0
|
352
|
andrewm@0
|
353 if (buttonThatWasClicked == midiOutputVoiceStealingButton)
|
andrewm@0
|
354 {
|
andrewm@0
|
355 //[UserButtonCode_midiOutputVoiceStealingButton] -- add your button handler code here..
|
andrewm@0
|
356 bool stealing = midiOutputVoiceStealingButton->getToggleState();
|
andrewm@0
|
357 keyboardSegment_->setVoiceStealingEnabled(stealing);
|
andrewm@0
|
358 //[/UserButtonCode_midiOutputVoiceStealingButton]
|
andrewm@0
|
359 }
|
andrewm@0
|
360 else if (buttonThatWasClicked == addMappingButton)
|
andrewm@0
|
361 {
|
andrewm@0
|
362 //[UserButtonCode_addMappingButton] -- add your button handler code here..
|
andrewm@0
|
363 createMappingListPopup();
|
andrewm@0
|
364 //[/UserButtonCode_addMappingButton]
|
andrewm@0
|
365 }
|
andrewm@5
|
366 else if (buttonThatWasClicked == keyboardControllersButton)
|
andrewm@5
|
367 {
|
andrewm@5
|
368 //[UserButtonCode_keyboardControllersButton] -- add your button handler code here..
|
andrewm@5
|
369 createKeyboardControllerPopup();
|
andrewm@5
|
370 //[/UserButtonCode_keyboardControllersButton]
|
andrewm@5
|
371 }
|
andrewm@0
|
372
|
andrewm@0
|
373 //[UserbuttonClicked_Post]
|
andrewm@0
|
374 //[/UserbuttonClicked_Post]
|
andrewm@0
|
375 }
|
andrewm@0
|
376
|
andrewm@0
|
377
|
andrewm@0
|
378
|
andrewm@0
|
379 //[MiscUserCode] You can add your own definitions of your custom methods or any other code here...
|
andrewm@0
|
380
|
andrewm@0
|
381 void KeyboardZoneComponent::textEditorReturnKeyPressed(TextEditor &editor)
|
andrewm@0
|
382 {
|
andrewm@0
|
383 if(keyboardSegment_ == 0)
|
andrewm@0
|
384 return;
|
andrewm@0
|
385
|
andrewm@0
|
386 if(&editor == midiOutputChannelLowEditor ||
|
andrewm@0
|
387 &editor == midiOutputChannelHighEditor) {
|
andrewm@0
|
388 // Change range of MIDI output channels
|
andrewm@0
|
389 int rangeLow = atoi(midiOutputChannelLowEditor->getText().toUTF8());
|
andrewm@0
|
390 int rangeHigh = atoi(midiOutputChannelHighEditor->getText().toUTF8());
|
andrewm@0
|
391 if(rangeHigh > 16)
|
andrewm@0
|
392 rangeHigh = 16;
|
andrewm@0
|
393 if(rangeLow > 16)
|
andrewm@0
|
394 rangeLow = 16;
|
andrewm@0
|
395 if(rangeHigh < 1)
|
andrewm@0
|
396 rangeHigh = 1;
|
andrewm@0
|
397 if(rangeLow < 1)
|
andrewm@0
|
398 rangeLow = 1;
|
andrewm@0
|
399 keyboardSegment_->setOutputChannelLowest(rangeLow - 1); // 1-16 --> 0-15 indexing
|
andrewm@0
|
400
|
andrewm@0
|
401 int polyphony = rangeHigh - rangeLow + 1;
|
andrewm@0
|
402 if(polyphony < 1)
|
andrewm@0
|
403 polyphony = 1;
|
andrewm@0
|
404 keyboardSegment_->setPolyphony(polyphony);
|
andrewm@0
|
405 }
|
andrewm@0
|
406 else if(&editor == midiOutputTransposeEditor) {
|
andrewm@0
|
407 // Change output transposition (limiting possible range to +/- 4 octaves)
|
andrewm@0
|
408 int transpose = atoi(midiOutputTransposeEditor->getText().toUTF8());
|
andrewm@0
|
409 if(transpose < -48)
|
andrewm@0
|
410 transpose = -48;
|
andrewm@0
|
411 if(transpose > 48)
|
andrewm@0
|
412 transpose = 48;
|
andrewm@0
|
413 keyboardSegment_->setOutputTransposition(transpose);
|
andrewm@0
|
414 }
|
andrewm@5
|
415 else if(&editor == pitchWheelRangeEditor) {
|
andrewm@5
|
416 float range = atof(pitchWheelRangeEditor->getText().toUTF8());
|
andrewm@5
|
417 keyboardSegment_->setMidiPitchWheelRange(range);
|
andrewm@5
|
418 }
|
andrewm@0
|
419 }
|
andrewm@0
|
420
|
andrewm@0
|
421 void KeyboardZoneComponent::textEditorEscapeKeyPressed(TextEditor &editor)
|
andrewm@0
|
422 {
|
andrewm@0
|
423
|
andrewm@0
|
424 }
|
andrewm@0
|
425
|
andrewm@0
|
426 void KeyboardZoneComponent::textEditorFocusLost(TextEditor &editor)
|
andrewm@0
|
427 {
|
andrewm@0
|
428 textEditorReturnKeyPressed(editor);
|
andrewm@0
|
429 }
|
andrewm@0
|
430
|
andrewm@0
|
431 // Update state of GUI to reflect underlying controller
|
andrewm@0
|
432 void KeyboardZoneComponent::synchronize(bool forceUpdates)
|
andrewm@0
|
433 {
|
andrewm@0
|
434 if(keyboardSegment_ == 0 || controller_ == 0)
|
andrewm@0
|
435 return;
|
andrewm@31
|
436
|
andrewm@28
|
437 if(forceUpdates) {
|
andrewm@28
|
438 // Update the controls to reflect the current state
|
andrewm@28
|
439 updateOutputDeviceList();
|
andrewm@28
|
440 }
|
andrewm@31
|
441
|
andrewm@0
|
442 // Update note ranges
|
andrewm@0
|
443 std::pair<int, int> range = keyboardSegment_->noteRange();
|
andrewm@0
|
444 if(!rangeLowComboBox->hasKeyboardFocus(true) || forceUpdates) {
|
andrewm@0
|
445 if(range.first < 12 || range.first > 127) {
|
andrewm@0
|
446 rangeLowComboBox->setText(String(range.first));
|
andrewm@0
|
447 }
|
andrewm@0
|
448 else
|
andrewm@0
|
449 rangeLowComboBox->setSelectedId(range.first, dontSendNotification);
|
andrewm@0
|
450 }
|
andrewm@0
|
451 if(!rangeHighComboBox->hasKeyboardFocus(true) || forceUpdates) {
|
andrewm@0
|
452 if(range.second < 12 || range.second > 127) {
|
andrewm@0
|
453 rangeHighComboBox->setText(String(range.second));
|
andrewm@0
|
454 }
|
andrewm@0
|
455 else
|
andrewm@0
|
456 rangeHighComboBox->setSelectedId(range.second, dontSendNotification);
|
andrewm@0
|
457 }
|
andrewm@0
|
458
|
andrewm@0
|
459 // Update MIDI output status
|
andrewm@0
|
460 int selectedMidiOutputDevice = controller_->selectedMIDIOutputPort(keyboardSegment_->outputPort());
|
andrewm@28
|
461 if(selectedMidiOutputDevice != lastSelectedMidiOutputID_ || forceUpdates) {
|
andrewm@0
|
462 if(selectedMidiOutputDevice == MidiOutputController::kMidiOutputNotOpen)
|
andrewm@0
|
463 midiOutputDeviceComboBox->setSelectedId(1, dontSendNotification);
|
andrewm@20
|
464 #ifndef JUCE_WINDOWS
|
andrewm@0
|
465 else if(selectedMidiOutputDevice == MidiOutputController::kMidiVirtualOutputPortNumber)
|
andrewm@0
|
466 midiOutputDeviceComboBox->setSelectedId(2, dontSendNotification);
|
andrewm@20
|
467 #endif
|
andrewm@0
|
468 else {
|
andrewm@0
|
469 // Find the output device in the vector
|
andrewm@0
|
470 for(int i = 0; i < midiOutputDeviceIDs_.size(); i++) {
|
andrewm@0
|
471 if(midiOutputDeviceIDs_[i] == selectedMidiOutputDevice) {
|
andrewm@0
|
472 midiOutputDeviceComboBox->setSelectedId(i + kMidiOutputDeviceComboBoxOffset, dontSendNotification);
|
andrewm@0
|
473 break;
|
andrewm@0
|
474 }
|
andrewm@0
|
475 }
|
andrewm@0
|
476 }
|
andrewm@0
|
477 lastSelectedMidiOutputID_ = selectedMidiOutputDevice;
|
andrewm@0
|
478 }
|
andrewm@0
|
479
|
andrewm@0
|
480 // Update the mode and the peripheral controls that go with it
|
andrewm@0
|
481 int selectedMidiOutputMode = keyboardSegment_->mode();
|
andrewm@0
|
482 midiOutputModeComboBox->setSelectedId(selectedMidiOutputMode + kMidiOutputModeComboBoxOffset, dontSendNotification);
|
andrewm@0
|
483
|
andrewm@0
|
484 if(selectedMidiOutputMode == MidiKeyboardSegment::ModePolyphonic) {
|
andrewm@0
|
485 midiOutputVoiceStealingButton->setEnabled(true);
|
andrewm@0
|
486 midiOutputVoiceStealingButton->setToggleState(keyboardSegment_->voiceStealingEnabled(), dontSendNotification);
|
andrewm@0
|
487 }
|
andrewm@0
|
488 else {
|
andrewm@0
|
489 midiOutputVoiceStealingButton->setEnabled(false);
|
andrewm@0
|
490 midiOutputVoiceStealingButton->setToggleState(false, dontSendNotification);
|
andrewm@0
|
491 }
|
andrewm@0
|
492
|
andrewm@0
|
493 // Update text editors
|
andrewm@5
|
494 if(!pitchWheelRangeEditor->hasKeyboardFocus(true) || forceUpdates) {
|
andrewm@5
|
495 float value = keyboardSegment_->midiPitchWheelRange();
|
andrewm@5
|
496 char st[16];
|
andrewm@20
|
497 #ifdef _MSC_VER
|
andrewm@20
|
498 _snprintf_s(st, 16, _TRUNCATE, "%.1f", value);
|
andrewm@20
|
499 #else
|
andrewm@5
|
500 snprintf(st, 16, "%.1f", value);
|
andrewm@20
|
501 #endif
|
andrewm@5
|
502 pitchWheelRangeEditor->setText(st);
|
andrewm@5
|
503 }
|
andrewm@0
|
504 if(!midiOutputChannelLowEditor->hasKeyboardFocus(true) || forceUpdates) {
|
andrewm@0
|
505 int rangeLow = keyboardSegment_->outputChannelLowest() + 1; // 0-15 --> 1-16
|
andrewm@0
|
506 midiOutputChannelLowEditor->setText(String(rangeLow));
|
andrewm@0
|
507 }
|
andrewm@0
|
508 if(!midiOutputTransposeEditor->hasKeyboardFocus(true) || forceUpdates) {
|
andrewm@0
|
509 int transpose = keyboardSegment_->outputTransposition();
|
andrewm@0
|
510 midiOutputTransposeEditor->setText(String(transpose));
|
andrewm@0
|
511 }
|
andrewm@0
|
512
|
andrewm@0
|
513 if(selectedMidiOutputMode == MidiKeyboardSegment::ModePolyphonic) {
|
andrewm@0
|
514 midiOutputChannelHighEditor->setEnabled(true);
|
andrewm@0
|
515 if(!midiOutputChannelHighEditor->hasKeyboardFocus(true) || forceUpdates) {
|
andrewm@0
|
516 int rangeHigh = keyboardSegment_->polyphony() + keyboardSegment_->outputChannelLowest();
|
andrewm@0
|
517 midiOutputChannelHighEditor->setText(String(rangeHigh));
|
andrewm@0
|
518 }
|
andrewm@0
|
519 }
|
andrewm@0
|
520 else {
|
andrewm@0
|
521 midiOutputChannelHighEditor->setEnabled(false);
|
andrewm@0
|
522 midiOutputChannelHighEditor->setText("", false);
|
andrewm@0
|
523 }
|
andrewm@0
|
524
|
andrewm@0
|
525 // Update buttons
|
andrewm@5
|
526 //useAftertouchButton->setToggleState(keyboardSegment_->usesKeyboardChannnelPressure(), dontSendNotification);
|
andrewm@5
|
527 //usePitchWheelButton->setToggleState(keyboardSegment_->usesKeyboardPitchWheel(), dontSendNotification);
|
andrewm@5
|
528 //useControllersButton->setToggleState(keyboardSegment_->usesKeyboardMIDIControllers(), dontSendNotification);
|
andrewm@0
|
529
|
andrewm@0
|
530 // Update the mapping list
|
andrewm@0
|
531 mappingListComponent->synchronize();
|
andrewm@0
|
532 }
|
andrewm@0
|
533
|
andrewm@0
|
534 // Update the range of the keyboard segment
|
andrewm@0
|
535 void KeyboardZoneComponent::updateSegmentRange()
|
andrewm@0
|
536 {
|
andrewm@0
|
537 int selectionLow = rangeLowComboBox->getSelectedId();
|
andrewm@0
|
538 int noteLow = -1;
|
andrewm@0
|
539 if(selectionLow == 0) {
|
andrewm@0
|
540 // Not one of the predefined values that's selected. Parse the string.
|
andrewm@0
|
541 noteLow = MainApplicationController::midiNoteNumberForName((const char *)(rangeLowComboBox->getText().toUTF8()));
|
andrewm@0
|
542 }
|
andrewm@0
|
543 else {
|
andrewm@0
|
544 noteLow = selectionLow;
|
andrewm@0
|
545 }
|
andrewm@0
|
546
|
andrewm@0
|
547 if(noteLow < 0 || noteLow > 127) {
|
andrewm@0
|
548 // Out of range: keep the old value
|
andrewm@0
|
549 noteLow = keyboardSegment_->noteRange().first;
|
andrewm@0
|
550 }
|
andrewm@0
|
551
|
andrewm@0
|
552 int selectionHigh = rangeHighComboBox->getSelectedId();
|
andrewm@0
|
553 int noteHigh = -1;
|
andrewm@0
|
554 if(selectionHigh == 0) {
|
andrewm@0
|
555 // Not one of the predefined values that's selected. Parse the string.
|
andrewm@0
|
556 noteHigh = MainApplicationController::midiNoteNumberForName((const char *)(rangeHighComboBox->getText().toUTF8()));
|
andrewm@0
|
557 }
|
andrewm@0
|
558 else {
|
andrewm@0
|
559 noteHigh = selectionHigh;
|
andrewm@0
|
560 }
|
andrewm@0
|
561
|
andrewm@0
|
562 if(noteHigh < 0 || noteHigh > 127) {
|
andrewm@0
|
563 // Out of range: keep the old value
|
andrewm@0
|
564 noteHigh = keyboardSegment_->noteRange().second;
|
andrewm@0
|
565 }
|
andrewm@0
|
566
|
andrewm@0
|
567 if(noteHigh < noteLow)
|
andrewm@0
|
568 noteHigh = noteLow;
|
andrewm@0
|
569 keyboardSegment_->setNoteRange(noteLow, noteHigh);
|
andrewm@0
|
570 }
|
andrewm@0
|
571
|
andrewm@0
|
572 // Update the combo box with the current output devices
|
andrewm@0
|
573 void KeyboardZoneComponent::updateOutputDeviceList()
|
andrewm@0
|
574 {
|
andrewm@0
|
575 if(controller_ == 0 || keyboardSegment_ == 0)
|
andrewm@0
|
576 return;
|
andrewm@0
|
577
|
andrewm@0
|
578 // *** MIDI output devices ***
|
andrewm@0
|
579 vector<pair<int, string> > devices = controller_->availableMIDIOutputDevices();
|
andrewm@0
|
580 vector<pair<int, string> >::iterator it;
|
andrewm@0
|
581
|
andrewm@0
|
582 midiOutputDeviceComboBox->clear();
|
andrewm@0
|
583 midiOutputDeviceIDs_.clear();
|
andrewm@0
|
584 midiOutputDeviceComboBox->addItem("Disabled", 1);
|
andrewm@20
|
585 #ifndef JUCE_WINDOWS
|
andrewm@20
|
586 char virtualPortName[24];
|
andrewm@20
|
587 snprintf(virtualPortName, 24, "Virtual Port (%d)", keyboardSegment_->outputPort());
|
andrewm@20
|
588 midiOutputDeviceComboBox->addItem(virtualPortName, 2);
|
andrewm@20
|
589 #endif
|
andrewm@31
|
590
|
andrewm@28
|
591 // Check whether the currently selected ID still exists while
|
andrewm@28
|
592 // we build the list
|
andrewm@28
|
593 bool lastSelectedDeviceExists = false;
|
andrewm@0
|
594 int counter = kMidiOutputDeviceComboBoxOffset;
|
andrewm@0
|
595 for(it = devices.begin(); it != devices.end(); ++it) {
|
andrewm@0
|
596 if(it->first < 0)
|
andrewm@0
|
597 continue;
|
andrewm@0
|
598 midiOutputDeviceComboBox->addItem((*it).second.c_str(), counter);
|
andrewm@0
|
599 midiOutputDeviceIDs_.push_back(it->first);
|
andrewm@28
|
600 if(it->first == lastSelectedMidiOutputID_)
|
andrewm@28
|
601 lastSelectedDeviceExists = true;
|
andrewm@0
|
602 counter++;
|
andrewm@0
|
603 }
|
andrewm@31
|
604
|
andrewm@39
|
605 if(!lastSelectedDeviceExists && lastSelectedMidiOutputID_ != kInvalidMidiOutputId) {
|
andrewm@29
|
606 #ifndef JUCE_WINDOWS
|
andrewm@29
|
607 if(lastSelectedMidiOutputID_ != MidiOutputController::kMidiVirtualOutputPortNumber)
|
andrewm@29
|
608 controller_->disableMIDIOutputPort(keyboardSegment_->outputPort());
|
andrewm@29
|
609 #else // No virtual port on Windows
|
andrewm@28
|
610 controller_->disableMIDIOutputPort(keyboardSegment_->outputPort());
|
andrewm@29
|
611 #endif
|
andrewm@28
|
612 }
|
andrewm@0
|
613 }
|
andrewm@0
|
614
|
andrewm@0
|
615 // Create a popup menu containing a list of mapping factories
|
andrewm@0
|
616 void KeyboardZoneComponent::createMappingListPopup()
|
andrewm@0
|
617 {
|
andrewm@0
|
618 if(controller_ == 0)
|
andrewm@0
|
619 return;
|
andrewm@0
|
620
|
andrewm@0
|
621 PopupMenu menu;
|
andrewm@0
|
622
|
andrewm@49
|
623 for(int i = 0; i < MidiKeyboardSegment::numberOfMappingFactories(); i++) {
|
andrewm@49
|
624 if(controller_->experimentalMappingsEnabled() || !MidiKeyboardSegment::mappingIsExperimental(i))
|
andrewm@49
|
625 menu.addItem(i + 1, MidiKeyboardSegment::mappingFactoryNameForIndex(i));
|
andrewm@0
|
626 }
|
andrewm@0
|
627
|
andrewm@0
|
628 menu.showMenuAsync(PopupMenu::Options().withTargetComponent(addMappingButton),
|
andrewm@0
|
629 ModalCallbackFunction::forComponent(staticMappingChosenCallback, this));
|
andrewm@0
|
630 }
|
andrewm@0
|
631
|
andrewm@5
|
632 // Create a popup menu allowing selection of which controllers to retransmit
|
andrewm@5
|
633 void KeyboardZoneComponent::createKeyboardControllerPopup()
|
andrewm@5
|
634 {
|
andrewm@5
|
635 if(controller_ == 0 || keyboardSegment_ == 0)
|
andrewm@5
|
636 return;
|
andrewm@8
|
637
|
andrewm@5
|
638 PopupMenu menu;
|
andrewm@8
|
639
|
andrewm@8
|
640 menu.addItem(kKeyboardControllerSendPitchWheelRange, "Send Pitchwheel Range RPN", true, false);
|
andrewm@31
|
641 menu.addSeparator();
|
andrewm@5
|
642 menu.addItem(MidiKeyboardSegment::kControlPitchWheel, "Retransmit from Keyboard:", false);
|
andrewm@5
|
643 menu.addSeparator();
|
andrewm@5
|
644 menu.addItem(MidiKeyboardSegment::kControlPitchWheel, "Pitch Wheel", true, keyboardSegment_->usesKeyboardPitchWheel());
|
andrewm@5
|
645 menu.addItem(MidiKeyboardSegment::kControlChannelAftertouch, "Aftertouch", true, keyboardSegment_->usesKeyboardChannnelPressure());
|
andrewm@5
|
646 menu.addItem(1, "CC 1 (Mod Wheel)", true, keyboardSegment_->usesKeyboardModWheel());
|
andrewm@53
|
647 menu.addItem(kKeyboardControllerRetransmitPedals, "Pedals", true, keyboardSegment_->usesKeyboardPedals());
|
andrewm@5
|
648 menu.addItem(kKeyboardControllerRetransmitOthers, "Other Controllers", true, keyboardSegment_->usesKeyboardMIDIControllers());
|
andrewm@8
|
649
|
andrewm@5
|
650 menu.showMenuAsync(PopupMenu::Options().withTargetComponent(keyboardControllersButton),
|
andrewm@5
|
651 ModalCallbackFunction::forComponent(staticKeyboardControllerChosenCallback, this));
|
andrewm@5
|
652 }
|
andrewm@5
|
653
|
andrewm@0
|
654 // Called from the popup menu, indicating the selected item
|
andrewm@0
|
655 void KeyboardZoneComponent::mappingChosenCallback(int result)
|
andrewm@0
|
656 {
|
andrewm@0
|
657 if(controller_ == 0 || keyboardSegment_ == 0)
|
andrewm@0
|
658 return;
|
andrewm@0
|
659
|
andrewm@0
|
660 // Items are numbered from 1 in the menu but from 0 in the array in the controller
|
andrewm@0
|
661 if(result >= 1) {
|
andrewm@49
|
662 MappingFactory *newFactory = keyboardSegment_->createMappingFactoryForIndex(result - 1);
|
andrewm@0
|
663
|
andrewm@0
|
664 if(newFactory != 0) {
|
andrewm@0
|
665 keyboardSegment_->addMappingFactory(newFactory, true);
|
andrewm@0
|
666 }
|
andrewm@0
|
667 }
|
andrewm@0
|
668 }
|
andrewm@5
|
669
|
andrewm@5
|
670 // Called from the popup menu, indicated selected controller
|
andrewm@5
|
671 void KeyboardZoneComponent::keyboardControllerChosenCallback(int result)
|
andrewm@5
|
672 {
|
andrewm@5
|
673 if(controller_ == 0 || keyboardSegment_ == 0)
|
andrewm@5
|
674 return;
|
andrewm@8
|
675
|
andrewm@5
|
676 // Enable or disable retransmitting specific messages
|
andrewm@5
|
677 if(result == MidiKeyboardSegment::kControlPitchWheel) {
|
andrewm@5
|
678 keyboardSegment_->setUsesKeyboardPitchWheel(!keyboardSegment_->usesKeyboardPitchWheel());
|
andrewm@5
|
679 }
|
andrewm@5
|
680 else if(result == MidiKeyboardSegment::kControlChannelAftertouch) {
|
andrewm@5
|
681 keyboardSegment_->setUsesKeyboardChannelPressure(!keyboardSegment_->usesKeyboardChannnelPressure());
|
andrewm@5
|
682 }
|
andrewm@5
|
683 else if(result == 1) { // ModWheel == CC 1
|
andrewm@5
|
684 keyboardSegment_->setUsesKeyboardModWheel(!keyboardSegment_->usesKeyboardModWheel());
|
andrewm@5
|
685 }
|
andrewm@53
|
686 else if(result == kKeyboardControllerRetransmitPedals) {
|
andrewm@53
|
687 keyboardSegment_->setUsesKeyboardPedals(!keyboardSegment_->usesKeyboardPedals());
|
andrewm@53
|
688 }
|
andrewm@5
|
689 else if(result == kKeyboardControllerRetransmitOthers) {
|
andrewm@5
|
690 keyboardSegment_->setUsesKeyboardMIDIControllers(!keyboardSegment_->usesKeyboardMIDIControllers());
|
andrewm@5
|
691 }
|
andrewm@8
|
692 else if(result == kKeyboardControllerSendPitchWheelRange) {
|
andrewm@8
|
693 // Send a MIDI RPN message now to update the pitch wheel range
|
andrewm@8
|
694 keyboardSegment_->sendMidiPitchWheelRange();
|
andrewm@8
|
695 }
|
andrewm@5
|
696 }
|
andrewm@0
|
697 //[/MiscUserCode]
|
andrewm@0
|
698
|
andrewm@0
|
699
|
andrewm@0
|
700 //==============================================================================
|
andrewm@0
|
701 #if 0
|
andrewm@0
|
702 /* -- Introjucer information section --
|
andrewm@0
|
703
|
andrewm@0
|
704 This is where the Introjucer stores the metadata that describe this GUI layout, so
|
andrewm@0
|
705 make changes in here at your peril!
|
andrewm@0
|
706
|
andrewm@0
|
707 BEGIN_JUCER_METADATA
|
andrewm@0
|
708
|
andrewm@0
|
709 <JUCER_COMPONENT documentType="Component" className="KeyboardZoneComponent" componentName=""
|
andrewm@0
|
710 parentClasses="public Component, public TextEditor::Listener"
|
andrewm@0
|
711 constructorParams="" variableInitialisers="controller_(0), keyboardSegment_(0)"
|
andrewm@0
|
712 snapPixels="8" snapActive="1" snapShown="1" overlayOpacity="0.330"
|
andrewm@31
|
713 fixedSize="0" initialWidth="552" initialHeight="400">
|
andrewm@0
|
714 <BACKGROUND backgroundColour="ffd2d2d2"/>
|
andrewm@5
|
715 <JUCERCOMP name="mapping list" id="4d5d007374cdad00" memberName="mappingListComponent"
|
andrewm@5
|
716 virtualName="MappingListComponent" explicitFocusOrder="0" pos="0 168 552 260"
|
andrewm@5
|
717 sourceFile="" constructorParams=""/>
|
andrewm@0
|
718 <GROUPCOMPONENT name="MIDI input group" id="49eee95279c0cc95" memberName="midiOutputGroupComponent"
|
andrewm@0
|
719 virtualName="" explicitFocusOrder="0" pos="200 8 344 128" title="MIDI Output"/>
|
andrewm@0
|
720 <COMBOBOX name="MIDI input combo box" id="244410f02f6c1c72" memberName="midiOutputDeviceComboBox"
|
andrewm@0
|
721 virtualName="" explicitFocusOrder="0" pos="264 32 264 24" editable="0"
|
andrewm@0
|
722 layout="33" items="" textWhenNonSelected="" textWhenNoItems="(no choices)"/>
|
andrewm@0
|
723 <LABEL name="new label" id="e9b3daa69a8ac5c" memberName="label4" virtualName=""
|
andrewm@0
|
724 explicitFocusOrder="0" pos="208 32 55 24" edTextCol="ff000000"
|
andrewm@0
|
725 edBkgCol="0" labelText="Device:" editableSingleClick="0" editableDoubleClick="0"
|
andrewm@0
|
726 focusDiscardsChanges="0" fontname="Default font" fontsize="15"
|
andrewm@0
|
727 bold="0" italic="0" justification="33"/>
|
andrewm@0
|
728 <LABEL name="new label" id="c578e3610ba16aaf" memberName="label5" virtualName=""
|
andrewm@0
|
729 explicitFocusOrder="0" pos="208 64 55 24" edTextCol="ff000000"
|
andrewm@0
|
730 edBkgCol="0" labelText="Mode:" editableSingleClick="0" editableDoubleClick="0"
|
andrewm@0
|
731 focusDiscardsChanges="0" fontname="Default font" fontsize="15"
|
andrewm@0
|
732 bold="0" italic="0" justification="33"/>
|
andrewm@0
|
733 <COMBOBOX name="MIDI input combo box" id="b129ec2d38f47a91" memberName="midiOutputModeComboBox"
|
andrewm@0
|
734 virtualName="" explicitFocusOrder="0" pos="264 64 152 24" editable="0"
|
andrewm@0
|
735 layout="33" items="" textWhenNonSelected="" textWhenNoItems="(no choices)"/>
|
andrewm@0
|
736 <TOGGLEBUTTON name="Voice stealing button" id="62c82600413ca060" memberName="midiOutputVoiceStealingButton"
|
andrewm@0
|
737 virtualName="" explicitFocusOrder="0" pos="424 64 112 24" buttonText="Voice stealing"
|
andrewm@0
|
738 connectedEdges="0" needsCallback="1" radioGroupId="0" state="0"/>
|
andrewm@0
|
739 <LABEL name="new label" id="afb5095c42b66671" memberName="label2" virtualName=""
|
andrewm@0
|
740 explicitFocusOrder="0" pos="208 96 56 24" edTextCol="ff000000"
|
andrewm@0
|
741 edBkgCol="0" labelText="Channels:" editableSingleClick="0" editableDoubleClick="0"
|
andrewm@0
|
742 focusDiscardsChanges="0" fontname="Default font" fontsize="15"
|
andrewm@0
|
743 bold="0" italic="0" justification="33"/>
|
andrewm@0
|
744 <TEXTEDITOR name="new text editor" id="8fba4a69492a2f4f" memberName="midiOutputChannelLowEditor"
|
andrewm@0
|
745 virtualName="" explicitFocusOrder="0" pos="264 96 32 24" initialText=""
|
andrewm@0
|
746 multiline="0" retKeyStartsLine="0" readonly="0" scrollbars="1"
|
andrewm@0
|
747 caret="1" popupmenu="1"/>
|
andrewm@0
|
748 <TEXTEDITOR name="new text editor" id="21b3096394683581" memberName="midiOutputChannelHighEditor"
|
andrewm@0
|
749 virtualName="" explicitFocusOrder="0" pos="320 96 32 24" initialText=""
|
andrewm@0
|
750 multiline="0" retKeyStartsLine="0" readonly="0" scrollbars="1"
|
andrewm@0
|
751 caret="1" popupmenu="1"/>
|
andrewm@0
|
752 <LABEL name="new label" id="f6b023e6043849e7" memberName="label3" virtualName=""
|
andrewm@0
|
753 explicitFocusOrder="0" pos="296 96 32 24" edTextCol="ff000000"
|
andrewm@0
|
754 edBkgCol="0" labelText="to" editableSingleClick="0" editableDoubleClick="0"
|
andrewm@0
|
755 focusDiscardsChanges="0" fontname="Default font" fontsize="15"
|
andrewm@0
|
756 bold="0" italic="0" justification="33"/>
|
andrewm@0
|
757 <GROUPCOMPONENT name="MIDI input group" id="388fb821de641818" memberName="midiOutputGroupComponent2"
|
andrewm@0
|
758 virtualName="" explicitFocusOrder="0" pos="8 8 184 128" title="Range"/>
|
andrewm@0
|
759 <LABEL name="new label" id="bff0e81cc2020a66" memberName="label7" virtualName=""
|
andrewm@0
|
760 explicitFocusOrder="0" pos="88 32 32 24" edTextCol="ff000000"
|
andrewm@0
|
761 edBkgCol="0" labelText="to" editableSingleClick="0" editableDoubleClick="0"
|
andrewm@0
|
762 focusDiscardsChanges="0" fontname="Default font" fontsize="15"
|
andrewm@0
|
763 bold="0" italic="0" justification="33"/>
|
andrewm@0
|
764 <COMBOBOX name="range low combo box" id="86999fb7f9fe9c2" memberName="rangeLowComboBox"
|
andrewm@0
|
765 virtualName="" explicitFocusOrder="0" pos="24 32 64 24" editable="1"
|
andrewm@0
|
766 layout="33" items="" textWhenNonSelected="" textWhenNoItems="(no choices)"/>
|
andrewm@0
|
767 <COMBOBOX name="range high combo combo box" id="7cba07ed947e85b2" memberName="rangeHighComboBox"
|
andrewm@0
|
768 virtualName="" explicitFocusOrder="0" pos="112 32 64 24" editable="1"
|
andrewm@0
|
769 layout="33" items="" textWhenNonSelected="" textWhenNoItems="(no choices)"/>
|
andrewm@0
|
770 <LABEL name="new label" id="fd730bc972dffbdb" memberName="label6" virtualName=""
|
andrewm@0
|
771 explicitFocusOrder="0" pos="392 96 80 24" edTextCol="ff000000"
|
andrewm@0
|
772 edBkgCol="0" labelText="Transpose:" editableSingleClick="0" editableDoubleClick="0"
|
andrewm@0
|
773 focusDiscardsChanges="0" fontname="Default font" fontsize="15"
|
andrewm@0
|
774 bold="0" italic="0" justification="33"/>
|
andrewm@0
|
775 <TEXTEDITOR name="transposition text editor" id="6f96be1359a01685" memberName="midiOutputTransposeEditor"
|
andrewm@0
|
776 virtualName="" explicitFocusOrder="0" pos="472 96 56 24" initialText=""
|
andrewm@0
|
777 multiline="0" retKeyStartsLine="0" readonly="0" scrollbars="1"
|
andrewm@0
|
778 caret="1" popupmenu="1"/>
|
andrewm@0
|
779 <LABEL name="new label" id="759d38e4603010a8" memberName="label8" virtualName=""
|
andrewm@0
|
780 explicitFocusOrder="0" pos="8 144 88 24" edTextCol="ff000000"
|
andrewm@0
|
781 edBkgCol="0" labelText="Mappings:" editableSingleClick="0" editableDoubleClick="0"
|
andrewm@0
|
782 focusDiscardsChanges="0" fontname="Default font" fontsize="15"
|
andrewm@0
|
783 bold="0" italic="0" justification="33"/>
|
andrewm@0
|
784 <TEXTBUTTON name="add mapping button" id="a5fd2f0afd2d74b2" memberName="addMappingButton"
|
andrewm@0
|
785 virtualName="" explicitFocusOrder="0" pos="440 144 104 20" buttonText="Add Mapping..."
|
andrewm@0
|
786 connectedEdges="0" needsCallback="1" radioGroupId="0"/>
|
andrewm@5
|
787 <LABEL name="new label" id="dbad09f5c5953d5f" memberName="label9" virtualName=""
|
andrewm@5
|
788 explicitFocusOrder="0" pos="24 68 104 24" edTextCol="ff000000"
|
andrewm@5
|
789 edBkgCol="0" labelText="Pitchwheel range:" editableSingleClick="0"
|
andrewm@5
|
790 editableDoubleClick="0" focusDiscardsChanges="0" fontname="Default font"
|
andrewm@5
|
791 fontsize="15" bold="0" italic="0" justification="33"/>
|
andrewm@5
|
792 <TEXTEDITOR name="pitch wheel range editor" id="593d42c6501420c1" memberName="pitchWheelRangeEditor"
|
andrewm@5
|
793 virtualName="" explicitFocusOrder="0" pos="128 68 48 24" initialText=""
|
andrewm@5
|
794 multiline="0" retKeyStartsLine="0" readonly="0" scrollbars="1"
|
andrewm@5
|
795 caret="1" popupmenu="1"/>
|
andrewm@5
|
796 <TEXTBUTTON name="keyboard controllers button" id="a1ebab19a3375b93" memberName="keyboardControllersButton"
|
andrewm@8
|
797 virtualName="" explicitFocusOrder="0" pos="24 100 152 20" buttonText=" Controllers..."
|
andrewm@5
|
798 connectedEdges="0" needsCallback="1" radioGroupId="0"/>
|
andrewm@0
|
799 </JUCER_COMPONENT>
|
andrewm@0
|
800
|
andrewm@0
|
801 END_JUCER_METADATA
|
andrewm@0
|
802 */
|
andrewm@0
|
803 #endif
|
andrewm@0
|
804
|
andrewm@0
|
805
|
andrewm@0
|
806 //[EndFile] You can add extra defines here...
|
andrewm@50
|
807 #endif // TOUCHKEYS_NO_GUI
|
andrewm@0
|
808 //[/EndFile]
|