1 |
// qsamplerMainForm.cpp |
// qsamplerMainForm.cpp |
2 |
// |
// |
3 |
/**************************************************************************** |
/**************************************************************************** |
4 |
Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved. |
Copyright (C) 2004-2008, rncbc aka Rui Nuno Capela. All rights reserved. |
5 |
Copyright (C) 2007, 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 |
8 |
modify it under the terms of the GNU General Public License |
modify it under the terms of the GNU General Public License |
33 |
#include "qsamplerInstrumentListForm.h" |
#include "qsamplerInstrumentListForm.h" |
34 |
#include "qsamplerDeviceForm.h" |
#include "qsamplerDeviceForm.h" |
35 |
#include "qsamplerOptionsForm.h" |
#include "qsamplerOptionsForm.h" |
36 |
|
#include "qsamplerDeviceStatusForm.h" |
37 |
|
|
38 |
#include <QApplication> |
#include <QApplication> |
39 |
#include <QWorkspace> |
#include <QWorkspace> |
78 |
} |
} |
79 |
#endif |
#endif |
80 |
|
|
81 |
|
|
82 |
|
// All winsock apps needs this. |
83 |
|
#if defined(WIN32) |
84 |
|
static WSADATA _wsaData; |
85 |
|
#endif |
86 |
|
|
87 |
|
|
88 |
|
namespace QSampler { |
89 |
|
|
90 |
// Timer constant stuff. |
// Timer constant stuff. |
91 |
#define QSAMPLER_TIMER_MSECS 200 |
#define QSAMPLER_TIMER_MSECS 200 |
92 |
|
|
97 |
#define QSAMPLER_STATUS_SESSION 3 // Current session modification state. |
#define QSAMPLER_STATUS_SESSION 3 // Current session modification state. |
98 |
|
|
99 |
|
|
|
// All winsock apps needs this. |
|
|
#if defined(WIN32) |
|
|
static WSADATA _wsaData; |
|
|
#endif |
|
|
|
|
|
|
|
100 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
101 |
// qsamplerCustomEvent -- specialty for callback comunication. |
// CustomEvent -- specialty for callback comunication. |
102 |
|
|
103 |
#define QSAMPLER_CUSTOM_EVENT QEvent::Type(QEvent::User + 0) |
#define QSAMPLER_CUSTOM_EVENT QEvent::Type(QEvent::User + 0) |
104 |
|
|
105 |
class qsamplerCustomEvent : public QEvent |
class CustomEvent : public QEvent |
106 |
{ |
{ |
107 |
public: |
public: |
108 |
|
|
109 |
// Constructor. |
// Constructor. |
110 |
qsamplerCustomEvent(lscp_event_t event, const char *pchData, int cchData) |
CustomEvent(lscp_event_t event, const char *pchData, int cchData) |
111 |
: QEvent(QSAMPLER_CUSTOM_EVENT) |
: QEvent(QSAMPLER_CUSTOM_EVENT) |
112 |
{ |
{ |
113 |
m_event = event; |
m_event = event; |
130 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
131 |
// qsamplerMainForm -- Main window form implementation. |
// qsamplerMainForm -- Main window form implementation. |
132 |
|
|
|
namespace QSampler { |
|
|
|
|
133 |
// Kind of singleton reference. |
// Kind of singleton reference. |
134 |
MainForm* MainForm::g_pMainForm = NULL; |
MainForm* MainForm::g_pMainForm = NULL; |
135 |
|
|
173 |
// Volume slider... |
// Volume slider... |
174 |
m_ui.channelsToolbar->addSeparator(); |
m_ui.channelsToolbar->addSeparator(); |
175 |
m_pVolumeSlider = new QSlider(Qt::Horizontal, m_ui.channelsToolbar); |
m_pVolumeSlider = new QSlider(Qt::Horizontal, m_ui.channelsToolbar); |
176 |
m_pVolumeSlider->setTickPosition(QSlider::TicksBelow); |
m_pVolumeSlider->setTickPosition(QSlider::TicksBothSides); |
177 |
m_pVolumeSlider->setTickInterval(10); |
m_pVolumeSlider->setTickInterval(10); |
178 |
m_pVolumeSlider->setPageStep(10); |
m_pVolumeSlider->setPageStep(10); |
179 |
m_pVolumeSlider->setSingleStep(10); |
m_pVolumeSlider->setSingleStep(10); |
191 |
// Volume spin-box |
// Volume spin-box |
192 |
m_ui.channelsToolbar->addSeparator(); |
m_ui.channelsToolbar->addSeparator(); |
193 |
m_pVolumeSpinBox = new QSpinBox(m_ui.channelsToolbar); |
m_pVolumeSpinBox = new QSpinBox(m_ui.channelsToolbar); |
194 |
|
m_pVolumeSpinBox->setMaximumHeight(24); |
195 |
m_pVolumeSpinBox->setSuffix(" %"); |
m_pVolumeSpinBox->setSuffix(" %"); |
196 |
m_pVolumeSpinBox->setMinimum(0); |
m_pVolumeSpinBox->setMinimum(0); |
197 |
m_pVolumeSpinBox->setMaximum(100); |
m_pVolumeSpinBox->setMaximum(100); |
208 |
// Set the activation connection. |
// Set the activation connection. |
209 |
QObject::connect(m_pWorkspace, |
QObject::connect(m_pWorkspace, |
210 |
SIGNAL(windowActivated(QWidget *)), |
SIGNAL(windowActivated(QWidget *)), |
211 |
SLOT(stabilizeForm())); |
SLOT(activateStrip(QWidget *))); |
212 |
// Make it shine :-) |
// Make it shine :-) |
213 |
setCentralWidget(m_pWorkspace); |
setCentralWidget(m_pWorkspace); |
214 |
|
|
368 |
|
|
369 |
|
|
370 |
// Make and set a proper setup options step. |
// Make and set a proper setup options step. |
371 |
void MainForm::setup ( qsamplerOptions *pOptions ) |
void MainForm::setup ( Options *pOptions ) |
372 |
{ |
{ |
373 |
// We got options? |
// We got options? |
374 |
m_pOptions = pOptions; |
m_pOptions = pOptions; |
384 |
if (m_pOptions->bKeepOnTop) |
if (m_pOptions->bKeepOnTop) |
385 |
wflags |= Qt::Tool; |
wflags |= Qt::Tool; |
386 |
// Some child forms are to be created right now. |
// Some child forms are to be created right now. |
387 |
m_pMessages = new qsamplerMessages(this); |
m_pMessages = new Messages(this); |
388 |
m_pDeviceForm = new DeviceForm(this, wflags); |
m_pDeviceForm = new DeviceForm(this, wflags); |
389 |
#ifdef CONFIG_MIDI_INSTRUMENT |
#ifdef CONFIG_MIDI_INSTRUMENT |
390 |
m_pInstrumentListForm = new InstrumentListForm(this, wflags); |
m_pInstrumentListForm = new InstrumentListForm(this, wflags); |
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(); |
476 |
if (m_pDeviceForm) |
if (m_pDeviceForm) |
477 |
m_pDeviceForm->close(); |
m_pDeviceForm->close(); |
478 |
// Stop client and/or server, gracefully. |
// Stop client and/or server, gracefully. |
479 |
stopServer(); |
stopServer(true /*interactive*/); |
480 |
} |
} |
481 |
} |
} |
482 |
|
|
486 |
|
|
487 |
void MainForm::closeEvent ( QCloseEvent *pCloseEvent ) |
void MainForm::closeEvent ( QCloseEvent *pCloseEvent ) |
488 |
{ |
{ |
489 |
if (queryClose()) |
if (queryClose()) { |
490 |
|
DeviceStatusForm::deleteAllInstances(); |
491 |
pCloseEvent->accept(); |
pCloseEvent->accept(); |
492 |
else |
} else |
493 |
pCloseEvent->ignore(); |
pCloseEvent->ignore(); |
494 |
} |
} |
495 |
|
|
518 |
QListIterator<QUrl> iter(pMimeData->urls()); |
QListIterator<QUrl> iter(pMimeData->urls()); |
519 |
while (iter.hasNext()) { |
while (iter.hasNext()) { |
520 |
const QString& sPath = iter.next().toLocalFile(); |
const QString& sPath = iter.next().toLocalFile(); |
521 |
if (qsamplerChannel::isInstrumentFile(sPath)) { |
if (Channel::isInstrumentFile(sPath)) { |
522 |
// Try to create a new channel from instrument file... |
// Try to create a new channel from instrument file... |
523 |
qsamplerChannel *pChannel = new qsamplerChannel(); |
Channel *pChannel = new Channel(); |
524 |
if (pChannel == NULL) |
if (pChannel == NULL) |
525 |
return; |
return; |
526 |
// Start setting the instrument filename... |
// Start setting the instrument filename... |
556 |
{ |
{ |
557 |
// For the time being, just pump it to messages. |
// For the time being, just pump it to messages. |
558 |
if (pCustomEvent->type() == QSAMPLER_CUSTOM_EVENT) { |
if (pCustomEvent->type() == QSAMPLER_CUSTOM_EVENT) { |
559 |
qsamplerCustomEvent *pEvent = (qsamplerCustomEvent *) pCustomEvent; |
CustomEvent *pEvent = static_cast<CustomEvent *> (pCustomEvent); |
560 |
if (pEvent->event() == LSCP_EVENT_CHANNEL_INFO) { |
switch (pEvent->event()) { |
561 |
int iChannelID = pEvent->data().toInt(); |
case LSCP_EVENT_CHANNEL_COUNT: |
562 |
ChannelStrip *pChannelStrip = channelStrip(iChannelID); |
updateAllChannelStrips(true); |
563 |
if (pChannelStrip) |
break; |
564 |
channelStripChanged(pChannelStrip); |
case LSCP_EVENT_CHANNEL_INFO: { |
565 |
} else { |
int iChannelID = pEvent->data().toInt(); |
566 |
appendMessagesColor(tr("Notify event: %1 data: %2") |
ChannelStrip *pChannelStrip = channelStrip(iChannelID); |
567 |
.arg(::lscp_event_to_text(pEvent->event())) |
if (pChannelStrip) |
568 |
.arg(pEvent->data()), "#996699"); |
channelStripChanged(pChannelStrip); |
569 |
|
break; |
570 |
|
} |
571 |
|
case LSCP_EVENT_MIDI_INPUT_DEVICE_COUNT: |
572 |
|
if (m_pDeviceForm) m_pDeviceForm->refreshDevices(); |
573 |
|
DeviceStatusForm::onDevicesChanged(); |
574 |
|
updateViewMidiDeviceStatusMenu(); |
575 |
|
break; |
576 |
|
case LSCP_EVENT_MIDI_INPUT_DEVICE_INFO: { |
577 |
|
if (m_pDeviceForm) m_pDeviceForm->refreshDevices(); |
578 |
|
const int iDeviceID = pEvent->data().section(' ', 0, 0).toInt(); |
579 |
|
DeviceStatusForm::onDeviceChanged(iDeviceID); |
580 |
|
break; |
581 |
|
} |
582 |
|
case LSCP_EVENT_AUDIO_OUTPUT_DEVICE_COUNT: |
583 |
|
if (m_pDeviceForm) m_pDeviceForm->refreshDevices(); |
584 |
|
break; |
585 |
|
case LSCP_EVENT_AUDIO_OUTPUT_DEVICE_INFO: |
586 |
|
if (m_pDeviceForm) m_pDeviceForm->refreshDevices(); |
587 |
|
break; |
588 |
|
#if CONFIG_EVENT_CHANNEL_MIDI |
589 |
|
case LSCP_EVENT_CHANNEL_MIDI: { |
590 |
|
const int iChannelID = pEvent->data().section(' ', 0, 0).toInt(); |
591 |
|
ChannelStrip *pChannelStrip = channelStrip(iChannelID); |
592 |
|
if (pChannelStrip) |
593 |
|
pChannelStrip->midiArrived(); |
594 |
|
break; |
595 |
|
} |
596 |
|
#endif |
597 |
|
#if CONFIG_EVENT_DEVICE_MIDI |
598 |
|
case LSCP_EVENT_DEVICE_MIDI: { |
599 |
|
const int iDeviceID = pEvent->data().section(' ', 0, 0).toInt(); |
600 |
|
const int iPortID = pEvent->data().section(' ', 1, 1).toInt(); |
601 |
|
DeviceStatusForm* pDeviceStatusForm = |
602 |
|
DeviceStatusForm::getInstance(iDeviceID); |
603 |
|
if (pDeviceStatusForm) |
604 |
|
pDeviceStatusForm->midiArrived(iPortID); |
605 |
|
break; |
606 |
|
} |
607 |
|
#endif |
608 |
|
default: |
609 |
|
appendMessagesColor(tr("Notify event: %1 data: %2") |
610 |
|
.arg(::lscp_event_to_text(pEvent->event())) |
611 |
|
.arg(pEvent->data()), "#996699"); |
612 |
} |
} |
613 |
} |
} |
614 |
} |
} |
615 |
|
|
616 |
|
void MainForm::updateViewMidiDeviceStatusMenu() { |
617 |
|
m_ui.viewMidiDeviceStatusMenu->clear(); |
618 |
|
const std::map<int, DeviceStatusForm*> statusForms = |
619 |
|
DeviceStatusForm::getInstances(); |
620 |
|
for ( |
621 |
|
std::map<int, DeviceStatusForm*>::const_iterator iter = statusForms.begin(); |
622 |
|
iter != statusForms.end(); ++iter |
623 |
|
) { |
624 |
|
DeviceStatusForm* pForm = iter->second; |
625 |
|
m_ui.viewMidiDeviceStatusMenu->addAction( |
626 |
|
pForm->visibleAction() |
627 |
|
); |
628 |
|
} |
629 |
|
} |
630 |
|
|
631 |
// Context menu event handler. |
// Context menu event handler. |
632 |
void MainForm::contextMenuEvent( QContextMenuEvent *pEvent ) |
void MainForm::contextMenuEvent( QContextMenuEvent *pEvent ) |
633 |
{ |
{ |
641 |
// qsamplerMainForm -- Brainless public property accessors. |
// qsamplerMainForm -- Brainless public property accessors. |
642 |
|
|
643 |
// The global options settings property. |
// The global options settings property. |
644 |
qsamplerOptions *MainForm::options (void) const |
Options *MainForm::options (void) const |
645 |
{ |
{ |
646 |
return m_pOptions; |
return m_pOptions; |
647 |
} |
} |
802 |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
803 |
ChannelStrip *pChannelStrip = (ChannelStrip*) wlist.at(iChannel); |
ChannelStrip *pChannelStrip = (ChannelStrip*) wlist.at(iChannel); |
804 |
if (pChannelStrip) { |
if (pChannelStrip) { |
805 |
qsamplerChannel *pChannel = pChannelStrip->channel(); |
Channel *pChannel = pChannelStrip->channel(); |
806 |
if (bForce && pChannel) |
if (bForce && pChannel) |
807 |
pChannel->removeChannel(); |
pChannel->removeChannel(); |
808 |
delete pChannelStrip; |
delete pChannelStrip; |
942 |
|
|
943 |
// Audio device mapping. |
// Audio device mapping. |
944 |
QMap<int, int> audioDeviceMap; |
QMap<int, int> audioDeviceMap; |
945 |
piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Audio); |
piDeviceIDs = Device::getDevices(m_pClient, Device::Audio); |
946 |
for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) { |
for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) { |
947 |
ts << endl; |
ts << endl; |
948 |
qsamplerDevice device(qsamplerDevice::Audio, piDeviceIDs[iDevice]); |
Device device(Device::Audio, piDeviceIDs[iDevice]); |
949 |
// Audio device specification... |
// Audio device specification... |
950 |
ts << "# " << device.deviceTypeName() << " " << device.driverName() |
ts << "# " << device.deviceTypeName() << " " << device.driverName() |
951 |
<< " " << tr("Device") << " " << iDevice << endl; |
<< " " << tr("Device") << " " << iDevice << endl; |
952 |
ts << "CREATE AUDIO_OUTPUT_DEVICE " << device.driverName(); |
ts << "CREATE AUDIO_OUTPUT_DEVICE " << device.driverName(); |
953 |
qsamplerDeviceParamMap::ConstIterator deviceParam; |
DeviceParamMap::ConstIterator deviceParam; |
954 |
for (deviceParam = device.params().begin(); |
for (deviceParam = device.params().begin(); |
955 |
deviceParam != device.params().end(); |
deviceParam != device.params().end(); |
956 |
++deviceParam) { |
++deviceParam) { |
957 |
const qsamplerDeviceParam& param = deviceParam.value(); |
const DeviceParam& param = deviceParam.value(); |
958 |
if (param.value.isEmpty()) ts << "# "; |
if (param.value.isEmpty()) ts << "# "; |
959 |
ts << " " << deviceParam.key() << "='" << param.value << "'"; |
ts << " " << deviceParam.key() << "='" << param.value << "'"; |
960 |
} |
} |
961 |
ts << endl; |
ts << endl; |
962 |
// Audio channel parameters... |
// Audio channel parameters... |
963 |
int iPort = 0; |
int iPort = 0; |
964 |
QListIterator<qsamplerDevicePort *> iter(device.ports()); |
QListIterator<DevicePort *> iter(device.ports()); |
965 |
while (iter.hasNext()) { |
while (iter.hasNext()) { |
966 |
qsamplerDevicePort *pPort = iter.next(); |
DevicePort *pPort = iter.next(); |
967 |
qsamplerDeviceParamMap::ConstIterator portParam; |
DeviceParamMap::ConstIterator portParam; |
968 |
for (portParam = pPort->params().begin(); |
for (portParam = pPort->params().begin(); |
969 |
portParam != pPort->params().end(); |
portParam != pPort->params().end(); |
970 |
++portParam) { |
++portParam) { |
971 |
const qsamplerDeviceParam& param = portParam.value(); |
const DeviceParam& param = portParam.value(); |
972 |
if (param.fix || param.value.isEmpty()) ts << "# "; |
if (param.fix || param.value.isEmpty()) ts << "# "; |
973 |
ts << "SET AUDIO_OUTPUT_CHANNEL_PARAMETER " << iDevice |
ts << "SET AUDIO_OUTPUT_CHANNEL_PARAMETER " << iDevice |
974 |
<< " " << iPort << " " << portParam.key() |
<< " " << iPort << " " << portParam.key() |
984 |
|
|
985 |
// MIDI device mapping. |
// MIDI device mapping. |
986 |
QMap<int, int> midiDeviceMap; |
QMap<int, int> midiDeviceMap; |
987 |
piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Midi); |
piDeviceIDs = Device::getDevices(m_pClient, Device::Midi); |
988 |
for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) { |
for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) { |
989 |
ts << endl; |
ts << endl; |
990 |
qsamplerDevice device(qsamplerDevice::Midi, piDeviceIDs[iDevice]); |
Device device(Device::Midi, piDeviceIDs[iDevice]); |
991 |
// MIDI device specification... |
// MIDI device specification... |
992 |
ts << "# " << device.deviceTypeName() << " " << device.driverName() |
ts << "# " << device.deviceTypeName() << " " << device.driverName() |
993 |
<< " " << tr("Device") << " " << iDevice << endl; |
<< " " << tr("Device") << " " << iDevice << endl; |
994 |
ts << "CREATE MIDI_INPUT_DEVICE " << device.driverName(); |
ts << "CREATE MIDI_INPUT_DEVICE " << device.driverName(); |
995 |
qsamplerDeviceParamMap::ConstIterator deviceParam; |
DeviceParamMap::ConstIterator deviceParam; |
996 |
for (deviceParam = device.params().begin(); |
for (deviceParam = device.params().begin(); |
997 |
deviceParam != device.params().end(); |
deviceParam != device.params().end(); |
998 |
++deviceParam) { |
++deviceParam) { |
999 |
const qsamplerDeviceParam& param = deviceParam.value(); |
const DeviceParam& param = deviceParam.value(); |
1000 |
if (param.value.isEmpty()) ts << "# "; |
if (param.value.isEmpty()) ts << "# "; |
1001 |
ts << " " << deviceParam.key() << "='" << param.value << "'"; |
ts << " " << deviceParam.key() << "='" << param.value << "'"; |
1002 |
} |
} |
1003 |
ts << endl; |
ts << endl; |
1004 |
// MIDI port parameters... |
// MIDI port parameters... |
1005 |
int iPort = 0; |
int iPort = 0; |
1006 |
QListIterator<qsamplerDevicePort *> iter(device.ports()); |
QListIterator<DevicePort *> iter(device.ports()); |
1007 |
while (iter.hasNext()) { |
while (iter.hasNext()) { |
1008 |
qsamplerDevicePort *pPort = iter.next(); |
DevicePort *pPort = iter.next(); |
1009 |
qsamplerDeviceParamMap::ConstIterator portParam; |
DeviceParamMap::ConstIterator portParam; |
1010 |
for (portParam = pPort->params().begin(); |
for (portParam = pPort->params().begin(); |
1011 |
portParam != pPort->params().end(); |
portParam != pPort->params().end(); |
1012 |
++portParam) { |
++portParam) { |
1013 |
const qsamplerDeviceParam& param = portParam.value(); |
const DeviceParam& param = portParam.value(); |
1014 |
if (param.fix || param.value.isEmpty()) ts << "# "; |
if (param.fix || param.value.isEmpty()) ts << "# "; |
1015 |
ts << "SET MIDI_INPUT_PORT_PARAMETER " << iDevice |
ts << "SET MIDI_INPUT_PORT_PARAMETER " << iDevice |
1016 |
<< " " << iPort << " " << portParam.key() |
<< " " << iPort << " " << portParam.key() |
1102 |
ChannelStrip* pChannelStrip |
ChannelStrip* pChannelStrip |
1103 |
= static_cast<ChannelStrip *> (wlist.at(iChannel)); |
= static_cast<ChannelStrip *> (wlist.at(iChannel)); |
1104 |
if (pChannelStrip) { |
if (pChannelStrip) { |
1105 |
qsamplerChannel *pChannel = pChannelStrip->channel(); |
Channel *pChannel = pChannelStrip->channel(); |
1106 |
if (pChannel) { |
if (pChannel) { |
1107 |
ts << "# " << tr("Channel") << " " << iChannel << endl; |
ts << "# " << tr("Channel") << " " << iChannel << endl; |
1108 |
ts << "ADD CHANNEL" << endl; |
ts << "ADD CHANNEL" << endl; |
1134 |
ts << "LOAD INSTRUMENT NON_MODAL '" |
ts << "LOAD INSTRUMENT NON_MODAL '" |
1135 |
<< pChannel->instrumentFile() << "' " |
<< pChannel->instrumentFile() << "' " |
1136 |
<< pChannel->instrumentNr() << " " << iChannel << endl; |
<< pChannel->instrumentNr() << " " << iChannel << endl; |
1137 |
qsamplerChannelRoutingMap::ConstIterator audioRoute; |
ChannelRoutingMap::ConstIterator audioRoute; |
1138 |
for (audioRoute = pChannel->audioRouting().begin(); |
for (audioRoute = pChannel->audioRouting().begin(); |
1139 |
audioRoute != pChannel->audioRouting().end(); |
audioRoute != pChannel->audioRouting().end(); |
1140 |
++audioRoute) { |
++audioRoute) { |
1379 |
return; |
return; |
1380 |
|
|
1381 |
// Just create the channel instance... |
// Just create the channel instance... |
1382 |
qsamplerChannel *pChannel = new qsamplerChannel(); |
Channel *pChannel = new Channel(); |
1383 |
if (pChannel == NULL) |
if (pChannel == NULL) |
1384 |
return; |
return; |
1385 |
|
|
1397 |
return; |
return; |
1398 |
} |
} |
1399 |
|
|
1400 |
|
// Do we auto-arrange? |
1401 |
|
if (m_pOptions && m_pOptions->bAutoArrange) |
1402 |
|
channelsArrange(); |
1403 |
|
|
1404 |
// Make that an overall update. |
// Make that an overall update. |
1405 |
m_iDirtyCount++; |
m_iDirtyCount++; |
1406 |
stabilizeForm(); |
stabilizeForm(); |
1417 |
if (pChannelStrip == NULL) |
if (pChannelStrip == NULL) |
1418 |
return; |
return; |
1419 |
|
|
1420 |
qsamplerChannel *pChannel = pChannelStrip->channel(); |
Channel *pChannel = pChannelStrip->channel(); |
1421 |
if (pChannel == NULL) |
if (pChannel == NULL) |
1422 |
return; |
return; |
1423 |
|
|
1620 |
int iOldServerTimeout = m_pOptions->iServerTimeout; |
int iOldServerTimeout = m_pOptions->iServerTimeout; |
1621 |
bool bOldServerStart = m_pOptions->bServerStart; |
bool bOldServerStart = m_pOptions->bServerStart; |
1622 |
QString sOldServerCmdLine = m_pOptions->sServerCmdLine; |
QString sOldServerCmdLine = m_pOptions->sServerCmdLine; |
1623 |
|
bool bOldMessagesLog = m_pOptions->bMessagesLog; |
1624 |
|
QString sOldMessagesLogPath = m_pOptions->sMessagesLogPath; |
1625 |
QString sOldDisplayFont = m_pOptions->sDisplayFont; |
QString sOldDisplayFont = m_pOptions->sDisplayFont; |
1626 |
bool bOldDisplayEffect = m_pOptions->bDisplayEffect; |
bool bOldDisplayEffect = m_pOptions->bDisplayEffect; |
1627 |
int iOldMaxVolume = m_pOptions->iMaxVolume; |
int iOldMaxVolume = m_pOptions->iMaxVolume; |
1633 |
bool bOldCompletePath = m_pOptions->bCompletePath; |
bool bOldCompletePath = m_pOptions->bCompletePath; |
1634 |
bool bOldInstrumentNames = m_pOptions->bInstrumentNames; |
bool bOldInstrumentNames = m_pOptions->bInstrumentNames; |
1635 |
int iOldMaxRecentFiles = m_pOptions->iMaxRecentFiles; |
int iOldMaxRecentFiles = m_pOptions->iMaxRecentFiles; |
1636 |
|
int iOldBaseFontSize = m_pOptions->iBaseFontSize; |
1637 |
// Load the current setup settings. |
// Load the current setup settings. |
1638 |
pOptionsForm->setup(m_pOptions); |
pOptionsForm->setup(m_pOptions); |
1639 |
// Show the setup dialog... |
// Show the setup dialog... |
1642 |
if (( bOldStdoutCapture && !m_pOptions->bStdoutCapture) || |
if (( bOldStdoutCapture && !m_pOptions->bStdoutCapture) || |
1643 |
(!bOldStdoutCapture && m_pOptions->bStdoutCapture) || |
(!bOldStdoutCapture && m_pOptions->bStdoutCapture) || |
1644 |
( bOldKeepOnTop && !m_pOptions->bKeepOnTop) || |
( bOldKeepOnTop && !m_pOptions->bKeepOnTop) || |
1645 |
(!bOldKeepOnTop && m_pOptions->bKeepOnTop)) { |
(!bOldKeepOnTop && m_pOptions->bKeepOnTop) || |
1646 |
|
(iOldBaseFontSize != m_pOptions->iBaseFontSize)) { |
1647 |
QMessageBox::information(this, |
QMessageBox::information(this, |
1648 |
QSAMPLER_TITLE ": " + tr("Information"), |
QSAMPLER_TITLE ": " + tr("Information"), |
1649 |
tr("Some settings may be only effective\n" |
tr("Some settings may be only effective\n" |
1651 |
updateMessagesCapture(); |
updateMessagesCapture(); |
1652 |
} |
} |
1653 |
// Check wheather something immediate has changed. |
// Check wheather something immediate has changed. |
1654 |
|
if (( bOldMessagesLog && !m_pOptions->bMessagesLog) || |
1655 |
|
(!bOldMessagesLog && m_pOptions->bMessagesLog) || |
1656 |
|
(sOldMessagesLogPath != m_pOptions->sMessagesLogPath)) |
1657 |
|
m_pMessages->setLogging( |
1658 |
|
m_pOptions->bMessagesLog, m_pOptions->sMessagesLogPath); |
1659 |
if (( bOldCompletePath && !m_pOptions->bCompletePath) || |
if (( bOldCompletePath && !m_pOptions->bCompletePath) || |
1660 |
(!bOldCompletePath && m_pOptions->bCompletePath) || |
(!bOldCompletePath && m_pOptions->bCompletePath) || |
1661 |
(iOldMaxRecentFiles != m_pOptions->iMaxRecentFiles)) |
(iOldMaxRecentFiles != m_pOptions->iMaxRecentFiles)) |
1984 |
} |
} |
1985 |
#endif |
#endif |
1986 |
|
|
1987 |
|
updateAllChannelStrips(false); |
1988 |
|
|
1989 |
|
// Do we auto-arrange? |
1990 |
|
if (m_pOptions && m_pOptions->bAutoArrange) |
1991 |
|
channelsArrange(); |
1992 |
|
|
1993 |
|
// Remember to refresh devices and instruments... |
1994 |
|
if (m_pInstrumentListForm) |
1995 |
|
m_pInstrumentListForm->refreshInstruments(); |
1996 |
|
if (m_pDeviceForm) |
1997 |
|
m_pDeviceForm->refreshDevices(); |
1998 |
|
} |
1999 |
|
|
2000 |
|
void MainForm::updateAllChannelStrips(bool bRemoveDeadStrips) { |
2001 |
// Retrieve the current channel list. |
// Retrieve the current channel list. |
2002 |
int *piChannelIDs = ::lscp_list_channels(m_pClient); |
int *piChannelIDs = ::lscp_list_channels(m_pClient); |
2003 |
if (piChannelIDs == NULL) { |
if (piChannelIDs == NULL) { |
2012 |
for (int iChannel = 0; piChannelIDs[iChannel] >= 0; iChannel++) { |
for (int iChannel = 0; piChannelIDs[iChannel] >= 0; iChannel++) { |
2013 |
// Check if theres already a channel strip for this one... |
// Check if theres already a channel strip for this one... |
2014 |
if (!channelStrip(piChannelIDs[iChannel])) |
if (!channelStrip(piChannelIDs[iChannel])) |
2015 |
createChannelStrip(new qsamplerChannel(piChannelIDs[iChannel])); |
createChannelStrip(new Channel(piChannelIDs[iChannel])); |
2016 |
} |
} |
|
m_pWorkspace->setUpdatesEnabled(true); |
|
|
} |
|
2017 |
|
|
2018 |
// Do we auto-arrange? |
// Do we auto-arrange? |
2019 |
if (m_pOptions && m_pOptions->bAutoArrange) |
if (m_pOptions && m_pOptions->bAutoArrange) |
2020 |
channelsArrange(); |
channelsArrange(); |
2021 |
|
|
2022 |
// Remember to refresh devices and instruments... |
stabilizeForm(); |
|
if (m_pInstrumentListForm) |
|
|
m_pInstrumentListForm->refreshInstruments(); |
|
|
if (m_pDeviceForm) |
|
|
m_pDeviceForm->refreshDevices(); |
|
|
} |
|
2023 |
|
|
2024 |
|
// remove dead channel strips |
2025 |
|
if (bRemoveDeadStrips) { |
2026 |
|
for (int i = 0; channelStripAt(i); ++i) { |
2027 |
|
ChannelStrip* pChannelStrip = channelStripAt(i); |
2028 |
|
bool bExists = false; |
2029 |
|
for (int j = 0; piChannelIDs[j] >= 0; ++j) { |
2030 |
|
if (!pChannelStrip->channel()) break; |
2031 |
|
if (piChannelIDs[j] == pChannelStrip->channel()->channelID()) { |
2032 |
|
// strip exists, don't touch it |
2033 |
|
bExists = true; |
2034 |
|
break; |
2035 |
|
} |
2036 |
|
} |
2037 |
|
if (!bExists) destroyChannelStrip(pChannelStrip); |
2038 |
|
} |
2039 |
|
} |
2040 |
|
m_pWorkspace->setUpdatesEnabled(true); |
2041 |
|
} |
2042 |
|
} |
2043 |
|
|
2044 |
// Update the recent files list and menu. |
// Update the recent files list and menu. |
2045 |
void MainForm::updateRecentFiles ( const QString& sFilename ) |
void MainForm::updateRecentFiles ( const QString& sFilename ) |
2276 |
// qsamplerMainForm -- MDI channel strip management. |
// qsamplerMainForm -- MDI channel strip management. |
2277 |
|
|
2278 |
// The channel strip creation executive. |
// The channel strip creation executive. |
2279 |
ChannelStrip* MainForm::createChannelStrip(qsamplerChannel* pChannel) |
ChannelStrip* MainForm::createChannelStrip ( Channel *pChannel ) |
2280 |
{ |
{ |
2281 |
if (m_pClient == NULL || pChannel == NULL) |
if (m_pClient == NULL || pChannel == NULL) |
2282 |
return NULL; |
return NULL; |
2283 |
|
|
|
// Prepare for auto-arrange? |
|
|
ChannelStrip* pChannelStrip = NULL; |
|
|
int y = 0; |
|
|
if (m_pOptions && m_pOptions->bAutoArrange) { |
|
|
QWidgetList wlist = m_pWorkspace->windowList(); |
|
|
for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) { |
|
|
pChannelStrip = static_cast<ChannelStrip *> (wlist.at(iChannel)); |
|
|
if (pChannelStrip) { |
|
|
// y += pChannelStrip->height() |
|
|
// + pChannelStrip->parentWidget()->baseSize().height(); |
|
|
y += pChannelStrip->parentWidget()->frameGeometry().height(); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
2284 |
// Add a new channel itema... |
// Add a new channel itema... |
2285 |
pChannelStrip = new ChannelStrip(); |
ChannelStrip *pChannelStrip = new ChannelStrip(); |
2286 |
if (pChannelStrip == NULL) |
if (pChannelStrip == NULL) |
2287 |
return NULL; |
return NULL; |
2288 |
|
|
2289 |
m_pWorkspace->addWindow(pChannelStrip, Qt::FramelessWindowHint); |
// Set some initial channel strip options... |
|
|
|
|
// Actual channel strip setup... |
|
|
pChannelStrip->setup(pChannel); |
|
|
QObject::connect(pChannelStrip, |
|
|
SIGNAL(channelChanged(ChannelStrip*)), |
|
|
SLOT(channelStripChanged(ChannelStrip*))); |
|
|
// Set some initial aesthetic options... |
|
2290 |
if (m_pOptions) { |
if (m_pOptions) { |
2291 |
// Background display effect... |
// Background display effect... |
2292 |
pChannelStrip->setDisplayEffect(m_pOptions->bDisplayEffect); |
pChannelStrip->setDisplayEffect(m_pOptions->bDisplayEffect); |
2298 |
pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume); |
pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume); |
2299 |
} |
} |
2300 |
|
|
2301 |
|
// Add it to workspace... |
2302 |
|
m_pWorkspace->addWindow(pChannelStrip, Qt::FramelessWindowHint); |
2303 |
|
|
2304 |
|
// Actual channel strip setup... |
2305 |
|
pChannelStrip->setup(pChannel); |
2306 |
|
|
2307 |
|
QObject::connect(pChannelStrip, |
2308 |
|
SIGNAL(channelChanged(ChannelStrip*)), |
2309 |
|
SLOT(channelStripChanged(ChannelStrip*))); |
2310 |
|
|
2311 |
// Now we show up us to the world. |
// Now we show up us to the world. |
2312 |
pChannelStrip->show(); |
pChannelStrip->show(); |
|
// Only then, we'll auto-arrange... |
|
|
if (m_pOptions && m_pOptions->bAutoArrange) { |
|
|
int iWidth = m_pWorkspace->width(); |
|
|
// int iHeight = pChannel->height() |
|
|
// + pChannel->parentWidget()->baseSize().height(); |
|
|
int iHeight = pChannelStrip->parentWidget()->frameGeometry().height(); |
|
|
pChannelStrip->parentWidget()->setGeometry(0, y, iWidth, iHeight); |
|
|
} |
|
2313 |
|
|
2314 |
// This is pretty new, so we'll watch for it closely. |
// This is pretty new, so we'll watch for it closely. |
2315 |
channelStripChanged(pChannelStrip); |
channelStripChanged(pChannelStrip); |
2318 |
return pChannelStrip; |
return pChannelStrip; |
2319 |
} |
} |
2320 |
|
|
2321 |
|
void MainForm::destroyChannelStrip(ChannelStrip* pChannelStrip) { |
2322 |
|
// Just delete the channel strip. |
2323 |
|
delete pChannelStrip; |
2324 |
|
|
2325 |
|
// Do we auto-arrange? |
2326 |
|
if (m_pOptions && m_pOptions->bAutoArrange) |
2327 |
|
channelsArrange(); |
2328 |
|
|
2329 |
|
stabilizeForm(); |
2330 |
|
} |
2331 |
|
|
2332 |
// Retrieve the active channel strip. |
// Retrieve the active channel strip. |
2333 |
ChannelStrip* MainForm::activeChannelStrip (void) |
ChannelStrip* MainForm::activeChannelStrip (void) |
2339 |
// Retrieve a channel strip by index. |
// Retrieve a channel strip by index. |
2340 |
ChannelStrip* MainForm::channelStripAt ( int iChannel ) |
ChannelStrip* MainForm::channelStripAt ( int iChannel ) |
2341 |
{ |
{ |
2342 |
|
if (!m_pWorkspace) return NULL; |
2343 |
|
|
2344 |
QWidgetList wlist = m_pWorkspace->windowList(); |
QWidgetList wlist = m_pWorkspace->windowList(); |
2345 |
if (wlist.isEmpty()) |
if (wlist.isEmpty()) |
2346 |
return NULL; |
return NULL; |
2347 |
|
|
2348 |
return static_cast<ChannelStrip *> (wlist.at(iChannel)); |
if (iChannel < 0 || iChannel >= wlist.size()) |
2349 |
|
return NULL; |
2350 |
|
|
2351 |
|
return dynamic_cast<ChannelStrip *> (wlist.at(iChannel)); |
2352 |
} |
} |
2353 |
|
|
2354 |
|
|
2363 |
ChannelStrip* pChannelStrip |
ChannelStrip* pChannelStrip |
2364 |
= static_cast<ChannelStrip*> (wlist.at(iChannel)); |
= static_cast<ChannelStrip*> (wlist.at(iChannel)); |
2365 |
if (pChannelStrip) { |
if (pChannelStrip) { |
2366 |
qsamplerChannel *pChannel = pChannelStrip->channel(); |
Channel *pChannel = pChannelStrip->channel(); |
2367 |
if (pChannel && pChannel->channelID() == iChannelID) |
if (pChannel && pChannel->channelID() == iChannelID) |
2368 |
return pChannelStrip; |
return pChannelStrip; |
2369 |
} |
} |
2504 |
switch (QMessageBox::warning(this, |
switch (QMessageBox::warning(this, |
2505 |
QSAMPLER_TITLE ": " + tr("Warning"), |
QSAMPLER_TITLE ": " + tr("Warning"), |
2506 |
tr("Could not start the LinuxSampler server.\n\n" |
tr("Could not start the LinuxSampler server.\n\n" |
2507 |
"Maybe it ss already started."), |
"Maybe it is already started."), |
2508 |
tr("Stop"), tr("Kill"), tr("Cancel"))) { |
tr("Stop"), tr("Kill"), tr("Cancel"))) { |
2509 |
case 0: |
case 0: |
2510 |
m_pServer->terminate(); |
m_pServer->terminate(); |
2524 |
return; |
return; |
2525 |
|
|
2526 |
// OK. Let's build the startup process... |
// OK. Let's build the startup process... |
2527 |
m_pServer = new QProcess(this); |
m_pServer = new QProcess(); |
2528 |
|
bForceServerStop = true; |
2529 |
|
|
2530 |
// Setup stdout/stderr capture... |
// Setup stdout/stderr capture... |
2531 |
// if (m_pOptions->bStdoutCapture) { |
// if (m_pOptions->bStdoutCapture) { |
2532 |
//m_pServer->setProcessChannelMode( |
#if QT_VERSION >= 0x040200 |
2533 |
// QProcess::StandardOutput); |
m_pServer->setProcessChannelMode(QProcess::ForwardedChannels); |
2534 |
|
#endif |
2535 |
QObject::connect(m_pServer, |
QObject::connect(m_pServer, |
2536 |
SIGNAL(readyReadStandardOutput()), |
SIGNAL(readyReadStandardOutput()), |
2537 |
SLOT(readServerStdout())); |
SLOT(readServerStdout())); |
2542 |
|
|
2543 |
// The unforgiveable signal communication... |
// The unforgiveable signal communication... |
2544 |
QObject::connect(m_pServer, |
QObject::connect(m_pServer, |
2545 |
SIGNAL(finished(int,QProcess::ExitStatus)), |
SIGNAL(finished(int, QProcess::ExitStatus)), |
2546 |
SLOT(processServerExit())); |
SLOT(processServerExit())); |
2547 |
|
|
2548 |
// Build process arguments... |
// Build process arguments... |
2573 |
|
|
2574 |
|
|
2575 |
// Stop linuxsampler server... |
// Stop linuxsampler server... |
2576 |
void MainForm::stopServer (void) |
void MainForm::stopServer (bool bInteractive) |
2577 |
{ |
{ |
2578 |
// Stop client code. |
// Stop client code. |
2579 |
stopClient(); |
stopClient(); |
2580 |
|
|
2581 |
|
if (m_pServer && bInteractive) { |
2582 |
|
if (QMessageBox::question(this, |
2583 |
|
QSAMPLER_TITLE ": " + tr("The backend's fate ..."), |
2584 |
|
tr("You have the option to keep the sampler backend (LinuxSampler)\n" |
2585 |
|
"running in the background. The sampler would continue to work\n" |
2586 |
|
"according to your current sampler session and you could alter the\n" |
2587 |
|
"sampler session at any time by relaunching QSampler.\n\n" |
2588 |
|
"Do you want LinuxSampler to stop or to keep running in\n" |
2589 |
|
"the background?"), |
2590 |
|
tr("Stop"), tr("Keep Running")) == 1) |
2591 |
|
{ |
2592 |
|
bForceServerStop = false; |
2593 |
|
} |
2594 |
|
} |
2595 |
|
|
2596 |
// And try to stop server. |
// And try to stop server. |
2597 |
if (m_pServer) { |
if (m_pServer && bForceServerStop) { |
2598 |
appendMessages(tr("Server is stopping...")); |
appendMessages(tr("Server is stopping...")); |
2599 |
if (m_pServer->state() == QProcess::Running) |
if (m_pServer->state() == QProcess::Running) { |
2600 |
|
#if defined(WIN32) |
2601 |
|
// Try harder... |
2602 |
|
m_pServer->kill(); |
2603 |
|
#else |
2604 |
|
// Try softly... |
2605 |
m_pServer->terminate(); |
m_pServer->terminate(); |
2606 |
} |
#endif |
2607 |
|
} |
2608 |
|
} // Do final processing anyway. |
2609 |
|
else processServerExit(); |
2610 |
|
|
2611 |
// Give it some time to terminate gracefully and stabilize... |
// Give it some time to terminate gracefully and stabilize... |
2612 |
QTime t; |
QTime t; |
2613 |
t.start(); |
t.start(); |
2614 |
while (t.elapsed() < QSAMPLER_TIMER_MSECS) |
while (t.elapsed() < QSAMPLER_TIMER_MSECS) |
2615 |
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents); |
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents); |
|
|
|
|
// Do final processing anyway. |
|
|
processServerExit(); |
|
2616 |
} |
} |
2617 |
|
|
2618 |
|
|
2634 |
if (m_pMessages) |
if (m_pMessages) |
2635 |
m_pMessages->flushStdoutBuffer(); |
m_pMessages->flushStdoutBuffer(); |
2636 |
|
|
2637 |
if (m_pServer) { |
if (m_pServer && bForceServerStop) { |
2638 |
|
if (m_pServer->state() != QProcess::NotRunning) { |
2639 |
|
appendMessages(tr("Server is being forced...")); |
2640 |
|
// Force final server shutdown... |
2641 |
|
m_pServer->kill(); |
2642 |
|
// Give it some time to terminate gracefully and stabilize... |
2643 |
|
QTime t; |
2644 |
|
t.start(); |
2645 |
|
while (t.elapsed() < QSAMPLER_TIMER_MSECS) |
2646 |
|
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents); |
2647 |
|
} |
2648 |
// Force final server shutdown... |
// Force final server shutdown... |
2649 |
appendMessages( |
appendMessages( |
2650 |
tr("Server was stopped with exit status %1.") |
tr("Server was stopped with exit status %1.") |
2651 |
.arg(m_pServer->exitStatus())); |
.arg(m_pServer->exitStatus())); |
|
m_pServer->terminate(); |
|
|
if (!m_pServer->waitForFinished(2000)) |
|
|
m_pServer->kill(); |
|
|
// Destroy it. |
|
2652 |
delete m_pServer; |
delete m_pServer; |
2653 |
m_pServer = NULL; |
m_pServer = NULL; |
2654 |
} |
} |
2673 |
// as this is run under some other thread context. |
// as this is run under some other thread context. |
2674 |
// A custom event must be posted here... |
// A custom event must be posted here... |
2675 |
QApplication::postEvent(pMainForm, |
QApplication::postEvent(pMainForm, |
2676 |
new qsamplerCustomEvent(event, pchData, cchData)); |
new CustomEvent(event, pchData, cchData)); |
2677 |
|
|
2678 |
return LSCP_OK; |
return LSCP_OK; |
2679 |
} |
} |
2718 |
.arg(::lscp_client_get_timeout(m_pClient))); |
.arg(::lscp_client_get_timeout(m_pClient))); |
2719 |
|
|
2720 |
// Subscribe to channel info change notifications... |
// Subscribe to channel info change notifications... |
2721 |
|
if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_CHANNEL_COUNT) != LSCP_OK) |
2722 |
|
appendMessagesClient("lscp_client_subscribe(CHANNEL_COUNT)"); |
2723 |
if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_CHANNEL_INFO) != LSCP_OK) |
if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_CHANNEL_INFO) != LSCP_OK) |
2724 |
appendMessagesClient("lscp_client_subscribe"); |
appendMessagesClient("lscp_client_subscribe(CHANNEL_INFO)"); |
2725 |
|
|
2726 |
|
DeviceStatusForm::onDevicesChanged(); // initialize |
2727 |
|
updateViewMidiDeviceStatusMenu(); |
2728 |
|
if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_MIDI_INPUT_DEVICE_COUNT) != LSCP_OK) |
2729 |
|
appendMessagesClient("lscp_client_subscribe(MIDI_INPUT_DEVICE_COUNT)"); |
2730 |
|
if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_MIDI_INPUT_DEVICE_INFO) != LSCP_OK) |
2731 |
|
appendMessagesClient("lscp_client_subscribe(MIDI_INPUT_DEVICE_INFO)"); |
2732 |
|
if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_AUDIO_OUTPUT_DEVICE_COUNT) != LSCP_OK) |
2733 |
|
appendMessagesClient("lscp_client_subscribe(AUDIO_OUTPUT_DEVICE_COUNT)"); |
2734 |
|
if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_AUDIO_OUTPUT_DEVICE_INFO) != LSCP_OK) |
2735 |
|
appendMessagesClient("lscp_client_subscribe(AUDIO_OUTPUT_DEVICE_INFO)"); |
2736 |
|
|
2737 |
|
#if CONFIG_EVENT_CHANNEL_MIDI |
2738 |
|
// Subscribe to channel MIDI data notifications... |
2739 |
|
if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_CHANNEL_MIDI) != LSCP_OK) |
2740 |
|
appendMessagesClient("lscp_client_subscribe(CHANNEL_MIDI)"); |
2741 |
|
#endif |
2742 |
|
|
2743 |
|
#if CONFIG_EVENT_DEVICE_MIDI |
2744 |
|
// Subscribe to channel MIDI data notifications... |
2745 |
|
if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_DEVICE_MIDI) != LSCP_OK) |
2746 |
|
appendMessagesClient("lscp_client_subscribe(DEVICE_MIDI)"); |
2747 |
|
#endif |
2748 |
|
|
2749 |
// We may stop scheduling around. |
// We may stop scheduling around. |
2750 |
stopSchedule(); |
stopSchedule(); |
2798 |
closeSession(false); |
closeSession(false); |
2799 |
|
|
2800 |
// Close us as a client... |
// Close us as a client... |
2801 |
|
#if CONFIG_EVENT_DEVICE_MIDI |
2802 |
|
::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_DEVICE_MIDI); |
2803 |
|
#endif |
2804 |
|
#if CONFIG_EVENT_CHANNEL_MIDI |
2805 |
|
::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_CHANNEL_MIDI); |
2806 |
|
#endif |
2807 |
|
::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_AUDIO_OUTPUT_DEVICE_INFO); |
2808 |
|
::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_AUDIO_OUTPUT_DEVICE_COUNT); |
2809 |
|
::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_MIDI_INPUT_DEVICE_INFO); |
2810 |
|
::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_MIDI_INPUT_DEVICE_COUNT); |
2811 |
::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_CHANNEL_INFO); |
::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_CHANNEL_INFO); |
2812 |
|
::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_CHANNEL_COUNT); |
2813 |
::lscp_client_destroy(m_pClient); |
::lscp_client_destroy(m_pClient); |
2814 |
m_pClient = NULL; |
m_pClient = NULL; |
2815 |
|
|
2827 |
stabilizeForm(); |
stabilizeForm(); |
2828 |
} |
} |
2829 |
|
|
2830 |
|
|
2831 |
|
// Channel strip activation/selection. |
2832 |
|
void MainForm::activateStrip ( QWidget *pWidget ) |
2833 |
|
{ |
2834 |
|
ChannelStrip *pChannelStrip |
2835 |
|
= static_cast<ChannelStrip *> (pWidget); |
2836 |
|
if (pChannelStrip) |
2837 |
|
pChannelStrip->setSelected(true); |
2838 |
|
|
2839 |
|
stabilizeForm(); |
2840 |
|
} |
2841 |
|
|
2842 |
|
|
2843 |
} // namespace QSampler |
} // namespace QSampler |
2844 |
|
|
2845 |
|
|