summaryrefslogtreecommitdiff
path: root/muse2
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2012-03-15 19:10:20 +0000
committerFlorian Jung <flo@windfisch.org>2012-03-15 19:10:20 +0000
commite232be5476afe17a3abc717f757e667832d9daa6 (patch)
tree3653e77acb51a700572b89466640552cf3bbb250 /muse2
parent27b7bf6815cda7abb67026c37b3e44daee1803cb (diff)
custom columns only consider controller changes at tick0 now
Diffstat (limited to 'muse2')
-rw-r--r--muse2/ChangeLog2
-rw-r--r--muse2/muse/arranger/tlist.cpp9
-rw-r--r--muse2/muse/midiedit/scoreedit.cpp3
-rw-r--r--muse2/muse/track.cpp21
-rw-r--r--muse2/muse/track.h5
5 files changed, 31 insertions, 9 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog
index 6ff81359..2a3b57fd 100644
--- a/muse2/ChangeLog
+++ b/muse2/ChangeLog
@@ -27,6 +27,8 @@
23.02.2012:
- Compile fix in pyapi.cpp (Orcan)
- Don't optimize debug builds of simpledrums (Orcan)
+14.02.2012:
+ - added customizable columns to the arranger (flo93)
13.02.2012:
- CMake build system: Added cached variable LIB_PATH_SUFFIX, may be set to 64 so that installed library path is lib64 or whatever. (Tim)
12.02.2012:
diff --git a/muse2/muse/arranger/tlist.cpp b/muse2/muse/arranger/tlist.cpp
index b5fa2a1a..77686ff2 100644
--- a/muse2/muse/arranger/tlist.cpp
+++ b/muse2/muse/arranger/tlist.cpp
@@ -425,7 +425,7 @@ void TList::paint(const QRect& r)
MusECore::MidiTrack* mt=dynamic_cast<MusECore::MidiTrack*>(track);
MusECore::MidiPort* mp = &MusEGlobal::midiPorts[mt->outPort()];
MusECore::MidiController* mctl = mp->midiController(col_ctrl_no);
- int val=mt->getFirstControllerValue(col_ctrl_no,MusECore::CTRL_VAL_UNKNOWN);
+ int val=mt->getControllerValueAtTick(0,col_ctrl_no,MusECore::CTRL_VAL_UNKNOWN);
if (val!=MusECore::CTRL_VAL_UNKNOWN)
val-=mctl->bias();
@@ -810,7 +810,7 @@ void TList::mouseDoubleClickEvent(QMouseEvent* ev)
ctrl_edit->setMinimum(mctl->minVal()-1); // -1 because of the specialValueText
ctrl_edit->setMaximum(mctl->maxVal());
- ctrl_edit->setValue(((MusECore::MidiTrack*)editTrack)->getFirstControllerValue(ctrl_num)-mctl->bias());
+ ctrl_edit->setValue(((MusECore::MidiTrack*)editTrack)->getControllerValueAtTick(0,ctrl_num)-mctl->bias());
int w=colw;
if (w < ctrl_edit->sizeHint().width()) w=ctrl_edit->sizeHint().width();
ctrl_edit->setGeometry(colx, coly, w, colh);
@@ -1858,7 +1858,7 @@ void TList::mousePressEvent(QMouseEvent* ev)
int minval=mctl->minVal()+mctl->bias();
int maxval=mctl->maxVal()+mctl->bias();
- int val = mt->getFirstControllerValue(ctrl_num);
+ int val = mt->getControllerValueAtTick(0,ctrl_num);
int oldval=val;
if (ctrl_num!=MusECore::CTRL_PROGRAM)
@@ -1919,7 +1919,6 @@ void TList::mousePressEvent(QMouseEvent* ev)
MusECore::MidiTrack* mt=(MusECore::MidiTrack*)t;
MusECore::MidiPort* mp = &MusEGlobal::midiPorts[mt->outPort()];
- MusECore::MidiController* mctl = mp->midiController(ctrl_num);
MusECore::MidiInstrument* instr = mp->instrument();
PopupMenu* pup = new PopupMenu(true);
@@ -2335,7 +2334,7 @@ void TList::wheelEvent(QWheelEvent* ev)
int minval=mctl->minVal()+mctl->bias();
int maxval=mctl->maxVal()+mctl->bias();
- int val = mt->getFirstControllerValue(ctrl_num);
+ int val = mt->getControllerValueAtTick(0,ctrl_num);
int oldval=val;
if (ctrl_num!=MusECore::CTRL_PROGRAM)
diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp
index 5722a275..f06c2ad7 100644
--- a/muse2/muse/midiedit/scoreedit.cpp
+++ b/muse2/muse/midiedit/scoreedit.cpp
@@ -4704,12 +4704,13 @@ void ScoreCanvas::add_new_parts(const std::map< MusECore::Part*, std::set<MusECo
* o test old- and new drumtrack recording, steprecording
*
* CURRENT TODO
- * o column's widths aren't stored into configuration. fix that.
* o automatically send controller changes by the arranger columns
* if necessary (i.e., if no later controller overrides this)
* o make custom columns only look at CCs at tick0, not at "the firstCC"
* beacuse this probably causes confusion.
* o custom columns should also be able to store at cpos, not only at tick0
+ *
+ * o column's widths aren't stored into configuration. fix that.
* o storing <no_toplevels /> into a template file seems to ignore
* the arranger's "MDI-ness", sets is at subwin all the time!
*
diff --git a/muse2/muse/track.cpp b/muse2/muse/track.cpp
index e810f677..26ac101b 100644
--- a/muse2/muse/track.cpp
+++ b/muse2/muse/track.cpp
@@ -1306,6 +1306,27 @@ int MidiTrack::getFirstControllerValue(int ctrl, int def)
return val;
}
+int MidiTrack::getControllerValueAtTick(int tick, int ctrl, int def)
+{
+ for (iPart pit=parts()->begin(); pit!=parts()->end(); pit++)
+ {
+ Part* part=pit->second;
+ if (part->tick() > tick) break; // ignore this and the rest. we'd find nothing any more
+ if (part->endTick() < tick) continue; // ignore only this.
+ for (iEvent eit=part->events()->begin(); eit!=part->events()->end(); eit++)
+ {
+ if (eit->first+part->tick() > tick) break; // we won't find anything in this part from now on.
+ if (eit->first+part->tick() < tick) continue; // ignore only this
+
+ // else if (eit->first+part->tick() == tick) and
+ if (eit->second.type()==Controller && eit->second.dataA()==ctrl)
+ return eit->second.dataB();
+ }
+ }
+
+ return def;
+}
+
// returns true if the autoupdate changed something
bool MidiTrack::auto_update_drummap()
diff --git a/muse2/muse/track.h b/muse2/muse/track.h
index b8133fae..b92f2146 100644
--- a/muse2/muse/track.h
+++ b/muse2/muse/track.h
@@ -110,7 +110,6 @@ class Track {
Track(TrackType);
Track(const Track&, int flags);
virtual ~Track();
- //virtual Track& operator=(const Track& t); DELETETHIS
virtual void assign(const Track&, int flags);
static const char* _cname[];
@@ -183,7 +182,7 @@ class Track {
bool mute() const { return _mute; }
bool off() const { return _off; }
bool recordFlag() const { return _recordFlag; }
- //
+
// Internal use...
static void clearSoloRefCounts();
void updateSoloState();
@@ -220,7 +219,6 @@ class Track {
//---------------------------------------------------------
class MidiTrack : public Track {
-
int _outPort;
int _outChannel;
bool _recEcho; // For midi (and audio). Whether to echo incoming record events to output device.
@@ -306,6 +304,7 @@ class MidiTrack : public Track {
static bool visible() { return _isVisible; }
int getFirstControllerValue(int ctrl, int def=-1);
+ int getControllerValueAtTick(int tick, int ctrl, int def=-1);
void setClef(clefTypes i) { clefType = i; }
clefTypes getClef() { return clefType; }