330 |
} |
} |
331 |
|
|
332 |
// Channel setup dialog. |
// Channel setup dialog. |
333 |
void qsamplerChannelStrip::channelSetup (void) |
void qsamplerChannelStrip::channelSetup ( bool bNew ) |
334 |
{ |
{ |
335 |
qsamplerChannelForm *pChannelForm = new qsamplerChannelForm(this); |
qsamplerChannelForm *pChannelForm = new qsamplerChannelForm(this); |
336 |
if (pChannelForm) { |
if (pChannelForm) { |
337 |
pChannelForm->setup(this); |
pChannelForm->setup(this, bNew); |
338 |
if (pChannelForm->exec()) { |
if (pChannelForm->exec()) { |
339 |
updateChannelInfo(); |
updateChannelInfo(); |
340 |
emit channelChanged(this); |
emit channelChanged(this); |
380 |
} |
} |
381 |
|
|
382 |
// Set some proper display values. |
// Set some proper display values. |
383 |
|
const QString sIndent = " "; |
384 |
|
|
385 |
// Engine name... |
// Engine name... |
386 |
if (m_sEngineName.isEmpty()) |
if (m_sEngineName.isEmpty()) |
387 |
EngineNameTextLabel->setText(tr("(No engine)")); |
EngineNameTextLabel->setText(sIndent + tr("(No engine)")); |
388 |
else |
else |
389 |
EngineNameTextLabel->setText(m_sEngineName); |
EngineNameTextLabel->setText(sIndent + m_sEngineName); |
390 |
|
|
391 |
// Instrument name... |
// Instrument name... |
392 |
if (m_sInstrumentFile.isEmpty()) |
if (m_sInstrumentFile.isEmpty()) |
393 |
InstrumentNameTextLabel->setText(tr("(No instrument)")); |
InstrumentNameTextLabel->setText(sIndent + tr("(No instrument)")); |
394 |
else |
else |
395 |
InstrumentNameTextLabel->setText(QString("%1 [%2]") |
InstrumentNameTextLabel->setText(sIndent + QString("%1 [%2]") |
396 |
.arg(QFileInfo(m_sInstrumentFile).fileName()).arg(m_iInstrumentNr)); |
.arg(QFileInfo(m_sInstrumentFile).fileName()).arg(m_iInstrumentNr)); |
397 |
|
|
398 |
// Instrument status... |
// Instrument status... |
405 |
} |
} |
406 |
|
|
407 |
// MIDI Port/Channel... |
// MIDI Port/Channel... |
408 |
MidiPortChannelTextLabel->setText(QString("%1 / %2") |
if (m_iMidiChannel > 0) |
409 |
.arg(m_iMidiPort).arg(m_iMidiChannel)); |
MidiPortChannelTextLabel->setText(QString("%1 / %2").arg(m_iMidiPort).arg(m_iMidiChannel)); |
410 |
|
else |
411 |
|
MidiPortChannelTextLabel->setText(QString("%1 / *").arg(m_iMidiPort)); |
412 |
|
|
413 |
// And update the both GUI volume elements. |
// And update the both GUI volume elements. |
414 |
updateChannelVolume(); |
updateChannelVolume(); |
415 |
} |
} |
451 |
return; |
return; |
452 |
|
|
453 |
// Conditionally update whole channel status info. |
// Conditionally update whole channel status info. |
454 |
if (m_iInstrumentStatus >= 0 && m_iInstrumentStatus < 100) |
if (m_iInstrumentStatus >= 0 && m_iInstrumentStatus < 100) { |
455 |
updateChannelInfo(); |
updateChannelInfo(); |
456 |
|
// Once we get a complete instrument load, try a implied reset channel.... |
457 |
|
if (m_iInstrumentStatus == 100) { |
458 |
|
if (::lscp_reset_channel(client(), m_iChannelID) != LSCP_OK) |
459 |
|
appendMessagesClient("lscp_reset_channel"); |
460 |
|
else |
461 |
|
appendMessages(tr("Channel %1 reset.").arg(m_iChannelID)); |
462 |
|
} |
463 |
|
} |
464 |
|
// Leave, if we still have an erroneus or incomplete instrument load. |
465 |
|
if (m_iInstrumentStatus < 100) |
466 |
|
return; |
467 |
|
|
468 |
// Get current channel voice count. |
// Get current channel voice count. |
469 |
int iVoiceCount = ::lscp_get_channel_voice_count(client(), m_iChannelID); |
int iVoiceCount = ::lscp_get_channel_voice_count(client(), m_iChannelID); |
472 |
// Get current channel buffer fill usage. |
// Get current channel buffer fill usage. |
473 |
// As benno has suggested this is the percentage usage |
// As benno has suggested this is the percentage usage |
474 |
// of the least filled buffer stream... |
// of the least filled buffer stream... |
475 |
int iStreamUsage = 0; |
int iStreamUsage = ::lscp_get_channel_stream_usage(client(), m_iChannelID);; |
476 |
if (iStreamCount > 0) { |
|
|
lscp_buffer_fill_t *pBufferFill = ::lscp_get_channel_buffer_fill(client(), LSCP_USAGE_PERCENTAGE, m_iChannelID); |
|
|
if (pBufferFill) { |
|
|
for (int iStream = 0; iStream < iStreamCount; iStream++) { |
|
|
if (iStreamUsage > (int) pBufferFill[iStream].stream_usage || iStream == 0) |
|
|
iStreamUsage = pBufferFill[iStream].stream_usage; |
|
|
} |
|
|
} |
|
|
} |
|
477 |
// Update the GUI elements... |
// Update the GUI elements... |
478 |
StreamUsageProgressBar->setProgress(iStreamUsage); |
StreamUsageProgressBar->setProgress(iStreamUsage); |
479 |
StreamVoiceCountTextLabel->setText(QString("%1 / %2").arg(iStreamCount).arg(iVoiceCount)); |
StreamVoiceCountTextLabel->setText(QString("%1 / %2").arg(iStreamCount).arg(iVoiceCount)); |
546 |
|
|
547 |
|
|
548 |
// end of qsamplerChannelStrip.ui.h |
// end of qsamplerChannelStrip.ui.h |
|
|
|