1 |
capela |
1464 |
// qsamplerChannelForm.cpp |
2 |
|
|
// |
3 |
|
|
/**************************************************************************** |
4 |
|
|
Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved. |
5 |
|
|
Copyright (C) 2007, Christian Schoenebeck |
6 |
|
|
|
7 |
|
|
This program is free software; you can redistribute it and/or |
8 |
|
|
modify it under the terms of the GNU General Public License |
9 |
|
|
as published by the Free Software Foundation; either version 2 |
10 |
|
|
of the License, or (at your option) any later version. |
11 |
|
|
|
12 |
|
|
This program is distributed in the hope that it will be useful, |
13 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
|
|
GNU General Public License for more details. |
16 |
|
|
|
17 |
|
|
You should have received a copy of the GNU General Public License along |
18 |
|
|
with this program; if not, write to the Free Software Foundation, Inc., |
19 |
|
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
20 |
|
|
|
21 |
|
|
*****************************************************************************/ |
22 |
|
|
|
23 |
schoenebeck |
1461 |
#include "qsamplerChannelForm.h" |
24 |
|
|
|
25 |
|
|
#include "qsamplerAbout.h" |
26 |
|
|
#include "qsamplerDeviceForm.h" |
27 |
|
|
|
28 |
|
|
#include "qsamplerMainForm.h" |
29 |
|
|
#include "qsamplerInstrument.h" |
30 |
|
|
|
31 |
capela |
1499 |
#include <QValidator> |
32 |
|
|
#include <QMessageBox> |
33 |
|
|
#include <QFileDialog> |
34 |
|
|
#include <QFileInfo> |
35 |
schoenebeck |
1461 |
|
36 |
capela |
1499 |
#include <QHeaderView> |
37 |
|
|
|
38 |
|
|
|
39 |
schoenebeck |
1461 |
namespace QSampler { |
40 |
|
|
|
41 |
capela |
1509 |
ChannelForm::ChannelForm ( QWidget* pParent ) |
42 |
|
|
: QDialog(pParent) |
43 |
|
|
{ |
44 |
capela |
1510 |
m_ui.setupUi(this); |
45 |
schoenebeck |
1461 |
|
46 |
|
|
// Initialize locals. |
47 |
|
|
m_pChannel = NULL; |
48 |
|
|
|
49 |
|
|
m_iDirtySetup = 0; |
50 |
|
|
m_iDirtyCount = 0; |
51 |
|
|
|
52 |
capela |
1499 |
// m_midiDevices.setAutoDelete(true); |
53 |
|
|
// m_audioDevices.setAutoDelete(true); |
54 |
schoenebeck |
1461 |
|
55 |
|
|
m_pDeviceForm = NULL; |
56 |
|
|
|
57 |
capela |
1509 |
m_ui.AudioRoutingTable->setModel(&m_routingModel); |
58 |
|
|
m_ui.AudioRoutingTable->setItemDelegate(&m_routingDelegate); |
59 |
|
|
m_ui.AudioRoutingTable->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); |
60 |
|
|
// m_ui.AudioRoutingTable->verticalHeader()->hide(); |
61 |
|
|
|
62 |
|
|
// This goes initially hidden, and will be shown |
63 |
capela |
1510 |
// on setup() for currently existing channels... |
64 |
capela |
1509 |
m_ui.AudioRoutingTable->hide(); |
65 |
|
|
|
66 |
schoenebeck |
1461 |
// Try to restore normal window positioning. |
67 |
|
|
adjustSize(); |
68 |
capela |
1466 |
|
69 |
capela |
1509 |
QObject::connect(m_ui.EngineNameComboBox, |
70 |
capela |
1466 |
SIGNAL(activated(int)), |
71 |
|
|
SLOT(optionsChanged())); |
72 |
capela |
1509 |
QObject::connect(m_ui.InstrumentFileComboBox, |
73 |
schoenebeck |
1474 |
SIGNAL(activated(const QString&)), |
74 |
capela |
1466 |
SLOT(updateInstrumentName())); |
75 |
capela |
1509 |
QObject::connect(m_ui.InstrumentFileToolButton, |
76 |
capela |
1466 |
SIGNAL(clicked()), |
77 |
|
|
SLOT(openInstrumentFile())); |
78 |
capela |
1509 |
QObject::connect(m_ui.InstrumentNrComboBox, |
79 |
capela |
1466 |
SIGNAL(activated(int)), |
80 |
|
|
SLOT(optionsChanged())); |
81 |
capela |
1509 |
QObject::connect(m_ui.MidiDriverComboBox, |
82 |
schoenebeck |
1474 |
SIGNAL(activated(const QString&)), |
83 |
|
|
SLOT(selectMidiDriver(const QString&))); |
84 |
capela |
1509 |
QObject::connect(m_ui.MidiDeviceComboBox, |
85 |
capela |
1466 |
SIGNAL(activated(int)), |
86 |
|
|
SLOT(selectMidiDevice(int))); |
87 |
capela |
1509 |
QObject::connect(m_ui.MidiPortSpinBox, |
88 |
capela |
1466 |
SIGNAL(valueChanged(int)), |
89 |
|
|
SLOT(optionsChanged())); |
90 |
capela |
1509 |
QObject::connect(m_ui.MidiChannelComboBox, |
91 |
capela |
1466 |
SIGNAL(activated(int)), |
92 |
|
|
SLOT(optionsChanged())); |
93 |
capela |
1509 |
QObject::connect(m_ui.MidiMapComboBox, |
94 |
capela |
1466 |
SIGNAL(activated(int)), |
95 |
|
|
SLOT(optionsChanged())); |
96 |
capela |
1509 |
QObject::connect(m_ui.AudioDriverComboBox, |
97 |
schoenebeck |
1474 |
SIGNAL(activated(const QString&)), |
98 |
|
|
SLOT(selectAudioDriver(const QString&))); |
99 |
capela |
1509 |
QObject::connect(m_ui.AudioDeviceComboBox, |
100 |
capela |
1466 |
SIGNAL(activated(int)), |
101 |
|
|
SLOT(selectAudioDevice(int))); |
102 |
capela |
1509 |
QObject::connect(m_ui.OkPushButton, |
103 |
capela |
1466 |
SIGNAL(clicked()), |
104 |
|
|
SLOT(accept())); |
105 |
capela |
1509 |
QObject::connect(m_ui.CancelPushButton, |
106 |
capela |
1466 |
SIGNAL(clicked()), |
107 |
|
|
SLOT(reject())); |
108 |
capela |
1509 |
QObject::connect(m_ui.MidiDeviceToolButton, |
109 |
capela |
1466 |
SIGNAL(clicked()), |
110 |
|
|
SLOT(setupMidiDevice())); |
111 |
capela |
1509 |
QObject::connect(m_ui.AudioDeviceToolButton, |
112 |
capela |
1466 |
SIGNAL(clicked()), |
113 |
|
|
SLOT(setupAudioDevice())); |
114 |
capela |
1509 |
QObject::connect(&m_routingModel, |
115 |
schoenebeck |
1489 |
SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), |
116 |
|
|
SLOT(optionsChanged())); |
117 |
capela |
1509 |
QObject::connect(&m_routingModel, |
118 |
schoenebeck |
1489 |
SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), |
119 |
|
|
SLOT(updateTableCellRenderers(const QModelIndex&, const QModelIndex&))); |
120 |
capela |
1509 |
QObject::connect(&m_routingModel, |
121 |
schoenebeck |
1489 |
SIGNAL(modelReset()), |
122 |
|
|
SLOT(updateTableCellRenderers())); |
123 |
schoenebeck |
1461 |
} |
124 |
|
|
|
125 |
capela |
1499 |
ChannelForm::~ChannelForm() |
126 |
|
|
{ |
127 |
schoenebeck |
1461 |
if (m_pDeviceForm) |
128 |
|
|
delete m_pDeviceForm; |
129 |
|
|
m_pDeviceForm = NULL; |
130 |
capela |
1499 |
|
131 |
|
|
qDeleteAll(m_midiDevices); |
132 |
|
|
m_midiDevices.clear(); |
133 |
|
|
|
134 |
|
|
qDeleteAll(m_audioDevices); |
135 |
|
|
m_audioDevices.clear(); |
136 |
schoenebeck |
1461 |
} |
137 |
|
|
|
138 |
|
|
|
139 |
|
|
// Channel dialog setup formal initializer. |
140 |
|
|
void ChannelForm::setup ( qsamplerChannel *pChannel ) |
141 |
|
|
{ |
142 |
|
|
m_pChannel = pChannel; |
143 |
|
|
|
144 |
|
|
m_iDirtySetup = 0; |
145 |
|
|
m_iDirtyCount = 0; |
146 |
|
|
|
147 |
|
|
if (m_pChannel == NULL) |
148 |
|
|
return; |
149 |
|
|
|
150 |
|
|
// It can be a brand new channel, remember? |
151 |
|
|
bool bNew = (m_pChannel->channelID() < 0); |
152 |
capela |
1499 |
setWindowTitle(QSAMPLER_TITLE ": " + m_pChannel->channelName()); |
153 |
schoenebeck |
1461 |
|
154 |
|
|
// Check if we're up and connected. |
155 |
|
|
MainForm *pMainForm = MainForm::getInstance(); |
156 |
|
|
if (pMainForm == NULL) |
157 |
|
|
return; |
158 |
|
|
if (pMainForm->client() == NULL) |
159 |
|
|
return; |
160 |
|
|
|
161 |
|
|
qsamplerOptions *pOptions = pMainForm->options(); |
162 |
|
|
if (pOptions == NULL) |
163 |
|
|
return; |
164 |
|
|
|
165 |
|
|
// Avoid nested changes. |
166 |
|
|
m_iDirtySetup++; |
167 |
|
|
|
168 |
|
|
// Load combo box history... |
169 |
capela |
1509 |
pOptions->loadComboBoxHistory(m_ui.InstrumentFileComboBox); |
170 |
schoenebeck |
1461 |
|
171 |
|
|
// Populate Engines list. |
172 |
|
|
const char **ppszEngines = ::lscp_list_available_engines(pMainForm->client()); |
173 |
|
|
if (ppszEngines) { |
174 |
capela |
1509 |
m_ui.EngineNameComboBox->clear(); |
175 |
schoenebeck |
1461 |
for (int iEngine = 0; ppszEngines[iEngine]; iEngine++) |
176 |
capela |
1509 |
m_ui.EngineNameComboBox->addItem(QString(ppszEngines[iEngine])); |
177 |
schoenebeck |
1461 |
} |
178 |
|
|
else m_pChannel->appendMessagesClient("lscp_list_available_engines"); |
179 |
|
|
|
180 |
|
|
// Populate Audio output type list. |
181 |
capela |
1509 |
m_ui.AudioDriverComboBox->clear(); |
182 |
|
|
m_ui.AudioDriverComboBox->insertItems(0, |
183 |
schoenebeck |
1461 |
qsamplerDevice::getDrivers(pMainForm->client(), qsamplerDevice::Audio)); |
184 |
|
|
|
185 |
|
|
// Populate MIDI input type list. |
186 |
capela |
1509 |
m_ui.MidiDriverComboBox->clear(); |
187 |
|
|
m_ui.MidiDriverComboBox->insertItems(0, |
188 |
schoenebeck |
1461 |
qsamplerDevice::getDrivers(pMainForm->client(), qsamplerDevice::Midi)); |
189 |
|
|
|
190 |
|
|
// Populate Maps list. |
191 |
capela |
1509 |
m_ui.MidiMapComboBox->clear(); |
192 |
|
|
m_ui.MidiMapComboBox->insertItems(0, |
193 |
capela |
1499 |
qsamplerInstrument::getMapNames()); |
194 |
schoenebeck |
1461 |
|
195 |
|
|
// Read proper channel information, |
196 |
|
|
// and populate the channel form fields. |
197 |
|
|
|
198 |
|
|
// Engine name... |
199 |
|
|
QString sEngineName = pChannel->engineName(); |
200 |
|
|
if (sEngineName.isEmpty() || bNew) |
201 |
|
|
sEngineName = pOptions->sEngineName; |
202 |
|
|
if (sEngineName.isEmpty()) |
203 |
|
|
sEngineName = qsamplerChannel::noEngineName(); |
204 |
capela |
1509 |
if (m_ui.EngineNameComboBox->findText(sEngineName, |
205 |
schoenebeck |
1474 |
Qt::MatchExactly | Qt::MatchCaseSensitive) < 0) { |
206 |
capela |
1509 |
m_ui.EngineNameComboBox->addItem(sEngineName); |
207 |
schoenebeck |
1461 |
} |
208 |
capela |
1509 |
m_ui.EngineNameComboBox->setCurrentIndex( |
209 |
|
|
m_ui.EngineNameComboBox->findText(sEngineName, |
210 |
schoenebeck |
1474 |
Qt::MatchExactly | Qt::MatchCaseSensitive)); |
211 |
capela |
1504 |
|
212 |
schoenebeck |
1461 |
// Instrument filename and index... |
213 |
|
|
QString sInstrumentFile = pChannel->instrumentFile(); |
214 |
|
|
if (sInstrumentFile.isEmpty()) |
215 |
|
|
sInstrumentFile = qsamplerChannel::noInstrumentName(); |
216 |
capela |
1509 |
m_ui.InstrumentFileComboBox->setEditText(sInstrumentFile); |
217 |
|
|
m_ui.InstrumentNrComboBox->clear(); |
218 |
|
|
m_ui.InstrumentNrComboBox->insertItems(0, |
219 |
schoenebeck |
1461 |
qsamplerChannel::getInstrumentList(sInstrumentFile, |
220 |
|
|
pOptions->bInstrumentNames)); |
221 |
capela |
1510 |
int iInstrumentNr = pChannel->instrumentNr(); |
222 |
|
|
if (iInstrumentNr < 0) |
223 |
|
|
iInstrumentNr = 0; |
224 |
|
|
m_ui.InstrumentNrComboBox->setCurrentIndex(iInstrumentNr); |
225 |
schoenebeck |
1461 |
|
226 |
|
|
// MIDI input device... |
227 |
|
|
qsamplerDevice midiDevice(qsamplerDevice::Midi, m_pChannel->midiDevice()); |
228 |
|
|
// MIDI input driver... |
229 |
|
|
QString sMidiDriver = midiDevice.driverName(); |
230 |
|
|
if (sMidiDriver.isEmpty() || bNew) |
231 |
capela |
1499 |
sMidiDriver = pOptions->sMidiDriver.toUpper(); |
232 |
schoenebeck |
1461 |
if (!sMidiDriver.isEmpty()) { |
233 |
capela |
1509 |
if (m_ui.MidiDriverComboBox->findText(sMidiDriver, |
234 |
schoenebeck |
1474 |
Qt::MatchExactly | Qt::MatchCaseSensitive) < 0) { |
235 |
capela |
1509 |
m_ui.MidiDriverComboBox->insertItem(0, sMidiDriver); |
236 |
schoenebeck |
1461 |
} |
237 |
capela |
1509 |
m_ui.MidiDriverComboBox->setItemText( |
238 |
|
|
m_ui.MidiDriverComboBox->currentIndex(), |
239 |
capela |
1499 |
sMidiDriver); |
240 |
schoenebeck |
1461 |
} |
241 |
|
|
selectMidiDriverItem(sMidiDriver); |
242 |
capela |
1499 |
if (!bNew) { |
243 |
capela |
1509 |
m_ui.MidiDeviceComboBox->setItemText( |
244 |
|
|
m_ui.MidiDeviceComboBox->currentIndex(), |
245 |
capela |
1499 |
midiDevice.deviceName()); |
246 |
|
|
} |
247 |
capela |
1509 |
selectMidiDeviceItem(m_ui.MidiDeviceComboBox->currentIndex()); |
248 |
schoenebeck |
1461 |
// MIDI input port... |
249 |
capela |
1509 |
m_ui.MidiPortSpinBox->setValue(pChannel->midiPort()); |
250 |
schoenebeck |
1461 |
// MIDI input channel... |
251 |
|
|
int iMidiChannel = pChannel->midiChannel(); |
252 |
|
|
// When new, try to suggest a sensible MIDI channel... |
253 |
|
|
if (iMidiChannel < 0) |
254 |
|
|
iMidiChannel = (::lscp_get_channels(pMainForm->client()) % 16); |
255 |
capela |
1509 |
m_ui.MidiChannelComboBox->setCurrentIndex(iMidiChannel); |
256 |
schoenebeck |
1461 |
// MIDI instrument map... |
257 |
|
|
int iMidiMap = (bNew ? pOptions->iMidiMap : pChannel->midiMap()); |
258 |
|
|
// When new, try to suggest a sensible MIDI map... |
259 |
|
|
if (iMidiMap < 0) |
260 |
|
|
iMidiMap = 0; |
261 |
|
|
const QString& sMapName = qsamplerInstrument::getMapName(iMidiMap); |
262 |
capela |
1499 |
if (!sMapName.isEmpty()) { |
263 |
capela |
1509 |
m_ui.MidiMapComboBox->setItemText( |
264 |
|
|
m_ui.MidiMapComboBox->currentIndex(), |
265 |
capela |
1499 |
sMapName); |
266 |
|
|
} |
267 |
schoenebeck |
1461 |
// It might be no maps around... |
268 |
capela |
1509 |
bool bMidiMapEnabled = (m_ui.MidiMapComboBox->count() > 0); |
269 |
|
|
m_ui.MidiMapTextLabel->setEnabled(bMidiMapEnabled); |
270 |
|
|
m_ui.MidiMapComboBox->setEnabled(bMidiMapEnabled); |
271 |
schoenebeck |
1461 |
|
272 |
|
|
// Audio output device... |
273 |
|
|
qsamplerDevice audioDevice(qsamplerDevice::Audio, m_pChannel->audioDevice()); |
274 |
|
|
// Audio output driver... |
275 |
|
|
QString sAudioDriver = audioDevice.driverName(); |
276 |
|
|
if (sAudioDriver.isEmpty() || bNew) |
277 |
capela |
1499 |
sAudioDriver = pOptions->sAudioDriver.toUpper(); |
278 |
schoenebeck |
1461 |
if (!sAudioDriver.isEmpty()) { |
279 |
capela |
1509 |
if (m_ui.AudioDriverComboBox->findText(sAudioDriver, |
280 |
schoenebeck |
1474 |
Qt::MatchExactly | Qt::MatchCaseSensitive) < 0) { |
281 |
capela |
1509 |
m_ui.AudioDriverComboBox->insertItem(0, sAudioDriver); |
282 |
schoenebeck |
1461 |
} |
283 |
capela |
1509 |
m_ui.AudioDriverComboBox->setItemText( |
284 |
|
|
m_ui.AudioDriverComboBox->currentIndex(), |
285 |
capela |
1499 |
sAudioDriver); |
286 |
schoenebeck |
1461 |
} |
287 |
|
|
selectAudioDriverItem(sAudioDriver); |
288 |
capela |
1499 |
if (!bNew) { |
289 |
capela |
1509 |
m_ui.AudioDeviceComboBox->setItemText( |
290 |
|
|
m_ui.AudioDeviceComboBox->currentIndex(), |
291 |
capela |
1499 |
audioDevice.deviceName()); |
292 |
|
|
} |
293 |
capela |
1509 |
selectAudioDeviceItem(m_ui.AudioDeviceComboBox->currentIndex()); |
294 |
schoenebeck |
1461 |
|
295 |
capela |
1509 |
// Let the audio routing table see the light, |
296 |
|
|
// if we're editing an existing sampler channel... |
297 |
|
|
m_ui.AudioRoutingTable->setVisible(!bNew); |
298 |
|
|
|
299 |
schoenebeck |
1461 |
// As convenient, make it ready on stabilizeForm() for |
300 |
|
|
// prompt acceptance, if we got the minimum required... |
301 |
|
|
/* if (sEngineName != qsamplerChannel::noEngineName() && |
302 |
|
|
sInstrumentFile != qsamplerChannel::noInstrumentName()) |
303 |
|
|
m_iDirtyCount++; */ |
304 |
|
|
// Done. |
305 |
|
|
m_iDirtySetup--; |
306 |
|
|
stabilizeForm(); |
307 |
|
|
} |
308 |
|
|
|
309 |
|
|
|
310 |
|
|
// Accept settings (OK button slot). |
311 |
|
|
void ChannelForm::accept (void) |
312 |
|
|
{ |
313 |
|
|
if (m_pChannel == NULL) |
314 |
|
|
return; |
315 |
|
|
|
316 |
|
|
MainForm *pMainForm = MainForm::getInstance(); |
317 |
|
|
if (pMainForm == NULL) |
318 |
|
|
return; |
319 |
|
|
if (pMainForm->client() == NULL) |
320 |
|
|
return; |
321 |
|
|
|
322 |
|
|
qsamplerOptions *pOptions = pMainForm->options(); |
323 |
|
|
if (pOptions == NULL) |
324 |
|
|
return; |
325 |
|
|
|
326 |
|
|
// Flush any pending editing... |
327 |
capela |
1509 |
//m_ui.AudioRoutingTable->flush(); |
328 |
schoenebeck |
1461 |
|
329 |
|
|
// We'll go for it! |
330 |
|
|
if (m_iDirtyCount > 0) { |
331 |
|
|
int iErrors = 0; |
332 |
|
|
// Are we a new channel? |
333 |
|
|
if (!m_pChannel->addChannel()) |
334 |
|
|
iErrors++; |
335 |
|
|
// Accept Audio driver or device selection... |
336 |
|
|
if (m_audioDevices.isEmpty()) { |
337 |
capela |
1509 |
if (!m_pChannel->setAudioDriver(m_ui.AudioDriverComboBox->currentText())) |
338 |
schoenebeck |
1461 |
iErrors++; |
339 |
|
|
} else { |
340 |
capela |
1504 |
qsamplerDevice *pDevice = NULL; |
341 |
capela |
1509 |
int iAudioItem = m_ui.AudioDeviceComboBox->currentIndex(); |
342 |
capela |
1504 |
if (iAudioItem >= 0 && iAudioItem < m_audioDevices.count()) |
343 |
|
|
pDevice = m_audioDevices.at(iAudioItem); |
344 |
capela |
1509 |
qsamplerChannelRoutingMap routingMap = m_routingModel.routingMap(); |
345 |
schoenebeck |
1461 |
if (pDevice == NULL) |
346 |
|
|
iErrors++; |
347 |
|
|
else if (!m_pChannel->setAudioDevice(pDevice->deviceID())) |
348 |
|
|
iErrors++; |
349 |
schoenebeck |
1489 |
else if (!routingMap.isEmpty()) { |
350 |
schoenebeck |
1461 |
// Set the audio route changes... |
351 |
|
|
qsamplerChannelRoutingMap::ConstIterator iter; |
352 |
schoenebeck |
1489 |
for (iter = routingMap.begin(); |
353 |
|
|
iter != routingMap.end(); ++iter) { |
354 |
capela |
1499 |
if (!m_pChannel->setAudioChannel(iter.key(), iter.value())) |
355 |
schoenebeck |
1461 |
iErrors++; |
356 |
|
|
} |
357 |
|
|
} |
358 |
|
|
} |
359 |
|
|
// Accept MIDI driver or device selection... |
360 |
|
|
if (m_midiDevices.isEmpty()) { |
361 |
capela |
1509 |
if (!m_pChannel->setMidiDriver(m_ui.MidiDriverComboBox->currentText())) |
362 |
schoenebeck |
1461 |
iErrors++; |
363 |
|
|
} else { |
364 |
capela |
1504 |
qsamplerDevice *pDevice = NULL; |
365 |
capela |
1509 |
int iMidiItem = m_ui.MidiDeviceComboBox->currentIndex(); |
366 |
capela |
1504 |
if (iMidiItem >= 0 && iMidiItem < m_midiDevices.count()) |
367 |
|
|
pDevice = m_midiDevices.at(iMidiItem); |
368 |
schoenebeck |
1461 |
if (pDevice == NULL) |
369 |
|
|
iErrors++; |
370 |
|
|
else if (!m_pChannel->setMidiDevice(pDevice->deviceID())) |
371 |
|
|
iErrors++; |
372 |
|
|
} |
373 |
|
|
// MIDI input port number... |
374 |
capela |
1509 |
if (!m_pChannel->setMidiPort(m_ui.MidiPortSpinBox->value())) |
375 |
schoenebeck |
1461 |
iErrors++; |
376 |
|
|
// MIDI input channel... |
377 |
capela |
1509 |
if (!m_pChannel->setMidiChannel(m_ui.MidiChannelComboBox->currentIndex())) |
378 |
schoenebeck |
1461 |
iErrors++; |
379 |
|
|
// Engine name... |
380 |
capela |
1509 |
if (!m_pChannel->loadEngine(m_ui.EngineNameComboBox->currentText())) |
381 |
schoenebeck |
1461 |
iErrors++; |
382 |
|
|
// Instrument file and index... |
383 |
capela |
1509 |
const QString& sPath = m_ui.InstrumentFileComboBox->currentText(); |
384 |
schoenebeck |
1461 |
if (!sPath.isEmpty() && QFileInfo(sPath).exists()) { |
385 |
capela |
1509 |
if (!m_pChannel->loadInstrument(sPath, m_ui.InstrumentNrComboBox->currentIndex())) |
386 |
schoenebeck |
1461 |
iErrors++; |
387 |
|
|
} |
388 |
|
|
// MIDI intrument map... |
389 |
capela |
1509 |
if (!m_pChannel->setMidiMap(m_ui.MidiMapComboBox->currentIndex())) |
390 |
schoenebeck |
1461 |
iErrors++; |
391 |
|
|
// Show error messages? |
392 |
capela |
1510 |
if (iErrors > 0) { |
393 |
|
|
m_pChannel->appendMessagesError( |
394 |
|
|
tr("Some channel settings could not be set.\n\nSorry.")); |
395 |
|
|
} |
396 |
schoenebeck |
1461 |
} |
397 |
|
|
|
398 |
|
|
// Save default engine name, instrument directory and history... |
399 |
capela |
1499 |
pOptions->sInstrumentDir = QFileInfo( |
400 |
capela |
1509 |
m_ui.InstrumentFileComboBox->currentText()).dir().absolutePath(); |
401 |
|
|
pOptions->sEngineName = m_ui.EngineNameComboBox->currentText(); |
402 |
|
|
pOptions->sAudioDriver = m_ui.AudioDriverComboBox->currentText(); |
403 |
|
|
pOptions->sMidiDriver = m_ui.MidiDriverComboBox->currentText(); |
404 |
|
|
pOptions->iMidiMap = m_ui.MidiMapComboBox->currentIndex(); |
405 |
|
|
pOptions->saveComboBoxHistory(m_ui.InstrumentFileComboBox); |
406 |
schoenebeck |
1461 |
|
407 |
|
|
// Just go with dialog acceptance. |
408 |
|
|
QDialog::accept(); |
409 |
|
|
} |
410 |
|
|
|
411 |
|
|
|
412 |
|
|
// Reject settings (Cancel button slot). |
413 |
|
|
void ChannelForm::reject (void) |
414 |
|
|
{ |
415 |
|
|
bool bReject = true; |
416 |
|
|
|
417 |
|
|
// Check if there's any pending changes... |
418 |
capela |
1509 |
if (m_iDirtyCount > 0 && m_ui.OkPushButton->isEnabled()) { |
419 |
schoenebeck |
1461 |
switch (QMessageBox::warning(this, |
420 |
|
|
QSAMPLER_TITLE ": " + tr("Warning"), |
421 |
|
|
tr("Some channel settings have been changed.\n\n" |
422 |
|
|
"Do you want to apply the changes?"), |
423 |
|
|
tr("Apply"), tr("Discard"), tr("Cancel"))) { |
424 |
|
|
case 0: // Apply... |
425 |
|
|
accept(); |
426 |
|
|
return; |
427 |
|
|
case 1: // Discard |
428 |
|
|
break; |
429 |
|
|
default: // Cancel. |
430 |
|
|
bReject = false; |
431 |
|
|
break; |
432 |
|
|
} |
433 |
|
|
} |
434 |
|
|
|
435 |
|
|
if (bReject) |
436 |
|
|
QDialog::reject(); |
437 |
|
|
} |
438 |
|
|
|
439 |
|
|
|
440 |
|
|
// Browse and open an instrument file. |
441 |
|
|
void ChannelForm::openInstrumentFile (void) |
442 |
|
|
{ |
443 |
|
|
MainForm *pMainForm = MainForm::getInstance(); |
444 |
|
|
if (pMainForm == NULL) |
445 |
|
|
return; |
446 |
|
|
if (pMainForm->client() == NULL) |
447 |
|
|
return; |
448 |
|
|
|
449 |
|
|
qsamplerOptions *pOptions = pMainForm->options(); |
450 |
|
|
if (pOptions == NULL) |
451 |
|
|
return; |
452 |
|
|
|
453 |
|
|
// FIXME: the instrument file filters should be restricted, |
454 |
|
|
// depending on the current engine. |
455 |
capela |
1499 |
QString sInstrumentFile = QFileDialog::getOpenFileName(this, |
456 |
|
|
QSAMPLER_TITLE ": " + tr("Instrument files"), // Caption. |
457 |
|
|
pOptions->sInstrumentDir, // Start here. |
458 |
|
|
tr("Instrument files") + " (*.gig *.dls)" // Filter (GIG and DLS files) |
459 |
schoenebeck |
1461 |
); |
460 |
|
|
|
461 |
|
|
if (sInstrumentFile.isEmpty()) |
462 |
|
|
return; |
463 |
|
|
|
464 |
capela |
1509 |
m_ui.InstrumentFileComboBox->setEditText(sInstrumentFile); |
465 |
schoenebeck |
1461 |
updateInstrumentName(); |
466 |
|
|
} |
467 |
|
|
|
468 |
|
|
|
469 |
|
|
// Refresh the actual instrument name. |
470 |
|
|
void ChannelForm::updateInstrumentName (void) |
471 |
|
|
{ |
472 |
|
|
MainForm *pMainForm = MainForm::getInstance(); |
473 |
|
|
if (pMainForm == NULL) |
474 |
|
|
return; |
475 |
|
|
if (pMainForm->client() == NULL) |
476 |
|
|
return; |
477 |
|
|
|
478 |
|
|
qsamplerOptions *pOptions = pMainForm->options(); |
479 |
|
|
if (pOptions == NULL) |
480 |
|
|
return; |
481 |
|
|
|
482 |
|
|
// Finally this better idea would be to use libgig |
483 |
|
|
// to retrieve the REAL instrument names. |
484 |
capela |
1509 |
m_ui.InstrumentNrComboBox->clear(); |
485 |
|
|
m_ui.InstrumentNrComboBox->insertItems(0, |
486 |
schoenebeck |
1461 |
qsamplerChannel::getInstrumentList( |
487 |
capela |
1509 |
m_ui.InstrumentFileComboBox->currentText(), |
488 |
schoenebeck |
1461 |
pOptions->bInstrumentNames) |
489 |
|
|
); |
490 |
|
|
|
491 |
|
|
optionsChanged(); |
492 |
|
|
} |
493 |
|
|
|
494 |
|
|
|
495 |
|
|
// Show device options dialog. |
496 |
|
|
void ChannelForm::setupDevice ( qsamplerDevice *pDevice, |
497 |
capela |
1509 |
qsamplerDevice::DeviceType deviceTypeMode, |
498 |
schoenebeck |
1461 |
const QString& sDriverName ) |
499 |
|
|
{ |
500 |
capela |
1504 |
if (pDevice == NULL) |
501 |
|
|
return; |
502 |
|
|
|
503 |
schoenebeck |
1461 |
MainForm *pMainForm = MainForm::getInstance(); |
504 |
|
|
if (pMainForm == NULL) |
505 |
|
|
return; |
506 |
|
|
if (pMainForm->client() == NULL) |
507 |
|
|
return; |
508 |
|
|
|
509 |
|
|
// Create the device form if not already... |
510 |
|
|
if (m_pDeviceForm == NULL) { |
511 |
|
|
m_pDeviceForm = new DeviceForm(this, Qt::Dialog); |
512 |
capela |
1510 |
m_pDeviceForm->setAttribute(Qt::WA_ShowModal); |
513 |
schoenebeck |
1461 |
QObject::connect(m_pDeviceForm, SIGNAL(devicesChanged()), |
514 |
|
|
this, SLOT(updateDevices())); |
515 |
|
|
} |
516 |
|
|
|
517 |
|
|
// Refresh the device form with selected data. |
518 |
|
|
if (m_pDeviceForm) { |
519 |
|
|
m_pDeviceForm->setDeviceTypeMode(deviceTypeMode); |
520 |
|
|
m_pDeviceForm->refreshDevices(); |
521 |
|
|
m_pDeviceForm->setDevice(pDevice); |
522 |
|
|
m_pDeviceForm->setDriverName(sDriverName); |
523 |
|
|
m_pDeviceForm->show(); |
524 |
|
|
} |
525 |
|
|
} |
526 |
|
|
|
527 |
|
|
|
528 |
|
|
// Refresh MIDI driver item devices. |
529 |
|
|
void ChannelForm::selectMidiDriverItem ( const QString& sMidiDriver ) |
530 |
|
|
{ |
531 |
|
|
MainForm *pMainForm = MainForm::getInstance(); |
532 |
|
|
if (pMainForm == NULL) |
533 |
|
|
return; |
534 |
|
|
if (pMainForm->client() == NULL) |
535 |
|
|
return; |
536 |
|
|
|
537 |
capela |
1499 |
const QString sDriverName = sMidiDriver.toUpper(); |
538 |
schoenebeck |
1461 |
|
539 |
|
|
// Save current device id. |
540 |
capela |
1504 |
// Save current device id. |
541 |
schoenebeck |
1461 |
int iDeviceID = 0; |
542 |
capela |
1504 |
qsamplerDevice *pDevice = NULL; |
543 |
capela |
1509 |
int iMidiItem = m_ui.MidiDeviceComboBox->currentIndex(); |
544 |
capela |
1504 |
if (iMidiItem >= 0 && iMidiItem < m_midiDevices.count()) |
545 |
|
|
pDevice = m_midiDevices.at(iMidiItem); |
546 |
schoenebeck |
1461 |
if (pDevice) |
547 |
|
|
iDeviceID = pDevice->deviceID(); |
548 |
|
|
|
549 |
|
|
// Clean maplist. |
550 |
capela |
1509 |
m_ui.MidiDeviceComboBox->clear(); |
551 |
capela |
1499 |
qDeleteAll(m_midiDevices); |
552 |
schoenebeck |
1461 |
m_midiDevices.clear(); |
553 |
|
|
|
554 |
|
|
// Populate with the current ones... |
555 |
schoenebeck |
1489 |
const QPixmap midiPixmap(":/icons/midi2.png"); |
556 |
schoenebeck |
1461 |
int *piDeviceIDs = qsamplerDevice::getDevices(pMainForm->client(), |
557 |
|
|
qsamplerDevice::Midi); |
558 |
|
|
for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) { |
559 |
|
|
pDevice = new qsamplerDevice(qsamplerDevice::Midi, piDeviceIDs[i]); |
560 |
capela |
1499 |
if (pDevice->driverName().toUpper() == sDriverName) { |
561 |
capela |
1510 |
m_ui.MidiDeviceComboBox->insertItem(0, |
562 |
|
|
midiPixmap, pDevice->deviceName()); |
563 |
schoenebeck |
1461 |
m_midiDevices.append(pDevice); |
564 |
|
|
} else { |
565 |
|
|
delete pDevice; |
566 |
|
|
} |
567 |
|
|
} |
568 |
|
|
|
569 |
|
|
// Do proper enabling... |
570 |
|
|
bool bEnabled = !m_midiDevices.isEmpty(); |
571 |
|
|
if (bEnabled) { |
572 |
|
|
// Select the previous current device... |
573 |
capela |
1504 |
iMidiItem = 0; |
574 |
capela |
1499 |
QListIterator<qsamplerDevice *> iter(m_midiDevices); |
575 |
|
|
while (iter.hasNext()) { |
576 |
|
|
pDevice = iter.next(); |
577 |
schoenebeck |
1461 |
if (pDevice->deviceID() == iDeviceID) { |
578 |
capela |
1509 |
m_ui.MidiDeviceComboBox->setCurrentIndex(iMidiItem); |
579 |
schoenebeck |
1461 |
selectMidiDeviceItem(iMidiItem); |
580 |
|
|
break; |
581 |
|
|
} |
582 |
|
|
iMidiItem++; |
583 |
|
|
} |
584 |
|
|
} else { |
585 |
capela |
1509 |
m_ui.MidiDeviceComboBox->insertItem(0, |
586 |
schoenebeck |
1461 |
tr("(New MIDI %1 device)").arg(sMidiDriver)); |
587 |
|
|
} |
588 |
capela |
1509 |
m_ui.MidiDeviceTextLabel->setEnabled(bEnabled); |
589 |
|
|
m_ui.MidiDeviceComboBox->setEnabled(bEnabled); |
590 |
schoenebeck |
1461 |
} |
591 |
|
|
|
592 |
|
|
|
593 |
|
|
// Refresh MIDI device options slot. |
594 |
|
|
void ChannelForm::selectMidiDriver ( const QString& sMidiDriver ) |
595 |
|
|
{ |
596 |
|
|
if (m_iDirtySetup > 0) |
597 |
|
|
return; |
598 |
|
|
|
599 |
|
|
selectMidiDriverItem(sMidiDriver); |
600 |
|
|
optionsChanged(); |
601 |
|
|
} |
602 |
|
|
|
603 |
|
|
|
604 |
|
|
// Select MIDI device item. |
605 |
|
|
void ChannelForm::selectMidiDeviceItem ( int iMidiItem ) |
606 |
|
|
{ |
607 |
capela |
1504 |
qsamplerDevice *pDevice = NULL; |
608 |
|
|
if (iMidiItem >= 0 && iMidiItem < m_midiDevices.count()) |
609 |
|
|
pDevice = m_midiDevices.at(iMidiItem); |
610 |
schoenebeck |
1461 |
if (pDevice) { |
611 |
|
|
const qsamplerDeviceParamMap& params = pDevice->params(); |
612 |
|
|
int iPorts = params["PORTS"].value.toInt(); |
613 |
capela |
1509 |
m_ui.MidiPortTextLabel->setEnabled(iPorts > 0); |
614 |
|
|
m_ui.MidiPortSpinBox->setEnabled(iPorts > 0); |
615 |
schoenebeck |
1461 |
if (iPorts > 0) |
616 |
capela |
1509 |
m_ui.MidiPortSpinBox->setMaximum(iPorts - 1); |
617 |
schoenebeck |
1461 |
} |
618 |
|
|
} |
619 |
|
|
|
620 |
|
|
|
621 |
|
|
// Select MIDI device options slot. |
622 |
|
|
void ChannelForm::selectMidiDevice ( int iMidiItem ) |
623 |
|
|
{ |
624 |
|
|
if (m_iDirtySetup > 0) |
625 |
|
|
return; |
626 |
|
|
|
627 |
|
|
selectMidiDeviceItem(iMidiItem); |
628 |
|
|
optionsChanged(); |
629 |
|
|
} |
630 |
|
|
|
631 |
|
|
|
632 |
|
|
// MIDI device options. |
633 |
|
|
void ChannelForm::setupMidiDevice (void) |
634 |
|
|
{ |
635 |
capela |
1504 |
qsamplerDevice *pDevice = NULL; |
636 |
capela |
1509 |
int iMidiItem = m_ui.MidiDeviceComboBox->currentIndex(); |
637 |
capela |
1504 |
if (iMidiItem >= 0 && iMidiItem < m_midiDevices.count()) |
638 |
|
|
pDevice = m_midiDevices.at(iMidiItem); |
639 |
|
|
setupDevice(pDevice, |
640 |
capela |
1509 |
qsamplerDevice::Midi, m_ui.MidiDriverComboBox->currentText()); |
641 |
schoenebeck |
1461 |
} |
642 |
|
|
|
643 |
|
|
|
644 |
|
|
// Refresh Audio driver item devices. |
645 |
|
|
void ChannelForm::selectAudioDriverItem ( const QString& sAudioDriver ) |
646 |
|
|
{ |
647 |
|
|
MainForm *pMainForm = MainForm::getInstance(); |
648 |
|
|
if (pMainForm == NULL) |
649 |
|
|
return; |
650 |
|
|
if (pMainForm->client() == NULL) |
651 |
|
|
return; |
652 |
|
|
|
653 |
capela |
1499 |
const QString sDriverName = sAudioDriver.toUpper(); |
654 |
schoenebeck |
1461 |
|
655 |
|
|
// Save current device id. |
656 |
|
|
int iDeviceID = 0; |
657 |
capela |
1504 |
qsamplerDevice *pDevice = NULL; |
658 |
capela |
1509 |
int iAudioItem = m_ui.AudioDeviceComboBox->currentIndex(); |
659 |
capela |
1504 |
if (iAudioItem >= 0 && iAudioItem < m_audioDevices.count()) |
660 |
|
|
pDevice = m_audioDevices.at(iAudioItem); |
661 |
schoenebeck |
1461 |
if (pDevice) |
662 |
|
|
iDeviceID = pDevice->deviceID(); |
663 |
|
|
|
664 |
|
|
// Clean maplist. |
665 |
capela |
1509 |
m_ui.AudioDeviceComboBox->clear(); |
666 |
capela |
1499 |
qDeleteAll(m_audioDevices); |
667 |
schoenebeck |
1461 |
m_audioDevices.clear(); |
668 |
|
|
|
669 |
|
|
// Populate with the current ones... |
670 |
schoenebeck |
1489 |
const QPixmap audioPixmap(":/icons/audio2.png"); |
671 |
schoenebeck |
1461 |
int *piDeviceIDs = qsamplerDevice::getDevices(pMainForm->client(), |
672 |
|
|
qsamplerDevice::Audio); |
673 |
|
|
for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) { |
674 |
|
|
pDevice = new qsamplerDevice(qsamplerDevice::Audio, piDeviceIDs[i]); |
675 |
capela |
1499 |
if (pDevice->driverName().toUpper() == sDriverName) { |
676 |
capela |
1510 |
m_ui.AudioDeviceComboBox->insertItem(0, |
677 |
|
|
audioPixmap, pDevice->deviceName()); |
678 |
schoenebeck |
1461 |
m_audioDevices.append(pDevice); |
679 |
|
|
} else { |
680 |
|
|
delete pDevice; |
681 |
|
|
} |
682 |
|
|
} |
683 |
|
|
|
684 |
|
|
// Do proper enabling... |
685 |
|
|
bool bEnabled = !m_audioDevices.isEmpty(); |
686 |
|
|
if (bEnabled) { |
687 |
|
|
// Select the previous current device... |
688 |
capela |
1504 |
iAudioItem = 0; |
689 |
capela |
1499 |
QListIterator<qsamplerDevice *> iter(m_audioDevices); |
690 |
|
|
while (iter.hasNext()) { |
691 |
|
|
pDevice = iter.next(); |
692 |
schoenebeck |
1461 |
if (pDevice->deviceID() == iDeviceID) { |
693 |
capela |
1509 |
m_ui.AudioDeviceComboBox->setCurrentIndex(iAudioItem); |
694 |
schoenebeck |
1461 |
selectAudioDeviceItem(iAudioItem); |
695 |
|
|
break; |
696 |
|
|
} |
697 |
|
|
iAudioItem++; |
698 |
|
|
} |
699 |
|
|
} else { |
700 |
capela |
1509 |
m_ui.AudioDeviceComboBox->insertItem(0, |
701 |
schoenebeck |
1461 |
tr("(New Audio %1 device)").arg(sAudioDriver)); |
702 |
capela |
1509 |
//m_ui.AudioRoutingTable->setNumRows(0); |
703 |
schoenebeck |
1461 |
} |
704 |
capela |
1509 |
m_ui.AudioDeviceTextLabel->setEnabled(bEnabled); |
705 |
|
|
m_ui.AudioDeviceComboBox->setEnabled(bEnabled); |
706 |
|
|
m_ui.AudioRoutingTable->setEnabled(bEnabled); |
707 |
schoenebeck |
1461 |
} |
708 |
|
|
|
709 |
|
|
|
710 |
|
|
// Refresh Audio device options slot. |
711 |
|
|
void ChannelForm::selectAudioDriver ( const QString& sAudioDriver ) |
712 |
|
|
{ |
713 |
|
|
if (m_iDirtySetup > 0) |
714 |
|
|
return; |
715 |
|
|
|
716 |
|
|
selectAudioDriverItem(sAudioDriver); |
717 |
|
|
optionsChanged(); |
718 |
|
|
} |
719 |
|
|
|
720 |
|
|
|
721 |
|
|
// Select Audio device item. |
722 |
|
|
void ChannelForm::selectAudioDeviceItem ( int iAudioItem ) |
723 |
|
|
{ |
724 |
capela |
1504 |
qsamplerDevice *pDevice = NULL; |
725 |
|
|
if (iAudioItem >= 0 && iAudioItem < m_audioDevices.count()) |
726 |
|
|
pDevice = m_audioDevices.at(iAudioItem); |
727 |
schoenebeck |
1461 |
if (pDevice) { |
728 |
|
|
// Refresh the audio routing table. |
729 |
capela |
1509 |
m_routingModel.refresh(pDevice, m_pChannel->audioRouting()); |
730 |
schoenebeck |
1461 |
// Reset routing change map. |
731 |
capela |
1509 |
m_routingModel.clear(); |
732 |
schoenebeck |
1461 |
} |
733 |
|
|
} |
734 |
|
|
|
735 |
|
|
|
736 |
|
|
// Select Audio device options slot. |
737 |
|
|
void ChannelForm::selectAudioDevice ( int iAudioItem ) |
738 |
|
|
{ |
739 |
|
|
if (m_iDirtySetup > 0) |
740 |
|
|
return; |
741 |
|
|
|
742 |
|
|
selectAudioDeviceItem(iAudioItem); |
743 |
|
|
optionsChanged(); |
744 |
|
|
} |
745 |
|
|
|
746 |
|
|
|
747 |
|
|
// Audio device options. |
748 |
|
|
void ChannelForm::setupAudioDevice (void) |
749 |
|
|
{ |
750 |
capela |
1504 |
qsamplerDevice *pDevice = NULL; |
751 |
capela |
1509 |
int iAudioItem = m_ui.AudioDeviceComboBox->currentIndex(); |
752 |
capela |
1504 |
if (iAudioItem >= 0 && iAudioItem < m_audioDevices.count()) |
753 |
|
|
pDevice = m_audioDevices.at(iAudioItem); |
754 |
|
|
setupDevice(pDevice, |
755 |
capela |
1509 |
qsamplerDevice::Audio, m_ui.AudioDriverComboBox->currentText()); |
756 |
schoenebeck |
1461 |
} |
757 |
|
|
|
758 |
|
|
// UPdate all device lists slot. |
759 |
|
|
void ChannelForm::updateDevices (void) |
760 |
|
|
{ |
761 |
|
|
if (m_iDirtySetup > 0) |
762 |
|
|
return; |
763 |
|
|
|
764 |
capela |
1509 |
selectMidiDriverItem(m_ui.MidiDriverComboBox->currentText()); |
765 |
|
|
selectAudioDriverItem(m_ui.AudioDriverComboBox->currentText()); |
766 |
schoenebeck |
1461 |
optionsChanged(); |
767 |
|
|
} |
768 |
|
|
|
769 |
|
|
|
770 |
|
|
// Dirty up settings. |
771 |
|
|
void ChannelForm::optionsChanged (void) |
772 |
|
|
{ |
773 |
|
|
if (m_iDirtySetup > 0) |
774 |
|
|
return; |
775 |
|
|
|
776 |
|
|
m_iDirtyCount++; |
777 |
|
|
stabilizeForm(); |
778 |
|
|
} |
779 |
|
|
|
780 |
|
|
|
781 |
|
|
// Stabilize current form state. |
782 |
|
|
void ChannelForm::stabilizeForm (void) |
783 |
|
|
{ |
784 |
schoenebeck |
1506 |
const bool bValid = |
785 |
capela |
1509 |
m_ui.EngineNameComboBox->currentIndex() >= 0 && |
786 |
capela |
1510 |
m_ui.EngineNameComboBox->currentText() |
787 |
|
|
!= qsamplerChannel::noEngineName(); |
788 |
schoenebeck |
1461 |
#if 0 |
789 |
|
|
const QString& sPath = InstrumentFileComboBox->currentText(); |
790 |
|
|
bValid = bValid && !sPath.isEmpty() && QFileInfo(sPath).exists(); |
791 |
|
|
#endif |
792 |
capela |
1509 |
m_ui.OkPushButton->setEnabled(m_iDirtyCount > 0 && bValid); |
793 |
schoenebeck |
1461 |
} |
794 |
|
|
|
795 |
capela |
1509 |
|
796 |
|
|
void ChannelForm::updateTableCellRenderers (void) |
797 |
|
|
{ |
798 |
capela |
1510 |
const int rows = m_routingModel.rowCount(); |
799 |
|
|
const int cols = m_routingModel.columnCount(); |
800 |
|
|
updateTableCellRenderers( |
801 |
capela |
1509 |
m_routingModel.index(0, 0), |
802 |
|
|
m_routingModel.index(rows - 1, cols - 1)); |
803 |
schoenebeck |
1489 |
} |
804 |
schoenebeck |
1461 |
|
805 |
capela |
1509 |
|
806 |
|
|
void ChannelForm::updateTableCellRenderers ( |
807 |
|
|
const QModelIndex& topLeft, const QModelIndex& bottomRight ) |
808 |
|
|
{ |
809 |
capela |
1510 |
for (int r = topLeft.row(); r <= bottomRight.row(); r++) { |
810 |
|
|
for (int c = topLeft.column(); c <= bottomRight.column(); c++) { |
811 |
|
|
const QModelIndex index = m_routingModel.index(r, c); |
812 |
|
|
m_ui.AudioRoutingTable->openPersistentEditor(index); |
813 |
|
|
} |
814 |
|
|
} |
815 |
schoenebeck |
1489 |
} |
816 |
|
|
|
817 |
schoenebeck |
1461 |
} // namespace QSampler |
818 |
capela |
1464 |
|
819 |
|
|
|
820 |
|
|
// end of qsamplerChannelForm.cpp |