1 |
// qsamplerMainForm.cpp |
// qsamplerMainForm.cpp |
2 |
// |
// |
3 |
/**************************************************************************** |
/**************************************************************************** |
4 |
Copyright (C) 2004-2016, rncbc aka Rui Nuno Capela. All rights reserved. |
Copyright (C) 2004-2018, 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 |
91 |
|
|
92 |
|
|
93 |
// All winsock apps needs this. |
// All winsock apps needs this. |
94 |
#if defined(WIN32) |
#if defined(__WIN32__) || defined(_WIN32) || defined(WIN32) |
95 |
static WSADATA _wsaData; |
static WSADATA _wsaData; |
96 |
#endif |
#endif |
97 |
|
|
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) |
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. |
324 |
m_statusItem[QSAMPLER_STATUS_SESSION] = pLabel; |
m_statusItem[QSAMPLER_STATUS_SESSION] = pLabel; |
325 |
statusBar()->addWidget(pLabel); |
statusBar()->addWidget(pLabel); |
326 |
|
|
327 |
#if defined(WIN32) |
#if defined(__WIN32__) || defined(_WIN32) || defined(WIN32) |
328 |
WSAStartup(MAKEWORD(1, 1), &_wsaData); |
WSAStartup(MAKEWORD(1, 1), &_wsaData); |
329 |
#endif |
#endif |
330 |
|
|
425 |
// Do final processing anyway. |
// Do final processing anyway. |
426 |
processServerExit(); |
processServerExit(); |
427 |
|
|
428 |
#if defined(WIN32) |
#if defined(__WIN32__) || defined(_WIN32) || defined(WIN32) |
429 |
WSACleanup(); |
WSACleanup(); |
430 |
#endif |
#endif |
431 |
|
|
714 |
} |
} |
715 |
|
|
716 |
|
|
|
// Window resize event handler. |
|
|
void MainForm::resizeEvent ( QResizeEvent * ) |
|
|
{ |
|
|
if (m_pOptions->bAutoArrange) |
|
|
channelsArrange(); |
|
|
} |
|
|
|
|
|
|
|
717 |
// LADISH Level 1 -- SIGUSR1 signal handler. |
// LADISH Level 1 -- SIGUSR1 signal handler. |
718 |
void MainForm::handle_sigusr1 (void) |
void MainForm::handle_sigusr1 (void) |
719 |
{ |
{ |
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 ) |
866 |
// Enforce .lscp extension... |
// Enforce .lscp extension... |
867 |
if (QFileInfo(sFilename).suffix().isEmpty()) |
if (QFileInfo(sFilename).suffix().isEmpty()) |
868 |
sFilename += ".lscp"; |
sFilename += ".lscp"; |
869 |
|
#if 0 |
870 |
// Check if already exists... |
// Check if already exists... |
871 |
if (sFilename != m_sFilename && QFileInfo(sFilename).exists()) { |
if (sFilename != m_sFilename && QFileInfo(sFilename).exists()) { |
872 |
if (QMessageBox::warning(this, |
if (QMessageBox::warning(this, |
879 |
== QMessageBox::No) |
== QMessageBox::No) |
880 |
return false; |
return false; |
881 |
} |
} |
882 |
|
#endif |
883 |
} |
} |
884 |
|
|
885 |
// Save it right away. |
// Save it right away. |
1048 |
int iErrors = 0; |
int iErrors = 0; |
1049 |
QTextStream ts(&file); |
QTextStream ts(&file); |
1050 |
ts << "# " << QSAMPLER_TITLE " - " << tr(QSAMPLER_SUBTITLE) << endl; |
ts << "# " << QSAMPLER_TITLE " - " << tr(QSAMPLER_SUBTITLE) << endl; |
1051 |
ts << "# " << tr("Version") |
ts << "# " << tr("Version") << ": " CONFIG_BUILD_VERSION << endl; |
1052 |
<< ": " QSAMPLER_VERSION << endl; |
// ts << "# " << tr("Build") << ": " CONFIG_BUILD_DATE << endl; |
|
ts << "# " << tr("Build") |
|
|
<< ": " __DATE__ " " __TIME__ << endl; |
|
1053 |
ts << "#" << endl; |
ts << "#" << endl; |
1054 |
ts << "# " << tr("File") |
ts << "# " << tr("File") |
1055 |
<< ": " << QFileInfo(sFilename).fileName() << endl; |
<< ": " << QFileInfo(sFilename).fileName() << endl; |
1062 |
// It is assumed that this new kind of device+session file |
// It is assumed that this new kind of device+session file |
1063 |
// will be loaded from a complete initialized server... |
// will be loaded from a complete initialized server... |
1064 |
int *piDeviceIDs; |
int *piDeviceIDs; |
1065 |
int iDevice; |
int i, iDevice; |
1066 |
ts << "RESET" << endl; |
ts << "RESET" << endl; |
1067 |
|
|
1068 |
// Audio device mapping. |
// Audio device mapping. |
1069 |
QMap<int, int> audioDeviceMap; |
QMap<int, int> audioDeviceMap; iDevice = 0; |
1070 |
piDeviceIDs = Device::getDevices(m_pClient, Device::Audio); |
piDeviceIDs = Device::getDevices(m_pClient, Device::Audio); |
1071 |
for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) { |
for (i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; ++i) { |
1072 |
ts << endl; |
Device device(Device::Audio, piDeviceIDs[i]); |
1073 |
Device device(Device::Audio, piDeviceIDs[iDevice]); |
// Avoid plug-in driver devices... |
1074 |
|
if (device.driverName().toUpper() == "PLUGIN") |
1075 |
|
continue; |
1076 |
// Audio device specification... |
// Audio device specification... |
1077 |
|
ts << endl; |
1078 |
ts << "# " << device.deviceTypeName() << " " << device.driverName() |
ts << "# " << device.deviceTypeName() << " " << device.driverName() |
1079 |
<< " " << tr("Device") << " " << iDevice << endl; |
<< " " << tr("Device") << " " << iDevice << endl; |
1080 |
ts << "CREATE AUDIO_OUTPUT_DEVICE " << device.driverName(); |
ts << "CREATE AUDIO_OUTPUT_DEVICE " << device.driverName(); |
1105 |
iPort++; |
iPort++; |
1106 |
} |
} |
1107 |
// Audio device index/id mapping. |
// Audio device index/id mapping. |
1108 |
audioDeviceMap[device.deviceID()] = iDevice; |
audioDeviceMap.insert(device.deviceID(), iDevice++); |
1109 |
// Try to keep it snappy :) |
// Try to keep it snappy :) |
1110 |
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents); |
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents); |
1111 |
} |
} |
1112 |
|
|
1113 |
// MIDI device mapping. |
// MIDI device mapping. |
1114 |
QMap<int, int> midiDeviceMap; |
QMap<int, int> midiDeviceMap; iDevice = 0; |
1115 |
piDeviceIDs = Device::getDevices(m_pClient, Device::Midi); |
piDeviceIDs = Device::getDevices(m_pClient, Device::Midi); |
1116 |
for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) { |
for (i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; ++i) { |
1117 |
ts << endl; |
Device device(Device::Midi, piDeviceIDs[i]); |
1118 |
Device device(Device::Midi, piDeviceIDs[iDevice]); |
// Avoid plug-in driver devices... |
1119 |
|
if (device.driverName().toUpper() == "PLUGIN") |
1120 |
|
continue; |
1121 |
// MIDI device specification... |
// MIDI device specification... |
1122 |
|
ts << endl; |
1123 |
ts << "# " << device.deviceTypeName() << " " << device.driverName() |
ts << "# " << device.deviceTypeName() << " " << device.driverName() |
1124 |
<< " " << tr("Device") << " " << iDevice << endl; |
<< " " << tr("Device") << " " << iDevice << endl; |
1125 |
ts << "CREATE MIDI_INPUT_DEVICE " << device.driverName(); |
ts << "CREATE MIDI_INPUT_DEVICE " << device.driverName(); |
1150 |
iPort++; |
iPort++; |
1151 |
} |
} |
1152 |
// MIDI device index/id mapping. |
// MIDI device index/id mapping. |
1153 |
midiDeviceMap[device.deviceID()] = iDevice; |
midiDeviceMap.insert(device.deviceID(), iDevice++); |
1154 |
// Try to keep it snappy :) |
// Try to keep it snappy :) |
1155 |
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents); |
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents); |
1156 |
} |
} |
1218 |
iErrors++; |
iErrors++; |
1219 |
} |
} |
1220 |
// MIDI strument index/id mapping. |
// MIDI strument index/id mapping. |
1221 |
midiInstrumentMap[iMidiMap] = iMap; |
midiInstrumentMap.insert(iMidiMap, iMap); |
1222 |
} |
} |
1223 |
// Check for errors... |
// Check for errors... |
1224 |
if (piMaps == NULL && ::lscp_client_get_errno(m_pClient)) { |
if (piMaps == NULL && ::lscp_client_get_errno(m_pClient)) { |
1227 |
} |
} |
1228 |
#endif // CONFIG_MIDI_INSTRUMENT |
#endif // CONFIG_MIDI_INSTRUMENT |
1229 |
|
|
1230 |
// Sampler channel mapping. |
// Sampler channel mapping... |
1231 |
|
int iChannelID = 0; |
1232 |
const QList<QMdiSubWindow *>& wlist |
const QList<QMdiSubWindow *>& wlist |
1233 |
= m_pWorkspace->subWindowList(); |
= m_pWorkspace->subWindowList(); |
1234 |
const int iStripCount = wlist.count(); |
const int iStripCount = wlist.count(); |
1240 |
if (pChannelStrip) { |
if (pChannelStrip) { |
1241 |
Channel *pChannel = pChannelStrip->channel(); |
Channel *pChannel = pChannelStrip->channel(); |
1242 |
if (pChannel) { |
if (pChannel) { |
1243 |
const int iChannelID = pChannel->channelID(); |
// Avoid "artifial" plug-in devices... |
1244 |
|
const int iAudioDevice = pChannel->audioDevice(); |
1245 |
|
if (!audioDeviceMap.contains(iAudioDevice)) |
1246 |
|
continue; |
1247 |
|
const int iMidiDevice = pChannel->midiDevice(); |
1248 |
|
if (!midiDeviceMap.contains(iMidiDevice)) |
1249 |
|
continue; |
1250 |
|
// Go for regular, canonical devices... |
1251 |
ts << "# " << tr("Channel") << " " << iChannelID << endl; |
ts << "# " << tr("Channel") << " " << iChannelID << endl; |
1252 |
ts << "ADD CHANNEL" << endl; |
ts << "ADD CHANNEL" << endl; |
1253 |
if (audioDeviceMap.isEmpty()) { |
if (audioDeviceMap.isEmpty()) { |
1255 |
<< " " << pChannel->audioDriver() << endl; |
<< " " << pChannel->audioDriver() << endl; |
1256 |
} else { |
} else { |
1257 |
ts << "SET CHANNEL AUDIO_OUTPUT_DEVICE " << iChannelID |
ts << "SET CHANNEL AUDIO_OUTPUT_DEVICE " << iChannelID |
1258 |
<< " " << audioDeviceMap[pChannel->audioDevice()] << endl; |
<< " " << audioDeviceMap.value(iAudioDevice) << endl; |
1259 |
} |
} |
1260 |
if (midiDeviceMap.isEmpty()) { |
if (midiDeviceMap.isEmpty()) { |
1261 |
ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannelID |
ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannelID |
1262 |
<< " " << pChannel->midiDriver() << endl; |
<< " " << pChannel->midiDriver() << endl; |
1263 |
} else { |
} else { |
1264 |
ts << "SET CHANNEL MIDI_INPUT_DEVICE " << iChannelID |
ts << "SET CHANNEL MIDI_INPUT_DEVICE " << iChannelID |
1265 |
<< " " << midiDeviceMap[pChannel->midiDevice()] << endl; |
<< " " << midiDeviceMap.value(iMidiDevice) << endl; |
1266 |
} |
} |
1267 |
ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannelID |
ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannelID |
1268 |
<< " " << pChannel->midiPort() << endl; |
<< " " << pChannel->midiPort() << endl; |
1293 |
if (pChannel->channelSolo()) |
if (pChannel->channelSolo()) |
1294 |
ts << "SET CHANNEL SOLO " << iChannelID << " 1" << endl; |
ts << "SET CHANNEL SOLO " << iChannelID << " 1" << endl; |
1295 |
#ifdef CONFIG_MIDI_INSTRUMENT |
#ifdef CONFIG_MIDI_INSTRUMENT |
1296 |
if (pChannel->midiMap() >= 0) { |
const int iMidiMap = pChannel->midiMap(); |
1297 |
|
if (midiInstrumentMap.contains(iMidiMap)) { |
1298 |
ts << "SET CHANNEL MIDI_INSTRUMENT_MAP " << iChannelID |
ts << "SET CHANNEL MIDI_INSTRUMENT_MAP " << iChannelID |
1299 |
<< " " << midiInstrumentMap[pChannel->midiMap()] << endl; |
<< " " << midiInstrumentMap.value(iMidiMap) << endl; |
1300 |
} |
} |
1301 |
#endif |
#endif |
1302 |
#ifdef CONFIG_FXSEND |
#ifdef CONFIG_FXSEND |
1335 |
} |
} |
1336 |
#endif |
#endif |
1337 |
ts << endl; |
ts << endl; |
1338 |
|
// Go for next channel... |
1339 |
|
++iChannelID; |
1340 |
} |
} |
1341 |
} |
} |
1342 |
// Try to keep it snappy :) |
// Try to keep it snappy :) |
1388 |
|
|
1389 |
|
|
1390 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
1391 |
// qsamplerMainForm -- File Action slots. |
// QSampler::MainForm -- File Action slots. |
1392 |
|
|
1393 |
// Create a new sampler session. |
// Create a new sampler session. |
1394 |
void MainForm::fileNew (void) |
void MainForm::fileNew (void) |
1554 |
|
|
1555 |
|
|
1556 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
1557 |
// qsamplerMainForm -- Edit Action slots. |
// QSampler::MainForm -- Edit Action slots. |
1558 |
|
|
1559 |
// Add a new sampler channel. |
// Add a new sampler channel. |
1560 |
void MainForm::editAddChannel (void) |
void MainForm::editAddChannel (void) |
1589 |
} |
} |
1590 |
|
|
1591 |
// Do we auto-arrange? |
// Do we auto-arrange? |
1592 |
if (m_pOptions && m_pOptions->bAutoArrange) |
channelsArrangeAuto(); |
|
channelsArrange(); |
|
1593 |
|
|
1594 |
// Make that an overall update. |
// Make that an overall update. |
1595 |
m_iDirtyCount++; |
m_iDirtyCount++; |
1730 |
|
|
1731 |
|
|
1732 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
1733 |
// qsamplerMainForm -- View Action slots. |
// QSampler::MainForm -- View Action slots. |
1734 |
|
|
1735 |
// Show/hide the main program window menubar. |
// Show/hide the main program window menubar. |
1736 |
void MainForm::viewMenubar ( bool bOn ) |
void MainForm::viewMenubar ( bool bOn ) |
1911 |
|
|
1912 |
|
|
1913 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
1914 |
// qsamplerMainForm -- Channels action slots. |
// QSampler::MainForm -- Channels action slots. |
1915 |
|
|
1916 |
// Arrange channel strips. |
// Arrange channel strips. |
1917 |
void MainForm::channelsArrange (void) |
void MainForm::channelsArrange (void) |
1953 |
m_pOptions->bAutoArrange = bOn; |
m_pOptions->bAutoArrange = bOn; |
1954 |
|
|
1955 |
// If on, update whole workspace... |
// If on, update whole workspace... |
1956 |
if (m_pOptions->bAutoArrange) |
channelsArrangeAuto(); |
1957 |
|
} |
1958 |
|
|
1959 |
|
|
1960 |
|
void MainForm::channelsArrangeAuto (void) |
1961 |
|
{ |
1962 |
|
if (m_pOptions && m_pOptions->bAutoArrange) |
1963 |
channelsArrange(); |
channelsArrange(); |
1964 |
} |
} |
1965 |
|
|
1966 |
|
|
1967 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
1968 |
// qsamplerMainForm -- Help Action slots. |
// QSampler::MainForm -- Help Action slots. |
1969 |
|
|
1970 |
// Show information about the Qt toolkit. |
// Show information about the Qt toolkit. |
1971 |
void MainForm::helpAboutQt (void) |
void MainForm::helpAboutQt (void) |
1977 |
// Show information about application program. |
// Show information about application program. |
1978 |
void MainForm::helpAbout (void) |
void MainForm::helpAbout (void) |
1979 |
{ |
{ |
1980 |
// Stuff the about box text... |
QStringList list; |
|
QString sText = "<p>\n"; |
|
|
sText += "<b>" QSAMPLER_TITLE " - " + tr(QSAMPLER_SUBTITLE) + "</b><br />\n"; |
|
|
sText += "<br />\n"; |
|
|
sText += tr("Version") + ": <b>" QSAMPLER_VERSION "</b><br />\n"; |
|
|
sText += "<small>" + tr("Build") + ": " __DATE__ " " __TIME__ "</small><br />\n"; |
|
1981 |
#ifdef CONFIG_DEBUG |
#ifdef CONFIG_DEBUG |
1982 |
sText += "<small><font color=\"red\">"; |
list << tr("Debugging option enabled."); |
|
sText += tr("Debugging option enabled."); |
|
|
sText += "</font></small><br />"; |
|
1983 |
#endif |
#endif |
1984 |
#ifndef CONFIG_LIBGIG |
#ifndef CONFIG_LIBGIG |
1985 |
sText += "<small><font color=\"red\">"; |
list << tr("GIG (libgig) file support disabled."); |
|
sText += tr("GIG (libgig) file support disabled."); |
|
|
sText += "</font></small><br />"; |
|
1986 |
#endif |
#endif |
1987 |
#ifndef CONFIG_INSTRUMENT_NAME |
#ifndef CONFIG_INSTRUMENT_NAME |
1988 |
sText += "<small><font color=\"red\">"; |
list << tr("LSCP (liblscp) instrument_name support disabled."); |
|
sText += tr("LSCP (liblscp) instrument_name support disabled."); |
|
|
sText += "</font></small><br />"; |
|
1989 |
#endif |
#endif |
1990 |
#ifndef CONFIG_MUTE_SOLO |
#ifndef CONFIG_MUTE_SOLO |
1991 |
sText += "<small><font color=\"red\">"; |
list << tr("Sampler channel Mute/Solo support disabled."); |
|
sText += tr("Sampler channel Mute/Solo support disabled."); |
|
|
sText += "</font></small><br />"; |
|
1992 |
#endif |
#endif |
1993 |
#ifndef CONFIG_AUDIO_ROUTING |
#ifndef CONFIG_AUDIO_ROUTING |
1994 |
sText += "<small><font color=\"red\">"; |
list << tr("LSCP (liblscp) audio_routing support disabled."); |
|
sText += tr("LSCP (liblscp) audio_routing support disabled."); |
|
|
sText += "</font></small><br />"; |
|
1995 |
#endif |
#endif |
1996 |
#ifndef CONFIG_FXSEND |
#ifndef CONFIG_FXSEND |
1997 |
sText += "<small><font color=\"red\">"; |
list << tr("Sampler channel Effect Sends support disabled."); |
|
sText += tr("Sampler channel Effect Sends support disabled."); |
|
|
sText += "</font></small><br />"; |
|
1998 |
#endif |
#endif |
1999 |
#ifndef CONFIG_VOLUME |
#ifndef CONFIG_VOLUME |
2000 |
sText += "<small><font color=\"red\">"; |
list << tr("Global volume support disabled."); |
|
sText += tr("Global volume support disabled."); |
|
|
sText += "</font></small><br />"; |
|
2001 |
#endif |
#endif |
2002 |
#ifndef CONFIG_MIDI_INSTRUMENT |
#ifndef CONFIG_MIDI_INSTRUMENT |
2003 |
sText += "<small><font color=\"red\">"; |
list << tr("MIDI instrument mapping support disabled."); |
|
sText += tr("MIDI instrument mapping support disabled."); |
|
|
sText += "</font></small><br />"; |
|
2004 |
#endif |
#endif |
2005 |
#ifndef CONFIG_EDIT_INSTRUMENT |
#ifndef CONFIG_EDIT_INSTRUMENT |
2006 |
sText += "<small><font color=\"red\">"; |
list << tr("Instrument editing support disabled."); |
|
sText += tr("Instrument editing support disabled."); |
|
|
sText += "</font></small><br />"; |
|
2007 |
#endif |
#endif |
2008 |
#ifndef CONFIG_EVENT_CHANNEL_MIDI |
#ifndef CONFIG_EVENT_CHANNEL_MIDI |
2009 |
sText += "<small><font color=\"red\">"; |
list << tr("Channel MIDI event support disabled."); |
|
sText += tr("Channel MIDI event support disabled."); |
|
|
sText += "</font></small><br />"; |
|
2010 |
#endif |
#endif |
2011 |
#ifndef CONFIG_EVENT_DEVICE_MIDI |
#ifndef CONFIG_EVENT_DEVICE_MIDI |
2012 |
sText += "<small><font color=\"red\">"; |
list << tr("Device MIDI event support disabled."); |
|
sText += tr("Device MIDI event support disabled."); |
|
|
sText += "</font></small><br />"; |
|
2013 |
#endif |
#endif |
2014 |
#ifndef CONFIG_MAX_VOICES |
#ifndef CONFIG_MAX_VOICES |
2015 |
sText += "<small><font color=\"red\">"; |
list << tr("Runtime max. voices / disk streams support disabled."); |
|
sText += tr("Runtime max. voices / disk streams support disabled."); |
|
|
sText += "</font></small><br />"; |
|
2016 |
#endif |
#endif |
2017 |
|
|
2018 |
|
// Stuff the about box text... |
2019 |
|
QString sText = "<p>\n"; |
2020 |
|
sText += "<b>" QSAMPLER_TITLE " - " + tr(QSAMPLER_SUBTITLE) + "</b><br />\n"; |
2021 |
|
sText += "<br />\n"; |
2022 |
|
sText += tr("Version") + ": <b>" CONFIG_BUILD_VERSION "</b><br />\n"; |
2023 |
|
// sText += "<small>" + tr("Build") + ": " CONFIG_BUILD_DATE "</small><br />\n"; |
2024 |
|
if (!list.isEmpty()) { |
2025 |
|
sText += "<small><font color=\"red\">"; |
2026 |
|
sText += list.join("<br />\n"); |
2027 |
|
sText += "</font></small>"; |
2028 |
|
} |
2029 |
sText += "<br />\n"; |
sText += "<br />\n"; |
2030 |
sText += tr("Using") + ": "; |
sText += tr("Using") + ": "; |
2031 |
sText += ::lscp_client_package(); |
sText += ::lscp_client_package(); |
2055 |
|
|
2056 |
|
|
2057 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
2058 |
// qsamplerMainForm -- Main window stabilization. |
// QSampler::MainForm -- Main window stabilization. |
2059 |
|
|
2060 |
void MainForm::stabilizeForm (void) |
void MainForm::stabilizeForm (void) |
2061 |
{ |
{ |
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) |
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 |
const QList<QMdiSubWindow *>& wlist |
const QList<QMdiSubWindow *>& wlist |
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 ) |
2604 |
delete pMdiSubWindow; |
delete pMdiSubWindow; |
2605 |
|
|
2606 |
// Do we auto-arrange? |
// Do we auto-arrange? |
2607 |
if (m_pOptions && m_pOptions->bAutoArrange) |
channelsArrangeAuto(); |
|
channelsArrange(); |
|
2608 |
} |
} |
2609 |
|
|
2610 |
|
|
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 ) |
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) |
2820 |
|
|
2821 |
// OK. Let's build the startup process... |
// OK. Let's build the startup process... |
2822 |
m_pServer = new QProcess(); |
m_pServer = new QProcess(); |
2823 |
bForceServerStop = true; |
m_bForceServerStop = true; |
2824 |
|
|
2825 |
// Setup stdout/stderr capture... |
// Setup stdout/stderr capture... |
2826 |
m_pServer->setProcessChannelMode(QProcess::ForwardedChannels); |
m_pServer->setProcessChannelMode(QProcess::ForwardedChannels); |
2864 |
|
|
2865 |
|
|
2866 |
// Stop linuxsampler server... |
// Stop linuxsampler server... |
2867 |
void MainForm::stopServer (bool bInteractive) |
void MainForm::stopServer ( bool bInteractive ) |
2868 |
{ |
{ |
2869 |
// Stop client code. |
// Stop client code. |
2870 |
stopClient(); |
stopClient(); |
2878 |
"sampler session at any time by relaunching QSampler.\n\n" |
"sampler session at any time by relaunching QSampler.\n\n" |
2879 |
"Do you want LinuxSampler to stop?"), |
"Do you want LinuxSampler to stop?"), |
2880 |
QMessageBox::Yes | QMessageBox::No, |
QMessageBox::Yes | QMessageBox::No, |
2881 |
QMessageBox::Yes) == QMessageBox::No) |
QMessageBox::Yes) == QMessageBox::No) { |
2882 |
{ |
m_bForceServerStop = false; |
|
bForceServerStop = false; |
|
2883 |
} |
} |
2884 |
} |
} |
2885 |
|
|
2886 |
|
bool bGraceWait = true; |
2887 |
|
|
2888 |
// And try to stop server. |
// And try to stop server. |
2889 |
if (m_pServer && bForceServerStop) { |
if (m_pServer && m_bForceServerStop) { |
2890 |
appendMessages(tr("Server is stopping...")); |
appendMessages(tr("Server is stopping...")); |
2891 |
if (m_pServer->state() == QProcess::Running) { |
if (m_pServer->state() == QProcess::Running) { |
2892 |
#if defined(WIN32) |
#if defined(__WIN32__) || defined(_WIN32) || defined(WIN32) |
2893 |
// Try harder... |
// Try harder... |
2894 |
m_pServer->kill(); |
m_pServer->kill(); |
2895 |
#else |
#else |
2896 |
// Try softly... |
// Try softly... |
2897 |
m_pServer->terminate(); |
m_pServer->terminate(); |
2898 |
|
bool bFinished = m_pServer->waitForFinished(QSAMPLER_TIMER_MSECS * 1000); |
2899 |
|
if (bFinished) bGraceWait = false; |
2900 |
#endif |
#endif |
2901 |
} |
} |
2902 |
} // Do final processing anyway. |
} // Do final processing anyway. |
2903 |
else processServerExit(); |
else processServerExit(); |
2904 |
|
|
2905 |
// Give it some time to terminate gracefully and stabilize... |
// Give it some time to terminate gracefully and stabilize... |
2906 |
QTime t; |
if (bGraceWait) { |
2907 |
t.start(); |
QTime t; |
2908 |
while (t.elapsed() < QSAMPLER_TIMER_MSECS) |
t.start(); |
2909 |
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents); |
while (t.elapsed() < QSAMPLER_TIMER_MSECS) |
2910 |
|
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents); |
2911 |
|
} |
2912 |
} |
} |
2913 |
|
|
2914 |
|
|
2930 |
if (m_pMessages) |
if (m_pMessages) |
2931 |
m_pMessages->flushStdoutBuffer(); |
m_pMessages->flushStdoutBuffer(); |
2932 |
|
|
2933 |
if (m_pServer && bForceServerStop) { |
if (m_pServer && m_bForceServerStop) { |
2934 |
if (m_pServer->state() != QProcess::NotRunning) { |
if (m_pServer->state() != QProcess::NotRunning) { |
2935 |
appendMessages(tr("Server is being forced...")); |
appendMessages(tr("Server is being forced...")); |
2936 |
// Force final server shutdown... |
// Force final server shutdown... |
2955 |
|
|
2956 |
|
|
2957 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
2958 |
// qsamplerMainForm -- Client stuff. |
// QSampler::MainForm -- Client stuff. |
2959 |
|
|
2960 |
// The LSCP client callback procedure. |
// The LSCP client callback procedure. |
2961 |
lscp_status_t qsampler_client_callback ( lscp_client_t */*pClient*/, |
lscp_status_t qsampler_client_callback ( lscp_client_t */*pClient*/, |
3007 |
stabilizeForm(); |
stabilizeForm(); |
3008 |
return false; |
return false; |
3009 |
} |
} |
3010 |
|
|
3011 |
// Just set receive timeout value, blindly. |
// Just set receive timeout value, blindly. |
3012 |
::lscp_client_set_timeout(m_pClient, m_pOptions->iServerTimeout); |
::lscp_client_set_timeout(m_pClient, m_pOptions->iServerTimeout); |
3013 |
appendMessages( |
appendMessages( |