1 |
// qsamplerChannelStrip.cpp |
// qsamplerChannelStrip.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, 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 |
25 |
|
|
26 |
#include "qsamplerMainForm.h" |
#include "qsamplerMainForm.h" |
27 |
|
|
28 |
|
#include "qsamplerChannelFxForm.h" |
29 |
|
|
30 |
|
#include <QMessageBox> |
31 |
#include <QDragEnterEvent> |
#include <QDragEnterEvent> |
32 |
|
#include <QTimer> |
33 |
#include <QUrl> |
#include <QUrl> |
34 |
|
|
35 |
|
|
36 |
// Channel status/usage usage limit control. |
// Channel status/usage usage limit control. |
37 |
#define QSAMPLER_ERROR_LIMIT 3 |
#define QSAMPLER_ERROR_LIMIT 3 |
38 |
|
|
56 |
// QSampler::ChannelStrip -- Channel strip form implementation. |
// QSampler::ChannelStrip -- Channel strip form implementation. |
57 |
// |
// |
58 |
|
|
59 |
|
// MIDI activity pixmap common resources. |
60 |
|
int ChannelStrip::g_iMidiActivityRefCount = 0; |
61 |
|
QPixmap *ChannelStrip::g_pMidiActivityLedOn = NULL; |
62 |
|
QPixmap *ChannelStrip::g_pMidiActivityLedOff = NULL; |
63 |
|
|
64 |
// Channel strip activation/selection. |
// Channel strip activation/selection. |
65 |
ChannelStrip *ChannelStrip::g_pSelectedStrip = NULL; |
ChannelStrip *ChannelStrip::g_pSelectedStrip = NULL; |
66 |
|
|
74 |
m_iDirtyChange = 0; |
m_iDirtyChange = 0; |
75 |
m_iErrorCount = 0; |
m_iErrorCount = 0; |
76 |
|
|
77 |
|
if (++g_iMidiActivityRefCount == 1) { |
78 |
|
g_pMidiActivityLedOn = new QPixmap(":/icons/ledon1.png"); |
79 |
|
g_pMidiActivityLedOff = new QPixmap(":/icons/ledoff1.png"); |
80 |
|
} |
81 |
|
|
82 |
|
m_ui.MidiActivityLabel->setPixmap(*g_pMidiActivityLedOff); |
83 |
|
|
84 |
|
#ifndef CONFIG_EVENT_CHANNEL_MIDI |
85 |
|
m_ui.MidiActivityLabel->setToolTip("MIDI activity (disabled)"); |
86 |
|
#endif |
87 |
|
|
88 |
|
m_pMidiActivityTimer = new QTimer(this); |
89 |
|
m_pMidiActivityTimer->setSingleShot(true); |
90 |
|
|
91 |
|
QObject::connect(m_pMidiActivityTimer, |
92 |
|
SIGNAL(timeout()), |
93 |
|
SLOT(midiActivityLedOff()) |
94 |
|
); |
95 |
|
|
96 |
// Try to restore normal window positioning. |
// Try to restore normal window positioning. |
97 |
adjustSize(); |
adjustSize(); |
98 |
|
|
114 |
QObject::connect(m_ui.ChannelEditPushButton, |
QObject::connect(m_ui.ChannelEditPushButton, |
115 |
SIGNAL(clicked()), |
SIGNAL(clicked()), |
116 |
SLOT(channelEdit())); |
SLOT(channelEdit())); |
117 |
|
QObject::connect(m_ui.FxPushButton, |
118 |
|
SIGNAL(clicked()), |
119 |
|
SLOT(channelFxEdit())); |
120 |
|
|
121 |
setSelected(false); |
setSelected(false); |
122 |
} |
} |
130 |
if (m_pChannel) |
if (m_pChannel) |
131 |
delete m_pChannel; |
delete m_pChannel; |
132 |
m_pChannel = NULL; |
m_pChannel = NULL; |
133 |
|
|
134 |
|
if (--g_iMidiActivityRefCount == 0) { |
135 |
|
if (g_pMidiActivityLedOn) |
136 |
|
delete g_pMidiActivityLedOn; |
137 |
|
g_pMidiActivityLedOn = NULL; |
138 |
|
if (g_pMidiActivityLedOff) |
139 |
|
delete g_pMidiActivityLedOff; |
140 |
|
g_pMidiActivityLedOff = NULL; |
141 |
|
} |
142 |
} |
} |
143 |
|
|
144 |
|
|
254 |
pal.setColor(QPalette::Background, Qt::black); |
pal.setColor(QPalette::Background, Qt::black); |
255 |
} |
} |
256 |
m_ui.ChannelInfoFrame->setPalette(pal); |
m_ui.ChannelInfoFrame->setPalette(pal); |
257 |
|
m_ui.InstrumentNameTextLabel->setPalette(pal); |
258 |
m_ui.StreamVoiceCountTextLabel->setPalette(pal); |
m_ui.StreamVoiceCountTextLabel->setPalette(pal); |
259 |
} |
} |
260 |
|
|
326 |
m_pChannel->editChannel(); |
m_pChannel->editChannel(); |
327 |
} |
} |
328 |
|
|
329 |
|
bool ChannelStrip::channelFxEdit (void) |
330 |
|
{ |
331 |
|
MainForm *pMainForm = MainForm::getInstance(); |
332 |
|
if (!pMainForm || !channel()) |
333 |
|
return false; |
334 |
|
|
335 |
|
pMainForm->appendMessages(QObject::tr("channel fx sends...")); |
336 |
|
|
337 |
|
bool bResult = false; |
338 |
|
|
339 |
|
#if CONFIG_FXSEND |
340 |
|
ChannelFxForm *pChannelFxForm = |
341 |
|
new ChannelFxForm(channel(), parentWidget()); |
342 |
|
if (pChannelFxForm) { |
343 |
|
//pChannelForm->setup(this); |
344 |
|
bResult = pChannelFxForm->exec(); |
345 |
|
delete pChannelFxForm; |
346 |
|
} |
347 |
|
#else // CONFIG_FXSEND |
348 |
|
QMessageBox::critical(this, |
349 |
|
QSAMPLER_TITLE ": " + tr("Unavailable"), |
350 |
|
tr("Sorry, QSampler was built without FX send support!\n\n" |
351 |
|
"(Make sure you have a recent liblscp when recompiling QSampler)")); |
352 |
|
#endif // CONFIG_FXSEND |
353 |
|
|
354 |
|
return bResult; |
355 |
|
} |
356 |
|
|
357 |
// Channel reset slot. |
// Channel reset slot. |
358 |
bool ChannelStrip::channelReset (void) |
bool ChannelStrip::channelReset (void) |
578 |
} |
} |
579 |
|
|
580 |
|
|
581 |
|
void ChannelStrip::midiActivityLedOn (void) |
582 |
|
{ |
583 |
|
m_ui.MidiActivityLabel->setPixmap(*g_pMidiActivityLedOn); |
584 |
|
m_pMidiActivityTimer->start(100); |
585 |
|
} |
586 |
|
|
587 |
|
|
588 |
|
void ChannelStrip::midiActivityLedOff (void) |
589 |
|
{ |
590 |
|
m_ui.MidiActivityLabel->setPixmap(*g_pMidiActivityLedOff); |
591 |
|
} |
592 |
|
|
593 |
|
|
594 |
// Error count hackish accessors. |
// Error count hackish accessors. |
595 |
void ChannelStrip::resetErrorCount (void) |
void ChannelStrip::resetErrorCount (void) |
596 |
{ |
{ |