summaryrefslogtreecommitdiff
path: root/muse2
diff options
context:
space:
mode:
authorRobert Jonsson <spamatica@gmail.com>2011-03-16 22:18:00 +0000
committerRobert Jonsson <spamatica@gmail.com>2011-03-16 22:18:00 +0000
commitead1d513257aeed4199075c1ea5266c560992227 (patch)
tree025b480b1fb61c9cc44213e53264704d9d3a58d9 /muse2
parent062b07f0cb5a27bf5508af692b0b533a66a1bbd6 (diff)
write to the right track and stuff
Diffstat (limited to 'muse2')
-rw-r--r--muse2/ChangeLog1
-rw-r--r--muse2/muse/arranger/pcanvas.cpp82
-rw-r--r--muse2/muse/synth.cpp7
3 files changed, 44 insertions, 46 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog
index effaf218..cd662936 100644
--- a/muse2/ChangeLog
+++ b/muse2/ChangeLog
@@ -1,5 +1,6 @@
16.03.2011:
- Added: Midi events drawing while recording (rj)
+ - Fixed, hopefully, MESS synths sometimes being silent (rj)
12.03.2011:
- Cursor mode in drum editor should be usable now (rj)
Changes:
diff --git a/muse2/muse/arranger/pcanvas.cpp b/muse2/muse/arranger/pcanvas.cpp
index 49808faf..5747726f 100644
--- a/muse2/muse/arranger/pcanvas.cpp
+++ b/muse2/muse/arranger/pcanvas.cpp
@@ -1512,8 +1512,8 @@ void PartCanvas::drawItem(QPainter& p, const CItem* item, const QRect& rect)
QColor c(Qt::white);
c.setAlpha(config.globalAlphaBlend);
QLinearGradient gradient(r.topLeft(), r.bottomLeft());
- gradient.setColorAt(0, c.lighter());
- gradient.setColorAt(1, c);
+ gradient.setColorAt(0, c);
+ gradient.setColorAt(1, c.darker());
QBrush cc(gradient);
p.setBrush(cc);
@@ -1527,8 +1527,8 @@ void PartCanvas::drawItem(QPainter& p, const CItem* item, const QRect& rect)
QColor c(Qt::gray);
c.setAlpha(config.globalAlphaBlend);
QLinearGradient gradient(r.topLeft(), r.bottomLeft());
- gradient.setColorAt(0, c.lighter());
- gradient.setColorAt(1, c);
+ gradient.setColorAt(0, c);
+ gradient.setColorAt(1, c.darker());
QBrush cc(gradient);
p.setBrush(cc);
@@ -1553,8 +1553,8 @@ void PartCanvas::drawItem(QPainter& p, const CItem* item, const QRect& rect)
QColor c(Qt::black);
c.setAlpha(config.globalAlphaBlend);
QLinearGradient gradient(r.topLeft(), r.bottomLeft());
- gradient.setColorAt(0, c.lighter());
- gradient.setColorAt(1, c);
+ gradient.setColorAt(0, c);
+ gradient.setColorAt(1, c.darker());
QBrush cc(gradient);
p.setBrush(cc);
p.drawRect(r);
@@ -1571,8 +1571,8 @@ void PartCanvas::drawItem(QPainter& p, const CItem* item, const QRect& rect)
QColor c(config.partColors[i]);
c.setAlpha(config.globalAlphaBlend);
QLinearGradient gradient(r.topLeft(), r.bottomLeft());
- gradient.setColorAt(0, c.lighter());
- gradient.setColorAt(1, c);
+ gradient.setColorAt(0, c);
+ gradient.setColorAt(1, c.darker());
QBrush cc(gradient);
p.setBrush(cc);
@@ -1656,7 +1656,7 @@ void PartCanvas::drawMidiPart(QPainter& p, const QRect& bb, EventList* events, M
// Do not allow this, causes segfault.
if(from <= to)
{
- p.setPen(Qt::darkGray);
+ p.setPen(QColor(80,80,80));
//EventList* events = mp->events();
iEvent ito(events->lower_bound(to));
@@ -1678,7 +1678,7 @@ void PartCanvas::drawMidiPart(QPainter& p, const QRect& bb, EventList* events, M
}
}
else { // show Cakewalk Style
- p.setPen(Qt::darkGray);
+ p.setPen(QColor(80,80,80));
//EventList* events = mp->events();
iEvent ito(events->lower_bound(to));
//printf("PartCanvas::drawItem pTick:%d from:%d to:%d\n", pTick, from, to);
@@ -2996,9 +2996,9 @@ void PartCanvas::drawTopItem(QPainter& p, const QRect& rect)
p.setPen(pen);
QColor c(config.partColors[0]);
c.setAlpha(config.globalAlphaBlend);
- QLinearGradient gradient(QPoint(0,0), QPoint(0,track->height()));
- gradient.setColorAt(0, c.lighter());
- gradient.setColorAt(1, c);
+ QLinearGradient gradient(QPoint(startx,yPos), QPoint(startx,yPos+track->height()));
+ gradient.setColorAt(0, c);
+ gradient.setColorAt(1, c.darker());
QBrush cc(gradient);
p.setBrush(cc);
@@ -3009,44 +3009,44 @@ void PartCanvas::drawTopItem(QPainter& p, const QRect& rect)
}
p.restore();
+ // draw midi events on
yPos=0;
if (song->record() && audio->isPlaying()) {
for (iTrack it = tl->begin(); it != tl->end(); ++it) {
Track* track = *it;
- if (track->isMidiTrack()) {
+ if (track->isMidiTrack() && track->recordFlag()) {
MidiTrack *mt = (MidiTrack*)track;
QRect partRect(startPos,yPos, song->cpos()-startPos, track->height()); // probably the wrong rect
EventList myEventList;
MPEventList *el = mt->mpevents();
- if (el->size() == 0)
- continue;
-
- //printf("num events %d\n", mt->mpevents()->size());
- for (iMPEvent i = el->begin(); i != el->end(); ++i) {
- MidiPlayEvent pe = *i;
-
- if (pe.isNote() && !pe.isNoteOff()) {
- Event e(Note);
- e.setPitch(pe.dataA());
- e.setTick(pe.time()-startPos);
- e.setLenTick(song->cpos()-pe.time());
- e.setC(1); // we abuse this value to determine that this note hasn't been concluded
- myEventList.add(e);
- }
- else if (pe.isNoteOff()) {
- for (iEvent i = myEventList.begin(); i != myEventList.end(); ++i) {
- Event &e = i->second;
- if (e.pitch() == pe.dataA() && e.dataC() == 1) {
- e.setLenTick(pe.time() - e.tick()- startPos);
- e.setC(0); // reset the variable we borrowed for state handling
- //printf("editing event tick=%d startPos=%d\n",e.tick(), startPos);
- continue;
+ if (el->size()) {
+
+ //printf("num events %d\n", mt->mpevents()->size());
+ for (iMPEvent i = el->begin(); i != el->end(); ++i) {
+ MidiPlayEvent pe = *i;
+
+ if (pe.isNote() && !pe.isNoteOff()) {
+ Event e(Note);
+ e.setPitch(pe.dataA());
+ e.setTick(pe.time()-startPos);
+ e.setLenTick(song->cpos()-pe.time());
+ e.setC(1); // we abuse this value to determine that this note hasn't been concluded
+ myEventList.add(e);
+ }
+ else if (pe.isNoteOff()) {
+ for (iEvent i = myEventList.begin(); i != myEventList.end(); ++i) {
+ Event &e = i->second;
+ if (e.pitch() == pe.dataA() && e.dataC() == 1) {
+ e.setLenTick(pe.time() - e.tick()- startPos);
+ e.setC(0); // reset the variable we borrowed for state handling
+ //printf("editing event tick=%d startPos=%d\n",e.tick(), startPos);
+ continue;
+ }
}
}
- }
+ }
}
-
drawMidiPart(p, rect, &myEventList, mt, partRect,startPos,0,song->cpos()-startPos);
}
yPos+=track->height();
@@ -3072,8 +3072,8 @@ void PartCanvas::drawAudioTrack(QPainter& p, const QRect& r, AudioTrack* /* t */
QColor c(Qt::gray);
c.setAlpha(config.globalAlphaBlend);
QLinearGradient gradient(r.topLeft(), r.bottomLeft());
- gradient.setColorAt(0, c.lighter());
- gradient.setColorAt(1, c);
+ gradient.setColorAt(0, c);
+ gradient.setColorAt(1, c.darker());
QBrush cc(gradient);
p.setBrush(cc);
p.drawRect(r);
diff --git a/muse2/muse/synth.cpp b/muse2/muse/synth.cpp
index 349707c9..13e3baa3 100644
--- a/muse2/muse/synth.cpp
+++ b/muse2/muse/synth.cpp
@@ -941,12 +941,9 @@ iMPEvent MessSynthIF::getData(MidiPort* mp, MPEventList* el, iMPEvent i, unsigne
if (evTime == 0) {
// printf("MessSynthIF::getData - time is 0!\n");
// continue;
- evTime=frameOffset; // will cause frame to be zero, problem?
+ evTime=abs(frameOffset); // will cause frame to be zero, problem?
}
- int frame = evTime - frameOffset;
-
-//TODO if (frame > 0) // robert: ugly fix, don't really know what is going on here
-// // makes PPC work much better.
+ int frame = evTime - abs(frameOffset);
if (frame >= endPos) {
printf("frame > endPos!! frame = %d >= endPos %d, i->time() %d, frameOffset %d curPos=%d\n", frame, endPos, i->time(), frameOffset,curPos);