2 |
// |
// |
3 |
// ui.h extension file, included from the uic-generated form implementation. |
// ui.h extension file, included from the uic-generated form implementation. |
4 |
/**************************************************************************** |
/**************************************************************************** |
5 |
Copyright (C) 2004, rncbc aka Rui Nuno Capela. All rights reserved. |
Copyright (C) 2004-2005, rncbc aka Rui Nuno Capela. All rights reserved. |
6 |
|
|
7 |
This program is free software; you can redistribute it and/or |
This program is free software; you can redistribute it and/or |
8 |
modify it under the terms of the GNU General Public License |
modify it under the terms of the GNU General Public License |
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); |
205 |
// We got options? |
// We got options? |
206 |
m_pOptions = pOptions; |
m_pOptions = pOptions; |
207 |
|
|
208 |
|
// Set initial instrument name display mode. |
209 |
|
qsamplerChannel::setInstrumentNames(m_pOptions->bInstrumentNames); |
210 |
|
|
211 |
// Some child forms are to be created right now. |
// Some child forms are to be created right now. |
212 |
m_pMessages = new qsamplerMessages(this); |
m_pMessages = new qsamplerMessages(this); |
213 |
// Set message defaults... |
// Set message defaults... |
555 |
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)); |
556 |
|
|
557 |
// Now we'll try to create the whole GUI session. |
// Now we'll try to create the whole GUI session. |
558 |
int iChannels = ::lscp_get_channels(m_pClient); |
int *piChannelIDs = ::lscp_list_channels(m_pClient); |
559 |
if (iChannels < 0) { |
if (piChannelIDs == NULL) { |
560 |
appendMessagesClient("lscp_get_channels"); |
appendMessagesClient("lscp_list_channels"); |
561 |
appendMessagesError(tr("Could not get current number of channels.\n\nSorry.")); |
appendMessagesError(tr("Could not get current list of channels.\n\nSorry.")); |
562 |
} |
} |
563 |
|
|
564 |
// Try to (re)create each channel. |
// Try to (re)create each channel. |
565 |
m_pWorkspace->setUpdatesEnabled(false); |
m_pWorkspace->setUpdatesEnabled(false); |
566 |
for (int iChannelID = 0; iChannelID < iChannels; iChannelID++) { |
for (int iChannel = 0; piChannelIDs[iChannel] >= 0; iChannel++) { |
567 |
createChannelStrip(iChannelID); |
createChannelStrip(new qsamplerChannel(this, piChannelIDs[iChannel])); |
568 |
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
569 |
} |
} |
570 |
m_pWorkspace->setUpdatesEnabled(true); |
m_pWorkspace->setUpdatesEnabled(true); |
578 |
m_sFilename = sFilename; |
m_sFilename = sFilename; |
579 |
updateRecentFiles(sFilename); |
updateRecentFiles(sFilename); |
580 |
appendMessages(tr("Open session: \"%1\".").arg(sessionName(m_sFilename))); |
appendMessages(tr("Open session: \"%1\".").arg(sessionName(m_sFilename))); |
581 |
|
|
582 |
|
// Make that an overall update. |
583 |
|
m_iChangeCount++; |
584 |
stabilizeForm(); |
stabilizeForm(); |
585 |
return true; |
return true; |
586 |
} |
} |
625 |
ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannelID << " " << pChannel->midiDriver() << endl; |
ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannelID << " " << pChannel->midiDriver() << endl; |
626 |
ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannelID << " " << pChannel->midiPort() << endl; |
ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannelID << " " << pChannel->midiPort() << endl; |
627 |
ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannelID << " "; |
ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannelID << " "; |
628 |
if (pChannel->midiChannel() > 0) |
if (pChannel->midiChannel() == LSCP_MIDI_CHANNEL_ALL) |
|
ts << pChannel->midiChannel(); |
|
|
else |
|
629 |
ts << "ALL"; |
ts << "ALL"; |
630 |
|
else |
631 |
|
ts << pChannel->midiChannel(); |
632 |
ts << endl; |
ts << endl; |
633 |
ts << "LOAD ENGINE " << pChannel->engineName() << " " << iChannelID << endl; |
ts << "LOAD ENGINE " << pChannel->engineName() << " " << iChannelID << endl; |
634 |
ts << "LOAD INSTRUMENT NON_MODAL '" << pChannel->instrumentFile() << "' " << pChannel->instrumentNr() << " " << iChannelID << endl; |
ts << "LOAD INSTRUMENT NON_MODAL '" << pChannel->instrumentFile() << "' " << pChannel->instrumentNr() << " " << iChannelID << endl; |
782 |
if (m_pClient == NULL) |
if (m_pClient == NULL) |
783 |
return; |
return; |
784 |
|
|
785 |
// Just create the channel strip, |
// Just create the channel instance... |
786 |
// by giving an invalid channel id. |
qsamplerChannel *pChannel = new qsamplerChannel(this); |
787 |
createChannelStrip(-1); |
if (pChannel == NULL) |
788 |
|
return; |
789 |
|
|
790 |
|
// Before we show it up, may be we'll |
791 |
|
// better ask for some initial values? |
792 |
|
if (!pChannel->channelSetup(this)) { |
793 |
|
delete pChannel; |
794 |
|
return; |
795 |
|
} |
796 |
|
|
797 |
|
// And give it to the strip (will own the channel instance, if successful). |
798 |
|
if (!createChannelStrip(pChannel)) { |
799 |
|
delete pChannel; |
800 |
|
return; |
801 |
|
} |
802 |
|
|
803 |
|
// Make that an overall update. |
804 |
|
m_iDirtyCount++; |
805 |
|
m_iChangeCount++; |
806 |
|
stabilizeForm(); |
807 |
} |
} |
808 |
|
|
809 |
|
|
881 |
// Reset the existing sampler channel. |
// Reset the existing sampler channel. |
882 |
pChannel->resetChannel(); |
pChannel->resetChannel(); |
883 |
|
|
|
// Refresh channel strip info. |
|
|
pChannelStrip->updateChannelInfo(); |
|
884 |
// And force a deferred update. |
// And force a deferred update. |
885 |
m_iChangeCount++; |
m_iChangeCount++; |
886 |
} |
} |
963 |
int iOldMessagesLimitLines = m_pOptions->iMessagesLimitLines; |
int iOldMessagesLimitLines = m_pOptions->iMessagesLimitLines; |
964 |
bool bOldCompletePath = m_pOptions->bCompletePath; |
bool bOldCompletePath = m_pOptions->bCompletePath; |
965 |
int iOldMaxRecentFiles = m_pOptions->iMaxRecentFiles; |
int iOldMaxRecentFiles = m_pOptions->iMaxRecentFiles; |
966 |
|
bool bOldInstrumentNames = m_pOptions->bInstrumentNames; |
967 |
// Load the current setup settings. |
// Load the current setup settings. |
968 |
pOptionsForm->setup(m_pOptions); |
pOptionsForm->setup(m_pOptions); |
969 |
// Show the setup dialog... |
// Show the setup dialog... |
977 |
updateMessagesCapture(); |
updateMessagesCapture(); |
978 |
} |
} |
979 |
// Check wheather something immediate has changed. |
// Check wheather something immediate has changed. |
980 |
|
if (( bOldInstrumentNames && !m_pOptions->bInstrumentNames) || |
981 |
|
(!bOldInstrumentNames && m_pOptions->bInstrumentNames)) |
982 |
|
qsamplerChannel::setInstrumentNames(m_pOptions->bInstrumentNames); |
983 |
if (( bOldCompletePath && !m_pOptions->bCompletePath) || |
if (( bOldCompletePath && !m_pOptions->bCompletePath) || |
984 |
(!bOldCompletePath && m_pOptions->bCompletePath) || |
(!bOldCompletePath && m_pOptions->bCompletePath) || |
985 |
(iOldMaxRecentFiles != m_pOptions->iMaxRecentFiles)) |
(iOldMaxRecentFiles != m_pOptions->iMaxRecentFiles)) |
1392 |
// qsamplerMainForm -- MDI channel strip management. |
// qsamplerMainForm -- MDI channel strip management. |
1393 |
|
|
1394 |
// The channel strip creation executive. |
// The channel strip creation executive. |
1395 |
qsamplerChannelStrip *qsamplerMainForm::createChannelStrip ( int iChannelID ) |
qsamplerChannelStrip *qsamplerMainForm::createChannelStrip ( qsamplerChannel *pChannel ) |
1396 |
{ |
{ |
1397 |
if (m_pClient == NULL) |
if (m_pClient == NULL || pChannel == NULL) |
1398 |
return NULL; |
return NULL; |
1399 |
|
|
1400 |
// Prepare for auto-arrange? |
// Prepare for auto-arrange? |
1412 |
// Add a new channel itema... |
// Add a new channel itema... |
1413 |
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; |
1414 |
pChannelStrip = new qsamplerChannelStrip(m_pWorkspace, 0, wflags); |
pChannelStrip = new qsamplerChannelStrip(m_pWorkspace, 0, wflags); |
1415 |
// 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; |
|
1416 |
return NULL; |
return NULL; |
1417 |
} |
|
1418 |
|
// Actual channel strip setup... |
1419 |
|
pChannelStrip->setup(pChannel); |
1420 |
|
QObject::connect(pChannelStrip, SIGNAL(channelChanged(qsamplerChannelStrip *)), this, SLOT(channelStripChanged(qsamplerChannelStrip *))); |
1421 |
// Set some initial aesthetic options... |
// Set some initial aesthetic options... |
1422 |
if (m_pOptions) { |
if (m_pOptions) { |
1423 |
// Background display effect... |
// Background display effect... |