48
controlTypeComboBox->addItem(tr("Control7"), MusECore::MidiController::Controller7);
49
controlTypeComboBox->addItem(tr("Control14"), MusECore::MidiController::Controller14);
50
controlTypeComboBox->addItem(tr("RPN"), MusECore::MidiController::RPN);
51
controlTypeComboBox->addItem(tr("NPRN"), MusECore::MidiController::NRPN);
52
controlTypeComboBox->addItem(tr("RPN14"), MusECore::MidiController::RPN14);
53
controlTypeComboBox->addItem(tr("NRPN14"), MusECore::MidiController::NRPN14);
54
controlTypeComboBox->addItem(tr("Pitch"), MusECore::MidiController::Pitch);
55
controlTypeComboBox->addItem(tr("Program"), MusECore::MidiController::Program);
56
//controlTypeComboBox->addItem(tr("PolyAftertouch"), MusECore::MidiController::PolyAftertouch); // Not supported yet. Need a way to select pitch.
57
controlTypeComboBox->addItem(tr("Aftertouch"), MusECore::MidiController::Aftertouch);
58
controlTypeComboBox->setCurrentIndex(0);
89
101
if(MusEGlobal::midiLearnCtrl != -1)
91
int type = MusECore::midiControllerType(MusEGlobal::midiLearnCtrl);
92
if(type < controlTypeComboBox->count() && type != controlTypeComboBox->currentIndex())
103
MusECore::MidiController::ControllerType type = MusECore::midiControllerType(MusEGlobal::midiLearnCtrl);
104
int idx = controlTypeComboBox->findData(type);
105
if(idx != -1 && idx != controlTypeComboBox->currentIndex())
94
107
controlTypeComboBox->blockSignals(true);
95
controlTypeComboBox->setCurrentIndex(type);
108
controlTypeComboBox->setCurrentIndex(idx);
96
109
controlTypeComboBox->blockSignals(false);
99
112
int hv = (MusEGlobal::midiLearnCtrl >> 8) & 0xff;
100
113
int lv = MusEGlobal::midiLearnCtrl & 0xff;
101
if(type == MusECore::MidiController::Program || type == MusECore::MidiController::Pitch)
103
ctrlHiSpinBox->setEnabled(false);
104
ctrlLoSpinBox->setEnabled(false);
105
ctrlHiSpinBox->blockSignals(true);
106
ctrlLoSpinBox->blockSignals(true);
107
ctrlHiSpinBox->setValue(0);
108
ctrlLoSpinBox->setValue(0);
109
ctrlHiSpinBox->blockSignals(false);
110
ctrlLoSpinBox->blockSignals(false);
112
else if(type == MusECore::MidiController::Controller7)
114
ctrlHiSpinBox->setEnabled(false);
115
ctrlLoSpinBox->setEnabled(true);
117
ctrlHiSpinBox->blockSignals(true);
118
ctrlHiSpinBox->setValue(0);
119
ctrlHiSpinBox->blockSignals(false);
121
if(lv != ctrlLoSpinBox->value())
123
ctrlLoSpinBox->blockSignals(true);
124
ctrlLoSpinBox->setValue(lv);
125
ctrlLoSpinBox->blockSignals(false);
130
ctrlHiSpinBox->setEnabled(true);
131
ctrlLoSpinBox->setEnabled(true);
132
if(hv != ctrlHiSpinBox->value())
134
ctrlHiSpinBox->blockSignals(true);
135
ctrlHiSpinBox->setValue(hv);
136
ctrlHiSpinBox->blockSignals(false);
138
if(lv != ctrlLoSpinBox->value())
140
ctrlLoSpinBox->blockSignals(true);
141
ctrlLoSpinBox->setValue(lv);
142
ctrlLoSpinBox->blockSignals(false);
117
case MusECore::MidiController::Program:
118
case MusECore::MidiController::Pitch:
119
case MusECore::MidiController::PolyAftertouch: // Unsupported yet. Need a way to select pitch.
120
case MusECore::MidiController::Aftertouch:
121
ctrlHiSpinBox->setEnabled(false);
122
ctrlLoSpinBox->setEnabled(false);
123
ctrlHiSpinBox->blockSignals(true);
124
ctrlLoSpinBox->blockSignals(true);
125
ctrlHiSpinBox->setValue(0);
126
ctrlLoSpinBox->setValue(0);
127
ctrlHiSpinBox->blockSignals(false);
128
ctrlLoSpinBox->blockSignals(false);
130
case MusECore::MidiController::Controller7:
131
ctrlHiSpinBox->setEnabled(false);
132
ctrlLoSpinBox->setEnabled(true);
134
ctrlHiSpinBox->blockSignals(true);
135
ctrlHiSpinBox->setValue(0);
136
ctrlHiSpinBox->blockSignals(false);
138
if(lv != ctrlLoSpinBox->value())
140
ctrlLoSpinBox->blockSignals(true);
141
ctrlLoSpinBox->setValue(lv);
142
ctrlLoSpinBox->blockSignals(false);
145
case MusECore::MidiController::Controller14:
146
case MusECore::MidiController::RPN:
147
case MusECore::MidiController::RPN14:
148
case MusECore::MidiController::NRPN:
149
case MusECore::MidiController::NRPN14:
150
ctrlHiSpinBox->setEnabled(true);
151
ctrlLoSpinBox->setEnabled(true);
152
if(hv != ctrlHiSpinBox->value())
154
ctrlHiSpinBox->blockSignals(true);
155
ctrlHiSpinBox->setValue(hv);
156
ctrlHiSpinBox->blockSignals(false);
158
if(lv != ctrlLoSpinBox->value())
160
ctrlLoSpinBox->blockSignals(true);
161
ctrlLoSpinBox->setValue(lv);
162
ctrlLoSpinBox->blockSignals(false);
166
printf("FIXME: MidiAudioControl::heartbeat: Unknown control type: %d\n", type);
146
170
_ctrl = MusECore::midiCtrlTerms2Number(type, (ctrlHiSpinBox->value() << 8) + ctrlLoSpinBox->value());
185
209
void MidiAudioControl::updateCtrlBoxes()
187
int idx = controlTypeComboBox->currentIndex();
211
if(controlTypeComboBox->currentIndex() == -1)
191
if(idx == MusECore::MidiController::Program || idx == MusECore::MidiController::Pitch)
193
ctrlHiSpinBox->setEnabled(false);
194
ctrlLoSpinBox->setEnabled(false);
195
ctrlHiSpinBox->blockSignals(true);
196
ctrlLoSpinBox->blockSignals(true);
197
ctrlHiSpinBox->setValue(0);
198
ctrlLoSpinBox->setValue(0);
199
ctrlHiSpinBox->blockSignals(false);
200
ctrlLoSpinBox->blockSignals(false);
202
else if(idx == MusECore::MidiController::Controller7)
204
ctrlHiSpinBox->setEnabled(false);
205
ctrlLoSpinBox->setEnabled(true);
213
MusECore::MidiController::ControllerType t = (MusECore::MidiController::ControllerType)controlTypeComboBox->itemData(controlTypeComboBox->currentIndex()).toInt();
207
ctrlHiSpinBox->blockSignals(true);
208
ctrlHiSpinBox->setValue(0);
209
ctrlHiSpinBox->blockSignals(false);
217
case MusECore::MidiController::Program:
218
case MusECore::MidiController::Pitch:
219
case MusECore::MidiController::PolyAftertouch: // Unsupported yet. Need a way to select pitch.
220
case MusECore::MidiController::Aftertouch:
221
ctrlHiSpinBox->setEnabled(false);
222
ctrlLoSpinBox->setEnabled(false);
223
ctrlHiSpinBox->blockSignals(true);
224
ctrlLoSpinBox->blockSignals(true);
225
ctrlHiSpinBox->setValue(0);
226
ctrlLoSpinBox->setValue(0);
227
ctrlHiSpinBox->blockSignals(false);
228
ctrlLoSpinBox->blockSignals(false);
230
case MusECore::MidiController::Controller7:
231
ctrlHiSpinBox->setEnabled(false);
232
ctrlLoSpinBox->setEnabled(true);
233
ctrlHiSpinBox->blockSignals(true);
234
ctrlHiSpinBox->setValue(0);
235
ctrlHiSpinBox->blockSignals(false);
237
case MusECore::MidiController::Controller14:
238
case MusECore::MidiController::RPN:
239
case MusECore::MidiController::RPN14:
240
case MusECore::MidiController::NRPN:
241
case MusECore::MidiController::NRPN14:
242
ctrlHiSpinBox->setEnabled(true);
243
ctrlLoSpinBox->setEnabled(true);
246
printf("FIXME: MidiAudioControl::updateCtrlBoxes: Unknown control type: %d\n", t);
213
ctrlHiSpinBox->setEnabled(true);
214
ctrlLoSpinBox->setEnabled(true);
218
251
void MidiAudioControl::ctrlTypeChanged(int idx)
223
256
updateCtrlBoxes();
225
258
_ctrl = (ctrlHiSpinBox->value() << 8) + ctrlLoSpinBox->value();
226
_ctrl = MusECore::midiCtrlTerms2Number(idx, _ctrl);
259
_ctrl = MusECore::midiCtrlTerms2Number((MusECore::MidiController::ControllerType)controlTypeComboBox->itemData(idx).toInt(), _ctrl);
282
315
channelSpinBox->blockSignals(false);
284
317
int type = MusECore::midiControllerType(_ctrl);
285
if(type < controlTypeComboBox->count())
318
int idx = controlTypeComboBox->findData(type);
319
if(idx != -1 && idx != controlTypeComboBox->currentIndex())
287
321
controlTypeComboBox->blockSignals(true);
288
controlTypeComboBox->setCurrentIndex(type);
322
controlTypeComboBox->setCurrentIndex(idx);
289
323
controlTypeComboBox->blockSignals(false);
292
326
int hv = (_ctrl >> 8) & 0xff;
293
327
int lv = _ctrl & 0xff;
294
if(type == MusECore::MidiController::Program || type == MusECore::MidiController::Pitch)
296
ctrlHiSpinBox->setEnabled(false);
297
ctrlLoSpinBox->setEnabled(false);
298
ctrlHiSpinBox->blockSignals(true);
299
ctrlLoSpinBox->blockSignals(true);
300
ctrlHiSpinBox->setValue(0);
301
ctrlLoSpinBox->setValue(0);
302
ctrlHiSpinBox->blockSignals(false);
303
ctrlLoSpinBox->blockSignals(false);
305
else if(type == MusECore::MidiController::Controller7)
307
ctrlHiSpinBox->setEnabled(false);
308
ctrlLoSpinBox->setEnabled(true);
310
ctrlHiSpinBox->blockSignals(true);
311
ctrlHiSpinBox->setValue(0);
312
ctrlHiSpinBox->blockSignals(false);
314
if(lv != ctrlLoSpinBox->value())
316
ctrlLoSpinBox->blockSignals(true);
317
ctrlLoSpinBox->setValue(lv);
318
ctrlLoSpinBox->blockSignals(false);
323
ctrlHiSpinBox->setEnabled(true);
324
ctrlLoSpinBox->setEnabled(true);
325
if(hv != ctrlHiSpinBox->value())
327
ctrlHiSpinBox->blockSignals(true);
328
ctrlHiSpinBox->setValue(hv);
329
ctrlHiSpinBox->blockSignals(false);
331
if(lv != ctrlLoSpinBox->value())
333
ctrlLoSpinBox->blockSignals(true);
334
ctrlLoSpinBox->setValue(lv);
335
ctrlLoSpinBox->blockSignals(false);
331
case MusECore::MidiController::Program:
332
case MusECore::MidiController::Pitch:
333
case MusECore::MidiController::PolyAftertouch: // Unsupported yet. Need a way to select pitch.
334
case MusECore::MidiController::Aftertouch:
335
ctrlHiSpinBox->setEnabled(false);
336
ctrlLoSpinBox->setEnabled(false);
337
ctrlHiSpinBox->blockSignals(true);
338
ctrlLoSpinBox->blockSignals(true);
339
ctrlHiSpinBox->setValue(0);
340
ctrlLoSpinBox->setValue(0);
341
ctrlHiSpinBox->blockSignals(false);
342
ctrlLoSpinBox->blockSignals(false);
344
case MusECore::MidiController::Controller7:
345
ctrlHiSpinBox->setEnabled(false);
346
ctrlLoSpinBox->setEnabled(true);
348
ctrlHiSpinBox->blockSignals(true);
349
ctrlHiSpinBox->setValue(0);
350
ctrlHiSpinBox->blockSignals(false);
352
if(lv != ctrlLoSpinBox->value())
354
ctrlLoSpinBox->blockSignals(true);
355
ctrlLoSpinBox->setValue(lv);
356
ctrlLoSpinBox->blockSignals(false);
359
case MusECore::MidiController::Controller14:
360
case MusECore::MidiController::RPN:
361
case MusECore::MidiController::RPN14:
362
case MusECore::MidiController::NRPN:
363
case MusECore::MidiController::NRPN14:
364
ctrlHiSpinBox->setEnabled(true);
365
ctrlLoSpinBox->setEnabled(true);
366
if(hv != ctrlHiSpinBox->value())
368
ctrlHiSpinBox->blockSignals(true);
369
ctrlHiSpinBox->setValue(hv);
370
ctrlHiSpinBox->blockSignals(false);
372
if(lv != ctrlLoSpinBox->value())
374
ctrlLoSpinBox->blockSignals(true);
375
ctrlLoSpinBox->setValue(lv);
376
ctrlLoSpinBox->blockSignals(false);
380
printf("FIXME: MidiAudioControl::updateCtrlBoxes: Unknown control type: %d\n", type);
385
} // namespace MusEGui