diff options
Diffstat (limited to 'muse2')
-rw-r--r-- | muse2/muse/ctrl/ctrlpanel.cpp | 19 | ||||
-rw-r--r-- | muse2/muse/liste/editevent.cpp | 8 | ||||
-rw-r--r-- | muse2/muse/midi.cpp | 29 | ||||
-rw-r--r-- | muse2/muse/midiedit/scoreedit.cpp | 2 | ||||
-rw-r--r-- | muse2/muse/part.cpp | 8 | ||||
-rw-r--r-- | muse2/muse/song.cpp | 22 | ||||
-rw-r--r-- | muse2/muse/songfile.cpp | 2 | ||||
-rw-r--r-- | muse2/muse/track.cpp | 10 | ||||
-rw-r--r-- | muse2/muse/track.h | 1 | ||||
-rw-r--r-- | muse2/muse/widgets/mtrackinfo.cpp | 18 |
10 files changed, 78 insertions, 41 deletions
diff --git a/muse2/muse/ctrl/ctrlpanel.cpp b/muse2/muse/ctrl/ctrlpanel.cpp index 88787c47..5e07e5f3 100644 --- a/muse2/muse/ctrl/ctrlpanel.cpp +++ b/muse2/muse/ctrl/ctrlpanel.cpp @@ -171,7 +171,7 @@ void CtrlPanel::heartBeat() int outport; int chan; int cdi = editor->curDrumInstrument(); - if(_track->type() == MusECore::Track::DRUM && ((_ctrl->num() & 0xff) == 0xff) && cdi != -1) //FINDMICHJETZT was ist das? und ähnliche dinger + if(_track->type() == MusECore::Track::DRUM && ((_ctrl->num() & 0xff) == 0xff) && cdi != -1) { outport = MusEGlobal::drumMap[cdi].port; chan = MusEGlobal::drumMap[cdi].channel; @@ -539,6 +539,21 @@ void CtrlPanel::setHeight(int h) } #if 0 +/* WARNING: INVALID CODE! *\ + * the code which has been disabled by the above #if 0 is partly * + * OBSOLETE! it lacks support for new-style drum tracks, especially * + * the drum-controller-handling for these! * + * * + * when you ever enable that code again, first check the changes * + * flo93 did somewhere between revision 1188 and 1188+something * + * (let's say, 1195; it's NOT the revision in which this comment * + * has been introduced) in experimental to the currently enabled * + * code below. then apply similar changes to the currently disabled * +\* code here! */ +#error "INVALID CODE. please check the comment in ctrlpanel.cpp which starts with 'WARNING: INVALID CODE'" +just to be sure: dear compiler, please refuse to compile. +dear user: read the comment above! + struct CI { QString s; bool used; @@ -562,7 +577,7 @@ void CtrlPanel::ctrlPopup() 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? + bool isDrum = track->type() == MusECore::Track::DRUM; QMenu* pop = new QMenu; //pop->clear(); diff --git a/muse2/muse/liste/editevent.cpp b/muse2/muse/liste/editevent.cpp index ce53069d..32a328a8 100644 --- a/muse2/muse/liste/editevent.cpp +++ b/muse2/muse/liste/editevent.cpp @@ -614,12 +614,12 @@ EditCtrlDialog::EditCtrlDialog(int tick, const MusECore::Event& event, } ///pop = new QMenu(this); - //pop->setCheckable(false);//not necessary in Qt4 + //pop->setCheckable(false); //not necessary in Qt4 MusECore::MidiTrack* track = part->track(); int portn = track->outPort(); MusECore::MidiPort* port = &MusEGlobal::midiPorts[portn]; - bool isDrum = track->type() == MusECore::Track::DRUM; //FINDMICHJETZT was soll das? + bool isDrum = track->isDrumTrack(); MusECore::MidiCtrlValListList* cll = port->controller(); ctrlList->clear(); @@ -835,7 +835,7 @@ void EditCtrlDialog::updatePatch() int port = track->outPort(); int channel = track->outChannel(); MusECore::MidiInstrument* instr = MusEGlobal::midiPorts[port].instrument(); - patchName->setText(instr->getPatchName(channel, val, MusEGlobal::song->mtype(), track->type() == MusECore::Track::DRUM)); //FINDMICHJETZT was soll das? + patchName->setText(instr->getPatchName(channel, val, MusEGlobal::song->mtype(), track->isDrumTrack())); int hb = ((val >> 16) & 0xff) + 1; if (hb == 0x100) @@ -874,7 +874,7 @@ void EditCtrlDialog::instrPopup() ///instr->populatePatchPopup(pop, channel, MusEGlobal::song->mtype(), track->type() == MusECore::Track::DRUM); //QMenu* pup = new QMenu(this); MusEGui::PopupMenu* pup = new MusEGui::PopupMenu(this); - populatePatchPopup(instr, pup, channel, MusEGlobal::song->mtype(), track->type() == MusECore::Track::DRUM); //FINDMICHJETZT was soll das? + populatePatchPopup(instr, pup, channel, MusEGlobal::song->mtype(), track->isDrumTrack()); ///if(pop->actions().count() == 0) /// return; diff --git a/muse2/muse/midi.cpp b/muse2/muse/midi.cpp index 28269b20..d5ed119d 100644 --- a/muse2/muse/midi.cpp +++ b/muse2/muse/midi.cpp @@ -372,7 +372,7 @@ void buildMidiEventList(EventList* del, const MPEventList* el, MidiTrack* track, int ctl = ev.dataA(); e.setA(ctl); - if(track->type() == Track::DRUM) //FINDMICHJETZT drum controller? + if(track->type() == Track::DRUM) { // Is it a drum controller event, according to the track port's instrument? MidiController *mc = MusEGlobal::midiPorts[track->outPort()].drumController(ctl); @@ -808,7 +808,7 @@ void Audio::collectEvents(MusECore::MidiTrack* track, unsigned int cts, unsigned case Controller: { - if (track->type() == Track::DRUM) //FINDMICHJETZT was ist das? drumcontroller -_- + if (track->type() == Track::DRUM) { int ctl = ev.dataA(); // Is it a drum controller event, according to the track port's instrument? @@ -1026,10 +1026,9 @@ void Audio::processMidi() event.setB(velo); } } - else - if(event.type() == MusECore::ME_CONTROLLER) + else if(event.type() == MusECore::ME_CONTROLLER) { - if(track->type() == Track::DRUM) //FINDMICHJETZT was ist das? + if(track->type() == Track::DRUM) { ctl = event.dataA(); // Regardless of what port the event came from, is it a drum controller event @@ -1049,6 +1048,24 @@ void Audio::processMidi() event.setChannel(channel); } } + else if (track->type() == Track::NEW_DRUM) //FINDMICHJETZT TEST + { + ctl = event.dataA(); + if (tport->drumController(ctl)) // is it a drum controller? + { + int pitch = ctl & 0x7f; // pitch is now the incoming pitch + pitch = track->map_drum_in(pitch); // pitch is now the mapped (recorded) pitch + event.setA(ctl & ~0xff | pitch); // map the drum ctrl's value accordingly + + if (MusEGlobal::config.newDrumRecordCondition & MusECore::DONT_REC_HIDDEN && + track->drummap_hidden()[pitch] ) + continue; // skip that event, proceed with the next + + if (MusEGlobal::config.newDrumRecordCondition & MusECore::DONT_REC_MUTED && + track->drummap()[pitch].mute ) + continue; // skip that event, proceed with the next + } + } } // MusE uses a fixed clocks per quarternote of 24. @@ -1092,7 +1109,7 @@ void Audio::processMidi() // to the track port so buildMidiEventList will accept it. Even though // the port may have no device "<none>". // - if (track->type() == Track::DRUM) //FINDMICHJETZT was ist das? + if (track->type() == Track::DRUM) //FINDMICHJETZT no changes. TEST { // Is it a drum controller event? if(mc) diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index 6957e9c1..9fd0b3ed 100644 --- a/muse2/muse/midiedit/scoreedit.cpp +++ b/muse2/muse/midiedit/scoreedit.cpp @@ -4595,6 +4595,8 @@ void ScoreCanvas::add_new_parts(const std::map< MusECore::Part*, std::set<MusECo * * CURRENT TODO * o drum controllers + * update ctrlcanvas/panel + * test! * o my record flag handling * o option for disabling old-style / new-style drum tracks? * diff --git a/muse2/muse/part.cpp b/muse2/muse/part.cpp index 3601ff57..6407dadc 100644 --- a/muse2/muse/part.cpp +++ b/muse2/muse/part.cpp @@ -403,7 +403,7 @@ void addPortCtrlEvents(Event& event, Part* part, bool doClones) MidiPort* mp = &MusEGlobal::midiPorts[port]; // Is it a drum controller event, according to the track port's instrument? - if(mt->type() == Track::DRUM) //FINDMICHJETZT was ist das? + if(mt->type() == Track::DRUM) { MidiController* mc = mp->drumController(cntrl); if(mc) @@ -471,7 +471,7 @@ void addPortCtrlEvents(Part* part, bool doClones) MidiPort* mp = &MusEGlobal::midiPorts[port]; // Is it a drum controller event, according to the track port's instrument? - if(mt->type() == Track::DRUM) //FINDMICHJETZT was ist das? + if(mt->type() == Track::DRUM) { MidiController* mc = mp->drumController(cntrl); if(mc) @@ -530,7 +530,7 @@ void removePortCtrlEvents(Event& event, Part* part, bool doClones) MidiPort* mp = &MusEGlobal::midiPorts[port]; // Is it a drum controller event, according to the track port's instrument? - if(mt->type() == Track::DRUM) //FINDMICHJETZT was ist das? + if(mt->type() == Track::DRUM) { MidiController* mc = mp->drumController(cntrl); if(mc) @@ -599,7 +599,7 @@ void removePortCtrlEvents(Part* part, bool doClones) MidiPort* mp = &MusEGlobal::midiPorts[port]; // Is it a drum controller event, according to the track port's instrument? - if(mt->type() == Track::DRUM) //FINDMICHJETZT was ist das? + if(mt->type() == Track::DRUM) { MidiController* mc = mp->drumController(cntrl); if(mc) diff --git a/muse2/muse/song.cpp b/muse2/muse/song.cpp index 98ad007a..b48f134b 100644 --- a/muse2/muse/song.cpp +++ b/muse2/muse/song.cpp @@ -446,7 +446,7 @@ bool Song::addEvent(Event& event, Part* part) MidiPort* mp = &MusEGlobal::midiPorts[track->outPort()]; // Is it a drum controller event, according to the track port's instrument? - if(track->type() == Track::DRUM) //FINDMICHJETZT was ist das? + if(track->type() == Track::DRUM) { MidiController* mc = mp->drumController(cntrl); if(mc) @@ -519,7 +519,7 @@ void Song::changeEvent(Event& oldEvent, Event& newEvent, Part* part) int cntrl = oldEvent.dataA(); MidiPort* mp = &MusEGlobal::midiPorts[track->outPort()]; // Is it a drum controller event, according to the track port's instrument? - if(track->type() == Track::DRUM) //FINDMICHJETZT was ist das? + if(track->type() == Track::DRUM) { MidiController* mc = mp->drumController(cntrl); if(mc) @@ -546,7 +546,7 @@ void Song::changeEvent(Event& oldEvent, Event& newEvent, Part* part) int val = newEvent.dataB(); MidiPort* mp = &MusEGlobal::midiPorts[track->outPort()]; // Is it a drum controller event, according to the track port's instrument? - if(track->type() == Track::DRUM) //FINDMICHJETZT was ist das? + if(track->type() == Track::DRUM) { MidiController* mc = mp->drumController(cntrl); if(mc) @@ -580,7 +580,7 @@ void Song::deleteEvent(Event& event, Part* part) MidiPort* mp = &MusEGlobal::midiPorts[track->outPort()]; // Is it a drum controller event, according to the track port's instrument? - if(track->type() == Track::DRUM) //FINDMICHJETZT was ist das? + if(track->type() == Track::DRUM) { MidiController* mc = mp->drumController(cntrl); if(mc) @@ -621,7 +621,7 @@ void Song::remapPortDrumCtrlEvents(int mapidx, int newnote, int newchan, int new for(ciMidiTrack it = _midis.begin(); it != _midis.end(); ++it) { MidiTrack* mt = *it; - if(mt->type() != Track::DRUM) //FINDMICHJETZT was ist das? drumcontroller? + if(mt->type() != Track::DRUM) continue; MidiPort* trackmp = &MusEGlobal::midiPorts[mt->outPort()]; @@ -630,7 +630,7 @@ void Song::remapPortDrumCtrlEvents(int mapidx, int newnote, int newchan, int new { MidiPart* part = (MidiPart*)(ip->second); const EventList* el = part->cevents(); - unsigned len = part->lenTick(); + // unsigned len = part->lenTick(); // Commented out by flo, see below for(ciEvent ie = el->begin(); ie != el->end(); ++ie) { const Event& ev = ie->second; @@ -693,7 +693,7 @@ void Song::changeAllPortDrumCtrlEvents(bool add, bool drumonly) for(ciMidiTrack it = _midis.begin(); it != _midis.end(); ++it) { MidiTrack* mt = *it; - if(mt->type() != Track::DRUM) //FINDMICHJETZT was ist das? drumcontroller + if(mt->type() != Track::DRUM) continue; trackmp = &MusEGlobal::midiPorts[mt->outPort()]; @@ -703,13 +703,15 @@ void Song::changeAllPortDrumCtrlEvents(bool add, bool drumonly) { MidiPart* part = (MidiPart*)(ip->second); const EventList* el = part->cevents(); - unsigned len = part->lenTick(); + // unsigned len = part->lenTick(); // Commented out by flo, see below for(ciEvent ie = el->begin(); ie != el->end(); ++ie) { const Event& ev = ie->second; // Added by T356. Do not handle events which are past the end of the part. - if(ev.tick() >= len) - break; + // Commented out by flo: yes, DO handle them! these are "hidden events" + // which may be revealed later again! + // if(ev.tick() >= len) + // break; if(ev.type() != Controller) continue; diff --git a/muse2/muse/songfile.cpp b/muse2/muse/songfile.cpp index 3096312e..b5c3382d 100644 --- a/muse2/muse/songfile.cpp +++ b/muse2/muse/songfile.cpp @@ -725,7 +725,7 @@ void Part::read(Xml& xml, int, bool toTrack) // int newPartOffset newPartOffset=this->tick(); int ctl = e.dataA(); - if(mt->type() == Track::DRUM) //FINDMICHJETZT commented out: was ist das? + if(mt->type() == Track::DRUM) { // Is it a drum controller event, according to the track port's instrument? MidiController* mc = mp->drumController(ctl); diff --git a/muse2/muse/track.cpp b/muse2/muse/track.cpp index 31504309..4140732d 100644 --- a/muse2/muse/track.cpp +++ b/muse2/muse/track.cpp @@ -78,7 +78,7 @@ void addPortCtrlEvents(MidiTrack* t) MidiPort* mp = &MusEGlobal::midiPorts[t->outPort()]; // Is it a drum controller event, according to the track port's instrument? - if(t->type() == Track::DRUM) //FINDMICHJETZT was soll das? drumcontroller -_- + if(t->type() == Track::DRUM) { MidiController* mc = mp->drumController(cntrl); if(mc) @@ -126,7 +126,7 @@ void removePortCtrlEvents(MidiTrack* t) MidiPort* mp = &MusEGlobal::midiPorts[t->outPort()]; // Is it a drum controller event, according to the track port's instrument? - if(t->type() == Track::DRUM) //FINDMICHJETZT was soll das? drumcontroller... + if(t->type() == Track::DRUM) { MidiController* mc = mp->drumController(cntrl); if(mc) @@ -504,7 +504,7 @@ void MidiTrack::init_drummap(bool write_ordering) void MidiTrack::update_drum_in_map() { for (int i=0;i<127;i++) - drum_in_map[_drummap[i].enote]=i; + drum_in_map[(int)_drummap[i].enote]=i; } //--------------------------------------------------------- @@ -667,7 +667,7 @@ void MidiTrack::addPortCtrlEvents() MidiPort* mp = &MusEGlobal::midiPorts[_outPort]; // Is it a drum controller event, according to the track port's instrument? - if(type() == DRUM) //FINDMICHJETZT commented out. was soll das? + if(type() == DRUM) { MidiController* mc = mp->drumController(cntrl); if(mc) @@ -708,7 +708,7 @@ void MidiTrack::removePortCtrlEvents() MidiPort* mp = &MusEGlobal::midiPorts[_outPort]; // Is it a drum controller event, according to the track port's instrument? - if(type() == DRUM) //FINDMICHJETZT commented out: was soll das? + if(type() == DRUM) { MidiController* mc = mp->drumController(cntrl); if(mc) diff --git a/muse2/muse/track.h b/muse2/muse/track.h index 1826f081..bbda67e4 100644 --- a/muse2/muse/track.h +++ b/muse2/muse/track.h @@ -202,6 +202,7 @@ class Track { int channels() const { return _channels; } virtual void setChannels(int n); bool isMidiTrack() const { return type() == MIDI || type() == DRUM || type() == NEW_DRUM; } + bool isDrumTrack() const { return type() == DRUM || type() == NEW_DRUM; } virtual bool canRecord() const { return false; } virtual AutomationType automationType() const = 0; virtual void setAutomationType(AutomationType t) = 0; diff --git a/muse2/muse/widgets/mtrackinfo.cpp b/muse2/muse/widgets/mtrackinfo.cpp index 33462d0c..d0c0e070 100644 --- a/muse2/muse/widgets/mtrackinfo.cpp +++ b/muse2/muse/widgets/mtrackinfo.cpp @@ -345,7 +345,7 @@ void MidiTrackInfo::heartBeat() else { MusECore::MidiInstrument* instr = mp->instrument(); - QString name = instr->getPatchName(outChannel, nprogram, MusEGlobal::song->mtype(), track->type() == MusECore::Track::DRUM); //FINDMICHJETZT was soll das? + QString name = instr->getPatchName(outChannel, nprogram, MusEGlobal::song->mtype(), track->isDrumTrack()); if(name.isEmpty()) { const QString n("???"); @@ -391,7 +391,7 @@ void MidiTrackInfo::heartBeat() //else //{ MusECore::MidiInstrument* instr = mp->instrument(); - QString name = instr->getPatchName(outChannel, program, MusEGlobal::song->mtype(), track->type() == MusECore::Track::DRUM); //FINDMICHJETZT was soll das? + QString name = instr->getPatchName(outChannel, program, MusEGlobal::song->mtype(), track->isDrumTrack()); if(iPatch->text() != name) iPatch->setText(name); @@ -762,7 +762,7 @@ void MidiTrackInfo::iProgHBankChanged() MusEGlobal::audio->msgPlayMidiEvent(&ev); MusECore::MidiInstrument* instr = mp->instrument(); - iPatch->setText(instr->getPatchName(channel, program, MusEGlobal::song->mtype(), track->type() == MusECore::Track::DRUM)); //FINDMICHJETZT was soll das? + iPatch->setText(instr->getPatchName(channel, program, MusEGlobal::song->mtype(), track->isDrumTrack())); // updateTrackInfo(); } @@ -840,7 +840,7 @@ void MidiTrackInfo::iProgLBankChanged() MusEGlobal::audio->msgPlayMidiEvent(&ev); MusECore::MidiInstrument* instr = mp->instrument(); - iPatch->setText(instr->getPatchName(channel, program, MusEGlobal::song->mtype(), track->type() == MusECore::Track::DRUM)); //FINDMICHJETZT was soll das? + iPatch->setText(instr->getPatchName(channel, program, MusEGlobal::song->mtype(), track->isDrumTrack())); // updateTrackInfo(); } @@ -918,7 +918,7 @@ void MidiTrackInfo::iProgramChanged() MusEGlobal::audio->msgPlayMidiEvent(&ev); MusECore::MidiInstrument* instr = mp->instrument(); - iPatch->setText(instr->getPatchName(channel, program, MusEGlobal::song->mtype(), track->type() == MusECore::Track::DRUM)); //FINDMICHJETZT was soll das? + iPatch->setText(instr->getPatchName(channel, program, MusEGlobal::song->mtype(), track->isDrumTrack())); } // updateTrackInfo(); @@ -1086,8 +1086,8 @@ void MidiTrackInfo::instrPopup() //QMenu* pup = new QMenu; PopupMenu* pup = new PopupMenu(true); - //instr->populatePatchPopup(pop, channel, MusEGlobal::song->mtype(), track->type() == MusECore::Track::DRUM); - populatePatchPopup(instr, pup, channel, MusEGlobal::song->mtype(), track->type() == MusECore::Track::DRUM); //FINDMICHJETZT was soll das? + //instr->populatePatchPopup(pop, channel, MusEGlobal::song->mtype(), track->isDrumTrack()); + populatePatchPopup(instr, pup, channel, MusEGlobal::song->mtype(), track->isDrumTrack()); //if(pop->actions().count() == 0) // return; @@ -1411,7 +1411,7 @@ void MidiTrackInfo::updateTrackInfo(int flags) else { MusECore::MidiInstrument* instr = mp->instrument(); - iPatch->setText(instr->getPatchName(outChannel, nprogram, MusEGlobal::song->mtype(), track->type() == MusECore::Track::DRUM)); //FINDMICHJETZT was soll das? + iPatch->setText(instr->getPatchName(outChannel, nprogram, MusEGlobal::song->mtype(), track->isDrumTrack())); } } else @@ -1427,7 +1427,7 @@ void MidiTrackInfo::updateTrackInfo(int flags) //else //{ MusECore::MidiInstrument* instr = mp->instrument(); - iPatch->setText(instr->getPatchName(outChannel, program, MusEGlobal::song->mtype(), track->type() == MusECore::Track::DRUM)); //FINDMICHJETZT was soll das? + iPatch->setText(instr->getPatchName(outChannel, program, MusEGlobal::song->mtype(), track->isDrumTrack())); int hb = ((program >> 16) & 0xff) + 1; if (hb == 0x100) |