summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNil Geisweiller <a-lin@sourceforge.net>2006-12-10 20:58:12 +0000
committerNil Geisweiller <a-lin@sourceforge.net>2006-12-10 20:58:12 +0000
commit048fcaa1ada790549c8a1c0e2d1160d385785e71 (patch)
tree09d7356592707d4e23165699db25ee0b82a90948
parent9af73b3a26a39bce5a95ee0945b7df68df2e2ac4 (diff)
see ChangeLog
-rw-r--r--muse/ChangeLog6
-rw-r--r--muse/muse/midiedit/ecanvas.cpp24
-rw-r--r--muse/muse/midiedit/prcanvas.cpp48
-rw-r--r--muse/muse/route.cpp4
-rw-r--r--muse/synti/deicsonze/deicsonze.cpp2
5 files changed, 51 insertions, 33 deletions
diff --git a/muse/ChangeLog b/muse/ChangeLog
index 709a80a6..4892c302 100644
--- a/muse/ChangeLog
+++ b/muse/ChangeLog
@@ -1,3 +1,9 @@
+10.12 (ng)
+ - items in pianoroll play the right pitch (event.pitch + transpose)
+ - items in pianoroll are displayed correctly according to Y zoom
+ - selection in the pianoroll are dragged correctly
+ - fix RouteNode::write(Xml& xml, const char* label) xml.put --> xml.tagE
+ - fix eventCanvas::genCanvasPopup(), uncheck unselected action
08.12 (ws)
- first version of midi instrument editor (*.idf files)
(ng) deicsonze
diff --git a/muse/muse/midiedit/ecanvas.cpp b/muse/muse/midiedit/ecanvas.cpp
index 343f3f53..ae99db11 100644
--- a/muse/muse/midiedit/ecanvas.cpp
+++ b/muse/muse/midiedit/ecanvas.cpp
@@ -348,8 +348,9 @@ void EventCanvas::mousePressCanvasA(QMouseEvent* me)
curItem = searchItem(start);
if (curItem && editor->playEvents()) {
- MidiEvent e(0, 0, ME_NOTEON, curItem->event.pitch(), curItem->event.velo());
- track()->playMidiEvent(&e);
+ int pitch = curItem->event.pitch() + track()->transposition();
+ MidiEvent e(0, 0, ME_NOTEON, pitch, curItem->event.velo());
+ track()->playMidiEvent(&e);
}
if (curItem && (button == Qt::MidButton)) {
@@ -453,7 +454,8 @@ void EventCanvas::mousePressCanvasA(QMouseEvent* me)
if (curItem) {
items.add(curItem);
if (editor->playEvents()) {
- MidiEvent e(0, 0, ME_NOTEON, curItem->event.pitch(), curItem->event.velo());
+ int pitch = curItem->event.pitch() + track()->transposition();
+ MidiEvent e(0, 0, ME_NOTEON, pitch, curItem->event.velo());
track()->playMidiEvent(&e);
}
}
@@ -586,7 +588,8 @@ void EventCanvas::mouseMoveCanvasA(QPoint pos)
void EventCanvas::mouseReleaseCanvasA(QMouseEvent* me)
{
if (curItem && editor->playEvents()) {
- MidiEvent e(0, 0, ME_NOTEON, curItem->event.pitch(), 0);
+ int pitch = curItem->event.pitch() + track()->transposition();
+ MidiEvent e(0, 0, ME_NOTEON, pitch, 0);
track()->playMidiEvent(&e);
}
// ignore event if (another) button is already active:
@@ -715,8 +718,7 @@ QMenu* EventCanvas::genCanvasPopup()
QAction* a = getAction(toolList[i], this);
a->setData(data);
a->setCheckable(true);
- if (data == int(_tool))
- a->setChecked(true);
+ a->setChecked(data == int(_tool));
canvasPopup->addAction(a);
}
return canvasPopup;
@@ -806,7 +808,7 @@ void EventCanvas::deleteItem(const QPoint& p)
void EventCanvas::moveItems(const QPoint& pos, int dir)
{
- int dy = pos.y() - start.y();
+ int dpitch = y2pitch(pos.y()) - y2pitch(start.y());
Pos sp(pix2pos(start.x()));
Pos cp(pix2pos(pos.x()));
@@ -832,15 +834,15 @@ void EventCanvas::moveItems(const QPoint& pos, int dir)
else
p = item->pos + dx;
p.snap(raster());
- int ny = pitch2y(y2pitch(pitch2y(item->event.pitch()) + dy));
if (p < *curPart)
p = *curPart;
- if (item->moving != p || (item->my - wpos.y()) != ny) {
+ if (item->moving != p || dpitch !=0) {
item->moving = p;
if (dir != 1)
- item->my = ny + wpos.y();
+ item->my = pitch2y(item->event.pitch() + dpitch)
+ + (int)(wpos.y() / _ymag);
itemMoved(item);
}
}
@@ -1204,7 +1206,7 @@ void EventCanvas::mouseMove(QPoint pos)
if (curPitch != keyDown)
noteOff(keyDown);
keyDown = curPitch;
- int velocity = pos.x()*127/40;
+ int velocity = std::min(pos.x()*127/40, 127);
noteOn(keyDown, velocity, shift);
}
}
diff --git a/muse/muse/midiedit/prcanvas.cpp b/muse/muse/midiedit/prcanvas.cpp
index d80d77ed..17f79bab 100644
--- a/muse/muse/midiedit/prcanvas.cpp
+++ b/muse/muse/midiedit/prcanvas.cpp
@@ -56,7 +56,7 @@ PianoCanvas::PianoCanvas(MidiEditor* pr)
void PianoCanvas::addItem(Part* part, const Event& event)
{
CItem* item = new CItem(event, part);
- int y = pitch2y(event.pitch()) + keyHeight/4 + wpos.y();
+ int y = pitch2y(event.pitch()) + keyHeight/4 + (int)(wpos.y()/_ymag);
item->pos = event.pos() + *part;
unsigned time = item->pos.time(timeType());
item->bbox = QRect(time, y, event.lenTick(), keyHeight/2);
@@ -203,13 +203,16 @@ void PianoCanvas::moveItem(CItem* item, DragType dtype)
{
Part* part = item->part;
Event event = item->event;
- int npitch = y2pitch(item->my -wpos.y() + item->bbox.height()/2);
- if (event.pitch() != npitch && editor->playEvents()) {
+ int npitch = y2pitch((int)((item->my - (int)(wpos.y()/_ymag)
+ + item->bbox.height())*_ymag));
+ if ((curItem==item) //remove this if want to have all selection playing
+ && event.pitch() != npitch && editor->playEvents()) {
// release note:
- MidiEvent ev1(0, 0, 0x90, event.pitch() + track()->transposition(), 0);
+ MidiEvent ev1(0, 0, 0x90, playedPitch, 0);
track()->playMidiEvent(&ev1);
- MidiEvent ev2(0, 0, 0x90, npitch + track()->transposition(), event.velo());
- track()->playMidiEvent(&ev2);
+ //remove below because the note is never cut off
+ //MidiEvent ev2(0, 0, 0x90, npitch + track()->transposition(), event.velo());
+ //track()->playMidiEvent(&ev2);
}
Event newEvent = event.clone();
@@ -236,6 +239,7 @@ CItem* PianoCanvas::newItem(const QPoint& p, int)
return 0;
int pitch = y2pitch(p.y());
+
Event e(Note);
e.setPitch(pitch);
e.setVelo(curVelo);
@@ -244,7 +248,7 @@ CItem* PianoCanvas::newItem(const QPoint& p, int)
CItem* i = new CItem(e, curPart);
int l = timeType() == AL::TICKS ? e.lenTick() : e.lenFrame();
int x = pos.time(timeType());
- int y = pitch2y(pitch) + keyHeight/4 + wpos.y();
+ int y = pitch2y(pitch) + keyHeight/4 + (int)(wpos.y() / _ymag);
i->bbox = QRect(x, y, l, keyHeight/2);
return i;
@@ -593,11 +597,13 @@ void PianoCanvas::itemPressed(const CItem* item)
return;
Event event = item->event;
playedPitch = event.pitch() + track()->transposition();
- int velo = event.velo();
+ //int velo = event.velo();
// play note:
- MidiEvent e(0, 0, 0x90, playedPitch, velo);
- track()->playMidiEvent(&e);
+ //I comment the following code because a note
+ //is already played in EventCanvas::mousePressCanvasA(QMouseEvent* me)
+ /*MidiEvent e(0, 0, 0x90, playedPitch, velo);
+ track()->playMidiEvent(&e);*/
}
//---------------------------------------------------------
@@ -621,16 +627,20 @@ void PianoCanvas::itemReleased()
void PianoCanvas::itemMoved(const CItem* item)
{
- int npitch = y2pitch(item->my - wpos.y());
- if ((playedPitch != -1) && (playedPitch != npitch)) {
+ int npitch = y2pitch((int)((item->my - (int)(wpos.y()/_ymag)
+ + item->bbox.height())*_ymag));
+ npitch += track()->transposition();
+ if ((curItem==item) //remove this if want to have all selection playing
+ && (playedPitch != -1) && (playedPitch != npitch)
+ && editor->playEvents()) {
Event event = item->event;
- // release note:
- MidiEvent ev1(0, 0, 0x90, playedPitch, 0);
- track()->playMidiEvent(&ev1);
- // play note:
- MidiEvent e2(0, 0, 0x90, npitch + track()->transposition(), event.velo());
- track()->playMidiEvent(&e2);
- playedPitch = npitch + track()->transposition();
+ // release note:
+ MidiEvent ev1(0, 0, 0x90, playedPitch, 0);
+ track()->playMidiEvent(&ev1);
+ // play note:
+ MidiEvent e2(0, 0, 0x90, npitch, event.velo());
+ track()->playMidiEvent(&e2);
+ playedPitch = npitch;
}
}
diff --git a/muse/muse/route.cpp b/muse/muse/route.cpp
index 7808a088..7d4d364c 100644
--- a/muse/muse/route.cpp
+++ b/muse/muse/route.cpp
@@ -345,10 +345,10 @@ const char* RouteNode::tname() const
void RouteNode::write(Xml& xml, const char* label) const
{
if (channel != -1)
- xml.put(QString("<%1 type=\"%2\" channel=\"%3\" name=\"%4\"/>")
+ xml.tagE(QString("%1 type=\"%2\" channel=\"%3\" name=\"%4\"")
.arg(label).arg(tname()).arg(channel + 1).arg(name()));
else
- xml.put(QString("<%1 type=\"%2\" name=\"%3\"/>")
+ xml.tagE(QString("%1 type=\"%2\" name=\"%3\"")
.arg(label).arg(tname()).arg(name()));
}
diff --git a/muse/synti/deicsonze/deicsonze.cpp b/muse/synti/deicsonze/deicsonze.cpp
index 908dc1f5..0aa23fcd 100644
--- a/muse/synti/deicsonze/deicsonze.cpp
+++ b/muse/synti/deicsonze/deicsonze.cpp
@@ -834,7 +834,7 @@ int DeicsOnze::getChorusReturn() const {
// getReverbReturn
//----------------------------------------------------------------
int DeicsOnze::getReverbReturn() const {
- return(amp2level(_global.chorusReturn/2.0));
+ return(amp2level(_global.reverbReturn/2.0));
}
//----------------------------------------------------------------