1 |
// qsamplerMainForm.cpp |
// qsamplerMainForm.cpp |
2 |
// |
// |
3 |
/**************************************************************************** |
/**************************************************************************** |
4 |
Copyright (C) 2004-2015, rncbc aka Rui Nuno Capela. All rights reserved. |
Copyright (C) 2004-2016, rncbc aka Rui Nuno Capela. All rights reserved. |
5 |
Copyright (C) 2007,2008,2015 Christian Schoenebeck |
Copyright (C) 2007,2008,2015 Christian Schoenebeck |
6 |
|
|
7 |
This program is free software; you can redistribute it and/or |
This program is free software; you can redistribute it and/or |
123 |
|
|
124 |
|
|
125 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
126 |
// qsampler -- namespace |
// QSampler -- namespace |
127 |
|
|
128 |
|
|
129 |
namespace QSampler { |
namespace QSampler { |
143 |
|
|
144 |
|
|
145 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
146 |
// LscpEvent -- specialty for LSCP callback comunication. |
// QSampler::LscpEvent -- specialty for LSCP callback comunication. |
|
|
|
147 |
|
|
148 |
class LscpEvent : public QEvent |
class LscpEvent : public QEvent |
149 |
{ |
{ |
158 |
} |
} |
159 |
|
|
160 |
// Accessors. |
// Accessors. |
161 |
lscp_event_t event() { return m_event; } |
lscp_event_t event() { return m_event; } |
162 |
QString& data() { return m_data; } |
const QString& data() { return m_data; } |
163 |
|
|
164 |
private: |
private: |
165 |
|
|
171 |
|
|
172 |
|
|
173 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
174 |
// qsamplerMainForm -- Main window form implementation. |
// QSampler::Workspace -- Main window workspace (MDI Area) decl. |
175 |
|
|
176 |
|
class Workspace : public QMdiArea |
177 |
|
{ |
178 |
|
public: |
179 |
|
|
180 |
|
Workspace(MainForm *pMainForm) : QMdiArea(pMainForm) {} |
181 |
|
|
182 |
|
protected: |
183 |
|
|
184 |
|
void resizeEvent(QResizeEvent *) |
185 |
|
{ |
186 |
|
MainForm *pMainForm = static_cast<MainForm *> (parentWidget()); |
187 |
|
if (pMainForm) |
188 |
|
pMainForm->channelsArrangeAuto(); |
189 |
|
} |
190 |
|
}; |
191 |
|
|
192 |
|
|
193 |
|
//------------------------------------------------------------------------- |
194 |
|
// QSampler::MainForm -- Main window form implementation. |
195 |
|
|
196 |
// Kind of singleton reference. |
// Kind of singleton reference. |
197 |
MainForm* MainForm::g_pMainForm = NULL; |
MainForm *MainForm::g_pMainForm = NULL; |
198 |
|
|
199 |
MainForm::MainForm ( QWidget *pParent ) |
MainForm::MainForm ( QWidget *pParent ) |
200 |
: QMainWindow(pParent) |
: QMainWindow(pParent) |
214 |
|
|
215 |
// We'll start clean. |
// We'll start clean. |
216 |
m_iUntitled = 0; |
m_iUntitled = 0; |
217 |
|
m_iDirtySetup = 0; |
218 |
m_iDirtyCount = 0; |
m_iDirtyCount = 0; |
219 |
|
|
220 |
m_pServer = NULL; |
m_pServer = NULL; |
289 |
#endif |
#endif |
290 |
|
|
291 |
// Make it an MDI workspace. |
// Make it an MDI workspace. |
292 |
m_pWorkspace = new QMdiArea(this); |
m_pWorkspace = new Workspace(this); |
293 |
m_pWorkspace->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); |
m_pWorkspace->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); |
294 |
m_pWorkspace->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); |
m_pWorkspace->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); |
295 |
// Set the activation connection. |
// Set the activation connection. |
498 |
updateMessagesFont(); |
updateMessagesFont(); |
499 |
updateMessagesLimit(); |
updateMessagesLimit(); |
500 |
updateMessagesCapture(); |
updateMessagesCapture(); |
501 |
|
|
502 |
// Set the visibility signal. |
// Set the visibility signal. |
503 |
QObject::connect(m_pMessages, |
QObject::connect(m_pMessages, |
504 |
SIGNAL(visibilityChanged(bool)), |
SIGNAL(visibilityChanged(bool)), |
564 |
|| m_ui.channelsToolbar->isVisible()); |
|| m_ui.channelsToolbar->isVisible()); |
565 |
m_pOptions->bStatusbar = statusBar()->isVisible(); |
m_pOptions->bStatusbar = statusBar()->isVisible(); |
566 |
// Save the dock windows state. |
// Save the dock windows state. |
|
const QString sDockables = saveState().toBase64().data(); |
|
567 |
m_pOptions->settings().setValue("/Layout/DockWindows", saveState()); |
m_pOptions->settings().setValue("/Layout/DockWindows", saveState()); |
568 |
// And the children, and the main windows state,. |
// And the children, and the main windows state,. |
569 |
m_pOptions->saveWidgetGeometry(m_pDeviceForm); |
m_pOptions->saveWidgetGeometry(m_pDeviceForm); |
606 |
} |
} |
607 |
|
|
608 |
|
|
609 |
void MainForm::dropEvent ( QDropEvent* pDropEvent ) |
void MainForm::dropEvent ( QDropEvent *pDropEvent ) |
610 |
{ |
{ |
611 |
// Accept externally originated drops only... |
// Accept externally originated drops only... |
612 |
if (pDropEvent->source()) |
if (pDropEvent->source()) |
662 |
updateAllChannelStrips(true); |
updateAllChannelStrips(true); |
663 |
break; |
break; |
664 |
case LSCP_EVENT_CHANNEL_INFO: { |
case LSCP_EVENT_CHANNEL_INFO: { |
665 |
int iChannelID = pLscpEvent->data().toInt(); |
const int iChannelID = pLscpEvent->data().toInt(); |
666 |
ChannelStrip *pChannelStrip = channelStrip(iChannelID); |
ChannelStrip *pChannelStrip = channelStrip(iChannelID); |
667 |
if (pChannelStrip) |
if (pChannelStrip) |
668 |
channelStripChanged(pChannelStrip); |
channelStripChanged(pChannelStrip); |
753 |
|
|
754 |
|
|
755 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
756 |
// qsamplerMainForm -- Brainless public property accessors. |
// QSampler::MainForm -- Brainless public property accessors. |
757 |
|
|
758 |
// The global options settings property. |
// The global options settings property. |
759 |
Options *MainForm::options (void) const |
Options *MainForm::options (void) const |
777 |
|
|
778 |
|
|
779 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
780 |
// qsamplerMainForm -- Session file stuff. |
// QSampler::MainForm -- Session file stuff. |
781 |
|
|
782 |
// Format the displayable session filename. |
// Format the displayable session filename. |
783 |
QString MainForm::sessionName ( const QString& sFilename ) |
QString MainForm::sessionName ( const QString& sFilename ) |
784 |
{ |
{ |
785 |
bool bCompletePath = (m_pOptions && m_pOptions->bCompletePath); |
const bool bCompletePath = (m_pOptions && m_pOptions->bCompletePath); |
786 |
QString sSessionName = sFilename; |
QString sSessionName = sFilename; |
787 |
if (sSessionName.isEmpty()) |
if (sSessionName.isEmpty()) |
788 |
sSessionName = tr("Untitled") + QString::number(m_iUntitled); |
sSessionName = tr("Untitled") + QString::number(m_iUntitled); |
916 |
if (bClose) { |
if (bClose) { |
917 |
// Remove all channel strips from sight... |
// Remove all channel strips from sight... |
918 |
m_pWorkspace->setUpdatesEnabled(false); |
m_pWorkspace->setUpdatesEnabled(false); |
919 |
QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList(); |
const QList<QMdiSubWindow *>& wlist |
920 |
for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) { |
= m_pWorkspace->subWindowList(); |
921 |
|
const int iStripCount = wlist.count(); |
922 |
|
for (int iStrip = 0; iStrip < iStripCount; ++iStrip) { |
923 |
ChannelStrip *pChannelStrip = NULL; |
ChannelStrip *pChannelStrip = NULL; |
924 |
QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel); |
QMdiSubWindow *pMdiSubWindow = wlist.at(iStrip); |
925 |
if (pMdiSubWindow) |
if (pMdiSubWindow) |
926 |
pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget()); |
pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget()); |
927 |
if (pChannelStrip) { |
if (pChannelStrip) { |
1043 |
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); |
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); |
1044 |
|
|
1045 |
// Write the file. |
// Write the file. |
1046 |
int iErrors = 0; |
int iErrors = 0; |
1047 |
QTextStream ts(&file); |
QTextStream ts(&file); |
1048 |
ts << "# " << QSAMPLER_TITLE " - " << tr(QSAMPLER_SUBTITLE) << endl; |
ts << "# " << QSAMPLER_TITLE " - " << tr(QSAMPLER_SUBTITLE) << endl; |
1049 |
ts << "# " << tr("Version") |
ts << "# " << tr("Version") |
1050 |
<< ": " QSAMPLER_VERSION << endl; |
<< ": " QSAMPLER_VERSION << endl; |
1051 |
ts << "# " << tr("Build") |
ts << "# " << tr("Build") |
1052 |
<< ": " __DATE__ " " __TIME__ << endl; |
<< ": " CONFIG_BUILD_DATE << endl; |
1053 |
ts << "#" << endl; |
ts << "#" << endl; |
1054 |
ts << "# " << tr("File") |
ts << "# " << tr("File") |
1055 |
<< ": " << QFileInfo(sFilename).fileName() << endl; |
<< ": " << QFileInfo(sFilename).fileName() << endl; |
1155 |
QMap<int, int> midiInstrumentMap; |
QMap<int, int> midiInstrumentMap; |
1156 |
int *piMaps = ::lscp_list_midi_instrument_maps(m_pClient); |
int *piMaps = ::lscp_list_midi_instrument_maps(m_pClient); |
1157 |
for (int iMap = 0; piMaps && piMaps[iMap] >= 0; iMap++) { |
for (int iMap = 0; piMaps && piMaps[iMap] >= 0; iMap++) { |
1158 |
int iMidiMap = piMaps[iMap]; |
const int iMidiMap = piMaps[iMap]; |
1159 |
const char *pszMapName |
const char *pszMapName |
1160 |
= ::lscp_get_midi_instrument_map_name(m_pClient, iMidiMap); |
= ::lscp_get_midi_instrument_map_name(m_pClient, iMidiMap); |
1161 |
ts << "# " << tr("MIDI instrument map") << " " << iMap; |
ts << "# " << tr("MIDI instrument map") << " " << iMap; |
1222 |
#endif // CONFIG_MIDI_INSTRUMENT |
#endif // CONFIG_MIDI_INSTRUMENT |
1223 |
|
|
1224 |
// Sampler channel mapping. |
// Sampler channel mapping. |
1225 |
QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList(); |
const QList<QMdiSubWindow *>& wlist |
1226 |
for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) { |
= m_pWorkspace->subWindowList(); |
1227 |
|
const int iStripCount = wlist.count(); |
1228 |
|
for (int iStrip = 0; iStrip < iStripCount; ++iStrip) { |
1229 |
ChannelStrip *pChannelStrip = NULL; |
ChannelStrip *pChannelStrip = NULL; |
1230 |
QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel); |
QMdiSubWindow *pMdiSubWindow = wlist.at(iStrip); |
1231 |
if (pMdiSubWindow) |
if (pMdiSubWindow) |
1232 |
pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget()); |
pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget()); |
1233 |
if (pChannelStrip) { |
if (pChannelStrip) { |
1234 |
Channel *pChannel = pChannelStrip->channel(); |
Channel *pChannel = pChannelStrip->channel(); |
1235 |
if (pChannel) { |
if (pChannel) { |
1236 |
ts << "# " << tr("Channel") << " " << iChannel << endl; |
const int iChannelID = pChannel->channelID(); |
1237 |
|
ts << "# " << tr("Channel") << " " << iChannelID << endl; |
1238 |
ts << "ADD CHANNEL" << endl; |
ts << "ADD CHANNEL" << endl; |
1239 |
if (audioDeviceMap.isEmpty()) { |
if (audioDeviceMap.isEmpty()) { |
1240 |
ts << "SET CHANNEL AUDIO_OUTPUT_TYPE " << iChannel |
ts << "SET CHANNEL AUDIO_OUTPUT_TYPE " << iChannelID |
1241 |
<< " " << pChannel->audioDriver() << endl; |
<< " " << pChannel->audioDriver() << endl; |
1242 |
} else { |
} else { |
1243 |
ts << "SET CHANNEL AUDIO_OUTPUT_DEVICE " << iChannel |
ts << "SET CHANNEL AUDIO_OUTPUT_DEVICE " << iChannelID |
1244 |
<< " " << audioDeviceMap[pChannel->audioDevice()] << endl; |
<< " " << audioDeviceMap[pChannel->audioDevice()] << endl; |
1245 |
} |
} |
1246 |
if (midiDeviceMap.isEmpty()) { |
if (midiDeviceMap.isEmpty()) { |
1247 |
ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannel |
ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannelID |
1248 |
<< " " << pChannel->midiDriver() << endl; |
<< " " << pChannel->midiDriver() << endl; |
1249 |
} else { |
} else { |
1250 |
ts << "SET CHANNEL MIDI_INPUT_DEVICE " << iChannel |
ts << "SET CHANNEL MIDI_INPUT_DEVICE " << iChannelID |
1251 |
<< " " << midiDeviceMap[pChannel->midiDevice()] << endl; |
<< " " << midiDeviceMap[pChannel->midiDevice()] << endl; |
1252 |
} |
} |
1253 |
ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannel |
ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannelID |
1254 |
<< " " << pChannel->midiPort() << endl; |
<< " " << pChannel->midiPort() << endl; |
1255 |
ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannel << " "; |
ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannelID << " "; |
1256 |
if (pChannel->midiChannel() == LSCP_MIDI_CHANNEL_ALL) |
if (pChannel->midiChannel() == LSCP_MIDI_CHANNEL_ALL) |
1257 |
ts << "ALL"; |
ts << "ALL"; |
1258 |
else |
else |
1259 |
ts << pChannel->midiChannel(); |
ts << pChannel->midiChannel(); |
1260 |
ts << endl; |
ts << endl; |
1261 |
ts << "LOAD ENGINE " << pChannel->engineName() |
ts << "LOAD ENGINE " << pChannel->engineName() |
1262 |
<< " " << iChannel << endl; |
<< " " << iChannelID << endl; |
1263 |
if (pChannel->instrumentStatus() < 100) ts << "# "; |
if (pChannel->instrumentStatus() < 100) ts << "# "; |
1264 |
ts << "LOAD INSTRUMENT NON_MODAL '" |
ts << "LOAD INSTRUMENT NON_MODAL '" |
1265 |
<< pChannel->instrumentFile() << "' " |
<< pChannel->instrumentFile() << "' " |
1266 |
<< pChannel->instrumentNr() << " " << iChannel << endl; |
<< pChannel->instrumentNr() << " " << iChannelID << endl; |
1267 |
ChannelRoutingMap::ConstIterator audioRoute; |
ChannelRoutingMap::ConstIterator audioRoute; |
1268 |
for (audioRoute = pChannel->audioRouting().begin(); |
for (audioRoute = pChannel->audioRouting().begin(); |
1269 |
audioRoute != pChannel->audioRouting().end(); |
audioRoute != pChannel->audioRouting().end(); |
1270 |
++audioRoute) { |
++audioRoute) { |
1271 |
ts << "SET CHANNEL AUDIO_OUTPUT_CHANNEL " << iChannel |
ts << "SET CHANNEL AUDIO_OUTPUT_CHANNEL " << iChannelID |
1272 |
<< " " << audioRoute.key() |
<< " " << audioRoute.key() |
1273 |
<< " " << audioRoute.value() << endl; |
<< " " << audioRoute.value() << endl; |
1274 |
} |
} |
1275 |
ts << "SET CHANNEL VOLUME " << iChannel |
ts << "SET CHANNEL VOLUME " << iChannelID |
1276 |
<< " " << pChannel->volume() << endl; |
<< " " << pChannel->volume() << endl; |
1277 |
if (pChannel->channelMute()) |
if (pChannel->channelMute()) |
1278 |
ts << "SET CHANNEL MUTE " << iChannel << " 1" << endl; |
ts << "SET CHANNEL MUTE " << iChannelID << " 1" << endl; |
1279 |
if (pChannel->channelSolo()) |
if (pChannel->channelSolo()) |
1280 |
ts << "SET CHANNEL SOLO " << iChannel << " 1" << endl; |
ts << "SET CHANNEL SOLO " << iChannelID << " 1" << endl; |
1281 |
#ifdef CONFIG_MIDI_INSTRUMENT |
#ifdef CONFIG_MIDI_INSTRUMENT |
1282 |
if (pChannel->midiMap() >= 0) { |
if (pChannel->midiMap() >= 0) { |
1283 |
ts << "SET CHANNEL MIDI_INSTRUMENT_MAP " << iChannel |
ts << "SET CHANNEL MIDI_INSTRUMENT_MAP " << iChannelID |
1284 |
<< " " << midiInstrumentMap[pChannel->midiMap()] << endl; |
<< " " << midiInstrumentMap[pChannel->midiMap()] << endl; |
1285 |
} |
} |
1286 |
#endif |
#endif |
1287 |
#ifdef CONFIG_FXSEND |
#ifdef CONFIG_FXSEND |
|
int iChannelID = pChannel->channelID(); |
|
1288 |
int *piFxSends = ::lscp_list_fxsends(m_pClient, iChannelID); |
int *piFxSends = ::lscp_list_fxsends(m_pClient, iChannelID); |
1289 |
for (int iFxSend = 0; |
for (int iFxSend = 0; |
1290 |
piFxSends && piFxSends[iFxSend] >= 0; |
piFxSends && piFxSends[iFxSend] >= 0; |
1292 |
lscp_fxsend_info_t *pFxSendInfo = ::lscp_get_fxsend_info( |
lscp_fxsend_info_t *pFxSendInfo = ::lscp_get_fxsend_info( |
1293 |
m_pClient, iChannelID, piFxSends[iFxSend]); |
m_pClient, iChannelID, piFxSends[iFxSend]); |
1294 |
if (pFxSendInfo) { |
if (pFxSendInfo) { |
1295 |
ts << "CREATE FX_SEND " << iChannel |
ts << "CREATE FX_SEND " << iChannelID |
1296 |
<< " " << pFxSendInfo->midi_controller; |
<< " " << pFxSendInfo->midi_controller; |
1297 |
if (pFxSendInfo->name) |
if (pFxSendInfo->name) |
1298 |
ts << " '" << pFxSendInfo->name << "'"; |
ts << " '" << pFxSendInfo->name << "'"; |
1302 |
piRouting && piRouting[iAudioSrc] >= 0; |
piRouting && piRouting[iAudioSrc] >= 0; |
1303 |
iAudioSrc++) { |
iAudioSrc++) { |
1304 |
ts << "SET FX_SEND AUDIO_OUTPUT_CHANNEL " |
ts << "SET FX_SEND AUDIO_OUTPUT_CHANNEL " |
1305 |
<< iChannel |
<< iChannelID |
1306 |
<< " " << iFxSend |
<< " " << iFxSend |
1307 |
<< " " << iAudioSrc |
<< " " << iAudioSrc |
1308 |
<< " " << piRouting[iAudioSrc] << endl; |
<< " " << piRouting[iAudioSrc] << endl; |
1309 |
} |
} |
1310 |
#ifdef CONFIG_FXSEND_LEVEL |
#ifdef CONFIG_FXSEND_LEVEL |
1311 |
ts << "SET FX_SEND LEVEL " << iChannel |
ts << "SET FX_SEND LEVEL " << iChannelID |
1312 |
<< " " << iFxSend |
<< " " << iFxSend |
1313 |
<< " " << pFxSendInfo->level << endl; |
<< " " << pFxSendInfo->level << endl; |
1314 |
#endif |
#endif |
1371 |
|
|
1372 |
|
|
1373 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
1374 |
// qsamplerMainForm -- File Action slots. |
// QSampler::MainForm -- File Action slots. |
1375 |
|
|
1376 |
// Create a new sampler session. |
// Create a new sampler session. |
1377 |
void MainForm::fileNew (void) |
void MainForm::fileNew (void) |
1395 |
// Retrive filename index from action data... |
// Retrive filename index from action data... |
1396 |
QAction *pAction = qobject_cast<QAction *> (sender()); |
QAction *pAction = qobject_cast<QAction *> (sender()); |
1397 |
if (pAction && m_pOptions) { |
if (pAction && m_pOptions) { |
1398 |
int iIndex = pAction->data().toInt(); |
const int iIndex = pAction->data().toInt(); |
1399 |
if (iIndex >= 0 && iIndex < m_pOptions->recentFiles.count()) { |
if (iIndex >= 0 && iIndex < m_pOptions->recentFiles.count()) { |
1400 |
QString sFilename = m_pOptions->recentFiles[iIndex]; |
QString sFilename = m_pOptions->recentFiles[iIndex]; |
1401 |
// Check if we can safely close the current session... |
// Check if we can safely close the current session... |
1537 |
|
|
1538 |
|
|
1539 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
1540 |
// qsamplerMainForm -- Edit Action slots. |
// QSampler::MainForm -- Edit Action slots. |
1541 |
|
|
1542 |
// Add a new sampler channel. |
// Add a new sampler channel. |
1543 |
void MainForm::editAddChannel (void) |
void MainForm::editAddChannel (void) |
1544 |
{ |
{ |
1545 |
|
++m_iDirtySetup; |
1546 |
|
addChannelStrip(); |
1547 |
|
--m_iDirtySetup; |
1548 |
|
} |
1549 |
|
|
1550 |
|
void MainForm::addChannelStrip (void) |
1551 |
|
{ |
1552 |
if (m_pClient == NULL) |
if (m_pClient == NULL) |
1553 |
return; |
return; |
1554 |
|
|
1572 |
} |
} |
1573 |
|
|
1574 |
// Do we auto-arrange? |
// Do we auto-arrange? |
1575 |
if (m_pOptions && m_pOptions->bAutoArrange) |
channelsArrangeAuto(); |
|
channelsArrange(); |
|
1576 |
|
|
1577 |
// Make that an overall update. |
// Make that an overall update. |
1578 |
m_iDirtyCount++; |
m_iDirtyCount++; |
1583 |
// Remove current sampler channel. |
// Remove current sampler channel. |
1584 |
void MainForm::editRemoveChannel (void) |
void MainForm::editRemoveChannel (void) |
1585 |
{ |
{ |
1586 |
|
++m_iDirtySetup; |
1587 |
|
removeChannelStrip(); |
1588 |
|
--m_iDirtySetup; |
1589 |
|
} |
1590 |
|
|
1591 |
|
void MainForm::removeChannelStrip (void) |
1592 |
|
{ |
1593 |
if (m_pClient == NULL) |
if (m_pClient == NULL) |
1594 |
return; |
return; |
1595 |
|
|
1634 |
if (!pChannel->removeChannel()) |
if (!pChannel->removeChannel()) |
1635 |
return; |
return; |
1636 |
|
|
|
// We'll be dirty, for sure... |
|
|
m_iDirtyCount++; |
|
|
|
|
1637 |
// Just delete the channel strip. |
// Just delete the channel strip. |
1638 |
destroyChannelStrip(pChannelStrip); |
destroyChannelStrip(pChannelStrip); |
1639 |
|
|
1640 |
|
// We'll be dirty, for sure... |
1641 |
|
m_iDirtyCount++; |
1642 |
|
stabilizeForm(); |
1643 |
} |
} |
1644 |
|
|
1645 |
|
|
1697 |
// Invoque the channel strip procedure, |
// Invoque the channel strip procedure, |
1698 |
// for all channels out there... |
// for all channels out there... |
1699 |
m_pWorkspace->setUpdatesEnabled(false); |
m_pWorkspace->setUpdatesEnabled(false); |
1700 |
QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList(); |
const QList<QMdiSubWindow *>& wlist |
1701 |
for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) { |
= m_pWorkspace->subWindowList(); |
1702 |
|
const int iStripCount = wlist.count(); |
1703 |
|
for (int iStrip = 0; iStrip < iStripCount; ++iStrip) { |
1704 |
ChannelStrip *pChannelStrip = NULL; |
ChannelStrip *pChannelStrip = NULL; |
1705 |
QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel); |
QMdiSubWindow *pMdiSubWindow = wlist.at(iStrip); |
1706 |
if (pMdiSubWindow) |
if (pMdiSubWindow) |
1707 |
pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget()); |
pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget()); |
1708 |
if (pChannelStrip) |
if (pChannelStrip) |
1713 |
|
|
1714 |
|
|
1715 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
1716 |
// qsamplerMainForm -- View Action slots. |
// QSampler::MainForm -- View Action slots. |
1717 |
|
|
1718 |
// Show/hide the main program window menubar. |
// Show/hide the main program window menubar. |
1719 |
void MainForm::viewMenubar ( bool bOn ) |
void MainForm::viewMenubar ( bool bOn ) |
1813 |
if (m_pOptions->sMessagesFont.isEmpty() && m_pMessages) |
if (m_pOptions->sMessagesFont.isEmpty() && m_pMessages) |
1814 |
m_pOptions->sMessagesFont = m_pMessages->messagesFont().toString(); |
m_pOptions->sMessagesFont = m_pMessages->messagesFont().toString(); |
1815 |
// To track down deferred or immediate changes. |
// To track down deferred or immediate changes. |
1816 |
QString sOldServerHost = m_pOptions->sServerHost; |
const QString sOldServerHost = m_pOptions->sServerHost; |
1817 |
int iOldServerPort = m_pOptions->iServerPort; |
const int iOldServerPort = m_pOptions->iServerPort; |
1818 |
int iOldServerTimeout = m_pOptions->iServerTimeout; |
const int iOldServerTimeout = m_pOptions->iServerTimeout; |
1819 |
bool bOldServerStart = m_pOptions->bServerStart; |
const bool bOldServerStart = m_pOptions->bServerStart; |
1820 |
QString sOldServerCmdLine = m_pOptions->sServerCmdLine; |
const QString sOldServerCmdLine = m_pOptions->sServerCmdLine; |
1821 |
bool bOldMessagesLog = m_pOptions->bMessagesLog; |
const bool bOldMessagesLog = m_pOptions->bMessagesLog; |
1822 |
QString sOldMessagesLogPath = m_pOptions->sMessagesLogPath; |
const QString sOldMessagesLogPath = m_pOptions->sMessagesLogPath; |
1823 |
QString sOldDisplayFont = m_pOptions->sDisplayFont; |
const QString sOldDisplayFont = m_pOptions->sDisplayFont; |
1824 |
bool bOldDisplayEffect = m_pOptions->bDisplayEffect; |
const bool bOldDisplayEffect = m_pOptions->bDisplayEffect; |
1825 |
int iOldMaxVolume = m_pOptions->iMaxVolume; |
const int iOldMaxVolume = m_pOptions->iMaxVolume; |
1826 |
QString sOldMessagesFont = m_pOptions->sMessagesFont; |
const QString sOldMessagesFont = m_pOptions->sMessagesFont; |
1827 |
bool bOldKeepOnTop = m_pOptions->bKeepOnTop; |
const bool bOldKeepOnTop = m_pOptions->bKeepOnTop; |
1828 |
bool bOldStdoutCapture = m_pOptions->bStdoutCapture; |
const bool bOldStdoutCapture = m_pOptions->bStdoutCapture; |
1829 |
int bOldMessagesLimit = m_pOptions->bMessagesLimit; |
const int bOldMessagesLimit = m_pOptions->bMessagesLimit; |
1830 |
int iOldMessagesLimitLines = m_pOptions->iMessagesLimitLines; |
const int iOldMessagesLimitLines = m_pOptions->iMessagesLimitLines; |
1831 |
bool bOldCompletePath = m_pOptions->bCompletePath; |
const bool bOldCompletePath = m_pOptions->bCompletePath; |
1832 |
bool bOldInstrumentNames = m_pOptions->bInstrumentNames; |
const bool bOldInstrumentNames = m_pOptions->bInstrumentNames; |
1833 |
int iOldMaxRecentFiles = m_pOptions->iMaxRecentFiles; |
const int iOldMaxRecentFiles = m_pOptions->iMaxRecentFiles; |
1834 |
int iOldBaseFontSize = m_pOptions->iBaseFontSize; |
const int iOldBaseFontSize = m_pOptions->iBaseFontSize; |
1835 |
// Load the current setup settings. |
// Load the current setup settings. |
1836 |
pOptionsForm->setup(m_pOptions); |
pOptionsForm->setup(m_pOptions); |
1837 |
// Show the setup dialog... |
// Show the setup dialog... |
1894 |
|
|
1895 |
|
|
1896 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
1897 |
// qsamplerMainForm -- Channels action slots. |
// QSampler::MainForm -- Channels action slots. |
1898 |
|
|
1899 |
// Arrange channel strips. |
// Arrange channel strips. |
1900 |
void MainForm::channelsArrange (void) |
void MainForm::channelsArrange (void) |
1901 |
{ |
{ |
1902 |
// Full width vertical tiling |
// Full width vertical tiling |
1903 |
QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList(); |
const QList<QMdiSubWindow *>& wlist |
1904 |
|
= m_pWorkspace->subWindowList(); |
1905 |
if (wlist.isEmpty()) |
if (wlist.isEmpty()) |
1906 |
return; |
return; |
1907 |
|
|
1908 |
m_pWorkspace->setUpdatesEnabled(false); |
m_pWorkspace->setUpdatesEnabled(false); |
1909 |
int y = 0; |
int y = 0; |
1910 |
for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) { |
const int iStripCount = wlist.count(); |
1911 |
ChannelStrip *pChannelStrip = NULL; |
for (int iStrip = 0; iStrip < iStripCount; ++iStrip) { |
1912 |
QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel); |
QMdiSubWindow *pMdiSubWindow = wlist.at(iStrip); |
1913 |
if (pMdiSubWindow) |
if (pMdiSubWindow) { |
1914 |
pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget()); |
pMdiSubWindow->adjustSize(); |
1915 |
if (pChannelStrip) { |
int iWidth = m_pWorkspace->width(); |
1916 |
/* if (pChannelStrip->testWState(WState_Maximized | WState_Minimized)) { |
if (iWidth < pMdiSubWindow->width()) |
1917 |
// Prevent flicker... |
iWidth = pMdiSubWindow->width(); |
1918 |
pChannelStrip->hide(); |
const int iHeight = pMdiSubWindow->frameGeometry().height(); |
1919 |
pChannelStrip->showNormal(); |
pMdiSubWindow->setGeometry(0, y, iWidth, iHeight); |
|
} */ |
|
|
pChannelStrip->adjustSize(); |
|
|
int iWidth = m_pWorkspace->width(); |
|
|
if (iWidth < pChannelStrip->width()) |
|
|
iWidth = pChannelStrip->width(); |
|
|
// int iHeight = pChannelStrip->height() |
|
|
// + pChannelStrip->parentWidget()->baseSize().height(); |
|
|
int iHeight = pChannelStrip->parentWidget()->frameGeometry().height(); |
|
|
pChannelStrip->parentWidget()->setGeometry(0, y, iWidth, iHeight); |
|
1920 |
y += iHeight; |
y += iHeight; |
1921 |
} |
} |
1922 |
} |
} |
1936 |
m_pOptions->bAutoArrange = bOn; |
m_pOptions->bAutoArrange = bOn; |
1937 |
|
|
1938 |
// If on, update whole workspace... |
// If on, update whole workspace... |
1939 |
if (m_pOptions->bAutoArrange) |
channelsArrangeAuto(); |
1940 |
|
} |
1941 |
|
|
1942 |
|
|
1943 |
|
void MainForm::channelsArrangeAuto (void) |
1944 |
|
{ |
1945 |
|
if (m_pOptions && m_pOptions->bAutoArrange) |
1946 |
channelsArrange(); |
channelsArrange(); |
1947 |
} |
} |
1948 |
|
|
1949 |
|
|
1950 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
1951 |
// qsamplerMainForm -- Help Action slots. |
// QSampler::MainForm -- Help Action slots. |
1952 |
|
|
1953 |
// Show information about the Qt toolkit. |
// Show information about the Qt toolkit. |
1954 |
void MainForm::helpAboutQt (void) |
void MainForm::helpAboutQt (void) |
1965 |
sText += "<b>" QSAMPLER_TITLE " - " + tr(QSAMPLER_SUBTITLE) + "</b><br />\n"; |
sText += "<b>" QSAMPLER_TITLE " - " + tr(QSAMPLER_SUBTITLE) + "</b><br />\n"; |
1966 |
sText += "<br />\n"; |
sText += "<br />\n"; |
1967 |
sText += tr("Version") + ": <b>" QSAMPLER_VERSION "</b><br />\n"; |
sText += tr("Version") + ": <b>" QSAMPLER_VERSION "</b><br />\n"; |
1968 |
sText += "<small>" + tr("Build") + ": " __DATE__ " " __TIME__ "</small><br />\n"; |
sText += "<small>" + tr("Build") + ": " CONFIG_BUILD_DATE "</small><br />\n"; |
1969 |
#ifdef CONFIG_DEBUG |
#ifdef CONFIG_DEBUG |
1970 |
sText += "<small><font color=\"red\">"; |
sText += "<small><font color=\"red\">"; |
1971 |
sText += tr("Debugging option enabled."); |
sText += tr("Debugging option enabled."); |
2055 |
|
|
2056 |
|
|
2057 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
2058 |
// qsamplerMainForm -- Main window stabilization. |
// QSampler::MainForm -- Main window stabilization. |
2059 |
|
|
2060 |
void MainForm::stabilizeForm (void) |
void MainForm::stabilizeForm (void) |
2061 |
{ |
{ |
2067 |
|
|
2068 |
// Update the main menu state... |
// Update the main menu state... |
2069 |
ChannelStrip *pChannelStrip = activeChannelStrip(); |
ChannelStrip *pChannelStrip = activeChannelStrip(); |
2070 |
bool bHasClient = (m_pOptions != NULL && m_pClient != NULL); |
const QList<QMdiSubWindow *>& wlist = m_pWorkspace->subWindowList(); |
2071 |
bool bHasChannel = (bHasClient && pChannelStrip != NULL); |
const bool bHasClient = (m_pOptions != NULL && m_pClient != NULL); |
2072 |
bool bHasChannels = (bHasClient && m_pWorkspace->subWindowList().count() > 0); |
const bool bHasChannel = (bHasClient && pChannelStrip != NULL); |
2073 |
|
const bool bHasChannels = (bHasClient && wlist.count() > 0); |
2074 |
m_ui.fileNewAction->setEnabled(bHasClient); |
m_ui.fileNewAction->setEnabled(bHasClient); |
2075 |
m_ui.fileOpenAction->setEnabled(bHasClient); |
m_ui.fileOpenAction->setEnabled(bHasClient); |
2076 |
m_ui.fileSaveAction->setEnabled(bHasClient && m_iDirtyCount > 0); |
m_ui.fileSaveAction->setEnabled(bHasClient && m_iDirtyCount > 0); |
2150 |
m_pVolumeSpinBox->setValue(iVolume); |
m_pVolumeSpinBox->setValue(iVolume); |
2151 |
|
|
2152 |
// Do it as commanded... |
// Do it as commanded... |
2153 |
float fVolume = 0.01f * float(iVolume); |
const float fVolume = 0.01f * float(iVolume); |
2154 |
if (::lscp_set_volume(m_pClient, fVolume) == LSCP_OK) |
if (::lscp_set_volume(m_pClient, fVolume) == LSCP_OK) |
2155 |
appendMessages(QObject::tr("Volume: %1.").arg(fVolume)); |
appendMessages(QObject::tr("Volume: %1.").arg(fVolume)); |
2156 |
else |
else |
2185 |
void MainForm::updateSession (void) |
void MainForm::updateSession (void) |
2186 |
{ |
{ |
2187 |
#ifdef CONFIG_VOLUME |
#ifdef CONFIG_VOLUME |
2188 |
int iVolume = ::lroundf(100.0f * ::lscp_get_volume(m_pClient)); |
const int iVolume = ::lroundf(100.0f * ::lscp_get_volume(m_pClient)); |
2189 |
m_iVolumeChanging++; |
m_iVolumeChanging++; |
2190 |
m_pVolumeSlider->setValue(iVolume); |
m_pVolumeSlider->setValue(iVolume); |
2191 |
m_pVolumeSpinBox->setValue(iVolume); |
m_pVolumeSpinBox->setValue(iVolume); |
2193 |
#endif |
#endif |
2194 |
#ifdef CONFIG_MIDI_INSTRUMENT |
#ifdef CONFIG_MIDI_INSTRUMENT |
2195 |
// FIXME: Make some room for default instrument maps... |
// FIXME: Make some room for default instrument maps... |
2196 |
int iMaps = ::lscp_get_midi_instrument_maps(m_pClient); |
const int iMaps = ::lscp_get_midi_instrument_maps(m_pClient); |
2197 |
if (iMaps < 0) |
if (iMaps < 0) |
2198 |
appendMessagesClient("lscp_get_midi_instrument_maps"); |
appendMessagesClient("lscp_get_midi_instrument_maps"); |
2199 |
else if (iMaps < 1) { |
else if (iMaps < 1) { |
2207 |
updateAllChannelStrips(false); |
updateAllChannelStrips(false); |
2208 |
|
|
2209 |
// Do we auto-arrange? |
// Do we auto-arrange? |
2210 |
if (m_pOptions && m_pOptions->bAutoArrange) |
channelsArrangeAuto(); |
|
channelsArrange(); |
|
2211 |
|
|
2212 |
// Remember to refresh devices and instruments... |
// Remember to refresh devices and instruments... |
2213 |
if (m_pInstrumentListForm) |
if (m_pInstrumentListForm) |
2219 |
|
|
2220 |
void MainForm::updateAllChannelStrips ( bool bRemoveDeadStrips ) |
void MainForm::updateAllChannelStrips ( bool bRemoveDeadStrips ) |
2221 |
{ |
{ |
2222 |
|
// Skip if setting up a new channel strip... |
2223 |
|
if (m_iDirtySetup > 0) |
2224 |
|
return; |
2225 |
|
|
2226 |
// Retrieve the current channel list. |
// Retrieve the current channel list. |
2227 |
int *piChannelIDs = ::lscp_list_channels(m_pClient); |
int *piChannelIDs = ::lscp_list_channels(m_pClient); |
2228 |
if (piChannelIDs == NULL) { |
if (piChannelIDs == NULL) { |
2240 |
createChannelStrip(new Channel(piChannelIDs[iChannel])); |
createChannelStrip(new Channel(piChannelIDs[iChannel])); |
2241 |
} |
} |
2242 |
// Do we auto-arrange? |
// Do we auto-arrange? |
2243 |
if (m_pOptions && m_pOptions->bAutoArrange) |
channelsArrangeAuto(); |
|
channelsArrange(); |
|
2244 |
// remove dead channel strips |
// remove dead channel strips |
2245 |
if (bRemoveDeadStrips) { |
if (bRemoveDeadStrips) { |
2246 |
QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList(); |
const QList<QMdiSubWindow *>& wlist |
2247 |
for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) { |
= m_pWorkspace->subWindowList(); |
2248 |
|
const int iStripCount = wlist.count(); |
2249 |
|
for (int iStrip = 0; iStrip < iStripCount; ++iStrip) { |
2250 |
ChannelStrip *pChannelStrip = NULL; |
ChannelStrip *pChannelStrip = NULL; |
2251 |
QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel); |
QMdiSubWindow *pMdiSubWindow = wlist.at(iStrip); |
2252 |
if (pMdiSubWindow) |
if (pMdiSubWindow) |
2253 |
pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget()); |
pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget()); |
2254 |
if (pChannelStrip) { |
if (pChannelStrip) { |
2255 |
bool bExists = false; |
bool bExists = false; |
2256 |
for (int j = 0; piChannelIDs[j] >= 0; ++j) { |
for (int iChannel = 0; piChannelIDs[iChannel] >= 0; ++iChannel) { |
2257 |
if (!pChannelStrip->channel()) |
Channel *pChannel = pChannelStrip->channel(); |
2258 |
|
if (pChannel == NULL) |
2259 |
break; |
break; |
2260 |
if (piChannelIDs[j] == pChannelStrip->channel()->channelID()) { |
if (piChannelIDs[iChannel] == pChannel->channelID()) { |
2261 |
// strip exists, don't touch it |
// strip exists, don't touch it |
2262 |
bExists = true; |
bExists = true; |
2263 |
break; |
break; |
2282 |
return; |
return; |
2283 |
|
|
2284 |
// Remove from list if already there (avoid duplicates) |
// Remove from list if already there (avoid duplicates) |
2285 |
int iIndex = m_pOptions->recentFiles.indexOf(sFilename); |
const int iIndex = m_pOptions->recentFiles.indexOf(sFilename); |
2286 |
if (iIndex >= 0) |
if (iIndex >= 0) |
2287 |
m_pOptions->recentFiles.removeAt(iIndex); |
m_pOptions->recentFiles.removeAt(iIndex); |
2288 |
// Put it to front... |
// Put it to front... |
2321 |
void MainForm::updateInstrumentNames (void) |
void MainForm::updateInstrumentNames (void) |
2322 |
{ |
{ |
2323 |
// Full channel list update... |
// Full channel list update... |
2324 |
QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList(); |
const QList<QMdiSubWindow *>& wlist |
2325 |
|
= m_pWorkspace->subWindowList(); |
2326 |
if (wlist.isEmpty()) |
if (wlist.isEmpty()) |
2327 |
return; |
return; |
2328 |
|
|
2329 |
m_pWorkspace->setUpdatesEnabled(false); |
m_pWorkspace->setUpdatesEnabled(false); |
2330 |
for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) { |
const int iStripCount = wlist.count(); |
2331 |
ChannelStrip *pChannelStrip = (ChannelStrip *) wlist.at(iChannel); |
for (int iStrip = 0; iStrip < iStripCount; ++iStrip) { |
2332 |
|
ChannelStrip *pChannelStrip = NULL; |
2333 |
|
QMdiSubWindow *pMdiSubWindow = wlist.at(iStrip); |
2334 |
|
if (pMdiSubWindow) |
2335 |
|
pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget()); |
2336 |
if (pChannelStrip) |
if (pChannelStrip) |
2337 |
pChannelStrip->updateInstrumentName(true); |
pChannelStrip->updateInstrumentName(true); |
2338 |
} |
} |
2349 |
// Check if display font is legal. |
// Check if display font is legal. |
2350 |
if (m_pOptions->sDisplayFont.isEmpty()) |
if (m_pOptions->sDisplayFont.isEmpty()) |
2351 |
return; |
return; |
2352 |
|
|
2353 |
// Realize it. |
// Realize it. |
2354 |
QFont font; |
QFont font; |
2355 |
if (!font.fromString(m_pOptions->sDisplayFont)) |
if (!font.fromString(m_pOptions->sDisplayFont)) |
2356 |
return; |
return; |
2357 |
|
|
2358 |
// Full channel list update... |
// Full channel list update... |
2359 |
QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList(); |
const QList<QMdiSubWindow *>& wlist |
2360 |
|
= m_pWorkspace->subWindowList(); |
2361 |
if (wlist.isEmpty()) |
if (wlist.isEmpty()) |
2362 |
return; |
return; |
2363 |
|
|
2364 |
m_pWorkspace->setUpdatesEnabled(false); |
m_pWorkspace->setUpdatesEnabled(false); |
2365 |
for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) { |
const int iStripCount = wlist.count(); |
2366 |
|
for (int iStrip = 0; iStrip < iStripCount; ++iStrip) { |
2367 |
ChannelStrip *pChannelStrip = NULL; |
ChannelStrip *pChannelStrip = NULL; |
2368 |
QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel); |
QMdiSubWindow *pMdiSubWindow = wlist.at(iStrip); |
2369 |
if (pMdiSubWindow) |
if (pMdiSubWindow) |
2370 |
pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget()); |
pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget()); |
2371 |
if (pChannelStrip) |
if (pChannelStrip) |
2379 |
void MainForm::updateDisplayEffect (void) |
void MainForm::updateDisplayEffect (void) |
2380 |
{ |
{ |
2381 |
// Full channel list update... |
// Full channel list update... |
2382 |
QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList(); |
const QList<QMdiSubWindow *>& wlist |
2383 |
|
= m_pWorkspace->subWindowList(); |
2384 |
if (wlist.isEmpty()) |
if (wlist.isEmpty()) |
2385 |
return; |
return; |
2386 |
|
|
2387 |
m_pWorkspace->setUpdatesEnabled(false); |
m_pWorkspace->setUpdatesEnabled(false); |
2388 |
for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) { |
const int iStripCount = wlist.count(); |
2389 |
|
for (int iStrip = 0; iStrip < iStripCount; ++iStrip) { |
2390 |
ChannelStrip *pChannelStrip = NULL; |
ChannelStrip *pChannelStrip = NULL; |
2391 |
QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel); |
QMdiSubWindow *pMdiSubWindow = wlist.at(iStrip); |
2392 |
if (pMdiSubWindow) |
if (pMdiSubWindow) |
2393 |
pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget()); |
pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget()); |
2394 |
if (pChannelStrip) |
if (pChannelStrip) |
2412 |
#endif |
#endif |
2413 |
|
|
2414 |
// Full channel list update... |
// Full channel list update... |
2415 |
QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList(); |
const QList<QMdiSubWindow *>& wlist |
2416 |
|
= m_pWorkspace->subWindowList(); |
2417 |
if (wlist.isEmpty()) |
if (wlist.isEmpty()) |
2418 |
return; |
return; |
2419 |
|
|
2420 |
m_pWorkspace->setUpdatesEnabled(false); |
m_pWorkspace->setUpdatesEnabled(false); |
2421 |
for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) { |
const int iStripCount = wlist.count(); |
2422 |
|
for (int iStrip = 0; iStrip < iStripCount; ++iStrip) { |
2423 |
ChannelStrip *pChannelStrip = NULL; |
ChannelStrip *pChannelStrip = NULL; |
2424 |
QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel); |
QMdiSubWindow *pMdiSubWindow = wlist.at(iStrip); |
2425 |
if (pMdiSubWindow) |
if (pMdiSubWindow) |
2426 |
pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget()); |
pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget()); |
2427 |
if (pChannelStrip) |
if (pChannelStrip) |
2432 |
|
|
2433 |
|
|
2434 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
2435 |
// qsamplerMainForm -- Messages window form handlers. |
// QSampler::MainForm -- Messages window form handlers. |
2436 |
|
|
2437 |
// Messages output methods. |
// Messages output methods. |
2438 |
void MainForm::appendMessages( const QString& s ) |
void MainForm::appendMessages( const QString& s ) |
2544 |
|
|
2545 |
|
|
2546 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
2547 |
// qsamplerMainForm -- MDI channel strip management. |
// QSampler::MainForm -- MDI channel strip management. |
2548 |
|
|
2549 |
// The channel strip creation executive. |
// The channel strip creation executive. |
2550 |
ChannelStrip *MainForm::createChannelStrip ( Channel *pChannel ) |
ChannelStrip *MainForm::createChannelStrip ( Channel *pChannel ) |
2563 |
pChannelStrip->setDisplayEffect(m_pOptions->bDisplayEffect); |
pChannelStrip->setDisplayEffect(m_pOptions->bDisplayEffect); |
2564 |
// We'll need a display font. |
// We'll need a display font. |
2565 |
QFont font; |
QFont font; |
2566 |
if (font.fromString(m_pOptions->sDisplayFont)) |
if (!m_pOptions->sDisplayFont.isEmpty() && |
2567 |
|
font.fromString(m_pOptions->sDisplayFont)) |
2568 |
pChannelStrip->setDisplayFont(font); |
pChannelStrip->setDisplayFont(font); |
2569 |
// Maximum allowed volume setting. |
// Maximum allowed volume setting. |
2570 |
pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume); |
pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume); |
2604 |
delete pMdiSubWindow; |
delete pMdiSubWindow; |
2605 |
|
|
2606 |
// Do we auto-arrange? |
// Do we auto-arrange? |
2607 |
if (m_pOptions && m_pOptions->bAutoArrange) |
channelsArrangeAuto(); |
|
channelsArrange(); |
|
|
|
|
|
stabilizeForm(); |
|
2608 |
} |
} |
2609 |
|
|
2610 |
|
|
2620 |
|
|
2621 |
|
|
2622 |
// Retrieve a channel strip by index. |
// Retrieve a channel strip by index. |
2623 |
ChannelStrip *MainForm::channelStripAt ( int iChannel ) |
ChannelStrip *MainForm::channelStripAt ( int iStrip ) |
2624 |
{ |
{ |
2625 |
if (!m_pWorkspace) return NULL; |
if (!m_pWorkspace) return NULL; |
2626 |
|
|
2627 |
QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList(); |
const QList<QMdiSubWindow *>& wlist |
2628 |
|
= m_pWorkspace->subWindowList(); |
2629 |
if (wlist.isEmpty()) |
if (wlist.isEmpty()) |
2630 |
return NULL; |
return NULL; |
2631 |
|
|
2632 |
if (iChannel < 0 || iChannel >= wlist.size()) |
if (iStrip < 0 || iStrip >= wlist.count()) |
2633 |
return NULL; |
return NULL; |
2634 |
|
|
2635 |
QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel); |
QMdiSubWindow *pMdiSubWindow = wlist.at(iStrip); |
2636 |
if (pMdiSubWindow) |
if (pMdiSubWindow) |
2637 |
return static_cast<ChannelStrip *> (pMdiSubWindow->widget()); |
return static_cast<ChannelStrip *> (pMdiSubWindow->widget()); |
2638 |
else |
else |
2643 |
// Retrieve a channel strip by sampler channel id. |
// Retrieve a channel strip by sampler channel id. |
2644 |
ChannelStrip *MainForm::channelStrip ( int iChannelID ) |
ChannelStrip *MainForm::channelStrip ( int iChannelID ) |
2645 |
{ |
{ |
2646 |
QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList(); |
const QList<QMdiSubWindow *>& wlist |
2647 |
|
= m_pWorkspace->subWindowList(); |
2648 |
if (wlist.isEmpty()) |
if (wlist.isEmpty()) |
2649 |
return NULL; |
return NULL; |
2650 |
|
|
2651 |
for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) { |
const int iStripCount = wlist.count(); |
2652 |
|
for (int iStrip = 0; iStrip < iStripCount; ++iStrip) { |
2653 |
ChannelStrip *pChannelStrip = NULL; |
ChannelStrip *pChannelStrip = NULL; |
2654 |
QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel); |
QMdiSubWindow *pMdiSubWindow = wlist.at(iStrip); |
2655 |
if (pMdiSubWindow) |
if (pMdiSubWindow) |
2656 |
pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget()); |
pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget()); |
2657 |
if (pChannelStrip) { |
if (pChannelStrip) { |
2673 |
m_ui.channelsMenu->addAction(m_ui.channelsArrangeAction); |
m_ui.channelsMenu->addAction(m_ui.channelsArrangeAction); |
2674 |
m_ui.channelsMenu->addAction(m_ui.channelsAutoArrangeAction); |
m_ui.channelsMenu->addAction(m_ui.channelsAutoArrangeAction); |
2675 |
|
|
2676 |
QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList(); |
const QList<QMdiSubWindow *>& wlist |
2677 |
|
= m_pWorkspace->subWindowList(); |
2678 |
if (!wlist.isEmpty()) { |
if (!wlist.isEmpty()) { |
2679 |
m_ui.channelsMenu->addSeparator(); |
m_ui.channelsMenu->addSeparator(); |
2680 |
for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) { |
const int iStripCount = wlist.count(); |
2681 |
|
for (int iStrip = 0; iStrip < iStripCount; ++iStrip) { |
2682 |
ChannelStrip *pChannelStrip = NULL; |
ChannelStrip *pChannelStrip = NULL; |
2683 |
QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel); |
QMdiSubWindow *pMdiSubWindow = wlist.at(iStrip); |
2684 |
if (pMdiSubWindow) |
if (pMdiSubWindow) |
2685 |
pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget()); |
pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget()); |
2686 |
if (pChannelStrip) { |
if (pChannelStrip) { |
2689 |
this, SLOT(channelsMenuActivated())); |
this, SLOT(channelsMenuActivated())); |
2690 |
pAction->setCheckable(true); |
pAction->setCheckable(true); |
2691 |
pAction->setChecked(activeChannelStrip() == pChannelStrip); |
pAction->setChecked(activeChannelStrip() == pChannelStrip); |
2692 |
pAction->setData(iChannel); |
pAction->setData(iStrip); |
2693 |
} |
} |
2694 |
} |
} |
2695 |
} |
} |
2713 |
|
|
2714 |
|
|
2715 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
2716 |
// qsamplerMainForm -- Timer stuff. |
// QSampler::MainForm -- Timer stuff. |
2717 |
|
|
2718 |
// Set the pseudo-timer delay schedule. |
// Set the pseudo-timer delay schedule. |
2719 |
void MainForm::startSchedule ( int iStartDelay ) |
void MainForm::startSchedule ( int iStartDelay ) |
2754 |
ChannelStrip *pChannelStrip = iter.next(); |
ChannelStrip *pChannelStrip = iter.next(); |
2755 |
// If successfull, remove from pending list... |
// If successfull, remove from pending list... |
2756 |
if (pChannelStrip->updateChannelInfo()) { |
if (pChannelStrip->updateChannelInfo()) { |
2757 |
int iChannelStrip = m_changedStrips.indexOf(pChannelStrip); |
const int iChannelStrip = m_changedStrips.indexOf(pChannelStrip); |
2758 |
if (iChannelStrip >= 0) |
if (iChannelStrip >= 0) |
2759 |
m_changedStrips.removeAt(iChannelStrip); |
m_changedStrips.removeAt(iChannelStrip); |
2760 |
} |
} |
2765 |
if (m_iTimerSlot >= m_pOptions->iAutoRefreshTime) { |
if (m_iTimerSlot >= m_pOptions->iAutoRefreshTime) { |
2766 |
m_iTimerSlot = 0; |
m_iTimerSlot = 0; |
2767 |
// Update the channel stream usage for each strip... |
// Update the channel stream usage for each strip... |
2768 |
QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList(); |
const QList<QMdiSubWindow *>& wlist |
2769 |
for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) { |
= m_pWorkspace->subWindowList(); |
2770 |
|
const int iStripCount = wlist.count(); |
2771 |
|
for (int iStrip = 0; iStrip < iStripCount; ++iStrip) { |
2772 |
ChannelStrip *pChannelStrip = NULL; |
ChannelStrip *pChannelStrip = NULL; |
2773 |
QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel); |
QMdiSubWindow *pMdiSubWindow = wlist.at(iStrip); |
2774 |
if (pMdiSubWindow) |
if (pMdiSubWindow) |
2775 |
pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget()); |
pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget()); |
2776 |
if (pChannelStrip && pChannelStrip->isVisible()) |
if (pChannelStrip && pChannelStrip->isVisible()) |
2786 |
|
|
2787 |
|
|
2788 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
2789 |
// qsamplerMainForm -- Server stuff. |
// QSampler::MainForm -- Server stuff. |
2790 |
|
|
2791 |
// Start linuxsampler server... |
// Start linuxsampler server... |
2792 |
void MainForm::startServer (void) |
void MainForm::startServer (void) |
2823 |
bForceServerStop = true; |
bForceServerStop = true; |
2824 |
|
|
2825 |
// Setup stdout/stderr capture... |
// Setup stdout/stderr capture... |
2826 |
// if (m_pOptions->bStdoutCapture) { |
m_pServer->setProcessChannelMode(QProcess::ForwardedChannels); |
2827 |
m_pServer->setProcessChannelMode(QProcess::ForwardedChannels); |
QObject::connect(m_pServer, |
2828 |
QObject::connect(m_pServer, |
SIGNAL(readyReadStandardOutput()), |
2829 |
SIGNAL(readyReadStandardOutput()), |
SLOT(readServerStdout())); |
2830 |
SLOT(readServerStdout())); |
QObject::connect(m_pServer, |
2831 |
QObject::connect(m_pServer, |
SIGNAL(readyReadStandardError()), |
2832 |
SIGNAL(readyReadStandardError()), |
SLOT(readServerStdout())); |
|
SLOT(readServerStdout())); |
|
|
// } |
|
2833 |
|
|
2834 |
// The unforgiveable signal communication... |
// The unforgiveable signal communication... |
2835 |
QObject::connect(m_pServer, |
QObject::connect(m_pServer, |
2950 |
|
|
2951 |
|
|
2952 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
2953 |
// qsamplerMainForm -- Client stuff. |
// QSampler::MainForm -- Client stuff. |
2954 |
|
|
2955 |
// The LSCP client callback procedure. |
// The LSCP client callback procedure. |
2956 |
lscp_status_t qsampler_client_callback ( lscp_client_t */*pClient*/, |
lscp_status_t qsampler_client_callback ( lscp_client_t */*pClient*/, |