50 |
|
|
51 |
|
|
52 |
// Channel dialog setup formal initializer. |
// Channel dialog setup formal initializer. |
53 |
void qsamplerChannelForm::setup ( qsamplerChannel *pChannel, bool bNew ) |
void qsamplerChannelForm::setup ( qsamplerChannel *pChannel ) |
54 |
{ |
{ |
55 |
m_pChannel = pChannel; |
m_pChannel = pChannel; |
56 |
|
|
60 |
if (m_pChannel == NULL) |
if (m_pChannel == NULL) |
61 |
return; |
return; |
62 |
|
|
63 |
setCaption(tr("Channel %1").arg(m_pChannel->channelID())); |
// It can be a brand new channel, remember? |
64 |
|
bool bNew = (m_pChannel->channelID() < 0); |
65 |
|
setCaption(m_pChannel->channelName()); |
66 |
|
|
67 |
// Check if we're up and connected. |
// Check if we're up and connected. |
68 |
if (m_pChannel->client() == NULL) |
if (m_pChannel->client() == NULL) |
125 |
InstrumentNrSpinBox->setValue(pChannel->instrumentNr()); |
InstrumentNrSpinBox->setValue(pChannel->instrumentNr()); |
126 |
// MIDI input driver... |
// MIDI input driver... |
127 |
QString sMidiDriver = pChannel->midiDriver(); |
QString sMidiDriver = pChannel->midiDriver(); |
128 |
if (sMidiDriver.isEmpty() && bNew) |
if (sMidiDriver.isEmpty() || bNew) |
129 |
sMidiDriver = pOptions->sMidiDriver; |
sMidiDriver = pOptions->sMidiDriver; |
130 |
if (!sMidiDriver.isEmpty()) { |
if (!sMidiDriver.isEmpty()) { |
131 |
if (MidiDriverComboBox->listBox()->findItem(sMidiDriver, Qt::ExactMatch) == NULL) |
if (MidiDriverComboBox->listBox()->findItem(sMidiDriver, Qt::ExactMatch) == NULL) |
136 |
MidiPortSpinBox->setValue(pChannel->midiPort()); |
MidiPortSpinBox->setValue(pChannel->midiPort()); |
137 |
// MIDI input channel... |
// MIDI input channel... |
138 |
int iMidiChannel = pChannel->midiChannel(); |
int iMidiChannel = pChannel->midiChannel(); |
139 |
if (bNew) |
// When new, try to suggest a sensible MIDI channel... |
140 |
iMidiChannel = (pChannel->channelID() % 16); |
if (iMidiChannel < 0) |
141 |
|
iMidiChannel = (::lscp_get_channels(m_pChannel->client()) % 16); |
142 |
MidiChannelComboBox->setCurrentItem(iMidiChannel); |
MidiChannelComboBox->setCurrentItem(iMidiChannel); |
143 |
// Audio output driver... |
// Audio output driver... |
144 |
QString sAudioDriver = pChannel->audioDriver(); |
QString sAudioDriver = pChannel->audioDriver(); |
145 |
if (sAudioDriver.isEmpty() && bNew) |
if (sAudioDriver.isEmpty() || bNew) |
146 |
sAudioDriver = pOptions->sAudioDriver; |
sAudioDriver = pOptions->sAudioDriver; |
147 |
if (!sAudioDriver.isEmpty()) { |
if (!sAudioDriver.isEmpty()) { |
148 |
if (AudioDriverComboBox->listBox()->findItem(sAudioDriver, Qt::ExactMatch) == NULL) |
if (AudioDriverComboBox->listBox()->findItem(sAudioDriver, Qt::ExactMatch) == NULL) |
168 |
// We'll go for it! |
// We'll go for it! |
169 |
if (m_iDirtyCount > 0) { |
if (m_iDirtyCount > 0) { |
170 |
int iErrors = 0; |
int iErrors = 0; |
171 |
|
// Are we a new channel? |
172 |
|
if (!m_pChannel->addChannel()) |
173 |
|
iErrors++; |
174 |
// Audio output driver type... |
// Audio output driver type... |
175 |
if (!m_pChannel->setAudioDriver(AudioDriverComboBox->currentText())) |
if (!m_pChannel->setAudioDriver(AudioDriverComboBox->currentText())) |
176 |
iErrors++; |
iErrors++; |