1 |
// qsamplerMainForm.cpp |
// qsamplerMainForm.cpp |
2 |
// |
// |
3 |
/**************************************************************************** |
/**************************************************************************** |
4 |
Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved. |
Copyright (C) 2004-2010, 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 |
56 |
#include <QTimer> |
#include <QTimer> |
57 |
#include <QDateTime> |
#include <QDateTime> |
58 |
|
|
59 |
|
#if QT_VERSION < 0x040500 |
60 |
|
namespace Qt { |
61 |
|
const WindowFlags WindowCloseButtonHint = WindowFlags(0x08000000); |
62 |
|
#if QT_VERSION < 0x040200 |
63 |
|
const WindowFlags CustomizeWindowHint = WindowFlags(0x02000000); |
64 |
|
#endif |
65 |
|
} |
66 |
|
#endif |
67 |
|
|
68 |
#ifdef HAVE_SIGNAL_H |
#ifdef HAVE_SIGNAL_H |
69 |
#include <signal.h> |
#include <signal.h> |
383 |
|
|
384 |
// What style do we create these forms? |
// What style do we create these forms? |
385 |
Qt::WindowFlags wflags = Qt::Window |
Qt::WindowFlags wflags = Qt::Window |
|
#if QT_VERSION >= 0x040200 |
|
386 |
| Qt::CustomizeWindowHint |
| Qt::CustomizeWindowHint |
|
#endif |
|
387 |
| Qt::WindowTitleHint |
| Qt::WindowTitleHint |
388 |
| Qt::WindowSystemMenuHint |
| Qt::WindowSystemMenuHint |
389 |
| Qt::WindowMinMaxButtonsHint; |
| Qt::WindowMinMaxButtonsHint |
390 |
|
| Qt::WindowCloseButtonHint; |
391 |
if (m_pOptions->bKeepOnTop) |
if (m_pOptions->bKeepOnTop) |
392 |
wflags |= Qt::Tool; |
wflags |= Qt::Tool; |
393 |
|
|
394 |
// Some child forms are to be created right now. |
// Some child forms are to be created right now. |
395 |
m_pMessages = new Messages(this); |
m_pMessages = new Messages(this); |
396 |
m_pDeviceForm = new DeviceForm(this, wflags); |
m_pDeviceForm = new DeviceForm(this, wflags); |
397 |
#ifdef CONFIG_MIDI_INSTRUMENT |
#ifdef CONFIG_MIDI_INSTRUMENT |
398 |
m_pInstrumentListForm = new InstrumentListForm(this, wflags); |
m_pInstrumentListForm = new InstrumentListForm(this, wflags); |
399 |
#else |
#else |
400 |
viewInstrumentsAction->setEnabled(false); |
m_ui.viewInstrumentsAction->setEnabled(false); |
401 |
#endif |
#endif |
402 |
|
|
403 |
|
// Setup messages logging appropriately... |
404 |
|
m_pMessages->setLogging( |
405 |
|
m_pOptions->bMessagesLog, |
406 |
|
m_pOptions->sMessagesLogPath); |
407 |
|
|
408 |
// Set message defaults... |
// Set message defaults... |
409 |
updateMessagesFont(); |
updateMessagesFont(); |
410 |
updateMessagesLimit(); |
updateMessagesLimit(); |
568 |
if (pCustomEvent->type() == QSAMPLER_CUSTOM_EVENT) { |
if (pCustomEvent->type() == QSAMPLER_CUSTOM_EVENT) { |
569 |
CustomEvent *pEvent = static_cast<CustomEvent *> (pCustomEvent); |
CustomEvent *pEvent = static_cast<CustomEvent *> (pCustomEvent); |
570 |
switch (pEvent->event()) { |
switch (pEvent->event()) { |
571 |
|
case LSCP_EVENT_CHANNEL_COUNT: |
572 |
|
updateAllChannelStrips(true); |
573 |
|
break; |
574 |
case LSCP_EVENT_CHANNEL_INFO: { |
case LSCP_EVENT_CHANNEL_INFO: { |
575 |
int iChannelID = pEvent->data().toInt(); |
int iChannelID = pEvent->data().toInt(); |
576 |
ChannelStrip *pChannelStrip = channelStrip(iChannelID); |
ChannelStrip *pChannelStrip = channelStrip(iChannelID); |
589 |
DeviceStatusForm::onDeviceChanged(iDeviceID); |
DeviceStatusForm::onDeviceChanged(iDeviceID); |
590 |
break; |
break; |
591 |
} |
} |
592 |
#if CONFIG_LSCP_CHANNEL_MIDI |
case LSCP_EVENT_AUDIO_OUTPUT_DEVICE_COUNT: |
593 |
|
if (m_pDeviceForm) m_pDeviceForm->refreshDevices(); |
594 |
|
break; |
595 |
|
case LSCP_EVENT_AUDIO_OUTPUT_DEVICE_INFO: |
596 |
|
if (m_pDeviceForm) m_pDeviceForm->refreshDevices(); |
597 |
|
break; |
598 |
|
#if CONFIG_EVENT_CHANNEL_MIDI |
599 |
case LSCP_EVENT_CHANNEL_MIDI: { |
case LSCP_EVENT_CHANNEL_MIDI: { |
600 |
const int iChannelID = pEvent->data().section(' ', 0, 0).toInt(); |
const int iChannelID = pEvent->data().section(' ', 0, 0).toInt(); |
601 |
ChannelStrip *pChannelStrip = channelStrip(iChannelID); |
ChannelStrip *pChannelStrip = channelStrip(iChannelID); |
602 |
if (pChannelStrip) |
if (pChannelStrip) |
603 |
pChannelStrip->midiArrived(); |
pChannelStrip->midiActivityLedOn(); |
604 |
break; |
break; |
605 |
} |
} |
606 |
#endif |
#endif |
607 |
#if CONFIG_LSCP_DEVICE_MIDI |
#if CONFIG_EVENT_DEVICE_MIDI |
608 |
case LSCP_EVENT_DEVICE_MIDI: { |
case LSCP_EVENT_DEVICE_MIDI: { |
609 |
const int iDeviceID = pEvent->data().section(' ', 0, 0).toInt(); |
const int iDeviceID = pEvent->data().section(' ', 0, 0).toInt(); |
610 |
const int iPortID = pEvent->data().section(' ', 1, 1).toInt(); |
const int iPortID = pEvent->data().section(' ', 1, 1).toInt(); |
611 |
DeviceStatusForm* pDeviceStatusForm = |
DeviceStatusForm *pDeviceStatusForm |
612 |
DeviceStatusForm::getInstance(iDeviceID); |
= DeviceStatusForm::getInstance(iDeviceID); |
613 |
if (pDeviceStatusForm) |
if (pDeviceStatusForm) |
614 |
pDeviceStatusForm->midiArrived(iPortID); |
pDeviceStatusForm->midiArrived(iPortID); |
615 |
break; |
break; |
616 |
} |
} |
617 |
#endif |
#endif |
618 |
default: |
default: |
619 |
appendMessagesColor(tr("Notify event: %1 data: %2") |
appendMessagesColor(tr("Notify event: %1 data: %2") |
620 |
.arg(::lscp_event_to_text(pEvent->event())) |
.arg(::lscp_event_to_text(pEvent->event())) |
623 |
} |
} |
624 |
} |
} |
625 |
|
|
626 |
void MainForm::updateViewMidiDeviceStatusMenu() { |
|
627 |
|
void MainForm::updateViewMidiDeviceStatusMenu (void) |
628 |
|
{ |
629 |
m_ui.viewMidiDeviceStatusMenu->clear(); |
m_ui.viewMidiDeviceStatusMenu->clear(); |
630 |
const std::map<int, DeviceStatusForm*> statusForms = |
const std::map<int, DeviceStatusForm *> statusForms |
631 |
DeviceStatusForm::getInstances(); |
= DeviceStatusForm::getInstances(); |
632 |
for ( |
std::map<int, DeviceStatusForm *>::const_iterator iter |
633 |
std::map<int, DeviceStatusForm*>::const_iterator iter = statusForms.begin(); |
= statusForms.begin(); |
634 |
iter != statusForms.end(); ++iter |
for ( ; iter != statusForms.end(); ++iter) { |
635 |
) { |
DeviceStatusForm *pStatusForm = iter->second; |
|
DeviceStatusForm* pForm = iter->second; |
|
636 |
m_ui.viewMidiDeviceStatusMenu->addAction( |
m_ui.viewMidiDeviceStatusMenu->addAction( |
637 |
pForm->visibleAction() |
pStatusForm->visibleAction()); |
|
); |
|
638 |
} |
} |
639 |
} |
} |
640 |
|
|
641 |
|
|
642 |
// Context menu event handler. |
// Context menu event handler. |
643 |
void MainForm::contextMenuEvent( QContextMenuEvent *pEvent ) |
void MainForm::contextMenuEvent( QContextMenuEvent *pEvent ) |
644 |
{ |
{ |
770 |
"\"%1\"\n\n" |
"\"%1\"\n\n" |
771 |
"Do you want to replace it?") |
"Do you want to replace it?") |
772 |
.arg(sFilename), |
.arg(sFilename), |
773 |
tr("Replace"), tr("Cancel")) > 0) |
QMessageBox::Yes | QMessageBox::No) |
774 |
|
== QMessageBox::No) |
775 |
return false; |
return false; |
776 |
} |
} |
777 |
} |
} |
794 |
"\"%1\"\n\n" |
"\"%1\"\n\n" |
795 |
"Do you want to save the changes?") |
"Do you want to save the changes?") |
796 |
.arg(sessionName(m_sFilename)), |
.arg(sessionName(m_sFilename)), |
797 |
tr("Save"), tr("Discard"), tr("Cancel"))) { |
QMessageBox::Save | |
798 |
case 0: // Save... |
QMessageBox::Discard | |
799 |
|
QMessageBox::Cancel)) { |
800 |
|
case QMessageBox::Save: |
801 |
bClose = saveSession(false); |
bClose = saveSession(false); |
802 |
// Fall thru.... |
// Fall thru.... |
803 |
case 1: // Discard |
case QMessageBox::Discard: |
804 |
break; |
break; |
805 |
default: // Cancel. |
default: // Cancel. |
806 |
bClose = false; |
bClose = false; |
1321 |
"Please note that this operation may cause\n" |
"Please note that this operation may cause\n" |
1322 |
"temporary MIDI and Audio disruption.\n\n" |
"temporary MIDI and Audio disruption.\n\n" |
1323 |
"Do you want to reset the sampler engine now?"), |
"Do you want to reset the sampler engine now?"), |
1324 |
tr("Reset"), tr("Cancel")) > 0) |
QMessageBox::Ok | QMessageBox::Cancel) |
1325 |
|
== QMessageBox::Cancel) |
1326 |
return; |
return; |
1327 |
|
|
1328 |
// Trye closing the current session, first... |
// Trye closing the current session, first... |
1363 |
"Please note that this operation may cause\n" |
"Please note that this operation may cause\n" |
1364 |
"temporary MIDI and Audio disruption.\n\n" |
"temporary MIDI and Audio disruption.\n\n" |
1365 |
"Do you want to restart the connection now?"), |
"Do you want to restart the connection now?"), |
1366 |
tr("Restart"), tr("Cancel")) == 0); |
QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Ok); |
1367 |
} |
} |
1368 |
|
|
1369 |
// Are we still for it? |
// Are we still for it? |
1444 |
"%1\n\n" |
"%1\n\n" |
1445 |
"Are you sure?") |
"Are you sure?") |
1446 |
.arg(pChannelStrip->windowTitle()), |
.arg(pChannelStrip->windowTitle()), |
1447 |
tr("OK"), tr("Cancel")) > 0) |
QMessageBox::Ok | QMessageBox::Cancel) |
1448 |
|
== QMessageBox::Cancel) |
1449 |
return; |
return; |
1450 |
} |
} |
1451 |
|
|
1636 |
int iOldServerTimeout = m_pOptions->iServerTimeout; |
int iOldServerTimeout = m_pOptions->iServerTimeout; |
1637 |
bool bOldServerStart = m_pOptions->bServerStart; |
bool bOldServerStart = m_pOptions->bServerStart; |
1638 |
QString sOldServerCmdLine = m_pOptions->sServerCmdLine; |
QString sOldServerCmdLine = m_pOptions->sServerCmdLine; |
1639 |
|
bool bOldMessagesLog = m_pOptions->bMessagesLog; |
1640 |
|
QString sOldMessagesLogPath = m_pOptions->sMessagesLogPath; |
1641 |
QString sOldDisplayFont = m_pOptions->sDisplayFont; |
QString sOldDisplayFont = m_pOptions->sDisplayFont; |
1642 |
bool bOldDisplayEffect = m_pOptions->bDisplayEffect; |
bool bOldDisplayEffect = m_pOptions->bDisplayEffect; |
1643 |
int iOldMaxVolume = m_pOptions->iMaxVolume; |
int iOldMaxVolume = m_pOptions->iMaxVolume; |
1649 |
bool bOldCompletePath = m_pOptions->bCompletePath; |
bool bOldCompletePath = m_pOptions->bCompletePath; |
1650 |
bool bOldInstrumentNames = m_pOptions->bInstrumentNames; |
bool bOldInstrumentNames = m_pOptions->bInstrumentNames; |
1651 |
int iOldMaxRecentFiles = m_pOptions->iMaxRecentFiles; |
int iOldMaxRecentFiles = m_pOptions->iMaxRecentFiles; |
1652 |
|
int iOldBaseFontSize = m_pOptions->iBaseFontSize; |
1653 |
// Load the current setup settings. |
// Load the current setup settings. |
1654 |
pOptionsForm->setup(m_pOptions); |
pOptionsForm->setup(m_pOptions); |
1655 |
// Show the setup dialog... |
// Show the setup dialog... |
1658 |
if (( bOldStdoutCapture && !m_pOptions->bStdoutCapture) || |
if (( bOldStdoutCapture && !m_pOptions->bStdoutCapture) || |
1659 |
(!bOldStdoutCapture && m_pOptions->bStdoutCapture) || |
(!bOldStdoutCapture && m_pOptions->bStdoutCapture) || |
1660 |
( bOldKeepOnTop && !m_pOptions->bKeepOnTop) || |
( bOldKeepOnTop && !m_pOptions->bKeepOnTop) || |
1661 |
(!bOldKeepOnTop && m_pOptions->bKeepOnTop)) { |
(!bOldKeepOnTop && m_pOptions->bKeepOnTop) || |
1662 |
|
(iOldBaseFontSize != m_pOptions->iBaseFontSize)) { |
1663 |
QMessageBox::information(this, |
QMessageBox::information(this, |
1664 |
QSAMPLER_TITLE ": " + tr("Information"), |
QSAMPLER_TITLE ": " + tr("Information"), |
1665 |
tr("Some settings may be only effective\n" |
tr("Some settings may be only effective\n" |
1666 |
"next time you start this program."), tr("OK")); |
"next time you start this program.")); |
1667 |
updateMessagesCapture(); |
updateMessagesCapture(); |
1668 |
} |
} |
1669 |
// Check wheather something immediate has changed. |
// Check wheather something immediate has changed. |
1670 |
|
if (( bOldMessagesLog && !m_pOptions->bMessagesLog) || |
1671 |
|
(!bOldMessagesLog && m_pOptions->bMessagesLog) || |
1672 |
|
(sOldMessagesLogPath != m_pOptions->sMessagesLogPath)) |
1673 |
|
m_pMessages->setLogging( |
1674 |
|
m_pOptions->bMessagesLog, m_pOptions->sMessagesLogPath); |
1675 |
if (( bOldCompletePath && !m_pOptions->bCompletePath) || |
if (( bOldCompletePath && !m_pOptions->bCompletePath) || |
1676 |
(!bOldCompletePath && m_pOptions->bCompletePath) || |
(!bOldCompletePath && m_pOptions->bCompletePath) || |
1677 |
(iOldMaxRecentFiles != m_pOptions->iMaxRecentFiles)) |
(iOldMaxRecentFiles != m_pOptions->iMaxRecentFiles)) |
1826 |
sText += tr("Instrument editing support disabled."); |
sText += tr("Instrument editing support disabled."); |
1827 |
sText += "</font></small><br />"; |
sText += "</font></small><br />"; |
1828 |
#endif |
#endif |
1829 |
|
#ifndef CONFIG_EVENT_CHANNEL_MIDI |
1830 |
|
sText += "<small><font color=\"red\">"; |
1831 |
|
sText += tr("Channel MIDI event support disabled."); |
1832 |
|
sText += "</font></small><br />"; |
1833 |
|
#endif |
1834 |
|
#ifndef CONFIG_EVENT_DEVICE_MIDI |
1835 |
|
sText += "<small><font color=\"red\">"; |
1836 |
|
sText += tr("Device MIDI event support disabled."); |
1837 |
|
sText += "</font></small><br />"; |
1838 |
|
#endif |
1839 |
|
#ifndef CONFIG_MAX_VOICES |
1840 |
|
sText += "<small><font color=\"red\">"; |
1841 |
|
sText += tr("Runtime max. voices / disk streams support disabled."); |
1842 |
|
sText += "</font></small><br />"; |
1843 |
|
#endif |
1844 |
sText += "<br />\n"; |
sText += "<br />\n"; |
1845 |
sText += tr("Using") + ": "; |
sText += tr("Using") + ": "; |
1846 |
sText += ::lscp_client_package(); |
sText += ::lscp_client_package(); |
1881 |
setWindowTitle(tr(QSAMPLER_TITLE " - [%1]").arg(sSessionName)); |
setWindowTitle(tr(QSAMPLER_TITLE " - [%1]").arg(sSessionName)); |
1882 |
|
|
1883 |
// Update the main menu state... |
// Update the main menu state... |
1884 |
ChannelStrip* pChannelStrip = activeChannelStrip(); |
ChannelStrip *pChannelStrip = activeChannelStrip(); |
1885 |
bool bHasClient = (m_pOptions != NULL && m_pClient != NULL); |
bool bHasClient = (m_pOptions != NULL && m_pClient != NULL); |
1886 |
bool bHasChannel = (bHasClient && pChannelStrip != NULL); |
bool bHasChannel = (bHasClient && pChannelStrip != NULL); |
1887 |
|
bool bHasChannels = (bHasClient && m_pWorkspace->windowList().count() > 0); |
1888 |
m_ui.fileNewAction->setEnabled(bHasClient); |
m_ui.fileNewAction->setEnabled(bHasClient); |
1889 |
m_ui.fileOpenAction->setEnabled(bHasClient); |
m_ui.fileOpenAction->setEnabled(bHasClient); |
1890 |
m_ui.fileSaveAction->setEnabled(bHasClient && m_iDirtyCount > 0); |
m_ui.fileSaveAction->setEnabled(bHasClient && m_iDirtyCount > 0); |
1900 |
m_ui.editEditChannelAction->setEnabled(false); |
m_ui.editEditChannelAction->setEnabled(false); |
1901 |
#endif |
#endif |
1902 |
m_ui.editResetChannelAction->setEnabled(bHasChannel); |
m_ui.editResetChannelAction->setEnabled(bHasChannel); |
1903 |
m_ui.editResetAllChannelsAction->setEnabled(bHasChannel); |
m_ui.editResetAllChannelsAction->setEnabled(bHasChannels); |
1904 |
m_ui.viewMessagesAction->setChecked(m_pMessages && m_pMessages->isVisible()); |
m_ui.viewMessagesAction->setChecked(m_pMessages && m_pMessages->isVisible()); |
1905 |
#ifdef CONFIG_MIDI_INSTRUMENT |
#ifdef CONFIG_MIDI_INSTRUMENT |
1906 |
m_ui.viewInstrumentsAction->setChecked(m_pInstrumentListForm |
m_ui.viewInstrumentsAction->setChecked(m_pInstrumentListForm |
1912 |
m_ui.viewDevicesAction->setChecked(m_pDeviceForm |
m_ui.viewDevicesAction->setChecked(m_pDeviceForm |
1913 |
&& m_pDeviceForm->isVisible()); |
&& m_pDeviceForm->isVisible()); |
1914 |
m_ui.viewDevicesAction->setEnabled(bHasClient); |
m_ui.viewDevicesAction->setEnabled(bHasClient); |
1915 |
m_ui.channelsArrangeAction->setEnabled(bHasChannel); |
m_ui.viewMidiDeviceStatusMenu->setEnabled( |
1916 |
|
DeviceStatusForm::getInstances().size() > 0); |
1917 |
|
m_ui.channelsArrangeAction->setEnabled(bHasChannels); |
1918 |
|
|
1919 |
#ifdef CONFIG_VOLUME |
#ifdef CONFIG_VOLUME |
1920 |
// Toolbar widgets are also affected... |
// Toolbar widgets are also affected... |
2018 |
} |
} |
2019 |
#endif |
#endif |
2020 |
|
|
2021 |
|
updateAllChannelStrips(false); |
2022 |
|
|
2023 |
|
// Do we auto-arrange? |
2024 |
|
if (m_pOptions && m_pOptions->bAutoArrange) |
2025 |
|
channelsArrange(); |
2026 |
|
|
2027 |
|
// Remember to refresh devices and instruments... |
2028 |
|
if (m_pInstrumentListForm) |
2029 |
|
m_pInstrumentListForm->refreshInstruments(); |
2030 |
|
if (m_pDeviceForm) |
2031 |
|
m_pDeviceForm->refreshDevices(); |
2032 |
|
} |
2033 |
|
|
2034 |
|
void MainForm::updateAllChannelStrips(bool bRemoveDeadStrips) { |
2035 |
// Retrieve the current channel list. |
// Retrieve the current channel list. |
2036 |
int *piChannelIDs = ::lscp_list_channels(m_pClient); |
int *piChannelIDs = ::lscp_list_channels(m_pClient); |
2037 |
if (piChannelIDs == NULL) { |
if (piChannelIDs == NULL) { |
2048 |
if (!channelStrip(piChannelIDs[iChannel])) |
if (!channelStrip(piChannelIDs[iChannel])) |
2049 |
createChannelStrip(new Channel(piChannelIDs[iChannel])); |
createChannelStrip(new Channel(piChannelIDs[iChannel])); |
2050 |
} |
} |
|
m_pWorkspace->setUpdatesEnabled(true); |
|
|
} |
|
2051 |
|
|
2052 |
// Do we auto-arrange? |
// Do we auto-arrange? |
2053 |
if (m_pOptions && m_pOptions->bAutoArrange) |
if (m_pOptions && m_pOptions->bAutoArrange) |
2054 |
channelsArrange(); |
channelsArrange(); |
2055 |
|
|
2056 |
// Remember to refresh devices and instruments... |
stabilizeForm(); |
|
if (m_pInstrumentListForm) |
|
|
m_pInstrumentListForm->refreshInstruments(); |
|
|
if (m_pDeviceForm) |
|
|
m_pDeviceForm->refreshDevices(); |
|
|
} |
|
2057 |
|
|
2058 |
|
// remove dead channel strips |
2059 |
|
if (bRemoveDeadStrips) { |
2060 |
|
for (int i = 0; channelStripAt(i); ++i) { |
2061 |
|
ChannelStrip* pChannelStrip = channelStripAt(i); |
2062 |
|
bool bExists = false; |
2063 |
|
for (int j = 0; piChannelIDs[j] >= 0; ++j) { |
2064 |
|
if (!pChannelStrip->channel()) break; |
2065 |
|
if (piChannelIDs[j] == pChannelStrip->channel()->channelID()) { |
2066 |
|
// strip exists, don't touch it |
2067 |
|
bExists = true; |
2068 |
|
break; |
2069 |
|
} |
2070 |
|
} |
2071 |
|
if (!bExists) destroyChannelStrip(pChannelStrip); |
2072 |
|
} |
2073 |
|
} |
2074 |
|
m_pWorkspace->setUpdatesEnabled(true); |
2075 |
|
} |
2076 |
|
} |
2077 |
|
|
2078 |
// Update the recent files list and menu. |
// Update the recent files list and menu. |
2079 |
void MainForm::updateRecentFiles ( const QString& sFilename ) |
void MainForm::updateRecentFiles ( const QString& sFilename ) |
2247 |
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents); |
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents); |
2248 |
|
|
2249 |
QMessageBox::critical(this, |
QMessageBox::critical(this, |
2250 |
QSAMPLER_TITLE ": " + tr("Error"), s, tr("Cancel")); |
QSAMPLER_TITLE ": " + tr("Error"), s, QMessageBox::Cancel); |
2251 |
} |
} |
2252 |
|
|
2253 |
|
|
2352 |
return pChannelStrip; |
return pChannelStrip; |
2353 |
} |
} |
2354 |
|
|
2355 |
|
void MainForm::destroyChannelStrip(ChannelStrip* pChannelStrip) { |
2356 |
|
// Just delete the channel strip. |
2357 |
|
delete pChannelStrip; |
2358 |
|
|
2359 |
|
// Do we auto-arrange? |
2360 |
|
if (m_pOptions && m_pOptions->bAutoArrange) |
2361 |
|
channelsArrange(); |
2362 |
|
|
2363 |
|
stabilizeForm(); |
2364 |
|
} |
2365 |
|
|
2366 |
// Retrieve the active channel strip. |
// Retrieve the active channel strip. |
2367 |
ChannelStrip* MainForm::activeChannelStrip (void) |
ChannelStrip* MainForm::activeChannelStrip (void) |
2373 |
// Retrieve a channel strip by index. |
// Retrieve a channel strip by index. |
2374 |
ChannelStrip* MainForm::channelStripAt ( int iChannel ) |
ChannelStrip* MainForm::channelStripAt ( int iChannel ) |
2375 |
{ |
{ |
2376 |
|
if (!m_pWorkspace) return NULL; |
2377 |
|
|
2378 |
QWidgetList wlist = m_pWorkspace->windowList(); |
QWidgetList wlist = m_pWorkspace->windowList(); |
2379 |
if (wlist.isEmpty()) |
if (wlist.isEmpty()) |
2380 |
return NULL; |
return NULL; |
2381 |
|
|
2382 |
return static_cast<ChannelStrip *> (wlist.at(iChannel)); |
if (iChannel < 0 || iChannel >= wlist.size()) |
2383 |
|
return NULL; |
2384 |
|
|
2385 |
|
return dynamic_cast<ChannelStrip *> (wlist.at(iChannel)); |
2386 |
} |
} |
2387 |
|
|
2388 |
|
|
2535 |
|
|
2536 |
// Is the server process instance still here? |
// Is the server process instance still here? |
2537 |
if (m_pServer) { |
if (m_pServer) { |
2538 |
switch (QMessageBox::warning(this, |
if (QMessageBox::warning(this, |
2539 |
QSAMPLER_TITLE ": " + tr("Warning"), |
QSAMPLER_TITLE ": " + tr("Warning"), |
2540 |
tr("Could not start the LinuxSampler server.\n\n" |
tr("Could not start the LinuxSampler server.\n\n" |
2541 |
"Maybe it is already started."), |
"Maybe it is already started."), |
2542 |
tr("Stop"), tr("Kill"), tr("Cancel"))) { |
QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Ok) { |
|
case 0: |
|
2543 |
m_pServer->terminate(); |
m_pServer->terminate(); |
|
break; |
|
|
case 1: |
|
2544 |
m_pServer->kill(); |
m_pServer->kill(); |
|
break; |
|
2545 |
} |
} |
2546 |
return; |
return; |
2547 |
} |
} |
2615 |
"running in the background. The sampler would continue to work\n" |
"running in the background. The sampler would continue to work\n" |
2616 |
"according to your current sampler session and you could alter the\n" |
"according to your current sampler session and you could alter the\n" |
2617 |
"sampler session at any time by relaunching QSampler.\n\n" |
"sampler session at any time by relaunching QSampler.\n\n" |
2618 |
"Do you want LinuxSampler to stop or to keep running in\n" |
"Do you want LinuxSampler to stop?"), |
2619 |
"the background?"), |
QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) |
|
tr("Stop"), tr("Keep Running")) == 1) |
|
2620 |
{ |
{ |
2621 |
bForceServerStop = false; |
bForceServerStop = false; |
2622 |
} |
} |
2747 |
.arg(::lscp_client_get_timeout(m_pClient))); |
.arg(::lscp_client_get_timeout(m_pClient))); |
2748 |
|
|
2749 |
// Subscribe to channel info change notifications... |
// Subscribe to channel info change notifications... |
2750 |
|
if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_CHANNEL_COUNT) != LSCP_OK) |
2751 |
|
appendMessagesClient("lscp_client_subscribe(CHANNEL_COUNT)"); |
2752 |
if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_CHANNEL_INFO) != LSCP_OK) |
if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_CHANNEL_INFO) != LSCP_OK) |
2753 |
appendMessagesClient("lscp_client_subscribe(CHANNEL_INFO)"); |
appendMessagesClient("lscp_client_subscribe(CHANNEL_INFO)"); |
2754 |
|
|
2758 |
appendMessagesClient("lscp_client_subscribe(MIDI_INPUT_DEVICE_COUNT)"); |
appendMessagesClient("lscp_client_subscribe(MIDI_INPUT_DEVICE_COUNT)"); |
2759 |
if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_MIDI_INPUT_DEVICE_INFO) != LSCP_OK) |
if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_MIDI_INPUT_DEVICE_INFO) != LSCP_OK) |
2760 |
appendMessagesClient("lscp_client_subscribe(MIDI_INPUT_DEVICE_INFO)"); |
appendMessagesClient("lscp_client_subscribe(MIDI_INPUT_DEVICE_INFO)"); |
2761 |
|
if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_AUDIO_OUTPUT_DEVICE_COUNT) != LSCP_OK) |
2762 |
|
appendMessagesClient("lscp_client_subscribe(AUDIO_OUTPUT_DEVICE_COUNT)"); |
2763 |
|
if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_AUDIO_OUTPUT_DEVICE_INFO) != LSCP_OK) |
2764 |
|
appendMessagesClient("lscp_client_subscribe(AUDIO_OUTPUT_DEVICE_INFO)"); |
2765 |
|
|
2766 |
#if CONFIG_LSCP_CHANNEL_MIDI |
#if CONFIG_EVENT_CHANNEL_MIDI |
2767 |
// Subscribe to channel MIDI data notifications... |
// Subscribe to channel MIDI data notifications... |
2768 |
if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_CHANNEL_MIDI) != LSCP_OK) |
if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_CHANNEL_MIDI) != LSCP_OK) |
2769 |
appendMessagesClient("lscp_client_subscribe(CHANNEL_MIDI)"); |
appendMessagesClient("lscp_client_subscribe(CHANNEL_MIDI)"); |
2770 |
#endif |
#endif |
2771 |
|
|
2772 |
#if CONFIG_LSCP_DEVICE_MIDI |
#if CONFIG_EVENT_DEVICE_MIDI |
2773 |
// Subscribe to channel MIDI data notifications... |
// Subscribe to channel MIDI data notifications... |
2774 |
if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_DEVICE_MIDI) != LSCP_OK) |
if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_DEVICE_MIDI) != LSCP_OK) |
2775 |
appendMessagesClient("lscp_client_subscribe(DEVICE_MIDI)"); |
appendMessagesClient("lscp_client_subscribe(DEVICE_MIDI)"); |
2800 |
} |
} |
2801 |
} |
} |
2802 |
|
|
2803 |
|
// send the current / loaded fine tuning settings to the sampler |
2804 |
|
m_pOptions->sendFineTuningSettings(); |
2805 |
|
|
2806 |
// Make a new session |
// Make a new session |
2807 |
return newSession(); |
return newSession(); |
2808 |
} |
} |
2830 |
closeSession(false); |
closeSession(false); |
2831 |
|
|
2832 |
// Close us as a client... |
// Close us as a client... |
2833 |
#if CONFIG_LSCP_DEVICE_MIDI |
#if CONFIG_EVENT_DEVICE_MIDI |
2834 |
::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_DEVICE_MIDI); |
::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_DEVICE_MIDI); |
2835 |
#endif |
#endif |
2836 |
#if CONFIG_LSCP_CHANNEL_MIDI |
#if CONFIG_EVENT_CHANNEL_MIDI |
2837 |
::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_CHANNEL_MIDI); |
::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_CHANNEL_MIDI); |
2838 |
#endif |
#endif |
2839 |
|
::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_AUDIO_OUTPUT_DEVICE_INFO); |
2840 |
|
::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_AUDIO_OUTPUT_DEVICE_COUNT); |
2841 |
::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_MIDI_INPUT_DEVICE_INFO); |
::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_MIDI_INPUT_DEVICE_INFO); |
2842 |
::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_MIDI_INPUT_DEVICE_COUNT); |
::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_MIDI_INPUT_DEVICE_COUNT); |
2843 |
::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_CHANNEL_INFO); |
::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_CHANNEL_INFO); |
2844 |
|
::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_CHANNEL_COUNT); |
2845 |
::lscp_client_destroy(m_pClient); |
::lscp_client_destroy(m_pClient); |
2846 |
m_pClient = NULL; |
m_pClient = NULL; |
2847 |
|
|