58 |
#include <gig.h> |
#include <gig.h> |
59 |
#endif |
#endif |
60 |
|
|
61 |
|
// Needed for lroundf() |
62 |
|
#include <math.h> |
63 |
|
|
64 |
|
#ifndef CONFIG_ROUND |
65 |
|
static inline long lroundf ( float x ) |
66 |
|
{ |
67 |
|
if (x >= 0.0f) |
68 |
|
return long(x + 0.5f); |
69 |
|
else |
70 |
|
return long(x - 0.5f); |
71 |
|
} |
72 |
|
#endif |
73 |
|
|
74 |
// Timer constant stuff. |
// Timer constant stuff. |
75 |
#define QSAMPLER_TIMER_MSECS 200 |
#define QSAMPLER_TIMER_MSECS 200 |
76 |
|
|
157 |
|
|
158 |
#ifdef CONFIG_VOLUME |
#ifdef CONFIG_VOLUME |
159 |
// Make some extras into the toolbar... |
// Make some extras into the toolbar... |
|
channelsToolbar->addSeparator(); |
|
160 |
const QString& sVolumeText = tr("Master volume"); |
const QString& sVolumeText = tr("Master volume"); |
161 |
m_iVolumeChanging = 0; |
m_iVolumeChanging = 0; |
162 |
// Volume slider... |
// Volume slider... |
163 |
|
channelsToolbar->addSeparator(); |
164 |
m_pVolumeSlider = new QSlider(Qt::Horizontal, channelsToolbar); |
m_pVolumeSlider = new QSlider(Qt::Horizontal, channelsToolbar); |
165 |
// m_pVolumeSlider->setTickmarks(QSlider::Below); |
m_pVolumeSlider->setTickmarks(QSlider::Below); |
166 |
// m_pVolumeSlider->setTickInterval(10); |
m_pVolumeSlider->setTickInterval(10); |
167 |
m_pVolumeSlider->setPageStep(10); |
m_pVolumeSlider->setPageStep(10); |
168 |
m_pVolumeSlider->setRange(0, 100); |
m_pVolumeSlider->setRange(0, 100); |
169 |
m_pVolumeSlider->setMaximumHeight(22); |
m_pVolumeSlider->setMaximumHeight(22); |
170 |
m_pVolumeSlider->setMinimumWidth(160); |
m_pVolumeSlider->setMinimumWidth(160); |
|
m_pVolumeSlider->setSizePolicy( |
|
|
QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); |
|
171 |
QToolTip::add(m_pVolumeSlider, sVolumeText); |
QToolTip::add(m_pVolumeSlider, sVolumeText); |
172 |
QObject::connect(m_pVolumeSlider, |
QObject::connect(m_pVolumeSlider, |
173 |
SIGNAL(valueChanged(int)), |
SIGNAL(valueChanged(int)), |
174 |
SLOT(volumeChanged(int))); |
SLOT(volumeChanged(int))); |
175 |
|
channelsToolbar->setHorizontallyStretchable(true); |
176 |
|
channelsToolbar->setStretchableWidget(m_pVolumeSlider); |
177 |
// Volume spin-box |
// Volume spin-box |
178 |
|
channelsToolbar->addSeparator(); |
179 |
m_pVolumeSpinBox = new QSpinBox(channelsToolbar); |
m_pVolumeSpinBox = new QSpinBox(channelsToolbar); |
180 |
m_pVolumeSpinBox->setSuffix(" %"); |
m_pVolumeSpinBox->setSuffix(" %"); |
181 |
m_pVolumeSpinBox->setRange(0, 100); |
m_pVolumeSpinBox->setRange(0, 100); |
1300 |
} |
} |
1301 |
|
|
1302 |
|
|
1303 |
|
// Edit current sampler channel. |
1304 |
|
void qsamplerMainForm::editEditChannel (void) |
1305 |
|
{ |
1306 |
|
if (m_pClient == NULL) |
1307 |
|
return; |
1308 |
|
|
1309 |
|
qsamplerChannelStrip *pChannelStrip = activeChannelStrip(); |
1310 |
|
if (pChannelStrip == NULL) |
1311 |
|
return; |
1312 |
|
|
1313 |
|
// Just invoque the channel strip procedure. |
1314 |
|
pChannelStrip->channelEdit(); |
1315 |
|
} |
1316 |
|
|
1317 |
|
|
1318 |
// Reset current sampler channel. |
// Reset current sampler channel. |
1319 |
void qsamplerMainForm::editResetChannel (void) |
void qsamplerMainForm::editResetChannel (void) |
1320 |
{ |
{ |
1629 |
sText += tr("MIDI instrument mapping support disabled."); |
sText += tr("MIDI instrument mapping support disabled."); |
1630 |
sText += "</font></small><br />"; |
sText += "</font></small><br />"; |
1631 |
#endif |
#endif |
1632 |
|
#ifndef CONFIG_EDIT_INSTRUMENT |
1633 |
|
sText += "<small><font color=\"red\">"; |
1634 |
|
sText += tr("Instrument editing support disabled."); |
1635 |
|
sText += "</font></small><br />"; |
1636 |
|
#endif |
1637 |
sText += "<br />\n"; |
sText += "<br />\n"; |
1638 |
sText += tr("Using") + ": "; |
sText += tr("Using") + ": "; |
1639 |
sText += ::lscp_client_package(); |
sText += ::lscp_client_package(); |
1685 |
editAddChannelAction->setEnabled(bHasClient); |
editAddChannelAction->setEnabled(bHasClient); |
1686 |
editRemoveChannelAction->setEnabled(bHasChannel); |
editRemoveChannelAction->setEnabled(bHasChannel); |
1687 |
editSetupChannelAction->setEnabled(bHasChannel); |
editSetupChannelAction->setEnabled(bHasChannel); |
1688 |
|
#ifdef CONFIG_EDIT_INSTRUMENT |
1689 |
|
editEditChannelAction->setEnabled(bHasChannel); |
1690 |
|
#else |
1691 |
|
editEditChannelAction->setEnabled(false); |
1692 |
|
#endif |
1693 |
editResetChannelAction->setEnabled(bHasChannel); |
editResetChannelAction->setEnabled(bHasChannel); |
1694 |
editResetAllChannelsAction->setEnabled(bHasChannel); |
editResetAllChannelsAction->setEnabled(bHasChannel); |
1695 |
viewMessagesAction->setOn(m_pMessages && m_pMessages->isVisible()); |
viewMessagesAction->setOn(m_pMessages && m_pMessages->isVisible()); |
1697 |
viewInstrumentsAction->setOn(m_pInstrumentListForm |
viewInstrumentsAction->setOn(m_pInstrumentListForm |
1698 |
&& m_pInstrumentListForm->isVisible()); |
&& m_pInstrumentListForm->isVisible()); |
1699 |
viewInstrumentsAction->setEnabled(bHasClient); |
viewInstrumentsAction->setEnabled(bHasClient); |
1700 |
|
#else |
1701 |
|
viewInstrumentsAction->setEnabled(false); |
1702 |
#endif |
#endif |
1703 |
viewDevicesAction->setOn(m_pDeviceForm |
viewDevicesAction->setOn(m_pDeviceForm |
1704 |
&& m_pDeviceForm->isVisible()); |
&& m_pDeviceForm->isVisible()); |
1750 |
m_iVolumeChanging++; |
m_iVolumeChanging++; |
1751 |
|
|
1752 |
// Update the toolbar widgets... |
// Update the toolbar widgets... |
1753 |
if (m_pVolumeSlider->value() != iVolume) |
if (m_pVolumeSlider->value() != iVolume) |
1754 |
m_pVolumeSlider->setValue(iVolume); |
m_pVolumeSlider->setValue(iVolume); |
1755 |
if (m_pVolumeSpinBox->value() != iVolume) |
if (m_pVolumeSpinBox->value() != iVolume) |
1756 |
m_pVolumeSpinBox->setValue(iVolume); |
m_pVolumeSpinBox->setValue(iVolume); |
1760 |
if (::lscp_set_volume(m_pClient, fVolume) == LSCP_OK) |
if (::lscp_set_volume(m_pClient, fVolume) == LSCP_OK) |
1761 |
appendMessages(QObject::tr("Volume: %1.").arg(fVolume)); |
appendMessages(QObject::tr("Volume: %1.").arg(fVolume)); |
1762 |
else |
else |
1763 |
appendMessagesClient("lscp_set_channel_volume"); |
appendMessagesClient("lscp_set_volume"); |
1764 |
|
|
1765 |
m_iVolumeChanging--; |
m_iVolumeChanging--; |
1766 |
|
|
1791 |
void qsamplerMainForm::updateSession (void) |
void qsamplerMainForm::updateSession (void) |
1792 |
{ |
{ |
1793 |
#ifdef CONFIG_VOLUME |
#ifdef CONFIG_VOLUME |
1794 |
int iVolume = 100.0f * ::lscp_get_volume(m_pClient); |
int iVolume = ::lroundf(100.0f * ::lscp_get_volume(m_pClient)); |
1795 |
m_iVolumeChanging++; |
m_iVolumeChanging++; |
1796 |
m_pVolumeSlider->setValue(iVolume); |
m_pVolumeSlider->setValue(iVolume); |
1797 |
m_pVolumeSpinBox->setValue(iVolume); |
m_pVolumeSpinBox->setValue(iVolume); |