1 |
// qsamplerMainForm.cpp |
// qsamplerMainForm.cpp |
2 |
// |
// |
3 |
/**************************************************************************** |
/**************************************************************************** |
4 |
Copyright (C) 2004-2012, rncbc aka Rui Nuno Capela. All rights reserved. |
Copyright (C) 2004-2013, rncbc aka Rui Nuno Capela. All rights reserved. |
5 |
Copyright (C) 2007, 2008 Christian Schoenebeck |
Copyright (C) 2007, 2008 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 |
65 |
#if QT_VERSION < 0x040500 |
#if QT_VERSION < 0x040500 |
66 |
namespace Qt { |
namespace Qt { |
67 |
const WindowFlags WindowCloseButtonHint = WindowFlags(0x08000000); |
const WindowFlags WindowCloseButtonHint = WindowFlags(0x08000000); |
|
#if QT_VERSION < 0x040200 |
|
|
const WindowFlags CustomizeWindowHint = WindowFlags(0x02000000); |
|
|
#endif |
|
68 |
} |
} |
69 |
#endif |
#endif |
70 |
|
|
273 |
|
|
274 |
// Make it an MDI workspace. |
// Make it an MDI workspace. |
275 |
m_pWorkspace = new QMdiArea(this); |
m_pWorkspace = new QMdiArea(this); |
276 |
|
m_pWorkspace->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); |
277 |
|
m_pWorkspace->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); |
278 |
// Set the activation connection. |
// Set the activation connection. |
279 |
QObject::connect(m_pWorkspace, |
QObject::connect(m_pWorkspace, |
280 |
SIGNAL(subWindowActivated(QMdiSubWindow *)), |
SIGNAL(subWindowActivated(QMdiSubWindow *)), |
906 |
pChannel->removeChannel(); |
pChannel->removeChannel(); |
907 |
delete pChannelStrip; |
delete pChannelStrip; |
908 |
} |
} |
909 |
|
if (pMdiSubWindow) |
910 |
|
delete pMdiSubWindow; |
911 |
} |
} |
912 |
m_pWorkspace->setUpdatesEnabled(true); |
m_pWorkspace->setUpdatesEnabled(true); |
913 |
// We're now clean, for sure. |
// We're now clean, for sure. |
1251 |
ts << "SET CHANNEL MUTE " << iChannel << " 1" << endl; |
ts << "SET CHANNEL MUTE " << iChannel << " 1" << endl; |
1252 |
if (pChannel->channelSolo()) |
if (pChannel->channelSolo()) |
1253 |
ts << "SET CHANNEL SOLO " << iChannel << " 1" << endl; |
ts << "SET CHANNEL SOLO " << iChannel << " 1" << endl; |
1254 |
#ifdef CONFIG_MIDI_INSTRUMENT |
#ifdef CONFIG_MIDI_INSTRUMENT |
1255 |
if (pChannel->midiMap() >= 0) { |
if (pChannel->midiMap() >= 0) { |
1256 |
ts << "SET CHANNEL MIDI_INSTRUMENT_MAP " << iChannel |
ts << "SET CHANNEL MIDI_INSTRUMENT_MAP " << iChannel |
1257 |
<< " " << midiInstrumentMap[pChannel->midiMap()] << endl; |
<< " " << midiInstrumentMap[pChannel->midiMap()] << endl; |
1258 |
} |
} |
1259 |
#endif |
#endif |
1260 |
#ifdef CONFIG_FXSEND |
#ifdef CONFIG_FXSEND |
1261 |
int iChannelID = pChannel->channelID(); |
int iChannelID = pChannel->channelID(); |
1262 |
int *piFxSends = ::lscp_list_fxsends(m_pClient, iChannelID); |
int *piFxSends = ::lscp_list_fxsends(m_pClient, iChannelID); |
1263 |
for (int iFxSend = 0; |
for (int iFxSend = 0; |
1281 |
<< " " << iAudioSrc |
<< " " << iAudioSrc |
1282 |
<< " " << piRouting[iAudioSrc] << endl; |
<< " " << piRouting[iAudioSrc] << endl; |
1283 |
} |
} |
1284 |
#ifdef CONFIG_FXSEND_LEVEL |
#ifdef CONFIG_FXSEND_LEVEL |
1285 |
ts << "SET FX_SEND LEVEL " << iChannel |
ts << "SET FX_SEND LEVEL " << iChannel |
1286 |
<< " " << iFxSend |
<< " " << iFxSend |
1287 |
<< " " << pFxSendInfo->level << endl; |
<< " " << pFxSendInfo->level << endl; |
1288 |
#endif |
#endif |
1289 |
} // Check for errors... |
} // Check for errors... |
1290 |
else if (::lscp_client_get_errno(m_pClient)) { |
else if (::lscp_client_get_errno(m_pClient)) { |
1291 |
appendMessagesClient("lscp_get_fxsend_info"); |
appendMessagesClient("lscp_get_fxsend_info"); |
1292 |
iErrors++; |
iErrors++; |
1293 |
} |
} |
1294 |
} |
} |
1295 |
#endif |
#endif |
1296 |
ts << endl; |
ts << endl; |
1297 |
} |
} |
1298 |
} |
} |
1542 |
if (!pChannel->removeChannel()) |
if (!pChannel->removeChannel()) |
1543 |
return; |
return; |
1544 |
|
|
|
// Just delete the channel strip. |
|
|
delete pChannelStrip; |
|
|
|
|
|
// Do we auto-arrange? |
|
|
if (m_pOptions && m_pOptions->bAutoArrange) |
|
|
channelsArrange(); |
|
|
|
|
1545 |
// We'll be dirty, for sure... |
// We'll be dirty, for sure... |
1546 |
m_iDirtyCount++; |
m_iDirtyCount++; |
1547 |
stabilizeForm(); |
|
1548 |
|
// Just delete the channel strip. |
1549 |
|
destroyChannelStrip(pChannelStrip); |
1550 |
} |
} |
1551 |
|
|
1552 |
|
|
2443 |
} |
} |
2444 |
|
|
2445 |
// Add it to workspace... |
// Add it to workspace... |
2446 |
m_pWorkspace->addSubWindow(pChannelStrip, Qt::FramelessWindowHint); |
m_pWorkspace->addSubWindow(pChannelStrip, |
2447 |
|
Qt::SubWindow | Qt::FramelessWindowHint); |
2448 |
|
|
2449 |
// Actual channel strip setup... |
// Actual channel strip setup... |
2450 |
pChannelStrip->setup(pChannel); |
pChannelStrip->setup(pChannel); |
2466 |
|
|
2467 |
void MainForm::destroyChannelStrip ( ChannelStrip *pChannelStrip ) |
void MainForm::destroyChannelStrip ( ChannelStrip *pChannelStrip ) |
2468 |
{ |
{ |
2469 |
|
QMdiSubWindow *pMdiSubWindow |
2470 |
|
= static_cast<QMdiSubWindow *> (pChannelStrip->parentWidget()); |
2471 |
|
if (pMdiSubWindow == NULL) |
2472 |
|
return; |
2473 |
|
|
2474 |
// Just delete the channel strip. |
// Just delete the channel strip. |
2475 |
delete pChannelStrip; |
delete pChannelStrip; |
2476 |
|
delete pMdiSubWindow; |
2477 |
|
|
2478 |
// Do we auto-arrange? |
// Do we auto-arrange? |
2479 |
if (m_pOptions && m_pOptions->bAutoArrange) |
if (m_pOptions && m_pOptions->bAutoArrange) |
2692 |
|
|
2693 |
// Setup stdout/stderr capture... |
// Setup stdout/stderr capture... |
2694 |
// if (m_pOptions->bStdoutCapture) { |
// if (m_pOptions->bStdoutCapture) { |
|
#if QT_VERSION >= 0x040200 |
|
2695 |
m_pServer->setProcessChannelMode(QProcess::ForwardedChannels); |
m_pServer->setProcessChannelMode(QProcess::ForwardedChannels); |
|
#endif |
|
2696 |
QObject::connect(m_pServer, |
QObject::connect(m_pServer, |
2697 |
SIGNAL(readyReadStandardOutput()), |
SIGNAL(readyReadStandardOutput()), |
2698 |
SLOT(readServerStdout())); |
SLOT(readServerStdout())); |
2757 |
if (m_pServer && bForceServerStop) { |
if (m_pServer && bForceServerStop) { |
2758 |
appendMessages(tr("Server is stopping...")); |
appendMessages(tr("Server is stopping...")); |
2759 |
if (m_pServer->state() == QProcess::Running) { |
if (m_pServer->state() == QProcess::Running) { |
2760 |
#if defined(WIN32) |
#if defined(WIN32) |
2761 |
// Try harder... |
// Try harder... |
2762 |
m_pServer->kill(); |
m_pServer->kill(); |
2763 |
#else |
#else |
2764 |
// Try softly... |
// Try softly... |
2765 |
m_pServer->terminate(); |
m_pServer->terminate(); |
2766 |
#endif |
#endif |
2767 |
} |
} |
2768 |
} // Do final processing anyway. |
} // Do final processing anyway. |
2769 |
else processServerExit(); |
else processServerExit(); |