38 |
m_iDirtySetup = 0; |
m_iDirtySetup = 0; |
39 |
m_iDirtyCount = 0; |
m_iDirtyCount = 0; |
40 |
|
|
41 |
|
m_midiDevices.setAutoDelete(true); |
42 |
|
m_audioDevices.setAutoDelete(true); |
43 |
|
|
44 |
// Try to restore normal window positioning. |
// Try to restore normal window positioning. |
45 |
adjustSize(); |
adjustSize(); |
46 |
} |
} |
91 |
else m_pChannel->appendMessagesClient("lscp_get_available_engines"); |
else m_pChannel->appendMessagesClient("lscp_get_available_engines"); |
92 |
|
|
93 |
// Populate Audio output type list. |
// Populate Audio output type list. |
94 |
const char **ppszAudioDrivers = ::lscp_get_available_audio_drivers(m_pChannel->client()); |
AudioDriverComboBox->clear(); |
95 |
if (ppszAudioDrivers) { |
AudioDriverComboBox->insertStringList( |
96 |
AudioDriverComboBox->clear(); |
qsamplerDevice::getDrivers(m_pChannel->client(), qsamplerDevice::Audio)); |
|
for (int iAudioDriver = 0; ppszAudioDrivers[iAudioDriver]; iAudioDriver++) |
|
|
AudioDriverComboBox->insertItem(ppszAudioDrivers[iAudioDriver]); |
|
|
} |
|
|
else m_pChannel->appendMessagesClient("lscp_get_available_audio_drivers"); |
|
97 |
|
|
98 |
// Populate MIDI input type list. |
// Populate MIDI input type list. |
99 |
const char **ppszMidiDrivers = ::lscp_get_available_midi_drivers(m_pChannel->client()); |
MidiDriverComboBox->clear(); |
100 |
if (ppszMidiDrivers) { |
MidiDriverComboBox->insertStringList( |
101 |
MidiDriverComboBox->clear(); |
qsamplerDevice::getDrivers(m_pChannel->client(), qsamplerDevice::Midi)); |
|
for (int iMidiDriver = 0; ppszMidiDrivers[iMidiDriver]; iMidiDriver++) |
|
|
MidiDriverComboBox->insertItem(ppszMidiDrivers[iMidiDriver]); |
|
|
} |
|
|
else m_pChannel->appendMessagesClient("lscp_get_available_midi_drivers"); |
|
102 |
|
|
103 |
// Read proper channel information, |
// Read proper channel information, |
104 |
// and populate the channel form fields. |
// and populate the channel form fields. |
122 |
qsamplerChannel::getInstrumentList(sInstrumentFile, |
qsamplerChannel::getInstrumentList(sInstrumentFile, |
123 |
pOptions->bInstrumentNames)); |
pOptions->bInstrumentNames)); |
124 |
InstrumentNrComboBox->setCurrentItem(pChannel->instrumentNr()); |
InstrumentNrComboBox->setCurrentItem(pChannel->instrumentNr()); |
125 |
|
|
126 |
|
// MIDI input device... |
127 |
|
qsamplerDevice midiDevice(m_pChannel->client(), |
128 |
|
qsamplerDevice::Midi, m_pChannel->midiDevice()); |
129 |
// MIDI input driver... |
// MIDI input driver... |
130 |
QString sMidiDriver = pChannel->midiDriver(); |
QString sMidiDriver = midiDevice.driverName(); |
131 |
if (sMidiDriver.isEmpty() || bNew) |
if (sMidiDriver.isEmpty() || bNew) |
132 |
sMidiDriver = pOptions->sMidiDriver; |
sMidiDriver = pOptions->sMidiDriver; |
133 |
if (!sMidiDriver.isEmpty()) { |
if (!sMidiDriver.isEmpty()) { |
134 |
if (MidiDriverComboBox->listBox()->findItem(sMidiDriver, Qt::ExactMatch) == NULL) |
if (MidiDriverComboBox->listBox()->findItem(sMidiDriver, Qt::ExactMatch) == NULL) |
135 |
MidiDriverComboBox->insertItem(sMidiDriver); |
MidiDriverComboBox->insertItem(sMidiDriver); |
136 |
MidiDriverComboBox->setCurrentText(sMidiDriver); |
MidiDriverComboBox->setCurrentText(sMidiDriver); |
137 |
} |
} |
138 |
|
selectMidiDriver(sMidiDriver); |
139 |
|
if (!bNew) |
140 |
|
MidiDeviceComboBox->setCurrentText(midiDevice.deviceName()); |
141 |
// MIDI input port... |
// MIDI input port... |
142 |
MidiPortSpinBox->setValue(pChannel->midiPort()); |
MidiPortSpinBox->setValue(pChannel->midiPort()); |
143 |
// MIDI input channel... |
// MIDI input channel... |
146 |
if (iMidiChannel < 0) |
if (iMidiChannel < 0) |
147 |
iMidiChannel = (::lscp_get_channels(m_pChannel->client()) % 16); |
iMidiChannel = (::lscp_get_channels(m_pChannel->client()) % 16); |
148 |
MidiChannelComboBox->setCurrentItem(iMidiChannel); |
MidiChannelComboBox->setCurrentItem(iMidiChannel); |
149 |
// Audio output driver... |
|
150 |
QString sAudioDriver = pChannel->audioDriver(); |
// Audio output device... |
151 |
if (sAudioDriver.isEmpty() || bNew) |
qsamplerDevice audioDevice(m_pChannel->client(), |
152 |
sAudioDriver = pOptions->sAudioDriver; |
qsamplerDevice::Audio, m_pChannel->audioDevice()); |
153 |
if (!sAudioDriver.isEmpty()) { |
// Audio output driver... |
154 |
if (AudioDriverComboBox->listBox()->findItem(sAudioDriver, Qt::ExactMatch) == NULL) |
QString sAudioDriver = audioDevice.driverName(); |
155 |
AudioDriverComboBox->insertItem(sAudioDriver); |
if (sAudioDriver.isEmpty() || bNew) |
156 |
AudioDriverComboBox->setCurrentText(sAudioDriver); |
sAudioDriver = pOptions->sAudioDriver; |
157 |
} |
if (!sAudioDriver.isEmpty()) { |
158 |
|
if (AudioDriverComboBox->listBox()->findItem(sAudioDriver, Qt::ExactMatch) == NULL) |
159 |
|
AudioDriverComboBox->insertItem(sAudioDriver); |
160 |
|
AudioDriverComboBox->setCurrentText(sAudioDriver); |
161 |
|
} |
162 |
|
selectAudioDriver(sAudioDriver); |
163 |
|
if (!bNew) |
164 |
|
AudioDeviceComboBox->setCurrentText(audioDevice.deviceName()); |
165 |
|
|
166 |
// As convenient, make it ready on stabilizeForm() for |
// As convenient, make it ready on stabilizeForm() for |
167 |
// prompt acceptance, if we got the minimum required... |
// prompt acceptance, if we got the minimum required... |
168 |
if (sEngineName != qsamplerChannel::noEngineName() && |
if (sEngineName != qsamplerChannel::noEngineName() && |
193 |
// Are we a new channel? |
// Are we a new channel? |
194 |
if (!m_pChannel->addChannel()) |
if (!m_pChannel->addChannel()) |
195 |
iErrors++; |
iErrors++; |
196 |
// Audio output driver type... |
// Accept Audio driver or device selection... |
197 |
if (!m_pChannel->setAudioDriver(AudioDriverComboBox->currentText())) |
if (m_audioDevices.isEmpty()) { |
198 |
iErrors++; |
if (!m_pChannel->setAudioDriver(AudioDriverComboBox->currentText())) |
199 |
// MIDI input driver type... |
iErrors++; |
200 |
if (!m_pChannel->setMidiDriver(MidiDriverComboBox->currentText())) |
} else { |
201 |
iErrors++; |
qsamplerDevice *pDevice = m_audioDevices.at(AudioDeviceComboBox->currentItem()); |
202 |
|
if (pDevice == NULL) |
203 |
|
iErrors++; |
204 |
|
else if (!m_pChannel->setAudioDevice(pDevice->deviceID())) |
205 |
|
iErrors++; |
206 |
|
} |
207 |
|
// Accept MIDI driver or device selection... |
208 |
|
if (m_midiDevices.isEmpty()) { |
209 |
|
if (!m_pChannel->setMidiDriver(MidiDriverComboBox->currentText())) |
210 |
|
iErrors++; |
211 |
|
} else { |
212 |
|
qsamplerDevice *pDevice = m_midiDevices.at(MidiDeviceComboBox->currentItem()); |
213 |
|
if (pDevice == NULL) |
214 |
|
iErrors++; |
215 |
|
else if (!m_pChannel->setMidiDevice(pDevice->deviceID())) |
216 |
|
iErrors++; |
217 |
|
} |
218 |
// MIDI input port number... |
// MIDI input port number... |
219 |
if (!m_pChannel->setMidiPort(MidiPortSpinBox->value())) |
if (!m_pChannel->setMidiPort(MidiPortSpinBox->value())) |
220 |
iErrors++; |
iErrors++; |
313 |
} |
} |
314 |
|
|
315 |
|
|
316 |
|
// Refresh MIDI device options. |
317 |
|
void qsamplerChannelForm::selectMidiDriver ( const QString& sMidiDriver ) |
318 |
|
{ |
319 |
|
const QString sDriverName = sMidiDriver.upper(); |
320 |
|
|
321 |
|
MidiDeviceComboBox->clear(); |
322 |
|
m_audioDevices.clear(); |
323 |
|
|
324 |
|
const QPixmap& midiPixmap = QPixmap::fromMimeSource("midi2.png"); |
325 |
|
int *piDeviceIDs = qsamplerDevice::getDevices(m_pChannel->client(), |
326 |
|
qsamplerDevice::Midi); |
327 |
|
for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) { |
328 |
|
qsamplerDevice *pDevice = new qsamplerDevice(m_pChannel->client(), |
329 |
|
qsamplerDevice::Midi, piDeviceIDs[i]); |
330 |
|
if (pDevice->driverName().upper() == sDriverName) { |
331 |
|
MidiDeviceComboBox->insertItem(midiPixmap, pDevice->deviceName()); |
332 |
|
m_midiDevices.append(pDevice); |
333 |
|
} else { |
334 |
|
delete pDevice; |
335 |
|
} |
336 |
|
} |
337 |
|
|
338 |
|
bool bEnabled = !m_midiDevices.isEmpty(); |
339 |
|
if (!bEnabled) |
340 |
|
MidiDeviceComboBox->insertItem(tr("(New MIDI device)")); |
341 |
|
MidiDeviceTextLabel->setEnabled(bEnabled); |
342 |
|
MidiDeviceComboBox->setEnabled(bEnabled); |
343 |
|
optionsChanged(); |
344 |
|
} |
345 |
|
|
346 |
|
|
347 |
|
// Refresh Audio device options. |
348 |
|
void qsamplerChannelForm::selectAudioDriver ( const QString& sAudioDriver ) |
349 |
|
{ |
350 |
|
const QString sDriverName = sAudioDriver.upper(); |
351 |
|
|
352 |
|
AudioDeviceComboBox->clear(); |
353 |
|
m_audioDevices.clear(); |
354 |
|
|
355 |
|
const QPixmap& audioPixmap = QPixmap::fromMimeSource("audio2.png"); |
356 |
|
int *piDeviceIDs = qsamplerDevice::getDevices(m_pChannel->client(), |
357 |
|
qsamplerDevice::Audio); |
358 |
|
for (int i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; i++) { |
359 |
|
qsamplerDevice *pDevice = new qsamplerDevice(m_pChannel->client(), |
360 |
|
qsamplerDevice::Audio, piDeviceIDs[i]); |
361 |
|
if (pDevice->driverName().upper() == sDriverName) { |
362 |
|
AudioDeviceComboBox->insertItem(audioPixmap, pDevice->deviceName()); |
363 |
|
m_audioDevices.append(pDevice); |
364 |
|
} else { |
365 |
|
delete pDevice; |
366 |
|
} |
367 |
|
} |
368 |
|
|
369 |
|
bool bEnabled = !m_audioDevices.isEmpty(); |
370 |
|
if (!bEnabled) |
371 |
|
AudioDeviceComboBox->insertItem(tr("(New Audio device)")); |
372 |
|
AudioDeviceTextLabel->setEnabled(bEnabled); |
373 |
|
AudioDeviceComboBox->setEnabled(bEnabled); |
374 |
|
optionsChanged(); |
375 |
|
} |
376 |
|
|
377 |
|
|
378 |
// Dirty up settings. |
// Dirty up settings. |
379 |
void qsamplerChannelForm::optionsChanged (void) |
void qsamplerChannelForm::optionsChanged (void) |