32 |
#include <qfile.h> |
#include <qfile.h> |
33 |
#include <qtextstream.h> |
#include <qtextstream.h> |
34 |
#include <qstatusbar.h> |
#include <qstatusbar.h> |
35 |
|
#include <qslider.h> |
36 |
|
#include <qspinbox.h> |
37 |
#include <qlabel.h> |
#include <qlabel.h> |
38 |
#include <qtimer.h> |
#include <qtimer.h> |
39 |
|
#include <qtooltip.h> |
40 |
|
|
41 |
#include "qsamplerAbout.h" |
#include "qsamplerAbout.h" |
42 |
#include "qsamplerOptions.h" |
#include "qsamplerOptions.h" |
142 |
::signal(SIGPIPE, SIG_IGN); |
::signal(SIGPIPE, SIG_IGN); |
143 |
#endif |
#endif |
144 |
|
|
145 |
|
#ifdef CONFIG_VOLUME |
146 |
|
// Make some extras into the toolbar... |
147 |
|
channelsToolbar->addSeparator(); |
148 |
|
const QString& sVolumeText = tr("Master volume"); |
149 |
|
m_iVolumeChanging = 0; |
150 |
|
// Volume slider... |
151 |
|
m_pVolumeSlider = new QSlider(Qt::Horizontal, channelsToolbar); |
152 |
|
// m_pVolumeSlider->setTickmarks(QSlider::Below); |
153 |
|
// m_pVolumeSlider->setTickInterval(10); |
154 |
|
m_pVolumeSlider->setPageStep(10); |
155 |
|
m_pVolumeSlider->setRange(0, 100); |
156 |
|
m_pVolumeSlider->setMaximumHeight(22); |
157 |
|
m_pVolumeSlider->setMinimumWidth(160); |
158 |
|
m_pVolumeSlider->setSizePolicy( |
159 |
|
QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); |
160 |
|
QToolTip::add(m_pVolumeSlider, sVolumeText); |
161 |
|
QObject::connect(m_pVolumeSlider, |
162 |
|
SIGNAL(valueChanged(int)), |
163 |
|
SLOT(volumeChanged(int))); |
164 |
|
// Volume spin-box |
165 |
|
m_pVolumeSpinBox = new QSpinBox(channelsToolbar); |
166 |
|
m_pVolumeSpinBox->setSuffix(" %"); |
167 |
|
m_pVolumeSpinBox->setRange(0, 100); |
168 |
|
QToolTip::add(m_pVolumeSpinBox, sVolumeText); |
169 |
|
QObject::connect(m_pVolumeSpinBox, |
170 |
|
SIGNAL(valueChanged(int)), |
171 |
|
SLOT(volumeChanged(int))); |
172 |
|
#endif |
173 |
|
|
174 |
// Make it an MDI workspace. |
// Make it an MDI workspace. |
175 |
m_pWorkspace = new QWorkspace(this); |
m_pWorkspace = new QWorkspace(this); |
176 |
m_pWorkspace->setScrollBarsEnabled(true); |
m_pWorkspace->setScrollBarsEnabled(true); |
247 |
if (m_statusItem[QSAMPLER_STATUS_SESSION]) |
if (m_statusItem[QSAMPLER_STATUS_SESSION]) |
248 |
delete m_statusItem[QSAMPLER_STATUS_SESSION]; |
delete m_statusItem[QSAMPLER_STATUS_SESSION]; |
249 |
|
|
250 |
|
#ifdef CONFIG_VOLUME |
251 |
|
delete m_pVolumeSpinBox; |
252 |
|
delete m_pVolumeSlider; |
253 |
|
#endif |
254 |
|
|
255 |
// Delete recentfiles menu. |
// Delete recentfiles menu. |
256 |
if (m_pRecentFilesMenu) |
if (m_pRecentFilesMenu) |
257 |
delete m_pRecentFilesMenu; |
delete m_pRecentFilesMenu; |
323 |
m_pOptions->loadWidgetGeometry(m_pDeviceForm); |
m_pOptions->loadWidgetGeometry(m_pDeviceForm); |
324 |
|
|
325 |
// Final startup stabilization... |
// Final startup stabilization... |
326 |
|
updateMaxVolume(); |
327 |
updateRecentFilesMenu(); |
updateRecentFilesMenu(); |
328 |
stabilizeForm(); |
stabilizeForm(); |
329 |
|
|
1033 |
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
1034 |
} |
} |
1035 |
|
|
1036 |
|
#ifdef CONFIG_VOLUME |
1037 |
|
ts << "# " << tr("Global volume level") << endl; |
1038 |
|
ts << "SET VOLUME " << ::lscp_get_volume(m_pClient) << endl; |
1039 |
|
ts << endl; |
1040 |
|
#endif |
1041 |
|
|
1042 |
// Ok. we've wrote it. |
// Ok. we've wrote it. |
1043 |
file.close(); |
file.close(); |
1044 |
|
|
1590 |
sText += tr("Sampler channel Effect Sends support disabled."); |
sText += tr("Sampler channel Effect Sends support disabled."); |
1591 |
sText += "</font></small><br />"; |
sText += "</font></small><br />"; |
1592 |
#endif |
#endif |
1593 |
|
#ifndef CONFIG_VOLUME |
1594 |
|
sText += "<small><font color=\"red\">"; |
1595 |
|
sText += tr("Global volume support disabled."); |
1596 |
|
sText += "</font></small><br />"; |
1597 |
|
#endif |
1598 |
#ifndef CONFIG_MIDI_INSTRUMENT |
#ifndef CONFIG_MIDI_INSTRUMENT |
1599 |
sText += "<small><font color=\"red\">"; |
sText += "<small><font color=\"red\">"; |
1600 |
sText += tr("MIDI instrument mapping support disabled."); |
sText += tr("MIDI instrument mapping support disabled."); |
1664 |
viewDevicesAction->setEnabled(bHasClient); |
viewDevicesAction->setEnabled(bHasClient); |
1665 |
channelsArrangeAction->setEnabled(bHasChannel); |
channelsArrangeAction->setEnabled(bHasChannel); |
1666 |
|
|
1667 |
|
#ifdef CONFIG_VOLUME |
1668 |
|
// Toolbar widgets are also affected... |
1669 |
|
m_pVolumeSlider->setEnabled(bHasClient); |
1670 |
|
m_pVolumeSpinBox->setEnabled(bHasClient); |
1671 |
|
#endif |
1672 |
|
|
1673 |
// Client/Server status... |
// Client/Server status... |
1674 |
if (bHasClient) { |
if (bHasClient) { |
1675 |
m_statusItem[QSAMPLER_STATUS_CLIENT]->setText(tr("Connected")); |
m_statusItem[QSAMPLER_STATUS_CLIENT]->setText(tr("Connected")); |
1698 |
} |
} |
1699 |
|
|
1700 |
|
|
1701 |
|
// Global volume change receiver slot. |
1702 |
|
void qsamplerMainForm::volumeChanged ( int iVolume ) |
1703 |
|
{ |
1704 |
|
#ifdef CONFIG_VOLUME |
1705 |
|
|
1706 |
|
if (m_iVolumeChanging > 0) |
1707 |
|
return; |
1708 |
|
|
1709 |
|
m_iVolumeChanging++; |
1710 |
|
|
1711 |
|
// Update the toolbar widgets... |
1712 |
|
if (m_pVolumeSlider->value() != iVolume) |
1713 |
|
m_pVolumeSlider->setValue(iVolume); |
1714 |
|
if (m_pVolumeSpinBox->value() != iVolume) |
1715 |
|
m_pVolumeSpinBox->setValue(iVolume); |
1716 |
|
|
1717 |
|
// Do it as commanded... |
1718 |
|
float fVolume = 0.01f * float(iVolume); |
1719 |
|
if (::lscp_set_volume(m_pClient, fVolume) == LSCP_OK) |
1720 |
|
appendMessages(QObject::tr("Volume: %1.").arg(fVolume)); |
1721 |
|
else |
1722 |
|
appendMessagesClient("lscp_set_channel_volume"); |
1723 |
|
|
1724 |
|
m_iVolumeChanging--; |
1725 |
|
|
1726 |
|
m_iDirtyCount++; |
1727 |
|
stabilizeForm(); |
1728 |
|
|
1729 |
|
#endif |
1730 |
|
} |
1731 |
|
|
1732 |
|
|
1733 |
// Channel change receiver slot. |
// Channel change receiver slot. |
1734 |
void qsamplerMainForm::channelStripChanged( qsamplerChannelStrip *pChannelStrip ) |
void qsamplerMainForm::channelStripChanged( qsamplerChannelStrip *pChannelStrip ) |
1735 |
{ |
{ |
1749 |
// Grab and restore current sampler channels session. |
// Grab and restore current sampler channels session. |
1750 |
void qsamplerMainForm::updateSession (void) |
void qsamplerMainForm::updateSession (void) |
1751 |
{ |
{ |
1752 |
|
#ifdef CONFIG_VOLUME |
1753 |
|
int iVolume = 100.0f * ::lscp_get_volume(m_pClient); |
1754 |
|
m_iVolumeChanging++; |
1755 |
|
m_pVolumeSlider->setValue(iVolume); |
1756 |
|
m_pVolumeSpinBox->setValue(iVolume); |
1757 |
|
m_iVolumeChanging--; |
1758 |
|
#endif |
1759 |
#ifdef CONFIG_MIDI_INSTRUMENT |
#ifdef CONFIG_MIDI_INSTRUMENT |
1760 |
// FIXME: Make some room for default instrument maps... |
// FIXME: Make some room for default instrument maps... |
1761 |
int iMaps = ::lscp_get_midi_instrument_maps(m_pClient); |
int iMaps = ::lscp_get_midi_instrument_maps(m_pClient); |
1916 |
if (m_pOptions == NULL) |
if (m_pOptions == NULL) |
1917 |
return; |
return; |
1918 |
|
|
1919 |
|
#ifdef CONFIG_VOLUME |
1920 |
|
m_iVolumeChanging++; |
1921 |
|
m_pVolumeSlider->setMaxValue(m_pOptions->iMaxVolume); |
1922 |
|
m_pVolumeSpinBox->setMaxValue(m_pOptions->iMaxVolume); |
1923 |
|
m_iVolumeChanging--; |
1924 |
|
#endif |
1925 |
|
|
1926 |
// Full channel list update... |
// Full channel list update... |
1927 |
QWidgetList wlist = m_pWorkspace->windowList(); |
QWidgetList wlist = m_pWorkspace->windowList(); |
1928 |
if (wlist.isEmpty()) |
if (wlist.isEmpty()) |