84
85
int diff = event.tick()-part->lenTick();
85
86
if (diff > 0) {// too short part? extend it
86
//printf("addItem - this code should not be run!\n"); DELETETHIS
87
//MusECore::Part* newPart = part->clone();
88
//newPart->setLenTick(newPart->lenTick()+diff);
89
//MusEGlobal::audio->msgChangePart(part, newPart,false);
91
87
part->setLenTick(part->lenTick()+diff);
248
244
int mey = mer.y();
249
245
int mew = mer.width();
250
246
int meh = mer.height();
251
//int mfx = mx; DELETETHIS
252
//if(mfx == mex) mfx += 1;
254
//if(mfy == mey) mfy += 1;
256
//if(mfw == mew) mfw -= 1;
257
//if(mfx == mex) mfw -= 1;
259
//if(mfh == meh) mfh -= 1;
260
//if(mfy == mey) mfh -= 1;
261
247
color.setAlpha(MusEGlobal::config.globalAlphaBlend);
262
//QLinearGradient gradient(mex + 1, mey + 1, mex + 1, mey + meh - 2); // Inside the border DELETETHIS
263
//gradient.setColorAt(0, color);
264
//gradient.setColorAt(1, color.darker());
265
//QBrush brush(gradient);
266
248
QBrush brush(color);
267
249
p.fillRect(mr, brush);
268
//p.fillRect(mfx, mfy, mfw, mfh, brush); DELETETHIS
270
251
if(mex >= mx && mex <= mx + mw)
271
252
p.drawLine(mex, my, mex, my + mh - 1); // The left edge
453
434
if (event.pitch() != npitch && _playEvents) {
454
int port = track()->outPort();
455
int channel = track()->outChannel();
457
MusECore::MidiPlayEvent ev1(0, port, channel, 0x90, event.pitch() + track()->transposition, 0);
458
MusEGlobal::audio->msgPlayMidiEvent(&ev1);
459
MusECore::MidiPlayEvent ev2(0, port, channel, 0x90, npitch + track()->transposition, event.velo());
460
MusEGlobal::audio->msgPlayMidiEvent(&ev2);
436
if (moving.size() == 1) {
437
startPlayEvent(npitch, event.velo());
463
441
MusECore::Part* part = nevent->part();
714
692
void PianoCanvas::pianoPressed(int pitch, int velocity, bool shift)
716
int port = track()->outPort();
717
int channel = track()->outChannel();
718
pitch += track()->transposition;
723
MusECore::MidiPlayEvent e(0, port, channel, 0x90, pitch, velocity);
724
MusEGlobal::audio->msgPlayMidiEvent(&e);
697
startPlayEvent(pitch, velocity);
727
700
if (_steprec && curPart) // && pos[0] >= start_tick && pos[0] < end_tick [removed by flo93: this is handled in steprec->record]
733
706
//---------------------------------------------------------
735
void PianoCanvas::pianoReleased(int pitch, bool)
708
void PianoCanvas::pianoReleased(int /*pitch*/, bool)
737
int port = track()->outPort();
738
int channel = track()->outChannel();
739
pitch += track()->transposition;
744
MusECore::MidiPlayEvent e(0, port, channel, 0x90, pitch, 0);
745
MusEGlobal::audio->msgPlayMidiEvent(&e);
749
715
//---------------------------------------------------------
757
723
int w = rect.width();
758
724
int h = rect.height();
760
//DELETETHIS whoa, clean up the whole function. remove every commented out code line
762
// Changed to draw in device coordinate space instead of virtual, transformed space. Tim. p4.0.30
766
//int mw = mapx(x + w) - mx;
767
//int mw = mapx(x + w) - mx - 1;
768
//int mh = mapy(y + h) - my;
769
//int mh = mapy(y + h) - my - 1;
772
// FIXME Can't get horizontal lines quite right yet. Draw in virtual space for now...
773
///p.setWorldMatrixEnabled(false);
775
727
//---------------------------------------------------
776
728
// horizontal lines
777
729
//---------------------------------------------------
779
731
int yy = ((y-1) / KH) * KH + KH;
781
//int yy = ((my-1) / KH) * KH + KH;
782
//int yoff = -rmapy(yorg) - ypos;
783
732
int key = 75 - (yy / KH);
785
//printf("PianoCanvas::drawCanvas x:%d y:%d w:%d h:%d mx:%d my:%d mw:%d mh:%d yy:%d key:%d\n", x, y, w, h, mx, my, mw, mh, yy, key);
787
735
for (; yy < y + h; yy += KH) {
788
//for (; yy + yoff < my + mh; yy += KH) {
789
//for (; yy < my + mh; yy += KH) {
790
736
switch (key % 7) {
793
739
p.setPen(Qt::black);
794
740
p.drawLine(x, yy, x + w, yy);
795
//p.drawLine(mx, yy + yoff, mx + mw, yy + yoff);
796
//p.drawLine(mx, yy, mx + mw, yy);
799
743
p.fillRect(x, yy-3, w, 6, QBrush(QColor(230,230,230)));
800
//p.fillRect(mx, yy-3 + yoff, mw, 6, QBrush(QColor(230,230,230)));
801
//p.fillRect(mx, yy-3, mw, 6, QBrush(QColor(230,230,230)));
807
///p.setWorldMatrixEnabled(true);
809
//p.setWorldMatrixEnabled(false);
811
749
//---------------------------------------------------
812
750
// vertical lines
1034
967
int npitch = y2pitch(pos.y());
1035
968
if ((playedPitch != -1) && (playedPitch != npitch)) {
1036
int port = track()->outPort();
1037
int channel = track()->outChannel();
1038
969
NEvent* nevent = (NEvent*) item;
1039
970
MusECore::Event event = nevent->event();
1041
972
// release note:
1042
MusECore::MidiPlayEvent ev1(0, port, channel, 0x90, playedPitch, 0);
1043
MusEGlobal::audio->msgPlayMidiEvent(&ev1);
1045
MusECore::MidiPlayEvent e2(0, port, channel, 0x90, npitch + track()->transposition, event.velo());
1046
MusEGlobal::audio->msgPlayMidiEvent(&e2);
1047
playedPitch = npitch + track()->transposition;
975
if (moving.size() == 1) { // items moving
977
startPlayEvent(npitch, event.velo());
1164
1095
EventCanvas::resizeEvent(ev);
1167
//---------------------------------------------------------
1169
//---------------------------------------------------------
1171
void PianoCanvas::startPlayEvent(const MusEGui::CItem* item)
1173
int port = track()->outPort();
1174
int channel = track()->outChannel();
1175
NEvent* nevent = (NEvent*) item;
1176
MusECore::Event event = nevent->event();
1177
playedPitch = event.pitch() + track()->transposition;
1178
int velo = event.velo();
1181
MusECore::MidiPlayEvent e(0, port, channel, 0x90, playedPitch, velo);
1182
MusEGlobal::audio->msgPlayMidiEvent(&e);
1185
//---------------------------------------------------------
1187
//---------------------------------------------------------
1189
void PianoCanvas::stopPlayEvent()
1191
int port = track()->outPort();
1192
int channel = track()->outChannel();
1195
MusECore::MidiPlayEvent ev(0, port, channel, 0x90, playedPitch, 0);
1196
MusEGlobal::audio->msgPlayMidiEvent(&ev);
1200
1100
} // namespace MusEGui