summaryrefslogtreecommitdiff
path: root/muse2/muse/ctrl/ctrlpanel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'muse2/muse/ctrl/ctrlpanel.cpp')
-rw-r--r--muse2/muse/ctrl/ctrlpanel.cpp132
1 files changed, 84 insertions, 48 deletions
diff --git a/muse2/muse/ctrl/ctrlpanel.cpp b/muse2/muse/ctrl/ctrlpanel.cpp
index 5e07e5f3..ed83bab8 100644
--- a/muse2/muse/ctrl/ctrlpanel.cpp
+++ b/muse2/muse/ctrl/ctrlpanel.cpp
@@ -64,7 +64,7 @@ namespace MusEGui {
// CtrlPanel
//---------------------------------------------------------
-CtrlPanel::CtrlPanel(QWidget* parent, MidiEditor* e, const char* name)
+CtrlPanel::CtrlPanel(QWidget* parent, MidiEditor* e, CtrlCanvas* c, const char* name)
: QWidget(parent)
{
setObjectName(name);
@@ -72,6 +72,7 @@ CtrlPanel::CtrlPanel(QWidget* parent, MidiEditor* e, const char* name)
//ctrlMainPop = 0;
//ctrlSubPop = 0;
editor = e;
+ ctrlcanvas = c;
setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
QVBoxLayout* vbox = new QVBoxLayout;
QHBoxLayout* bbox = new QHBoxLayout;
@@ -170,11 +171,11 @@ void CtrlPanel::heartBeat()
{
int outport;
int chan;
- int cdi = editor->curDrumInstrument();
- if(_track->type() == MusECore::Track::DRUM && ((_ctrl->num() & 0xff) == 0xff) && cdi != -1)
+ int cdp = ctrlcanvas->getCurDrumPitch();
+ if(_track->type() == MusECore::Track::DRUM && ((_ctrl->num() & 0xff) == 0xff) && cdp != -1)
{
- outport = MusEGlobal::drumMap[cdi].port;
- chan = MusEGlobal::drumMap[cdi].channel;
+ outport = MusEGlobal::drumMap[cdp].port;
+ chan = MusEGlobal::drumMap[cdp].channel;
}
else
{
@@ -248,11 +249,11 @@ void CtrlPanel::labelDoubleClicked()
int outport;
int chan;
- int cdi = editor->curDrumInstrument();
- if(_track->type() == MusECore::Track::DRUM && ((_ctrl->num() & 0xff) == 0xff) && cdi != -1)
+ int cdp = ctrlcanvas->getCurDrumPitch();
+ if(_track->type() == MusECore::Track::DRUM && ((_ctrl->num() & 0xff) == 0xff) && cdp != -1)
{
- outport = MusEGlobal::drumMap[cdi].port;
- chan = MusEGlobal::drumMap[cdi].channel;
+ outport = MusEGlobal::drumMap[cdp].port;
+ chan = MusEGlobal::drumMap[cdp].channel;
}
else
{
@@ -352,11 +353,11 @@ void CtrlPanel::ctrlChanged(double val)
int outport;
int chan;
- int cdi = editor->curDrumInstrument();
- if(_track->type() == MusECore::Track::DRUM && ((_ctrl->num() & 0xff) == 0xff) && cdi != -1)
+ int cdp = ctrlcanvas->getCurDrumPitch();
+ if(_track->type() == MusECore::Track::DRUM && ((_ctrl->num() & 0xff) == 0xff) && cdp != -1)
{
- outport = MusEGlobal::drumMap[cdi].port;
- chan = MusEGlobal::drumMap[cdi].channel;
+ outport = MusEGlobal::drumMap[cdp].port;
+ chan = MusEGlobal::drumMap[cdp].channel;
}
else
{
@@ -421,13 +422,19 @@ void CtrlPanel::setHWController(MusECore::MidiTrack* t, MusECore::MidiController
MusECore::MidiPort* mp;
int ch;
- int cdi = editor->curDrumInstrument();
+ int cdp = ctrlcanvas->getCurDrumPitch();
_dnum = _ctrl->num();
- if(_track->type() == MusECore::Track::DRUM && ((_dnum & 0xff) == 0xff) && cdi != -1)
+ if(_track->type() == MusECore::Track::DRUM && ((_dnum & 0xff) == 0xff) && cdp != -1)
{
- _dnum = (_dnum & ~0xff) | MusEGlobal::drumMap[cdi].anote;
- mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[cdi].port];
- ch = MusEGlobal::drumMap[cdi].channel;
+ _dnum = (_dnum & ~0xff) | MusEGlobal::drumMap[cdp].anote;
+ mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[cdp].port];
+ ch = MusEGlobal::drumMap[cdp].channel;
+ }
+ else if(_track->type() == MusECore::Track::NEW_DRUM && ((_dnum & 0xff) == 0xff) && cdp != -1)
+ {
+ _dnum = (_dnum & ~0xff) | cdp; //FINDMICHJETZT does that work?
+ mp = &MusEGlobal::midiPorts[_track->outPort()];
+ ch = _track->outChannel();
}
else
{
@@ -576,8 +583,9 @@ void CtrlPanel::ctrlPopup()
MusECore::MidiTrack* track = (MusECore::MidiTrack*)(part->track());
int channel = track->outChannel();
MusECore::MidiPort* port = &MusEGlobal::midiPorts[track->outPort()];
- int curDrumInstrument = editor->curDrumInstrument();
+ int curDrumPitch = ctrlcanvas->getCurDrumPitch();
bool isDrum = track->type() == MusECore::Track::DRUM;
+ bool isNewDrum = track->type() == MusECore::Track::NEW_DRUM;
QMenu* pop = new QMenu;
//pop->clear();
@@ -595,12 +603,20 @@ void CtrlPanel::ctrlPopup()
MusECore::MidiController* c = port->midiController(cl->num());
// dont show drum specific controller if not a drum track
if ((c->num() & 0xff) == 0xff) {
- if (!isDrum)
- continue;
- // only show controller for curDrumInstrument:
- if ((cl->num() & 0xff) != MusEGlobal::drumMap[curDrumInstrument].anote) {
- continue;
- }
+ if (isDrum)
+ {
+ // only show controller for curDrumPitch:
+ if ((curDrumPitch == -1) || ((cl->num() & 0xff) != MusEGlobal::drumMap[curDrumPitch].anote))
+ continue;
+ }
+ else if (isNewDrum)
+ {
+ // only show controller for curDrumPitch: FINDMICH does this work?
+ if ((curDrumPitch == -1) || ((cl->num() & 0xff) != curDrumPitch))
+ continue;
+ }
+ else
+ continue;
}
isList i = sList.begin();
for (; i != sList.end(); ++i) {
@@ -663,8 +679,10 @@ void CtrlPanel::ctrlPopup()
for (iMusECore::MidiController ci = mcl->begin(); ci != mcl->end(); ++ci)
{
int num = ci->second->num();
- if (isDrum && ((num & 0xff) == 0xff))
- num = (num & ~0xff) + MusEGlobal::drumMap[curDrumInstrument].anote;
+ if (isDrum && ((num & 0xff) == 0xff) && curDrumPitch!=-1)
+ num = (num & ~0xff) + MusEGlobal::drumMap[curDrumPitch].anote;
+ if (isNewDrum && ((num & 0xff) == 0xff) && curDrumPitch!=-1) //FINDMICHJETZT does this work?
+ num = (num & ~0xff) + curDrumPitch;
if(cll->find(channel, num) == cll->end())
pop1->addAction(ci->second->name());
@@ -677,8 +695,10 @@ void CtrlPanel::ctrlPopup()
c = ci->second;
if (c->name() == s) {
int num = c->num();
- if (isDrum && ((num & 0xff) == 0xff))
- num = (num & ~0xff) + MusEGlobal::drumMap[curDrumInstrument].anote;
+ if (isDrum && ((num & 0xff) == 0xff) && curDrumPitch!=-1)
+ num = (num & ~0xff) + MusEGlobal::drumMap[curDrumPitch].anote;
+ if (isNewDrum && ((num & 0xff) == 0xff) && curDrumPitch!=-1) //FINDMICHJETZT does this work?
+ num = (num & ~0xff) + curDrumPitch;
if(cll->find(channel, num) == cll->end())
{
@@ -734,8 +754,9 @@ void CtrlPanel::ctrlPopup()
MusECore::MidiTrack* track = (MusECore::MidiTrack*)(part->track());
int channel = track->outChannel();
MusECore::MidiPort* port = &MusEGlobal::midiPorts[track->outPort()];
- int curDrumInstrument = editor->curDrumInstrument();
- bool isDrum = track->type() == MusECore::Track::DRUM; //FINDMICHJETZT ist das wichtig?
+ int curDrumPitch = ctrlcanvas->getCurDrumPitch();
+ bool isDrum = track->type() == MusECore::Track::DRUM;
+ bool isNewDrum = track->type() == MusECore::Track::NEW_DRUM;
MusECore::MidiInstrument* instr = port->instrument();
MusECore::MidiControllerList* mcl = instr->controller();
@@ -751,12 +772,20 @@ void CtrlPanel::ctrlPopup()
MusECore::MidiController* c = port->midiController(cl->num());
// dont show drum specific controller if not a drum track
if ((c->num() & 0xff) == 0xff) {
- if (!isDrum)
- continue;
- // only show controller for curDrumInstrument:
- if ((cl->num() & 0xff) != MusEGlobal::drumMap[curDrumInstrument].anote) {
- continue;
- }
+ if (isDrum)
+ {
+ // only show controller for curDrumPitch:
+ if ((curDrumPitch == -1) || ((cl->num() & 0xff) != MusEGlobal::drumMap[curDrumPitch].anote))
+ continue;
+ }
+ else if (isNewDrum)
+ {
+ // only show controller for curDrumPitch: FINDMICH does this work?
+ if ((curDrumPitch == -1) || ((cl->num() & 0xff) != curDrumPitch))
+ continue;
+ }
+ else
+ continue;
}
isList i = sList.begin();
for (; i != sList.end(); ++i) {
@@ -866,10 +895,12 @@ void CtrlPanel::ctrlPopup()
int num = ci->second->num();
if((num & 0xff) == 0xff)
{
- // dont show drum specific controller if not a drum track
- if(!isDrum)
+ if (isDrum && curDrumPitch!=-1)
+ num = (num & ~0xff) + MusEGlobal::drumMap[curDrumPitch].anote;
+ else if (isNewDrum && curDrumPitch!=-1)
+ num = (num & ~0xff) + curDrumPitch; //FINDMICH does this work?
+ else // dont show drum specific controller if not a drum track
continue;
- num = (num & ~0xff) + MusEGlobal::drumMap[curDrumInstrument].anote;
}
if(cll->find(channel, num) == cll->end())
@@ -896,8 +927,10 @@ void CtrlPanel::ctrlPopup()
{
c = ci->second;
int num = c->num();
- if (isDrum && ((num & 0xff) == 0xff))
- num = (num & ~0xff) + MusEGlobal::drumMap[curDrumInstrument].anote;
+ if (isDrum && ((num & 0xff) == 0xff) && curDrumPitch!=-1)
+ num = (num & ~0xff) + MusEGlobal::drumMap[curDrumPitch].anote;
+ else if (isNewDrum && ((num & 0xff) == 0xff) && curDrumPitch!=-1)
+ num = (num & ~0xff) + curDrumPitch; //FINDMICHJETZT does this work?
if(num != rv2)
continue;
@@ -933,8 +966,11 @@ void CtrlPanel::ctrlPopup()
if (act2) {
int rv2 = act2->data().toInt();
int num = rv2;
- if (isDrum && ((num & 0xff) == 0xff))
- num = (num & ~0xff) + MusEGlobal::drumMap[curDrumInstrument].anote;
+ if (isDrum && ((num & 0xff) == 0xff) && curDrumPitch!=-1)
+ num = (num & ~0xff) + MusEGlobal::drumMap[curDrumPitch].anote;
+ if (isNewDrum && ((num & 0xff) == 0xff) && curDrumPitch!=-1)
+ num = (num & ~0xff) + curDrumPitch; //FINDMICHJETZT does this work?
+
if(cll->find(channel, num) == cll->end())
{
MusECore::MidiCtrlValList* vl = new MusECore::MidiCtrlValList(num);
@@ -981,11 +1017,11 @@ void CtrlPanel::ctrlRightClicked(const QPoint& p, int /*id*/)
if(!editor->curCanvasPart() || !_ctrl)
return;
- int cdi = editor->curDrumInstrument();
+ int cdp = ctrlcanvas->getCurDrumPitch();
int ctlnum = _ctrl->num();
- if(_track->type() == MusECore::Track::DRUM && ((ctlnum & 0xff) == 0xff) && cdi != -1)
- //ctlnum = (ctlnum & ~0xff) | MusEGlobal::drumMap[cdi].enote;
- ctlnum = (ctlnum & ~0xff) | cdi;
+ if(_track->type() == MusECore::Track::DRUM && ((ctlnum & 0xff) == 0xff) && cdp != -1)
+ //ctlnum = (ctlnum & ~0xff) | MusEGlobal::drumMap[cdp].enote;
+ ctlnum = (ctlnum & ~0xff) | cdp;
MusECore::MidiPart* part = dynamic_cast<MusECore::MidiPart*>(editor->curCanvasPart());
MusEGlobal::song->execMidiAutomationCtlPopup(0, part, p, ctlnum);