summaryrefslogtreecommitdiff
path: root/muse2/muse/arranger/pcanvas.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'muse2/muse/arranger/pcanvas.cpp')
-rw-r--r--muse2/muse/arranger/pcanvas.cpp60
1 files changed, 36 insertions, 24 deletions
diff --git a/muse2/muse/arranger/pcanvas.cpp b/muse2/muse/arranger/pcanvas.cpp
index 9ad7bf3c..a37e237e 100644
--- a/muse2/muse/arranger/pcanvas.cpp
+++ b/muse2/muse/arranger/pcanvas.cpp
@@ -1721,42 +1721,54 @@ void PartCanvas::drawMidiPart(QPainter& p, const QRect&, EventList* events, Midi
int highest_pitch=0;
map<int,int> y_mapper;
- for (iEvent i = events->begin(); i != ito; ++i)
+ if (config.canvasShowPartType & 4) //y-stretch?
{
- if (i->second.type()==Note)
+ for (iEvent i = events->begin(); i != ito; ++i)
{
- int pitch=i->second.pitch();
-
- if (!isdrum)
+ if (i->second.type()==Note)
{
- if (pitch > highest_pitch) highest_pitch=pitch;
- if (pitch < lowest_pitch) lowest_pitch=pitch;
+ int pitch=i->second.pitch();
+
+ if (!isdrum)
+ {
+ if (pitch > highest_pitch) highest_pitch=pitch;
+ if (pitch < lowest_pitch) lowest_pitch=pitch;
+ }
+ else
+ {
+ y_mapper.insert(pair<int,int>(pitch, 0));
+ }
}
- else
+ }
+
+ if (isdrum)
+ {
+ int cnt=0;
+ for (map<int,int>::iterator it=y_mapper.begin(); it!=y_mapper.end(); it++)
{
- y_mapper.insert(pair<int,int>(pitch, 0));
+ it->second=cnt;
+ cnt++;
}
+ lowest_pitch=0;
+ highest_pitch=cnt-1;
}
- }
-
- if (isdrum)
- {
- int cnt=0;
- for (map<int,int>::iterator it=y_mapper.begin(); it!=y_mapper.end(); it++)
+
+ if (lowest_pitch==highest_pitch)
{
- it->second=cnt;
- cnt++;
+ lowest_pitch--;
+ highest_pitch++;
}
- lowest_pitch=0;
- highest_pitch=cnt-1;
}
-
- if (lowest_pitch==highest_pitch)
+ else
{
- lowest_pitch--;
- highest_pitch++;
- }
+ lowest_pitch=0;
+ highest_pitch=127;
+ if (isdrum)
+ for (int cnt=0;cnt<127;cnt++)
+ y_mapper[cnt]=cnt;
+ }
+
for (iEvent i = events->begin(); i != ito; ++i) {
int t = i->first + pTick;
int te = t + i->second.lenTick();