44 |
|
|
45 |
#include "config.h" |
#include "config.h" |
46 |
|
|
47 |
|
#ifdef HAVE_SIGNAL_H |
48 |
|
#include <signal.h> |
49 |
|
#endif |
50 |
|
|
51 |
// Timer constant stuff. |
// Timer constant stuff. |
52 |
#define QSAMPLER_TIMER_MSECS 200 |
#define QSAMPLER_TIMER_MSECS 200 |
119 |
|
|
120 |
m_iTimerSlot = 0; |
m_iTimerSlot = 0; |
121 |
|
|
122 |
|
#ifdef HAVE_SIGNAL_H |
123 |
|
// Set to ignore any fatal "Broken pipe" signals. |
124 |
|
::signal(SIGPIPE, SIG_IGN); |
125 |
|
#endif |
126 |
|
|
127 |
// Make it an MDI workspace. |
// Make it an MDI workspace. |
128 |
m_pWorkspace = new QWorkspace(this); |
m_pWorkspace = new QWorkspace(this); |
129 |
m_pWorkspace->setScrollBarsEnabled(true); |
m_pWorkspace->setScrollBarsEnabled(true); |
552 |
appendMessagesError(tr("Some setttings could not be loaded\nfrom \"%1\" session file.\n\nSorry.").arg(sFilename)); |
appendMessagesError(tr("Some setttings could not be loaded\nfrom \"%1\" session file.\n\nSorry.").arg(sFilename)); |
553 |
|
|
554 |
// Now we'll try to create the whole GUI session. |
// Now we'll try to create the whole GUI session. |
555 |
int iChannels = ::lscp_get_channels(m_pClient); |
int *piChannelIDs = ::lscp_list_channels(m_pClient); |
556 |
if (iChannels < 0) { |
if (piChannelIDs == NULL) { |
557 |
appendMessagesClient("lscp_get_channels"); |
appendMessagesClient("lscp_list_channels"); |
558 |
appendMessagesError(tr("Could not get current number of channels.\n\nSorry.")); |
appendMessagesError(tr("Could not get current list of channels.\n\nSorry.")); |
559 |
} |
} |
560 |
|
|
561 |
// Try to (re)create each channel. |
// Try to (re)create each channel. |
562 |
m_pWorkspace->setUpdatesEnabled(false); |
m_pWorkspace->setUpdatesEnabled(false); |
563 |
for (int iChannelID = 0; iChannelID < iChannels; iChannelID++) { |
for (int iChannel = 0; piChannelIDs[iChannel] >= 0; iChannel++) { |
564 |
createChannelStrip(iChannelID); |
createChannelStrip(new qsamplerChannel(this, piChannelIDs[iChannel])); |
565 |
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
566 |
} |
} |
567 |
m_pWorkspace->setUpdatesEnabled(true); |
m_pWorkspace->setUpdatesEnabled(true); |
575 |
m_sFilename = sFilename; |
m_sFilename = sFilename; |
576 |
updateRecentFiles(sFilename); |
updateRecentFiles(sFilename); |
577 |
appendMessages(tr("Open session: \"%1\".").arg(sessionName(m_sFilename))); |
appendMessages(tr("Open session: \"%1\".").arg(sessionName(m_sFilename))); |
578 |
|
|
579 |
|
// Make that an overall update. |
580 |
|
m_iChangeCount++; |
581 |
stabilizeForm(); |
stabilizeForm(); |
582 |
return true; |
return true; |
583 |
} |
} |
622 |
ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannelID << " " << pChannel->midiDriver() << endl; |
ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannelID << " " << pChannel->midiDriver() << endl; |
623 |
ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannelID << " " << pChannel->midiPort() << endl; |
ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannelID << " " << pChannel->midiPort() << endl; |
624 |
ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannelID << " "; |
ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannelID << " "; |
625 |
if (pChannel->midiChannel() > 0) |
if (pChannel->midiChannel() == LSCP_MIDI_CHANNEL_ALL) |
|
ts << pChannel->midiChannel(); |
|
|
else |
|
626 |
ts << "ALL"; |
ts << "ALL"; |
627 |
|
else |
628 |
|
ts << pChannel->midiChannel(); |
629 |
ts << endl; |
ts << endl; |
630 |
ts << "LOAD ENGINE " << pChannel->engineName() << " " << iChannelID << endl; |
ts << "LOAD ENGINE " << pChannel->engineName() << " " << iChannelID << endl; |
631 |
ts << "LOAD INSTRUMENT NON_MODAL '" << pChannel->instrumentFile() << "' " << pChannel->instrumentNr() << " " << iChannelID << endl; |
ts << "LOAD INSTRUMENT NON_MODAL '" << pChannel->instrumentFile() << "' " << pChannel->instrumentNr() << " " << iChannelID << endl; |
779 |
if (m_pClient == NULL) |
if (m_pClient == NULL) |
780 |
return; |
return; |
781 |
|
|
782 |
// Just create the channel strip, |
// Just create the channel instance... |
783 |
// by giving an invalid channel id. |
qsamplerChannel *pChannel = new qsamplerChannel(this); |
784 |
createChannelStrip(-1); |
if (pChannel == NULL) |
785 |
|
return; |
786 |
|
|
787 |
|
// Before we show it up, may be we'll |
788 |
|
// better ask for some initial values? |
789 |
|
if (!pChannel->channelSetup(this)) { |
790 |
|
delete pChannel; |
791 |
|
return; |
792 |
|
} |
793 |
|
|
794 |
|
// And give it to the strip (will own the channel instance, if successful). |
795 |
|
if (!createChannelStrip(pChannel)) { |
796 |
|
delete pChannel; |
797 |
|
return; |
798 |
|
} |
799 |
|
|
800 |
|
// Make that an overall update. |
801 |
|
m_iDirtyCount++; |
802 |
|
m_iChangeCount++; |
803 |
|
stabilizeForm(); |
804 |
} |
} |
805 |
|
|
806 |
|
|
878 |
// Reset the existing sampler channel. |
// Reset the existing sampler channel. |
879 |
pChannel->resetChannel(); |
pChannel->resetChannel(); |
880 |
|
|
|
// Refresh channel strip info. |
|
|
pChannelStrip->updateChannelInfo(); |
|
881 |
// And force a deferred update. |
// And force a deferred update. |
882 |
m_iChangeCount++; |
m_iChangeCount++; |
883 |
} |
} |
1385 |
// qsamplerMainForm -- MDI channel strip management. |
// qsamplerMainForm -- MDI channel strip management. |
1386 |
|
|
1387 |
// The channel strip creation executive. |
// The channel strip creation executive. |
1388 |
qsamplerChannelStrip *qsamplerMainForm::createChannelStrip ( int iChannelID ) |
qsamplerChannelStrip *qsamplerMainForm::createChannelStrip ( qsamplerChannel *pChannel ) |
1389 |
{ |
{ |
1390 |
if (m_pClient == NULL) |
if (m_pClient == NULL || pChannel == NULL) |
1391 |
return NULL; |
return NULL; |
1392 |
|
|
1393 |
// Prepare for auto-arrange? |
// Prepare for auto-arrange? |
1405 |
// Add a new channel itema... |
// Add a new channel itema... |
1406 |
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; |
1407 |
pChannelStrip = new qsamplerChannelStrip(m_pWorkspace, 0, wflags); |
pChannelStrip = new qsamplerChannelStrip(m_pWorkspace, 0, wflags); |
1408 |
// Actual channel setup. |
if (pChannelStrip == NULL) |
|
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 (iChannelID < 0 && !pChannelStrip->channelSetup()) { |
|
|
// No luck, bail out... |
|
|
delete pChannelStrip; |
|
1409 |
return NULL; |
return NULL; |
1410 |
} |
|
1411 |
|
// Actual channel strip setup... |
1412 |
|
pChannelStrip->setup(pChannel); |
1413 |
|
QObject::connect(pChannelStrip, SIGNAL(channelChanged(qsamplerChannelStrip *)), this, SLOT(channelStripChanged(qsamplerChannelStrip *))); |
1414 |
// Set some initial aesthetic options... |
// Set some initial aesthetic options... |
1415 |
if (m_pOptions) { |
if (m_pOptions) { |
1416 |
// Background display effect... |
// Background display effect... |