2 |
// |
// |
3 |
// ui.h extension file, included from the uic-generated form implementation. |
// ui.h extension file, included from the uic-generated form implementation. |
4 |
/**************************************************************************** |
/**************************************************************************** |
5 |
Copyright (C) 2004, rncbc aka Rui Nuno Capela. All rights reserved. |
Copyright (C) 2004-2005, rncbc aka Rui Nuno Capela. All rights reserved. |
6 |
|
|
7 |
This program is free software; you can redistribute it and/or |
This program is free software; you can redistribute it and/or |
8 |
modify it under the terms of the GNU General Public License |
modify it under the terms of the GNU General Public License |
26 |
#include <qfileinfo.h> |
#include <qfileinfo.h> |
27 |
#include <qlistbox.h> |
#include <qlistbox.h> |
28 |
|
|
29 |
|
#include "qsamplerDevice.h" |
30 |
|
|
31 |
#include "config.h" |
#include "config.h" |
32 |
|
|
33 |
|
|
90 |
else m_pChannel->appendMessagesClient("lscp_get_available_engines"); |
else m_pChannel->appendMessagesClient("lscp_get_available_engines"); |
91 |
|
|
92 |
// Populate Audio output type list. |
// Populate Audio output type list. |
93 |
const char **ppszAudioDrivers = ::lscp_get_available_audio_drivers(m_pChannel->client()); |
AudioDriverComboBox->clear(); |
94 |
if (ppszAudioDrivers) { |
AudioDriverComboBox->insertStringList( |
95 |
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"); |
|
96 |
|
|
97 |
// Populate MIDI input type list. |
// Populate MIDI input type list. |
98 |
const char **ppszMidiDrivers = ::lscp_get_available_midi_drivers(m_pChannel->client()); |
MidiDriverComboBox->clear(); |
99 |
if (ppszMidiDrivers) { |
MidiDriverComboBox->insertStringList( |
100 |
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"); |
|
101 |
|
|
102 |
// Read proper channel information, |
// Read proper channel information, |
103 |
// and populate the channel form fields. |
// and populate the channel form fields. |
104 |
|
|
105 |
// Engine name... |
// Engine name... |
106 |
QString sEngineName = pChannel->engineName(); |
QString sEngineName = pChannel->engineName(); |
107 |
if (sEngineName.isEmpty() && bNew) |
if (sEngineName.isEmpty() || bNew) |
108 |
sEngineName = pOptions->sEngineName; |
sEngineName = pOptions->sEngineName; |
109 |
if (sEngineName.isEmpty()) |
if (sEngineName.isEmpty()) |
110 |
sEngineName = tr("(No engine)"); |
sEngineName = qsamplerChannel::noEngineName(); |
111 |
if (EngineNameComboBox->listBox()->findItem(sEngineName, Qt::ExactMatch) == NULL) |
if (EngineNameComboBox->listBox()->findItem(sEngineName, Qt::ExactMatch) == NULL) |
112 |
EngineNameComboBox->insertItem(sEngineName); |
EngineNameComboBox->insertItem(sEngineName); |
113 |
EngineNameComboBox->setCurrentText(sEngineName); |
EngineNameComboBox->setCurrentText(sEngineName); |
114 |
// Instrument filename and index... |
// Instrument filename and index... |
115 |
QString sInstrumentFile = pChannel->instrumentFile(); |
QString sInstrumentFile = pChannel->instrumentFile(); |
116 |
if (sInstrumentFile.isEmpty()) |
if (sInstrumentFile.isEmpty()) |
117 |
sInstrumentFile = tr("(No instrument)"); |
sInstrumentFile = qsamplerChannel::noInstrumentName(); |
118 |
InstrumentFileComboBox->setCurrentText(sInstrumentFile); |
InstrumentFileComboBox->setCurrentText(sInstrumentFile); |
119 |
InstrumentNrSpinBox->setValue(pChannel->instrumentNr()); |
InstrumentNrComboBox->clear(); |
120 |
|
InstrumentNrComboBox->insertStringList( |
121 |
|
qsamplerChannel::getInstrumentList(sInstrumentFile, |
122 |
|
pOptions->bInstrumentNames)); |
123 |
|
InstrumentNrComboBox->setCurrentItem(pChannel->instrumentNr()); |
124 |
// MIDI input driver... |
// MIDI input driver... |
125 |
QString sMidiDriver = pChannel->midiDriver(); |
QString sMidiDriver = pChannel->midiDriver(); |
126 |
if (sMidiDriver.isEmpty() || bNew) |
if (sMidiDriver.isEmpty() || bNew) |
147 |
AudioDriverComboBox->insertItem(sAudioDriver); |
AudioDriverComboBox->insertItem(sAudioDriver); |
148 |
AudioDriverComboBox->setCurrentText(sAudioDriver); |
AudioDriverComboBox->setCurrentText(sAudioDriver); |
149 |
} |
} |
150 |
|
// As convenient, make it ready on stabilizeForm() for |
151 |
|
// prompt acceptance, if we got the minimum required... |
152 |
|
if (sEngineName != qsamplerChannel::noEngineName() && |
153 |
|
sInstrumentFile != qsamplerChannel::noInstrumentName()) |
154 |
|
m_iDirtyCount++; |
155 |
|
// FIXME: These are better leave diabled... |
156 |
|
MidiPortTextLabel->setEnabled(false); |
157 |
|
MidiPortSpinBox->setEnabled(false); |
158 |
// Done. |
// Done. |
159 |
m_iDirtySetup--; |
m_iDirtySetup--; |
160 |
stabilizeForm(); |
stabilizeForm(); |
193 |
if (!m_pChannel->loadEngine(EngineNameComboBox->currentText())) |
if (!m_pChannel->loadEngine(EngineNameComboBox->currentText())) |
194 |
iErrors++; |
iErrors++; |
195 |
// Instrument file and index... |
// Instrument file and index... |
196 |
if (!m_pChannel->loadInstrument(InstrumentFileComboBox->currentText(), InstrumentNrSpinBox->value())) |
if (!m_pChannel->loadInstrument(InstrumentFileComboBox->currentText(), InstrumentNrComboBox->currentItem())) |
197 |
iErrors++; |
iErrors++; |
198 |
// Show error messages? |
// Show error messages? |
199 |
if (iErrors > 0) |
if (iErrors > 0) |
264 |
// Refresh the actual instrument name. |
// Refresh the actual instrument name. |
265 |
void qsamplerChannelForm::updateInstrumentName (void) |
void qsamplerChannelForm::updateInstrumentName (void) |
266 |
{ |
{ |
267 |
// FIXME: A better idea would be to use libgig |
qsamplerOptions *pOptions = m_pChannel->options(); |
268 |
// to retrieve the REAL instrument name. |
if (pOptions == NULL) |
269 |
InstrumentNameTextLabel->setText(QFileInfo(InstrumentFileComboBox->currentText()).fileName() |
return; |
270 |
+ " [" + QString::number(InstrumentNrSpinBox->value()) + "]"); |
|
271 |
|
// Finally this better idea would be to use libgig |
272 |
|
// to retrieve the REAL instrument names. |
273 |
|
InstrumentNrComboBox->clear(); |
274 |
|
InstrumentNrComboBox->insertStringList( |
275 |
|
qsamplerChannel::getInstrumentList( |
276 |
|
InstrumentFileComboBox->currentText(), |
277 |
|
pOptions->bInstrumentNames) |
278 |
|
); |
279 |
|
|
280 |
optionsChanged(); |
optionsChanged(); |
281 |
} |
} |