28 |
#include "qsamplerMainForm.h" |
#include "qsamplerMainForm.h" |
29 |
#include "qsamplerInstrument.h" |
#include "qsamplerInstrument.h" |
30 |
|
|
31 |
#include <qvalidator.h> |
#include <QValidator> |
32 |
#include <qmessagebox.h> |
#include <QMessageBox> |
33 |
#include <qfiledialog.h> |
#include <QFileDialog> |
34 |
#include <qfileinfo.h> |
#include <QFileInfo> |
35 |
|
|
36 |
|
#include <QHeaderView> |
37 |
|
|
38 |
|
|
39 |
namespace QSampler { |
namespace QSampler { |
40 |
|
|
41 |
ChannelForm::ChannelForm(QWidget* parent) : QDialog(parent) { |
ChannelForm::ChannelForm ( QWidget* pParent ) |
42 |
ui.setupUi(this); |
: QDialog(pParent) |
43 |
|
{ |
44 |
|
m_ui.setupUi(this); |
45 |
|
|
46 |
// Initialize locals. |
// Initialize locals. |
47 |
m_pChannel = NULL; |
m_pChannel = NULL; |
49 |
m_iDirtySetup = 0; |
m_iDirtySetup = 0; |
50 |
m_iDirtyCount = 0; |
m_iDirtyCount = 0; |
51 |
|
|
52 |
m_midiDevices.setAutoDelete(true); |
// m_midiDevices.setAutoDelete(true); |
53 |
m_audioDevices.setAutoDelete(true); |
// m_audioDevices.setAutoDelete(true); |
54 |
|
|
55 |
m_pDeviceForm = NULL; |
m_pDeviceForm = NULL; |
56 |
|
|
57 |
|
int iRowHeight = m_ui.AudioRoutingTable->fontMetrics().height() + 4; |
58 |
|
m_ui.AudioRoutingTable->verticalHeader()->setDefaultSectionSize(iRowHeight); |
59 |
|
m_ui.AudioRoutingTable->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft); |
60 |
|
|
61 |
|
m_ui.AudioRoutingTable->setModel(&m_routingModel); |
62 |
|
m_ui.AudioRoutingTable->setItemDelegate(&m_routingDelegate); |
63 |
|
m_ui.AudioRoutingTable->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); |
64 |
|
// m_ui.AudioRoutingTable->verticalHeader()->hide(); |
65 |
|
|
66 |
|
// This goes initially hidden, and will be shown |
67 |
|
// on setup() for currently existing channels... |
68 |
|
m_ui.AudioRoutingTable->hide(); |
69 |
|
|
70 |
// Try to restore normal window positioning. |
// Try to restore normal window positioning. |
71 |
adjustSize(); |
adjustSize(); |
72 |
|
|
73 |
QObject::connect(ui.EngineNameComboBox, |
QObject::connect(m_ui.EngineNameComboBox, |
74 |
SIGNAL(activated(int)), |
SIGNAL(activated(int)), |
75 |
SLOT(optionsChanged())); |
SLOT(optionsChanged())); |
76 |
QObject::connect(ui.InstrumentFileComboBox, |
QObject::connect(m_ui.InstrumentFileComboBox, |
77 |
SIGNAL(activated(const QString&)), |
SIGNAL(activated(const QString&)), |
78 |
SLOT(updateInstrumentName())); |
SLOT(updateInstrumentName())); |
79 |
QObject::connect(ui.InstrumentFileToolButton, |
QObject::connect(m_ui.InstrumentFileToolButton, |
80 |
SIGNAL(clicked()), |
SIGNAL(clicked()), |
81 |
SLOT(openInstrumentFile())); |
SLOT(openInstrumentFile())); |
82 |
QObject::connect(ui.InstrumentNrComboBox, |
QObject::connect(m_ui.InstrumentNrComboBox, |
83 |
SIGNAL(activated(int)), |
SIGNAL(activated(int)), |
84 |
SLOT(optionsChanged())); |
SLOT(optionsChanged())); |
85 |
QObject::connect(ui.MidiDriverComboBox, |
QObject::connect(m_ui.MidiDriverComboBox, |
86 |
SIGNAL(activated(const QString&)), |
SIGNAL(activated(const QString&)), |
87 |
SLOT(selectMidiDriver(const QString&))); |
SLOT(selectMidiDriver(const QString&))); |
88 |
QObject::connect(ui.MidiDeviceComboBox, |
QObject::connect(m_ui.MidiDeviceComboBox, |
89 |
SIGNAL(activated(int)), |
SIGNAL(activated(int)), |
90 |
SLOT(selectMidiDevice(int))); |
SLOT(selectMidiDevice(int))); |
91 |
QObject::connect(ui.MidiPortSpinBox, |
QObject::connect(m_ui.MidiPortSpinBox, |
92 |
SIGNAL(valueChanged(int)), |
SIGNAL(valueChanged(int)), |
93 |
SLOT(optionsChanged())); |
SLOT(optionsChanged())); |
94 |
QObject::connect(ui.MidiChannelComboBox, |
QObject::connect(m_ui.MidiChannelComboBox, |
95 |
SIGNAL(activated(int)), |
SIGNAL(activated(int)), |
96 |
SLOT(optionsChanged())); |
SLOT(optionsChanged())); |
97 |
QObject::connect(ui.MidiMapComboBox, |
QObject::connect(m_ui.MidiMapComboBox, |
98 |
SIGNAL(activated(int)), |
SIGNAL(activated(int)), |
99 |
SLOT(optionsChanged())); |
SLOT(optionsChanged())); |
100 |
QObject::connect(ui.AudioDriverComboBox, |
QObject::connect(m_ui.AudioDriverComboBox, |
101 |
SIGNAL(activated(const QString&)), |
SIGNAL(activated(const QString&)), |
102 |
SLOT(selectAudioDriver(const QString&))); |
SLOT(selectAudioDriver(const QString&))); |
103 |
QObject::connect(ui.AudioDeviceComboBox, |
QObject::connect(m_ui.AudioDeviceComboBox, |
104 |
SIGNAL(activated(int)), |
SIGNAL(activated(int)), |
105 |
SLOT(selectAudioDevice(int))); |
SLOT(selectAudioDevice(int))); |
106 |
QObject::connect(ui.OkPushButton, |
QObject::connect(m_ui.OkPushButton, |
107 |
SIGNAL(clicked()), |
SIGNAL(clicked()), |
108 |
SLOT(accept())); |
SLOT(accept())); |
109 |
QObject::connect(ui.CancelPushButton, |
QObject::connect(m_ui.CancelPushButton, |
110 |
SIGNAL(clicked()), |
SIGNAL(clicked()), |
111 |
SLOT(reject())); |
SLOT(reject())); |
112 |
QObject::connect(ui.MidiDeviceToolButton, |
QObject::connect(m_ui.MidiDeviceToolButton, |
113 |
SIGNAL(clicked()), |
SIGNAL(clicked()), |
114 |
SLOT(setupMidiDevice())); |
SLOT(setupMidiDevice())); |
115 |
QObject::connect(ui.AudioDeviceToolButton, |
QObject::connect(m_ui.AudioDeviceToolButton, |
116 |
SIGNAL(clicked()), |
SIGNAL(clicked()), |
117 |
SLOT(setupAudioDevice())); |
SLOT(setupAudioDevice())); |
118 |
|
QObject::connect(&m_routingModel, |
119 |
|
SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), |
120 |
|
SLOT(optionsChanged())); |
121 |
|
QObject::connect(&m_routingModel, |
122 |
|
SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), |
123 |
|
SLOT(updateTableCellRenderers(const QModelIndex&, const QModelIndex&))); |
124 |
|
QObject::connect(&m_routingModel, |
125 |
|
SIGNAL(modelReset()), |
126 |
|
SLOT(updateTableCellRenderers())); |
127 |
} |
} |
128 |
|
|
129 |
ChannelForm::~ChannelForm() { |
ChannelForm::~ChannelForm() |
130 |
|
{ |
131 |
if (m_pDeviceForm) |
if (m_pDeviceForm) |
132 |
delete m_pDeviceForm; |
delete m_pDeviceForm; |
133 |
m_pDeviceForm = NULL; |
m_pDeviceForm = NULL; |
134 |
|
|
135 |
|
qDeleteAll(m_midiDevices); |
136 |
|
m_midiDevices.clear(); |
137 |
|
|
138 |
|
qDeleteAll(m_audioDevices); |
139 |
|
m_audioDevices.clear(); |
140 |
} |
} |
141 |
|
|
142 |
|
|
153 |
|
|
154 |
// It can be a brand new channel, remember? |
// It can be a brand new channel, remember? |
155 |
bool bNew = (m_pChannel->channelID() < 0); |
bool bNew = (m_pChannel->channelID() < 0); |
156 |
setCaption(QSAMPLER_TITLE ": " + m_pChannel->channelName()); |
setWindowTitle(QSAMPLER_TITLE ": " + m_pChannel->channelName()); |
157 |
|
|
158 |
// Check if we're up and connected. |
// Check if we're up and connected. |
159 |
MainForm *pMainForm = MainForm::getInstance(); |
MainForm *pMainForm = MainForm::getInstance(); |
170 |
m_iDirtySetup++; |
m_iDirtySetup++; |
171 |
|
|
172 |
// Load combo box history... |
// Load combo box history... |
173 |
pOptions->loadComboBoxHistory(ui.InstrumentFileComboBox); |
pOptions->loadComboBoxHistory(m_ui.InstrumentFileComboBox); |
|
|
|
|
// Notify.that we've just changed one audio route. |
|
|
QObject::connect(ui.AudioRoutingTable, SIGNAL(valueChanged(int,int)), |
|
|
this, SLOT(changeAudioRouting(int,int))); |
|
174 |
|
|
175 |
// Populate Engines list. |
// Populate Engines list. |
176 |
const char **ppszEngines = ::lscp_list_available_engines(pMainForm->client()); |
const char **ppszEngines = ::lscp_list_available_engines(pMainForm->client()); |
177 |
if (ppszEngines) { |
if (ppszEngines) { |
178 |
ui.EngineNameComboBox->clear(); |
m_ui.EngineNameComboBox->clear(); |
179 |
for (int iEngine = 0; ppszEngines[iEngine]; iEngine++) |
for (int iEngine = 0; ppszEngines[iEngine]; iEngine++) |
180 |
ui.EngineNameComboBox->addItem(QString(ppszEngines[iEngine])); |
m_ui.EngineNameComboBox->addItem(QString(ppszEngines[iEngine])); |
181 |
} |
} |
182 |
else m_pChannel->appendMessagesClient("lscp_list_available_engines"); |
else m_pChannel->appendMessagesClient("lscp_list_available_engines"); |
183 |
|
|
184 |
// Populate Audio output type list. |
// Populate Audio output type list. |
185 |
ui.AudioDriverComboBox->clear(); |
m_ui.AudioDriverComboBox->clear(); |
186 |
ui.AudioDriverComboBox->insertStringList( |
m_ui.AudioDriverComboBox->insertItems(0, |
187 |
qsamplerDevice::getDrivers(pMainForm->client(), qsamplerDevice::Audio)); |
qsamplerDevice::getDrivers(pMainForm->client(), qsamplerDevice::Audio)); |
188 |
|
|
189 |
// Populate MIDI input type list. |
// Populate MIDI input type list. |
190 |
ui.MidiDriverComboBox->clear(); |
m_ui.MidiDriverComboBox->clear(); |
191 |
ui.MidiDriverComboBox->insertStringList( |
m_ui.MidiDriverComboBox->insertItems(0, |
192 |
qsamplerDevice::getDrivers(pMainForm->client(), qsamplerDevice::Midi)); |
qsamplerDevice::getDrivers(pMainForm->client(), qsamplerDevice::Midi)); |
193 |
|
|
194 |
// Populate Maps list. |
// Populate Maps list. |
195 |
ui.MidiMapComboBox->clear(); |
m_ui.MidiMapComboBox->clear(); |
196 |
ui.MidiMapComboBox->insertStringList(qsamplerInstrument::getMapNames()); |
m_ui.MidiMapComboBox->insertItems(0, |
197 |
|
qsamplerInstrument::getMapNames()); |
198 |
|
|
199 |
// Read proper channel information, |
// Read proper channel information, |
200 |
// and populate the channel form fields. |
// and populate the channel form fields. |
205 |
sEngineName = pOptions->sEngineName; |
sEngineName = pOptions->sEngineName; |
206 |
if (sEngineName.isEmpty()) |
if (sEngineName.isEmpty()) |
207 |
sEngineName = qsamplerChannel::noEngineName(); |
sEngineName = qsamplerChannel::noEngineName(); |
208 |
if (ui.EngineNameComboBox->findText(sEngineName, |
if (m_ui.EngineNameComboBox->findText(sEngineName, |
209 |
Qt::MatchExactly | Qt::MatchCaseSensitive) < 0) { |
Qt::MatchExactly | Qt::MatchCaseSensitive) < 0) { |
210 |
ui.EngineNameComboBox->addItem(sEngineName); |
m_ui.EngineNameComboBox->addItem(sEngineName); |
211 |
} |
} |
212 |
ui.EngineNameComboBox->setCurrentIndex( |
m_ui.EngineNameComboBox->setCurrentIndex( |
213 |
ui.EngineNameComboBox->findText(sEngineName, |
m_ui.EngineNameComboBox->findText(sEngineName, |
214 |
Qt::MatchExactly | Qt::MatchCaseSensitive)); |
Qt::MatchExactly | Qt::MatchCaseSensitive)); |
215 |
|
|
216 |
// Instrument filename and index... |
// Instrument filename and index... |
217 |
QString sInstrumentFile = pChannel->instrumentFile(); |
QString sInstrumentFile = pChannel->instrumentFile(); |
218 |
if (sInstrumentFile.isEmpty()) |
if (sInstrumentFile.isEmpty()) |
219 |
sInstrumentFile = qsamplerChannel::noInstrumentName(); |
sInstrumentFile = qsamplerChannel::noInstrumentName(); |
220 |
ui.InstrumentFileComboBox->setCurrentText(sInstrumentFile); |
m_ui.InstrumentFileComboBox->setEditText(sInstrumentFile); |
221 |
ui.InstrumentNrComboBox->clear(); |
m_ui.InstrumentNrComboBox->clear(); |
222 |
ui.InstrumentNrComboBox->insertStringList( |
m_ui.InstrumentNrComboBox->insertItems(0, |
223 |
qsamplerChannel::getInstrumentList(sInstrumentFile, |
qsamplerChannel::getInstrumentList(sInstrumentFile, |
224 |
pOptions->bInstrumentNames)); |
pOptions->bInstrumentNames)); |
225 |
ui.InstrumentNrComboBox->setCurrentItem(pChannel->instrumentNr()); |
int iInstrumentNr = pChannel->instrumentNr(); |
226 |
|
if (iInstrumentNr < 0) |
227 |
|
iInstrumentNr = 0; |
228 |
|
m_ui.InstrumentNrComboBox->setCurrentIndex(iInstrumentNr); |
229 |
|
|
230 |
// MIDI input device... |
// MIDI input device... |
231 |
qsamplerDevice midiDevice(qsamplerDevice::Midi, m_pChannel->midiDevice()); |
qsamplerDevice midiDevice(qsamplerDevice::Midi, m_pChannel->midiDevice()); |
232 |
// MIDI input driver... |
// MIDI input driver... |
233 |
QString sMidiDriver = midiDevice.driverName(); |
QString sMidiDriver = midiDevice.driverName(); |
234 |
if (sMidiDriver.isEmpty() || bNew) |
if (sMidiDriver.isEmpty() || bNew) |
235 |
sMidiDriver = pOptions->sMidiDriver.upper(); |
sMidiDriver = pOptions->sMidiDriver.toUpper(); |
236 |
if (!sMidiDriver.isEmpty()) { |
if (!sMidiDriver.isEmpty()) { |
237 |
if (ui.MidiDriverComboBox->findText(sMidiDriver, |
if (m_ui.MidiDriverComboBox->findText(sMidiDriver, |
238 |
Qt::MatchExactly | Qt::MatchCaseSensitive) < 0) { |
Qt::MatchExactly | Qt::MatchCaseSensitive) < 0) { |
239 |
ui.MidiDriverComboBox->insertItem(sMidiDriver); |
m_ui.MidiDriverComboBox->insertItem(0, sMidiDriver); |
240 |
} |
} |
241 |
ui.MidiDriverComboBox->setCurrentText(sMidiDriver); |
m_ui.MidiDriverComboBox->setItemText( |
242 |
|
m_ui.MidiDriverComboBox->currentIndex(), |
243 |
|
sMidiDriver); |
244 |
} |
} |
245 |
selectMidiDriverItem(sMidiDriver); |
selectMidiDriverItem(sMidiDriver); |
246 |
if (!bNew) |
if (!bNew) { |
247 |
ui.MidiDeviceComboBox->setCurrentText(midiDevice.deviceName()); |
m_ui.MidiDeviceComboBox->setItemText( |
248 |
selectMidiDeviceItem(ui.MidiDeviceComboBox->currentItem()); |
m_ui.MidiDeviceComboBox->currentIndex(), |
249 |
|
midiDevice.deviceName()); |
250 |
|
} |
251 |
|
selectMidiDeviceItem(m_ui.MidiDeviceComboBox->currentIndex()); |
252 |
// MIDI input port... |
// MIDI input port... |
253 |
ui.MidiPortSpinBox->setValue(pChannel->midiPort()); |
m_ui.MidiPortSpinBox->setValue(pChannel->midiPort()); |
254 |
// MIDI input channel... |
// MIDI input channel... |
255 |
int iMidiChannel = pChannel->midiChannel(); |
int iMidiChannel = pChannel->midiChannel(); |
256 |
// When new, try to suggest a sensible MIDI channel... |
// When new, try to suggest a sensible MIDI channel... |
257 |
if (iMidiChannel < 0) |
if (iMidiChannel < 0) |
258 |
iMidiChannel = (::lscp_get_channels(pMainForm->client()) % 16); |
iMidiChannel = (::lscp_get_channels(pMainForm->client()) % 16); |
259 |
ui.MidiChannelComboBox->setCurrentItem(iMidiChannel); |
m_ui.MidiChannelComboBox->setCurrentIndex(iMidiChannel); |
260 |
// MIDI instrument map... |
// MIDI instrument map... |
261 |
int iMidiMap = (bNew ? pOptions->iMidiMap : pChannel->midiMap()); |
int iMidiMap = (bNew ? pOptions->iMidiMap : pChannel->midiMap()); |
262 |
// When new, try to suggest a sensible MIDI map... |
// When new, try to suggest a sensible MIDI map... |
263 |
if (iMidiMap < 0) |
if (iMidiMap < 0) |
264 |
iMidiMap = 0; |
iMidiMap = 0; |
265 |
const QString& sMapName = qsamplerInstrument::getMapName(iMidiMap); |
const QString& sMapName = qsamplerInstrument::getMapName(iMidiMap); |
266 |
if (!sMapName.isEmpty()) |
if (!sMapName.isEmpty()) { |
267 |
ui.MidiMapComboBox->setCurrentText(sMapName); |
m_ui.MidiMapComboBox->setItemText( |
268 |
|
m_ui.MidiMapComboBox->currentIndex(), |
269 |
|
sMapName); |
270 |
|
} |
271 |
// It might be no maps around... |
// It might be no maps around... |
272 |
bool bMidiMapEnabled = (ui.MidiMapComboBox->count() > 0); |
bool bMidiMapEnabled = (m_ui.MidiMapComboBox->count() > 0); |
273 |
ui.MidiMapTextLabel->setEnabled(bMidiMapEnabled); |
m_ui.MidiMapTextLabel->setEnabled(bMidiMapEnabled); |
274 |
ui.MidiMapComboBox->setEnabled(bMidiMapEnabled); |
m_ui.MidiMapComboBox->setEnabled(bMidiMapEnabled); |
275 |
|
|
276 |
// Audio output device... |
// Audio output device... |
277 |
qsamplerDevice audioDevice(qsamplerDevice::Audio, m_pChannel->audioDevice()); |
qsamplerDevice audioDevice(qsamplerDevice::Audio, m_pChannel->audioDevice()); |
278 |
// Audio output driver... |
// Audio output driver... |
279 |
QString sAudioDriver = audioDevice.driverName(); |
QString sAudioDriver = audioDevice.driverName(); |
280 |
if (sAudioDriver.isEmpty() || bNew) |
if (sAudioDriver.isEmpty() || bNew) |
281 |
sAudioDriver = pOptions->sAudioDriver.upper(); |
sAudioDriver = pOptions->sAudioDriver.toUpper(); |
282 |
if (!sAudioDriver.isEmpty()) { |
if (!sAudioDriver.isEmpty()) { |
283 |
if (ui.AudioDriverComboBox->findText(sAudioDriver, |
if (m_ui.AudioDriverComboBox->findText(sAudioDriver, |
284 |
Qt::MatchExactly | Qt::MatchCaseSensitive) < 0) { |
Qt::MatchExactly | Qt::MatchCaseSensitive) < 0) { |
285 |
ui.AudioDriverComboBox->insertItem(sAudioDriver); |
m_ui.AudioDriverComboBox->insertItem(0, sAudioDriver); |
286 |
} |
} |
287 |
ui.AudioDriverComboBox->setCurrentText(sAudioDriver); |
m_ui.AudioDriverComboBox->setItemText( |
288 |
|
m_ui.AudioDriverComboBox->currentIndex(), |
289 |
|
sAudioDriver); |
290 |
} |
} |
291 |
selectAudioDriverItem(sAudioDriver); |
selectAudioDriverItem(sAudioDriver); |
292 |
if (!bNew) |
if (!bNew) { |
293 |
ui.AudioDeviceComboBox->setCurrentText(audioDevice.deviceName()); |
m_ui.AudioDeviceComboBox->setItemText( |
294 |
selectAudioDeviceItem(ui.AudioDeviceComboBox->currentItem()); |
m_ui.AudioDeviceComboBox->currentIndex(), |
295 |
|
audioDevice.deviceName()); |
296 |
|
} |
297 |
|
selectAudioDeviceItem(m_ui.AudioDeviceComboBox->currentIndex()); |
298 |
|
|
299 |
|
// Let the audio routing table see the light, |
300 |
|
// if we're editing an existing sampler channel... |
301 |
|
m_ui.AudioRoutingTable->setVisible(!bNew); |
302 |
|
|
303 |
// As convenient, make it ready on stabilizeForm() for |
// As convenient, make it ready on stabilizeForm() for |
304 |
// prompt acceptance, if we got the minimum required... |
// prompt acceptance, if we got the minimum required... |
328 |
return; |
return; |
329 |
|
|
330 |
// Flush any pending editing... |
// Flush any pending editing... |
331 |
//ui.AudioRoutingTable->flush(); |
//m_ui.AudioRoutingTable->flush(); |
332 |
|
|
333 |
// We'll go for it! |
// We'll go for it! |
334 |
if (m_iDirtyCount > 0) { |
if (m_iDirtyCount > 0) { |
338 |
iErrors++; |
iErrors++; |
339 |
// Accept Audio driver or device selection... |
// Accept Audio driver or device selection... |
340 |
if (m_audioDevices.isEmpty()) { |
if (m_audioDevices.isEmpty()) { |
341 |
if (!m_pChannel->setAudioDriver(ui.AudioDriverComboBox->currentText())) |
if (!m_pChannel->setAudioDriver(m_ui.AudioDriverComboBox->currentText())) |
342 |
iErrors++; |
iErrors++; |
343 |
} else { |
} else { |
344 |
qsamplerDevice *pDevice = m_audioDevices.at(ui.AudioDeviceComboBox->currentItem()); |
qsamplerDevice *pDevice = NULL; |
345 |
|
int iAudioItem = m_ui.AudioDeviceComboBox->currentIndex(); |
346 |
|
if (iAudioItem >= 0 && iAudioItem < m_audioDevices.count()) |
347 |
|
pDevice = m_audioDevices.at(iAudioItem); |
348 |
|
qsamplerChannelRoutingMap routingMap = m_routingModel.routingMap(); |
349 |
if (pDevice == NULL) |
if (pDevice == NULL) |
350 |
iErrors++; |
iErrors++; |
351 |
else if (!m_pChannel->setAudioDevice(pDevice->deviceID())) |
else if (!m_pChannel->setAudioDevice(pDevice->deviceID())) |
352 |
iErrors++; |
iErrors++; |
353 |
else if (!m_audioRouting.isEmpty()) { |
else if (!routingMap.isEmpty()) { |
354 |
// Set the audio route changes... |
// Set the audio route changes... |
355 |
qsamplerChannelRoutingMap::ConstIterator iter; |
qsamplerChannelRoutingMap::ConstIterator iter; |
356 |
for (iter = m_audioRouting.begin(); |
for (iter = routingMap.begin(); |
357 |
iter != m_audioRouting.end(); ++iter) { |
iter != routingMap.end(); ++iter) { |
358 |
if (!m_pChannel->setAudioChannel(iter.key(), iter.data())) |
if (!m_pChannel->setAudioChannel(iter.key(), iter.value())) |
359 |
iErrors++; |
iErrors++; |
360 |
} |
} |
361 |
} |
} |
362 |
} |
} |
363 |
// Accept MIDI driver or device selection... |
// Accept MIDI driver or device selection... |
364 |
if (m_midiDevices.isEmpty()) { |
if (m_midiDevices.isEmpty()) { |
365 |
if (!m_pChannel->setMidiDriver(ui.MidiDriverComboBox->currentText())) |
if (!m_pChannel->setMidiDriver(m_ui.MidiDriverComboBox->currentText())) |
366 |
iErrors++; |
iErrors++; |
367 |
} else { |
} else { |
368 |
qsamplerDevice *pDevice = m_midiDevices.at(ui.MidiDeviceComboBox->currentItem()); |
qsamplerDevice *pDevice = NULL; |
369 |
|
int iMidiItem = m_ui.MidiDeviceComboBox->currentIndex(); |
370 |
|
if (iMidiItem >= 0 && iMidiItem < m_midiDevices.count()) |
371 |
|
pDevice = m_midiDevices.at(iMidiItem); |
372 |
if (pDevice == NULL) |
if (pDevice == NULL) |
373 |
iErrors++; |
iErrors++; |
374 |
else if (!m_pChannel->setMidiDevice(pDevice->deviceID())) |
else if (!m_pChannel->setMidiDevice(pDevice->deviceID())) |
375 |
iErrors++; |
iErrors++; |
376 |
} |
} |
377 |
// MIDI input port number... |
// MIDI input port number... |
378 |
if (!m_pChannel->setMidiPort(ui.MidiPortSpinBox->value())) |
if (!m_pChannel->setMidiPort(m_ui.MidiPortSpinBox->value())) |
379 |
iErrors++; |
iErrors++; |
380 |
// MIDI input channel... |
// MIDI input channel... |
381 |
if (!m_pChannel->setMidiChannel(ui.MidiChannelComboBox->currentItem())) |
if (!m_pChannel->setMidiChannel(m_ui.MidiChannelComboBox->currentIndex())) |
382 |
iErrors++; |
iErrors++; |
383 |
// Engine name... |
// Engine name... |
384 |
if (!m_pChannel->loadEngine(ui.EngineNameComboBox->currentText())) |
if (!m_pChannel->loadEngine(m_ui.EngineNameComboBox->currentText())) |
385 |
iErrors++; |
iErrors++; |
386 |
// Instrument file and index... |
// Instrument file and index... |
387 |
const QString& sPath = ui.InstrumentFileComboBox->currentText(); |
const QString& sPath = m_ui.InstrumentFileComboBox->currentText(); |
388 |
if (!sPath.isEmpty() && QFileInfo(sPath).exists()) { |
if (!sPath.isEmpty() && QFileInfo(sPath).exists()) { |
389 |
if (!m_pChannel->loadInstrument(sPath, ui.InstrumentNrComboBox->currentItem())) |
if (!m_pChannel->loadInstrument(sPath, m_ui.InstrumentNrComboBox->currentIndex())) |
390 |
iErrors++; |
iErrors++; |
391 |
} |
} |
392 |
// MIDI intrument map... |
// MIDI intrument map... |
393 |
if (!m_pChannel->setMidiMap(ui.MidiMapComboBox->currentItem())) |
if (!m_pChannel->setMidiMap(m_ui.MidiMapComboBox->currentIndex())) |
394 |
iErrors++; |
iErrors++; |
395 |
// Show error messages? |
// Show error messages? |
396 |
if (iErrors > 0) |
if (iErrors > 0) { |
397 |
m_pChannel->appendMessagesError(tr("Some channel settings could not be set.\n\nSorry.")); |
m_pChannel->appendMessagesError( |
398 |
|
tr("Some channel settings could not be set.\n\nSorry.")); |
399 |
|
} |
400 |
} |
} |
401 |
|
|
402 |
// Save default engine name, instrument directory and history... |
// Save default engine name, instrument directory and history... |
403 |
pOptions->sInstrumentDir = QFileInfo(ui.InstrumentFileComboBox->currentText()).dirPath(true); |
pOptions->sInstrumentDir = QFileInfo( |
404 |
pOptions->sEngineName = ui.EngineNameComboBox->currentText(); |
m_ui.InstrumentFileComboBox->currentText()).dir().absolutePath(); |
405 |
pOptions->sAudioDriver = ui.AudioDriverComboBox->currentText(); |
pOptions->sEngineName = m_ui.EngineNameComboBox->currentText(); |
406 |
pOptions->sMidiDriver = ui.MidiDriverComboBox->currentText(); |
pOptions->sAudioDriver = m_ui.AudioDriverComboBox->currentText(); |
407 |
pOptions->iMidiMap = ui.MidiMapComboBox->currentItem(); |
pOptions->sMidiDriver = m_ui.MidiDriverComboBox->currentText(); |
408 |
pOptions->saveComboBoxHistory(ui.InstrumentFileComboBox); |
pOptions->iMidiMap = m_ui.MidiMapComboBox->currentIndex(); |
409 |
|
pOptions->saveComboBoxHistory(m_ui.InstrumentFileComboBox); |
410 |
|
|
411 |
// Just go with dialog acceptance. |
// Just go with dialog acceptance. |
412 |
QDialog::accept(); |
QDialog::accept(); |
419 |
bool bReject = true; |
bool bReject = true; |
420 |
|
|
421 |
// Check if there's any pending changes... |
// Check if there's any pending changes... |
422 |
if (m_iDirtyCount > 0 && ui.OkPushButton->isEnabled()) { |
if (m_iDirtyCount > 0 && m_ui.OkPushButton->isEnabled()) { |
423 |
switch (QMessageBox::warning(this, |
switch (QMessageBox::warning(this, |
424 |
QSAMPLER_TITLE ": " + tr("Warning"), |
QSAMPLER_TITLE ": " + tr("Warning"), |
425 |
tr("Some channel settings have been changed.\n\n" |
tr("Some channel settings have been changed.\n\n" |
456 |
|
|
457 |
// FIXME: the instrument file filters should be restricted, |
// FIXME: the instrument file filters should be restricted, |
458 |
// depending on the current engine. |
// depending on the current engine. |
459 |
QString sInstrumentFile = QFileDialog::getOpenFileName( |
QString sInstrumentFile = QFileDialog::getOpenFileName(this, |
460 |
pOptions->sInstrumentDir, // Start here. |
QSAMPLER_TITLE ": " + tr("Instrument files"), // Caption. |
461 |
tr("Instrument files") + " (*.gig *.dls)", // Filter (GIG and DLS files) |
pOptions->sInstrumentDir, // Start here. |
462 |
this, 0, // Parent and name (none) |
tr("Instrument files") + " (*.gig *.dls)" // Filter (GIG and DLS files) |
|
QSAMPLER_TITLE ": " + tr("Instrument files") // Caption. |
|
463 |
); |
); |
464 |
|
|
465 |
if (sInstrumentFile.isEmpty()) |
if (sInstrumentFile.isEmpty()) |
466 |
return; |
return; |
467 |
|
|
468 |
ui.InstrumentFileComboBox->setCurrentText(sInstrumentFile); |
m_ui.InstrumentFileComboBox->setEditText(sInstrumentFile); |
469 |
updateInstrumentName(); |
updateInstrumentName(); |
470 |
} |
} |
471 |
|
|
485 |
|
|
486 |
// Finally this better idea would be to use libgig |
// Finally this better idea would be to use libgig |
487 |
// to retrieve the REAL instrument names. |
// to retrieve the REAL instrument names. |
488 |
ui.InstrumentNrComboBox->clear(); |
m_ui.InstrumentNrComboBox->clear(); |
489 |
ui.InstrumentNrComboBox->insertStringList( |
m_ui.InstrumentNrComboBox->insertItems(0, |
490 |
qsamplerChannel::getInstrumentList( |
qsamplerChannel::getInstrumentList( |
491 |
ui.InstrumentFileComboBox->currentText(), |
m_ui.InstrumentFileComboBox->currentText(), |
492 |
pOptions->bInstrumentNames) |
pOptions->bInstrumentNames) |
493 |
); |
); |
494 |
|
|
498 |
|
|
499 |
// Show device options dialog. |
// Show device options dialog. |
500 |
void ChannelForm::setupDevice ( qsamplerDevice *pDevice, |
void ChannelForm::setupDevice ( qsamplerDevice *pDevice, |
501 |
qsamplerDevice::qsamplerDeviceType deviceTypeMode, |
qsamplerDevice::DeviceType deviceTypeMode, |
502 |
const QString& sDriverName ) |
const QString& sDriverName ) |
503 |
{ |
{ |
504 |
|
if (pDevice == NULL) |
505 |
|
return; |
506 |
|
|
507 |
MainForm *pMainForm = MainForm::getInstance(); |
MainForm *pMainForm = MainForm::getInstance(); |
508 |
if (pMainForm == NULL) |
if (pMainForm == NULL) |
509 |
return; |
return; |
513 |
// Create the device form if not already... |
// Create the device form if not already... |
514 |
if (m_pDeviceForm == NULL) { |
if (m_pDeviceForm == NULL) { |
515 |
m_pDeviceForm = new DeviceForm(this, Qt::Dialog); |
m_pDeviceForm = new DeviceForm(this, Qt::Dialog); |
516 |
m_pDeviceForm->setAttribute(Qt::WA_ShowModal); |
m_pDeviceForm->setAttribute(Qt::WA_ShowModal); |
517 |
QObject::connect(m_pDeviceForm, SIGNAL(devicesChanged()), |
QObject::connect(m_pDeviceForm, SIGNAL(devicesChanged()), |
518 |
this, SLOT(updateDevices())); |
this, SLOT(updateDevices())); |
519 |
} |
} |
538 |
if (pMainForm->client() == NULL) |
if (pMainForm->client() == NULL) |
539 |
return; |
return; |
540 |
|
|
541 |
const QString sDriverName = sMidiDriver.upper(); |
const QString sDriverName = sMidiDriver.toUpper(); |
542 |
|
|
543 |
// Save current device id. |
// Save current device id. |
544 |
|
// Save current device id. |
545 |
int iDeviceID = 0; |
int iDeviceID = 0; |
546 |
qsamplerDevice *pDevice = m_midiDevices.at(ui.MidiDeviceComboBox->currentItem()); |
qsamplerDevice *pDevice = NULL; |
547 |
|
int iMidiItem = m_ui.MidiDeviceComboBox->currentIndex(); |
548 |
|
if (iMidiItem >= 0 && iMidiItem < m_midiDevices.count()) |
549 |
|
pDevice = m_midiDevices.at(iMidiItem); |
550 |
if (pDevice) |
if (pDevice) |
551 |
iDeviceID = pDevice->deviceID(); |
iDeviceID = pDevice->deviceID(); |
552 |
|
|
553 |
// Clean maplist. |
// Clean maplist. |
554 |
ui.MidiDeviceComboBox->clear(); |
m_ui.MidiDeviceComboBox->clear(); |
555 |
|
qDeleteAll(m_midiDevices); |
556 |
m_midiDevices.clear(); |
m_midiDevices.clear(); |
557 |
|
|
558 |
// Populate with the current ones... |
// Populate with the current ones... |
559 |
const QPixmap midiPixmap(":/qsampler/pixmaps/midi2.png"); |
const QPixmap midiPixmap(":/icons/midi2.png"); |
560 |
int *piDeviceIDs = qsamplerDevice::getDevices(pMainForm->client(), |
int *piDeviceIDs = qsamplerDevice::getDevices(pMainForm->client(), |
561 |
qsamplerDevice::Midi); |
qsamplerDevice::Midi); |
562 |
for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) { |
for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) { |
563 |
pDevice = new qsamplerDevice(qsamplerDevice::Midi, piDeviceIDs[i]); |
pDevice = new qsamplerDevice(qsamplerDevice::Midi, piDeviceIDs[i]); |
564 |
if (pDevice->driverName().upper() == sDriverName) { |
if (pDevice->driverName().toUpper() == sDriverName) { |
565 |
ui.MidiDeviceComboBox->insertItem(midiPixmap, pDevice->deviceName()); |
m_ui.MidiDeviceComboBox->insertItem(0, |
566 |
|
midiPixmap, pDevice->deviceName()); |
567 |
m_midiDevices.append(pDevice); |
m_midiDevices.append(pDevice); |
568 |
} else { |
} else { |
569 |
delete pDevice; |
delete pDevice; |
574 |
bool bEnabled = !m_midiDevices.isEmpty(); |
bool bEnabled = !m_midiDevices.isEmpty(); |
575 |
if (bEnabled) { |
if (bEnabled) { |
576 |
// Select the previous current device... |
// Select the previous current device... |
577 |
int iMidiItem = 0; |
iMidiItem = 0; |
578 |
for (pDevice = m_midiDevices.first(); |
QListIterator<qsamplerDevice *> iter(m_midiDevices); |
579 |
pDevice; |
while (iter.hasNext()) { |
580 |
pDevice = m_midiDevices.next()) { |
pDevice = iter.next(); |
581 |
if (pDevice->deviceID() == iDeviceID) { |
if (pDevice->deviceID() == iDeviceID) { |
582 |
ui.MidiDeviceComboBox->setCurrentItem(iMidiItem); |
m_ui.MidiDeviceComboBox->setCurrentIndex(iMidiItem); |
583 |
selectMidiDeviceItem(iMidiItem); |
selectMidiDeviceItem(iMidiItem); |
584 |
break; |
break; |
585 |
} |
} |
586 |
iMidiItem++; |
iMidiItem++; |
587 |
} |
} |
588 |
} else { |
} else { |
589 |
ui.MidiDeviceComboBox->insertItem( |
m_ui.MidiDeviceComboBox->insertItem(0, |
590 |
tr("(New MIDI %1 device)").arg(sMidiDriver)); |
tr("(New MIDI %1 device)").arg(sMidiDriver)); |
591 |
} |
} |
592 |
ui.MidiDeviceTextLabel->setEnabled(bEnabled); |
m_ui.MidiDeviceTextLabel->setEnabled(bEnabled); |
593 |
ui.MidiDeviceComboBox->setEnabled(bEnabled); |
m_ui.MidiDeviceComboBox->setEnabled(bEnabled); |
594 |
} |
} |
595 |
|
|
596 |
|
|
608 |
// Select MIDI device item. |
// Select MIDI device item. |
609 |
void ChannelForm::selectMidiDeviceItem ( int iMidiItem ) |
void ChannelForm::selectMidiDeviceItem ( int iMidiItem ) |
610 |
{ |
{ |
611 |
qsamplerDevice *pDevice = m_midiDevices.at(iMidiItem); |
qsamplerDevice *pDevice = NULL; |
612 |
|
if (iMidiItem >= 0 && iMidiItem < m_midiDevices.count()) |
613 |
|
pDevice = m_midiDevices.at(iMidiItem); |
614 |
if (pDevice) { |
if (pDevice) { |
615 |
const qsamplerDeviceParamMap& params = pDevice->params(); |
const qsamplerDeviceParamMap& params = pDevice->params(); |
616 |
int iPorts = params["PORTS"].value.toInt(); |
int iPorts = params["PORTS"].value.toInt(); |
617 |
ui.MidiPortTextLabel->setEnabled(iPorts > 0); |
m_ui.MidiPortTextLabel->setEnabled(iPorts > 0); |
618 |
ui.MidiPortSpinBox->setEnabled(iPorts > 0); |
m_ui.MidiPortSpinBox->setEnabled(iPorts > 0); |
619 |
if (iPorts > 0) |
if (iPorts > 0) |
620 |
ui.MidiPortSpinBox->setMaxValue(iPorts - 1); |
m_ui.MidiPortSpinBox->setMaximum(iPorts - 1); |
621 |
} |
} |
622 |
} |
} |
623 |
|
|
636 |
// MIDI device options. |
// MIDI device options. |
637 |
void ChannelForm::setupMidiDevice (void) |
void ChannelForm::setupMidiDevice (void) |
638 |
{ |
{ |
639 |
setupDevice(m_midiDevices.at(ui.MidiDeviceComboBox->currentItem()), |
qsamplerDevice *pDevice = NULL; |
640 |
qsamplerDevice::Midi, ui.MidiDriverComboBox->currentText()); |
int iMidiItem = m_ui.MidiDeviceComboBox->currentIndex(); |
641 |
|
if (iMidiItem >= 0 && iMidiItem < m_midiDevices.count()) |
642 |
|
pDevice = m_midiDevices.at(iMidiItem); |
643 |
|
setupDevice(pDevice, |
644 |
|
qsamplerDevice::Midi, m_ui.MidiDriverComboBox->currentText()); |
645 |
} |
} |
646 |
|
|
647 |
|
|
654 |
if (pMainForm->client() == NULL) |
if (pMainForm->client() == NULL) |
655 |
return; |
return; |
656 |
|
|
657 |
const QString sDriverName = sAudioDriver.upper(); |
const QString sDriverName = sAudioDriver.toUpper(); |
658 |
|
|
659 |
// Save current device id. |
// Save current device id. |
660 |
int iDeviceID = 0; |
int iDeviceID = 0; |
661 |
qsamplerDevice *pDevice = m_audioDevices.at(ui.AudioDeviceComboBox->currentItem()); |
qsamplerDevice *pDevice = NULL; |
662 |
|
int iAudioItem = m_ui.AudioDeviceComboBox->currentIndex(); |
663 |
|
if (iAudioItem >= 0 && iAudioItem < m_audioDevices.count()) |
664 |
|
pDevice = m_audioDevices.at(iAudioItem); |
665 |
if (pDevice) |
if (pDevice) |
666 |
iDeviceID = pDevice->deviceID(); |
iDeviceID = pDevice->deviceID(); |
667 |
|
|
668 |
// Clean maplist. |
// Clean maplist. |
669 |
ui.AudioDeviceComboBox->clear(); |
m_ui.AudioDeviceComboBox->clear(); |
670 |
|
qDeleteAll(m_audioDevices); |
671 |
m_audioDevices.clear(); |
m_audioDevices.clear(); |
672 |
|
|
673 |
// Populate with the current ones... |
// Populate with the current ones... |
674 |
const QPixmap audioPixmap(":/qsampler/pixmaps/audio2.png"); |
const QPixmap audioPixmap(":/icons/audio2.png"); |
675 |
int *piDeviceIDs = qsamplerDevice::getDevices(pMainForm->client(), |
int *piDeviceIDs = qsamplerDevice::getDevices(pMainForm->client(), |
676 |
qsamplerDevice::Audio); |
qsamplerDevice::Audio); |
677 |
for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) { |
for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) { |
678 |
pDevice = new qsamplerDevice(qsamplerDevice::Audio, piDeviceIDs[i]); |
pDevice = new qsamplerDevice(qsamplerDevice::Audio, piDeviceIDs[i]); |
679 |
if (pDevice->driverName().upper() == sDriverName) { |
if (pDevice->driverName().toUpper() == sDriverName) { |
680 |
ui.AudioDeviceComboBox->insertItem(audioPixmap, pDevice->deviceName()); |
m_ui.AudioDeviceComboBox->insertItem(0, |
681 |
|
audioPixmap, pDevice->deviceName()); |
682 |
m_audioDevices.append(pDevice); |
m_audioDevices.append(pDevice); |
683 |
} else { |
} else { |
684 |
delete pDevice; |
delete pDevice; |
689 |
bool bEnabled = !m_audioDevices.isEmpty(); |
bool bEnabled = !m_audioDevices.isEmpty(); |
690 |
if (bEnabled) { |
if (bEnabled) { |
691 |
// Select the previous current device... |
// Select the previous current device... |
692 |
int iAudioItem = 0; |
iAudioItem = 0; |
693 |
for (pDevice = m_audioDevices.first(); |
QListIterator<qsamplerDevice *> iter(m_audioDevices); |
694 |
pDevice; |
while (iter.hasNext()) { |
695 |
pDevice = m_audioDevices.next()) { |
pDevice = iter.next(); |
696 |
if (pDevice->deviceID() == iDeviceID) { |
if (pDevice->deviceID() == iDeviceID) { |
697 |
ui.AudioDeviceComboBox->setCurrentItem(iAudioItem); |
m_ui.AudioDeviceComboBox->setCurrentIndex(iAudioItem); |
698 |
selectAudioDeviceItem(iAudioItem); |
selectAudioDeviceItem(iAudioItem); |
699 |
break; |
break; |
700 |
} |
} |
701 |
iAudioItem++; |
iAudioItem++; |
702 |
} |
} |
703 |
} else { |
} else { |
704 |
ui.AudioDeviceComboBox->insertItem( |
m_ui.AudioDeviceComboBox->insertItem(0, |
705 |
tr("(New Audio %1 device)").arg(sAudioDriver)); |
tr("(New Audio %1 device)").arg(sAudioDriver)); |
706 |
//ui.AudioRoutingTable->setNumRows(0); |
//m_ui.AudioRoutingTable->setNumRows(0); |
707 |
} |
} |
708 |
ui.AudioDeviceTextLabel->setEnabled(bEnabled); |
m_ui.AudioDeviceTextLabel->setEnabled(bEnabled); |
709 |
ui.AudioDeviceComboBox->setEnabled(bEnabled); |
m_ui.AudioDeviceComboBox->setEnabled(bEnabled); |
710 |
ui.AudioRoutingTable->setEnabled(bEnabled); |
m_ui.AudioRoutingTable->setEnabled(bEnabled); |
711 |
} |
} |
712 |
|
|
713 |
|
|
725 |
// Select Audio device item. |
// Select Audio device item. |
726 |
void ChannelForm::selectAudioDeviceItem ( int iAudioItem ) |
void ChannelForm::selectAudioDeviceItem ( int iAudioItem ) |
727 |
{ |
{ |
728 |
qsamplerDevice *pDevice = m_audioDevices.at(iAudioItem); |
qsamplerDevice *pDevice = NULL; |
729 |
|
if (iAudioItem >= 0 && iAudioItem < m_audioDevices.count()) |
730 |
|
pDevice = m_audioDevices.at(iAudioItem); |
731 |
if (pDevice) { |
if (pDevice) { |
732 |
// Refresh the audio routing table. |
// Refresh the audio routing table. |
733 |
routingModel.refresh(pDevice, m_pChannel->audioRouting()); |
m_routingModel.refresh(pDevice, m_pChannel->audioRouting()); |
734 |
// Reset routing change map. |
// Reset routing change map. |
735 |
m_audioRouting.clear(); |
m_routingModel.clear(); |
736 |
} |
} |
737 |
} |
} |
738 |
|
|
751 |
// Audio device options. |
// Audio device options. |
752 |
void ChannelForm::setupAudioDevice (void) |
void ChannelForm::setupAudioDevice (void) |
753 |
{ |
{ |
754 |
setupDevice(m_audioDevices.at(ui.AudioDeviceComboBox->currentItem()), |
qsamplerDevice *pDevice = NULL; |
755 |
qsamplerDevice::Audio, ui.AudioDriverComboBox->currentText()); |
int iAudioItem = m_ui.AudioDeviceComboBox->currentIndex(); |
756 |
|
if (iAudioItem >= 0 && iAudioItem < m_audioDevices.count()) |
757 |
|
pDevice = m_audioDevices.at(iAudioItem); |
758 |
|
setupDevice(pDevice, |
759 |
|
qsamplerDevice::Audio, m_ui.AudioDriverComboBox->currentText()); |
760 |
} |
} |
761 |
|
|
|
|
|
|
// Audio routing change slot. |
|
|
void ChannelForm::changeAudioRouting ( int iRow, int iCol ) |
|
|
{ |
|
|
#if 0 |
|
|
if (m_iDirtySetup > 0) |
|
|
return; |
|
|
if (iRow < 0 || iCol < 0) |
|
|
return; |
|
|
|
|
|
// Verify that this is a QComboTableItem (magic rtti == 1) |
|
|
QTableItem *pItem = ui.AudioRoutingTable->item(iRow, iCol); |
|
|
if (pItem == NULL) |
|
|
return; |
|
|
qsamplerChannelRoutingComboBox *pComboItem = |
|
|
static_cast<qsamplerChannelRoutingComboBox*> (pItem); |
|
|
// FIXME: Its not garanteed that we must have |
|
|
// iAudioOut == iRow on all times forth! |
|
|
m_audioRouting[iRow] = pComboItem->currentItem(); |
|
|
|
|
|
// And let's get dirty... |
|
|
optionsChanged(); |
|
|
#endif |
|
|
} |
|
|
|
|
|
|
|
762 |
// UPdate all device lists slot. |
// UPdate all device lists slot. |
763 |
void ChannelForm::updateDevices (void) |
void ChannelForm::updateDevices (void) |
764 |
{ |
{ |
765 |
if (m_iDirtySetup > 0) |
if (m_iDirtySetup > 0) |
766 |
return; |
return; |
767 |
|
|
768 |
selectMidiDriverItem(ui.MidiDriverComboBox->currentText()); |
selectMidiDriverItem(m_ui.MidiDriverComboBox->currentText()); |
769 |
selectAudioDriverItem(ui.AudioDriverComboBox->currentText()); |
selectAudioDriverItem(m_ui.AudioDriverComboBox->currentText()); |
770 |
optionsChanged(); |
optionsChanged(); |
771 |
} |
} |
772 |
|
|
785 |
// Stabilize current form state. |
// Stabilize current form state. |
786 |
void ChannelForm::stabilizeForm (void) |
void ChannelForm::stabilizeForm (void) |
787 |
{ |
{ |
788 |
bool bValid = true; |
const bool bValid = |
789 |
|
m_ui.EngineNameComboBox->currentIndex() >= 0 && |
790 |
|
m_ui.EngineNameComboBox->currentText() |
791 |
|
!= qsamplerChannel::noEngineName(); |
792 |
#if 0 |
#if 0 |
793 |
const QString& sPath = InstrumentFileComboBox->currentText(); |
const QString& sPath = InstrumentFileComboBox->currentText(); |
794 |
bValid = bValid && !sPath.isEmpty() && QFileInfo(sPath).exists(); |
bValid = bValid && !sPath.isEmpty() && QFileInfo(sPath).exists(); |
795 |
#endif |
#endif |
796 |
ui.OkPushButton->setEnabled(m_iDirtyCount > 0 && bValid); |
m_ui.OkPushButton->setEnabled(m_iDirtyCount > 0 && bValid); |
797 |
|
} |
798 |
|
|
799 |
|
|
800 |
|
void ChannelForm::updateTableCellRenderers (void) |
801 |
|
{ |
802 |
|
const int rows = m_routingModel.rowCount(); |
803 |
|
const int cols = m_routingModel.columnCount(); |
804 |
|
updateTableCellRenderers( |
805 |
|
m_routingModel.index(0, 0), |
806 |
|
m_routingModel.index(rows - 1, cols - 1)); |
807 |
} |
} |
808 |
|
|
809 |
|
|
810 |
|
void ChannelForm::updateTableCellRenderers ( |
811 |
|
const QModelIndex& topLeft, const QModelIndex& bottomRight ) |
812 |
|
{ |
813 |
|
for (int r = topLeft.row(); r <= bottomRight.row(); r++) { |
814 |
|
for (int c = topLeft.column(); c <= bottomRight.column(); c++) { |
815 |
|
const QModelIndex index = m_routingModel.index(r, c); |
816 |
|
m_ui.AudioRoutingTable->openPersistentEditor(index); |
817 |
|
} |
818 |
|
} |
819 |
|
} |
820 |
|
|
821 |
} // namespace QSampler |
} // namespace QSampler |
822 |
|
|
823 |
|
|