487 |
qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel); |
qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel); |
488 |
if (pChannelStrip) { |
if (pChannelStrip) { |
489 |
qsamplerChannel *pChannel = pChannelStrip->channel(); |
qsamplerChannel *pChannel = pChannelStrip->channel(); |
490 |
if (bForce && pChannel && ::lscp_remove_channel(m_pClient, pChannel->channelID()) != LSCP_OK) |
if (bForce && pChannel) |
491 |
appendMessagesClient("lscp_remove_channel"); |
pChannel->removeChannel(); |
492 |
delete pChannelStrip; |
delete pChannelStrip; |
493 |
} |
} |
494 |
} |
} |
552 |
// Try to (re)create each channel. |
// Try to (re)create each channel. |
553 |
m_pWorkspace->setUpdatesEnabled(false); |
m_pWorkspace->setUpdatesEnabled(false); |
554 |
for (int iChannelID = 0; iChannelID < iChannels; iChannelID++) { |
for (int iChannelID = 0; iChannelID < iChannels; iChannelID++) { |
555 |
createChannel(iChannelID, false); |
createChannelStrip(iChannelID); |
556 |
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
557 |
} |
} |
558 |
m_pWorkspace->setUpdatesEnabled(true); |
m_pWorkspace->setUpdatesEnabled(true); |
767 |
if (m_pClient == NULL) |
if (m_pClient == NULL) |
768 |
return; |
return; |
769 |
|
|
770 |
// Create the new sampler channel. |
// Just create the channel strip, given an invalid channel id. |
771 |
int iChannelID = ::lscp_add_channel(m_pClient); |
qsamplerChannelStrip *pChannelStrip = createChannelStrip(-1); |
772 |
if (iChannelID < 0) { |
if (pChannelStrip == NULL) |
|
appendMessagesClient("lscp_add_channel"); |
|
|
appendMessagesError(tr("Could not create the new channel.\n\nSorry.")); |
|
773 |
return; |
return; |
774 |
} |
|
|
|
|
|
// Log this happening. |
|
|
appendMessages(tr("Channel %1 created.").arg(iChannelID)); |
|
|
|
|
|
// Just create the channel strip with given id. |
|
|
createChannel(iChannelID, true); |
|
|
|
|
775 |
// We'll be dirty, for sure... |
// We'll be dirty, for sure... |
776 |
m_iDirtyCount++; |
m_iDirtyCount++; |
777 |
// Stabilize form anyway. |
// Stabilize form anyway. |
805 |
} |
} |
806 |
|
|
807 |
// Remove the existing sampler channel. |
// Remove the existing sampler channel. |
808 |
if (::lscp_remove_channel(m_pClient, pChannel->channelID()) != LSCP_OK) { |
if (!pChannel->removeChannel()) |
|
appendMessagesClient("lscp_remove_channel"); |
|
|
appendMessagesError(tr("Could not remove channel.\n\nSorry.")); |
|
809 |
return; |
return; |
|
} |
|
810 |
|
|
|
// Log this happening. |
|
|
appendMessages(tr("Channel %1 removed.").arg(pChannel->channelID())); |
|
|
|
|
811 |
// Just delete the channel strip. |
// Just delete the channel strip. |
812 |
delete pChannelStrip; |
delete pChannelStrip; |
813 |
|
|
832 |
return; |
return; |
833 |
|
|
834 |
// Just invoque the channel strip procedure. |
// Just invoque the channel strip procedure. |
835 |
pChannelStrip->showChannelSetup(false); |
pChannelStrip->channelSetup(); |
836 |
} |
} |
837 |
|
|
838 |
|
|
850 |
if (pChannel == NULL) |
if (pChannel == NULL) |
851 |
return; |
return; |
852 |
|
|
853 |
// Remove the existing sampler channel. |
// Reset the existing sampler channel. |
854 |
if (::lscp_reset_channel(m_pClient, pChannel->channelID()) != LSCP_OK) { |
pChannel->resetChannel(); |
|
appendMessagesClient("lscp_reset_channel"); |
|
|
appendMessagesError(tr("Could not reset channel.\n\nSorry.")); |
|
|
return; |
|
|
} |
|
|
|
|
|
// Log this. |
|
|
appendMessages(tr("Channel %1 reset.").arg(pChannel->channelID())); |
|
855 |
|
|
856 |
// Refresh channel strip info. |
// Refresh channel strip info. |
857 |
pChannelStrip->updateChannelInfo(); |
pChannelStrip->updateChannelInfo(); |
1358 |
// qsamplerMainForm -- MDI channel strip management. |
// qsamplerMainForm -- MDI channel strip management. |
1359 |
|
|
1360 |
// The channel strip creation executive. |
// The channel strip creation executive. |
1361 |
void qsamplerMainForm::createChannel ( int iChannelID, bool bPrompt ) |
qsamplerChannelStrip *qsamplerMainForm::createChannelStrip ( int iChannelID ) |
1362 |
{ |
{ |
1363 |
if (m_pClient == NULL) |
if (m_pClient == NULL) |
1364 |
return; |
return NULL; |
1365 |
|
|
1366 |
// Prepare for auto-arrange? |
// Prepare for auto-arrange? |
1367 |
qsamplerChannelStrip *pChannelStrip = NULL; |
qsamplerChannelStrip *pChannelStrip = NULL; |
1378 |
// Add a new channel itema... |
// Add a new channel itema... |
1379 |
WFlags wflags = Qt::WStyle_Customize | Qt::WStyle_Tool | Qt::WStyle_Title | Qt::WStyle_NoBorder; |
WFlags wflags = Qt::WStyle_Customize | Qt::WStyle_Tool | Qt::WStyle_Title | Qt::WStyle_NoBorder; |
1380 |
pChannelStrip = new qsamplerChannelStrip(m_pWorkspace, 0, wflags); |
pChannelStrip = new qsamplerChannelStrip(m_pWorkspace, 0, wflags); |
1381 |
|
// Actual channel setup. |
1382 |
|
pChannelStrip->setup(this, iChannelID); |
1383 |
|
QObject::connect(pChannelStrip, SIGNAL(channelChanged(qsamplerChannelStrip *)), this, SLOT(channelStripChanged(qsamplerChannelStrip *))); |
1384 |
|
// Before we show it up, may be we'll |
1385 |
|
// better ask for some initial values? |
1386 |
|
if (iChannelID < 0 && !pChannelStrip->channelSetup()) { |
1387 |
|
// No luck, bail out... |
1388 |
|
delete pChannelStrip; |
1389 |
|
return NULL; |
1390 |
|
} |
1391 |
|
|
1392 |
// Set some initial aesthetic options... |
// Set some initial aesthetic options... |
1393 |
if (m_pOptions) { |
if (m_pOptions) { |
1394 |
// Background display effect... |
// Background display effect... |
1400 |
// Maximum allowed volume setting. |
// Maximum allowed volume setting. |
1401 |
pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume); |
pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume); |
1402 |
} |
} |
1403 |
// Actual channel setup. |
|
|
pChannelStrip->setup(this, iChannelID); |
|
|
QObject::connect(pChannelStrip, SIGNAL(channelChanged(qsamplerChannelStrip *)), this, SLOT(channelStripChanged(qsamplerChannelStrip *))); |
|
|
// Before we show it up, may be we'll |
|
|
// better ask for some initial values? |
|
|
if (bPrompt) |
|
|
pChannelStrip->showChannelSetup(true); |
|
1404 |
// Now we show up us to the world. |
// Now we show up us to the world. |
1405 |
pChannelStrip->show(); |
pChannelStrip->show(); |
1406 |
// Only then, we'll auto-arrange... |
// Only then, we'll auto-arrange... |
1410 |
int iHeight = pChannelStrip->parentWidget()->frameGeometry().height(); |
int iHeight = pChannelStrip->parentWidget()->frameGeometry().height(); |
1411 |
pChannelStrip->parentWidget()->setGeometry(0, y, iWidth, iHeight); |
pChannelStrip->parentWidget()->setGeometry(0, y, iWidth, iHeight); |
1412 |
} |
} |
1413 |
|
|
1414 |
|
// Return our successful reference... |
1415 |
|
return pChannelStrip; |
1416 |
} |
} |
1417 |
|
|
1418 |
|
|