1 //===========================================================================
2 //
3 //    DeicsOnze an emulator of the YAMAHA DX11 synthesizer
4 //
5 //    Version 0.5.5
6 //
7 //    deicsonzegui.cpp
8 //
9 //
10 //  Copyright (c) 2004-2006 Nil Geisweiller
11 //
12 //
13 //
14 // This program is free software; you can redistribute it and/or
15 // modify it under the terms of the GNU General Public License
16 // as published by the Free Software Foundation; either version 2
17 // of the License, or (at your option) any later version.
18 //
19 // This program is distributed in the hope that it will be useful,
20 // but WITHOUT ANY WARRANTY; without even the implied warranty of
21 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22 // GNU General Public License for more details.
23 //
24 // You should have received a copy of the GNU General Public License
25 // along with this program; if not, write to the Free Software
26 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
27 // 02111-1301, USA or point your web browser to http://www.gnu.org.
28 //===========================================================================
29 
30 #include <QDir>
31 #include <QDomDocument>
32 #include <QFileDialog>
33 #include <QMenu>
34 #include <QMessageBox>
35 #include <QMouseEvent>
36 #include <QPainter>
37 
38 #include "muse/midi_consts.h"
39 #include "midictrl_consts.h"
40 
41 #include "common_defs.h"
42 #include "deicsonzegui.h"
43 
44 #include "libsimpleplugin/simpler_plugin.h"
45 #include "libsimpleplugin/simpler_plugingui.h"
46 
47 //#include "plugins/pandelay/pandelaymodel.h"
48 
49 namespace MusEGui {
50 class PluginDialog;
51 }
52 
DeicsOnzeGui(DeicsOnze * deicsOnze)53 DeicsOnzeGui::DeicsOnzeGui(DeicsOnze* deicsOnze)
54     : QDialog(0),
55       MessGui()
56 {
57   setupUi(this);
58   _deicsOnze = deicsOnze;
59   lastDir = QDir::currentPath();
60 
61   _currentChannel = 0;
62 
63   //FX
64   _chorusSuperWidget = NULL;
65   _reverbSuperWidget = NULL;
66 
67   tColor = new TCOLOR;
68   bColor = new BCOLOR;
69   etColor = new ETCOLOR;
70   ebColor = new EBCOLOR;
71   curColor = new QColor(0, 0, 0);
72 
73   pitchEnvelopeGraph = new QFramePitchEnvelope(pitchEnvFrame, this);
74 
75   envelopeGraph[0] = new QFrameEnvelope(envelope1Frame, this, 0);
76   envelopeGraph[1] = new QFrameEnvelope(envelope2Frame, this, 1);
77   envelopeGraph[2] = new QFrameEnvelope(envelope3Frame, this, 2);
78   envelopeGraph[3] = new QFrameEnvelope(envelope4Frame, this, 3);
79 
80   //change/enable channel
81   connect(ChannelCheckBox, SIGNAL(toggled(bool)), this,
82 	  SLOT(setEnabledChannel(bool)));
83   connect(ChannelNumSpinBox, SIGNAL(valueChanged(int)), this,
84 	  SLOT(setChangeChannel(int)));
85   //MasterVolume
86   connect(masterVolKnob, SIGNAL(valueChanged(double, int)),
87 	  this, SLOT(setMasterVolKnob(double)));
88   //Panic
89   connect(panicButton, SIGNAL(pressed()), this, SLOT(setPanic()));
90   //reset Ctrls
91   connect(resCtrlButton, SIGNAL(pressed()), this, SLOT(setResCtrl()));
92   //FX
93   connect(chorusActivCheckBox, SIGNAL(toggled(bool)),
94 	  this, SLOT(setChorusActiv(bool)));
95   connect(chChorusSlider, SIGNAL(valueChanged(int)),
96 	  this, SLOT(setChannelChorus(int)));
97   connect(returnChorusSlider, SIGNAL(valueChanged(int)),
98 	  this, SLOT(setChorusReturn(int)));
99   connect(selectLadspaChorusPushButton, SIGNAL(pressed()),
100 	  this, SLOT(setSelectChorusPlugin()));
101   /*connect(panChorus1Knob, SIGNAL(valueChanged(double, int)),
102     this, SLOT(setPanChorus1(double)));
103   connect(LFOFreqChorus1Knob, SIGNAL(valueChanged(double, int)),
104 	  this, SLOT(setLFOFreqChorus1(double)));
105   connect(depthChorus1Knob, SIGNAL(valueChanged(double, int)),
106 	  this, SLOT(setDepthChorus1(double)));
107   connect(panChorus2Knob, SIGNAL(valueChanged(double, int)),
108 	  this, SLOT(setPanChorus2(double)));
109   connect(LFOFreqChorus2Knob, SIGNAL(valueChanged(double, int)),
110 	  this, SLOT(setLFOFreqChorus2(double)));
111   connect(depthChorus2Knob, SIGNAL(valueChanged(double, int)),
112   this, SLOT(setDepthChorus2(double)));*/
113   connect(reverbActivCheckBox, SIGNAL(toggled(bool)),
114 	  this, SLOT(setReverbActiv(bool)));
115   connect(chReverbSlider, SIGNAL(valueChanged(int)),
116 	  this, SLOT(setChannelReverb(int)));
117   connect(returnReverbSlider, SIGNAL(valueChanged(int)),
118 	  this, SLOT(setReverbReturn(int)));
119   connect(selectLadspaReverbPushButton, SIGNAL(pressed()),
120 	  this, SLOT(setSelectReverbPlugin()));
121   //Quick edit
122   connect(channelVolumeKnob, SIGNAL(valueChanged(double, int)),
123 	  this, SLOT(setChannelVolKnob(double)));
124   connect(channelPanKnob, SIGNAL(valueChanged(double, int)),
125 	  this, SLOT(setChannelPan(double)));
126   connect(brightnessKnob, SIGNAL(valueChanged(double, int)),
127 	  this, SLOT(setBrightnessKnob(double)));
128   connect(modulationKnob, SIGNAL(valueChanged(double, int)),
129 	  this, SLOT(setModulationKnob(double)));
130   connect(detuneKnob, SIGNAL(valueChanged(double, int)),
131 	  this, SLOT(setDetuneKnob(double)));
132   connect(attackKnob, SIGNAL(valueChanged(double, int)),
133 	  this, SLOT(setAttackKnob(double)));
134   connect(releaseKnob, SIGNAL(valueChanged(double, int)),
135 	  this, SLOT(setReleaseKnob(double)));
136   //nbr of voices
137   connect(nbrVoicesSpinBox, SIGNAL(valueChanged(int)),
138 	  this, SLOT(setNbrVoices(int)));
139   //quality
140   connect(qualityComboBox, SIGNAL(activated(const QString&)),
141 	  this, SLOT(setQuality(const QString&)));
142   connect(filterCheckBox, SIGNAL(toggled(bool)),
143 	  this, SLOT(setFilter(bool)));
144   //change font size
145   connect(fontSizeSpinBox, SIGNAL(valueChanged(int)),
146 	  this, SLOT(setFontSize(int)));
147   //load save configuration
148   connect(saveConfPushButton, SIGNAL(pressed()),
149 	  this, SLOT(saveConfiguration()));
150   connect(loadConfPushButton, SIGNAL(pressed()),
151 	  this, SLOT(loadConfiguration()));
152   connect(saveDefaultPushButton, SIGNAL(pressed()),
153 	  this, SLOT(saveDefaultConfiguration()));
154   //load init set
155   connect(initSetCheckBox, SIGNAL(toggled(bool)),
156 	  this, SLOT(setIsInitSet(bool)));
157   connect(initSetPathLineEdit, SIGNAL(textChanged(const QString&)),
158 	  this, SLOT(setInitSetPath(const QString&)));
159   connect(initSetBrowsePushButton, SIGNAL(pressed()),
160 	  this, SLOT(setBrowseInitSetPath()));
161   //load background pix
162   connect(imageCheckBox, SIGNAL(toggled(bool)),
163 	  this, SLOT(setIsBackgroundPix(bool)));
164   connect(imagePathLineEdit, SIGNAL(textChanged(const QString&)),
165 	  this, SLOT(setBackgroundPixPath(const QString&)));
166   connect(imageBrowsePushButton, SIGNAL(pressed()),
167 	  this, SLOT(setBrowseBackgroundPixPath()));
168 
169   //Midi in channel
170   //connect(MidiInChComboBox, SIGNAL(activated(int)),
171   //  this, SLOT(setMidiInCh(int)));
172   //Save mode ratio button
173   connect(minSaveRadioButton, SIGNAL(toggled(bool)),
174 	  this, SLOT(setSaveOnlyUsed(bool)));
175   connect(hugeSaveRadioButton, SIGNAL(toggled(bool)),
176 	  this, SLOT(setSaveOnlyUsedComp(bool)));
177   connect(saveConfigCheckBox, SIGNAL(toggled(bool)),
178 	  this, SLOT(setSaveConfig(bool)));
179   //Colors
180   connect(redSlider, SIGNAL(valueChanged(int)),
181 	  this, SLOT(setRedColor(int)));
182   connect(greenSlider, SIGNAL(valueChanged(int)),
183 	  this, SLOT(setGreenColor(int)));
184   connect(blueSlider, SIGNAL(valueChanged(int)),
185 	  this, SLOT(setBlueColor(int)));
186   connect(colorListBox,
187 	  SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
188 	  this, SLOT(setRGBSliders(QListWidgetItem*)));
189   //PopupMenu Category Subcategory Preset
190   connect(categoryListView,
191 	  SIGNAL(customContextMenuRequested(const QPoint&)),
192 	  this, SLOT(categoryPopupMenu(const QPoint&)));
193   connect(subcategoryListView,
194 	  SIGNAL(customContextMenuRequested(const QPoint&)),
195 	  this, SLOT(subcategoryPopupMenu(const QPoint&)));
196   connect(presetListView,
197 	  SIGNAL(customContextMenuRequested(const QPoint &)),
198 	  this, SLOT(presetPopupMenu(const QPoint &)));
199   //Preset and bank
200   connect(presetLineEdit, SIGNAL(textChanged(const QString&)),
201 	  this, SLOT(setPresetName(const QString&)));
202   connect(subcategoryLineEdit, SIGNAL(textChanged(const QString&)),
203 	  this, SLOT(setSubcategoryName(const QString&)));
204   connect(categoryLineEdit, SIGNAL(textChanged(const QString&)),
205 	  this, SLOT(setCategoryName(const QString&)));
206   connect(hbankSpinBox, SIGNAL(valueChanged(int)),
207 	  this, SLOT(setHBank(int)));
208   connect(lbankSpinBox, SIGNAL(valueChanged(int)),
209 	  this, SLOT(setLBank(int)));
210   connect(progSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setProg(int)));
211   //Global
212   //connect(channelPanSlider, SIGNAL(valueChanged(int)),
213   //this, SLOT(setChannelPan(int)));
214   connect(feedbackSlider, SIGNAL(valueChanged(int)),
215 	  this, SLOT(setFeedback(int)));
216   connect(LFOWaveComboBox, SIGNAL(activated(int)),
217 	  this, SLOT(setLfoWave(int)));
218   connect(LFOSpeedSlider, SIGNAL(valueChanged(int)),
219 	  this, SLOT(setLfoSpeed(int)));
220   connect(LFODelaySlider, SIGNAL(valueChanged(int)),
221 	  this, SLOT(setLfoDelay(int)));
222   connect(PModDepthSlider, SIGNAL(valueChanged(int)),
223 	  this, SLOT(setLfoPModDepth(int)));
224   connect(PModSensSlider, SIGNAL(valueChanged(int)),
225 	  this, SLOT(setLfoPitchSens(int)));
226   connect(AModDepthSlider, SIGNAL(valueChanged(int)),
227 	  this, SLOT(setLfoAModDepth(int)));
228   connect(AModSensSlider, SIGNAL(valueChanged(int)),
229 	  this, SLOT(setLfoAmpSens(int)));
230   connect(transposeSlider, SIGNAL(valueChanged(int)),
231 	  this, SLOT(setTranspose(int)));
232   //connect(channelDetuneSlider, SIGNAL(valueChanged(int)),
233   //  this, SLOT(setChannelDetune(int)));
234   connect(algorithmComboBox, SIGNAL(activated(int)),
235 	  this, SLOT(setAlgorithm(int)));
236   connect(pitchBendRangeSlider, SIGNAL(valueChanged(int)),
237 	  this, SLOT(setPitchBendRange(int)));
238   //Pitch Envelope
239   connect(PL1SpinBox, SIGNAL(valueChanged(int)), this, SLOT(setPL1(int)));
240   connect(PL2SpinBox, SIGNAL(valueChanged(int)), this, SLOT(setPL2(int)));
241   connect(PL3SpinBox, SIGNAL(valueChanged(int)), this, SLOT(setPL3(int)));
242   connect(PR1SpinBox, SIGNAL(valueChanged(int)), this, SLOT(setPR1(int)));
243   connect(PR2SpinBox, SIGNAL(valueChanged(int)), this, SLOT(setPR2(int)));
244   connect(PR3SpinBox, SIGNAL(valueChanged(int)), this, SLOT(setPR3(int)));
245   //Function
246   connect(fcVolumeSpinBox, SIGNAL(valueChanged(int)),
247 	  this, SLOT(setFcVolume(int)));
248   connect(fcPitchSpinBox, SIGNAL(valueChanged(int)),
249 	  this, SLOT(setFcPitch(int)));
250   connect(fcAmplitudeSpinBox, SIGNAL(valueChanged(int)),
251 	  this, SLOT(setFcAmplitude(int)));
252   connect(mwPitchSpinBox, SIGNAL(valueChanged(int)),
253 	  this, SLOT(setMwPitch(int)));
254   connect(mwAmplitudeSpinBox, SIGNAL(valueChanged(int)),
255 	  this, SLOT(setMwAmplitude(int)));
256   connect(bcPitchSpinBox, SIGNAL(valueChanged(int)),
257 	  this, SLOT(setBcPitch(int)));
258   connect(bcAmplitudeSpinBox, SIGNAL(valueChanged(int)),
259 	  this, SLOT(setBcAmplitude(int)));
260   connect(bcPitchBiasSpinBox, SIGNAL(valueChanged(int)),
261 	  this, SLOT(setBcPitchBias(int)));
262   connect(bcEgBiasSpinBox, SIGNAL(valueChanged(int)),
263 	  this, SLOT(setBcEgBias(int)));
264   connect(atPitchSpinBox, SIGNAL(valueChanged(int)),
265 	  this, SLOT(setAtPitch(int)));
266   connect(atAmplitudeSpinBox, SIGNAL(valueChanged(int)),
267 	  this, SLOT(setAtAmplitude(int)));
268   connect(atPitchBiasSpinBox, SIGNAL(valueChanged(int)),
269 	  this, SLOT(setAtPitchBias(int)));
270   connect(atEgBiasSpinBox, SIGNAL(valueChanged(int)),
271 	  this, SLOT(setAtEgBias(int)));
272   //connect(reverbSpinBox, SIGNAL(valueChanged(int)),
273   //  this, SLOT(setReverbRate(int)));
274   connect(polyMonoComboBox, SIGNAL(activated(int)),
275 	  this, SLOT(setPolyMode(int)));
276   connect(PortFingerFullComboBox, SIGNAL(activated(int)),
277 	  this, SLOT(setPortFingerFull(int)));
278   connect(PortamentoTimeSlider, SIGNAL(valueChanged(int)),
279 	  this, SLOT(setPortaTime(int)));
280   //envelope
281   connect(AR1SpinBox, SIGNAL(valueChanged(int)), this, SLOT(setAR1(int)));
282   connect(D1R1SpinBox, SIGNAL(valueChanged(int)), this, SLOT(setD1R1(int)));
283   connect(D1L1SpinBox, SIGNAL(valueChanged(int)), this, SLOT(setD1L1(int)));
284   connect(D2R1SpinBox, SIGNAL(valueChanged(int)), this, SLOT(setD2R1(int)));
285   connect(RR1SpinBox, SIGNAL(valueChanged(int)), this, SLOT(setRR1(int)));
286   connect(AR2SpinBox, SIGNAL(valueChanged(int)), this, SLOT(setAR2(int)));
287   connect(D1R2SpinBox, SIGNAL(valueChanged(int)), this, SLOT(setD1R2(int)));
288   connect(D1L2SpinBox, SIGNAL(valueChanged(int)), this, SLOT(setD1L2(int)));
289   connect(D2R2SpinBox, SIGNAL(valueChanged(int)), this, SLOT(setD2R2(int)));
290   connect(RR2SpinBox, SIGNAL(valueChanged(int)), this, SLOT(setRR2(int)));
291   connect(AR3SpinBox, SIGNAL(valueChanged(int)), this, SLOT(setAR3(int)));
292   connect(D1R3SpinBox, SIGNAL(valueChanged(int)), this, SLOT(setD1R3(int)));
293   connect(D1L3SpinBox, SIGNAL(valueChanged(int)), this, SLOT(setD1L3(int)));
294   connect(D2R3SpinBox, SIGNAL(valueChanged(int)), this, SLOT(setD2R3(int)));
295   connect(RR3SpinBox, SIGNAL(valueChanged(int)), this, SLOT(setRR3(int)));
296   connect(AR4SpinBox, SIGNAL(valueChanged(int)), this, SLOT(setAR4(int)));
297   connect(D1R4SpinBox, SIGNAL(valueChanged(int)), this, SLOT(setD1R4(int)));
298   connect(D1L4SpinBox, SIGNAL(valueChanged(int)), this, SLOT(setD1L4(int)));
299   connect(D2R4SpinBox, SIGNAL(valueChanged(int)), this, SLOT(setD2R4(int)));
300   connect(RR4SpinBox, SIGNAL(valueChanged(int)), this, SLOT(setRR4(int)));
301   //Scaling
302   connect(LS1Slider, SIGNAL(valueChanged(int)), this, SLOT(setLS1(int)));
303   connect(RS1Slider, SIGNAL(valueChanged(int)), this, SLOT(setRS1(int)));
304   connect(LS2Slider, SIGNAL(valueChanged(int)), this, SLOT(setLS2(int)));
305   connect(RS2Slider, SIGNAL(valueChanged(int)), this, SLOT(setRS2(int)));
306   connect(LS3Slider, SIGNAL(valueChanged(int)), this, SLOT(setLS3(int)));
307   connect(RS3Slider, SIGNAL(valueChanged(int)), this, SLOT(setRS3(int)));
308   connect(LS4Slider, SIGNAL(valueChanged(int)), this, SLOT(setLS4(int)));
309   connect(RS4Slider, SIGNAL(valueChanged(int)), this, SLOT(setRS4(int)));
310   //Volume
311   connect(OUT1Slider, SIGNAL(valueChanged(int)), this, SLOT(setVol1(int)));
312   connect(OUT2Slider, SIGNAL(valueChanged(int)), this, SLOT(setVol2(int)));
313   connect(OUT3Slider, SIGNAL(valueChanged(int)), this, SLOT(setVol3(int)));
314   connect(OUT4Slider, SIGNAL(valueChanged(int)), this, SLOT(setVol4(int)));
315   //Ratio and Frequency
316   connect(CoarseRatio1SpinBox, SIGNAL(valueChanged(int)),
317 	  this, SLOT(setCoarseRatio1(int)));
318   connect(FineRatio1SpinBox, SIGNAL(valueChanged(int)),
319 	  this, SLOT(setFineRatio1(int)));
320   connect(Freq1SpinBox, SIGNAL(valueChanged(int)),
321 	  this, SLOT(setFreq1(int)));
322   connect(Fix1CheckBox, SIGNAL(toggled(bool)), this, SLOT(setFix1(bool)));
323   connect(CoarseRatio2SpinBox, SIGNAL(valueChanged(int)),
324 	  this, SLOT(setCoarseRatio2(int)));
325   connect(FineRatio2SpinBox, SIGNAL(valueChanged(int)),
326 	  this, SLOT(setFineRatio2(int)));
327   connect(Freq2SpinBox, SIGNAL(valueChanged(int)),
328 	  this, SLOT(setFreq2(int)));
329   connect(Fix2CheckBox, SIGNAL(toggled(bool)), this, SLOT(setFix2(bool)));
330   connect(CoarseRatio3SpinBox, SIGNAL(valueChanged(int)),
331 	  this, SLOT(setCoarseRatio3(int)));
332   connect(FineRatio3SpinBox, SIGNAL(valueChanged(int)),
333 	  this, SLOT(setFineRatio3(int)));
334   connect(Freq3SpinBox, SIGNAL(valueChanged(int)),
335 	  this, SLOT(setFreq3(int)));
336   connect(Fix3CheckBox, SIGNAL(toggled(bool)), this, SLOT(setFix3(bool)));
337   connect(CoarseRatio4SpinBox, SIGNAL(valueChanged(int)),
338 	  this, SLOT(setCoarseRatio4(int)));
339   connect(FineRatio4SpinBox, SIGNAL(valueChanged(int)),
340 	  this, SLOT(setFineRatio4(int)));
341   connect(Freq4SpinBox, SIGNAL(valueChanged(int)),
342 	  this, SLOT(setFreq4(int)));
343   connect(Fix4CheckBox, SIGNAL(toggled(bool)), this, SLOT(setFix4(bool)));
344   //Sensitivity
345   connect(AME1CheckBox, SIGNAL(toggled(bool)), this, SLOT(setAME1(bool)));
346   connect(EBS1Slider, SIGNAL(valueChanged(int)), this, SLOT(setEBS1(int)));
347   connect(KVS1Slider, SIGNAL(valueChanged(int)), this, SLOT(setKVS1(int)));
348   connect(AME2CheckBox, SIGNAL(toggled(bool)), this, SLOT(setAME2(bool)));
349   connect(EBS2Slider, SIGNAL(valueChanged(int)), this, SLOT(setEBS2(int)));
350   connect(KVS2Slider, SIGNAL(valueChanged(int)), this, SLOT(setKVS2(int)));
351   connect(AME3CheckBox, SIGNAL(toggled(bool)), this, SLOT(setAME3(bool)));
352   connect(EBS3Slider, SIGNAL(valueChanged(int)), this, SLOT(setEBS3(int)));
353   connect(KVS3Slider, SIGNAL(valueChanged(int)), this, SLOT(setKVS3(int)));
354   connect(AME4CheckBox, SIGNAL(toggled(bool)), this, SLOT(setAME4(bool)));
355   connect(EBS4Slider, SIGNAL(valueChanged(int)), this, SLOT(setEBS4(int)));
356   connect(KVS4Slider, SIGNAL(valueChanged(int)), this, SLOT(setKVS4(int)));
357   //detune
358   connect(DET1Slider, SIGNAL(valueChanged(int)), this, SLOT(setDET1(int)));
359   connect(DET2Slider, SIGNAL(valueChanged(int)), this, SLOT(setDET2(int)));
360   connect(DET3Slider, SIGNAL(valueChanged(int)), this, SLOT(setDET3(int)));
361   connect(DET4Slider, SIGNAL(valueChanged(int)), this, SLOT(setDET4(int)));
362   //WaveForm
363   connect(WaveForm1ComboBox, SIGNAL(activated(int)),
364 	  this, SLOT(setWaveForm1(int)));
365   connect(WaveForm2ComboBox, SIGNAL(activated(int)),
366 	  this, SLOT(setWaveForm2(int)));
367   connect(WaveForm3ComboBox, SIGNAL(activated(int)),
368 	  this, SLOT(setWaveForm3(int)));
369   connect(WaveForm4ComboBox, SIGNAL(activated(int)),
370 	  this, SLOT(setWaveForm4(int)));
371   //PanDelay
372   connect(delayActivCheckBox, SIGNAL(toggled(bool)), this,
373 	  SLOT(setActivDelay(bool)));
374   connect(delayReturnSlider, SIGNAL(valueChanged(int)), this,
375 	  SLOT(setDelayReturn(int)));
376   connect(chDelaySlider, SIGNAL(valueChanged(int)), this,
377 	  SLOT(setChannelDelay(int)));
378   connect(delayBPMFloatentry, SIGNAL(valueChanged(double, int)), this,
379 	  SLOT(setDelayBPM(double)));
380   connect(delayBPMKnob, SIGNAL(valueChanged(double, int)), this,
381 	  SLOT(setDelayBPM(double)));
382   connect(delayBeatRatioFloatentry, SIGNAL(valueChanged(double, int)), this,
383 	  SLOT(setDelayBeatRatio(double)));
384   connect(delayBeatRatioKnob, SIGNAL(valueChanged(double, int)), this,
385 	  SLOT(setDelayBeatRatio(double)));
386   connect(delayFeedbackFloatentry, SIGNAL(valueChanged(double, int)), this,
387 	  SLOT(setDelayFeedback(double)));
388   connect(delayFeedbackKnob, SIGNAL(valueChanged(double, int)), this,
389 	  SLOT(setDelayFeedback(double)));
390   connect(delayPanLFOFreqFloatentry, SIGNAL(valueChanged(double, int)), this,
391 	  SLOT(setDelayPanLFOFreq(double)));
392   connect(delayPanLFOFreqKnob, SIGNAL(valueChanged(double, int)), this,
393 	  SLOT(setDelayPanLFOFreq(double)));
394   delayPanLFOFreqKnob->setMinLogValue(0.1);
395   delayPanLFOFreqKnob->setMaxLogValue(10.0);
396   connect(delayPanLFODepthFloatentry, SIGNAL(valueChanged(double, int)), this,
397 	  SLOT(setDelayPanLFODepth(double)));
398   connect(delayPanLFODepthKnob, SIGNAL(valueChanged(double, int)), this,
399 	  SLOT(setDelayPanLFODepth(double)));
400   //category subcategory preset
401   connect(categoryListView,
402 	  SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),
403 	  this, SLOT(setCategory(QTreeWidgetItem*)));
404   connect(categoryListView, SIGNAL(itemClicked(QTreeWidgetItem*,int)),
405 	  this, SLOT(setCategory(QTreeWidgetItem*)));
406   connect(subcategoryListView,
407 	  SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),
408 	  this, SLOT(setSubcategory(QTreeWidgetItem*)));
409   connect(subcategoryListView, SIGNAL(itemClicked(QTreeWidgetItem*,int)),
410 	  this, SLOT(setSubcategory(QTreeWidgetItem*)));
411   connect(presetListView,
412 	  SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),
413 	  this, SLOT(setPreset(QTreeWidgetItem*)));
414   connect(presetListView, SIGNAL(itemClicked(QTreeWidgetItem*,int)),
415 	  this, SLOT(setPreset(QTreeWidgetItem*)));
416 
417   connect(this->getGuiSignal(),SIGNAL(wakeup()),this,SLOT(readMessage()));
418 
419   updateInitSetPath(DEI_sharePath + QString("/presets/deicsonze/SutulaBank.dei"));    // Tim.
420   updateBackgroundPixPath(DEI_sharePath + QString("/wallpapers/paper2.jpg"));    // Tim.
421   updateBackgroundPixCheckBox(false);
422 
423   setTextColor(reinterpret_cast<const QColor &>(*tColor));
424   setBackgroundColor(reinterpret_cast<const QColor &>(*bColor));
425   setEditTextColor(reinterpret_cast<const QColor &>(*etColor));
426   setEditBackgroundColor(reinterpret_cast<const QColor &>(*ebColor));
427 
428   //select the first item in the color list
429   colorListBox->setCurrentItem(colorListBox->item(0));
430 
431   //color the colorFrame with the color of the text
432   QPalette p = colorFrame->palette();
433   p.setColor(QPalette::Window, (reinterpret_cast<const QColor &>(*tColor)));
434   colorFrame->setPalette(p);
435 
436   //update maaster volume
437   //updateMasterVolume(INITMASTERVOL);
438   //update Quick edit
439   updateQuickEdit();
440 
441   //updatePreset();
442   _enabledPreset = true;
443   setEnabledPreset(false);
444 
445 
446 }
447 
448 //-----------------------------------------------------------
449 // setEnabledChannel
450 //-----------------------------------------------------------
setEnabledChannel(bool e)451 void DeicsOnzeGui::setEnabledChannel(bool e) {
452   sendController(_currentChannel, CTRL_CHANNELENABLE, (int)e);
453   updateEnabledChannel(e);
454 }
455 //-----------------------------------------------------------
456 // setUpdateEnabledChannelCheckBox
457 //-----------------------------------------------------------
updateChannelCheckBox(bool b)458 void DeicsOnzeGui::updateChannelCheckBox(bool b) {
459   ChannelCheckBox->blockSignals(true);
460   ChannelCheckBox->setChecked(b);
461   ChannelCheckBox->blockSignals(false);
462 }
463 
464 //-----------------------------------------------------------
465 // setChangeChannel
466 //-----------------------------------------------------------
setChangeChannel(int c)467 void DeicsOnzeGui::setChangeChannel(int c) {
468   _currentChannel = c-1;
469   updateChannelEnable(_deicsOnze->getChannelEnable(_currentChannel));
470   updateNbrVoices(_deicsOnze->getNbrVoices(_currentChannel));
471   //update quick edit
472   updateQuickEdit();
473   //update preset
474   int p, l, h;
475   _deicsOnze->_preset[_currentChannel]->getHBankLBankProg(&h, &l, &p);
476   updateSelectPreset(h, l, p);
477   updatePreset();
478 }
479 //-----------------------------------------------------------
480 // setPanic
481 //-----------------------------------------------------------
setPanic()482 void DeicsOnzeGui::setPanic() {
483   unsigned char message[3];
484   message[0]=MUSE_SYNTH_SYSEX_MFG_ID;
485   message[1]=DEICSONZE_UNIQUE_ID;
486   message[2]=SYSEX_PANIC;
487   sendSysex(message, 3);
488 }
489 
490 //-----------------------------------------------------------
491 // setResCtrl
492 //-----------------------------------------------------------
setResCtrl()493 void DeicsOnzeGui::setResCtrl() {
494   //Detune
495   updateChannelDetune(0);
496   sendController(_currentChannel, CTRL_CHANNELDETUNE, 0);
497   //Brightness
498   updateBrightness(MIDFINEBRIGHTNESS);
499   sendController(_currentChannel, CTRL_FINEBRIGHTNESS, MIDFINEBRIGHTNESS);
500   //Attack
501   updateAttack(MIDATTACK);
502   sendController(_currentChannel, MusECore::CTRL_ATTACK_TIME, MIDATTACK);
503   //Release
504   updateRelease(MIDRELEASE);
505   sendController(_currentChannel, MusECore::CTRL_RELEASE_TIME, MIDRELEASE);
506 }
507 
508 //-----------------------------------------------------------
509 // setNbrVoices
510 //-----------------------------------------------------------
setNbrVoices(int nv)511 void DeicsOnzeGui::setNbrVoices(int nv) {
512   sendController(_currentChannel, CTRL_NBRVOICES, nv);
513 }
514 
515 //----------------------------------------------------------
516 // setMidiInCh
517 //----------------------------------------------------------
518 //void DeicsOnzeGui::setMidiInCh(int m) {
519 //  unsigned char message[4];
520 //  message[0]=MUSE_SYNTH_SYSEX_MFG_ID;
521 //  message[1]=DEICSONZE_UNIQUE_ID;
522 //  message[2]=SYSEX_CHANNELNUM;
523 //  message[3]=(unsigned char)(m-1);
524 //  sendSysex(message, 4);
525 //}
526 
527 //-----------------------------------------------------------
528 // saveConfiguration
529 //-----------------------------------------------------------
saveConfiguration()530 void DeicsOnzeGui::saveConfiguration() {
531   QString filename =
532     QFileDialog::getSaveFileName(
533 				 this,
534 				 tr("Save configuration"),
535 				 lastDir,
536 				 QString("*.dco"));
537   if(!filename.isEmpty()) {
538     QFileInfo fi(filename);
539     lastDir = fi.path();
540     if(!filename.endsWith(".dco")) filename+=".dco";
541     QFile f(filename);
542     f.open(QIODevice::WriteOnly);
543     AL::Xml* xml = new AL::Xml(&f);
544     xml->header();
545     _deicsOnze->writeConfiguration(xml);
546     f.close();
547   }
548 }
549 
550 //-----------------------------------------------------------
551 // saveDefaultConfiguration
552 //-----------------------------------------------------------
saveDefaultConfiguration()553 void DeicsOnzeGui::saveDefaultConfiguration() {
554   QString filename = DEI_hostConfigPath + QString("/" DEICSONZESTR ".dco");
555   if(!filename.isEmpty()) {
556     QFile f(filename);
557     f.open(QIODevice::WriteOnly);
558 
559     AL::Xml* xml = new AL::Xml(&f);
560     xml->header();
561     _deicsOnze->writeConfiguration(xml);
562     f.close();
563   }
564 }
565 
566 //-----------------------------------------------------------
567 // loadConfiguration
568 //-----------------------------------------------------------
loadConfiguration(QString fileName)569 void DeicsOnzeGui::loadConfiguration(QString fileName) {
570   // read the XML file and create DOM tree
571   if(!fileName.isEmpty()) {
572     QFile confFile(fileName);
573     if(!confFile.open(QIODevice::ReadOnly)) {
574       QMessageBox::critical(0,
575 			    tr("Critical Error"),
576 			    tr("Cannot open file %1").arg(fileName));
577       return;
578     }
579     QDomDocument domTree;
580     if (!domTree.setContent(&confFile )) {
581       QMessageBox::critical
582 	(0, tr("Critical Error"),
583 	 tr("Parsing error for file %1").arg(fileName));
584       confFile.close();
585       return;
586     }
587 
588     confFile.close();
589 
590     QDomNode node = domTree.documentElement();
591     while (!node.isNull()) {
592       QDomElement e = node.toElement();
593       if (e.isNull())
594 	continue;
595       if (e.tagName() == DEICSONZECONFIGURATIONSTR) {
596 	QString version = e.attribute(QString("version"));
597 	if (version == "1.0") {
598 	  _deicsOnze->readConfiguration(node.firstChild());
599 	}
600 	else printf("unsupported *.dco file version %s\n",
601 		    version.toLatin1().constData());
602       }
603       else printf("DeicsOnze: %s not supported\n",
604 		  e.tagName().toLatin1().constData());
605       node = node.nextSibling();
606     }
607   }
608 }
609 
610 //-----------------------------------------------------------
611 // loadConfiguration
612 //-----------------------------------------------------------
loadConfiguration()613 void DeicsOnzeGui::loadConfiguration() {
614   QString fileName =
615     QFileDialog::getOpenFileName(
616 				 this,
617 				 tr("Load category dialog"),
618 				 lastDir,
619 				 QString("*.dco"));
620   QFileInfo fi(fileName);
621   lastDir = fi.path();
622   loadConfiguration(fileName);
623 }
624 
625 //-----------------------------------------------------------
626 // setQuality
627 //-----------------------------------------------------------
setQuality(const QString & q)628 void DeicsOnzeGui::setQuality(const QString& q) {
629   unsigned char message[4];
630   message[0]=MUSE_SYNTH_SYSEX_MFG_ID;
631   message[1]=DEICSONZE_UNIQUE_ID;
632   message[2]=SYSEX_QUALITY;
633   message[3]=(unsigned char)(q=="High"?
634 			     high:(q=="Middle"?
635 				   middle:(q=="Low"?low:ultralow)));
636   sendSysex(message, 4);
637 }
638 //-----------------------------------------------------------
639 // setFilter
640 //-----------------------------------------------------------
setFilter(bool f)641 void DeicsOnzeGui::setFilter(bool f) {
642   unsigned char message[4];
643   message[0]=MUSE_SYNTH_SYSEX_MFG_ID;
644   message[1]=DEICSONZE_UNIQUE_ID;
645   message[2]=SYSEX_FILTER;
646   message[3]=(unsigned char)f;
647   sendSysex(message, 4);
648 }
649 //-----------------------------------------------------------
650 // setFontSize
651 //-----------------------------------------------------------
setFontSize(int fs)652 void DeicsOnzeGui::setFontSize(int fs) {
653   applyFontSize(fs);
654   unsigned char message[4];
655   message[0]=MUSE_SYNTH_SYSEX_MFG_ID;
656   message[1]=DEICSONZE_UNIQUE_ID;
657   message[2]=SYSEX_FONTSIZE;
658   message[3]=(unsigned char)fs;
659   sendSysex(message, 4);
660 }
661 //-----------------------------------------------------------
662 // setSaveOnlyUsed
663 //-----------------------------------------------------------
setSaveOnlyUsed(bool sou)664 void DeicsOnzeGui::setSaveOnlyUsed(bool sou) {
665   unsigned char message[4];
666   message[0]=MUSE_SYNTH_SYSEX_MFG_ID;
667   message[1]=DEICSONZE_UNIQUE_ID;
668   message[2]=SYSEX_SAVEONLYUSED;
669   message[3]=(unsigned char)sou;
670   sendSysex(message, 4);
671   updateSaveOnlyUsed(sou);
672 }
setSaveOnlyUsedComp(bool souc)673 void DeicsOnzeGui::setSaveOnlyUsedComp(bool souc) {
674   unsigned char message[4];
675   message[0]=MUSE_SYNTH_SYSEX_MFG_ID;
676   message[1]=DEICSONZE_UNIQUE_ID;
677   message[2]=SYSEX_SAVEONLYUSED;
678   message[3]=(unsigned char)!souc;
679   sendSysex(message, 4);
680   updateSaveOnlyUsed(!souc);
681 }
682 //-----------------------------------------------------------
683 // setSaveConfig
684 //-----------------------------------------------------------
setSaveConfig(bool ssc)685 void DeicsOnzeGui::setSaveConfig(bool ssc) {
686   unsigned char message[4];
687   message[0]=MUSE_SYNTH_SYSEX_MFG_ID;
688   message[1]=DEICSONZE_UNIQUE_ID;
689   message[2]=SYSEX_SAVECONFIG;
690   message[3]=(unsigned char)ssc;
691   sendSysex(message, 4);
692 }
693 //-----------------------------------------------------------
694 // setColor
695 //-----------------------------------------------------------
setRedColor(int r)696 void DeicsOnzeGui::setRedColor(int r) {
697   QListWidgetItem* i=colorListBox->selectedItems().at(0);
698   if(i){
699     curColor->setRgb(r, curColor->green(), curColor->blue());
700     if(i->text()==QString("Text")) {
701       tColor->setRgb(curColor->rgb());
702       setTextColor(reinterpret_cast<const QColor &>(*curColor));
703     }
704     else if(i->text()==QString("Background")) {
705       bColor->setRgb(curColor->rgb());
706       setBackgroundColor(reinterpret_cast<const QColor &>(*curColor));
707     }
708     else if(i->text()==QString("Edit Text")) {
709       etColor->setRgb(curColor->rgb());
710       setEditTextColor(reinterpret_cast<const QColor &>(*curColor));
711     }
712     else if(i->text()==QString("Edit Background")) {
713       ebColor->setRgb(curColor->rgb());
714       setEditBackgroundColor(reinterpret_cast<const QColor &>(*curColor));
715     }
716     QPalette p = colorFrame->palette();
717     p.setColor(QPalette::Window,
718 	       (reinterpret_cast<const QColor &>(*curColor)));
719     colorFrame->setPalette(p);
720   }
721 }
setGreenColor(int g)722 void DeicsOnzeGui::setGreenColor(int g) {
723     QListWidgetItem* i=colorListBox->selectedItems().at(0);
724     if(i) {
725 	curColor->setRgb(curColor->red(), g, curColor->blue());
726 	if(i->text()==QString("Text")) {
727 	    tColor->setRgb(curColor->rgb());
728 	    setTextColor(reinterpret_cast<const QColor &>(*curColor));
729 	}
730 	else if(i->text()==QString("Background")) {
731 	    bColor->setRgb(curColor->rgb());
732 	    setBackgroundColor(reinterpret_cast<const QColor &>(*curColor));
733 	}
734 	else if(i->text()==QString("Edit Text")) {
735 	    etColor->setRgb(curColor->rgb());
736 	    setEditTextColor(reinterpret_cast<const QColor &>(*curColor));
737 	}
738 	else if(i->text()==QString("Edit Background")) {
739 	    ebColor->setRgb(curColor->rgb());
740 	    setEditBackgroundColor(reinterpret_cast<const QColor &>(*curColor));
741 	}
742 	QPalette p = colorFrame->palette();
743 	p.setColor(QPalette::Window, (reinterpret_cast<const QColor &>(*curColor)));
744 	colorFrame->setPalette(p);
745     }
746 }
setBlueColor(int b)747 void DeicsOnzeGui::setBlueColor(int b) {
748     QListWidgetItem* i=colorListBox->selectedItems().at(0);
749     if(i) {
750 	curColor->setRgb(curColor->red(), curColor->green(), b);
751 	if(i->text()==QString("Text")) {
752 	    tColor->setRgb(curColor->rgb());
753 	    setTextColor(reinterpret_cast<const QColor &>(*curColor));
754 	}
755 	else if(i->text()==QString("Background")) {
756 	    bColor->setRgb(curColor->rgb());
757 	    setBackgroundColor(reinterpret_cast<const QColor &>(*curColor));
758 	}
759 	else if(i->text()==QString("Edit Text")) {
760 	    etColor->setRgb(curColor->rgb());
761 	    setEditTextColor(reinterpret_cast<const QColor &>(*curColor));
762 	}
763 	else if(i->text()==QString("Edit Background")) {
764 	    ebColor->setRgb(curColor->rgb());
765 	    setEditBackgroundColor(reinterpret_cast<const QColor &>(*curColor));
766 	}
767 	QPalette p = colorFrame->palette();
768 	p.setColor(QPalette::Window, (reinterpret_cast<const QColor &>(*curColor)));
769 	colorFrame->setPalette(p);
770     }
771 }
setRGBSliders(QListWidgetItem * i)772 void DeicsOnzeGui::setRGBSliders(QListWidgetItem* i) {
773   if(i->text()==QString("Text"))
774     curColor->setRgb(tColor->red(), tColor->green(), tColor->blue());
775   else if(i->text()==QString("Background"))
776     curColor->setRgb(bColor->red(), bColor->green(), bColor->blue());
777   else if(i->text()==QString("Edit Text"))
778     curColor->setRgb(etColor->red(), etColor->green(), etColor->blue());
779   else if(i->text()==QString("Edit Background"))
780     curColor->setRgb(ebColor->red(), ebColor->green(), ebColor->blue());
781 
782   redSlider->blockSignals(true);
783   redSlider->setValue(curColor->red());
784   redSlider->blockSignals(false);
785   redSpinBox->blockSignals(true);
786   redSpinBox->setValue(curColor->red());
787   redSpinBox->blockSignals(false);
788   greenSlider->blockSignals(true);
789   greenSlider->setValue(curColor->green());
790   greenSlider->blockSignals(false);
791   greenSpinBox->blockSignals(true);
792   greenSpinBox->setValue(curColor->green());
793   greenSpinBox->blockSignals(false);
794   blueSlider->blockSignals(true);
795   blueSlider->setValue(curColor->blue());
796   blueSlider->blockSignals(false);
797   blueSpinBox->blockSignals(true);
798   blueSpinBox->setValue(curColor->blue());
799   blueSpinBox->blockSignals(false);
800   QPalette p = colorFrame->palette();
801   p.setColor(QPalette::Window, (reinterpret_cast<const QColor &>(*curColor)));
802   colorFrame->setPalette(p);
803 }
setTextColor(const QColor & c)804 void DeicsOnzeGui::setTextColor(const QColor & c) {
805   QPalette p = this->palette();
806   p.setColor(QPalette::WindowText, c);
807   this->setPalette(p);
808   channelCtrlGroupBox->setPalette(p);
809   //channelPanGroupBox->setPalette(p);
810   FeedbackGroupBox->setPalette(p);
811   LFOGroupBox->setPalette(p);
812   ModulationMatrixGroupBox->setPalette(p);
813   FeedbackGroupBox->setPalette(p);
814   pitchEnvGroupBox->setPalette(p);
815   Frequency1groupBox->setPalette(p);
816   OUT1groupBox->setPalette(p);
817   Env1GroupBox->setPalette(p);
818   Scaling1GroupBox->setPalette(p);
819   DetWaveEGS1GroupBox->setPalette(p);
820   sensitivity1groupBox->setPalette(p);
821   Frequency2groupBox->setPalette(p);
822   OUT2groupBox->setPalette(p);
823   Env2GroupBox->setPalette(p);
824   Scaling2GroupBox->setPalette(p);
825   DetWaveEGS2GroupBox->setPalette(p);
826   sensitivity2groupBox->setPalette(p);
827   Frequency3groupBox->setPalette(p);
828   OUT3groupBox->setPalette(p);
829   Env3GroupBox->setPalette(p);
830   Scaling3GroupBox->setPalette(p);
831   DetWaveEGS3GroupBox->setPalette(p);
832   sensitivity3groupBox->setPalette(p);
833   Frequency4groupBox->setPalette(p);
834   OUT4groupBox->setPalette(p);
835   Env4GroupBox->setPalette(p);
836   Scaling4GroupBox->setPalette(p);
837   DetWaveEGS4GroupBox->setPalette(p);
838   sensitivity4groupBox->setPalette(p);
839   transposeGroupBox->setPalette(p);
840   //detuneGroupBox->setPalette(p);
841   //footSWGroupBox->setPalette(p);
842   pitchBendRangeGroupBox->setPalette(p);
843   //reverbGroupBox->setPalette(p);
844   modeGroupBox->setPalette(p);
845   portamentoGroupBox->setPalette(p);
846   colorGroupBox->setPalette(p);
847   pathGroupBox->setPalette(p);
848   qualityGroupBox->setPalette(p);
849   saveModeButtonGroup->setPalette(p);
850   fileGroupBox->setPalette(p);
851   onReverbGroupBox->setPalette(p);
852   selectLadspaReverbGroupBox->setPalette(p);
853   channelReverbGroupBox->setPalette(p);
854   parametersReverbGroupBox->setPalette(p);
855   onChorusGroupBox->setPalette(p);
856   selectLadspaChorusGroupBox->setPalette(p);
857   channelChorusGroupBox->setPalette(p);
858   parametersChorusGroupBox->setPalette(p);
859   fontSizeGroupBox->setPalette(p);
860   delayBPMGroupBox->setPalette(p);
861   delayBeatRatioGroupBox->setPalette(p);
862   delayFeedbackGroupBox->setPalette(p);
863   delayPanLFOGroupBox->setPalette(p);
864   delayPanDepthGroupBox->setPalette(p);
865   delayReturnGroupBox->setPalette(p);
866   channelDelayGroupBox->setPalette(p);
867 }
868 
setBackgroundColor(const QColor & c)869 void DeicsOnzeGui::setBackgroundColor(const QColor & c) {
870   if(imageCheckBox->checkState()==Qt::Unchecked) {
871     QPalette p = this->palette();
872     p.setColor(QPalette::Window, c);
873     this->setPalette(p);
874   }
875 }
setEditTextColor(const QColor & c)876 void DeicsOnzeGui::setEditTextColor(const QColor & c) {
877   QPalette p = this->palette();
878   p.setColor(QPalette::Text, c);
879   this->setPalette(p);
880   channelCtrlGroupBox->setPalette(p);
881   //channelPanGroupBox->setPalette(p);
882   FeedbackGroupBox->setPalette(p);
883   LFOGroupBox->setPalette(p);
884   ModulationMatrixGroupBox->setPalette(p);
885   FeedbackGroupBox->setPalette(p);
886   pitchEnvGroupBox->setPalette(p);
887   Frequency1groupBox->setPalette(p);
888   OUT1groupBox->setPalette(p);
889   Env1GroupBox->setPalette(p);
890   Scaling1GroupBox->setPalette(p);
891   DetWaveEGS1GroupBox->setPalette(p);
892   sensitivity1groupBox->setPalette(p);
893   Frequency2groupBox->setPalette(p);
894   OUT2groupBox->setPalette(p);
895   Env2GroupBox->setPalette(p);
896   Scaling2GroupBox->setPalette(p);
897   DetWaveEGS2GroupBox->setPalette(p);
898   sensitivity2groupBox->setPalette(p);
899   Frequency3groupBox->setPalette(p);
900   OUT3groupBox->setPalette(p);
901   Env3GroupBox->setPalette(p);
902   Scaling3GroupBox->setPalette(p);
903   DetWaveEGS3GroupBox->setPalette(p);
904   sensitivity3groupBox->setPalette(p);
905   Frequency4groupBox->setPalette(p);
906   OUT4groupBox->setPalette(p);
907   Env4GroupBox->setPalette(p);
908   Scaling4GroupBox->setPalette(p);
909   DetWaveEGS4GroupBox->setPalette(p);
910   sensitivity4groupBox->setPalette(p);
911   transposeGroupBox->setPalette(p);
912   //detuneGroupBox->setPalette(p);
913   //footSWGroupBox->setPalette(p);
914   pitchBendRangeGroupBox->setPalette(p);
915   //reverbGroupBox->setPalette(p);
916   modeGroupBox->setPalette(p);
917   portamentoGroupBox->setPalette(p);
918   colorGroupBox->setPalette(p);
919   pathGroupBox->setPalette(p);
920   qualityGroupBox->setPalette(p);
921   saveModeButtonGroup->setPalette(p);
922   fileGroupBox->setPalette(p);
923   masterVolKnob->setScaleValueColor(c);
924   channelVolumeKnob->setScaleValueColor(c);
925   channelPanKnob->setScaleValueColor(c);
926   brightnessKnob->setScaleValueColor(c);
927   modulationKnob->setScaleValueColor(c);
928   detuneKnob->setScaleValueColor(c);
929   attackKnob->setScaleValueColor(c);
930   releaseKnob->setScaleValueColor(c);
931   channelChorusGroupBox->setPalette(p);
932   selectLadspaChorusGroupBox->setPalette(p);
933   parametersChorusGroupBox->setPalette(p);
934   for(int i=0; i < (int)_chorusSliderVector.size(); i++)
935     if(_chorusSliderVector[i]) _chorusSliderVector[i]->setScaleValueColor(c);
936   channelReverbGroupBox->setPalette(p);
937   selectLadspaReverbGroupBox->setPalette(p);
938   parametersReverbGroupBox->setPalette(p);
939   for(int i=0; i < (int)_reverbSliderVector.size(); i++)
940     if(_reverbSliderVector[i]) _reverbSliderVector[i]->setScaleValueColor(c);
941   channelDelayGroupBox->setPalette(p);
942   delayBPMKnob->setScaleValueColor(c);
943   delayBPMGroupBox->setPalette(p);
944   delayBeatRatioKnob->setScaleValueColor(c);
945   delayBeatRatioGroupBox->setPalette(p);
946   delayFeedbackKnob->setScaleValueColor(c);
947   delayFeedbackGroupBox->setPalette(p);
948   delayPanLFOFreqKnob->setScaleValueColor(c);
949   delayPanLFOGroupBox->setPalette(p);
950   delayPanLFODepthKnob->setScaleValueColor(c);
951   delayPanDepthGroupBox->setPalette(p);
952   fontSizeGroupBox->setPalette(p);
953 }
setEditBackgroundColor(const QColor & c)954 void DeicsOnzeGui::setEditBackgroundColor(const QColor & c) {
955   QPalette p = this->palette();
956   p.setColor(QPalette::Base, c);
957   this->setPalette(p);
958   channelCtrlGroupBox->setPalette(p);
959   //channelPanGroupBox->setPalette(p);
960   FeedbackGroupBox->setPalette(p);
961   LFOGroupBox->setPalette(p);
962   ModulationMatrixGroupBox->setPalette(p);
963   FeedbackGroupBox->setPalette(p);
964   pitchEnvGroupBox->setPalette(p);
965   Frequency1groupBox->setPalette(p);
966   OUT1groupBox->setPalette(p);
967   Env1GroupBox->setPalette(p);
968   Scaling1GroupBox->setPalette(p);
969   DetWaveEGS1GroupBox->setPalette(p);
970   sensitivity1groupBox->setPalette(p);
971   Frequency2groupBox->setPalette(p);
972   OUT2groupBox->setPalette(p);
973   Env2GroupBox->setPalette(p);
974   Scaling2GroupBox->setPalette(p);
975   DetWaveEGS2GroupBox->setPalette(p);
976   sensitivity2groupBox->setPalette(p);
977   Frequency3groupBox->setPalette(p);
978   OUT3groupBox->setPalette(p);
979   Env3GroupBox->setPalette(p);
980   Scaling3GroupBox->setPalette(p);
981   DetWaveEGS3GroupBox->setPalette(p);
982   sensitivity3groupBox->setPalette(p);
983   Frequency4groupBox->setPalette(p);
984   OUT4groupBox->setPalette(p);
985   Env4GroupBox->setPalette(p);
986   Scaling4GroupBox->setPalette(p);
987   DetWaveEGS4GroupBox->setPalette(p);
988   sensitivity4groupBox->setPalette(p);
989   transposeGroupBox->setPalette(p);
990   //detuneGroupBox->setPalette(p);
991   //footSWGroupBox->setPalette(p);
992   pitchBendRangeGroupBox->setPalette(p);
993   //reverbGroupBox->setPalette(p);
994   modeGroupBox->setPalette(p);
995   portamentoGroupBox->setPalette(p);
996   colorGroupBox->setPalette(p);
997   pathGroupBox->setPalette(p);
998   qualityGroupBox->setPalette(p);
999   saveModeButtonGroup->setPalette(p);
1000   fileGroupBox->setPalette(p);
1001   p = pitchEnvFrame->palette();
1002   p.setColor(QPalette::Window, c);
1003   pitchEnvFrame->setPalette(p);
1004   p = envelope1Frame->palette();
1005   p.setColor(QPalette::Window, c);
1006   envelope1Frame->setPalette(p);
1007   p = envelope2Frame->palette();
1008   p.setColor(QPalette::Window, c);
1009   envelope2Frame->setPalette(p);
1010   p = envelope3Frame->palette();
1011   p.setColor(QPalette::Window, c);
1012   envelope3Frame->setPalette(p);
1013   p = envelope4Frame->palette();
1014   p.setColor(QPalette::Window, c);
1015   envelope4Frame->setPalette(p);
1016   masterVolKnob->setScaleColor(c);
1017   channelVolumeKnob->setScaleColor(c);
1018   channelPanKnob->setScaleColor(c);
1019   brightnessKnob->setScaleColor(c);
1020   modulationKnob->setScaleColor(c);
1021   detuneKnob->setScaleColor(c);
1022   attackKnob->setScaleColor(c);
1023   releaseKnob->setScaleColor(c);
1024   channelChorusGroupBox->setPalette(p);
1025   selectLadspaChorusGroupBox->setPalette(p);
1026   parametersChorusGroupBox->setPalette(p);
1027   for(int i=0; i < (int)_chorusSliderVector.size(); i++)
1028     if(_chorusSliderVector[i]) _chorusSliderVector[i]->setScaleColor(c);
1029   channelReverbGroupBox->setPalette(p);
1030   selectLadspaReverbGroupBox->setPalette(p);
1031   parametersReverbGroupBox->setPalette(p);
1032   for(int i=0; i < (int)_reverbSliderVector.size(); i++)
1033     if(_reverbSliderVector[i]) _reverbSliderVector[i]->setScaleColor(c);
1034   channelDelayGroupBox->setPalette(p);
1035   delayBPMKnob->setScaleColor(c);
1036   delayBPMGroupBox->setPalette(p);
1037   delayBeatRatioKnob->setScaleColor(c);
1038   delayBeatRatioGroupBox->setPalette(p);
1039   delayFeedbackKnob->setScaleColor(c);
1040   delayFeedbackGroupBox->setPalette(p);
1041   delayPanLFOFreqKnob->setScaleColor(c);
1042   delayPanLFOGroupBox->setPalette(p);
1043   delayPanLFODepthKnob->setScaleColor(c);
1044   delayPanDepthGroupBox->setPalette(p);
1045   fontSizeGroupBox->setPalette(p);
1046 }
1047 
1048 //-----------------------------------------------------------
1049 // QFramePitchEnvelope
1050 //-----------------------------------------------------------
paintEvent(QPaintEvent *)1051 void QFramePitchEnvelope::paintEvent(QPaintEvent* /*e*/) {
1052   QPainter paint(this);
1053   QPen pen;
1054   pen.setColor(*(_deicsOnzeGui->etColor));
1055   //if the size of pitchEnvFrame is different than QFramePitchEnvelope resize
1056   //and update the envelope
1057   if(_deicsOnzeGui->pitchEnvFrame->width()!=width() ||
1058      _deicsOnzeGui->pitchEnvFrame->height()!=height()) {
1059     resize(_deicsOnzeGui->pitchEnvFrame->width(),
1060 	   _deicsOnzeGui->pitchEnvFrame->height());
1061     //update the positions of the envelope
1062     PitchEg* pe = &_deicsOnzeGui->_deicsOnze
1063       ->_preset[_deicsOnzeGui->_currentChannel]->pitchEg;
1064     env2Points(pe->pl1, pe->pl2, pe->pl3, pe->pr1, pe->pr2, pe->pr3);
1065   }
1066   //Draw the verticale line on the release time
1067   pen.setWidth(1);
1068   pen.setStyle(Qt::DotLine);
1069   paint.setPen(pen);
1070   paint.drawLine(P2linkP3.x(), height(), P2linkP3.x(), 0);
1071   //Draw the horisontal line for the center of the pitch
1072   pen.setStyle(Qt::DashDotLine);
1073   paint.setPen(pen);
1074   paint.drawLine(0, height()/2-DOTWIDTH/2, width(), height()/2-DOTWIDTH/2);
1075   //Draw the pitch envelope
1076   pen.setWidth(PENWIDTH);
1077   pen.setStyle(Qt::SolidLine);
1078   paint.setPen(pen);
1079   paint.drawRect(startlinkP1.x()-DOTWIDTH/2, startlinkP1.y()-DOTWIDTH/2,
1080 		 DOTWIDTH, DOTWIDTH);
1081   paint.drawRect(P1linkP2.x()-DOTWIDTH/2, P1linkP2.y()-DOTWIDTH/2,
1082 		 DOTWIDTH, DOTWIDTH);
1083   paint.drawRect(P2linkP3.x()-DOTWIDTH/2, P2linkP3.y()-DOTWIDTH/2,
1084 		 DOTWIDTH, DOTWIDTH);
1085   paint.drawRect(P3linkEnd.x()-DOTWIDTH/2, P3linkEnd.y()-DOTWIDTH/2,
1086 		 DOTWIDTH, DOTWIDTH);
1087   paint.drawLine(startlinkP1,P1linkP2);
1088   paint.drawLine(P1linkP2, P2linkP3);
1089   paint.drawLine(P2linkP3, P3linkEnd);
1090 }
mousePressEvent(QMouseEvent * e)1091 void QFramePitchEnvelope::mousePressEvent(QMouseEvent * e) {
1092     //startlinkP1
1093     if(e->x()<startlinkP1.x()+DRAGWIDTH && e->x()>startlinkP1.x()-DRAGWIDTH
1094        && e->y()<startlinkP1.y()+DRAGWIDTH && e->y()>startlinkP1.y()-DRAGWIDTH)
1095 	isStartlinkP1Edit=true;
1096     //P1linkP2
1097     if(e->x()<P1linkP2.x()+DRAGWIDTH && e->x()>P1linkP2.x()-DRAGWIDTH
1098        && e->y()<P1linkP2.y()+DRAGWIDTH && e->y()>P1linkP2.y()-DRAGWIDTH)
1099 	isP1linkP2Edit=true;
1100     //P2linkP3
1101     if(e->x()<P2linkP3.x()+DRAGWIDTH && e->x()>P2linkP3.x()-DRAGWIDTH
1102        && e->y()<P2linkP3.y()+DRAGWIDTH && e->y()>P2linkP3.y()-DRAGWIDTH)
1103 	isP2linkP3Edit=true;
1104     //P3linkEnd
1105     if(e->x()<P3linkEnd.x()+DRAGWIDTH && e->x()>P3linkEnd.x()-DRAGWIDTH
1106        && e->y()<P3linkEnd.y()+DRAGWIDTH && e->y()>P3linkEnd.y()-DRAGWIDTH)
1107 	isP3linkEndEdit=true;
1108 }
mouseReleaseEvent(QMouseEvent *)1109 void QFramePitchEnvelope::mouseReleaseEvent(QMouseEvent* /*e*/) {
1110     isStartlinkP1Edit=false;
1111     isP1linkP2Edit=false;
1112     isP2linkP3Edit=false;
1113     isP3linkEndEdit=false;
1114 }
mouseMoveEvent(QMouseEvent * e)1115 void QFramePitchEnvelope::mouseMoveEvent(QMouseEvent* e) {
1116   if(isStartlinkP1Edit) {
1117     if(e->y()>startlinkP1.y()) _deicsOnzeGui->PL1SpinBox->stepDown();
1118     if(e->y()<startlinkP1.y()) _deicsOnzeGui->PL1SpinBox->stepUp();
1119   }
1120   if(isP1linkP2Edit) {
1121     if(e->x()>P1linkP2.x()) _deicsOnzeGui->PR1SpinBox->stepDown();
1122     if(e->x()<P1linkP2.x()) _deicsOnzeGui->PR1SpinBox->stepUp();
1123     if(e->y()>P1linkP2.y()) _deicsOnzeGui->PL2SpinBox->stepDown();
1124     if(e->y()<P1linkP2.y()) _deicsOnzeGui->PL2SpinBox->stepUp();
1125   }
1126   if(isP2linkP3Edit) {
1127     if(e->x()>P2linkP3.x()) _deicsOnzeGui->PR2SpinBox->stepDown();
1128     if(e->x()<P2linkP3.x()) _deicsOnzeGui->PR2SpinBox->stepUp();
1129     if(e->y()>P2linkP3.y()) _deicsOnzeGui->PL3SpinBox->stepDown();
1130     if(e->y()<P2linkP3.y()) _deicsOnzeGui->PL3SpinBox->stepUp();
1131   }
1132   if(isP3linkEndEdit) {
1133     if(e->x()>P3linkEnd.x()) _deicsOnzeGui->PR3SpinBox->stepDown();
1134     if(e->x()<P3linkEnd.x()) _deicsOnzeGui->PR3SpinBox->stepUp();
1135     if(e->y()>P3linkEnd.y()) _deicsOnzeGui->PL1SpinBox->stepDown();
1136     if(e->y()<P3linkEnd.y()) _deicsOnzeGui->PL1SpinBox->stepUp();
1137   }
1138 }
1139 //-----------------------------------------------------------
1140 // env2Points
1141 //   assigns the right coordinates to the points
1142 //   to draw the pitch envelope
1143 //-----------------------------------------------------------
env2Points(int pl1,int pl2,int pl3,int pr1,int pr2,int pr3)1144 void QFramePitchEnvelope::env2Points(int pl1, int pl2, int pl3,
1145 				     int pr1, int pr2, int pr3) {
1146   startlinkP1.setY(YOFFSET+MAXPHEIGHT
1147 		   -PENWIDTH-((PL1HEIGHT-PENWIDTH)*pl1)/MAXPL);
1148   startlinkP1.setX(XOFFSET);
1149   P1linkP2.setY(YOFFSET+MAXPHEIGHT-PENWIDTH-((PL2HEIGHT-PENWIDTH)*pl2)/MAXPL);
1150   P1linkP2.setX(XOFFSET+WALLWIDTH+PR1WIDTH-(PR1WIDTH*pr1)/MAXPR);
1151   P2linkP3.setY(YOFFSET+MAXPHEIGHT-PENWIDTH-((PL3HEIGHT-PENWIDTH)*pl3)/MAXPL);
1152   P2linkP3.setX(P1linkP2.x()+WALLWIDTH+PR2WIDTH-(PR2WIDTH*pr2)/MAXPR);
1153   P3linkEnd.setY(YOFFSET+MAXPHEIGHT-PENWIDTH-((PL1HEIGHT-PENWIDTH)*pl1)/MAXPL);
1154   P3linkEnd.setX(P2linkP3.x()+WALLWIDTH+PR3WIDTH-(PR3WIDTH*pr3)/MAXPR);
1155 }
1156 //-----------------------------------------------------------
1157 // QFrameEnvelope
1158 //-----------------------------------------------------------
paintEvent(QPaintEvent *)1159 void QFrameEnvelope::paintEvent(QPaintEvent* /*e*/) {
1160   QPainter paint(this);
1161   QPen pen;
1162   pen.setColor(*(_deicsOnzeGui->etColor));
1163   //if the size of pitchEnvFrame is different than QFramePitchEnvelope resize
1164   //and update the envelope
1165   int op = _deicsOnzeGui->deicsOnzeTabWidget->currentIndex()-2;
1166                               //-2 because of the presetsTab and globalTab
1167   Eg* eg=&(_deicsOnzeGui->_deicsOnze->
1168 	   _preset[_deicsOnzeGui->_currentChannel]->eg[op]);
1169   switch(op) {
1170   case 0 :
1171     if(_deicsOnzeGui->envelope1Frame->width()!=width() ||
1172        _deicsOnzeGui->envelope1Frame->height()!=height()) {
1173       resize(_deicsOnzeGui->envelope1Frame->width(),
1174 	     _deicsOnzeGui->envelope1Frame->height());
1175       //update the positions of the envelope
1176       env2Points(eg->ar, eg->d1r, eg->d1l, eg->d2r, eg->rr);
1177     }
1178     break;
1179   case 1 :
1180     if(_deicsOnzeGui->envelope2Frame->width()!=width() ||
1181        _deicsOnzeGui->envelope2Frame->height()!=height()) {
1182       resize(_deicsOnzeGui->envelope2Frame->width(),
1183 	     _deicsOnzeGui->envelope2Frame->height());
1184       //update the positions of the envelope
1185       env2Points(eg->ar, eg->d1r, eg->d1l, eg->d2r, eg->rr);
1186     }
1187     break;
1188   case 2 :
1189     if(_deicsOnzeGui->envelope3Frame->width()!=width() ||
1190        _deicsOnzeGui->envelope3Frame->height()!=height()) {
1191       resize(_deicsOnzeGui->envelope3Frame->width(),
1192 	     _deicsOnzeGui->envelope3Frame->height());
1193       //update the positions of the envelope
1194       env2Points(eg->ar, eg->d1r, eg->d1l, eg->d2r, eg->rr);
1195     }
1196     break;
1197   case 3 :
1198     if(_deicsOnzeGui->envelope4Frame->width()!=width() ||
1199        _deicsOnzeGui->envelope4Frame->height()!=height()) {
1200       resize(_deicsOnzeGui->envelope4Frame->width(),
1201 	     _deicsOnzeGui->envelope4Frame->height());
1202       //update the positions of the envelope
1203       env2Points(eg->ar, eg->d1r, eg->d1l, eg->d2r, eg->rr);
1204     }
1205     break;
1206   default :
1207     printf("QFrameEnvelope::paintEvent switch case error\n");
1208     break;
1209   }
1210   //Draw the vertical line of the release note
1211   pen.setWidth(1);
1212   pen.setStyle(Qt::DotLine);
1213   paint.setPen(pen);
1214   paint.drawLine(D2linkRR.x(), MAXHEIGHT, D2linkRR.x(), YOFFSET);
1215   //Draw the volume envelope
1216   pen.setWidth(PENWIDTH);
1217   pen.setStyle(Qt::SolidLine);
1218   paint.setPen(pen);
1219   paint.drawRect(startlinkAR.x()-DOTWIDTH/2, startlinkAR.y()-DOTWIDTH/2,
1220 		 DOTWIDTH, DOTWIDTH);
1221   paint.drawRect(ARlinkD1.x()-DOTWIDTH/2, ARlinkD1.y()-DOTWIDTH/2,
1222 		 DOTWIDTH, DOTWIDTH);
1223   paint.drawRect(D1linkD2.x()-DOTWIDTH/2, D1linkD2.y()-DOTWIDTH/2,
1224 		 DOTWIDTH, DOTWIDTH);
1225   paint.drawRect(D2linkRR.x()-DOTWIDTH/2, D2linkRR.y()-DOTWIDTH/2,
1226 		 DOTWIDTH, DOTWIDTH);
1227   paint.drawRect(RRlinkEnd.x()-DOTWIDTH/2, RRlinkEnd.y()-DOTWIDTH/2,
1228 		 DOTWIDTH, DOTWIDTH);
1229   paint.drawLine(startlinkAR,ARlinkD1);
1230   paint.drawLine(ARlinkD1, D1linkD2);
1231   paint.drawLine(D1linkD2, D2linkRR);
1232   paint.drawLine(D2linkRR, RRlinkEnd);
1233 }
mousePressEvent(QMouseEvent * e)1234 void QFrameEnvelope::mousePressEvent(QMouseEvent * e) {
1235     //ARlinkD1
1236     if(e->x()<ARlinkD1.x()+DRAGWIDTH && e->x()>ARlinkD1.x()-DRAGWIDTH
1237        && e->y()<ARlinkD1.y()+DRAGWIDTH && e->y()>ARlinkD1.y()-DRAGWIDTH)
1238 	isARlinkD1Edit=true;
1239     //D1linkD2
1240     if(e->x()<D1linkD2.x()+DRAGWIDTH && e->x()>D1linkD2.x()-DRAGWIDTH
1241        && e->y()<D1linkD2.y()+DRAGWIDTH && e->y()>D1linkD2.y()-DRAGWIDTH)
1242 	isD1linkD2Edit=true;
1243     //D2linkRR
1244     if(e->x()<D2linkRR.x()+DRAGWIDTH && e->x()>D2linkRR.x()-DRAGWIDTH
1245        && e->y()<D2linkRR.y()+DRAGWIDTH && e->y()>D2linkRR.y()-DRAGWIDTH)
1246 	isD2linkRREdit=true;
1247     //RRlinkEnd
1248     if(e->x()<RRlinkEnd.x()+DRAGWIDTH && e->x()>RRlinkEnd.x()-DRAGWIDTH
1249        && e->y()<RRlinkEnd.y()+DRAGWIDTH && e->y()>RRlinkEnd.y()-DRAGWIDTH)
1250 	isRRlinkEndEdit=true;
1251 }
mouseReleaseEvent(QMouseEvent *)1252 void QFrameEnvelope::mouseReleaseEvent(QMouseEvent* /*e*/) {
1253     isARlinkD1Edit=false;
1254     isD1linkD2Edit=false;
1255     isD2linkRREdit=false;
1256     isRRlinkEndEdit=false;
1257 }
mouseMoveEvent(QMouseEvent * e)1258 void QFrameEnvelope::mouseMoveEvent(QMouseEvent* e) {
1259     if(isARlinkD1Edit)
1260     {
1261 	switch(op) {
1262 	    case 0 :
1263 		if(e->x()>ARlinkD1.x()) _deicsOnzeGui->AR1SpinBox->stepDown();
1264 		if(e->x()<ARlinkD1.x()) _deicsOnzeGui->AR1SpinBox->stepUp();
1265 		break;
1266 	    case 1 :
1267 		if(e->x()>ARlinkD1.x()) _deicsOnzeGui->AR2SpinBox->stepDown();
1268 		if(e->x()<ARlinkD1.x()) _deicsOnzeGui->AR2SpinBox->stepUp();
1269 		break;
1270 	    case 2 :
1271 		if(e->x()>ARlinkD1.x()) _deicsOnzeGui->AR3SpinBox->stepDown();
1272 		if(e->x()<ARlinkD1.x()) _deicsOnzeGui->AR3SpinBox->stepUp();
1273 		break;
1274 	    case 3 :
1275 		if(e->x()>ARlinkD1.x()) _deicsOnzeGui->AR4SpinBox->stepDown();
1276 		if(e->x()<ARlinkD1.x()) _deicsOnzeGui->AR4SpinBox->stepUp();
1277 		break;
1278 	    default :
1279 		break;
1280 	}
1281     }
1282     if(isD1linkD2Edit)
1283     {
1284 	switch(op) {
1285 	    case 0 :
1286 		if(e->x()>D1linkD2.x()) _deicsOnzeGui->D1R1SpinBox->stepDown();
1287 		if(e->x()<D1linkD2.x()) _deicsOnzeGui->D1R1SpinBox->stepUp();
1288 		if(e->y()>D1linkD2.y()) _deicsOnzeGui->D1L1SpinBox->stepDown();
1289 		if(e->y()<D1linkD2.y()) _deicsOnzeGui->D1L1SpinBox->stepUp();
1290 		break;
1291 	    case 1 :
1292 		if(e->x()>D1linkD2.x()) _deicsOnzeGui->D1R2SpinBox->stepDown();
1293 		if(e->x()<D1linkD2.x()) _deicsOnzeGui->D1R2SpinBox->stepUp();
1294 		if(e->y()>D1linkD2.y()) _deicsOnzeGui->D1L2SpinBox->stepDown();
1295 		if(e->y()<D1linkD2.y()) _deicsOnzeGui->D1L2SpinBox->stepUp();
1296 		break;
1297 	    case 2 :
1298 		if(e->x()>D1linkD2.x()) _deicsOnzeGui->D1R3SpinBox->stepDown();
1299 		if(e->x()<D1linkD2.x()) _deicsOnzeGui->D1R3SpinBox->stepUp();
1300 		if(e->y()>D1linkD2.y()) _deicsOnzeGui->D1L3SpinBox->stepDown();
1301 		if(e->y()<D1linkD2.y()) _deicsOnzeGui->D1L3SpinBox->stepUp();
1302 		break;
1303 	    case 3 :
1304 		if(e->x()>D1linkD2.x()) _deicsOnzeGui->D1R4SpinBox->stepDown();
1305 		if(e->x()<D1linkD2.x()) _deicsOnzeGui->D1R4SpinBox->stepUp();
1306 		if(e->y()>D1linkD2.y()) _deicsOnzeGui->D1L4SpinBox->stepDown();
1307 		if(e->y()<D1linkD2.y()) _deicsOnzeGui->D1L4SpinBox->stepUp();
1308 		break;
1309 	    default :
1310 		break;
1311 	}
1312     }
1313     if(isD2linkRREdit)
1314     {
1315 	switch(op) {
1316 	    case 0 :
1317 		if(e->x()>D2linkRR.x() /*&& e->y()<D2linkRR.y()*/)
1318 		    _deicsOnzeGui->D2R1SpinBox->stepDown();
1319 		if(e->x()<D2linkRR.x() /*&& e->y()>D2linkRR.y()*/)
1320 		    _deicsOnzeGui->D2R1SpinBox->stepUp();
1321 		break;
1322 	    case 1 :
1323 		if(e->x()>D2linkRR.x() /*&& e->y()<D2linkRR.y()*/)
1324 		    _deicsOnzeGui->D2R2SpinBox->stepDown();
1325 		if(e->x()<D2linkRR.x() /*&& e->y()>D2linkRR.y()*/)
1326 		    _deicsOnzeGui->D2R2SpinBox->stepUp();
1327 		break;
1328 	    case 2 :
1329 		if(e->x()>D2linkRR.x() /*&& e->y()<D2linkRR.y()*/)
1330 		    _deicsOnzeGui->D2R3SpinBox->stepDown();
1331 		if(e->x()<D2linkRR.x() /*&& e->y()>D2linkRR.y()*/)
1332 		    _deicsOnzeGui->D2R3SpinBox->stepUp();
1333 		break;
1334 	    case 3 :
1335 		if(e->x()>D2linkRR.x() /*&& e->y()<D2linkRR.y()*/)
1336 		    _deicsOnzeGui->D2R4SpinBox->stepDown();
1337 		if(e->x()<D2linkRR.x() /*&& e->y()>D2linkRR.y()*/)
1338 		    _deicsOnzeGui->D2R4SpinBox->stepUp();
1339 		break;
1340 	    default :
1341 		break;
1342 	}
1343     }
1344     if(isRRlinkEndEdit)
1345     {
1346 	switch(op) {
1347 	    case 0 :
1348 		if(e->x()>RRlinkEnd.x()) _deicsOnzeGui->RR1SpinBox->stepDown();
1349 		if(e->x()<RRlinkEnd.x()) _deicsOnzeGui->RR1SpinBox->stepUp();
1350 		break;
1351 	    case 1 :
1352 		if(e->x()>RRlinkEnd.x()) _deicsOnzeGui->RR2SpinBox->stepDown();
1353 		if(e->x()<RRlinkEnd.x()) _deicsOnzeGui->RR2SpinBox->stepUp();
1354 		break;
1355 	    case 2 :
1356 		if(e->x()>RRlinkEnd.x()) _deicsOnzeGui->RR3SpinBox->stepDown();
1357 		if(e->x()<RRlinkEnd.x()) _deicsOnzeGui->RR3SpinBox->stepUp();
1358 		break;
1359 	    case 3 :
1360 		if(e->x()>RRlinkEnd.x()) _deicsOnzeGui->RR4SpinBox->stepDown();
1361 		if(e->x()<RRlinkEnd.x()) _deicsOnzeGui->RR4SpinBox->stepUp();
1362 		break;
1363 	    default :
1364 		break;
1365 	}
1366     }
1367 }
1368 //-----------------------------------------------------------
1369 // env2Points
1370 //   assigns the right coordinates to the points
1371 //   to draw the envelope
1372 //-----------------------------------------------------------
env2Points(int ar,int d1r,int d1l,int d2r,int rr)1373 void QFrameEnvelope::env2Points(int ar, int d1r, int d1l, int d2r, int rr) {
1374     startlinkAR.setY(MAXHEIGHT-PENWIDTH);
1375     startlinkAR.setX(PENWIDTH);
1376     ARlinkD1.setY(PENWIDTH);
1377     ARlinkD1.setX(PENWIDTH+ARWIDTH-(ARWIDTH*ar)/MAXAR);
1378     D1linkD2.setY(PENWIDTH+
1379 		  (D1LHEIGHT-2*PENWIDTH-((D1LHEIGHT-2*PENWIDTH)*d1l)/MAXD1L));
1380     D1linkD2.setX(ARlinkD1.x()+D1RWIDTH-(D1RWIDTH*d1r)/MAXD1R);
1381     D2linkRR.setY(D1linkD2.y()
1382 		  +((D1LHEIGHT-2*PENWIDTH-D1linkD2.y())*d2r)/MAXD2R);
1383     D2linkRR.setX(D1linkD2.x()+D2RWIDTH-(D2RWIDTH*d2r)/MAXD2R);
1384     RRlinkEnd.setY(MAXHEIGHT-PENWIDTH);
1385     RRlinkEnd.setX(D2linkRR.x()
1386 		   +(RRWIDTH-PENWIDTH-((RRWIDTH-PENWIDTH)*rr)/MAXRR));
1387 }
1388 
1389 //-----------------------------------------------------------
1390 // processEvent(const MidiEvent&);
1391 //-----------------------------------------------------------
processEvent(const MusECore::MidiPlayEvent & ev)1392 void DeicsOnzeGui::processEvent(const MusECore::MidiPlayEvent& ev) {
1393   //Controller
1394   if (ev.type() == MusECore::ME_CONTROLLER) {
1395     //printf("MusECore::ME_CONTROLLER\n");
1396     int id=ev.dataA();
1397     int ch=ev.channel();
1398     int val=ev.dataB();
1399     if(ch == _currentChannel || id == CTRL_CHANNELENABLE) {
1400       switch(id) {
1401       case CTRL_AR: updateAR(0, val); break;
1402       case CTRL_D1R: updateD1R(0, val); break;
1403       case CTRL_D2R: updateD2R(0, val); break;
1404       case CTRL_RR: updateRR(0, val); break;
1405       case CTRL_D1L: updateD1L(0, val); break;
1406       case CTRL_LS: updateLS(0, val); break;
1407       case CTRL_RS: updateRS(0, val); break;
1408       case CTRL_EBS: updateEBS(0, val); break;
1409       case CTRL_AME: updateAME(0, val==1); break;
1410       case CTRL_KVS: updateKVS(0, val); break;
1411       case CTRL_OUT: updateOUT(0, val); break;
1412       case CTRL_RATIO: updateRATIO(0, val); break;
1413       case CTRL_DET: updateDET(0, val); break;
1414       case CTRL_AR+DECAPAR1: updateAR(1, val); break;
1415       case CTRL_D1R+DECAPAR1: updateD1R(1, val); break;
1416       case CTRL_D2R+DECAPAR1: updateD2R(1, val); break;
1417       case CTRL_RR+DECAPAR1: updateRR(1, val); break;
1418       case CTRL_D1L+DECAPAR1: updateD1L(1, val); break;
1419       case CTRL_LS+DECAPAR1: updateLS(1, val); break;
1420       case CTRL_RS+DECAPAR1: updateRS(1, val); break;
1421       case CTRL_EBS+DECAPAR1: updateEBS(1, val); break;
1422       case CTRL_AME+DECAPAR1: updateAME(1, val==1); break;
1423       case CTRL_KVS+DECAPAR1: updateKVS(1, val); break;
1424       case CTRL_OUT+DECAPAR1: updateOUT(1, val); break;
1425       case CTRL_RATIO+DECAPAR1: updateRATIO(1, val); break;
1426       case CTRL_DET+DECAPAR1: updateDET(1, val); break;
1427       case CTRL_AR+2*DECAPAR1: updateAR(2, val); break;
1428       case CTRL_D1R+2*DECAPAR1: updateD1R(2, val); break;
1429       case CTRL_D2R+2*DECAPAR1: updateD2R(2, val); break;
1430       case CTRL_RR+2*DECAPAR1: updateRR(2, val); break;
1431       case CTRL_D1L+2*DECAPAR1: updateD1L(2, val); break;
1432       case CTRL_LS+2*DECAPAR1: updateLS(2, val); break;
1433       case CTRL_RS+2*DECAPAR1: updateRS(2, val); break;
1434       case CTRL_EBS+2*DECAPAR1: updateEBS(2, val); break;
1435       case CTRL_AME+2*DECAPAR1: updateAME(2, val==1); break;
1436       case CTRL_KVS+2*DECAPAR1: updateKVS(2, val); break;
1437       case CTRL_OUT+2*DECAPAR1: updateOUT(2, val); break;
1438       case CTRL_RATIO+2*DECAPAR1: updateRATIO(2, val); break;
1439       case CTRL_DET+2*DECAPAR1: updateDET(2, val); break;
1440       case CTRL_AR+3*DECAPAR1: updateAR(3, val); break;
1441       case CTRL_D1R+3*DECAPAR1: updateD1R(3, val); break;
1442       case CTRL_D2R+3*DECAPAR1: updateD2R(3, val); break;
1443       case CTRL_RR+3*DECAPAR1: updateRR(3, val); break;
1444       case CTRL_D1L+3*DECAPAR1: updateD1L(3, val); break;
1445       case CTRL_LS+3*DECAPAR1: updateLS(3, val); break;
1446       case CTRL_RS+3*DECAPAR1: updateRS(3, val); break;
1447       case CTRL_EBS+3*DECAPAR1: updateEBS(3, val); break;
1448       case CTRL_AME+3*DECAPAR1: updateAME(3, val==1); break;
1449       case CTRL_KVS+3*DECAPAR1: updateKVS(3, val); break;
1450       case CTRL_OUT+3*DECAPAR1: updateOUT(3, val); break;
1451       case CTRL_RATIO+3*DECAPAR1: updateRATIO(3, val); break;
1452       case CTRL_DET+3*DECAPAR1: updateDET(3, val); break;
1453       case CTRL_ALG: updateALG(val); break;
1454       case CTRL_FEEDBACK: updateFEEDBACK(val); break;
1455       case CTRL_SPEED: updateSPEED(val); break;
1456       case CTRL_DELAY: updateDELAY(val); break;
1457       case CTRL_PMODDEPTH: updatePMODDEPTH(val); break;
1458       case CTRL_AMODDEPTH: updateAMODDEPTH(val); break;
1459       case CTRL_SYNC: updateSYNC(val==1); break;
1460       case CTRL_WAVE: updateWAVE(val); break;
1461       case CTRL_PMODSENS: updatePMODSENS(val); break;
1462       case CTRL_AMS: updateAMS(val); break;
1463       case CTRL_TRANSPOSE: updateTRANSPOSE(val); break;
1464       case CTRL_POLYMODE: updatePOLYMODE(val); break;
1465       case CTRL_PBENDRANGE: updatePBENDRANGE(val); break;
1466       case CTRL_PORTAMODE: updatePORTAMODE(val); break;
1467       case CTRL_PORTATIME: updatePORTATIME(val); break;
1468       case CTRL_FCVOLUME: updateFcVolume(val); break;
1469       case CTRL_FSW:
1470 	break;
1471       case CTRL_MWPITCH: updateMwPitch(val); break;
1472       case CTRL_MWAMPLITUDE: updateMwAmplitude(val); break;
1473       case CTRL_BCPITCH: updateBcPitch(val); break;
1474       case CTRL_BCAMPLITUDE: updateBcAmplitude(val); break;
1475       case CTRL_BCPITCHBIAS: updateBcPitchBias(val); break;
1476       case CTRL_BCEGBIAS: updateBcEgBias(val); break;
1477       case CTRL_PR1: updatePR1(val); break;
1478       case CTRL_PR2: updatePR2(val); break;
1479       case CTRL_PR3: updatePR3(val); break;
1480       case CTRL_PL1: updatePL1(val); break;
1481       case CTRL_PL2: updatePL2(val); break;
1482       case CTRL_PL3: updatePL3(val); break;
1483       case CTRL_FIX: updateFIX(0, val==1); break;
1484       case CTRL_FIXRANGE: updateFIXRANGE(0, val); break;
1485       case CTRL_OSW: updateOSW(0, val); break;
1486       case CTRL_SHFT: updateSHFT(0, val); break;
1487       case CTRL_FIX+DECAPAR2: updateFIX(1, val==1); break;
1488       case CTRL_FIXRANGE+DECAPAR2: updateFIXRANGE(1, val); break;
1489       case CTRL_OSW+DECAPAR2: updateOSW(1, val); break;
1490       case CTRL_SHFT+DECAPAR2: updateSHFT(1, val); break;
1491       case CTRL_FIX+2*DECAPAR2: updateFIX(2, val==1); break;
1492       case CTRL_FIXRANGE+2*DECAPAR2: updateFIXRANGE(2, val); break;
1493       case CTRL_OSW+2*DECAPAR2: updateOSW(2, val); break;
1494       case CTRL_SHFT+2*DECAPAR2: updateSHFT(2, val); break;
1495       case CTRL_FIX+3*DECAPAR2: updateFIX(3, val==1); break;
1496       case CTRL_FIXRANGE+3*DECAPAR2: updateFIXRANGE(3, val); break;
1497       case CTRL_OSW+3*DECAPAR2: updateOSW(3, val); break;
1498       case CTRL_SHFT+3*DECAPAR2: updateSHFT(3, val); break;
1499       case CTRL_REVERBRATE: /*updateReverbRate(val);*/ break;
1500       case CTRL_FCPITCH: updateFcPitch(val); break;
1501       case CTRL_FCAMPLITUDE: updateFcAmplitude(val); break;
1502       case CTRL_CHANNELENABLE:
1503 	if(ch == _currentChannel) updateChannelEnable(val);
1504 	break;
1505       case CTRL_CHANNELDETUNE: updateChannelDetune(val); break;
1506       case CTRL_CHANNELPAN: updateChannelPan(val); break;
1507       case CTRL_CHANNELVOLUME: updateChannelVolume(val); break;
1508       case CTRL_NBRVOICES: updateNbrVoices(val); break;
1509       case CTRL_FINEBRIGHTNESS: updateBrightness(val); break;
1510       case MusECore::CTRL_ATTACK_TIME: updateAttack(val); break;
1511       case MusECore::CTRL_RELEASE_TIME: updateRelease(val); break;
1512       case MusECore::CTRL_CHORUS_SEND: updateChannelChorus(val); break;
1513       case MusECore::CTRL_REVERB_SEND: updateChannelReverb(val); break;
1514       case MusECore::CTRL_VARIATION_SEND: updateChannelDelay(val); break;
1515       case MusECore::CTRL_MODULATION: updateModulation(val); break;
1516       case MusECore::CTRL_PROGRAM :
1517 	int hbank = (val & 0xff0000) >> 16;
1518 	int lbank = (val & 0xff00) >> 8;
1519 	if (hbank > 127)  // map "dont care" to 0
1520 	  hbank = 0;
1521 	if (lbank > 127)
1522 	  lbank = 0;
1523 	int prog  = val & 0x7f;
1524 	//printf("GUI program : ch = %d, hbank = %d, lbank = %d, prog = %d\n",
1525 	//       ch, hbank, lbank, prog);
1526 	//change the _deicsonze preset
1527 	//to update the right preset
1528 	_deicsOnze->programSelect(ch, hbank, lbank, prog);
1529 	//only display _deicsonze preset
1530 	updateSelectPreset(hbank, lbank, prog);
1531 	updatePreset();
1532 	break;
1533       }
1534     }
1535   }
1536   // Sysexes
1537   else if (ev.type() == MusECore::ME_SYSEX) {
1538     //printf("MusECore::ME_SYSEX\n");
1539     const unsigned char* data = ev.constData();
1540 
1541     const int cmd = *data;
1542     float f;
1543     switch (cmd) {
1544     case SYSEX_CHORUSACTIV :
1545       updateChorusActiv((bool)data[1]);
1546       break;
1547     case SYSEX_CHORUSRETURN :
1548       updateChorusReturn((int)data[1]);
1549       break;
1550     case SYSEX_REVERBACTIV :
1551       updateReverbActiv((bool)data[1]);
1552       break;
1553     case SYSEX_REVERBRETURN :
1554       updateReverbReturn((int)data[1]);
1555       break;
1556       /*case SYSEX_CHORUS1PAN :
1557       updatePanChorus1((int)data[1]);
1558       break;
1559     case SYSEX_CHORUS1LFOFREQ :
1560       updateLFOFreqChorus1((int)data[1]);
1561       break;
1562     case SYSEX_CHORUS1DEPTH :
1563       updateDepthChorus1((int)data[1]);
1564       break;
1565     case SYSEX_CHORUS2PAN :
1566       updatePanChorus2((int)data[1]);
1567       break;
1568     case SYSEX_CHORUS2LFOFREQ :
1569       updateLFOFreqChorus2((int)data[1]);
1570       break;
1571     case SYSEX_CHORUS2DEPTH :
1572       updateDepthChorus2((int)data[1]);
1573       break;*/
1574     case SYSEX_DELAYACTIV :
1575       updateDelayActiv((bool)data[1]);
1576       break;
1577     case SYSEX_DELAYRETURN :
1578       updateDelayReturn((int)data[1]);
1579       break;
1580     case SYSEX_DELAYBPM :
1581       memcpy(&f, &data[1], sizeof(float));
1582       updateDelayBPM(f);
1583       break;
1584     case SYSEX_DELAYBEATRATIO :
1585       memcpy(&f, &data[1], sizeof(float));
1586       updateDelayBeatRatio(f);
1587       break;
1588     case SYSEX_DELAYFEEDBACK :
1589       memcpy(&f, &data[1], sizeof(float));
1590       updateDelayFeedback(f);
1591       break;
1592     case SYSEX_DELAYLFOFREQ :
1593       memcpy(&f, &data[1], sizeof(float));
1594       updateDelayPanLFOFreq(f);
1595       break;
1596     case SYSEX_DELAYLFODEPTH :
1597       memcpy(&f, &data[1], sizeof(float));
1598       updateDelayPanLFODepth(f);
1599       break;
1600     case SYSEX_DELAYWETDRYMIX :
1601       memcpy(&f, &data[1], sizeof(float));
1602       //updateDelayPanDryWet(f);
1603       break;
1604     case SYSEX_QUALITY :
1605       updateQuality((int)data[1]);
1606       break;
1607     case SYSEX_FILTER :
1608       updateFilter((bool)data[1]);
1609       break;
1610     case SYSEX_FONTSIZE :
1611       updateFontSize((int)data[1]);
1612       applyFontSize((int)data[1]);
1613       break;
1614     case SYSEX_MASTERVOL :
1615       updateMasterVolume((int)data[1]);
1616       break;
1617     case SYSEX_SAVECONFIG :
1618       updateSaveConfig((bool)data[1]);
1619       break;
1620     case SYSEX_SAVEONLYUSED :
1621       updateSaveOnlyUsed((bool)data[1]);
1622       break;
1623     case SYSEX_COLORGUI :
1624       tColor->setRgb(data[1], data[2], data[3]);
1625       bColor->setRgb(data[4], data[5], data[6]);
1626       etColor->setRgb(data[7], data[8], data[9]);
1627       ebColor->setRgb(data[10], data[11], data[12]);
1628       setTextColor(reinterpret_cast<const QColor &>(*tColor));
1629       setBackgroundColor(reinterpret_cast<const QColor &>(*bColor));
1630       setEditTextColor(reinterpret_cast<const QColor &>(*etColor));
1631       setEditBackgroundColor(reinterpret_cast<const QColor &>(*ebColor));
1632       setRGBSliders(colorListBox->currentItem());
1633       break;
1634     case SYSEX_ISINITSET :
1635       updateInitSetCheckBox((bool)data[1]);
1636       break;
1637     case SYSEX_INITSETPATH :
1638       updateInitSetPath(QString((char*)&data[1]));
1639       break;
1640     case SYSEX_ISBACKGROUNDPIX :
1641       updateBackgroundPixCheckBox((bool)data[1]);
1642       if((bool)data[1]) applyBackgroundPix();
1643       break;
1644     case SYSEX_BACKGROUNDPIXPATH :
1645       updateBackgroundPixPath(QString((char*)&data[1]));
1646       break;
1647     case SYSEX_UPDATESETGUI :
1648       setSet();
1649       subcategoryListView->clear();
1650       presetListView->clear();
1651       updateCategoryName("NONE", false);
1652       hbankSpinBox->setEnabled(false);
1653       updatePreset();
1654       updateSubcategoryName("NONE", false);
1655       progSpinBox->setEnabled(false);
1656       updatePresetName("INITVOICE", false);
1657       break;
1658     case SYSEX_BUILDGUIREVERB :
1659       buildGuiReverb();
1660       break;
1661     case SYSEX_BUILDGUICHORUS :
1662       buildGuiChorus();
1663       break;
1664     case SYSEX_LOADSET :
1665       //printf("LoadSet\n");
1666       // read the XML file and create DOM tree
1667       /*QString filename = (const char*) (data+2);
1668       QFile deicsonzeFile(filename);
1669       deicsonzeFile.open(IO_ReadOnly);
1670       QDomDocument domTree;
1671       domTree.setContent(&deicsonzeFile);
1672       deicsonzeFile.close();
1673       QDomNode node = domTree.documentElement();
1674 
1675       printf("After XML\n");
1676       while (!node.isNull()) {
1677 	QDomElement e = node.toElement();
1678 	if (e.isNull())
1679 	  continue;
1680 	if (e.tagName() == "deicsOnzeSet") {
1681 	  QString version = e.attribute(QString("version"));
1682 	  if (version == "1.0") {
1683 	  _deicsOnze->_preset=_deicsOnze->_initialPreset;*/
1684       //read the set
1685       if((bool)data[1]) {
1686 	//printf("Mini\n");
1687 	updateSaveOnlyUsed(true);
1688       }
1689       else {
1690 	//printf("Huge\n");
1691 	//while(!_deicsOnze->_set->_categoryVector.empty())
1692 	//  delete(*_deicsOnze->_set->_categoryVector.begin());
1693 	updateSaveOnlyUsed(false);
1694       }
1695       //_deicsOnze->_set->readSet(node.firstChild());
1696       //display load preset
1697       setSet();
1698       /*}
1699 	  else printf("Wrong set version : %s\n",
1700 		      version.toLatin1().constData());
1701 	}
1702 	node = node.nextSibling();
1703       }
1704       break;
1705       // delete the temporary file created
1706       QString rmfile;
1707       rmfile="rm ";
1708       rmfile+=filename;
1709       system(rmfile);
1710       printf("Finit\n");*/
1711     }
1712   }
1713 }
1714 
1715 /*!
1716     \fn SimpleSynthGui::readMessage()
1717  */
readMessage()1718 void DeicsOnzeGui::readMessage()
1719 {
1720     MessGui::readMessage();
1721 }
1722 
1723 //-----------------------------------------------------------
1724 // num3Digits(int n)
1725 //-----------------------------------------------------------
num3Digits(int n)1726 QString DeicsOnzeGui::num3Digits(int n) {
1727     QString sn=QString::number(n);
1728     return(sn.length()==1?"00"+sn:(sn.length()==2?"0"+sn:sn));
1729 }
1730 
1731 //-----------------------------------------------------------
1732 // deleteSet
1733 //-----------------------------------------------------------
deleteSetDialog()1734 void DeicsOnzeGui::deleteSetDialog() {
1735   //TODO : maybe to put this in sysex to deicsonze.cpp
1736   for(int c = 0; c < NBRCHANNELS; c++)
1737     _deicsOnze->_preset[c]=_deicsOnze->_initialPreset;
1738   while(!_deicsOnze->_set->_categoryVector.empty())
1739     delete(*_deicsOnze->_set->_categoryVector.begin());
1740   setSet();
1741   //_currentQLVCategory = NULL;
1742   presetListView->clear();
1743   subcategoryListView->clear();
1744   updateCategoryName("NONE", false);
1745   hbankSpinBox->setEnabled(false);
1746   updateSubcategoryName("NONE", false);
1747   lbankSpinBox->setEnabled(false);
1748   updatePresetName("INITVOICE", false);
1749   progSpinBox->setEnabled(false);
1750   updatePreset();
1751 }
1752 //-----------------------------------------------------------
1753 // loadSetDialog
1754 //-----------------------------------------------------------
loadSetDialog()1755 void DeicsOnzeGui::loadSetDialog() {
1756   QString fileName =
1757     QFileDialog::getOpenFileName(
1758 				 this,
1759 				 tr("Load set dialog"),
1760 				 lastDir,
1761 				 QString("*.dei")
1762 				 );
1763 
1764   // read the XML file and create DOM tree
1765   if(!fileName.isEmpty()) {
1766     QFileInfo fi(fileName);
1767     lastDir = fi.path();
1768     QFile deicsonzeFile(fileName);
1769     if(!deicsonzeFile.open(QIODevice::ReadOnly)) {
1770       QMessageBox::critical(0,
1771 			    tr("Critical Error"),
1772 			    tr("Cannot open file %1").arg(fileName));
1773       return;
1774     }
1775     QDomDocument domTree;
1776     if (!domTree.setContent(&deicsonzeFile )) {
1777       QMessageBox::critical
1778 	(0, tr("Critical Error"),
1779 	 tr("Parsing error for file %1").arg(fileName));
1780       deicsonzeFile.close();
1781       return;
1782     }
1783     deicsonzeFile.close();
1784 
1785     QDomNode node = domTree.documentElement();
1786     while (!node.isNull()) {
1787       QDomElement e = node.toElement();
1788       if (e.isNull())
1789 	continue;
1790       if (e.tagName() == "deicsOnzeSet") {
1791 	QString version = e.attribute(QString("version"));
1792 	if (version == "1.0") {
1793 	  for(int c = 0; c < NBRCHANNELS; c++)
1794 	    _deicsOnze->_preset[c]=_deicsOnze->_initialPreset;
1795 	  while(!_deicsOnze->_set->_categoryVector.empty())
1796 	    delete(*_deicsOnze->_set->_categoryVector.begin());
1797 	  _deicsOnze->_set->readSet(node.firstChild());
1798 	  //display load preset
1799 	  setSet();
1800 	  subcategoryListView->clear();
1801 	  presetListView->clear();
1802 	  updateCategoryName("NONE", false);
1803 	  hbankSpinBox->setEnabled(false);
1804 	  updatePreset();
1805 	  updateSubcategoryName("NONE", false);
1806 	  progSpinBox->setEnabled(false);
1807 	  updatePresetName("INITVOICE", false);
1808 	}
1809 	else printf("unsupported *.dei file version %s\n",
1810 		    version.toLatin1().constData());
1811       }
1812       else printf("DeicsOnze: %s not supported\n",
1813 		  e.tagName().toLatin1().constData());
1814       node = node.nextSibling();
1815     }
1816   }
1817 }
1818 
1819 //-----------------------------------------------------------
1820 // saveSetDialog
1821 //-----------------------------------------------------------
saveSetDialog()1822 void DeicsOnzeGui::saveSetDialog() {
1823   QString filename =
1824     QFileDialog::getSaveFileName(
1825 				 this,
1826 				 tr("Save set dialog"),
1827 				 lastDir,
1828 				 QString("*.dei"));
1829   if(!filename.isEmpty()) {
1830     QFileInfo fi(filename);
1831     lastDir = fi.path();
1832     if(!filename.endsWith(".dei")) filename+=".dei";
1833     QFile f(filename);
1834     f.open(QIODevice::WriteOnly);
1835 
1836     AL::Xml* xml = new AL::Xml(&f);
1837     xml->header();
1838     _deicsOnze->_set->writeSet(xml, false);
1839 
1840     f.close();
1841   }
1842 }
1843 
1844 //-----------------------------------------------------------
1845 // popupMenuCategory
1846 //-----------------------------------------------------------
categoryPopupMenu(const QPoint &)1847 void DeicsOnzeGui::categoryPopupMenu(const QPoint&) {
1848   QTreeWidgetItem* cat = categoryListView->currentItem();
1849   QMenu *categoryMenu = new QMenu;
1850   categoryMenu->addAction(tr("New category"),
1851 			  this, SLOT(newCategoryDialog()));
1852   QAction* deleteItem = categoryMenu->addAction(tr("Delete category"), this,
1853 						SLOT(deleteCategoryDialog()));
1854   categoryMenu->addAction(tr("Load category"),
1855 			  this, SLOT(loadCategoryDialog()));
1856   QAction* saveItem = categoryMenu->addAction(tr("Save category"), this,
1857 					      SLOT(saveCategoryDialog()));
1858   if(!cat || !cat->isSelected()) {
1859     deleteItem->setEnabled(false);
1860     saveItem->setEnabled(false);
1861   }
1862   categoryMenu->addSeparator();
1863   categoryMenu->addAction(tr("Load set"),
1864 			  this, SLOT(loadSetDialog()));;
1865   categoryMenu->addAction(tr("Save set"),
1866 			  this, SLOT(saveSetDialog()));;
1867   categoryMenu->addAction(tr("Delete set"),
1868 			  this, SLOT(deleteSetDialog()));;
1869   categoryMenu->exec(QCursor::pos());
1870   delete categoryMenu; // Tim.
1871 }
subcategoryPopupMenu(const QPoint &)1872 void DeicsOnzeGui::subcategoryPopupMenu(const QPoint&) {
1873   QTreeWidgetItem* sub = subcategoryListView->currentItem();
1874   QMenu *subcategoryMenu = new QMenu;
1875   QAction* newItem =
1876     subcategoryMenu->addAction(tr("New subcategory"), this,
1877 			       SLOT(newSubcategoryDialog()));
1878   QAction* deleteItem =
1879     subcategoryMenu->addAction(tr("Delete subcategory"),
1880 			       this, SLOT(deleteSubcategoryDialog()));
1881   QAction* loadItem =
1882     subcategoryMenu->addAction(tr("Load subcategory"), this,
1883 			       SLOT(loadSubcategoryDialog()));
1884   QAction* saveItem =
1885     subcategoryMenu->addAction(tr("Save subcategory"), this,
1886 			       SLOT(saveSubcategoryDialog()));
1887   if(!sub || !sub->isSelected()) {
1888     deleteItem->setEnabled(false);
1889     saveItem->setEnabled(false);
1890   }
1891   if(!categoryListView->currentItem()
1892      || !categoryListView->currentItem()->isSelected()) {
1893     newItem->setEnabled(false);
1894     loadItem->setEnabled(false);
1895   }
1896   subcategoryMenu->exec(QCursor::pos());
1897   delete subcategoryMenu; // Tim.
1898 }
presetPopupMenu(const QPoint &)1899 void DeicsOnzeGui::presetPopupMenu(const QPoint&) {
1900   QTreeWidgetItem* pre = presetListView->currentItem();
1901   QMenu *presetMenu = new QMenu;
1902   QAction* newItem = presetMenu->addAction(tr("New preset"), this,
1903 					   SLOT(newPresetDialog()));
1904   QAction* deleteItem = presetMenu->addAction(tr("Delete preset"), this,
1905 					      SLOT(deletePresetDialog()));
1906   QAction* loadItem = presetMenu->addAction(tr("Load preset"), this,
1907 					    SLOT(loadPresetDialog()));
1908   QAction* saveItem = presetMenu->addAction(tr("Save preset"), this,
1909 					    SLOT(savePresetDialog()));
1910   if(!pre || !pre->isSelected()) {
1911     deleteItem->setEnabled(false);
1912     saveItem->setEnabled(false);
1913   }
1914   if(!subcategoryListView->currentItem() ||
1915      !subcategoryListView->currentItem()->isSelected()){
1916     newItem->setEnabled(false);
1917     loadItem->setEnabled(false);
1918   }
1919   presetMenu->exec(QCursor::pos());
1920   delete presetMenu;   // Tim.
1921 }
1922 
1923 //-----------------------------------------------------------
1924 // newCategoryDialog
1925 //-----------------------------------------------------------
newCategoryDialog()1926 void DeicsOnzeGui::newCategoryDialog() {
1927     int nhbank=_deicsOnze->_set->firstFreeHBank();
1928     if(nhbank==-1)
1929 	QMessageBox::information(this,
1930 				 tr("No more category supported"),
1931 				 tr("You can not add more categories"),
1932 				 QMessageBox::Ok);
1933     else {
1934 	new Category(_deicsOnze->_set, "NEWCAT", nhbank);
1935 	setSet();
1936 	QTreeWidgetItem* ci=
1937 	    categoryListView->findItems(num3Digits(nhbank+1), Qt::MatchExactly).at(0);
1938 	ci->setSelected(true);
1939 	categoryListView->setCurrentItem(ci);
1940 	setCategory(ci);
1941 	categoryListView->scrollToItem(ci);
1942     }
1943 }
1944 
1945 //-----------------------------------------------------------
1946 // deleteCategoryDialog
1947 //-----------------------------------------------------------
deleteCategoryDialog()1948 void DeicsOnzeGui::deleteCategoryDialog() {
1949   QTreeCategory* cat = (QTreeCategory*) categoryListView->currentItem();
1950   if(cat && cat->isSelected()) {
1951     if(!QMessageBox::question(
1952 			      this,
1953 			      tr("Delete category"),
1954 			      tr("Do you really want to delete %1 ?")
1955 			      .arg(cat->_category->_categoryName.c_str()),
1956 			      tr("&Yes"), tr("&No"),
1957 			      QString(), 0, 1 ))
1958       {
1959 	for(int c = 0; c < NBRCHANNELS; c++)
1960 	  _deicsOnze->_preset[c]=_deicsOnze->_initialPreset;
1961 	delete(cat->_category);
1962 	delete(cat);
1963 	subcategoryListView->clear();
1964 	presetListView->clear();
1965 	updateCategoryName("NONE", false);
1966 	hbankSpinBox->setEnabled(false);
1967 	updatePreset();
1968 	updateSubcategoryName("NONE", false);
1969 	progSpinBox->setEnabled(false);
1970 	updatePresetName("INITVOICE", false);
1971       }
1972   }
1973   else QMessageBox::warning(this, tr("No category selected"),
1974 			    tr("You must first select a category."));
1975 }
1976 
1977 //-----------------------------------------------------------
1978 // loadCategoryDialog
1979 //-----------------------------------------------------------
loadCategoryDialog()1980 void DeicsOnzeGui::loadCategoryDialog() {
1981   QString buffstr;
1982   QString fileName =
1983     QFileDialog::getOpenFileName(
1984 				 this,
1985 				 tr("Load category dialog"),
1986 				 lastDir,
1987 				 QString("*.dec"));
1988 
1989   // read the XML file and create DOM tree
1990   if(!fileName.isEmpty()) {
1991     QFileInfo fi(fileName);
1992     lastDir = fi.path();
1993     QFile deicsonzeFile(fileName);
1994     if(!deicsonzeFile.open(QIODevice::ReadOnly)) {
1995       QMessageBox::critical(0,
1996 			    tr("Critical Error"),
1997 			    tr("Cannot open file %1").arg(fileName));
1998       return;
1999     }
2000     QDomDocument domTree;
2001     if (!domTree.setContent(&deicsonzeFile )) {
2002       QMessageBox::critical
2003 	(0, tr("Critical Error"),
2004 	 tr("Parsing error for file %1").arg(fileName));
2005       deicsonzeFile.close();
2006       return;
2007     }
2008     deicsonzeFile.close();
2009 
2010     QDomNode node = domTree.documentElement();
2011     while (!node.isNull()) {
2012       QDomElement e = node.toElement();
2013       if (e.isNull())
2014 	continue;
2015       if (e.tagName() == "deicsOnzeCategory") {
2016 	QString version = e.attribute(QString("version"));
2017 	if (version == "1.0") {
2018 	  Category* lCategory = new Category();
2019 	  lCategory->readCategory(node.firstChild());
2020 	  if (!_deicsOnze->_set->isFreeHBank(lCategory->_hbank)) {
2021 	    if(!QMessageBox::question(
2022 				      this,
2023 				      tr("Replace or add"),
2024 				      tr("%1 is supposed to be affected to the hbank number %2, but there is already one on this slot.\n Do you want to replace it or to add it in the next free slot ?")
2025 				      .arg((lCategory->_categoryName).c_str())
2026 				      .arg(buffstr.setNum(lCategory->_hbank+1)),
2027 				      tr("&Replace"), tr("&Add"),
2028 				      QString(), 0, 1 )) {
2029 	      delete(_deicsOnze->_set
2030 		     ->findCategory(lCategory->_hbank));
2031 	      lCategory->linkSet(_deicsOnze->_set);
2032 	    }
2033 	    else {
2034 	      int ffhb=_deicsOnze->_set->firstFreeHBank();
2035 	      if(ffhb==-1)
2036 		QMessageBox::warning
2037 		  (this, tr("Download error"),
2038 		   tr("There is no more free category slot."));
2039 	      else lCategory->_hbank=ffhb;
2040 	      lCategory->linkSet(_deicsOnze->_set);
2041 	    }
2042 	  }
2043 	  else lCategory->linkSet(_deicsOnze->_set);
2044 	  //display category
2045 	  setSet();
2046 	}
2047 	else printf("unsupported *.dec file version %s\n",
2048 		    version.toLatin1().constData());
2049       }
2050       else printf("DeicsOnze: %s not supported\n",
2051 		  e.tagName().toLatin1().constData());
2052       node = node.nextSibling();
2053     }
2054   }
2055 }
2056 
2057 //-----------------------------------------------------------
2058 // saveCategoryDialog
2059 //-----------------------------------------------------------
saveCategoryDialog()2060 void DeicsOnzeGui::saveCategoryDialog() {
2061   QTreeCategory* cat = (QTreeCategory*) categoryListView->currentItem();
2062   if(cat) {
2063     QString filename =
2064       QFileDialog::getSaveFileName(
2065 				   this,
2066 				   tr("Save category dialog"),
2067 				   lastDir,
2068 				   QString("*.dec"));
2069 
2070     if(!filename.isEmpty()) {
2071       QFileInfo fi(filename);
2072       lastDir = fi.path();
2073       if(!filename.endsWith(".dec")) filename+=".dec";
2074       QFile f(filename);
2075       f.open(QIODevice::WriteOnly);
2076       AL::Xml* xml = new AL::Xml(&f);
2077       xml->header();
2078       cat->_category->writeCategory(xml, false);
2079 
2080       f.close();
2081     }
2082   }
2083   else QMessageBox::warning(this, tr("No category selected"),
2084 			    tr("You must first select a category."));
2085 }
2086 
2087 //-----------------------------------------------------------
2088 // newSubcategoryDialog
2089 //-----------------------------------------------------------
newSubcategoryDialog()2090 void DeicsOnzeGui::newSubcategoryDialog() {
2091   QTreeCategory* cat = (QTreeCategory*) categoryListView->currentItem();
2092   if(cat && cat->isSelected()) {
2093     int nlbank=cat->_category->firstFreeLBank();
2094     if(nlbank==-1)
2095       QMessageBox::information(this,
2096 			       tr("No more subcategory supported"),
2097 			       tr("You can not add more subcategories"),
2098 			       QMessageBox::Ok);
2099     else {
2100       new Subcategory(cat->_category, "NEWSUB", nlbank);
2101       setCategory(cat);
2102       QTreeWidgetItem* si=
2103 	subcategoryListView->findItems(num3Digits(nlbank+1),
2104 				       Qt::MatchExactly).at(0);
2105       si->setSelected(true);
2106       subcategoryListView->setCurrentItem(si);
2107       setSubcategory(si);
2108       subcategoryListView->scrollToItem(si);
2109     }
2110   }
2111 }
2112 
2113 //-----------------------------------------------------------
2114 // deleteSubcategoryDialog
2115 //-----------------------------------------------------------
deleteSubcategoryDialog()2116 void DeicsOnzeGui::deleteSubcategoryDialog() {
2117   QTreeSubcategory* sub =
2118     (QTreeSubcategory*) subcategoryListView->currentItem();
2119   if(sub && sub->isSelected()) {
2120     if(!QMessageBox::question(
2121 			      this,
2122 			      tr("Delete subcategory"),
2123 			      tr("Do you really want to delete %1 ?")
2124 			      .arg(sub->_subcategory
2125 				   ->_subcategoryName.c_str()),
2126 			      tr("&Yes"), tr("&No"),
2127 			      QString(), 0, 1 )) {
2128       	for(int c = 0; c < NBRCHANNELS; c++)
2129 	  _deicsOnze->_preset[c]=_deicsOnze->_initialPreset;
2130       delete(sub->_subcategory);
2131       delete(sub);
2132       presetListView->clear();
2133       //subcategoryLineEdit->setEnabled(false);
2134       updateSubcategoryName("NONE", false);
2135       lbankSpinBox->setEnabled(false);
2136       updatePreset();
2137     }
2138   }
2139   else QMessageBox::warning(this, tr("No subcategory selected"),
2140 			    tr("You must first select a subcategory."));
2141 }
2142 
2143 //-----------------------------------------------------------
2144 // loadSubcategoryDialog
2145 //-----------------------------------------------------------
loadSubcategoryDialog()2146 void DeicsOnzeGui::loadSubcategoryDialog() {
2147   QTreeCategory* cat = (QTreeCategory*) categoryListView->currentItem();
2148   QString buffstr;
2149   QString fileName =
2150     QFileDialog::getOpenFileName(
2151 				 this,
2152 				 tr("Load subcategory dialog"),
2153 				 lastDir,
2154 				 QString("*.des"));
2155 
2156   // read the XML file and create DOM tree
2157   if(!fileName.isEmpty()) {
2158     QFileInfo fi(fileName);
2159     lastDir = fi.path();
2160     QFile deicsonzeFile(fileName);
2161     if(!deicsonzeFile.open(QIODevice::ReadOnly)) {
2162       QMessageBox::critical(0,
2163 			    tr("Critical Error"),
2164 			    tr("Cannot open file %1").arg(fileName));
2165       return;
2166     }
2167     QDomDocument domTree;
2168     if (!domTree.setContent(&deicsonzeFile )) {
2169       QMessageBox::critical
2170 	(0, tr("Critical Error"),
2171 	 tr("Parsing error for file %1").arg(fileName));
2172       deicsonzeFile.close();
2173       return;
2174     }
2175     deicsonzeFile.close();
2176 
2177     QDomNode node = domTree.documentElement();
2178     while (!node.isNull()) {
2179       QDomElement e = node.toElement();
2180       if (e.isNull())
2181 	continue;
2182       if (e.tagName() == "deicsOnzeSubcategory") {
2183 	QString version = e.attribute(QString("version"));
2184 	if (version == "1.0") {
2185 	  Subcategory* lSubcategory = new Subcategory();
2186 	  lSubcategory->readSubcategory(node.firstChild());
2187 	  if (!cat->_category->isFreeLBank(lSubcategory->_lbank)) {
2188 	    if(!QMessageBox::question(
2189 				      this,
2190 				      tr("Replace or add"),
2191 				      tr("%1 is supposed to be affected to the lbank number %2, but there is already one on this slot.\n Do you want to replace it or to add it in the next free slot ?")
2192 				      .arg((lSubcategory->_subcategoryName)
2193 					   .c_str())
2194 				      .arg(buffstr.setNum(lSubcategory->_lbank+1)),
2195 				      tr("&Replace"), tr("&Add"),
2196 				      QString(), 0, 1 )) {
2197 	      delete(cat->_category->findSubcategory(lSubcategory->_lbank));
2198 	      lSubcategory->linkCategory(cat->_category);
2199 	    }
2200 	    else {
2201 	      int fflb=cat->_category->firstFreeLBank();
2202 	      if(fflb==-1)
2203 		QMessageBox::warning
2204 		  (this, tr("Download error"),
2205 		   tr("There is no more free subcategory slot."));
2206 	      else lSubcategory->_lbank=fflb;
2207 	      lSubcategory->linkCategory(cat->_category);
2208 	    }
2209 	  }
2210 	  else lSubcategory->linkCategory(cat->_category);
2211 	  //display subcategory
2212 	  setCategory(cat);
2213 	}
2214 	else printf("unsupported *.des file version %s\n",
2215 		    version.toLatin1().constData());
2216       }
2217       else printf("DeicsOnze: %s not supported\n",
2218 		  e.tagName().toLatin1().constData());
2219       node = node.nextSibling();
2220     }
2221   }
2222 }
2223 
2224 //-----------------------------------------------------------
2225 // saveSubcategoryDialog
2226 //-----------------------------------------------------------
saveSubcategoryDialog()2227 void DeicsOnzeGui::saveSubcategoryDialog() {
2228   QTreeSubcategory* sub =
2229     (QTreeSubcategory*) subcategoryListView->currentItem();
2230   if(sub) {
2231     QString filename =
2232       QFileDialog::getSaveFileName(
2233 				   this,
2234 				   tr("Save subcategory dialog"),
2235 				   lastDir,
2236 				   QString("*.des"));
2237 
2238     if(!filename.isEmpty()) {
2239       QFileInfo fi(filename);
2240       lastDir = fi.path();
2241       if(!filename.endsWith(".des")) filename+=".des";
2242       QFile f(filename);
2243       f.open(QIODevice::WriteOnly);
2244 
2245       AL::Xml* xml = new AL::Xml(&f);
2246       xml->header();
2247       sub->_subcategory->writeSubcategory(xml, false);
2248 
2249       f.close();
2250     }
2251   }
2252   else QMessageBox::warning(this, tr("No subcategory selected"),
2253 			    tr("You must first select a subcategory."));
2254 }
2255 
2256 
2257 //-----------------------------------------------------------
2258 // newPresetDialog
2259 //-----------------------------------------------------------
newPresetDialog()2260 void DeicsOnzeGui::newPresetDialog() {
2261   QTreeSubcategory* sub =
2262     (QTreeSubcategory*) subcategoryListView->currentItem();
2263   if(sub && sub->isSelected()) {
2264     int nprog=sub->_subcategory->firstFreeProg();
2265     if(nprog==-1)
2266       QMessageBox::information(this,
2267 			       tr("No more preset supported"),
2268 			       tr("You can not add more presets"),
2269 			       QMessageBox::Ok);
2270     else {
2271       new Preset(sub->_subcategory, nprog);
2272       setSubcategory(sub);
2273       QTreeWidgetItem* pi=
2274 	presetListView->findItems(num3Digits(nprog+1),
2275 				  Qt::MatchExactly).at(0);
2276       pi->setSelected(true);
2277       presetListView->setCurrentItem(pi);
2278       setPreset(pi);
2279       presetListView->scrollToItem(pi);
2280     }
2281   }
2282 }
2283 
2284 //-----------------------------------------------------------
2285 // deletePresetDialog
2286 //-----------------------------------------------------------
deletePresetDialog()2287 void DeicsOnzeGui::deletePresetDialog() {
2288   QTreePreset* pre = (QTreePreset*) presetListView->currentItem();
2289   if(pre) {
2290     if(pre->isSelected()) {
2291       if(!QMessageBox::question(
2292 				this,
2293 				tr("Delete preset"),
2294 				tr("Do you really want to delete %1 ?")
2295 				.arg(pre->_preset->name.c_str()),
2296 				tr("&Yes"), tr("&No"),
2297 				QString(), 0, 1 )) {
2298 	for(int c = 0; c < NBRCHANNELS; c++)
2299 	  _deicsOnze->_preset[c]=_deicsOnze->_initialPreset;
2300 	delete(pre->_preset);
2301 	delete(pre);
2302 	presetLineEdit->setEnabled(false);
2303 	progSpinBox->setEnabled(false);
2304 	updatePreset();
2305       }
2306     }
2307     else QMessageBox::warning(this, tr("No preset selected"),
2308 			      tr("You must first select a preset."));
2309   }
2310   else QMessageBox::warning(this, tr("No preset selected"),
2311 			    tr("You must first select a preset."));
2312 }
2313 
2314 //-----------------------------------------------------------
2315 // loadPresetDialog
2316 //-----------------------------------------------------------
loadPresetDialog()2317 void DeicsOnzeGui::loadPresetDialog() {
2318   QTreeSubcategory* sub =
2319     (QTreeSubcategory*) subcategoryListView->currentItem();
2320   QString buffstr;
2321   QString fileName =
2322     QFileDialog::getOpenFileName(
2323 				 this,
2324 				 tr("Load preset dialog"),
2325 				 lastDir,
2326 				 QString("*.dep"));
2327 
2328   // read the XML file and create DOM tree
2329   if(!fileName.isEmpty()) {
2330     QFileInfo fi(fileName);
2331     lastDir = fi.path();
2332     QFile deicsonzeFile(fileName);
2333     if(!deicsonzeFile.open(QIODevice::ReadOnly)) {
2334       QMessageBox::critical(0,
2335 			    tr("Critical Error"),
2336 			    tr("Cannot open file %1").arg(fileName));
2337       return;
2338     }
2339     QDomDocument domTree;
2340     if (!domTree.setContent(&deicsonzeFile )) {
2341       QMessageBox::critical
2342 	(0, tr("Critical Error"),
2343 	 tr("Parsing error for file %1").arg(fileName));
2344       deicsonzeFile.close();
2345       return;
2346     }
2347     deicsonzeFile.close();
2348 
2349     QDomNode node = domTree.documentElement();
2350     while (!node.isNull()) {
2351       QDomElement e = node.toElement();
2352       if(e.isNull())
2353 	continue;
2354       if(e.tagName() == "deicsOnzePreset") {
2355 	QString version = e.attribute(QString("version"));
2356 	if (version == "1.0") {
2357 	  Preset* lPreset = new Preset();
2358 	  lPreset->readPreset(node.firstChild());
2359 	  if(!sub->_subcategory->isFreeProg(lPreset->prog)) {
2360 	    if(!QMessageBox::question(
2361 				      this,
2362 				      tr("Replace or add"),
2363 				      tr("%1 is supposed to be affected to the prog number %2, but there is already one on this slot.\n Do you want to replace it or to add it in the next free slot ?")
2364 				      .arg((lPreset->name).c_str())
2365 				      .arg(buffstr.setNum(lPreset->prog+1)),
2366 				      tr("&Replace"), tr("&Add"),
2367 				      QString(), 0, 1 )) {
2368 	      delete(sub->_subcategory->findPreset(lPreset->prog));
2369 	      lPreset->linkSubcategory(sub->_subcategory);
2370 	    }
2371 	    else {
2372 	      int ffp=sub->_subcategory->firstFreeProg();
2373 	      if(ffp==-1)
2374 		QMessageBox::warning
2375 		  (this, tr("Download error"),
2376 		   tr("There is no more free preset slot."));
2377 	      else lPreset->prog=ffp;
2378 	      lPreset->linkSubcategory(sub->_subcategory);
2379 	    }
2380 	  }
2381 	  else lPreset->linkSubcategory(sub->_subcategory);
2382 	  //display preset
2383 	  setSubcategory(sub->_subcategory);
2384 	}
2385 	else printf("unsupported *.dep file version %s\n",
2386 		    version.toLatin1().constData());
2387       }
2388       else printf("DeicsOnze: %s not supported\n",
2389 		  e.tagName().toLatin1().constData());
2390       node = node.nextSibling();
2391     }
2392   }
2393 }
2394 
2395 
2396 //-----------------------------------------------------------
2397 // savePresetDialog
2398 //-----------------------------------------------------------
savePresetDialog()2399 void DeicsOnzeGui::savePresetDialog() {
2400   QTreePreset* pre = (QTreePreset*) presetListView->currentItem();
2401   if(pre) {
2402     QString filename =
2403       QFileDialog::getSaveFileName(
2404 				   this,
2405 				   tr("Save preset dialog"),
2406 				   lastDir,
2407 				   QString("*.dep"));
2408     if(!filename.isEmpty()) {
2409       QFileInfo fi(filename);
2410       lastDir = fi.path();
2411       if(!filename.endsWith(".dep")) filename+=".dep";
2412       QFile f(filename);
2413       f.open(QIODevice::WriteOnly);
2414       AL::Xml* xml = new AL::Xml(&f);
2415 
2416       xml->header();
2417       pre->_preset->writePreset(xml, false);
2418       f.close();
2419     }
2420   }
2421   else QMessageBox::warning(this, tr("No preset selected"),
2422 			    tr("You must first select a preset."));
2423 }
2424 
2425 //-----------------------------------------------------------
2426 // Preset and bank
2427 //-----------------------------------------------------------
setPresetName(const QString & n)2428 void DeicsOnzeGui::setPresetName(const QString& n) {
2429   QTreeWidgetItem* pre = presetListView->currentItem();
2430   if(pre) {
2431     //TODO : must be changed with SysEx
2432     _deicsOnze->_preset[_currentChannel]->name = n.toLatin1().data();
2433     pre->setText(1,n.toLatin1().data());
2434   }
2435 }
setSubcategoryName(const QString & s)2436 void DeicsOnzeGui::setSubcategoryName(const QString& s) {
2437   QTreeSubcategory* sub =
2438     (QTreeSubcategory*) subcategoryListView->currentItem();
2439   if(sub) {//must be changed with SysEx
2440     sub->_subcategory->_subcategoryName=s.toLatin1().data();
2441     sub->setText(1, s.toLatin1().data());
2442   }
2443 }
setCategoryName(const QString & c)2444 void DeicsOnzeGui::setCategoryName(const QString& c) {
2445   QTreeCategory* cat = (QTreeCategory*) categoryListView->currentItem();
2446   if(cat) {//must be changed with SysEx
2447     cat->_category->_categoryName=c.toLatin1().data();
2448     cat->setText(1, c.toLatin1().data());
2449   }
2450 }
setHBank(int hb)2451 void DeicsOnzeGui::setHBank(int hb) {
2452   QTreeCategory* cat = (QTreeCategory*) categoryListView->currentItem();
2453   if(cat) {//must be changed with SysEx
2454     if(!_deicsOnze->_set->isFreeHBank(hb-1)) {
2455       QTreeWidgetItem* qcat;
2456       qcat=categoryListView->findItems(num3Digits(hb), Qt::MatchExactly).at(0);
2457       ((QTreeCategory*)qcat)->_category->_hbank=
2458 	cat->_category->_hbank;
2459       qcat->setText(0, num3Digits(((QTreeCategory*)qcat)
2460 				  ->_category->_hbank+1));
2461     }
2462     cat->_category->_hbank=hb-1;
2463     cat->setText(0,num3Digits(hb));
2464     categoryListView->sortItems(0, Qt::AscendingOrder);
2465     categoryListView->scrollToItem(cat);
2466   }
2467 }
setLBank(int lb)2468 void DeicsOnzeGui::setLBank(int lb) {//must be changed with SysEx
2469   QTreeSubcategory* sub =
2470     (QTreeSubcategory*) subcategoryListView->currentItem();
2471   if(sub) {
2472     Category* currentCat=sub->_subcategory->_category;
2473     if(!currentCat->isFreeLBank(lb-1)) {
2474       QTreeWidgetItem* qsub;
2475       qsub=subcategoryListView->findItems(num3Digits(lb),
2476 					  Qt::MatchExactly).at(0);
2477       ((QTreeSubcategory*)qsub)->_subcategory->_lbank=
2478 	sub->_subcategory->_lbank;
2479       qsub->setText(0, num3Digits(((QTreeSubcategory*)qsub)
2480 				  ->_subcategory->_lbank+1));
2481     }
2482     sub->_subcategory->_lbank=lb-1;
2483     sub->setText(0,num3Digits(lb));
2484     subcategoryListView->sortItems(0, Qt::AscendingOrder);
2485     subcategoryListView->scrollToItem(sub);
2486   }
2487 }
setProg(int pr)2488 void DeicsOnzeGui::setProg(int pr) {//must be changed with SysEx
2489   QTreePreset* pre = (QTreePreset*) presetListView->currentItem();
2490   if(pre) {
2491     Subcategory* currentSub=pre->_preset->_subcategory;
2492     if(!currentSub->isFreeProg(pr-1)) {
2493       QTreeWidgetItem* qpre;
2494       qpre=presetListView->findItems(num3Digits(pr), Qt::MatchExactly).at(0);
2495       ((QTreePreset*)qpre)->_preset->prog=pre->_preset->prog;
2496       qpre->setText(0, num3Digits(((QTreePreset*)qpre)->_preset->prog+1));
2497     }
2498     pre->_preset->prog=pr-1;
2499     pre->setText(0,num3Digits(pr));
2500     presetListView->sortItems(0,Qt::AscendingOrder);
2501     presetListView->scrollToItem(pre);
2502   }
2503 }
2504 //-----------------------------------------------------------
2505 // load init set
2506 //-----------------------------------------------------------
setIsInitSet(bool b)2507 void DeicsOnzeGui::setIsInitSet(bool b) {
2508   initSetPathLineEdit->setEnabled(b);
2509   initSetBrowsePushButton->setEnabled(b);
2510   unsigned char message[4];
2511   message[0]=MUSE_SYNTH_SYSEX_MFG_ID;
2512   message[1]=DEICSONZE_UNIQUE_ID;
2513   message[2]=SYSEX_ISINITSET;
2514   message[3]=(unsigned char)b;
2515   sendSysex(message, 4);
2516 }
setInitSetPath(const QString & s)2517 void DeicsOnzeGui::setInitSetPath(const QString& s) {
2518   unsigned char message[4+MAXSTRLENGTHINITSETPATH];
2519   message[0]=MUSE_SYNTH_SYSEX_MFG_ID;
2520   message[1]=DEICSONZE_UNIQUE_ID;
2521   message[2]=SYSEX_INITSETPATH;
2522   strncpy((char*)&message[3], s.toLatin1().data(), MAXSTRLENGTHINITSETPATH);
2523   sendSysex(message, 3+MAXSTRLENGTHINITSETPATH);
2524 }
setBrowseInitSetPath()2525 void DeicsOnzeGui::setBrowseInitSetPath() {
2526   QString fileName =
2527     QFileDialog::getOpenFileName(
2528 				 this,
2529 				 tr("Browse set dialog"),
2530 				 lastDir,
2531 				 QString("*.dei"));
2532   if(!fileName.isEmpty()) {
2533     QFileInfo fi(fileName);
2534     lastDir = fi.path();
2535     updateInitSetPath(fileName);
2536     setInitSetPath(fileName);
2537   }
2538 }
2539 //-----------------------------------------------------------
2540 // load background pix
2541 //-----------------------------------------------------------
setIsBackgroundPix(bool b)2542 void DeicsOnzeGui::setIsBackgroundPix(bool b) {
2543   if(b && !imagePathLineEdit->text().isEmpty()) applyBackgroundPix();
2544   else setBackgroundColor(reinterpret_cast<const QColor &>(*bColor));
2545   imagePathLineEdit->setEnabled(b);
2546   imageBrowsePushButton->setEnabled(b);
2547   unsigned char message[4];
2548   message[0]=MUSE_SYNTH_SYSEX_MFG_ID;
2549   message[1]=DEICSONZE_UNIQUE_ID;
2550   message[2]=SYSEX_ISBACKGROUNDPIX;
2551   message[3]=(unsigned char)b;
2552   sendSysex(message, 4);
2553 }
setBackgroundPixPath(const QString & s)2554 void DeicsOnzeGui::setBackgroundPixPath(const QString& s) {
2555   applyBackgroundPix();
2556   unsigned char message[4+MAXSTRLENGTHBACKGROUNDPIXPATH];
2557   message[0]=MUSE_SYNTH_SYSEX_MFG_ID;
2558   message[1]=DEICSONZE_UNIQUE_ID;
2559   message[2]=SYSEX_BACKGROUNDPIXPATH;
2560   strncpy((char*)&message[3], s.toLatin1().data(),
2561 	  MAXSTRLENGTHBACKGROUNDPIXPATH);
2562   sendSysex(message, 3+MAXSTRLENGTHBACKGROUNDPIXPATH);
2563 }
setBrowseBackgroundPixPath()2564 void DeicsOnzeGui::setBrowseBackgroundPixPath() {
2565   QString fileName =
2566     QFileDialog::getOpenFileName(
2567 				 this,
2568 				 tr("Browse image dialog"),
2569 				 lastDir,
2570 				 QString("*.jpg *.png"));
2571   if(!fileName.isEmpty()) {
2572     QFileInfo fi(fileName);
2573     lastDir = fi.path();
2574     updateBackgroundPixPath(fileName);
2575     setBackgroundPixPath(fileName);
2576   }
2577 }
2578 //-----------------------------------------------------------
2579 // FX
2580 //-----------------------------------------------------------
setChorusActiv(bool a)2581 void DeicsOnzeGui::setChorusActiv(bool a) {
2582   unsigned char message[4];
2583   message[0]=MUSE_SYNTH_SYSEX_MFG_ID;
2584   message[1]=DEICSONZE_UNIQUE_ID;
2585   message[2]=SYSEX_CHORUSACTIV;
2586   message[3]=(unsigned char)a;
2587   sendSysex(message, 4);
2588 }
setChannelChorus(int c)2589 void DeicsOnzeGui::setChannelChorus(int c) {
2590   sendController(_currentChannel, MusECore::CTRL_CHORUS_SEND, c);
2591 }
setChorusReturn(int val)2592 void DeicsOnzeGui::setChorusReturn(int val) {
2593   unsigned char message[4];
2594   message[0]=MUSE_SYNTH_SYSEX_MFG_ID;
2595   message[1]=DEICSONZE_UNIQUE_ID;
2596   message[2]=SYSEX_CHORUSRETURN;
2597   message[3]=(unsigned char)val;
2598   sendSysex(message, 4);
2599 }
setSelectChorusPlugin()2600 void DeicsOnzeGui::setSelectChorusPlugin() {
2601   MusESimplePlugin::Plugin* pluginChorus =
2602     MusESimplePlugin::SimplerPluginChooser::getPlugin(this);
2603   if(pluginChorus) {
2604     unsigned char message[3+sizeof(MusESimplePlugin::Plugin*)];
2605     message[0]=MUSE_SYNTH_SYSEX_MFG_ID;
2606     message[1]=DEICSONZE_UNIQUE_ID;
2607     message[2]=SYSEX_SELECTCHORUS;
2608     memcpy(&message[3], &pluginChorus, sizeof(MusESimplePlugin::Plugin*));
2609     sendSysex(message, 3+sizeof(MusESimplePlugin::Plugin*));
2610   }
2611 }
2612 
2613 /*void DeicsOnzeGui::setPanChorus1(double i) {
2614   unsigned char message[4];
2615   message[0]=MUSE_SYNTH_SYSEX_MFG_ID;
2616   message[1]=DEICSONZE_UNIQUE_ID;
2617   message[2]=SYSEX_CHORUS1PAN;
2618   message[3]=(unsigned char)(i*(double)MAXCHORUSPARAM);
2619   sendSysex(message, 4);
2620 }
2621 void DeicsOnzeGui::setLFOFreqChorus1(double i) {
2622   unsigned char message[4];
2623   message[0]=MUSE_SYNTH_SYSEX_MFG_ID;
2624   message[1]=DEICSONZE_UNIQUE_ID;
2625   message[2]=SYSEX_CHORUS1LFOFREQ;
2626   message[3]=(unsigned char)(i*(double)MAXCHORUSPARAM);
2627   sendSysex(message, 4);
2628 }
2629 void DeicsOnzeGui::setDepthChorus1(double i) {
2630   unsigned char message[4];
2631   message[0]=MUSE_SYNTH_SYSEX_MFG_ID;
2632   message[1]=DEICSONZE_UNIQUE_ID;
2633   message[2]=SYSEX_CHORUS1DEPTH;
2634   message[3]=(unsigned char)(i*(double)MAXCHORUSPARAM);
2635   sendSysex(message, 4);
2636 }
2637 void DeicsOnzeGui::setPanChorus2(double i) {
2638   unsigned char message[4];
2639   message[0]=MUSE_SYNTH_SYSEX_MFG_ID;
2640   message[1]=DEICSONZE_UNIQUE_ID;
2641   message[2]=SYSEX_CHORUS2PAN;
2642   message[3]=(unsigned char)(i*(double)MAXCHORUSPARAM);
2643   sendSysex(message, 4);
2644 }
2645 void DeicsOnzeGui::setLFOFreqChorus2(double i) {
2646   unsigned char message[4];
2647   message[0]=MUSE_SYNTH_SYSEX_MFG_ID;
2648   message[1]=DEICSONZE_UNIQUE_ID;
2649   message[2]=SYSEX_CHORUS2LFOFREQ;
2650   message[3]=(unsigned char)(i*(double)MAXCHORUSPARAM);
2651   sendSysex(message, 4);
2652 }
2653 void DeicsOnzeGui::setDepthChorus2(double i) {
2654   unsigned char message[4];
2655   message[0]=MUSE_SYNTH_SYSEX_MFG_ID;
2656   message[1]=DEICSONZE_UNIQUE_ID;
2657   message[2]=SYSEX_CHORUS2DEPTH;
2658   message[3]=(unsigned char)(i*(double)MAXCHORUSPARAM);
2659   sendSysex(message, 4);
2660   }*/
setReverbActiv(bool a)2661 void DeicsOnzeGui::setReverbActiv(bool a) {
2662   unsigned char message[4];
2663   message[0]=MUSE_SYNTH_SYSEX_MFG_ID;
2664   message[1]=DEICSONZE_UNIQUE_ID;
2665   message[2]=SYSEX_REVERBACTIV;
2666   message[3]=(unsigned char)a;
2667   sendSysex(message, 4);
2668 }
setChannelReverb(int r)2669 void DeicsOnzeGui::setChannelReverb(int r) {
2670   sendController(_currentChannel, MusECore::CTRL_REVERB_SEND, r);
2671 }
setReverbReturn(int val)2672 void DeicsOnzeGui::setReverbReturn(int val) {
2673   unsigned char message[4];
2674   message[0]=MUSE_SYNTH_SYSEX_MFG_ID;
2675   message[1]=DEICSONZE_UNIQUE_ID;
2676   message[2]=SYSEX_REVERBRETURN;
2677   message[3]=(unsigned char)val;
2678   sendSysex(message, 4);
2679 }
setSelectReverbPlugin()2680 void DeicsOnzeGui::setSelectReverbPlugin() {
2681   MusESimplePlugin::Plugin* pluginReverb = MusESimplePlugin::SimplerPluginChooser::getPlugin(this);
2682   if(pluginReverb) {
2683     unsigned char message[3+sizeof(MusESimplePlugin::Plugin*)];
2684     message[0]=MUSE_SYNTH_SYSEX_MFG_ID;
2685     message[1]=DEICSONZE_UNIQUE_ID;
2686     message[2]=SYSEX_SELECTREVERB;
2687     memcpy(&message[3], &pluginReverb, sizeof(MusESimplePlugin::Plugin*));
2688     sendSysex(message, 3+sizeof(MusESimplePlugin::Plugin*));
2689   }
2690 }
2691 
2692 //-----------------------------------------------------------
2693 // Quick Edit
2694 //-----------------------------------------------------------
setChannelVolKnob(double val)2695 void DeicsOnzeGui::setChannelVolKnob(double val) {
2696   sendController(_currentChannel, CTRL_CHANNELVOLUME,
2697 		 (int)(val*(double)MAXCHANNELVOLUME));
2698 }
setBrightnessKnob(double val)2699 void DeicsOnzeGui::setBrightnessKnob(double val) {
2700   sendController(_currentChannel, CTRL_FINEBRIGHTNESS,
2701 		 (int)(val*(double)MAXFINEBRIGHTNESS));
2702 }
setModulationKnob(double val)2703 void DeicsOnzeGui::setModulationKnob(double val) {
2704   sendController(_currentChannel, MusECore::CTRL_MODULATION,
2705 		 (int)(val*(double)MAXMODULATION));
2706 }
setDetuneKnob(double val)2707 void DeicsOnzeGui::setDetuneKnob(double val) {
2708   //channelDetuneSlider->setValue((int)((2.0*val-1.0)*(double)MAXCHANNELDETUNE));
2709   setChannelDetune((int)((2.0*val-1.0)*(double)MAXCHANNELDETUNE));
2710 }
setAttackKnob(double val)2711 void DeicsOnzeGui::setAttackKnob(double val) {
2712   sendController(_currentChannel, MusECore::CTRL_ATTACK_TIME,
2713 		 (int)(val*(double)MAXATTACK));
2714 }
setReleaseKnob(double val)2715 void DeicsOnzeGui::setReleaseKnob(double val) {
2716   sendController(_currentChannel, MusECore::CTRL_RELEASE_TIME, (int)(val*(double)MAXRELEASE));
2717 }
2718 //-----------------------------------------------------------
2719 // Global control
2720 //-----------------------------------------------------------
setChannelPan(double mv)2721 void DeicsOnzeGui::setChannelPan(double mv) {
2722   sendController(_currentChannel, CTRL_CHANNELPAN,
2723 		 (int)((mv-0.5)*2*(double)MAXCHANNELPAN));
2724 }
setMasterVolKnob(double mv)2725 void DeicsOnzeGui::setMasterVolKnob(double mv) {
2726   setMasterVol((int)(mv*(double)MAXMASTERVOLUME));
2727 }
setMasterVol(int mv)2728 void DeicsOnzeGui::setMasterVol(int mv) {
2729   unsigned char message[4];
2730   message[0]=MUSE_SYNTH_SYSEX_MFG_ID;
2731   message[1]=DEICSONZE_UNIQUE_ID;
2732   message[2]=SYSEX_MASTERVOL;
2733   message[3]=(unsigned char)mv;
2734   sendSysex(message, 4);
2735 }
2736 
setFeedback(int f)2737 void DeicsOnzeGui::setFeedback(int f) {sendController(_currentChannel, CTRL_FEEDBACK, f);}
2738 
setLfoWave(int lw)2739 void DeicsOnzeGui::setLfoWave(int lw) {sendController(_currentChannel, CTRL_WAVE, lw);}
2740 
setLfoSpeed(int ls)2741 void DeicsOnzeGui::setLfoSpeed(int ls) {sendController(_currentChannel, CTRL_SPEED, ls);}
2742 
setLfoDelay(int ld)2743 void DeicsOnzeGui::setLfoDelay(int ld) {sendController(_currentChannel, CTRL_DELAY, ld);}
2744 
setLfoPModDepth(int lpmd)2745 void DeicsOnzeGui::setLfoPModDepth(int lpmd) {
2746   sendController(_currentChannel, CTRL_PMODDEPTH, lpmd);
2747 }
2748 
setLfoPitchSens(int lps)2749 void DeicsOnzeGui::setLfoPitchSens(int lps) {
2750   sendController(_currentChannel, CTRL_PMODSENS, lps);
2751 }
2752 
setLfoAModDepth(int lamd)2753 void DeicsOnzeGui::setLfoAModDepth(int lamd) {
2754   sendController(_currentChannel, CTRL_AMODDEPTH, lamd);
2755 }
setLfoAmpSens(int las)2756 void DeicsOnzeGui::setLfoAmpSens(int las) {sendController(_currentChannel, CTRL_AMS, las);}
2757 
setTranspose(int t)2758 void DeicsOnzeGui::setTranspose(int t) {sendController(_currentChannel, CTRL_TRANSPOSE, t);}
2759 
setChannelDetune(int d)2760 void DeicsOnzeGui::setChannelDetune(int d) {
2761   sendController(_currentChannel, CTRL_CHANNELDETUNE, d);
2762   updateChannelDetuneKnob(d);
2763 }
2764 
setAlgorithm(int a)2765 void DeicsOnzeGui::setAlgorithm(int a) {
2766     sendController(_currentChannel, CTRL_ALG, (int) (a==0?FIRST:
2767 				       (a==1?SECOND:
2768 					(a==2?THIRD:
2769 					 (a==3?FOURTH:
2770 					  (a==4?FIFTH:
2771 					   (a==5?SIXTH:
2772 					    (a==6?SEVENTH:EIGHTH))))))));
2773 }
2774 
setPitchBendRange(int pbr)2775 void DeicsOnzeGui::setPitchBendRange(int pbr) {
2776     sendController(_currentChannel, CTRL_PBENDRANGE, pbr);
2777 }
2778 
2779 //---------------------------------------------------------------
2780 // Pitch Envelope
2781 //---------------------------------------------------------------
setPL1(int val)2782 void DeicsOnzeGui::setPL1(int val) {
2783   PitchEg* pe=&_deicsOnze->_preset[_currentChannel]->pitchEg;
2784   pitchEnvelopeGraph->env2Points(val, pe->pl2, pe->pl3,
2785 				 pe->pr1, pe->pr2, pe->pr3);
2786   pitchEnvelopeGraph->updateEnv();
2787   sendController(_currentChannel, CTRL_PL1, val);
2788 }
setPL2(int val)2789 void DeicsOnzeGui::setPL2(int val) {
2790   PitchEg* pe=&_deicsOnze->_preset[_currentChannel]->pitchEg;
2791   pitchEnvelopeGraph->env2Points(pe->pl1, val, pe->pl3,
2792 				 pe->pr1, pe->pr2, pe->pr3);
2793   pitchEnvelopeGraph->updateEnv();
2794   sendController(_currentChannel, CTRL_PL2, val);
2795 }
setPL3(int val)2796 void DeicsOnzeGui::setPL3(int val) {
2797   PitchEg* pe=&_deicsOnze->_preset[_currentChannel]->pitchEg;
2798   pitchEnvelopeGraph->env2Points(pe->pl1, pe->pl2, val,
2799 				 pe->pr1, pe->pr2, pe->pr3);
2800   pitchEnvelopeGraph->updateEnv();
2801   sendController(_currentChannel, CTRL_PL3, val);
2802 }
setPR1(int val)2803 void DeicsOnzeGui::setPR1(int val) {
2804   PitchEg* pe=&_deicsOnze->_preset[_currentChannel]->pitchEg;
2805   pitchEnvelopeGraph->env2Points(pe->pl1, pe->pl2, pe->pl3,
2806 				 val, pe->pr2, pe->pr3);
2807   pitchEnvelopeGraph->updateEnv();
2808   sendController(_currentChannel, CTRL_PR1, val);
2809 }
setPR2(int val)2810 void DeicsOnzeGui::setPR2(int val) {
2811   PitchEg* pe=&_deicsOnze->_preset[_currentChannel]->pitchEg;
2812   pitchEnvelopeGraph->env2Points(pe->pl1, pe->pl2, pe->pl3,
2813 				 pe->pr1, val, pe->pr3);
2814   pitchEnvelopeGraph->updateEnv();
2815   sendController(_currentChannel, CTRL_PR2, val);
2816 }
setPR3(int val)2817 void DeicsOnzeGui::setPR3(int val) {
2818   PitchEg* pe=&_deicsOnze->_preset[_currentChannel]->pitchEg;
2819   pitchEnvelopeGraph->env2Points(pe->pl1, pe->pl2, pe->pl3,
2820 				 pe->pr1, pe->pr2, val);
2821   pitchEnvelopeGraph->updateEnv();
2822   sendController(_currentChannel, CTRL_PR3, val);
2823 }
2824 //---------------------------------------------------------------
2825 // Function
2826 //---------------------------------------------------------------
setFcVolume(int val)2827 void DeicsOnzeGui::setFcVolume(int val){sendController(_currentChannel, CTRL_FCVOLUME, val);}
setFcPitch(int val)2828 void DeicsOnzeGui::setFcPitch(int val){sendController(_currentChannel, CTRL_FCPITCH, val);}
setFcAmplitude(int val)2829 void DeicsOnzeGui::setFcAmplitude(int val) {
2830   sendController(_currentChannel, CTRL_FCAMPLITUDE, val);
2831 }
setMwPitch(int val)2832 void DeicsOnzeGui::setMwPitch(int val){sendController(_currentChannel, CTRL_MWPITCH, val);}
setMwAmplitude(int val)2833 void DeicsOnzeGui::setMwAmplitude(int val) {
2834   sendController(_currentChannel, CTRL_MWAMPLITUDE, val);
2835 }
setBcPitch(int val)2836 void DeicsOnzeGui::setBcPitch(int val){sendController(_currentChannel, CTRL_BCPITCH, val);}
setBcAmplitude(int val)2837 void DeicsOnzeGui::setBcAmplitude(int val) {
2838   sendController(_currentChannel, CTRL_BCAMPLITUDE, val);
2839 }
setBcPitchBias(int val)2840 void DeicsOnzeGui::setBcPitchBias(int val) {
2841   sendController(_currentChannel, CTRL_BCPITCHBIAS, val);}
setBcEgBias(int val)2842 void DeicsOnzeGui::setBcEgBias(int val) {
2843   sendController(_currentChannel, CTRL_BCEGBIAS, val);
2844 }
setAtPitch(int val)2845 void DeicsOnzeGui::setAtPitch(int val){sendController(_currentChannel, CTRL_ATPITCH, val);}
setAtAmplitude(int val)2846 void DeicsOnzeGui::setAtAmplitude(int val) {
2847   sendController(_currentChannel, CTRL_ATAMPLITUDE, val);
2848 }
setAtPitchBias(int val)2849 void DeicsOnzeGui::setAtPitchBias(int val) {
2850   sendController(_currentChannel, CTRL_ATPITCHBIAS, val);}
setAtEgBias(int val)2851 void DeicsOnzeGui::setAtEgBias(int val) {
2852   sendController(_currentChannel, CTRL_ATEGBIAS, val);
2853 }
setReverbRate(int val)2854 void DeicsOnzeGui::setReverbRate(int val) {
2855   sendController(_currentChannel, CTRL_REVERBRATE, val);
2856 }
setPolyMode(int val)2857 void DeicsOnzeGui::setPolyMode(int val) {
2858   sendController(_currentChannel, CTRL_POLYMODE, val);
2859 }
setPortFingerFull(int val)2860 void DeicsOnzeGui::setPortFingerFull(int val) {
2861   sendController(_currentChannel, CTRL_PORTAMODE, val);
2862 }
setPortaTime(int val)2863 void DeicsOnzeGui::setPortaTime(int val) {
2864   sendController(_currentChannel, CTRL_PORTATIME, val);
2865 }
2866 
2867 //---------------------------------------------------------------
2868 // envelope controle
2869 //---------------------------------------------------------------
setAR1(int val)2870 void DeicsOnzeGui::setAR1(int val) {
2871   Eg* _eg=&(_deicsOnze->_preset[_currentChannel]->eg[0]);
2872   //printf("ar : %d, d1r : %d, d1l : %d, d2r : %d, rr : %d\n",
2873   // val, _eg->d1r, _eg->d1l, _eg->d2r, _eg->rr);
2874   envelopeGraph[0]->env2Points(val, _eg->d1r, _eg->d1l, _eg->d2r, _eg->rr);
2875   envelopeGraph[0]->updateEnv();
2876   sendController(_currentChannel, CTRL_AR, val);
2877 }
setD1R1(int val)2878 void DeicsOnzeGui::setD1R1(int val) {
2879     Eg* _eg=&(_deicsOnze->_preset[_currentChannel]->eg[0]);
2880     envelopeGraph[0]->env2Points(_eg->ar, val, _eg->d1l, _eg->d2r, _eg->rr);
2881     envelopeGraph[0]->updateEnv();
2882     sendController(_currentChannel, CTRL_D1R, val);
2883 }
setD1L1(int val)2884 void DeicsOnzeGui::setD1L1(int val) {
2885     Eg* _eg=&(_deicsOnze->_preset[_currentChannel]->eg[0]);
2886     envelopeGraph[0]->env2Points(_eg->ar, _eg->d1r, val, _eg->d2r, _eg->rr);
2887     envelopeGraph[0]->updateEnv();
2888     sendController(_currentChannel, CTRL_D1L, val);
2889 }
setD2R1(int val)2890 void DeicsOnzeGui::setD2R1(int val) {
2891     Eg* _eg=&(_deicsOnze->_preset[_currentChannel]->eg[0]);
2892     envelopeGraph[0]->env2Points(_eg->ar, _eg->d1r, _eg->d1l, val, _eg->rr);
2893     envelopeGraph[0]->updateEnv();
2894     sendController(_currentChannel, CTRL_D2R, val);
2895 }
setRR1(int val)2896 void DeicsOnzeGui::setRR1(int val){
2897     Eg* _eg=&(_deicsOnze->_preset[_currentChannel]->eg[0]);
2898     envelopeGraph[0]->env2Points(_eg->ar, _eg->d1r, _eg->d1l, _eg->d2r, val);
2899     envelopeGraph[0]->updateEnv();
2900     sendController(_currentChannel, CTRL_RR, val);
2901 }
setAR2(int val)2902 void DeicsOnzeGui::setAR2(int val) {
2903     Eg* _eg=&(_deicsOnze->_preset[_currentChannel]->eg[1]);
2904     envelopeGraph[1]->env2Points(val, _eg->d1r, _eg->d1l, _eg->d2r, _eg->rr);
2905     envelopeGraph[1]->updateEnv();
2906     sendController(_currentChannel, CTRL_AR+DECAPAR1, val);
2907 }
setD1R2(int val)2908 void DeicsOnzeGui::setD1R2(int val) {
2909     Eg* _eg=&(_deicsOnze->_preset[_currentChannel]->eg[1]);
2910     envelopeGraph[1]->env2Points(_eg->ar, val, _eg->d1l, _eg->d2r, _eg->rr);
2911     envelopeGraph[1]->updateEnv();
2912     sendController(_currentChannel, CTRL_D1R+DECAPAR1, val);
2913 }
setD1L2(int val)2914 void DeicsOnzeGui::setD1L2(int val) {
2915     Eg* _eg=&(_deicsOnze->_preset[_currentChannel]->eg[1]);
2916     envelopeGraph[1]->env2Points(_eg->ar, _eg->d1r, val, _eg->d2r, _eg->rr);
2917     envelopeGraph[1]->updateEnv();
2918     sendController(_currentChannel, CTRL_D1L+DECAPAR1, val);
2919 }
setD2R2(int val)2920 void DeicsOnzeGui::setD2R2(int val) {
2921     Eg* _eg=&(_deicsOnze->_preset[_currentChannel]->eg[1]);
2922     envelopeGraph[1]->env2Points(_eg->ar, _eg->d1r, _eg->d1l, val, _eg->rr);
2923     envelopeGraph[1]->updateEnv();
2924     sendController(_currentChannel, CTRL_D2R+DECAPAR1, val);
2925 }
setRR2(int val)2926 void DeicsOnzeGui::setRR2(int val){
2927     Eg* _eg=&(_deicsOnze->_preset[_currentChannel]->eg[1]);
2928     envelopeGraph[1]->env2Points(_eg->ar, _eg->d1r, _eg->d1l, _eg->d2r, val);
2929     envelopeGraph[1]->updateEnv();
2930     sendController(_currentChannel, CTRL_RR+DECAPAR1, val);
2931 }
setAR3(int val)2932 void DeicsOnzeGui::setAR3(int val) {
2933     Eg* _eg=&(_deicsOnze->_preset[_currentChannel]->eg[2]);
2934     envelopeGraph[2]->env2Points(val, _eg->d1r, _eg->d1l, _eg->d2r, _eg->rr);
2935     envelopeGraph[2]->updateEnv();
2936     sendController(_currentChannel, CTRL_AR+2*DECAPAR1, val);
2937 }
setD1R3(int val)2938 void DeicsOnzeGui::setD1R3(int val) {
2939     Eg* _eg=&(_deicsOnze->_preset[_currentChannel]->eg[2]);
2940     envelopeGraph[2]->env2Points(_eg->ar, val, _eg->d1l, _eg->d2r, _eg->rr);
2941     envelopeGraph[2]->updateEnv();
2942     sendController(_currentChannel, CTRL_D1R+2*DECAPAR1, val);
2943 }
setD1L3(int val)2944 void DeicsOnzeGui::setD1L3(int val) {
2945     Eg* _eg=&(_deicsOnze->_preset[_currentChannel]->eg[2]);
2946     envelopeGraph[2]->env2Points(_eg->ar, _eg->d1r, val, _eg->d2r, _eg->rr);
2947     envelopeGraph[2]->updateEnv();
2948     sendController(_currentChannel, CTRL_D1L+2*DECAPAR1, val);
2949 }
setD2R3(int val)2950 void DeicsOnzeGui::setD2R3(int val) {
2951     Eg* _eg=&(_deicsOnze->_preset[_currentChannel]->eg[2]);
2952     envelopeGraph[2]->env2Points(_eg->ar, _eg->d1r, _eg->d1l, val, _eg->rr);
2953     envelopeGraph[2]->updateEnv();
2954     sendController(_currentChannel, CTRL_D2R+2*DECAPAR1, val);
2955 }
setRR3(int val)2956 void DeicsOnzeGui::setRR3(int val){
2957     Eg* _eg=&(_deicsOnze->_preset[_currentChannel]->eg[2]);
2958     envelopeGraph[2]->env2Points(_eg->ar, _eg->d1r, _eg->d1l, _eg->d2r, val);
2959     envelopeGraph[2]->updateEnv();
2960     sendController(_currentChannel, CTRL_RR+2*DECAPAR1, val);
2961 }
setAR4(int val)2962 void DeicsOnzeGui::setAR4(int val) {
2963     Eg* _eg=&(_deicsOnze->_preset[_currentChannel]->eg[3]);
2964     envelopeGraph[3]->env2Points(val, _eg->d1r, _eg->d1l, _eg->d2r, _eg->rr);
2965     envelopeGraph[3]->updateEnv();
2966     sendController(_currentChannel, CTRL_AR+3*DECAPAR1, val);
2967 }
setD1R4(int val)2968 void DeicsOnzeGui::setD1R4(int val) {
2969     Eg* _eg=&(_deicsOnze->_preset[_currentChannel]->eg[3]);
2970     envelopeGraph[3]->env2Points(_eg->ar, val, _eg->d1l, _eg->d2r, _eg->rr);
2971     envelopeGraph[3]->updateEnv();
2972     sendController(_currentChannel, CTRL_D1R+3*DECAPAR1, val);
2973 }
setD1L4(int val)2974 void DeicsOnzeGui::setD1L4(int val) {
2975     Eg* _eg=&(_deicsOnze->_preset[_currentChannel]->eg[3]);
2976     envelopeGraph[3]->env2Points(_eg->ar, _eg->d1r, val, _eg->d2r, _eg->rr);
2977     envelopeGraph[3]->updateEnv();
2978     sendController(_currentChannel, CTRL_D1L+3*DECAPAR1, val);
2979 }
setD2R4(int val)2980 void DeicsOnzeGui::setD2R4(int val) {
2981     Eg* _eg=&(_deicsOnze->_preset[_currentChannel]->eg[3]);
2982     envelopeGraph[3]->env2Points(_eg->ar, _eg->d1r, _eg->d1l, val, _eg->rr);
2983     envelopeGraph[3]->updateEnv();
2984     sendController(_currentChannel, CTRL_D2R+3*DECAPAR1, val);
2985 }
setRR4(int val)2986 void DeicsOnzeGui::setRR4(int val){
2987     Eg* _eg=&(_deicsOnze->_preset[_currentChannel]->eg[3]);
2988     envelopeGraph[3]->env2Points(_eg->ar, _eg->d1r, _eg->d1l, _eg->d2r, val);
2989     envelopeGraph[3]->updateEnv();
2990     sendController(_currentChannel, CTRL_RR+3*DECAPAR1, val);
2991 }
2992 
2993 //--------------------------------------------------------------
2994 // set Scaling
2995 //--------------------------------------------------------------
setLS1(int val)2996 void DeicsOnzeGui::setLS1(int val){sendController(_currentChannel, CTRL_LS, val);}
setRS1(int val)2997 void DeicsOnzeGui::setRS1(int val){sendController(_currentChannel, CTRL_RS, val);}
setLS2(int val)2998 void DeicsOnzeGui::setLS2(int val){sendController(_currentChannel, CTRL_LS+DECAPAR1, val);}
setRS2(int val)2999 void DeicsOnzeGui::setRS2(int val){sendController(_currentChannel, CTRL_RS+DECAPAR1, val);}
setLS3(int val)3000 void DeicsOnzeGui::setLS3(int val){sendController(_currentChannel, CTRL_LS+2*DECAPAR1, val);}
setRS3(int val)3001 void DeicsOnzeGui::setRS3(int val){sendController(_currentChannel, CTRL_RS+2*DECAPAR1, val);}
setLS4(int val)3002 void DeicsOnzeGui::setLS4(int val){sendController(_currentChannel, CTRL_LS+3*DECAPAR1, val);}
setRS4(int val)3003 void DeicsOnzeGui::setRS4(int val){sendController(_currentChannel, CTRL_RS+3*DECAPAR1, val);}
3004 
3005 //--------------------------------------------------------------
3006 // set Volume
3007 //--------------------------------------------------------------
setVol1(int val)3008 void DeicsOnzeGui::setVol1(int val){sendController(_currentChannel, CTRL_OUT, val);}
setVol2(int val)3009 void DeicsOnzeGui::setVol2(int val){sendController(_currentChannel, CTRL_OUT+DECAPAR1, val);}
setVol3(int val)3010 void DeicsOnzeGui::setVol3(int val){sendController(_currentChannel,CTRL_OUT+2*DECAPAR1,val);}
setVol4(int val)3011 void DeicsOnzeGui::setVol4(int val){sendController(_currentChannel,CTRL_OUT+3*DECAPAR1,val);}
3012 
3013 //--------------------------------------------------------------
3014 // set Ratio and Frequency
3015 //--------------------------------------------------------------
setCoarseRatio1(int val)3016 void DeicsOnzeGui::setCoarseRatio1(int val) {
3017     sendController(_currentChannel, CTRL_RATIO, val*100+FineRatio1SpinBox->value());
3018 }
setFineRatio1(int val)3019 void DeicsOnzeGui::setFineRatio1(int val) {
3020     sendController(_currentChannel, CTRL_RATIO, val+CoarseRatio1SpinBox->value()*100);
3021 }
setFreq1(int val)3022 void DeicsOnzeGui::setFreq1(int val) {
3023     sendController(_currentChannel,CTRL_FIXRANGE,val*100);}
setFix1(bool f)3024 void DeicsOnzeGui::setFix1(bool f)  {
3025     sendController(_currentChannel, CTRL_FIX, (f==false?0:1));}
setCoarseRatio2(int val)3026 void DeicsOnzeGui::setCoarseRatio2(int val) {
3027     sendController(_currentChannel, CTRL_RATIO+DECAPAR1, val*100+FineRatio2SpinBox->value());
3028 }
setFineRatio2(int val)3029 void DeicsOnzeGui::setFineRatio2(int val) {
3030     sendController(_currentChannel,CTRL_RATIO+DECAPAR1,val+CoarseRatio2SpinBox->value()*100);
3031 }
setFreq2(int val)3032 void DeicsOnzeGui::setFreq2(int val) {
3033     sendController(_currentChannel,CTRL_FIXRANGE+DECAPAR2,val*100);}
setFix2(bool f)3034 void DeicsOnzeGui::setFix2(bool f)  {
3035     sendController(_currentChannel, CTRL_FIX+DECAPAR2, (f==false?0:1));}
setCoarseRatio3(int val)3036 void DeicsOnzeGui::setCoarseRatio3(int val) {
3037     sendController(_currentChannel,CTRL_RATIO+2*DECAPAR1,val*100+FineRatio3SpinBox->value());
3038 }
setFineRatio3(int val)3039 void DeicsOnzeGui::setFineRatio3(int val) {
3040     sendController(_currentChannel,CTRL_RATIO+2*DECAPAR1,
3041 		   val+CoarseRatio3SpinBox->value()*100);
3042 }
setFreq3(int val)3043 void DeicsOnzeGui::setFreq3(int val) {
3044     sendController(_currentChannel,CTRL_FIXRANGE+2*DECAPAR2,val*100);}
setFix3(bool f)3045 void DeicsOnzeGui::setFix3(bool f)  {
3046     sendController(_currentChannel, CTRL_FIX+2*DECAPAR2, (f==false?0:1));}
setCoarseRatio4(int val)3047 void DeicsOnzeGui::setCoarseRatio4(int val) {
3048     sendController(_currentChannel,CTRL_RATIO+3*DECAPAR1,val*100+FineRatio4SpinBox->value());
3049 }
setFineRatio4(int val)3050 void DeicsOnzeGui::setFineRatio4(int val) {
3051     sendController(_currentChannel,CTRL_RATIO+3*DECAPAR1,
3052 		   val+CoarseRatio4SpinBox->value()*100);
3053 }
setFreq4(int val)3054 void DeicsOnzeGui::setFreq4(int val) {
3055     sendController(_currentChannel,CTRL_FIXRANGE+3*DECAPAR2,val*100);}
setFix4(bool f)3056 void DeicsOnzeGui::setFix4(bool f)  {
3057     sendController(_currentChannel, CTRL_FIX+3*DECAPAR2, (f==false?0:1));}
3058 
3059 //--------------------------------------------------------------
3060 // set Sensitivity
3061 //--------------------------------------------------------------
setAME1(bool val)3062 void DeicsOnzeGui::setAME1(bool val) {sendController(_currentChannel, CTRL_AME, val);}
setEBS1(int val)3063 void DeicsOnzeGui::setEBS1(int val) {sendController(_currentChannel, CTRL_EBS, val);}
setKVS1(int val)3064 void DeicsOnzeGui::setKVS1(int val) {sendController(_currentChannel, CTRL_KVS, val);}
setAME2(bool val)3065 void DeicsOnzeGui::setAME2(bool val) {sendController(_currentChannel,CTRL_AME+DECAPAR1,val);}
setEBS2(int val)3066 void DeicsOnzeGui::setEBS2(int val) {sendController(_currentChannel,CTRL_EBS+DECAPAR1,val);}
setKVS2(int val)3067 void DeicsOnzeGui::setKVS2(int val) {sendController(_currentChannel,CTRL_KVS+DECAPAR1,val);}
setAME3(bool val)3068 void DeicsOnzeGui::setAME3(bool val) {
3069     sendController(_currentChannel,CTRL_AME+2*DECAPAR1,val);}
setEBS3(int val)3070 void DeicsOnzeGui::setEBS3(int val) {
3071     sendController(_currentChannel, CTRL_EBS+2*DECAPAR1, val);}
setKVS3(int val)3072 void DeicsOnzeGui::setKVS3(int val) {
3073     sendController(_currentChannel, CTRL_KVS+2*DECAPAR1, val);}
setAME4(bool val)3074 void DeicsOnzeGui::setAME4(bool val) {
3075     sendController(_currentChannel, CTRL_AME+3*DECAPAR1, val);}
setEBS4(int val)3076 void DeicsOnzeGui::setEBS4(int val) {
3077     sendController(_currentChannel, CTRL_EBS+3*DECAPAR1, val);}
setKVS4(int val)3078 void DeicsOnzeGui::setKVS4(int val) {
3079     sendController(_currentChannel, CTRL_KVS+3*DECAPAR1, val);}
3080 
3081 //--------------------------------------------------------------
3082 // set detune
3083 //--------------------------------------------------------------
setDET1(int val)3084 void DeicsOnzeGui::setDET1(int val){sendController(_currentChannel, CTRL_DET, val);}
setDET2(int val)3085 void DeicsOnzeGui::setDET2(int val){sendController(_currentChannel, CTRL_DET+DECAPAR1, val);}
setDET3(int val)3086 void DeicsOnzeGui::setDET3(int val){sendController(_currentChannel,CTRL_DET+2*DECAPAR1,val);}
setDET4(int val)3087 void DeicsOnzeGui::setDET4(int val){sendController(_currentChannel,CTRL_DET+3*DECAPAR1,val);}
3088 
3089 //--------------------------------------------------------------
3090 // set WaveForm
3091 //--------------------------------------------------------------
setWaveForm1(int w)3092 void DeicsOnzeGui::setWaveForm1(int w) {
3093     sendController(_currentChannel, CTRL_OSW, w);
3094 }
setWaveForm2(int w)3095 void DeicsOnzeGui::setWaveForm2(int w) {
3096     sendController(_currentChannel, CTRL_OSW+DECAPAR2, w);
3097 }
setWaveForm3(int w)3098 void DeicsOnzeGui::setWaveForm3(int w) {
3099     sendController(_currentChannel, CTRL_OSW+2*DECAPAR2, w);
3100 }
setWaveForm4(int w)3101 void DeicsOnzeGui::setWaveForm4(int w) {
3102     sendController(_currentChannel, CTRL_OSW+3*DECAPAR2, w);
3103 }
3104 //--------------------------------------------------------------
3105 // set delay
3106 //--------------------------------------------------------------
setActivDelay(bool a)3107 void DeicsOnzeGui::setActivDelay(bool a) {
3108   unsigned char message[4];
3109   message[0]=MUSE_SYNTH_SYSEX_MFG_ID;
3110   message[1]=DEICSONZE_UNIQUE_ID;
3111   message[2]=SYSEX_DELAYACTIV;
3112   message[3]=(unsigned char)a;
3113   sendSysex(message, 4);
3114 }
setDelayReturn(int r)3115 void DeicsOnzeGui::setDelayReturn(int r) {
3116   unsigned char message[4];
3117   message[0]=MUSE_SYNTH_SYSEX_MFG_ID;
3118   message[1]=DEICSONZE_UNIQUE_ID;
3119   message[2]=SYSEX_DELAYRETURN;
3120   message[3]=(unsigned char)r;
3121   sendSysex(message, 4);
3122 }
setChannelDelay(int d)3123 void DeicsOnzeGui::setChannelDelay(int d) {
3124   sendController(_currentChannel, MusECore::CTRL_VARIATION_SEND, (unsigned char)d);
3125 }
setDelayBPM(double t)3126 void DeicsOnzeGui::setDelayBPM(double t) {
3127   //int it = (int)(((t - MINDELAYTIME) / (MAXDELAYTIME - MINDELAYTIME))*255.0);
3128   unsigned char message[sizeof(float)+3];
3129   message[0]=MUSE_SYNTH_SYSEX_MFG_ID;
3130   message[1]=DEICSONZE_UNIQUE_ID;
3131   message[2]=SYSEX_DELAYBPM;
3132   float f = (float)t;
3133   memcpy(&message[3], &f, sizeof(float));
3134   message[3]=(unsigned char)f;
3135   sendSysex(message, sizeof(float)+3);
3136   //updateDelayTime(it);
3137 }
setDelayBeatRatio(double t)3138 void DeicsOnzeGui::setDelayBeatRatio(double t) {
3139   unsigned char message[sizeof(float)+3];
3140   message[0]=MUSE_SYNTH_SYSEX_MFG_ID;
3141   message[1]=DEICSONZE_UNIQUE_ID;
3142   message[2]=SYSEX_DELAYBEATRATIO;
3143   float f = (float)t;
3144   memcpy(&message[3], &f, sizeof(float));
3145   message[3]=(unsigned char)f;
3146   sendSysex(message, sizeof(float)+3);
3147 }
setDelayFeedback(double t)3148 void DeicsOnzeGui::setDelayFeedback(double t) {
3149   //int idf = (int)(f*128.0+128.0);
3150   unsigned char message[sizeof(float)+3];
3151   message[0]=MUSE_SYNTH_SYSEX_MFG_ID;
3152   message[1]=DEICSONZE_UNIQUE_ID;
3153   message[2]=SYSEX_DELAYFEEDBACK;
3154   float f = (float)t;
3155   memcpy(&message[3], &f, sizeof(float));
3156   sendSysex(message, sizeof(float)+3);
3157   //updateDelayFeedback(idf);
3158 }
setDelayPanLFOFreq(double pf)3159 void DeicsOnzeGui::setDelayPanLFOFreq(double pf) {
3160   //int ipf = (int)(((pf - MINFREQ) / (MAXFREQ - MINFREQ))*255.0);
3161   unsigned char message[sizeof(float)+3];
3162   message[0]=MUSE_SYNTH_SYSEX_MFG_ID;
3163   message[1]=DEICSONZE_UNIQUE_ID;
3164   message[2]=SYSEX_DELAYLFOFREQ;
3165   float f = (float)pf;
3166   memcpy(&message[3], &f, sizeof(float));
3167   sendSysex(message, sizeof(float)+3);
3168   //updateDelayPanLFOFreq(ipf);
3169 }
setDelayPanLFODepth(double pd)3170 void DeicsOnzeGui::setDelayPanLFODepth(double pd) {
3171   //int ipd = (int)(pd*255.0);
3172   unsigned char message[sizeof(float)+3];
3173   message[0]=MUSE_SYNTH_SYSEX_MFG_ID;
3174   message[1]=DEICSONZE_UNIQUE_ID;
3175   message[2]=SYSEX_DELAYLFODEPTH;
3176   float f = (float)pd;
3177   memcpy(&message[3], &f, sizeof(float));
3178   sendSysex(message, sizeof(float)+3);
3179   //updateDelayPanLFODepth(ipd);
3180 }
3181 
3182 
3183 //--------------------------------------------------------------
3184 // setSet
3185 //  Display the set, that is the category list
3186 //--------------------------------------------------------------
setSet()3187 void DeicsOnzeGui::setSet() {
3188   categoryListView->clear();
3189   hbankSpinBox->setEnabled(false);
3190   categoryLineEdit->setEnabled(false);
3191   for(std::vector<Category*>::iterator
3192 	i=_deicsOnze->_set->_categoryVector.begin();
3193       i!=_deicsOnze->_set->_categoryVector.end(); i++)
3194     (void) new QTreeCategory
3195       (categoryListView, num3Digits((*i)->_hbank+1),
3196        (*i)->_categoryName.c_str(), *i);
3197   categoryListView->resizeColumnToContents(0);
3198   categoryListView->sortItems(0,Qt::AscendingOrder);
3199 }
3200 
3201 //--------------------------------------------------------------
3202 // setCategory
3203 //--------------------------------------------------------------
setCategory(Category * cat)3204 void DeicsOnzeGui::setCategory(Category* cat) {
3205     subcategoryListView->clear();
3206     lbankSpinBox->setEnabled(false);
3207     subcategoryLineEdit->setEnabled(false);
3208     for(std::vector<Subcategory*>::iterator i=cat->_subcategoryVector.begin();
3209 	i!=cat->_subcategoryVector.end(); i++)
3210 	(void) new QTreeSubcategory(subcategoryListView,
3211 					    num3Digits((*i)->_lbank+1),
3212 					    (*i)->_subcategoryName.c_str(),*i);
3213     subcategoryListView->resizeColumnToContents(0);
3214     subcategoryListView->sortItems(0,Qt::AscendingOrder);
3215 }
setCategory(QTreeWidgetItem * cat)3216 void DeicsOnzeGui::setCategory(QTreeWidgetItem* cat) {
3217   QTreeCategory* ccat = (QTreeCategory*) categoryListView->currentItem();
3218   if(cat) {
3219     categoryLineEdit->setEnabled(true);
3220     hbankSpinBox->setEnabled(true);
3221     categoryLineEdit
3222       ->setText(((QTreeCategory*)cat)->_category->_categoryName.c_str());
3223     hbankSpinBox->setValue(((QTreeCategory*)cat)->_category->_hbank+1);
3224     ccat=(QTreeCategory*)cat;
3225     setCategory(ccat->_category);
3226   }
3227 }
3228 
3229 //--------------------------------------------------------------
3230 // setSubcategory
3231 //--------------------------------------------------------------
setSubcategory(Subcategory * sub)3232 void DeicsOnzeGui::setSubcategory(Subcategory* sub) {
3233   presetListView->clear();
3234   progSpinBox->setEnabled(false);
3235   presetLineEdit->setEnabled(false);
3236   for(std::vector<Preset*>::iterator i=sub->_presetVector.begin();
3237       i!=sub->_presetVector.end(); i++)
3238     (void) new QTreePreset(presetListView,
3239 			       num3Digits((*i)->prog+1),
3240 			       (*i)->name.c_str(),*i);
3241   presetListView->resizeColumnToContents(0);
3242   presetListView->sortItems(0,Qt::AscendingOrder);
3243 }
setSubcategory(QTreeWidgetItem * sub)3244 void DeicsOnzeGui::setSubcategory(QTreeWidgetItem* sub) {
3245   QTreeSubcategory* csub =
3246     (QTreeSubcategory*) subcategoryListView->currentItem();
3247   if(sub) {
3248     subcategoryLineEdit->setEnabled(true);
3249     lbankSpinBox->setEnabled(true);
3250     subcategoryLineEdit->setText(((QTreeSubcategory*)sub)
3251 				 ->_subcategory->_subcategoryName.c_str());
3252     lbankSpinBox->setValue(((QTreeSubcategory*)sub)
3253 			   ->_subcategory->_lbank+1);
3254     csub=(QTreeSubcategory*)sub;
3255     setSubcategory(csub->_subcategory);
3256   }
3257 }
3258 //--------------------------------------------------------------
3259 // setPreset
3260 //--------------------------------------------------------------
setPreset(QTreeWidgetItem * pre)3261 void DeicsOnzeGui::setPreset(QTreeWidgetItem* pre) {
3262   if(pre) {
3263     QTreePreset* cpre=(QTreePreset*)pre;
3264     updatePresetName(cpre->_preset->name.c_str(), true);
3265     updateProg(cpre->_preset->prog, true);
3266     int prog = cpre->_preset->prog;
3267     int lbank = cpre->_preset->_subcategory->_lbank;
3268     int hbank = cpre->_preset->_subcategory->_category->_hbank;
3269     setEnabledPreset(true);
3270     updatePreset(cpre->_preset);
3271     sendController(_currentChannel, MusECore::CTRL_PROGRAM, (hbank<<16)+(lbank<<8)+prog);
3272   }
3273 }
3274 //--------------------------------------------------------------
3275 // update the gui
3276 //--------------------------------------------------------------
setEnabledPreset(bool b)3277 void DeicsOnzeGui::setEnabledPreset(bool b) {
3278   if(_enabledPreset!=b) {
3279     FeedbackGroupBox->setEnabled(b);
3280     LFOGroupBox->setEnabled(b);
3281     pitchEnvGroupBox->setEnabled(b);
3282     ModulationMatrixGroupBox->setEnabled(b);
3283     Op1Tab->setEnabled(b);
3284     Op2Tab->setEnabled(b);
3285     Op3Tab->setEnabled(b);
3286     Op4Tab->setEnabled(b);
3287     FunctionsTab->setEnabled(b);
3288     chorusTab->setEnabled(b);
3289     reverbTab->setEnabled(b);
3290 
3291     _enabledPreset=b;
3292   }
3293 }
updateChannelEnable(bool e)3294 void DeicsOnzeGui::updateChannelEnable(bool e) {
3295   updateChannelCheckBox(e);
3296   updateEnabledChannel(e);
3297 }
updateEnabledChannel(bool e)3298 void DeicsOnzeGui::updateEnabledChannel(bool e) {
3299   numberVoicesLabel->setEnabled(e);
3300   nbrVoicesSpinBox->setEnabled(e);
3301   channelCtrlGroupBox->setEnabled(e);
3302   deicsOnzeTabWidget->setEnabled(e);
3303 }
updateNbrVoices(int val)3304 void DeicsOnzeGui::updateNbrVoices(int val) {
3305   nbrVoicesSpinBox->blockSignals(true);
3306   nbrVoicesSpinBox->setValue(val);
3307   nbrVoicesSpinBox->blockSignals(false);
3308 }
updateMasterVolume(int val)3309 void DeicsOnzeGui::updateMasterVolume(int val) {
3310   double d = (double)val/(double)MAXMASTERVOLUME;
3311   //printf("D = %d, %f\n", val, d);
3312   masterVolKnob->blockSignals(true);
3313   masterVolKnob->setValue(d);
3314   masterVolKnob->blockSignals(false);
3315 }
3316 //void DeicsOnzeGui::updateMidiInCh(int val) {
3317   //MidiInChComboBox->blockSignals(true);
3318   //MidiInChComboBox->setCurrentIndex(val);
3319   //MidiInChComboBox->blockSignals(false);
3320 //}
updateQuality(int val)3321 void DeicsOnzeGui::updateQuality(int val) {
3322   qualityComboBox->blockSignals(true);
3323   qualityComboBox->setCurrentIndex(val);
3324   qualityComboBox->blockSignals(false);
3325 }
updateFilter(bool f)3326 void DeicsOnzeGui::updateFilter(bool f) {
3327   filterCheckBox->blockSignals(true);
3328   filterCheckBox->setChecked(f);
3329   filterCheckBox->blockSignals(false);
3330 }
updateFontSize(int val)3331 void DeicsOnzeGui::updateFontSize(int val) {
3332   fontSizeSpinBox->blockSignals(true);
3333   fontSizeSpinBox->setValue(val);
3334   fontSizeSpinBox->blockSignals(false);
3335 }
3336 //FX
updateChorusActiv(bool a)3337 void DeicsOnzeGui::updateChorusActiv(bool a) {
3338   chorusActivCheckBox->blockSignals(true);
3339   chorusActivCheckBox->setChecked(a);
3340   chorusActivCheckBox->blockSignals(false);
3341 }
updateChannelChorus(int c)3342 void DeicsOnzeGui::updateChannelChorus(int c) {
3343   chChorusSlider->blockSignals(true);
3344   chChorusSlider->setValue(c);
3345   chChorusSlider->blockSignals(false);
3346   chChorusSpinBox->blockSignals(true);
3347   chChorusSpinBox->setValue(c);
3348   chChorusSpinBox->blockSignals(false);
3349 }
updateChorusReturn(int r)3350 void DeicsOnzeGui::updateChorusReturn(int r) {
3351   returnChorusSlider->blockSignals(true);
3352   returnChorusSlider->setValue(r);
3353   returnChorusSlider->blockSignals(false);
3354 }
3355 /*void DeicsOnzeGui::updatePanChorus1(int c) {
3356   panChorus1Knob->blockSignals(true);
3357   panChorus1Knob->setValue((double)c/(double)MAXCHORUSPARAM);
3358   panChorus1Knob->blockSignals(false);
3359 }
3360 void DeicsOnzeGui::updateLFOFreqChorus1(int c) {
3361   LFOFreqChorus1Knob->blockSignals(true);
3362   LFOFreqChorus1Knob->setValue((double)c/(double)MAXCHORUSPARAM);
3363   LFOFreqChorus1Knob->blockSignals(false);
3364 }
3365 void DeicsOnzeGui::updateDepthChorus1(int c) {
3366   depthChorus1Knob->blockSignals(true);
3367   depthChorus1Knob->setValue((double)c/(double)MAXCHORUSPARAM);
3368   depthChorus1Knob->blockSignals(false);
3369 }
3370 void DeicsOnzeGui::updatePanChorus2(int c) {
3371   panChorus2Knob->blockSignals(true);
3372   panChorus2Knob->setValue((double)c/(double)MAXCHORUSPARAM);
3373   panChorus2Knob->blockSignals(false);
3374 }
3375 void DeicsOnzeGui::updateLFOFreqChorus2(int c) {
3376   LFOFreqChorus2Knob->blockSignals(true);
3377   LFOFreqChorus2Knob->setValue((double)c/(double)MAXCHORUSPARAM);
3378   LFOFreqChorus2Knob->blockSignals(false);
3379 }
3380 void DeicsOnzeGui::updateDepthChorus2(int c) {
3381   depthChorus2Knob->blockSignals(true);
3382   depthChorus2Knob->setValue((double)c/(double)MAXCHORUSPARAM);
3383   depthChorus2Knob->blockSignals(false);
3384   }*/
updateReverbActiv(bool a)3385 void DeicsOnzeGui::updateReverbActiv(bool a) {
3386   reverbActivCheckBox->blockSignals(true);
3387   reverbActivCheckBox->setChecked(a);
3388   reverbActivCheckBox->blockSignals(false);
3389 }
updateChannelReverb(int r)3390 void DeicsOnzeGui::updateChannelReverb(int r) {
3391   chReverbSlider->blockSignals(true);
3392   chReverbSlider->setValue(r);
3393   chReverbSlider->blockSignals(false);
3394   chReverbSpinBox->blockSignals(true);
3395   chReverbSpinBox->setValue(r);
3396   chReverbSpinBox->blockSignals(false);
3397 }
updateReverbReturn(int r)3398 void DeicsOnzeGui::updateReverbReturn(int r) {
3399   returnReverbSlider->blockSignals(true);
3400   returnReverbSlider->setValue(r);
3401   returnReverbSlider->blockSignals(false);
3402 }
updateLadspaReverbLineEdit(QString s)3403 void DeicsOnzeGui::updateLadspaReverbLineEdit(QString s) {
3404   selectLadspaReverbLineEdit->blockSignals(true);
3405   selectLadspaReverbLineEdit->setText(s);
3406   selectLadspaReverbLineEdit->blockSignals(false);
3407 }
updateLadspaChorusLineEdit(QString s)3408 void DeicsOnzeGui::updateLadspaChorusLineEdit(QString s) {
3409   selectLadspaChorusLineEdit->blockSignals(true);
3410   selectLadspaChorusLineEdit->setText(s);
3411   selectLadspaChorusLineEdit->blockSignals(false);
3412 }
3413 
updateDelayActiv(bool a)3414 void DeicsOnzeGui::updateDelayActiv(bool a) {
3415   delayActivCheckBox->blockSignals(true);
3416   delayActivCheckBox->setChecked(a);
3417   delayActivCheckBox->blockSignals(false);
3418 }
updateChannelDelay(int r)3419 void DeicsOnzeGui::updateChannelDelay(int r) {
3420   chDelaySlider->blockSignals(true);
3421   chDelaySlider->setValue(r);
3422   chDelaySlider->blockSignals(false);
3423   chDelaySpinBox->blockSignals(true);
3424   chDelaySpinBox->setValue(r);
3425   chDelaySpinBox->blockSignals(false);
3426 }
updateDelayReturn(int r)3427 void DeicsOnzeGui::updateDelayReturn(int r) {
3428   delayReturnSlider->blockSignals(true);
3429   delayReturnSlider->setValue(r);
3430   delayReturnSlider->blockSignals(false);
3431 }
updateDelayPanLFOFreq(float plf)3432 void DeicsOnzeGui::updateDelayPanLFOFreq(float plf) {
3433   delayPanLFOFreqKnob->blockSignals(true);
3434   delayPanLFOFreqKnob->setValue((double)plf);
3435   delayPanLFOFreqKnob->blockSignals(false);
3436   delayPanLFOFreqFloatentry->blockSignals(true);
3437   delayPanLFOFreqFloatentry->setValue((double)plf);
3438   delayPanLFOFreqFloatentry->blockSignals(false);
3439 }
updateDelayBPM(float dt)3440 void DeicsOnzeGui::updateDelayBPM(float dt) {
3441   delayBPMKnob->blockSignals(true);
3442   delayBPMKnob->setValue((double)dt);
3443   delayBPMKnob->blockSignals(false);
3444   delayBPMFloatentry->blockSignals(true);
3445   delayBPMFloatentry->setValue((double)dt);
3446   delayBPMFloatentry->blockSignals(false);
3447 }
updateDelayBeatRatio(float dt)3448 void DeicsOnzeGui::updateDelayBeatRatio(float dt) {
3449   delayBeatRatioKnob->blockSignals(true);
3450   delayBeatRatioKnob->setValue((double)dt);
3451   delayBeatRatioKnob->blockSignals(false);
3452   delayBeatRatioFloatentry->blockSignals(true);
3453   delayBeatRatioFloatentry->setValue((double)dt);
3454   delayBeatRatioFloatentry->blockSignals(false);
3455 }
updateDelayFeedback(float df)3456 void DeicsOnzeGui::updateDelayFeedback(float df) {
3457   delayFeedbackKnob->blockSignals(true);
3458   delayFeedbackKnob->setValue((double)df);
3459   delayFeedbackKnob->blockSignals(false);
3460   delayFeedbackFloatentry->blockSignals(true);
3461   delayFeedbackFloatentry->setValue((double)df);
3462   delayFeedbackFloatentry->blockSignals(false);
3463 }
updateDelayPanLFODepth(float dpd)3464 void DeicsOnzeGui::updateDelayPanLFODepth(float dpd) {
3465   delayPanLFODepthKnob->blockSignals(true);
3466   delayPanLFODepthKnob->setValue((double)dpd);
3467   delayPanLFODepthKnob->blockSignals(false);
3468   delayPanLFODepthFloatentry->blockSignals(true);
3469   delayPanLFODepthFloatentry->setValue((double)dpd);
3470   delayPanLFODepthFloatentry->blockSignals(false);
3471 }
3472 
applyFontSize(int fs)3473 void DeicsOnzeGui::applyFontSize(int fs) {
3474   QFont f = font();
3475   f.setPointSize(fs);
3476   setFont(f);
3477 }
updateSaveConfig(bool usc)3478 void DeicsOnzeGui::updateSaveConfig(bool usc) {
3479   saveConfigCheckBox->blockSignals(true);
3480   saveConfigCheckBox->setChecked(usc);
3481   saveConfigCheckBox->blockSignals(false);
3482 }
updateSaveOnlyUsed(bool usou)3483 void DeicsOnzeGui::updateSaveOnlyUsed(bool usou) {
3484   hugeSaveRadioButton->blockSignals(true);
3485   hugeSaveRadioButton->setChecked(!usou);
3486   hugeSaveRadioButton->blockSignals(false);
3487   minSaveRadioButton->blockSignals(true);
3488   minSaveRadioButton->setChecked(usou);
3489   minSaveRadioButton->blockSignals(false);
3490 }
3491 //Pitch Envelope
updatePL1(int val)3492 void DeicsOnzeGui::updatePL1(int val) {
3493   PL1SpinBox->blockSignals(true);
3494   PL1SpinBox->setValue(val);
3495   PL1SpinBox->blockSignals(false);
3496 }
updatePL2(int val)3497 void DeicsOnzeGui::updatePL2(int val) {
3498   PL2SpinBox->blockSignals(true);
3499   PL2SpinBox->setValue(val);
3500   PL2SpinBox->blockSignals(false);
3501 }
updatePL3(int val)3502 void DeicsOnzeGui::updatePL3(int val) {
3503   PL3SpinBox->blockSignals(true);
3504   PL3SpinBox->setValue(val);
3505   PL3SpinBox->blockSignals(false);
3506 }
updatePR1(int val)3507 void DeicsOnzeGui::updatePR1(int val) {
3508   PR1SpinBox->blockSignals(true);
3509   PR1SpinBox->setValue(val);
3510   PR1SpinBox->blockSignals(false);
3511 }
updatePR2(int val)3512 void DeicsOnzeGui::updatePR2(int val) {
3513   PR2SpinBox->blockSignals(true);
3514   PR2SpinBox->setValue(val);
3515   PR2SpinBox->blockSignals(false);
3516 }
updatePR3(int val)3517 void DeicsOnzeGui::updatePR3(int val) {
3518   PR3SpinBox->blockSignals(true);
3519   PR3SpinBox->setValue(val);
3520   PR3SpinBox->blockSignals(false);
3521 }
3522 //Function
updateFcVolume(int val)3523 void DeicsOnzeGui::updateFcVolume(int val) {
3524   fcVolumeSpinBox->blockSignals(true);
3525   fcVolumeSpinBox->setValue(val);
3526   fcVolumeSpinBox->blockSignals(false);
3527   fcVolumeSlider->blockSignals(true);
3528   fcVolumeSlider->setValue(val);
3529   fcVolumeSlider->blockSignals(false);
3530 }
updateFcPitch(int val)3531 void DeicsOnzeGui::updateFcPitch(int val) {
3532   fcPitchSpinBox->blockSignals(true);
3533   fcPitchSpinBox->setValue(val);
3534   fcPitchSpinBox->blockSignals(false);
3535   fcPitchSlider->blockSignals(true);
3536   fcPitchSlider->setValue(val);
3537   fcPitchSlider->blockSignals(false);
3538 }
updateFcAmplitude(int val)3539 void DeicsOnzeGui::updateFcAmplitude(int val) {
3540   fcAmplitudeSpinBox->blockSignals(true);
3541   fcAmplitudeSpinBox->setValue(val);
3542   fcAmplitudeSpinBox->blockSignals(false);
3543   fcAmplitudeSlider->blockSignals(true);
3544   fcAmplitudeSlider->setValue(val);
3545   fcAmplitudeSlider->blockSignals(false);
3546 }
updateMwPitch(int val)3547 void DeicsOnzeGui::updateMwPitch(int val) {
3548   mwPitchSpinBox->blockSignals(true);
3549   mwPitchSpinBox->setValue(val);
3550   mwPitchSpinBox->blockSignals(false);
3551   mwPitchSlider->blockSignals(true);
3552   mwPitchSlider->setValue(val);
3553   mwPitchSlider->blockSignals(false);
3554 }
updateMwAmplitude(int val)3555 void DeicsOnzeGui::updateMwAmplitude(int val) {
3556   mwAmplitudeSpinBox->blockSignals(true);
3557   mwAmplitudeSpinBox->setValue(val);
3558   mwAmplitudeSpinBox->blockSignals(false);
3559   mwAmplitudeSlider->blockSignals(true);
3560   mwAmplitudeSlider->setValue(val);
3561   mwAmplitudeSlider->blockSignals(false);
3562 }
updateBcPitch(int val)3563 void DeicsOnzeGui::updateBcPitch(int val) {
3564   bcPitchSpinBox->blockSignals(true);
3565   bcPitchSpinBox->setValue(val);
3566   bcPitchSpinBox->blockSignals(false);
3567   bcPitchSlider->blockSignals(true);
3568   bcPitchSlider->setValue(val);
3569   bcPitchSlider->blockSignals(false);
3570 }
updateBcAmplitude(int val)3571 void DeicsOnzeGui::updateBcAmplitude(int val) {
3572   bcAmplitudeSpinBox->blockSignals(true);
3573   bcAmplitudeSpinBox->setValue(val);
3574   bcAmplitudeSpinBox->blockSignals(false);
3575   bcAmplitudeSlider->blockSignals(true);
3576   bcAmplitudeSlider->setValue(val);
3577   bcAmplitudeSlider->blockSignals(false);
3578 }
updateBcPitchBias(int val)3579 void DeicsOnzeGui::updateBcPitchBias(int val) {
3580   bcPitchBiasSpinBox->blockSignals(true);
3581   bcPitchBiasSpinBox->setValue(val);
3582   bcPitchBiasSpinBox->blockSignals(false);
3583   bcPitchBiasSlider->blockSignals(true);
3584   bcPitchBiasSlider->setValue(val);
3585   bcPitchBiasSlider->blockSignals(false);
3586 }
updateBcEgBias(int val)3587 void DeicsOnzeGui::updateBcEgBias(int val) {
3588   bcEgBiasSpinBox->blockSignals(true);
3589   bcEgBiasSpinBox->setValue(val);
3590   bcEgBiasSpinBox->blockSignals(false);
3591   bcEgBiasSlider->blockSignals(true);
3592   bcEgBiasSlider->setValue(val);
3593   bcEgBiasSlider->blockSignals(false);
3594 }
updateAtPitch(int val)3595 void DeicsOnzeGui::updateAtPitch(int val) {
3596   atPitchSpinBox->blockSignals(true);
3597   atPitchSpinBox->setValue(val);
3598   atPitchSpinBox->blockSignals(false);
3599   atPitchSlider->blockSignals(true);
3600   atPitchSlider->setValue(val);
3601   atPitchSlider->blockSignals(false);
3602 }
updateAtAmplitude(int val)3603 void DeicsOnzeGui::updateAtAmplitude(int val) {
3604   atAmplitudeSpinBox->blockSignals(true);
3605   atAmplitudeSpinBox->setValue(val);
3606   atAmplitudeSpinBox->blockSignals(false);
3607   atAmplitudeSlider->blockSignals(true);
3608   atAmplitudeSlider->setValue(val);
3609   atAmplitudeSlider->blockSignals(false);
3610 }
updateAtPitchBias(int val)3611 void DeicsOnzeGui::updateAtPitchBias(int val) {
3612   atPitchBiasSpinBox->blockSignals(true);
3613   atPitchBiasSpinBox->setValue(val);
3614   atPitchBiasSpinBox->blockSignals(false);
3615   atPitchBiasSlider->blockSignals(true);
3616   atPitchBiasSlider->setValue(val);
3617   atPitchBiasSlider->blockSignals(false);
3618 }
updateAtEgBias(int val)3619 void DeicsOnzeGui::updateAtEgBias(int val) {
3620   atEgBiasSpinBox->blockSignals(true);
3621   atEgBiasSpinBox->setValue(val);
3622   atEgBiasSpinBox->blockSignals(false);
3623   atEgBiasSlider->blockSignals(true);
3624   atEgBiasSlider->setValue(val);
3625   atEgBiasSlider->blockSignals(false);
3626 }
3627 //void DeicsOnzeGui::updateReverbRate(int val) {
3628   //reverbSpinBox->blockSignals(true);
3629   //reverbSpinBox->setValue(val);
3630   //reverbSpinBox->blockSignals(false);
3631   //reverbSlider->blockSignals(true);
3632   //reverbSlider->setValue(val);
3633   //reverbSlider->blockSignals(false);
3634 //}
3635 //Envelope
updateAR(int op,int val)3636 void DeicsOnzeGui::updateAR(int op, int val) {
3637     Eg* _eg=&(_deicsOnze->_preset[_currentChannel]->eg[op]);
3638     envelopeGraph[op]->env2Points(val, _eg->d1r, _eg->d1l, _eg->d2r, _eg->rr);
3639     envelopeGraph[op]->updateEnv();
3640     switch(op) {
3641 	case 0:
3642 	    AR1SpinBox->blockSignals(true);
3643 	    AR1SpinBox->setValue(val);
3644 	    AR1SpinBox->blockSignals(false);
3645 	    break;
3646 	case 1:
3647 	    AR2SpinBox->blockSignals(true);
3648 	    AR2SpinBox->setValue(val);
3649 	    AR2SpinBox->blockSignals(false);
3650 	    break;
3651 	case 2:
3652 	    AR3SpinBox->blockSignals(true);
3653 	    AR3SpinBox->setValue(val);
3654 	    AR3SpinBox->blockSignals(false);
3655 	    break;
3656 	case 3:
3657 	    AR4SpinBox->blockSignals(true);
3658 	    AR4SpinBox->setValue(val);
3659 	    AR4SpinBox->blockSignals(false);
3660 	    break;
3661 	default: printf("DeicsOnzeGui::updateAR : Error switch\n");
3662     }
3663 }
3664 
updateD1R(int op,int val)3665 void DeicsOnzeGui::updateD1R(int op, int val) {
3666     Eg* _eg=&(_deicsOnze->_preset[_currentChannel]->eg[op]);
3667     envelopeGraph[op]->env2Points(_eg->ar, val, _eg->d1l, _eg->d2r, _eg->rr);
3668     envelopeGraph[op]->updateEnv();
3669     switch(op) {
3670 	case 0:
3671 	    D1R1SpinBox->blockSignals(true);
3672 	    D1R1SpinBox->setValue(val);
3673 	    D1R1SpinBox->blockSignals(false);
3674 	    break;
3675 	case 1:
3676 	    D1R2SpinBox->blockSignals(true);
3677 	    D1R2SpinBox->setValue(val);
3678 	    D1R2SpinBox->blockSignals(false);
3679 	    break;
3680 	case 2:
3681 	    D1R3SpinBox->blockSignals(true);
3682 	    D1R3SpinBox->setValue(val);
3683 	    D1R3SpinBox->blockSignals(false);
3684 	    break;
3685 	case 3:
3686 	    D1R4SpinBox->blockSignals(true);
3687 	    D1R4SpinBox->setValue(val);
3688 	    D1R4SpinBox->blockSignals(false);
3689 	    break;
3690 	default: printf("DeicsOnzeGui::updateD1R : Error switch\n");
3691     }
3692 }
updateD2R(int op,int val)3693 void DeicsOnzeGui::updateD2R(int op, int val) {
3694     Eg* _eg=&(_deicsOnze->_preset[_currentChannel]->eg[op]);
3695     envelopeGraph[op]->env2Points(_eg->ar, _eg->d1r, _eg->d1l, val, _eg->rr);
3696     envelopeGraph[op]->updateEnv();
3697     switch(op) {
3698 	case 0:
3699 	    D2R1SpinBox->blockSignals(true);
3700 	    D2R1SpinBox->setValue(val);
3701 	    D2R1SpinBox->blockSignals(false);
3702 	    break;
3703 	case 1:
3704 	    D2R2SpinBox->blockSignals(true);
3705 	    D2R2SpinBox->setValue(val);
3706 	    D2R2SpinBox->blockSignals(false);
3707 	    break;
3708 	case 2:
3709 	    D2R3SpinBox->blockSignals(true);
3710 	    D2R3SpinBox->setValue(val);
3711 	    D2R3SpinBox->blockSignals(false);
3712 	    break;
3713 	case 3:
3714 	    D2R4SpinBox->blockSignals(true);
3715 	    D2R4SpinBox->setValue(val);
3716 	    D2R4SpinBox->blockSignals(false);
3717 	    break;
3718 	default: printf("DeicsOnzeGui::updateD2R : Error switch\n");
3719     }
3720 }
updateRR(int op,int val)3721 void DeicsOnzeGui::updateRR(int op, int val) {
3722     Eg* _eg=&(_deicsOnze->_preset[_currentChannel]->eg[op]);
3723     envelopeGraph[op]->env2Points(_eg->ar, _eg->d1r, _eg->d1l, _eg->d2r, val);
3724     envelopeGraph[op]->updateEnv();
3725     switch(op) {
3726 	case 0:
3727 	    RR1SpinBox->blockSignals(true);
3728 	    RR1SpinBox->setValue(val);
3729 	    RR1SpinBox->blockSignals(false);
3730 	    break;
3731 	case 1:
3732 	    RR2SpinBox->blockSignals(true);
3733 	    RR2SpinBox->setValue(val);
3734 	    RR2SpinBox->blockSignals(false);
3735 	    break;
3736 	case 2:
3737 	    RR3SpinBox->blockSignals(true);
3738 	    RR3SpinBox->setValue(val);
3739 	    RR3SpinBox->blockSignals(false);
3740 	    break;
3741 	case 3:
3742 	    RR4SpinBox->blockSignals(true);
3743 	    RR4SpinBox->setValue(val);
3744 	    RR4SpinBox->blockSignals(false);
3745 	    break;
3746 	default: printf("DeicsOnzeGui::updateRR : Error switch\n");
3747     }
3748 }
updateD1L(int op,int val)3749 void DeicsOnzeGui::updateD1L(int op, int val) {
3750     Eg* _eg=&(_deicsOnze->_preset[_currentChannel]->eg[op]);
3751     envelopeGraph[op]->env2Points(_eg->ar, _eg->d1r, val, _eg->d2r, _eg->rr);
3752     envelopeGraph[op]->updateEnv();
3753     switch(op) {
3754 	case 0:
3755 	    D1L1SpinBox->blockSignals(true);
3756 	    D1L1SpinBox->setValue(val);
3757 	    D1L1SpinBox->blockSignals(false);
3758 	    break;
3759 	case 1:
3760 	    D1L2SpinBox->blockSignals(true);
3761 	    D1L2SpinBox->setValue(val);
3762 	    D1L2SpinBox->blockSignals(false);
3763 	    break;
3764 	case 2:
3765 	    D1L3SpinBox->blockSignals(true);
3766 	    D1L3SpinBox->setValue(val);
3767 	    D1L3SpinBox->blockSignals(false);
3768 	    break;
3769 	case 3:
3770 	    D1L4SpinBox->blockSignals(true);
3771 	    D1L4SpinBox->setValue(val);
3772 	    D1L4SpinBox->blockSignals(false);
3773 	    break;
3774 	default: printf("DeicsOnzeGui::updateD1L : Error switch\n");
3775     }
3776 }
updateLS(int op,int val)3777 void DeicsOnzeGui::updateLS(int op, int val) {
3778     switch(op) {
3779 	case 0:
3780 	    LS1Slider->blockSignals(true);
3781 	    LS1Slider->setValue(val);
3782 	    LS1Slider->blockSignals(false);
3783 	    LS1SpinBox->blockSignals(true);
3784 	    LS1SpinBox->setValue(val);
3785 	    LS1SpinBox->blockSignals(false);
3786 	    break;
3787 	case 1:
3788 	    LS2Slider->blockSignals(true);
3789 	    LS2Slider->setValue(val);
3790 	    LS2Slider->blockSignals(false);
3791 	    LS2SpinBox->blockSignals(true);
3792 	    LS2SpinBox->setValue(val);
3793 	    LS2SpinBox->blockSignals(false);
3794 	    break;
3795 	case 2:
3796 	    LS3Slider->blockSignals(true);
3797 	    LS3Slider->setValue(val);
3798 	    LS3Slider->blockSignals(false);
3799 	    LS3SpinBox->blockSignals(true);
3800 	    LS3SpinBox->setValue(val);
3801 	    LS3SpinBox->blockSignals(false);
3802 	    break;
3803 	case 3:
3804 	    LS4Slider->blockSignals(true);
3805 	    LS4Slider->setValue(val);
3806 	    LS4Slider->blockSignals(false);
3807 	    LS4SpinBox->blockSignals(true);
3808 	    LS4SpinBox->setValue(val);
3809 	    LS4SpinBox->blockSignals(false);
3810 	    break;
3811 	default: printf("DeicsOnzeGui::updateLS : Error switch\n");
3812     }
3813 }
updateRS(int op,int val)3814 void DeicsOnzeGui::updateRS(int op, int val) {
3815     switch(op) {
3816 	case 0:
3817 	    RS1Slider->blockSignals(true);
3818 	    RS1Slider->setValue(val);
3819 	    RS1Slider->blockSignals(false);
3820 	    RS1SpinBox->blockSignals(true);
3821 	    RS1SpinBox->setValue(val);
3822 	    RS1SpinBox->blockSignals(false);
3823 	    break;
3824 	case 1:
3825 	    RS2Slider->blockSignals(true);
3826 	    RS2Slider->setValue(val);
3827 	    RS2Slider->blockSignals(false);
3828 	    RS2SpinBox->blockSignals(true);
3829 	    RS2SpinBox->setValue(val);
3830 	    RS2SpinBox->blockSignals(false);
3831 	    break;
3832 	case 2:
3833 	    RS3Slider->blockSignals(true);
3834 	    RS3Slider->setValue(val);
3835 	    RS3Slider->blockSignals(false);
3836 	    RS3SpinBox->blockSignals(true);
3837 	    RS3SpinBox->setValue(val);
3838 	    RS3SpinBox->blockSignals(false);
3839 	    break;
3840 	case 3:
3841 	    RS4Slider->blockSignals(true);
3842 	    RS4Slider->setValue(val);
3843 	    RS4Slider->blockSignals(false);
3844 	    RS4SpinBox->blockSignals(true);
3845 	    RS4SpinBox->setValue(val);
3846 	    RS4SpinBox->blockSignals(false);
3847 	    break;
3848 	default: printf("DeicsOnzeGui::updateRS : Error switch\n");
3849     }
3850 }
updateEBS(int op,int val)3851 void DeicsOnzeGui::updateEBS(int op, int val) {
3852     switch(op) {
3853 	case 0:
3854 	    EBS1Slider->blockSignals(true);
3855 	    EBS1Slider->setValue(val);
3856 	    EBS1Slider->blockSignals(false);
3857 	    EBS1SpinBox->blockSignals(true);
3858 	    EBS1SpinBox->setValue(val);
3859 	    EBS1SpinBox->blockSignals(false);
3860 	    break;
3861 	case 1:
3862 	    EBS2Slider->blockSignals(true);
3863 	    EBS2Slider->setValue(val);
3864 	    EBS2Slider->blockSignals(false);
3865 	    EBS2SpinBox->blockSignals(true);
3866 	    EBS2SpinBox->setValue(val);
3867 	    EBS2SpinBox->blockSignals(false);
3868 	    break;
3869 	case 2:
3870 	    EBS3Slider->blockSignals(true);
3871 	    EBS3Slider->setValue(val);
3872 	    EBS3Slider->blockSignals(false);
3873 	    EBS3SpinBox->blockSignals(true);
3874 	    EBS3SpinBox->setValue(val);
3875 	    EBS3SpinBox->blockSignals(false);
3876 	    break;
3877 	case 3:
3878 	    EBS4Slider->blockSignals(true);
3879 	    EBS4Slider->setValue(val);
3880 	    EBS4Slider->blockSignals(false);
3881 	    EBS4SpinBox->blockSignals(true);
3882 	    EBS4SpinBox->setValue(val);
3883 	    EBS4SpinBox->blockSignals(false);
3884 	    break;
3885 	default: printf("DeicsOnzeGui::updateEBS : Error switch\n");
3886     }
3887 }
updateAME(int op,bool val)3888 void DeicsOnzeGui::updateAME(int op, bool val) {
3889     switch(op) {
3890 	case 0:
3891 	    AME1CheckBox->blockSignals(true);
3892 	    AME1CheckBox->setChecked(val);
3893 	    AME1CheckBox->blockSignals(false);
3894 	    break;
3895 	case 1:
3896 	    AME2CheckBox->blockSignals(true);
3897 	    AME2CheckBox->setChecked(val);
3898 	    AME2CheckBox->blockSignals(false);
3899 	    break;
3900 	case 2:
3901 	    AME3CheckBox->blockSignals(true);
3902 	    AME3CheckBox->setChecked(val);
3903 	    AME3CheckBox->blockSignals(false);
3904 	    break;
3905 	case 3:
3906 	    AME4CheckBox->blockSignals(true);
3907 	    AME4CheckBox->setChecked(val);
3908 	    AME4CheckBox->blockSignals(false);
3909 	    break;
3910 	default: printf("DeicsOnzeGui::updateAME : Error switch\n");
3911     }
3912 }
updateKVS(int op,int val)3913 void DeicsOnzeGui::updateKVS(int op, int val) {
3914     switch(op) {
3915 	case 0:
3916 	    KVS1Slider->blockSignals(true);
3917 	    KVS1Slider->setValue(val);
3918 	    KVS1Slider->blockSignals(false);
3919 	    KVS1SpinBox->blockSignals(true);
3920 	    KVS1SpinBox->setValue(val);
3921 	    KVS1SpinBox->blockSignals(false);
3922 	    break;
3923 	case 1:
3924 	    KVS2Slider->blockSignals(true);
3925 	    KVS2Slider->setValue(val);
3926 	    KVS2Slider->blockSignals(false);
3927 	    KVS2SpinBox->blockSignals(true);
3928 	    KVS2SpinBox->setValue(val);
3929 	    KVS2SpinBox->blockSignals(false);
3930 	    break;
3931 	case 2:
3932 	    KVS3Slider->blockSignals(true);
3933 	    KVS3Slider->setValue(val);
3934 	    KVS3Slider->blockSignals(false);
3935 	    KVS3SpinBox->blockSignals(true);
3936 	    KVS3SpinBox->setValue(val);
3937 	    KVS3SpinBox->blockSignals(false);
3938 	    break;
3939 	case 3:
3940 	    KVS4Slider->blockSignals(true);
3941 	    KVS4Slider->setValue(val);
3942 	    KVS4Slider->blockSignals(false);
3943 	    KVS4SpinBox->blockSignals(true);
3944 	    KVS4SpinBox->setValue(val);
3945 	    KVS4SpinBox->blockSignals(false);
3946 	    break;
3947 	default: printf("DeicsOnzeGui::updateKVS : Error switch\n");
3948     }
3949 }
updateOUT(int op,int val)3950 void DeicsOnzeGui::updateOUT(int op, int val) {
3951     switch(op) {
3952 	case 0:
3953 	    OUT1Slider->blockSignals(true);
3954 	    OUT1Slider->setValue(val);
3955 	    OUT1Slider->blockSignals(false);
3956 	    OUT1SpinBox->blockSignals(true);
3957 	    OUT1SpinBox->setValue(val);
3958 	    OUT1SpinBox->blockSignals(false);
3959 	    break;
3960 	case 1:
3961 	    OUT2Slider->blockSignals(true);
3962 	    OUT2Slider->setValue(val);
3963 	    OUT2Slider->blockSignals(false);
3964 	    OUT2SpinBox->blockSignals(true);
3965 	    OUT2SpinBox->setValue(val);
3966 	    OUT2SpinBox->blockSignals(false);
3967 	    break;
3968 	case 2:
3969 	    OUT3Slider->blockSignals(true);
3970 	    OUT3Slider->setValue(val);
3971 	    OUT3Slider->blockSignals(false);
3972 	    OUT3SpinBox->blockSignals(true);
3973 	    OUT3SpinBox->setValue(val);
3974 	    OUT3SpinBox->blockSignals(false);
3975 	    break;
3976 	case 3:
3977 	    OUT4Slider->blockSignals(true);
3978 	    OUT4Slider->setValue(val);
3979 	    OUT4Slider->blockSignals(false);
3980 	    OUT4SpinBox->blockSignals(true);
3981 	    OUT4SpinBox->setValue(val);
3982 	    OUT4SpinBox->blockSignals(false);
3983 	    break;
3984 	default: printf("DeicsOnzeGui::updateOUT : Error switch\n");
3985     }
3986 }
updateRATIO(int op,int val)3987 void DeicsOnzeGui::updateRATIO(int op, int val) {
3988     switch(op) {
3989 	case 0:
3990 	    CoarseRatio1SpinBox->blockSignals(true);
3991 	    CoarseRatio1SpinBox->setValue(val/100);
3992 	    CoarseRatio1SpinBox->blockSignals(false);
3993 	    FineRatio1SpinBox->blockSignals(true);
3994 	    FineRatio1SpinBox->setValue(val%100);
3995 	    FineRatio1SpinBox->blockSignals(false);
3996 	    break;
3997 	case 1:
3998 	    CoarseRatio2SpinBox->blockSignals(true);
3999 	    CoarseRatio2SpinBox->setValue(val/100);
4000 	    CoarseRatio2SpinBox->blockSignals(false);
4001 	    FineRatio2SpinBox->blockSignals(true);
4002 	    FineRatio2SpinBox->setValue(val%100);
4003 	    FineRatio2SpinBox->blockSignals(false);
4004 	    break;
4005 	case 2:
4006 	    CoarseRatio3SpinBox->blockSignals(true);
4007 	    CoarseRatio3SpinBox->setValue(val/100);
4008 	    CoarseRatio3SpinBox->blockSignals(false);
4009 	    FineRatio3SpinBox->blockSignals(true);
4010 	    FineRatio3SpinBox->setValue(val%100);
4011 	    FineRatio3SpinBox->blockSignals(false);
4012 	    break;
4013 	case 3:
4014 	    CoarseRatio4SpinBox->blockSignals(true);
4015 	    CoarseRatio4SpinBox->setValue(val/100);
4016 	    CoarseRatio4SpinBox->blockSignals(false);
4017 	    FineRatio4SpinBox->blockSignals(true);
4018 	    FineRatio4SpinBox->setValue(val%100);
4019 	    FineRatio4SpinBox->blockSignals(false);
4020 	    break;
4021 	default: printf("DeicsOnzeGui::updateRATIO : Error switch\n");
4022     }
4023 }
updateDET(int op,int val)4024 void DeicsOnzeGui::updateDET(int op, int val) {
4025     switch(op) {
4026 	case 0:
4027 	    DET1Slider->blockSignals(true);
4028 	    DET1Slider->setValue(val);
4029 	    DET1Slider->blockSignals(false);
4030 	    DET1SpinBox->blockSignals(true);
4031 	    DET1SpinBox->setValue(val);
4032 	    DET1SpinBox->blockSignals(false);
4033 	    break;
4034 	case 1:
4035 	    DET2Slider->blockSignals(true);
4036 	    DET2Slider->setValue(val);
4037 	    DET2Slider->blockSignals(false);
4038 	    DET2SpinBox->blockSignals(true);
4039 	    DET2SpinBox->setValue(val);
4040 	    DET2SpinBox->blockSignals(false);
4041 	    break;
4042 	case 2:
4043 	    DET3Slider->blockSignals(true);
4044 	    DET3Slider->setValue(val);
4045 	    DET3Slider->blockSignals(false);
4046 	    DET3SpinBox->blockSignals(true);
4047 	    DET3SpinBox->setValue(val);
4048 	    DET3SpinBox->blockSignals(false);
4049 	    break;
4050 	case 3:
4051 	    DET4Slider->blockSignals(true);
4052 	    DET4Slider->setValue(val);
4053 	    DET4Slider->blockSignals(false);
4054 	    DET4SpinBox->blockSignals(true);
4055 	    DET4SpinBox->setValue(val);
4056 	    DET4SpinBox->blockSignals(false);
4057 	    break;
4058 	default: printf("DeicsOnzeGui::updateDET : Error switch\n");
4059     }
4060 }
updateALG(int val)4061 void DeicsOnzeGui::updateALG(int val) {
4062     algorithmComboBox->blockSignals(true);
4063     algorithmComboBox->setCurrentIndex(val);
4064     algorithmComboBox->blockSignals(false);
4065 }
updateFEEDBACK(int val)4066 void DeicsOnzeGui::updateFEEDBACK(int val) {
4067     feedbackSlider->blockSignals(true);
4068     feedbackSlider->setValue(val);
4069     feedbackSlider->blockSignals(false);
4070     feedbackSpinBox->blockSignals(true);
4071     feedbackSpinBox->setValue(val);
4072     feedbackSpinBox->blockSignals(false);
4073 }
updateSPEED(int val)4074 void DeicsOnzeGui::updateSPEED(int val) {
4075     LFOSpeedSlider->blockSignals(true);
4076     LFOSpeedSlider->setValue(val);
4077     LFOSpeedSlider->blockSignals(false);
4078     LFOSpeedSpinBox->blockSignals(true);
4079     LFOSpeedSpinBox->setValue(val);
4080     LFOSpeedSpinBox->blockSignals(false);
4081 }
updateDELAY(int val)4082 void DeicsOnzeGui::updateDELAY(int val) {
4083     LFODelaySlider->blockSignals(true);
4084     LFODelaySlider->setValue(val);
4085     LFODelaySlider->blockSignals(false);
4086     LFODelaySpinBox->blockSignals(true);
4087     LFODelaySpinBox->setValue(val);
4088     LFODelaySpinBox->blockSignals(false);
4089 }
updatePMODDEPTH(int val)4090 void DeicsOnzeGui::updatePMODDEPTH(int val) {
4091     PModDepthSlider->blockSignals(true);
4092     PModDepthSlider->setValue(val);
4093     PModDepthSlider->blockSignals(false);
4094     PModDepthSpinBox->blockSignals(true);
4095     PModDepthSpinBox->setValue(val);
4096     PModDepthSpinBox->blockSignals(false);
4097 }
updateAMODDEPTH(int val)4098 void DeicsOnzeGui::updateAMODDEPTH(int val) {
4099     AModDepthSlider->blockSignals(true);
4100     AModDepthSlider->setValue(val);
4101     AModDepthSlider->blockSignals(false);
4102     AModDepthSpinBox->blockSignals(true);
4103     AModDepthSpinBox->setValue(val);
4104     AModDepthSpinBox->blockSignals(false);
4105 }
updateSYNC(bool val)4106 void DeicsOnzeGui::updateSYNC(bool val) {
4107     LFOSyncCheckBox->blockSignals(true);
4108     LFOSyncCheckBox->setChecked(val);
4109     LFOSyncCheckBox->blockSignals(false);
4110 }
updateWAVE(int val)4111 void DeicsOnzeGui::updateWAVE(int val) {
4112     LFOWaveComboBox->blockSignals(true);
4113     LFOWaveComboBox->setCurrentIndex(val);
4114     LFOWaveComboBox->blockSignals(false);
4115 }
updatePMODSENS(int val)4116 void DeicsOnzeGui::updatePMODSENS(int val) {
4117     PModSensSlider->blockSignals(true);
4118     PModSensSlider->setValue(val);
4119     PModSensSlider->blockSignals(false);
4120     PModSensSpinBox->blockSignals(true);
4121     PModSensSpinBox->setValue(val);
4122     PModSensSpinBox->blockSignals(false);
4123 }
updateAMS(int val)4124 void DeicsOnzeGui::updateAMS(int val) {
4125     AModSensSlider->blockSignals(true);
4126     AModSensSlider->setValue(val);
4127     AModSensSlider->blockSignals(false);
4128     AModSensSpinBox->blockSignals(true);
4129     AModSensSpinBox->setValue(val);
4130     AModSensSpinBox->blockSignals(false);
4131 }
updateTRANSPOSE(int val)4132 void DeicsOnzeGui::updateTRANSPOSE(int val) {
4133     transposeSlider->blockSignals(true);
4134     transposeSlider->setValue(val);
4135     transposeSlider->blockSignals(false);
4136     transposeSpinBox->blockSignals(true);
4137     transposeSpinBox->setValue(val);
4138     transposeSpinBox->blockSignals(false);
4139 }
updatePOLYMODE(int val)4140 void DeicsOnzeGui::updatePOLYMODE(int val) {
4141     polyMonoComboBox->blockSignals(true);
4142     polyMonoComboBox->setCurrentIndex(val);
4143     polyMonoComboBox->blockSignals(false);
4144 }
updatePBENDRANGE(int val)4145 void DeicsOnzeGui::updatePBENDRANGE(int val) {
4146     pitchBendRangeSlider->blockSignals(true);
4147     pitchBendRangeSlider->setValue(val);
4148     pitchBendRangeSlider->blockSignals(false);
4149     pitchBendRangeSpinBox->blockSignals(true);
4150     pitchBendRangeSpinBox->setValue(val);
4151     pitchBendRangeSpinBox->blockSignals(false);
4152 }
updatePORTAMODE(int val)4153 void DeicsOnzeGui::updatePORTAMODE(int val) {
4154     PortFingerFullComboBox->blockSignals(true);
4155     PortFingerFullComboBox->setCurrentIndex(val);
4156     PortFingerFullComboBox->blockSignals(false);
4157 }
updatePORTATIME(int val)4158 void DeicsOnzeGui::updatePORTATIME(int val) {
4159     PortamentoTimeSlider->blockSignals(true);
4160     PortamentoTimeSlider->setValue(val);
4161     PortamentoTimeSlider->blockSignals(false);
4162     PortamentoTimeSpinBox->blockSignals(true);
4163     PortamentoTimeSpinBox->setValue(val);
4164     PortamentoTimeSpinBox->blockSignals(false);
4165 }
updateFIX(int op,bool val)4166 void DeicsOnzeGui::updateFIX(int op, bool val) {
4167     switch(op) {
4168 	case 0:
4169 	    Fix1CheckBox->blockSignals(true);
4170 	    Fix1CheckBox->setChecked(val);
4171 	    Fix1CheckBox->blockSignals(false);
4172 	    FineRatio1SpinBox->blockSignals(true);
4173 	    FineRatio1SpinBox->setEnabled(!val);
4174 	    FineRatio1SpinBox->blockSignals(false);
4175 	    CoarseRatio1SpinBox->blockSignals(true);
4176 	    CoarseRatio1SpinBox->setEnabled(!val);
4177 	    CoarseRatio1SpinBox->blockSignals(false);
4178 	    break;
4179 	case 1:
4180 	    Fix2CheckBox->blockSignals(true);
4181 	    Fix2CheckBox->setChecked(val);
4182 	    Fix2CheckBox->blockSignals(false);
4183 	    FineRatio2SpinBox->blockSignals(true);
4184 	    FineRatio2SpinBox->setEnabled(!val);
4185 	    FineRatio2SpinBox->blockSignals(false);
4186 	    CoarseRatio2SpinBox->blockSignals(true);
4187 	    CoarseRatio2SpinBox->setEnabled(!val);
4188 	    CoarseRatio2SpinBox->blockSignals(false);
4189 	    break;
4190 	case 2:
4191 	    Fix3CheckBox->blockSignals(true);
4192 	    Fix3CheckBox->setChecked(val);
4193 	    Fix3CheckBox->blockSignals(false);
4194 	    FineRatio3SpinBox->blockSignals(true);
4195 	    FineRatio3SpinBox->setEnabled(!val);
4196 	    FineRatio3SpinBox->blockSignals(false);
4197 	    CoarseRatio3SpinBox->blockSignals(true);
4198 	    CoarseRatio3SpinBox->setEnabled(!val);
4199 	    CoarseRatio3SpinBox->blockSignals(false);
4200 	    break;
4201 	case 3:
4202 	    Fix4CheckBox->blockSignals(true);
4203 	    Fix4CheckBox->setChecked(val);
4204 	    Fix4CheckBox->blockSignals(false);
4205 	    FineRatio4SpinBox->blockSignals(true);
4206 	    FineRatio4SpinBox->setEnabled(!val);
4207 	    FineRatio4SpinBox->blockSignals(false);
4208 	    CoarseRatio4SpinBox->blockSignals(true);
4209 	    CoarseRatio4SpinBox->setEnabled(!val);
4210 	    CoarseRatio4SpinBox->blockSignals(false);
4211 	    break;
4212 	default: printf("DeicsOnzeGui::updateFIX : error switch\n");
4213     }
4214 }
updateFIXRANGE(int op,int val)4215 void DeicsOnzeGui::updateFIXRANGE(int op, int val) {
4216     switch(op) {
4217 	case 0:
4218 	    Freq1SpinBox->blockSignals(true);
4219 	    Freq1SpinBox->setValue(val/100);
4220 	    //val/100 because it is still a coarse display
4221 	    Freq1SpinBox->blockSignals(false);
4222 	    break;
4223 	case 1:
4224 	    Freq2SpinBox->blockSignals(true);
4225 	    Freq2SpinBox->setValue(val/100);
4226 	    Freq2SpinBox->blockSignals(false);
4227 	    break;
4228 	case 2:
4229 	    Freq3SpinBox->blockSignals(true);
4230 	    Freq3SpinBox->setValue(val/100);
4231 	    Freq3SpinBox->blockSignals(false);
4232 	    break;
4233 	case 3:
4234 	    Freq4SpinBox->blockSignals(true);
4235 	    Freq4SpinBox->setValue(val/100);
4236 	    Freq4SpinBox->blockSignals(false);
4237 	    break;
4238 	default: printf("DeicsOnzeGui::updateFIXRANGE : error switch\n");
4239     }
4240 }
updateOSW(int op,int val)4241 void DeicsOnzeGui::updateOSW(int op, int val) {
4242   switch(op) {
4243   case 0:
4244     WaveForm1ComboBox->blockSignals(true);
4245     WaveForm1ComboBox->setCurrentIndex(val);
4246     WaveForm1ComboBox->blockSignals(false);
4247     break;
4248   case 1:
4249     WaveForm2ComboBox->blockSignals(true);
4250     WaveForm2ComboBox->setCurrentIndex(val);
4251     WaveForm2ComboBox->blockSignals(false);
4252     break;
4253   case 2:
4254     WaveForm3ComboBox->blockSignals(true);
4255     WaveForm3ComboBox->setCurrentIndex(val);
4256     WaveForm3ComboBox->blockSignals(false);
4257     break;
4258   case 3:
4259     WaveForm4ComboBox->blockSignals(true);
4260     WaveForm4ComboBox->setCurrentIndex(val);
4261     WaveForm4ComboBox->blockSignals(false);
4262     break;
4263   default: printf("DeicsOnzeGui::updateOSW : Error switch\n");
4264   }
4265 }
updateSHFT(int op,int val)4266 void DeicsOnzeGui::updateSHFT(int op, int val) {
4267   switch(op) {
4268   case 0:
4269     EGS1ComboBox->blockSignals(true);
4270     EGS1ComboBox->setCurrentIndex(val);
4271     EGS1ComboBox->blockSignals(false);
4272     break;
4273   case 1:
4274     EGS2ComboBox->blockSignals(true);
4275     EGS2ComboBox->setCurrentIndex(val);
4276     EGS2ComboBox->blockSignals(false);
4277     break;
4278   case 2:
4279     EGS3ComboBox->blockSignals(true);
4280     EGS3ComboBox->setCurrentIndex(val);
4281     EGS3ComboBox->blockSignals(false);
4282     break;
4283   case 3:
4284     EGS4ComboBox->blockSignals(true);
4285     EGS4ComboBox->setCurrentIndex(val);
4286     EGS4ComboBox->blockSignals(false);
4287     break;
4288   default: printf("DeicsOnzeGui::updateSHFT : Error switch\n");
4289   }
4290 }
updateChannelDetune(int val)4291 void DeicsOnzeGui::updateChannelDetune(int val) {
4292   updateChannelDetuneKnob(val);
4293   //updateChannelDetuneSlider(val);
4294 }
updateChannelDetuneKnob(int val)4295 void DeicsOnzeGui::updateChannelDetuneKnob(int val) {
4296   detuneKnob->blockSignals(true);
4297   detuneKnob->setValue((((double)val)/((double)MAXCHANNELDETUNE))/2.0+0.5);
4298   detuneKnob->blockSignals(false);
4299 }
4300 //void DeicsOnzeGui::updateChannelDetuneSlider(int val) {
4301   //channelDetuneSlider->blockSignals(true);
4302   //channelDetuneSlider->setValue(val);
4303   //channelDetuneSlider->blockSignals(false);
4304   //channelDetuneSpinBox->blockSignals(true);
4305   //channelDetuneSpinBox->setValue(val);
4306   //channelDetuneSpinBox->blockSignals(false);
4307 //}
updateChannelVolume(int val)4308 void DeicsOnzeGui::updateChannelVolume(int val) {
4309   channelVolumeKnob->blockSignals(true);
4310   channelVolumeKnob->setValue(((double)val)/(double)MAXCHANNELVOLUME);
4311   channelVolumeKnob->blockSignals(false);
4312 }
updateCategoryName(QString cn,bool enable)4313 void DeicsOnzeGui::updateCategoryName(QString cn, bool enable) {
4314   categoryLineEdit->setEnabled(enable);
4315   categoryLineEdit->blockSignals(true);
4316   categoryLineEdit->setText(cn);
4317   categoryLineEdit->blockSignals(false);
4318 }
updateSubcategoryName(QString sn,bool enable)4319 void DeicsOnzeGui::updateSubcategoryName(QString sn, bool enable) {
4320   subcategoryLineEdit->setEnabled(enable);
4321   subcategoryLineEdit->blockSignals(true);
4322   subcategoryLineEdit->setText(sn);
4323   subcategoryLineEdit->blockSignals(false);
4324 }
updatePresetName(QString pn)4325 void DeicsOnzeGui::updatePresetName(QString pn) {
4326   //presetNameLineEdit->blockSignals(true);
4327   //presetNameLineEdit->setText(pn);
4328   //presetNameLineEdit->blockSignals(false);
4329   //presetNameLabel->setText(pn);
4330   presetLineEdit->blockSignals(true);
4331   presetLineEdit->setText(pn);
4332   presetLineEdit->blockSignals(false);
4333 }
updatePresetName(QString pn,bool enable)4334 void DeicsOnzeGui::updatePresetName(QString pn, bool enable) {
4335   presetLineEdit->setEnabled(enable);
4336   //presetNameLineEdit->setEnabled(enable);
4337   updatePresetName(pn);
4338 }
updateHBank(int n,bool enable)4339 void DeicsOnzeGui::updateHBank(int n, bool enable) {
4340   hbankSpinBox->setEnabled(enable);
4341   hbankSpinBox->blockSignals(true);
4342   hbankSpinBox->setValue(n+1);
4343   hbankSpinBox->blockSignals(false);
4344 }
updateLBank(int n,bool enable)4345 void DeicsOnzeGui::updateLBank(int n, bool enable) {
4346   lbankSpinBox->setEnabled(enable);
4347   lbankSpinBox->blockSignals(true);
4348   lbankSpinBox->setValue(n+1);
4349   lbankSpinBox->blockSignals(false);
4350 }
updateProg(int n,bool enable)4351 void DeicsOnzeGui::updateProg(int n, bool enable) {
4352   progSpinBox->setEnabled(enable);
4353   progSpinBox->blockSignals(true);
4354   progSpinBox->setValue(n+1);
4355   progSpinBox->blockSignals(false);
4356 }
updateInitSetCheckBox(bool b)4357 void DeicsOnzeGui::updateInitSetCheckBox(bool b) {
4358   initSetCheckBox->blockSignals(true);
4359   initSetCheckBox->setChecked(b);
4360   initSetCheckBox->blockSignals(false);
4361   initSetPathLineEdit->setEnabled(b);
4362   initSetBrowsePushButton-> setEnabled(b);
4363 }
updateInitSetPath(QString s)4364 void DeicsOnzeGui::updateInitSetPath(QString s) {
4365   initSetPathLineEdit->blockSignals(true);
4366   initSetPathLineEdit->setText(s);
4367   initSetPathLineEdit->blockSignals(false);
4368 }
updateBackgroundPixCheckBox(bool b)4369 void DeicsOnzeGui::updateBackgroundPixCheckBox(bool b) {
4370   imageCheckBox->blockSignals(true);
4371   imageCheckBox->setChecked(b);
4372   imageCheckBox->blockSignals(false);
4373   imagePathLineEdit->setEnabled(b);
4374   imageBrowsePushButton-> setEnabled(b);
4375 }
updateBackgroundPixPath(QString s)4376 void DeicsOnzeGui::updateBackgroundPixPath(QString s) {
4377   imagePathLineEdit->blockSignals(true);
4378   imagePathLineEdit->setText(s);
4379   imagePathLineEdit->blockSignals(false);
4380 }
applyBackgroundPix()4381 void DeicsOnzeGui::applyBackgroundPix() {
4382   #ifdef DEICSONZE_DEBUG
4383   printf("applyBackgroundPix\n");
4384   #endif
4385   QPalette p = this->palette();
4386   QPixmap pixmap = QPixmap(imagePathLineEdit->text());
4387   p.setBrush((this)->backgroundRole(), QBrush(pixmap));
4388   (this)->setPalette(p);
4389 }
updateChannelPan(int val)4390 void DeicsOnzeGui::updateChannelPan(int val) {
4391   channelPanKnob->blockSignals(true);
4392   channelPanKnob->setValue((((double)val/(double)MAXCHANNELPAN)+1.0)/2.0);
4393   channelPanKnob->blockSignals(false);
4394   //channelPanSpinBox->blockSignals(true);
4395   //channelPanSpinBox->setValue(val);
4396   //channelPanSpinBox->blockSignals(false);
4397 }
updateBrightness(int val)4398 void DeicsOnzeGui::updateBrightness(int val) {
4399   brightnessKnob->blockSignals(true);
4400   brightnessKnob->setValue((double)val/((double)MAXFINEBRIGHTNESS));
4401   brightnessKnob->blockSignals(false);
4402 }
updateModulation(int val)4403 void DeicsOnzeGui::updateModulation(int val) {
4404   modulationKnob->blockSignals(true);
4405   modulationKnob->setValue((double)val/((double)MAXMODULATION));
4406   modulationKnob->blockSignals(false);
4407 }
updateAttack(int val)4408 void DeicsOnzeGui::updateAttack(int val) {
4409   attackKnob->blockSignals(true);
4410   attackKnob->setValue((double)val/((double)MAXATTACK));
4411   attackKnob->blockSignals(false);
4412 }
updateRelease(int val)4413 void DeicsOnzeGui::updateRelease(int val) {
4414   releaseKnob->blockSignals(true);
4415   releaseKnob->setValue((double)val/((double)MAXRELEASE));
4416   releaseKnob->blockSignals(false);
4417 }
updateQuickEdit()4418 void DeicsOnzeGui::updateQuickEdit() {
4419   updateChannelVolume(_deicsOnze->getChannelVol(_currentChannel));
4420   updateChannelPan(_deicsOnze->getChannelPan(_currentChannel));
4421   updateBrightness(_deicsOnze->getChannelBrightness(_currentChannel));
4422   updateModulation(_deicsOnze->getChannelModulation(_currentChannel));
4423   updateChannelDetune(_deicsOnze->getChannelDetune(_currentChannel));
4424   updateAttack(_deicsOnze->getChannelAttack(_currentChannel));
4425   updateRelease(_deicsOnze->getChannelRelease(_currentChannel));
4426   updateChannelReverb(_deicsOnze->getChannelReverb(_currentChannel));
4427   updateChannelChorus(_deicsOnze->getChannelChorus(_currentChannel));
4428   updateChannelDelay(_deicsOnze->getChannelDelay(_currentChannel));
4429 }
4430 //--------------------------------------------------------------
4431 // updatePreset
4432 //--------------------------------------------------------------
updatePreset(Preset * p)4433 void DeicsOnzeGui::updatePreset(Preset* p) {
4434     //TODO : why updateMasterVolume
4435     //updateMasterVolume(_deicsOnze->getMasterVol()); //to change
4436     updatePresetName(p->name.c_str());
4437     updateFEEDBACK(p->feedback);
4438     updateWAVE((int)p->lfo.wave);
4439     updateSPEED(p->lfo.speed);
4440     updateDELAY(p->lfo.delay);
4441     updatePMODDEPTH(p->lfo.pModDepth);
4442     updatePMODSENS(p->sensitivity.pitch);
4443     updateAMODDEPTH(p->lfo.aModDepth);
4444     updateAMS(p->sensitivity.amplitude);
4445     updateTRANSPOSE(p->function.transpose);
4446     updateALG((int)p->algorithm);
4447     updatePBENDRANGE(p->function.pBendRange);
4448     //pitch envelope
4449     PitchEg* pe=&(p->pitchEg);
4450     pitchEnvelopeGraph
4451       ->env2Points(pe->pl1, pe->pl2, pe->pl3, pe->pr1, pe->pr2, pe->pr3);
4452     pitchEnvelopeGraph->updateEnv();
4453     updatePL1(pe->pl1);
4454     updatePL2(pe->pl2);
4455     updatePL3(pe->pl3);
4456     updatePR1(pe->pr1);
4457     updatePR2(pe->pr2);
4458     updatePR3(pe->pr3);
4459     //function
4460     updateFcVolume(p->function.fcVolume);
4461     updateFcPitch(p->function.fcPitch);
4462     updateFcAmplitude(p->function.fcAmplitude);
4463     updateMwPitch(p->function.mwPitch);
4464     updateMwAmplitude(p->function.mwAmplitude);
4465     updateBcPitch(p->function.bcPitch);
4466     updateBcAmplitude(p->function.bcAmplitude);
4467     updateBcPitchBias(p->function.bcPitchBias);
4468     updateBcEgBias(p->function.bcEgBias);
4469     updateAtPitch(p->function.atPitch);
4470     updateAtAmplitude(p->function.atAmplitude);
4471     updateAtPitchBias(p->function.atPitchBias);
4472     updateAtEgBias(p->function.atEgBias);
4473     //updateReverbRate(p->function.reverbRate);
4474     updatePOLYMODE((int)p->function.mode);
4475     updatePORTAMODE((int)p->function.portamento);
4476     updatePORTATIME((int)p->function.portamentoTime);
4477     for(int k=0; k<NBROP; k++) {
4478 	//envelope
4479 	Eg* _eg=&(p->eg[k]);
4480 	envelopeGraph[k]
4481 	    ->env2Points(_eg->ar, _eg->d1r, _eg->d1l, _eg->d2r, _eg->rr);
4482 	envelopeGraph[k]->updateEnv();
4483 	updateAR(k, _eg->ar);
4484 	updateD1R(k, _eg->d1r);
4485 	updateD1L(k, _eg->d1l);
4486 	updateD2R(k, _eg->d2r);
4487 	updateRR(k, _eg->rr);
4488 	//scaling
4489 	updateLS(k, p->scaling.level[k]);
4490 	updateRS(k, p->scaling.rate[k]);
4491 	//Volume
4492 	updateOUT(k, p->outLevel[k]);
4493 	//Ratio and Frequency
4494 	updateRATIO(k, (int)(100*p->frequency[k].ratio));
4495 	updateFIXRANGE(k, (int)(100*p->frequency[k].freq));
4496 	updateFIX(k, p->frequency[k].isFix);
4497 	//Sensitivity
4498 	updateAME(k, p->sensitivity.ampOn[k]);
4499 	updateEBS(k, p->sensitivity.egBias[k]);
4500 	updateKVS(k, p->sensitivity.keyVelocity[k]);
4501 	//detune
4502 	updateDET(k, p->detune[k]);
4503 	//Waveform
4504 	updateOSW(k, (int)p->oscWave[0]);
4505     }
4506 }
4507 /*void DeicsOnzeGui::updateCurrentChannel() {
4508   updateBrightness(_deicsOnze->_global.channel[_currentChannel].brightness);
4509   updateModulation(_deicsOnze->_global.channel[_currentChannel].modulation);
4510   updateChannelDetune(_deicsOnze->_global.channel[_currentChannel].detune);
4511   updateAttack(_deicsOnze->_global.channel[_currentChannel].attack);
4512   updateRelease(_deicsOnze->_global.channel[_currentChannel].release);
4513   }*/
updatePreset()4514 void DeicsOnzeGui::updatePreset() {
4515   updatePreset(_deicsOnze->_preset[_currentChannel]);
4516 }
4517 
updateSelectPreset(int hbank,int lbank,int prog)4518 void DeicsOnzeGui::updateSelectPreset(int hbank, int lbank, int prog) {
4519   //QTreeWidgetItem* cat = categoryListView->currentItem();
4520   //QTreeWidgetItem* sub = subcategoryListView->currentItem();
4521   //QTreeWidgetItem* pre = presetListView->currentItem();
4522   //select category, subcategory, preset
4523   //category
4524   QList<QTreeWidgetItem *> qlcat =
4525     categoryListView->findItems(num3Digits(hbank+1), Qt::MatchExactly);
4526   QTreeWidgetItem* qcat = qlcat.empty()? NULL:qlcat.at(0);
4527   //if the category is different than the last one then select the new one
4528   //if(!cat || !qcat || qcat!= cat) {
4529   if(qcat) {
4530     qcat->setSelected(true);
4531     categoryListView->setCurrentItem(qcat);
4532     categoryListView->scrollToItem(qcat);
4533     setEnabledPreset(true);
4534   }
4535   else {
4536     updateCategoryName(QString("NONE"), false);
4537     updateHBank(hbank, false);
4538     categoryListView->clearSelection();
4539     subcategoryListView->clear();
4540     setEnabledPreset(false);
4541   }
4542   //}
4543   //subcategory
4544   //if(cat) {
4545   QList<QTreeWidgetItem *> qlsub =
4546     subcategoryListView->findItems(num3Digits(lbank+1), Qt::MatchExactly);
4547   QTreeWidgetItem* qsub = qlsub.empty()? NULL:qlsub.at(0);
4548   //  if(!sub || qsub!=sub) {
4549   if(qsub) {
4550     qsub->setSelected(true);
4551     subcategoryListView->setCurrentItem(qsub);
4552     subcategoryListView->scrollToItem(qsub);
4553     setEnabledPreset(true);
4554   }
4555   else {
4556     updateSubcategoryName(QString("NONE"), false);
4557     updateLBank(lbank, false);
4558     subcategoryListView->clearSelection();
4559     presetListView->clear();
4560     setEnabledPreset(false);
4561   }
4562   //  }
4563   //}
4564   //else {
4565   //  updateSubcategoryName(QString("NONE"), false);
4566   //  updateLBank(lbank, false);
4567   //  subcategoryListView->clearSelection();
4568   //  presetListView->clear();
4569   //  setEnabledPreset(false);
4570   //}
4571   //preset
4572   //if(sub) {
4573   QList<QTreeWidgetItem *> qlpre =
4574     presetListView->findItems(num3Digits(prog+1), Qt::MatchExactly);
4575   QTreeWidgetItem* qpre = qlpre.empty()? NULL:qlpre.at(0);
4576   if(qpre) {
4577     presetListView->blockSignals(true);
4578     qpre->setSelected(true);
4579     presetListView->setCurrentItem(qpre);
4580     presetListView->blockSignals(false);
4581     presetListView->scrollToItem(qpre);
4582     updatePresetName(qpre->text(1), true);
4583     updateProg(prog, true);
4584     //pre=(QTreePreset*) qpre;
4585     setEnabledPreset(true);
4586   }
4587   else {
4588     updatePresetName(QString("INITVOICE"), false);
4589     updateProg(prog, false);
4590     presetListView->clearSelection();
4591     setEnabledPreset(false);
4592   }
4593   //}
4594   //else {
4595   //  updatePresetName(QString("INITVOICE"), false);
4596   //  updateProg(prog, false);
4597   //  presetListView->clearSelection();
4598   //  setEnabledPreset(false);
4599   //}
4600 }
4601 
4602