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-2005, rncbc aka Rui Nuno Capela. All rights reserved. |
Copyright (C) 2004-2007, 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 |
14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
GNU General Public License for more details. |
GNU General Public License for more details. |
16 |
|
|
17 |
You should have received a copy of the GNU General Public License |
You should have received a copy of the GNU General Public License along |
18 |
along with this program; if not, write to the Free Software |
with this program; if not, write to the Free Software Foundation, Inc., |
19 |
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
20 |
|
|
21 |
*****************************************************************************/ |
*****************************************************************************/ |
22 |
|
|
32 |
#include <qfile.h> |
#include <qfile.h> |
33 |
#include <qtextstream.h> |
#include <qtextstream.h> |
34 |
#include <qstatusbar.h> |
#include <qstatusbar.h> |
35 |
|
#include <qslider.h> |
36 |
|
#include <qspinbox.h> |
37 |
#include <qlabel.h> |
#include <qlabel.h> |
38 |
#include <qtimer.h> |
#include <qtimer.h> |
39 |
|
#include <qtooltip.h> |
40 |
|
|
41 |
#include "qsamplerAbout.h" |
#include "qsamplerAbout.h" |
42 |
#include "qsamplerOptions.h" |
#include "qsamplerOptions.h" |
44 |
#include "qsamplerMessages.h" |
#include "qsamplerMessages.h" |
45 |
|
|
46 |
#include "qsamplerChannelStrip.h" |
#include "qsamplerChannelStrip.h" |
47 |
|
#include "qsamplerInstrumentList.h" |
48 |
|
|
49 |
|
#include "qsamplerInstrumentListForm.h" |
50 |
#include "qsamplerDeviceForm.h" |
#include "qsamplerDeviceForm.h" |
51 |
#include "qsamplerOptionsForm.h" |
#include "qsamplerOptionsForm.h" |
52 |
|
|
58 |
#include <gig.h> |
#include <gig.h> |
59 |
#endif |
#endif |
60 |
|
|
61 |
|
// Needed for lroundf() |
62 |
|
#include <math.h> |
63 |
|
|
64 |
|
#ifndef CONFIG_ROUND |
65 |
|
static inline long lroundf ( float x ) |
66 |
|
{ |
67 |
|
if (x >= 0.0f) |
68 |
|
return long(x + 0.5f); |
69 |
|
else |
70 |
|
return long(x - 0.5f); |
71 |
|
} |
72 |
|
#endif |
73 |
|
|
74 |
// Timer constant stuff. |
// Timer constant stuff. |
75 |
#define QSAMPLER_TIMER_MSECS 200 |
#define QSAMPLER_TIMER_MSECS 200 |
76 |
|
|
120 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
121 |
// qsamplerMainForm -- Main window form implementation. |
// qsamplerMainForm -- Main window form implementation. |
122 |
|
|
123 |
|
// Kind of singleton reference. |
124 |
|
qsamplerMainForm *qsamplerMainForm::g_pMainForm = NULL; |
125 |
|
|
126 |
|
|
127 |
// Kind of constructor. |
// Kind of constructor. |
128 |
void qsamplerMainForm::init (void) |
void qsamplerMainForm::init (void) |
129 |
{ |
{ |
130 |
|
// Pseudo-singleton reference setup. |
131 |
|
g_pMainForm = this; |
132 |
|
|
133 |
// Initialize some pointer references. |
// Initialize some pointer references. |
134 |
m_pOptions = NULL; |
m_pOptions = NULL; |
135 |
|
|
136 |
// All child forms are to be created later, not earlier than setup. |
// All child forms are to be created later, not earlier than setup. |
137 |
m_pMessages = NULL; |
m_pMessages = NULL; |
138 |
|
m_pInstrumentListForm = NULL; |
139 |
m_pDeviceForm = NULL; |
m_pDeviceForm = NULL; |
140 |
|
|
141 |
// We'll start clean. |
// We'll start clean. |
155 |
::signal(SIGPIPE, SIG_IGN); |
::signal(SIGPIPE, SIG_IGN); |
156 |
#endif |
#endif |
157 |
|
|
158 |
|
#ifdef CONFIG_VOLUME |
159 |
|
// Make some extras into the toolbar... |
160 |
|
const QString& sVolumeText = tr("Master volume"); |
161 |
|
m_iVolumeChanging = 0; |
162 |
|
// Volume slider... |
163 |
|
channelsToolbar->addSeparator(); |
164 |
|
m_pVolumeSlider = new QSlider(Qt::Horizontal, channelsToolbar); |
165 |
|
m_pVolumeSlider->setTickmarks(QSlider::Below); |
166 |
|
m_pVolumeSlider->setTickInterval(10); |
167 |
|
m_pVolumeSlider->setPageStep(10); |
168 |
|
m_pVolumeSlider->setRange(0, 100); |
169 |
|
m_pVolumeSlider->setMaximumHeight(22); |
170 |
|
m_pVolumeSlider->setMinimumWidth(160); |
171 |
|
QToolTip::add(m_pVolumeSlider, sVolumeText); |
172 |
|
QObject::connect(m_pVolumeSlider, |
173 |
|
SIGNAL(valueChanged(int)), |
174 |
|
SLOT(volumeChanged(int))); |
175 |
|
channelsToolbar->setHorizontallyStretchable(true); |
176 |
|
channelsToolbar->setStretchableWidget(m_pVolumeSlider); |
177 |
|
// Volume spin-box |
178 |
|
channelsToolbar->addSeparator(); |
179 |
|
m_pVolumeSpinBox = new QSpinBox(channelsToolbar); |
180 |
|
m_pVolumeSpinBox->setSuffix(" %"); |
181 |
|
m_pVolumeSpinBox->setRange(0, 100); |
182 |
|
QToolTip::add(m_pVolumeSpinBox, sVolumeText); |
183 |
|
QObject::connect(m_pVolumeSpinBox, |
184 |
|
SIGNAL(valueChanged(int)), |
185 |
|
SLOT(volumeChanged(int))); |
186 |
|
#endif |
187 |
|
|
188 |
// Make it an MDI workspace. |
// Make it an MDI workspace. |
189 |
m_pWorkspace = new QWorkspace(this); |
m_pWorkspace = new QWorkspace(this); |
190 |
m_pWorkspace->setScrollBarsEnabled(true); |
m_pWorkspace->setScrollBarsEnabled(true); |
191 |
// Set the activation connection. |
// Set the activation connection. |
192 |
QObject::connect(m_pWorkspace, SIGNAL(windowActivated(QWidget *)), this, SLOT(stabilizeForm())); |
QObject::connect(m_pWorkspace, |
193 |
|
SIGNAL(windowActivated(QWidget *)), |
194 |
|
SLOT(stabilizeForm())); |
195 |
// Make it shine :-) |
// Make it shine :-) |
196 |
setCentralWidget(m_pWorkspace); |
setCentralWidget(m_pWorkspace); |
197 |
|
|
244 |
// Finally drop any widgets around... |
// Finally drop any widgets around... |
245 |
if (m_pDeviceForm) |
if (m_pDeviceForm) |
246 |
delete m_pDeviceForm; |
delete m_pDeviceForm; |
247 |
|
if (m_pInstrumentListForm) |
248 |
|
delete m_pInstrumentListForm; |
249 |
if (m_pMessages) |
if (m_pMessages) |
250 |
delete m_pMessages; |
delete m_pMessages; |
251 |
if (m_pWorkspace) |
if (m_pWorkspace) |
261 |
if (m_statusItem[QSAMPLER_STATUS_SESSION]) |
if (m_statusItem[QSAMPLER_STATUS_SESSION]) |
262 |
delete m_statusItem[QSAMPLER_STATUS_SESSION]; |
delete m_statusItem[QSAMPLER_STATUS_SESSION]; |
263 |
|
|
264 |
|
#ifdef CONFIG_VOLUME |
265 |
|
delete m_pVolumeSpinBox; |
266 |
|
delete m_pVolumeSlider; |
267 |
|
#endif |
268 |
|
|
269 |
// Delete recentfiles menu. |
// Delete recentfiles menu. |
270 |
if (m_pRecentFilesMenu) |
if (m_pRecentFilesMenu) |
271 |
delete m_pRecentFilesMenu; |
delete m_pRecentFilesMenu; |
272 |
|
|
273 |
|
// Pseudo-singleton reference shut-down. |
274 |
|
g_pMainForm = NULL; |
275 |
} |
} |
276 |
|
|
277 |
|
|
282 |
m_pOptions = pOptions; |
m_pOptions = pOptions; |
283 |
|
|
284 |
// What style do we create these forms? |
// What style do we create these forms? |
285 |
WFlags wflags = Qt::WType_TopLevel; |
Qt::WFlags wflags = Qt::WStyle_Customize |
286 |
|
| Qt::WStyle_NormalBorder |
287 |
|
| Qt::WStyle_Title |
288 |
|
| Qt::WStyle_SysMenu |
289 |
|
| Qt::WStyle_MinMax |
290 |
|
| Qt::WType_TopLevel; |
291 |
if (m_pOptions->bKeepOnTop) |
if (m_pOptions->bKeepOnTop) |
292 |
wflags |= Qt::WStyle_Tool; |
wflags |= Qt::WStyle_Tool; |
293 |
// Some child forms are to be created right now. |
// Some child forms are to be created right now. |
294 |
m_pMessages = new qsamplerMessages(this); |
m_pMessages = new qsamplerMessages(this); |
295 |
m_pDeviceForm = new qsamplerDeviceForm(this, 0, wflags); |
m_pDeviceForm = new qsamplerDeviceForm(this, 0, wflags); |
296 |
m_pDeviceForm->setMainForm(this); // An important life immutable! |
#ifdef CONFIG_MIDI_INSTRUMENT |
297 |
|
m_pInstrumentListForm = new qsamplerInstrumentListForm(this, 0, wflags); |
298 |
|
QObject::connect(m_pInstrumentListForm->InstrumentList, |
299 |
|
SIGNAL(instrumentsChanged()), |
300 |
|
SLOT(sessionDirty())); |
301 |
|
#else |
302 |
|
viewInstrumentsAction->setEnabled(false); |
303 |
|
#endif |
304 |
// Set message defaults... |
// Set message defaults... |
305 |
updateMessagesFont(); |
updateMessagesFont(); |
306 |
updateMessagesLimit(); |
updateMessagesLimit(); |
307 |
updateMessagesCapture(); |
updateMessagesCapture(); |
308 |
// Set the visibility signal. |
// Set the visibility signal. |
309 |
QObject::connect(m_pMessages, SIGNAL(visibilityChanged(bool)), this, SLOT(stabilizeForm())); |
QObject::connect(m_pMessages, |
310 |
|
SIGNAL(visibilityChanged(bool)), |
311 |
|
SLOT(stabilizeForm())); |
312 |
|
|
313 |
// Initial decorations toggle state. |
// Initial decorations toggle state. |
314 |
viewMenubarAction->setOn(m_pOptions->bMenubar); |
viewMenubarAction->setOn(m_pOptions->bMenubar); |
333 |
} |
} |
334 |
// Try to restore old window positioning and initial visibility. |
// Try to restore old window positioning and initial visibility. |
335 |
m_pOptions->loadWidgetGeometry(this); |
m_pOptions->loadWidgetGeometry(this); |
336 |
|
m_pOptions->loadWidgetGeometry(m_pInstrumentListForm); |
337 |
m_pOptions->loadWidgetGeometry(m_pDeviceForm); |
m_pOptions->loadWidgetGeometry(m_pDeviceForm); |
338 |
|
|
339 |
// Final startup stabilization... |
// Final startup stabilization... |
340 |
|
updateMaxVolume(); |
341 |
updateRecentFilesMenu(); |
updateRecentFilesMenu(); |
342 |
stabilizeForm(); |
stabilizeForm(); |
343 |
|
|
375 |
m_pOptions->settings().writeEntry("/Layout/DockWindows", sDockables); |
m_pOptions->settings().writeEntry("/Layout/DockWindows", sDockables); |
376 |
// And the children, and the main windows state,. |
// And the children, and the main windows state,. |
377 |
m_pOptions->saveWidgetGeometry(m_pDeviceForm); |
m_pOptions->saveWidgetGeometry(m_pDeviceForm); |
378 |
|
m_pOptions->saveWidgetGeometry(m_pInstrumentListForm); |
379 |
m_pOptions->saveWidgetGeometry(this); |
m_pOptions->saveWidgetGeometry(this); |
380 |
// Close popup widgets. |
// Close popup widgets. |
381 |
|
if (m_pInstrumentListForm) |
382 |
|
m_pInstrumentListForm->close(); |
383 |
if (m_pDeviceForm) |
if (m_pDeviceForm) |
384 |
m_pDeviceForm->close(); |
m_pDeviceForm->close(); |
385 |
// Stop client and/or server, gracefully. |
// Stop client and/or server, gracefully. |
438 |
const QString& sPath = *iter; |
const QString& sPath = *iter; |
439 |
if (qsamplerChannel::isInstrumentFile(sPath)) { |
if (qsamplerChannel::isInstrumentFile(sPath)) { |
440 |
// Try to create a new channel from instrument file... |
// Try to create a new channel from instrument file... |
441 |
qsamplerChannel *pChannel = new qsamplerChannel(this); |
qsamplerChannel *pChannel = new qsamplerChannel(); |
442 |
if (pChannel == NULL) |
if (pChannel == NULL) |
443 |
return; |
return; |
444 |
// Start setting the instrument filename... |
// Start setting the instrument filename... |
458 |
m_iDirtyCount++; |
m_iDirtyCount++; |
459 |
stabilizeForm(); |
stabilizeForm(); |
460 |
} // Otherwise, load an usual session file (LSCP script)... |
} // Otherwise, load an usual session file (LSCP script)... |
461 |
else if (closeSession(true)) |
else if (closeSession(true)) { |
462 |
loadSessionFile(sPath); |
loadSessionFile(sPath); |
463 |
|
break; |
464 |
|
} |
465 |
// Make it look responsive...:) |
// Make it look responsive...:) |
466 |
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
467 |
} |
} |
506 |
return m_pOptions; |
return m_pOptions; |
507 |
} |
} |
508 |
|
|
509 |
|
|
510 |
// The LSCP client descriptor property. |
// The LSCP client descriptor property. |
511 |
lscp_client_t *qsamplerMainForm::client (void) |
lscp_client_t *qsamplerMainForm::client (void) |
512 |
{ |
{ |
514 |
} |
} |
515 |
|
|
516 |
|
|
517 |
|
// The pseudo-singleton instance accessor. |
518 |
|
qsamplerMainForm *qsamplerMainForm::getInstance (void) |
519 |
|
{ |
520 |
|
return g_pMainForm; |
521 |
|
} |
522 |
|
|
523 |
|
|
524 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
525 |
// qsamplerMainForm -- Session file stuff. |
// qsamplerMainForm -- Session file stuff. |
526 |
|
|
692 |
return false; |
return false; |
693 |
} |
} |
694 |
|
|
695 |
|
// Tell the world we'll take some time... |
696 |
|
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); |
697 |
|
|
698 |
// Read the file. |
// Read the file. |
699 |
|
int iLine = 0; |
700 |
int iErrors = 0; |
int iErrors = 0; |
701 |
QTextStream ts(&file); |
QTextStream ts(&file); |
702 |
while (!ts.atEnd()) { |
while (!ts.atEnd()) { |
703 |
// Read the line. |
// Read the line. |
704 |
QString sCommand = ts.readLine().simplifyWhiteSpace(); |
QString sCommand = ts.readLine().stripWhiteSpace(); |
705 |
|
iLine++; |
706 |
// If not empty, nor a comment, call the server... |
// If not empty, nor a comment, call the server... |
707 |
if (!sCommand.isEmpty() && sCommand[0] != '#') { |
if (!sCommand.isEmpty() && sCommand[0] != '#') { |
708 |
appendMessagesColor(sCommand, "#996633"); |
// Remember that, no matter what, |
709 |
// Remember that, no matter what, |
// all LSCP commands are CR/LF terminated. |
710 |
// all LSCP commands are CR/LF terminated. |
sCommand += "\r\n"; |
711 |
sCommand += "\r\n"; |
if (::lscp_client_query(m_pClient, sCommand.latin1()) != LSCP_OK) { |
712 |
if (::lscp_client_query(m_pClient, sCommand.latin1()) != LSCP_OK) { |
appendMessagesColor(QString("%1(%2): %3") |
713 |
appendMessagesClient("lscp_client_query"); |
.arg(QFileInfo(sFilename).fileName()).arg(iLine) |
714 |
iErrors++; |
.arg(sCommand.simplifyWhiteSpace()), "#996633"); |
715 |
} |
appendMessagesClient("lscp_client_query"); |
716 |
|
iErrors++; |
717 |
|
} |
718 |
} |
} |
719 |
// Try to make it snappy :) |
// Try to make it snappy :) |
720 |
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
726 |
// Now we'll try to create (update) the whole GUI session. |
// Now we'll try to create (update) the whole GUI session. |
727 |
updateSession(); |
updateSession(); |
728 |
|
|
729 |
|
// We're fornerly done. |
730 |
|
QApplication::restoreOverrideCursor(); |
731 |
|
|
732 |
// Have we any errors? |
// Have we any errors? |
733 |
if (iErrors > 0) |
if (iErrors > 0) |
734 |
appendMessagesError(tr("Session loaded with errors\nfrom \"%1\".\n\nSorry.").arg(sFilename)); |
appendMessagesError(tr("Session loaded with errors\nfrom \"%1\".\n\nSorry.").arg(sFilename)); |
752 |
// Save current session to specific file path. |
// Save current session to specific file path. |
753 |
bool qsamplerMainForm::saveSessionFile ( const QString& sFilename ) |
bool qsamplerMainForm::saveSessionFile ( const QString& sFilename ) |
754 |
{ |
{ |
755 |
|
if (m_pClient == NULL) |
756 |
|
return false; |
757 |
|
|
758 |
|
// Check whether server is apparently OK... |
759 |
|
if (::lscp_get_channels(m_pClient) < 0) { |
760 |
|
appendMessagesClient("lscp_get_channels"); |
761 |
|
return false; |
762 |
|
} |
763 |
|
|
764 |
// Open and write into real file. |
// Open and write into real file. |
765 |
QFile file(sFilename); |
QFile file(sFilename); |
766 |
if (!file.open(IO_WriteOnly | IO_Truncate)) { |
if (!file.open(IO_WriteOnly | IO_Truncate)) { |
768 |
return false; |
return false; |
769 |
} |
} |
770 |
|
|
771 |
|
// Tell the world we'll take some time... |
772 |
|
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); |
773 |
|
|
774 |
// Write the file. |
// Write the file. |
775 |
int iErrors = 0; |
int iErrors = 0; |
776 |
QTextStream ts(&file); |
QTextStream ts(&file); |
787 |
<< " " << QTime::currentTime().toString("hh:mm:ss") << endl; |
<< " " << QTime::currentTime().toString("hh:mm:ss") << endl; |
788 |
ts << "#" << endl; |
ts << "#" << endl; |
789 |
ts << endl; |
ts << endl; |
790 |
|
|
791 |
// It is assumed that this new kind of device+session file |
// It is assumed that this new kind of device+session file |
792 |
// will be loaded from a complete |
// will be loaded from a complete initialized server... |
793 |
int *piDeviceIDs; |
int *piDeviceIDs; |
794 |
int iDevice; |
int iDevice; |
795 |
ts << "RESET" << endl; |
ts << "RESET" << endl; |
796 |
|
|
797 |
// Audio device mapping. |
// Audio device mapping. |
798 |
QMap<int, int> audioDeviceMap; |
QMap<int, int> audioDeviceMap; |
799 |
piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Audio); |
piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Audio); |
800 |
for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) { |
for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) { |
801 |
ts << endl; |
ts << endl; |
802 |
qsamplerDevice device(this, qsamplerDevice::Audio, piDeviceIDs[iDevice]); |
qsamplerDevice device(qsamplerDevice::Audio, piDeviceIDs[iDevice]); |
803 |
// Audio device specification... |
// Audio device specification... |
804 |
ts << "# " << device.deviceTypeName() << " " << device.driverName() |
ts << "# " << device.deviceTypeName() << " " << device.driverName() |
805 |
<< " " << tr("Device") << " " << iDevice << endl; |
<< " " << tr("Device") << " " << iDevice << endl; |
831 |
} |
} |
832 |
// Audio device index/id mapping. |
// Audio device index/id mapping. |
833 |
audioDeviceMap[device.deviceID()] = iDevice; |
audioDeviceMap[device.deviceID()] = iDevice; |
834 |
// Try to keep it snappy :) |
// Try to keep it snappy :) |
835 |
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
836 |
} |
} |
837 |
|
|
838 |
// MIDI device mapping. |
// MIDI device mapping. |
839 |
QMap<int, int> midiDeviceMap; |
QMap<int, int> midiDeviceMap; |
840 |
piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Midi); |
piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Midi); |
841 |
for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) { |
for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) { |
842 |
ts << endl; |
ts << endl; |
843 |
qsamplerDevice device(this, qsamplerDevice::Midi, piDeviceIDs[iDevice]); |
qsamplerDevice device(qsamplerDevice::Midi, piDeviceIDs[iDevice]); |
844 |
// MIDI device specification... |
// MIDI device specification... |
845 |
ts << "# " << device.deviceTypeName() << " " << device.driverName() |
ts << "# " << device.deviceTypeName() << " " << device.driverName() |
846 |
<< " " << tr("Device") << " " << iDevice << endl; |
<< " " << tr("Device") << " " << iDevice << endl; |
872 |
} |
} |
873 |
// MIDI device index/id mapping. |
// MIDI device index/id mapping. |
874 |
midiDeviceMap[device.deviceID()] = iDevice; |
midiDeviceMap[device.deviceID()] = iDevice; |
875 |
// Try to keep it snappy :) |
// Try to keep it snappy :) |
876 |
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
877 |
} |
} |
878 |
ts << endl; |
ts << endl; |
879 |
|
|
880 |
|
#ifdef CONFIG_MIDI_INSTRUMENT |
881 |
|
// MIDI instrument mapping... |
882 |
|
QMap<int, int> midiInstrumentMap; |
883 |
|
int *piMaps = ::lscp_list_midi_instrument_maps(m_pClient); |
884 |
|
for (int iMap = 0; piMaps && piMaps[iMap] >= 0; iMap++) { |
885 |
|
int iMidiMap = piMaps[iMap]; |
886 |
|
const char *pszMapName |
887 |
|
= ::lscp_get_midi_instrument_map_name(m_pClient, iMidiMap); |
888 |
|
ts << "# " << tr("MIDI instrument map") << " " << iMap; |
889 |
|
if (pszMapName) |
890 |
|
ts << " - " << pszMapName; |
891 |
|
ts << endl; |
892 |
|
ts << "ADD MIDI_INSTRUMENT_MAP"; |
893 |
|
if (pszMapName) |
894 |
|
ts << " '" << pszMapName << "'"; |
895 |
|
ts << endl; |
896 |
|
// MIDI instrument mapping... |
897 |
|
lscp_midi_instrument_t *pInstrs |
898 |
|
= ::lscp_list_midi_instruments(m_pClient, iMidiMap); |
899 |
|
for (int iInstr = 0; pInstrs && pInstrs[iInstr].map >= 0; iInstr++) { |
900 |
|
lscp_midi_instrument_info_t *pInstrInfo |
901 |
|
= ::lscp_get_midi_instrument_info(m_pClient, &pInstrs[iInstr]); |
902 |
|
if (pInstrInfo) { |
903 |
|
ts << "MAP MIDI_INSTRUMENT " |
904 |
|
<< iMap << " " |
905 |
|
<< pInstrs[iInstr].bank << " " |
906 |
|
<< pInstrs[iInstr].prog << " " |
907 |
|
<< pInstrInfo->engine_name << " '" |
908 |
|
<< pInstrInfo->instrument_file << "' " |
909 |
|
<< pInstrInfo->instrument_nr << " " |
910 |
|
<< pInstrInfo->volume << " "; |
911 |
|
switch (pInstrInfo->load_mode) { |
912 |
|
case LSCP_LOAD_PERSISTENT: |
913 |
|
ts << "PERSISTENT"; |
914 |
|
break; |
915 |
|
case LSCP_LOAD_ON_DEMAND_HOLD: |
916 |
|
ts << "ON_DEMAND_HOLD"; |
917 |
|
break; |
918 |
|
case LSCP_LOAD_ON_DEMAND: |
919 |
|
case LSCP_LOAD_DEFAULT: |
920 |
|
default: |
921 |
|
ts << "ON_DEMAND"; |
922 |
|
break; |
923 |
|
} |
924 |
|
if (pInstrInfo->name) |
925 |
|
ts << " '" << pInstrInfo->name << "'"; |
926 |
|
ts << endl; |
927 |
|
} // Check for errors... |
928 |
|
else if (::lscp_client_get_errno(m_pClient)) { |
929 |
|
appendMessagesClient("lscp_get_midi_instrument_info"); |
930 |
|
iErrors++; |
931 |
|
} |
932 |
|
// Try to keep it snappy :) |
933 |
|
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
934 |
|
} |
935 |
|
ts << endl; |
936 |
|
// Check for errors... |
937 |
|
if (pInstrs == NULL && ::lscp_client_get_errno(m_pClient)) { |
938 |
|
appendMessagesClient("lscp_list_midi_instruments"); |
939 |
|
iErrors++; |
940 |
|
} |
941 |
|
// MIDI strument index/id mapping. |
942 |
|
midiInstrumentMap[iMidiMap] = iMap; |
943 |
|
} |
944 |
|
// Check for errors... |
945 |
|
if (piMaps == NULL && ::lscp_client_get_errno(m_pClient)) { |
946 |
|
appendMessagesClient("lscp_list_midi_instrument_maps"); |
947 |
|
iErrors++; |
948 |
|
} |
949 |
|
#endif // CONFIG_MIDI_INSTRUMENT |
950 |
|
|
951 |
// Sampler channel mapping. |
// Sampler channel mapping. |
952 |
QWidgetList wlist = m_pWorkspace->windowList(); |
QWidgetList wlist = m_pWorkspace->windowList(); |
953 |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
954 |
qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel); |
qsamplerChannelStrip *pChannelStrip |
955 |
|
= static_cast<qsamplerChannelStrip *> (wlist.at(iChannel)); |
956 |
if (pChannelStrip) { |
if (pChannelStrip) { |
957 |
qsamplerChannel *pChannel = pChannelStrip->channel(); |
qsamplerChannel *pChannel = pChannelStrip->channel(); |
958 |
if (pChannel) { |
if (pChannel) { |
981 |
ts << pChannel->midiChannel(); |
ts << pChannel->midiChannel(); |
982 |
ts << endl; |
ts << endl; |
983 |
ts << "LOAD ENGINE " << pChannel->engineName() << " " << iChannel << endl; |
ts << "LOAD ENGINE " << pChannel->engineName() << " " << iChannel << endl; |
984 |
ts << "LOAD INSTRUMENT NON_MODAL '" << pChannel->instrumentFile() << "' " << pChannel->instrumentNr() << " " << iChannel << endl; |
if (pChannel->instrumentStatus() < 100) ts << "# "; |
985 |
ts << "SET CHANNEL VOLUME " << iChannel << " " << pChannel->volume() << endl; |
ts << "LOAD INSTRUMENT NON_MODAL '" << pChannel->instrumentFile() << "' " |
986 |
if (pChannel->channelMute()) |
<< pChannel->instrumentNr() << " " << iChannel << endl; |
987 |
ts << "SET CHANNEL MUTE " << iChannel << " 1" << endl; |
qsamplerChannelRoutingMap::ConstIterator audioRoute; |
988 |
if (pChannel->channelSolo()) |
for (audioRoute = pChannel->audioRouting().begin(); |
989 |
ts << "SET CHANNEL SOLO " << iChannel << " 1" << endl; |
audioRoute != pChannel->audioRouting().end(); |
990 |
|
++audioRoute) { |
991 |
|
ts << "SET CHANNEL AUDIO_OUTPUT_CHANNEL " << iChannel |
992 |
|
<< " " << audioRoute.key() |
993 |
|
<< " " << audioRoute.data() << endl; |
994 |
|
} |
995 |
|
ts << "SET CHANNEL VOLUME " << iChannel |
996 |
|
<< " " << pChannel->volume() << endl; |
997 |
|
if (pChannel->channelMute()) |
998 |
|
ts << "SET CHANNEL MUTE " << iChannel << " 1" << endl; |
999 |
|
if (pChannel->channelSolo()) |
1000 |
|
ts << "SET CHANNEL SOLO " << iChannel << " 1" << endl; |
1001 |
|
#ifdef CONFIG_MIDI_INSTRUMENT |
1002 |
|
if (pChannel->midiMap() >= 0) { |
1003 |
|
ts << "SET CHANNEL MIDI_INSTRUMENT_MAP " << iChannel |
1004 |
|
<< " " << midiInstrumentMap[pChannel->midiMap()] << endl; |
1005 |
|
} |
1006 |
|
#endif |
1007 |
|
#ifdef CONFIG_FXSEND |
1008 |
|
int iChannelID = pChannel->channelID(); |
1009 |
|
int *piFxSends = ::lscp_list_fxsends(m_pClient, iChannelID); |
1010 |
|
for (int iFxSend = 0; |
1011 |
|
piFxSends && piFxSends[iFxSend] >= 0; |
1012 |
|
iFxSend++) { |
1013 |
|
lscp_fxsend_info_t *pFxSendInfo = ::lscp_get_fxsend_info( |
1014 |
|
m_pClient, iChannelID, piFxSends[iFxSend]); |
1015 |
|
if (pFxSendInfo) { |
1016 |
|
ts << "CREATE FX_SEND " << iChannel |
1017 |
|
<< " " << pFxSendInfo->midi_controller; |
1018 |
|
if (pFxSendInfo->name) |
1019 |
|
ts << " '" << pFxSendInfo->name << "'"; |
1020 |
|
ts << endl; |
1021 |
|
int *piRouting = pFxSendInfo->audio_routing; |
1022 |
|
for (int iAudioSrc = 0; |
1023 |
|
piRouting && piRouting[iAudioSrc] >= 0; |
1024 |
|
iAudioSrc++) { |
1025 |
|
ts << "SET FX_SEND AUDIO_OUTPUT_CHANNEL " |
1026 |
|
<< iChannel |
1027 |
|
<< " " << iFxSend |
1028 |
|
<< " " << iAudioSrc |
1029 |
|
<< " " << piRouting[iAudioSrc] << endl; |
1030 |
|
} |
1031 |
|
#ifdef CONFIG_FXSEND_LEVEL |
1032 |
|
ts << "SET FX_SEND LEVEL " << iChannel |
1033 |
|
<< " " << iFxSend |
1034 |
|
<< " " << pFxSendInfo->level << endl; |
1035 |
|
#endif |
1036 |
|
} // Check for errors... |
1037 |
|
else if (::lscp_client_get_errno(m_pClient)) { |
1038 |
|
appendMessagesClient("lscp_get_fxsend_info"); |
1039 |
|
iErrors++; |
1040 |
|
} |
1041 |
|
} |
1042 |
|
#endif |
1043 |
ts << endl; |
ts << endl; |
1044 |
} |
} |
1045 |
} |
} |
1047 |
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
1048 |
} |
} |
1049 |
|
|
1050 |
|
#ifdef CONFIG_VOLUME |
1051 |
|
ts << "# " << tr("Global volume level") << endl; |
1052 |
|
ts << "SET VOLUME " << ::lscp_get_volume(m_pClient) << endl; |
1053 |
|
ts << endl; |
1054 |
|
#endif |
1055 |
|
|
1056 |
// Ok. we've wrote it. |
// Ok. we've wrote it. |
1057 |
file.close(); |
file.close(); |
1058 |
|
|
1059 |
|
// We're fornerly done. |
1060 |
|
QApplication::restoreOverrideCursor(); |
1061 |
|
|
1062 |
// Have we any errors? |
// Have we any errors? |
1063 |
if (iErrors > 0) |
if (iErrors > 0) |
1064 |
appendMessagesError(tr("Some settings could not be saved\nto \"%1\" session file.\n\nSorry.").arg(sFilename)); |
appendMessagesError(tr("Some settings could not be saved\nto \"%1\" session file.\n\nSorry.").arg(sFilename)); |
1150 |
tr("Reset"), tr("Cancel")) > 0) |
tr("Reset"), tr("Cancel")) > 0) |
1151 |
return; |
return; |
1152 |
|
|
1153 |
|
// Trye closing the current session, first... |
1154 |
|
if (!closeSession(true)) |
1155 |
|
return; |
1156 |
|
|
1157 |
// Just do the reset, after closing down current session... |
// Just do the reset, after closing down current session... |
1158 |
if (closeSession(true) && ::lscp_reset_sampler(m_pClient) != LSCP_OK) { |
// Do the actual sampler reset... |
1159 |
appendMessagesClient("lscp_reset_sampler"); |
if (::lscp_reset_sampler(m_pClient) != LSCP_OK) { |
1160 |
appendMessagesError(tr("Could not reset sampler instance.\n\nSorry.")); |
appendMessagesClient("lscp_reset_sampler"); |
1161 |
return; |
appendMessagesError(tr("Could not reset sampler instance.\n\nSorry.")); |
1162 |
} |
return; |
1163 |
|
} |
1164 |
|
|
1165 |
// Log this. |
// Log this. |
1166 |
appendMessages(tr("Sampler reset.")); |
appendMessages(tr("Sampler reset.")); |
1219 |
return; |
return; |
1220 |
|
|
1221 |
// Just create the channel instance... |
// Just create the channel instance... |
1222 |
qsamplerChannel *pChannel = new qsamplerChannel(this); |
qsamplerChannel *pChannel = new qsamplerChannel(); |
1223 |
if (pChannel == NULL) |
if (pChannel == NULL) |
1224 |
return; |
return; |
1225 |
|
|
1382 |
} |
} |
1383 |
|
|
1384 |
|
|
1385 |
|
// Show/hide the MIDI instrument list-view form. |
1386 |
|
void qsamplerMainForm::viewInstruments (void) |
1387 |
|
{ |
1388 |
|
if (m_pOptions == NULL) |
1389 |
|
return; |
1390 |
|
|
1391 |
|
if (m_pInstrumentListForm) { |
1392 |
|
m_pOptions->saveWidgetGeometry(m_pInstrumentListForm); |
1393 |
|
if (m_pInstrumentListForm->isVisible()) { |
1394 |
|
m_pInstrumentListForm->hide(); |
1395 |
|
} else { |
1396 |
|
m_pInstrumentListForm->show(); |
1397 |
|
m_pInstrumentListForm->raise(); |
1398 |
|
m_pInstrumentListForm->setActiveWindow(); |
1399 |
|
} |
1400 |
|
} |
1401 |
|
} |
1402 |
|
|
1403 |
|
|
1404 |
// Show/hide the device configurator form. |
// Show/hide the device configurator form. |
1405 |
void qsamplerMainForm::viewDevices (void) |
void qsamplerMainForm::viewDevices (void) |
1406 |
{ |
{ |
1409 |
|
|
1410 |
if (m_pDeviceForm) { |
if (m_pDeviceForm) { |
1411 |
m_pOptions->saveWidgetGeometry(m_pDeviceForm); |
m_pOptions->saveWidgetGeometry(m_pDeviceForm); |
|
m_pDeviceForm->setClient(m_pClient); |
|
1412 |
if (m_pDeviceForm->isVisible()) { |
if (m_pDeviceForm->isVisible()) { |
1413 |
m_pDeviceForm->hide(); |
m_pDeviceForm->hide(); |
1414 |
} else { |
} else { |
1594 |
sText += tr("Sampler channel Mute/Solo support disabled."); |
sText += tr("Sampler channel Mute/Solo support disabled."); |
1595 |
sText += "</font></small><br />"; |
sText += "</font></small><br />"; |
1596 |
#endif |
#endif |
1597 |
|
#ifndef CONFIG_AUDIO_ROUTING |
1598 |
|
sText += "<small><font color=\"red\">"; |
1599 |
|
sText += tr("LSCP (liblscp) audio_routing support disabled."); |
1600 |
|
sText += "</font></small><br />"; |
1601 |
|
#endif |
1602 |
|
#ifndef CONFIG_FXSEND |
1603 |
|
sText += "<small><font color=\"red\">"; |
1604 |
|
sText += tr("Sampler channel Effect Sends support disabled."); |
1605 |
|
sText += "</font></small><br />"; |
1606 |
|
#endif |
1607 |
|
#ifndef CONFIG_VOLUME |
1608 |
|
sText += "<small><font color=\"red\">"; |
1609 |
|
sText += tr("Global volume support disabled."); |
1610 |
|
sText += "</font></small><br />"; |
1611 |
|
#endif |
1612 |
|
#ifndef CONFIG_MIDI_INSTRUMENT |
1613 |
|
sText += "<small><font color=\"red\">"; |
1614 |
|
sText += tr("MIDI instrument mapping support disabled."); |
1615 |
|
sText += "</font></small><br />"; |
1616 |
|
#endif |
1617 |
sText += "<br />\n"; |
sText += "<br />\n"; |
1618 |
sText += tr("Using") + ": "; |
sText += tr("Using") + ": "; |
1619 |
sText += ::lscp_client_package(); |
sText += ::lscp_client_package(); |
1649 |
// Update the main application caption... |
// Update the main application caption... |
1650 |
QString sSessionName = sessionName(m_sFilename); |
QString sSessionName = sessionName(m_sFilename); |
1651 |
if (m_iDirtyCount > 0) |
if (m_iDirtyCount > 0) |
1652 |
sSessionName += '*'; |
sSessionName += " *"; |
1653 |
setCaption(tr(QSAMPLER_TITLE " - [%1]").arg(sSessionName)); |
setCaption(tr(QSAMPLER_TITLE " - [%1]").arg(sSessionName)); |
1654 |
|
|
1655 |
// Update the main menu state... |
// Update the main menu state... |
1668 |
editResetChannelAction->setEnabled(bHasChannel); |
editResetChannelAction->setEnabled(bHasChannel); |
1669 |
editResetAllChannelsAction->setEnabled(bHasChannel); |
editResetAllChannelsAction->setEnabled(bHasChannel); |
1670 |
viewMessagesAction->setOn(m_pMessages && m_pMessages->isVisible()); |
viewMessagesAction->setOn(m_pMessages && m_pMessages->isVisible()); |
1671 |
viewDevicesAction->setOn(m_pDeviceForm && m_pDeviceForm->isVisible()); |
#ifdef CONFIG_MIDI_INSTRUMENT |
1672 |
|
viewInstrumentsAction->setOn(m_pInstrumentListForm |
1673 |
|
&& m_pInstrumentListForm->isVisible()); |
1674 |
|
viewInstrumentsAction->setEnabled(bHasClient); |
1675 |
|
#endif |
1676 |
|
viewDevicesAction->setOn(m_pDeviceForm |
1677 |
|
&& m_pDeviceForm->isVisible()); |
1678 |
viewDevicesAction->setEnabled(bHasClient); |
viewDevicesAction->setEnabled(bHasClient); |
1679 |
channelsArrangeAction->setEnabled(bHasChannel); |
channelsArrangeAction->setEnabled(bHasChannel); |
1680 |
|
|
1681 |
|
#ifdef CONFIG_VOLUME |
1682 |
|
// Toolbar widgets are also affected... |
1683 |
|
m_pVolumeSlider->setEnabled(bHasClient); |
1684 |
|
m_pVolumeSpinBox->setEnabled(bHasClient); |
1685 |
|
#endif |
1686 |
|
|
1687 |
// Client/Server status... |
// Client/Server status... |
1688 |
if (bHasClient) { |
if (bHasClient) { |
1689 |
m_statusItem[QSAMPLER_STATUS_CLIENT]->setText(tr("Connected")); |
m_statusItem[QSAMPLER_STATUS_CLIENT]->setText(tr("Connected")); |
1712 |
} |
} |
1713 |
|
|
1714 |
|
|
1715 |
|
// Global volume change receiver slot. |
1716 |
|
void qsamplerMainForm::volumeChanged ( int iVolume ) |
1717 |
|
{ |
1718 |
|
#ifdef CONFIG_VOLUME |
1719 |
|
|
1720 |
|
if (m_iVolumeChanging > 0) |
1721 |
|
return; |
1722 |
|
|
1723 |
|
m_iVolumeChanging++; |
1724 |
|
|
1725 |
|
// Update the toolbar widgets... |
1726 |
|
if (m_pVolumeSlider->value() != iVolume) |
1727 |
|
m_pVolumeSlider->setValue(iVolume); |
1728 |
|
if (m_pVolumeSpinBox->value() != iVolume) |
1729 |
|
m_pVolumeSpinBox->setValue(iVolume); |
1730 |
|
|
1731 |
|
// Do it as commanded... |
1732 |
|
float fVolume = 0.01f * float(iVolume); |
1733 |
|
if (::lscp_set_volume(m_pClient, fVolume) == LSCP_OK) |
1734 |
|
appendMessages(QObject::tr("Volume: %1.").arg(fVolume)); |
1735 |
|
else |
1736 |
|
appendMessagesClient("lscp_set_volume"); |
1737 |
|
|
1738 |
|
m_iVolumeChanging--; |
1739 |
|
|
1740 |
|
m_iDirtyCount++; |
1741 |
|
stabilizeForm(); |
1742 |
|
|
1743 |
|
#endif |
1744 |
|
} |
1745 |
|
|
1746 |
|
|
1747 |
// Channel change receiver slot. |
// Channel change receiver slot. |
1748 |
void qsamplerMainForm::channelStripChanged( qsamplerChannelStrip *pChannelStrip ) |
void qsamplerMainForm::channelStripChanged( qsamplerChannelStrip *pChannelStrip ) |
1749 |
{ |
{ |
1763 |
// Grab and restore current sampler channels session. |
// Grab and restore current sampler channels session. |
1764 |
void qsamplerMainForm::updateSession (void) |
void qsamplerMainForm::updateSession (void) |
1765 |
{ |
{ |
1766 |
|
#ifdef CONFIG_VOLUME |
1767 |
|
int iVolume = ::lroundf(100.0f * ::lscp_get_volume(m_pClient)); |
1768 |
|
m_iVolumeChanging++; |
1769 |
|
m_pVolumeSlider->setValue(iVolume); |
1770 |
|
m_pVolumeSpinBox->setValue(iVolume); |
1771 |
|
m_iVolumeChanging--; |
1772 |
|
#endif |
1773 |
|
#ifdef CONFIG_MIDI_INSTRUMENT |
1774 |
|
// FIXME: Make some room for default instrument maps... |
1775 |
|
int iMaps = ::lscp_get_midi_instrument_maps(m_pClient); |
1776 |
|
if (iMaps < 0) |
1777 |
|
appendMessagesClient("lscp_get_midi_instrument_maps"); |
1778 |
|
else if (iMaps < 1) { |
1779 |
|
::lscp_add_midi_instrument_map(m_pClient, tr("Chromatic").latin1()); |
1780 |
|
::lscp_add_midi_instrument_map(m_pClient, tr("Drum Kits").latin1()); |
1781 |
|
} |
1782 |
|
#endif |
1783 |
|
|
1784 |
// Retrieve the current channel list. |
// Retrieve the current channel list. |
1785 |
int *piChannelIDs = ::lscp_list_channels(m_pClient); |
int *piChannelIDs = ::lscp_list_channels(m_pClient); |
1786 |
if (piChannelIDs == NULL) { |
if (piChannelIDs == NULL) { |
1788 |
appendMessagesClient("lscp_list_channels"); |
appendMessagesClient("lscp_list_channels"); |
1789 |
appendMessagesError(tr("Could not get current list of channels.\n\nSorry.")); |
appendMessagesError(tr("Could not get current list of channels.\n\nSorry.")); |
1790 |
} |
} |
1791 |
return; |
} else { |
1792 |
|
// Try to (re)create each channel. |
1793 |
|
m_pWorkspace->setUpdatesEnabled(false); |
1794 |
|
for (int iChannel = 0; piChannelIDs[iChannel] >= 0; iChannel++) { |
1795 |
|
// Check if theres already a channel strip for this one... |
1796 |
|
if (!channelStrip(piChannelIDs[iChannel])) |
1797 |
|
createChannelStrip(new qsamplerChannel(piChannelIDs[iChannel])); |
1798 |
|
} |
1799 |
|
m_pWorkspace->setUpdatesEnabled(true); |
1800 |
} |
} |
1801 |
|
|
1802 |
// Try to (re)create each channel. |
// Do we auto-arrange? |
1803 |
m_pWorkspace->setUpdatesEnabled(false); |
if (m_pOptions && m_pOptions->bAutoArrange) |
1804 |
for (int iChannel = 0; piChannelIDs[iChannel] >= 0; iChannel++) { |
channelsArrange(); |
1805 |
// Check if theres already a channel strip for this one... |
|
1806 |
if (!channelStrip(piChannelIDs[iChannel])) |
// Remember to refresh devices and instruments... |
1807 |
createChannelStrip(new qsamplerChannel(this, piChannelIDs[iChannel])); |
if (m_pInstrumentListForm) |
1808 |
// Make it visibly responsive... |
m_pInstrumentListForm->refreshInstruments(); |
|
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
|
|
} |
|
|
m_pWorkspace->setUpdatesEnabled(true); |
|
|
|
|
|
// Remember to refresh devices |
|
1809 |
if (m_pDeviceForm) |
if (m_pDeviceForm) |
1810 |
m_pDeviceForm->refreshDevices(); |
m_pDeviceForm->refreshDevices(); |
1811 |
} |
} |
1930 |
if (m_pOptions == NULL) |
if (m_pOptions == NULL) |
1931 |
return; |
return; |
1932 |
|
|
1933 |
|
#ifdef CONFIG_VOLUME |
1934 |
|
m_iVolumeChanging++; |
1935 |
|
m_pVolumeSlider->setMaxValue(m_pOptions->iMaxVolume); |
1936 |
|
m_pVolumeSpinBox->setMaxValue(m_pOptions->iMaxVolume); |
1937 |
|
m_iVolumeChanging--; |
1938 |
|
#endif |
1939 |
|
|
1940 |
// Full channel list update... |
// Full channel list update... |
1941 |
QWidgetList wlist = m_pWorkspace->windowList(); |
QWidgetList wlist = m_pWorkspace->windowList(); |
1942 |
if (wlist.isEmpty()) |
if (wlist.isEmpty()) |
1985 |
|
|
1986 |
appendMessagesColor(s.simplifyWhiteSpace(), "#ff0000"); |
appendMessagesColor(s.simplifyWhiteSpace(), "#ff0000"); |
1987 |
|
|
1988 |
|
// Make it look responsive...:) |
1989 |
|
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
1990 |
|
|
1991 |
QMessageBox::critical(this, |
QMessageBox::critical(this, |
1992 |
QSAMPLER_TITLE ": " + tr("Error"), s, tr("Cancel")); |
QSAMPLER_TITLE ": " + tr("Error"), s, tr("Cancel")); |
1993 |
} |
} |
2002 |
appendMessagesColor(s + QString(": %1 (errno=%2)") |
appendMessagesColor(s + QString(": %1 (errno=%2)") |
2003 |
.arg(::lscp_client_get_result(m_pClient)) |
.arg(::lscp_client_get_result(m_pClient)) |
2004 |
.arg(::lscp_client_get_errno(m_pClient)), "#996666"); |
.arg(::lscp_client_get_errno(m_pClient)), "#996666"); |
2005 |
|
|
2006 |
|
// Make it look responsive...:) |
2007 |
|
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
2008 |
} |
} |
2009 |
|
|
2010 |
|
|
2079 |
|
|
2080 |
// Actual channel strip setup... |
// Actual channel strip setup... |
2081 |
pChannelStrip->setup(pChannel); |
pChannelStrip->setup(pChannel); |
2082 |
QObject::connect(pChannelStrip, SIGNAL(channelChanged(qsamplerChannelStrip *)), this, SLOT(channelStripChanged(qsamplerChannelStrip *))); |
QObject::connect(pChannelStrip, |
2083 |
|
SIGNAL(channelChanged(qsamplerChannelStrip *)), |
2084 |
|
SLOT(channelStripChanged(qsamplerChannelStrip *))); |
2085 |
// Set some initial aesthetic options... |
// Set some initial aesthetic options... |
2086 |
if (m_pOptions) { |
if (m_pOptions) { |
2087 |
// Background display effect... |
// Background display effect... |
2288 |
m_pServer = new QProcess(this); |
m_pServer = new QProcess(this); |
2289 |
|
|
2290 |
// Setup stdout/stderr capture... |
// Setup stdout/stderr capture... |
2291 |
//if (m_pOptions->bStdoutCapture) { |
// if (m_pOptions->bStdoutCapture) { |
2292 |
m_pServer->setCommunication(QProcess::Stdout | QProcess::Stderr | QProcess::DupStderr); |
m_pServer->setCommunication( |
2293 |
QObject::connect(m_pServer, SIGNAL(readyReadStdout()), this, SLOT(readServerStdout())); |
QProcess::Stdout | QProcess::Stderr | QProcess::DupStderr); |
2294 |
QObject::connect(m_pServer, SIGNAL(readyReadStderr()), this, SLOT(readServerStdout())); |
QObject::connect(m_pServer, |
2295 |
//} |
SIGNAL(readyReadStdout()), |
2296 |
// The unforgiveable signal communication... |
SLOT(readServerStdout())); |
2297 |
QObject::connect(m_pServer, SIGNAL(processExited()), this, SLOT(processServerExit())); |
QObject::connect(m_pServer, |
2298 |
|
SIGNAL(readyReadStderr()), |
2299 |
|
SLOT(readServerStdout())); |
2300 |
|
// } |
2301 |
|
// The unforgiveable signal communication... |
2302 |
|
QObject::connect(m_pServer, |
2303 |
|
SIGNAL(processExited()), |
2304 |
|
SLOT(processServerExit())); |
2305 |
|
|
2306 |
// Build process arguments... |
// Build process arguments... |
2307 |
m_pServer->setArguments(QStringList::split(' ', m_pOptions->sServerCmdLine)); |
m_pServer->setArguments(QStringList::split(' ', m_pOptions->sServerCmdLine)); |
2446 |
// Log success here. |
// Log success here. |
2447 |
appendMessages(tr("Client connected.")); |
appendMessages(tr("Client connected.")); |
2448 |
|
|
2449 |
// Hard-notify device configuration form, |
// Hard-notify instrumnet and device configuration forms, |
2450 |
// if visible, that we're ready... |
// if visible, that we're ready... |
2451 |
if (m_pDeviceForm && m_pDeviceForm->isVisible()) |
if (m_pInstrumentListForm) |
2452 |
m_pDeviceForm->setClient(m_pClient); |
m_pInstrumentListForm->refreshInstruments(); |
2453 |
|
if (m_pDeviceForm) |
2454 |
|
m_pDeviceForm->refreshDevices(); |
2455 |
|
|
2456 |
// Is any session pending to be loaded? |
// Is any session pending to be loaded? |
2457 |
if (!m_pOptions->sSessionFile.isEmpty()) { |
if (!m_pOptions->sSessionFile.isEmpty()) { |
2473 |
if (m_pClient == NULL) |
if (m_pClient == NULL) |
2474 |
return; |
return; |
2475 |
|
|
|
// Hard-notify device configuration form, |
|
|
// if visible, that we're running out... |
|
|
if (m_pDeviceForm && m_pDeviceForm->isVisible()) |
|
|
m_pDeviceForm->setClient(NULL); |
|
|
|
|
2476 |
// Log prepare here. |
// Log prepare here. |
2477 |
appendMessages(tr("Client disconnecting...")); |
appendMessages(tr("Client disconnecting...")); |
2478 |
|
|
2493 |
::lscp_client_destroy(m_pClient); |
::lscp_client_destroy(m_pClient); |
2494 |
m_pClient = NULL; |
m_pClient = NULL; |
2495 |
|
|
2496 |
|
// Hard-notify instrumnet and device configuration forms, |
2497 |
|
// if visible, that we're running out... |
2498 |
|
if (m_pInstrumentListForm) |
2499 |
|
m_pInstrumentListForm->refreshInstruments(); |
2500 |
|
if (m_pDeviceForm) |
2501 |
|
m_pDeviceForm->refreshDevices(); |
2502 |
|
|
2503 |
// Log final here. |
// Log final here. |
2504 |
appendMessages(tr("Client disconnected.")); |
appendMessages(tr("Client disconnected.")); |
2505 |
|
|