1 |
// qsamplerMainForm.cpp |
// qsamplerMainForm.cpp |
2 |
// |
// |
3 |
/**************************************************************************** |
/**************************************************************************** |
4 |
Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved. |
Copyright (C) 2004-2009, 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 |
391 |
#else |
#else |
392 |
viewInstrumentsAction->setEnabled(false); |
viewInstrumentsAction->setEnabled(false); |
393 |
#endif |
#endif |
394 |
|
// Setup messages logging appropriately... |
395 |
|
m_pMessages->setLogging( |
396 |
|
m_pOptions->bMessagesLog, |
397 |
|
m_pOptions->sMessagesLogPath); |
398 |
// Set message defaults... |
// Set message defaults... |
399 |
updateMessagesFont(); |
updateMessagesFont(); |
400 |
updateMessagesLimit(); |
updateMessagesLimit(); |
585 |
case LSCP_EVENT_AUDIO_OUTPUT_DEVICE_INFO: |
case LSCP_EVENT_AUDIO_OUTPUT_DEVICE_INFO: |
586 |
if (m_pDeviceForm) m_pDeviceForm->refreshDevices(); |
if (m_pDeviceForm) m_pDeviceForm->refreshDevices(); |
587 |
break; |
break; |
588 |
#if CONFIG_LSCP_CHANNEL_MIDI |
#if CONFIG_EVENT_CHANNEL_MIDI |
589 |
case LSCP_EVENT_CHANNEL_MIDI: { |
case LSCP_EVENT_CHANNEL_MIDI: { |
590 |
const int iChannelID = pEvent->data().section(' ', 0, 0).toInt(); |
const int iChannelID = pEvent->data().section(' ', 0, 0).toInt(); |
591 |
ChannelStrip *pChannelStrip = channelStrip(iChannelID); |
ChannelStrip *pChannelStrip = channelStrip(iChannelID); |
594 |
break; |
break; |
595 |
} |
} |
596 |
#endif |
#endif |
597 |
#if CONFIG_LSCP_DEVICE_MIDI |
#if CONFIG_EVENT_DEVICE_MIDI |
598 |
case LSCP_EVENT_DEVICE_MIDI: { |
case LSCP_EVENT_DEVICE_MIDI: { |
599 |
const int iDeviceID = pEvent->data().section(' ', 0, 0).toInt(); |
const int iDeviceID = pEvent->data().section(' ', 0, 0).toInt(); |
600 |
const int iPortID = pEvent->data().section(' ', 1, 1).toInt(); |
const int iPortID = pEvent->data().section(' ', 1, 1).toInt(); |
759 |
"\"%1\"\n\n" |
"\"%1\"\n\n" |
760 |
"Do you want to replace it?") |
"Do you want to replace it?") |
761 |
.arg(sFilename), |
.arg(sFilename), |
762 |
tr("Replace"), tr("Cancel")) > 0) |
QMessageBox::Yes | QMessageBox::No) |
763 |
|
== QMessageBox::No) |
764 |
return false; |
return false; |
765 |
} |
} |
766 |
} |
} |
783 |
"\"%1\"\n\n" |
"\"%1\"\n\n" |
784 |
"Do you want to save the changes?") |
"Do you want to save the changes?") |
785 |
.arg(sessionName(m_sFilename)), |
.arg(sessionName(m_sFilename)), |
786 |
tr("Save"), tr("Discard"), tr("Cancel"))) { |
QMessageBox::Save | |
787 |
case 0: // Save... |
QMessageBox::Discard | |
788 |
|
QMessageBox::Cancel)) { |
789 |
|
case QMessageBox::Save: |
790 |
bClose = saveSession(false); |
bClose = saveSession(false); |
791 |
// Fall thru.... |
// Fall thru.... |
792 |
case 1: // Discard |
case QMessageBox::Discard: |
793 |
break; |
break; |
794 |
default: // Cancel. |
default: // Cancel. |
795 |
bClose = false; |
bClose = false; |
1310 |
"Please note that this operation may cause\n" |
"Please note that this operation may cause\n" |
1311 |
"temporary MIDI and Audio disruption.\n\n" |
"temporary MIDI and Audio disruption.\n\n" |
1312 |
"Do you want to reset the sampler engine now?"), |
"Do you want to reset the sampler engine now?"), |
1313 |
tr("Reset"), tr("Cancel")) > 0) |
QMessageBox::Ok | QMessageBox::Cancel) |
1314 |
|
== QMessageBox::Cancel) |
1315 |
return; |
return; |
1316 |
|
|
1317 |
// Trye closing the current session, first... |
// Trye closing the current session, first... |
1352 |
"Please note that this operation may cause\n" |
"Please note that this operation may cause\n" |
1353 |
"temporary MIDI and Audio disruption.\n\n" |
"temporary MIDI and Audio disruption.\n\n" |
1354 |
"Do you want to restart the connection now?"), |
"Do you want to restart the connection now?"), |
1355 |
tr("Restart"), tr("Cancel")) == 0); |
QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Ok); |
1356 |
} |
} |
1357 |
|
|
1358 |
// Are we still for it? |
// Are we still for it? |
1433 |
"%1\n\n" |
"%1\n\n" |
1434 |
"Are you sure?") |
"Are you sure?") |
1435 |
.arg(pChannelStrip->windowTitle()), |
.arg(pChannelStrip->windowTitle()), |
1436 |
tr("OK"), tr("Cancel")) > 0) |
QMessageBox::Ok | QMessageBox::Cancel) |
1437 |
|
== QMessageBox::Cancel) |
1438 |
return; |
return; |
1439 |
} |
} |
1440 |
|
|
1625 |
int iOldServerTimeout = m_pOptions->iServerTimeout; |
int iOldServerTimeout = m_pOptions->iServerTimeout; |
1626 |
bool bOldServerStart = m_pOptions->bServerStart; |
bool bOldServerStart = m_pOptions->bServerStart; |
1627 |
QString sOldServerCmdLine = m_pOptions->sServerCmdLine; |
QString sOldServerCmdLine = m_pOptions->sServerCmdLine; |
1628 |
|
bool bOldMessagesLog = m_pOptions->bMessagesLog; |
1629 |
|
QString sOldMessagesLogPath = m_pOptions->sMessagesLogPath; |
1630 |
QString sOldDisplayFont = m_pOptions->sDisplayFont; |
QString sOldDisplayFont = m_pOptions->sDisplayFont; |
1631 |
bool bOldDisplayEffect = m_pOptions->bDisplayEffect; |
bool bOldDisplayEffect = m_pOptions->bDisplayEffect; |
1632 |
int iOldMaxVolume = m_pOptions->iMaxVolume; |
int iOldMaxVolume = m_pOptions->iMaxVolume; |
1638 |
bool bOldCompletePath = m_pOptions->bCompletePath; |
bool bOldCompletePath = m_pOptions->bCompletePath; |
1639 |
bool bOldInstrumentNames = m_pOptions->bInstrumentNames; |
bool bOldInstrumentNames = m_pOptions->bInstrumentNames; |
1640 |
int iOldMaxRecentFiles = m_pOptions->iMaxRecentFiles; |
int iOldMaxRecentFiles = m_pOptions->iMaxRecentFiles; |
1641 |
|
int iOldBaseFontSize = m_pOptions->iBaseFontSize; |
1642 |
// Load the current setup settings. |
// Load the current setup settings. |
1643 |
pOptionsForm->setup(m_pOptions); |
pOptionsForm->setup(m_pOptions); |
1644 |
// Show the setup dialog... |
// Show the setup dialog... |
1647 |
if (( bOldStdoutCapture && !m_pOptions->bStdoutCapture) || |
if (( bOldStdoutCapture && !m_pOptions->bStdoutCapture) || |
1648 |
(!bOldStdoutCapture && m_pOptions->bStdoutCapture) || |
(!bOldStdoutCapture && m_pOptions->bStdoutCapture) || |
1649 |
( bOldKeepOnTop && !m_pOptions->bKeepOnTop) || |
( bOldKeepOnTop && !m_pOptions->bKeepOnTop) || |
1650 |
(!bOldKeepOnTop && m_pOptions->bKeepOnTop)) { |
(!bOldKeepOnTop && m_pOptions->bKeepOnTop) || |
1651 |
|
(iOldBaseFontSize != m_pOptions->iBaseFontSize)) { |
1652 |
QMessageBox::information(this, |
QMessageBox::information(this, |
1653 |
QSAMPLER_TITLE ": " + tr("Information"), |
QSAMPLER_TITLE ": " + tr("Information"), |
1654 |
tr("Some settings may be only effective\n" |
tr("Some settings may be only effective\n" |
1655 |
"next time you start this program."), tr("OK")); |
"next time you start this program.")); |
1656 |
updateMessagesCapture(); |
updateMessagesCapture(); |
1657 |
} |
} |
1658 |
// Check wheather something immediate has changed. |
// Check wheather something immediate has changed. |
1659 |
|
if (( bOldMessagesLog && !m_pOptions->bMessagesLog) || |
1660 |
|
(!bOldMessagesLog && m_pOptions->bMessagesLog) || |
1661 |
|
(sOldMessagesLogPath != m_pOptions->sMessagesLogPath)) |
1662 |
|
m_pMessages->setLogging( |
1663 |
|
m_pOptions->bMessagesLog, m_pOptions->sMessagesLogPath); |
1664 |
if (( bOldCompletePath && !m_pOptions->bCompletePath) || |
if (( bOldCompletePath && !m_pOptions->bCompletePath) || |
1665 |
(!bOldCompletePath && m_pOptions->bCompletePath) || |
(!bOldCompletePath && m_pOptions->bCompletePath) || |
1666 |
(iOldMaxRecentFiles != m_pOptions->iMaxRecentFiles)) |
(iOldMaxRecentFiles != m_pOptions->iMaxRecentFiles)) |
1815 |
sText += tr("Instrument editing support disabled."); |
sText += tr("Instrument editing support disabled."); |
1816 |
sText += "</font></small><br />"; |
sText += "</font></small><br />"; |
1817 |
#endif |
#endif |
1818 |
|
#ifndef CONFIG_EVENT_CHANNEL_MIDI |
1819 |
|
sText += "<small><font color=\"red\">"; |
1820 |
|
sText += tr("Channel MIDI event support disabled."); |
1821 |
|
sText += "</font></small><br />"; |
1822 |
|
#endif |
1823 |
|
#ifndef CONFIG_EVENT_DEVICE_MIDI |
1824 |
|
sText += "<small><font color=\"red\">"; |
1825 |
|
sText += tr("Device MIDI event support disabled."); |
1826 |
|
sText += "</font></small><br />"; |
1827 |
|
#endif |
1828 |
|
#ifndef CONFIG_MAX_VOICES |
1829 |
|
sText += "<small><font color=\"red\">"; |
1830 |
|
sText += tr("Runtime max. voices / disk streams support disabled."); |
1831 |
|
sText += "</font></small><br />"; |
1832 |
|
#endif |
1833 |
sText += "<br />\n"; |
sText += "<br />\n"; |
1834 |
sText += tr("Using") + ": "; |
sText += tr("Using") + ": "; |
1835 |
sText += ::lscp_client_package(); |
sText += ::lscp_client_package(); |
2233 |
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents); |
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents); |
2234 |
|
|
2235 |
QMessageBox::critical(this, |
QMessageBox::critical(this, |
2236 |
QSAMPLER_TITLE ": " + tr("Error"), s, tr("Cancel")); |
QSAMPLER_TITLE ": " + tr("Error"), s, QMessageBox::Cancel); |
2237 |
} |
} |
2238 |
|
|
2239 |
|
|
2521 |
|
|
2522 |
// Is the server process instance still here? |
// Is the server process instance still here? |
2523 |
if (m_pServer) { |
if (m_pServer) { |
2524 |
switch (QMessageBox::warning(this, |
if (QMessageBox::warning(this, |
2525 |
QSAMPLER_TITLE ": " + tr("Warning"), |
QSAMPLER_TITLE ": " + tr("Warning"), |
2526 |
tr("Could not start the LinuxSampler server.\n\n" |
tr("Could not start the LinuxSampler server.\n\n" |
2527 |
"Maybe it is already started."), |
"Maybe it is already started."), |
2528 |
tr("Stop"), tr("Kill"), tr("Cancel"))) { |
QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Ok) { |
|
case 0: |
|
2529 |
m_pServer->terminate(); |
m_pServer->terminate(); |
|
break; |
|
|
case 1: |
|
2530 |
m_pServer->kill(); |
m_pServer->kill(); |
|
break; |
|
2531 |
} |
} |
2532 |
return; |
return; |
2533 |
} |
} |
2601 |
"running in the background. The sampler would continue to work\n" |
"running in the background. The sampler would continue to work\n" |
2602 |
"according to your current sampler session and you could alter the\n" |
"according to your current sampler session and you could alter the\n" |
2603 |
"sampler session at any time by relaunching QSampler.\n\n" |
"sampler session at any time by relaunching QSampler.\n\n" |
2604 |
"Do you want LinuxSampler to stop or to keep running in\n" |
"Do you want LinuxSampler to stop?"), |
2605 |
"the background?"), |
QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) |
|
tr("Stop"), tr("Keep Running")) == 1) |
|
2606 |
{ |
{ |
2607 |
bForceServerStop = false; |
bForceServerStop = false; |
2608 |
} |
} |
2749 |
if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_AUDIO_OUTPUT_DEVICE_INFO) != LSCP_OK) |
if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_AUDIO_OUTPUT_DEVICE_INFO) != LSCP_OK) |
2750 |
appendMessagesClient("lscp_client_subscribe(AUDIO_OUTPUT_DEVICE_INFO)"); |
appendMessagesClient("lscp_client_subscribe(AUDIO_OUTPUT_DEVICE_INFO)"); |
2751 |
|
|
2752 |
#if CONFIG_LSCP_CHANNEL_MIDI |
#if CONFIG_EVENT_CHANNEL_MIDI |
2753 |
// Subscribe to channel MIDI data notifications... |
// Subscribe to channel MIDI data notifications... |
2754 |
if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_CHANNEL_MIDI) != LSCP_OK) |
if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_CHANNEL_MIDI) != LSCP_OK) |
2755 |
appendMessagesClient("lscp_client_subscribe(CHANNEL_MIDI)"); |
appendMessagesClient("lscp_client_subscribe(CHANNEL_MIDI)"); |
2756 |
#endif |
#endif |
2757 |
|
|
2758 |
#if CONFIG_LSCP_DEVICE_MIDI |
#if CONFIG_EVENT_DEVICE_MIDI |
2759 |
// Subscribe to channel MIDI data notifications... |
// Subscribe to channel MIDI data notifications... |
2760 |
if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_DEVICE_MIDI) != LSCP_OK) |
if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_DEVICE_MIDI) != LSCP_OK) |
2761 |
appendMessagesClient("lscp_client_subscribe(DEVICE_MIDI)"); |
appendMessagesClient("lscp_client_subscribe(DEVICE_MIDI)"); |
2786 |
} |
} |
2787 |
} |
} |
2788 |
|
|
2789 |
|
// send the current / loaded fine tuning settings to the sampler |
2790 |
|
m_pOptions->sendFineTuningSettings(); |
2791 |
|
|
2792 |
// Make a new session |
// Make a new session |
2793 |
return newSession(); |
return newSession(); |
2794 |
} |
} |
2816 |
closeSession(false); |
closeSession(false); |
2817 |
|
|
2818 |
// Close us as a client... |
// Close us as a client... |
2819 |
#if CONFIG_LSCP_DEVICE_MIDI |
#if CONFIG_EVENT_DEVICE_MIDI |
2820 |
::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_DEVICE_MIDI); |
::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_DEVICE_MIDI); |
2821 |
#endif |
#endif |
2822 |
#if CONFIG_LSCP_CHANNEL_MIDI |
#if CONFIG_EVENT_CHANNEL_MIDI |
2823 |
::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_CHANNEL_MIDI); |
::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_CHANNEL_MIDI); |
2824 |
#endif |
#endif |
2825 |
::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_AUDIO_OUTPUT_DEVICE_INFO); |
::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_AUDIO_OUTPUT_DEVICE_INFO); |