36 |
|
|
37 |
#include "qsamplerAbout.h" |
#include "qsamplerAbout.h" |
38 |
#include "qsamplerOptions.h" |
#include "qsamplerOptions.h" |
39 |
|
#include "qsamplerChannel.h" |
40 |
#include "qsamplerMessages.h" |
#include "qsamplerMessages.h" |
41 |
|
|
42 |
#include "qsamplerChannelStrip.h" |
#include "qsamplerChannelStrip.h" |
484 |
m_pWorkspace->setUpdatesEnabled(false); |
m_pWorkspace->setUpdatesEnabled(false); |
485 |
QWidgetList wlist = m_pWorkspace->windowList(); |
QWidgetList wlist = m_pWorkspace->windowList(); |
486 |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
487 |
qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel); |
qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel); |
488 |
if (bForce && ::lscp_remove_channel(m_pClient, pChannel->channelID()) != LSCP_OK) |
if (pChannelStrip) { |
489 |
appendMessagesClient("lscp_remove_channel"); |
qsamplerChannel *pChannel = pChannelStrip->channel(); |
490 |
delete pChannel; |
if (bForce && pChannel && ::lscp_remove_channel(m_pClient, pChannel->channelID()) != LSCP_OK) |
491 |
|
appendMessagesClient("lscp_remove_channel"); |
492 |
|
delete pChannelStrip; |
493 |
|
} |
494 |
} |
} |
495 |
m_pWorkspace->setUpdatesEnabled(true); |
m_pWorkspace->setUpdatesEnabled(true); |
496 |
// We're now clean, for sure. |
// We're now clean, for sure. |
599 |
ts << endl; |
ts << endl; |
600 |
QWidgetList wlist = m_pWorkspace->windowList(); |
QWidgetList wlist = m_pWorkspace->windowList(); |
601 |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
602 |
qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel); |
qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel); |
603 |
int iChannelID = pChannel->channelID(); |
if (pChannelStrip) { |
604 |
ts << "# " << pChannel->caption() << endl; |
qsamplerChannel *pChannel = pChannelStrip->channel(); |
605 |
ts << "ADD CHANNEL" << endl; |
if (pChannel) { |
606 |
ts << "SET CHANNEL AUDIO_OUTPUT_TYPE " << iChannelID << " " << pChannel->audioDriver() << endl; |
int iChannelID = pChannel->channelID(); |
607 |
ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannelID << " " << pChannel->midiDriver() << endl; |
ts << "# " << pChannelStrip->caption() << endl; |
608 |
// ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannelID << " " << pChannel->midiPort() << endl; |
ts << "ADD CHANNEL" << endl; |
609 |
ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannelID << " " << pChannel->midiChannel() << endl; |
ts << "SET CHANNEL AUDIO_OUTPUT_TYPE " << iChannelID << " " << pChannel->audioDriver() << endl; |
610 |
ts << "LOAD ENGINE " << pChannel->engineName() << " " << iChannelID << endl; |
ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannelID << " " << pChannel->midiDriver() << endl; |
611 |
ts << "LOAD INSTRUMENT NON_MODAL " << pChannel->instrumentFile() << " " << pChannel->instrumentNr() << " " << iChannelID << endl; |
ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannelID << " " << pChannel->midiPort() << endl; |
612 |
ts << "SET CHANNEL VOLUME " << iChannelID << " " << pChannel->volume() << endl; |
ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannelID << " "; |
613 |
ts << endl; |
if (pChannel->midiChannel() > 0) |
614 |
|
ts << pChannel->midiChannel(); |
615 |
|
else |
616 |
|
ts << "ALL"; |
617 |
|
ts << endl; |
618 |
|
ts << "LOAD ENGINE " << pChannel->engineName() << " " << iChannelID << endl; |
619 |
|
ts << "LOAD INSTRUMENT NON_MODAL '" << pChannel->instrumentFile() << "' " << pChannel->instrumentNr() << " " << iChannelID << endl; |
620 |
|
ts << "SET CHANNEL VOLUME " << iChannelID << " " << pChannel->volume() << endl; |
621 |
|
ts << endl; |
622 |
|
} |
623 |
|
} |
624 |
// Try to keep it snappy :) |
// Try to keep it snappy :) |
625 |
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
626 |
} |
} |
692 |
} |
} |
693 |
|
|
694 |
|
|
695 |
|
// Reset the sampler instance. |
696 |
|
void qsamplerMainForm::fileReset (void) |
697 |
|
{ |
698 |
|
if (m_pClient == NULL) |
699 |
|
return; |
700 |
|
|
701 |
|
// Ask user whether he/she want's an internal sampler reset... |
702 |
|
if (QMessageBox::warning(this, tr("Warning"), |
703 |
|
tr("Resetting the sampler instance will close\n" |
704 |
|
"all device and channel configurations.\n\n" |
705 |
|
"Please note that this operation may cause\n" |
706 |
|
"temporary MIDI and Audio disruption\n\n" |
707 |
|
"Do you want to reset the sampler engine now?"), |
708 |
|
tr("Reset"), tr("Cancel")) > 0) |
709 |
|
return; |
710 |
|
|
711 |
|
// Just do the reset, after closing down current session... |
712 |
|
if (closeSession(true) && ::lscp_reset_sampler(m_pClient) != LSCP_OK) { |
713 |
|
appendMessagesClient("lscp_reset_sampler"); |
714 |
|
appendMessagesError(tr("Could not reset sampler instance.\n\nSorry.")); |
715 |
|
return; |
716 |
|
} |
717 |
|
|
718 |
|
// Log this. |
719 |
|
appendMessages(tr("Sampler reset.")); |
720 |
|
} |
721 |
|
|
722 |
|
|
723 |
// Restart the client/server instance. |
// Restart the client/server instance. |
724 |
void qsamplerMainForm::fileRestart (void) |
void qsamplerMainForm::fileRestart (void) |
725 |
{ |
{ |
794 |
if (m_pClient == NULL) |
if (m_pClient == NULL) |
795 |
return; |
return; |
796 |
|
|
797 |
qsamplerChannelStrip *pChannel = activeChannel(); |
qsamplerChannelStrip *pChannelStrip = activeChannelStrip(); |
798 |
|
if (pChannelStrip == NULL) |
799 |
|
return; |
800 |
|
|
801 |
|
qsamplerChannel *pChannel = pChannelStrip->channel(); |
802 |
if (pChannel == NULL) |
if (pChannel == NULL) |
803 |
return; |
return; |
804 |
|
|
808 |
tr("About to remove channel:\n\n" |
tr("About to remove channel:\n\n" |
809 |
"%1\n\n" |
"%1\n\n" |
810 |
"Are you sure?") |
"Are you sure?") |
811 |
.arg(pChannel->caption()), |
.arg(pChannelStrip->caption()), |
812 |
tr("OK"), tr("Cancel")) > 0) |
tr("OK"), tr("Cancel")) > 0) |
813 |
return; |
return; |
814 |
} |
} |
824 |
appendMessages(tr("Channel %1 removed.").arg(pChannel->channelID())); |
appendMessages(tr("Channel %1 removed.").arg(pChannel->channelID())); |
825 |
|
|
826 |
// Just delete the channel strip. |
// Just delete the channel strip. |
827 |
delete pChannel; |
delete pChannelStrip; |
828 |
|
|
829 |
// Do we auto-arrange? |
// Do we auto-arrange? |
830 |
if (m_pOptions && m_pOptions->bAutoArrange) |
if (m_pOptions && m_pOptions->bAutoArrange) |
831 |
channelsArrange(); |
channelsArrange(); |
842 |
if (m_pClient == NULL) |
if (m_pClient == NULL) |
843 |
return; |
return; |
844 |
|
|
845 |
qsamplerChannelStrip *pChannel = activeChannel(); |
qsamplerChannelStrip *pChannelStrip = activeChannelStrip(); |
846 |
if (pChannel == NULL) |
if (pChannelStrip == NULL) |
847 |
return; |
return; |
848 |
|
|
849 |
// Just invoque the channel strip procedure. |
// Just invoque the channel strip procedure. |
850 |
pChannel->channelSetup(); |
pChannelStrip->showChannelSetup(false); |
851 |
} |
} |
852 |
|
|
853 |
|
|
857 |
if (m_pClient == NULL) |
if (m_pClient == NULL) |
858 |
return; |
return; |
859 |
|
|
860 |
qsamplerChannelStrip *pChannel = activeChannel(); |
qsamplerChannelStrip *pChannelStrip = activeChannelStrip(); |
861 |
|
if (pChannelStrip == NULL) |
862 |
|
return; |
863 |
|
|
864 |
|
qsamplerChannel *pChannel = pChannelStrip->channel(); |
865 |
if (pChannel == NULL) |
if (pChannel == NULL) |
866 |
return; |
return; |
867 |
|
|
876 |
appendMessages(tr("Channel %1 reset.").arg(pChannel->channelID())); |
appendMessages(tr("Channel %1 reset.").arg(pChannel->channelID())); |
877 |
|
|
878 |
// Refresh channel strip info. |
// Refresh channel strip info. |
879 |
pChannel->updateChannelInfo(); |
pChannelStrip->updateChannelInfo(); |
880 |
} |
} |
881 |
|
|
882 |
|
|
937 |
qsamplerOptionsForm *pOptionsForm = new qsamplerOptionsForm(this); |
qsamplerOptionsForm *pOptionsForm = new qsamplerOptionsForm(this); |
938 |
if (pOptionsForm) { |
if (pOptionsForm) { |
939 |
// Check out some initial nullities(tm)... |
// Check out some initial nullities(tm)... |
940 |
qsamplerChannelStrip *pChannel = activeChannel(); |
qsamplerChannelStrip *pChannelStrip = activeChannelStrip(); |
941 |
if (m_pOptions->sDisplayFont.isEmpty() && pChannel) |
if (m_pOptions->sDisplayFont.isEmpty() && pChannelStrip) |
942 |
m_pOptions->sDisplayFont = pChannel->displayFont().toString(); |
m_pOptions->sDisplayFont = pChannelStrip->displayFont().toString(); |
943 |
if (m_pOptions->sMessagesFont.isEmpty() && m_pMessages) |
if (m_pOptions->sMessagesFont.isEmpty() && m_pMessages) |
944 |
m_pOptions->sMessagesFont = m_pMessages->messagesFont().toString(); |
m_pOptions->sMessagesFont = m_pMessages->messagesFont().toString(); |
945 |
// To track down deferred or immediate changes. |
// To track down deferred or immediate changes. |
949 |
bool bOldServerStart = m_pOptions->bServerStart; |
bool bOldServerStart = m_pOptions->bServerStart; |
950 |
QString sOldServerCmdLine = m_pOptions->sServerCmdLine; |
QString sOldServerCmdLine = m_pOptions->sServerCmdLine; |
951 |
QString sOldDisplayFont = m_pOptions->sDisplayFont; |
QString sOldDisplayFont = m_pOptions->sDisplayFont; |
952 |
|
bool bOldDisplayEffect = m_pOptions->bDisplayEffect; |
953 |
int iOldMaxVolume = m_pOptions->iMaxVolume; |
int iOldMaxVolume = m_pOptions->iMaxVolume; |
954 |
QString sOldMessagesFont = m_pOptions->sMessagesFont; |
QString sOldMessagesFont = m_pOptions->sMessagesFont; |
955 |
bool bOldStdoutCapture = m_pOptions->bStdoutCapture; |
bool bOldStdoutCapture = m_pOptions->bStdoutCapture; |
974 |
(!bOldCompletePath && m_pOptions->bCompletePath) || |
(!bOldCompletePath && m_pOptions->bCompletePath) || |
975 |
(iOldMaxRecentFiles != m_pOptions->iMaxRecentFiles)) |
(iOldMaxRecentFiles != m_pOptions->iMaxRecentFiles)) |
976 |
updateRecentFilesMenu(); |
updateRecentFilesMenu(); |
977 |
|
if (( bOldDisplayEffect && !m_pOptions->bDisplayEffect) || |
978 |
|
(!bOldDisplayEffect && m_pOptions->bDisplayEffect)) |
979 |
|
updateDisplayEffect(); |
980 |
if (sOldDisplayFont != m_pOptions->sDisplayFont) |
if (sOldDisplayFont != m_pOptions->sDisplayFont) |
981 |
updateDisplayFont(); |
updateDisplayFont(); |
982 |
if (iOldMaxVolume != m_pOptions->iMaxVolume) |
if (iOldMaxVolume != m_pOptions->iMaxVolume) |
1019 |
m_pWorkspace->setUpdatesEnabled(false); |
m_pWorkspace->setUpdatesEnabled(false); |
1020 |
int y = 0; |
int y = 0; |
1021 |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
1022 |
qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel); |
qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel); |
1023 |
/* if (pChannel->testWState(WState_Maximized | WState_Minimized)) { |
/* if (pChannelStrip->testWState(WState_Maximized | WState_Minimized)) { |
1024 |
// Prevent flicker... |
// Prevent flicker... |
1025 |
pChannel->hide(); |
pChannelStrip->hide(); |
1026 |
pChannel->showNormal(); |
pChannelStrip->showNormal(); |
1027 |
} */ |
} */ |
1028 |
pChannel->adjustSize(); |
pChannelStrip->adjustSize(); |
1029 |
int iWidth = m_pWorkspace->width(); |
int iWidth = m_pWorkspace->width(); |
1030 |
if (iWidth < pChannel->width()) |
if (iWidth < pChannelStrip->width()) |
1031 |
iWidth = pChannel->width(); |
iWidth = pChannelStrip->width(); |
1032 |
// int iHeight = pChannel->height() + pChannel->parentWidget()->baseSize().height(); |
// int iHeight = pChannelStrip->height() + pChannelStrip->parentWidget()->baseSize().height(); |
1033 |
int iHeight = pChannel->parentWidget()->frameGeometry().height(); |
int iHeight = pChannelStrip->parentWidget()->frameGeometry().height(); |
1034 |
pChannel->parentWidget()->setGeometry(0, y, iWidth, iHeight); |
pChannelStrip->parentWidget()->setGeometry(0, y, iWidth, iHeight); |
1035 |
y += iHeight; |
y += iHeight; |
1036 |
} |
} |
1037 |
m_pWorkspace->setUpdatesEnabled(true); |
m_pWorkspace->setUpdatesEnabled(true); |
1079 |
sText += tr("Debugging option enabled."); |
sText += tr("Debugging option enabled."); |
1080 |
sText += "</font></small><br />"; |
sText += "</font></small><br />"; |
1081 |
#endif |
#endif |
1082 |
|
#ifndef CONFIG_LIBGIG |
1083 |
|
sText += "<small><font color=\"red\">"; |
1084 |
|
sText += tr("GIG (libgig) file support disabled."); |
1085 |
|
sText += "</font></small><br />"; |
1086 |
|
#endif |
1087 |
sText += "<br />\n"; |
sText += "<br />\n"; |
1088 |
sText += tr("Using") + ": "; |
sText += tr("Using") + ": "; |
1089 |
sText += ::lscp_client_package(); |
sText += ::lscp_client_package(); |
1117 |
setCaption(tr(QSAMPLER_TITLE " - [%1]").arg(sSessioName)); |
setCaption(tr(QSAMPLER_TITLE " - [%1]").arg(sSessioName)); |
1118 |
|
|
1119 |
// Update the main menu state... |
// Update the main menu state... |
1120 |
qsamplerChannelStrip *pChannel = activeChannel(); |
qsamplerChannelStrip *pChannelStrip = activeChannelStrip(); |
1121 |
bool bHasClient = (m_pOptions != NULL && m_pClient != NULL); |
bool bHasClient = (m_pOptions != NULL && m_pClient != NULL); |
1122 |
bool bHasChannel = (bHasClient && pChannel != NULL); |
bool bHasChannel = (bHasClient && pChannelStrip != NULL); |
1123 |
fileNewAction->setEnabled(bHasClient); |
fileNewAction->setEnabled(bHasClient); |
1124 |
fileOpenAction->setEnabled(bHasClient); |
fileOpenAction->setEnabled(bHasClient); |
1125 |
fileSaveAction->setEnabled(bHasClient && m_iDirtyCount > 0); |
fileSaveAction->setEnabled(bHasClient && m_iDirtyCount > 0); |
1126 |
fileSaveAsAction->setEnabled(bHasClient); |
fileSaveAsAction->setEnabled(bHasClient); |
1127 |
|
fileResetAction->setEnabled(bHasClient); |
1128 |
fileRestartAction->setEnabled(bHasClient || m_pServer == NULL); |
fileRestartAction->setEnabled(bHasClient || m_pServer == NULL); |
1129 |
editAddChannelAction->setEnabled(bHasClient); |
editAddChannelAction->setEnabled(bHasClient); |
1130 |
editRemoveChannelAction->setEnabled(bHasChannel); |
editRemoveChannelAction->setEnabled(bHasChannel); |
1143 |
} |
} |
1144 |
// Channel status... |
// Channel status... |
1145 |
if (bHasChannel) |
if (bHasChannel) |
1146 |
m_status[QSAMPLER_STATUS_CHANNEL]->setText(pChannel->caption()); |
m_status[QSAMPLER_STATUS_CHANNEL]->setText(pChannelStrip->caption()); |
1147 |
else |
else |
1148 |
m_status[QSAMPLER_STATUS_CHANNEL]->clear(); |
m_status[QSAMPLER_STATUS_CHANNEL]->clear(); |
1149 |
// Session status... |
// Session status... |
1162 |
|
|
1163 |
|
|
1164 |
// Channel change receiver slot. |
// Channel change receiver slot. |
1165 |
void qsamplerMainForm::channelChanged( qsamplerChannelStrip * ) |
void qsamplerMainForm::channelStripChanged( qsamplerChannelStrip * ) |
1166 |
{ |
{ |
1167 |
// Just mark the dirty form. |
// Just mark the dirty form. |
1168 |
m_iDirtyCount++; |
m_iDirtyCount++; |
1236 |
|
|
1237 |
m_pWorkspace->setUpdatesEnabled(false); |
m_pWorkspace->setUpdatesEnabled(false); |
1238 |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
1239 |
qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel); |
qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel); |
1240 |
pChannel->setDisplayFont(font); |
if (pChannelStrip) |
1241 |
|
pChannelStrip->setDisplayFont(font); |
1242 |
|
} |
1243 |
|
m_pWorkspace->setUpdatesEnabled(true); |
1244 |
|
} |
1245 |
|
|
1246 |
|
|
1247 |
|
// Update channel strips background effect. |
1248 |
|
void qsamplerMainForm::updateDisplayEffect (void) |
1249 |
|
{ |
1250 |
|
QPixmap pm; |
1251 |
|
if (m_pOptions->bDisplayEffect) |
1252 |
|
pm = QPixmap::fromMimeSource("displaybg1.png"); |
1253 |
|
|
1254 |
|
// Full channel list update... |
1255 |
|
QWidgetList wlist = m_pWorkspace->windowList(); |
1256 |
|
if (wlist.isEmpty()) |
1257 |
|
return; |
1258 |
|
|
1259 |
|
m_pWorkspace->setUpdatesEnabled(false); |
1260 |
|
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
1261 |
|
qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel); |
1262 |
|
if (pChannelStrip) |
1263 |
|
pChannelStrip->setDisplayBackground(pm); |
1264 |
} |
} |
1265 |
m_pWorkspace->setUpdatesEnabled(true); |
m_pWorkspace->setUpdatesEnabled(true); |
1266 |
} |
} |
1279 |
|
|
1280 |
m_pWorkspace->setUpdatesEnabled(false); |
m_pWorkspace->setUpdatesEnabled(false); |
1281 |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
1282 |
qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel); |
qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel); |
1283 |
pChannel->setMaxVolume(m_pOptions->iMaxVolume); |
if (pChannelStrip) |
1284 |
|
pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume); |
1285 |
} |
} |
1286 |
m_pWorkspace->setUpdatesEnabled(true); |
m_pWorkspace->setUpdatesEnabled(true); |
1287 |
} |
} |
1386 |
return; |
return; |
1387 |
|
|
1388 |
// Prepare for auto-arrange? |
// Prepare for auto-arrange? |
1389 |
qsamplerChannelStrip *pChannel = NULL; |
qsamplerChannelStrip *pChannelStrip = NULL; |
1390 |
int y = 0; |
int y = 0; |
1391 |
if (m_pOptions && m_pOptions->bAutoArrange) { |
if (m_pOptions && m_pOptions->bAutoArrange) { |
1392 |
QWidgetList wlist = m_pWorkspace->windowList(); |
QWidgetList wlist = m_pWorkspace->windowList(); |
1393 |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
1394 |
pChannel = (qsamplerChannelStrip *) wlist.at(iChannel); |
pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel); |
1395 |
// y += pChannel->height() + pChannel->parentWidget()->baseSize().height(); |
// y += pChannelStrip->height() + pChannelStrip->parentWidget()->baseSize().height(); |
1396 |
y += pChannel->parentWidget()->frameGeometry().height(); |
y += pChannelStrip->parentWidget()->frameGeometry().height(); |
1397 |
} |
} |
1398 |
} |
} |
1399 |
|
|
1400 |
// Add a new channel itema... |
// Add a new channel itema... |
1401 |
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; |
1402 |
pChannel = new qsamplerChannelStrip(m_pWorkspace, 0, wflags); |
pChannelStrip = new qsamplerChannelStrip(m_pWorkspace, 0, wflags); |
1403 |
pChannel->setMaxVolume(m_pOptions->iMaxVolume); |
// Set some initial aesthetic options... |
1404 |
pChannel->setup(this, iChannelID); |
if (m_pOptions) { |
1405 |
// We'll need a display font. |
// Background display effect... |
1406 |
QFont font; |
pChannelStrip->setDisplayEffect(m_pOptions->bDisplayEffect); |
1407 |
if (m_pOptions && font.fromString(m_pOptions->sDisplayFont)) |
// We'll need a display font. |
1408 |
pChannel->setDisplayFont(font); |
QFont font; |
1409 |
// Track channel setup changes. |
if (font.fromString(m_pOptions->sDisplayFont)) |
1410 |
QObject::connect(pChannel, SIGNAL(channelChanged(qsamplerChannelStrip *)), this, SLOT(channelChanged(qsamplerChannelStrip *))); |
pChannelStrip->setDisplayFont(font); |
1411 |
|
// Maximum allowed volume setting. |
1412 |
|
pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume); |
1413 |
|
} |
1414 |
|
// Actual channel setup. |
1415 |
|
pChannelStrip->setup(this, iChannelID); |
1416 |
|
QObject::connect(pChannelStrip, SIGNAL(channelChanged(qsamplerChannelStrip *)), this, SLOT(channelStripChanged(qsamplerChannelStrip *))); |
1417 |
// Before we show it up, may be we'll |
// Before we show it up, may be we'll |
1418 |
// better ask for some initial values? |
// better ask for some initial values? |
1419 |
if (bPrompt) |
if (bPrompt) |
1420 |
pChannel->channelSetup(); |
pChannelStrip->showChannelSetup(true); |
1421 |
// Now we show up us to the world. |
// Now we show up us to the world. |
1422 |
pChannel->show(); |
pChannelStrip->show(); |
1423 |
// Only then, we'll auto-arrange... |
// Only then, we'll auto-arrange... |
1424 |
if (m_pOptions && m_pOptions->bAutoArrange) { |
if (m_pOptions && m_pOptions->bAutoArrange) { |
1425 |
int iWidth = m_pWorkspace->width(); |
int iWidth = m_pWorkspace->width(); |
1426 |
// int iHeight = pChannel->height() + pChannel->parentWidget()->baseSize().height(); |
// int iHeight = pChannel->height() + pChannel->parentWidget()->baseSize().height(); |
1427 |
int iHeight = pChannel->parentWidget()->frameGeometry().height(); |
int iHeight = pChannelStrip->parentWidget()->frameGeometry().height(); |
1428 |
pChannel->parentWidget()->setGeometry(0, y, iWidth, iHeight); |
pChannelStrip->parentWidget()->setGeometry(0, y, iWidth, iHeight); |
1429 |
} |
} |
1430 |
} |
} |
1431 |
|
|
1432 |
|
|
1433 |
// Retrieve the active channel strip. |
// Retrieve the active channel strip. |
1434 |
qsamplerChannelStrip *qsamplerMainForm::activeChannel (void) |
qsamplerChannelStrip *qsamplerMainForm::activeChannelStrip (void) |
1435 |
{ |
{ |
1436 |
return (qsamplerChannelStrip *) m_pWorkspace->activeWindow(); |
return (qsamplerChannelStrip *) m_pWorkspace->activeWindow(); |
1437 |
} |
} |
1438 |
|
|
1439 |
|
|
1440 |
// Retrieve a channel strip by index. |
// Retrieve a channel strip by index. |
1441 |
qsamplerChannelStrip *qsamplerMainForm::channelAt ( int iChannel ) |
qsamplerChannelStrip *qsamplerMainForm::channelStripAt ( int iChannel ) |
1442 |
{ |
{ |
1443 |
QWidgetList wlist = m_pWorkspace->windowList(); |
QWidgetList wlist = m_pWorkspace->windowList(); |
1444 |
if (wlist.isEmpty()) |
if (wlist.isEmpty()) |
1459 |
if (!wlist.isEmpty()) { |
if (!wlist.isEmpty()) { |
1460 |
channelsMenu->insertSeparator(); |
channelsMenu->insertSeparator(); |
1461 |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
1462 |
qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel); |
qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel); |
1463 |
int iItemID = channelsMenu->insertItem(pChannel->caption(), this, SLOT(channelsMenuActivated(int))); |
if (pChannelStrip) { |
1464 |
channelsMenu->setItemParameter(iItemID, iChannel); |
int iItemID = channelsMenu->insertItem(pChannelStrip->caption(), this, SLOT(channelsMenuActivated(int))); |
1465 |
channelsMenu->setItemChecked(iItemID, activeChannel() == pChannel); |
channelsMenu->setItemParameter(iItemID, iChannel); |
1466 |
|
channelsMenu->setItemChecked(iItemID, activeChannelStrip() == pChannelStrip); |
1467 |
|
} |
1468 |
} |
} |
1469 |
} |
} |
1470 |
} |
} |
1473 |
// Windows menu activation slot |
// Windows menu activation slot |
1474 |
void qsamplerMainForm::channelsMenuActivated ( int iChannel ) |
void qsamplerMainForm::channelsMenuActivated ( int iChannel ) |
1475 |
{ |
{ |
1476 |
qsamplerChannelStrip *pChannel = channelAt(iChannel); |
qsamplerChannelStrip *pChannelStrip = channelStripAt(iChannel); |
1477 |
if (pChannel) |
if (pChannelStrip) |
1478 |
pChannel->showNormal(); |
pChannelStrip->showNormal(); |
1479 |
pChannel->setFocus(); |
pChannelStrip->setFocus(); |
1480 |
} |
} |
1481 |
|
|
1482 |
|
|
1522 |
m_iTimerSlot = 0; |
m_iTimerSlot = 0; |
1523 |
QWidgetList wlist = m_pWorkspace->windowList(); |
QWidgetList wlist = m_pWorkspace->windowList(); |
1524 |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
1525 |
qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel); |
qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel); |
1526 |
if (pChannel->isVisible()) |
if (pChannelStrip && pChannelStrip->isVisible()) |
1527 |
pChannel->updateChannelUsage(); |
pChannelStrip->updateChannelUsage(); |
1528 |
} |
} |
1529 |
} |
} |
1530 |
} |
} |