35 |
|
|
36 |
namespace QSampler { |
namespace QSampler { |
37 |
|
|
38 |
ChannelStrip::ChannelStrip(QWidget* parent, Qt::WFlags f) : QWidget(parent, f) { |
ChannelStrip::ChannelStrip ( QWidget* pParent, Qt::WindowFlags wflags ) |
39 |
ui.setupUi(this); |
: QWidget(pParent, wflags) |
40 |
|
{ |
41 |
|
m_ui.setupUi(this); |
42 |
|
|
43 |
// Initialize locals. |
// Initialize locals. |
44 |
m_pChannel = NULL; |
m_pChannel = NULL; |
48 |
// Try to restore normal window positioning. |
// Try to restore normal window positioning. |
49 |
adjustSize(); |
adjustSize(); |
50 |
|
|
51 |
QObject::connect(ui.ChannelSetupPushButton, |
QObject::connect(m_ui.ChannelSetupPushButton, |
52 |
SIGNAL(clicked()), |
SIGNAL(clicked()), |
53 |
SLOT(channelSetup())); |
SLOT(channelSetup())); |
54 |
QObject::connect(ui.ChannelMutePushButton, |
QObject::connect(m_ui.ChannelMutePushButton, |
55 |
SIGNAL(toggled(bool)), |
SIGNAL(toggled(bool)), |
56 |
SLOT(channelMute(bool))); |
SLOT(channelMute(bool))); |
57 |
QObject::connect(ui.ChannelSoloPushButton, |
QObject::connect(m_ui.ChannelSoloPushButton, |
58 |
SIGNAL(toggled(bool)), |
SIGNAL(toggled(bool)), |
59 |
SLOT(channelSolo(bool))); |
SLOT(channelSolo(bool))); |
60 |
QObject::connect(ui.VolumeSlider, |
QObject::connect(m_ui.VolumeSlider, |
61 |
SIGNAL(valueChanged(int)), |
SIGNAL(valueChanged(int)), |
62 |
SLOT(volumeChanged(int))); |
SLOT(volumeChanged(int))); |
63 |
QObject::connect(ui.VolumeSpinBox, |
QObject::connect(m_ui.VolumeSpinBox, |
64 |
SIGNAL(valueChanged(int)), |
SIGNAL(valueChanged(int)), |
65 |
SLOT(volumeChanged(int))); |
SLOT(volumeChanged(int))); |
66 |
QObject::connect(ui.ChannelEditPushButton, |
QObject::connect(m_ui.ChannelEditPushButton, |
67 |
SIGNAL(clicked()), |
SIGNAL(clicked()), |
68 |
SLOT(channelEdit())); |
SLOT(channelEdit())); |
69 |
} |
} |
151 |
} |
} |
152 |
|
|
153 |
// Channel secriptor accessor. |
// Channel secriptor accessor. |
154 |
qsamplerChannel *ChannelStrip::channel (void) |
qsamplerChannel *ChannelStrip::channel (void) const |
155 |
{ |
{ |
156 |
return m_pChannel; |
return m_pChannel; |
157 |
} |
} |
158 |
|
|
159 |
|
|
160 |
// Messages view font accessors. |
// Messages view font accessors. |
161 |
QFont ChannelStrip::displayFont (void) |
QFont ChannelStrip::displayFont (void) const |
162 |
{ |
{ |
163 |
return ui.EngineNameTextLabel->font(); |
return m_ui.EngineNameTextLabel->font(); |
164 |
} |
} |
165 |
|
|
166 |
void ChannelStrip::setDisplayFont ( const QFont & font ) |
void ChannelStrip::setDisplayFont ( const QFont & font ) |
167 |
{ |
{ |
168 |
ui.EngineNameTextLabel->setFont(font); |
m_ui.EngineNameTextLabel->setFont(font); |
169 |
ui.MidiPortChannelTextLabel->setFont(font); |
m_ui.MidiPortChannelTextLabel->setFont(font); |
170 |
ui.InstrumentNameTextLabel->setFont(font); |
m_ui.InstrumentNameTextLabel->setFont(font); |
171 |
ui.InstrumentStatusTextLabel->setFont(font); |
m_ui.InstrumentStatusTextLabel->setFont(font); |
172 |
} |
} |
173 |
|
|
174 |
|
|
177 |
{ |
{ |
178 |
QPalette pal; |
QPalette pal; |
179 |
pal.setColor(QPalette::Foreground, Qt::yellow); |
pal.setColor(QPalette::Foreground, Qt::yellow); |
180 |
ui.EngineNameTextLabel->setPalette(pal); |
m_ui.EngineNameTextLabel->setPalette(pal); |
181 |
ui.MidiPortChannelTextLabel->setPalette(pal); |
m_ui.MidiPortChannelTextLabel->setPalette(pal); |
182 |
pal.setColor(QPalette::Foreground, Qt::green); |
pal.setColor(QPalette::Foreground, Qt::green); |
183 |
if (bDisplayEffect) { |
if (bDisplayEffect) { |
184 |
QPixmap pm(":/icons/displaybg1.png"); |
QPixmap pm(":/icons/displaybg1.png"); |
186 |
} else { |
} else { |
187 |
pal.setColor(QPalette::Background, Qt::black); |
pal.setColor(QPalette::Background, Qt::black); |
188 |
} |
} |
189 |
ui.ChannelInfoFrame->setPalette(pal); |
m_ui.ChannelInfoFrame->setPalette(pal); |
190 |
ui.StreamVoiceCountTextLabel->setPalette(pal); |
m_ui.StreamVoiceCountTextLabel->setPalette(pal); |
191 |
} |
} |
192 |
|
|
193 |
|
|
195 |
void ChannelStrip::setMaxVolume ( int iMaxVolume ) |
void ChannelStrip::setMaxVolume ( int iMaxVolume ) |
196 |
{ |
{ |
197 |
m_iDirtyChange++; |
m_iDirtyChange++; |
198 |
ui.VolumeSlider->setRange(0, iMaxVolume); |
m_ui.VolumeSlider->setRange(0, iMaxVolume); |
199 |
ui.VolumeSpinBox->setRange(0, iMaxVolume); |
m_ui.VolumeSpinBox->setRange(0, iMaxVolume); |
200 |
m_iDirtyChange--; |
m_iDirtyChange--; |
201 |
} |
} |
202 |
|
|
288 |
// Instrument name... |
// Instrument name... |
289 |
if (m_pChannel->instrumentName().isEmpty()) { |
if (m_pChannel->instrumentName().isEmpty()) { |
290 |
if (m_pChannel->instrumentStatus() >= 0) |
if (m_pChannel->instrumentStatus() >= 0) |
291 |
ui.InstrumentNameTextLabel->setText(' ' + qsamplerChannel::loadingInstrument()); |
m_ui.InstrumentNameTextLabel->setText(' ' + qsamplerChannel::loadingInstrument()); |
292 |
else |
else |
293 |
ui.InstrumentNameTextLabel->setText(' ' + qsamplerChannel::noInstrumentName()); |
m_ui.InstrumentNameTextLabel->setText(' ' + qsamplerChannel::noInstrumentName()); |
294 |
} else |
} else |
295 |
ui.InstrumentNameTextLabel->setText(' ' + m_pChannel->instrumentName()); |
m_ui.InstrumentNameTextLabel->setText(' ' + m_pChannel->instrumentName()); |
296 |
|
|
297 |
return true; |
return true; |
298 |
} |
} |
324 |
|
|
325 |
// Flag it here, to avoid infinite recursion. |
// Flag it here, to avoid infinite recursion. |
326 |
m_iDirtyChange++; |
m_iDirtyChange++; |
327 |
ui.VolumeSlider->setValue(iVolume); |
m_ui.VolumeSlider->setValue(iVolume); |
328 |
ui.VolumeSpinBox->setValue(iVolume); |
m_ui.VolumeSpinBox->setValue(iVolume); |
329 |
m_iDirtyChange--; |
m_iDirtyChange--; |
330 |
|
|
331 |
return true; |
return true; |
345 |
// Update strip caption. |
// Update strip caption. |
346 |
QString sText = m_pChannel->channelName(); |
QString sText = m_pChannel->channelName(); |
347 |
setWindowTitle(sText); |
setWindowTitle(sText); |
348 |
ui.ChannelSetupPushButton->setText(sText); |
m_ui.ChannelSetupPushButton->setText(sText); |
349 |
|
|
350 |
// Check if we're up and connected. |
// Check if we're up and connected. |
351 |
MainForm* pMainForm = MainForm::getInstance(); |
MainForm* pMainForm = MainForm::getInstance(); |
357 |
|
|
358 |
// Engine name... |
// Engine name... |
359 |
if (m_pChannel->engineName().isEmpty()) |
if (m_pChannel->engineName().isEmpty()) |
360 |
ui.EngineNameTextLabel->setText(' ' + qsamplerChannel::noEngineName()); |
m_ui.EngineNameTextLabel->setText(' ' + qsamplerChannel::noEngineName()); |
361 |
else |
else |
362 |
ui.EngineNameTextLabel->setText(' ' + m_pChannel->engineName()); |
m_ui.EngineNameTextLabel->setText(' ' + m_pChannel->engineName()); |
363 |
|
|
364 |
// Instrument name... |
// Instrument name... |
365 |
updateInstrumentName(false); |
updateInstrumentName(false); |
370 |
sMidiPortChannel += tr("All"); |
sMidiPortChannel += tr("All"); |
371 |
else |
else |
372 |
sMidiPortChannel += QString::number(m_pChannel->midiChannel() + 1); |
sMidiPortChannel += QString::number(m_pChannel->midiChannel() + 1); |
373 |
ui.MidiPortChannelTextLabel->setText(sMidiPortChannel); |
m_ui.MidiPortChannelTextLabel->setText(sMidiPortChannel); |
374 |
|
|
375 |
// Common palette... |
// Common palette... |
376 |
QPalette pal; |
QPalette pal; |
380 |
int iInstrumentStatus = m_pChannel->instrumentStatus(); |
int iInstrumentStatus = m_pChannel->instrumentStatus(); |
381 |
if (iInstrumentStatus < 0) { |
if (iInstrumentStatus < 0) { |
382 |
pal.setColor(QPalette::Foreground, Qt::red); |
pal.setColor(QPalette::Foreground, Qt::red); |
383 |
ui.InstrumentStatusTextLabel->setPalette(pal); |
m_ui.InstrumentStatusTextLabel->setPalette(pal); |
384 |
ui.InstrumentStatusTextLabel->setText(tr("ERR%1").arg(iInstrumentStatus)); |
m_ui.InstrumentStatusTextLabel->setText(tr("ERR%1").arg(iInstrumentStatus)); |
385 |
m_iErrorCount++; |
m_iErrorCount++; |
386 |
return false; |
return false; |
387 |
} |
} |
388 |
// All seems normal... |
// All seems normal... |
389 |
pal.setColor(QPalette::Foreground, |
pal.setColor(QPalette::Foreground, |
390 |
iInstrumentStatus < 100 ? Qt::yellow : Qt::green); |
iInstrumentStatus < 100 ? Qt::yellow : Qt::green); |
391 |
ui.InstrumentStatusTextLabel->setPalette(pal); |
m_ui.InstrumentStatusTextLabel->setPalette(pal); |
392 |
ui.InstrumentStatusTextLabel->setText(QString::number(iInstrumentStatus) + '%'); |
m_ui.InstrumentStatusTextLabel->setText(QString::number(iInstrumentStatus) + '%'); |
393 |
m_iErrorCount = 0; |
m_iErrorCount = 0; |
394 |
|
|
395 |
#ifdef CONFIG_MUTE_SOLO |
#ifdef CONFIG_MUTE_SOLO |
398 |
const QColor& rgbButton = pal.color(QPalette::Button); |
const QColor& rgbButton = pal.color(QPalette::Button); |
399 |
pal.setColor(QPalette::Foreground, rgbFore); |
pal.setColor(QPalette::Foreground, rgbFore); |
400 |
pal.setColor(QPalette::Button, bMute ? Qt::yellow : rgbButton); |
pal.setColor(QPalette::Button, bMute ? Qt::yellow : rgbButton); |
401 |
ui.ChannelMutePushButton->setPalette(pal); |
m_ui.ChannelMutePushButton->setPalette(pal); |
402 |
ui.ChannelMutePushButton->setDown(bMute); |
m_ui.ChannelMutePushButton->setDown(bMute); |
403 |
bool bSolo = m_pChannel->channelSolo(); |
bool bSolo = m_pChannel->channelSolo(); |
404 |
pal.setColor(QPalette::Button, bSolo ? Qt::cyan : rgbButton); |
pal.setColor(QPalette::Button, bSolo ? Qt::cyan : rgbButton); |
405 |
ui.ChannelSoloPushButton->setPalette(pal); |
m_ui.ChannelSoloPushButton->setPalette(pal); |
406 |
ui.ChannelSoloPushButton->setDown(bSolo); |
m_ui.ChannelSoloPushButton->setDown(bSolo); |
407 |
#else |
#else |
408 |
ui.ChannelMutePushButton->setEnabled(false); |
m_ui.ChannelMutePushButton->setEnabled(false); |
409 |
ui.ChannelSoloPushButton->setEnabled(false); |
m_ui.ChannelSoloPushButton->setEnabled(false); |
410 |
#endif |
#endif |
411 |
|
|
412 |
// And update the both GUI volume elements; |
// And update the both GUI volume elements; |
439 |
int iStreamUsage = ::lscp_get_channel_stream_usage(pMainForm->client(), m_pChannel->channelID());; |
int iStreamUsage = ::lscp_get_channel_stream_usage(pMainForm->client(), m_pChannel->channelID());; |
440 |
|
|
441 |
// Update the GUI elements... |
// Update the GUI elements... |
442 |
ui.StreamUsageProgressBar->setValue(iStreamUsage); |
m_ui.StreamUsageProgressBar->setValue(iStreamUsage); |
443 |
ui.StreamVoiceCountTextLabel->setText(QString("%1 / %2").arg(iStreamCount).arg(iVoiceCount)); |
m_ui.StreamVoiceCountTextLabel->setText(QString("%1 / %2").arg(iStreamCount).arg(iVoiceCount)); |
444 |
|
|
445 |
// We're clean. |
// We're clean. |
446 |
return true; |
return true; |