-- cgit v1.2.3 From 94583a696436a3bec385223efaea730768720975 Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Sun, 8 May 2011 14:08:06 +0000 Subject: made quantize, modify note len and modify velocity functions global added quantize-dialog and improved the other dialogs --- muse2/muse/CMakeLists.txt | 1 + muse2/muse/app.cpp | 4 +- muse2/muse/functions.cpp | 237 +++++++++++++++++++++++++++ muse2/muse/functions.h | 40 +++++ muse2/muse/main.cpp | 4 + muse2/muse/midiedit/CMakeLists.txt | 2 - muse2/muse/midiedit/dcanvas.cpp | 49 +----- muse2/muse/midiedit/drumedit.cpp | 4 + muse2/muse/midiedit/pianoroll.cpp | 62 ++------ muse2/muse/midiedit/pianoroll.h | 9 +- muse2/muse/midiedit/prcanvas.cpp | 159 +------------------ muse2/muse/midiedit/prcanvas.h | 7 +- muse2/muse/midiedit/quantconfig.cpp | 79 --------- muse2/muse/midiedit/quantconfig.h | 32 ---- muse2/muse/midiedit/scoreedit.cpp | 43 +++-- muse2/muse/midiedit/scoreedit.h | 12 +- muse2/muse/widgets/CMakeLists.txt | 3 + muse2/muse/widgets/gatetime.cpp | 26 ++- muse2/muse/widgets/gatetime.h | 16 +- muse2/muse/widgets/gatetimebase.ui | 13 +- muse2/muse/widgets/quantbase.ui | 308 ++++++++++++++++++++++++++++++++++++ muse2/muse/widgets/quantize.cpp | 54 +++++++ muse2/muse/widgets/quantize.h | 40 +++++ muse2/muse/widgets/velocity.cpp | 28 +++- muse2/muse/widgets/velocity.h | 19 +-- muse2/muse/widgets/velocitybase.ui | 14 +- 26 files changed, 834 insertions(+), 431 deletions(-) create mode 100644 muse2/muse/functions.cpp create mode 100644 muse2/muse/functions.h delete mode 100644 muse2/muse/midiedit/quantconfig.cpp delete mode 100644 muse2/muse/midiedit/quantconfig.h create mode 100644 muse2/muse/widgets/quantbase.ui create mode 100644 muse2/muse/widgets/quantize.cpp create mode 100644 muse2/muse/widgets/quantize.h diff --git a/muse2/muse/CMakeLists.txt b/muse2/muse/CMakeLists.txt index 2d2a9fe3..3117cf2f 100644 --- a/muse2/muse/CMakeLists.txt +++ b/muse2/muse/CMakeLists.txt @@ -89,6 +89,7 @@ file (GLOB core_source_files event.cpp eventlist.cpp exportmidi.cpp + functions.cpp gconfig.cpp globals.cpp help.cpp diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp index 052bb48b..7bf171e5 100644 --- a/muse2/muse/app.cpp +++ b/muse2/muse/app.cpp @@ -31,7 +31,6 @@ #include "didyouknow.h" #include "drumedit.h" #include "filedialog.h" -#include "gatetime.h" #include "gconfig.h" #include "gui.h" #include "icons.h" @@ -4184,8 +4183,7 @@ void MusE::transpose() void MusE::modifyGateTime() { - GateTime* w = new GateTime(this); - w->show(); + printf("not implemented\n"); } //--------------------------------------------------------- diff --git a/muse2/muse/functions.cpp b/muse2/muse/functions.cpp new file mode 100644 index 00000000..980a5103 --- /dev/null +++ b/muse2/muse/functions.cpp @@ -0,0 +1,237 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: functions.cpp,v 1.20.2.19 2011/05/05 20:10 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#include "functions.h" +#include "song.h" + +#include "event.h" +#include "audio.h" +#include "gconfig.h" + +#include + +using namespace std; + +GateTime* gatetime_dialog=NULL; +Velocity* velocity_dialog=NULL; +Quantize* quantize_dialog=NULL; + +void init_function_dialogs(QWidget* parent) +{ + gatetime_dialog = new GateTime(parent); + velocity_dialog = new Velocity(parent); + quantize_dialog = new Quantize(parent); +} + +set partlist_to_set(PartList* pl) +{ + set result; + + for (PartList::iterator it=pl->begin(); it!=pl->end(); it++) + result.insert(it->second); + + return result; +} + +bool is_relevant(const Event& event, const Part* part, int range) +{ + unsigned tick; + + if (event.type()!=Note) return false; + + switch (range) + { + case 0: return true; + case 1: return event.selected(); + case 2: tick=event.tick()+part->tick(); return (tick >= song->lpos()) && (tick < song->rpos()); + case 3: return is_relevant(event,part,1) && is_relevant(event,part,2); + default: cout << "ERROR: ILLEGAL FUNCTION CALL in is_relevant: range is illegal: "<& parts) +{ + if (!gatetime_dialog->exec()) + return false; + + modify_notelen(parts,gatetime_dialog->range,gatetime_dialog->rateVal,gatetime_dialog->offsetVal); + + return true; +} + +bool modify_velocity(const set& parts) +{ + if (!velocity_dialog->exec()) + return false; + + modify_velocity(parts,velocity_dialog->range,velocity_dialog->rateVal,velocity_dialog->offsetVal); + + return true; +} + +bool quantize_notes(const set& parts) +{ + if (!quantize_dialog->exec()) + return false; + + quantize_notes(parts, quantize_dialog->range, (config.division*4)/(1<raster_power2), + quantize_dialog->strength, quantize_dialog->swing, quantize_dialog->threshold); + + return true; +} + + + +void modify_velocity(const set& parts, int range, int rate, int offset) +{ + map events; + + for (set::iterator part=parts.begin(); part!=parts.end(); part++) + for (iEvent event=(*part)->events()->begin(); event!=(*part)->events()->end(); event++) + if (is_relevant(event->second, *part, range)) + events.insert(pair(&event->second, *part)); + + + song->startUndo(); + + for (map::iterator it=events.begin(); it!=events.end(); it++) + { + Event& event=*(it->first); + Part* part=it->second; + + int velo = event.velo(); + + velo = (velo * rate) / 100; + velo += offset; + + if (velo <= 0) + velo = 1; + else if (velo > 127) + velo = 127; + + if (event.velo() != velo) + { + Event newEvent = event.clone(); + newEvent.setVelo(velo); + // Indicate no undo, and do not do port controller values and clone parts. + audio->msgChangeEvent(event, newEvent, part, false, false, false); + } + } + + song->endUndo(SC_EVENT_MODIFIED); +} + +void modify_notelen(const set& parts, int range, int rate, int offset) +{ + map events; + + for (set::iterator part=parts.begin(); part!=parts.end(); part++) + for (iEvent event=(*part)->events()->begin(); event!=(*part)->events()->end(); event++) + if (is_relevant(event->second, *part, range)) + events.insert(pair(&event->second, *part)); + + + song->startUndo(); + + for (map::iterator it=events.begin(); it!=events.end(); it++) + { + Event& event=*(it->first); + Part* part=it->second; + + unsigned int len = event.lenTick(); //prevent compiler warning: comparison singed/unsigned + + len = (len * rate) / 100; + len += offset; + + if (len <= 0) + len = 1; + + if (event.lenTick() != len) + { + Event newEvent = event.clone(); + newEvent.setLenTick(len); + // Indicate no undo, and do not do port controller values and clone parts. + audio->msgChangeEvent(event, newEvent, part, false, false, false); + } + } + + song->endUndo(SC_EVENT_MODIFIED); +} + +unsigned quantize_tick(unsigned tick, unsigned raster, int swing) +{ + //find out the nearest tick and the distance to it: + //this is so complicated because this function supports + //swing: if swing is 50, the resulting rhythm is not + //"daa daa daa daa" but "daaaa da daaaa da"... + int tick_dest1 = AL::sigmap.raster1(tick, raster*2); //round down + int tick_dest2 = tick_dest1 + raster + raster*swing/100; + int tick_dest3 = tick_dest1 + raster*2; + + int tick_diff1 = tick_dest1 - tick; + int tick_diff2 = tick_dest2 - tick; + int tick_diff3 = tick_dest3 - tick; + + if ((abs(tick_diff1) <= abs(tick_diff2)) && (abs(tick_diff1) <= abs(tick_diff3))) //tick_dest1 is the nearest tick + return tick_dest1; + else if ((abs(tick_diff2) <= abs(tick_diff1)) && (abs(tick_diff2) <= abs(tick_diff3))) //tick_dest2 is the nearest tick + return tick_dest2; + else + return tick_dest3; +} + +void quantize_notes(const set& parts, int range, int raster, int strength, int swing, int threshold) +{ + map events; + + for (set::iterator part=parts.begin(); part!=parts.end(); part++) + for (iEvent event=(*part)->events()->begin(); event!=(*part)->events()->end(); event++) + if (is_relevant(event->second, *part, range)) + events.insert(pair(&event->second, *part)); + + + song->startUndo(); + + for (map::iterator it=events.begin(); it!=events.end(); it++) + { + Event& event=*(it->first); + Part* part=it->second; + + unsigned begin_tick = event.tick() + part->tick(); + int begin_diff = quantize_tick(begin_tick, raster, swing) - begin_tick; + + if (abs(begin_diff) > threshold) + begin_tick = begin_tick + begin_diff*strength/100; + + + unsigned len=event.lenTick(); + + unsigned end_tick = begin_tick + len; + int len_diff = quantize_tick(end_tick, raster, swing) - end_tick; + + if (abs(len_diff) > threshold) + len = len + len_diff*strength/100; + + if (len <= 0) + len = 1; + + + if ( (event.lenTick() != len) || (event.tick() + part->tick() != begin_tick) ) + { + Event newEvent = event.clone(); + newEvent.setTick(begin_tick - part->tick()); + newEvent.setLenTick(len); + // Indicate no undo, and do not do port controller values and clone parts. + audio->msgChangeEvent(event, newEvent, part, false, false, false); + } + } + + song->endUndo(SC_EVENT_MODIFIED); +} + + diff --git a/muse2/muse/functions.h b/muse2/muse/functions.h new file mode 100644 index 00000000..a71230a4 --- /dev/null +++ b/muse2/muse/functions.h @@ -0,0 +1,40 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: functions.h,v 1.20.2.19 2011/05/05 20:10 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#ifndef __FUNCTIONS_H__ +#define __FUNCTIONS_H__ + +#include "velocity.h" +#include "quantize.h" +#include "gatetime.h" + +#include +#include "part.h" + + +extern GateTime* gatetime_dialog; +extern Velocity* velocity_dialog; +extern Quantize* quantize_dialog; + +void init_function_dialogs(QWidget* parent); + + +std::set partlist_to_set(PartList* pl); + +//these functions simply do their job, non-interactively +void modify_velocity(const std::set& parts, int range, int rate, int offset=0); +void modify_notelen(const std::set& parts, int range, int rate, int offset=0); +void quantize_notes(const std::set& parts, int range, int raster, int strength=100, int swing=0, int threshold=0); + +//the below functions automatically open the dialog +//they return true if you click "ok" and false if "abort" +bool modify_velocity(const std::set& parts); +bool modify_notelen(const std::set& parts); +bool quantize_notes(const std::set& parts); + + +#endif diff --git a/muse2/muse/main.cpp b/muse2/muse/main.cpp index 53f8961b..6481f4cb 100644 --- a/muse2/muse/main.cpp +++ b/muse2/muse/main.cpp @@ -27,6 +27,7 @@ #include "globals.h" #include "icons.h" #include "sync.h" +#include "functions.h" extern bool initDummyAudio(); extern void initIcons(); @@ -470,6 +471,9 @@ int main(int argc, char* argv[]) muse = new MusE(argc, &argv[optind]); app.setMuse(muse); muse->setWindowIcon(*museIcon); + + init_function_dialogs(muse); + // Added by Tim. p3.3.22 if (!debugMode) { diff --git a/muse2/muse/midiedit/CMakeLists.txt b/muse2/muse/midiedit/CMakeLists.txt index 7e973aaa..a52d1844 100644 --- a/muse2/muse/midiedit/CMakeLists.txt +++ b/muse2/muse/midiedit/CMakeLists.txt @@ -35,7 +35,6 @@ QT4_WRAP_CPP ( midiedit_mocs piano.h pianoroll.h prcanvas.h - quantconfig.h scoreedit.h ) @@ -58,7 +57,6 @@ file (GLOB midiedit_source_files piano.cpp pianoroll.cpp prcanvas.cpp - quantconfig.cpp scoreedit.cpp ) diff --git a/muse2/muse/midiedit/dcanvas.cpp b/muse2/muse/midiedit/dcanvas.cpp index 1303c189..9c50c8b2 100644 --- a/muse2/muse/midiedit/dcanvas.cpp +++ b/muse2/muse/midiedit/dcanvas.cpp @@ -31,7 +31,6 @@ #include "globals.h" #include "midiport.h" #include "audio.h" -#include "velocity.h" #include "shortcuts.h" #include "icons.h" @@ -608,7 +607,7 @@ void DrumCanvas::drawCanvas(QPainter& p, const QRect& rect) //--------------------------------------------------------- // drawTopItem //--------------------------------------------------------- -void DrumCanvas::drawTopItem(QPainter &p, const QRect &r) +void DrumCanvas::drawTopItem(QPainter& p, const QRect&) { // draw cursor if (_tool == CursorTool) { @@ -819,52 +818,6 @@ void DrumCanvas::cmd(int cmd) song->setPos(0, p, true, true, true); //CDW } break; - case CMD_MODIFY_VELOCITY: - { - Velocity w; - w.setRange(0); //TODO: Make this work! Probably put _to & _toInit in ecanvas instead - if (!w.exec()) - break; - int range = w.range(); // all, selected, looped, sel+loop - int rate = w.rateVal(); - int offset = w.offsetVal(); - - song->startUndo(); - for (iCItem k = items.begin(); k != items.end(); ++k) { - DEvent* devent = (DEvent*)(k->second); - Event event = devent->event(); - if (event.type() != Note) - continue; - unsigned tick = event.tick(); - bool selected = k->second->isSelected(); - bool inLoop = (tick >= song->lpos()) && (tick < song->rpos()); - - if ((range == 0) - || (range == 1 && selected) - || (range == 2 && inLoop) - || (range == 3 && selected && inLoop)) { - int velo = event.velo(); - - //velo = rate ? (velo * 100) / rate : 64; - velo = (velo * rate) / 100; - velo += offset; - - if (velo <= 0) - velo = 1; - if (velo > 127) - velo = 127; - if (event.velo() != velo) { - Event newEvent = event.clone(); - newEvent.setVelo(velo); - // Indicate no undo, and do not do port controller values and clone parts. - //audio->msgChangeEvent(event, newEvent, devent->part(), false); - audio->msgChangeEvent(event, newEvent, devent->part(), false, false, false); - } - } - } - song->endUndo(SC_EVENT_MODIFIED); - } - break; } updateSelection(); redraw(); diff --git a/muse2/muse/midiedit/drumedit.cpp b/muse2/muse/midiedit/drumedit.cpp index ed3cd0e8..d9029969 100644 --- a/muse2/muse/midiedit/drumedit.cpp +++ b/muse2/muse/midiedit/drumedit.cpp @@ -43,6 +43,7 @@ #include "drummap.h" #include "audio.h" #include "gconfig.h" +#include "functions.h" /* static const char* map_file_pattern[] = { @@ -905,6 +906,9 @@ void DrumEdit::cmd(int cmd) case DrumCanvas::CMD_RESET: reset(); break; + case DrumCanvas::CMD_MODIFY_VELOCITY: + modify_velocity(partlist_to_set(parts())); + break; default: ((DrumCanvas*)(canvas))->cmd(cmd); break; diff --git a/muse2/muse/midiedit/pianoroll.cpp b/muse2/muse/midiedit/pianoroll.cpp index 2778d8b9..d008b35f 100644 --- a/muse2/muse/midiedit/pianoroll.cpp +++ b/muse2/muse/midiedit/pianoroll.cpp @@ -44,9 +44,10 @@ #include "gconfig.h" #include "icons.h" #include "audio.h" +#include "functions.h" + #include "cmd.h" -#include "quantconfig.h" #include "shortcuts.h" #include "mtrackinfo.h" @@ -77,7 +78,6 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i deltaMode = false; resize(_widthInit, _heightInit); selPart = 0; - quantConfig = 0; _playEvents = false; _quantStrength = _quantStrengthInit; _quantLimit = _quantLimitInit; @@ -186,30 +186,11 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i menuFunctions->setTearOffEnabled(true); - funcOverQuantAction = menuFunctions->addAction(tr("Over Quantize")); - mapper->setMapping(funcOverQuantAction, PianoCanvas::CMD_OVER_QUANTIZE); - connect(funcOverQuantAction, SIGNAL(triggered()), mapper, SLOT(map())); - - funcNoteOnQuantAction = menuFunctions->addAction(tr("Note On Quantize")); - mapper->setMapping(funcNoteOnQuantAction, PianoCanvas::CMD_ON_QUANTIZE); - connect(funcNoteOnQuantAction, SIGNAL(triggered()), mapper, SLOT(map())); - - funcNoteOnOffQuantAction = menuFunctions->addAction(tr("Note On/Off Quantize")); - mapper->setMapping(funcNoteOnOffQuantAction, PianoCanvas::CMD_ONOFF_QUANTIZE); - connect(funcNoteOnOffQuantAction, SIGNAL(triggered()), mapper, SLOT(map())); - - funcIterQuantAction = menuFunctions->addAction(tr("Iterative Quantize")); - mapper->setMapping(funcIterQuantAction, PianoCanvas::CMD_ITERATIVE_QUANTIZE); - connect(funcIterQuantAction, SIGNAL(triggered()), mapper, SLOT(map())); + funcQuantizeAction = menuFunctions->addAction(tr("Quantize")); + mapper->setMapping(funcQuantizeAction, PianoCanvas::CMD_QUANTIZE); + connect(funcQuantizeAction, SIGNAL(triggered()), mapper, SLOT(map())); - menuFunctions->addSeparator(); - - funcConfigQuantAction = menuFunctions->addAction(tr("Config Quant...")); - connect(funcConfigQuantAction, SIGNAL(triggered()), this, SLOT(configQuant())); - - menuFunctions->addSeparator(); - - funcGateTimeAction = menuFunctions->addAction(tr("Modify Gate Time")); + funcGateTimeAction = menuFunctions->addAction(tr("Modify Note Length")); mapper->setMapping(funcGateTimeAction, PianoCanvas::CMD_MODIFY_GATE_TIME); connect(funcGateTimeAction, SIGNAL(triggered()), mapper, SLOT(map())); @@ -655,7 +636,14 @@ PianoRoll::~PianoRoll() void PianoRoll::cmd(int cmd) { - ((PianoCanvas*)canvas)->cmd(cmd, _quantStrength, _quantLimit, _quantLen, _to); + switch (cmd) + { + case PianoCanvas::CMD_MODIFY_GATE_TIME: modify_notelen(partlist_to_set(parts())); break; + case PianoCanvas::CMD_MODIFY_VELOCITY: modify_velocity(partlist_to_set(parts())); break; + case PianoCanvas::CMD_QUANTIZE: quantize_notes(partlist_to_set(parts())); break; + + default: ((PianoCanvas*)canvas)->cmd(cmd); + } } //--------------------------------------------------------- @@ -1200,21 +1188,6 @@ void PianoRoll::keyPressEvent(QKeyEvent* event) toolbar->setRaster(_raster); } -//--------------------------------------------------------- -// configQuant -//--------------------------------------------------------- - -void PianoRoll::configQuant() - { - if (!quantConfig) { - quantConfig = new QuantConfig(_quantStrength, _quantLimit, _quantLen); - connect(quantConfig, SIGNAL(setQuantStrength(int)), SLOT(setQuantStrength(int))); - connect(quantConfig, SIGNAL(setQuantLimit(int)), SLOT(setQuantLimit(int))); - connect(quantConfig, SIGNAL(setQuantLen(bool)), SLOT(setQuantLen(bool))); - } - quantConfig->show(); - } - //--------------------------------------------------------- // setSteprec //--------------------------------------------------------- @@ -1336,12 +1309,7 @@ void PianoRoll::initShortcuts() //evColorPitchAction->setShortcut(shortcuts[ ].key); //evColorVelAction->setShortcut(shortcuts[ ].key); - funcOverQuantAction->setShortcut(shortcuts[SHRT_OVER_QUANTIZE].key); - funcNoteOnQuantAction->setShortcut(shortcuts[SHRT_ON_QUANTIZE].key); - funcNoteOnOffQuantAction->setShortcut(shortcuts[SHRT_ONOFF_QUANTIZE].key); - funcIterQuantAction->setShortcut(shortcuts[SHRT_ITERATIVE_QUANTIZE].key); - - funcConfigQuantAction->setShortcut(shortcuts[SHRT_CONFIG_QUANT].key); + funcQuantizeAction->setShortcut(shortcuts[SHRT_OVER_QUANTIZE].key); //FINDMICH TODO FLO funcGateTimeAction->setShortcut(shortcuts[SHRT_MODIFY_GATE_TIME].key); funcModVelAction->setShortcut(shortcuts[SHRT_MODIFY_VELOCITY].key); diff --git a/muse2/muse/midiedit/pianoroll.h b/muse2/muse/midiedit/pianoroll.h index 2bfa9324..87bf52b6 100644 --- a/muse2/muse/midiedit/pianoroll.h +++ b/muse2/muse/midiedit/pianoroll.h @@ -35,7 +35,6 @@ class Splitter; class PartList; class Toolbar1; class Xml; -class QuantConfig; class ScrollScale; class Part; class SNode; @@ -81,11 +80,7 @@ class PianoRoll : public MidiEditor { QAction* evColorPitchAction; QAction* evColorVelAction; - QAction* funcOverQuantAction; - QAction* funcNoteOnQuantAction; - QAction* funcNoteOnOffQuantAction; - QAction* funcIterQuantAction; - QAction* funcConfigQuantAction; + QAction* funcQuantizeAction; QAction* funcGateTimeAction; QAction* funcModVelAction; QAction* funcCrescendoAction; @@ -137,7 +132,6 @@ class PianoRoll : public MidiEditor { int _quantLimit; int _to; bool _quantLen; - QuantConfig* quantConfig; bool _playEvents; //QScrollBar* infoScroll; @@ -160,7 +154,6 @@ class PianoRoll : public MidiEditor { //void trackInfoScroll(int); void setRaster(int); void setQuant(int); - void configQuant(); void setQuantStrength(int val) { _quantStrength = val; } void setQuantLimit(int val) { _quantLimit = val; } void setQuantLen(bool val) { _quantLen = val; } diff --git a/muse2/muse/midiedit/prcanvas.cpp b/muse2/muse/midiedit/prcanvas.cpp index a0ffdcaf..2966cf71 100644 --- a/muse2/muse/midiedit/prcanvas.cpp +++ b/muse2/muse/midiedit/prcanvas.cpp @@ -32,8 +32,6 @@ #include "mpevent.h" #include "globals.h" #include "cmd.h" -#include "gatetime.h" -#include "velocity.h" #include "song.h" #include "audio.h" @@ -82,7 +80,6 @@ PianoCanvas::PianoCanvas(MidiEditor* pr, QWidget* parent, int sx, int sy) : EventCanvas(pr, parent, sx, sy) { colorMode = 0; - cmdRange = 0; // all Events playedPitch = -1; songChanged(SC_TRACK_INSERTED); @@ -907,10 +904,8 @@ void PianoCanvas::drawCanvas(QPainter& p, const QRect& rect) // pulldown menu commands //--------------------------------------------------------- -void PianoCanvas::cmd(int cmd, int quantStrength, - int quantLimit, bool quantLen, int range) +void PianoCanvas::cmd(int cmd) { - cmdRange = range; switch (cmd) { case CMD_CUT: copy(); @@ -946,18 +941,7 @@ void PianoCanvas::cmd(int cmd, int quantStrength, song->endUndo(SC_EVENT_REMOVED); } return; - case CMD_OVER_QUANTIZE: // over quantize - quantize(100, 1, quantLen); - break; - case CMD_ON_QUANTIZE: // note on quantize - quantize(50, 1, false); - break; - case CMD_ONOFF_QUANTIZE: // note on/off quantize - quantize(50, 1, true); - break; - case CMD_ITERATIVE_QUANTIZE: // Iterative Quantize - quantize(quantStrength, quantLimit, quantLen); - break; + case CMD_SELECT_ALL: // select all for (iCItem k = items.begin(); k != items.end(); ++k) { if (!k->second->isSelected()) @@ -1032,96 +1016,6 @@ void PianoCanvas::cmd(int cmd, int quantStrength, editor->setCurCanvasPart(newpt); } break; - case CMD_MODIFY_GATE_TIME: - { - GateTime w(this); - w.setRange(range); - if (!w.exec()) - break; - int range = w.range(); // all, selected, looped, sel+loop - int rate = w.rateVal(); - int offset = w.offsetVal(); - - song->startUndo(); - for (iCItem k = items.begin(); k != items.end(); ++k) { - NEvent* nevent =(NEvent*)(k->second); - Event event = nevent->event(); - if (event.type() != Note) - continue; - unsigned tick = event.tick(); - bool selected = k->second->isSelected(); - bool inLoop = (tick >= song->lpos()) && (tick < song->rpos()); - - if ((range == 0) - || (range == 1 && selected) - || (range == 2 && inLoop) - || (range == 3 && selected && inLoop)) { - unsigned int len = event.lenTick(); //prevent compiler warning: comparison singed/unsigned - - len = rate ? (len * 100) / rate : 1; - len += offset; - if (len < 1) - len = 1; - - if (event.lenTick() != len) { - Event newEvent = event.clone(); - newEvent.setLenTick(len); - // Indicate no undo, and do not do port controller values and clone parts. - //audio->msgChangeEvent(event, newEvent, nevent->part(), false); - audio->msgChangeEvent(event, newEvent, nevent->part(), false, false, false); - } - } - } - song->endUndo(SC_EVENT_MODIFIED); - } - break; - - case CMD_MODIFY_VELOCITY: - { - Velocity w; - w.setRange(range); - if (!w.exec()) - break; - int range = w.range(); // all, selected, looped, sel+loop - int rate = w.rateVal(); - int offset = w.offsetVal(); - - song->startUndo(); - for (iCItem k = items.begin(); k != items.end(); ++k) { - NEvent* nevent = (NEvent*)(k->second); - Event event = nevent->event(); - if (event.type() != Note) - continue; - unsigned tick = event.tick(); - bool selected = k->second->isSelected(); - bool inLoop = (tick >= song->lpos()) && (tick < song->rpos()); - - if ((range == 0) - || (range == 1 && selected) - || (range == 2 && inLoop) - || (range == 3 && selected && inLoop)) { - int velo = event.velo(); - - //velo = rate ? (velo * 100) / rate : 64; - velo = (velo * rate) / 100; - velo += offset; - - if (velo <= 0) - velo = 1; - if (velo > 127) - velo = 127; - if (event.velo() != velo) { - Event newEvent = event.clone(); - newEvent.setVelo(velo); - // Indicate no undo, and do not do port controller values and clone parts. - //audio->msgChangeEvent(event, newEvent, nevent->part(), false); - audio->msgChangeEvent(event, newEvent, nevent->part(), false, false, false); - } - } - } - song->endUndo(SC_EVENT_MODIFIED); - } - break; case CMD_FIXED_LEN: //Set notes to the length specified in the drummap if (!selectionSize()) @@ -1230,55 +1124,6 @@ void PianoCanvas::cmd(int cmd, int quantStrength, redraw(); } -//--------------------------------------------------------- -// quantize -//--------------------------------------------------------- - -void PianoCanvas::quantize(int strength, int limit, bool quantLen) - { - song->startUndo(); - for (iCItem k = items.begin(); k != items.end(); ++k) { - NEvent* nevent = (NEvent*)(k->second); - Event event = nevent->event(); - Part* part = nevent->part(); - if (event.type() != Note) - continue; - - if ((cmdRange & CMD_RANGE_SELECTED) && !k->second->isSelected()) - continue; - - unsigned tick = event.tick() + part->tick(); - - if ((cmdRange & CMD_RANGE_LOOP) - && ((tick < song->lpos() || tick >= song->rpos()))) - continue; - - unsigned int len = event.lenTick(); //prevent compiler warning: comparison singed/unsigned - int tick2 = tick + len; - - // quant start position - int diff = AL::sigmap.raster(tick, editor->quant()) - tick; - if (abs(diff) > limit) - tick += ((diff * strength) / 100); - - // quant len - diff = AL::sigmap.raster(tick2, editor->quant()) - tick2; - if (quantLen && (abs(diff) > limit)) - len += ((diff * strength) / 100); - - // something changed? - if (((event.tick() + part->tick()) != tick) || (event.lenTick() != len)) { - Event newEvent = event.clone(); - newEvent.setTick(tick - part->tick()); - newEvent.setLenTick(len); - // Indicate no undo, and do not do port controller values and clone parts. - //audio->msgChangeEvent(event, newEvent, part, false); - audio->msgChangeEvent(event, newEvent, part, false, false, false); - } - } - song->endUndo(SC_EVENT_MODIFIED); - } - //--------------------------------------------------------- // midiNote //--------------------------------------------------------- diff --git a/muse2/muse/midiedit/prcanvas.h b/muse2/muse/midiedit/prcanvas.h index bda22fc3..39506a13 100644 --- a/muse2/muse/midiedit/prcanvas.h +++ b/muse2/muse/midiedit/prcanvas.h @@ -37,7 +37,6 @@ class QRect; //--------------------------------------------------------- class PianoCanvas : public EventCanvas { - int cmdRange; int colorMode; int playedPitch; @@ -63,7 +62,6 @@ class PianoCanvas : public EventCanvas { int y2pitch(int) const; int pitch2y(int) const; virtual void drawCanvas(QPainter&, const QRect&); - void quantize(int, int, bool); void copy(); void paste(); virtual void itemPressed(const CItem*); @@ -88,8 +86,7 @@ class PianoCanvas : public EventCanvas { public: enum { CMD_CUT, CMD_COPY, CMD_PASTE, CMD_DEL, - CMD_OVER_QUANTIZE, CMD_ON_QUANTIZE, CMD_ONOFF_QUANTIZE, - CMD_ITERATIVE_QUANTIZE, + CMD_QUANTIZE, CMD_SELECT_ALL, CMD_SELECT_NONE, CMD_SELECT_INVERT, CMD_SELECT_ILOOP, CMD_SELECT_OLOOP, CMD_SELECT_PREV_PART, CMD_SELECT_NEXT_PART, CMD_MODIFY_GATE_TIME, CMD_MODIFY_VELOCITY, @@ -100,7 +97,7 @@ class PianoCanvas : public EventCanvas { }; PianoCanvas(MidiEditor*, QWidget*, int, int); - void cmd(int, int, int, bool, int); + void cmd(int cmd); void setColorMode(int mode) { colorMode = mode; redraw(); diff --git a/muse2/muse/midiedit/quantconfig.cpp b/muse2/muse/midiedit/quantconfig.cpp deleted file mode 100644 index 2f413e6a..00000000 --- a/muse2/muse/midiedit/quantconfig.cpp +++ /dev/null @@ -1,79 +0,0 @@ -//========================================================= -// MusE -// Linux Music Editor -// $Id: quantconfig.cpp,v 1.2 2004/04/24 14:58:52 wschweer Exp $ -// -// (C) Copyright 1999/2003 Werner Schweer (ws@seh.de) -//========================================================= - -#include -#include -#include -#include -#include - -#include "quantconfig.h" - -const char* wtStrengthTxt = QT_TRANSLATE_NOOP("@default", "sets amount of quantization:\n" - "0 - no quantization\n" - "100 - full quantization"); -const char* wtQLimitTxt = QT_TRANSLATE_NOOP("@default", "don't quantize notes above this tick limit"); -const char* wtQLenTxt = QT_TRANSLATE_NOOP("@default", "quantize also note len as default"); - -//--------------------------------------------------------- -// QuantConfig -//--------------------------------------------------------- - -QuantConfig::QuantConfig(int s, int l, bool lenFlag) - : QDialog() - { - setWindowTitle(tr("MusE: Config Quantize")); - QVBoxLayout *mainlayout = new QVBoxLayout; - - QGridLayout* layout = new QGridLayout; - QGroupBox* gb = new QGroupBox(tr("Config Quantize")); - - QLabel* l1 = new QLabel(tr("Strength")); - layout->addWidget(l1, 0, 0); - QSpinBox* sb1 = new QSpinBox; - sb1->setMinimum(0); - sb1->setMaximum(100); - sb1->setSingleStep(1); - sb1->setSuffix(QString("%")); - sb1->setValue(s); - layout->addWidget(sb1, 0, 1); - - QLabel* l2 = new QLabel(tr("Donīt Quantize")); - layout->addWidget(l2, 1, 0); - QSpinBox* sb2 = new QSpinBox; - sb2->setMinimum(0); - sb2->setMaximum(500); - sb2->setSingleStep(1); - sb2->setValue(l); - layout->addWidget(sb2, 1, 1); - - QLabel* l3 = new QLabel(tr("Quant Len")); - layout->addWidget(l3, 2, 0); - QCheckBox* but = new QCheckBox; - but->setChecked(lenFlag); - layout->addWidget(but, 2, 1); - - connect(sb1, SIGNAL(valueChanged(int)), SIGNAL(setQuantStrength(int))); - connect(sb2, SIGNAL(valueChanged(int)), SIGNAL(setQuantLimit(int))); - connect(but, SIGNAL(toggled(bool)), SIGNAL(setQuantLen(bool))); - - gb->setLayout(layout); - mainlayout->addWidget(gb); - setLayout(mainlayout); - - l1->setWhatsThis(tr(wtStrengthTxt)); - l1->setToolTip(tr(wtStrengthTxt)); - sb1->setWhatsThis(tr(wtStrengthTxt)); - l2->setWhatsThis(tr(wtQLimitTxt)); - l2->setToolTip(tr(wtQLimitTxt)); - sb2->setWhatsThis(tr(wtQLimitTxt)); - l3->setWhatsThis(tr(wtQLenTxt)); - l3->setToolTip(tr(wtQLenTxt)); - but->setWhatsThis(tr(wtQLenTxt)); - } - diff --git a/muse2/muse/midiedit/quantconfig.h b/muse2/muse/midiedit/quantconfig.h deleted file mode 100644 index 4466cdf0..00000000 --- a/muse2/muse/midiedit/quantconfig.h +++ /dev/null @@ -1,32 +0,0 @@ -//========================================================= -// MusE -// Linux Music Editor -// $Id: quantconfig.h,v 1.1.1.1 2003/10/27 18:52:23 wschweer Exp $ -// -// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de) -//========================================================= - -#ifndef __QCONFIG_H__ -#define __QCONFIG_H__ - -#include - -//--------------------------------------------------------- -// QuantConfig -//--------------------------------------------------------- - -class QuantConfig : public QDialog { - Q_OBJECT - - signals: - void setQuantStrength(int); - void setQuantLimit(int); - void setQuantLen(bool); - - public: - QuantConfig(int, int, bool); - }; - - -#endif - diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index 31f0f325..cb37c382 100644 --- a/muse2/muse/midiedit/scoreedit.cpp +++ b/muse2/muse/midiedit/scoreedit.cpp @@ -43,25 +43,20 @@ using namespace std; #include "mtscale.h" #include "prcanvas.h" #include "scoreedit.h" -#include "scrollscale.h" -#include "piano.h" -#include "../ctrl/ctrledit.h" -#include "splitter.h" #include "ttoolbar.h" #include "tb1.h" -#include "utils.h" #include "globals.h" #include "gconfig.h" #include "icons.h" #include "audio.h" +#include "functions.h" #include "cmd.h" -#include "quantconfig.h" -#include "shortcuts.h" - -#include "mtrackinfo.h" - #include "sig.h" +#include "song.h" + +//#include "../ctrl/ctrledit.h" +//#include "shortcuts.h" string IntToStr(int i); @@ -331,9 +326,15 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos) QAction* set_name_action = settings_menu->addAction(tr("Set Score &name"), menu_mapper, SLOT(map())); menu_mapper->setMapping(set_name_action, CMD_SET_NAME); - - + QMenu* functions_menu = menuBar()->addMenu(tr("&Functions")); + + QAction* func_quantize_action = functions_menu->addAction(tr("&Quantize"), menu_mapper, SLOT(map())); + QAction* func_notelen_action = functions_menu->addAction(tr("Change note &length"), menu_mapper, SLOT(map())); + QAction* func_velocity_action = functions_menu->addAction(tr("Change note &velocity"), menu_mapper, SLOT(map())); + menu_mapper->setMapping(func_quantize_action, CMD_QUANTIZE); + menu_mapper->setMapping(func_notelen_action, CMD_NOTELEN); + menu_mapper->setMapping(func_velocity_action, CMD_VELOCITY); score_canvas->song_changed(SC_EVENT_INSERTED); @@ -474,6 +475,10 @@ void ScoreEdit::menu_command(int cmd) } break; + case CMD_QUANTIZE: quantize_notes(score_canvas->get_all_parts()); break; + case CMD_VELOCITY: modify_velocity(score_canvas->get_all_parts()); break; + case CMD_NOTELEN: modify_notelen(score_canvas->get_all_parts()); break; + default: score_canvas->menu_command(cmd); } @@ -1097,6 +1102,15 @@ void ScoreCanvas::move_staff_below(list::iterator dest, list:: move_staff_above(dest, src); } +set ScoreCanvas::get_all_parts() +{ + set result; + + for (list::iterator it=staves.begin(); it!=staves.end(); it++) + result.insert(it->parts.begin(), it->parts.end()); + + return result; +} void ScoreCanvas::song_changed(int flags) { @@ -3913,16 +3927,19 @@ set staff_t::parts_at_tick(unsigned tick) /* BUGS and potential bugs + * o the proper quantize functions must be used! yes, really! * o when the keymap is not used, this will probably lead to a bug * same when mastertrack is disabled * o tied notes don't work properly when there's a key-change in * between, for example, when a cis is tied to a des * * CURRENT TODO - * o offer functions like in the pianoroll: quantize etc. * o support selections * o let the user select the distance between staves, or do this * automatically? + * o update translations + * o remove ambiguous translation: "offset"="zeitversatz" + * this is ambigous in mod. note len and WRONG in mod. velo dialogs * * IMPORTANT TODO * o add a select-clef-toolbox for tracks diff --git a/muse2/muse/midiedit/scoreedit.h b/muse2/muse/midiedit/scoreedit.h index 111a4f47..ed242aae 100644 --- a/muse2/muse/midiedit/scoreedit.h +++ b/muse2/muse/midiedit/scoreedit.h @@ -20,12 +20,13 @@ #include #include #include +#include #include #include "noteinfo.h" #include "cobject.h" -#include "midieditor.h" -#include "tools.h" +//#include "midieditor.h" +//#include "tools.h" #include "event.h" #include "view.h" #include "gconfig.h" @@ -55,9 +56,12 @@ using std::string; enum {CMD_COLOR_BLACK, CMD_COLOR_VELO, CMD_COLOR_PART, CMD_SET_NAME, CMD_NOTELEN_1, CMD_NOTELEN_2, CMD_NOTELEN_4, CMD_NOTELEN_8, - CMD_NOTELEN_16, CMD_NOTELEN_32, CMD_NOTELEN_LAST }; + CMD_NOTELEN_16, CMD_NOTELEN_32, CMD_NOTELEN_LAST, + + CMD_QUANTIZE, CMD_VELOCITY, CMD_NOTELEN }; class ScoreCanvas; +class EditToolBar; //--------------------------------------------------------- // ScoreEdit @@ -725,6 +729,8 @@ class ScoreCanvas : public View Part* get_selected_part() {return selected_part;} void set_selected_part(Part* p) {selected_part=p;} + set get_all_parts(); + void write_staves(int level, Xml& xml) const; }; diff --git a/muse2/muse/widgets/CMakeLists.txt b/muse2/muse/widgets/CMakeLists.txt index 261c27a2..ee4af793 100644 --- a/muse2/muse/widgets/CMakeLists.txt +++ b/muse2/muse/widgets/CMakeLists.txt @@ -76,6 +76,7 @@ QT4_WRAP_CPP (widget_mocs # ttoolbar.h ttoolbutton.h velocity.h + quantize.h verticalmeter.h view.h vscale.h @@ -111,6 +112,7 @@ file (GLOB widgets_ui_files transformbase.ui transposebase.ui velocitybase.ui + quantbase.ui ) QT4_WRAP_UI (widget_ui_headers ${widgets_ui_files}) @@ -177,6 +179,7 @@ file (GLOB widgets_source_files ttoolbutton.cpp utils.cpp velocity.cpp + quantize.cpp verticalmeter.cpp view.cpp vscale.cpp diff --git a/muse2/muse/widgets/gatetime.cpp b/muse2/muse/widgets/gatetime.cpp index f1804c35..c64411a0 100644 --- a/muse2/muse/widgets/gatetime.cpp +++ b/muse2/muse/widgets/gatetime.cpp @@ -26,6 +26,8 @@ GateTime::GateTime(QWidget* parent) rangeGroup->addButton(loopButton, 2); rangeGroup->addButton(sloopButton, 3); rangeGroup->setExclusive(true); + + pullValues(); } //--------------------------------------------------------- @@ -34,18 +36,30 @@ GateTime::GateTime(QWidget* parent) void GateTime::accept() { - _range = rangeGroup->checkedId(); - _rateVal = rate->value(); - _offsetVal = offset->value(); + pullValues(); QDialog::accept(); } //--------------------------------------------------------- -// setRange +// pullValues //--------------------------------------------------------- -void GateTime::setRange(int id) +void GateTime::pullValues() { - rangeGroup->button(id)->setChecked(true); + range = rangeGroup->checkedId(); + rateVal = rate->value(); + offsetVal = offset->value(); } +//--------------------------------------------------------- +// exec +//--------------------------------------------------------- + +int GateTime::exec() + { + rangeGroup->button(range)->setChecked(true); + rate->setValue(rateVal); + offset->setValue(offsetVal); + + return QDialog::exec(); + } diff --git a/muse2/muse/widgets/gatetime.h b/muse2/muse/widgets/gatetime.h index dcb1827c..5585d6ad 100644 --- a/muse2/muse/widgets/gatetime.h +++ b/muse2/muse/widgets/gatetime.h @@ -18,22 +18,24 @@ class QDialog; //--------------------------------------------------------- class GateTime : public QDialog, public Ui::GateTimeBase { + private: Q_OBJECT - int _range; - int _rateVal; - int _offsetVal; QButtonGroup *rangeGroup; protected slots: void accept(); + void pullValues(); public: GateTime(QWidget* parent=0); - void setRange(int id); - int range() const { return _range; } - int rateVal() const { return _rateVal; } - int offsetVal() const { return _offsetVal; } + + int range; + int rateVal; + int offsetVal; + + public slots: + int exec(); }; #endif diff --git a/muse2/muse/widgets/gatetimebase.ui b/muse2/muse/widgets/gatetimebase.ui index babf5f02..e804de17 100644 --- a/muse2/muse/widgets/gatetimebase.ui +++ b/muse2/muse/widgets/gatetimebase.ui @@ -11,7 +11,7 @@ - MusE: Modify Gate Time + MusE: Modify Note Length @@ -59,7 +59,7 @@ - Selected & Looped + Selected Looped @@ -104,7 +104,7 @@ % - 200 + 1000 100 @@ -124,6 +124,13 @@ + + + + lenNew = (lenOld * rate) + offset + + + diff --git a/muse2/muse/widgets/quantbase.ui b/muse2/muse/widgets/quantbase.ui new file mode 100644 index 00000000..6a88c86f --- /dev/null +++ b/muse2/muse/widgets/quantbase.ui @@ -0,0 +1,308 @@ + + + QuantBase + + + true + + + + 0 + 0 + 279 + 486 + + + + MusE: Quantize + + + + 6 + + + 11 + + + + + Range + + + + 6 + + + 11 + + + + + All Events + + + + + + + Selected Events + + + true + + + + + + + Looped Events + + + + + + + Selected Looped + + + + + + + + + + Values + + + + 11 + + + 6 + + + + + Strength: + + + false + + + + + + + % + + + 100 + + + 80 + + + + + + + Threshold (ticks): + + + false + + + + + + + 0 + + + 10000 + + + 1 + + + + + + + Quantize Len + + + + + + + + + + true + + + + + + + Raster + + + + + + + false + + + 3 + + + true + + + + Whole + + + + + Half + + + + + Quarter + + + + + 8th + + + + + 16th + + + + + 32th + + + + + + + + Swing: + + + + + + + -99 + + + + + + + If the proposed change in tick or length is smaller than threshold, nothing is done. +If swing=0, this is normal +If swing is 33, you get a 2:1-rhythm. +If swing is -33, you get a 1:2-rhythm. + + + true + + + + + + + + + + 6 + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 20 + 20 + + + + + + + + OK + + + false + + + true + + + + + + + Cancel + + + + + + + + + + + + ok_button + clicked() + QuantBase + accept() + + + 20 + 20 + + + 20 + 20 + + + + + cancel_button + clicked() + QuantBase + reject() + + + 20 + 20 + + + 20 + 20 + + + + + diff --git a/muse2/muse/widgets/quantize.cpp b/muse2/muse/widgets/quantize.cpp new file mode 100644 index 00000000..734f3d5d --- /dev/null +++ b/muse2/muse/widgets/quantize.cpp @@ -0,0 +1,54 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: quantize.cpp,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#include +#include "quantize.h" + + +Quantize::Quantize(QWidget* parent) + : QDialog(parent) +{ + setupUi(this); + range_group = new QButtonGroup; + range_group->addButton(all_events_button,0); + range_group->addButton(selected_events_button,1); + range_group->addButton(looped_events_button,2); + range_group->addButton(selected_looped_button,3); + + pull_values(); +} + +void Quantize::pull_values() +{ + range = range_group->checkedId(); + strength = strength_spinbox->value(); + threshold = threshold_spinbox->value(); + raster_power2 = raster_combobox->currentIndex(); + quant_len = len_checkbox->isChecked(); + swing = swing_spinbox->value(); +} + +void Quantize::accept() +{ + pull_values(); + QDialog::accept(); +} + +int Quantize::exec() +{ + if ((range < 0) || (range > 3)) range=0; + + range_group->button(range)->setChecked(true); + strength_spinbox->setValue(strength); + threshold_spinbox->setValue(threshold); + raster_combobox->setCurrentIndex(raster_power2); + len_checkbox->setChecked(quant_len); + swing_spinbox->setValue(swing); + + return QDialog::exec(); +} + diff --git a/muse2/muse/widgets/quantize.h b/muse2/muse/widgets/quantize.h new file mode 100644 index 00000000..3f54bc09 --- /dev/null +++ b/muse2/muse/widgets/quantize.h @@ -0,0 +1,40 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: quantize.h,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#ifndef __QUANTIZE_H__ +#define __QUANTIZE_H__ + +#include "ui_quantbase.h" + +class QButtonGroup; + +class Quantize : public QDialog, public Ui::QuantBase +{ + private: + Q_OBJECT + QButtonGroup* range_group; + + protected slots: + void accept(); + void pull_values(); + + public: + Quantize(QWidget* parent = 0); + + int range; + int strength; + int threshold; + int raster_power2; + int swing; + bool quant_len; + + public slots: + int exec(); +}; + +#endif + diff --git a/muse2/muse/widgets/velocity.cpp b/muse2/muse/widgets/velocity.cpp index 309beb4d..ad9bbfe4 100644 --- a/muse2/muse/widgets/velocity.cpp +++ b/muse2/muse/widgets/velocity.cpp @@ -12,7 +12,7 @@ // Velocity //--------------------------------------------------------- -Velocity::Velocity(QDialog* parent) +Velocity::Velocity(QWidget* parent) : QDialog(parent) { setupUi(this); @@ -21,6 +21,8 @@ Velocity::Velocity(QDialog* parent) rangeGroup->addButton(selectedEvents,1); rangeGroup->addButton(loopedEvents,2); rangeGroup->addButton(selectedLooped,3); + + pullValues(); } //--------------------------------------------------------- @@ -29,18 +31,30 @@ Velocity::Velocity(QDialog* parent) void Velocity::accept() { - _range = rangeGroup->checkedId(); - _rateVal = rate->value(); - _offsetVal = offset->value(); + pullValues(); QDialog::accept(); } //--------------------------------------------------------- -// setRange +// pullValues //--------------------------------------------------------- -void Velocity::setRange(int id) +void Velocity::pullValues() { - rangeGroup->button(id)->setChecked(true); + range = rangeGroup->checkedId(); + rateVal = rate->value(); + offsetVal = offset->value(); } +//--------------------------------------------------------- +// exec +//--------------------------------------------------------- + +int Velocity::exec() + { + rangeGroup->button(range)->setChecked(true); + rate->setValue(rateVal); + offset->setValue(offsetVal); + + return QDialog::exec(); + } diff --git a/muse2/muse/widgets/velocity.h b/muse2/muse/widgets/velocity.h index cf5b2779..448b3e5b 100644 --- a/muse2/muse/widgets/velocity.h +++ b/muse2/muse/widgets/velocity.h @@ -17,22 +17,23 @@ class QButtonGroup; //--------------------------------------------------------- class Velocity : public QDialog, public Ui::VelocityBase { - int _range; - int _rateVal; - int _offsetVal; - + private: Q_OBJECT QButtonGroup* rangeGroup; protected slots: void accept(); + void pullValues(); public: - Velocity(QDialog* parent = 0); - void setRange(int id); - int range() const { return _range; } - int rateVal() const { return _rateVal; } - int offsetVal() const { return _offsetVal; } + Velocity(QWidget* parent = 0); + + int range; + int rateVal; + int offsetVal; + + public slots: + int exec(); }; #endif diff --git a/muse2/muse/widgets/velocitybase.ui b/muse2/muse/widgets/velocitybase.ui index 1e386e11..40fe625f 100644 --- a/muse2/muse/widgets/velocitybase.ui +++ b/muse2/muse/widgets/velocitybase.ui @@ -59,7 +59,7 @@ - Selected & Looped + Selected Looped @@ -114,7 +114,7 @@ - 1 + -127 127 @@ -122,6 +122,16 @@ 1 + + 0 + + + + + + + veloNew = (veloOld * rate) + offset + -- cgit v1.2.3 From a3670594c5a3c5a7053dd8bd8280b7c2b20cefbe Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Sun, 8 May 2011 14:38:10 +0000 Subject: the proper AL::raster quantisation functions are used in the scoreeditor --- muse2/muse/midiedit/scoreedit.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index cb37c382..9534abf9 100644 --- a/muse2/muse/midiedit/scoreedit.cpp +++ b/muse2/muse/midiedit/scoreedit.cpp @@ -1315,15 +1315,15 @@ bool operator< (const note_pos_t& a, const note_pos_t& b) } - + int flo_quantize(int tick, int quant_ticks) { - return int(nearbyint((float)tick / quant_ticks))*quant_ticks; + return AL::sigmap.raster(tick, quant_ticks); } int flo_quantize_floor(int tick, int quant_ticks) { - return int(tick / quant_ticks) * quant_ticks; + return AL::sigmap.raster1(tick, quant_ticks); } @@ -3927,7 +3927,6 @@ set staff_t::parts_at_tick(unsigned tick) /* BUGS and potential bugs - * o the proper quantize functions must be used! yes, really! * o when the keymap is not used, this will probably lead to a bug * same when mastertrack is disabled * o tied notes don't work properly when there's a key-change in -- cgit v1.2.3 From 3793e801b3116509fadd853e158b522a65fb6d22 Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Mon, 9 May 2011 16:33:22 +0000 Subject: swapped ctrl and shift for selecting stuff -> made muse's behaviour according to common standards --- muse2/muse/arranger/pcanvas.cpp | 10 +++++----- muse2/muse/arranger/tlist.cpp | 10 +++++----- muse2/muse/ctrl/ctrlcanvas.cpp | 24 ++++++++++++------------ muse2/muse/midiedit/dcanvas.cpp | 3 --- muse2/muse/midiedit/dlist.cpp | 5 ----- muse2/muse/midiedit/pianoroll.cpp | 3 --- muse2/muse/shortcuts.h | 2 +- muse2/muse/widgets/canvas.cpp | 29 +++++++++++------------------ 8 files changed, 34 insertions(+), 52 deletions(-) diff --git a/muse2/muse/arranger/pcanvas.cpp b/muse2/muse/arranger/pcanvas.cpp index 35de93ee..599e90a0 100644 --- a/muse2/muse/arranger/pcanvas.cpp +++ b/muse2/muse/arranger/pcanvas.cpp @@ -231,9 +231,9 @@ void PartCanvas::viewMouseDoubleClickEvent(QMouseEvent* event) } QPoint cpos = event->pos(); curItem = items.find(cpos); - bool shift = event->modifiers() & Qt::ShiftModifier; + bool ctrl = event->modifiers() & Qt::ControlModifier; if (curItem) { - if (event->button() == Qt::LeftButton && shift) { + if (event->button() == Qt::LeftButton && ctrl) { editPart = (NPart*)curItem; QRect r = map(curItem->bbox()); if (lineEditor == 0) { @@ -1002,7 +1002,7 @@ void PartCanvas::itemPopup(CItem* item, int n, const QPoint& pt) void PartCanvas::mousePress(QMouseEvent* event) { - if (event->modifiers() & Qt::ShiftModifier) { + if (event->modifiers() & Qt::ControlModifier) { return; } QPoint pt = event->pos(); @@ -1059,7 +1059,7 @@ void PartCanvas::mouseMove(QMouseEvent* event) x = 0; if (_tool == AutomationTool) - processAutomationMovements(event->pos(), event->modifiers() & Qt::ControlModifier); + processAutomationMovements(event->pos(), event->modifiers() & Qt::ShiftModifier); emit timeChanged(AL::sigmap.raster(x, *_raster)); } @@ -1665,7 +1665,7 @@ void PartCanvas::drawMoving(QPainter& p, const CItem* item, const QRect&) // pr - part rectangle //--------------------------------------------------------- -void PartCanvas::drawMidiPart(QPainter& p, const QRect& bb, EventList* events, MidiTrack *mt, MidiPart *pt, const QRect& r, int pTick, int from, int to) +void PartCanvas::drawMidiPart(QPainter& p, const QRect&, EventList* events, MidiTrack *mt, MidiPart *pt, const QRect& r, int pTick, int from, int to) { //printf("x=%d y=%d h=%d w=%d\n",r.x(),r.y(),r.height(),r.width()); diff --git a/muse2/muse/arranger/tlist.cpp b/muse2/muse/arranger/tlist.cpp index b907b555..2a397a4e 100644 --- a/muse2/muse/arranger/tlist.cpp +++ b/muse2/muse/arranger/tlist.cpp @@ -348,7 +348,7 @@ void TList::paint(const QRect& r) if (cl->isVisible()) countVisible++; } - int count = ((AudioTrack*)track)->controller()->size(); + //int count = ((AudioTrack*)track)->controller()->size(); //commented out by flo: gives a "unused variable" warning s.sprintf(" %d(%d) visible",countVisible, countAll); } @@ -914,7 +914,7 @@ void TList::mousePressEvent(QMouseEvent* ev) int x = ev->x(); int y = ev->y(); int button = ev->button(); - bool shift = ((QInputEvent*)ev)->modifiers() & Qt::ShiftModifier; + bool ctrl = ((QInputEvent*)ev)->modifiers() & Qt::ControlModifier; Track* t = y2Track(y + ypos); @@ -1152,7 +1152,7 @@ void TList::mousePressEvent(QMouseEvent* ev) break; case COL_MUTE: // p3.3.29 - if ((button == Qt::RightButton) || (((QInputEvent*)ev)->modifiers() & Qt::ControlModifier)) + if ((button == Qt::RightButton) || (((QInputEvent*)ev)->modifiers() & Qt::ShiftModifier)) t->setOff(!t->off()); else { @@ -1170,7 +1170,7 @@ void TList::mousePressEvent(QMouseEvent* ev) case COL_NAME: if (button == Qt::LeftButton) { - if (!shift) { + if (!ctrl) { song->deselectTracks(); t->setSelected(true); @@ -1463,7 +1463,7 @@ void TList::wheelEvent(QWheelEvent* ev) break; case COL_MUTE: // p3.3.29 - if (((QInputEvent*)ev)->modifiers() & Qt::ControlModifier) + if (((QInputEvent*)ev)->modifiers() & Qt::ShiftModifier) t->setOff(!t->off()); else { diff --git a/muse2/muse/ctrl/ctrlcanvas.cpp b/muse2/muse/ctrl/ctrlcanvas.cpp index 56f19384..5e97ed90 100644 --- a/muse2/muse/ctrl/ctrlcanvas.cpp +++ b/muse2/muse/ctrl/ctrlcanvas.cpp @@ -743,7 +743,7 @@ void CtrlCanvas::viewMousePressEvent(QMouseEvent* event) start = event->pos(); Tool activeTool = tool; - bool shift = event->modifiers() & Qt::ShiftModifier; + bool ctrlKey = event->modifiers() & Qt::ControlModifier; int xpos = start.x(); int ypos = start.y(); @@ -755,7 +755,7 @@ void CtrlCanvas::viewMousePressEvent(QMouseEvent* event) { bool do_redraw = false; - if (!shift) + if (!ctrlKey) { deselectAll(); do_redraw = true; @@ -780,7 +780,7 @@ void CtrlCanvas::viewMousePressEvent(QMouseEvent* event) break; if (ev->intersects(_controller, r, tickstep, h)) { - if (shift && ev->selected()) + if (ctrlKey && ev->selected()) deselectItem(ev); else selectItem(ev); @@ -797,7 +797,7 @@ void CtrlCanvas::viewMousePressEvent(QMouseEvent* event) break; case PencilTool: - if (shift) { + if (ctrlKey) { if (type != MidiController::Velo) { drag = DRAG_NEW; song->startUndo(); @@ -824,7 +824,7 @@ void CtrlCanvas::viewMousePressEvent(QMouseEvent* event) if (drawLineMode) { line2x = xpos; line2y = ypos; - if (shift) + if (ctrlKey) newValRamp(line1x, line1y, line2x, line2y); else changeValRamp(line1x, line1y, line2x, line2y); @@ -899,7 +899,7 @@ void CtrlCanvas::viewMouseMoveEvent(QMouseEvent* event) void CtrlCanvas::viewMouseReleaseEvent(QMouseEvent* event) { - bool shift = event->modifiers() & Qt::ShiftModifier; + bool ctrlKey = event->modifiers() & Qt::ControlModifier; switch (drag) { ///case DRAG_RESIZE: @@ -922,7 +922,7 @@ void CtrlCanvas::viewMouseReleaseEvent(QMouseEvent* event) case DRAG_LASSO: { - ///if (!shift) + ///if (!ctrlKey) /// deselectAll(); lasso = lasso.normalized(); int h = height(); @@ -932,9 +932,9 @@ void CtrlCanvas::viewMouseReleaseEvent(QMouseEvent* event) if((*i)->part() != curPart) continue; if ((*i)->intersects(_controller, lasso, tickstep, h)) { - if (shift && (*i)->selected()) + if (ctrlKey && (*i)->selected()) { - //if (!shift) // Shift p4.0.18 + //if (!ctrlKey) // ctrlKey p4.0.18 { ///deselectItem(*i); //do_redraw = true; @@ -2211,8 +2211,8 @@ void CtrlCanvas::drawOverlay(QPainter& p) if (noEvents) { //p.setFont(config.fonts[3]); //p.setPen(Qt::black); - //p.drawText(width()/2-100,height()/2-10, "Use shift + pencil or line tool to draw new events"); - p.drawText(2 , y * 2, "Use shift + pencil or line tool to draw new events"); + //p.drawText(width()/2-100,height()/2-10, "Use ctrlKey + pencil or line tool to draw new events"); + p.drawText(2 , y * 2, "Use ctrlKey + pencil or line tool to draw new events"); } } @@ -2232,7 +2232,7 @@ QRect CtrlCanvas::overlayRect() const r.translate(2, y); if (noEvents) { - QRect r2(fm.boundingRect(QString("Use shift + pencil or line tool to draw new events"))); + QRect r2(fm.boundingRect(QString("Use ctrlKey + pencil or line tool to draw new events"))); //r2.translate(width()/2-100, height()/2-10); r2.translate(2, y * 2); r |= r2; diff --git a/muse2/muse/midiedit/dcanvas.cpp b/muse2/muse/midiedit/dcanvas.cpp index 9c50c8b2..a21f04c0 100644 --- a/muse2/muse/midiedit/dcanvas.cpp +++ b/muse2/muse/midiedit/dcanvas.cpp @@ -1352,13 +1352,10 @@ void DrumCanvas::keyPress(QKeyEvent* event) if (_tool == CursorTool) { int key = event->key(); - ///if (event->state() & Qt::ShiftButton) if (((QInputEvent*)event)->modifiers() & Qt::ShiftModifier) key += Qt::SHIFT; - ///if (event->state() & Qt::AltButton) if (((QInputEvent*)event)->modifiers() & Qt::AltModifier) key += Qt::ALT; - ///if (event->state() & Qt::ControlButton) if (((QInputEvent*)event)->modifiers() & Qt::ControlModifier) key+= Qt::CTRL; diff --git a/muse2/muse/midiedit/dlist.cpp b/muse2/muse/midiedit/dlist.cpp index 3736d6aa..3b8670db 100644 --- a/muse2/muse/midiedit/dlist.cpp +++ b/muse2/muse/midiedit/dlist.cpp @@ -220,8 +220,6 @@ void DList::viewMousePressEvent(QMouseEvent* ev) int x = ev->x(); int y = ev->y(); int button = ev->button(); - ///bool shift = ev->state() & Qt::ShiftButton; - //bool shift = ev->modifiers() & Qt::ShiftModifier; unsigned pitch = y / TH; DrumMap* dm = &drumMap[pitch]; @@ -259,7 +257,6 @@ void DList::viewMousePressEvent(QMouseEvent* ev) break; case COL_PORT: if (button == Qt::RightButton) { - ///bool changeAll = ev->state() & Qt::ControlButton; bool changeAll = ev->modifiers() & Qt::ControlModifier; devicesPopupMenu(dm, mapx(x), mapy(pitch * TH), changeAll); } @@ -328,7 +325,6 @@ void DList::viewMousePressEvent(QMouseEvent* ev) else if (val > 127) val = 127; - ///if (ev->state() & Qt::ControlButton) { if (ev->modifiers() & Qt::ControlModifier) { audio->msgIdle(true); // Delete all port controller events. @@ -724,7 +720,6 @@ void DList::viewMouseReleaseEvent(QMouseEvent* ev) editor->setFocus(); int x = ev->x(); int y = ev->y(); - ///bool shift = ev->state() & Qt::ShiftButton; bool shift = ev->modifiers() & Qt::ShiftModifier; unsigned pitch = y / TH; diff --git a/muse2/muse/midiedit/pianoroll.cpp b/muse2/muse/midiedit/pianoroll.cpp index d008b35f..6b0e37cb 100644 --- a/muse2/muse/midiedit/pianoroll.cpp +++ b/muse2/muse/midiedit/pianoroll.cpp @@ -1045,13 +1045,10 @@ void PianoRoll::keyPressEvent(QKeyEvent* event) PianoCanvas* pc = (PianoCanvas*)canvas; int key = event->key(); - //if (event->state() & Qt::ShiftButton) if (((QInputEvent*)event)->modifiers() & Qt::ShiftModifier) key += Qt::SHIFT; - //if (event->state() & Qt::AltButton) if (((QInputEvent*)event)->modifiers() & Qt::AltModifier) key += Qt::ALT; - //if (event->state() & Qt::ControlButton) if (((QInputEvent*)event)->modifiers() & Qt::ControlModifier) key+= Qt::CTRL; diff --git a/muse2/muse/shortcuts.h b/muse2/muse/shortcuts.h index 1098be49..ede91d22 100644 --- a/muse2/muse/shortcuts.h +++ b/muse2/muse/shortcuts.h @@ -22,7 +22,7 @@ #define DEDIT_SHRT 2 // Drumedit shortcut #define LEDIT_SHRT 4 // Listedit shortcut #define SCORE_SHRT 8 // Score shortcut -#define ARRANG_SHRT 16 // Arrenger shortcut +#define ARRANG_SHRT 16 // Arranger shortcut #define TRANSP_SHRT 32 // Transport shortcut #define WAVE_SHRT 64 // Waveedit shortcut #define GLOBAL_SHRT 128 // Global shortcuts diff --git a/muse2/muse/widgets/canvas.cpp b/muse2/muse/widgets/canvas.cpp index 14f414b7..c12ac956 100644 --- a/muse2/muse/widgets/canvas.cpp +++ b/muse2/muse/widgets/canvas.cpp @@ -538,11 +538,11 @@ void Canvas::viewMousePressEvent(QMouseEvent* event) updateSelection(); redraw(); } - startDrag(curItem, shift); + startDrag(curItem, ctrl); } else if (event->button() == Qt::RightButton) { if (curItem) { - if (shift) { + if (ctrl) { drag = DRAG_RESIZE; setCursor(); int dx = start.x() - curItem->x(); @@ -586,15 +586,14 @@ void Canvas::viewMousePressEvent(QMouseEvent* event) // Changed by T356. Alt is default reserved for moving the whole window in KDE. Changed to Shift-Alt. // Hmm, nope, shift-alt is also reserved sometimes. Must find a way to bypass, // why make user turn off setting? Left alone for now... - if (shift && !ctrl) + if (ctrl && !shift) drag = DRAG_COPY_START; else if (alt) { drag = DRAG_CLONE_START; } - else if (ctrl) { //Select all on the same pitch (e.g. same y-value) - if (!shift) + else if (shift) { //Select all on the same pitch (e.g. same y-value) + if (!ctrl) deselectAll(); - //printf("Yes, ctrl and press\n"); for (iCItem i = items.begin(); i != items.end(); ++i) { if (i->second->y() == curItem->y() ) selectItem(i->second, true); @@ -1046,32 +1045,26 @@ void Canvas::viewMouseMoveEvent(QMouseEvent* event) void Canvas::viewMouseReleaseEvent(QMouseEvent* event) { -// printf("release %x %x\n", event->state(), event->button()); - doScroll = false; canScrollLeft = true; canScrollRight = true; canScrollUp = true; canScrollDown = true; - ///if (event->state() & (Qt::LeftButton|Qt::RightButton|Qt::MidButton) & ~(event->button())) { if (event->buttons() & (Qt::LeftButton|Qt::RightButton|Qt::MidButton) & ~(event->button())) { - ///printf("ignore %x %x\n", keyState, event->button()); - //printf("viewMouseReleaseEvent ignore buttons:%x mods:%x button:%x\n", (int)event->buttons(), (int)keyState, event->button()); return; } QPoint pos = event->pos(); - ///bool shift = event->state() & Qt::ShiftModifier; - bool shift = ((QInputEvent*)event)->modifiers() & Qt::ShiftModifier; + bool ctrl = ((QInputEvent*)event)->modifiers() & Qt::ControlModifier; bool redrawFlag = false; switch (drag) { case DRAG_MOVE_START: case DRAG_COPY_START: case DRAG_CLONE_START: - if (!shift) + if (!ctrl) deselectAll(); - selectItem(curItem, !(shift && curItem->isSelected())); + selectItem(curItem, !(ctrl && curItem->isSelected())); updateSelection(); redrawFlag = true; itemReleased(curItem, curItem->pos()); @@ -1114,17 +1107,17 @@ void Canvas::viewMouseReleaseEvent(QMouseEvent* event) break; case DRAG_LASSO_START: lasso.setRect(-1, -1, -1, -1); - if (!shift) + if (!ctrl) deselectAll(); updateSelection(); redrawFlag = true; break; case DRAG_LASSO: - if (!shift) + if (!ctrl) deselectAll(); lasso = lasso.normalized(); - selectLasso(shift); + selectLasso(ctrl); updateSelection(); redrawFlag = true; break; -- cgit v1.2.3 From 5d966672553cbdd483a75b9e6ae273be42922bb0 Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Mon, 9 May 2011 16:34:20 +0000 Subject: oops, sorry. forgot to save one silly change before committing --- muse2/muse/ctrl/ctrlcanvas.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/muse2/muse/ctrl/ctrlcanvas.cpp b/muse2/muse/ctrl/ctrlcanvas.cpp index 5e97ed90..64a17b4f 100644 --- a/muse2/muse/ctrl/ctrlcanvas.cpp +++ b/muse2/muse/ctrl/ctrlcanvas.cpp @@ -2211,8 +2211,8 @@ void CtrlCanvas::drawOverlay(QPainter& p) if (noEvents) { //p.setFont(config.fonts[3]); //p.setPen(Qt::black); - //p.drawText(width()/2-100,height()/2-10, "Use ctrlKey + pencil or line tool to draw new events"); - p.drawText(2 , y * 2, "Use ctrlKey + pencil or line tool to draw new events"); + //p.drawText(width()/2-100,height()/2-10, "Use shift + pencil or line tool to draw new events"); + p.drawText(2 , y * 2, "Use shift + pencil or line tool to draw new events"); } } -- cgit v1.2.3 From a92278628f21f30a759bc51736249e56b51dd969 Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Tue, 10 May 2011 15:40:57 +0000 Subject: score editor now displays the currently selected notes --- muse2/muse/ctrl/ctrlcanvas.cpp | 2 +- muse2/muse/midiedit/scoreedit.cpp | 11 +++++++++++ muse2/muse/midiedit/scoreedit.h | 5 +++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/muse2/muse/ctrl/ctrlcanvas.cpp b/muse2/muse/ctrl/ctrlcanvas.cpp index 64a17b4f..70d1ad63 100644 --- a/muse2/muse/ctrl/ctrlcanvas.cpp +++ b/muse2/muse/ctrl/ctrlcanvas.cpp @@ -2232,7 +2232,7 @@ QRect CtrlCanvas::overlayRect() const r.translate(2, y); if (noEvents) { - QRect r2(fm.boundingRect(QString("Use ctrlKey + pencil or line tool to draw new events"))); + QRect r2(fm.boundingRect(QString("Use shift + pencil or line tool to draw new events"))); //r2.translate(width()/2-100, height()/2-10); r2.translate(2, y * 2); r |= r2; diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index 9534abf9..c7170014 100644 --- a/muse2/muse/midiedit/scoreedit.cpp +++ b/muse2/muse/midiedit/scoreedit.cpp @@ -1145,6 +1145,11 @@ void ScoreCanvas::song_changed(int flags) redraw(); } + + if (flags & SC_SELECTION) + { + redraw(); + } } int ScoreCanvas::canvas_width() @@ -1223,6 +1228,7 @@ void ScoreCanvas::init_pixmaps() mycolors[i]=config.partColors[i]; mycolors[BLACK_PIXMAP]=Qt::black; mycolors[HIGHLIGHTED_PIXMAP]=Qt::red; + mycolors[SELECTED_PIXMAP]=QColor(255,160,0); for (int i=0; i<64; i++) mycolors[i+VELO_PIXMAP_BEGIN]=QColor(i*4,0,0xff); @@ -2698,9 +2704,14 @@ void ScoreCanvas::draw_items(QPainter& p, int y_offset, staff_t& staff, ScoreIte color_index=VELO_PIXMAP_BEGIN + it->source_event->velo(); break; } + + if (it->source_event->selected()) + color_index=SELECTED_PIXMAP; + if (audio->isPlaying() && it->is_active) color_index=HIGHLIGHTED_PIXMAP; + draw_pixmap(p,it->x -x_pos+x_left,y_offset + it->y,it->pix[color_index]); //draw dots diff --git a/muse2/muse/midiedit/scoreedit.h b/muse2/muse/midiedit/scoreedit.h index ed242aae..26687ea5 100644 --- a/muse2/muse/midiedit/scoreedit.h +++ b/muse2/muse/midiedit/scoreedit.h @@ -440,8 +440,9 @@ struct cumulative_t #define BLACK_PIXMAP (NUM_PARTCOLORS) #define HIGHLIGHTED_PIXMAP (NUM_PARTCOLORS+1) -#define NUM_MYCOLORS (NUM_PARTCOLORS+2 + 128) -#define VELO_PIXMAP_BEGIN (NUM_PARTCOLORS+2) +#define SELECTED_PIXMAP (NUM_PARTCOLORS+2) +#define NUM_MYCOLORS (NUM_PARTCOLORS+3 + 128) +#define VELO_PIXMAP_BEGIN (NUM_PARTCOLORS+3) struct timesig_t { -- cgit v1.2.3 From a2c25d50996ce03b117e1418e90ab497053caed0 Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Tue, 10 May 2011 16:10:42 +0000 Subject: the score editor can now select notes, however, not via lasso --- muse2/muse/midiedit/scoreedit.cpp | 35 ++++++++++++++++++++++++++++++++++- muse2/muse/midiedit/scoreedit.h | 4 ++++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index c7170014..c4c6b385 100644 --- a/muse2/muse/midiedit/scoreedit.cpp +++ b/muse2/muse/midiedit/scoreedit.cpp @@ -878,6 +878,7 @@ ScoreCanvas::ScoreCanvas(ScoreEdit* pr, QWidget* parent_widget, x_left=0; y_pos=0; dragging=false; + drag_cursor_changed=false; mouse_erases_notes=false; mouse_inserts_notes=true; @@ -3174,6 +3175,10 @@ int ScoreCanvas::y_to_pitch(int y, int t, clef_t clef) void ScoreCanvas::mousePressEvent (QMouseEvent* event) { + keystate=((QInputEvent*)event)->modifiers(); + + bool ctrl=keystate & Qt::ControlModifier; + // den errechneten tick immer ABrunden! // denn der "bereich" eines schlags geht von schlag_begin bis nÃĪchsterschlag_begin-1 // noten werden aber genau in die mitte dieses bereiches gezeichnet @@ -3183,6 +3188,10 @@ void ScoreCanvas::mousePressEvent (QMouseEvent* event) int y=event->y() + y_pos - staff_it->y_draw; int x=event->x()+x_pos-x_left; int tick=flo_quantize_floor(x_to_tick(x), quant_ticks()); + + if (event->button()==Qt::LeftButton) + if (!ctrl) + deselect_all(); if (staff_it!=staves.end()) { @@ -3283,9 +3292,12 @@ void ScoreCanvas::mousePressEvent (QMouseEvent* event) } else if (event->button()==Qt::LeftButton) //edit? { + set_it->source_event->setSelected(!set_it->source_event->selected()); + song_changed(SC_SELECTION); + setMouseTracking(true); dragging=true; - setCursor(Qt::SizeAllCursor); + drag_cursor_changed=false; song->startUndo(); } } @@ -3327,6 +3339,7 @@ void ScoreCanvas::mousePressEvent (QMouseEvent* event) newevent.setVeloOff(newnote_velo_off); newevent.setTick(relative_tick); newevent.setLenTick((new_len>0)?new_len:last_len); + newevent.setSelected(true); if (flo_quantize(newevent.lenTick(), quant_ticks()) <= 0) { @@ -3355,6 +3368,7 @@ void ScoreCanvas::mousePressEvent (QMouseEvent* event) setMouseTracking(true); dragging=true; + drag_cursor_changed=true; setCursor(Qt::SizeAllCursor); //song->startUndo(); unneccessary because we have started it already above } @@ -3385,6 +3399,7 @@ void ScoreCanvas::mouseReleaseEvent (QMouseEvent* event) setMouseTracking(false); unsetCursor(); dragging=false; + drag_cursor_changed=false; x_scroll_speed=0; x_scroll_pos=0; } @@ -3427,6 +3442,13 @@ void ScoreCanvas::mouseMoveEvent (QMouseEvent* event) int tick=flo_quantize_floor(x_to_tick(x), quant_ticks()); + + if ((drag_cursor_changed==false) && ((dx!=0) || (dy!=0))) + { + setCursor(Qt::SizeAllCursor); + drag_cursor_changed=true; + } + if (mouse_operation==NO_OP) { if ((abs(dx)>DRAG_INIT_DISTANCE) && (mouse_x_drag_operation!=NO_OP)) @@ -3873,6 +3895,17 @@ void ScoreCanvas::set_newnote_velo_off(int velo) newnote_velo_off=velo; } +void ScoreCanvas::deselect_all() +{ + set all_parts=get_all_parts(); + + for (set::iterator part=all_parts.begin(); part!=all_parts.end(); part++) + for (iEvent event=(*part)->events()->begin(); event!=(*part)->events()->end(); event++) + event->second.setSelected(false); + + song_changed(SC_SELECTION); +} + bool staff_t::cleanup_parts() { bool did_something=false; diff --git a/muse2/muse/midiedit/scoreedit.h b/muse2/muse/midiedit/scoreedit.h index 26687ea5..ee1d20c1 100644 --- a/muse2/muse/midiedit/scoreedit.h +++ b/muse2/muse/midiedit/scoreedit.h @@ -624,6 +624,7 @@ class ScoreCanvas : public View int last_len; int new_len; //when zero or negative, last_len is used + Qt::KeyboardModifiers keystate; QPoint mouse_down_pos; bool mouse_down; enum operation_t @@ -639,6 +640,7 @@ class ScoreCanvas : public View bool mouse_inserts_notes; bool dragging; + bool drag_cursor_changed; Part* dragged_event_part; Event dragged_event; int dragged_event_original_pitch; @@ -669,6 +671,8 @@ class ScoreCanvas : public View void play_changed(bool); void config_changed(); + + void deselect_all(); public slots: void x_scroll_event(int); -- cgit v1.2.3 From 8f13533997cb21f6cd1c523f888fd6f3e03cc22d Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Tue, 10 May 2011 17:13:03 +0000 Subject: implemented lasso selection --- muse2/muse/midiedit/scoreedit.cpp | 179 ++++++++++++++++++++++++-------------- muse2/muse/midiedit/scoreedit.h | 6 ++ 2 files changed, 121 insertions(+), 64 deletions(-) diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index c4c6b385..4471f48e 100644 --- a/muse2/muse/midiedit/scoreedit.cpp +++ b/muse2/muse/midiedit/scoreedit.cpp @@ -877,6 +877,7 @@ ScoreCanvas::ScoreCanvas(ScoreEdit* pr, QWidget* parent_widget, x_pos=0; x_left=0; y_pos=0; + have_lasso=false; dragging=false; drag_cursor_changed=false; mouse_erases_notes=false; @@ -3033,7 +3034,14 @@ void ScoreCanvas::draw(QPainter& p, const QRect&) draw_items(p,it->y_draw - y_pos, *it); p.setClipping(false); } - + + if (have_lasso) + { + p.setPen(Qt::blue); + p.setBrush(Qt::NoBrush); + p.drawRect(lasso); + } + if (debugMsg) cout << "drawing done." << endl; } @@ -3302,78 +3310,87 @@ void ScoreCanvas::mousePressEvent (QMouseEvent* event) } } else //we found nothing? - { - if ((event->button()==Qt::LeftButton) && (mouse_inserts_notes)) + if (event->button()==Qt::LeftButton) { - Part* curr_part = NULL; - set possible_dests=staff_it->parts_at_tick(tick); - - if (!possible_dests.empty()) + if (mouse_inserts_notes) { - if (possible_dests.size()==1) - curr_part=*possible_dests.begin(); - else + Part* curr_part = NULL; + set possible_dests=staff_it->parts_at_tick(tick); + + if (!possible_dests.empty()) { - if (possible_dests.find(selected_part)!=possible_dests.end()) - curr_part=selected_part; + if (possible_dests.size()==1) + curr_part=*possible_dests.begin(); else - QMessageBox::information(this, tr("Ambiguous part"), tr("There are two or more possible parts you could add the note to, but none matches the selected part. Please select the destination part by clicking on any note belonging to it and try again, or add a new stave containing only the destination part.")); - } - } - else - QMessageBox::information(this, tr("No part"), tr("There are no parts you could add the note to.")); - - if (curr_part!=NULL) - { - signed int relative_tick=(signed) tick - curr_part->tick(); - if (relative_tick<0) - cerr << "ERROR: THIS SHOULD NEVER HAPPEN: relative_tick is negative!" << endl; - song->startUndo(); - //stopping undo at the end of this function is unneccessary - //because we'll begin a drag right after it. finishing - //this drag will stop undo as well (in mouseReleaseEvent) - - Event newevent(Note); - newevent.setPitch(y_to_pitch(y,tick, staff_it->clef)); - newevent.setVelo(newnote_velo); - newevent.setVeloOff(newnote_velo_off); - newevent.setTick(relative_tick); - newevent.setLenTick((new_len>0)?new_len:last_len); - newevent.setSelected(true); - - if (flo_quantize(newevent.lenTick(), quant_ticks()) <= 0) - { - newevent.setLenTick(quant_ticks()); - if (debugMsg) cout << "inserted note's length would be invisible after quantisation (too short)." << endl << - " setting it to " << newevent.lenTick() << endl; + { + if (possible_dests.find(selected_part)!=possible_dests.end()) + curr_part=selected_part; + else + QMessageBox::information(this, tr("Ambiguous part"), tr("There are two or more possible parts you could add the note to, but none matches the selected part. Please select the destination part by clicking on any note belonging to it and try again, or add a new stave containing only the destination part.")); + } } + else + QMessageBox::information(this, tr("No part"), tr("There are no parts you could add the note to.")); - if (newevent.endTick() > curr_part->lenTick()) + if (curr_part!=NULL) { - if (debugMsg) cout << "clipping inserted note from len="<startUndo(); + //stopping undo at the end of this function is unneccessary + //because we'll begin a drag right after it. finishing + //this drag will stop undo as well (in mouseReleaseEvent) + + Event newevent(Note); + newevent.setPitch(y_to_pitch(y,tick, staff_it->clef)); + newevent.setVelo(newnote_velo); + newevent.setVeloOff(newnote_velo_off); + newevent.setTick(relative_tick); + newevent.setLenTick((new_len>0)?new_len:last_len); + newevent.setSelected(true); + + if (flo_quantize(newevent.lenTick(), quant_ticks()) <= 0) + { + newevent.setLenTick(quant_ticks()); + if (debugMsg) cout << "inserted note's length would be invisible after quantisation (too short)." << endl << + " setting it to " << newevent.lenTick() << endl; + } + + if (newevent.endTick() > curr_part->lenTick()) + { + if (debugMsg) cout << "clipping inserted note from len="< staff_t::parts_at_tick(unsigned tick) return result; } +void staff_t::apply_lasso(QRect rect, set& already_processed) +{ + for (ScoreItemList::iterator it=itemlist.begin(); it!=itemlist.end(); it++) + for (set::iterator it2=it->second.begin(); it2!=it->second.end(); it2++) + if (it2->type==FloItem::NOTE) + { + if (rect.contains(it2->x, it2->y)) + if (already_processed.find(it2->source_event)==already_processed.end()) + { + it2->source_event->setSelected(!it2->source_event->selected()); + already_processed.insert(it2->source_event); + } + } +} + //the following assertions are made: // pix_quarter.width() == pix_half.width() @@ -3971,13 +4020,14 @@ set staff_t::parts_at_tick(unsigned tick) /* BUGS and potential bugs + * o notes must not be moved to pitches <0 or >127 * o when the keymap is not used, this will probably lead to a bug * same when mastertrack is disabled * o tied notes don't work properly when there's a key-change in * between, for example, when a cis is tied to a des * * CURRENT TODO - * o support selections + * o use "DEL" for deleting all selected items * o let the user select the distance between staves, or do this * automatically? * o update translations @@ -3993,6 +4043,7 @@ set staff_t::parts_at_tick(unsigned tick) * and provide sane defaults * * less important stuff + * o support edge-scrolling when opening a lasso * o deal with expanding parts * o do all the song_changed(SC_EVENT_INSERTED) properly * o use bars instead of flags over groups of 8ths / 16ths etc diff --git a/muse2/muse/midiedit/scoreedit.h b/muse2/muse/midiedit/scoreedit.h index ee1d20c1..74bc0283 100644 --- a/muse2/muse/midiedit/scoreedit.h +++ b/muse2/muse/midiedit/scoreedit.h @@ -484,6 +484,8 @@ struct staff_t void process_itemlist(); void calc_item_pos(); + void apply_lasso(QRect rect, set& already_processed); + void recalculate() { create_appropriate_eventlist(); @@ -644,6 +646,10 @@ class ScoreCanvas : public View Part* dragged_event_part; Event dragged_event; int dragged_event_original_pitch; + + bool have_lasso; + QPoint lasso_start; + QRect lasso; -- cgit v1.2.3 From e9c43888de8601c940b428c3bc6012f2ffe9f68c Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Wed, 11 May 2011 12:38:56 +0000 Subject: implemented erasing notes with [delete] functions only indicate undo when something has really changed --- muse2/muse/functions.cpp | 199 +++++++++++++++++++++----------------- muse2/muse/functions.h | 1 + muse2/muse/midiedit/scoreedit.cpp | 21 +++- muse2/muse/midiedit/scoreedit.h | 1 + 4 files changed, 130 insertions(+), 92 deletions(-) diff --git a/muse2/muse/functions.cpp b/muse2/muse/functions.cpp index 980a5103..6a3af374 100644 --- a/muse2/muse/functions.cpp +++ b/muse2/muse/functions.cpp @@ -54,6 +54,20 @@ bool is_relevant(const Event& event, const Part* part, int range) } } + +map get_events(const set& parts, int range) +{ + map events; + + for (set::iterator part=parts.begin(); part!=parts.end(); part++) + for (iEvent event=(*part)->events()->begin(); event!=(*part)->events()->end(); event++) + if (is_relevant(event->second, *part, range)) + events.insert(pair(&event->second, *part)); + + return events; +} + + bool modify_notelen(const set& parts) { if (!gatetime_dialog->exec()) @@ -89,78 +103,72 @@ bool quantize_notes(const set& parts) void modify_velocity(const set& parts, int range, int rate, int offset) { - map events; - - for (set::iterator part=parts.begin(); part!=parts.end(); part++) - for (iEvent event=(*part)->events()->begin(); event!=(*part)->events()->end(); event++) - if (is_relevant(event->second, *part, range)) - events.insert(pair(&event->second, *part)); - - - song->startUndo(); + map events = get_events(parts, range); - for (map::iterator it=events.begin(); it!=events.end(); it++) + if (!events.empty()) { - Event& event=*(it->first); - Part* part=it->second; + song->startUndo(); - int velo = event.velo(); + for (map::iterator it=events.begin(); it!=events.end(); it++) + { + Event& event=*(it->first); + Part* part=it->second; + + int velo = event.velo(); - velo = (velo * rate) / 100; - velo += offset; + velo = (velo * rate) / 100; + velo += offset; - if (velo <= 0) - velo = 1; - else if (velo > 127) - velo = 127; - - if (event.velo() != velo) - { - Event newEvent = event.clone(); - newEvent.setVelo(velo); - // Indicate no undo, and do not do port controller values and clone parts. - audio->msgChangeEvent(event, newEvent, part, false, false, false); + if (velo <= 0) + velo = 1; + else if (velo > 127) + velo = 127; + + if (event.velo() != velo) + { + Event newEvent = event.clone(); + newEvent.setVelo(velo); + // Indicate no undo, and do not do port controller values and clone parts. + audio->msgChangeEvent(event, newEvent, part, false, false, false); + } } + + song->endUndo(SC_EVENT_MODIFIED); } - - song->endUndo(SC_EVENT_MODIFIED); } void modify_notelen(const set& parts, int range, int rate, int offset) { - map events; - - for (set::iterator part=parts.begin(); part!=parts.end(); part++) - for (iEvent event=(*part)->events()->begin(); event!=(*part)->events()->end(); event++) - if (is_relevant(event->second, *part, range)) - events.insert(pair(&event->second, *part)); + map events = get_events(parts, range); - - song->startUndo(); - - for (map::iterator it=events.begin(); it!=events.end(); it++) + if (!events.empty()) { - Event& event=*(it->first); - Part* part=it->second; + song->startUndo(); + + for (map::iterator it=events.begin(); it!=events.end(); it++) + { + Event& event=*(it->first); + Part* part=it->second; - unsigned int len = event.lenTick(); //prevent compiler warning: comparison singed/unsigned + unsigned int len = event.lenTick(); //prevent compiler warning: comparison singed/unsigned - len = (len * rate) / 100; - len += offset; + len = (len * rate) / 100; + len += offset; - if (len <= 0) - len = 1; - - if (event.lenTick() != len) - { - Event newEvent = event.clone(); - newEvent.setLenTick(len); - // Indicate no undo, and do not do port controller values and clone parts. - audio->msgChangeEvent(event, newEvent, part, false, false, false); + if (len <= 0) + len = 1; + + if (event.lenTick() != len) + { + Event newEvent = event.clone(); + newEvent.setLenTick(len); + // Indicate no undo, and do not do port controller values and clone parts. + audio->msgChangeEvent(event, newEvent, part, false, false, false); + } } + + song->endUndo(SC_EVENT_MODIFIED); } - - song->endUndo(SC_EVENT_MODIFIED); } unsigned quantize_tick(unsigned tick, unsigned raster, int swing) @@ -187,51 +195,68 @@ unsigned quantize_tick(unsigned tick, unsigned raster, int swing) void quantize_notes(const set& parts, int range, int raster, int strength, int swing, int threshold) { - map events; - - for (set::iterator part=parts.begin(); part!=parts.end(); part++) - for (iEvent event=(*part)->events()->begin(); event!=(*part)->events()->end(); event++) - if (is_relevant(event->second, *part, range)) - events.insert(pair(&event->second, *part)); - - - song->startUndo(); + map events = get_events(parts, range); - for (map::iterator it=events.begin(); it!=events.end(); it++) + if (!events.empty()) { - Event& event=*(it->first); - Part* part=it->second; + song->startUndo(); + + for (map::iterator it=events.begin(); it!=events.end(); it++) + { + Event& event=*(it->first); + Part* part=it->second; - unsigned begin_tick = event.tick() + part->tick(); - int begin_diff = quantize_tick(begin_tick, raster, swing) - begin_tick; + unsigned begin_tick = event.tick() + part->tick(); + int begin_diff = quantize_tick(begin_tick, raster, swing) - begin_tick; - if (abs(begin_diff) > threshold) - begin_tick = begin_tick + begin_diff*strength/100; + if (abs(begin_diff) > threshold) + begin_tick = begin_tick + begin_diff*strength/100; - unsigned len=event.lenTick(); - - unsigned end_tick = begin_tick + len; - int len_diff = quantize_tick(end_tick, raster, swing) - end_tick; + unsigned len=event.lenTick(); - if (abs(len_diff) > threshold) - len = len + len_diff*strength/100; + unsigned end_tick = begin_tick + len; + int len_diff = quantize_tick(end_tick, raster, swing) - end_tick; + + if (abs(len_diff) > threshold) + len = len + len_diff*strength/100; - if (len <= 0) - len = 1; + if (len <= 0) + len = 1; - - if ( (event.lenTick() != len) || (event.tick() + part->tick() != begin_tick) ) - { - Event newEvent = event.clone(); - newEvent.setTick(begin_tick - part->tick()); - newEvent.setLenTick(len); - // Indicate no undo, and do not do port controller values and clone parts. - audio->msgChangeEvent(event, newEvent, part, false, false, false); + + if ( (event.lenTick() != len) || (event.tick() + part->tick() != begin_tick) ) + { + Event newEvent = event.clone(); + newEvent.setTick(begin_tick - part->tick()); + newEvent.setLenTick(len); + // Indicate no undo, and do not do port controller values and clone parts. + audio->msgChangeEvent(event, newEvent, part, false, false, false); + } } + + song->endUndo(SC_EVENT_MODIFIED); } +} + +void erase_notes(const set& parts, int range) +{ + map events = get_events(parts, range); - song->endUndo(SC_EVENT_MODIFIED); + if (!events.empty()) + { + song->startUndo(); + + for (map::iterator it=events.begin(); it!=events.end(); it++) + { + Event& event=*(it->first); + Part* part=it->second; + + audio->msgDeleteEvent(event, part, false, false, false); + } + + song->endUndo(SC_EVENT_REMOVED); + } } diff --git a/muse2/muse/functions.h b/muse2/muse/functions.h index a71230a4..03d0ba88 100644 --- a/muse2/muse/functions.h +++ b/muse2/muse/functions.h @@ -29,6 +29,7 @@ std::set partlist_to_set(PartList* pl); void modify_velocity(const std::set& parts, int range, int rate, int offset=0); void modify_notelen(const std::set& parts, int range, int rate, int offset=0); void quantize_notes(const std::set& parts, int range, int raster, int strength=100, int swing=0, int threshold=0); +void erase_notes(const std::set& parts, int range); //the below functions automatically open the dialog //they return true if you click "ok" and false if "abort" diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index 4471f48e..02151227 100644 --- a/muse2/muse/midiedit/scoreedit.cpp +++ b/muse2/muse/midiedit/scoreedit.cpp @@ -3451,6 +3451,8 @@ void ScoreCanvas::mouseReleaseEvent (QMouseEvent* event) for (list::iterator it=staves.begin(); it!=staves.end(); it++) it->apply_lasso(lasso.translated(x_pos-x_left, y_pos - it->y_draw), already_processed); + song->update(SC_SELECTION); + have_lasso=false; redraw(); } @@ -3937,7 +3939,15 @@ void ScoreCanvas::deselect_all() for (iEvent event=(*part)->events()->begin(); event!=(*part)->events()->end(); event++) event->second.setSelected(false); - song_changed(SC_SELECTION); + song->update(SC_SELECTION); +} + +void ScoreCanvas::keyPressEvent(QKeyEvent* event) +{ + if (event->key()==Qt::Key_Delete) + { + erase_notes(get_all_parts(), 1); // 1 means "all selected" + } } bool staff_t::cleanup_parts() @@ -4027,12 +4037,9 @@ void staff_t::apply_lasso(QRect rect, set& already_processed) * between, for example, when a cis is tied to a des * * CURRENT TODO - * o use "DEL" for deleting all selected items * o let the user select the distance between staves, or do this * automatically? - * o update translations - * o remove ambiguous translation: "offset"="zeitversatz" - * this is ambigous in mod. note len and WRONG in mod. velo dialogs + * o don't indicate undo when only clicking on an item * * IMPORTANT TODO * o add a select-clef-toolbox for tracks @@ -4065,6 +4072,10 @@ void staff_t::apply_lasso(QRect rect, set& already_processed) * * * stuff for the other muse developers + * o update translations + * o remove ambiguous translation: "offset"="zeitversatz" + * this is ambigous in mod. note len and WRONG in mod. velo dialogs + * o process accurate timesignatures from muse's list (has to be implemented first in muse) * ( (2+2+3)/4 or (3+2+2)/4 instead of 7/4 ) * o maybe do expanding parts inside the msgChangeEvent or diff --git a/muse2/muse/midiedit/scoreedit.h b/muse2/muse/midiedit/scoreedit.h index 74bc0283..e46f408a 100644 --- a/muse2/muse/midiedit/scoreedit.h +++ b/muse2/muse/midiedit/scoreedit.h @@ -715,6 +715,7 @@ class ScoreCanvas : public View virtual void mouseMoveEvent (QMouseEvent* event); virtual void mouseReleaseEvent (QMouseEvent* event); virtual void resizeEvent(QResizeEvent*); + virtual void keyPressEvent(QKeyEvent* event); public: ScoreCanvas(ScoreEdit*, QWidget*, int, int); -- cgit v1.2.3 From 67a3e8f501f9df2646bfe6ad7aa3b08246e8f7ce Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Wed, 11 May 2011 13:24:19 +0000 Subject: not indicating undo any more when only clicking on a note --- muse2/muse/midiedit/scoreedit.cpp | 31 ++++++++++++++++++++++++++++--- muse2/muse/midiedit/scoreedit.h | 5 ++++- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index 02151227..a75c5b5b 100644 --- a/muse2/muse/midiedit/scoreedit.cpp +++ b/muse2/muse/midiedit/scoreedit.cpp @@ -882,6 +882,9 @@ ScoreCanvas::ScoreCanvas(ScoreEdit* pr, QWidget* parent_widget, drag_cursor_changed=false; mouse_erases_notes=false; mouse_inserts_notes=true; + + undo_started=false; + undo_flags=0; selected_part=NULL; @@ -3306,7 +3309,8 @@ void ScoreCanvas::mousePressEvent (QMouseEvent* event) setMouseTracking(true); dragging=true; drag_cursor_changed=false; - song->startUndo(); + undo_started=false; + undo_flags=SC_EVENT_MODIFIED; } } else //we found nothing? @@ -3338,6 +3342,8 @@ void ScoreCanvas::mousePressEvent (QMouseEvent* event) if (relative_tick<0) cerr << "ERROR: THIS SHOULD NEVER HAPPEN: relative_tick is negative!" << endl; song->startUndo(); + undo_started=true; + undo_flags=SC_EVENT_INSERTED | SC_EVENT_MODIFIED; //stopping undo at the end of this function is unneccessary //because we'll begin a drag right after it. finishing //this drag will stop undo as well (in mouseReleaseEvent) @@ -3412,7 +3418,9 @@ void ScoreCanvas::mouseReleaseEvent (QMouseEvent* event) } } - song->endUndo(SC_EVENT_MODIFIED); + if (undo_started) + song->endUndo(undo_flags); + setMouseTracking(false); unsetCursor(); dragging=false; @@ -3508,6 +3516,12 @@ void ScoreCanvas::mouseMoveEvent (QMouseEvent* event) if (dragged_event.pitch()!=new_pitch) { + if (!undo_started) + { + song->startUndo(); + undo_started=true; + } + Event tmp=dragged_event.clone(); tmp.setPitch(new_pitch); @@ -3522,6 +3536,12 @@ void ScoreCanvas::mouseMoveEvent (QMouseEvent* event) case BEGIN: if (dragged_event.tick()+dragged_event_part->tick() != unsigned(tick)) { + if (!undo_started) + { + song->startUndo(); + undo_started=true; + } + Event tmp=dragged_event.clone(); signed relative_tick=tick-signed(dragged_event_part->tick()); @@ -3560,6 +3580,12 @@ void ScoreCanvas::mouseMoveEvent (QMouseEvent* event) tick+=quant_ticks(); if (dragged_event.tick()+dragged_event.lenTick() + dragged_event_part->tick() != unsigned(tick)) { + if (!undo_started) + { + song->startUndo(); + undo_started=true; + } + Event tmp=dragged_event.clone(); signed relative_tick=tick-signed(dragged_event_part->tick()); signed new_len=relative_tick-dragged_event.tick(); @@ -4039,7 +4065,6 @@ void staff_t::apply_lasso(QRect rect, set& already_processed) * CURRENT TODO * o let the user select the distance between staves, or do this * automatically? - * o don't indicate undo when only clicking on an item * * IMPORTANT TODO * o add a select-clef-toolbox for tracks diff --git a/muse2/muse/midiedit/scoreedit.h b/muse2/muse/midiedit/scoreedit.h index e46f408a..920c150b 100644 --- a/muse2/muse/midiedit/scoreedit.h +++ b/muse2/muse/midiedit/scoreedit.h @@ -651,7 +651,10 @@ class ScoreCanvas : public View QPoint lasso_start; QRect lasso; - + bool undo_started; + int undo_flags; + + enum {COLOR_MODE_BLACK, COLOR_MODE_PART, COLOR_MODE_VELO} coloring_mode; bool preamble_contains_keysig; -- cgit v1.2.3 From 9de70ebf672b450c1e7d91adc0bdb96f6dc2c4de Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Wed, 11 May 2011 13:28:42 +0000 Subject: fixed endless-loop-bug by limiting note.pitch to 0..127 (i.e., valid ranges) --- muse2/muse/midiedit/scoreedit.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index a75c5b5b..65559efb 100644 --- a/muse2/muse/midiedit/scoreedit.cpp +++ b/muse2/muse/midiedit/scoreedit.cpp @@ -3513,7 +3513,10 @@ void ScoreCanvas::mouseMoveEvent (QMouseEvent* event) case PITCH: if (debugMsg) cout << "changing pitch, delta="< 127) new_pitch=127; + if (dragged_event.pitch()!=new_pitch) { if (!undo_started) @@ -4056,7 +4059,6 @@ void staff_t::apply_lasso(QRect rect, set& already_processed) /* BUGS and potential bugs - * o notes must not be moved to pitches <0 or >127 * o when the keymap is not used, this will probably lead to a bug * same when mastertrack is disabled * o tied notes don't work properly when there's a key-change in -- cgit v1.2.3 From 56b1d339a4176c07d4d995bd8912f1eccddc5539 Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Wed, 11 May 2011 16:14:24 +0000 Subject: the distance between staves now gets automatically increased to avoid stave A's note be drawn over stave B (or vice versa) --- muse2/muse/midiedit/scoreedit.cpp | 45 +++++++++++++++++++++++++++++++++------ muse2/muse/midiedit/scoreedit.h | 3 +++ 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index 65559efb..2bc87df8 100644 --- a/muse2/muse/midiedit/scoreedit.cpp +++ b/muse2/muse/midiedit/scoreedit.cpp @@ -104,6 +104,10 @@ QString IntToQStr(int i); #define STAFF_DISTANCE (10*YLEN) #define GRANDSTAFF_DISTANCE (8*YLEN) +#define NOTE_YDIST 20 +//NOTE_YDIST is the number of pixels which are between two notes +//which exceed their staves' y-boundaries, so that these boundaries +//must be expanded. QString create_random_string(int len=8) { @@ -858,8 +862,8 @@ void ScoreCanvas::add_staves(PartList* pl, bool all_in_one) } cleanup_staves(); - recalc_staff_pos(); song_changed(SC_EVENT_INSERTED); + recalc_staff_pos(); } @@ -996,8 +1000,8 @@ void ScoreCanvas::set_staffmode(list::iterator it, staff_mode_t mode) cerr << "ERROR: ILLEGAL FUNCTION CALL: invalid mode in set_staffmode" << endl; } - recalc_staff_pos(); song_changed(SC_EVENT_INSERTED); + recalc_staff_pos(); } void ScoreCanvas::remove_staff(list::iterator it) @@ -1022,8 +1026,8 @@ void ScoreCanvas::remove_staff(list::iterator it) } maybe_close_if_empty(); - recalc_staff_pos(); song_changed(SC_EVENT_INSERTED); + recalc_staff_pos(); } void ScoreCanvas::merge_staves(list::iterator dest, list::iterator src) @@ -1058,8 +1062,8 @@ void ScoreCanvas::merge_staves(list::iterator dest, list::iter remove_staff(src); - recalc_staff_pos(); song_changed(SC_EVENT_INSERTED); + recalc_staff_pos(); } void ScoreCanvas::move_staff_above(list::iterator dest, list::iterator src) @@ -1089,8 +1093,8 @@ void ScoreCanvas::move_staff_above(list::iterator dest, list:: staves.splice(dest, staves, src, src_end); - recalc_staff_pos(); song_changed(SC_EVENT_INSERTED); + recalc_staff_pos(); } void ScoreCanvas::move_staff_below(list::iterator dest, list::iterator src) @@ -1127,6 +1131,8 @@ void ScoreCanvas::song_changed(int flags) for (list::iterator it=staves.begin(); it!=staves.end(); it++) it->recalculate(); + + recalc_staff_pos(); redraw(); emit canvas_width_changed(canvas_width()); @@ -1143,11 +1149,12 @@ void ScoreCanvas::song_changed(int flags) } cleanup_staves(); - recalc_staff_pos(); for (list::iterator it=staves.begin(); it!=staves.end(); it++) it->recalculate(); + recalc_staff_pos(); + redraw(); } @@ -2444,6 +2451,9 @@ void staff_t::calc_item_pos() //key signature is properly drawn. int pos_add=0; + max_y_coord=0; + min_y_coord=0; + for (ScoreItemList::iterator it2=itemlist.begin(); it2!=itemlist.end(); it2++) { for (set::iterator it=it2->second.begin(); it!=it2->second.end();it++) @@ -2454,6 +2464,9 @@ void staff_t::calc_item_pos() if (it->type==FloItem::NOTE) { + if (it->y > max_y_coord) max_y_coord=it->y; + if (it->y < min_y_coord) min_y_coord=it->y; + it->x+=parent->note_x_indent() + it->shift*NOTE_SHIFT; switch (it->len) @@ -2527,6 +2540,9 @@ void staff_t::calc_item_pos() } } } + + max_y_coord+= (pix_quarter->height()/2 +NOTE_YDIST/2); + min_y_coord-= (pix_quarter->height()/2 +NOTE_YDIST/2); } void ScoreCanvas::calc_pos_add_list() @@ -3797,16 +3813,33 @@ void ScoreCanvas::recalc_staff_pos() { case NORMAL: it->y_draw = it->y_top + STAFF_DISTANCE/2; + if (it->min_y_coord < -STAFF_DISTANCE/2) + it->y_draw+= (-it->min_y_coord - STAFF_DISTANCE/2); + it->y_bottom = it->y_draw + STAFF_DISTANCE/2; + if (it->max_y_coord > STAFF_DISTANCE/2) + it->y_bottom+= (it->max_y_coord - STAFF_DISTANCE/2); + break; + case GRAND_TOP: it->y_draw = it->y_top + STAFF_DISTANCE/2; + if (it->min_y_coord < -STAFF_DISTANCE/2) + it->y_draw+= (-it->min_y_coord - STAFF_DISTANCE/2); + it->y_bottom = it->y_draw + GRANDSTAFF_DISTANCE/2; + break; + case GRAND_BOTTOM: it->y_draw = it->y_top + GRANDSTAFF_DISTANCE/2; + it->y_bottom = it->y_draw + STAFF_DISTANCE/2; + if (it->max_y_coord > STAFF_DISTANCE/2) + it->y_bottom+= (it->max_y_coord - STAFF_DISTANCE/2); + break; + default: cerr << "ERROR: THIS SHOULD NEVER HAPPEN: invalid staff type!" << endl; } diff --git a/muse2/muse/midiedit/scoreedit.h b/muse2/muse/midiedit/scoreedit.h index 920c150b..ceb41679 100644 --- a/muse2/muse/midiedit/scoreedit.h +++ b/muse2/muse/midiedit/scoreedit.h @@ -474,6 +474,9 @@ struct staff_t int y_draw; int y_bottom; + int min_y_coord; + int max_y_coord; + staff_type_t type; clef_t clef; -- cgit v1.2.3 From 0ec79fb4c59be4adb77d3dcbc068dee7107ed381 Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Sat, 14 May 2011 13:29:32 +0000 Subject: - removed unneccessary _to and _quant* - stuff from piano roll and drum edit this also involved changing the Toolbar1 - removed unneccessary short cuts: SHRT_OVER_QUANTIZE etc. instead added SHRT_QUANTIZE - changed behaviour for scripts: the "quant"-parameter they get isn't the quant-combo's setting, but the snap-combo's now - changed behaviour for step-recording: the note-length is now the "raster"- value instead of the "quant"-value --- muse2/muse/liste/listedit.cpp | 2 +- muse2/muse/master/masteredit.cpp | 2 +- muse2/muse/midiedit/dcanvas.h | 3 +- muse2/muse/midiedit/drumedit.cpp | 38 ++++--------------- muse2/muse/midiedit/drumedit.h | 8 +--- muse2/muse/midiedit/pianoroll.cpp | 62 +++--------------------------- muse2/muse/midiedit/pianoroll.h | 15 +------- muse2/muse/midiedit/prcanvas.cpp | 6 ++- muse2/muse/midieditor.cpp | 19 +--------- muse2/muse/midieditor.h | 7 +--- muse2/muse/shortcuts.cpp | 10 ++--- muse2/muse/shortcuts.h | 5 --- muse2/muse/waveedit/waveedit.cpp | 2 +- muse2/muse/widgets/tb1.cpp | 79 +++------------------------------------ muse2/muse/widgets/tb1.h | 8 +--- 15 files changed, 40 insertions(+), 226 deletions(-) diff --git a/muse2/muse/liste/listedit.cpp b/muse2/muse/liste/listedit.cpp index 11e9cfc5..080ee01c 100644 --- a/muse2/muse/liste/listedit.cpp +++ b/muse2/muse/liste/listedit.cpp @@ -445,7 +445,7 @@ QString EventListItem::text(int col) const //--------------------------------------------------------- ListEdit::ListEdit(PartList* pl) - : MidiEditor(0, 0, pl) + : MidiEditor(0, pl) { insertItems = new QActionGroup(this); insertItems->setExclusive(false); diff --git a/muse2/muse/master/masteredit.cpp b/muse2/muse/master/masteredit.cpp index 2b91ae90..17d390e9 100644 --- a/muse2/muse/master/masteredit.cpp +++ b/muse2/muse/master/masteredit.cpp @@ -77,7 +77,7 @@ void MasterEdit::songChanged(int type) //--------------------------------------------------------- MasterEdit::MasterEdit() - : MidiEditor(0, _rasterInit, 0) + : MidiEditor(_rasterInit, 0) { setWindowTitle(tr("MusE: Mastertrack")); _raster = 0; // measure diff --git a/muse2/muse/midiedit/dcanvas.h b/muse2/muse/midiedit/dcanvas.h index 4e05a422..deb3a096 100644 --- a/muse2/muse/midiedit/dcanvas.h +++ b/muse2/muse/midiedit/dcanvas.h @@ -90,7 +90,8 @@ class DrumCanvas : public EventCanvas { CMD_CUT, CMD_COPY, CMD_PASTE, CMD_SAVE, CMD_LOAD, CMD_RESET, CMD_SELECT_ALL, CMD_SELECT_NONE, CMD_SELECT_INVERT, CMD_SELECT_ILOOP, CMD_SELECT_OLOOP, CMD_SELECT_PREV_PART, CMD_SELECT_NEXT_PART, - CMD_DEL, CMD_FIXED_LEN, CMD_RIGHT, CMD_LEFT, CMD_RIGHT_NOSNAP, CMD_LEFT_NOSNAP, CMD_MODIFY_VELOCITY + CMD_DEL, CMD_FIXED_LEN, CMD_RIGHT, CMD_LEFT, CMD_RIGHT_NOSNAP, CMD_LEFT_NOSNAP, CMD_MODIFY_VELOCITY, + CMD_QUANTIZE }; DrumCanvas(MidiEditor*, QWidget*, int, int, const char* name = 0); diff --git a/muse2/muse/midiedit/drumedit.cpp b/muse2/muse/midiedit/drumedit.cpp index d9029969..84d4bf5b 100644 --- a/muse2/muse/midiedit/drumedit.cpp +++ b/muse2/muse/midiedit/drumedit.cpp @@ -60,13 +60,11 @@ static const char* map_file_save_pattern[] = { }; */ -int DrumEdit::_quantInit = 96; int DrumEdit::_rasterInit = 96; int DrumEdit::_widthInit = 600; int DrumEdit::_heightInit = 400; int DrumEdit::_dlistWidthInit = 50; int DrumEdit::_dcanvasWidthInit = 300; -int DrumEdit::_toInit = 0; static const int xscale = -10; static const int yscale = 1; @@ -156,12 +154,11 @@ void DrumEdit::closeEvent(QCloseEvent* e) //--------------------------------------------------------- DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned initPos) - : MidiEditor(_quantInit, _rasterInit, pl, parent, name) + : MidiEditor(_rasterInit, pl, parent, name) { split1w1 = 0; resize(_widthInit, _heightInit); selPart = 0; - _to = _toInit; QSignalMapper *signalMapper = new QSignalMapper(this); //---------Pulldown Menu---------------------------- @@ -236,12 +233,15 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini fixedAction = menuFunctions->addAction(tr("Set Fixed Length")); veloAction = menuFunctions->addAction(tr("Modify Velocity")); + quantizeAction = menuFunctions->addAction(tr("Quantize")); connect(fixedAction, SIGNAL(triggered()), signalMapper, SLOT(map())); connect(veloAction, SIGNAL(triggered()), signalMapper, SLOT(map())); + connect(quantizeAction, SIGNAL(triggered()), signalMapper, SLOT(map())); signalMapper->setMapping(fixedAction, DrumCanvas::CMD_FIXED_LEN); signalMapper->setMapping(veloAction, DrumCanvas::CMD_MODIFY_VELOCITY); + signalMapper->setMapping(quantizeAction, DrumCanvas::CMD_QUANTIZE); QMenu* menuScriptPlugins = menuBar()->addMenu(tr("&Plugins")); song->populateScriptMenu(menuScriptPlugins, this); @@ -318,7 +318,7 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini addToolBarBreak(); // don't show pitch value in toolbar - toolbar = new Toolbar1(this, _rasterInit, _quantInit, false); + toolbar = new Toolbar1(this, _rasterInit, false); addToolBar(toolbar); addToolBarBreak(); @@ -455,7 +455,6 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini // connect toolbar connect(canvas, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned))); connect(time, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned))); - connect(toolbar, SIGNAL(quantChanged(int)), SLOT(setQuant(int))); connect(toolbar, SIGNAL(rasterChanged(int)), SLOT(setRaster(int))); connect(toolbar, SIGNAL(soloChanged(bool)), SLOT(soloChanged(bool))); connect(info, SIGNAL(valueChanged(NoteInfo::ValType, int)), SLOT(noteinfoChanged(NoteInfo::ValType, int))); @@ -601,16 +600,6 @@ void DrumEdit::setRaster(int val) canvas->redrawGrid(); } -//--------------------------------------------------------- -// setQuant -//--------------------------------------------------------- - -void DrumEdit::setQuant(int val) - { - _quantInit = val; - MidiEditor::setQuant(val); - } - //--------------------------------------------------------- // edit currently selected Event //--------------------------------------------------------- @@ -721,10 +710,8 @@ void DrumEdit::readStatus(Xml& xml) break; case Xml::TagEnd: if (tag == "drumedit") { - _quantInit = _quant; _rasterInit = _raster; toolbar->setRaster(_raster); - toolbar->setQuant(_quant); canvas->redrawGrid(); return; } @@ -748,9 +735,7 @@ void DrumEdit::readConfiguration(Xml& xml) case Xml::End: return; case Xml::TagStart: - if (tag == "quant") - _quantInit = xml.parseInt(); - else if (tag == "raster") + if (tag == "raster") _rasterInit = xml.parseInt(); else if (tag == "width") _widthInit = xml.parseInt(); @@ -760,9 +745,6 @@ void DrumEdit::readConfiguration(Xml& xml) _dcanvasWidthInit = xml.parseInt(); else if (tag == "dlistwidth") _dlistWidthInit = xml.parseInt(); - else if (tag == "to") { - _toInit = xml.parseInt(); - } else xml.unknown("DrumEdit"); break; @@ -783,13 +765,11 @@ void DrumEdit::readConfiguration(Xml& xml) void DrumEdit::writeConfiguration(int level, Xml& xml) { xml.tag(level++, "drumedit"); - xml.intTag(level, "quant", _quantInit); xml.intTag(level, "raster", _rasterInit); xml.intTag(level, "width", _widthInit); xml.intTag(level, "height", _heightInit); xml.intTag(level, "dlistwidth", _dlistWidthInit); xml.intTag(level, "dcanvaswidth", _dcanvasWidthInit); - xml.intTag(level, "to", _toInit); xml.tag(level, "/drumedit"); } @@ -1231,9 +1211,7 @@ void DrumEdit::keyPressEvent(QKeyEvent* event) event->ignore(); return; } - setQuant(val); setRaster(val); - toolbar->setQuant(_quant); toolbar->setRaster(_raster); } @@ -1273,7 +1251,7 @@ void DrumEdit::execDeliveredScript(int id) { //QString scriptfile = QString(INSTPREFIX) + SCRIPTSSUFFIX + deliveredScriptNames[id]; QString scriptfile = song->getScriptPath(id, true); - song->executeScript(scriptfile.toLatin1().constData(), parts(), quant(), true); + song->executeScript(scriptfile.toLatin1().constData(), parts(), raster(), true); } //--------------------------------------------------------- @@ -1282,7 +1260,7 @@ void DrumEdit::execDeliveredScript(int id) void DrumEdit::execUserScript(int id) { QString scriptfile = song->getScriptPath(id, false); - song->executeScript(scriptfile.toLatin1().constData(), parts(), quant(), true); + song->executeScript(scriptfile.toLatin1().constData(), parts(), raster(), true); } void DrumEdit::setStep(QString v) diff --git a/muse2/muse/midiedit/drumedit.h b/muse2/muse/midiedit/drumedit.h index 02a1a5cc..dd3ad223 100644 --- a/muse2/muse/midiedit/drumedit.h +++ b/muse2/muse/midiedit/drumedit.h @@ -66,15 +66,13 @@ class DrumEdit : public MidiEditor { QToolBar* tools; QComboBox *stepLenWidget; - static int _quantInit, _rasterInit; + static int _rasterInit; static int _widthInit, _heightInit; static int _dlistWidthInit, _dcanvasWidthInit; - static int _toInit; //Used in function dialog for applying modification to selection - QAction *loadAction, *saveAction, *resetAction; QAction *cutAction, *copyAction, *pasteAction, *deleteAction; - QAction *fixedAction, *veloAction; + QAction *fixedAction, *veloAction, *quantizeAction; QAction *sallAction, *snoneAction, *invAction, *inAction , *outAction; QAction *prevAction, *nextAction; @@ -85,13 +83,11 @@ class DrumEdit : public MidiEditor { QWidget* genToolbar(QWidget* parent); virtual void resizeEvent(QResizeEvent*); virtual void keyPressEvent(QKeyEvent*); - int _to;//TODO: Make this work void setHeaderToolTips(); void setHeaderWhatsThis(); private slots: void setRaster(int); - void setQuant(int); void noteinfoChanged(NoteInfo::ValType type, int val); //CtrlEdit* addCtrl(); void removeCtrl(CtrlEdit* ctrl); diff --git a/muse2/muse/midiedit/pianoroll.cpp b/muse2/muse/midiedit/pianoroll.cpp index 6b0e37cb..153199cd 100644 --- a/muse2/muse/midiedit/pianoroll.cpp +++ b/muse2/muse/midiedit/pianoroll.cpp @@ -52,14 +52,9 @@ #include "mtrackinfo.h" -int PianoRoll::_quantInit = 96; int PianoRoll::_rasterInit = 96; int PianoRoll::_widthInit = 600; int PianoRoll::_heightInit = 400; -int PianoRoll::_quantStrengthInit = 80; // 1 - 100% -int PianoRoll::_quantLimitInit = 50; // tick value -bool PianoRoll::_quantLenInit = false; -int PianoRoll::_toInit = 0; int PianoRoll::colorModeInit = 0; static const int xscale = -10; @@ -73,16 +68,12 @@ static int pianorollTools = PointerTool | PencilTool | RubberTool | DrawTool; //--------------------------------------------------------- PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned initPos) - : MidiEditor(_quantInit, _rasterInit, pl, parent, name) + : MidiEditor(_rasterInit, pl, parent, name) { deltaMode = false; resize(_widthInit, _heightInit); selPart = 0; _playEvents = false; - _quantStrength = _quantStrengthInit; - _quantLimit = _quantLimitInit; - _quantLen = _quantLenInit; - _to = _toInit; colorMode = colorModeInit; QSignalMapper* mapper = new QSignalMapper(this); @@ -299,7 +290,7 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i transport->addActions(transportAction->actions()); addToolBarBreak(); - toolbar = new Toolbar1(this, _rasterInit, _quantInit); + toolbar = new Toolbar1(this, _rasterInit); addToolBar(toolbar); addToolBarBreak(); @@ -497,9 +488,7 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i connect(canvas, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned))); connect(piano, SIGNAL(pitchChanged(int)), toolbar, SLOT(setPitch(int))); connect(time, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned))); - connect(toolbar, SIGNAL(quantChanged(int)), SLOT(setQuant(int))); connect(toolbar, SIGNAL(rasterChanged(int)),SLOT(setRaster(int))); - connect(toolbar, SIGNAL(toChanged(int)), SLOT(setTo(int))); connect(toolbar, SIGNAL(soloChanged(bool)), SLOT(soloChanged(bool))); setFocusPolicy(Qt::StrongFocus); @@ -821,18 +810,8 @@ void PianoRoll::readConfiguration(Xml& xml) const QString& tag = xml.s1(); switch (token) { case Xml::TagStart: - if (tag == "quant") - _quantInit = xml.parseInt(); - else if (tag == "raster") + if (tag == "raster") _rasterInit = xml.parseInt(); - else if (tag == "quantStrength") - _quantStrengthInit = xml.parseInt(); - else if (tag == "quantLimit") - _quantLimitInit = xml.parseInt(); - else if (tag == "quantLen") - _quantLenInit = xml.parseInt(); - else if (tag == "to") - _toInit = xml.parseInt(); else if (tag == "colormode") colorModeInit = xml.parseInt(); else if (tag == "width") @@ -858,12 +837,7 @@ void PianoRoll::readConfiguration(Xml& xml) void PianoRoll::writeConfiguration(int level, Xml& xml) { xml.tag(level++, "pianoroll"); - xml.intTag(level, "quant", _quantInit); xml.intTag(level, "raster", _rasterInit); - xml.intTag(level, "quantStrength", _quantStrengthInit); - xml.intTag(level, "quantLimit", _quantLimitInit); - xml.intTag(level, "quantLen", _quantLenInit); - xml.intTag(level, "to", _toInit); xml.intTag(level, "width", _widthInit); xml.intTag(level, "height", _heightInit); xml.intTag(level, "colormode", colorModeInit); @@ -893,17 +867,6 @@ void PianoRoll::setRaster(int val) canvas->setFocus(); // give back focus after kb input } -//--------------------------------------------------------- -// setQuant -//--------------------------------------------------------- - -void PianoRoll::setQuant(int val) - { - _quantInit = val; - MidiEditor::setQuant(val); - canvas->setFocus(); - } - //--------------------------------------------------------- // writeStatus //--------------------------------------------------------- @@ -924,9 +887,6 @@ void PianoRoll::writeStatus(int level, Xml& xml) const xml.intTag(level, "steprec", canvas->steprec()); xml.intTag(level, "midiin", canvas->midiin()); xml.intTag(level, "tool", int(canvas->tool())); - xml.intTag(level, "quantStrength", _quantStrength); - xml.intTag(level, "quantLimit", _quantLimit); - xml.intTag(level, "quantLen", _quantLen); xml.intTag(level, "playEvents", _playEvents); xml.intTag(level, "xpos", hscroll->pos()); xml.intTag(level, "xmag", hscroll->mag()); @@ -973,12 +933,6 @@ void PianoRoll::readStatus(Xml& xml) splitter->readStatus(xml); else if (tag == hsplitter->objectName()) hsplitter->readStatus(xml); - else if (tag == "quantStrength") - _quantStrength = xml.parseInt(); - else if (tag == "quantLimit") - _quantLimit = xml.parseInt(); - else if (tag == "quantLen") - _quantLen = xml.parseInt(); else if (tag == "playEvents") { _playEvents = xml.parseInt(); canvas->playEvents(_playEvents); @@ -997,10 +951,8 @@ void PianoRoll::readStatus(Xml& xml) break; case Xml::TagEnd: if (tag == "pianoroll") { - _quantInit = _quant; _rasterInit = _raster; toolbar->setRaster(_raster); - toolbar->setQuant(_quant); canvas->redrawGrid(); return; } @@ -1179,9 +1131,7 @@ void PianoRoll::keyPressEvent(QKeyEvent* event) event->ignore(); return; } - setQuant(val); setRaster(val); - toolbar->setQuant(_quant); toolbar->setRaster(_raster); } @@ -1306,7 +1256,7 @@ void PianoRoll::initShortcuts() //evColorPitchAction->setShortcut(shortcuts[ ].key); //evColorVelAction->setShortcut(shortcuts[ ].key); - funcQuantizeAction->setShortcut(shortcuts[SHRT_OVER_QUANTIZE].key); //FINDMICH TODO FLO + funcQuantizeAction->setShortcut(shortcuts[SHRT_QUANTIZE].key); funcGateTimeAction->setShortcut(shortcuts[SHRT_MODIFY_GATE_TIME].key); funcModVelAction->setShortcut(shortcuts[SHRT_MODIFY_VELOCITY].key); @@ -1332,7 +1282,7 @@ void PianoRoll::execDeliveredScript(int id) { //QString scriptfile = QString(INSTPREFIX) + SCRIPTSSUFFIX + deliveredScriptNames[id]; QString scriptfile = song->getScriptPath(id, true); - song->executeScript(scriptfile.toAscii().data(), parts(), quant(), true); + song->executeScript(scriptfile.toAscii().data(), parts(), raster(), true); } //--------------------------------------------------------- @@ -1341,7 +1291,7 @@ void PianoRoll::execDeliveredScript(int id) void PianoRoll::execUserScript(int id) { QString scriptfile = song->getScriptPath(id, false); - song->executeScript(scriptfile.toAscii().data(), parts(), quant(), true); + song->executeScript(scriptfile.toAscii().data(), parts(), raster(), true); } //--------------------------------------------------------- diff --git a/muse2/muse/midiedit/pianoroll.h b/muse2/muse/midiedit/pianoroll.h index 87bf52b6..32be3bea 100644 --- a/muse2/muse/midiedit/pianoroll.h +++ b/muse2/muse/midiedit/pianoroll.h @@ -119,19 +119,11 @@ class PianoRoll : public MidiEditor { int colorMode; - static int _quantInit, _rasterInit; + static int _rasterInit; static int _widthInit, _heightInit; - static int _quantStrengthInit; - static int _quantLimitInit; - static bool _quantLenInit; - static int _toInit; static int colorModeInit; - int _quantStrength; - int _quantLimit; - int _to; - bool _quantLen; bool _playEvents; //QScrollBar* infoScroll; @@ -153,13 +145,8 @@ class PianoRoll : public MidiEditor { void soloChanged(bool flag); //void trackInfoScroll(int); void setRaster(int); - void setQuant(int); - void setQuantStrength(int val) { _quantStrength = val; } - void setQuantLimit(int val) { _quantLimit = val; } - void setQuantLen(bool val) { _quantLen = val; } void cmd(int); void setSteprec(bool); - void setTo(int val) { _to = val; } void eventColorModeChanged(int); void clipboardChanged(); // enable/disable "Paste" void selectionChanged(); // enable/disable "Copy" & "Paste" diff --git a/muse2/muse/midiedit/prcanvas.cpp b/muse2/muse/midiedit/prcanvas.cpp index 2966cf71..5f3def81 100644 --- a/muse2/muse/midiedit/prcanvas.cpp +++ b/muse2/muse/midiedit/prcanvas.cpp @@ -1134,7 +1134,11 @@ void PianoCanvas::midiNote(int pitch, int velo) && !audio->isPlaying() && velo && pos[0] >= start_tick && pos[0] < end_tick && !(globalKeyState & Qt::AltModifier)) { - unsigned int len = editor->quant();//prevent compiler warning: comparison singed/unsigned + //len has been changed by flo: set to raster() instead of quant() + //reason: the quant-toolbar has been removed; the flexibility you + //lose with this can be re-gained by applying a "modify note len" + //on the notes you have entered. + unsigned int len = editor->raster();//prevent compiler warning: comparison singed/unsigned unsigned tick = pos[0]; //CDW unsigned starttick = tick; if (globalKeyState & Qt::ShiftModifier) diff --git a/muse2/muse/midieditor.cpp b/muse2/muse/midieditor.cpp index 9191233d..2a6d8750 100644 --- a/muse2/muse/midieditor.cpp +++ b/muse2/muse/midieditor.cpp @@ -23,7 +23,7 @@ // MidiEditor //--------------------------------------------------------- -MidiEditor::MidiEditor(int q, int r, PartList* pl, +MidiEditor::MidiEditor(int r, PartList* pl, QWidget* parent, const char* name) : TopWin(parent, name) { setAttribute(Qt::WA_DeleteOnClose); @@ -31,7 +31,6 @@ MidiEditor::MidiEditor(int q, int r, PartList* pl, if (_pl) for (iPart i = _pl->begin(); i != _pl->end(); ++i) _parts.push_back(i->second->sn()); - _quant = q; _raster = r; canvas = 0; wview = 0; @@ -81,17 +80,6 @@ MidiEditor::~MidiEditor() delete _pl; } -//--------------------------------------------------------- -// quantVal -//--------------------------------------------------------- - -int MidiEditor::quantVal(int v) const - { - int val = ((v+_quant/2)/_quant)*_quant; - if (val == 0) - val = _quant; - return val; - } //--------------------------------------------------------- // readStatus @@ -110,9 +98,7 @@ void MidiEditor::readStatus(Xml& xml) case Xml::End: return; case Xml::TagStart: - if (tag == "quant") - _quant = xml.parseInt(); - else if (tag == "raster") + if (tag == "raster") _raster = xml.parseInt(); else if (tag == "topwin") TopWin::readStatus(xml); @@ -155,7 +141,6 @@ void MidiEditor::writeStatus(int level, Xml& xml) const { xml.tag(level++, "midieditor"); TopWin::writeStatus(level, xml); - xml.intTag(level, "quant", _quant); xml.intTag(level, "raster", _raster); xml.tag(level, "/midieditor"); } diff --git a/muse2/muse/midieditor.h b/muse2/muse/midieditor.h index 1f465c2d..00272529 100644 --- a/muse2/muse/midieditor.h +++ b/muse2/muse/midieditor.h @@ -44,7 +44,7 @@ class MidiEditor : public TopWin { WaveView* wview; std::list ctrlEditList; - int _quant, _raster; + int _raster; QGridLayout* mainGrid; QWidget* mainw; virtual void readStatus(Xml&); @@ -61,11 +61,10 @@ class MidiEditor : public TopWin { void curDrumInstrumentChanged(int); public: - MidiEditor(int, int, PartList*, + MidiEditor(int, PartList*, QWidget* parent = 0, const char* name = 0); ~MidiEditor(); - int quantVal(int v) const; ///int rasterStep(unsigned tick) const { return sigmap.rasterStep(tick, _raster); } ///unsigned rasterVal(unsigned v) const { return sigmap.raster(v, _raster); } ///unsigned rasterVal1(unsigned v) const { return sigmap.raster1(v, _raster); } @@ -74,8 +73,6 @@ class MidiEditor : public TopWin { unsigned rasterVal(unsigned v) const { return AL::sigmap.raster(v, _raster); } unsigned rasterVal1(unsigned v) const { return AL::sigmap.raster1(v, _raster); } unsigned rasterVal2(unsigned v) const { return AL::sigmap.raster2(v, _raster); } - int quant() const { return _quant; } - void setQuant(int val) { _quant = val; } int raster() const { return _raster; } void setRaster(int val) { _raster = val; } PartList* parts() { return _pl; } diff --git a/muse2/muse/shortcuts.cpp b/muse2/muse/shortcuts.cpp index cd54b096..86ab0dcd 100644 --- a/muse2/muse/shortcuts.cpp +++ b/muse2/muse/shortcuts.cpp @@ -181,13 +181,9 @@ void initShortCuts() //Pianoroll: //----------------------------------------------------------- - defShrt(SHRT_OVER_QUANTIZE, 0, "Quantize: Over Quantize", PROLL_SHRT, "midi_over_quant"); - defShrt(SHRT_ON_QUANTIZE, 0, "Quantize: Note On Quantize", PROLL_SHRT, "midi_quant_noteon"); - defShrt(SHRT_ONOFF_QUANTIZE, 0, "Quantize: Note On/Off Quantize", PROLL_SHRT,"midi_quant_noteoff"); - defShrt(SHRT_ITERATIVE_QUANTIZE,0,"Quantize: Iterative Quantize", PROLL_SHRT,"midi_quant_iterative"); - defShrt(SHRT_CONFIG_QUANT, Qt::CTRL + Qt::ALT + Qt::Key_Q, "Quantize: Configure quant", PROLL_SHRT, "config_quant"); - defShrt(SHRT_MODIFY_GATE_TIME, 0, "Quantize: Modify Gate Time", PROLL_SHRT, "midi_mod_gate_time"); - defShrt(SHRT_MODIFY_VELOCITY, 0, "Quantize: Modify Velocity", PROLL_SHRT, "midi_mod_velo"); + defShrt(SHRT_QUANTIZE, 0, "Quantize", PROLL_SHRT, "midi_quant"); + defShrt(SHRT_MODIFY_GATE_TIME, 0, "Modify Note Length", PROLL_SHRT, "midi_mod_gate_time"); + defShrt(SHRT_MODIFY_VELOCITY, 0, "Modify Velocity", PROLL_SHRT, "midi_mod_velo"); defShrt(SHRT_CRESCENDO, 0, "Edit: Crescendo", PROLL_SHRT, "midi_crescendo"); defShrt(SHRT_THIN_OUT, 0, "Edit: Thin Out", PROLL_SHRT, "midi_thin_out"); defShrt(SHRT_ERASE_EVENT, 0, "Edit: Erase Event", PROLL_SHRT, "midi_erase_event"); diff --git a/muse2/muse/shortcuts.h b/muse2/muse/shortcuts.h index ede91d22..b72e0207 100644 --- a/muse2/muse/shortcuts.h +++ b/muse2/muse/shortcuts.h @@ -246,11 +246,6 @@ enum { SHRT_SCROLL_RIGHT, // l SHRT_FIXED_LEN, //Alt+L, currently only drumeditor SHRT_QUANTIZE, //q - SHRT_OVER_QUANTIZE, //Default: undefined - SHRT_ON_QUANTIZE, //Default: undefined - SHRT_ONOFF_QUANTIZE, //Default: undefined - SHRT_ITERATIVE_QUANTIZE, //Default: undefined - SHRT_CONFIG_QUANT, //Default: Ctrl+Alt+Q SHRT_MODIFY_GATE_TIME, //Default: undefined SHRT_MODIFY_VELOCITY, SHRT_CRESCENDO, diff --git a/muse2/muse/waveedit/waveedit.cpp b/muse2/muse/waveedit/waveedit.cpp index 2350a2c5..0e3c1c30 100644 --- a/muse2/muse/waveedit/waveedit.cpp +++ b/muse2/muse/waveedit/waveedit.cpp @@ -61,7 +61,7 @@ void WaveEdit::closeEvent(QCloseEvent* e) //--------------------------------------------------------- WaveEdit::WaveEdit(PartList* pl) - : MidiEditor(1, 1, pl) + : MidiEditor(1, pl) { resize(_widthInit, _heightInit); diff --git a/muse2/muse/widgets/tb1.cpp b/muse2/muse/widgets/tb1.cpp index 917e6ae2..bd8e94a2 100644 --- a/muse2/muse/widgets/tb1.cpp +++ b/muse2/muse/widgets/tb1.cpp @@ -33,27 +33,16 @@ static const char* rasterStrings[] = { QT_TRANSLATE_NOOP("@default", "Off"), "4pp", "7pp", "64.", "32.", "16.", "8.", "4.", "2.", "1." }; -static int quantTable[] = { - 1, 16, 32, 64, 128, 256, 512, 1024, - 1, 24, 48, 96, 192, 384, 768, 1536, - 1, 36, 72, 144, 288, 576, 1152, 2304 - }; - -static const char* quantStrings[] = { - QT_TRANSLATE_NOOP("@default", "Off"), "64T", "32T", "16T", "8T", "4T", "2T", "1T", - QT_TRANSLATE_NOOP("@default", "Off"), "64", "32", "16", "8", "4", "2", "1", - QT_TRANSLATE_NOOP("@default", "Off"), "64.", "32.", "16.", "8.", "4.", "2.", "1." - }; //--------------------------------------------------------- // genToolbar -// solo time pitch raster quant +// solo time pitch raster //--------------------------------------------------------- -Toolbar1::Toolbar1(QWidget* parent, int r, int q, bool sp) - : QToolBar(QString("Quant'n'Snap-tools"), parent) +Toolbar1::Toolbar1(QWidget* parent, int r, bool sp) + : QToolBar(QString("Pos/Snap/Solo-tools"), parent) { - setObjectName("Quant'n'Snap-tools"); + setObjectName("Pos/Snap/Solo-tools"); pitch = 0; showPitch = sp; // ORCAN - FIXME: Check this: @@ -85,66 +74,34 @@ Toolbar1::Toolbar1(QWidget* parent, int r, int q, bool sp) } //--------------------------------------------------- - // Raster, Quant. + // Raster //--------------------------------------------------- raster = new LabelCombo(tr("Snap"), 0); - quant = new LabelCombo(tr("Quantize"), 0); rlist = new QTableWidget(10, 3); - qlist = new QTableWidget(8, 3); rlist->verticalHeader()->setDefaultSectionSize(22); rlist->horizontalHeader()->setDefaultSectionSize(32); rlist->setSelectionMode(QAbstractItemView::SingleSelection); rlist->verticalHeader()->hide(); rlist->horizontalHeader()->hide(); - qlist->verticalHeader()->setDefaultSectionSize(22); - qlist->horizontalHeader()->setDefaultSectionSize(32); - qlist->setSelectionMode(QAbstractItemView::SingleSelection); - qlist->verticalHeader()->hide(); - qlist->horizontalHeader()->hide(); rlist->setMinimumWidth(96); - qlist->setMinimumWidth(96); raster->setView(rlist); - quant->setView(qlist); for (int j = 0; j < 3; j++) for (int i = 0; i < 10; i++) rlist->setItem(i, j, new QTableWidgetItem(tr(rasterStrings[i + j * 10]))); - for (int j = 0; j < 3; j++) - for (int i = 0; i < 8; i++) - qlist->setItem(i, j, new QTableWidgetItem(tr(quantStrings[i + j * 8]))); setRaster(r); - setQuant(q); addWidget(raster); - addWidget(quant); // FIXME: Not working right. raster->setFixedHeight(38); - quant->setFixedHeight(38); - //--------------------------------------------------- - // To Menu - //--------------------------------------------------- - - addWidget(new QLabel(tr("To"))); - QComboBox* toList = new QComboBox; - toList->setFixedHeight(22); - toList->insertItem(0, tr("All Events")); - toList->insertItem(CMD_RANGE_LOOP, tr("Looped Ev.")); - toList->insertItem(CMD_RANGE_SELECTED, tr("Selected Ev.")); - toList->insertItem(CMD_RANGE_LOOP | CMD_RANGE_SELECTED, tr("Looped+Sel.")); - addWidget(toList); - connect(raster, SIGNAL(activated(int)), SLOT(_rasterChanged(int))); - connect(quant, SIGNAL(activated(int)), SLOT(_quantChanged(int))); - //connect(rlist, SIGNAL(cellClicked(int,int)), SLOT(_rasterChanged(int, int))); - //connect(qlist, SIGNAL(cellClicked(int,int)), SLOT(_quantChanged(int,int))); - connect(toList, SIGNAL(activated(int)), SIGNAL(toChanged(int))); connect(solo, SIGNAL(toggled(bool)), SIGNAL(soloChanged(bool))); pos->setEnabled(false); } @@ -160,16 +117,6 @@ void Toolbar1::_rasterChanged(int /*i*/) //emit rasterChanged(rasterTable[r + c * 10]); } -//--------------------------------------------------------- -// quantChanged -//--------------------------------------------------------- - -void Toolbar1::_quantChanged(int /*i*/) -//void Toolbar1::_quantChanged(int r, int c) - { - emit quantChanged(quantTable[qlist->currentRow() + qlist->currentColumn() * 8]); - //emit quantChanged(quantTable[r + c * 8]); - } //--------------------------------------------------------- // setPitch @@ -225,22 +172,6 @@ void Toolbar1::setRaster(int val) raster->setCurrentIndex(0); } -//--------------------------------------------------------- -// setQuant -//--------------------------------------------------------- - -void Toolbar1::setQuant(int val) - { - for (unsigned i = 0; i < sizeof(quantTable)/sizeof(*quantTable); i++) { - if (val == quantTable[i]) { - quant->setCurrentIndex(i); - return; - } - } - printf("setQuant(%d) not defined\n", val); - quant->setCurrentIndex(0); - } - //--------------------------------------------------------- // setSolo //--------------------------------------------------------- diff --git a/muse2/muse/widgets/tb1.h b/muse2/muse/widgets/tb1.h index fbed13b1..ff31593f 100644 --- a/muse2/muse/widgets/tb1.h +++ b/muse2/muse/widgets/tb1.h @@ -26,8 +26,6 @@ class Toolbar1 : public QToolBar { QToolButton* solo; PosLabel* pos; PitchLabel* pitch; - LabelCombo* quant; - QTableWidget* qlist; LabelCombo* raster; QTableWidget* rlist; bool showPitch; @@ -35,25 +33,21 @@ class Toolbar1 : public QToolBar { private slots: void _rasterChanged(int); - void _quantChanged(int); public slots: void setTime(unsigned); void setPitch(int); void setInt(int); void setRaster(int); - void setQuant(int); signals: void rasterChanged(int); - void quantChanged(int); void soloChanged(bool); - void toChanged(int); public: //Toolbar1(QMainWindow* parent = 0, int r=96, Toolbar1(QWidget* parent, int r=96, - int q=96, bool showPitch=true); + bool showPitch=true); void setSolo(bool val); void setPitchMode(bool flag); }; -- cgit v1.2.3 From a79460c36201572c453974a93e62903fe77fd824 Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Sun, 15 May 2011 10:14:51 +0000 Subject: - changed lots of functions and moved them into functions.cpp - delete overlaps may work differently, i haven't understood it fully - added lots of dialogs for these functions --- muse2/muse/CMakeLists.txt | 2 - muse2/muse/app.cpp | 15 --- muse2/muse/app.h | 2 - muse2/muse/functions.cpp | 186 ++++++++++++++++++++++++++++++- muse2/muse/functions.h | 21 +++- muse2/muse/midiedit/cmd.h | 23 ++-- muse2/muse/midiedit/dcanvas.cpp | 14 --- muse2/muse/midiedit/dcanvas.h | 2 +- muse2/muse/midiedit/drumedit.cpp | 36 +++--- muse2/muse/midiedit/pianoroll.cpp | 59 ++-------- muse2/muse/midiedit/pianoroll.h | 7 -- muse2/muse/midiedit/prcanvas.cpp | 87 +-------------- muse2/muse/midiedit/scoreedit.cpp | 3 +- muse2/muse/transpose.cpp | 100 ----------------- muse2/muse/transpose.h | 26 ----- muse2/muse/widgets/CMakeLists.txt | 15 +++ muse2/muse/widgets/deloverlaps.cpp | 44 ++++++++ muse2/muse/widgets/deloverlaps.h | 35 ++++++ muse2/muse/widgets/deloverlapsbase.ui | 153 +++++++++++++++++++++++++ muse2/muse/widgets/move.cpp | 46 ++++++++ muse2/muse/widgets/move.h | 36 ++++++ muse2/muse/widgets/movebase.ui | 203 ++++++++++++++++++++++++++++++++++ muse2/muse/widgets/remove.cpp | 44 ++++++++ muse2/muse/widgets/remove.h | 35 ++++++ muse2/muse/widgets/removebase.ui | 153 +++++++++++++++++++++++++ muse2/muse/widgets/setlen.cpp | 46 ++++++++ muse2/muse/widgets/setlen.h | 36 ++++++ muse2/muse/widgets/setlenbase.ui | 197 +++++++++++++++++++++++++++++++++ muse2/muse/widgets/transpose.cpp | 46 ++++++++ muse2/muse/widgets/transpose.h | 36 ++++++ muse2/muse/widgets/transposebase.ui | 147 ++++++++++-------------- 31 files changed, 1434 insertions(+), 421 deletions(-) delete mode 100644 muse2/muse/transpose.cpp delete mode 100644 muse2/muse/transpose.h create mode 100644 muse2/muse/widgets/deloverlaps.cpp create mode 100644 muse2/muse/widgets/deloverlaps.h create mode 100644 muse2/muse/widgets/deloverlapsbase.ui create mode 100644 muse2/muse/widgets/move.cpp create mode 100644 muse2/muse/widgets/move.h create mode 100644 muse2/muse/widgets/movebase.ui create mode 100644 muse2/muse/widgets/remove.cpp create mode 100644 muse2/muse/widgets/remove.h create mode 100644 muse2/muse/widgets/removebase.ui create mode 100644 muse2/muse/widgets/setlen.cpp create mode 100644 muse2/muse/widgets/setlen.h create mode 100644 muse2/muse/widgets/setlenbase.ui create mode 100644 muse2/muse/widgets/transpose.cpp create mode 100644 muse2/muse/widgets/transpose.h diff --git a/muse2/muse/CMakeLists.txt b/muse2/muse/CMakeLists.txt index d9ca7e3c..8705f914 100644 --- a/muse2/muse/CMakeLists.txt +++ b/muse2/muse/CMakeLists.txt @@ -62,7 +62,6 @@ QT4_WRAP_CPP ( muse_moc_headers plugin.h song.h transport.h - transpose.h value.h ) @@ -129,7 +128,6 @@ file (GLOB core_source_files ticksynth.cpp track.cpp transport.cpp - transpose.cpp undo.cpp value.cpp vst.cpp diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp index 62651cc9..4ec64edf 100644 --- a/muse2/muse/app.cpp +++ b/muse2/muse/app.cpp @@ -48,7 +48,6 @@ #include "songinfo.h" #include "ticksynth.h" #include "transport.h" -#include "transpose.h" #include "waveedit.h" #include "widgets/projectcreateimpl.h" #include "widgets/menutitleitem.h" @@ -1018,7 +1017,6 @@ MusE::MusE(int argc, char** argv) : QMainWindow() midiEdit = new QMenu(tr("Midi"), this); midiEdit->setIcon(QIcon(*edit_midiIcon)); - midiTransposeAction = new QAction(QIcon(*midi_transposeIcon), tr("Transpose"), this); midiTransformerAction = new QAction(QIcon(*midi_transformIcon), tr("Midi &Transform"), this); editSongInfoAction = new QAction(QIcon(*edit_listIcon), tr("Song Info"), this); @@ -1165,7 +1163,6 @@ MusE::MusE(int argc, char** argv) : QMainWindow() connect(masterGraphicAction, SIGNAL(activated()), SLOT(startMasterEditor())); connect(masterListAction, SIGNAL(activated()), SLOT(startLMasterEditor())); - connect(midiTransposeAction, SIGNAL(activated()), SLOT(transpose())); connect(midiTransformerAction, SIGNAL(activated()), SLOT(startMidiTransformer())); connect(editSongInfoAction, SIGNAL(activated()), SLOT(startSongInfo())); @@ -1393,7 +1390,6 @@ MusE::MusE(int argc, char** argv) : QMainWindow() midiEdit->insertItem(tr("Modify Gate Time"), this, SLOT(modifyGateTime())); midiEdit->insertItem(tr("Modify Velocity"), this, SLOT(modifyVelocity())); midiEdit->insertItem(tr("Crescendo"), this, SLOT(crescendo())); - midiEdit->insertItem(tr("Transpose"), this, SLOT(transpose())); midiEdit->insertItem(tr("Thin Out"), this, SLOT(thinOut())); midiEdit->insertItem(tr("Erase Event"), this, SLOT(eraseEvent())); midiEdit->insertItem(tr("Note Shift"), this, SLOT(noteShift())); @@ -1404,7 +1400,6 @@ MusE::MusE(int argc, char** argv) : QMainWindow() midiEdit->insertItem(tr("Create Measure"), this, SLOT(createMeasure())); midiEdit->insertItem(tr("Mix Track"), this, SLOT(mixTrack())); #endif - midiEdit->addAction(midiTransposeAction); midiEdit->addAction(midiTransformerAction); menuEdit->addAction(editSongInfoAction); @@ -4173,15 +4168,6 @@ void MusE::selectionChanged() editCopyAction->setEnabled(flag); } -//--------------------------------------------------------- -// transpose -//--------------------------------------------------------- - -void MusE::transpose() - { - Transpose *w = new Transpose(); - w->show(); - } //--------------------------------------------------------- // modifyGateTime @@ -4834,7 +4820,6 @@ void MusE::updateConfiguration() masterGraphicAction->setShortcut(shortcuts[SHRT_OPEN_GRAPHIC_MASTER].key); masterListAction->setShortcut(shortcuts[SHRT_OPEN_LIST_MASTER].key); - midiTransposeAction->setShortcut(shortcuts[SHRT_TRANSPOSE].key); midiTransformerAction->setShortcut(shortcuts[SHRT_OPEN_MIDI_TRANSFORM].key); //editSongInfoAction has no acceleration diff --git a/muse2/muse/app.h b/muse2/muse/app.h index 42aebf3b..0cca50b3 100644 --- a/muse2/muse/app.h +++ b/muse2/muse/app.h @@ -113,7 +113,6 @@ class MusE : public QMainWindow QAction *trackMidiAction, *trackDrumAction, *trackWaveAction, *trackAOutputAction, *trackAGroupAction; QAction *trackAInputAction, *trackAAuxAction; QAction *masterGraphicAction, *masterListAction; - QAction *midiTransposeAction; QAction *midiTransformerAction; QAction *editSongInfoAction; public: @@ -293,7 +292,6 @@ class MusE : public QMainWindow void cmd(int); void clipboardChanged(); void selectionChanged(); - void transpose(); void modifyGateTime(); void modifyVelocity(); void crescendo(); diff --git a/muse2/muse/functions.cpp b/muse2/muse/functions.cpp index 6a3af374..65369b98 100644 --- a/muse2/muse/functions.cpp +++ b/muse2/muse/functions.cpp @@ -19,12 +19,22 @@ using namespace std; GateTime* gatetime_dialog=NULL; Velocity* velocity_dialog=NULL; Quantize* quantize_dialog=NULL; +Remove* erase_dialog=NULL; +DelOverlaps* del_overlaps_dialog=NULL; +Setlen* set_notelen_dialog=NULL; +Move* move_notes_dialog=NULL; +Transpose* transpose_dialog=NULL; void init_function_dialogs(QWidget* parent) { gatetime_dialog = new GateTime(parent); velocity_dialog = new Velocity(parent); quantize_dialog = new Quantize(parent); + erase_dialog = new Remove(parent); + del_overlaps_dialog = new DelOverlaps(parent); + set_notelen_dialog = new Setlen(parent); + move_notes_dialog = new Move(parent); + transpose_dialog = new Transpose(parent); } set partlist_to_set(PartList* pl) @@ -99,13 +109,63 @@ bool quantize_notes(const set& parts) return true; } +bool erase_notes(const set& parts) +{ + if (!erase_dialog->exec()) + return false; + + erase_notes(parts,erase_dialog->range); + + return true; +} + +bool delete_overlaps(const set& parts) +{ + if (!del_overlaps_dialog->exec()) + return false; + + delete_overlaps(parts,erase_dialog->range); + + return true; +} + +bool set_notelen(const set& parts) +{ + if (!set_notelen_dialog->exec()) + return false; + + set_notelen(parts,set_notelen_dialog->range,set_notelen_dialog->len); + + return true; +} + +bool move_notes(const set& parts) +{ + if (!move_notes_dialog->exec()) + return false; + + move_notes(parts,move_notes_dialog->range,move_notes_dialog->amount); + + return true; +} + +bool transpose_notes(const set& parts) +{ + if (!transpose_dialog->exec()) + return false; + + transpose_notes(parts,transpose_dialog->range,transpose_dialog->amount); + + return true; +} + void modify_velocity(const set& parts, int range, int rate, int offset) { map events = get_events(parts, range); - if (!events.empty()) + if ( (!events.empty()) && ((rate!=100) || (offset!=0)) ) { song->startUndo(); @@ -141,7 +201,7 @@ void modify_notelen(const set& parts, int range, int rate, int offset) { map events = get_events(parts, range); - if (!events.empty()) + if ( (!events.empty()) && ((rate!=100) || (offset!=0)) ) { song->startUndo(); @@ -171,6 +231,11 @@ void modify_notelen(const set& parts, int range, int rate, int offset) } } +void set_notelen(const set& parts, int range, int len) +{ + modify_notelen(parts, range, 0, len); +} + unsigned quantize_tick(unsigned tick, unsigned raster, int swing) { //find out the nearest tick and the distance to it: @@ -196,11 +261,10 @@ unsigned quantize_tick(unsigned tick, unsigned raster, int swing) void quantize_notes(const set& parts, int range, int raster, int strength, int swing, int threshold) { map events = get_events(parts, range); + bool undo_started=false; if (!events.empty()) { - song->startUndo(); - for (map::iterator it=events.begin(); it!=events.end(); it++) { Event& event=*(it->first); @@ -227,6 +291,12 @@ void quantize_notes(const set& parts, int range, int raster, int strength if ( (event.lenTick() != len) || (event.tick() + part->tick() != begin_tick) ) { + if (!undo_started) + { + song->startUndo(); + undo_started=true; + } + Event newEvent = event.clone(); newEvent.setTick(begin_tick - part->tick()); newEvent.setLenTick(len); @@ -235,7 +305,7 @@ void quantize_notes(const set& parts, int range, int raster, int strength } } - song->endUndo(SC_EVENT_MODIFIED); + if (undo_started) song->endUndo(SC_EVENT_MODIFIED); } } @@ -259,4 +329,110 @@ void erase_notes(const set& parts, int range) } } +void transpose_notes(const set& parts, int range, signed int halftonesteps) +{ + map events = get_events(parts, range); + + if ( (!events.empty()) && (halftonesteps!=0) ) + { + song->startUndo(); + + for (map::iterator it=events.begin(); it!=events.end(); it++) + { + Event& event=*(it->first); + Part* part=it->second; + + Event newEvent = event.clone(); + int pitch = event.pitch()+halftonesteps; + if (pitch > 127) pitch=127; + if (pitch < 0) pitch=0; + newEvent.setPitch(pitch); + // Indicate no undo, and do not do port controller values and clone parts. + audio->msgChangeEvent(event, newEvent, part, false, false, false); + } + + song->endUndo(SC_EVENT_MODIFIED); + } +} + +void move_notes(const set& parts, int range, signed int ticks) //TODO FINDMICH: safety checks +{ + map events = get_events(parts, range); + + if ( (!events.empty()) && (ticks!=0) ) + { + song->startUndo(); + + for (map::iterator it=events.begin(); it!=events.end(); it++) + { + Event& event=*(it->first); + Part* part=it->second; + + Event newEvent = event.clone(); + newEvent.setTick(event.tick()+ticks); + // Indicate no undo, and do not do port controller values and clone parts. + audio->msgChangeEvent(event, newEvent, part, false, false, false); + } + + song->endUndo(SC_EVENT_MODIFIED); + } +} +void delete_overlaps(const set& parts, int range) +{ + map events = get_events(parts, range); + bool undo_started=false; + + set deleted_events; + + if (!events.empty()) + { + for (map::iterator it1=events.begin(); it1!=events.end(); it1++) + { + Event& event1=*(it1->first); + Part* part1=it1->second; + + // we may NOT optimize by letting it2 start at (it1 +1); this optimisation + // is only allowed when events was sorted by time. it is, however, sorted + // randomly by pointer. + for (map::iterator it2=events.begin(); it2!=events.end(); it2++) + { + Event& event2=*(it2->first); + Part* part2=it2->second; + + if ( (part1->events()==part2->events()) && // part1 and part2 are the same or are duplicates + (&event1 != &event2) && // and event1 and event2 aren't the same + (deleted_events.find(&event2) == deleted_events.end()) ) //and event2 hasn't been deleted before + { + if ( (event1.pitch() == event2.pitch()) && + (event1.tick() <= event2.tick()) && + (event1.endTick() > event2.tick()) ) //they overlap + { + if (undo_started==false) + { + song->startUndo(); + undo_started=true; + } + + int new_len = event2.tick() - event1.tick(); + + if (new_len==0) + { + audio->msgDeleteEvent(event1, part1, false, false, false); + deleted_events.insert(&event1); + } + else + { + Event new_event1 = event1.clone(); + new_event1.setLenTick(new_len); + + audio->msgChangeEvent(event1, new_event1, part1, false, false, false); + } + } + } + } + } + + if (undo_started) song->endUndo(SC_EVENT_MODIFIED); + } +} diff --git a/muse2/muse/functions.h b/muse2/muse/functions.h index 03d0ba88..afd5b559 100644 --- a/muse2/muse/functions.h +++ b/muse2/muse/functions.h @@ -11,6 +11,11 @@ #include "velocity.h" #include "quantize.h" #include "gatetime.h" +#include "remove.h" +#include "transpose.h" +#include "setlen.h" +#include "move.h" +#include "deloverlaps.h" #include #include "part.h" @@ -19,6 +24,11 @@ extern GateTime* gatetime_dialog; extern Velocity* velocity_dialog; extern Quantize* quantize_dialog; +extern Remove* erase_dialog; +extern DelOverlaps* del_overlaps_dialog; +extern Setlen* set_notelen_dialog; +extern Move* move_notes_dialog; +extern Transpose* transpose_dialog; void init_function_dialogs(QWidget* parent); @@ -30,12 +40,21 @@ void modify_velocity(const std::set& parts, int range, int rate, int offs void modify_notelen(const std::set& parts, int range, int rate, int offset=0); void quantize_notes(const std::set& parts, int range, int raster, int strength=100, int swing=0, int threshold=0); void erase_notes(const std::set& parts, int range); +void delete_overlaps(const std::set& parts, int range); +void set_notelen(const std::set& parts, int range, int len); +void move_notes(const std::set& parts, int range, signed int ticks); +void transpose_notes(const std::set& parts, int range, signed int halftonesteps); + //the below functions automatically open the dialog //they return true if you click "ok" and false if "abort" bool modify_velocity(const std::set& parts); bool modify_notelen(const std::set& parts); bool quantize_notes(const std::set& parts); - +bool set_notelen(const std::set& parts); +bool move_notes(const std::set& parts); +bool transpose_notes(const std::set& parts); +bool erase_notes(const std::set& parts); +bool delete_overlaps(const std::set& parts); #endif diff --git a/muse2/muse/midiedit/cmd.h b/muse2/muse/midiedit/cmd.h index 8339b7ae..b72166b1 100644 --- a/muse2/muse/midiedit/cmd.h +++ b/muse2/muse/midiedit/cmd.h @@ -12,17 +12,18 @@ #define CMD_RIGHT 1 #define CMD_INSERT 2 #define CMD_DELETE 3 -#define CMD_1 4 -#define CMD_2 5 -#define CMD_3 6 -#define CMD_4 7 -#define CMD_5 8 -#define CMD_6 9 -#define CMD_7 10 -#define CMD_T 11 -#define CMD_period 12 -#define CMD_LEFT_NOSNAP 13 -#define CMD_RIGHT_NOSNAP 14 +#define CMD_BACKSPACE 4 +#define CMD_1 5 +#define CMD_2 6 +#define CMD_3 7 +#define CMD_4 8 +#define CMD_5 9 +#define CMD_6 10 +#define CMD_7 11 +#define CMD_T 12 +#define CMD_period 13 +#define CMD_LEFT_NOSNAP 14 +#define CMD_RIGHT_NOSNAP 15 #endif diff --git a/muse2/muse/midiedit/dcanvas.cpp b/muse2/muse/midiedit/dcanvas.cpp index a21f04c0..18463eb0 100644 --- a/muse2/muse/midiedit/dcanvas.cpp +++ b/muse2/muse/midiedit/dcanvas.cpp @@ -742,20 +742,6 @@ void DrumCanvas::cmd(int cmd) editor->setCurCanvasPart(newpt); } break; - case CMD_DEL: - if (selectionSize()) { - song->startUndo(); - for (iCItem i = items.begin(); i != items.end(); ++i) { - if (!i->second->isSelected()) - continue; - Event ev = i->second->event(); - // Indicate no undo, and do not do port controller values and clone parts. - //audio->msgDeleteEvent(ev, i->second->part(), false); - audio->msgDeleteEvent(ev, i->second->part(), false, false, false); - } - song->endUndo(SC_EVENT_REMOVED); - } - return; case CMD_SAVE: case CMD_LOAD: diff --git a/muse2/muse/midiedit/dcanvas.h b/muse2/muse/midiedit/dcanvas.h index deb3a096..8bd70d89 100644 --- a/muse2/muse/midiedit/dcanvas.h +++ b/muse2/muse/midiedit/dcanvas.h @@ -91,7 +91,7 @@ class DrumCanvas : public EventCanvas { CMD_SELECT_ALL, CMD_SELECT_NONE, CMD_SELECT_INVERT, CMD_SELECT_ILOOP, CMD_SELECT_OLOOP, CMD_SELECT_PREV_PART, CMD_SELECT_NEXT_PART, CMD_DEL, CMD_FIXED_LEN, CMD_RIGHT, CMD_LEFT, CMD_RIGHT_NOSNAP, CMD_LEFT_NOSNAP, CMD_MODIFY_VELOCITY, - CMD_QUANTIZE + CMD_QUANTIZE, CMD_ERASE_EVENT, CMD_NOTE_SHIFT, CMD_DELETE_OVERLAPS }; DrumCanvas(MidiEditor*, QWidget*, int, int, const char* name = 0); diff --git a/muse2/muse/midiedit/drumedit.cpp b/muse2/muse/midiedit/drumedit.cpp index 84d4bf5b..617d3d1f 100644 --- a/muse2/muse/midiedit/drumedit.cpp +++ b/muse2/muse/midiedit/drumedit.cpp @@ -234,14 +234,23 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini fixedAction = menuFunctions->addAction(tr("Set Fixed Length")); veloAction = menuFunctions->addAction(tr("Modify Velocity")); quantizeAction = menuFunctions->addAction(tr("Quantize")); + QAction* eraseEventAction = menuFunctions->addAction(tr("Erase Event")); + QAction* noteShiftAction = menuFunctions->addAction(tr("Note Shift")); + QAction* delOverlapsAction = menuFunctions->addAction(tr("Delete Overlaps")); connect(fixedAction, SIGNAL(triggered()), signalMapper, SLOT(map())); connect(veloAction, SIGNAL(triggered()), signalMapper, SLOT(map())); connect(quantizeAction, SIGNAL(triggered()), signalMapper, SLOT(map())); + connect(eraseEventAction, SIGNAL(triggered()), signalMapper, SLOT(map())); + connect(noteShiftAction, SIGNAL(triggered()), signalMapper, SLOT(map())); + connect(delOverlapsAction, SIGNAL(triggered()), signalMapper, SLOT(map())); signalMapper->setMapping(fixedAction, DrumCanvas::CMD_FIXED_LEN); signalMapper->setMapping(veloAction, DrumCanvas::CMD_MODIFY_VELOCITY); signalMapper->setMapping(quantizeAction, DrumCanvas::CMD_QUANTIZE); + signalMapper->setMapping(eraseEventAction, DrumCanvas::CMD_ERASE_EVENT); + signalMapper->setMapping(noteShiftAction, DrumCanvas::CMD_NOTE_SHIFT); + signalMapper->setMapping(delOverlapsAction, DrumCanvas::CMD_DELETE_OVERLAPS); QMenu* menuScriptPlugins = menuBar()->addMenu(tr("&Plugins")); song->populateScriptMenu(menuScriptPlugins, this); @@ -877,21 +886,18 @@ void DrumEdit::reset() void DrumEdit::cmd(int cmd) { switch(cmd) { - case DrumCanvas::CMD_LOAD: - load(); - break; - case DrumCanvas::CMD_SAVE: - save(); - break; - case DrumCanvas::CMD_RESET: - reset(); - break; - case DrumCanvas::CMD_MODIFY_VELOCITY: - modify_velocity(partlist_to_set(parts())); - break; - default: - ((DrumCanvas*)(canvas))->cmd(cmd); - break; + case DrumCanvas::CMD_LOAD: load(); break; + case DrumCanvas::CMD_SAVE: save(); break; + case DrumCanvas::CMD_RESET: reset(); break; + case DrumCanvas::CMD_MODIFY_VELOCITY: modify_velocity(partlist_to_set(parts())); break; + case DrumCanvas::CMD_ERASE_EVENT: erase_notes(partlist_to_set(parts())); break; + case DrumCanvas::CMD_DEL: erase_notes(partlist_to_set(parts()),1); break; //delete selected events + case DrumCanvas::CMD_DELETE_OVERLAPS: delete_overlaps(partlist_to_set(parts())); break; + case DrumCanvas::CMD_NOTE_SHIFT: move_notes(partlist_to_set(parts())); break; + //case DrumCanvas::CMD_FIXED_LEN: // this must be handled by the drum canvas, due to its + // special nature (each drum has its own length) + + default: ((DrumCanvas*)(canvas))->cmd(cmd); } } diff --git a/muse2/muse/midiedit/pianoroll.cpp b/muse2/muse/midiedit/pianoroll.cpp index 153199cd..79699860 100644 --- a/muse2/muse/midiedit/pianoroll.cpp +++ b/muse2/muse/midiedit/pianoroll.cpp @@ -189,56 +189,18 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i mapper->setMapping(funcModVelAction, PianoCanvas::CMD_MODIFY_VELOCITY); connect(funcModVelAction, SIGNAL(triggered()), mapper, SLOT(map())); - funcCrescendoAction = menuFunctions->addAction(tr("Crescendo")); - mapper->setMapping(funcCrescendoAction, PianoCanvas::CMD_CRESCENDO); - funcCrescendoAction->setEnabled(false); - connect(funcCrescendoAction, SIGNAL(triggered()), mapper, SLOT(map())); - funcTransposeAction = menuFunctions->addAction(tr("Transpose")); mapper->setMapping(funcTransposeAction, PianoCanvas::CMD_TRANSPOSE); - funcTransposeAction->setEnabled(false); connect(funcTransposeAction, SIGNAL(triggered()), mapper, SLOT(map())); - - funcThinOutAction = menuFunctions->addAction(tr("Thin Out")); - mapper->setMapping(funcThinOutAction, PianoCanvas::CMD_THIN_OUT); - funcThinOutAction->setEnabled(false); - connect(funcThinOutAction, SIGNAL(triggered()), mapper, SLOT(map())); - + funcEraseEventAction = menuFunctions->addAction(tr("Erase Event")); mapper->setMapping(funcEraseEventAction, PianoCanvas::CMD_ERASE_EVENT); - funcEraseEventAction->setEnabled(false); connect(funcEraseEventAction, SIGNAL(triggered()), mapper, SLOT(map())); funcNoteShiftAction = menuFunctions->addAction(tr("Note Shift")); mapper->setMapping(funcNoteShiftAction, PianoCanvas::CMD_NOTE_SHIFT); - funcNoteShiftAction->setEnabled(false); connect(funcNoteShiftAction, SIGNAL(triggered()), mapper, SLOT(map())); - - funcMoveClockAction = menuFunctions->addAction(tr("Move Clock")); - mapper->setMapping(funcMoveClockAction, PianoCanvas::CMD_MOVE_CLOCK); - funcMoveClockAction->setEnabled(false); - connect(funcMoveClockAction, SIGNAL(triggered()), mapper, SLOT(map())); - - funcCopyMeasureAction = menuFunctions->addAction(tr("Copy Measure")); - mapper->setMapping(funcCopyMeasureAction, PianoCanvas::CMD_COPY_MEASURE); - funcCopyMeasureAction->setEnabled(false); - connect(funcCopyMeasureAction, SIGNAL(triggered()), mapper, SLOT(map())); - - funcEraseMeasureAction = menuFunctions->addAction(tr("Erase Measure")); - mapper->setMapping(funcEraseMeasureAction, PianoCanvas::CMD_ERASE_MEASURE); - funcEraseMeasureAction->setEnabled(false); - connect(funcEraseMeasureAction, SIGNAL(triggered()), mapper, SLOT(map())); - - funcDelMeasureAction = menuFunctions->addAction(tr("Delete Measure")); - mapper->setMapping(funcDelMeasureAction, PianoCanvas::CMD_DELETE_MEASURE); - funcDelMeasureAction->setEnabled(false); - connect(funcDelMeasureAction, SIGNAL(triggered()), mapper, SLOT(map())); - - funcCreateMeasureAction = menuFunctions->addAction(tr("Create Measure")); - mapper->setMapping(funcCreateMeasureAction, PianoCanvas::CMD_CREATE_MEASURE); - funcCreateMeasureAction->setEnabled(false); - connect(funcCreateMeasureAction, SIGNAL(triggered()), mapper, SLOT(map())); - + funcSetFixedLenAction = menuFunctions->addAction(tr("Set Fixed Length")); mapper->setMapping(funcSetFixedLenAction, PianoCanvas::CMD_FIXED_LEN); connect(funcSetFixedLenAction, SIGNAL(triggered()), mapper, SLOT(map())); @@ -630,6 +592,12 @@ void PianoRoll::cmd(int cmd) case PianoCanvas::CMD_MODIFY_GATE_TIME: modify_notelen(partlist_to_set(parts())); break; case PianoCanvas::CMD_MODIFY_VELOCITY: modify_velocity(partlist_to_set(parts())); break; case PianoCanvas::CMD_QUANTIZE: quantize_notes(partlist_to_set(parts())); break; + case PianoCanvas::CMD_TRANSPOSE: transpose_notes(partlist_to_set(parts())); break; + case PianoCanvas::CMD_ERASE_EVENT: erase_notes(partlist_to_set(parts())); break; + case PianoCanvas::CMD_DEL: erase_notes(partlist_to_set(parts()),1); break; + case PianoCanvas::CMD_NOTE_SHIFT: move_notes(partlist_to_set(parts())); break; + case PianoCanvas::CMD_FIXED_LEN: set_notelen(partlist_to_set(parts())); break; + case PianoCanvas::CMD_DELETE_OVERLAPS: delete_overlaps(partlist_to_set(parts())); break; default: ((PianoCanvas*)canvas)->cmd(cmd); } @@ -1044,8 +1012,8 @@ void PianoRoll::keyPressEvent(QKeyEvent* event) pc->pianoCmd(CMD_INSERT); return; } - else if (key == Qt::Key_Delete) { - pc->pianoCmd(CMD_DELETE); + else if (key == Qt::Key_Backspace) { + pc->pianoCmd(CMD_BACKSPACE); return; } else if (key == shortcuts[SHRT_ZOOM_IN].key) { @@ -1260,16 +1228,9 @@ void PianoRoll::initShortcuts() funcGateTimeAction->setShortcut(shortcuts[SHRT_MODIFY_GATE_TIME].key); funcModVelAction->setShortcut(shortcuts[SHRT_MODIFY_VELOCITY].key); - funcCrescendoAction->setShortcut(shortcuts[SHRT_CRESCENDO].key); funcTransposeAction->setShortcut(shortcuts[SHRT_TRANSPOSE].key); - funcThinOutAction->setShortcut(shortcuts[SHRT_THIN_OUT].key); funcEraseEventAction->setShortcut(shortcuts[SHRT_ERASE_EVENT].key); funcNoteShiftAction->setShortcut(shortcuts[SHRT_NOTE_SHIFT].key); - funcMoveClockAction->setShortcut(shortcuts[SHRT_MOVE_CLOCK].key); - funcCopyMeasureAction->setShortcut(shortcuts[SHRT_COPY_MEASURE].key); - funcEraseMeasureAction->setShortcut(shortcuts[SHRT_ERASE_MEASURE].key); - funcDelMeasureAction->setShortcut(shortcuts[SHRT_DELETE_MEASURE].key); - funcCreateMeasureAction->setShortcut(shortcuts[SHRT_CREATE_MEASURE].key); funcSetFixedLenAction->setShortcut(shortcuts[SHRT_FIXED_LEN].key); funcDelOverlapsAction->setShortcut(shortcuts[SHRT_DELETE_OVERLAPS].key); diff --git a/muse2/muse/midiedit/pianoroll.h b/muse2/muse/midiedit/pianoroll.h index 32be3bea..0c1066b4 100644 --- a/muse2/muse/midiedit/pianoroll.h +++ b/muse2/muse/midiedit/pianoroll.h @@ -83,16 +83,9 @@ class PianoRoll : public MidiEditor { QAction* funcQuantizeAction; QAction* funcGateTimeAction; QAction* funcModVelAction; - QAction* funcCrescendoAction; QAction* funcTransposeAction; - QAction* funcThinOutAction; QAction* funcEraseEventAction; QAction* funcNoteShiftAction; - QAction* funcMoveClockAction; - QAction* funcCopyMeasureAction; - QAction* funcEraseMeasureAction; - QAction* funcDelMeasureAction; - QAction* funcCreateMeasureAction; QAction* funcSetFixedLenAction; QAction* funcDelOverlapsAction; diff --git a/muse2/muse/midiedit/prcanvas.cpp b/muse2/muse/midiedit/prcanvas.cpp index 5f3def81..0da18e99 100644 --- a/muse2/muse/midiedit/prcanvas.cpp +++ b/muse2/muse/midiedit/prcanvas.cpp @@ -723,7 +723,7 @@ void PianoCanvas::pianoCmd(int cmd) song->setPos(0, p, true, false, true); } return; - case CMD_DELETE: + case CMD_BACKSPACE: if (pos[0] < start() || pos[0] >= end()) break; { @@ -927,21 +927,6 @@ void PianoCanvas::cmd(int cmd) case CMD_PASTE: paste(); break; - case CMD_DEL: - if (selectionSize()) { - song->startUndo(); - for (iCItem i = items.begin(); i != items.end(); ++i) { - if (!i->second->isSelected()) - continue; - Event ev = i->second->event(); - // Indicate no undo, and do not do port controller values and clone parts. - //audio->msgDeleteEvent(ev, i->second->part(), false); - audio->msgDeleteEvent(ev, i->second->part(), false, false, false); - } - song->endUndo(SC_EVENT_REMOVED); - } - return; - case CMD_SELECT_ALL: // select all for (iCItem k = items.begin(); k != items.end(); ++k) { if (!k->second->isSelected()) @@ -1035,76 +1020,6 @@ void PianoCanvas::cmd(int cmd) song->endUndo(SC_EVENT_MODIFIED); break; - case CMD_DELETE_OVERLAPS: - if (!selectionSize()) - break; - - song->startUndo(); - for (iCItem k = items.begin(); k != items.end(); k++) { - if (k->second->isSelected() == false) - continue; - - NEvent* e1 = (NEvent*) (k->second); // first note - NEvent* e2 = NULL; // ptr to next selected note (which will be checked for overlap) - Event ce1 = e1->event(); - Event ce2; - - if (ce1.type() != Note) - continue; - - // Find next selected item on the same pitch - iCItem l = k; l++; - for (; l != items.end(); l++) { - if (l->second->isSelected() == false) - continue; - - e2 = (NEvent*) l->second; - ce2 = e2->event(); - - // Same pitch? - if (ce1.dataA() == ce2.dataA()) - break; - - // If the note has the same len and place we treat it as a duplicate note and not a following note - // The best thing to do would probably be to delete the duplicate note, we just want to avoid - // matching against the same note - if ( ce1.tick() + e1->part()->tick() == ce2.tick() + e2->part()->tick() - && ce1.lenTick() + e1->part()->tick() == ce2.lenTick() + e2->part()->tick()) - { - e2 = NULL; // this wasn't what we were looking for - continue; - } - - } - - if (e2 == NULL) // None found - break; - - Part* part1 = e1->part(); - Part* part2 = e2->part(); - if (ce2.type() != Note) - continue; - - - unsigned event1pos = ce1.tick() + part1->tick(); - unsigned event1end = event1pos + ce1.lenTick(); - unsigned event2pos = ce2.tick() + part2->tick(); - - //printf("event1pos %u event1end %u event2pos %u\n", event1pos, event1end, event2pos); - if (event1end > event2pos) { - Event newEvent = ce1.clone(); - unsigned newlen = ce1.lenTick() - (event1end - event2pos); - //printf("newlen: %u\n", newlen); - newEvent.setLenTick(newlen); - // Indicate no undo, and do not do port controller values and clone parts. - //audio->msgChangeEvent(ce1, newEvent, e1->part(), false); - audio->msgChangeEvent(ce1, newEvent, e1->part(), false, false, false); - } - } - song->endUndo(SC_EVENT_MODIFIED); - break; - - case CMD_CRESCENDO: case CMD_TRANSPOSE: case CMD_THIN_OUT: diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index e70e5310..62519036 100644 --- a/muse2/muse/midiedit/scoreedit.cpp +++ b/muse2/muse/midiedit/scoreedit.cpp @@ -41,8 +41,9 @@ using namespace std; #include "app.h" #include "xml.h" #include "mtscale.h" -#include "prcanvas.h" +#include "al/sig.h" #include "scoreedit.h" +#include "tools.h" #include "ttoolbar.h" #include "tb1.h" #include "globals.h" diff --git a/muse2/muse/transpose.cpp b/muse2/muse/transpose.cpp deleted file mode 100644 index 9e99c471..00000000 --- a/muse2/muse/transpose.cpp +++ /dev/null @@ -1,100 +0,0 @@ - -#include - -#include - -#include "transpose.h" -#include "track.h" -#include "song.h" -#include "event.h" -#include "audio.h" - -//--------------------------------------------------------- -// Transpose -//--------------------------------------------------------- - -Transpose::Transpose(QWidget* parent) - : QDialog(parent) - { - setupUi(this); - setAttribute(Qt::WA_DeleteOnClose); - buttonGroup1 = new QButtonGroup(this); - buttonGroup1->addButton(time_all); - buttonGroup1->addButton(time_selected); - buttonGroup2 = new QButtonGroup(this); - buttonGroup2->addButton(parts_all); - buttonGroup2->addButton(parts_selected); - - if (song->lpos() != song->rpos()) { - time_selected->setChecked(true); - } - else { -// time_all->setChecked(true); - ButtonBox1->setEnabled(false); - } -// parts_all->setSelected(true); - } - -//--------------------------------------------------------- -// accept -//--------------------------------------------------------- - -void Transpose::accept() - { - int left = 0, right = 0; - int dv = delta->value(); - - TrackList *tracks = song->tracks(); - - if (time_selected->isChecked()) { - left = song->lpos(); - right = song->rpos(); - } - else { - left = 0; - right = song->len(); - } - - std::vector< EventList* > doneList; - typedef std::vector< EventList* >::iterator iDoneList; - - song->startUndo(); - for (iTrack t = tracks->begin(); t != tracks->end(); ++t) { -// if (((*t)->type() == Track::MIDI || (*t)->type() == Track::DRUM) - if (((*t)->type() != Track::MIDI) - || !(parts_all->isChecked() || (*t)->selected())) - continue; - - PartList *pl = (*t)->parts(); - for (iPart p = pl->begin(); p != pl->end(); ++p) { - MidiPart *mp = (MidiPart *) p->second; - EventList* el = mp->events(); - - // Check if the event list has already been done. Skip repeated clones. - iDoneList idl; - for(idl = doneList.begin(); idl != doneList.end(); ++idl) - if(*idl == el) - break; - if(idl != doneList.end()) - break; - doneList.push_back(el); - - for (iEvent i = el->begin(); i != el->end(); ++i) { - Event oe = i->second; - int tick = oe.tick(); - if (tick > right) - break; - if (tick < left) - continue; - Event ne = oe.clone(); - ne.setA(oe.dataA() + dv ); - // Indicate no undo, and do not do port controller values and clone parts. - //audio->msgChangeEvent(oe, ne, mp, false); - audio->msgChangeEvent(oe, ne, mp, false, false, false); - } - } - } - song->endUndo(SC_EVENT_MODIFIED); - close(); - } - diff --git a/muse2/muse/transpose.h b/muse2/muse/transpose.h deleted file mode 100644 index a5d2a1bb..00000000 --- a/muse2/muse/transpose.h +++ /dev/null @@ -1,26 +0,0 @@ - -#ifndef __TRANSPOSE_H__ -#define __TRANSPOSE_H__ - -#include "ui_transposebase.h" - -class QButtonGroup; - -//--------------------------------------------------------- -// transpose widget -//--------------------------------------------------------- - -class Transpose : public QDialog, public Ui::TransposeDialogBase { - Q_OBJECT - - QButtonGroup* buttonGroup1; - QButtonGroup* buttonGroup2; - - private slots: - virtual void accept(); - - public: - Transpose(QWidget* parent=0); - }; - -#endif diff --git a/muse2/muse/widgets/CMakeLists.txt b/muse2/muse/widgets/CMakeLists.txt index ee4af793..feb86816 100644 --- a/muse2/muse/widgets/CMakeLists.txt +++ b/muse2/muse/widgets/CMakeLists.txt @@ -77,6 +77,11 @@ QT4_WRAP_CPP (widget_mocs ttoolbutton.h velocity.h quantize.h + move.h + remove.h + deloverlaps.h + setlen.h + transpose.h verticalmeter.h view.h vscale.h @@ -113,6 +118,11 @@ file (GLOB widgets_ui_files transposebase.ui velocitybase.ui quantbase.ui + movebase.ui + removebase.ui + deloverlapsbase.ui + transposebase.ui + setlenbase.ui ) QT4_WRAP_UI (widget_ui_headers ${widgets_ui_files}) @@ -180,6 +190,11 @@ file (GLOB widgets_source_files utils.cpp velocity.cpp quantize.cpp + move.cpp + remove.cpp + deloverlaps.cpp + setlen.cpp + transpose.cpp verticalmeter.cpp view.cpp vscale.cpp diff --git a/muse2/muse/widgets/deloverlaps.cpp b/muse2/muse/widgets/deloverlaps.cpp new file mode 100644 index 00000000..ed4fab83 --- /dev/null +++ b/muse2/muse/widgets/deloverlaps.cpp @@ -0,0 +1,44 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: deloverlaps.cpp,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#include +#include "deloverlaps.h" + + +DelOverlaps::DelOverlaps(QWidget* parent) + : QDialog(parent) +{ + setupUi(this); + range_group = new QButtonGroup; + range_group->addButton(all_events_button,0); + range_group->addButton(selected_events_button,1); + range_group->addButton(looped_events_button,2); + range_group->addButton(selected_looped_button,3); + + pull_values(); +} + +void DelOverlaps::pull_values() +{ + range = range_group->checkedId(); +} + +void DelOverlaps::accept() +{ + pull_values(); + QDialog::accept(); +} + +int DelOverlaps::exec() +{ + if ((range < 0) || (range > 3)) range=0; + + range_group->button(range)->setChecked(true); + + return QDialog::exec(); +} + diff --git a/muse2/muse/widgets/deloverlaps.h b/muse2/muse/widgets/deloverlaps.h new file mode 100644 index 00000000..cb0cebe6 --- /dev/null +++ b/muse2/muse/widgets/deloverlaps.h @@ -0,0 +1,35 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: deloverlaps.h,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#ifndef __DELOVERLAPS_H__ +#define __DELOVERLAPS__H__ + +#include "ui_deloverlapsbase.h" + +class QButtonGroup; + +class DelOverlaps : public QDialog, public Ui::DelOverlapsBase +{ + private: + Q_OBJECT + QButtonGroup* range_group; + + protected slots: + void accept(); + void pull_values(); + + public: + DelOverlaps(QWidget* parent = 0); + + int range; + + public slots: + int exec(); +}; + +#endif + diff --git a/muse2/muse/widgets/deloverlapsbase.ui b/muse2/muse/widgets/deloverlapsbase.ui new file mode 100644 index 00000000..7484bf97 --- /dev/null +++ b/muse2/muse/widgets/deloverlapsbase.ui @@ -0,0 +1,153 @@ + + + DelOverlapsBase + + + true + + + + 0 + 0 + 275 + 195 + + + + MusE: Delete Overlaps + + + + 6 + + + 11 + + + + + Range + + + + 6 + + + 11 + + + + + All Events + + + + + + + Selected Events + + + true + + + + + + + Looped Events + + + + + + + Selected Looped + + + + + + + + + + 6 + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 20 + 20 + + + + + + + + OK + + + false + + + true + + + + + + + Cancel + + + + + + + + + + + + okButton + clicked() + DelOverlapsBase + accept() + + + 20 + 20 + + + 20 + 20 + + + + + cancelButton + clicked() + DelOverlapsBase + reject() + + + 20 + 20 + + + 20 + 20 + + + + + diff --git a/muse2/muse/widgets/move.cpp b/muse2/muse/widgets/move.cpp new file mode 100644 index 00000000..116325c3 --- /dev/null +++ b/muse2/muse/widgets/move.cpp @@ -0,0 +1,46 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: move.cpp,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#include +#include "move.h" + + +Move::Move(QWidget* parent) + : QDialog(parent) +{ + setupUi(this); + range_group = new QButtonGroup; + range_group->addButton(all_events_button,0); + range_group->addButton(selected_events_button,1); + range_group->addButton(looped_events_button,2); + range_group->addButton(selected_looped_button,3); + + pull_values(); +} + +void Move::pull_values() +{ + range = range_group->checkedId(); + amount = amount_spinbox->value(); +} + +void Move::accept() +{ + pull_values(); + QDialog::accept(); +} + +int Move::exec() +{ + if ((range < 0) || (range > 3)) range=0; + + range_group->button(range)->setChecked(true); + amount_spinbox->setValue(amount); + + return QDialog::exec(); +} + diff --git a/muse2/muse/widgets/move.h b/muse2/muse/widgets/move.h new file mode 100644 index 00000000..a69a72c5 --- /dev/null +++ b/muse2/muse/widgets/move.h @@ -0,0 +1,36 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: move.h,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#ifndef __MOVE_H__ +#define __MOVE_H__ + +#include "ui_movebase.h" + +class QButtonGroup; + +class Move : public QDialog, public Ui::MoveBase +{ + private: + Q_OBJECT + QButtonGroup* range_group; + + protected slots: + void accept(); + void pull_values(); + + public: + Move(QWidget* parent = 0); + + int range; + int amount; + + public slots: + int exec(); +}; + +#endif + diff --git a/muse2/muse/widgets/movebase.ui b/muse2/muse/widgets/movebase.ui new file mode 100644 index 00000000..a8825dd5 --- /dev/null +++ b/muse2/muse/widgets/movebase.ui @@ -0,0 +1,203 @@ + + + MoveBase + + + + 0 + 0 + 275 + 264 + + + + MusE: Move Notes + + + + 6 + + + 11 + + + + + Range + + + + 6 + + + 11 + + + + + All Events + + + + + + + Selected Events + + + true + + + + + + + Looped Events + + + + + + + Selected Looped + + + + + + + + + + Value + + + false + + + false + + + + 11 + + + 6 + + + + + Move by + + + false + + + + + + + true + + + ticks + + + -9999999 + + + 9999999 + + + 386 + + + 0 + + + + + + + + + + 6 + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 20 + 20 + + + + + + + + OK + + + false + + + true + + + + + + + Cancel + + + + + + + + + + + + okButton + clicked() + MoveBase + accept() + + + 20 + 20 + + + 20 + 20 + + + + + cancelButton + clicked() + MoveBase + reject() + + + 20 + 20 + + + 20 + 20 + + + + + diff --git a/muse2/muse/widgets/remove.cpp b/muse2/muse/widgets/remove.cpp new file mode 100644 index 00000000..cb75aa21 --- /dev/null +++ b/muse2/muse/widgets/remove.cpp @@ -0,0 +1,44 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: remove.cpp,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#include +#include "remove.h" + + +Remove::Remove(QWidget* parent) + : QDialog(parent) +{ + setupUi(this); + range_group = new QButtonGroup; + range_group->addButton(all_events_button,0); + range_group->addButton(selected_events_button,1); + range_group->addButton(looped_events_button,2); + range_group->addButton(selected_looped_button,3); + + pull_values(); +} + +void Remove::pull_values() +{ + range = range_group->checkedId(); +} + +void Remove::accept() +{ + pull_values(); + QDialog::accept(); +} + +int Remove::exec() +{ + if ((range < 0) || (range > 3)) range=0; + + range_group->button(range)->setChecked(true); + + return QDialog::exec(); +} + diff --git a/muse2/muse/widgets/remove.h b/muse2/muse/widgets/remove.h new file mode 100644 index 00000000..7b749142 --- /dev/null +++ b/muse2/muse/widgets/remove.h @@ -0,0 +1,35 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: remove.h,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#ifndef __REMOVE_H__ +#define __REMOVE_H__ + +#include "ui_removebase.h" + +class QButtonGroup; + +class Remove : public QDialog, public Ui::RemoveBase +{ + private: + Q_OBJECT + QButtonGroup* range_group; + + protected slots: + void accept(); + void pull_values(); + + public: + Remove(QWidget* parent = 0); + + int range; + + public slots: + int exec(); +}; + +#endif + diff --git a/muse2/muse/widgets/removebase.ui b/muse2/muse/widgets/removebase.ui new file mode 100644 index 00000000..3381795c --- /dev/null +++ b/muse2/muse/widgets/removebase.ui @@ -0,0 +1,153 @@ + + + RemoveBase + + + true + + + + 0 + 0 + 275 + 195 + + + + MusE: Erase Notes + + + + 6 + + + 11 + + + + + Range + + + + 6 + + + 11 + + + + + All Events + + + + + + + Selected Events + + + true + + + + + + + Looped Events + + + + + + + Selected Looped + + + + + + + + + + 6 + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 20 + 20 + + + + + + + + OK + + + false + + + true + + + + + + + Cancel + + + + + + + + + + + + okButton + clicked() + RemoveBase + accept() + + + 20 + 20 + + + 20 + 20 + + + + + cancelButton + clicked() + RemoveBase + reject() + + + 20 + 20 + + + 20 + 20 + + + + + diff --git a/muse2/muse/widgets/setlen.cpp b/muse2/muse/widgets/setlen.cpp new file mode 100644 index 00000000..a1de875a --- /dev/null +++ b/muse2/muse/widgets/setlen.cpp @@ -0,0 +1,46 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: setlen.cpp,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#include +#include "setlen.h" + + +Setlen::Setlen(QWidget* parent) + : QDialog(parent) +{ + setupUi(this); + range_group = new QButtonGroup; + range_group->addButton(all_events_button,0); + range_group->addButton(selected_events_button,1); + range_group->addButton(looped_events_button,2); + range_group->addButton(selected_looped_button,3); + + pull_values(); +} + +void Setlen::pull_values() +{ + range = range_group->checkedId(); + len = len_spinbox->value(); +} + +void Setlen::accept() +{ + pull_values(); + QDialog::accept(); +} + +int Setlen::exec() +{ + if ((range < 0) || (range > 3)) range=0; + + range_group->button(range)->setChecked(true); + len_spinbox->setValue(len); + + return QDialog::exec(); +} + diff --git a/muse2/muse/widgets/setlen.h b/muse2/muse/widgets/setlen.h new file mode 100644 index 00000000..7dc54eb6 --- /dev/null +++ b/muse2/muse/widgets/setlen.h @@ -0,0 +1,36 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: setlen.h,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#ifndef __SETLEN_H__ +#define __SETLEN_H__ + +#include "ui_setlenbase.h" + +class QButtonGroup; + +class Setlen : public QDialog, public Ui::SetlenBase +{ + private: + Q_OBJECT + QButtonGroup* range_group; + + protected slots: + void accept(); + void pull_values(); + + public: + Setlen(QWidget* parent = 0); + + int range; + int len; + + public slots: + int exec(); +}; + +#endif + diff --git a/muse2/muse/widgets/setlenbase.ui b/muse2/muse/widgets/setlenbase.ui new file mode 100644 index 00000000..7d929716 --- /dev/null +++ b/muse2/muse/widgets/setlenbase.ui @@ -0,0 +1,197 @@ + + + SetlenBase + + + + 0 + 0 + 275 + 264 + + + + MusE: Set Note Length + + + + 6 + + + 11 + + + + + Range + + + + 6 + + + 11 + + + + + All Events + + + + + + + Selected Events + + + true + + + + + + + Looped Events + + + + + + + Selected Looped + + + + + + + + + + Value + + + false + + + false + + + + 11 + + + 6 + + + + + New length + + + false + + + + + + + ticks + + + 1 + + + 10000 + + + 1 + + + + + + + + + + 6 + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 20 + 20 + + + + + + + + OK + + + false + + + true + + + + + + + Cancel + + + + + + + + + + + + okButton + clicked() + SetlenBase + accept() + + + 20 + 20 + + + 20 + 20 + + + + + cancelButton + clicked() + SetlenBase + reject() + + + 20 + 20 + + + 20 + 20 + + + + + diff --git a/muse2/muse/widgets/transpose.cpp b/muse2/muse/widgets/transpose.cpp new file mode 100644 index 00000000..66411829 --- /dev/null +++ b/muse2/muse/widgets/transpose.cpp @@ -0,0 +1,46 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: transpose.cpp,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#include +#include "transpose.h" + + +Transpose::Transpose(QWidget* parent) + : QDialog(parent) +{ + setupUi(this); + range_group = new QButtonGroup; + range_group->addButton(all_events_button,0); + range_group->addButton(selected_events_button,1); + range_group->addButton(looped_events_button,2); + range_group->addButton(selected_looped_button,3); + + pull_values(); +} + +void Transpose::pull_values() +{ + range = range_group->checkedId(); + amount = amount_spinbox->value(); +} + +void Transpose::accept() +{ + pull_values(); + QDialog::accept(); +} + +int Transpose::exec() +{ + if ((range < 0) || (range > 3)) range=0; + + range_group->button(range)->setChecked(true); + amount_spinbox->setValue(amount); + + return QDialog::exec(); +} + diff --git a/muse2/muse/widgets/transpose.h b/muse2/muse/widgets/transpose.h new file mode 100644 index 00000000..1ade8766 --- /dev/null +++ b/muse2/muse/widgets/transpose.h @@ -0,0 +1,36 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: transpose.h,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#ifndef __TRANSPOSE_H__ +#define __TRANSPOSE_H__ + +#include "ui_transposebase.h" + +class QButtonGroup; + +class Transpose : public QDialog, public Ui::TransposeBase +{ + private: + Q_OBJECT + QButtonGroup* range_group; + + protected slots: + void accept(); + void pull_values(); + + public: + Transpose(QWidget* parent = 0); + + int range; + int amount; + + public slots: + int exec(); +}; + +#endif + diff --git a/muse2/muse/widgets/transposebase.ui b/muse2/muse/widgets/transposebase.ui index 63ac74a6..c26f2ef9 100644 --- a/muse2/muse/widgets/transposebase.ui +++ b/muse2/muse/widgets/transposebase.ui @@ -1,19 +1,19 @@ - TransposeDialogBase - + TransposeBase + 0 0 - 289 - 340 + 275 + 264 - MusE: Midi Transpose + MusE: Transpose - + 6 @@ -21,11 +21,11 @@ 11 - + - Value + Range - + 6 @@ -33,63 +33,16 @@ 11 - - - 6 - - - 0 + + + All Events - - - - - 0 - 0 - - - - -99 - - - - - - - - 0 - 0 - - - - halftones - - - false - - - - + - - - - - - - Time - - - - 6 - - - 11 - - + - all + Selected Events true @@ -97,9 +50,16 @@ - + + + Looped Events + + + + + - between markers + Selected Looped @@ -107,34 +67,52 @@ - + - Parts + Value - - - 6 - + + false + + + false + + 11 - - + + 6 + + + - all + Halftone-steps - - true + + false - - - + + + + true + + - - all in selected tracks + + -127 + + + 127 + + + 1 + + + 0 @@ -142,13 +120,10 @@ - + 6 - - 0 - @@ -195,7 +170,7 @@ okButton clicked() - TransposeDialogBase + TransposeBase accept() @@ -211,7 +186,7 @@ cancelButton clicked() - TransposeDialogBase + TransposeBase reject() -- cgit v1.2.3 From c7d22c133d2d9a5e8494d0285af10da6a6dff9d9 Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Sun, 15 May 2011 16:52:14 +0000 Subject: defaults for toolbars are now saved --- muse2/muse/master/masteredit.cpp | 39 ++++++++++++++++++++++++++++++++++++++- muse2/muse/master/masteredit.h | 7 +++++++ muse2/muse/midiedit/drumedit.cpp | 16 ++++++++++++++++ muse2/muse/midiedit/drumedit.h | 4 ++++ muse2/muse/midiedit/pianoroll.cpp | 19 +++++++++++++++++++ muse2/muse/midiedit/pianoroll.h | 3 +++ muse2/muse/midiedit/scoreedit.cpp | 26 ++++++++++++++++++++------ muse2/muse/midiedit/scoreedit.h | 5 +++-- muse2/muse/waveedit/waveedit.cpp | 21 +++++++++++++++++++-- muse2/muse/waveedit/waveedit.h | 4 ++++ 10 files changed, 133 insertions(+), 11 deletions(-) diff --git a/muse2/muse/master/masteredit.cpp b/muse2/muse/master/masteredit.cpp index 17d390e9..fd7000dd 100644 --- a/muse2/muse/master/masteredit.cpp +++ b/muse2/muse/master/masteredit.cpp @@ -33,6 +33,9 @@ #include int MasterEdit::_rasterInit = 0; +int MasterEdit::_widthInit = 600; +int MasterEdit::_heightInit = 400; +QByteArray MasterEdit::_toolbarInit; //--------------------------------------------------------- // closeEvent @@ -82,7 +85,7 @@ MasterEdit::MasterEdit() setWindowTitle(tr("MusE: Mastertrack")); _raster = 0; // measure setMinimumSize(400, 300); - resize(500, 350); + resize(_widthInit, _heightInit); //---------Pulldown Menu---------------------------- // QPopupMenu* file = new QPopupMenu(this); @@ -229,6 +232,9 @@ MasterEdit::MasterEdit() connect(canvas, SIGNAL(followEvent(int)), hscroll, SLOT(setOffset(int))); connect(canvas, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned))); + + if (!_toolbarInit.isEmpty()) + restoreState(_toolbarInit); } //--------------------------------------------------------- @@ -317,6 +323,12 @@ void MasterEdit::readConfiguration(Xml& xml) case Xml::TagStart: if (tag == "raster") _rasterInit = xml.parseInt(); + else if (tag == "width") + _widthInit = xml.parseInt(); + else if (tag == "height") + _heightInit = xml.parseInt(); + else if (tag == "toolbars") + _toolbarInit = QByteArray::fromHex(xml.parse1().toAscii()); else xml.unknown("MasterEdit"); break; @@ -337,6 +349,9 @@ void MasterEdit::writeConfiguration(int level, Xml& xml) { xml.tag(level++, "masteredit"); xml.intTag(level, "raster", _rasterInit); + xml.intTag(level, "width", _widthInit); + xml.intTag(level, "height", _heightInit); + xml.strTag(level, "toolbars", _toolbarInit.toHex().data()); xml.tag(level, "/masteredit"); } @@ -404,3 +419,25 @@ void MasterEdit::setTempo(int val) } } + +//--------------------------------------------------------- +// resizeEvent +//--------------------------------------------------------- + +void MasterEdit::resizeEvent(QResizeEvent* ev) + { + QWidget::resizeEvent(ev); + _widthInit = ev->size().width(); + _heightInit = ev->size().height(); + } + + +//--------------------------------------------------------- +// focusOutEvent +//--------------------------------------------------------- + +void MasterEdit::focusOutEvent(QFocusEvent* ev) + { + QWidget::focusOutEvent(ev); + _toolbarInit=saveState(); + } diff --git a/muse2/muse/master/masteredit.h b/muse2/muse/master/masteredit.h index af43c7b0..5abcfc8d 100644 --- a/muse2/muse/master/masteredit.h +++ b/muse2/muse/master/masteredit.h @@ -8,6 +8,9 @@ #ifndef __MASTER_EDIT_H__ #define __MASTER_EDIT_H__ +#include +#include + #include "midieditor.h" #include "noteinfo.h" #include "cobject.h" @@ -56,9 +59,13 @@ class MasterEdit : public MidiEditor { QToolButton* enableButton; static int _rasterInit; + static int _widthInit, _heightInit; + static QByteArray _toolbarInit; Q_OBJECT virtual void closeEvent(QCloseEvent*); + virtual void resizeEvent(QResizeEvent*); + virtual void focusOutEvent(QFocusEvent*); private slots: void _setRaster(int); diff --git a/muse2/muse/midiedit/drumedit.cpp b/muse2/muse/midiedit/drumedit.cpp index 617d3d1f..b762d776 100644 --- a/muse2/muse/midiedit/drumedit.cpp +++ b/muse2/muse/midiedit/drumedit.cpp @@ -65,6 +65,7 @@ int DrumEdit::_widthInit = 600; int DrumEdit::_heightInit = 400; int DrumEdit::_dlistWidthInit = 50; int DrumEdit::_dcanvasWidthInit = 300; +QByteArray DrumEdit::_toolbarInit; static const int xscale = -10; static const int yscale = 1; @@ -470,6 +471,9 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini connect(ctrl, SIGNAL(clicked()), SLOT(addCtrl())); + if (!_toolbarInit.isEmpty()) + restoreState(_toolbarInit); + QClipboard* cb = QApplication::clipboard(); connect(cb, SIGNAL(dataChanged()), SLOT(clipboardChanged())); @@ -754,6 +758,8 @@ void DrumEdit::readConfiguration(Xml& xml) _dcanvasWidthInit = xml.parseInt(); else if (tag == "dlistwidth") _dlistWidthInit = xml.parseInt(); + else if (tag == "toolbars") + _toolbarInit = QByteArray::fromHex(xml.parse1().toAscii()); else xml.unknown("DrumEdit"); break; @@ -779,6 +785,7 @@ void DrumEdit::writeConfiguration(int level, Xml& xml) xml.intTag(level, "height", _heightInit); xml.intTag(level, "dlistwidth", _dlistWidthInit); xml.intTag(level, "dcanvaswidth", _dcanvasWidthInit); + xml.strTag(level, "toolbars", _toolbarInit.toHex().data()); xml.tag(level, "/drumedit"); } @@ -1022,6 +1029,15 @@ void DrumEdit::resizeEvent(QResizeEvent* ev) //TODO: Make the dlist not expand/shrink, but the canvas instead } +//--------------------------------------------------------- +// focusOutEvent +//--------------------------------------------------------- + +void DrumEdit::focusOutEvent(QFocusEvent* ev) + { + QWidget::focusOutEvent(ev); + _toolbarInit=saveState(); + } //--------------------------------------------------------- // configChanged diff --git a/muse2/muse/midiedit/drumedit.h b/muse2/muse/midiedit/drumedit.h index dd3ad223..ab6c6cb3 100644 --- a/muse2/muse/midiedit/drumedit.h +++ b/muse2/muse/midiedit/drumedit.h @@ -8,6 +8,8 @@ #ifndef __DRUM_EDIT_H__ #define __DRUM_EDIT_H__ +#include + #include #include "midieditor.h" #include "noteinfo.h" @@ -69,6 +71,7 @@ class DrumEdit : public MidiEditor { static int _rasterInit; static int _widthInit, _heightInit; static int _dlistWidthInit, _dcanvasWidthInit; + static QByteArray _toolbarInit; QAction *loadAction, *saveAction, *resetAction; QAction *cutAction, *copyAction, *pasteAction, *deleteAction; @@ -82,6 +85,7 @@ class DrumEdit : public MidiEditor { virtual void closeEvent(QCloseEvent*); QWidget* genToolbar(QWidget* parent); virtual void resizeEvent(QResizeEvent*); + virtual void focusOutEvent(QFocusEvent*); virtual void keyPressEvent(QKeyEvent*); void setHeaderToolTips(); void setHeaderWhatsThis(); diff --git a/muse2/muse/midiedit/pianoroll.cpp b/muse2/muse/midiedit/pianoroll.cpp index 79699860..02fe7f5d 100644 --- a/muse2/muse/midiedit/pianoroll.cpp +++ b/muse2/muse/midiedit/pianoroll.cpp @@ -56,6 +56,7 @@ int PianoRoll::_rasterInit = 96; int PianoRoll::_widthInit = 600; int PianoRoll::_heightInit = 400; int PianoRoll::colorModeInit = 0; +QByteArray PianoRoll::_toolbarInit; static const int xscale = -10; static const int yscale = 1; @@ -456,6 +457,10 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i setFocusPolicy(Qt::StrongFocus); setEventColorMode(colorMode); + if (!_toolbarInit.isEmpty()) + restoreState(_toolbarInit); + + QClipboard* cb = QApplication::clipboard(); connect(cb, SIGNAL(dataChanged()), SLOT(clipboardChanged())); @@ -786,6 +791,8 @@ void PianoRoll::readConfiguration(Xml& xml) _widthInit = xml.parseInt(); else if (tag == "height") _heightInit = xml.parseInt(); + else if (tag == "toolbars") + _toolbarInit = QByteArray::fromHex(xml.parse1().toAscii()); else xml.unknown("PianoRoll"); break; @@ -809,6 +816,7 @@ void PianoRoll::writeConfiguration(int level, Xml& xml) xml.intTag(level, "width", _widthInit); xml.intTag(level, "height", _heightInit); xml.intTag(level, "colormode", colorModeInit); + xml.strTag(level, "toolbars", _toolbarInit.toHex().data()); xml.etag(level, "pianoroll"); } @@ -1188,6 +1196,17 @@ void PianoRoll::resizeEvent(QResizeEvent* ev) } +//--------------------------------------------------------- +// focusOutEvent +//--------------------------------------------------------- + +void PianoRoll::focusOutEvent(QFocusEvent* ev) + { + QWidget::focusOutEvent(ev); + _toolbarInit=saveState(); + } + + /* //--------------------------------------------------------- // trackInfoScroll diff --git a/muse2/muse/midiedit/pianoroll.h b/muse2/muse/midiedit/pianoroll.h index 0c1066b4..6090e34f 100644 --- a/muse2/muse/midiedit/pianoroll.h +++ b/muse2/muse/midiedit/pianoroll.h @@ -12,6 +12,7 @@ #include #include #include +#include #include #include "noteinfo.h" @@ -114,6 +115,7 @@ class PianoRoll : public MidiEditor { static int _rasterInit; static int _widthInit, _heightInit; + static QByteArray _toolbarInit; static int colorModeInit; @@ -129,6 +131,7 @@ class PianoRoll : public MidiEditor { virtual void closeEvent(QCloseEvent*); virtual void keyPressEvent(QKeyEvent*); virtual void resizeEvent(QResizeEvent*); + virtual void focusOutEvent(QFocusEvent*); private slots: void setSelection(int, Event&, Part*); diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index 62519036..31203396 100644 --- a/muse2/muse/midiedit/scoreedit.cpp +++ b/muse2/muse/midiedit/scoreedit.cpp @@ -141,6 +141,7 @@ QColor* mycolors; // array [NUM_MYCOLORS] set ScoreEdit::names; int ScoreEdit::width_init = 600; int ScoreEdit::height_init = 400; +QByteArray ScoreEdit::default_toolbar_state; //--------------------------------------------------------- @@ -151,6 +152,7 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos) : TopWin(parent, name) { setAttribute(Qt::WA_DeleteOnClose); + setFocusPolicy(Qt::StrongFocus); resize(width_init, height_init); @@ -216,6 +218,8 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos) transport_toolbar->setObjectName("transport"); transport_toolbar->addActions(transportAction->actions()); + addToolBarBreak(); + QToolBar* newnote_toolbar = addToolBar(tr("New note settings")); newnote_toolbar->setObjectName("New note settings"); newnote_toolbar->addWidget(new QLabel(tr("Note length:"), newnote_toolbar)); @@ -341,6 +345,9 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos) menu_mapper->setMapping(func_notelen_action, CMD_NOTELEN); menu_mapper->setMapping(func_velocity_action, CMD_VELOCITY); + if (!default_toolbar_state.isEmpty()) + restoreState(default_toolbar_state); + score_canvas->fully_recalculate(); score_canvas->goto_tick(initPos,true); @@ -351,6 +358,11 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos) init_name(); } +void ScoreEdit::focusOutEvent(QFocusEvent* ev) +{ + default_toolbar_state=saveState(); + QMainWindow::focusOutEvent(ev); +} void ScoreEdit::add_parts(PartList* pl, bool all_in_one) { @@ -783,10 +795,12 @@ void ScoreEdit::read_configuration(Xml& xml) switch (token) { case Xml::TagStart: - if (tag == "width") + if (tag == "height") height_init = xml.parseInt(); - else if (tag == "height") + else if (tag == "width") width_init = xml.parseInt(); + else if (tag == "toolbars") + default_toolbar_state = QByteArray::fromHex(xml.parse1().toAscii()); else xml.unknown("ScoreEdit"); break; @@ -807,6 +821,7 @@ void ScoreEdit::write_configuration(int level, Xml& xml) xml.tag(level++, "scoreedit"); xml.intTag(level, "width", width_init); xml.intTag(level, "height", height_init); + xml.strTag(level, "toolbars", default_toolbar_state.toHex().data()); xml.etag(level, "scoreedit"); } @@ -4103,15 +4118,14 @@ void staff_t::apply_lasso(QRect rect, set& already_processed) * between, for example, when a cis is tied to a des * * CURRENT TODO - * x nothing atm + * o let the user change velocity of already existent notes + * o save dialog-window's values * * IMPORTANT TODO * o add a select-clef-toolbox for tracks * o respect the track's clef (has to be implemented first in muse) * o do partial recalculating; recalculating can take pretty long * (0,5 sec) when displaying a whole song in scores - * o save toolbar position also in the global window settings - * and provide sane defaults * o support edge-scrolling when opening a lasso * * less important stuff @@ -4122,7 +4136,7 @@ void staff_t::apply_lasso(QRect rect, set& already_processed) * calc_pos_add_list must be called before calc_item_pos then, * and calc_item_pos must respect the pos_add_list instead of * keeping its own pos_add variable (which is only an optimisation) - * o save more configuration stuff (quant, color, to_init) + * o save more configuration stuff (quant, color) * * really unimportant nice-to-haves * o support in-song clef-changes diff --git a/muse2/muse/midiedit/scoreedit.h b/muse2/muse/midiedit/scoreedit.h index d664f139..cfe6f34e 100644 --- a/muse2/muse/midiedit/scoreedit.h +++ b/muse2/muse/midiedit/scoreedit.h @@ -21,12 +21,11 @@ #include #include #include +#include #include #include "noteinfo.h" #include "cobject.h" -//#include "midieditor.h" -//#include "tools.h" #include "event.h" #include "view.h" #include "gconfig.h" @@ -74,6 +73,7 @@ class ScoreEdit : public TopWin private: virtual void closeEvent(QCloseEvent*); virtual void resizeEvent(QResizeEvent*); + virtual void focusOutEvent(QFocusEvent*); void init_name(); @@ -110,6 +110,7 @@ class ScoreEdit : public TopWin static set names; static int width_init, height_init; + static QByteArray default_toolbar_state; QString name; diff --git a/muse2/muse/waveedit/waveedit.cpp b/muse2/muse/waveedit/waveedit.cpp index 0e3c1c30..f2d936f4 100644 --- a/muse2/muse/waveedit/waveedit.cpp +++ b/muse2/muse/waveedit/waveedit.cpp @@ -42,6 +42,7 @@ extern QColor readColor(Xml& xml); int WaveEdit::_widthInit = 600; int WaveEdit::_heightInit = 400; +QByteArray WaveEdit::_toolbarInit; //--------------------------------------------------------- // closeEvent @@ -170,8 +171,8 @@ WaveEdit::WaveEdit(PartList* pl) // ToolBar: Solo Cursor1 Cursor2 addToolBarBreak(); - tb1 = addToolBar(tr("Pianoroll tools")); - tb1->setObjectName("Pianoroll tools"); + tb1 = addToolBar(tr("WaveEdit tools")); + tb1->setObjectName("WaveEdit tools"); //tb1->setLabel(tr("weTools")); solo = new QToolButton(); @@ -249,6 +250,8 @@ WaveEdit::WaveEdit(PartList* pl) connect(hscroll, SIGNAL(scaleChanged(int)), SLOT(updateHScrollRange())); connect(song, SIGNAL(songChanged(int)), SLOT(songChanged1(int))); + if (!_toolbarInit.isEmpty()) + restoreState(_toolbarInit); initShortcuts(); @@ -354,6 +357,8 @@ void WaveEdit::readConfiguration(Xml& xml) _widthInit = xml.parseInt(); else if (tag == "height") _heightInit = xml.parseInt(); + else if (tag == "toolbars") + _toolbarInit = QByteArray::fromHex(xml.parse1().toAscii()); else xml.unknown("WaveEdit"); break; @@ -379,6 +384,7 @@ void WaveEdit::writeConfiguration(int level, Xml& xml) xml.colorTag(level, "bgcolor", config.waveEditBackgroundColor); xml.intTag(level, "width", _widthInit); xml.intTag(level, "height", _heightInit); + xml.strTag(level, "toolbars", _toolbarInit.toHex().data()); xml.tag(level, "/waveedit"); } @@ -441,6 +447,17 @@ void WaveEdit::resizeEvent(QResizeEvent* ev) _heightInit = ev->size().height(); } +//--------------------------------------------------------- +// focusOutEvent +//--------------------------------------------------------- + +void WaveEdit::focusOutEvent(QFocusEvent* ev) + { + QWidget::focusOutEvent(ev); + _toolbarInit=saveState(); + } + + //--------------------------------------------------------- // songChanged1 // signal from "song" diff --git a/muse2/muse/waveedit/waveedit.h b/muse2/muse/waveedit/waveedit.h index 67230897..921b314c 100644 --- a/muse2/muse/waveedit/waveedit.h +++ b/muse2/muse/waveedit/waveedit.h @@ -14,6 +14,8 @@ #include #include #include +#include + #include "midieditor.h" class QToolButton; @@ -45,11 +47,13 @@ class WaveEdit : public MidiEditor { QAction* pasteAction; static int _widthInit, _heightInit; + static QByteArray _toolbarInit; Q_OBJECT virtual void closeEvent(QCloseEvent*); virtual void resizeEvent(QResizeEvent* ev); virtual void keyPressEvent(QKeyEvent*); + virtual void focusOutEvent(QFocusEvent*); QMenu* menuFunctions, *select, *menuGain; -- cgit v1.2.3 From 4e1ca61b03bab50d5e71e6da433503ac3b4470c0 Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Mon, 16 May 2011 11:34:53 +0000 Subject: fixed saving window state dialogs now also save and restore their state templates were updated and have now sane defaults for toolbars etc. --- muse2/muse/conf.cpp | 7 + muse2/muse/functions.cpp | 67 ++ muse2/muse/functions.h | 7 + muse2/muse/main.cpp | 3 +- muse2/muse/master/masteredit.cpp | 16 +- muse2/muse/master/masteredit.h | 1 + muse2/muse/midiedit/drumedit.cpp | 16 +- muse2/muse/midiedit/drumedit.h | 5 +- muse2/muse/midiedit/pianoroll.cpp | 15 +- muse2/muse/midiedit/pianoroll.h | 1 + muse2/muse/midiedit/scoreedit.cpp | 23 +- muse2/muse/midiedit/scoreedit.h | 2 + muse2/muse/waveedit/waveedit.cpp | 15 +- muse2/muse/waveedit/waveedit.h | 3 +- muse2/muse/widgets/deloverlaps.cpp | 35 + muse2/muse/widgets/deloverlaps.h | 4 + muse2/muse/widgets/gatetime.cpp | 43 + muse2/muse/widgets/gatetime.h | 5 + muse2/muse/widgets/move.cpp | 40 +- muse2/muse/widgets/move.h | 5 + muse2/muse/widgets/quantize.cpp | 51 +- muse2/muse/widgets/quantize.h | 5 + muse2/muse/widgets/remove.cpp | 36 +- muse2/muse/widgets/remove.h | 5 + muse2/muse/widgets/setlen.cpp | 39 +- muse2/muse/widgets/setlen.h | 5 + muse2/muse/widgets/transpose.cpp | 39 +- muse2/muse/widgets/transpose.h | 5 + muse2/muse/widgets/velocity.cpp | 42 + muse2/muse/widgets/velocity.h | 5 + muse2/share/templates/audio.med | 494 +++++++++-- muse2/share/templates/default.med | 332 +++++++- muse2/share/templates/midiGM.med | 274 +++++- muse2/share/templates/monorecord.med | 746 ++++++++-------- muse2/share/templates/synti.med | 1553 +++++++++++++++++++--------------- 35 files changed, 2728 insertions(+), 1216 deletions(-) diff --git a/muse2/muse/conf.cpp b/muse2/muse/conf.cpp index 2f391445..e7eef503 100644 --- a/muse2/muse/conf.cpp +++ b/muse2/muse/conf.cpp @@ -14,6 +14,7 @@ #include "transport.h" #include "icons.h" #include "globals.h" +#include "functions.h" #include "drumedit.h" #include "pianoroll.h" #include "scoreedit.h" @@ -891,6 +892,8 @@ void readConfiguration(Xml& xml, bool readOnlySequencer) MasterEdit::readConfiguration(xml); else if (tag == "waveedit") WaveEdit::readConfiguration(xml); + else if (tag == "dialogs") + read_function_dialog_config(xml); else if (tag == "shortcuts") readShortCuts(xml); else if (tag == "division") @@ -1360,6 +1363,8 @@ void MusE::writeGlobalConfiguration(int level, Xml& xml) const ScoreEdit::write_configuration(level, xml); MasterEdit::writeConfiguration(level, xml); WaveEdit::writeConfiguration(level, xml); + + write_function_dialog_config(level, xml); writeShortCuts(level, xml); xml.etag(level, "configuration"); @@ -1475,6 +1480,8 @@ void MusE::writeConfiguration(int level, Xml& xml) const ScoreEdit::write_configuration(level, xml); MasterEdit::writeConfiguration(level, xml); WaveEdit::writeConfiguration(level, xml); + + write_function_dialog_config(level, xml); writeMidiTransforms(level, xml); writeMidiInputTransforms(level, xml); diff --git a/muse2/muse/functions.cpp b/muse2/muse/functions.cpp index 65369b98..e14f32b8 100644 --- a/muse2/muse/functions.cpp +++ b/muse2/muse/functions.cpp @@ -436,3 +436,70 @@ void delete_overlaps(const set& parts, int range) if (undo_started) song->endUndo(SC_EVENT_MODIFIED); } } + + + +void read_function_dialog_config(Xml& xml) +{ + if (erase_dialog==NULL) + { + cout << "ERROR: THIS SHOULD NEVER HAPPEN: read_function_dialog_config() called, but\n" + " dialogs are still uninitalized (NULL)!"<read_configuration(xml); + else if (tag == "mod_velo") + velocity_dialog->read_configuration(xml); + else if (tag == "quantize") + quantize_dialog->read_configuration(xml); + else if (tag == "erase") + erase_dialog->read_configuration(xml); + else if (tag == "del_overlaps") + del_overlaps_dialog->read_configuration(xml); + else if (tag == "setlen") + set_notelen_dialog->read_configuration(xml); + else if (tag == "move") + move_notes_dialog->read_configuration(xml); + else if (tag == "transpose") + transpose_dialog->read_configuration(xml); + else + xml.unknown("function_dialogs"); + break; + + case Xml::TagEnd: + if (tag == "dialogs") + return; + + default: + break; + } + } +} + +void write_function_dialog_config(int level, Xml& xml) +{ + xml.tag(level++, "dialogs"); + + gatetime_dialog->write_configuration(level, xml); + velocity_dialog->write_configuration(level, xml); + quantize_dialog->write_configuration(level, xml); + erase_dialog->write_configuration(level, xml); + del_overlaps_dialog->write_configuration(level, xml); + set_notelen_dialog->write_configuration(level, xml); + move_notes_dialog->write_configuration(level, xml); + transpose_dialog->write_configuration(level, xml); + + xml.tag(level, "/dialogs"); +} diff --git a/muse2/muse/functions.h b/muse2/muse/functions.h index afd5b559..14797a15 100644 --- a/muse2/muse/functions.h +++ b/muse2/muse/functions.h @@ -57,4 +57,11 @@ bool transpose_notes(const std::set& parts); bool erase_notes(const std::set& parts); bool delete_overlaps(const std::set& parts); + + +//functions for reading and writing default values +class Xml; +void read_function_dialog_config(Xml& xml); +void write_function_dialog_config(int level, Xml& xml); + #endif diff --git a/muse2/muse/main.cpp b/muse2/muse/main.cpp index 6481f4cb..192c0bd3 100644 --- a/muse2/muse/main.cpp +++ b/muse2/muse/main.cpp @@ -254,6 +254,7 @@ int main(int argc, char* argv[]) QApplication::setColorSpec(QApplication::ManyColor); MuseApplication app(argc, argv); + init_function_dialogs(muse); initShortCuts(); readConfiguration(); @@ -471,8 +472,6 @@ int main(int argc, char* argv[]) muse = new MusE(argc, &argv[optind]); app.setMuse(muse); muse->setWindowIcon(*museIcon); - - init_function_dialogs(muse); // Added by Tim. p3.3.22 diff --git a/muse2/muse/master/masteredit.cpp b/muse2/muse/master/masteredit.cpp index fd7000dd..9053f3a8 100644 --- a/muse2/muse/master/masteredit.cpp +++ b/muse2/muse/master/masteredit.cpp @@ -427,11 +427,9 @@ void MasterEdit::setTempo(int val) void MasterEdit::resizeEvent(QResizeEvent* ev) { QWidget::resizeEvent(ev); - _widthInit = ev->size().width(); - _heightInit = ev->size().height(); + storeInitialState(); } - //--------------------------------------------------------- // focusOutEvent //--------------------------------------------------------- @@ -439,5 +437,17 @@ void MasterEdit::resizeEvent(QResizeEvent* ev) void MasterEdit::focusOutEvent(QFocusEvent* ev) { QWidget::focusOutEvent(ev); + storeInitialState(); + } + + +//--------------------------------------------------------- +// storeInitialState +//--------------------------------------------------------- + +void MasterEdit::storeInitialState() + { + _widthInit = width(); + _heightInit = height(); _toolbarInit=saveState(); } diff --git a/muse2/muse/master/masteredit.h b/muse2/muse/master/masteredit.h index 5abcfc8d..59a5ab05 100644 --- a/muse2/muse/master/masteredit.h +++ b/muse2/muse/master/masteredit.h @@ -66,6 +66,7 @@ class MasterEdit : public MidiEditor { virtual void closeEvent(QCloseEvent*); virtual void resizeEvent(QResizeEvent*); virtual void focusOutEvent(QFocusEvent*); + void storeInitialState(); private slots: void _setRaster(int); diff --git a/muse2/muse/midiedit/drumedit.cpp b/muse2/muse/midiedit/drumedit.cpp index b762d776..b5ff9447 100644 --- a/muse2/muse/midiedit/drumedit.cpp +++ b/muse2/muse/midiedit/drumedit.cpp @@ -1023,9 +1023,7 @@ void DrumEdit::newCanvasWidth(int w) void DrumEdit::resizeEvent(QResizeEvent* ev) { QWidget::resizeEvent(ev); - _widthInit = ev->size().width(); - _heightInit = ev->size().height(); - + storeInitialState(); //TODO: Make the dlist not expand/shrink, but the canvas instead } @@ -1036,9 +1034,21 @@ void DrumEdit::resizeEvent(QResizeEvent* ev) void DrumEdit::focusOutEvent(QFocusEvent* ev) { QWidget::focusOutEvent(ev); + storeInitialState(); + } + +//--------------------------------------------------------- +// storeInitialState +//--------------------------------------------------------- + +void DrumEdit::storeInitialState() + { + _widthInit = width(); + _heightInit = height(); _toolbarInit=saveState(); } + //--------------------------------------------------------- // configChanged //--------------------------------------------------------- diff --git a/muse2/muse/midiedit/drumedit.h b/muse2/muse/midiedit/drumedit.h index ab6c6cb3..242ec963 100644 --- a/muse2/muse/midiedit/drumedit.h +++ b/muse2/muse/midiedit/drumedit.h @@ -84,9 +84,12 @@ class DrumEdit : public MidiEditor { virtual void closeEvent(QCloseEvent*); QWidget* genToolbar(QWidget* parent); + virtual void keyPressEvent(QKeyEvent*); + virtual void resizeEvent(QResizeEvent*); virtual void focusOutEvent(QFocusEvent*); - virtual void keyPressEvent(QKeyEvent*); + void storeInitialState(); + void setHeaderToolTips(); void setHeaderWhatsThis(); diff --git a/muse2/muse/midiedit/pianoroll.cpp b/muse2/muse/midiedit/pianoroll.cpp index 02fe7f5d..2a2bad5b 100644 --- a/muse2/muse/midiedit/pianoroll.cpp +++ b/muse2/muse/midiedit/pianoroll.cpp @@ -1191,8 +1191,7 @@ void PianoRoll::setSpeaker(bool val) void PianoRoll::resizeEvent(QResizeEvent* ev) { QWidget::resizeEvent(ev); - _widthInit = ev->size().width(); - _heightInit = ev->size().height(); + storeInitialState(); } @@ -1203,6 +1202,18 @@ void PianoRoll::resizeEvent(QResizeEvent* ev) void PianoRoll::focusOutEvent(QFocusEvent* ev) { QWidget::focusOutEvent(ev); + storeInitialState(); + } + + +//--------------------------------------------------------- +// storeInitialState +//--------------------------------------------------------- + +void PianoRoll::storeInitialState() + { + _widthInit = width(); + _heightInit = height(); _toolbarInit=saveState(); } diff --git a/muse2/muse/midiedit/pianoroll.h b/muse2/muse/midiedit/pianoroll.h index 6090e34f..e157db10 100644 --- a/muse2/muse/midiedit/pianoroll.h +++ b/muse2/muse/midiedit/pianoroll.h @@ -132,6 +132,7 @@ class PianoRoll : public MidiEditor { virtual void keyPressEvent(QKeyEvent*); virtual void resizeEvent(QResizeEvent*); virtual void focusOutEvent(QFocusEvent*); + void storeInitialState(); private slots: void setSelection(int, Event&, Part*); diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index 31203396..0b4111cd 100644 --- a/muse2/muse/midiedit/scoreedit.cpp +++ b/muse2/muse/midiedit/scoreedit.cpp @@ -358,12 +358,6 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos) init_name(); } -void ScoreEdit::focusOutEvent(QFocusEvent* ev) -{ - default_toolbar_state=saveState(); - QMainWindow::focusOutEvent(ev); -} - void ScoreEdit::add_parts(PartList* pl, bool all_in_one) { score_canvas->add_staves(pl, all_in_one); @@ -470,8 +464,21 @@ void ScoreEdit::resizeEvent(QResizeEvent* ev) { QWidget::resizeEvent(ev); - width_init=ev->size().width(); - height_init=ev->size().height(); + store_initial_state(); +} + +void ScoreEdit::focusOutEvent(QFocusEvent* ev) +{ + QMainWindow::focusOutEvent(ev); + + store_initial_state(); +} + +void ScoreEdit::store_initial_state() +{ + width_init=width(); + height_init=height(); + default_toolbar_state=saveState(); } void ScoreEdit::menu_command(int cmd) diff --git a/muse2/muse/midiedit/scoreedit.h b/muse2/muse/midiedit/scoreedit.h index cfe6f34e..91d399e6 100644 --- a/muse2/muse/midiedit/scoreedit.h +++ b/muse2/muse/midiedit/scoreedit.h @@ -75,6 +75,8 @@ class ScoreEdit : public TopWin virtual void resizeEvent(QResizeEvent*); virtual void focusOutEvent(QFocusEvent*); + void store_initial_state(); + void init_name(); QGridLayout* mainGrid; diff --git a/muse2/muse/waveedit/waveedit.cpp b/muse2/muse/waveedit/waveedit.cpp index f2d936f4..99dfd5f1 100644 --- a/muse2/muse/waveedit/waveedit.cpp +++ b/muse2/muse/waveedit/waveedit.cpp @@ -443,8 +443,7 @@ void WaveEdit::readStatus(Xml& xml) void WaveEdit::resizeEvent(QResizeEvent* ev) { QWidget::resizeEvent(ev); - _widthInit = ev->size().width(); - _heightInit = ev->size().height(); + storeInitialState(); } //--------------------------------------------------------- @@ -454,6 +453,18 @@ void WaveEdit::resizeEvent(QResizeEvent* ev) void WaveEdit::focusOutEvent(QFocusEvent* ev) { QWidget::focusOutEvent(ev); + storeInitialState(); + } + + +//--------------------------------------------------------- +// storeInitialState +//--------------------------------------------------------- + +void WaveEdit::storeInitialState() + { + _widthInit = width(); + _heightInit = height(); _toolbarInit=saveState(); } diff --git a/muse2/muse/waveedit/waveedit.h b/muse2/muse/waveedit/waveedit.h index 921b314c..5c06d37f 100644 --- a/muse2/muse/waveedit/waveedit.h +++ b/muse2/muse/waveedit/waveedit.h @@ -51,9 +51,10 @@ class WaveEdit : public MidiEditor { Q_OBJECT virtual void closeEvent(QCloseEvent*); - virtual void resizeEvent(QResizeEvent* ev); virtual void keyPressEvent(QKeyEvent*); + virtual void resizeEvent(QResizeEvent* ev); virtual void focusOutEvent(QFocusEvent*); + void storeInitialState(); QMenu* menuFunctions, *select, *menuGain; diff --git a/muse2/muse/widgets/deloverlaps.cpp b/muse2/muse/widgets/deloverlaps.cpp index ed4fab83..76103d74 100644 --- a/muse2/muse/widgets/deloverlaps.cpp +++ b/muse2/muse/widgets/deloverlaps.cpp @@ -7,6 +7,7 @@ #include #include "deloverlaps.h" +#include "xml.h" DelOverlaps::DelOverlaps(QWidget* parent) @@ -42,3 +43,37 @@ int DelOverlaps::exec() return QDialog::exec(); } +void DelOverlaps::read_configuration(Xml& xml) +{ + for (;;) + { + Xml::Token token = xml.parse(); + if (token == Xml::Error || token == Xml::End) + break; + + const QString& tag = xml.s1(); + switch (token) + { + case Xml::TagStart: + if (tag == "range") + range=xml.parseInt(); + else + xml.unknown("DelOverlaps"); + break; + + case Xml::TagEnd: + if (tag == "del_overlaps") + return; + + default: + break; + } + } +} + +void DelOverlaps::write_configuration(int level, Xml& xml) +{ + xml.tag(level++, "del_overlaps"); + xml.intTag(level, "range", range); + xml.tag(level, "/del_overlaps"); +} diff --git a/muse2/muse/widgets/deloverlaps.h b/muse2/muse/widgets/deloverlaps.h index cb0cebe6..813192a6 100644 --- a/muse2/muse/widgets/deloverlaps.h +++ b/muse2/muse/widgets/deloverlaps.h @@ -11,6 +11,7 @@ #include "ui_deloverlapsbase.h" class QButtonGroup; +class Xml; class DelOverlaps : public QDialog, public Ui::DelOverlapsBase { @@ -27,6 +28,9 @@ class DelOverlaps : public QDialog, public Ui::DelOverlapsBase int range; + void read_configuration(Xml& xml); + void write_configuration(int level, Xml& xml); + public slots: int exec(); }; diff --git a/muse2/muse/widgets/gatetime.cpp b/muse2/muse/widgets/gatetime.cpp index c64411a0..9448ab1c 100644 --- a/muse2/muse/widgets/gatetime.cpp +++ b/muse2/muse/widgets/gatetime.cpp @@ -10,6 +10,7 @@ #include "gatetime.h" +#include "xml.h" #include "song.h" //--------------------------------------------------------- @@ -63,3 +64,45 @@ int GateTime::exec() return QDialog::exec(); } + + +void GateTime::read_configuration(Xml& xml) +{ + for (;;) + { + Xml::Token token = xml.parse(); + if (token == Xml::Error || token == Xml::End) + break; + + const QString& tag = xml.s1(); + switch (token) + { + case Xml::TagStart: + if (tag == "range") + range=xml.parseInt(); + else if (tag == "rate") + rateVal=xml.parseInt(); + else if (tag == "offset") + offsetVal=xml.parseInt(); + else + xml.unknown("ModLen"); + break; + + case Xml::TagEnd: + if (tag == "mod_len") + return; + + default: + break; + } + } +} + +void GateTime::write_configuration(int level, Xml& xml) +{ + xml.tag(level++, "mod_len"); + xml.intTag(level, "range", range); + xml.intTag(level, "offset", offsetVal); + xml.intTag(level, "rate", rateVal); + xml.tag(level, "/mod_len"); +} diff --git a/muse2/muse/widgets/gatetime.h b/muse2/muse/widgets/gatetime.h index 5585d6ad..d2555872 100644 --- a/muse2/muse/widgets/gatetime.h +++ b/muse2/muse/widgets/gatetime.h @@ -12,6 +12,7 @@ class QButtonGroup; class QDialog; +class Xml; //--------------------------------------------------------- // GateTime @@ -34,6 +35,10 @@ class GateTime : public QDialog, public Ui::GateTimeBase { int rateVal; int offsetVal; + void read_configuration(Xml& xml); + void write_configuration(int level, Xml& xml); + + public slots: int exec(); }; diff --git a/muse2/muse/widgets/move.cpp b/muse2/muse/widgets/move.cpp index 116325c3..2ce6cb05 100644 --- a/muse2/muse/widgets/move.cpp +++ b/muse2/muse/widgets/move.cpp @@ -7,7 +7,7 @@ #include #include "move.h" - +#include "xml.h" Move::Move(QWidget* parent) : QDialog(parent) @@ -44,3 +44,41 @@ int Move::exec() return QDialog::exec(); } + +void Move::read_configuration(Xml& xml) +{ + for (;;) + { + Xml::Token token = xml.parse(); + if (token == Xml::Error || token == Xml::End) + break; + + const QString& tag = xml.s1(); + switch (token) + { + case Xml::TagStart: + if (tag == "range") + range=xml.parseInt(); + else if (tag == "amount") + amount=xml.parseInt(); + else + xml.unknown("Move"); + break; + + case Xml::TagEnd: + if (tag == "move") + return; + + default: + break; + } + } +} + +void Move::write_configuration(int level, Xml& xml) +{ + xml.tag(level++, "move"); + xml.intTag(level, "range", range); + xml.intTag(level, "amount", amount); + xml.tag(level, "/move"); +} diff --git a/muse2/muse/widgets/move.h b/muse2/muse/widgets/move.h index a69a72c5..4c90a922 100644 --- a/muse2/muse/widgets/move.h +++ b/muse2/muse/widgets/move.h @@ -11,6 +11,7 @@ #include "ui_movebase.h" class QButtonGroup; +class Xml; class Move : public QDialog, public Ui::MoveBase { @@ -28,6 +29,10 @@ class Move : public QDialog, public Ui::MoveBase int range; int amount; + void read_configuration(Xml& xml); + void write_configuration(int level, Xml& xml); + + public slots: int exec(); }; diff --git a/muse2/muse/widgets/quantize.cpp b/muse2/muse/widgets/quantize.cpp index 734f3d5d..111087c2 100644 --- a/muse2/muse/widgets/quantize.cpp +++ b/muse2/muse/widgets/quantize.cpp @@ -7,7 +7,7 @@ #include #include "quantize.h" - +#include "xml.h" Quantize::Quantize(QWidget* parent) : QDialog(parent) @@ -52,3 +52,52 @@ int Quantize::exec() return QDialog::exec(); } +void Quantize::read_configuration(Xml& xml) +{ + for (;;) + { + Xml::Token token = xml.parse(); + if (token == Xml::Error || token == Xml::End) + break; + + const QString& tag = xml.s1(); + switch (token) + { + case Xml::TagStart: + if (tag == "range") + range=xml.parseInt(); + else if (tag == "strength") + strength=xml.parseInt(); + else if (tag == "threshold") + threshold=xml.parseInt(); + else if (tag == "raster") + raster_power2=xml.parseInt(); + else if (tag == "swing") + swing=xml.parseInt(); + else if (tag == "quant_len") + quant_len=xml.parseInt(); + else + xml.unknown("Quantize"); + break; + + case Xml::TagEnd: + if (tag == "quantize") + return; + + default: + break; + } + } +} + +void Quantize::write_configuration(int level, Xml& xml) +{ + xml.tag(level++, "quantize"); + xml.intTag(level, "range", range); + xml.intTag(level, "strength", strength); + xml.intTag(level, "threshold", threshold); + xml.intTag(level, "raster", raster_power2); + xml.intTag(level, "swing", swing); + xml.intTag(level, "quant_len", quant_len); + xml.tag(level, "/quantize"); +} diff --git a/muse2/muse/widgets/quantize.h b/muse2/muse/widgets/quantize.h index 3f54bc09..399e2545 100644 --- a/muse2/muse/widgets/quantize.h +++ b/muse2/muse/widgets/quantize.h @@ -11,6 +11,7 @@ #include "ui_quantbase.h" class QButtonGroup; +class Xml; class Quantize : public QDialog, public Ui::QuantBase { @@ -32,6 +33,10 @@ class Quantize : public QDialog, public Ui::QuantBase int swing; bool quant_len; + void read_configuration(Xml& xml); + void write_configuration(int level, Xml& xml); + + public slots: int exec(); }; diff --git a/muse2/muse/widgets/remove.cpp b/muse2/muse/widgets/remove.cpp index cb75aa21..5ad272ab 100644 --- a/muse2/muse/widgets/remove.cpp +++ b/muse2/muse/widgets/remove.cpp @@ -7,7 +7,7 @@ #include #include "remove.h" - +#include "xml.h" Remove::Remove(QWidget* parent) : QDialog(parent) @@ -42,3 +42,37 @@ int Remove::exec() return QDialog::exec(); } +void Remove::read_configuration(Xml& xml) +{ + for (;;) + { + Xml::Token token = xml.parse(); + if (token == Xml::Error || token == Xml::End) + break; + + const QString& tag = xml.s1(); + switch (token) + { + case Xml::TagStart: + if (tag == "range") + range=xml.parseInt(); + else + xml.unknown("Erase"); + break; + + case Xml::TagEnd: + if (tag == "erase") + return; + + default: + break; + } + } +} + +void Remove::write_configuration(int level, Xml& xml) +{ + xml.tag(level++, "erase"); + xml.intTag(level, "range", range); + xml.tag(level, "/erase"); +} diff --git a/muse2/muse/widgets/remove.h b/muse2/muse/widgets/remove.h index 7b749142..5615ed42 100644 --- a/muse2/muse/widgets/remove.h +++ b/muse2/muse/widgets/remove.h @@ -11,6 +11,7 @@ #include "ui_removebase.h" class QButtonGroup; +class Xml; class Remove : public QDialog, public Ui::RemoveBase { @@ -27,6 +28,10 @@ class Remove : public QDialog, public Ui::RemoveBase int range; + void read_configuration(Xml& xml); + void write_configuration(int level, Xml& xml); + + public slots: int exec(); }; diff --git a/muse2/muse/widgets/setlen.cpp b/muse2/muse/widgets/setlen.cpp index a1de875a..024cdd35 100644 --- a/muse2/muse/widgets/setlen.cpp +++ b/muse2/muse/widgets/setlen.cpp @@ -7,7 +7,7 @@ #include #include "setlen.h" - +#include "xml.h" Setlen::Setlen(QWidget* parent) : QDialog(parent) @@ -44,3 +44,40 @@ int Setlen::exec() return QDialog::exec(); } +void Setlen::read_configuration(Xml& xml) +{ + for (;;) + { + Xml::Token token = xml.parse(); + if (token == Xml::Error || token == Xml::End) + break; + + const QString& tag = xml.s1(); + switch (token) + { + case Xml::TagStart: + if (tag == "range") + range=xml.parseInt(); + else if (tag == "len") + len=xml.parseInt(); + else + xml.unknown("SetLen"); + break; + + case Xml::TagEnd: + if (tag == "setlen") + return; + + default: + break; + } + } +} + +void Setlen::write_configuration(int level, Xml& xml) +{ + xml.tag(level++, "setlen"); + xml.intTag(level, "range", range); + xml.intTag(level, "len", len); + xml.tag(level, "/setlen"); +} diff --git a/muse2/muse/widgets/setlen.h b/muse2/muse/widgets/setlen.h index 7dc54eb6..ad66a38b 100644 --- a/muse2/muse/widgets/setlen.h +++ b/muse2/muse/widgets/setlen.h @@ -11,6 +11,7 @@ #include "ui_setlenbase.h" class QButtonGroup; +class Xml; class Setlen : public QDialog, public Ui::SetlenBase { @@ -28,6 +29,10 @@ class Setlen : public QDialog, public Ui::SetlenBase int range; int len; + void read_configuration(Xml& xml); + void write_configuration(int level, Xml& xml); + + public slots: int exec(); }; diff --git a/muse2/muse/widgets/transpose.cpp b/muse2/muse/widgets/transpose.cpp index 66411829..b10c1249 100644 --- a/muse2/muse/widgets/transpose.cpp +++ b/muse2/muse/widgets/transpose.cpp @@ -7,7 +7,7 @@ #include #include "transpose.h" - +#include "xml.h" Transpose::Transpose(QWidget* parent) : QDialog(parent) @@ -44,3 +44,40 @@ int Transpose::exec() return QDialog::exec(); } +void Transpose::read_configuration(Xml& xml) +{ + for (;;) + { + Xml::Token token = xml.parse(); + if (token == Xml::Error || token == Xml::End) + break; + + const QString& tag = xml.s1(); + switch (token) + { + case Xml::TagStart: + if (tag == "range") + range=xml.parseInt(); + else if (tag == "amount") + amount=xml.parseInt(); + else + xml.unknown("Transpose"); + break; + + case Xml::TagEnd: + if (tag == "transpose") + return; + + default: + break; + } + } +} + +void Transpose::write_configuration(int level, Xml& xml) +{ + xml.tag(level++, "transpose"); + xml.intTag(level, "range", range); + xml.intTag(level, "amount", amount); + xml.tag(level, "/transpose"); +} diff --git a/muse2/muse/widgets/transpose.h b/muse2/muse/widgets/transpose.h index 1ade8766..97dd443e 100644 --- a/muse2/muse/widgets/transpose.h +++ b/muse2/muse/widgets/transpose.h @@ -11,6 +11,7 @@ #include "ui_transposebase.h" class QButtonGroup; +class Xml; class Transpose : public QDialog, public Ui::TransposeBase { @@ -28,6 +29,10 @@ class Transpose : public QDialog, public Ui::TransposeBase int range; int amount; + void read_configuration(Xml& xml); + void write_configuration(int level, Xml& xml); + + public slots: int exec(); }; diff --git a/muse2/muse/widgets/velocity.cpp b/muse2/muse/widgets/velocity.cpp index ad9bbfe4..ec625489 100644 --- a/muse2/muse/widgets/velocity.cpp +++ b/muse2/muse/widgets/velocity.cpp @@ -7,6 +7,7 @@ #include #include "velocity.h" +#include "xml.h" //--------------------------------------------------------- // Velocity @@ -58,3 +59,44 @@ int Velocity::exec() return QDialog::exec(); } + +void Velocity::read_configuration(Xml& xml) +{ + for (;;) + { + Xml::Token token = xml.parse(); + if (token == Xml::Error || token == Xml::End) + break; + + const QString& tag = xml.s1(); + switch (token) + { + case Xml::TagStart: + if (tag == "range") + range=xml.parseInt(); + else if (tag == "rate") + rateVal=xml.parseInt(); + else if (tag == "offset") + offsetVal=xml.parseInt(); + else + xml.unknown("ModVelo"); + break; + + case Xml::TagEnd: + if (tag == "mod_velo") + return; + + default: + break; + } + } +} + +void Velocity::write_configuration(int level, Xml& xml) +{ + xml.tag(level++, "mod_velo"); + xml.intTag(level, "range", range); + xml.intTag(level, "offset", offsetVal); + xml.intTag(level, "rate", rateVal); + xml.tag(level, "/mod_velo"); +} diff --git a/muse2/muse/widgets/velocity.h b/muse2/muse/widgets/velocity.h index 448b3e5b..cbea4e22 100644 --- a/muse2/muse/widgets/velocity.h +++ b/muse2/muse/widgets/velocity.h @@ -11,6 +11,7 @@ #include "ui_velocitybase.h" class QButtonGroup; +class Xml; //--------------------------------------------------------- // Velocity @@ -32,6 +33,10 @@ class Velocity : public QDialog, public Ui::VelocityBase { int rateVal; int offsetVal; + void read_configuration(Xml& xml); + void write_configuration(int level, Xml& xml); + + public slots: int exec(); }; diff --git a/muse2/share/templates/audio.med b/muse2/share/templates/audio.med index 9b8e1d93..14cd9c47 100644 --- a/muse2/share/templates/audio.med +++ b/muse2/share/templates/audio.med @@ -9,27 +9,31 @@ 0 0 0 - 127 - 127 - 1 - -1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 1 00:00:00:00:00 + 1 + 1 + 1 0 - 0 - 0 - 0 - 0 - 1 - 1 0 0 - 0 + 0 + + + 0 + 0 1 - 298 764 + 298 298 -
7 6 5 4 3 2 1 0
+
7 6 5 4 3 2 1 0 8
0 266 @@ -44,50 +48,323 @@ 70 9 0 - 1 - 1 + 0 + 0 4 4 0 0 1 0 + 0.5 0 28 31 33 29 + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - 96 96 - 600 - 400 - 50 - 300 + 883 + 465 + 126 + 753 + 000000ff00000000fd00000000000003730000015c00000004000000040000000800000008fc00000004000000020000000400000014004400720075006d00200074006f006f006c00730100000000000000d1000000000000000000000014004500640069007400200054006f006f006c007301000000d1000000c8000000000000000000000012007400720061006e00730070006f0072007401000001990000018400000000000000000000000a00700061006e00690063010000031dffffffff00000000000000000000000200000000000000020000000100000012004e006f0074006500200049006e0066006f0100000000ffffffff000000000000000000000002000000020000000c0063007500720073006f00720100000000ffffffff0000000000000000000000260050006f0073002f0053006e00610070002f0053006f006c006f002d0074006f006f006c00730100000083ffffffff0000000000000000 - 96 96 - 80 - 50 - 0 - 0 - 600 - 400 + 879 + 467 0 + 000000ff00000000fd000000000000036f0000017800000004000000040000000800000008fc00000006000000020000000000000002000000000000000200000000000000020000000000000002000000030000001e005000690061006e006f0072006f006c006c00200074006f006f006c00730100000000ffffffff000000000000000000000014004500640069007400200054006f006f006c00730100000091ffffffff000000000000000000000012004e006f0074006500200049006e0066006f0100000103ffffffff00000000000000000000000200000003000000260050006f0073002f0053006e00610070002f0053006f006c006f002d0074006f006f006c007301000000000000024c000000000000000000000012007400720061006e00730070006f00720074010000024c000000fc00000000000000000000000a00700061006e006900630100000348ffffffff0000000000000000 + + 880 + 466 + 000000ff00000000fd00000000000003700000018500000004000000040000000800000008fc0000000200000002000000030000001e0055006e0064006f002f005200650064006f00200074006f006f006c00730100000000ffffffff000000000000000000000014004500640069007400200054006f006f006c00730100000040ffffffff000000000000000000000022004e006500770020006e006f00740065002000730065007400740069006e006700730100000099ffffffff000000000000000000000002000000030000002a005100750061006e007400690073006100740069006f006e002000730065007400740069006e0067007301000000000000024a000000000000000000000012007400720061006e00730070006f00720074010000024a000000fc00000000000000000000000a00700061006e0069006301000003460000011f0000000000000000 + 0 + 875 + 464 + 000000ff00000000fd000000000000036b000001a400000004000000040000000800000008fc000000010000000200000004ffffffff0100000000ffffffff000000000000000000000014004500640069007400200054006f006f006c00730100000040ffffffff0000000000000000ffffffff0100000099ffffffff0000000000000000ffffffff01000000faffffffff0000000000000000 - - 600 - 400 + + 883 + 466 + 000000ff00000000fd0000000000000373000001a100000004000000040000000800000008fc0000000200000002000000030000001e00570061007600650020006500640069007400200074006f006f006c00730100000000ffffffff00000000000000000000001c0057006100760065004500640069007400200074006f006f006c007301000000400000023b000000000000000000000012007400720061006e00730070006f00720074010000027b0000003900000000000000000000000200000000 + + + 1 + 0 + 100 + + + 1 + 0 + 100 + + + 1 + 90 + 0 + 3 + 0 + 1 + + + 1 + + + 1 + + + 1 + 384 + + + 1 + 0 + + + 1 + 0 + + + + 1 0 0 0 @@ -105,6 +382,7 @@ 0 0 1 + 44100 Track 1 0 @@ -115,16 +393,18 @@ 20 0 1 - 0 - 0 0 - 0 + 0 1 - 0 - 0 - + 0 + 0 + + 0 0, - + + 0 0, + + @@ -136,16 +416,18 @@ 1 20 1 - 0 - 0 0 - 0 + 0 1 - 0 - 0 - + 0 + 0 + + 0 0, + + + 0 0, - + @@ -157,16 +439,18 @@ 1 20 0 - 0 - 0 0 - 0 + 0 1 - 0 - 0 - + 0 + 0 + + 0 0, - + + 0 0, + + @@ -178,16 +462,18 @@ 1 20 0 - 0 - 0 0 - 0 + 0 1 - 0 - 0 - + 0 + 0 + + 0 0, + + + 0 0, - + @@ -199,16 +485,18 @@ 1 20 1 - 0 - 0 0 - 0 + 0 1 - 0 - 0 - + 0 + 0 + + 0 0, - + + 0 0, + + @@ -220,16 +508,18 @@ 1 20 0 - 0 - 0 0 - 0 + 0 1 - 0 - 0 - + 0 + 0 + + 0 0, + + + 0 0, - + @@ -241,14 +531,16 @@ 2 20 1 - 0 - 0 0 - 0 + 0 1 - + + 0 0, + + + 0 0, - + @@ -260,14 +552,16 @@ 2 20 1 - 0 - 0 0 - 0 + 0 1 - + + 0 0, - + + 0 0, + + @@ -279,16 +573,18 @@ 2 20 1 - 1 - 0 0 - 0 + 0 1 - 0 - 0 - + 0 + 0 + + 0 0, + + + 0 0, - + @@ -300,14 +596,16 @@ 2 20 1 - 0 - 0 0 - 0 + 0 1 - + + 0 0, - + + 0 0, + + @@ -323,7 +621,15 @@ 4 + + + 0 + 1 + + + + diff --git a/muse2/share/templates/default.med b/muse2/share/templates/default.med index c0270b3a..8772f759 100644 --- a/muse2/share/templates/default.med +++ b/muse2/share/templates/default.med @@ -9,6 +9,13 @@ 0 0 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 1 00:00:00:00:00 1 @@ -18,11 +25,13 @@ 0 0 0 + + 0 0 1 - 418 751 + 418 456
8 7 6 5 4 3 2 1 0
@@ -54,38 +63,308 @@ 31 33 29 + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - 96 96 - 600 - 400 - 50 - 300 - 0 + 883 + 465 + 126 + 753 + 000000ff00000000fd00000000000003730000015c00000004000000040000000800000008fc00000004000000020000000400000014004400720075006d00200074006f006f006c00730100000000000000d1000000000000000000000014004500640069007400200054006f006f006c007301000000d1000000c8000000000000000000000012007400720061006e00730070006f0072007401000001990000018400000000000000000000000a00700061006e00690063010000031dffffffff00000000000000000000000200000000000000020000000100000012004e006f0074006500200049006e0066006f0100000000ffffffff000000000000000000000002000000020000000c0063007500720073006f00720100000000ffffffff0000000000000000000000260050006f0073002f0053006e00610070002f0053006f006c006f002d0074006f006f006c00730100000083ffffffff0000000000000000 - 96 96 - 80 - 50 - 0 - 0 - 600 - 400 + 879 + 467 0 + 000000ff00000000fd000000000000036f0000017800000004000000040000000800000008fc00000006000000020000000000000002000000000000000200000000000000020000000000000002000000030000001e005000690061006e006f0072006f006c006c00200074006f006f006c00730100000000ffffffff000000000000000000000014004500640069007400200054006f006f006c00730100000091ffffffff000000000000000000000012004e006f0074006500200049006e0066006f0100000103ffffffff00000000000000000000000200000003000000260050006f0073002f0053006e00610070002f0053006f006c006f002d0074006f006f006c007301000000000000024c000000000000000000000012007400720061006e00730070006f00720074010000024c000000fc00000000000000000000000a00700061006e006900630100000348ffffffff0000000000000000 + + 880 + 466 + 000000ff00000000fd00000000000003700000018500000004000000040000000800000008fc0000000200000002000000030000001e0055006e0064006f002f005200650064006f00200074006f006f006c00730100000000ffffffff000000000000000000000014004500640069007400200054006f006f006c00730100000040ffffffff000000000000000000000022004e006500770020006e006f00740065002000730065007400740069006e006700730100000099ffffffff000000000000000000000002000000030000002a005100750061006e007400690073006100740069006f006e002000730065007400740069006e0067007301000000000000024a000000000000000000000012007400720061006e00730070006f00720074010000024a000000fc00000000000000000000000a00700061006e0069006301000003460000011f0000000000000000 + 0 + 875 + 464 + 000000ff00000000fd000000000000036b000001a400000004000000040000000800000008fc000000010000000200000004ffffffff0100000000ffffffff000000000000000000000014004500640069007400200054006f006f006c00730100000040ffffffff0000000000000000ffffffff0100000099ffffffff0000000000000000ffffffff01000000faffffffff0000000000000000 - 600 - 400 + 883 + 466 + 000000ff00000000fd0000000000000373000001a100000004000000040000000800000008fc0000000200000002000000030000001e00570061007600650020006500640069007400200074006f006f006c00730100000000ffffffff00000000000000000000001c0057006100760065004500640069007400200074006f006f006c007301000000400000023b000000000000000000000012007400720061006e00730070006f00720074010000027b0000003900000000000000000000000200000000 + + + 1 + 0 + 100 + + + 1 + 0 + 100 + + + 1 + 90 + 0 + 3 + 0 + 1 + + + 1 + + + 1 + + + 1 + 384 + + + 1 + 0 + + + 1 + 0 + + + 1 1 0 0 @@ -103,6 +382,7 @@ 0 0 1 + 44100 Out 1 0 @@ -116,24 +396,16 @@ 0 0 0 - + 0 1, - + 0 0, - + 0 0, - - - - - - - - 0 @@ -147,6 +419,12 @@ 4 + + + 0 + 1 + + diff --git a/muse2/share/templates/midiGM.med b/muse2/share/templates/midiGM.med index 1314effb..bbc04498 100644 --- a/muse2/share/templates/midiGM.med +++ b/muse2/share/templates/midiGM.med @@ -9,27 +9,31 @@ 0 0 0 - 127 - 127 - 1 - -1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 1 00:00:00:00:00 + 1 + 1 + 1 0 - 0 - 0 - 0 - 0 - 1 - 1 0 0 - 0 + 0 + + + 0 + 0 1 - 298 764 + 298 298 -
7 6 5 4 3 2 1 0
+
7 6 5 4 3 2 1 0 8
0 266 @@ -44,14 +48,15 @@ 70 9 0 - 1 - 1 + 0 + 0 4 4 0 0 1 0 + 0.5 0 28 @@ -59,7 +64,7 @@ 33 29 - GM + 1 0 @@ -67,6 +72,12 @@ 0 + + + + + + 0 @@ -78,6 +89,12 @@ 0 + + + + + + 0 @@ -89,6 +106,12 @@ 0 + + + + + + 0 @@ -100,6 +123,12 @@ 0 + + + + + + 0 @@ -111,6 +140,12 @@ 0 + + + + + + 0 @@ -122,6 +157,12 @@ 0 + + + + + + 0 @@ -133,6 +174,12 @@ 0 + + + + + + 0 @@ -144,6 +191,12 @@ 0 + + + + + + 0 @@ -155,6 +208,12 @@ 0 + + + + + + 0 @@ -166,6 +225,12 @@ 0 + + + + + + 0 @@ -177,6 +242,12 @@ 0 + + + + + + 0 @@ -188,6 +259,12 @@ 0 + + + + + + 0 @@ -199,6 +276,12 @@ 0 + + + + + + 0 @@ -210,6 +293,12 @@ 0 + + + + + + 0 @@ -221,6 +310,12 @@ 0 + + + + + + 0 @@ -232,6 +327,12 @@ 0 + + + + + + 0 @@ -239,34 +340,79 @@ - 96 96 - 600 - 400 - 50 - 300 + 883 + 465 + 126 + 753 + 000000ff00000000fd00000000000003730000015c00000004000000040000000800000008fc00000004000000020000000400000014004400720075006d00200074006f006f006c00730100000000000000d1000000000000000000000014004500640069007400200054006f006f006c007301000000d1000000c8000000000000000000000012007400720061006e00730070006f0072007401000001990000018400000000000000000000000a00700061006e00690063010000031dffffffff00000000000000000000000200000000000000020000000100000012004e006f0074006500200049006e0066006f0100000000ffffffff000000000000000000000002000000020000000c0063007500720073006f00720100000000ffffffff0000000000000000000000260050006f0073002f0053006e00610070002f0053006f006c006f002d0074006f006f006c00730100000083ffffffff0000000000000000 - 96 96 - 80 - 50 - 0 - 0 - 600 - 400 + 879 + 467 0 + 000000ff00000000fd000000000000036f0000017800000004000000040000000800000008fc00000006000000020000000000000002000000000000000200000000000000020000000000000002000000030000001e005000690061006e006f0072006f006c006c00200074006f006f006c00730100000000ffffffff000000000000000000000014004500640069007400200054006f006f006c00730100000091ffffffff000000000000000000000012004e006f0074006500200049006e0066006f0100000103ffffffff00000000000000000000000200000003000000260050006f0073002f0053006e00610070002f0053006f006c006f002d0074006f006f006c007301000000000000024c000000000000000000000012007400720061006e00730070006f00720074010000024c000000fc00000000000000000000000a00700061006e006900630100000348ffffffff0000000000000000 + + 880 + 466 + 000000ff00000000fd00000000000003700000018500000004000000040000000800000008fc0000000200000002000000030000001e0055006e0064006f002f005200650064006f00200074006f006f006c00730100000000ffffffff000000000000000000000014004500640069007400200054006f006f006c00730100000040ffffffff000000000000000000000022004e006500770020006e006f00740065002000730065007400740069006e006700730100000099ffffffff000000000000000000000002000000030000002a005100750061006e007400690073006100740069006f006e002000730065007400740069006e0067007301000000000000024a000000000000000000000012007400720061006e00730070006f00720074010000024a000000fc00000000000000000000000a00700061006e0069006301000003460000011f0000000000000000 + 0 + 875 + 464 + 000000ff00000000fd000000000000036b000001a400000004000000040000000800000008fc000000010000000200000004ffffffff0100000000ffffffff000000000000000000000014004500640069007400200054006f006f006c00730100000040ffffffff0000000000000000ffffffff0100000099ffffffff0000000000000000ffffffff01000000faffffffff0000000000000000 - - 600 - 400 + + 883 + 466 + 000000ff00000000fd0000000000000373000001a100000004000000040000000800000008fc0000000200000002000000030000001e00570061007600650020006500640069007400200074006f006f006c00730100000000ffffffff00000000000000000000001c0057006100760065004500640069007400200074006f006f006c007301000000400000023b000000000000000000000012007400720061006e00730070006f00720074010000027b0000003900000000000000000000000200000000 + + + 1 + 0 + 100 + + + 1 + 0 + 100 + + + 1 + 90 + 0 + 3 + 0 + 1 + + + 1 + + + 1 + + + 1 + 384 + + + 1 + 0 + + + 1 + 0 + + + + 1 0 0 0 @@ -282,8 +428,9 @@ 0 0 0 - 0 + 6144 1 + 44100 Track 1 0 @@ -296,9 +443,8 @@ 1 0 0 - 65535 - 65535 0 + 1 0 0 0 @@ -317,9 +463,8 @@ 0 0 0 - 65535 - 65535 0 + 1 0 0 0 @@ -338,9 +483,8 @@ 0 0 0 - 65535 - 65535 0 + 1 0 0 0 @@ -359,9 +503,8 @@ 0 0 0 - 65535 - 65535 0 + 1 0 0 0 @@ -380,9 +523,8 @@ 0 0 9 - 65535 - 65535 0 + 1 0 0 0 @@ -390,6 +532,46 @@ 100 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 @@ -403,7 +585,15 @@ 4 + + + 0 + 1 + + + + diff --git a/muse2/share/templates/monorecord.med b/muse2/share/templates/monorecord.med index 8ba68625..fc8b324c 100644 --- a/muse2/share/templates/monorecord.med +++ b/muse2/share/templates/monorecord.med @@ -1,322 +1,370 @@ - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 127 - 127 - 1 - -1 - 1 - 00:00:00:00:00 - 0 - 0 - 0 - 0 - 0 - 1 - 1 - - - 0 - - 0 - 298 296 - -
7 6 5 4 3 2 1 0
-
- 0 - 266 - 0 -
- - - 2 - 63 - 127 - 63 - 70 - 9 - 0 - 1 - 1 - 4 - 4 - 0 - 0 - 1 - 0 - - 0 - 28 - 31 - 33 - 29 - - GM - TASCAM US-X2Y Port 0 - 1 - - 1 - 7 - 10 - 11 - 64 - 91 - 93 - 120 - 121 - 123 - 262144 - 262145 - - - 1 - 7 - 10 - 11 - 64 - 91 - 93 - 120 - 121 - 123 - 262144 - 262145 - - - 1 - 7 - 10 - 11 - 64 - 91 - 93 - 120 - 121 - 123 - 262144 - 262145 - - - 1 - 7 - 10 - 11 - 64 - 91 - 93 - 120 - 121 - 123 - 262144 - 262145 - - - 1 - 7 - 10 - 11 - 64 - 91 - 93 - 120 - 121 - 123 - 262144 - 262145 - - - 1 - 7 - 10 - 11 - 64 - 91 - 93 - 120 - 121 - 123 - 262144 - 262145 - - - 1 - 7 - 10 - 11 - 64 - 91 - 93 - 120 - 121 - 123 - 262144 - 262145 - - - 1 - 7 - 10 - 11 - 64 - 91 - 93 - 120 - 121 - 123 - 262144 - 262145 - - - 1 - 7 - 10 - 11 - 64 - 91 - 93 - 120 - 121 - 123 - 262144 - 262145 - - - 1 - 7 - 10 - 11 - 64 - 91 - 93 - 120 - 121 - 123 - 262144 - 262145 - - - 1 - 7 - 10 - 11 - 64 - 91 - 93 - 120 - 121 - 123 - 262144 - 262145 - - - 1 - 7 - 10 - 11 - 64 - 91 - 93 - 120 - 121 - 123 - 262144 - 262145 - - - 1 - 7 - 10 - 11 - 64 - 91 - 93 - 120 - 121 - 123 - 262144 - 262145 - - - 1 - 7 - 10 - 11 - 64 - 91 - 93 - 120 - 121 - 123 - 262144 - 262145 - - - 1 - 7 - 10 - 11 - 64 - 91 - 93 - 120 - 121 - 123 - 262144 - 262145 - - - 1 - 7 - 10 - 11 - 64 - 91 - 93 - 120 - 121 - 123 - 262144 - 262145 - - - - - 96 - 96 - 600 - 400 - 50 - 300 - - - 96 - 96 - 80 - 50 - 0 - 0 - 600 - 400 - 0 - - - 0 - - - - 600 - 400 - -
+ 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 00:00:00:00:00 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + + + 0 + 0 + + 0 + 298 298 + +
7 6 5 4 3 2 1 0 8
+
+ 0 + 266 + 0 +
+ + + 2 + 63 + 127 + 63 + 70 + 9 + 0 + 0 + 0 + 4 + 4 + 0 + 0 + 1 + 0 + 0.5 + + 0 + 28 + 31 + 33 + 29 + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 96 + 883 + 465 + 126 + 753 + 000000ff00000000fd00000000000003730000015c00000004000000040000000800000008fc00000004000000020000000400000014004400720075006d00200074006f006f006c00730100000000000000d1000000000000000000000014004500640069007400200054006f006f006c007301000000d1000000c8000000000000000000000012007400720061006e00730070006f0072007401000001990000018400000000000000000000000a00700061006e00690063010000031dffffffff00000000000000000000000200000000000000020000000100000012004e006f0074006500200049006e0066006f0100000000ffffffff000000000000000000000002000000020000000c0063007500720073006f00720100000000ffffffff0000000000000000000000260050006f0073002f0053006e00610070002f0053006f006c006f002d0074006f006f006c00730100000083ffffffff0000000000000000 + + + 96 + 879 + 467 + 0 + 000000ff00000000fd000000000000036f0000017800000004000000040000000800000008fc00000006000000020000000000000002000000000000000200000000000000020000000000000002000000030000001e005000690061006e006f0072006f006c006c00200074006f006f006c00730100000000ffffffff000000000000000000000014004500640069007400200054006f006f006c00730100000091ffffffff000000000000000000000012004e006f0074006500200049006e0066006f0100000103ffffffff00000000000000000000000200000003000000260050006f0073002f0053006e00610070002f0053006f006c006f002d0074006f006f006c007301000000000000024c000000000000000000000012007400720061006e00730070006f00720074010000024c000000fc00000000000000000000000a00700061006e006900630100000348ffffffff0000000000000000 + + + 880 + 466 + 000000ff00000000fd00000000000003700000018500000004000000040000000800000008fc0000000200000002000000030000001e0055006e0064006f002f005200650064006f00200074006f006f006c00730100000000ffffffff000000000000000000000014004500640069007400200054006f006f006c00730100000040ffffffff000000000000000000000022004e006500770020006e006f00740065002000730065007400740069006e006700730100000099ffffffff000000000000000000000002000000030000002a005100750061006e007400690073006100740069006f006e002000730065007400740069006e0067007301000000000000024a000000000000000000000012007400720061006e00730070006f00720074010000024a000000fc00000000000000000000000a00700061006e0069006301000003460000011f0000000000000000 + + + 0 + 875 + 464 + 000000ff00000000fd000000000000036b000001a400000004000000040000000800000008fc000000010000000200000004ffffffff0100000000ffffffff000000000000000000000014004500640069007400200054006f006f006c00730100000040ffffffff0000000000000000ffffffff0100000099ffffffff0000000000000000ffffffff01000000faffffffff0000000000000000 + + + + 883 + 466 + 000000ff00000000fd0000000000000373000001a100000004000000040000000800000008fc0000000200000002000000030000001e00570061007600650020006500640069007400200074006f006f006c00730100000000ffffffff00000000000000000000001c0057006100760065004500640069007400200074006f006f006c007301000000400000023b000000000000000000000012007400720061006e00730070006f00720074010000027b0000003900000000000000000000000200000000 + + + + 1 + 0 + 100 + + + 1 + 0 + 100 + + + 1 + 90 + 0 + 3 + 0 + 1 + + + 1 + + + 1 + + + 1 + 384 + + + 1 + 0 + + + 1 + 0 + + + + + 1 0 0 0 @@ -334,6 +382,7 @@ 0 0 1 + 44100 Track 1 1 @@ -343,15 +392,16 @@ 1 20 0 - 0 - 0 0 - 0 - 0.000000 - 0.000000 - + 0 + 0 + + 0 1.02164, + + + 0 0, - + @@ -364,15 +414,16 @@ 20 1 1 - 0 - 0 0 - 0 - 0.000000 - 0.000000 - + 0 + 0 + + 0 1.02164, + + + 0 0, - + @@ -384,26 +435,25 @@ 1 20 1 - 0 - 0 0 - 0 - + 0 + 0 + + 0 1.30152, + + + 0 0, - + - alsa_pcm:capture_1 - 1:Input 1 + + - Input 1 - Out 1 - - - Input 1 - Track 1 + + @@ -418,15 +468,15 @@ 4 + + + 0 + 1 + + - - - - - -
diff --git a/muse2/share/templates/synti.med b/muse2/share/templates/synti.med index b5ad8908..1a14a9ce 100644 --- a/muse2/share/templates/synti.med +++ b/muse2/share/templates/synti.med @@ -1,577 +1,773 @@ - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 127 - 127 - 1 - -1 - 1 - 00:00:00:00:00 - 0 - 0 - 0 - 0 - 0 - 1 - 1 - - - 0 - - 0 - 298 296 - -
7 6 5 4 3 2 1 0
-
- 0 - 266 - 0 -
- - - 2 - 63 - 127 - 63 - 70 - 9 - 0 - 1 - 1 - 4 - 4 - 0 - 0 - 1 - 0 - - 0 - 28 - 31 - 33 - 29 - - organ-1 - organ-1 - 0 - - 1 - 7 - 10 - 11 - 64 - 91 - 93 - 120 - 121 - 123 - 262144 - 262145 - - - 1 - 7 - 10 - 11 - 64 - 91 - 93 - 120 - 121 - 123 - 262144 - 262145 - - - 1 - 7 - 10 - 11 - 64 - 91 - 93 - 120 - 121 - 123 - 262144 - 262145 - - - 1 - 7 - 10 - 11 - 64 - 91 - 93 - 120 - 121 - 123 - 262144 - 262145 - - - 1 - 7 - 10 - 11 - 64 - 91 - 93 - 120 - 121 - 123 - 262144 - 262145 - - - 1 - 7 - 10 - 11 - 64 - 91 - 93 - 120 - 121 - 123 - 262144 - 262145 - - - 1 - 7 - 10 - 11 - 64 - 91 - 93 - 120 - 121 - 123 - 262144 - 262145 - - - 1 - 7 - 10 - 11 - 64 - 91 - 93 - 120 - 121 - 123 - 262144 - 262145 - - - 1 - 7 - 10 - 11 - 64 - 91 - 93 - 120 - 121 - 123 - 262144 - 262145 - - - 1 - 7 - 10 - 11 - 64 - 91 - 93 - 120 - 121 - 123 - 262144 - 262145 - - - 1 - 7 - 10 - 11 - 64 - 91 - 93 - 120 - 121 - 123 - 262144 - 262145 - - - 1 - 7 - 10 - 11 - 64 - 91 - 93 - 120 - 121 - 123 - 262144 - 262145 - - - 1 - 7 - 10 - 11 - 64 - 91 - 93 - 120 - 121 - 123 - 262144 - 262145 - - - 1 - 7 - 10 - 11 - 64 - 91 - 93 - 120 - 121 - 123 - 262144 - 262145 - - - 1 - 7 - 10 - 11 - 64 - 91 - 93 - 120 - 121 - 123 - 262144 - 262145 - - - 1 - 7 - 10 - 11 - 64 - 91 - 93 - 120 - 121 - 123 - 262144 - 262145 - - - - fluid-1 - fluid-1 - 0 - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - - s1-1 - s1-1 - 0 - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - - vam-1 - vam-1 - 0 - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - 7 - 10 - 262145 - - - - - 96 - 96 - 600 - 400 - 50 - 300 - - - 96 - 96 - 80 - 50 - 0 - 0 - 600 - 400 - 0 - - - 0 - - - - 600 - 400 - -
+ 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 00:00:00:00:00 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + + + 0 + 0 + + 0 + 298 298 + +
7 6 5 4 3 2 1 0 8
+
+ 0 + 266 + 0 +
+ + + 2 + 63 + 127 + 63 + 70 + 9 + 0 + 0 + 0 + 4 + 4 + 0 + 0 + 1 + 0 + 0.5 + + 0 + 28 + 31 + 33 + 29 + + 1 + organ-1 + organ-1 + 2 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + fluid-1 + fluid-1 + 2 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + General Midi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + vam-1 + vam-1 + 2 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 96 + 883 + 465 + 126 + 753 + 000000ff00000000fd00000000000003730000015c00000004000000040000000800000008fc00000004000000020000000400000014004400720075006d00200074006f006f006c00730100000000000000d1000000000000000000000014004500640069007400200054006f006f006c007301000000d1000000c8000000000000000000000012007400720061006e00730070006f0072007401000001990000018400000000000000000000000a00700061006e00690063010000031dffffffff00000000000000000000000200000000000000020000000100000012004e006f0074006500200049006e0066006f0100000000ffffffff000000000000000000000002000000020000000c0063007500720073006f00720100000000ffffffff0000000000000000000000260050006f0073002f0053006e00610070002f0053006f006c006f002d0074006f006f006c00730100000083ffffffff0000000000000000 + + + 96 + 879 + 467 + 0 + 000000ff00000000fd000000000000036f0000017800000004000000040000000800000008fc00000006000000020000000000000002000000000000000200000000000000020000000000000002000000030000001e005000690061006e006f0072006f006c006c00200074006f006f006c00730100000000ffffffff000000000000000000000014004500640069007400200054006f006f006c00730100000091ffffffff000000000000000000000012004e006f0074006500200049006e0066006f0100000103ffffffff00000000000000000000000200000003000000260050006f0073002f0053006e00610070002f0053006f006c006f002d0074006f006f006c007301000000000000024c000000000000000000000012007400720061006e00730070006f00720074010000024c000000fc00000000000000000000000a00700061006e006900630100000348ffffffff0000000000000000 + + + 880 + 466 + 000000ff00000000fd00000000000003700000018500000004000000040000000800000008fc0000000200000002000000030000001e0055006e0064006f002f005200650064006f00200074006f006f006c00730100000000ffffffff000000000000000000000014004500640069007400200054006f006f006c00730100000040ffffffff000000000000000000000022004e006500770020006e006f00740065002000730065007400740069006e006700730100000099ffffffff000000000000000000000002000000030000002a005100750061006e007400690073006100740069006f006e002000730065007400740069006e0067007301000000000000024a000000000000000000000012007400720061006e00730070006f00720074010000024a000000fc00000000000000000000000a00700061006e0069006301000003460000011f0000000000000000 + + + 0 + 875 + 464 + 000000ff00000000fd000000000000036b000001a400000004000000040000000800000008fc000000010000000200000004ffffffff0100000000ffffffff000000000000000000000014004500640069007400200054006f006f006c00730100000040ffffffff0000000000000000ffffffff0100000099ffffffff0000000000000000ffffffff01000000faffffffff0000000000000000 + + + + 883 + 466 + 000000ff00000000fd0000000000000373000001a100000004000000040000000800000008fc0000000200000002000000030000001e00570061007600650020006500640069007400200074006f006f006c00730100000000ffffffff00000000000000000000001c0057006100760065004500640069007400200074006f006f006c007301000000400000023b000000000000000000000012007400720061006e00730070006f00720074010000027b0000003900000000000000000000000200000000 + + + + 1 + 0 + 100 + + + 1 + 0 + 100 + + + 1 + 90 + 0 + 3 + 0 + 1 + + + 1 + + + 1 + + + 1 + 384 + + + 1 + 0 + + + 1 + 0 + + + + + 1 0 12288 0 @@ -589,6 +785,7 @@ 0 18432 1 + 44100 Track 1 0 @@ -600,15 +797,14 @@ 0 0 0 - 65535 - 65535 0 + 1 0 0 0 100 100 - 1 + 1 Track 1 @@ -626,13 +822,16 @@ 20 0 1 - 0 - 0 0 - 0 - + 0 + 0 + + 0 1.02164, - + + 0 0, + + @@ -643,24 +842,23 @@ 1 2 20 - 124 - 0 - 0 + 1 0 - 1 - + 0 + 0 + + 0 1.41091, + + + 0 0, - + fluid + 1 - 0 - - - 7c 00 01 2f 68 6f 6d 65 2f 77 73 2f 73 66 6f 6e - 74 2f 46 6c 75 69 64 52 33 2e 53 46 32 00 - - + 0 + organ-1 @@ -671,52 +869,33 @@ 1 20 0 - 0 - 0 0 - 0 - + 0 + 0 + + 0 1.02164, + + + 0 -0.04, - + organ + 0 - 0 + 0 + + - - 00 00 03 00 ff 3f 00 00 01 00 03 00 ff 3f 00 00 - 02 00 03 00 ff 3f 00 00 03 00 03 00 ff 3f 00 00 - 04 00 03 00 ff 3f 00 00 05 00 03 00 ff 3f 00 00 - 06 00 03 00 a2 00 00 00 07 00 03 00 00 00 00 00 - 08 00 03 00 ff 3f 00 00 09 00 03 00 fe 1f 00 00 - 0a 00 03 00 a2 00 00 00 0b 00 03 00 00 00 00 00 - 0c 00 03 00 ff 3f 00 00 0d 00 03 00 fe 1f 00 00 - 0e 00 03 00 01 00 00 00 0f 00 03 00 01 00 00 00 - 10 00 03 00 01 00 00 00 + + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 14 00 00 00 14 00 00 00 + 00 00 00 00 14 00 00 00 0a 00 00 00 0a 00 00 00 + 00 00 00 00 0a 00 00 00 01 00 00 00 01 00 00 00 + 01 00 00 00 00 00 00 00 - - s1-1 - 0 - 0 - 0 - 1 - 1 - 20 - 11 - 0 - 0 - 0 - 1 - - - - - s1 - 2 - 0 - vam-1 0 @@ -726,41 +905,79 @@ 1 20 0 - 0 - 0 0 - 1 - + 0 + 0 + + 0 0, + + + 0 0, - + vam + 3 - 0 + 0 + + + + + 00 20 00 00 00 20 00 00 01 00 00 00 01 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + fe 3e 00 00 fe 3e 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 ff 3f 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 7a 3a 00 00 + 00 20 00 00 00 20 00 00 00 00 00 00 00 00 00 00 + + - - 1:Out 1 - alsa_pcm:playback_1 + + + + + + + + + + + + + + + - - 2:Out 1 - alsa_pcm:playback_2 + + + - - fluid-1 - Out 1 + + + - - organ-1 - Out 1 + + + - - s1-1 - Out 1 + + + - - vam-1 - Out 1 + + + + + + + + + + + @@ -775,35 +992,15 @@ 4 + + + 0 + 1 + + - - - - - - 0:0 - - - - - 96 - 96 - - 255 - 0 - 0 - 1 - 80 - 50 - 0 - 0 - 0 - 346 - 390 - 286 -
-- cgit v1.2.3 From 03e37abb33dfcaa9d67cadbb3b1d3c5ae17b057d Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Mon, 16 May 2011 14:01:42 +0000 Subject: In "Cakewalk" mode, drum and instrument slivers are now stretched to the whole rectangle's height --- muse2/muse/arranger/pcanvas.cpp | 68 ++++++++++++++++++++++++++++++++--------- 1 file changed, 53 insertions(+), 15 deletions(-) diff --git a/muse2/muse/arranger/pcanvas.cpp b/muse2/muse/arranger/pcanvas.cpp index 599e90a0..9ad7bf3c 100644 --- a/muse2/muse/arranger/pcanvas.cpp +++ b/muse2/muse/arranger/pcanvas.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -1660,7 +1661,7 @@ void PartCanvas::drawMoving(QPainter& p, const CItem* item, const QRect&) //--------------------------------------------------------- -// drawWavePart +// drawMidiPart // bb - bounding box of paint area // pr - part rectangle //--------------------------------------------------------- @@ -1710,23 +1711,56 @@ void PartCanvas::drawMidiPart(QPainter& p, const QRect&, EventList* events, Midi } } else { // show Cakewalk Style - //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); - + using std::map; + using std::pair; + + iEvent ito(events->lower_bound(to)); //FINDMICH bool isdrum = (mt->type() == Track::DRUM); + + int lowest_pitch=127; + int highest_pitch=0; + map y_mapper; + + for (iEvent i = events->begin(); i != ito; ++i) + { + if (i->second.type()==Note) + { + 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(pitch, 0)); + } + } + } + + if (isdrum) + { + int cnt=0; + for (map::iterator it=y_mapper.begin(); it!=y_mapper.end(); it++) + { + it->second=cnt; + cnt++; + } + lowest_pitch=0; + highest_pitch=cnt-1; + } + + if (lowest_pitch==highest_pitch) + { + lowest_pitch--; + highest_pitch++; + } + for (iEvent i = events->begin(); i != ito; ++i) { int t = i->first + pTick; int te = t + i->second.lenTick(); - if (t > (to + pTick)) - { - //printf("PartCanvas::drawItem t:%d > to:%d + pTick:%d i->first:%d\n", t, to, pTick, i->first); - - break; - } - if (te < (from + pTick)) continue; @@ -1738,8 +1772,12 @@ void PartCanvas::drawMidiPart(QPainter& p, const QRect&, EventList* events, Midi int pitch = i->second.pitch(); int th = int(mt->height() * 0.75); // only draw on three quarters int hoffset = (mt->height() - th ) / 2; // offset from bottom - //int y = hoffset + (r.y() + th - (pitch * (th) / 127)); - int y = hoffset + r.y() + th - (isdrum?127-pitch:pitch) * th / 127; + int y; + if (!isdrum) + y = hoffset + r.y() + th - (pitch-lowest_pitch)*th/(highest_pitch-lowest_pitch); + else + y = hoffset + r.y() + y_mapper[pitch]*th/(highest_pitch-lowest_pitch); + p.drawLine(t, y, te, y); } } -- cgit v1.2.3 From 93ea371c955c961051b5c2e2d7b47881aec04c84 Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Mon, 16 May 2011 14:21:16 +0000 Subject: - changed appeareance settings to be able to choose between "y-stretch" and "no y-stretch" in cakewalk mode - when changing Midi to Drum or Drum to Midi in tlist, now a songChanged() gets emitted (fixes bug: slivers were not redrawn when changing that) --- muse2/muse/appearance.cpp | 5 +-- muse2/muse/arranger/pcanvas.cpp | 60 +++++++++++++++++++++--------------- muse2/muse/arranger/tlist.cpp | 3 +- muse2/muse/widgets/appearancebase.ui | 54 +++++++++++++++++++++++++++++++- 4 files changed, 94 insertions(+), 28 deletions(-) diff --git a/muse2/muse/appearance.cpp b/muse2/muse/appearance.cpp index df81e3b1..e326e868 100644 --- a/muse2/muse/appearance.cpp +++ b/muse2/muse/appearance.cpp @@ -474,6 +474,7 @@ void Appearance::resetValues() partShownames->setChecked(config->canvasShowPartType & 1); partShowevents->setChecked(config->canvasShowPartType & 2); partShowCakes->setChecked(!(config->canvasShowPartType & 2)); + partCakeStretch->setChecked(config->canvasShowPartType & 4); eventNoteon->setChecked(config->canvasShowPartEvent & (1 << 0)); eventPolypressure->setChecked(config->canvasShowPartEvent & (1 << 1)); @@ -598,8 +599,8 @@ void Appearance::apply() showPartType |= 1; if (partShowevents->isChecked()) showPartType |= 2; - //if (partShowCakes->isChecked()) - // showPartType |= 4; + if (partCakeStretch->isChecked()) + showPartType |= 4; config->canvasShowPartType = showPartType; 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 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(pitch, 0)); + } } - else + } + + if (isdrum) + { + int cnt=0; + for (map::iterator it=y_mapper.begin(); it!=y_mapper.end(); it++) { - y_mapper.insert(pair(pitch, 0)); + it->second=cnt; + cnt++; } + lowest_pitch=0; + highest_pitch=cnt-1; } - } - - if (isdrum) - { - int cnt=0; - for (map::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(); diff --git a/muse2/muse/arranger/tlist.cpp b/muse2/muse/arranger/tlist.cpp index 2a397a4e..4b531607 100644 --- a/muse2/muse/arranger/tlist.cpp +++ b/muse2/muse/arranger/tlist.cpp @@ -1660,6 +1660,7 @@ void TList::classesPopupMenu(Track* t, int x, int y) } t->setType(Track::MIDI); audio->msgIdle(false); + song->update(SC_EVENT_MODIFIED); } else if (Track::TrackType(n) == Track::DRUM && t->type() == Track::MIDI) { // @@ -1716,8 +1717,8 @@ void TList::classesPopupMenu(Track* t, int x, int y) // Add all port controller events. //audio->msgChangeAllPortDrumCtrlEvents(true); song->changeAllPortDrumCtrlEvents(true); - audio->msgIdle(false); + song->update(SC_EVENT_MODIFIED); } } diff --git a/muse2/muse/widgets/appearancebase.ui b/muse2/muse/widgets/appearancebase.ui index 8cb8c08c..a3a80a96 100644 --- a/muse2/muse/widgets/appearancebase.ui +++ b/muse2/muse/widgets/appearancebase.ui @@ -6,7 +6,7 @@ 0 0 - 538 + 558 531
@@ -69,6 +69,39 @@
+ + + + + + Qt::Horizontal + + + QSizePolicy::Maximum + + + + 30 + 20 + + + + + + + + false + + + y-stretch + + + false + + + + +
@@ -156,6 +189,9 @@ false + + false + 1 @@ -1936,5 +1972,21 @@ + + partShowCakes + toggled(bool) + partCakeStretch + setEnabled(bool) + + + 141 + 137 + + + 159 + 164 + + +
-- cgit v1.2.3 From 35d776fdb75f4e90954b402a883b1fce72de8239 Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Mon, 16 May 2011 17:39:19 +0000 Subject: the *.mf files aren't installed any more --- muse2/muse/midiedit/scoreedit.cpp | 2 ++ muse2/share/scoreglyphs/CMakeLists.txt | 5 +--- .../share/scoreglyphs/feta-original/CMakeLists.txt | 27 ---------------------- 3 files changed, 3 insertions(+), 31 deletions(-) delete mode 100644 muse2/share/scoreglyphs/feta-original/CMakeLists.txt diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index 67325b75..29cf32e4 100644 --- a/muse2/muse/midiedit/scoreedit.cpp +++ b/muse2/muse/midiedit/scoreedit.cpp @@ -4163,6 +4163,8 @@ void staff_t::apply_lasso(QRect rect, set& already_processed) * o maybe do expanding parts inside the msgChangeEvent or * msgNewEvent functions (see my e-mail) * + * o make quantize and other stuff faster (by assymetric communication) + * * GUI stuff * o velocity/release-velo for already existing notes * - do this by right-click -> some dialog shows up? diff --git a/muse2/share/scoreglyphs/CMakeLists.txt b/muse2/share/scoreglyphs/CMakeLists.txt index 16617660..fe520892 100644 --- a/muse2/share/scoreglyphs/CMakeLists.txt +++ b/muse2/share/scoreglyphs/CMakeLists.txt @@ -18,10 +18,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #============================================================================= -file (GLOB scoreglyph_files *.png LICENSE) - -subdirs( feta-original - ) +file (GLOB scoreglyph_files *.png) install( FILES ${scoreglyph_files} DESTINATION ${MusE_SHARE_DIR}/scoreglyphs diff --git a/muse2/share/scoreglyphs/feta-original/CMakeLists.txt b/muse2/share/scoreglyphs/feta-original/CMakeLists.txt deleted file mode 100644 index 04e44107..00000000 --- a/muse2/share/scoreglyphs/feta-original/CMakeLists.txt +++ /dev/null @@ -1,27 +0,0 @@ -#============================================================================= -# MusE -# Linux Music Editor -# $Id:$ -# -# Copyright (C) 2002-2006 by Werner Schweer and others -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -#============================================================================= - -file (GLOB fetaorig_files COPYING-lilypond GNUmakefile README *.pe.in *.mf *.mp) - - -install( FILES ${fetaorig_files} - DESTINATION ${MusE_SHARE_DIR}/scoreglyphs/feta-original - ) - -- cgit v1.2.3 From 231ee5b6243fd9ce02ffad93f99ec6055bc40fe0 Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Tue, 17 May 2011 12:37:51 +0000 Subject: implemented change existing note's velocity --- muse2/muse/arranger/pcanvas.cpp | 2 +- muse2/muse/functions.cpp | 36 ++++++++++ muse2/muse/functions.h | 2 + muse2/muse/midiedit/scoreedit.cpp | 137 +++++++++++++++++++++++++++++--------- muse2/muse/midiedit/scoreedit.h | 17 +++-- muse2/muse/song.cpp | 1 - muse2/muse/waveedit/waveview.cpp | 1 - 7 files changed, 157 insertions(+), 39 deletions(-) diff --git a/muse2/muse/arranger/pcanvas.cpp b/muse2/muse/arranger/pcanvas.cpp index a37e237e..40319d1e 100644 --- a/muse2/muse/arranger/pcanvas.cpp +++ b/muse2/muse/arranger/pcanvas.cpp @@ -1714,7 +1714,7 @@ void PartCanvas::drawMidiPart(QPainter& p, const QRect&, EventList* events, Midi using std::map; using std::pair; - iEvent ito(events->lower_bound(to)); //FINDMICH + iEvent ito(events->lower_bound(to)); bool isdrum = (mt->type() == Track::DRUM); int lowest_pitch=127; diff --git a/muse2/muse/functions.cpp b/muse2/muse/functions.cpp index e14f32b8..55daee2c 100644 --- a/muse2/muse/functions.cpp +++ b/muse2/muse/functions.cpp @@ -197,6 +197,42 @@ void modify_velocity(const set& parts, int range, int rate, int offset) } } +void modify_off_velocity(const set& parts, int range, int rate, int offset) +{ + map events = get_events(parts, range); + + if ( (!events.empty()) && ((rate!=100) || (offset!=0)) ) + { + song->startUndo(); + + for (map::iterator it=events.begin(); it!=events.end(); it++) + { + Event& event=*(it->first); + Part* part=it->second; + + int velo = event.veloOff(); + + velo = (velo * rate) / 100; + velo += offset; + + if (velo <= 0) + velo = 1; + else if (velo > 127) + velo = 127; + + if (event.veloOff() != velo) + { + Event newEvent = event.clone(); + newEvent.setVeloOff(velo); + // Indicate no undo, and do not do port controller values and clone parts. + audio->msgChangeEvent(event, newEvent, part, false, false, false); + } + } + + song->endUndo(SC_EVENT_MODIFIED); + } +} + void modify_notelen(const set& parts, int range, int rate, int offset) { map events = get_events(parts, range); diff --git a/muse2/muse/functions.h b/muse2/muse/functions.h index 14797a15..9477767a 100644 --- a/muse2/muse/functions.h +++ b/muse2/muse/functions.h @@ -34,9 +34,11 @@ void init_function_dialogs(QWidget* parent); std::set partlist_to_set(PartList* pl); +std::map get_events(const std::set& parts, int range); //these functions simply do their job, non-interactively void modify_velocity(const std::set& parts, int range, int rate, int offset=0); +void modify_off_velocity(const std::set& parts, int range, int rate, int offset=0); void modify_notelen(const std::set& parts, int range, int rate, int offset=0); void quantize_notes(const std::set& parts, int range, int raster, int strength=100, int swing=0, int threshold=0); void erase_notes(const std::set& parts, int range); diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index 29cf32e4..01b69e90 100644 --- a/muse2/muse/midiedit/scoreedit.cpp +++ b/muse2/muse/midiedit/scoreedit.cpp @@ -68,7 +68,8 @@ QString IntToQStr(int i); - +#define APPLY_TO_SELECTED_STRING tr("Apply to selected notes:") +#define APPLY_TO_NEW_STRING tr("Apply to new notes:") //PIXELS_PER_NOTEPOS must be greater or equal to 3*NOTE_XLEN + 2*NOTE_SHIFT @@ -166,7 +167,7 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos) setCentralWidget(mainw); - + apply_velo=false; score_canvas=new ScoreCanvas(this, mainw, 1, 1); @@ -220,17 +221,18 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos) addToolBarBreak(); - QToolBar* newnote_toolbar = addToolBar(tr("New note settings")); - newnote_toolbar->setObjectName("New note settings"); - newnote_toolbar->addWidget(new QLabel(tr("Note length:"), newnote_toolbar)); + QToolBar* note_settings_toolbar = addToolBar(tr("Note settings")); + //don't change that name, or you will lose toolbar settings + note_settings_toolbar->setObjectName("New note settings"); + note_settings_toolbar->addWidget(new QLabel(tr("Note length:"), note_settings_toolbar)); len_actions=new QActionGroup(this); - n1_action = newnote_toolbar->addAction("1", menu_mapper, SLOT(map())); - n2_action = newnote_toolbar->addAction("2", menu_mapper, SLOT(map())); - n4_action = newnote_toolbar->addAction("4", menu_mapper, SLOT(map())); - n8_action = newnote_toolbar->addAction("8", menu_mapper, SLOT(map())); - n16_action = newnote_toolbar->addAction("16", menu_mapper, SLOT(map())); - n32_action = newnote_toolbar->addAction("32", menu_mapper, SLOT(map())); - nlast_action = newnote_toolbar->addAction(tr("last"), menu_mapper, SLOT(map())); + n1_action = note_settings_toolbar->addAction("1", menu_mapper, SLOT(map())); + n2_action = note_settings_toolbar->addAction("2", menu_mapper, SLOT(map())); + n4_action = note_settings_toolbar->addAction("4", menu_mapper, SLOT(map())); + n8_action = note_settings_toolbar->addAction("8", menu_mapper, SLOT(map())); + n16_action = note_settings_toolbar->addAction("16", menu_mapper, SLOT(map())); + n32_action = note_settings_toolbar->addAction("32", menu_mapper, SLOT(map())); + nlast_action = note_settings_toolbar->addAction(tr("last"), menu_mapper, SLOT(map())); menu_mapper->setMapping(n1_action, CMD_NOTELEN_1); menu_mapper->setMapping(n2_action, CMD_NOTELEN_2); menu_mapper->setMapping(n4_action, CMD_NOTELEN_4); @@ -256,22 +258,37 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos) nlast_action->setChecked(true); menu_command(CMD_NOTELEN_LAST); - newnote_toolbar->addSeparator(); + note_settings_toolbar->addSeparator(); + + apply_velo_to_label = new QLabel(APPLY_TO_NEW_STRING, note_settings_toolbar); + int w1 = apply_velo_to_label->fontMetrics().width(APPLY_TO_NEW_STRING); + int w2 = apply_velo_to_label->fontMetrics().width(APPLY_TO_SELECTED_STRING); + if (w1>w2) + apply_velo_to_label->setFixedWidth(w1+5); + else + apply_velo_to_label->setFixedWidth(w2+5); - newnote_toolbar->addWidget(new QLabel(tr("Velocity:"), newnote_toolbar)); + note_settings_toolbar->addWidget(apply_velo_to_label); + note_settings_toolbar->addWidget(new QLabel(tr("Velocity:"), note_settings_toolbar)); velo_spinbox = new QSpinBox(this); velo_spinbox->setRange(0, 127); velo_spinbox->setSingleStep(1); - connect(velo_spinbox, SIGNAL(valueChanged(int)), score_canvas, SLOT(set_newnote_velo(int))); - newnote_toolbar->addWidget(velo_spinbox); + //we do not use the valueChanged signal, because that would generate + //many many undos when using the spin buttons. + connect(velo_spinbox, SIGNAL(editingFinished()), SLOT(velo_box_changed())); + connect(this,SIGNAL(velo_changed(int)), score_canvas, SLOT(set_velo(int))); + note_settings_toolbar->addWidget(velo_spinbox); velo_spinbox->setValue(64); - newnote_toolbar->addWidget(new QLabel(tr("Off-Velocity:"), newnote_toolbar)); + note_settings_toolbar->addWidget(new QLabel(tr("Off-Velocity:"), note_settings_toolbar)); velo_off_spinbox = new QSpinBox(this); velo_off_spinbox->setRange(0, 127); velo_off_spinbox->setSingleStep(1); - connect(velo_off_spinbox, SIGNAL(valueChanged(int)), score_canvas, SLOT(set_newnote_velo_off(int))); - newnote_toolbar->addWidget(velo_off_spinbox); + //we do not use the valueChanged signal, because that would generate + //many many undos when using the spin buttons. + connect(velo_off_spinbox, SIGNAL(editingFinished()), SLOT(velo_off_box_changed())); + connect(this,SIGNAL(velo_off_changed(int)), score_canvas, SLOT(set_velo_off(int))); + note_settings_toolbar->addWidget(velo_off_spinbox); velo_off_spinbox->setValue(64); @@ -347,7 +364,8 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos) if (!default_toolbar_state.isEmpty()) restoreState(default_toolbar_state); - + + connect(song, SIGNAL(songChanged(int)), SLOT(song_changed(int))); score_canvas->fully_recalculate(); score_canvas->goto_tick(initPos,true); @@ -356,6 +374,9 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos) set_name(name, false, true); else init_name(); + + + apply_velo=true; } void ScoreEdit::add_parts(PartList* pl, bool all_in_one) @@ -415,6 +436,46 @@ ScoreEdit::~ScoreEdit() } +void ScoreEdit::velo_box_changed() +{ + emit velo_changed(velo_spinbox->value()); +} + +void ScoreEdit::velo_off_box_changed() +{ + emit velo_off_changed(velo_off_spinbox->value()); +} + +void ScoreEdit::song_changed(int flags) +{ + if (flags & (SC_SELECTION | SC_EVENT_MODIFIED | SC_EVENT_REMOVED)) + { + map selection=get_events(score_canvas->get_all_parts(),1); + if (selection.empty()) + { + apply_velo_to_label->setText(APPLY_TO_NEW_STRING); + } + else + { + apply_velo_to_label->setText(APPLY_TO_SELECTED_STRING); + + int velo=-1; + int velo_off=-1; + for (map::iterator it=selection.begin(); it!=selection.end(); it++) + if (it->first->type()==Note) + { + if (velo==-1) velo=it->first->velo(); + else if ((velo>=0) && (velo!=it->first->velo())) velo=-2; + + if (velo_off==-1) velo_off=it->first->veloOff(); + else if ((velo_off>=0) && (velo_off!=it->first->veloOff())) velo_off=-2; + } + + if (velo>=0) velo_spinbox->setValue(velo); + if (velo_off>=0) velo_off_spinbox->setValue(velo_off); + } + } +} void ScoreEdit::canvas_width_changed(int width) { @@ -700,6 +761,9 @@ void ScoreCanvas::write_staves(int level, Xml& xml) const void ScoreEdit::readStatus(Xml& xml) { + bool apply_velo_temp=apply_velo; + apply_velo=false; + for (;;) { Xml::Token token = xml.parse(); @@ -788,6 +852,7 @@ void ScoreEdit::readStatus(Xml& xml) break; } } + apply_velo=apply_velo_temp; } void ScoreEdit::read_configuration(Xml& xml) @@ -911,7 +976,7 @@ ScoreCanvas::ScoreCanvas(ScoreEdit* pr, QWidget* parent_widget, undo_started=false; undo_flags=0; - + selected_part=NULL; last_len=384; @@ -922,8 +987,8 @@ ScoreCanvas::ScoreCanvas(ScoreEdit* pr, QWidget* parent_widget, //called again. but for safety... set_pixels_per_whole(300); //same as above. but safety rocks - set_newnote_velo(64); - set_newnote_velo_off(64); + set_velo(64); + set_velo_off(64); dragging_staff=false; @@ -3393,8 +3458,8 @@ void ScoreCanvas::mousePressEvent (QMouseEvent* event) Event newevent(Note); newevent.setPitch(y_to_pitch(y,tick, staff_it->clef)); - newevent.setVelo(newnote_velo); - newevent.setVeloOff(newnote_velo_off); + newevent.setVelo(note_velo); + newevent.setVeloOff(note_velo_off); newevent.setTick(relative_tick); newevent.setLenTick((new_len>0)?new_len:last_len); newevent.setSelected(true); @@ -3442,6 +3507,9 @@ void ScoreCanvas::mousePressEvent (QMouseEvent* event) } } } + + if (event->button()==Qt::LeftButton) + song->update(SC_SELECTION); } void ScoreCanvas::mouseReleaseEvent (QMouseEvent* event) @@ -4010,14 +4078,20 @@ void ScoreCanvas::maybe_close_if_empty() } } -void ScoreCanvas::set_newnote_velo(int velo) +void ScoreCanvas::set_velo(int velo) { - newnote_velo=velo; + note_velo=velo; + + if (parent->get_apply_velo()) + modify_velocity(get_all_parts(),1, 0,velo); } -void ScoreCanvas::set_newnote_velo_off(int velo) +void ScoreCanvas::set_velo_off(int velo) { - newnote_velo_off=velo; + note_velo_off=velo; + + if (parent->get_apply_velo()) + modify_off_velocity(get_all_parts(),1, 0,velo); } void ScoreCanvas::deselect_all() @@ -4125,7 +4199,7 @@ void staff_t::apply_lasso(QRect rect, set& already_processed) * between, for example, when a cis is tied to a des * * CURRENT TODO - * o let the user change velocity of already existent notes + * x nothing atm * * IMPORTANT TODO * o add a select-clef-toolbox for tracks @@ -4135,6 +4209,7 @@ void staff_t::apply_lasso(QRect rect, set& already_processed) * o support edge-scrolling when opening a lasso * * less important stuff + * o add functions like crescendo, set velo, mod/set velo-off * o deal with expanding parts * o use bars instead of flags over groups of 8ths / 16ths etc * o support different keys in different tracks at the same time @@ -4168,7 +4243,6 @@ void staff_t::apply_lasso(QRect rect, set& already_processed) * GUI stuff * o velocity/release-velo for already existing notes * - do this by right-click -> some dialog shows up? - * - or by selecting the note and changing the values in the same widget which also is used for new notes? * - or by controller graphs, as used by the piano roll */ @@ -4220,4 +4294,3 @@ void staff_t::apply_lasso(QRect rect, set& already_processed) * REASON: this is only a nice-to-have, which can however be * easily implemented when 4) is done */ - diff --git a/muse2/muse/midiedit/scoreedit.h b/muse2/muse/midiedit/scoreedit.h index 91d399e6..bdffd7b4 100644 --- a/muse2/muse/midiedit/scoreedit.h +++ b/muse2/muse/midiedit/scoreedit.h @@ -110,6 +110,9 @@ class ScoreEdit : public TopWin QScrollBar* yscroll; ScoreCanvas* score_canvas; + QLabel* apply_velo_to_label; + bool apply_velo; + static set names; static int width_init, height_init; static QByteArray default_toolbar_state; @@ -122,16 +125,21 @@ class ScoreEdit : public TopWin private slots: void menu_command(int); + void velo_box_changed(); + void velo_off_box_changed(); signals: void deleted(unsigned long); void name_changed(); + void velo_changed(int); + void velo_off_changed(int); public slots: void canvas_width_changed(int); void viewport_width_changed(int); void canvas_height_changed(int); void viewport_height_changed(int); + void song_changed(int); public: ScoreEdit(QWidget* parent = 0, const char* name = 0, unsigned initPos = MAXINT); @@ -144,6 +152,7 @@ class ScoreEdit : public TopWin void add_parts(PartList* pl, bool all_in_one=false); QString get_name() { return name; } + bool get_apply_velo() { return apply_velo; } }; @@ -601,8 +610,8 @@ class ScoreCanvas : public View int _quant_power2; int _pixels_per_whole; - int newnote_velo; - int newnote_velo_off; + int note_velo; + int note_velo_off; std::map pos_add_list; @@ -705,8 +714,8 @@ class ScoreCanvas : public View void preamble_timesig_slot(bool); void set_pixels_per_whole(int); - void set_newnote_velo(int); - void set_newnote_velo_off(int); + void set_velo(int); + void set_velo_off(int); signals: void xscroll_changed(int); diff --git a/muse2/muse/song.cpp b/muse2/muse/song.cpp index e6fa9cab..1c451f55 100644 --- a/muse2/muse/song.cpp +++ b/muse2/muse/song.cpp @@ -3769,7 +3769,6 @@ void Song::executeScript(const char* scriptfile, PartList* parts, int quant, boo QStringList sl = line.split(" "); Event e(Controller); - int tick = sl[1].toInt(); int a = sl[2].toInt(); int b = sl[3].toInt(); int c = sl[4].toInt(); diff --git a/muse2/muse/waveedit/waveview.cpp b/muse2/muse/waveedit/waveview.cpp index 0c387f72..1c7f74f2 100644 --- a/muse2/muse/waveedit/waveview.cpp +++ b/muse2/muse/waveedit/waveview.cpp @@ -392,7 +392,6 @@ void WaveView::wheelEvent(QWheelEvent* ev) int keyState = ev->modifiers(); bool shift = keyState & Qt::ShiftModifier; - bool alt = keyState & Qt::AltModifier; bool ctrl = keyState & Qt::ControlModifier; if (shift) { // scroll vertically -- cgit v1.2.3 From 4269edacdddc21f94061b121678c78d9e4935f2f Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Wed, 18 May 2011 15:01:21 +0000 Subject: implemented crescendo function --- muse2/muse/functions.cpp | 61 ++++++++++ muse2/muse/functions.h | 4 + muse2/muse/midiedit/dcanvas.h | 2 +- muse2/muse/midiedit/drumedit.cpp | 4 + muse2/muse/midiedit/drumedit.h | 2 +- muse2/muse/midiedit/pianoroll.cpp | 5 + muse2/muse/midiedit/pianoroll.h | 1 + muse2/muse/midiedit/prcanvas.h | 4 +- muse2/muse/midiedit/scoreedit.cpp | 16 ++- muse2/muse/midiedit/scoreedit.h | 2 +- muse2/muse/widgets/CMakeLists.txt | 3 + muse2/muse/widgets/crescendo.cpp | 112 ++++++++++++++++++ muse2/muse/widgets/crescendo.h | 46 ++++++++ muse2/muse/widgets/crescendobase.ui | 223 ++++++++++++++++++++++++++++++++++++ 14 files changed, 477 insertions(+), 8 deletions(-) create mode 100644 muse2/muse/widgets/crescendo.cpp create mode 100644 muse2/muse/widgets/crescendo.h create mode 100644 muse2/muse/widgets/crescendobase.ui diff --git a/muse2/muse/functions.cpp b/muse2/muse/functions.cpp index 55daee2c..3c6bbc89 100644 --- a/muse2/muse/functions.cpp +++ b/muse2/muse/functions.cpp @@ -14,6 +14,8 @@ #include +#include + using namespace std; GateTime* gatetime_dialog=NULL; @@ -24,6 +26,7 @@ DelOverlaps* del_overlaps_dialog=NULL; Setlen* set_notelen_dialog=NULL; Move* move_notes_dialog=NULL; Transpose* transpose_dialog=NULL; +Crescendo* crescendo_dialog=NULL; void init_function_dialogs(QWidget* parent) { @@ -35,6 +38,7 @@ void init_function_dialogs(QWidget* parent) set_notelen_dialog = new Setlen(parent); move_notes_dialog = new Move(parent); transpose_dialog = new Transpose(parent); + crescendo_dialog = new Crescendo(parent); } set partlist_to_set(PartList* pl) @@ -159,6 +163,22 @@ bool transpose_notes(const set& parts) return true; } +bool crescendo(const set& parts) +{ + if (song->rpos() <= song->lpos()) + { + QMessageBox::warning(NULL, QObject::tr("Error"), QObject::tr("Please first select the range for crescendo with the loop markers.")); + return false; + } + + if (!crescendo_dialog->exec()) + return false; + + crescendo(parts,crescendo_dialog->range,crescendo_dialog->start_val,crescendo_dialog->end_val,crescendo_dialog->absolute); + + return true; +} + void modify_velocity(const set& parts, int range, int rate, int offset) @@ -391,6 +411,44 @@ void transpose_notes(const set& parts, int range, signed int halftonestep } } +void crescendo(const set& parts, int range, int start_val, int end_val, bool absolute) +{ + map events = get_events(parts, range); + + int from=song->lpos(); + int to=song->rpos(); + + if ( (!events.empty()) && (to>from) ) + { + song->startUndo(); + + for (map::iterator it=events.begin(); it!=events.end(); it++) + { + Event& event=*(it->first); + Part* part=it->second; + + unsigned tick = event.tick() + part->tick(); + float curr_val= (float)start_val + (float)(end_val-start_val) * (tick-from) / (to-from); + + Event newEvent = event.clone(); + int velo = event.velo(); + + if (absolute) + velo=curr_val; + else + velo=curr_val*velo/100; + + if (velo > 127) velo=127; + if (velo <= 0) velo=1; + newEvent.setVelo(velo); + // Indicate no undo, and do not do port controller values and clone parts. + audio->msgChangeEvent(event, newEvent, part, false, false, false); + } + + song->endUndo(SC_EVENT_MODIFIED); + } +} + void move_notes(const set& parts, int range, signed int ticks) //TODO FINDMICH: safety checks { map events = get_events(parts, range); @@ -510,6 +568,8 @@ void read_function_dialog_config(Xml& xml) move_notes_dialog->read_configuration(xml); else if (tag == "transpose") transpose_dialog->read_configuration(xml); + else if (tag == "crescendo") + crescendo_dialog->read_configuration(xml); else xml.unknown("function_dialogs"); break; @@ -536,6 +596,7 @@ void write_function_dialog_config(int level, Xml& xml) set_notelen_dialog->write_configuration(level, xml); move_notes_dialog->write_configuration(level, xml); transpose_dialog->write_configuration(level, xml); + crescendo_dialog->write_configuration(level, xml); xml.tag(level, "/dialogs"); } diff --git a/muse2/muse/functions.h b/muse2/muse/functions.h index 9477767a..a0228831 100644 --- a/muse2/muse/functions.h +++ b/muse2/muse/functions.h @@ -10,6 +10,7 @@ #include "velocity.h" #include "quantize.h" +#include "crescendo.h" #include "gatetime.h" #include "remove.h" #include "transpose.h" @@ -29,6 +30,7 @@ extern DelOverlaps* del_overlaps_dialog; extern Setlen* set_notelen_dialog; extern Move* move_notes_dialog; extern Transpose* transpose_dialog; +extern Crescendo* crescendo_dialog; void init_function_dialogs(QWidget* parent); @@ -46,6 +48,7 @@ void delete_overlaps(const std::set& parts, int range); void set_notelen(const std::set& parts, int range, int len); void move_notes(const std::set& parts, int range, signed int ticks); void transpose_notes(const std::set& parts, int range, signed int halftonesteps); +void crescendo(const std::set& parts, int range, int start_val, int end_val, bool absolute); //the below functions automatically open the dialog @@ -56,6 +59,7 @@ bool quantize_notes(const std::set& parts); bool set_notelen(const std::set& parts); bool move_notes(const std::set& parts); bool transpose_notes(const std::set& parts); +bool crescendo(const std::set& parts); bool erase_notes(const std::set& parts); bool delete_overlaps(const std::set& parts); diff --git a/muse2/muse/midiedit/dcanvas.h b/muse2/muse/midiedit/dcanvas.h index 8bd70d89..cf653648 100644 --- a/muse2/muse/midiedit/dcanvas.h +++ b/muse2/muse/midiedit/dcanvas.h @@ -90,7 +90,7 @@ class DrumCanvas : public EventCanvas { CMD_CUT, CMD_COPY, CMD_PASTE, CMD_SAVE, CMD_LOAD, CMD_RESET, CMD_SELECT_ALL, CMD_SELECT_NONE, CMD_SELECT_INVERT, CMD_SELECT_ILOOP, CMD_SELECT_OLOOP, CMD_SELECT_PREV_PART, CMD_SELECT_NEXT_PART, - CMD_DEL, CMD_FIXED_LEN, CMD_RIGHT, CMD_LEFT, CMD_RIGHT_NOSNAP, CMD_LEFT_NOSNAP, CMD_MODIFY_VELOCITY, + CMD_DEL, CMD_FIXED_LEN, CMD_RIGHT, CMD_LEFT, CMD_RIGHT_NOSNAP, CMD_LEFT_NOSNAP, CMD_MODIFY_VELOCITY, CMD_CRESCENDO, CMD_QUANTIZE, CMD_ERASE_EVENT, CMD_NOTE_SHIFT, CMD_DELETE_OVERLAPS }; DrumCanvas(MidiEditor*, QWidget*, int, int, diff --git a/muse2/muse/midiedit/drumedit.cpp b/muse2/muse/midiedit/drumedit.cpp index b8d97283..1b7001f2 100644 --- a/muse2/muse/midiedit/drumedit.cpp +++ b/muse2/muse/midiedit/drumedit.cpp @@ -235,6 +235,7 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini fixedAction = menuFunctions->addAction(tr("Set Fixed Length")); veloAction = menuFunctions->addAction(tr("Modify Velocity")); + crescAction = menuFunctions->addAction(tr("Crescendo/Decrescendo")); quantizeAction = menuFunctions->addAction(tr("Quantize")); QAction* eraseEventAction = menuFunctions->addAction(tr("Erase Event")); QAction* noteShiftAction = menuFunctions->addAction(tr("Note Shift")); @@ -242,6 +243,7 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini connect(fixedAction, SIGNAL(triggered()), signalMapper, SLOT(map())); connect(veloAction, SIGNAL(triggered()), signalMapper, SLOT(map())); + connect(crescAction, SIGNAL(triggered()), signalMapper, SLOT(map())); connect(quantizeAction, SIGNAL(triggered()), signalMapper, SLOT(map())); connect(eraseEventAction, SIGNAL(triggered()), signalMapper, SLOT(map())); connect(noteShiftAction, SIGNAL(triggered()), signalMapper, SLOT(map())); @@ -249,6 +251,7 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini signalMapper->setMapping(fixedAction, DrumCanvas::CMD_FIXED_LEN); signalMapper->setMapping(veloAction, DrumCanvas::CMD_MODIFY_VELOCITY); + signalMapper->setMapping(crescAction, DrumCanvas::CMD_CRESCENDO); signalMapper->setMapping(quantizeAction, DrumCanvas::CMD_QUANTIZE); signalMapper->setMapping(eraseEventAction, DrumCanvas::CMD_ERASE_EVENT); signalMapper->setMapping(noteShiftAction, DrumCanvas::CMD_NOTE_SHIFT); @@ -900,6 +903,7 @@ void DrumEdit::cmd(int cmd) case DrumCanvas::CMD_SAVE: save(); break; case DrumCanvas::CMD_RESET: reset(); break; case DrumCanvas::CMD_MODIFY_VELOCITY: modify_velocity(partlist_to_set(parts())); break; + case DrumCanvas::CMD_CRESCENDO: crescendo(partlist_to_set(parts())); break; case DrumCanvas::CMD_ERASE_EVENT: erase_notes(partlist_to_set(parts())); break; case DrumCanvas::CMD_DEL: erase_notes(partlist_to_set(parts()),1); break; //delete selected events case DrumCanvas::CMD_DELETE_OVERLAPS: delete_overlaps(partlist_to_set(parts())); break; diff --git a/muse2/muse/midiedit/drumedit.h b/muse2/muse/midiedit/drumedit.h index 242ec963..30fe8487 100644 --- a/muse2/muse/midiedit/drumedit.h +++ b/muse2/muse/midiedit/drumedit.h @@ -75,7 +75,7 @@ class DrumEdit : public MidiEditor { QAction *loadAction, *saveAction, *resetAction; QAction *cutAction, *copyAction, *pasteAction, *deleteAction; - QAction *fixedAction, *veloAction, *quantizeAction; + QAction *fixedAction, *veloAction, *crescAction, *quantizeAction; QAction *sallAction, *snoneAction, *invAction, *inAction , *outAction; QAction *prevAction, *nextAction; diff --git a/muse2/muse/midiedit/pianoroll.cpp b/muse2/muse/midiedit/pianoroll.cpp index 840bd1c7..9105a446 100644 --- a/muse2/muse/midiedit/pianoroll.cpp +++ b/muse2/muse/midiedit/pianoroll.cpp @@ -190,6 +190,10 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i mapper->setMapping(funcModVelAction, PianoCanvas::CMD_MODIFY_VELOCITY); connect(funcModVelAction, SIGNAL(triggered()), mapper, SLOT(map())); + funcCrescAction = menuFunctions->addAction(tr("Crescendo/Decrescendo")); + mapper->setMapping(funcCrescAction, PianoCanvas::CMD_CRESCENDO); + connect(funcCrescAction, SIGNAL(triggered()), mapper, SLOT(map())); + funcTransposeAction = menuFunctions->addAction(tr("Transpose")); mapper->setMapping(funcTransposeAction, PianoCanvas::CMD_TRANSPOSE); connect(funcTransposeAction, SIGNAL(triggered()), mapper, SLOT(map())); @@ -598,6 +602,7 @@ void PianoRoll::cmd(int cmd) { case PianoCanvas::CMD_MODIFY_GATE_TIME: modify_notelen(partlist_to_set(parts())); break; case PianoCanvas::CMD_MODIFY_VELOCITY: modify_velocity(partlist_to_set(parts())); break; + case PianoCanvas::CMD_CRESCENDO: crescendo(partlist_to_set(parts())); break; case PianoCanvas::CMD_QUANTIZE: quantize_notes(partlist_to_set(parts())); break; case PianoCanvas::CMD_TRANSPOSE: transpose_notes(partlist_to_set(parts())); break; case PianoCanvas::CMD_ERASE_EVENT: erase_notes(partlist_to_set(parts())); break; diff --git a/muse2/muse/midiedit/pianoroll.h b/muse2/muse/midiedit/pianoroll.h index e157db10..58c2487a 100644 --- a/muse2/muse/midiedit/pianoroll.h +++ b/muse2/muse/midiedit/pianoroll.h @@ -84,6 +84,7 @@ class PianoRoll : public MidiEditor { QAction* funcQuantizeAction; QAction* funcGateTimeAction; QAction* funcModVelAction; + QAction* funcCrescAction; QAction* funcTransposeAction; QAction* funcEraseEventAction; QAction* funcNoteShiftAction; diff --git a/muse2/muse/midiedit/prcanvas.h b/muse2/muse/midiedit/prcanvas.h index 39506a13..9922b471 100644 --- a/muse2/muse/midiedit/prcanvas.h +++ b/muse2/muse/midiedit/prcanvas.h @@ -89,8 +89,8 @@ class PianoCanvas : public EventCanvas { CMD_QUANTIZE, CMD_SELECT_ALL, CMD_SELECT_NONE, CMD_SELECT_INVERT, CMD_SELECT_ILOOP, CMD_SELECT_OLOOP, CMD_SELECT_PREV_PART, CMD_SELECT_NEXT_PART, - CMD_MODIFY_GATE_TIME, CMD_MODIFY_VELOCITY, - CMD_CRESCENDO, CMD_TRANSPOSE, CMD_THIN_OUT, CMD_ERASE_EVENT, + CMD_MODIFY_GATE_TIME, CMD_MODIFY_VELOCITY, CMD_CRESCENDO, + CMD_TRANSPOSE, CMD_THIN_OUT, CMD_ERASE_EVENT, CMD_NOTE_SHIFT, CMD_MOVE_CLOCK, CMD_COPY_MEASURE, CMD_ERASE_MEASURE, CMD_DELETE_MEASURE, CMD_CREATE_MEASURE, CMD_FIXED_LEN, CMD_DELETE_OVERLAPS diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index 01b69e90..13586a72 100644 --- a/muse2/muse/midiedit/scoreedit.cpp +++ b/muse2/muse/midiedit/scoreedit.cpp @@ -358,9 +358,11 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos) QAction* func_quantize_action = functions_menu->addAction(tr("&Quantize"), menu_mapper, SLOT(map())); QAction* func_notelen_action = functions_menu->addAction(tr("Change note &length"), menu_mapper, SLOT(map())); QAction* func_velocity_action = functions_menu->addAction(tr("Change note &velocity"), menu_mapper, SLOT(map())); + QAction* func_cresc_action = functions_menu->addAction(tr("Crescendo/Decrescendo"), menu_mapper, SLOT(map())); menu_mapper->setMapping(func_quantize_action, CMD_QUANTIZE); menu_mapper->setMapping(func_notelen_action, CMD_NOTELEN); menu_mapper->setMapping(func_velocity_action, CMD_VELOCITY); + menu_mapper->setMapping(func_cresc_action, CMD_CRESCENDO); if (!default_toolbar_state.isEmpty()) restoreState(default_toolbar_state); @@ -562,6 +564,7 @@ void ScoreEdit::menu_command(int cmd) case CMD_QUANTIZE: quantize_notes(score_canvas->get_all_parts()); break; case CMD_VELOCITY: modify_velocity(score_canvas->get_all_parts()); break; + case CMD_CRESCENDO: crescendo(score_canvas->get_all_parts()); break; case CMD_NOTELEN: modify_notelen(score_canvas->get_all_parts()); break; default: @@ -4199,17 +4202,23 @@ void staff_t::apply_lasso(QRect rect, set& already_processed) * between, for example, when a cis is tied to a des * * CURRENT TODO - * x nothing atm + * o add functions like crescendo, set velo, mod/set velo-off + * o import midi: speed up + * o draw controllers in part "slivers" * * IMPORTANT TODO + * o display blue loop markers + * o transpose: support in-key-transpose + * o drum-loop-editor (like in sq korg ds xD) + * o in step-rec: insert chords + * * o add a select-clef-toolbox for tracks * o respect the track's clef (has to be implemented first in muse) * o do partial recalculating; recalculating can take pretty long * (0,5 sec) when displaying a whole song in scores - * o support edge-scrolling when opening a lasso + * o transpose etc. must also transpose key-pressure events * * less important stuff - * o add functions like crescendo, set velo, mod/set velo-off * o deal with expanding parts * o use bars instead of flags over groups of 8ths / 16ths etc * o support different keys in different tracks at the same time @@ -4217,6 +4226,7 @@ void staff_t::apply_lasso(QRect rect, set& already_processed) * calc_pos_add_list must be called before calc_item_pos then, * and calc_item_pos must respect the pos_add_list instead of * keeping its own pos_add variable (which is only an optimisation) + * o support edge-scrolling when opening a lasso * o save more configuration stuff (quant, color) * * really unimportant nice-to-haves diff --git a/muse2/muse/midiedit/scoreedit.h b/muse2/muse/midiedit/scoreedit.h index bdffd7b4..c26bdd84 100644 --- a/muse2/muse/midiedit/scoreedit.h +++ b/muse2/muse/midiedit/scoreedit.h @@ -57,7 +57,7 @@ enum {CMD_COLOR_BLACK, CMD_COLOR_VELO, CMD_COLOR_PART, CMD_NOTELEN_1, CMD_NOTELEN_2, CMD_NOTELEN_4, CMD_NOTELEN_8, CMD_NOTELEN_16, CMD_NOTELEN_32, CMD_NOTELEN_LAST, - CMD_QUANTIZE, CMD_VELOCITY, CMD_NOTELEN }; + CMD_QUANTIZE, CMD_VELOCITY, CMD_CRESCENDO, CMD_NOTELEN }; class ScoreCanvas; class EditToolBar; diff --git a/muse2/muse/widgets/CMakeLists.txt b/muse2/muse/widgets/CMakeLists.txt index 0ca33d5a..c8415d73 100644 --- a/muse2/muse/widgets/CMakeLists.txt +++ b/muse2/muse/widgets/CMakeLists.txt @@ -78,6 +78,7 @@ QT4_WRAP_CPP (widget_mocs unusedwavefiles.h velocity.h quantize.h + crescendo.h move.h remove.h deloverlaps.h @@ -120,6 +121,7 @@ file (GLOB widgets_ui_files unusedwavefiles.ui velocitybase.ui quantbase.ui + crescendobase.ui movebase.ui removebase.ui deloverlapsbase.ui @@ -193,6 +195,7 @@ file (GLOB widgets_source_files utils.cpp velocity.cpp quantize.cpp + crescendo.cpp move.cpp remove.cpp deloverlaps.cpp diff --git a/muse2/muse/widgets/crescendo.cpp b/muse2/muse/widgets/crescendo.cpp new file mode 100644 index 00000000..ef31c5ef --- /dev/null +++ b/muse2/muse/widgets/crescendo.cpp @@ -0,0 +1,112 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: crescendo.cpp,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#include +#include "crescendo.h" +#include "xml.h" + +Crescendo::Crescendo(QWidget* parent) + : QDialog(parent) +{ + setupUi(this); + range_group = new QButtonGroup; + range_group->addButton(looped_events_button,2); + range_group->addButton(selected_looped_button,3); + + connect(absolute_button, SIGNAL(toggled(bool)), SLOT(absolute_changed(bool))); + + pull_values(); +} + +void Crescendo::pull_values() +{ + range = range_group->checkedId(); + start_val = start_spinbox->value(); + end_val = end_spinbox->value(); + absolute = absolute_button->isChecked(); +} + +void Crescendo::accept() +{ + pull_values(); + QDialog::accept(); +} + +int Crescendo::exec() +{ + if ((range < 2) || (range > 3)) range=3; + + range_group->button(range)->setChecked(true); + start_spinbox->setValue(start_val); + end_spinbox->setValue(end_val); + absolute_button->setChecked(absolute); + absolute_changed(absolute); + + return QDialog::exec(); +} + +void Crescendo::read_configuration(Xml& xml) +{ + for (;;) + { + Xml::Token token = xml.parse(); + if (token == Xml::Error || token == Xml::End) + break; + + const QString& tag = xml.s1(); + switch (token) + { + case Xml::TagStart: + if (tag == "range") + range=xml.parseInt(); + else if (tag == "start") + start_val=xml.parseInt(); + else if (tag == "end") + end_val=xml.parseInt(); + else if (tag == "absolute") + absolute=xml.parseInt(); + else + xml.unknown("Crescendo"); + break; + + case Xml::TagEnd: + if (tag == "crescendo") + return; + + default: + break; + } + } +} + +void Crescendo::write_configuration(int level, Xml& xml) +{ + xml.tag(level++, "crescendo"); + xml.intTag(level, "range", range); + xml.intTag(level, "start", start_val); + xml.intTag(level, "end", end_val); + xml.intTag(level, "absolute", absolute); + xml.tag(level, "/crescendo"); +} + +void Crescendo::absolute_changed(bool val) +{ + if (val) + { + start_spinbox->setMaximum(127); + start_spinbox->setSuffix(""); + end_spinbox->setMaximum(127); + end_spinbox->setSuffix(""); + } + else + { + start_spinbox->setMaximum(12700); + start_spinbox->setSuffix(" %"); + end_spinbox->setMaximum(12700); + end_spinbox->setSuffix(" %"); + } +} diff --git a/muse2/muse/widgets/crescendo.h b/muse2/muse/widgets/crescendo.h new file mode 100644 index 00000000..eb00e94f --- /dev/null +++ b/muse2/muse/widgets/crescendo.h @@ -0,0 +1,46 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: crescendo.h,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#ifndef __CRESCENDO_H__ +#define __CRESCENDO_H__ + +#include "ui_crescendobase.h" + +class QButtonGroup; +class Xml; + +class Crescendo : public QDialog, public Ui::CrescendoBase +{ + private: + Q_OBJECT + QButtonGroup* range_group; + + protected slots: + void accept(); + void pull_values(); + + public: + Crescendo(QWidget* parent = 0); + + int range; + int start_val; + int end_val; + bool absolute; + + void read_configuration(Xml& xml); + void write_configuration(int level, Xml& xml); + + + public slots: + int exec(); + + private slots: + void absolute_changed(bool); +}; + +#endif + diff --git a/muse2/muse/widgets/crescendobase.ui b/muse2/muse/widgets/crescendobase.ui new file mode 100644 index 00000000..5f4ec1f4 --- /dev/null +++ b/muse2/muse/widgets/crescendobase.ui @@ -0,0 +1,223 @@ + + + CrescendoBase + + + + 0 + 0 + 275 + 293 + + + + MusE: Crescendo/Decrescendo + + + + 6 + + + 11 + + + + + Range + + + + 6 + + + 11 + + + + + Looped Events + + + + + + + Selected Looped + + + true + + + + + + + + + + Values + + + false + + + false + + + + 11 + + + 6 + + + + + Start velocity + + + false + + + + + + + % + + + 0 + + + 12700 + + + 80 + + + + + + + End velocity + + + + + + + Absolute + + + false + + + + + + + Relative + + + true + + + + + + + % + + + 12700 + + + 130 + + + + + + + + + + 6 + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 20 + 20 + + + + + + + + OK + + + false + + + true + + + + + + + Cancel + + + + + + + + + + + + okButton + clicked() + CrescendoBase + accept() + + + 20 + 20 + + + 20 + 20 + + + + + cancelButton + clicked() + CrescendoBase + reject() + + + 20 + 20 + + + 20 + 20 + + + + + -- cgit v1.2.3 From 728839fb3581904c2a464c73419126da04c250ee Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Wed, 18 May 2011 15:07:22 +0000 Subject: removed the silly and slow loop in importmidi.cpp caution: this may have introduced bugs like infinite loops or wrong file reading (but shouldn't). test it well! --- muse2/muse/importmidi.cpp | 60 ++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 32 deletions(-) diff --git a/muse2/muse/importmidi.cpp b/muse2/muse/importmidi.cpp index 6917a0fd..3e4e641e 100644 --- a/muse2/muse/importmidi.cpp +++ b/muse2/muse/importmidi.cpp @@ -10,6 +10,9 @@ #include #include +#include +#include + #include #include "app.h" @@ -32,6 +35,9 @@ #include "audio.h" #include "gconfig.h" +using std::set; +using std::pair; + //--------------------------------------------------------- // importMidi //--------------------------------------------------------- @@ -137,26 +143,27 @@ bool MusE::importMidi(const QString name, bool merge) // the first target track bool first = true; - // somewhat silly and slooow: - for (int port = 0; port < MIDI_PORTS; ++port) { - for (int channel = 0; channel < MIDI_CHANNELS; ++channel) { - // - // check if there are any events for port/channel in track: - // - iMPEvent i; - for (i = el->begin(); i != el->end(); ++i) { - MidiPlayEvent ev = *i; - if (ev.type() != ME_SYSEX && ev.type() != ME_META - && ev.channel() == channel && ev.port() == port) - break; - } - if (i == el->end()) - continue; + + // vastly changed by flo: replaced that silly loop + // with that already_processed-set-check. + // this makes stuff really fast :) + + iMPEvent ev; + set< pair > already_processed; + for (ev = el->begin(); ev != el->end(); ++ev) + { + if (ev->type() != ME_SYSEX && ev->type() != ME_META) + { + int channel=ev->channel(); + int port=ev->port(); + + if (already_processed.find(pair(channel, port)) == already_processed.end()) + { + already_processed.insert(pair(channel, port)); + MidiTrack* track = new MidiTrack(); if ((*t)->isDrumTrack) - { track->setType(Track::DRUM); - } track->setOutChannel(channel); track->setOutPort(port); @@ -171,15 +178,6 @@ bool MusE::importMidi(const QString name, bool merge) buildMidiEventList(mel, el, track, division, first, false); first = false; - // Removed by T356. Handled by addPortCtrlEvents() below. - //for (iEvent i = mel->begin(); i != mel->end(); ++i) { - // Event event = i->second; - // if (event.type() == Controller) { - // importController(channel, mport, event.dataA()); - // midiPorts[track->outPort()].setCtrl(channel, event.tick(), event.dataA(), event.dataB()); - // } - // } - // Comment Added by T356. // Hmm. buildMidiEventList already takes care of this. // But it seems to work. How? Must test. @@ -208,13 +206,11 @@ bool MusE::importMidi(const QString name, bool merge) processTrack(track); - // Added by T356. Send all controller values to the port's controller value list. - // No, done in song->insertTrack2() now. - //track->addPortCtrlEvents(); - song->insertTrack0(track, -1); - } - } + } + } + } + if (first) { // // track does only contain non-channel messages -- cgit v1.2.3 From 6b7d01342f2492617e6eee599bce5429ac164237 Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Wed, 18 May 2011 16:08:01 +0000 Subject: arranger now displays some controllers, pitchbend and program changes in "cakewalk" mode --- muse2/muse/arranger/pcanvas.cpp | 92 +++++++++++++++++++++++++++++++++++---- muse2/muse/midiedit/scoreedit.cpp | 5 +-- 2 files changed, 85 insertions(+), 12 deletions(-) diff --git a/muse2/muse/arranger/pcanvas.cpp b/muse2/muse/arranger/pcanvas.cpp index 40319d1e..daaf2d28 100644 --- a/muse2/muse/arranger/pcanvas.cpp +++ b/muse2/muse/arranger/pcanvas.cpp @@ -41,6 +41,7 @@ #include "mpevent.h" #include "midievent.h" #include "midi.h" +#include "midictrl.h" #include "utils.h" // Moved into global config by Tim. @@ -1669,28 +1670,26 @@ void PartCanvas::drawMoving(QPainter& p, const CItem* item, const QRect&) void PartCanvas::drawMidiPart(QPainter& p, const QRect&, EventList* events, MidiTrack *mt, MidiPart *pt, const QRect& r, int pTick, int from, int to) { //printf("x=%d y=%d h=%d w=%d\n",r.x(),r.y(),r.height(),r.width()); - + int color_brightness; + if(pt) { int part_r, part_g, part_b, brightness; config.partColors[pt->colorIndex()].getRgb(&part_r, &part_g, &part_b); brightness = part_r*29 + part_g*59 + part_b*12; if (brightness < 12000 || pt->selected()) - //p.setPen(Qt::white); // too dark: use white for color - p.setPen(QColor(192,192,192)); // too dark: use lighter color + color_brightness=192; // too dark: use lighter color else - //p.setPen(Qt::black); // otherwise use black - p.setPen(QColor(64,64,64)); // otherwise use dark color + color_brightness=64; // otherwise use dark color } else - p.setPen(QColor(80,80,80)); + color_brightness=80; if (config.canvasShowPartType & 2) { // show events + p.setPen(QColor(color_brightness,color_brightness,color_brightness)); // Do not allow this, causes segfault. if(from <= to) { - //p.setPen(QColor(80,80,80)); - //EventList* events = mp->events(); iEvent ito(events->lower_bound(to)); for (iEvent i = events->lower_bound(from); i != ito; ++i) { @@ -1717,6 +1716,80 @@ void PartCanvas::drawMidiPart(QPainter& p, const QRect&, EventList* events, Midi iEvent ito(events->lower_bound(to)); bool isdrum = (mt->type() == Track::DRUM); + // draw controllers ------------------------------------------ + p.setPen(QColor(192,192,color_brightness/2)); + for (iEvent i = events->begin(); i != ito; ++i) { // PITCH BEND + int t = i->first + pTick; + + EventType type = i->second.type(); + if (type == Controller) { + int ctrl_type=i->second.dataA(); + int val=i->second.dataB(); + + int th = int(mt->height() * 0.75); // only draw on three quarters + int hoffset = (mt->height() - th ) / 2; // offset from bottom + + if (ctrl_type == CTRL_PITCH) + p.drawLine(t, hoffset + r.y() + th/2, t, hoffset + r.y() + val*th/8192/2 + th/2); + } + } + + p.setPen(QColor(192,color_brightness/2,color_brightness/2)); + for (iEvent i = events->begin(); i != ito; ++i) { // PAN + int t = i->first + pTick; + + EventType type = i->second.type(); + if (type == Controller) { + int ctrl_type=i->second.dataA(); + int val=i->second.dataB(); + + int th = int(mt->height() * 0.75); // only draw on three quarters + int hoffset = (mt->height() - th ) / 2; // offset from bottom + + if (ctrl_type == 10) + p.drawLine(t, hoffset + r.y() + val*th/127, t, hoffset + r.y() + th); + } + } + + p.setPen(QColor(color_brightness/2,192,color_brightness/2)); + for (iEvent i = events->begin(); i != ito; ++i) { // VOLUME + int t = i->first + pTick; + + EventType type = i->second.type(); + if (type == Controller) { + int ctrl_type=i->second.dataA(); + int val=i->second.dataB(); + + int th = int(mt->height() * 0.75); // only draw on three quarters + int hoffset = (mt->height() - th ) / 2; // offset from bottom + + if (ctrl_type == 7) + p.drawLine(t, hoffset + r.y() + val*th/127, t, hoffset + r.y() + th); + } + } + + p.setPen(QColor(0,0,255)); + for (iEvent i = events->begin(); i != ito; ++i) { // PROGRAM CHANGE + int t = i->first + pTick; + + EventType type = i->second.type(); + if (type == Controller) { + int ctrl_type=i->second.dataA(); + + int th = int(mt->height() * 0.75); // only draw on three quarters + int hoffset = (mt->height() - th ) / 2; // offset from bottom + + if (ctrl_type == CTRL_PROGRAM) + p.drawLine(t, hoffset + r.y(), t, hoffset + r.y() + th); + } + } + + + + + + // draw notes ------------------------------------------------ + int lowest_pitch=127; int highest_pitch=0; map y_mapper; @@ -1768,7 +1841,8 @@ void PartCanvas::drawMidiPart(QPainter& p, const QRect&, EventList* events, Midi for (int cnt=0;cnt<127;cnt++) y_mapper[cnt]=cnt; } - + + p.setPen(QColor(color_brightness,color_brightness,color_brightness)); for (iEvent i = events->begin(); i != ito; ++i) { int t = i->first + pTick; int te = t + i->second.lenTick(); diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index 13586a72..9a4f6820 100644 --- a/muse2/muse/midiedit/scoreedit.cpp +++ b/muse2/muse/midiedit/scoreedit.cpp @@ -4202,12 +4202,10 @@ void staff_t::apply_lasso(QRect rect, set& already_processed) * between, for example, when a cis is tied to a des * * CURRENT TODO - * o add functions like crescendo, set velo, mod/set velo-off - * o import midi: speed up * o draw controllers in part "slivers" * * IMPORTANT TODO - * o display blue loop markers + * o display blue loop markers in score editor * o transpose: support in-key-transpose * o drum-loop-editor (like in sq korg ds xD) * o in step-rec: insert chords @@ -4219,6 +4217,7 @@ void staff_t::apply_lasso(QRect rect, set& already_processed) * o transpose etc. must also transpose key-pressure events * * less important stuff + * o add functions like set velo, mod/set velo-off * o deal with expanding parts * o use bars instead of flags over groups of 8ths / 16ths etc * o support different keys in different tracks at the same time -- cgit v1.2.3 From 26eebe4c5667c3b24cfc158358398f1598f3971c Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Wed, 18 May 2011 16:54:22 +0000 Subject: speeded up importing midi a bit more --- muse2/muse/midi.cpp | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/muse2/muse/midi.cpp b/muse2/muse/midi.cpp index 7087b342..52119692 100644 --- a/muse2/muse/midi.cpp +++ b/muse2/muse/midi.cpp @@ -480,17 +480,11 @@ void buildMidiEventList(EventList* del, const MPEventList* el, MidiTrack* track, // } // Added by Tim. p3.3.8 - - // The loop is a safe way to delete while iterating. - bool loop; - do - { - loop = false; - + // Loop removed by flo for (iEvent i = mel.begin(); i != mel.end(); ++i) { Event ev = i->second; if (ev.isNote()) { - if (ev.isNoteOff()) { + if (ev.isNoteOff()) { iEvent k; bool found = false; for (k = i; k != mel.end(); ++k) { @@ -511,25 +505,26 @@ void buildMidiEventList(EventList* del, const MPEventList* el, MidiTrack* track, if (!found) { printf("NOTE OFF without Note ON tick %d type %d %d %d\n", ev.tick(), ev.type(), ev.pitch(), ev.velo()); + continue; } else { - mel.erase(k); - - // Changed by Tim. p3.3.8 - //continue; - loop = true; - break; + if (k==i) + printf("ERROR: THIS SHOULD NEVER HAPPEN: k==i in midi.cpp:buildMidiEventList()\n"); + else + mel.erase(k); + // we may safely continue, because k!=i; only erasing + // i itself would invalidate it and require additional stuff + continue; } } + else { // !ev.isNoteOff() // Added by Tim. p3.3.8 // If the event length is not zero, it means the event and its // note on/off have already been taken care of. So ignore it. if(ev.lenTick() != 0) - { continue; - } iEvent k; for (k = mel.lower_bound(ev.tick()); k != mel.end(); ++k) { @@ -563,16 +558,16 @@ void buildMidiEventList(EventList* del, const MPEventList* el, MidiTrack* track, ev.setLenTick(endTick-ev.tick()); } else { - mel.erase(k); - // Added by Tim. p3.3.8 - loop = true; - break; + if (k==i) + printf("ERROR: THIS SHOULD NEVER HAPPEN: k==i in midi.cpp:buildMidiEventList()\n"); + else + mel.erase(k); + continue; } } + } } - } - while (loop); // DEBUG: any note offs left? -- cgit v1.2.3 From 755119791d4f2d1220ffa8175a53c4c148a93c21 Mon Sep 17 00:00:00 2001 From: Robert Jonsson Date: Wed, 18 May 2011 18:29:07 +0000 Subject: moved midi dialogs to sub project/dir --- muse2/muse/CMakeLists.txt | 1 + muse2/muse/functions.h | 4 +- muse2/muse/widgets/CMakeLists.txt | 12 +- muse2/muse/widgets/function_dialogs/gatetime.cpp | 108 ++++++++ muse2/muse/widgets/function_dialogs/gatetime.h | 47 ++++ .../muse/widgets/function_dialogs/gatetimebase.ui | 220 +++++++++++++++ muse2/muse/widgets/function_dialogs/quantbase.ui | 308 +++++++++++++++++++++ muse2/muse/widgets/function_dialogs/quantize.cpp | 103 +++++++ muse2/muse/widgets/function_dialogs/quantize.h | 45 +++ muse2/muse/widgets/gatetime.cpp | 108 -------- muse2/muse/widgets/gatetime.h | 47 ---- muse2/muse/widgets/gatetimebase.ui | 220 --------------- muse2/muse/widgets/quantbase.ui | 308 --------------------- muse2/muse/widgets/quantize.cpp | 103 ------- muse2/muse/widgets/quantize.h | 45 --- 15 files changed, 840 insertions(+), 839 deletions(-) create mode 100644 muse2/muse/widgets/function_dialogs/gatetime.cpp create mode 100644 muse2/muse/widgets/function_dialogs/gatetime.h create mode 100644 muse2/muse/widgets/function_dialogs/gatetimebase.ui create mode 100644 muse2/muse/widgets/function_dialogs/quantbase.ui create mode 100644 muse2/muse/widgets/function_dialogs/quantize.cpp create mode 100644 muse2/muse/widgets/function_dialogs/quantize.h delete mode 100644 muse2/muse/widgets/gatetime.cpp delete mode 100644 muse2/muse/widgets/gatetime.h delete mode 100644 muse2/muse/widgets/gatetimebase.ui delete mode 100644 muse2/muse/widgets/quantbase.ui delete mode 100644 muse2/muse/widgets/quantize.cpp delete mode 100644 muse2/muse/widgets/quantize.h diff --git a/muse2/muse/CMakeLists.txt b/muse2/muse/CMakeLists.txt index 8705f914..761f8e96 100644 --- a/muse2/muse/CMakeLists.txt +++ b/muse2/muse/CMakeLists.txt @@ -233,6 +233,7 @@ target_link_libraries(core synti waveedit widgets + widgets_functiondialogs ${QT_LIBRARIES} ${SNDFILE_LIBRARIES} diff --git a/muse2/muse/functions.h b/muse2/muse/functions.h index a0228831..9987958b 100644 --- a/muse2/muse/functions.h +++ b/muse2/muse/functions.h @@ -9,9 +9,9 @@ #define __FUNCTIONS_H__ #include "velocity.h" -#include "quantize.h" +#include "widgets/function_dialogs/quantize.h" #include "crescendo.h" -#include "gatetime.h" +#include "widgets/function_dialogs/gatetime.h" #include "remove.h" #include "transpose.h" #include "setlen.h" diff --git a/muse2/muse/widgets/CMakeLists.txt b/muse2/muse/widgets/CMakeLists.txt index c8415d73..2d848ab0 100644 --- a/muse2/muse/widgets/CMakeLists.txt +++ b/muse2/muse/widgets/CMakeLists.txt @@ -18,6 +18,12 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #============================================================================= +set (SubDirs + function_dialogs + ) + +subdirs (${SubDirs}) + ## ## Expand Qt macros in source files ## @@ -35,7 +41,6 @@ QT4_WRAP_CPP (widget_mocs didyouknow.h doublelabel.h filedialog.h - gatetime.h genset.h header.h hitscale.h @@ -77,7 +82,6 @@ QT4_WRAP_CPP (widget_mocs ttoolbutton.h unusedwavefiles.h velocity.h - quantize.h crescendo.h move.h remove.h @@ -103,7 +107,6 @@ file (GLOB widgets_ui_files editnotedialogbase.ui editsysexdialogbase.ui fdialogbuttons.ui - gatetimebase.ui gensetbase.ui itransformbase.ui metronomebase.ui @@ -120,7 +123,6 @@ file (GLOB widgets_ui_files transposebase.ui unusedwavefiles.ui velocitybase.ui - quantbase.ui crescendobase.ui movebase.ui removebase.ui @@ -148,7 +150,6 @@ file (GLOB widgets_source_files doublelabel.cpp drange.cpp filedialog.cpp - gatetime.cpp genset.cpp header.cpp hitscale.cpp @@ -194,7 +195,6 @@ file (GLOB widgets_source_files unusedwavefiles.cpp utils.cpp velocity.cpp - quantize.cpp crescendo.cpp move.cpp remove.cpp diff --git a/muse2/muse/widgets/function_dialogs/gatetime.cpp b/muse2/muse/widgets/function_dialogs/gatetime.cpp new file mode 100644 index 00000000..9448ab1c --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/gatetime.cpp @@ -0,0 +1,108 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: gatetime.cpp,v 1.1.1.1 2003/10/27 18:54:37 wschweer Exp $ +// (C) Copyright 2001 Werner Schweer (ws@seh.de) +//========================================================= + +#include +#include + +#include "gatetime.h" + +#include "xml.h" +#include "song.h" + +//--------------------------------------------------------- +// GateTime +//--------------------------------------------------------- + +GateTime::GateTime(QWidget* parent) + : QDialog(parent) + { + setupUi(this); + rangeGroup = new QButtonGroup(rangeBox); + rangeGroup->addButton(allButton, 0); + rangeGroup->addButton(selButton, 1); + rangeGroup->addButton(loopButton, 2); + rangeGroup->addButton(sloopButton, 3); + rangeGroup->setExclusive(true); + + pullValues(); + } + +//--------------------------------------------------------- +// accept +//--------------------------------------------------------- + +void GateTime::accept() + { + pullValues(); + QDialog::accept(); + } + +//--------------------------------------------------------- +// pullValues +//--------------------------------------------------------- + +void GateTime::pullValues() + { + range = rangeGroup->checkedId(); + rateVal = rate->value(); + offsetVal = offset->value(); + } + +//--------------------------------------------------------- +// exec +//--------------------------------------------------------- + +int GateTime::exec() + { + rangeGroup->button(range)->setChecked(true); + rate->setValue(rateVal); + offset->setValue(offsetVal); + + return QDialog::exec(); + } + + +void GateTime::read_configuration(Xml& xml) +{ + for (;;) + { + Xml::Token token = xml.parse(); + if (token == Xml::Error || token == Xml::End) + break; + + const QString& tag = xml.s1(); + switch (token) + { + case Xml::TagStart: + if (tag == "range") + range=xml.parseInt(); + else if (tag == "rate") + rateVal=xml.parseInt(); + else if (tag == "offset") + offsetVal=xml.parseInt(); + else + xml.unknown("ModLen"); + break; + + case Xml::TagEnd: + if (tag == "mod_len") + return; + + default: + break; + } + } +} + +void GateTime::write_configuration(int level, Xml& xml) +{ + xml.tag(level++, "mod_len"); + xml.intTag(level, "range", range); + xml.intTag(level, "offset", offsetVal); + xml.intTag(level, "rate", rateVal); + xml.tag(level, "/mod_len"); +} diff --git a/muse2/muse/widgets/function_dialogs/gatetime.h b/muse2/muse/widgets/function_dialogs/gatetime.h new file mode 100644 index 00000000..d2555872 --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/gatetime.h @@ -0,0 +1,47 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: gatetime.h,v 1.1.1.1.2.1 2008/01/19 13:33:47 wschweer Exp $ +// (C) Copyright 2001 Werner Schweer (ws@seh.de) +//========================================================= + +#ifndef __GATETIME_H__ +#define __GATETIME_H__ + +#include "ui_gatetimebase.h" + +class QButtonGroup; +class QDialog; +class Xml; + +//--------------------------------------------------------- +// GateTime +//--------------------------------------------------------- + +class GateTime : public QDialog, public Ui::GateTimeBase { + private: + Q_OBJECT + + QButtonGroup *rangeGroup; + + protected slots: + void accept(); + void pullValues(); + + public: + GateTime(QWidget* parent=0); + + int range; + int rateVal; + int offsetVal; + + void read_configuration(Xml& xml); + void write_configuration(int level, Xml& xml); + + + public slots: + int exec(); + }; + +#endif + diff --git a/muse2/muse/widgets/function_dialogs/gatetimebase.ui b/muse2/muse/widgets/function_dialogs/gatetimebase.ui new file mode 100644 index 00000000..e804de17 --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/gatetimebase.ui @@ -0,0 +1,220 @@ + + + GateTimeBase + + + + 0 + 0 + 275 + 316 + + + + MusE: Modify Note Length + + + + 6 + + + 11 + + + + + Range + + + + 6 + + + 11 + + + + + All Events + + + + + + + Selected Events + + + true + + + + + + + Looped Events + + + + + + + Selected Looped + + + + + + + + + + Values + + + + 11 + + + 6 + + + + + Rate: + + + false + + + + + + + Offset: + + + false + + + + + + + % + + + 1000 + + + 100 + + + + + + + -999 + + + 999 + + + 1 + + + + + + + lenNew = (lenOld * rate) + offset + + + + + + + + + + 6 + + + 0 + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 0 + 0 + + + + + + + + OK + + + false + + + true + + + + + + + Cancel + + + + + + + + + + + okButton + clicked() + GateTimeBase + accept() + + + 20 + 20 + + + 20 + 20 + + + + + cancelButton + clicked() + GateTimeBase + reject() + + + 20 + 20 + + + 20 + 20 + + + + + diff --git a/muse2/muse/widgets/function_dialogs/quantbase.ui b/muse2/muse/widgets/function_dialogs/quantbase.ui new file mode 100644 index 00000000..6a88c86f --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/quantbase.ui @@ -0,0 +1,308 @@ + + + QuantBase + + + true + + + + 0 + 0 + 279 + 486 + + + + MusE: Quantize + + + + 6 + + + 11 + + + + + Range + + + + 6 + + + 11 + + + + + All Events + + + + + + + Selected Events + + + true + + + + + + + Looped Events + + + + + + + Selected Looped + + + + + + + + + + Values + + + + 11 + + + 6 + + + + + Strength: + + + false + + + + + + + % + + + 100 + + + 80 + + + + + + + Threshold (ticks): + + + false + + + + + + + 0 + + + 10000 + + + 1 + + + + + + + Quantize Len + + + + + + + + + + true + + + + + + + Raster + + + + + + + false + + + 3 + + + true + + + + Whole + + + + + Half + + + + + Quarter + + + + + 8th + + + + + 16th + + + + + 32th + + + + + + + + Swing: + + + + + + + -99 + + + + + + + If the proposed change in tick or length is smaller than threshold, nothing is done. +If swing=0, this is normal +If swing is 33, you get a 2:1-rhythm. +If swing is -33, you get a 1:2-rhythm. + + + true + + + + + + + + + + 6 + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 20 + 20 + + + + + + + + OK + + + false + + + true + + + + + + + Cancel + + + + + + + + + + + + ok_button + clicked() + QuantBase + accept() + + + 20 + 20 + + + 20 + 20 + + + + + cancel_button + clicked() + QuantBase + reject() + + + 20 + 20 + + + 20 + 20 + + + + + diff --git a/muse2/muse/widgets/function_dialogs/quantize.cpp b/muse2/muse/widgets/function_dialogs/quantize.cpp new file mode 100644 index 00000000..111087c2 --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/quantize.cpp @@ -0,0 +1,103 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: quantize.cpp,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#include +#include "quantize.h" +#include "xml.h" + +Quantize::Quantize(QWidget* parent) + : QDialog(parent) +{ + setupUi(this); + range_group = new QButtonGroup; + range_group->addButton(all_events_button,0); + range_group->addButton(selected_events_button,1); + range_group->addButton(looped_events_button,2); + range_group->addButton(selected_looped_button,3); + + pull_values(); +} + +void Quantize::pull_values() +{ + range = range_group->checkedId(); + strength = strength_spinbox->value(); + threshold = threshold_spinbox->value(); + raster_power2 = raster_combobox->currentIndex(); + quant_len = len_checkbox->isChecked(); + swing = swing_spinbox->value(); +} + +void Quantize::accept() +{ + pull_values(); + QDialog::accept(); +} + +int Quantize::exec() +{ + if ((range < 0) || (range > 3)) range=0; + + range_group->button(range)->setChecked(true); + strength_spinbox->setValue(strength); + threshold_spinbox->setValue(threshold); + raster_combobox->setCurrentIndex(raster_power2); + len_checkbox->setChecked(quant_len); + swing_spinbox->setValue(swing); + + return QDialog::exec(); +} + +void Quantize::read_configuration(Xml& xml) +{ + for (;;) + { + Xml::Token token = xml.parse(); + if (token == Xml::Error || token == Xml::End) + break; + + const QString& tag = xml.s1(); + switch (token) + { + case Xml::TagStart: + if (tag == "range") + range=xml.parseInt(); + else if (tag == "strength") + strength=xml.parseInt(); + else if (tag == "threshold") + threshold=xml.parseInt(); + else if (tag == "raster") + raster_power2=xml.parseInt(); + else if (tag == "swing") + swing=xml.parseInt(); + else if (tag == "quant_len") + quant_len=xml.parseInt(); + else + xml.unknown("Quantize"); + break; + + case Xml::TagEnd: + if (tag == "quantize") + return; + + default: + break; + } + } +} + +void Quantize::write_configuration(int level, Xml& xml) +{ + xml.tag(level++, "quantize"); + xml.intTag(level, "range", range); + xml.intTag(level, "strength", strength); + xml.intTag(level, "threshold", threshold); + xml.intTag(level, "raster", raster_power2); + xml.intTag(level, "swing", swing); + xml.intTag(level, "quant_len", quant_len); + xml.tag(level, "/quantize"); +} diff --git a/muse2/muse/widgets/function_dialogs/quantize.h b/muse2/muse/widgets/function_dialogs/quantize.h new file mode 100644 index 00000000..399e2545 --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/quantize.h @@ -0,0 +1,45 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: quantize.h,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#ifndef __QUANTIZE_H__ +#define __QUANTIZE_H__ + +#include "ui_quantbase.h" + +class QButtonGroup; +class Xml; + +class Quantize : public QDialog, public Ui::QuantBase +{ + private: + Q_OBJECT + QButtonGroup* range_group; + + protected slots: + void accept(); + void pull_values(); + + public: + Quantize(QWidget* parent = 0); + + int range; + int strength; + int threshold; + int raster_power2; + int swing; + bool quant_len; + + void read_configuration(Xml& xml); + void write_configuration(int level, Xml& xml); + + + public slots: + int exec(); +}; + +#endif + diff --git a/muse2/muse/widgets/gatetime.cpp b/muse2/muse/widgets/gatetime.cpp deleted file mode 100644 index 9448ab1c..00000000 --- a/muse2/muse/widgets/gatetime.cpp +++ /dev/null @@ -1,108 +0,0 @@ -//========================================================= -// MusE -// Linux Music Editor -// $Id: gatetime.cpp,v 1.1.1.1 2003/10/27 18:54:37 wschweer Exp $ -// (C) Copyright 2001 Werner Schweer (ws@seh.de) -//========================================================= - -#include -#include - -#include "gatetime.h" - -#include "xml.h" -#include "song.h" - -//--------------------------------------------------------- -// GateTime -//--------------------------------------------------------- - -GateTime::GateTime(QWidget* parent) - : QDialog(parent) - { - setupUi(this); - rangeGroup = new QButtonGroup(rangeBox); - rangeGroup->addButton(allButton, 0); - rangeGroup->addButton(selButton, 1); - rangeGroup->addButton(loopButton, 2); - rangeGroup->addButton(sloopButton, 3); - rangeGroup->setExclusive(true); - - pullValues(); - } - -//--------------------------------------------------------- -// accept -//--------------------------------------------------------- - -void GateTime::accept() - { - pullValues(); - QDialog::accept(); - } - -//--------------------------------------------------------- -// pullValues -//--------------------------------------------------------- - -void GateTime::pullValues() - { - range = rangeGroup->checkedId(); - rateVal = rate->value(); - offsetVal = offset->value(); - } - -//--------------------------------------------------------- -// exec -//--------------------------------------------------------- - -int GateTime::exec() - { - rangeGroup->button(range)->setChecked(true); - rate->setValue(rateVal); - offset->setValue(offsetVal); - - return QDialog::exec(); - } - - -void GateTime::read_configuration(Xml& xml) -{ - for (;;) - { - Xml::Token token = xml.parse(); - if (token == Xml::Error || token == Xml::End) - break; - - const QString& tag = xml.s1(); - switch (token) - { - case Xml::TagStart: - if (tag == "range") - range=xml.parseInt(); - else if (tag == "rate") - rateVal=xml.parseInt(); - else if (tag == "offset") - offsetVal=xml.parseInt(); - else - xml.unknown("ModLen"); - break; - - case Xml::TagEnd: - if (tag == "mod_len") - return; - - default: - break; - } - } -} - -void GateTime::write_configuration(int level, Xml& xml) -{ - xml.tag(level++, "mod_len"); - xml.intTag(level, "range", range); - xml.intTag(level, "offset", offsetVal); - xml.intTag(level, "rate", rateVal); - xml.tag(level, "/mod_len"); -} diff --git a/muse2/muse/widgets/gatetime.h b/muse2/muse/widgets/gatetime.h deleted file mode 100644 index d2555872..00000000 --- a/muse2/muse/widgets/gatetime.h +++ /dev/null @@ -1,47 +0,0 @@ -//========================================================= -// MusE -// Linux Music Editor -// $Id: gatetime.h,v 1.1.1.1.2.1 2008/01/19 13:33:47 wschweer Exp $ -// (C) Copyright 2001 Werner Schweer (ws@seh.de) -//========================================================= - -#ifndef __GATETIME_H__ -#define __GATETIME_H__ - -#include "ui_gatetimebase.h" - -class QButtonGroup; -class QDialog; -class Xml; - -//--------------------------------------------------------- -// GateTime -//--------------------------------------------------------- - -class GateTime : public QDialog, public Ui::GateTimeBase { - private: - Q_OBJECT - - QButtonGroup *rangeGroup; - - protected slots: - void accept(); - void pullValues(); - - public: - GateTime(QWidget* parent=0); - - int range; - int rateVal; - int offsetVal; - - void read_configuration(Xml& xml); - void write_configuration(int level, Xml& xml); - - - public slots: - int exec(); - }; - -#endif - diff --git a/muse2/muse/widgets/gatetimebase.ui b/muse2/muse/widgets/gatetimebase.ui deleted file mode 100644 index e804de17..00000000 --- a/muse2/muse/widgets/gatetimebase.ui +++ /dev/null @@ -1,220 +0,0 @@ - - - GateTimeBase - - - - 0 - 0 - 275 - 316 - - - - MusE: Modify Note Length - - - - 6 - - - 11 - - - - - Range - - - - 6 - - - 11 - - - - - All Events - - - - - - - Selected Events - - - true - - - - - - - Looped Events - - - - - - - Selected Looped - - - - - - - - - - Values - - - - 11 - - - 6 - - - - - Rate: - - - false - - - - - - - Offset: - - - false - - - - - - - % - - - 1000 - - - 100 - - - - - - - -999 - - - 999 - - - 1 - - - - - - - lenNew = (lenOld * rate) + offset - - - - - - - - - - 6 - - - 0 - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 0 - 0 - - - - - - - - OK - - - false - - - true - - - - - - - Cancel - - - - - - - - - - - okButton - clicked() - GateTimeBase - accept() - - - 20 - 20 - - - 20 - 20 - - - - - cancelButton - clicked() - GateTimeBase - reject() - - - 20 - 20 - - - 20 - 20 - - - - - diff --git a/muse2/muse/widgets/quantbase.ui b/muse2/muse/widgets/quantbase.ui deleted file mode 100644 index 6a88c86f..00000000 --- a/muse2/muse/widgets/quantbase.ui +++ /dev/null @@ -1,308 +0,0 @@ - - - QuantBase - - - true - - - - 0 - 0 - 279 - 486 - - - - MusE: Quantize - - - - 6 - - - 11 - - - - - Range - - - - 6 - - - 11 - - - - - All Events - - - - - - - Selected Events - - - true - - - - - - - Looped Events - - - - - - - Selected Looped - - - - - - - - - - Values - - - - 11 - - - 6 - - - - - Strength: - - - false - - - - - - - % - - - 100 - - - 80 - - - - - - - Threshold (ticks): - - - false - - - - - - - 0 - - - 10000 - - - 1 - - - - - - - Quantize Len - - - - - - - - - - true - - - - - - - Raster - - - - - - - false - - - 3 - - - true - - - - Whole - - - - - Half - - - - - Quarter - - - - - 8th - - - - - 16th - - - - - 32th - - - - - - - - Swing: - - - - - - - -99 - - - - - - - If the proposed change in tick or length is smaller than threshold, nothing is done. -If swing=0, this is normal -If swing is 33, you get a 2:1-rhythm. -If swing is -33, you get a 1:2-rhythm. - - - true - - - - - - - - - - 6 - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 20 - 20 - - - - - - - - OK - - - false - - - true - - - - - - - Cancel - - - - - - - - - - - - ok_button - clicked() - QuantBase - accept() - - - 20 - 20 - - - 20 - 20 - - - - - cancel_button - clicked() - QuantBase - reject() - - - 20 - 20 - - - 20 - 20 - - - - - diff --git a/muse2/muse/widgets/quantize.cpp b/muse2/muse/widgets/quantize.cpp deleted file mode 100644 index 111087c2..00000000 --- a/muse2/muse/widgets/quantize.cpp +++ /dev/null @@ -1,103 +0,0 @@ -//========================================================= -// MusE -// Linux Music Editor -// $Id: quantize.cpp,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ -// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) -//========================================================= - -#include -#include "quantize.h" -#include "xml.h" - -Quantize::Quantize(QWidget* parent) - : QDialog(parent) -{ - setupUi(this); - range_group = new QButtonGroup; - range_group->addButton(all_events_button,0); - range_group->addButton(selected_events_button,1); - range_group->addButton(looped_events_button,2); - range_group->addButton(selected_looped_button,3); - - pull_values(); -} - -void Quantize::pull_values() -{ - range = range_group->checkedId(); - strength = strength_spinbox->value(); - threshold = threshold_spinbox->value(); - raster_power2 = raster_combobox->currentIndex(); - quant_len = len_checkbox->isChecked(); - swing = swing_spinbox->value(); -} - -void Quantize::accept() -{ - pull_values(); - QDialog::accept(); -} - -int Quantize::exec() -{ - if ((range < 0) || (range > 3)) range=0; - - range_group->button(range)->setChecked(true); - strength_spinbox->setValue(strength); - threshold_spinbox->setValue(threshold); - raster_combobox->setCurrentIndex(raster_power2); - len_checkbox->setChecked(quant_len); - swing_spinbox->setValue(swing); - - return QDialog::exec(); -} - -void Quantize::read_configuration(Xml& xml) -{ - for (;;) - { - Xml::Token token = xml.parse(); - if (token == Xml::Error || token == Xml::End) - break; - - const QString& tag = xml.s1(); - switch (token) - { - case Xml::TagStart: - if (tag == "range") - range=xml.parseInt(); - else if (tag == "strength") - strength=xml.parseInt(); - else if (tag == "threshold") - threshold=xml.parseInt(); - else if (tag == "raster") - raster_power2=xml.parseInt(); - else if (tag == "swing") - swing=xml.parseInt(); - else if (tag == "quant_len") - quant_len=xml.parseInt(); - else - xml.unknown("Quantize"); - break; - - case Xml::TagEnd: - if (tag == "quantize") - return; - - default: - break; - } - } -} - -void Quantize::write_configuration(int level, Xml& xml) -{ - xml.tag(level++, "quantize"); - xml.intTag(level, "range", range); - xml.intTag(level, "strength", strength); - xml.intTag(level, "threshold", threshold); - xml.intTag(level, "raster", raster_power2); - xml.intTag(level, "swing", swing); - xml.intTag(level, "quant_len", quant_len); - xml.tag(level, "/quantize"); -} diff --git a/muse2/muse/widgets/quantize.h b/muse2/muse/widgets/quantize.h deleted file mode 100644 index 399e2545..00000000 --- a/muse2/muse/widgets/quantize.h +++ /dev/null @@ -1,45 +0,0 @@ -//========================================================= -// MusE -// Linux Music Editor -// $Id: quantize.h,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ -// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) -//========================================================= - -#ifndef __QUANTIZE_H__ -#define __QUANTIZE_H__ - -#include "ui_quantbase.h" - -class QButtonGroup; -class Xml; - -class Quantize : public QDialog, public Ui::QuantBase -{ - private: - Q_OBJECT - QButtonGroup* range_group; - - protected slots: - void accept(); - void pull_values(); - - public: - Quantize(QWidget* parent = 0); - - int range; - int strength; - int threshold; - int raster_power2; - int swing; - bool quant_len; - - void read_configuration(Xml& xml); - void write_configuration(int level, Xml& xml); - - - public slots: - int exec(); -}; - -#endif - -- cgit v1.2.3 From 588ad3bc88f29523b52cd51779f94d7bae5f33dd Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Wed, 18 May 2011 19:19:40 +0000 Subject: moved more files -- DOES NOT COMPILE! --- muse2/muse/functions.h | 14 +- muse2/muse/midiedit/scoreedit.cpp | 7 +- muse2/muse/widgets/CMakeLists.txt | 21 -- muse2/muse/widgets/crescendo.cpp | 112 ----------- muse2/muse/widgets/crescendo.h | 46 ----- muse2/muse/widgets/crescendobase.ui | 223 --------------------- muse2/muse/widgets/deloverlaps.cpp | 79 -------- muse2/muse/widgets/deloverlaps.h | 39 ---- muse2/muse/widgets/deloverlapsbase.ui | 153 -------------- muse2/muse/widgets/function_dialogs/crescendo.cpp | 112 +++++++++++ muse2/muse/widgets/function_dialogs/crescendo.h | 46 +++++ .../muse/widgets/function_dialogs/crescendobase.ui | 223 +++++++++++++++++++++ .../muse/widgets/function_dialogs/deloverlaps.cpp | 79 ++++++++ muse2/muse/widgets/function_dialogs/deloverlaps.h | 39 ++++ .../widgets/function_dialogs/deloverlapsbase.ui | 153 ++++++++++++++ muse2/muse/widgets/function_dialogs/move.cpp | 84 ++++++++ muse2/muse/widgets/function_dialogs/move.h | 41 ++++ muse2/muse/widgets/function_dialogs/movebase.ui | 203 +++++++++++++++++++ muse2/muse/widgets/function_dialogs/remove.cpp | 78 +++++++ muse2/muse/widgets/function_dialogs/remove.h | 40 ++++ muse2/muse/widgets/function_dialogs/removebase.ui | 153 ++++++++++++++ muse2/muse/widgets/function_dialogs/setlen.cpp | 83 ++++++++ muse2/muse/widgets/function_dialogs/setlen.h | 41 ++++ muse2/muse/widgets/function_dialogs/setlenbase.ui | 197 ++++++++++++++++++ muse2/muse/widgets/function_dialogs/transpose.cpp | 83 ++++++++ muse2/muse/widgets/function_dialogs/transpose.h | 41 ++++ .../muse/widgets/function_dialogs/transposebase.ui | 203 +++++++++++++++++++ muse2/muse/widgets/function_dialogs/velocity.cpp | 102 ++++++++++ muse2/muse/widgets/function_dialogs/velocity.h | 45 +++++ .../muse/widgets/function_dialogs/velocitybase.ui | 221 ++++++++++++++++++++ muse2/muse/widgets/move.cpp | 84 -------- muse2/muse/widgets/move.h | 41 ---- muse2/muse/widgets/movebase.ui | 203 ------------------- muse2/muse/widgets/remove.cpp | 78 ------- muse2/muse/widgets/remove.h | 40 ---- muse2/muse/widgets/removebase.ui | 153 -------------- muse2/muse/widgets/setlen.cpp | 83 -------- muse2/muse/widgets/setlen.h | 41 ---- muse2/muse/widgets/setlenbase.ui | 197 ------------------ muse2/muse/widgets/transpose.cpp | 83 -------- muse2/muse/widgets/transpose.h | 41 ---- muse2/muse/widgets/transposebase.ui | 203 ------------------- muse2/muse/widgets/velocity.cpp | 102 ---------- muse2/muse/widgets/velocity.h | 45 ----- muse2/muse/widgets/velocitybase.ui | 221 -------------------- 45 files changed, 2279 insertions(+), 2297 deletions(-) delete mode 100644 muse2/muse/widgets/crescendo.cpp delete mode 100644 muse2/muse/widgets/crescendo.h delete mode 100644 muse2/muse/widgets/crescendobase.ui delete mode 100644 muse2/muse/widgets/deloverlaps.cpp delete mode 100644 muse2/muse/widgets/deloverlaps.h delete mode 100644 muse2/muse/widgets/deloverlapsbase.ui create mode 100644 muse2/muse/widgets/function_dialogs/crescendo.cpp create mode 100644 muse2/muse/widgets/function_dialogs/crescendo.h create mode 100644 muse2/muse/widgets/function_dialogs/crescendobase.ui create mode 100644 muse2/muse/widgets/function_dialogs/deloverlaps.cpp create mode 100644 muse2/muse/widgets/function_dialogs/deloverlaps.h create mode 100644 muse2/muse/widgets/function_dialogs/deloverlapsbase.ui create mode 100644 muse2/muse/widgets/function_dialogs/move.cpp create mode 100644 muse2/muse/widgets/function_dialogs/move.h create mode 100644 muse2/muse/widgets/function_dialogs/movebase.ui create mode 100644 muse2/muse/widgets/function_dialogs/remove.cpp create mode 100644 muse2/muse/widgets/function_dialogs/remove.h create mode 100644 muse2/muse/widgets/function_dialogs/removebase.ui create mode 100644 muse2/muse/widgets/function_dialogs/setlen.cpp create mode 100644 muse2/muse/widgets/function_dialogs/setlen.h create mode 100644 muse2/muse/widgets/function_dialogs/setlenbase.ui create mode 100644 muse2/muse/widgets/function_dialogs/transpose.cpp create mode 100644 muse2/muse/widgets/function_dialogs/transpose.h create mode 100644 muse2/muse/widgets/function_dialogs/transposebase.ui create mode 100644 muse2/muse/widgets/function_dialogs/velocity.cpp create mode 100644 muse2/muse/widgets/function_dialogs/velocity.h create mode 100644 muse2/muse/widgets/function_dialogs/velocitybase.ui delete mode 100644 muse2/muse/widgets/move.cpp delete mode 100644 muse2/muse/widgets/move.h delete mode 100644 muse2/muse/widgets/movebase.ui delete mode 100644 muse2/muse/widgets/remove.cpp delete mode 100644 muse2/muse/widgets/remove.h delete mode 100644 muse2/muse/widgets/removebase.ui delete mode 100644 muse2/muse/widgets/setlen.cpp delete mode 100644 muse2/muse/widgets/setlen.h delete mode 100644 muse2/muse/widgets/setlenbase.ui delete mode 100644 muse2/muse/widgets/transpose.cpp delete mode 100644 muse2/muse/widgets/transpose.h delete mode 100644 muse2/muse/widgets/transposebase.ui delete mode 100644 muse2/muse/widgets/velocity.cpp delete mode 100644 muse2/muse/widgets/velocity.h delete mode 100644 muse2/muse/widgets/velocitybase.ui diff --git a/muse2/muse/functions.h b/muse2/muse/functions.h index 9987958b..2b6dc711 100644 --- a/muse2/muse/functions.h +++ b/muse2/muse/functions.h @@ -8,15 +8,15 @@ #ifndef __FUNCTIONS_H__ #define __FUNCTIONS_H__ -#include "velocity.h" +#include "widgets/function_dialogs/velocity.h" #include "widgets/function_dialogs/quantize.h" -#include "crescendo.h" +#include "widgets/function_dialogs/crescendo.h" #include "widgets/function_dialogs/gatetime.h" -#include "remove.h" -#include "transpose.h" -#include "setlen.h" -#include "move.h" -#include "deloverlaps.h" +#include "widgets/function_dialogs/remove.h" +#include "widgets/function_dialogs/transpose.h" +#include "widgets/function_dialogs/setlen.h" +#include "widgets/function_dialogs/move.h" +#include "widgets/function_dialogs/deloverlaps.h" #include #include "part.h" diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index 9a4f6820..df915092 100644 --- a/muse2/muse/midiedit/scoreedit.cpp +++ b/muse2/muse/midiedit/scoreedit.cpp @@ -4202,13 +4202,12 @@ void staff_t::apply_lasso(QRect rect, set& already_processed) * between, for example, when a cis is tied to a des * * CURRENT TODO - * o draw controllers in part "slivers" + * o in step-rec: insert chords * * IMPORTANT TODO * o display blue loop markers in score editor * o transpose: support in-key-transpose * o drum-loop-editor (like in sq korg ds xD) - * o in step-rec: insert chords * * o add a select-clef-toolbox for tracks * o respect the track's clef (has to be implemented first in muse) @@ -4217,6 +4216,10 @@ void staff_t::apply_lasso(QRect rect, set& already_processed) * o transpose etc. must also transpose key-pressure events * * less important stuff + * o quantize-templates (everything is forced into a specified + * rhythm) + * o part-templates (you specify some notes and a control-chord; + * the notes are set according to the chord then) * o add functions like set velo, mod/set velo-off * o deal with expanding parts * o use bars instead of flags over groups of 8ths / 16ths etc diff --git a/muse2/muse/widgets/CMakeLists.txt b/muse2/muse/widgets/CMakeLists.txt index 2d848ab0..5989df11 100644 --- a/muse2/muse/widgets/CMakeLists.txt +++ b/muse2/muse/widgets/CMakeLists.txt @@ -81,13 +81,6 @@ QT4_WRAP_CPP (widget_mocs # ttoolbar.h ttoolbutton.h unusedwavefiles.h - velocity.h - crescendo.h - move.h - remove.h - deloverlaps.h - setlen.h - transpose.h verticalmeter.h view.h vscale.h @@ -120,15 +113,7 @@ file (GLOB widgets_ui_files songinfo.ui synthconfigbase.ui transformbase.ui - transposebase.ui unusedwavefiles.ui - velocitybase.ui - crescendobase.ui - movebase.ui - removebase.ui - deloverlapsbase.ui - transposebase.ui - setlenbase.ui ) QT4_WRAP_UI (widget_ui_headers ${widgets_ui_files}) @@ -195,12 +180,6 @@ file (GLOB widgets_source_files unusedwavefiles.cpp utils.cpp velocity.cpp - crescendo.cpp - move.cpp - remove.cpp - deloverlaps.cpp - setlen.cpp - transpose.cpp verticalmeter.cpp view.cpp vscale.cpp diff --git a/muse2/muse/widgets/crescendo.cpp b/muse2/muse/widgets/crescendo.cpp deleted file mode 100644 index ef31c5ef..00000000 --- a/muse2/muse/widgets/crescendo.cpp +++ /dev/null @@ -1,112 +0,0 @@ -//========================================================= -// MusE -// Linux Music Editor -// $Id: crescendo.cpp,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ -// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) -//========================================================= - -#include -#include "crescendo.h" -#include "xml.h" - -Crescendo::Crescendo(QWidget* parent) - : QDialog(parent) -{ - setupUi(this); - range_group = new QButtonGroup; - range_group->addButton(looped_events_button,2); - range_group->addButton(selected_looped_button,3); - - connect(absolute_button, SIGNAL(toggled(bool)), SLOT(absolute_changed(bool))); - - pull_values(); -} - -void Crescendo::pull_values() -{ - range = range_group->checkedId(); - start_val = start_spinbox->value(); - end_val = end_spinbox->value(); - absolute = absolute_button->isChecked(); -} - -void Crescendo::accept() -{ - pull_values(); - QDialog::accept(); -} - -int Crescendo::exec() -{ - if ((range < 2) || (range > 3)) range=3; - - range_group->button(range)->setChecked(true); - start_spinbox->setValue(start_val); - end_spinbox->setValue(end_val); - absolute_button->setChecked(absolute); - absolute_changed(absolute); - - return QDialog::exec(); -} - -void Crescendo::read_configuration(Xml& xml) -{ - for (;;) - { - Xml::Token token = xml.parse(); - if (token == Xml::Error || token == Xml::End) - break; - - const QString& tag = xml.s1(); - switch (token) - { - case Xml::TagStart: - if (tag == "range") - range=xml.parseInt(); - else if (tag == "start") - start_val=xml.parseInt(); - else if (tag == "end") - end_val=xml.parseInt(); - else if (tag == "absolute") - absolute=xml.parseInt(); - else - xml.unknown("Crescendo"); - break; - - case Xml::TagEnd: - if (tag == "crescendo") - return; - - default: - break; - } - } -} - -void Crescendo::write_configuration(int level, Xml& xml) -{ - xml.tag(level++, "crescendo"); - xml.intTag(level, "range", range); - xml.intTag(level, "start", start_val); - xml.intTag(level, "end", end_val); - xml.intTag(level, "absolute", absolute); - xml.tag(level, "/crescendo"); -} - -void Crescendo::absolute_changed(bool val) -{ - if (val) - { - start_spinbox->setMaximum(127); - start_spinbox->setSuffix(""); - end_spinbox->setMaximum(127); - end_spinbox->setSuffix(""); - } - else - { - start_spinbox->setMaximum(12700); - start_spinbox->setSuffix(" %"); - end_spinbox->setMaximum(12700); - end_spinbox->setSuffix(" %"); - } -} diff --git a/muse2/muse/widgets/crescendo.h b/muse2/muse/widgets/crescendo.h deleted file mode 100644 index eb00e94f..00000000 --- a/muse2/muse/widgets/crescendo.h +++ /dev/null @@ -1,46 +0,0 @@ -//========================================================= -// MusE -// Linux Music Editor -// $Id: crescendo.h,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ -// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) -//========================================================= - -#ifndef __CRESCENDO_H__ -#define __CRESCENDO_H__ - -#include "ui_crescendobase.h" - -class QButtonGroup; -class Xml; - -class Crescendo : public QDialog, public Ui::CrescendoBase -{ - private: - Q_OBJECT - QButtonGroup* range_group; - - protected slots: - void accept(); - void pull_values(); - - public: - Crescendo(QWidget* parent = 0); - - int range; - int start_val; - int end_val; - bool absolute; - - void read_configuration(Xml& xml); - void write_configuration(int level, Xml& xml); - - - public slots: - int exec(); - - private slots: - void absolute_changed(bool); -}; - -#endif - diff --git a/muse2/muse/widgets/crescendobase.ui b/muse2/muse/widgets/crescendobase.ui deleted file mode 100644 index 5f4ec1f4..00000000 --- a/muse2/muse/widgets/crescendobase.ui +++ /dev/null @@ -1,223 +0,0 @@ - - - CrescendoBase - - - - 0 - 0 - 275 - 293 - - - - MusE: Crescendo/Decrescendo - - - - 6 - - - 11 - - - - - Range - - - - 6 - - - 11 - - - - - Looped Events - - - - - - - Selected Looped - - - true - - - - - - - - - - Values - - - false - - - false - - - - 11 - - - 6 - - - - - Start velocity - - - false - - - - - - - % - - - 0 - - - 12700 - - - 80 - - - - - - - End velocity - - - - - - - Absolute - - - false - - - - - - - Relative - - - true - - - - - - - % - - - 12700 - - - 130 - - - - - - - - - - 6 - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 20 - 20 - - - - - - - - OK - - - false - - - true - - - - - - - Cancel - - - - - - - - - - - - okButton - clicked() - CrescendoBase - accept() - - - 20 - 20 - - - 20 - 20 - - - - - cancelButton - clicked() - CrescendoBase - reject() - - - 20 - 20 - - - 20 - 20 - - - - - diff --git a/muse2/muse/widgets/deloverlaps.cpp b/muse2/muse/widgets/deloverlaps.cpp deleted file mode 100644 index 76103d74..00000000 --- a/muse2/muse/widgets/deloverlaps.cpp +++ /dev/null @@ -1,79 +0,0 @@ -//========================================================= -// MusE -// Linux Music Editor -// $Id: deloverlaps.cpp,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ -// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) -//========================================================= - -#include -#include "deloverlaps.h" -#include "xml.h" - - -DelOverlaps::DelOverlaps(QWidget* parent) - : QDialog(parent) -{ - setupUi(this); - range_group = new QButtonGroup; - range_group->addButton(all_events_button,0); - range_group->addButton(selected_events_button,1); - range_group->addButton(looped_events_button,2); - range_group->addButton(selected_looped_button,3); - - pull_values(); -} - -void DelOverlaps::pull_values() -{ - range = range_group->checkedId(); -} - -void DelOverlaps::accept() -{ - pull_values(); - QDialog::accept(); -} - -int DelOverlaps::exec() -{ - if ((range < 0) || (range > 3)) range=0; - - range_group->button(range)->setChecked(true); - - return QDialog::exec(); -} - -void DelOverlaps::read_configuration(Xml& xml) -{ - for (;;) - { - Xml::Token token = xml.parse(); - if (token == Xml::Error || token == Xml::End) - break; - - const QString& tag = xml.s1(); - switch (token) - { - case Xml::TagStart: - if (tag == "range") - range=xml.parseInt(); - else - xml.unknown("DelOverlaps"); - break; - - case Xml::TagEnd: - if (tag == "del_overlaps") - return; - - default: - break; - } - } -} - -void DelOverlaps::write_configuration(int level, Xml& xml) -{ - xml.tag(level++, "del_overlaps"); - xml.intTag(level, "range", range); - xml.tag(level, "/del_overlaps"); -} diff --git a/muse2/muse/widgets/deloverlaps.h b/muse2/muse/widgets/deloverlaps.h deleted file mode 100644 index 813192a6..00000000 --- a/muse2/muse/widgets/deloverlaps.h +++ /dev/null @@ -1,39 +0,0 @@ -//========================================================= -// MusE -// Linux Music Editor -// $Id: deloverlaps.h,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ -// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) -//========================================================= - -#ifndef __DELOVERLAPS_H__ -#define __DELOVERLAPS__H__ - -#include "ui_deloverlapsbase.h" - -class QButtonGroup; -class Xml; - -class DelOverlaps : public QDialog, public Ui::DelOverlapsBase -{ - private: - Q_OBJECT - QButtonGroup* range_group; - - protected slots: - void accept(); - void pull_values(); - - public: - DelOverlaps(QWidget* parent = 0); - - int range; - - void read_configuration(Xml& xml); - void write_configuration(int level, Xml& xml); - - public slots: - int exec(); -}; - -#endif - diff --git a/muse2/muse/widgets/deloverlapsbase.ui b/muse2/muse/widgets/deloverlapsbase.ui deleted file mode 100644 index 7484bf97..00000000 --- a/muse2/muse/widgets/deloverlapsbase.ui +++ /dev/null @@ -1,153 +0,0 @@ - - - DelOverlapsBase - - - true - - - - 0 - 0 - 275 - 195 - - - - MusE: Delete Overlaps - - - - 6 - - - 11 - - - - - Range - - - - 6 - - - 11 - - - - - All Events - - - - - - - Selected Events - - - true - - - - - - - Looped Events - - - - - - - Selected Looped - - - - - - - - - - 6 - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 20 - 20 - - - - - - - - OK - - - false - - - true - - - - - - - Cancel - - - - - - - - - - - - okButton - clicked() - DelOverlapsBase - accept() - - - 20 - 20 - - - 20 - 20 - - - - - cancelButton - clicked() - DelOverlapsBase - reject() - - - 20 - 20 - - - 20 - 20 - - - - - diff --git a/muse2/muse/widgets/function_dialogs/crescendo.cpp b/muse2/muse/widgets/function_dialogs/crescendo.cpp new file mode 100644 index 00000000..ef31c5ef --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/crescendo.cpp @@ -0,0 +1,112 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: crescendo.cpp,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#include +#include "crescendo.h" +#include "xml.h" + +Crescendo::Crescendo(QWidget* parent) + : QDialog(parent) +{ + setupUi(this); + range_group = new QButtonGroup; + range_group->addButton(looped_events_button,2); + range_group->addButton(selected_looped_button,3); + + connect(absolute_button, SIGNAL(toggled(bool)), SLOT(absolute_changed(bool))); + + pull_values(); +} + +void Crescendo::pull_values() +{ + range = range_group->checkedId(); + start_val = start_spinbox->value(); + end_val = end_spinbox->value(); + absolute = absolute_button->isChecked(); +} + +void Crescendo::accept() +{ + pull_values(); + QDialog::accept(); +} + +int Crescendo::exec() +{ + if ((range < 2) || (range > 3)) range=3; + + range_group->button(range)->setChecked(true); + start_spinbox->setValue(start_val); + end_spinbox->setValue(end_val); + absolute_button->setChecked(absolute); + absolute_changed(absolute); + + return QDialog::exec(); +} + +void Crescendo::read_configuration(Xml& xml) +{ + for (;;) + { + Xml::Token token = xml.parse(); + if (token == Xml::Error || token == Xml::End) + break; + + const QString& tag = xml.s1(); + switch (token) + { + case Xml::TagStart: + if (tag == "range") + range=xml.parseInt(); + else if (tag == "start") + start_val=xml.parseInt(); + else if (tag == "end") + end_val=xml.parseInt(); + else if (tag == "absolute") + absolute=xml.parseInt(); + else + xml.unknown("Crescendo"); + break; + + case Xml::TagEnd: + if (tag == "crescendo") + return; + + default: + break; + } + } +} + +void Crescendo::write_configuration(int level, Xml& xml) +{ + xml.tag(level++, "crescendo"); + xml.intTag(level, "range", range); + xml.intTag(level, "start", start_val); + xml.intTag(level, "end", end_val); + xml.intTag(level, "absolute", absolute); + xml.tag(level, "/crescendo"); +} + +void Crescendo::absolute_changed(bool val) +{ + if (val) + { + start_spinbox->setMaximum(127); + start_spinbox->setSuffix(""); + end_spinbox->setMaximum(127); + end_spinbox->setSuffix(""); + } + else + { + start_spinbox->setMaximum(12700); + start_spinbox->setSuffix(" %"); + end_spinbox->setMaximum(12700); + end_spinbox->setSuffix(" %"); + } +} diff --git a/muse2/muse/widgets/function_dialogs/crescendo.h b/muse2/muse/widgets/function_dialogs/crescendo.h new file mode 100644 index 00000000..eb00e94f --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/crescendo.h @@ -0,0 +1,46 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: crescendo.h,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#ifndef __CRESCENDO_H__ +#define __CRESCENDO_H__ + +#include "ui_crescendobase.h" + +class QButtonGroup; +class Xml; + +class Crescendo : public QDialog, public Ui::CrescendoBase +{ + private: + Q_OBJECT + QButtonGroup* range_group; + + protected slots: + void accept(); + void pull_values(); + + public: + Crescendo(QWidget* parent = 0); + + int range; + int start_val; + int end_val; + bool absolute; + + void read_configuration(Xml& xml); + void write_configuration(int level, Xml& xml); + + + public slots: + int exec(); + + private slots: + void absolute_changed(bool); +}; + +#endif + diff --git a/muse2/muse/widgets/function_dialogs/crescendobase.ui b/muse2/muse/widgets/function_dialogs/crescendobase.ui new file mode 100644 index 00000000..5f4ec1f4 --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/crescendobase.ui @@ -0,0 +1,223 @@ + + + CrescendoBase + + + + 0 + 0 + 275 + 293 + + + + MusE: Crescendo/Decrescendo + + + + 6 + + + 11 + + + + + Range + + + + 6 + + + 11 + + + + + Looped Events + + + + + + + Selected Looped + + + true + + + + + + + + + + Values + + + false + + + false + + + + 11 + + + 6 + + + + + Start velocity + + + false + + + + + + + % + + + 0 + + + 12700 + + + 80 + + + + + + + End velocity + + + + + + + Absolute + + + false + + + + + + + Relative + + + true + + + + + + + % + + + 12700 + + + 130 + + + + + + + + + + 6 + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 20 + 20 + + + + + + + + OK + + + false + + + true + + + + + + + Cancel + + + + + + + + + + + + okButton + clicked() + CrescendoBase + accept() + + + 20 + 20 + + + 20 + 20 + + + + + cancelButton + clicked() + CrescendoBase + reject() + + + 20 + 20 + + + 20 + 20 + + + + + diff --git a/muse2/muse/widgets/function_dialogs/deloverlaps.cpp b/muse2/muse/widgets/function_dialogs/deloverlaps.cpp new file mode 100644 index 00000000..76103d74 --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/deloverlaps.cpp @@ -0,0 +1,79 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: deloverlaps.cpp,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#include +#include "deloverlaps.h" +#include "xml.h" + + +DelOverlaps::DelOverlaps(QWidget* parent) + : QDialog(parent) +{ + setupUi(this); + range_group = new QButtonGroup; + range_group->addButton(all_events_button,0); + range_group->addButton(selected_events_button,1); + range_group->addButton(looped_events_button,2); + range_group->addButton(selected_looped_button,3); + + pull_values(); +} + +void DelOverlaps::pull_values() +{ + range = range_group->checkedId(); +} + +void DelOverlaps::accept() +{ + pull_values(); + QDialog::accept(); +} + +int DelOverlaps::exec() +{ + if ((range < 0) || (range > 3)) range=0; + + range_group->button(range)->setChecked(true); + + return QDialog::exec(); +} + +void DelOverlaps::read_configuration(Xml& xml) +{ + for (;;) + { + Xml::Token token = xml.parse(); + if (token == Xml::Error || token == Xml::End) + break; + + const QString& tag = xml.s1(); + switch (token) + { + case Xml::TagStart: + if (tag == "range") + range=xml.parseInt(); + else + xml.unknown("DelOverlaps"); + break; + + case Xml::TagEnd: + if (tag == "del_overlaps") + return; + + default: + break; + } + } +} + +void DelOverlaps::write_configuration(int level, Xml& xml) +{ + xml.tag(level++, "del_overlaps"); + xml.intTag(level, "range", range); + xml.tag(level, "/del_overlaps"); +} diff --git a/muse2/muse/widgets/function_dialogs/deloverlaps.h b/muse2/muse/widgets/function_dialogs/deloverlaps.h new file mode 100644 index 00000000..813192a6 --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/deloverlaps.h @@ -0,0 +1,39 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: deloverlaps.h,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#ifndef __DELOVERLAPS_H__ +#define __DELOVERLAPS__H__ + +#include "ui_deloverlapsbase.h" + +class QButtonGroup; +class Xml; + +class DelOverlaps : public QDialog, public Ui::DelOverlapsBase +{ + private: + Q_OBJECT + QButtonGroup* range_group; + + protected slots: + void accept(); + void pull_values(); + + public: + DelOverlaps(QWidget* parent = 0); + + int range; + + void read_configuration(Xml& xml); + void write_configuration(int level, Xml& xml); + + public slots: + int exec(); +}; + +#endif + diff --git a/muse2/muse/widgets/function_dialogs/deloverlapsbase.ui b/muse2/muse/widgets/function_dialogs/deloverlapsbase.ui new file mode 100644 index 00000000..7484bf97 --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/deloverlapsbase.ui @@ -0,0 +1,153 @@ + + + DelOverlapsBase + + + true + + + + 0 + 0 + 275 + 195 + + + + MusE: Delete Overlaps + + + + 6 + + + 11 + + + + + Range + + + + 6 + + + 11 + + + + + All Events + + + + + + + Selected Events + + + true + + + + + + + Looped Events + + + + + + + Selected Looped + + + + + + + + + + 6 + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 20 + 20 + + + + + + + + OK + + + false + + + true + + + + + + + Cancel + + + + + + + + + + + + okButton + clicked() + DelOverlapsBase + accept() + + + 20 + 20 + + + 20 + 20 + + + + + cancelButton + clicked() + DelOverlapsBase + reject() + + + 20 + 20 + + + 20 + 20 + + + + + diff --git a/muse2/muse/widgets/function_dialogs/move.cpp b/muse2/muse/widgets/function_dialogs/move.cpp new file mode 100644 index 00000000..2ce6cb05 --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/move.cpp @@ -0,0 +1,84 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: move.cpp,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#include +#include "move.h" +#include "xml.h" + +Move::Move(QWidget* parent) + : QDialog(parent) +{ + setupUi(this); + range_group = new QButtonGroup; + range_group->addButton(all_events_button,0); + range_group->addButton(selected_events_button,1); + range_group->addButton(looped_events_button,2); + range_group->addButton(selected_looped_button,3); + + pull_values(); +} + +void Move::pull_values() +{ + range = range_group->checkedId(); + amount = amount_spinbox->value(); +} + +void Move::accept() +{ + pull_values(); + QDialog::accept(); +} + +int Move::exec() +{ + if ((range < 0) || (range > 3)) range=0; + + range_group->button(range)->setChecked(true); + amount_spinbox->setValue(amount); + + return QDialog::exec(); +} + + +void Move::read_configuration(Xml& xml) +{ + for (;;) + { + Xml::Token token = xml.parse(); + if (token == Xml::Error || token == Xml::End) + break; + + const QString& tag = xml.s1(); + switch (token) + { + case Xml::TagStart: + if (tag == "range") + range=xml.parseInt(); + else if (tag == "amount") + amount=xml.parseInt(); + else + xml.unknown("Move"); + break; + + case Xml::TagEnd: + if (tag == "move") + return; + + default: + break; + } + } +} + +void Move::write_configuration(int level, Xml& xml) +{ + xml.tag(level++, "move"); + xml.intTag(level, "range", range); + xml.intTag(level, "amount", amount); + xml.tag(level, "/move"); +} diff --git a/muse2/muse/widgets/function_dialogs/move.h b/muse2/muse/widgets/function_dialogs/move.h new file mode 100644 index 00000000..4c90a922 --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/move.h @@ -0,0 +1,41 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: move.h,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#ifndef __MOVE_H__ +#define __MOVE_H__ + +#include "ui_movebase.h" + +class QButtonGroup; +class Xml; + +class Move : public QDialog, public Ui::MoveBase +{ + private: + Q_OBJECT + QButtonGroup* range_group; + + protected slots: + void accept(); + void pull_values(); + + public: + Move(QWidget* parent = 0); + + int range; + int amount; + + void read_configuration(Xml& xml); + void write_configuration(int level, Xml& xml); + + + public slots: + int exec(); +}; + +#endif + diff --git a/muse2/muse/widgets/function_dialogs/movebase.ui b/muse2/muse/widgets/function_dialogs/movebase.ui new file mode 100644 index 00000000..a8825dd5 --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/movebase.ui @@ -0,0 +1,203 @@ + + + MoveBase + + + + 0 + 0 + 275 + 264 + + + + MusE: Move Notes + + + + 6 + + + 11 + + + + + Range + + + + 6 + + + 11 + + + + + All Events + + + + + + + Selected Events + + + true + + + + + + + Looped Events + + + + + + + Selected Looped + + + + + + + + + + Value + + + false + + + false + + + + 11 + + + 6 + + + + + Move by + + + false + + + + + + + true + + + ticks + + + -9999999 + + + 9999999 + + + 386 + + + 0 + + + + + + + + + + 6 + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 20 + 20 + + + + + + + + OK + + + false + + + true + + + + + + + Cancel + + + + + + + + + + + + okButton + clicked() + MoveBase + accept() + + + 20 + 20 + + + 20 + 20 + + + + + cancelButton + clicked() + MoveBase + reject() + + + 20 + 20 + + + 20 + 20 + + + + + diff --git a/muse2/muse/widgets/function_dialogs/remove.cpp b/muse2/muse/widgets/function_dialogs/remove.cpp new file mode 100644 index 00000000..5ad272ab --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/remove.cpp @@ -0,0 +1,78 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: remove.cpp,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#include +#include "remove.h" +#include "xml.h" + +Remove::Remove(QWidget* parent) + : QDialog(parent) +{ + setupUi(this); + range_group = new QButtonGroup; + range_group->addButton(all_events_button,0); + range_group->addButton(selected_events_button,1); + range_group->addButton(looped_events_button,2); + range_group->addButton(selected_looped_button,3); + + pull_values(); +} + +void Remove::pull_values() +{ + range = range_group->checkedId(); +} + +void Remove::accept() +{ + pull_values(); + QDialog::accept(); +} + +int Remove::exec() +{ + if ((range < 0) || (range > 3)) range=0; + + range_group->button(range)->setChecked(true); + + return QDialog::exec(); +} + +void Remove::read_configuration(Xml& xml) +{ + for (;;) + { + Xml::Token token = xml.parse(); + if (token == Xml::Error || token == Xml::End) + break; + + const QString& tag = xml.s1(); + switch (token) + { + case Xml::TagStart: + if (tag == "range") + range=xml.parseInt(); + else + xml.unknown("Erase"); + break; + + case Xml::TagEnd: + if (tag == "erase") + return; + + default: + break; + } + } +} + +void Remove::write_configuration(int level, Xml& xml) +{ + xml.tag(level++, "erase"); + xml.intTag(level, "range", range); + xml.tag(level, "/erase"); +} diff --git a/muse2/muse/widgets/function_dialogs/remove.h b/muse2/muse/widgets/function_dialogs/remove.h new file mode 100644 index 00000000..5615ed42 --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/remove.h @@ -0,0 +1,40 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: remove.h,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#ifndef __REMOVE_H__ +#define __REMOVE_H__ + +#include "ui_removebase.h" + +class QButtonGroup; +class Xml; + +class Remove : public QDialog, public Ui::RemoveBase +{ + private: + Q_OBJECT + QButtonGroup* range_group; + + protected slots: + void accept(); + void pull_values(); + + public: + Remove(QWidget* parent = 0); + + int range; + + void read_configuration(Xml& xml); + void write_configuration(int level, Xml& xml); + + + public slots: + int exec(); +}; + +#endif + diff --git a/muse2/muse/widgets/function_dialogs/removebase.ui b/muse2/muse/widgets/function_dialogs/removebase.ui new file mode 100644 index 00000000..3381795c --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/removebase.ui @@ -0,0 +1,153 @@ + + + RemoveBase + + + true + + + + 0 + 0 + 275 + 195 + + + + MusE: Erase Notes + + + + 6 + + + 11 + + + + + Range + + + + 6 + + + 11 + + + + + All Events + + + + + + + Selected Events + + + true + + + + + + + Looped Events + + + + + + + Selected Looped + + + + + + + + + + 6 + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 20 + 20 + + + + + + + + OK + + + false + + + true + + + + + + + Cancel + + + + + + + + + + + + okButton + clicked() + RemoveBase + accept() + + + 20 + 20 + + + 20 + 20 + + + + + cancelButton + clicked() + RemoveBase + reject() + + + 20 + 20 + + + 20 + 20 + + + + + diff --git a/muse2/muse/widgets/function_dialogs/setlen.cpp b/muse2/muse/widgets/function_dialogs/setlen.cpp new file mode 100644 index 00000000..024cdd35 --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/setlen.cpp @@ -0,0 +1,83 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: setlen.cpp,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#include +#include "setlen.h" +#include "xml.h" + +Setlen::Setlen(QWidget* parent) + : QDialog(parent) +{ + setupUi(this); + range_group = new QButtonGroup; + range_group->addButton(all_events_button,0); + range_group->addButton(selected_events_button,1); + range_group->addButton(looped_events_button,2); + range_group->addButton(selected_looped_button,3); + + pull_values(); +} + +void Setlen::pull_values() +{ + range = range_group->checkedId(); + len = len_spinbox->value(); +} + +void Setlen::accept() +{ + pull_values(); + QDialog::accept(); +} + +int Setlen::exec() +{ + if ((range < 0) || (range > 3)) range=0; + + range_group->button(range)->setChecked(true); + len_spinbox->setValue(len); + + return QDialog::exec(); +} + +void Setlen::read_configuration(Xml& xml) +{ + for (;;) + { + Xml::Token token = xml.parse(); + if (token == Xml::Error || token == Xml::End) + break; + + const QString& tag = xml.s1(); + switch (token) + { + case Xml::TagStart: + if (tag == "range") + range=xml.parseInt(); + else if (tag == "len") + len=xml.parseInt(); + else + xml.unknown("SetLen"); + break; + + case Xml::TagEnd: + if (tag == "setlen") + return; + + default: + break; + } + } +} + +void Setlen::write_configuration(int level, Xml& xml) +{ + xml.tag(level++, "setlen"); + xml.intTag(level, "range", range); + xml.intTag(level, "len", len); + xml.tag(level, "/setlen"); +} diff --git a/muse2/muse/widgets/function_dialogs/setlen.h b/muse2/muse/widgets/function_dialogs/setlen.h new file mode 100644 index 00000000..ad66a38b --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/setlen.h @@ -0,0 +1,41 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: setlen.h,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#ifndef __SETLEN_H__ +#define __SETLEN_H__ + +#include "ui_setlenbase.h" + +class QButtonGroup; +class Xml; + +class Setlen : public QDialog, public Ui::SetlenBase +{ + private: + Q_OBJECT + QButtonGroup* range_group; + + protected slots: + void accept(); + void pull_values(); + + public: + Setlen(QWidget* parent = 0); + + int range; + int len; + + void read_configuration(Xml& xml); + void write_configuration(int level, Xml& xml); + + + public slots: + int exec(); +}; + +#endif + diff --git a/muse2/muse/widgets/function_dialogs/setlenbase.ui b/muse2/muse/widgets/function_dialogs/setlenbase.ui new file mode 100644 index 00000000..7d929716 --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/setlenbase.ui @@ -0,0 +1,197 @@ + + + SetlenBase + + + + 0 + 0 + 275 + 264 + + + + MusE: Set Note Length + + + + 6 + + + 11 + + + + + Range + + + + 6 + + + 11 + + + + + All Events + + + + + + + Selected Events + + + true + + + + + + + Looped Events + + + + + + + Selected Looped + + + + + + + + + + Value + + + false + + + false + + + + 11 + + + 6 + + + + + New length + + + false + + + + + + + ticks + + + 1 + + + 10000 + + + 1 + + + + + + + + + + 6 + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 20 + 20 + + + + + + + + OK + + + false + + + true + + + + + + + Cancel + + + + + + + + + + + + okButton + clicked() + SetlenBase + accept() + + + 20 + 20 + + + 20 + 20 + + + + + cancelButton + clicked() + SetlenBase + reject() + + + 20 + 20 + + + 20 + 20 + + + + + diff --git a/muse2/muse/widgets/function_dialogs/transpose.cpp b/muse2/muse/widgets/function_dialogs/transpose.cpp new file mode 100644 index 00000000..b10c1249 --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/transpose.cpp @@ -0,0 +1,83 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: transpose.cpp,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#include +#include "transpose.h" +#include "xml.h" + +Transpose::Transpose(QWidget* parent) + : QDialog(parent) +{ + setupUi(this); + range_group = new QButtonGroup; + range_group->addButton(all_events_button,0); + range_group->addButton(selected_events_button,1); + range_group->addButton(looped_events_button,2); + range_group->addButton(selected_looped_button,3); + + pull_values(); +} + +void Transpose::pull_values() +{ + range = range_group->checkedId(); + amount = amount_spinbox->value(); +} + +void Transpose::accept() +{ + pull_values(); + QDialog::accept(); +} + +int Transpose::exec() +{ + if ((range < 0) || (range > 3)) range=0; + + range_group->button(range)->setChecked(true); + amount_spinbox->setValue(amount); + + return QDialog::exec(); +} + +void Transpose::read_configuration(Xml& xml) +{ + for (;;) + { + Xml::Token token = xml.parse(); + if (token == Xml::Error || token == Xml::End) + break; + + const QString& tag = xml.s1(); + switch (token) + { + case Xml::TagStart: + if (tag == "range") + range=xml.parseInt(); + else if (tag == "amount") + amount=xml.parseInt(); + else + xml.unknown("Transpose"); + break; + + case Xml::TagEnd: + if (tag == "transpose") + return; + + default: + break; + } + } +} + +void Transpose::write_configuration(int level, Xml& xml) +{ + xml.tag(level++, "transpose"); + xml.intTag(level, "range", range); + xml.intTag(level, "amount", amount); + xml.tag(level, "/transpose"); +} diff --git a/muse2/muse/widgets/function_dialogs/transpose.h b/muse2/muse/widgets/function_dialogs/transpose.h new file mode 100644 index 00000000..97dd443e --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/transpose.h @@ -0,0 +1,41 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: transpose.h,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#ifndef __TRANSPOSE_H__ +#define __TRANSPOSE_H__ + +#include "ui_transposebase.h" + +class QButtonGroup; +class Xml; + +class Transpose : public QDialog, public Ui::TransposeBase +{ + private: + Q_OBJECT + QButtonGroup* range_group; + + protected slots: + void accept(); + void pull_values(); + + public: + Transpose(QWidget* parent = 0); + + int range; + int amount; + + void read_configuration(Xml& xml); + void write_configuration(int level, Xml& xml); + + + public slots: + int exec(); +}; + +#endif + diff --git a/muse2/muse/widgets/function_dialogs/transposebase.ui b/muse2/muse/widgets/function_dialogs/transposebase.ui new file mode 100644 index 00000000..c26f2ef9 --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/transposebase.ui @@ -0,0 +1,203 @@ + + + TransposeBase + + + + 0 + 0 + 275 + 264 + + + + MusE: Transpose + + + + 6 + + + 11 + + + + + Range + + + + 6 + + + 11 + + + + + All Events + + + + + + + Selected Events + + + true + + + + + + + Looped Events + + + + + + + Selected Looped + + + + + + + + + + Value + + + false + + + false + + + + 11 + + + 6 + + + + + Halftone-steps + + + false + + + + + + + true + + + + + + -127 + + + 127 + + + 1 + + + 0 + + + + + + + + + + 6 + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 20 + 20 + + + + + + + + OK + + + false + + + true + + + + + + + Cancel + + + + + + + + + + + + okButton + clicked() + TransposeBase + accept() + + + 20 + 20 + + + 20 + 20 + + + + + cancelButton + clicked() + TransposeBase + reject() + + + 20 + 20 + + + 20 + 20 + + + + + diff --git a/muse2/muse/widgets/function_dialogs/velocity.cpp b/muse2/muse/widgets/function_dialogs/velocity.cpp new file mode 100644 index 00000000..ec625489 --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/velocity.cpp @@ -0,0 +1,102 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: velocity.cpp,v 1.1.1.1 2003/10/27 18:55:04 wschweer Exp $ +// (C) Copyright 2001 Werner Schweer (ws@seh.de) +//========================================================= + +#include +#include "velocity.h" +#include "xml.h" + +//--------------------------------------------------------- +// Velocity +//--------------------------------------------------------- + +Velocity::Velocity(QWidget* parent) + : QDialog(parent) + { + setupUi(this); + rangeGroup = new QButtonGroup; + rangeGroup->addButton(allEvents,0); + rangeGroup->addButton(selectedEvents,1); + rangeGroup->addButton(loopedEvents,2); + rangeGroup->addButton(selectedLooped,3); + + pullValues(); + } + +//--------------------------------------------------------- +// accept +//--------------------------------------------------------- + +void Velocity::accept() + { + pullValues(); + QDialog::accept(); + } + +//--------------------------------------------------------- +// pullValues +//--------------------------------------------------------- + +void Velocity::pullValues() + { + range = rangeGroup->checkedId(); + rateVal = rate->value(); + offsetVal = offset->value(); + } + +//--------------------------------------------------------- +// exec +//--------------------------------------------------------- + +int Velocity::exec() + { + rangeGroup->button(range)->setChecked(true); + rate->setValue(rateVal); + offset->setValue(offsetVal); + + return QDialog::exec(); + } + +void Velocity::read_configuration(Xml& xml) +{ + for (;;) + { + Xml::Token token = xml.parse(); + if (token == Xml::Error || token == Xml::End) + break; + + const QString& tag = xml.s1(); + switch (token) + { + case Xml::TagStart: + if (tag == "range") + range=xml.parseInt(); + else if (tag == "rate") + rateVal=xml.parseInt(); + else if (tag == "offset") + offsetVal=xml.parseInt(); + else + xml.unknown("ModVelo"); + break; + + case Xml::TagEnd: + if (tag == "mod_velo") + return; + + default: + break; + } + } +} + +void Velocity::write_configuration(int level, Xml& xml) +{ + xml.tag(level++, "mod_velo"); + xml.intTag(level, "range", range); + xml.intTag(level, "offset", offsetVal); + xml.intTag(level, "rate", rateVal); + xml.tag(level, "/mod_velo"); +} diff --git a/muse2/muse/widgets/function_dialogs/velocity.h b/muse2/muse/widgets/function_dialogs/velocity.h new file mode 100644 index 00000000..cbea4e22 --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/velocity.h @@ -0,0 +1,45 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: velocity.h,v 1.1.1.1 2003/10/27 18:54:51 wschweer Exp $ +// (C) Copyright 2001 Werner Schweer (ws@seh.de) +//========================================================= + +#ifndef __VELOCITY_H__ +#define __VELOCITY_H__ + +#include "ui_velocitybase.h" + +class QButtonGroup; +class Xml; + +//--------------------------------------------------------- +// Velocity +//--------------------------------------------------------- + +class Velocity : public QDialog, public Ui::VelocityBase { + private: + Q_OBJECT + QButtonGroup* rangeGroup; + + protected slots: + void accept(); + void pullValues(); + + public: + Velocity(QWidget* parent = 0); + + int range; + int rateVal; + int offsetVal; + + void read_configuration(Xml& xml); + void write_configuration(int level, Xml& xml); + + + public slots: + int exec(); + }; + +#endif + diff --git a/muse2/muse/widgets/function_dialogs/velocitybase.ui b/muse2/muse/widgets/function_dialogs/velocitybase.ui new file mode 100644 index 00000000..40fe625f --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/velocitybase.ui @@ -0,0 +1,221 @@ + + + VelocityBase + + + + 0 + 0 + 275 + 316 + + + + MusE: Modify Velocity + + + + 6 + + + 11 + + + + + Range + + + + 6 + + + 11 + + + + + All Events + + + + + + + Selected Events + + + true + + + + + + + Looped Events + + + + + + + Selected Looped + + + + + + + + + + Values + + + + 11 + + + 6 + + + + + Rate: + + + false + + + + + + + % + + + 200 + + + 100 + + + + + + + Offset: + + + false + + + + + + + -127 + + + 127 + + + 1 + + + 0 + + + + + + + veloNew = (veloOld * rate) + offset + + + + + + + + + + 6 + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 20 + 20 + + + + + + + + OK + + + false + + + true + + + + + + + Cancel + + + + + + + + + + + + okButton + clicked() + VelocityBase + accept() + + + 20 + 20 + + + 20 + 20 + + + + + cancelButton + clicked() + VelocityBase + reject() + + + 20 + 20 + + + 20 + 20 + + + + + diff --git a/muse2/muse/widgets/move.cpp b/muse2/muse/widgets/move.cpp deleted file mode 100644 index 2ce6cb05..00000000 --- a/muse2/muse/widgets/move.cpp +++ /dev/null @@ -1,84 +0,0 @@ -//========================================================= -// MusE -// Linux Music Editor -// $Id: move.cpp,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ -// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) -//========================================================= - -#include -#include "move.h" -#include "xml.h" - -Move::Move(QWidget* parent) - : QDialog(parent) -{ - setupUi(this); - range_group = new QButtonGroup; - range_group->addButton(all_events_button,0); - range_group->addButton(selected_events_button,1); - range_group->addButton(looped_events_button,2); - range_group->addButton(selected_looped_button,3); - - pull_values(); -} - -void Move::pull_values() -{ - range = range_group->checkedId(); - amount = amount_spinbox->value(); -} - -void Move::accept() -{ - pull_values(); - QDialog::accept(); -} - -int Move::exec() -{ - if ((range < 0) || (range > 3)) range=0; - - range_group->button(range)->setChecked(true); - amount_spinbox->setValue(amount); - - return QDialog::exec(); -} - - -void Move::read_configuration(Xml& xml) -{ - for (;;) - { - Xml::Token token = xml.parse(); - if (token == Xml::Error || token == Xml::End) - break; - - const QString& tag = xml.s1(); - switch (token) - { - case Xml::TagStart: - if (tag == "range") - range=xml.parseInt(); - else if (tag == "amount") - amount=xml.parseInt(); - else - xml.unknown("Move"); - break; - - case Xml::TagEnd: - if (tag == "move") - return; - - default: - break; - } - } -} - -void Move::write_configuration(int level, Xml& xml) -{ - xml.tag(level++, "move"); - xml.intTag(level, "range", range); - xml.intTag(level, "amount", amount); - xml.tag(level, "/move"); -} diff --git a/muse2/muse/widgets/move.h b/muse2/muse/widgets/move.h deleted file mode 100644 index 4c90a922..00000000 --- a/muse2/muse/widgets/move.h +++ /dev/null @@ -1,41 +0,0 @@ -//========================================================= -// MusE -// Linux Music Editor -// $Id: move.h,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ -// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) -//========================================================= - -#ifndef __MOVE_H__ -#define __MOVE_H__ - -#include "ui_movebase.h" - -class QButtonGroup; -class Xml; - -class Move : public QDialog, public Ui::MoveBase -{ - private: - Q_OBJECT - QButtonGroup* range_group; - - protected slots: - void accept(); - void pull_values(); - - public: - Move(QWidget* parent = 0); - - int range; - int amount; - - void read_configuration(Xml& xml); - void write_configuration(int level, Xml& xml); - - - public slots: - int exec(); -}; - -#endif - diff --git a/muse2/muse/widgets/movebase.ui b/muse2/muse/widgets/movebase.ui deleted file mode 100644 index a8825dd5..00000000 --- a/muse2/muse/widgets/movebase.ui +++ /dev/null @@ -1,203 +0,0 @@ - - - MoveBase - - - - 0 - 0 - 275 - 264 - - - - MusE: Move Notes - - - - 6 - - - 11 - - - - - Range - - - - 6 - - - 11 - - - - - All Events - - - - - - - Selected Events - - - true - - - - - - - Looped Events - - - - - - - Selected Looped - - - - - - - - - - Value - - - false - - - false - - - - 11 - - - 6 - - - - - Move by - - - false - - - - - - - true - - - ticks - - - -9999999 - - - 9999999 - - - 386 - - - 0 - - - - - - - - - - 6 - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 20 - 20 - - - - - - - - OK - - - false - - - true - - - - - - - Cancel - - - - - - - - - - - - okButton - clicked() - MoveBase - accept() - - - 20 - 20 - - - 20 - 20 - - - - - cancelButton - clicked() - MoveBase - reject() - - - 20 - 20 - - - 20 - 20 - - - - - diff --git a/muse2/muse/widgets/remove.cpp b/muse2/muse/widgets/remove.cpp deleted file mode 100644 index 5ad272ab..00000000 --- a/muse2/muse/widgets/remove.cpp +++ /dev/null @@ -1,78 +0,0 @@ -//========================================================= -// MusE -// Linux Music Editor -// $Id: remove.cpp,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ -// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) -//========================================================= - -#include -#include "remove.h" -#include "xml.h" - -Remove::Remove(QWidget* parent) - : QDialog(parent) -{ - setupUi(this); - range_group = new QButtonGroup; - range_group->addButton(all_events_button,0); - range_group->addButton(selected_events_button,1); - range_group->addButton(looped_events_button,2); - range_group->addButton(selected_looped_button,3); - - pull_values(); -} - -void Remove::pull_values() -{ - range = range_group->checkedId(); -} - -void Remove::accept() -{ - pull_values(); - QDialog::accept(); -} - -int Remove::exec() -{ - if ((range < 0) || (range > 3)) range=0; - - range_group->button(range)->setChecked(true); - - return QDialog::exec(); -} - -void Remove::read_configuration(Xml& xml) -{ - for (;;) - { - Xml::Token token = xml.parse(); - if (token == Xml::Error || token == Xml::End) - break; - - const QString& tag = xml.s1(); - switch (token) - { - case Xml::TagStart: - if (tag == "range") - range=xml.parseInt(); - else - xml.unknown("Erase"); - break; - - case Xml::TagEnd: - if (tag == "erase") - return; - - default: - break; - } - } -} - -void Remove::write_configuration(int level, Xml& xml) -{ - xml.tag(level++, "erase"); - xml.intTag(level, "range", range); - xml.tag(level, "/erase"); -} diff --git a/muse2/muse/widgets/remove.h b/muse2/muse/widgets/remove.h deleted file mode 100644 index 5615ed42..00000000 --- a/muse2/muse/widgets/remove.h +++ /dev/null @@ -1,40 +0,0 @@ -//========================================================= -// MusE -// Linux Music Editor -// $Id: remove.h,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ -// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) -//========================================================= - -#ifndef __REMOVE_H__ -#define __REMOVE_H__ - -#include "ui_removebase.h" - -class QButtonGroup; -class Xml; - -class Remove : public QDialog, public Ui::RemoveBase -{ - private: - Q_OBJECT - QButtonGroup* range_group; - - protected slots: - void accept(); - void pull_values(); - - public: - Remove(QWidget* parent = 0); - - int range; - - void read_configuration(Xml& xml); - void write_configuration(int level, Xml& xml); - - - public slots: - int exec(); -}; - -#endif - diff --git a/muse2/muse/widgets/removebase.ui b/muse2/muse/widgets/removebase.ui deleted file mode 100644 index 3381795c..00000000 --- a/muse2/muse/widgets/removebase.ui +++ /dev/null @@ -1,153 +0,0 @@ - - - RemoveBase - - - true - - - - 0 - 0 - 275 - 195 - - - - MusE: Erase Notes - - - - 6 - - - 11 - - - - - Range - - - - 6 - - - 11 - - - - - All Events - - - - - - - Selected Events - - - true - - - - - - - Looped Events - - - - - - - Selected Looped - - - - - - - - - - 6 - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 20 - 20 - - - - - - - - OK - - - false - - - true - - - - - - - Cancel - - - - - - - - - - - - okButton - clicked() - RemoveBase - accept() - - - 20 - 20 - - - 20 - 20 - - - - - cancelButton - clicked() - RemoveBase - reject() - - - 20 - 20 - - - 20 - 20 - - - - - diff --git a/muse2/muse/widgets/setlen.cpp b/muse2/muse/widgets/setlen.cpp deleted file mode 100644 index 024cdd35..00000000 --- a/muse2/muse/widgets/setlen.cpp +++ /dev/null @@ -1,83 +0,0 @@ -//========================================================= -// MusE -// Linux Music Editor -// $Id: setlen.cpp,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ -// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) -//========================================================= - -#include -#include "setlen.h" -#include "xml.h" - -Setlen::Setlen(QWidget* parent) - : QDialog(parent) -{ - setupUi(this); - range_group = new QButtonGroup; - range_group->addButton(all_events_button,0); - range_group->addButton(selected_events_button,1); - range_group->addButton(looped_events_button,2); - range_group->addButton(selected_looped_button,3); - - pull_values(); -} - -void Setlen::pull_values() -{ - range = range_group->checkedId(); - len = len_spinbox->value(); -} - -void Setlen::accept() -{ - pull_values(); - QDialog::accept(); -} - -int Setlen::exec() -{ - if ((range < 0) || (range > 3)) range=0; - - range_group->button(range)->setChecked(true); - len_spinbox->setValue(len); - - return QDialog::exec(); -} - -void Setlen::read_configuration(Xml& xml) -{ - for (;;) - { - Xml::Token token = xml.parse(); - if (token == Xml::Error || token == Xml::End) - break; - - const QString& tag = xml.s1(); - switch (token) - { - case Xml::TagStart: - if (tag == "range") - range=xml.parseInt(); - else if (tag == "len") - len=xml.parseInt(); - else - xml.unknown("SetLen"); - break; - - case Xml::TagEnd: - if (tag == "setlen") - return; - - default: - break; - } - } -} - -void Setlen::write_configuration(int level, Xml& xml) -{ - xml.tag(level++, "setlen"); - xml.intTag(level, "range", range); - xml.intTag(level, "len", len); - xml.tag(level, "/setlen"); -} diff --git a/muse2/muse/widgets/setlen.h b/muse2/muse/widgets/setlen.h deleted file mode 100644 index ad66a38b..00000000 --- a/muse2/muse/widgets/setlen.h +++ /dev/null @@ -1,41 +0,0 @@ -//========================================================= -// MusE -// Linux Music Editor -// $Id: setlen.h,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ -// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) -//========================================================= - -#ifndef __SETLEN_H__ -#define __SETLEN_H__ - -#include "ui_setlenbase.h" - -class QButtonGroup; -class Xml; - -class Setlen : public QDialog, public Ui::SetlenBase -{ - private: - Q_OBJECT - QButtonGroup* range_group; - - protected slots: - void accept(); - void pull_values(); - - public: - Setlen(QWidget* parent = 0); - - int range; - int len; - - void read_configuration(Xml& xml); - void write_configuration(int level, Xml& xml); - - - public slots: - int exec(); -}; - -#endif - diff --git a/muse2/muse/widgets/setlenbase.ui b/muse2/muse/widgets/setlenbase.ui deleted file mode 100644 index 7d929716..00000000 --- a/muse2/muse/widgets/setlenbase.ui +++ /dev/null @@ -1,197 +0,0 @@ - - - SetlenBase - - - - 0 - 0 - 275 - 264 - - - - MusE: Set Note Length - - - - 6 - - - 11 - - - - - Range - - - - 6 - - - 11 - - - - - All Events - - - - - - - Selected Events - - - true - - - - - - - Looped Events - - - - - - - Selected Looped - - - - - - - - - - Value - - - false - - - false - - - - 11 - - - 6 - - - - - New length - - - false - - - - - - - ticks - - - 1 - - - 10000 - - - 1 - - - - - - - - - - 6 - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 20 - 20 - - - - - - - - OK - - - false - - - true - - - - - - - Cancel - - - - - - - - - - - - okButton - clicked() - SetlenBase - accept() - - - 20 - 20 - - - 20 - 20 - - - - - cancelButton - clicked() - SetlenBase - reject() - - - 20 - 20 - - - 20 - 20 - - - - - diff --git a/muse2/muse/widgets/transpose.cpp b/muse2/muse/widgets/transpose.cpp deleted file mode 100644 index b10c1249..00000000 --- a/muse2/muse/widgets/transpose.cpp +++ /dev/null @@ -1,83 +0,0 @@ -//========================================================= -// MusE -// Linux Music Editor -// $Id: transpose.cpp,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ -// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) -//========================================================= - -#include -#include "transpose.h" -#include "xml.h" - -Transpose::Transpose(QWidget* parent) - : QDialog(parent) -{ - setupUi(this); - range_group = new QButtonGroup; - range_group->addButton(all_events_button,0); - range_group->addButton(selected_events_button,1); - range_group->addButton(looped_events_button,2); - range_group->addButton(selected_looped_button,3); - - pull_values(); -} - -void Transpose::pull_values() -{ - range = range_group->checkedId(); - amount = amount_spinbox->value(); -} - -void Transpose::accept() -{ - pull_values(); - QDialog::accept(); -} - -int Transpose::exec() -{ - if ((range < 0) || (range > 3)) range=0; - - range_group->button(range)->setChecked(true); - amount_spinbox->setValue(amount); - - return QDialog::exec(); -} - -void Transpose::read_configuration(Xml& xml) -{ - for (;;) - { - Xml::Token token = xml.parse(); - if (token == Xml::Error || token == Xml::End) - break; - - const QString& tag = xml.s1(); - switch (token) - { - case Xml::TagStart: - if (tag == "range") - range=xml.parseInt(); - else if (tag == "amount") - amount=xml.parseInt(); - else - xml.unknown("Transpose"); - break; - - case Xml::TagEnd: - if (tag == "transpose") - return; - - default: - break; - } - } -} - -void Transpose::write_configuration(int level, Xml& xml) -{ - xml.tag(level++, "transpose"); - xml.intTag(level, "range", range); - xml.intTag(level, "amount", amount); - xml.tag(level, "/transpose"); -} diff --git a/muse2/muse/widgets/transpose.h b/muse2/muse/widgets/transpose.h deleted file mode 100644 index 97dd443e..00000000 --- a/muse2/muse/widgets/transpose.h +++ /dev/null @@ -1,41 +0,0 @@ -//========================================================= -// MusE -// Linux Music Editor -// $Id: transpose.h,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ -// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) -//========================================================= - -#ifndef __TRANSPOSE_H__ -#define __TRANSPOSE_H__ - -#include "ui_transposebase.h" - -class QButtonGroup; -class Xml; - -class Transpose : public QDialog, public Ui::TransposeBase -{ - private: - Q_OBJECT - QButtonGroup* range_group; - - protected slots: - void accept(); - void pull_values(); - - public: - Transpose(QWidget* parent = 0); - - int range; - int amount; - - void read_configuration(Xml& xml); - void write_configuration(int level, Xml& xml); - - - public slots: - int exec(); -}; - -#endif - diff --git a/muse2/muse/widgets/transposebase.ui b/muse2/muse/widgets/transposebase.ui deleted file mode 100644 index c26f2ef9..00000000 --- a/muse2/muse/widgets/transposebase.ui +++ /dev/null @@ -1,203 +0,0 @@ - - - TransposeBase - - - - 0 - 0 - 275 - 264 - - - - MusE: Transpose - - - - 6 - - - 11 - - - - - Range - - - - 6 - - - 11 - - - - - All Events - - - - - - - Selected Events - - - true - - - - - - - Looped Events - - - - - - - Selected Looped - - - - - - - - - - Value - - - false - - - false - - - - 11 - - - 6 - - - - - Halftone-steps - - - false - - - - - - - true - - - - - - -127 - - - 127 - - - 1 - - - 0 - - - - - - - - - - 6 - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 20 - 20 - - - - - - - - OK - - - false - - - true - - - - - - - Cancel - - - - - - - - - - - - okButton - clicked() - TransposeBase - accept() - - - 20 - 20 - - - 20 - 20 - - - - - cancelButton - clicked() - TransposeBase - reject() - - - 20 - 20 - - - 20 - 20 - - - - - diff --git a/muse2/muse/widgets/velocity.cpp b/muse2/muse/widgets/velocity.cpp deleted file mode 100644 index ec625489..00000000 --- a/muse2/muse/widgets/velocity.cpp +++ /dev/null @@ -1,102 +0,0 @@ -//========================================================= -// MusE -// Linux Music Editor -// $Id: velocity.cpp,v 1.1.1.1 2003/10/27 18:55:04 wschweer Exp $ -// (C) Copyright 2001 Werner Schweer (ws@seh.de) -//========================================================= - -#include -#include "velocity.h" -#include "xml.h" - -//--------------------------------------------------------- -// Velocity -//--------------------------------------------------------- - -Velocity::Velocity(QWidget* parent) - : QDialog(parent) - { - setupUi(this); - rangeGroup = new QButtonGroup; - rangeGroup->addButton(allEvents,0); - rangeGroup->addButton(selectedEvents,1); - rangeGroup->addButton(loopedEvents,2); - rangeGroup->addButton(selectedLooped,3); - - pullValues(); - } - -//--------------------------------------------------------- -// accept -//--------------------------------------------------------- - -void Velocity::accept() - { - pullValues(); - QDialog::accept(); - } - -//--------------------------------------------------------- -// pullValues -//--------------------------------------------------------- - -void Velocity::pullValues() - { - range = rangeGroup->checkedId(); - rateVal = rate->value(); - offsetVal = offset->value(); - } - -//--------------------------------------------------------- -// exec -//--------------------------------------------------------- - -int Velocity::exec() - { - rangeGroup->button(range)->setChecked(true); - rate->setValue(rateVal); - offset->setValue(offsetVal); - - return QDialog::exec(); - } - -void Velocity::read_configuration(Xml& xml) -{ - for (;;) - { - Xml::Token token = xml.parse(); - if (token == Xml::Error || token == Xml::End) - break; - - const QString& tag = xml.s1(); - switch (token) - { - case Xml::TagStart: - if (tag == "range") - range=xml.parseInt(); - else if (tag == "rate") - rateVal=xml.parseInt(); - else if (tag == "offset") - offsetVal=xml.parseInt(); - else - xml.unknown("ModVelo"); - break; - - case Xml::TagEnd: - if (tag == "mod_velo") - return; - - default: - break; - } - } -} - -void Velocity::write_configuration(int level, Xml& xml) -{ - xml.tag(level++, "mod_velo"); - xml.intTag(level, "range", range); - xml.intTag(level, "offset", offsetVal); - xml.intTag(level, "rate", rateVal); - xml.tag(level, "/mod_velo"); -} diff --git a/muse2/muse/widgets/velocity.h b/muse2/muse/widgets/velocity.h deleted file mode 100644 index cbea4e22..00000000 --- a/muse2/muse/widgets/velocity.h +++ /dev/null @@ -1,45 +0,0 @@ -//========================================================= -// MusE -// Linux Music Editor -// $Id: velocity.h,v 1.1.1.1 2003/10/27 18:54:51 wschweer Exp $ -// (C) Copyright 2001 Werner Schweer (ws@seh.de) -//========================================================= - -#ifndef __VELOCITY_H__ -#define __VELOCITY_H__ - -#include "ui_velocitybase.h" - -class QButtonGroup; -class Xml; - -//--------------------------------------------------------- -// Velocity -//--------------------------------------------------------- - -class Velocity : public QDialog, public Ui::VelocityBase { - private: - Q_OBJECT - QButtonGroup* rangeGroup; - - protected slots: - void accept(); - void pullValues(); - - public: - Velocity(QWidget* parent = 0); - - int range; - int rateVal; - int offsetVal; - - void read_configuration(Xml& xml); - void write_configuration(int level, Xml& xml); - - - public slots: - int exec(); - }; - -#endif - diff --git a/muse2/muse/widgets/velocitybase.ui b/muse2/muse/widgets/velocitybase.ui deleted file mode 100644 index 40fe625f..00000000 --- a/muse2/muse/widgets/velocitybase.ui +++ /dev/null @@ -1,221 +0,0 @@ - - - VelocityBase - - - - 0 - 0 - 275 - 316 - - - - MusE: Modify Velocity - - - - 6 - - - 11 - - - - - Range - - - - 6 - - - 11 - - - - - All Events - - - - - - - Selected Events - - - true - - - - - - - Looped Events - - - - - - - Selected Looped - - - - - - - - - - Values - - - - 11 - - - 6 - - - - - Rate: - - - false - - - - - - - % - - - 200 - - - 100 - - - - - - - Offset: - - - false - - - - - - - -127 - - - 127 - - - 1 - - - 0 - - - - - - - veloNew = (veloOld * rate) + offset - - - - - - - - - - 6 - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 20 - 20 - - - - - - - - OK - - - false - - - true - - - - - - - Cancel - - - - - - - - - - - - okButton - clicked() - VelocityBase - accept() - - - 20 - 20 - - - 20 - 20 - - - - - cancelButton - clicked() - VelocityBase - reject() - - - 20 - 20 - - - 20 - 20 - - - - - -- cgit v1.2.3 From 5ebe0c1636ed2e805c3595e0e9aa1fb5d9d8ec0e Mon Sep 17 00:00:00 2001 From: Robert Jonsson Date: Wed, 18 May 2011 20:35:15 +0000 Subject: build fixes --- muse2/muse/CMakeLists.txt | 1 + muse2/muse/midiedit/CMakeLists.txt | 1 + muse2/muse/widgets/function_dialogs/CMakeLists.txt | 111 +++++++++++++++++++++ 3 files changed, 113 insertions(+) create mode 100644 muse2/muse/widgets/function_dialogs/CMakeLists.txt diff --git a/muse2/muse/CMakeLists.txt b/muse2/muse/CMakeLists.txt index 761f8e96..e6a90a59 100644 --- a/muse2/muse/CMakeLists.txt +++ b/muse2/muse/CMakeLists.txt @@ -193,6 +193,7 @@ include_directories( ${CMAKE_CURRENT_BINARY_DIR}/remote ${CMAKE_CURRENT_BINARY_DIR}/waveedit ${CMAKE_CURRENT_BINARY_DIR}/widgets + ${CMAKE_CURRENT_BINARY_DIR}/widgets/function_dialogs ) ## diff --git a/muse2/muse/midiedit/CMakeLists.txt b/muse2/muse/midiedit/CMakeLists.txt index a52d1844..9c3441e9 100644 --- a/muse2/muse/midiedit/CMakeLists.txt +++ b/muse2/muse/midiedit/CMakeLists.txt @@ -94,6 +94,7 @@ target_link_libraries ( midiedit ctrl icons widgets + widgets_functiondialogs ) ## diff --git a/muse2/muse/widgets/function_dialogs/CMakeLists.txt b/muse2/muse/widgets/function_dialogs/CMakeLists.txt new file mode 100644 index 00000000..7ddc6bee --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/CMakeLists.txt @@ -0,0 +1,111 @@ +#============================================================================= +# MusE +# Linux Music Editor +# $Id:$ +# +# Copyright (C) 2002-2006 by Werner Schweer and others +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +#============================================================================= + +## +## Expand Qt macros in source files +## +QT4_WRAP_CPP (widgets_functiondialogs_mocs + crescendo.h + deloverlaps.h + gatetime.h + move.h + quantize.h + remove.h + setlen.h + transpose.h + velocity.h + ) + +## +## UI files +## +file (GLOB widgets_functiondialogs_ui_files + crescendobase.ui + deloverlapsbase.ui + gatetimebase.ui + movebase.ui + quantbase.ui + removebase.ui + setlenbase.ui + transposebase.ui + velocitybase.ui + ) + +QT4_WRAP_UI (widgets_functiondialogs_ui_headers ${widgets_functiondialogs_ui_files}) + +## +## List of source files to compile +## +file (GLOB widgets_functiondialogs_source_files + crescendo.cpp + deloverlaps.cpp + gatetime.cpp + move.cpp + quantize.cpp + remove.cpp + setlen.cpp + transpose.cpp + velocity.cpp + ) + +## +## Define target +## +add_library ( widgets_functiondialogs ${MODULES_BUILD} + ${widgets_functiondialogs_ui_headers} + ${widgets_functiondialogs_mocs} + ${widgets_functiondialogs_source_files} + ) + +## +## Append to the list of translations +## +set (FILES_TO_TRANSLATE + ${FILES_TO_TRANSLATE} + ${widgets_functiondialogs_source_files} + ${widgets_functiondialogs_ui_files} + CACHE INTERNAL "" + ) + +## +## Compilation flags and target name +## +set_target_properties( widgets_functiondialogs + # PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h ${MUSECXXFLAGS} -I../ -I${PROJECT_SOURCE_DIR}/synti " + PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h ${MUSECXXFLAGS} -I../ -I${PROJECT_SOURCE_DIR}/synti" + OUTPUT_NAME muse_widgets_functiondialogs + ) + +## +## Linkage +## +target_link_libraries ( widgets_functiondialogs + ${QT_LIBRARIES} + icons + ) + +## +## Install location +## +if ( ${MODULES_BUILD} STREQUAL SHARED ) + install(TARGETS widgets_functiondialogs + DESTINATION ${MusE_MODULES_DIR} + ) +endif ( ${MODULES_BUILD} STREQUAL SHARED ) -- cgit v1.2.3 From def56ecf12f25a643e72c38ecf78226f5e87c11c Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Thu, 19 May 2011 11:02:32 +0000 Subject: improved step-recording: - chords can now be entered without pressing shift - behaviour of shift changed: previously, chords were entered like C E G ; now they're entered like C E G; or simply C E G (played at once) --- muse2/muse/midiedit/prcanvas.cpp | 51 ++++++++++++++++++++++++++++----------- muse2/muse/midiedit/prcanvas.h | 5 ++++ muse2/muse/midiedit/scoreedit.cpp | 2 +- 3 files changed, 43 insertions(+), 15 deletions(-) diff --git a/muse2/muse/midiedit/prcanvas.cpp b/muse2/muse/midiedit/prcanvas.cpp index 0da18e99..84cac135 100644 --- a/muse2/muse/midiedit/prcanvas.cpp +++ b/muse2/muse/midiedit/prcanvas.cpp @@ -35,6 +35,8 @@ #include "song.h" #include "audio.h" +#define CHORD_TIMEOUT 75 + //--------------------------------------------------------- // NEvent //--------------------------------------------------------- @@ -81,6 +83,13 @@ PianoCanvas::PianoCanvas(MidiEditor* pr, QWidget* parent, int sx, int sy) { colorMode = 0; playedPitch = -1; + + chordTimer = new QTimer(this); + chordTimer->setSingleShot(true); + chordTimer->setInterval(CHORD_TIMEOUT); + chordTimer->stop(); + + connect(chordTimer, SIGNAL(timeout()), SLOT(chordTimerTimedOut())); songChanged(SC_TRACK_INSERTED); connect(song, SIGNAL(midiNote(int, int)), SLOT(midiNote(int,int))); @@ -768,8 +777,7 @@ void PianoCanvas::pianoPressed(int pitch, int velocity, bool shift) audio->msgPlayMidiEvent(&e); if (_steprec && pos[0] >= start_tick && pos[0] < end_tick) { - if (curPart == 0) - return; + if (curPart) { int len = editor->raster(); unsigned tick = pos[0] - curPart->tick(); //CDW if (shift) @@ -788,6 +796,8 @@ void PianoCanvas::pianoPressed(int pitch, int velocity, bool shift) song->setPos(0, p, true, false, true); } } + } + } //--------------------------------------------------------- @@ -1049,6 +1059,8 @@ void PianoCanvas::midiNote(int pitch, int velo) && !audio->isPlaying() && velo && pos[0] >= start_tick && pos[0] < end_tick && !(globalKeyState & Qt::AltModifier)) { + chordTimer->stop(); + //len has been changed by flo: set to raster() instead of quant() //reason: the quant-toolbar has been removed; the flexibility you //lose with this can be re-gained by applying a "modify note len" @@ -1056,8 +1068,6 @@ void PianoCanvas::midiNote(int pitch, int velo) unsigned int len = editor->raster();//prevent compiler warning: comparison singed/unsigned unsigned tick = pos[0]; //CDW unsigned starttick = tick; - if (globalKeyState & Qt::ShiftModifier) - tick -= editor->rasterStep(tick); // // extend len of last note? @@ -1074,10 +1084,10 @@ void PianoCanvas::midiNote(int pitch, int velo) // Indicate do undo, and do not do port controller values and clone parts. //audio->msgChangeEvent(ev, e, curPart); audio->msgChangeEvent(ev, e, curPart, true, false, false); - tick += editor->rasterStep(tick); - if (tick != song->cpos()) { - Pos p(tick, true); - song->setPos(0, p, true, false, true); + + if (! (globalKeyState & Qt::ShiftModifier)) { + chordTimer_setToTick = tick + editor->rasterStep(tick); + chordTimer->start(); } return; } @@ -1094,8 +1104,12 @@ void PianoCanvas::midiNote(int pitch, int velo) // Indicate do undo, and do not do port controller values and clone parts. //audio->msgDeleteEvent(ev, curPart); audio->msgDeleteEvent(ev, curPart, true, false, false); - if (globalKeyState & Qt::ShiftModifier) - tick += editor->rasterStep(tick); + + if (! (globalKeyState & Qt::ShiftModifier)) { + chordTimer_setToTick = tick + editor->rasterStep(tick); + chordTimer->start(); + } + return; } } @@ -1107,14 +1121,23 @@ void PianoCanvas::midiNote(int pitch, int velo) // Indicate do undo, and do not do port controller values and clone parts. //audio->msgAddEvent(e, curPart); audio->msgAddEvent(e, curPart, true, false, false); - tick += editor->rasterStep(tick); - if (tick != song->cpos()) { - Pos p(tick, true); - song->setPos(0, p, true, false, true); + + if (! (globalKeyState & Qt::ShiftModifier)) { + chordTimer_setToTick = tick + editor->rasterStep(tick); + chordTimer->start(); } } } +void PianoCanvas::chordTimerTimedOut() +{ + if (chordTimer_setToTick != song->cpos()) + { + Pos p(chordTimer_setToTick, true); + song->setPos(0, p, true, false, true); + } +} + /* //--------------------------------------------------------- // getTextDrag diff --git a/muse2/muse/midiedit/prcanvas.h b/muse2/muse/midiedit/prcanvas.h index 9922b471..6995bdbe 100644 --- a/muse2/muse/midiedit/prcanvas.h +++ b/muse2/muse/midiedit/prcanvas.h @@ -15,6 +15,7 @@ #include #include #include +#include #define KH 13 @@ -39,6 +40,9 @@ class QRect; class PianoCanvas : public EventCanvas { int colorMode; int playedPitch; + + QTimer* chordTimer; + int chordTimer_setToTick; Q_OBJECT virtual void viewMouseDoubleClickEvent(QMouseEvent*); @@ -72,6 +76,7 @@ class PianoCanvas : public EventCanvas { private slots: void midiNote(int pitch, int velo); + void chordTimerTimedOut(); signals: void quantChanged(int); diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index df915092..46fa1914 100644 --- a/muse2/muse/midiedit/scoreedit.cpp +++ b/muse2/muse/midiedit/scoreedit.cpp @@ -4202,7 +4202,7 @@ void staff_t::apply_lasso(QRect rect, set& already_processed) * between, for example, when a cis is tied to a des * * CURRENT TODO - * o in step-rec: insert chords + * x nothing atm * * IMPORTANT TODO * o display blue loop markers in score editor -- cgit v1.2.3 From 6ddc310885d4dc3dfd2bdea44c2f6f1568fbd6bb Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Thu, 19 May 2011 16:02:25 +0000 Subject: added a modified MTScale to the score editor --- muse2/muse/midiedit/prcanvas.h | 2 +- muse2/muse/midiedit/scoreedit.cpp | 38 +++-- muse2/muse/midiedit/scoreedit.h | 20 ++- muse2/muse/widgets/CMakeLists.txt | 2 + muse2/muse/widgets/mtscale_flo.cpp | 325 +++++++++++++++++++++++++++++++++++++ muse2/muse/widgets/mtscale_flo.h | 51 ++++++ 6 files changed, 414 insertions(+), 24 deletions(-) create mode 100644 muse2/muse/widgets/mtscale_flo.cpp create mode 100644 muse2/muse/widgets/mtscale_flo.h diff --git a/muse2/muse/midiedit/prcanvas.h b/muse2/muse/midiedit/prcanvas.h index 6995bdbe..a04ca514 100644 --- a/muse2/muse/midiedit/prcanvas.h +++ b/muse2/muse/midiedit/prcanvas.h @@ -42,7 +42,7 @@ class PianoCanvas : public EventCanvas { int playedPitch; QTimer* chordTimer; - int chordTimer_setToTick; + unsigned chordTimer_setToTick; Q_OBJECT virtual void viewMouseDoubleClickEvent(QMouseEvent*); diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index 46fa1914..dccac615 100644 --- a/muse2/muse/midiedit/scoreedit.cpp +++ b/muse2/muse/midiedit/scoreedit.cpp @@ -170,9 +170,10 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos) apply_velo=false; - score_canvas=new ScoreCanvas(this, mainw, 1, 1); + score_canvas=new ScoreCanvas(this, mainw); xscroll = new QScrollBar(Qt::Horizontal, mainw); yscroll = new QScrollBar(Qt::Vertical, mainw); + time_bar = new MTScaleFlo(score_canvas, mainw); connect(xscroll, SIGNAL(valueChanged(int)), score_canvas, SLOT(x_scroll_event(int))); connect(score_canvas, SIGNAL(xscroll_changed(int)), xscroll, SLOT(setValue(int))); @@ -187,9 +188,14 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos) connect(song, SIGNAL(songChanged(int)), score_canvas, SLOT(song_changed(int))); - mainGrid->addWidget(score_canvas, 0, 0); - mainGrid->addWidget(xscroll,1,0); - mainGrid->addWidget(yscroll,0,1); + connect(xscroll, SIGNAL(valueChanged(int)), time_bar, SLOT(set_xpos(int))); + connect(score_canvas, SIGNAL(pos_add_changed()), time_bar, SLOT(pos_add_changed())); + connect(score_canvas, SIGNAL(preamble_width_changed(int)), time_bar, SLOT(set_xoffset(int))); + + mainGrid->addWidget(time_bar, 0,0); + mainGrid->addWidget(score_canvas, 1,0); + mainGrid->addWidget(xscroll,2,0); + mainGrid->addWidget(yscroll,1,1); xscroll->setMinimum(0); yscroll->setMinimum(0); @@ -957,8 +963,7 @@ void ScoreCanvas::add_staves(PartList* pl, bool all_in_one) } -ScoreCanvas::ScoreCanvas(ScoreEdit* pr, QWidget* parent_widget, - int sx, int sy) : View(parent_widget, sx, sy) +ScoreCanvas::ScoreCanvas(ScoreEdit* pr, QWidget* parent_widget) : View(parent_widget, 1, 1) { parent = pr; setFocusPolicy(Qt::StrongFocus); @@ -2667,6 +2672,8 @@ void ScoreCanvas::calc_pos_add_list() curr_key=new_key; } + + emit pos_add_changed(); } void ScoreCanvas::draw_items(QPainter& p, int y, staff_t& staff, int x1, int x2) @@ -3088,7 +3095,10 @@ void ScoreCanvas::draw_preamble(QPainter& p, int y_offset, clef_t clef) if (x_left_old!=x_left) + { emit viewport_width_changed(viewport_width()); + emit preamble_width_changed(x_left); + } } @@ -3206,6 +3216,11 @@ int ScoreCanvas::tick_to_x(int t) return x; } +int ScoreCanvas::delta_tick_to_delta_x(int t) +{ + return t*pixels_per_whole()/TICKS_PER_WHOLE; +} + int ScoreCanvas::calc_posadd(int t) { int result=0; @@ -4205,17 +4220,15 @@ void staff_t::apply_lasso(QRect rect, set& already_processed) * x nothing atm * * IMPORTANT TODO - * o display blue loop markers in score editor - * o transpose: support in-key-transpose - * o drum-loop-editor (like in sq korg ds xD) - * * o add a select-clef-toolbox for tracks * o respect the track's clef (has to be implemented first in muse) * o do partial recalculating; recalculating can take pretty long * (0,5 sec) when displaying a whole song in scores * o transpose etc. must also transpose key-pressure events + * o transpose: support in-key-transpose * * less important stuff + * o controller view in score editor * o quantize-templates (everything is forced into a specified * rhythm) * o part-templates (you specify some notes and a control-chord; @@ -4251,11 +4264,6 @@ void staff_t::apply_lasso(QRect rect, set& already_processed) * msgNewEvent functions (see my e-mail) * * o make quantize and other stuff faster (by assymetric communication) - * - * GUI stuff - * o velocity/release-velo for already existing notes - * - do this by right-click -> some dialog shows up? - * - or by controller graphs, as used by the piano roll */ diff --git a/muse2/muse/midiedit/scoreedit.h b/muse2/muse/midiedit/scoreedit.h index c26bdd84..4004452f 100644 --- a/muse2/muse/midiedit/scoreedit.h +++ b/muse2/muse/midiedit/scoreedit.h @@ -31,6 +31,7 @@ #include "gconfig.h" #include "part.h" #include "keyevent.h" +#include "mtscale_flo.h" #include #include @@ -109,6 +110,7 @@ class ScoreEdit : public TopWin QScrollBar* xscroll; QScrollBar* yscroll; ScoreCanvas* score_canvas; + MTScaleFlo* time_bar; QLabel* apply_velo_to_label; bool apply_velo; @@ -583,13 +585,6 @@ class ScoreCanvas : public View void recalc_staff_pos(); list::iterator staff_at_y(int y); - - timesig_t timesig_at_tick(int t); - key_enum key_at_tick(int t); - int tick_to_x(int t); - int x_to_tick(int x); - int calc_posadd(int t); - bool need_redraw_for_hilighting(ScoreItemList::iterator from_it, ScoreItemList::iterator to_it); @@ -722,9 +717,11 @@ class ScoreCanvas : public View void yscroll_changed(int); void viewport_width_changed(int); void canvas_width_changed(int); + void preamble_width_changed(int); void viewport_height_changed(int); void canvas_height_changed(int); void pixels_per_whole_changed(int); + void pos_add_changed(); protected: virtual void draw(QPainter& p, const QRect& rect); @@ -737,7 +734,7 @@ class ScoreCanvas : public View virtual void keyPressEvent(QKeyEvent* event); public: - ScoreCanvas(ScoreEdit*, QWidget*, int, int); + ScoreCanvas(ScoreEdit*, QWidget*); ~ScoreCanvas(){}; void add_staves(PartList* pl, bool all_in_one); @@ -763,6 +760,13 @@ class ScoreCanvas : public View set get_all_parts(); void write_staves(int level, Xml& xml) const; + + timesig_t timesig_at_tick(int t); + key_enum key_at_tick(int t); + int tick_to_x(int t); + int delta_tick_to_delta_x(int t); + int x_to_tick(int x); + int calc_posadd(int t); }; int calc_measure_len(const list& nums, int denom); diff --git a/muse2/muse/widgets/CMakeLists.txt b/muse2/muse/widgets/CMakeLists.txt index 5989df11..7589ddf0 100644 --- a/muse2/muse/widgets/CMakeLists.txt +++ b/muse2/muse/widgets/CMakeLists.txt @@ -53,6 +53,7 @@ QT4_WRAP_CPP (widget_mocs mixdowndialog.h mlabel.h mtscale.h + mtscale_flo.h mtrackinfo.h nentry.h noteinfo.h @@ -149,6 +150,7 @@ file (GLOB widgets_source_files mmath.cpp mtrackinfo.cpp mtscale.cpp + mtscale_flo.cpp nentry.cpp noteinfo.cpp pitchedit.cpp diff --git a/muse2/muse/widgets/mtscale_flo.cpp b/muse2/muse/widgets/mtscale_flo.cpp new file mode 100644 index 00000000..e18a7d11 --- /dev/null +++ b/muse2/muse/widgets/mtscale_flo.cpp @@ -0,0 +1,325 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: mtscale_flo.cpp,v 1.8.2.7 2011/05/19 04:14:01 flo Exp $ +// (C) Copyright 1999 Werner Schweer (ws@seh.de) +//========================================================= + +#include + +#include +#include + +#include "mtscale_flo.h" +#include "song.h" +#include "icons.h" +#include "gconfig.h" +#include "scoreedit.h" + +//--------------------------------------------------------- +// MTScale +// Midi Time Scale +//--------------------------------------------------------- + +MTScaleFlo::MTScaleFlo(ScoreCanvas* parent_editor, QWidget* parent_widget) + : View(parent_widget, 1, 1) + { + setToolTip(tr("bar scale")); + pos[0] = song->cpos(); + pos[1] = song->lpos(); + pos[2] = song->rpos(); + button = Qt::NoButton; + setMouseTracking(true); + connect(song, SIGNAL(posChanged(int, unsigned, bool)), SLOT(setPos(int, unsigned, bool))); + connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); + connect(song, SIGNAL(markerChanged(int)), SLOT(redraw())); + + parent=parent_editor; + + setFixedHeight(28); + setBg(QColor(0xe0, 0xe0, 0xe0)); + } + +//--------------------------------------------------------- +// songChanged +//--------------------------------------------------------- + +void MTScaleFlo::songChanged(int type) + { + if (type & (SC_SIG|SC_TEMPO)) + redraw(); + } + +//--------------------------------------------------------- +// setPos +//--------------------------------------------------------- + +void MTScaleFlo::setPos(int idx, unsigned val, bool) + { + if ((val == MAXINT) || (val == pos[idx])) + return; + + int opos = parent->tick_to_x(pos[idx] == MAXINT ? val : pos[idx]) + xoffset - xpos; + + pos[idx] = val; + +// if (isVisible()) +// redraw(); + if (isVisible()) { + + int tval = parent->tick_to_x(val) + xoffset - xpos; + int x = -9; + int w = 18; + + if (tval < 0) { // tval<0 occurs whenever the window is scrolled left, so I switched to signed int (ml) + redraw(); + } + else if (opos > tval) { + w += opos - tval; + x += tval; + } + else { + w += tval - opos; + x += opos; + } + redraw(QRect(x, 0, w, height())); + } + } + +//--------------------------------------------------------- +// mousePressEvent +//--------------------------------------------------------- + +void MTScaleFlo::mousePressEvent(QMouseEvent* event) + { + button = event->button(); + mouseMoveEvent(event); + } + +//--------------------------------------------------------- +// mouseReleaseEvent +//--------------------------------------------------------- + +void MTScaleFlo::mouseReleaseEvent(QMouseEvent*) + { + button = Qt::NoButton; + } + +//--------------------------------------------------------- +// mouseMoveEvent +//--------------------------------------------------------- + +void MTScaleFlo::mouseMoveEvent(QMouseEvent* event) + { + if (event->modifiers() & Qt::ShiftModifier ) + setCursor(QCursor(Qt::PointingHandCursor)); + else + setCursor(QCursor(Qt::ArrowCursor)); + + int tick = AL::sigmap.raster(parent->x_to_tick(event->x()-xoffset+xpos), parent->quant_ticks()); + if (tick<0) tick=0; + + int i; + switch (button) { + case Qt::LeftButton: + i = 0; + break; + case Qt::MidButton: + i = 1; + break; + case Qt::RightButton: + i = 2; + break; + default: + return; // if no button is pressed the function returns here + } + Pos p(tick, true); + + if(i== 0 && (event->modifiers() & Qt::ShiftModifier )) { // If shift +LMB we add a marker + Marker *alreadyExists = song->getMarkerAt(tick); + if (!alreadyExists) + song->addMarker(QString(""), tick, false); + } + else if (i== 2 && (event->modifiers() & Qt::ShiftModifier )) { // If shift +RMB we remove a marker + Marker *toRemove = song->getMarkerAt(tick); + if (toRemove) + song->removeMarker(toRemove); + else + printf("No marker to remove\n"); + } + else + song->setPos(i, p); // all other cases: relocating one of the locators + } + + + +//--------------------------------------------------------- +// draw +//--------------------------------------------------------- + +void MTScaleFlo::draw(QPainter& p, const QRect& r) + { + int x = r.x(); + int w = r.width(); + + x -= 20; + w += 40; // wg. Text + + //--------------------------------------------------- + // draw Marker + //--------------------------------------------------- + + int y = 12; + p.setPen(Qt::black); + p.setFont(config.fonts[4]); + p.drawLine(r.x(), y+1, r.x() + r.width(), y+1); + QRect tr(r); + tr.setHeight(12); + MarkerList* marker = song->marker(); + for (iMarker m = marker->begin(); m != marker->end(); ++m) { + + int xp = parent->tick_to_x(m->second.tick()) + xoffset - xpos; + if (xp > x+w) + break; + int xe = r.x() + r.width(); + iMarker mm = m; + ++mm; + if (mm != marker->end()) + xe = parent->tick_to_x(mm->first) + xoffset - xpos; + + QRect tr(xp, 0, xe-xp, 13); + + QRect wr = r.intersect(tr); + if(!wr.isEmpty()) + { + if (m->second.current()) + p.fillRect(wr, Qt::white); + + int x2; + if (mm != marker->end()) + x2 = parent->tick_to_x(mm->first) + xoffset - xpos; + else + x2 = xp+200; + + if(xp >= -32) + p.drawPixmap(xp, 0, *flagIconS); + + if(xp >= -1023) + { + QRect r = QRect(xp+10, 0, x2-xp, 12); + p.setPen(Qt::black); + p.drawText(r, Qt::AlignLeft|Qt::AlignVCenter, m->second.name()); + } + + if(xp >= 0) + { + p.setPen(Qt::green); + p.drawLine(xp, y, xp, height()); + } + } + } + + //--------------------------------------------------- + // draw location marker + //--------------------------------------------------- + + int h = height()-12; + + for (int i = 0; i < 3; ++i) { + int xp = parent->tick_to_x(pos[i]) + xoffset - xpos; + if (xp >= x && xp < x+w) { + QPixmap* pm = markIcon[i]; + p.drawPixmap(xp - pm->width()/2, y-1, *pm); + } + } + + + //--------------------------------------------------- + // draw beats + //--------------------------------------------------- + + + p.setPen(Qt::black); + + unsigned ctick; + int bar1, bar2, beat; + unsigned tick; + + ctick = parent->x_to_tick(x - xoffset + xpos); + AL::sigmap.tickValues(ctick, &bar1, &beat, &tick); + AL::sigmap.tickValues(parent->x_to_tick(x+w - xoffset + xpos), &bar2, &beat, &tick); + + + int stick = AL::sigmap.bar2tick(bar1, 0, 0); + int ntick; + for (int bar = bar1; bar <= bar2; bar++, stick = ntick) { + ntick = AL::sigmap.bar2tick(bar+1, 0, 0); + int tpix = parent->delta_tick_to_delta_x(ntick - stick); + if (tpix < 64) { + // donÃŊÂŋÂ―t show beats if measure is this small + int n = 1; + if (tpix < 32) + n = 2; + if (tpix <= 16) + n = 4; + if (tpix < 8) + n = 8; + if (tpix <= 4) + n = 16; + if (tpix <= 2) + n = 32; + if (bar % n) + continue; + p.setFont(config.fonts[3]); + int x = parent->tick_to_x(stick) + xoffset - xpos; + QString s; + s.setNum(bar + 1); + p.drawLine(x, y+1, x, y+1+h); +// QRect r = QRect(x+2, y, 0, h); + QRect r = QRect(x+2, y, 1000, h); + p.drawText(r, Qt::AlignLeft|Qt::AlignVCenter|Qt::TextDontClip, s); + } + else { + int z, n; + AL::sigmap.timesig(stick, z, n); + for (int beat = 0; beat < z; beat++) { + int xp = parent->tick_to_x(AL::sigmap.bar2tick(bar, beat, 0)) + xoffset - xpos; + QString s; + QRect r(xp+2, y, 1000, h); + int y1; + int num; + if (beat == 0) { + num = bar + 1; + y1 = y + 1; + p.setFont(config.fonts[3]); + } + else { + num = beat + 1; + y1 = y + 7; + p.setFont(config.fonts[1]); + r.setY(y+3); + } + s.setNum(num); + p.drawLine(xp, y1, xp, y+1+h); + p.drawText(r, Qt::AlignLeft|Qt::AlignVCenter|Qt::TextDontClip, s); + } + } + } + } + +void MTScaleFlo::set_xpos(int pos) +{ + xpos=pos; + redraw(); +} + +void MTScaleFlo::set_xoffset(int o) +{ + xoffset=o; + redraw(); +} + +void MTScaleFlo::pos_add_changed() +{ + redraw(); +} diff --git a/muse2/muse/widgets/mtscale_flo.h b/muse2/muse/widgets/mtscale_flo.h new file mode 100644 index 00000000..b7856207 --- /dev/null +++ b/muse2/muse/widgets/mtscale_flo.h @@ -0,0 +1,51 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: mtscale_flo.h,v 1.3 2011/05/19 22:27:06 flo Exp $ +// (C) Copyright 1999 Werner Schweer (ws@seh.de) +//========================================================= + +#ifndef __MTSCALE_FLO_H__ +#define __MTSCALE_FLO_H__ + +#include "view.h" + + +class ScoreCanvas; + +//--------------------------------------------------------- +// MTScaleFlo +// scale for midi track +//--------------------------------------------------------- + +class MTScaleFlo : public View { + Q_OBJECT + unsigned pos[3]; + int button; + ScoreCanvas* parent; + int xpos; + int xoffset; + + private slots: + void songChanged(int); + + protected: + virtual void draw(QPainter&, const QRect&); + virtual void mousePressEvent(QMouseEvent* event); + virtual void mouseMoveEvent(QMouseEvent* event); + virtual void mouseReleaseEvent(QMouseEvent* event); + + signals: + void timeChanged(unsigned); + + public slots: + void setPos(int, unsigned, bool); + void set_xpos(int); + void pos_add_changed(); + void set_xoffset(int); + + public: + MTScaleFlo(ScoreCanvas* parent_editor, QWidget* parent_widget); + }; +#endif + -- cgit v1.2.3 From 9284586c256dfc058040df57664eddd91b73db85 Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Thu, 19 May 2011 16:25:29 +0000 Subject: fixed bug in midi.cpp and cleaned up a bit --- muse2/muse/midi.cpp | 85 +++++------------------------------------------------ 1 file changed, 7 insertions(+), 78 deletions(-) diff --git a/muse2/muse/midi.cpp b/muse2/muse/midi.cpp index 52119692..39ae7874 100644 --- a/muse2/muse/midi.cpp +++ b/muse2/muse/midi.cpp @@ -14,7 +14,6 @@ #include "song.h" #include "midi.h" #include "drummap.h" -//#include "midiedit/drummap.h" // p4.0.2 #include "event.h" #include "globals.h" #include "midictrl.h" @@ -220,12 +219,8 @@ void buildMidiEventList(EventList* del, const MPEventList* el, MidiTrack* track, if(!(ev.isNoteOff() && loopn == 0)) { if(cmode == Song::CYCLE_REPLACE && loopn < loopc) - { - // Added by Tim. p3.3.8 - //printf("buildMidiEventList: CYCLE_REPLACE t:%d type:%d A:%d B:%d ln:%d lc:%d\n", tick, ev.type(), ev.dataA(), ev.dataB(), loopn, loopc); - continue; - } + // If we want NORMAL, same as REPLACE except keep all events from the previous loop // from rec stop position to right marker (and beyond). if(cmode == Song::CYCLE_NORMAL) @@ -233,12 +228,7 @@ void buildMidiEventList(EventList* del, const MPEventList* el, MidiTrack* track, // Not sure of accuracy here. Adjust? Adjusted when used elsewhere? unsigned endRec = audio->getEndRecordPos().tick(); if((tick < endRec && loopn < loopc) || (tick >= endRec && loopn < (loopc - 1))) - { - // Added by Tim. p3.3.8 - //printf("buildMidiEventList: CYCLE_NORMAL t:%d type:%d A:%d B:%d ln:%d lc:%d\n", tick, ev.type(), ev.dataA(), ev.dataB(), loopn, loopc); - continue; - } } } } @@ -451,8 +441,6 @@ void buildMidiEventList(EventList* del, const MPEventList* el, MidiTrack* track, } break; case 0x59: // Key Signature - // track->scale.set(data[0]); - // track->scale.setMajorMinor(data[1]); break; default: printf("unknown Meta 0x%x %d\n", ev.dataA(), ev.dataA()); @@ -462,63 +450,21 @@ void buildMidiEventList(EventList* del, const MPEventList* el, MidiTrack* track, } // switch(ev.type() if (!e.empty()) { e.setTick(tick); - // Added by Tim. p3.3.8 - //printf("buildMidiEventList: mel adding t:%d type:%d A:%d B:%d C:%d\n", tick, e.type(), e.dataA(), e.dataB(), e.dataC()); - mel.add(e); } } // i != el->end() + //--------------------------------------------------- - // resolve NoteOff events + // read NoteOn events and remove corresponding NoteOffs //--------------------------------------------------- -// for (iEvent i = mel.begin(); i != mel.end(); ++i) { -// Event event = i->second; -// if (event.isNote()) -// event.setLenTick(0); -// } - // Added by Tim. p3.3.8 // Loop removed by flo for (iEvent i = mel.begin(); i != mel.end(); ++i) { Event ev = i->second; if (ev.isNote()) { - if (ev.isNoteOff()) { - iEvent k; - bool found = false; - for (k = i; k != mel.end(); ++k) { - Event event = k->second; - if (event.tick() > ev.tick()) - break; - if (event.isNoteOff(ev)) { - ev.setLenTick(1); - ev.setVelo(event.velo()); - ev.setVeloOff(0); - // Added by Tim. p3.3.8 - //printf("buildMidiEventList: found note off: event t:%d len:%d type:%d A:%d B:%d C:%d ev t:%d len:%d type:%d A:%d B:%d C:%d\n", event.tick(), event.lenTick(), event.type(), event.dataA(), event.dataB(), event.dataC(), ev.tick(), ev.lenTick(), ev.type(), ev.dataA(), ev.dataB(), ev.dataC()); - - found = true; - break; - } - } - if (!found) { - printf("NOTE OFF without Note ON tick %d type %d %d %d\n", - ev.tick(), ev.type(), ev.pitch(), ev.velo()); - continue; - } - else { - if (k==i) - printf("ERROR: THIS SHOULD NEVER HAPPEN: k==i in midi.cpp:buildMidiEventList()\n"); - else - mel.erase(k); - - // we may safely continue, because k!=i; only erasing - // i itself would invalidate it and require additional stuff - continue; - } - } - else { // !ev.isNoteOff() + if (!ev.isNoteOff()) { // Added by Tim. p3.3.8 // If the event length is not zero, it means the event and its @@ -542,9 +488,6 @@ void buildMidiEventList(EventList* del, const MPEventList* el, MidiTrack* track, } ev.setLenTick(t); ev.setVeloOff(event.veloOff()); - // Added by Tim. p3.3.8 - //printf("buildMidiEventList: set len and velOff: event t:%d len:%d type:%d A:%d B:%d C:%d ev t:%d len:%d type:%d A:%d B:%d C:%d\n", event.tick(), event.lenTick(), event.type(), event.dataA(), event.dataB(), event.dataC(), ev.tick(), ev.lenTick(), ev.type(), ev.dataA(), ev.dataB(), ev.dataC()); - break; } } @@ -558,7 +501,9 @@ void buildMidiEventList(EventList* del, const MPEventList* el, MidiTrack* track, ev.setLenTick(endTick-ev.tick()); } else { - if (k==i) + if (k==i) + //this will never happen, because i->second has to be a NOTE ON, + //while k has to be a NOTE OFF. but in case something changes: printf("ERROR: THIS SHOULD NEVER HAPPEN: k==i in midi.cpp:buildMidiEventList()\n"); else mel.erase(k); @@ -569,24 +514,12 @@ void buildMidiEventList(EventList* del, const MPEventList* el, MidiTrack* track, } } -// DEBUG: any note offs left? - - // Removed by Tim. p3.3.8 - //for (iEvent i = mel.begin(); i != mel.end(); ++i) { - // Event ev = i->second; - // if (ev.isNoteOff()) { - // printf("+extra note-off! %d pitch %d velo %d\n", - // i->first, ev.pitch(), ev.velo()); -// ev.dump(); - // } - // } for (iEvent i = mel.begin(); i != mel.end(); ++i) { Event ev = i->second; if (ev.isNoteOff()) { printf("+extra note-off! %d pitch %d velo %d\n", i->first, ev.pitch(), ev.velo()); -// ev.dump(); continue; } int tick = CALC_TICK(ev.tick()); //(ev.tick() * config.division + div/2) / div; @@ -865,8 +798,6 @@ void Audio::collectEvents(MidiTrack* track, unsigned int cts, unsigned int nts) // Added by T356. case Controller: { - //int len = ev.lenTick(); - //int pitch = ev.pitch(); if (track->type() == Track::DRUM) { int ctl = ev.dataA(); @@ -889,8 +820,6 @@ void Audio::collectEvents(MidiTrack* track, unsigned int cts, unsigned int nts) mdAlt->playEvents()->add(MidiPlayEvent(tick, port, channel, ME_CONTROLLER, ctl | pitch, ev.dataB())); else - - //playEvents->add(MidiPlayEvent(frame, port, channel, ev)); mdAlt->playEvents()->add(MidiPlayEvent(frame, port, channel, ME_CONTROLLER, ctl | pitch, ev.dataB())); -- cgit v1.2.3 From 5d531cd32eb2053f10a349ee9a7d542bc550815c Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Thu, 19 May 2011 16:57:13 +0000 Subject: changed ctrl-edit's behaviour when control key is pressed added line tool to drum editor --- muse2/muse/ctrl/ctrlcanvas.cpp | 7 ++----- muse2/muse/midiedit/drumedit.cpp | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/muse2/muse/ctrl/ctrlcanvas.cpp b/muse2/muse/ctrl/ctrlcanvas.cpp index 70d1ad63..f2f335cf 100644 --- a/muse2/muse/ctrl/ctrlcanvas.cpp +++ b/muse2/muse/ctrl/ctrlcanvas.cpp @@ -797,13 +797,10 @@ void CtrlCanvas::viewMousePressEvent(QMouseEvent* event) break; case PencilTool: - if (ctrlKey) { - if (type != MidiController::Velo) { + if ((!ctrlKey) && (type != MidiController::Velo)) { drag = DRAG_NEW; song->startUndo(); - ///newVal(xpos, xpos, ypos); newVal(xpos, ypos); - } } else { drag = DRAG_RESIZE; @@ -824,7 +821,7 @@ void CtrlCanvas::viewMousePressEvent(QMouseEvent* event) if (drawLineMode) { line2x = xpos; line2y = ypos; - if (ctrlKey) + if ((!ctrlKey) && (type != MidiController::Velo)) newValRamp(line1x, line1y, line2x, line2y); else changeValRamp(line1x, line1y, line2x, line2y); diff --git a/muse2/muse/midiedit/drumedit.cpp b/muse2/muse/midiedit/drumedit.cpp index 1b7001f2..f95ee4f6 100644 --- a/muse2/muse/midiedit/drumedit.cpp +++ b/muse2/muse/midiedit/drumedit.cpp @@ -69,7 +69,7 @@ QByteArray DrumEdit::_toolbarInit; static const int xscale = -10; static const int yscale = 1; -static const int drumeditTools = PointerTool | PencilTool | RubberTool | CursorTool; +static const int drumeditTools = PointerTool | PencilTool | RubberTool | CursorTool | DrawTool; enum DrumColumn { COL_MUTE = 0, -- cgit v1.2.3 From c64f27112000bc26f94510c885ea433aca115fbe Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Fri, 20 May 2011 13:54:45 +0000 Subject: added "reorder list" function to drum roll --- muse2/muse/midiedit/dcanvas.cpp | 29 +++++++++++++++++++++++++++++ muse2/muse/midiedit/dcanvas.h | 3 ++- muse2/muse/midiedit/drumedit.cpp | 8 +++++++- muse2/muse/midiedit/scoreedit.cpp | 8 +++++++- 4 files changed, 45 insertions(+), 3 deletions(-) diff --git a/muse2/muse/midiedit/dcanvas.cpp b/muse2/muse/midiedit/dcanvas.cpp index 18463eb0..eea29b46 100644 --- a/muse2/muse/midiedit/dcanvas.cpp +++ b/muse2/muse/midiedit/dcanvas.cpp @@ -19,6 +19,7 @@ #include #include #include +#include //#include //#include @@ -1474,3 +1475,31 @@ void DrumCanvas::selectCursorEvent(Event *ev) } updateSelection(); } + + +void DrumCanvas::moveAwayUnused() +{ + using std::set; + + set used; + for (iCItem it=items.begin(); it!=items.end(); it++) + { + const Event& ev=it->second->event(); + + if (ev.type()==Note) + used.insert(ev.pitch()); + } + + int count=0; + for (set::iterator it=used.begin(); it!=used.end();) + { + while ((*it != count) && (used.find(count)!=used.end())) count++; + + if (*it != count) + mapChanged(*it, count); + + count++; + + used.erase(it++); + } +} diff --git a/muse2/muse/midiedit/dcanvas.h b/muse2/muse/midiedit/dcanvas.h index cf653648..b86bc2d7 100644 --- a/muse2/muse/midiedit/dcanvas.h +++ b/muse2/muse/midiedit/dcanvas.h @@ -84,6 +84,7 @@ class DrumCanvas : public EventCanvas { void setTool2(int); void setCurDrumInstrument(int); virtual void setStep(int); + void moveAwayUnused(); public: enum { @@ -91,7 +92,7 @@ class DrumCanvas : public EventCanvas { CMD_SELECT_ALL, CMD_SELECT_NONE, CMD_SELECT_INVERT, CMD_SELECT_ILOOP, CMD_SELECT_OLOOP, CMD_SELECT_PREV_PART, CMD_SELECT_NEXT_PART, CMD_DEL, CMD_FIXED_LEN, CMD_RIGHT, CMD_LEFT, CMD_RIGHT_NOSNAP, CMD_LEFT_NOSNAP, CMD_MODIFY_VELOCITY, CMD_CRESCENDO, - CMD_QUANTIZE, CMD_ERASE_EVENT, CMD_NOTE_SHIFT, CMD_DELETE_OVERLAPS + CMD_QUANTIZE, CMD_ERASE_EVENT, CMD_NOTE_SHIFT, CMD_DELETE_OVERLAPS, CMD_REORDER_LIST }; DrumCanvas(MidiEditor*, QWidget*, int, int, const char* name = 0); diff --git a/muse2/muse/midiedit/drumedit.cpp b/muse2/muse/midiedit/drumedit.cpp index f95ee4f6..9e64d7a7 100644 --- a/muse2/muse/midiedit/drumedit.cpp +++ b/muse2/muse/midiedit/drumedit.cpp @@ -233,14 +233,17 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini menuFunctions->setTearOffEnabled(true); + QAction* reorderListAction = menuFunctions->addAction(tr("Re-order list")); + menuFunctions->addSeparator(); fixedAction = menuFunctions->addAction(tr("Set Fixed Length")); veloAction = menuFunctions->addAction(tr("Modify Velocity")); crescAction = menuFunctions->addAction(tr("Crescendo/Decrescendo")); quantizeAction = menuFunctions->addAction(tr("Quantize")); QAction* eraseEventAction = menuFunctions->addAction(tr("Erase Event")); - QAction* noteShiftAction = menuFunctions->addAction(tr("Note Shift")); + QAction* noteShiftAction = menuFunctions->addAction(tr("Move Notes")); QAction* delOverlapsAction = menuFunctions->addAction(tr("Delete Overlaps")); + connect(reorderListAction, SIGNAL(triggered()), signalMapper, SLOT(map())); connect(fixedAction, SIGNAL(triggered()), signalMapper, SLOT(map())); connect(veloAction, SIGNAL(triggered()), signalMapper, SLOT(map())); connect(crescAction, SIGNAL(triggered()), signalMapper, SLOT(map())); @@ -249,6 +252,7 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini connect(noteShiftAction, SIGNAL(triggered()), signalMapper, SLOT(map())); connect(delOverlapsAction, SIGNAL(triggered()), signalMapper, SLOT(map())); + signalMapper->setMapping(reorderListAction, DrumCanvas::CMD_REORDER_LIST); signalMapper->setMapping(fixedAction, DrumCanvas::CMD_FIXED_LEN); signalMapper->setMapping(veloAction, DrumCanvas::CMD_MODIFY_VELOCITY); signalMapper->setMapping(crescAction, DrumCanvas::CMD_CRESCENDO); @@ -904,10 +908,12 @@ void DrumEdit::cmd(int cmd) case DrumCanvas::CMD_RESET: reset(); break; case DrumCanvas::CMD_MODIFY_VELOCITY: modify_velocity(partlist_to_set(parts())); break; case DrumCanvas::CMD_CRESCENDO: crescendo(partlist_to_set(parts())); break; + case DrumCanvas::CMD_QUANTIZE: quantize_notes(partlist_to_set(parts())); break; case DrumCanvas::CMD_ERASE_EVENT: erase_notes(partlist_to_set(parts())); break; case DrumCanvas::CMD_DEL: erase_notes(partlist_to_set(parts()),1); break; //delete selected events case DrumCanvas::CMD_DELETE_OVERLAPS: delete_overlaps(partlist_to_set(parts())); break; case DrumCanvas::CMD_NOTE_SHIFT: move_notes(partlist_to_set(parts())); break; + case DrumCanvas::CMD_REORDER_LIST: ((DrumCanvas*)(canvas))->moveAwayUnused(); break; //case DrumCanvas::CMD_FIXED_LEN: // this must be handled by the drum canvas, due to its // special nature (each drum has its own length) diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index dccac615..bbdd3d6f 100644 --- a/muse2/muse/midiedit/scoreedit.cpp +++ b/muse2/muse/midiedit/scoreedit.cpp @@ -4211,13 +4211,14 @@ void staff_t::apply_lasso(QRect rect, set& already_processed) /* BUGS and potential bugs + * o quantize always quantizes length. make this selectable! * o when the keymap is not used, this will probably lead to a bug * same when mastertrack is disabled * o tied notes don't work properly when there's a key-change in * between, for example, when a cis is tied to a des * * CURRENT TODO - * x nothing atm + * o drum list: scroll while dragging * * IMPORTANT TODO * o add a select-clef-toolbox for tracks @@ -4226,6 +4227,11 @@ void staff_t::apply_lasso(QRect rect, set& already_processed) * (0,5 sec) when displaying a whole song in scores * o transpose etc. must also transpose key-pressure events * o transpose: support in-key-transpose + * o legato: extend length to next note + * o delete: add velo and len threshold + * o thin out: remove unneeded ctrl messages + * o in drum roll: changing the list causes undo to be triggered, WTF? + * o changing list is dead slow * * less important stuff * o controller view in score editor -- cgit v1.2.3 From 0ec95d49a1cdf886fc44f98f68adc703ca65b3ee Mon Sep 17 00:00:00 2001 From: Robert Jonsson Date: Sat, 21 May 2011 23:16:32 +0000 Subject: added midi clef in track list + right click menu to select columns in track list --- muse2/muse/arranger/arranger.cpp | 4 ++ muse2/muse/arranger/tlist.cpp | 39 +++++++++++++ muse2/muse/arranger/tlist.h | 1 + muse2/muse/midiedit/scoreedit.h | 3 + muse2/muse/track.cpp | 5 ++ muse2/muse/track.h | 5 ++ muse2/muse/widgets/header.cpp | 119 +++++++++++++++++++++++++++----------- muse2/muse/widgets/header.h | 4 ++ muse2/share/templates/audio.med | 2 +- muse2/share/templates/default.med | 2 +- muse2/share/templates/midiGM.med | 2 +- muse2/share/templates/synti.med | 2 +- 12 files changed, 149 insertions(+), 39 deletions(-) diff --git a/muse2/muse/arranger/arranger.cpp b/muse2/muse/arranger/arranger.cpp index d74bed78..e1205d6f 100644 --- a/muse2/muse/arranger/arranger.cpp +++ b/muse2/muse/arranger/arranger.cpp @@ -69,6 +69,7 @@ void Arranger::setHeaderToolTips() header->setToolTip(COL_OPORT, tr("Midi output port or synth midi port")); header->setToolTip(COL_TIMELOCK, tr("Time Lock")); header->setToolTip(COL_AUTOMATION, tr("Automation parameter selection")); + header->setToolTip(COL_CLEF, tr("Notation clef")); } @@ -87,6 +88,7 @@ void Arranger::setHeaderWhatsThis() header->setWhatsThis(COL_OCHANNEL, tr("Midi/drum track: Output channel number.\nAudio track: Channels.\nMid/right-click to change.")); header->setWhatsThis(COL_OPORT, tr("Midi/drum track: Output port.\nSynth track: Assigned midi port.\nLeft-click to change.\nRight-click to show GUI.")); header->setWhatsThis(COL_TIMELOCK, tr("Time lock")); + header->setToolTip(COL_CLEF, tr("Notation clef. Select this tracks notation clef.")); } //--------------------------------------------------------- @@ -290,6 +292,7 @@ Arranger::Arranger(QMainWindow* parent, const char* name) header->setColumnLabel(tr("Ch"), COL_OCHANNEL, 30); header->setColumnLabel(tr("T"), COL_TIMELOCK, fm1.width('T')+fw); header->setColumnLabel(tr("Automation"), COL_AUTOMATION, 75); + header->setColumnLabel(tr("Clef"), COL_CLEF, 75); header->setResizeMode(COL_RECORD, QHeaderView::Fixed); header->setResizeMode(COL_MUTE, QHeaderView::Fixed); header->setResizeMode(COL_SOLO, QHeaderView::Fixed); @@ -299,6 +302,7 @@ Arranger::Arranger(QMainWindow* parent, const char* name) header->setResizeMode(COL_OCHANNEL, QHeaderView::Fixed); header->setResizeMode(COL_TIMELOCK, QHeaderView::Fixed); header->setResizeMode(COL_AUTOMATION, QHeaderView::Interactive); + header->setResizeMode(COL_CLEF, QHeaderView::Interactive); setHeaderToolTips(); setHeaderWhatsThis(); diff --git a/muse2/muse/arranger/tlist.cpp b/muse2/muse/arranger/tlist.cpp index 4b531607..427047c2 100644 --- a/muse2/muse/arranger/tlist.cpp +++ b/muse2/muse/arranger/tlist.cpp @@ -44,6 +44,7 @@ #include "midiedit/drummap.h" #include "synth.h" #include "config.h" +#include "scoreedit.h" #ifdef DSSI_SUPPORT #include "dssihost.h" @@ -356,6 +357,18 @@ void TList::paint(const QRect& r) p.drawText(r, Qt::AlignVCenter|Qt::AlignLeft, s); } break; + case COL_CLEF: + if (track->isMidiTrack()) { + QString s = "no clef"; + if (((MidiTrack*)track)->getClef() == ScoreEdit::trebleClef) + s="Treble Clef"; + else if (((MidiTrack*)track)->getClef() == ScoreEdit::bassClef) + s="Bass Clef"; + else if (((MidiTrack*)track)->getClef() == ScoreEdit::grandStaff) + s="Grand Staff"; + p.drawText(r, Qt::AlignVCenter|Qt::AlignLeft, s); + } + break; default: break; } @@ -1054,6 +1067,32 @@ void TList::mousePressEvent(QMouseEvent* ev) mode = START_DRAG; switch (col) { + case COL_CLEF: + if (t->isMidiTrack()) { + QMenu* p = new QMenu; + p->addAction("Treble clef")->setData(0); + p->addAction("Bass clef")->setData(1); + p->addAction("Grand Staff")->setData(2); + + // Show the menu + QAction* act = p->exec(ev->globalPos(), 0); + switch (act->data().toInt()) { + case 0: + ((MidiTrack*)t)->setClef(ScoreEdit::trebleClef); + break; + case 1: + ((MidiTrack*)t)->setClef(ScoreEdit::bassClef); + break; + case 2: + ((MidiTrack*)t)->setClef(ScoreEdit::grandStaff); + break; + default: + break; + } + delete p; + } + + break; case COL_AUTOMATION: { if (!t->isMidiTrack()) { diff --git a/muse2/muse/arranger/tlist.h b/muse2/muse/arranger/tlist.h index 8bebef95..7691b6cc 100644 --- a/muse2/muse/arranger/tlist.h +++ b/muse2/muse/arranger/tlist.h @@ -36,6 +36,7 @@ enum TrackColumn { COL_OCHANNEL, COL_TIMELOCK, COL_AUTOMATION, + COL_CLEF, COL_NONE = -1 }; diff --git a/muse2/muse/midiedit/scoreedit.h b/muse2/muse/midiedit/scoreedit.h index 4004452f..f587483a 100644 --- a/muse2/muse/midiedit/scoreedit.h +++ b/muse2/muse/midiedit/scoreedit.h @@ -60,6 +60,7 @@ enum {CMD_COLOR_BLACK, CMD_COLOR_VELO, CMD_COLOR_PART, CMD_QUANTIZE, CMD_VELOCITY, CMD_CRESCENDO, CMD_NOTELEN }; + class ScoreCanvas; class EditToolBar; @@ -70,6 +71,8 @@ class EditToolBar; class ScoreEdit : public TopWin { Q_OBJECT + public: + enum clefTypes { trebleClef, bassClef, grandStaff }; private: virtual void closeEvent(QCloseEvent*); diff --git a/muse2/muse/track.cpp b/muse2/muse/track.cpp index 2a93968d..5dab4c09 100644 --- a/muse2/muse/track.cpp +++ b/muse2/muse/track.cpp @@ -369,6 +369,7 @@ MidiTrack::MidiTrack() init(); _events = new EventList; _mpevents = new MPEventList; + clefType=ScoreEdit::trebleClef; } //MidiTrack::MidiTrack(const MidiTrack& mt) @@ -388,6 +389,7 @@ MidiTrack::MidiTrack(const MidiTrack& mt, bool cloneParts) len = mt.len; compression = mt.compression; _recEcho = mt.recEcho(); + clefType=ScoreEdit::trebleClef; } MidiTrack::~MidiTrack() @@ -894,6 +896,7 @@ void MidiTrack::write(int level, Xml& xml) const xml.intTag(level, "len", len); xml.intTag(level, "compression", compression); xml.intTag(level, "automation", int(automationType())); + xml.intTag(level, "clef", int(clefType)); const PartList* pl = cparts(); for (ciPart p = pl->begin(); p != pl->end(); ++p) @@ -955,6 +958,8 @@ void MidiTrack::read(Xml& xml) _recEcho = xml.parseInt(); else if (tag == "automation") setAutomationType(AutomationType(xml.parseInt())); + else if (tag == "clef") + clefType = (ScoreEdit::clefTypes)xml.parseInt(); else if (Track::readProperties(xml, tag)) { // version 1.0 compatibility: if (tag == "track" && xml.majorVersion() == 1 && xml.minorVersion() == 0) diff --git a/muse2/muse/track.h b/muse2/muse/track.h index aec765da..d1dc3a6f 100644 --- a/muse2/muse/track.h +++ b/muse2/muse/track.h @@ -20,6 +20,7 @@ #include "route.h" #include "ctrl.h" #include "globaldefs.h" +#include "scoreedit.h" class Pipeline; class Xml; @@ -208,6 +209,7 @@ class MidiTrack : public Track { EventList* _events; // tmp Events during midi import MPEventList* _mpevents; // tmp Events druring recording static bool _isVisible; + ScoreEdit::clefTypes clefType; public: MidiTrack(); @@ -273,6 +275,9 @@ class MidiTrack : public Track { virtual bool canRecord() const { return true; } static void setVisible(bool t) { _isVisible = t; } static bool visible() { return _isVisible; } + + void setClef(ScoreEdit::clefTypes i) { clefType = i; } + ScoreEdit::clefTypes getClef() { return clefType; } }; //--------------------------------------------------------- diff --git a/muse2/muse/widgets/header.cpp b/muse2/muse/widgets/header.cpp index 16cc374b..00cbd29c 100644 --- a/muse2/muse/widgets/header.cpp +++ b/muse2/muse/widgets/header.cpp @@ -7,46 +7,56 @@ #include "header.h" #include "xml.h" +#include "popupmenu.h" #include #include +#include //--------------------------------------------------------- // readStatus //--------------------------------------------------------- void Header::readStatus(Xml& xml) - { - for (;;) { - Xml::Token token = xml.parse(); - const QString& tag = xml.s1(); - switch (token) { - case Xml::Error: - case Xml::End: - return; - case Xml::Text: - { - //QStringList l = QStringList::split(QString(" "), tag); - QStringList l = tag.split(QString(" "), QString::SkipEmptyParts); - int index = count() -1; - for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) { - int section = visualIndex((*it).toInt()); - moveSection(section, index); - --index; - } - } - break; - case Xml::TagStart: - xml.unknown("Header"); - break; - case Xml::TagEnd: - if (tag ==objectName()) - return; - default: - break; - } - } - } +{ + + for (;;) { + Xml::Token token = xml.parse(); + const QString& tag = xml.s1(); + switch (token) { + case Xml::Error: + case Xml::End: + return; + case Xml::Text: + { + //QStringList l = QStringList::split(QString(" "), tag); + QStringList l = tag.split(QString(" "), QString::SkipEmptyParts); + int index = count() -1; + for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) { + int logialIdx=abs((*it).toInt()); + bool isHidden = (*it).toInt() < 0 ? true:false; + int section = visualIndex(logialIdx); + setMovable(true); + moveSection(section, index); + if (isHidden) + hideSection(logialIdx); + else + showSection(logialIdx); + --index; + } + } + break; + case Xml::TagStart: + xml.unknown("Header"); + break; + case Xml::TagEnd: + if (tag ==objectName()) + return; + default: + break; + } + } +} //--------------------------------------------------------- // writeStatus @@ -57,8 +67,12 @@ void Header::writeStatus(int level, Xml& xml) const //xml.nput(level, "<%s> ", name()); xml.nput(level, "<%s> ", Xml::xmlString(objectName()).toLatin1().constData()); int n = count() - 1; - for (int i = n; i >= 0; --i) - xml.nput("%d ", logicalIndex(i)); + for (int i = n; i >= 0; --i) { + if (isSectionHidden(logicalIndex(i))) + xml.nput("%d ", -logicalIndex(i)); // hidden is stored as negative value + else + xml.nput("%d ", logicalIndex(i)); + } //xml.put("", name()); xml.put("", Xml::xmlString(objectName()).toLatin1().constData()); } @@ -73,8 +87,9 @@ Header::Header(QWidget* parent, const char* name) setObjectName(name); itemModel = new QStandardItemModel; setModel(itemModel); - //setResizeMode(QHeaderView::ResizeToContents); setDefaultSectionSize(30); + setStretchLastSection(true); + } //--------------------------------------------------------- @@ -86,7 +101,7 @@ void Header::setColumnLabel(const QString & text, int col, int width ) QStandardItem *sitem = new QStandardItem(text ); itemModel->setHorizontalHeaderItem(col, sitem); if (width > -1) - resizeSection(col, width); + resizeSection(col, width); } //--------------------------------------------------------- @@ -109,3 +124,37 @@ void Header::setWhatsThis(int col, const QString &text) item->setWhatsThis(text); } +void Header::mousePressEvent ( QMouseEvent * e ) +{ + if (e->button() == Qt::RightButton) { + + PopupMenu* p = new PopupMenu(); + p->disconnect(); + p->clear(); + p->setTitle(tr("Track Info Columns")); + QAction* act = 0; + + for(int i=1; i < count(); i++) { + act = p->addAction(itemModel->horizontalHeaderItem(logicalIndex(i))->text() + + "\t - "+ itemModel->horizontalHeaderItem(logicalIndex(i))->toolTip()); + + act->setCheckable(true); + act->setChecked(!isSectionHidden(logicalIndex(i))); + int data = logicalIndex(i); + act->setData(data); + } + connect(p, SIGNAL(triggered(QAction*)), SLOT(changeColumns(QAction*))); + p->exec(QCursor::pos()); + + delete p; + + } +} +void Header::changeColumns(QAction *a) +{ + int section = a->data().toInt(); + if (isSectionHidden(section)) + showSection(section); + else + hideSection(section); +} diff --git a/muse2/muse/widgets/header.h b/muse2/muse/widgets/header.h index 83680f8a..3e7b73a4 100644 --- a/muse2/muse/widgets/header.h +++ b/muse2/muse/widgets/header.h @@ -9,6 +9,7 @@ #define __HEADER_H__ #include +#include class QStandardItemModel; @@ -26,6 +27,9 @@ class Header : public QHeaderView { void setColumnLabel( const QString & s, int col, int width = -1 ); void setToolTip(int col, const QString &text); void setWhatsThis(int col, const QString &text); + void mousePressEvent ( QMouseEvent * e ); + private slots: + void changeColumns(QAction* a); }; #endif diff --git a/muse2/share/templates/audio.med b/muse2/share/templates/audio.med index 14cd9c47..85b9edb4 100644 --- a/muse2/share/templates/audio.med +++ b/muse2/share/templates/audio.med @@ -33,7 +33,7 @@ 1 298 298 -
7 6 5 4 3 2 1 0 8
+
9 8 7 6 5 4 3 2 1 0
0 266 diff --git a/muse2/share/templates/default.med b/muse2/share/templates/default.med index 8772f759..82390cc4 100644 --- a/muse2/share/templates/default.med +++ b/muse2/share/templates/default.med @@ -33,7 +33,7 @@ 1 418 456 -
8 7 6 5 4 3 2 1 0
+
9 8 7 6 5 4 3 2 1 0
0 266 diff --git a/muse2/share/templates/midiGM.med b/muse2/share/templates/midiGM.med index bbc04498..e5459c14 100644 --- a/muse2/share/templates/midiGM.med +++ b/muse2/share/templates/midiGM.med @@ -33,7 +33,7 @@ 1 298 298 -
7 6 5 4 3 2 1 0 8
+
9 8 7 6 5 4 3 2 1 0
0 266 diff --git a/muse2/share/templates/synti.med b/muse2/share/templates/synti.med index 1a14a9ce..1939dacb 100644 --- a/muse2/share/templates/synti.med +++ b/muse2/share/templates/synti.med @@ -33,7 +33,7 @@ 0 298 298 -
7 6 5 4 3 2 1 0 8
+
9 8 7 6 5 4 3 2 1 0
0 266 -- cgit v1.2.3 From c3d2b8170870d7c0025d902b675fac417019aa7b Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Sun, 22 May 2011 14:11:41 +0000 Subject: "don't quantize len" is now respected quantize in the drum editor automatically doesn't quantize len --- muse2/muse/functions.cpp | 7 ++++--- muse2/muse/functions.h | 2 +- muse2/muse/midiedit/drumedit.cpp | 8 +++++++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/muse2/muse/functions.cpp b/muse2/muse/functions.cpp index 3c6bbc89..ba5f33c4 100644 --- a/muse2/muse/functions.cpp +++ b/muse2/muse/functions.cpp @@ -108,7 +108,8 @@ bool quantize_notes(const set& parts) return false; quantize_notes(parts, quantize_dialog->range, (config.division*4)/(1<raster_power2), - quantize_dialog->strength, quantize_dialog->swing, quantize_dialog->threshold); + quantize_dialog->quant_len, quantize_dialog->strength, quantize_dialog->swing, + quantize_dialog->threshold); return true; } @@ -314,7 +315,7 @@ unsigned quantize_tick(unsigned tick, unsigned raster, int swing) return tick_dest3; } -void quantize_notes(const set& parts, int range, int raster, int strength, int swing, int threshold) +void quantize_notes(const set& parts, int range, int raster, bool quant_len, int strength, int swing, int threshold) { map events = get_events(parts, range); bool undo_started=false; @@ -338,7 +339,7 @@ void quantize_notes(const set& parts, int range, int raster, int strength unsigned end_tick = begin_tick + len; int len_diff = quantize_tick(end_tick, raster, swing) - end_tick; - if (abs(len_diff) > threshold) + if ((abs(len_diff) > threshold) && quant_len) len = len + len_diff*strength/100; if (len <= 0) diff --git a/muse2/muse/functions.h b/muse2/muse/functions.h index 2b6dc711..4d7be6e2 100644 --- a/muse2/muse/functions.h +++ b/muse2/muse/functions.h @@ -42,7 +42,7 @@ std::map get_events(const std::set& parts, int range); void modify_velocity(const std::set& parts, int range, int rate, int offset=0); void modify_off_velocity(const std::set& parts, int range, int rate, int offset=0); void modify_notelen(const std::set& parts, int range, int rate, int offset=0); -void quantize_notes(const std::set& parts, int range, int raster, int strength=100, int swing=0, int threshold=0); +void quantize_notes(const std::set& parts, int range, int raster, bool len=false, int strength=100, int swing=0, int threshold=0); void erase_notes(const std::set& parts, int range); void delete_overlaps(const std::set& parts, int range); void set_notelen(const std::set& parts, int range, int len); diff --git a/muse2/muse/midiedit/drumedit.cpp b/muse2/muse/midiedit/drumedit.cpp index 9e64d7a7..97ab092e 100644 --- a/muse2/muse/midiedit/drumedit.cpp +++ b/muse2/muse/midiedit/drumedit.cpp @@ -908,7 +908,13 @@ void DrumEdit::cmd(int cmd) case DrumCanvas::CMD_RESET: reset(); break; case DrumCanvas::CMD_MODIFY_VELOCITY: modify_velocity(partlist_to_set(parts())); break; case DrumCanvas::CMD_CRESCENDO: crescendo(partlist_to_set(parts())); break; - case DrumCanvas::CMD_QUANTIZE: quantize_notes(partlist_to_set(parts())); break; + case DrumCanvas::CMD_QUANTIZE: + if (quantize_dialog->exec()) + quantize_notes(partlist_to_set(parts()), quantize_dialog->range, + (config.division*4)/(1<raster_power2), + /* quant_len= */false, quantize_dialog->strength, + quantize_dialog->swing, quantize_dialog->threshold); + break; case DrumCanvas::CMD_ERASE_EVENT: erase_notes(partlist_to_set(parts())); break; case DrumCanvas::CMD_DEL: erase_notes(partlist_to_set(parts()),1); break; //delete selected events case DrumCanvas::CMD_DELETE_OVERLAPS: delete_overlaps(partlist_to_set(parts())); break; -- cgit v1.2.3 From 44e32358acdd41f03c24d59e7764913c86196b9e Mon Sep 17 00:00:00 2001 From: Robert Jonsson Date: Sun, 22 May 2011 14:56:52 +0000 Subject: fixed crash when skipping selection in clef menu --- muse2/muse/arranger/tlist.cpp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/muse2/muse/arranger/tlist.cpp b/muse2/muse/arranger/tlist.cpp index 427047c2..6fea279a 100644 --- a/muse2/muse/arranger/tlist.cpp +++ b/muse2/muse/arranger/tlist.cpp @@ -1076,18 +1076,20 @@ void TList::mousePressEvent(QMouseEvent* ev) // Show the menu QAction* act = p->exec(ev->globalPos(), 0); - switch (act->data().toInt()) { - case 0: - ((MidiTrack*)t)->setClef(ScoreEdit::trebleClef); - break; - case 1: - ((MidiTrack*)t)->setClef(ScoreEdit::bassClef); - break; - case 2: - ((MidiTrack*)t)->setClef(ScoreEdit::grandStaff); - break; - default: - break; + if (act) { + switch (act->data().toInt()) { + case 0: + ((MidiTrack*)t)->setClef(ScoreEdit::trebleClef); + break; + case 1: + ((MidiTrack*)t)->setClef(ScoreEdit::bassClef); + break; + case 2: + ((MidiTrack*)t)->setClef(ScoreEdit::grandStaff); + break; + default: + break; + } } delete p; } -- cgit v1.2.3 From 53a36a7047584ce0e66e00815c501f59cac2fa14 Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Sun, 22 May 2011 18:14:05 +0000 Subject: the track's clef is now respected when opening a new score window --- muse2/muse/midiedit/scoreedit.cpp | 136 ++++++++++++++++++++++++-------------- 1 file changed, 88 insertions(+), 48 deletions(-) diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index bbdd3d6f..b0e0eaf6 100644 --- a/muse2/muse/midiedit/scoreedit.cpp +++ b/muse2/muse/midiedit/scoreedit.cpp @@ -911,55 +911,99 @@ void ScoreEdit::write_configuration(int level, Xml& xml) void ScoreCanvas::add_staves(PartList* pl, bool all_in_one) { - staff_t staff(this); - - if (all_in_one) + if (!pl->empty()) { - staff.parts.clear(); - for (ciPart part_it=pl->begin(); part_it!=pl->end(); part_it++) - staff.parts.insert(part_it->second); - staff.cleanup_parts(); - - staff.type=GRAND_TOP; //FINDME_INITCLEF - staff.clef=VIOLIN; - staves.push_back(staff); - - staff.type=GRAND_BOTTOM; - staff.clef=BASS; - staves.push_back(staff); - } - else - { - set tracks; - for (ciPart it=pl->begin(); it!=pl->end(); it++) - tracks.insert(it->second->track()); - - TrackList* tracklist = song->tracks(); - // this loop is used for inserting track-staves in the - // correct order. simply iterating through tracks's contents - // would sort after the pointer values, i.e. randomly - for (ciTrack track_it=tracklist->begin(); track_it!=tracklist->end(); track_it++) - if (tracks.find(*track_it)!=tracks.end()) + staff_t staff(this); + + if (all_in_one) + { + ScoreEdit::clefTypes clef=((MidiTrack*)pl->begin()->second->track())->getClef(); + + staff.parts.clear(); + for (ciPart part_it=pl->begin(); part_it!=pl->end(); part_it++) { - staff.parts.clear(); - for (ciPart part_it=pl->begin(); part_it!=pl->end(); part_it++) - if (part_it->second->track() == *track_it) - staff.parts.insert(part_it->second); - staff.cleanup_parts(); - - staff.type=GRAND_TOP; //FINDME_INITCLEF - staff.clef=VIOLIN; - staves.push_back(staff); + if (((MidiTrack*)part_it->second->track())->getClef() != clef) + clef=ScoreEdit::grandStaff; + + staff.parts.insert(part_it->second); + } + staff.cleanup_parts(); - staff.type=GRAND_BOTTOM; - staff.clef=BASS; - staves.push_back(staff); + switch (clef) + { + case ScoreEdit::trebleClef: + staff.type=NORMAL; + staff.clef=VIOLIN; + staves.push_back(staff); + break; + + case ScoreEdit::bassClef: + staff.type=NORMAL; + staff.clef=BASS; + staves.push_back(staff); + break; + + case ScoreEdit::grandStaff: + staff.type=GRAND_TOP; + staff.clef=VIOLIN; + staves.push_back(staff); + + staff.type=GRAND_BOTTOM; + staff.clef=BASS; + staves.push_back(staff); + break; } + } + else + { + set tracks; + for (ciPart it=pl->begin(); it!=pl->end(); it++) + tracks.insert(it->second->track()); + + TrackList* tracklist = song->tracks(); + // this loop is used for inserting track-staves in the + // correct order. simply iterating through tracks's contents + // would sort after the pointer values, i.e. randomly + for (ciTrack track_it=tracklist->begin(); track_it!=tracklist->end(); track_it++) + if (tracks.find(*track_it)!=tracks.end()) + { + staff.parts.clear(); + for (ciPart part_it=pl->begin(); part_it!=pl->end(); part_it++) + if (part_it->second->track() == *track_it) + staff.parts.insert(part_it->second); + staff.cleanup_parts(); + + switch (((MidiTrack*)(*track_it))->getClef()) + { + case ScoreEdit::trebleClef: + staff.type=NORMAL; + staff.clef=VIOLIN; + staves.push_back(staff); + break; + + case ScoreEdit::bassClef: + staff.type=NORMAL; + staff.clef=BASS; + staves.push_back(staff); + break; + + case ScoreEdit::grandStaff: + staff.type=GRAND_TOP; + staff.clef=VIOLIN; + staves.push_back(staff); + + staff.type=GRAND_BOTTOM; + staff.clef=BASS; + staves.push_back(staff); + break; + } + } + } + + cleanup_staves(); + fully_recalculate(); + recalc_staff_pos(); } - - cleanup_staves(); - fully_recalculate(); - recalc_staff_pos(); } @@ -4221,8 +4265,6 @@ void staff_t::apply_lasso(QRect rect, set& already_processed) * o drum list: scroll while dragging * * IMPORTANT TODO - * o add a select-clef-toolbox for tracks - * o respect the track's clef (has to be implemented first in muse) * o do partial recalculating; recalculating can take pretty long * (0,5 sec) when displaying a whole song in scores * o transpose etc. must also transpose key-pressure events @@ -4268,8 +4310,6 @@ void staff_t::apply_lasso(QRect rect, set& already_processed) * ( (2+2+3)/4 or (3+2+2)/4 instead of 7/4 ) * o maybe do expanding parts inside the msgChangeEvent or * msgNewEvent functions (see my e-mail) - * - * o make quantize and other stuff faster (by assymetric communication) */ -- cgit v1.2.3 From cebe18a6c4211f23bc7cad82b4d9a9611a46234f Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Mon, 23 May 2011 12:27:43 +0000 Subject: the "remove" function now supports velo- and length-thresholds --- muse2/muse/functions.cpp | 11 +- muse2/muse/functions.h | 2 +- muse2/muse/midiedit/scoreedit.cpp | 8 +- muse2/muse/widgets/function_dialogs/remove.cpp | 20 ++++ muse2/muse/widgets/function_dialogs/remove.h | 4 + muse2/muse/widgets/function_dialogs/removebase.ui | 129 +++++++++++++++++++++- 6 files changed, 162 insertions(+), 12 deletions(-) diff --git a/muse2/muse/functions.cpp b/muse2/muse/functions.cpp index ba5f33c4..1ad81693 100644 --- a/muse2/muse/functions.cpp +++ b/muse2/muse/functions.cpp @@ -119,7 +119,8 @@ bool erase_notes(const set& parts) if (!erase_dialog->exec()) return false; - erase_notes(parts,erase_dialog->range); + erase_notes(parts,erase_dialog->range, erase_dialog->velo_threshold, erase_dialog->velo_thres_used, + erase_dialog->len_threshold, erase_dialog->len_thres_used ); return true; } @@ -366,7 +367,7 @@ void quantize_notes(const set& parts, int range, int raster, bool quant_l } } -void erase_notes(const set& parts, int range) +void erase_notes(const set& parts, int range, int velo_threshold, bool velo_thres_used, int len_threshold, bool len_thres_used) { map events = get_events(parts, range); @@ -378,8 +379,10 @@ void erase_notes(const set& parts, int range) { Event& event=*(it->first); Part* part=it->second; - - audio->msgDeleteEvent(event, part, false, false, false); + if ( (!velo_thres_used && !len_thres_used) || + (velo_thres_used && event.velo() < velo_threshold) || + (len_thres_used && int(event.lenTick()) < len_threshold) ) + audio->msgDeleteEvent(event, part, false, false, false); } song->endUndo(SC_EVENT_REMOVED); diff --git a/muse2/muse/functions.h b/muse2/muse/functions.h index 4d7be6e2..18f6e3ec 100644 --- a/muse2/muse/functions.h +++ b/muse2/muse/functions.h @@ -43,7 +43,7 @@ void modify_velocity(const std::set& parts, int range, int rate, int offs void modify_off_velocity(const std::set& parts, int range, int rate, int offset=0); void modify_notelen(const std::set& parts, int range, int rate, int offset=0); void quantize_notes(const std::set& parts, int range, int raster, bool len=false, int strength=100, int swing=0, int threshold=0); -void erase_notes(const std::set& parts, int range); +void erase_notes(const std::set& parts, int range, int velo_threshold=0, bool velo_thres_used=false, int len_threshold=0, bool len_thres_used=false); void delete_overlaps(const std::set& parts, int range); void set_notelen(const std::set& parts, int range, int len); void move_notes(const std::set& parts, int range, signed int ticks); diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index b0e0eaf6..2636d4f2 100644 --- a/muse2/muse/midiedit/scoreedit.cpp +++ b/muse2/muse/midiedit/scoreedit.cpp @@ -4255,27 +4255,23 @@ void staff_t::apply_lasso(QRect rect, set& already_processed) /* BUGS and potential bugs - * o quantize always quantizes length. make this selectable! * o when the keymap is not used, this will probably lead to a bug * same when mastertrack is disabled * o tied notes don't work properly when there's a key-change in * between, for example, when a cis is tied to a des * * CURRENT TODO - * o drum list: scroll while dragging + * o legato: extend length to next note * * IMPORTANT TODO * o do partial recalculating; recalculating can take pretty long * (0,5 sec) when displaying a whole song in scores * o transpose etc. must also transpose key-pressure events * o transpose: support in-key-transpose - * o legato: extend length to next note - * o delete: add velo and len threshold * o thin out: remove unneeded ctrl messages - * o in drum roll: changing the list causes undo to be triggered, WTF? - * o changing list is dead slow * * less important stuff + * o drum list: scroll while dragging * o controller view in score editor * o quantize-templates (everything is forced into a specified * rhythm) diff --git a/muse2/muse/widgets/function_dialogs/remove.cpp b/muse2/muse/widgets/function_dialogs/remove.cpp index 5ad272ab..4a875135 100644 --- a/muse2/muse/widgets/function_dialogs/remove.cpp +++ b/muse2/muse/widgets/function_dialogs/remove.cpp @@ -25,6 +25,10 @@ Remove::Remove(QWidget* parent) void Remove::pull_values() { range = range_group->checkedId(); + len_thres_used=len_checkbox->isChecked(); + len_threshold=len_spinbox->value(); + velo_thres_used=velo_checkbox->isChecked(); + velo_threshold=velo_spinbox->value(); } void Remove::accept() @@ -38,6 +42,10 @@ int Remove::exec() if ((range < 0) || (range > 3)) range=0; range_group->button(range)->setChecked(true); + len_checkbox->setChecked(len_thres_used); + len_spinbox->setValue(len_threshold); + velo_checkbox->setChecked(velo_thres_used); + velo_spinbox->setValue(velo_threshold); return QDialog::exec(); } @@ -56,6 +64,14 @@ void Remove::read_configuration(Xml& xml) case Xml::TagStart: if (tag == "range") range=xml.parseInt(); + else if (tag == "velo_threshold") + velo_threshold=xml.parseInt(); + else if (tag == "velo_thres_used") + velo_thres_used=xml.parseInt(); + else if (tag == "len_threshold") + len_threshold=xml.parseInt(); + else if (tag == "len_thres_used") + len_thres_used=xml.parseInt(); else xml.unknown("Erase"); break; @@ -74,5 +90,9 @@ void Remove::write_configuration(int level, Xml& xml) { xml.tag(level++, "erase"); xml.intTag(level, "range", range); + xml.intTag(level, "velo_threshold", velo_threshold); + xml.intTag(level, "velo_thres_used", velo_thres_used); + xml.intTag(level, "len_threshold", len_threshold); + xml.intTag(level, "len_thres_used", len_thres_used); xml.tag(level, "/erase"); } diff --git a/muse2/muse/widgets/function_dialogs/remove.h b/muse2/muse/widgets/function_dialogs/remove.h index 5615ed42..4c1a91e9 100644 --- a/muse2/muse/widgets/function_dialogs/remove.h +++ b/muse2/muse/widgets/function_dialogs/remove.h @@ -27,6 +27,10 @@ class Remove : public QDialog, public Ui::RemoveBase Remove(QWidget* parent = 0); int range; + int velo_threshold; + bool velo_thres_used; + int len_threshold; + bool len_thres_used; void read_configuration(Xml& xml); void write_configuration(int level, Xml& xml); diff --git a/muse2/muse/widgets/function_dialogs/removebase.ui b/muse2/muse/widgets/function_dialogs/removebase.ui index 3381795c..79d541cc 100644 --- a/muse2/muse/widgets/function_dialogs/removebase.ui +++ b/muse2/muse/widgets/function_dialogs/removebase.ui @@ -10,7 +10,7 @@ 0 0 275 - 195 + 443 @@ -69,6 +69,101 @@ + + + + Thresholds + + + false + + + false + + + + 11 + + + 6 + + + + + false + + + true + + + + + + 0 + + + 127 + + + 1 + + + 16 + + + + + + + false + + + ticks + + + 10000 + + + 12 + + + + + + + Velocity + + + + + + + Length + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:7px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">If nothing is checked, everything is removed.</p> +<p style=" margin-top:0px; margin-bottom:7px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">If velocity is checked, only notes with velo &lt; threshold are removed.</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">If both are checked, notes with velo &lt; threshold OR with length &lt; threshold are removed.</p></body></html> + + + Qt::AutoText + + + true + + + + + + @@ -149,5 +244,37 @@ + + velo_checkbox + toggled(bool) + velo_spinbox + setEnabled(bool) + + + 83 + 192 + + + 198 + 193 + + + + + len_checkbox + toggled(bool) + len_spinbox + setEnabled(bool) + + + 83 + 221 + + + 198 + 222 + + + -- cgit v1.2.3 From 44a5f5d8805449c008924cca65c16837245825e0 Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Mon, 23 May 2011 16:24:51 +0000 Subject: implemented legato function added all the new functions to the score editor --- muse2/muse/functions.cpp | 69 ++++++ muse2/muse/functions.h | 4 + muse2/muse/midiedit/pianoroll.cpp | 12 +- muse2/muse/midiedit/prcanvas.h | 2 +- muse2/muse/midiedit/scoreedit.cpp | 25 ++- muse2/muse/midiedit/scoreedit.h | 3 +- muse2/muse/widgets/function_dialogs/CMakeLists.txt | 3 + muse2/muse/widgets/function_dialogs/legato.cpp | 88 ++++++++ muse2/muse/widgets/function_dialogs/legato.h | 42 ++++ muse2/muse/widgets/function_dialogs/legatobase.ui | 233 +++++++++++++++++++++ 10 files changed, 474 insertions(+), 7 deletions(-) create mode 100644 muse2/muse/widgets/function_dialogs/legato.cpp create mode 100644 muse2/muse/widgets/function_dialogs/legato.h create mode 100644 muse2/muse/widgets/function_dialogs/legatobase.ui diff --git a/muse2/muse/functions.cpp b/muse2/muse/functions.cpp index 1ad81693..89a66fa7 100644 --- a/muse2/muse/functions.cpp +++ b/muse2/muse/functions.cpp @@ -27,6 +27,7 @@ Setlen* set_notelen_dialog=NULL; Move* move_notes_dialog=NULL; Transpose* transpose_dialog=NULL; Crescendo* crescendo_dialog=NULL; +Legato* legato_dialog=NULL; void init_function_dialogs(QWidget* parent) { @@ -39,6 +40,7 @@ void init_function_dialogs(QWidget* parent) move_notes_dialog = new Move(parent); transpose_dialog = new Transpose(parent); crescendo_dialog = new Crescendo(parent); + legato_dialog = new Legato(parent); } set partlist_to_set(PartList* pl) @@ -181,6 +183,16 @@ bool crescendo(const set& parts) return true; } +bool legato(const set& parts) +{ + if (!legato_dialog->exec()) + return false; + + legato(parts,legato_dialog->range, legato_dialog->min_len, !legato_dialog->allow_shortening); + + return true; +} + void modify_velocity(const set& parts, int range, int rate, int offset) @@ -535,6 +547,60 @@ void delete_overlaps(const set& parts, int range) } } +void legato(const set& parts, int range, int min_len, bool dont_shorten) +{ + map events = get_events(parts, range); + bool undo_started=false; + + if (min_len<=0) min_len=1; + + if (!events.empty()) + { + for (map::iterator it1=events.begin(); it1!=events.end(); it1++) + { + Event& event1=*(it1->first); + Part* part1=it1->second; + + unsigned len=MAXINT; + // we may NOT optimize by letting it2 start at (it1 +1); this optimisation + // is only allowed when events was sorted by time. it is, however, sorted + // randomly by pointer. + for (map::iterator it2=events.begin(); it2!=events.end(); it2++) + { + Event& event2=*(it2->first); + Part* part2=it2->second; + + bool relevant = (event2.tick() >= event1.tick() + min_len); + if (dont_shorten) + relevant = relevant && (event2.tick() >= event1.endTick()); + + if ( (part1->events()==part2->events()) && // part1 and part2 are the same or are duplicates + relevant && // they're not too near (respect min_len and dont_shorten) + (event2.tick()-event1.tick() < len ) ) // that's the nearest relevant following note + len=event2.tick()-event1.tick(); + } + + if (len==MAXINT) len=event1.lenTick(); // if no following note was found, keep the length + + if (event1.lenTick() != len) + { + if (undo_started==false) + { + song->startUndo(); + undo_started=true; + } + + Event new_event1 = event1.clone(); + new_event1.setLenTick(len); + + audio->msgChangeEvent(event1, new_event1, part1, false, false, false); + } + } + + if (undo_started) song->endUndo(SC_EVENT_MODIFIED); + } +} + void read_function_dialog_config(Xml& xml) @@ -574,6 +640,8 @@ void read_function_dialog_config(Xml& xml) transpose_dialog->read_configuration(xml); else if (tag == "crescendo") crescendo_dialog->read_configuration(xml); + else if (tag == "legato") + legato_dialog->read_configuration(xml); else xml.unknown("function_dialogs"); break; @@ -601,6 +669,7 @@ void write_function_dialog_config(int level, Xml& xml) move_notes_dialog->write_configuration(level, xml); transpose_dialog->write_configuration(level, xml); crescendo_dialog->write_configuration(level, xml); + legato_dialog->write_configuration(level, xml); xml.tag(level, "/dialogs"); } diff --git a/muse2/muse/functions.h b/muse2/muse/functions.h index 18f6e3ec..40e5f0e0 100644 --- a/muse2/muse/functions.h +++ b/muse2/muse/functions.h @@ -17,6 +17,7 @@ #include "widgets/function_dialogs/setlen.h" #include "widgets/function_dialogs/move.h" #include "widgets/function_dialogs/deloverlaps.h" +#include "widgets/function_dialogs/legato.h" #include #include "part.h" @@ -31,6 +32,7 @@ extern Setlen* set_notelen_dialog; extern Move* move_notes_dialog; extern Transpose* transpose_dialog; extern Crescendo* crescendo_dialog; +extern Legato* legato_dialog; void init_function_dialogs(QWidget* parent); @@ -49,6 +51,7 @@ void set_notelen(const std::set& parts, int range, int len); void move_notes(const std::set& parts, int range, signed int ticks); void transpose_notes(const std::set& parts, int range, signed int halftonesteps); void crescendo(const std::set& parts, int range, int start_val, int end_val, bool absolute); +void legato(const std::set& parts, int range, int min_len=1, bool dont_shorten=false); //the below functions automatically open the dialog @@ -62,6 +65,7 @@ bool transpose_notes(const std::set& parts); bool crescendo(const std::set& parts); bool erase_notes(const std::set& parts); bool delete_overlaps(const std::set& parts); +bool legato(const std::set& parts); diff --git a/muse2/muse/midiedit/pianoroll.cpp b/muse2/muse/midiedit/pianoroll.cpp index 9105a446..ab83e85f 100644 --- a/muse2/muse/midiedit/pianoroll.cpp +++ b/muse2/muse/midiedit/pianoroll.cpp @@ -198,11 +198,11 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i mapper->setMapping(funcTransposeAction, PianoCanvas::CMD_TRANSPOSE); connect(funcTransposeAction, SIGNAL(triggered()), mapper, SLOT(map())); - funcEraseEventAction = menuFunctions->addAction(tr("Erase Event")); + funcEraseEventAction = menuFunctions->addAction(tr("Erase Events")); mapper->setMapping(funcEraseEventAction, PianoCanvas::CMD_ERASE_EVENT); connect(funcEraseEventAction, SIGNAL(triggered()), mapper, SLOT(map())); - funcNoteShiftAction = menuFunctions->addAction(tr("Note Shift")); + funcNoteShiftAction = menuFunctions->addAction(tr("Move Notes")); mapper->setMapping(funcNoteShiftAction, PianoCanvas::CMD_NOTE_SHIFT); connect(funcNoteShiftAction, SIGNAL(triggered()), mapper, SLOT(map())); @@ -213,7 +213,12 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i funcDelOverlapsAction = menuFunctions->addAction(tr("Delete Overlaps")); mapper->setMapping(funcDelOverlapsAction, PianoCanvas::CMD_DELETE_OVERLAPS); connect(funcDelOverlapsAction, SIGNAL(triggered()), mapper, SLOT(map())); - + + QAction* funcLegatoAction = menuFunctions->addAction(tr("Legato")); + mapper->setMapping(funcLegatoAction, PianoCanvas::CMD_LEGATO); + connect(funcLegatoAction, SIGNAL(triggered()), mapper, SLOT(map())); + + menuPlugins = menuBar()->addMenu(tr("&Plugins")); song->populateScriptMenu(menuPlugins, this); @@ -610,6 +615,7 @@ void PianoRoll::cmd(int cmd) case PianoCanvas::CMD_NOTE_SHIFT: move_notes(partlist_to_set(parts())); break; case PianoCanvas::CMD_FIXED_LEN: set_notelen(partlist_to_set(parts())); break; case PianoCanvas::CMD_DELETE_OVERLAPS: delete_overlaps(partlist_to_set(parts())); break; + case PianoCanvas::CMD_LEGATO: legato(partlist_to_set(parts())); break; default: ((PianoCanvas*)canvas)->cmd(cmd); } diff --git a/muse2/muse/midiedit/prcanvas.h b/muse2/muse/midiedit/prcanvas.h index a04ca514..3ca9ab52 100644 --- a/muse2/muse/midiedit/prcanvas.h +++ b/muse2/muse/midiedit/prcanvas.h @@ -98,7 +98,7 @@ class PianoCanvas : public EventCanvas { CMD_TRANSPOSE, CMD_THIN_OUT, CMD_ERASE_EVENT, CMD_NOTE_SHIFT, CMD_MOVE_CLOCK, CMD_COPY_MEASURE, CMD_ERASE_MEASURE, CMD_DELETE_MEASURE, CMD_CREATE_MEASURE, - CMD_FIXED_LEN, CMD_DELETE_OVERLAPS + CMD_FIXED_LEN, CMD_DELETE_OVERLAPS, CMD_LEGATO }; PianoCanvas(MidiEditor*, QWidget*, int, int); diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index 2636d4f2..0019de91 100644 --- a/muse2/muse/midiedit/scoreedit.cpp +++ b/muse2/muse/midiedit/scoreedit.cpp @@ -365,10 +365,23 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos) QAction* func_notelen_action = functions_menu->addAction(tr("Change note &length"), menu_mapper, SLOT(map())); QAction* func_velocity_action = functions_menu->addAction(tr("Change note &velocity"), menu_mapper, SLOT(map())); QAction* func_cresc_action = functions_menu->addAction(tr("Crescendo/Decrescendo"), menu_mapper, SLOT(map())); + QAction* func_transpose_action = functions_menu->addAction(tr("Transpose"), menu_mapper, SLOT(map())); + QAction* func_erase_action = functions_menu->addAction(tr("Erase Events"), menu_mapper, SLOT(map())); + QAction* func_move_action = functions_menu->addAction(tr("Move Notes"), menu_mapper, SLOT(map())); + QAction* func_fixed_len_action = functions_menu->addAction(tr("Set Fixed Length"), menu_mapper, SLOT(map())); + QAction* func_del_overlaps_action = functions_menu->addAction(tr("Delete Overlaps"), menu_mapper, SLOT(map())); + QAction* func_legato_action = functions_menu->addAction(tr("Legato"), menu_mapper, SLOT(map())); menu_mapper->setMapping(func_quantize_action, CMD_QUANTIZE); menu_mapper->setMapping(func_notelen_action, CMD_NOTELEN); menu_mapper->setMapping(func_velocity_action, CMD_VELOCITY); menu_mapper->setMapping(func_cresc_action, CMD_CRESCENDO); + menu_mapper->setMapping(func_transpose_action, CMD_TRANSPOSE); + menu_mapper->setMapping(func_erase_action, CMD_ERASE); + menu_mapper->setMapping(func_move_action, CMD_MOVE); + menu_mapper->setMapping(func_fixed_len_action, CMD_FIXED_LEN); + menu_mapper->setMapping(func_del_overlaps_action, CMD_DELETE_OVERLAPS); + menu_mapper->setMapping(func_legato_action, CMD_LEGATO); + if (!default_toolbar_state.isEmpty()) restoreState(default_toolbar_state); @@ -572,7 +585,13 @@ void ScoreEdit::menu_command(int cmd) case CMD_VELOCITY: modify_velocity(score_canvas->get_all_parts()); break; case CMD_CRESCENDO: crescendo(score_canvas->get_all_parts()); break; case CMD_NOTELEN: modify_notelen(score_canvas->get_all_parts()); break; - + case CMD_TRANSPOSE: transpose_notes(score_canvas->get_all_parts()); break; + case CMD_ERASE: erase_notes(score_canvas->get_all_parts()); break; + case CMD_MOVE: move_notes(score_canvas->get_all_parts()); break; + case CMD_FIXED_LEN: set_notelen(score_canvas->get_all_parts()); break; + case CMD_DELETE_OVERLAPS: delete_overlaps(score_canvas->get_all_parts()); break; + case CMD_LEGATO: legato(score_canvas->get_all_parts()); break; + default: score_canvas->menu_command(cmd); } @@ -4261,7 +4280,9 @@ void staff_t::apply_lasso(QRect rect, set& already_processed) * between, for example, when a cis is tied to a des * * CURRENT TODO - * o legato: extend length to next note + * > o legato: extend length to next note + * o add music-keyboard-bindings for "insert rest" and "increase note length" + * o maybe support step-recording in score editor as well? * * IMPORTANT TODO * o do partial recalculating; recalculating can take pretty long diff --git a/muse2/muse/midiedit/scoreedit.h b/muse2/muse/midiedit/scoreedit.h index f587483a..2ce8d645 100644 --- a/muse2/muse/midiedit/scoreedit.h +++ b/muse2/muse/midiedit/scoreedit.h @@ -58,7 +58,8 @@ enum {CMD_COLOR_BLACK, CMD_COLOR_VELO, CMD_COLOR_PART, CMD_NOTELEN_1, CMD_NOTELEN_2, CMD_NOTELEN_4, CMD_NOTELEN_8, CMD_NOTELEN_16, CMD_NOTELEN_32, CMD_NOTELEN_LAST, - CMD_QUANTIZE, CMD_VELOCITY, CMD_CRESCENDO, CMD_NOTELEN }; + CMD_QUANTIZE, CMD_VELOCITY, CMD_CRESCENDO, CMD_NOTELEN, CMD_TRANSPOSE, + CMD_ERASE, CMD_MOVE, CMD_FIXED_LEN, CMD_DELETE_OVERLAPS, CMD_LEGATO }; class ScoreCanvas; diff --git a/muse2/muse/widgets/function_dialogs/CMakeLists.txt b/muse2/muse/widgets/function_dialogs/CMakeLists.txt index 7ddc6bee..db1f3229 100644 --- a/muse2/muse/widgets/function_dialogs/CMakeLists.txt +++ b/muse2/muse/widgets/function_dialogs/CMakeLists.txt @@ -30,6 +30,7 @@ QT4_WRAP_CPP (widgets_functiondialogs_mocs remove.h setlen.h transpose.h + legato.h velocity.h ) @@ -45,6 +46,7 @@ file (GLOB widgets_functiondialogs_ui_files removebase.ui setlenbase.ui transposebase.ui + legatobase.ui velocitybase.ui ) @@ -62,6 +64,7 @@ file (GLOB widgets_functiondialogs_source_files remove.cpp setlen.cpp transpose.cpp + legato.cpp velocity.cpp ) diff --git a/muse2/muse/widgets/function_dialogs/legato.cpp b/muse2/muse/widgets/function_dialogs/legato.cpp new file mode 100644 index 00000000..0a181106 --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/legato.cpp @@ -0,0 +1,88 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: legato.cpp,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#include +#include "legato.h" +#include "xml.h" + +Legato::Legato(QWidget* parent) + : QDialog(parent) +{ + setupUi(this); + range_group = new QButtonGroup; + range_group->addButton(all_events_button,0); + range_group->addButton(selected_events_button,1); + range_group->addButton(looped_events_button,2); + range_group->addButton(selected_looped_button,3); + + pull_values(); +} + +void Legato::pull_values() +{ + range = range_group->checkedId(); + min_len = len_spinbox->value(); + allow_shortening = allow_shorten_checkbox->isChecked(); +} + +void Legato::accept() +{ + pull_values(); + QDialog::accept(); +} + +int Legato::exec() +{ + if ((range < 0) || (range > 3)) range=0; + + range_group->button(range)->setChecked(true); + len_spinbox->setValue(min_len); + allow_shorten_checkbox->setChecked(allow_shortening); + + return QDialog::exec(); +} + +void Legato::read_configuration(Xml& xml) +{ + for (;;) + { + Xml::Token token = xml.parse(); + if (token == Xml::Error || token == Xml::End) + break; + + const QString& tag = xml.s1(); + switch (token) + { + case Xml::TagStart: + if (tag == "range") + range=xml.parseInt(); + else if (tag == "min_len") + min_len=xml.parseInt(); + else if (tag == "allow_shortening") + allow_shortening=xml.parseInt(); + else + xml.unknown("Legato"); + break; + + case Xml::TagEnd: + if (tag == "legato") + return; + + default: + break; + } + } +} + +void Legato::write_configuration(int level, Xml& xml) +{ + xml.tag(level++, "legato"); + xml.intTag(level, "range", range); + xml.intTag(level, "min_len", min_len); + xml.intTag(level, "allow_shortening", allow_shortening); + xml.tag(level, "/legato"); +} diff --git a/muse2/muse/widgets/function_dialogs/legato.h b/muse2/muse/widgets/function_dialogs/legato.h new file mode 100644 index 00000000..80b371ca --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/legato.h @@ -0,0 +1,42 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: legato.h,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#ifndef __LEGATO_H__ +#define __LEGATO_H__ + +#include "ui_legatobase.h" + +class QButtonGroup; +class Xml; + +class Legato : public QDialog, public Ui::LegatoBase +{ + private: + Q_OBJECT + QButtonGroup* range_group; + + protected slots: + void accept(); + void pull_values(); + + public: + Legato(QWidget* parent = 0); + + int range; + int min_len; + bool allow_shortening; + + void read_configuration(Xml& xml); + void write_configuration(int level, Xml& xml); + + + public slots: + int exec(); +}; + +#endif + diff --git a/muse2/muse/widgets/function_dialogs/legatobase.ui b/muse2/muse/widgets/function_dialogs/legatobase.ui new file mode 100644 index 00000000..7bc406df --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/legatobase.ui @@ -0,0 +1,233 @@ + + + LegatoBase + + + true + + + + 0 + 0 + 275 + 289 + + + + MusE: Legato + + + + 6 + + + 11 + + + + + Range + + + + 6 + + + 11 + + + + + All Events + + + + + + + Selected Events + + + true + + + + + + + Looped Events + + + + + + + Selected Looped + + + + + + + + + + Settings + + + false + + + false + + + + 11 + + + 6 + + + + + true + + + true + + + ticks + + + 0 + + + 10000 + + + 1 + + + 0 + + + + + + + Minimum Length + + + + + + + + + + 0 + 0 + + + + Allow shortening notes + + + + + + + Qt::RightToLeft + + + + + + + + + + + + + + + 6 + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 20 + 20 + + + + + + + + OK + + + false + + + true + + + + + + + Cancel + + + + + + + + + + + + okButton + clicked() + LegatoBase + accept() + + + 20 + 20 + + + 20 + 20 + + + + + cancelButton + clicked() + LegatoBase + reject() + + + 20 + 20 + + + 20 + 20 + + + + + -- cgit v1.2.3 From 69427576250f7fcfdf0e1fb28658790f4b2077bb Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Mon, 23 May 2011 16:37:26 +0000 Subject: corrected reversed contollers in part canvas (cakewalk mode) --- muse2/muse/arranger/pcanvas.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/muse2/muse/arranger/pcanvas.cpp b/muse2/muse/arranger/pcanvas.cpp index daaf2d28..9b0a65b9 100644 --- a/muse2/muse/arranger/pcanvas.cpp +++ b/muse2/muse/arranger/pcanvas.cpp @@ -1730,7 +1730,7 @@ void PartCanvas::drawMidiPart(QPainter& p, const QRect&, EventList* events, Midi int hoffset = (mt->height() - th ) / 2; // offset from bottom if (ctrl_type == CTRL_PITCH) - p.drawLine(t, hoffset + r.y() + th/2, t, hoffset + r.y() + val*th/8192/2 + th/2); + p.drawLine(t, hoffset + r.y() + th/2, t, hoffset + r.y() - val*th/8192/2 + th/2); } } @@ -1747,7 +1747,7 @@ void PartCanvas::drawMidiPart(QPainter& p, const QRect&, EventList* events, Midi int hoffset = (mt->height() - th ) / 2; // offset from bottom if (ctrl_type == 10) - p.drawLine(t, hoffset + r.y() + val*th/127, t, hoffset + r.y() + th); + p.drawLine(t, hoffset + r.y() + th - val*th/127, t, hoffset + r.y() + th); } } @@ -1764,7 +1764,7 @@ void PartCanvas::drawMidiPart(QPainter& p, const QRect&, EventList* events, Midi int hoffset = (mt->height() - th ) / 2; // offset from bottom if (ctrl_type == 7) - p.drawLine(t, hoffset + r.y() + val*th/127, t, hoffset + r.y() + th); + p.drawLine(t, hoffset + r.y() + th - val*th/127, t, hoffset + r.y() + th); } } -- cgit v1.2.3 From 7caa48f2561ae838049abb64adffe8ce43185b34 Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Mon, 23 May 2011 18:06:57 +0000 Subject: Updated Changelog; prepared for merge --- muse2/ChangeLog | 32 ++++++++++++++++++++++++++++++++ muse2/muse/midiedit/scoreedit.cpp | 1 - 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/muse2/ChangeLog b/muse2/ChangeLog index fce03eb0..c46b7f7f 100644 --- a/muse2/ChangeLog +++ b/muse2/ChangeLog @@ -1,3 +1,35 @@ +23.05.2011: (all changes made by flo93, except one) + Function-related changes: + - made all the stuff in the "functions" menu global + - added crescendo, legato functions, improved erase function + - removed unneccessary _to and _quant* - stuff from piano roll and drum edit + this also involved changing the Toolbar1 + - changed behaviour for step-recording: the note-length is now the "raster"- + value instead of the "quant"-value + - changed behaviour for scripts: the "quant"-parameter they get isn't the + quant-combo's setting, but the snap-combo's now + - removed unneccessary short cuts: SHRT_OVER_QUANTIZE etc. instead added + SHRT_QUANTIZE + + Score-Editor-related changes: + - using the proper AL::raster functions in the score editor + - added support for selections to the score editor + - distance between staves is now automatically increased if neccessary + - fixed "change pitch freezes scoreeditor"-bug + - added clef-combobox to midi tracks (rj and flo) + - don't install the *.mf files any more + - added a modified MTScale to the score editor + + Other Stuff: + - speeded up importing midi massively + - when step-recording, chords can now be entered with only the musical keyboard + - swapped ctrl and shift behaviour to make muse accord to standards + - toolbar states are now saved + - improved "cakewalk" mode for arranger: added y-stretch and drawing some controllers + - added line tool to drum editor + - added "reorder list" function to drum roll + - changed ctrl-edit's behaviour when control key is pressed + 15.05.2011: - Changed mouse wheel behaviour in graphical editors except the score editor (rj) * wheel scrolls left-right diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index 0019de91..f8815185 100644 --- a/muse2/muse/midiedit/scoreedit.cpp +++ b/muse2/muse/midiedit/scoreedit.cpp @@ -4280,7 +4280,6 @@ void staff_t::apply_lasso(QRect rect, set& already_processed) * between, for example, when a cis is tied to a des * * CURRENT TODO - * > o legato: extend length to next note * o add music-keyboard-bindings for "insert rest" and "increase note length" * o maybe support step-recording in score editor as well? * -- cgit v1.2.3