summaryrefslogtreecommitdiff
path: root/muse2/muse
diff options
context:
space:
mode:
Diffstat (limited to 'muse2/muse')
-rw-r--r--muse2/muse/cobject.cpp2
-rw-r--r--muse2/muse/driver/rtctimer.cpp2
-rw-r--r--muse2/muse/gconfig.cpp2
-rw-r--r--muse2/muse/icons.cpp6
-rw-r--r--muse2/muse/icons.h2
-rw-r--r--muse2/muse/main.cpp4
-rw-r--r--muse2/muse/midiedit/dcanvas.cpp65
-rw-r--r--muse2/muse/midiedit/dcanvas.h2
-rw-r--r--muse2/muse/midiedit/drumedit.cpp206
-rw-r--r--muse2/muse/midiedit/drumedit.h20
-rw-r--r--muse2/muse/midiedit/ecanvas.cpp16
-rw-r--r--muse2/muse/midiedit/ecanvas.h6
-rw-r--r--muse2/muse/midiedit/pianoroll.cpp280
-rw-r--r--muse2/muse/midiedit/pianoroll.h14
-rw-r--r--muse2/muse/midiedit/prcanvas.cpp28
-rw-r--r--muse2/muse/midiedit/prcanvas.h2
-rw-r--r--muse2/muse/midiedit/scoreedit.cpp1
-rw-r--r--muse2/muse/midiseq.cpp22
-rw-r--r--muse2/muse/midiseq.h1
-rw-r--r--muse2/muse/transport.cpp17
-rw-r--r--muse2/muse/widgets/musewidgetsplug.cpp2
-rw-r--r--muse2/muse/widgets/noteinfo.cpp96
-rw-r--r--muse2/muse/widgets/noteinfo.h21
-rw-r--r--muse2/muse/widgets/pitchedit.cpp3
-rw-r--r--muse2/muse/widgets/spinbox.cpp11
-rw-r--r--muse2/muse/widgets/spinbox.h4
-rw-r--r--muse2/muse/widgets/tb1.cpp6
27 files changed, 591 insertions, 250 deletions
diff --git a/muse2/muse/cobject.cpp b/muse2/muse/cobject.cpp
index cb1600a4..1407a7a0 100644
--- a/muse2/muse/cobject.cpp
+++ b/muse2/muse/cobject.cpp
@@ -199,6 +199,8 @@ void TopWin::readStatus(MusECore::Xml& xml)
{
if (mdisubwin)
{
+ if(mdisubwin->isMaximized())
+ mdisubwin->showNormal();
mdisubwin->move(x, y);
mdisubwin->resize(width, height);
}
diff --git a/muse2/muse/driver/rtctimer.cpp b/muse2/muse/driver/rtctimer.cpp
index c50fadf6..e232b995 100644
--- a/muse2/muse/driver/rtctimer.cpp
+++ b/muse2/muse/driver/rtctimer.cpp
@@ -119,7 +119,7 @@ unsigned int RtcTimer::getTimerFreq()
{
unsigned int freq;
int rv = ioctl(timerFd, RTC_IRQP_READ, &freq);
- if (rv < 1)
+ if (rv < 0)
return 0;
return freq;
}
diff --git a/muse2/muse/gconfig.cpp b/muse2/muse/gconfig.cpp
index cb9184a3..6ab4df4b 100644
--- a/muse2/muse/gconfig.cpp
+++ b/muse2/muse/gconfig.cpp
@@ -193,7 +193,7 @@ GlobalConfigValues config = {
true, // addHiddenTracks
true, // unhideTracks
MusEGlobal::PREFER_NEW, // drumTrackPreference
- false // smartFocus
+ true // smartFocus
};
} // namespace MusEGlobal
diff --git a/muse2/muse/icons.cpp b/muse2/muse/icons.cpp
index 5e2cfce5..569f9620 100644
--- a/muse2/muse/icons.cpp
+++ b/muse2/muse/icons.cpp
@@ -208,6 +208,8 @@
#include "xpm/cliplistS.xpm"
#include "xpm/mixeraudioS.xpm"
#include "xpm/initS.xpm"
+#include "xpm/delta_on.xpm"
+#include "xpm/delta_off.xpm"
#include "xpm/addtrack_addmiditrack.xpm"
#include "xpm/addtrack_audiogroup.xpm"
@@ -288,6 +290,8 @@ QPixmap* inputpluginSIcon;
QPixmap* cliplistSIcon;
QPixmap* mixerAudioSIcon;
QPixmap* initSIcon;
+QPixmap* deltaOnIcon;
+QPixmap* deltaOffIcon;
QPixmap* exitIcon;
QPixmap* exit1Icon;
@@ -666,6 +670,8 @@ void initIcons()
cliplistSIcon = new MPIXMAP(cliplistS_xpm, NULL);
mixerAudioSIcon = new MPIXMAP(mixerAudioS_xpm, NULL);
initSIcon = new MPIXMAP(initS_xpm, NULL);
+ deltaOnIcon = new MPIXMAP(delta_on_xpm, NULL);
+ deltaOffIcon = new MPIXMAP(delta_off_xpm, NULL);
addtrack_addmiditrackIcon = new MPIXMAP(addtrack_addmiditrack_xpm, NULL);
addtrack_audiogroupIcon = new MPIXMAP(addtrack_audiogroup_xpm, NULL);
diff --git a/muse2/muse/icons.h b/muse2/muse/icons.h
index 115a79fc..3ee7cfea 100644
--- a/muse2/muse/icons.h
+++ b/muse2/muse/icons.h
@@ -191,6 +191,8 @@ extern QPixmap* inputpluginSIcon;
extern QPixmap* cliplistSIcon;
extern QPixmap* mixerAudioSIcon;
extern QPixmap* initSIcon;
+extern QPixmap* deltaOnIcon;
+extern QPixmap* deltaOffIcon;
extern QPixmap* addtrack_addmiditrackIcon;
extern QPixmap* addtrack_audiogroupIcon;
diff --git a/muse2/muse/main.cpp b/muse2/muse/main.cpp
index f7aee078..de2e2512 100644
--- a/muse2/muse/main.cpp
+++ b/muse2/muse/main.cpp
@@ -53,6 +53,7 @@
#include "sync.h"
#include "functions.h"
#include "appearance.h"
+#include "midiseq.h"
#ifdef HAVE_LASH
#include <lash/lash.h>
@@ -590,6 +591,9 @@ int main(int argc, char* argv[])
// Load the default song.
//--------------------------------------------------
MusEGlobal::muse->loadDefaultSong(argc, &argv[optind]); // p4.0.41
+
+ MusEGlobal::midiSeq->checkAndReportTimingResolution();
+
QTimer::singleShot(100, MusEGlobal::muse, SLOT(showDidYouKnowDialog()));
diff --git a/muse2/muse/midiedit/dcanvas.cpp b/muse2/muse/midiedit/dcanvas.cpp
index ab967fa9..6c3f865f 100644
--- a/muse2/muse/midiedit/dcanvas.cpp
+++ b/muse2/muse/midiedit/dcanvas.cpp
@@ -31,6 +31,8 @@
#include <QDragMoveEvent>
#include <QDropEvent>
#include <QResizeEvent>
+#include <QList>
+#include <QPair>
#include <stdio.h>
#include <values.h>
@@ -404,6 +406,9 @@ CItem* DrumCanvas::newItem(int tick, int instrument, int velocity)
// else or if we found an alternative part (which has now been set as curPart)
tick -= curPart->tick();
+ if (tick < 0)
+ //tick=0;
+ return 0;
MusECore::Event e(MusECore::Note);
e.setTick(tick);
e.setPitch(instrument_map[instrument].pitch);
@@ -439,6 +444,8 @@ void DrumCanvas::newItem(CItem* item, bool noSnap, bool replace)
DEvent* nevent = (DEvent*) item;
MusECore::Event event = nevent->event();
int x = item->x();
+ if (x<0)
+ x=0;
if (!noSnap)
x = editor->rasterVal(x);
event.setTick(x - nevent->part()->tick());
@@ -1101,8 +1108,9 @@ void DrumCanvas::resizeEvent(QResizeEvent* ev)
// modifySelected
//---------------------------------------------------------
-void DrumCanvas::modifySelected(NoteInfo::ValType type, int delta)
+void DrumCanvas::modifySelected(NoteInfo::ValType type, int val, bool delta_mode)
{
+ QList< QPair<MusECore::EventList*,MusECore::Event> > already_done;
MusEGlobal::audio->msgIdle(true);
MusEGlobal::song->startUndo();
for (iCItem i = items.begin(); i != items.end(); ++i) {
@@ -1114,30 +1122,65 @@ void DrumCanvas::modifySelected(NoteInfo::ValType type, int delta)
continue;
MusECore::MidiPart* part = (MusECore::MidiPart*)(e->part());
+
+ if (already_done.contains(QPair<MusECore::EventList*,MusECore::Event>(part->events(), event)))
+ continue;
+
MusECore::Event newEvent = event.clone();
switch (type) {
- case NoteInfo::VAL_TIME:
+ case MusEGui::NoteInfo::VAL_TIME:
{
- int newTime = event.tick() + delta;
+ int newTime = val;
+ if(delta_mode)
+ newTime += event.tick();
+ else
+ newTime -= part->tick();
if (newTime < 0)
newTime = 0;
newEvent.setTick(newTime);
}
break;
- case NoteInfo::VAL_LEN:
- printf("DrumCanvas::modifySelected - NoteInfo::VAL_LEN not implemented\n");
+ case MusEGui::NoteInfo::VAL_LEN:
+ {
+ int len = val;
+ if(delta_mode)
+ len += event.lenTick();
+ if (len < 1)
+ len = 1;
+ newEvent.setLenTick(len);
+ }
break;
- case NoteInfo::VAL_VELON:
- printf("DrumCanvas::modifySelected - NoteInfo::VAL_VELON not implemented\n");
+ case MusEGui::NoteInfo::VAL_VELON:
+ {
+ int velo = val;
+ if(delta_mode)
+ velo += event.velo();
+ if (velo > 127)
+ velo = 127;
+ else if (velo < 0)
+ velo = 0;
+ newEvent.setVelo(velo);
+ }
break;
- case NoteInfo::VAL_VELOFF:
- printf("DrumCanvas::modifySelected - NoteInfo::VAL_VELOFF not implemented\n");
+ case MusEGui::NoteInfo::VAL_VELOFF:
+ {
+ int velo = val;
+ if(delta_mode)
+ velo += event.veloOff();
+ if (velo > 127)
+ velo = 127;
+ else if (velo < 0)
+ velo = 0;
+ newEvent.setVeloOff(velo);
+ }
break;
case NoteInfo::VAL_PITCH:
if (old_style_drummap_mode)
{
- int pitch = event.pitch() - delta; // Reversing order since the drumlist is displayed in increasing order
+ int pitch = val;
+ if(delta_mode)
+ pitch += event.pitch();
if (pitch > 127)
pitch = 127;
else if (pitch < 0)
@@ -1151,6 +1194,8 @@ void DrumCanvas::modifySelected(NoteInfo::ValType type, int delta)
MusEGlobal::song->changeEvent(event, newEvent, part);
// Indicate do not do port controller values and clone parts.
MusEGlobal::song->addUndo(MusECore::UndoOp(MusECore::UndoOp::ModifyEvent, newEvent, event, part, false, false));
+
+ already_done.append(QPair<MusECore::EventList*,MusECore::Event>(part->events(), event));
}
MusEGlobal::song->endUndo(SC_EVENT_MODIFIED);
MusEGlobal::audio->msgIdle(false);
diff --git a/muse2/muse/midiedit/dcanvas.h b/muse2/muse/midiedit/dcanvas.h
index ae647709..1cd8074a 100644
--- a/muse2/muse/midiedit/dcanvas.h
+++ b/muse2/muse/midiedit/dcanvas.h
@@ -158,7 +158,7 @@ class DrumCanvas : public EventCanvas {
const char* name = 0);
virtual ~DrumCanvas();
void cmd(int);
- virtual void modifySelected(NoteInfo::ValType type, int delta);
+ virtual void modifySelected(NoteInfo::ValType type, int val, bool delta_mode = true);
virtual void keyPress(QKeyEvent* event);
MusECore::Event *getEventAtCursorPos();
void selectCursorEvent(MusECore::Event *ev);
diff --git a/muse2/muse/midiedit/drumedit.cpp b/muse2/muse/midiedit/drumedit.cpp
index e5b965f1..34a5bce5 100644
--- a/muse2/muse/midiedit/drumedit.cpp
+++ b/muse2/muse/midiedit/drumedit.cpp
@@ -149,8 +149,21 @@ DrumEdit::DrumEdit(MusECore::PartList* pl, QWidget* parent, const char* name, un
{
setFocusPolicy(Qt::NoFocus);
+ deltaMode = false;
+ tickValue = 0;
+ lenValue = 0;
+ pitchValue = 0;
+ veloOnValue = 0;
+ veloOffValue = 0;
+ firstValueSet = false;
+ tickOffset = 0;
+ lenOffset = 0;
+ pitchOffset = 0;
+ veloOnOffset = 0;
+ veloOffOffset = 0;
+ lastSelections = 0;
split1w1 = 0;
- selPart = 0;
+ //selPart = 0;
QSignalMapper *signalMapper = new QSignalMapper(this);
_group_mode = GROUP_SAME_CHANNEL;
@@ -534,7 +547,6 @@ DrumEdit::DrumEdit(MusECore::PartList* pl, QWidget* parent, const char* name, un
header->hideSection(COL_HIDE);
dlist = new DList(header, split1w1, yscale, (DrumCanvas*)canvas, old_style_drummap_mode());
- // p3.3.44
setCurDrumInstrument(dlist->getSelectedInstrument());
connect(dlist, SIGNAL(keyPressed(int, int)), canvas, SLOT(keyPressed(int, int)));
@@ -567,8 +579,8 @@ DrumEdit::DrumEdit(MusECore::PartList* pl, QWidget* parent, const char* name, un
connect(tools2, SIGNAL(toolChanged(int)), canvas, SLOT(setTool(int))); // in Canvas
connect(tools2, SIGNAL(toolChanged(int)), canvas, SLOT(setTool2(int))); // in DrumCanvas
- connect(canvas, SIGNAL(selectionChanged(int, MusECore::Event&, MusECore::Part*)), this,
- SLOT(setSelection(int, MusECore::Event&, MusECore::Part*)));
+ connect(canvas, SIGNAL(selectionChanged(int, MusECore::Event&, MusECore::Part*, bool)), this,
+ SLOT(setSelection(int, MusECore::Event&, MusECore::Part*, bool)));
connect(canvas, SIGNAL(followEvent(int)), SLOT(follow(int)));
connect(hscroll, SIGNAL(scaleChanged(int)), SLOT(updateHScrollRange()));
@@ -582,6 +594,7 @@ DrumEdit::DrumEdit(MusECore::PartList* pl, QWidget* parent, const char* name, un
connect(toolbar, SIGNAL(rasterChanged(int)), SLOT(setRaster(int)));
connect(toolbar, SIGNAL(soloChanged(bool)), SLOT(soloChanged(bool)));
connect(info, SIGNAL(valueChanged(MusEGui::NoteInfo::ValType, int)), SLOT(noteinfoChanged(MusEGui::NoteInfo::ValType, int)));
+ connect(info, SIGNAL(deltaModeChanged(bool)), SLOT(deltaModeChanged(bool)));
if(MusEGlobal::config.smartFocus)
{
connect(info, SIGNAL(returnPressed()), SLOT(focusCanvas()));
@@ -698,19 +711,79 @@ DrumEdit::~DrumEdit()
// update Info Line
//---------------------------------------------------------
-void DrumEdit::setSelection(int tick, MusECore::Event& e, MusECore::Part* p)
+void DrumEdit::setSelection(int tick, MusECore::Event& e, MusECore::Part*, bool update)
{
- selEvent = e;
- selPart = (MusECore::MidiPart*)p;
- selTick = tick;
- info->setEnabled(!e.empty());
- if (!e.empty()) {
- info->setValues(tick,
- selEvent.lenTick(),
- selEvent.pitch(),
- selEvent.velo(),
- selEvent.veloOff());
+ int selections = canvas->selectionSize();
+
+ // Diagnostics:
+ //printf("DrumEdit::setSelection selections:%d event empty:%d firstValueSet:%d\n", selections, e.empty(), firstValueSet);
+ //if(!e.empty())
+ // e.dump();
+
+ if(update)
+ {
+ // Selections have changed. Reset these.
+ tickOffset = 0;
+ lenOffset = 0;
+ pitchOffset = 0;
+ veloOnOffset = 0;
+ veloOffOffset = 0;
+
+ // Force 'suggested' modes:
+ if (selections == 1)
+ {
+ deltaMode = false;
+ info->setDeltaMode(deltaMode);
+ }
+ else
+ if (selections > 1)
+ {
+ // A feeble attempt to hold on to the user's setting. Should try to bring back
+ // selEvent (removed), but there were problems using it (it's a reference).
+ //if(lastSelections <= 1)
+ {
+ deltaMode = true;
+ info->setDeltaMode(deltaMode);
+ }
+ }
+ }
+
+ lastSelections = selections;
+
+ if ((selections == 1) || (selections > 1 && !firstValueSet))
+ {
+ tickValue = tick;
+ lenValue = e.lenTick();
+ pitchValue = e.pitch();
+ veloOnValue = e.velo();
+ veloOffValue = e.veloOff();
+ firstValueSet = true;
+ }
+
+ if (selections > 0) {
+ info->setEnabled(true);
+ if (deltaMode)
+ info->setValues(tickOffset, lenOffset, pitchOffset, veloOnOffset, veloOffOffset);
+ else
+ info->setValues(tickValue, lenValue, pitchValue, veloOnValue, veloOffValue);
+ }
+ else {
+ info->setEnabled(false);
+ info->setValues(0, 0, 0, 0, 0);
+ firstValueSet = false;
+ tickValue = 0;
+ lenValue = 0;
+ pitchValue = 0;
+ veloOnValue = 0;
+ veloOffValue = 0;
+ tickOffset = 0;
+ lenOffset = 0;
+ pitchOffset = 0;
+ veloOnOffset = 0;
+ veloOffOffset = 0;
}
+
+ info->setReturnMode(selections >= 2);
selectionChanged();
}
@@ -725,6 +798,30 @@ void DrumEdit::focusCanvas()
}
//---------------------------------------------------------
+// deltaModeChanged
+//---------------------------------------------------------
+
+void DrumEdit::deltaModeChanged(bool delta_on)
+{
+ if(deltaMode == delta_on)
+ return;
+ deltaMode = delta_on;
+
+ int selections = canvas->selectionSize();
+
+ if(deltaMode)
+ {
+ if(selections > 0)
+ info->setValues(tickOffset, lenOffset, pitchOffset, veloOnOffset, veloOffOffset);
+ }
+ else
+ {
+ if(selections > 0)
+ info->setValues(tickValue, lenValue, pitchValue, veloOnValue, veloOffValue);
+ }
+}
+
+//---------------------------------------------------------
// soloChanged
//---------------------------------------------------------
@@ -753,30 +850,62 @@ void DrumEdit::setRaster(int val)
void DrumEdit::noteinfoChanged(MusEGui::NoteInfo::ValType type, int val)
{
- if (selEvent.empty()) {
- printf("noteinfoChanged while note is zero %d\n", type);
- return;
+ int selections = canvas->selectionSize();
+
+ if (selections == 0) {
+ printf("noteinfoChanged while nothing selected\n");
}
- MusECore::Event event = selEvent.clone();
- switch (type) {
- case MusEGui::NoteInfo::VAL_TIME:
- event.setTick(val - selPart->tick());
- break;
- case MusEGui::NoteInfo::VAL_LEN:
- event.setLenTick(val);
- break;
- case MusEGui::NoteInfo::VAL_VELON:
- event.setVelo(val);
- break;
- case MusEGui::NoteInfo::VAL_VELOFF:
- event.setVeloOff(val);
- break;
- case MusEGui::NoteInfo::VAL_PITCH:
- event.setPitch(val);
- break;
+ else if (selections > 0) {
+ if(deltaMode) {
+ // treat noteinfo values as offsets to event values
+ int delta = 0;
+ switch (type) {
+ case MusEGui::NoteInfo::VAL_TIME:
+ delta = val - tickOffset;
+ tickOffset = val;
+ break;
+ case MusEGui::NoteInfo::VAL_LEN:
+ delta = val - lenOffset;
+ lenOffset = val;
+ break;
+ case MusEGui::NoteInfo::VAL_VELON:
+ delta = val - veloOnOffset;
+ veloOnOffset = val;
+ break;
+ case MusEGui::NoteInfo::VAL_VELOFF:
+ delta = val - veloOffOffset;
+ veloOffOffset = val;
+ break;
+ case MusEGui::NoteInfo::VAL_PITCH:
+ delta = val - pitchOffset;
+ pitchOffset = val;
+ break;
+ }
+ if (delta)
+ canvas->modifySelected(type, delta);
+ }
+ else {
+ switch (type) {
+ case MusEGui::NoteInfo::VAL_TIME:
+ tickValue = val;
+ break;
+ case MusEGui::NoteInfo::VAL_LEN:
+ lenValue = val;
+ break;
+ case MusEGui::NoteInfo::VAL_VELON:
+ veloOnValue = val;
+ break;
+ case MusEGui::NoteInfo::VAL_VELOFF:
+ veloOffValue = val;
+ break;
+ case MusEGui::NoteInfo::VAL_PITCH:
+ pitchValue = val;
+ break;
+ }
+ canvas->modifySelected(type, val, false); // No delta mode.
+ }
}
- // Indicate do undo, and do not do port controller values and clone parts.
- MusEGlobal::audio->msgChangeEvent(selEvent, event, selPart, true, false, false);
+
}
//---------------------------------------------------------
@@ -928,7 +1057,6 @@ void DrumEdit::writeConfiguration(int level, MusECore::Xml& xml)
void DrumEdit::load()
{
- //QString fn = MusEGui::getOpenFileName("drummaps", map_file_pattern,
QString fn = MusEGui::getOpenFileName("drummaps", MusEGlobal::drum_map_file_pattern,
this, tr("Muse: Load Drum Map"), 0);
if (fn.isEmpty())
@@ -1111,9 +1239,7 @@ CtrlEdit* DrumEdit::addCtrl()
setCurDrumInstrument(dlist->getSelectedInstrument());
- // p3.3.44
ctrlEdit->setTool(tools2->curTool());
-
ctrlEdit->setXPos(hscroll->pos());
ctrlEdit->setXMag(hscroll->getScaleValue());
diff --git a/muse2/muse/midiedit/drumedit.h b/muse2/muse/midiedit/drumedit.h
index 907b8b84..7f2d26ce 100644
--- a/muse2/muse/midiedit/drumedit.h
+++ b/muse2/muse/midiedit/drumedit.h
@@ -80,11 +80,22 @@ class DrumEdit : public MidiEditor {
bool _ignore_hide;
bool _old_style_drummap_mode;
- MusECore::Event selEvent;
- MusECore::MidiPart* selPart;
- int selTick;
QMenu* menuEdit, *menuFunctions, *menuSelect;
+ int tickValue;
+ int lenValue;
+ int pitchValue;
+ int veloOnValue;
+ int veloOffValue;
+ bool firstValueSet;
+ int tickOffset;
+ int lenOffset;
+ int pitchOffset;
+ int veloOnOffset;
+ int veloOffOffset;
+ bool deltaMode;
+ int lastSelections;
+
MusEGui::NoteInfo* info;
QToolButton* srec;
QToolButton* midiin;
@@ -144,9 +155,10 @@ class DrumEdit : public MidiEditor {
void display_old_new_conflict_message();
void focusCanvas();
+ void deltaModeChanged(bool);
public slots:
- void setSelection(int, MusECore::Event&, MusECore::Part*);
+ void setSelection(int /*tick*/, MusECore::Event&, MusECore::Part*, bool /*update*/);
void soloChanged(bool); // called by Solo button
void execDeliveredScript(int);
void execUserScript(int);
diff --git a/muse2/muse/midiedit/ecanvas.cpp b/muse2/muse/midiedit/ecanvas.cpp
index 984ec41c..75757bf9 100644
--- a/muse2/muse/midiedit/ecanvas.cpp
+++ b/muse2/muse/midiedit/ecanvas.cpp
@@ -222,18 +222,26 @@ void EventCanvas::songChanged(int flags)
start_tick = MusEGlobal::song->roundDownBar(start_tick);
end_tick = MusEGlobal::song->roundUpBar(end_tick);
- if (n == 1 && _setCurPartIfOnlyOneEventIsSelected) {
+ if (n >= 1)
+ {
x = nevent->x();
event = nevent->event();
part = (MusECore::MidiPart*)nevent->part();
- if (curPart != part) {
+ if (_setCurPartIfOnlyOneEventIsSelected && n == 1 && curPart != part) {
curPart = part;
curPartId = curPart->sn();
curPartChanged();
}
- }
+ }
+
+ bool f1 = flags & (SC_EVENT_INSERTED | SC_EVENT_MODIFIED | SC_EVENT_REMOVED |
+ SC_PART_INSERTED | SC_PART_MODIFIED | SC_PART_REMOVED |
+ SC_TRACK_INSERTED | SC_TRACK_REMOVED | SC_TRACK_MODIFIED |
+ SC_SIG | SC_TEMPO | SC_KEY | SC_MASTER | SC_CONFIG | SC_DRUMMAP);
+ bool f2 = flags & SC_SELECTION;
+ if(f1 || f2) // Try to avoid all unnecessary emissions.
+ emit selectionChanged(x, event, part, !f1);
- emit selectionChanged(x, event, part);
if (curPart == 0)
curPart = (MusECore::MidiPart*)(editor->parts()->begin()->second);
redraw();
diff --git a/muse2/muse/midiedit/ecanvas.h b/muse2/muse/midiedit/ecanvas.h
index 349bb92b..454ae3fa 100644
--- a/muse2/muse/midiedit/ecanvas.h
+++ b/muse2/muse/midiedit/ecanvas.h
@@ -57,9 +57,9 @@ class MidiEditor;
class EventCanvas : public Canvas {
Q_OBJECT
+
virtual void leaveEvent(QEvent*e);
virtual void enterEvent(QEvent*e);
-
virtual void mouseMove(QMouseEvent* event);
protected:
@@ -86,7 +86,7 @@ class EventCanvas : public Canvas {
signals:
void pitchChanged(int); // current cursor position
void timeChanged(unsigned);
- void selectionChanged(int, MusECore::Event&, MusECore::Part*);
+ void selectionChanged(int /*tick*/ , MusECore::Event&, MusECore::Part*, bool /*update*/);
void enterCanvas();
public:
@@ -102,7 +102,7 @@ class EventCanvas : public Canvas {
void playEvents(bool flag) { _playEvents = flag; }
void selectAtTick(unsigned int tick);
void viewDropEvent(QDropEvent* event);
- virtual void modifySelected(NoteInfo::ValType, int) {}
+ virtual void modifySelected(NoteInfo::ValType, int /*val*/, bool /*delta_mode*/ = true) {}
virtual void keyPress(QKeyEvent*);
};
diff --git a/muse2/muse/midiedit/pianoroll.cpp b/muse2/muse/midiedit/pianoroll.cpp
index 71b2abf8..d8608c70 100644
--- a/muse2/muse/midiedit/pianoroll.cpp
+++ b/muse2/muse/midiedit/pianoroll.cpp
@@ -87,8 +87,19 @@ static int pianorollTools = MusEGui::PointerTool | MusEGui::PencilTool | MusEGui
PianoRoll::PianoRoll(MusECore::PartList* pl, QWidget* parent, const char* name, unsigned initPos)
: MidiEditor(TopWin::PIANO_ROLL, _rasterInit, pl, parent, name)
{
- deltaMode = false;
- selPart = 0;
+ deltaMode = false;
+ tickValue = 0;
+ lenValue = 0;
+ pitchValue = 0;
+ veloOnValue = 0;
+ veloOffValue = 0;
+ firstValueSet = false;
+ tickOffset = 0;
+ lenOffset = 0;
+ pitchOffset = 0;
+ veloOnOffset = 0;
+ veloOffOffset = 0;
+ lastSelections = 0;
_playEvents = false;
colorMode = colorModeInit;
@@ -339,36 +350,12 @@ PianoRoll::PianoRoll(MusECore::PartList* pl, QWidget* parent, const char* name,
mainGrid->setColumnStretch(1, 100);
mainGrid->addWidget(hsplitter, 0, 1, 1, 3);
- // Original. DELETETHIS 21
- /*
- mainGrid->setColumnStretch(1, 100);
- mainGrid->addWidget(splitter, 0, 0, 1, 3);
- mainGrid->addWidget(ctrl, 1, 0);
- mainGrid->addWidget(hscroll, 1, 1);
- mainGrid->addWidget(corner, 1, 2, Qt::AlignBottom|Qt::AlignRight);
- */
-
-
- // Tim.
- /*
- mainGrid->setColumnStretch(2, 100);
- mainGrid->addWidget(splitter, 0, 0, 1, 4);
- mainGrid->addWidget(trackInfoButton, 1, 0);
- mainGrid->addWidget(ctrl, 1, 1);
- mainGrid->addWidget(hscroll, 1, 2);
- mainGrid->addWidget(corner, 1, 3, Qt::AlignBottom|Qt::AlignRight);
- */
-
- //mainGrid->addRowSpacing(1, hscroll->sizeHint().height());
- //mainGrid->addItem(new QSpacerItem(0, hscroll->sizeHint().height()), 1, 0); // Orig + Tim.
-
QWidget* split1 = new QWidget(splitter);
split1->setObjectName("split1");
QGridLayout* gridS1 = new QGridLayout(split1);
gridS1->setContentsMargins(0, 0, 0, 0);
gridS1->setSpacing(0);
- //Defined and configure your program change bar here.
- //This may well be a copy of MTScale extended for our needs
+
time = new MusEGui::MTScale(&_raster, split1, xscale);
Piano* piano = new Piano(split1, yscale);
canvas = new PianoCanvas(this, split1, xscale, yscale);
@@ -385,7 +372,6 @@ PianoRoll::PianoRoll(MusECore::PartList* pl, QWidget* parent, const char* name,
gridS1->setRowStretch(2, 100);
gridS1->setColumnStretch(1, 100);
- //gridS1->setColumnStretch(2, 100); // Tim. DELETETHIS
gridS1->addWidget(time, 0, 1, 1, 2);
gridS1->addWidget(MusECore::hLine(split1), 1, 0, 1, 3);
@@ -393,17 +379,6 @@ PianoRoll::PianoRoll(MusECore::PartList* pl, QWidget* parent, const char* name,
gridS1->addWidget(canvas, 2, 1);
gridS1->addWidget(vscroll, 2, 2);
- // Tim. DELETETHIS
- /*
- gridS1->addWidget(time, 0, 2, 1, 3);
- gridS1->addWidget(MusECore::hLine(split1), 1, 1, 1, 4);
- //gridS1->addWidget(infoScroll, 2, 0);
- gridS1->addWidget(infoScroll, 0, 0, 3, 1);
- gridS1->addWidget(piano, 2, 1);
- gridS1->addWidget(canvas, 2, 2);
- gridS1->addWidget(vscroll, 2, 3);
- */
-
ctrlLane = new MusEGui::Splitter(Qt::Vertical, splitter, "ctrllane");
QWidget* split2 = new QWidget(splitter);
split2->setMaximumHeight(hscroll->sizeHint().height());
@@ -416,7 +391,6 @@ PianoRoll::PianoRoll(MusECore::PartList* pl, QWidget* parent, const char* name,
gridS2->addWidget(ctrl, 0, 0);
gridS2->addWidget(hscroll, 0, 1);
gridS2->addWidget(corner, 0, 2, Qt::AlignBottom|Qt::AlignRight);
- //splitter->setCollapsible(0, true); DELETETHIS
piano->setFixedWidth(pianoWidth);
@@ -428,8 +402,8 @@ PianoRoll::PianoRoll(MusECore::PartList* pl, QWidget* parent, const char* name,
connect(tools2, SIGNAL(toolChanged(int)), canvas, SLOT(setTool(int)));
connect(ctrl, SIGNAL(clicked()), SLOT(addCtrl()));
- //connect(trackInfoButton, SIGNAL(clicked()), SLOT(toggleTrackInfo())); Tim. DELETETHIS
connect(info, SIGNAL(valueChanged(MusEGui::NoteInfo::ValType, int)), SLOT(noteinfoChanged(MusEGui::NoteInfo::ValType, int)));
+ connect(info, SIGNAL(deltaModeChanged(bool)), SLOT(deltaModeChanged(bool)));
connect(vscroll, SIGNAL(scrollChanged(int)), piano, SLOT(setYPos(int)));
connect(vscroll, SIGNAL(scrollChanged(int)), canvas, SLOT(setYPos(int)));
@@ -447,8 +421,8 @@ PianoRoll::PianoRoll(MusECore::PartList* pl, QWidget* parent, const char* name,
connect(canvas, SIGNAL(verticalScroll(unsigned)), vscroll, SLOT(setPos(unsigned)));
connect(canvas, SIGNAL(horizontalScroll(unsigned)),hscroll, SLOT(setPos(unsigned)));
connect(canvas, SIGNAL(horizontalScrollNoLimit(unsigned)),hscroll, SLOT(setPosNoLimit(unsigned)));
- connect(canvas, SIGNAL(selectionChanged(int, MusECore::Event&, MusECore::Part*)), this,
- SLOT(setSelection(int, MusECore::Event&, MusECore::Part*)));
+ connect(canvas, SIGNAL(selectionChanged(int, MusECore::Event&, MusECore::Part*, bool)), this,
+ SLOT(setSelection(int, MusECore::Event&, MusECore::Part*, bool)));
connect(piano, SIGNAL(keyPressed(int, int, bool)), canvas, SLOT(pianoPressed(int, int, bool)));
connect(piano, SIGNAL(keyReleased(int, bool)), canvas, SLOT(pianoReleased(int, bool)));
@@ -570,7 +544,6 @@ void PianoRoll::updateTrackInfo()
selected = curCanvasPart()->track();
if (selected->isMidiTrack()) {
midiTrackInfo->setTrack(selected);
- ///midiTrackInfo->updateTrackInfo(-1);
}
}
@@ -651,41 +624,79 @@ void PianoRoll::cmd(int cmd)
// update Info Line
//---------------------------------------------------------
-void PianoRoll::setSelection(int tick, MusECore::Event& e, MusECore::Part* p)
+void PianoRoll::setSelection(int tick, MusECore::Event& e, MusECore::Part* /*part*/, bool update)
{
int selections = canvas->selectionSize();
- selEvent = e;
- selPart = (MusECore::MidiPart*)p;
- selTick = tick;
+ // Diagnostics:
+ //printf("PianoRoll::setSelection selections:%d event empty:%d firstValueSet:%d\n", selections, e.empty(), firstValueSet);
+ //if(!e.empty())
+ // e.dump();
+
+ if(update)
+ {
+ // Selections have changed. Reset these.
+ tickOffset = 0;
+ lenOffset = 0;
+ pitchOffset = 0;
+ veloOnOffset = 0;
+ veloOffOffset = 0;
+
+ // Force 'suggested' modes:
+ if (selections == 1)
+ {
+ deltaMode = false;
+ info->setDeltaMode(deltaMode);
+ }
+ else
+ if (selections > 1)
+ {
+ // A feeble attempt to hold on to the user's setting. Should try to bring back
+ // selEvent (removed), but there were problems using it (it's a reference).
+ //if(lastSelections <= 1)
+ {
+ deltaMode = true;
+ info->setDeltaMode(deltaMode);
+ }
+ }
+ }
- if (selections > 1) {
- info->setEnabled(true);
- info->setDeltaMode(true);
- if (!deltaMode) {
- deltaMode = true;
- info->setValues(0, 0, 0, 0, 0);
- tickOffset = 0;
- lenOffset = 0;
- pitchOffset = 0;
- veloOnOffset = 0;
- veloOffOffset = 0;
- }
- }
- else if (selections == 1) {
- deltaMode = false;
+ lastSelections = selections;
+
+ if ((selections == 1) || (selections > 1 && !firstValueSet))
+ {
+ tickValue = tick;
+ lenValue = e.lenTick();
+ pitchValue = e.pitch();
+ veloOnValue = e.velo();
+ veloOffValue = e.veloOff();
+ firstValueSet = true;
+ }
+
+ if (selections > 0) {
info->setEnabled(true);
- info->setDeltaMode(false);
- info->setValues(tick,
- selEvent.lenTick(),
- selEvent.pitch(),
- selEvent.velo(),
- selEvent.veloOff());
+ if (deltaMode)
+ info->setValues(tickOffset, lenOffset, pitchOffset, veloOnOffset, veloOffOffset);
+ else
+ info->setValues(tickValue, lenValue, pitchValue, veloOnValue, veloOffValue);
}
else {
- deltaMode = false;
info->setEnabled(false);
+ info->setValues(0, 0, 0, 0, 0);
+ firstValueSet = false;
+ tickValue = 0;
+ lenValue = 0;
+ pitchValue = 0;
+ veloOnValue = 0;
+ veloOffValue = 0;
+ tickOffset = 0;
+ lenOffset = 0;
+ pitchOffset = 0;
+ veloOnOffset = 0;
+ veloOffOffset = 0;
}
+
+ info->setReturnMode(selections >= 2);
selectionChanged();
}
@@ -700,6 +711,25 @@ void PianoRoll::focusCanvas()
}
//---------------------------------------------------------
+// deltaModeChanged
+//---------------------------------------------------------
+
+void PianoRoll::deltaModeChanged(bool delta_on)
+{
+ if(deltaMode == delta_on)
+ return;
+ deltaMode = delta_on;
+
+ if(canvas->selectionSize() > 0)
+ {
+ if(deltaMode)
+ info->setValues(tickOffset, lenOffset, pitchOffset, veloOnOffset, veloOffOffset);
+ else
+ info->setValues(tickValue, lenValue, pitchValue, veloOnValue, veloOffValue);
+ }
+}
+
+//---------------------------------------------------------
// edit currently selected Event
//---------------------------------------------------------
@@ -710,57 +740,55 @@ void PianoRoll::noteinfoChanged(MusEGui::NoteInfo::ValType type, int val)
if (selections == 0) {
printf("noteinfoChanged while nothing selected\n");
}
- else if (selections == 1) {
- MusECore::Event event = selEvent.clone();
- switch(type) {
- case MusEGui::NoteInfo::VAL_TIME:
- event.setTick(val - selPart->tick());
- break;
- case MusEGui::NoteInfo::VAL_LEN:
- event.setLenTick(val);
- break;
- case MusEGui::NoteInfo::VAL_VELON:
- event.setVelo(val);
- break;
- case MusEGui::NoteInfo::VAL_VELOFF:
- event.setVeloOff(val);
- break;
- case MusEGui::NoteInfo::VAL_PITCH:
- event.setPitch(val);
- break;
+ else if (selections > 0) {
+ if(deltaMode) {
+ // treat noteinfo values as offsets to event values
+ int delta = 0;
+ switch (type) {
+ case MusEGui::NoteInfo::VAL_TIME:
+ delta = val - tickOffset;
+ tickOffset = val;
+ break;
+ case MusEGui::NoteInfo::VAL_LEN:
+ delta = val - lenOffset;
+ lenOffset = val;
+ break;
+ case MusEGui::NoteInfo::VAL_VELON:
+ delta = val - veloOnOffset;
+ veloOnOffset = val;
+ break;
+ case MusEGui::NoteInfo::VAL_VELOFF:
+ delta = val - veloOffOffset;
+ veloOffOffset = val;
+ break;
+ case MusEGui::NoteInfo::VAL_PITCH:
+ delta = val - pitchOffset;
+ pitchOffset = val;
+ break;
+ }
+ if (delta)
+ canvas->modifySelected(type, delta);
}
- // Indicate do undo, and do not do port controller values and clone parts.
- MusEGlobal::audio->msgChangeEvent(selEvent, event, selPart, true, false, false);
- }
- else {
- // multiple events are selected; treat noteinfo values
- // as offsets to event values
-
- int delta = 0;
- switch (type) {
- case MusEGui::NoteInfo::VAL_TIME:
- delta = val - tickOffset;
- tickOffset = val;
- break;
- case MusEGui::NoteInfo::VAL_LEN:
- delta = val - lenOffset;
- lenOffset = val;
- break;
- case MusEGui::NoteInfo::VAL_VELON:
- delta = val - veloOnOffset;
- veloOnOffset = val;
- break;
- case MusEGui::NoteInfo::VAL_VELOFF:
- delta = val - veloOffOffset;
- veloOffOffset = val;
- break;
- case MusEGui::NoteInfo::VAL_PITCH:
- delta = val - pitchOffset;
- pitchOffset = val;
- break;
+ else {
+ switch (type) {
+ case MusEGui::NoteInfo::VAL_TIME:
+ tickValue = val;
+ break;
+ case MusEGui::NoteInfo::VAL_LEN:
+ lenValue = val;
+ break;
+ case MusEGui::NoteInfo::VAL_VELON:
+ veloOnValue = val;
+ break;
+ case MusEGui::NoteInfo::VAL_VELOFF:
+ veloOffValue = val;
+ break;
+ case MusEGui::NoteInfo::VAL_PITCH:
+ pitchValue = val;
+ break;
+ }
+ canvas->modifySelected(type, val, false); // No delta mode.
}
- if (delta)
- canvas->modifySelected(type, delta);
}
}
@@ -1226,20 +1254,6 @@ void PianoRoll::setSpeaker(bool val)
canvas->playEvents(_playEvents);
}
-
-
-/* DELETETHIS
-//---------------------------------------------------------
-// trackInfoScroll
-//---------------------------------------------------------
-
-void PianoRoll::trackInfoScroll(int y)
- {
- if (trackInfo->visibleWidget())
- trackInfo->visibleWidget()->move(0, -y);
- }
-*/
-
//---------------------------------------------------------
// initShortcuts
//---------------------------------------------------------
diff --git a/muse2/muse/midiedit/pianoroll.h b/muse2/muse/midiedit/pianoroll.h
index 20ae093e..ad77b973 100644
--- a/muse2/muse/midiedit/pianoroll.h
+++ b/muse2/muse/midiedit/pianoroll.h
@@ -72,10 +72,6 @@ class Toolbar1;
class PianoRoll : public MidiEditor {
Q_OBJECT
- MusECore::Event selEvent;
- MusECore::MidiPart* selPart;
- int selTick;
-
QMenu *menuEdit, *menuFunctions, *menuSelect, *menuConfig, *eventColor, *menuPlugins;
MusEGui::MidiTrackInfo *midiTrackInfo;
MusECore::Track* selected;
@@ -110,12 +106,19 @@ class PianoRoll : public MidiEditor {
QAction* funcDelOverlapsAction;
+ int tickValue;
+ int lenValue;
+ int pitchValue;
+ int veloOnValue;
+ int veloOffValue;
+ bool firstValueSet;
int tickOffset;
int lenOffset;
int pitchOffset;
int veloOnOffset;
int veloOffOffset;
bool deltaMode;
+ int lastSelections;
MusEGui::NoteInfo* info;
QToolButton* srec;
@@ -148,7 +151,7 @@ class PianoRoll : public MidiEditor {
virtual void keyPressEvent(QKeyEvent*);
private slots:
- void setSelection(int, MusECore::Event&, MusECore::Part*);
+ void setSelection(int /*tick*/, MusECore::Event&, MusECore::Part*, bool /*update*/);
void noteinfoChanged(MusEGui::NoteInfo::ValType, int);
void removeCtrl(CtrlEdit* ctrl);
void soloChanged(bool flag);
@@ -167,6 +170,7 @@ class PianoRoll : public MidiEditor {
void toggleTrackInfo();
void updateTrackInfo();
void focusCanvas();
+ void deltaModeChanged(bool);
signals:
void isDeleting(MusEGui::TopWin*);
diff --git a/muse2/muse/midiedit/prcanvas.cpp b/muse2/muse/midiedit/prcanvas.cpp
index 794e04ad..0ccabbe0 100644
--- a/muse2/muse/midiedit/prcanvas.cpp
+++ b/muse2/muse/midiedit/prcanvas.cpp
@@ -492,7 +492,8 @@ MusEGui::CItem* PianoCanvas::newItem(const QPoint& p, int)
int len = p.x() - tick;
tick -= curPart->tick();
if (tick < 0)
- tick=0;
+ //tick=0;
+ return 0;
MusECore::Event e = MusECore::Event(MusECore::Note);
e.setTick(tick);
e.setPitch(pitch);
@@ -1064,7 +1065,7 @@ void PianoCanvas::curPartChanged()
// modifySelected
//---------------------------------------------------------
-void PianoCanvas::modifySelected(MusEGui::NoteInfo::ValType type, int delta)
+void PianoCanvas::modifySelected(MusEGui::NoteInfo::ValType type, int val, bool delta_mode)
{
QList< QPair<MusECore::EventList*,MusECore::Event> > already_done;
MusEGlobal::audio->msgIdle(true);
@@ -1087,7 +1088,11 @@ void PianoCanvas::modifySelected(MusEGui::NoteInfo::ValType type, int delta)
switch (type) {
case MusEGui::NoteInfo::VAL_TIME:
{
- int newTime = event.tick() + delta;
+ int newTime = val;
+ if(delta_mode)
+ newTime += event.tick();
+ else
+ newTime -= part->tick();
if (newTime < 0)
newTime = 0;
newEvent.setTick(newTime);
@@ -1095,7 +1100,9 @@ void PianoCanvas::modifySelected(MusEGui::NoteInfo::ValType type, int delta)
break;
case MusEGui::NoteInfo::VAL_LEN:
{
- int len = event.lenTick() + delta;
+ int len = val;
+ if(delta_mode)
+ len += event.lenTick();
if (len < 1)
len = 1;
newEvent.setLenTick(len);
@@ -1103,7 +1110,9 @@ void PianoCanvas::modifySelected(MusEGui::NoteInfo::ValType type, int delta)
break;
case MusEGui::NoteInfo::VAL_VELON:
{
- int velo = event.velo() + delta;
+ int velo = val;
+ if(delta_mode)
+ velo += event.velo();
if (velo > 127)
velo = 127;
else if (velo < 0)
@@ -1113,7 +1122,9 @@ void PianoCanvas::modifySelected(MusEGui::NoteInfo::ValType type, int delta)
break;
case MusEGui::NoteInfo::VAL_VELOFF:
{
- int velo = event.veloOff() + delta;
+ int velo = val;
+ if(delta_mode)
+ velo += event.veloOff();
if (velo > 127)
velo = 127;
else if (velo < 0)
@@ -1123,7 +1134,9 @@ void PianoCanvas::modifySelected(MusEGui::NoteInfo::ValType type, int delta)
break;
case MusEGui::NoteInfo::VAL_PITCH:
{
- int pitch = event.pitch() + delta;
+ int pitch = val;
+ if(delta_mode)
+ pitch += event.pitch();
if (pitch > 127)
pitch = 127;
else if (pitch < 0)
@@ -1132,6 +1145,7 @@ void PianoCanvas::modifySelected(MusEGui::NoteInfo::ValType type, int delta)
}
break;
}
+
MusEGlobal::song->changeEvent(event, newEvent, part);
// Indicate do not do port controller values and clone parts.
MusEGlobal::song->addUndo(MusECore::UndoOp(MusECore::UndoOp::ModifyEvent, newEvent, event, part, false, false));
diff --git a/muse2/muse/midiedit/prcanvas.h b/muse2/muse/midiedit/prcanvas.h
index 35e4975f..ee83c88e 100644
--- a/muse2/muse/midiedit/prcanvas.h
+++ b/muse2/muse/midiedit/prcanvas.h
@@ -126,7 +126,7 @@ class PianoCanvas : public EventCanvas {
colorMode = mode;
redraw();
}
- virtual void modifySelected(NoteInfo::ValType type, int delta);
+ virtual void modifySelected(NoteInfo::ValType type, int val, bool delta_mode = true);
};
} // namespace MusEGui
diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp
index d8529794..44629eef 100644
--- a/muse2/muse/midiedit/scoreedit.cpp
+++ b/muse2/muse/midiedit/scoreedit.cpp
@@ -4702,6 +4702,7 @@ void ScoreCanvas::add_new_parts(const std::map< MusECore::Part*, std::set<MusECo
* from clipboard failed. ignoring this one... ) [ not reproducible ]
* o test drum controllers
* o test old- and new drumtrack recording, steprecording
+ * o velo-controller doesn't work in new-style drum tracks
*
* CURRENT TODO
* o column's widths aren't stored into configuration. fix that.
diff --git a/muse2/muse/midiseq.cpp b/muse2/muse/midiseq.cpp
index 94335d99..1000cc46 100644
--- a/muse2/muse/midiseq.cpp
+++ b/muse2/muse/midiseq.cpp
@@ -486,18 +486,26 @@ void MidiSeq::start(int priority)
prio = priority;
MusEGlobal::doSetuid();
- int gotTicks = setRtcTicks();
+ setRtcTicks();
MusEGlobal::undoSetuid();
Thread::start(priority);
-
- if (gotTicks < 500) {
- QMessageBox::warning( MusEGlobal::muse, QString("Bad timing"), QString("Timing source has a frequency below 500hz!\n" \
- "This could lead to audible timing problems.\n" \
- "Please see console output for any further error messages\n "));
- }
}
//---------------------------------------------------------
+// checkAndReportTimingResolution
+//---------------------------------------------------------
+void MidiSeq::checkAndReportTimingResolution()
+{
+ int freq = timer->getTimerFreq();
+ if (freq < 500) {
+ QMessageBox::warning( MusEGlobal::muse, QString("Bad timing"), QString("Timing source frequency is %1hz, which is below the recommended minimum: 500hz!\n" \
+ "This could lead to audible timing problems for MIDI.\n" \
+ "Please see the FAQ on http://muse-sequencer.org for remedies.\n" \
+ "Also please check console output for any further error messages\n ").arg(freq));
+ }
+}
+
+//---------------------------------------------------------
// processMidiClock
//---------------------------------------------------------
diff --git a/muse2/muse/midiseq.h b/muse2/muse/midiseq.h
index bf7a3376..b5ed1099 100644
--- a/muse2/muse/midiseq.h
+++ b/muse2/muse/midiseq.h
@@ -93,6 +93,7 @@ class MidiSeq : public Thread {
void mmcInput(int, const unsigned char*, int);
void mtcInputFull(int, const unsigned char*, int);
void nonRealtimeSystemSysex(int, const unsigned char*, int);
+ void checkAndReportTimingResolution();
void msgMsg(int id);
void msgSeek();
diff --git a/muse2/muse/transport.cpp b/muse2/muse/transport.cpp
index aa0036e5..5ed83800 100644
--- a/muse2/muse/transport.cpp
+++ b/muse2/muse/transport.cpp
@@ -538,6 +538,11 @@ void Transport::setTempo(int t)
tempo->setTempo(t);
tempoVal = t;
}
+ blockSignals(true);
+ // Make sure positional controls are updated
+ unsigned v = MusEGlobal::song->cpos();
+ time2->setValue(v); // time2 is SMPTE, it only need tempo updates.
+ blockSignals(false);
}
//---------------------------------------------------------
@@ -558,7 +563,19 @@ void Transport::setHandleColor(QColor c)
void Transport::setTimesig(int z, int n)
{
+ blockSignals(true);
tempo->setTimesig(z, n);
+
+ // Make sure positional controls are updated
+ unsigned v = MusEGlobal::song->cpos();
+ time1->setValue(v); // time2 is SMPTE. It only need tempo updates.
+
+ v = MusEGlobal::song->lpos();
+ tl1->setValue(v);
+ v = MusEGlobal::song->rpos();
+ tl2->setValue(v);
+
+ blockSignals(false);
}
//---------------------------------------------------------
diff --git a/muse2/muse/widgets/musewidgetsplug.cpp b/muse2/muse/widgets/musewidgetsplug.cpp
index 398b6f5c..436970ad 100644
--- a/muse2/muse/widgets/musewidgetsplug.cpp
+++ b/muse2/muse/widgets/musewidgetsplug.cpp
@@ -222,7 +222,7 @@ MusEGlobal::GlobalConfigValues config = {
true, // addHiddenTracks
true, // unhideTracks
MusEGlobal::PREFER_NEW, // drumTrackPreference
- false // smartFocus
+ true // smartFocus
};
//---------------------------------------------------------
diff --git a/muse2/muse/widgets/noteinfo.cpp b/muse2/muse/widgets/noteinfo.cpp
index a5002540..4d29f919 100644
--- a/muse2/muse/widgets/noteinfo.cpp
+++ b/muse2/muse/widgets/noteinfo.cpp
@@ -30,13 +30,15 @@
#include "globals.h"
///#include "posedit.h"
#include "pitchedit.h"
+#include "icons.h"
+#include "pixmap_button.h"
namespace MusEGui {
//---------------------------------------------------
// NoteInfo
// ToolBar
-// Start, L�nge, Note, Velo an, Velo aus, Kanal
+// Start, Length, Note, Velo on, Velo off
//---------------------------------------------------
//NoteInfo::NoteInfo(QMainWindow* parent)
@@ -44,63 +46,60 @@ NoteInfo::NoteInfo(QWidget* parent)
: QToolBar(tr("Note Info"), parent)
{
setObjectName("Note Info");
+ _enabled = true;
+ _returnMode = false;
deltaMode = false;
+
+ deltaButton = new PixmapButton(deltaOnIcon, deltaOffIcon, 2);
+ deltaButton->setFocusPolicy(Qt::NoFocus);
+ deltaButton->setCheckable(true);
+ deltaButton->setToolTip(tr("delta/absolute mode"));
+ addWidget(deltaButton);
- //QLabel* label = new QLabel(tr("Start"), this, "Start");
QLabel* label = new QLabel(tr("Start"));
label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
label->setIndent(3);
addWidget(label);
- //selTime = new PosEdit(this, "Start");
- ///selTime = new PosEdit(0, "Start");
selTime = new Awl::PosEdit;
selTime->setFocusPolicy(Qt::StrongFocus);
selTime->setObjectName("Start");
addWidget(selTime);
- //label = new QLabel(tr("Len"), this, "Len");
label = new QLabel(tr("Len"));
label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
label->setIndent(3);
addWidget(label);
- //selLen = new QSpinBox(0, 100000, 1, this);
selLen = new SpinBox();
selLen->setFocusPolicy(Qt::StrongFocus);
selLen->setRange(0, 100000);
selLen->setSingleStep(1);
addWidget(selLen);
- //label = new QLabel(tr("Pitch"), this, "Pitch");
label = new QLabel(tr("Pitch"));
label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
label->setIndent(3);
addWidget(label);
- //selPitch = new PitchEdit(this, "selPitch");
selPitch = new PitchEdit;
selPitch->setFocusPolicy(Qt::StrongFocus);
selPitch->setDeltaMode(deltaMode);
addWidget(selPitch);
- //label = new QLabel(tr("Velo On"), this, "Velocity On");
label = new QLabel(tr("Velo On"));
label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
label->setIndent(3);
addWidget(label);
- //selVelOn = new QSpinBox(0, 127, 1, this);
selVelOn = new SpinBox();
selVelOn->setFocusPolicy(Qt::StrongFocus);
selVelOn->setRange(0, 127);
selVelOn->setSingleStep(1);
addWidget(selVelOn);
- //label = new QLabel(tr("Velo Off"), this, "Velocity Off");
label = new QLabel(tr("Velo Off"));
label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
label->setIndent(3);
addWidget(label);
- //selVelOff = new QSpinBox(0, 127, 1, this);
selVelOff = new SpinBox();
selVelOff->setFocusPolicy(Qt::StrongFocus);
selVelOff->setRange(0, 127);
@@ -124,19 +123,33 @@ NoteInfo::NoteInfo(QWidget* parent)
connect(selVelOn, SIGNAL(escapePressed()), SIGNAL(escapePressed()));
connect(selVelOff, SIGNAL(escapePressed()), SIGNAL(escapePressed()));
connect(selTime, SIGNAL(escapePressed()), SIGNAL(escapePressed()));
+
+ connect(deltaButton, SIGNAL(clicked(bool)), SLOT(deltaModeClicked(bool)));
}
//---------------------------------------------------------
-// setDeltaMode
+// setEnabled
//---------------------------------------------------------
-void NoteInfo::setDeltaMode(bool val)
+void NoteInfo::setEnabled(bool val)
+{
+ _enabled = val;
+ selLen->setEnabled(val);
+ selPitch->setEnabled(val);
+ selVelOn->setEnabled(val);
+ selVelOff->setEnabled(val);
+ selTime->setEnabled(val);
+}
+
+//---------------------------------------------------------
+// set_mode
+//---------------------------------------------------------
+
+void NoteInfo::set_mode()
{
- if(val == deltaMode)
- return;
- deltaMode = val;
- selPitch->setDeltaMode(val);
- if (val) {
+ blockSignals(true);
+ selPitch->setDeltaMode(deltaMode);
+ if (deltaMode) {
selLen->setRange(-100000, 100000);
selVelOn->setRange(-127, 127);
selVelOff->setRange(-127, 127);
@@ -146,6 +159,34 @@ void NoteInfo::setDeltaMode(bool val)
selVelOn->setRange(0, 127);
selVelOff->setRange(0, 127);
}
+ blockSignals(false);
+ }
+
+//---------------------------------------------------------
+// setReturnMode
+//---------------------------------------------------------
+
+void NoteInfo::setReturnMode(bool v)
+{
+ _returnMode = v;
+ selTime->setReturnMode(_returnMode);
+ selLen->setReturnMode(_returnMode);
+ selPitch->setReturnMode(_returnMode);
+ selVelOn->setReturnMode(_returnMode);
+ selVelOff->setReturnMode(_returnMode);
+}
+
+//---------------------------------------------------------
+// setDeltaMode
+//---------------------------------------------------------
+
+void NoteInfo::setDeltaMode(bool val)
+ {
+ if(val == deltaMode)
+ return;
+ deltaMode = val;
+ deltaButton->setChecked(deltaMode);
+ set_mode();
}
//---------------------------------------------------------
@@ -189,6 +230,19 @@ void NoteInfo::pitchChanged(int val)
}
//---------------------------------------------------------
+// setDeltaMode
+//---------------------------------------------------------
+
+void NoteInfo::deltaModeClicked(bool val)
+{
+ if(val == deltaMode)
+ return;
+ deltaMode = val;
+ set_mode();
+ emit deltaModeChanged(deltaMode);
+}
+
+//---------------------------------------------------------
// setValue
//---------------------------------------------------------
@@ -223,8 +277,8 @@ void NoteInfo::setValues(unsigned tick, int val2, int val3, int val4,
int val5)
{
blockSignals(true);
- if (selTime->pos().tick() != tick)
- selTime->setValue(tick);
+ // PosEdit will take care of optimizations. It must check whether actual values dependent on tempo or sig changed...
+ selTime->setValue(tick);
if (selLen->value() != val2)
selLen->setValue(val2);
if (selPitch->value() != val3)
diff --git a/muse2/muse/widgets/noteinfo.h b/muse2/muse/widgets/noteinfo.h
index 56079f34..143f9d9b 100644
--- a/muse2/muse/widgets/noteinfo.h
+++ b/muse2/muse/widgets/noteinfo.h
@@ -26,10 +26,8 @@
namespace Awl {
class PosEdit;
- //class PitchEdit;
};
-///class PosEdit;
namespace MusECore {
class Pos;
}
@@ -38,6 +36,8 @@ namespace MusEGui {
class PitchEdit;
class SpinBox;
+class PixmapButton;
+
//---------------------------------------------------------
// NoteInfo
@@ -46,35 +46,44 @@ class SpinBox;
class NoteInfo : public QToolBar {
Q_OBJECT
- ///PosEdit* selTime;
Awl::PosEdit* selTime;
SpinBox* selLen;
PitchEdit* selPitch;
SpinBox* selVelOn;
SpinBox* selVelOff;
+ PixmapButton* deltaButton;
+ bool _returnMode;
bool deltaMode;
-
+ bool _enabled;
+ void set_mode();
+
+
public:
enum ValType {VAL_TIME, VAL_LEN, VAL_VELON, VAL_VELOFF, VAL_PITCH };
- //NoteInfo(QMainWindow* parent);
NoteInfo(QWidget* parent = 0);
void setValues(unsigned, int, int, int, int);
void setDeltaMode(bool);
-
+ bool isEnabled() const { return _enabled; }
+ void setReturnMode(bool v);
+ bool returnMode() const { return _returnMode; }
+
private slots:
void lenChanged(int);
void velOnChanged(int);
void velOffChanged(int);
void pitchChanged(int);
void timeChanged(const MusECore::Pos&);
+ void deltaModeClicked(bool);
public slots:
void setValue(ValType, int);
+ void setEnabled(bool);
signals:
void valueChanged(MusEGui::NoteInfo::ValType, int);
void returnPressed();
void escapePressed();
+ void deltaModeChanged(bool);
};
} // namespace MusEGui
diff --git a/muse2/muse/widgets/pitchedit.cpp b/muse2/muse/widgets/pitchedit.cpp
index dd7524a2..f0499a8a 100644
--- a/muse2/muse/widgets/pitchedit.cpp
+++ b/muse2/muse/widgets/pitchedit.cpp
@@ -72,6 +72,9 @@ int PitchEdit::mapTextToValue(bool* ok)
void PitchEdit::setDeltaMode(bool val)
{
+ if(deltaMode == val)
+ return;
+
deltaMode = val;
if (deltaMode)
setRange(-127, 127);
diff --git a/muse2/muse/widgets/spinbox.cpp b/muse2/muse/widgets/spinbox.cpp
index b0b5d4ce..bb6aaacc 100644
--- a/muse2/muse/widgets/spinbox.cpp
+++ b/muse2/muse/widgets/spinbox.cpp
@@ -51,6 +51,7 @@ void SpinBoxLineEdit::mousePressEvent(QMouseEvent* e)
SpinBox::SpinBox(QWidget* parent)
: QSpinBox(parent)
{
+ _returnMode = false;
SpinBoxLineEdit* le = new SpinBoxLineEdit(this);
setLineEdit(le);
setKeyboardTracking(false);
@@ -63,6 +64,7 @@ SpinBox::SpinBox(QWidget* parent)
SpinBox::SpinBox(int minValue, int maxValue, int step, QWidget* parent)
: QSpinBox(parent)
{
+ _returnMode = false;
SpinBoxLineEdit* le = new SpinBoxLineEdit(this);
setLineEdit(le);
setRange(minValue, maxValue);
@@ -78,8 +80,13 @@ void SpinBox::keyPressEvent(QKeyEvent* ev)
{
switch (ev->key()) {
case Qt::Key_Return:
- QSpinBox::keyPressEvent(ev);
- emit returnPressed();
+ {
+ bool mod = lineEdit()->isModified();
+ QSpinBox::keyPressEvent(ev);
+ if(_returnMode && !mod) // Force valueChanged if return mode set, even if not modified.
+ emit valueChanged(value());
+ emit returnPressed();
+ }
return;
break;
case Qt::Key_Escape:
diff --git a/muse2/muse/widgets/spinbox.h b/muse2/muse/widgets/spinbox.h
index 261ba05e..7b57ec77 100644
--- a/muse2/muse/widgets/spinbox.h
+++ b/muse2/muse/widgets/spinbox.h
@@ -68,6 +68,8 @@ class SpinBoxLineEdit : public QLineEdit
class SpinBox : public QSpinBox {
Q_OBJECT
+ bool _returnMode;
+
protected:
virtual void keyPressEvent(QKeyEvent*);
virtual void wheelEvent(QWheelEvent*);
@@ -82,6 +84,8 @@ class SpinBox : public QSpinBox {
public:
SpinBox(QWidget* parent=0);
SpinBox(int minValue, int maxValue, int step = 1, QWidget* parent=0);
+ void setReturnMode(bool v) { _returnMode = v; }
+ bool returnMode() const { return _returnMode; }
};
} // namespace MusEGui
diff --git a/muse2/muse/widgets/tb1.cpp b/muse2/muse/widgets/tb1.cpp
index 60140ee2..32643bb0 100644
--- a/muse2/muse/widgets/tb1.cpp
+++ b/muse2/muse/widgets/tb1.cpp
@@ -81,12 +81,12 @@ Toolbar1::Toolbar1(QWidget* parent, int r, bool sp)
label->setIndent(3);
addWidget(label);
pos = new PosLabel(0, "pos");
- pos->setFixedHeight(22);
+ ///pos->setFixedHeight(22);
addWidget(pos);
if (showPitch) {
pitch = new PitchLabel(0);
pitch->setEnabled(false);
- pitch->setFixedHeight(22);
+ ///pitch->setFixedHeight(22);
addWidget(pitch);
}
@@ -117,7 +117,7 @@ Toolbar1::Toolbar1(QWidget* parent, int r, bool sp)
addWidget(raster);
// FIXME: Not working right.
- raster->setFixedHeight(38);
+ ///raster->setFixedHeight(38);
connect(raster, SIGNAL(activated(int)), SLOT(_rasterChanged(int)));
connect(solo, SIGNAL(toggled(bool)), SIGNAL(soloChanged(bool)));