From e2e536eab73dc7d1e2294078628eea80ecf6d120 Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Sun, 5 Jun 2011 22:05:16 +0000 Subject: speeded up the arranger's part canvas --- muse2/muse/app.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'muse2/muse/app.cpp') diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp index 72cdad6a..04c55b01 100644 --- a/muse2/muse/app.cpp +++ b/muse2/muse/app.cpp @@ -2971,14 +2971,13 @@ void MusE::cmd(int cmd) arranger->cmd(Arranger::CMD_INSERT_EMPTYMEAS); break; case CMD_DELETE: - song->startUndo(); - if (song->msgRemoveParts()) { - song->endUndo(SC_PART_REMOVED); - break; - } - else - audio->msgRemoveTracks(); - song->endUndo(SC_TRACK_REMOVED); + if (!song->msgRemoveParts()) //automatically does undo if neccessary and returns true then + { + //msgRemoveParts() returned false -> no parts to remove? + song->startUndo(); + audio->msgRemoveTracks(); //TODO FINDME this could still be speeded up! + song->endUndo(SC_TRACK_REMOVED); + } break; case CMD_DELETE_TRACK: song->startUndo(); -- cgit v1.2.3 From 6c8a1eb61743e3fa83925d40c14d3a6754c8359f Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Mon, 6 Jun 2011 16:49:02 +0000 Subject: implemented functions for shrinking, expanding and cleaning parts --- muse2/muse/app.cpp | 47 ++++++++--------- muse2/muse/app.h | 3 +- muse2/muse/functions.cpp | 104 +++++++++++++++++++++++++++++++++++++- muse2/muse/functions.h | 5 ++ muse2/muse/midiedit/scoreedit.cpp | 2 + 5 files changed, 133 insertions(+), 28 deletions(-) (limited to 'muse2/muse/app.cpp') diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp index 9e2f6c9a..6b9f2b5b 100644 --- a/muse2/muse/app.cpp +++ b/muse2/muse/app.cpp @@ -54,6 +54,7 @@ #include "tools.h" #include "visibletracks.h" #include "widgets/unusedwavefiles.h" +#include "functions.h" #ifdef DSSI_SUPPORT #include "dssihost.h" @@ -977,6 +978,10 @@ MusE::MusE(int argc, char** argv) : QMainWindow() editPaste2TrackAction = new QAction(QIcon(*editpaste2TrackIconSet), tr("Paste to &track"), this); editPasteC2TAction = new QAction(QIcon(*editpasteClone2TrackIconSet), tr("Paste clone to trac&k"), this); editDeleteSelectedAction = new QAction(QIcon(*edit_track_delIcon), tr("Delete Selected Tracks"), this); + + editShrinkPartsAction = new QAction(tr("Shrink selected parts"), this); //FINDMICH TODO tooltips! + editExpandPartsAction = new QAction(tr("Expand selected parts"), this); + editCleanPartsAction = new QAction(tr("Clean selected parts"), this); addTrack = new QMenu(tr("Add Track"), this); @@ -1127,6 +1132,10 @@ MusE::MusE(int argc, char** argv) : QMainWindow() connect(editPasteC2TAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editDeleteSelectedAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); + connect(editShrinkPartsAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); + connect(editExpandPartsAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); + connect(editCleanPartsAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); + connect(editSelectAllAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editDeselectAllAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editInvertSelectionAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); @@ -1143,6 +1152,9 @@ MusE::MusE(int argc, char** argv) : QMainWindow() editSignalMapper->setMapping(editPasteC2TAction, CMD_PASTE_CLONE_TO_TRACK); editSignalMapper->setMapping(editInsertEMAction, CMD_INSERTMEAS); editSignalMapper->setMapping(editDeleteSelectedAction, CMD_DELETE_TRACK); + editSignalMapper->setMapping(editShrinkPartsAction, CMD_SHRINK_PART); + editSignalMapper->setMapping(editExpandPartsAction, CMD_EXPAND_PART); + editSignalMapper->setMapping(editCleanPartsAction, CMD_CLEAN_PART); editSignalMapper->setMapping(editSelectAllAction, CMD_SELECT_ALL); editSignalMapper->setMapping(editDeselectAllAction, CMD_SELECT_NONE); editSignalMapper->setMapping(editInvertSelectionAction, CMD_SELECT_INVERT); @@ -1361,6 +1373,10 @@ MusE::MusE(int argc, char** argv) : QMainWindow() menuEdit->addAction(editPaste2TrackAction); menuEdit->addAction(editPasteC2TAction); menuEdit->addSeparator(); + menuEdit->addAction(editShrinkPartsAction); + menuEdit->addAction(editExpandPartsAction); + menuEdit->addAction(editCleanPartsAction); + menuEdit->addSeparator(); menuEdit->addAction(editDeleteSelectedAction); // Moved below. Have to wait until synths are available... @@ -1389,7 +1405,7 @@ MusE::MusE(int argc, char** argv) : QMainWindow() menuEdit->addMenu(midiEdit); -#if 0 // TODO +#if 0 // TODO FINDMICH delete! midiEdit->insertItem(tr("Modify Gate Time"), this, SLOT(modifyGateTime())); midiEdit->insertItem(tr("Modify Velocity"), this, SLOT(modifyVelocity())); midiEdit->insertItem(tr("Crescendo"), this, SLOT(crescendo())); @@ -3046,6 +3062,10 @@ void MusE::cmd(int cmd) song->setFollow(Song::CONTINUOUS); setFollow(); break; + + case CMD_SHRINK_PART: shrink_parts(); break; + case CMD_EXPAND_PART: expand_parts(); break; + case CMD_CLEAN_PART: clean_parts(); break; } } @@ -3055,37 +3075,12 @@ void MusE::cmd(int cmd) void MusE::clipboardChanged() { -/* - //Q3CString subtype("partlist"); - //QString subtype("partlist"); - QMimeSource* ms = QApplication::clipboard()->data(QClipboard::Clipboard); - if (ms == 0) - return; - bool flag = false; - for (int i = 0; ms->format(i); ++i) { -// printf("Format <%s\n", ms->format(i)); - if ((strncmp(ms->format(i), "text/midipartlist", 17) == 0) - || (strncmp(ms->format(i), "text/wavepartlist", 17) == 0) - // Added by T356. Support mixed .mpt files. - || (strncmp(ms->format(i), "text/mixedpartlist", 18) == 0)) { - flag = true; - break; - } - } -*/ - bool flag = false; if(QApplication::clipboard()->mimeData()->hasFormat(QString("text/x-muse-midipartlist")) || QApplication::clipboard()->mimeData()->hasFormat(QString("text/x-muse-wavepartlist")) || QApplication::clipboard()->mimeData()->hasFormat(QString("text/x-muse-mixedpartlist"))) flag = true; - //bool flag = false; - //if(!QApplication::clipboard()->text(QString("x-muse-midipartlist"), QClipboard::Clipboard).isEmpty() || - // !QApplication::clipboard()->text(QString("x-muse-wavepartlist"), QClipboard::Clipboard).isEmpty() || - // !QApplication::clipboard()->text(QString("x-muse-mixedpartlist"), QClipboard::Clipboard).isEmpty()) - // flag = true; - editPasteAction->setEnabled(flag); editInsertAction->setEnabled(flag); editPasteCloneAction->setEnabled(flag); diff --git a/muse2/muse/app.h b/muse2/muse/app.h index 256154e2..3f539196 100644 --- a/muse2/muse/app.h +++ b/muse2/muse/app.h @@ -80,7 +80,7 @@ class MusE : public QMainWindow CMD_SELECT_ALL, CMD_SELECT_NONE, CMD_SELECT_INVERT, CMD_SELECT_ILOOP, CMD_SELECT_OLOOP, CMD_SELECT_PARTS, CMD_FOLLOW_NO, CMD_FOLLOW_JUMP, CMD_FOLLOW_CONTINUOUS , - CMD_DELETE_TRACK + CMD_DELETE_TRACK, CMD_EXPAND_PART, CMD_SHRINK_PART, CMD_CLEAN_PART }; //File menu items: @@ -113,6 +113,7 @@ class MusE : public QMainWindow QAction *masterGraphicAction, *masterListAction; QAction *midiTransformerAction; QAction *editSongInfoAction; + QAction *editCleanPartsAction, *editShrinkPartsAction, *editExpandPartsAction; public: QAction *startScoreEditAction, *startPianoEditAction, *startDrumEditAction, *startListEditAction, *startWaveEditAction; QMenu *scoreSubmenu, *scoreOneStaffPerTrackSubsubmenu, *scoreAllInOneSubsubmenu; diff --git a/muse2/muse/functions.cpp b/muse2/muse/functions.cpp index a6c9c95a..3d10a878 100644 --- a/muse2/muse/functions.cpp +++ b/muse2/muse/functions.cpp @@ -749,7 +749,7 @@ void paste_at(Part* dest_part, const QString& pt, int pos) Part* newPart = dest_part->clone(); newPart->setLenTick(newPart->lenTick()+diff); // Indicate no undo, and do port controller values but not clone parts. - operations.push_back(UndoOp(UndoOp::ModifyPart,dest_part, newPart, true, false)); //FINDMICHJETZT oder andersrum? + operations.push_back(UndoOp(UndoOp::ModifyPart,dest_part, newPart, true, false)); dest_part = newPart; // reassign TODO FINDME does this work, or has dest_part to be a nonconst reference? } // Indicate no undo, and do not do port controller values and clone parts. @@ -831,6 +831,108 @@ void select_not_in_loop(const std::set& parts) } +void shrink_parts() +{ + Undo operations; + + TrackList* tracks = song->tracks(); + for (iTrack track = tracks->begin(); track != tracks->end(); track++) + for (iPart part = (*track)->parts()->begin(); part != (*track)->parts()->end(); part++) + if (part->second->selected()) + { + EventList* events=part->second->events(); + unsigned len=0; + + for (iEvent ev=events->begin(); ev!=events->end(); ev++) + if (ev->second.endTick() > len) + len=ev->second.endTick(); + + if (len > part->second->lenTick()) + len = part->second->lenTick(); + + if (len != part->second->lenTick()) + { + MidiPart* new_part = new MidiPart(*(MidiPart*)part->second); + new_part->setLenTick(len); + operations.push_back(UndoOp(UndoOp::ModifyPart, part->second, new_part, true, false)); + } + } + + song->applyOperationGroup(operations); +} + +void expand_parts() +{ + Undo operations; + + TrackList* tracks = song->tracks(); + for (iTrack track = tracks->begin(); track != tracks->end(); track++) + for (iPart part = (*track)->parts()->begin(); part != (*track)->parts()->end(); part++) + if (part->second->selected()) + { + EventList* events=part->second->events(); + unsigned len=part->second->lenTick(); + + for (iEvent ev=events->begin(); ev!=events->end(); ev++) + if (ev->second.endTick() > len) + len=ev->second.endTick(); + + if (len != part->second->lenTick()) + { + MidiPart* new_part = new MidiPart(*(MidiPart*)part->second); + new_part->setLenTick(len); + operations.push_back(UndoOp(UndoOp::ModifyPart, part->second, new_part, true, false)); + } + } + + song->applyOperationGroup(operations); +} + +void clean_parts() +{ + Undo operations; + set already_processed; + + TrackList* tracks = song->tracks(); + for (iTrack track = tracks->begin(); track != tracks->end(); track++) + for (iPart part = (*track)->parts()->begin(); part != (*track)->parts()->end(); part++) + if ((part->second->selected()) && (already_processed.find(part->second)==already_processed.end())) + { + // find out the length of the longest clone of this part; + // avoid processing eventlist multiple times (because of + // multiple clones) + unsigned len=0; + + Part* part_it=part->second; + do + { + if (part_it->lenTick() > len) + len=part_it->lenTick(); + + already_processed.insert(part_it); + part_it=part_it->nextClone(); + } while ((part_it!=part->second) && (part_it!=NULL)); + + + // erase all events exceeding the longest clone of this part + // (i.e., erase all hidden events) or shorten them + EventList* el = part->second->events(); + for (iEvent ev=el->begin(); ev!=el->end(); ev++) + if (ev->second.tick() >= len) + operations.push_back(UndoOp(UndoOp::DeleteEvent, ev->second, part->second, true, true)); + else if (ev->second.endTick() > len) + { + Event new_event = ev->second.clone(); + new_event.setLenTick(len - ev->second.tick()); + + operations.push_back(UndoOp(UndoOp::ModifyEvent, new_event, ev->second, part->second, true, true)); + } + } + + song->applyOperationGroup(operations); +} + + void read_function_dialog_config(Xml& xml) { if (erase_dialog==NULL) diff --git a/muse2/muse/functions.h b/muse2/muse/functions.h index bc2bb8f4..8a1eb3ed 100644 --- a/muse2/muse/functions.h +++ b/muse2/muse/functions.h @@ -84,6 +84,11 @@ void select_invert(const std::set& parts); void select_in_loop(const std::set& parts); void select_not_in_loop(const std::set& parts); +//functions for parts +void shrink_parts(); +void expand_parts(); +void clean_parts(); + //functions for reading and writing default values class Xml; void read_function_dialog_config(Xml& xml); diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index f1c305d6..450d6f98 100644 --- a/muse2/muse/midiedit/scoreedit.cpp +++ b/muse2/muse/midiedit/scoreedit.cpp @@ -4452,6 +4452,8 @@ void staff_t::update_part_indices() /* BUGS and potential bugs + * o clones aren't marked as clones any more :( + * * o when the keymap is not used, this will probably lead to a bug * 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 -- cgit v1.2.3 From 2359a1c010c298eb66b5b03e0e23f55b4fd9ff4b Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Mon, 6 Jun 2011 17:46:25 +0000 Subject: only cleaned up code --- muse2/muse/app.cpp | 455 +-------------------------------------------------- muse2/muse/app.h | 20 +-- muse2/muse/event.cpp | 71 -------- muse2/muse/event.h | 14 -- muse2/muse/part.cpp | 4 - muse2/muse/part.h | 15 -- 6 files changed, 7 insertions(+), 572 deletions(-) (limited to 'muse2/muse/app.cpp') diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp index 6b9f2b5b..fb07955f 100644 --- a/muse2/muse/app.cpp +++ b/muse2/muse/app.cpp @@ -106,13 +106,6 @@ int watchAudio, watchAudioPrefetch, watchMidi; pthread_t splashThread; -//PyScript *pyscript; -// void MusE::runPythonScript() -// { -// QString script("test.py"); -// // pyscript->runPythonScript(script); -// } - void MusE::clearScoreMenuMappers() { @@ -138,127 +131,12 @@ void microSleep(long msleep) sleepOk=usleep(msleep); } -// Removed p3.3.17 -/* -//--------------------------------------------------------- -// watchdog thread -//--------------------------------------------------------- - -static void* watchdog(void*) - { - doSetuid(); - - struct sched_param rt_param; - memset(&rt_param, 0, sizeof(rt_param)); - rt_param.sched_priority = sched_get_priority_max(SCHED_FIFO); - int rv = pthread_setschedparam(pthread_self(), SCHED_FIFO, &rt_param); - if (rv != 0) - perror("Set realtime scheduler"); - - int policy; - if (pthread_getschedparam(pthread_self(), &policy, &rt_param)!= 0) { - printf("Cannot get current client scheduler: %s\n", strerror(errno)); - } - if (policy != SCHED_FIFO) - printf("watchdog process %d _NOT_ running SCHED_FIFO\n", getpid()); - else if (debugMsg) - printf("watchdog set to SCHED_FIFO priority %d\n", - sched_get_priority_max(SCHED_FIFO)); - - undoSetuid(); - int fatal = 0; - for (;;) { - watchAudio = 0; - watchMidi = 0; - static const int WD_TIMEOUT = 3; - - // sleep can be interrpted by signals: - int to = WD_TIMEOUT; - while (to > 0) - to = sleep(to); - - bool timeout = false; - if (midiSeqRunning && watchMidi == 0) - { - printf("midiSeqRunning = %i watchMidi %i\n", midiSeqRunning, watchMidi); - timeout = true; - } - if (watchAudio == 0) - timeout = true; - if (watchAudio > 500000) - timeout = true; - if (timeout) - ++fatal; - else - fatal = 0; - if (fatal >= 3) { - printf("WatchDog: fatal error, realtime task timeout\n"); - printf(" (%d,%d-%d) - stopping all services\n", - watchMidi, watchAudio, fatal); - break; - } -// printf("wd %d %d %d\n", watchMidi, watchAudio, fatal); - } - audio->stop(true); - audioPrefetch->stop(true); - printf("watchdog exit\n"); - exit(-1); - } -*/ - //--------------------------------------------------------- // seqStart //--------------------------------------------------------- bool MusE::seqStart() { - // Changed by Tim. p3.3.17 - - /* - if (audio->isRunning()) { - printf("seqStart(): already running\n"); - return true; - } - - if (realTimeScheduling) { - // - // create watchdog thread with max priority - // - doSetuid(); - struct sched_param rt_param; - memset(&rt_param, 0, sizeof(rt_param)); - rt_param.sched_priority = realTimePriority +1;//sched_get_priority_max(SCHED_FIFO); - - pthread_attr_t* attributes = (pthread_attr_t*) malloc(sizeof(pthread_attr_t)); - pthread_attr_init(attributes); - -// if (pthread_attr_setschedpolicy(attributes, SCHED_FIFO)) { -// printf("MusE: cannot set FIFO scheduling class for RT thread\n"); -// } -// if (pthread_attr_setschedparam (attributes, &rt_param)) { -// // printf("Cannot set scheduling priority for RT thread (%s)\n", strerror(errno)); -// } -// if (pthread_attr_setscope (attributes, PTHREAD_SCOPE_SYSTEM)) { -// printf("MusE: Cannot set scheduling scope for RT thread\n"); -// } - if (pthread_create(&watchdogThread, attributes, ::watchdog, 0)) - perror("MusE: creating watchdog thread failed:"); - pthread_attr_destroy(attributes); - undoSetuid(); - } - audioPrefetch->start(); - audioPrefetch->msgSeek(0, true); // force - midiSeqRunning = !midiSeq->start(); - - if (!audio->start()) { - QMessageBox::critical( muse, tr(QString("Failed to start audio!")), - tr(QString("Was not able to start audio, check if jack is running.\n"))); - return false; - } - - return true; - */ - if (audio->isRunning()) { printf("seqStart(): already running\n"); return true; @@ -275,12 +153,10 @@ bool MusE::seqStart() // for(int i = 0; i < 60; ++i) { - //if (audioState == AUDIO_START2) if(audio->isRunning()) break; sleep(1); } - //if (audioState != AUDIO_START2) { if(!audio->isRunning()) { QMessageBox::critical( muse, tr("Failed to start audio!"), @@ -294,66 +170,6 @@ bool MusE::seqStart() if(debugMsg) printf("MusE::seqStart: getting audio driver realTimePriority:%d\n", realTimePriority); - // Disabled by Tim. p3.3.22 - /* - if(realTimeScheduling) - { - // - // create watchdog thread with max priority - // - doSetuid(); - struct sched_param rt_param; - memset(&rt_param, 0, sizeof(rt_param)); - rt_param.sched_priority = realTimePriority + 1;//sched_get_priority_max(SCHED_FIFO); - - pthread_attr_t* attributes = (pthread_attr_t*) malloc(sizeof(pthread_attr_t)); - pthread_attr_init(attributes); - -// if (pthread_attr_setschedpolicy(attributes, SCHED_FIFO)) { -// printf("MusE: cannot set FIFO scheduling class for RT thread\n"); -// } -// if (pthread_attr_setschedparam (attributes, &rt_param)) { -// // printf("Cannot set scheduling priority for RT thread (%s)\n", strerror(errno)); -// } -// if (pthread_attr_setscope (attributes, PTHREAD_SCOPE_SYSTEM)) { -// printf("MusE: Cannot set scheduling scope for RT thread\n"); -// } - if (pthread_create(&watchdogThread, attributes, ::watchdog, 0)) - perror("MusE: creating watchdog thread failed"); - pthread_attr_destroy(attributes); - undoSetuid(); - } - */ - - //int policy; - //if ((policy = sched_getscheduler (0)) < 0) { - // printf("Cannot get current client scheduler: %s\n", strerror(errno)); - // } - //if (policy != SCHED_FIFO) - // printf("midi thread %d _NOT_ running SCHED_FIFO\n", getpid()); - - - //audioState = AUDIO_RUNNING; - // Changed by Tim. p3.3.22 - /* - //if(realTimePriority) - if(realTimeScheduling) - { - int pr = realTimePriority; - if(pr > 5) - pr -= 5; - else - pr = 0; - audioPrefetch->start(pr); - //audioWriteback->start(realTimePriority - 5); - } - else - { - audioPrefetch->start(0); - //audioWriteback->start(0); - } - */ - int pfprio = 0; int midiprio = 0; @@ -363,52 +179,6 @@ bool MusE::seqStart() // in JackAudioDevice::realtimePriority() which is a bit flawed - it reports there's no RT... if(realTimeScheduling) { - //if(realTimePriority < 5) - // printf("MusE: WARNING: Recommend setting audio realtime priority to a higher value!\n"); - /* - if(realTimePriority == 0) - { - pfprio = 1; - midiprio = 2; - } - else - if(realTimePriority == 1) - { - pfprio = 2; - midiprio = 3; - } - else - if(realTimePriority == 2) - { - pfprio = 1; - midiprio = 3; - } - else - if(realTimePriority == 3) - { - pfprio = 1; - //midiprio = 2; - // p3.3.37 - midiprio = 4; - } - else - if(realTimePriority == 4) - { - pfprio = 1; - //midiprio = 3; - // p3.3.37 - midiprio = 5; - } - else - if(realTimePriority == 5) - { - pfprio = 1; - //midiprio = 3; - // p3.3.37 - midiprio = 6; - } - else - */ { //pfprio = realTimePriority - 5; // p3.3.40 @@ -537,16 +307,6 @@ void addProject(const QString& name) // populateAddSynth //--------------------------------------------------------- -/* -struct addSynth_cmp_str -{ - bool operator()(std::string a, std::string b) - { - return (a < b); - } -}; -*/ - // ORCAN - CHECK QMenu* populateAddSynth(QWidget* parent) { @@ -1326,12 +1086,6 @@ MusE::MusE(int argc, char** argv) : QMainWindow() // Popups //--------------------------------------------------- -// QPopupMenu *foo = new QPopupMenu(this); -// testAction = new QAction(foo,"testPython"); -// testAction->addTo(foo); -// menuBar()->insertItem(tr("&testpython"), foo); -// connect(testAction, SIGNAL(activated()), this, SLOT(runPythonScript())); - //------------------------------------------------------------- // popup File @@ -1405,20 +1159,14 @@ MusE::MusE(int argc, char** argv) : QMainWindow() menuEdit->addMenu(midiEdit); -#if 0 // TODO FINDMICH delete! - 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("Thin Out"), this, SLOT(thinOut())); - midiEdit->insertItem(tr("Erase Event"), this, SLOT(eraseEvent())); - midiEdit->insertItem(tr("Note Shift"), this, SLOT(noteShift())); - midiEdit->insertItem(tr("Move Clock"), this, SLOT(moveClock())); - midiEdit->insertItem(tr("Copy Measure"), this, SLOT(copyMeasure())); +/* commented out by flo: these are not implemented, + but maybe will be in future (state: revision 988) + midiEdit->insertItem(tr("Copy Measure"), this, SLOT(copyMeasure())); midiEdit->insertItem(tr("Erase Measure"), this, SLOT(eraseMeasure())); midiEdit->insertItem(tr("Delete Measure"), this, SLOT(deleteMeasure())); midiEdit->insertItem(tr("Create Measure"), this, SLOT(createMeasure())); midiEdit->insertItem(tr("Mix Track"), this, SLOT(mixTrack())); -#endif +*/ midiEdit->addAction(midiTransformerAction); menuEdit->addAction(editSongInfoAction); @@ -1638,9 +1386,6 @@ MusE::MusE(int argc, char** argv) : QMainWindow() MusE::~MusE() { - //printf("MusE::~MusE\n"); - //if(transport) - // delete transport; } //--------------------------------------------------------- @@ -1964,37 +1709,6 @@ void MusE::setUntitledProject() void MusE::setConfigDefaults() { readConfiguration(); // used for reading midi files -#if 0 - if (readConfiguration()) { - // - // failed to load config file - // set buildin defaults - // - configTransportVisible = false; - configBigTimeVisible = false; - - for (int channel = 0; channel < 2; ++channel) - song->addTrack(Track::AUDIO_GROUP); - AudioTrack* out = (AudioTrack*)song->addTrack(Track::AUDIO_OUTPUT); - AudioTrack* in = (AudioTrack*)song->addTrack(Track::AUDIO_INPUT); - - // set some default routes - std::list il = audioDevice->inputPorts(); - int channel = 0; - for (std::list::iterator i = il.begin(); i != il.end(); ++i, ++channel) { - if (channel == 2) - break; - audio->msgAddRoute(Route(out,channel), Route(*i,channel)); - } - channel = 0; - std::list ol = audioDevice->outputPorts(); - for (std::list::iterator i = ol.begin(); i != ol.end(); ++i, ++channel) { - if (channel == 2) - break; - audio->msgAddRoute(Route(*i, channel), Route(in,channel)); - } - } -#endif song->dirty = false; } @@ -3101,113 +2815,6 @@ void MusE::selectionChanged() } -//--------------------------------------------------------- -// modifyGateTime -//--------------------------------------------------------- - -void MusE::modifyGateTime() - { - printf("not implemented\n"); - } - -//--------------------------------------------------------- -// modifyVelocity -//--------------------------------------------------------- - -void MusE::modifyVelocity() - { - printf("not implemented\n"); - } - -//--------------------------------------------------------- -// crescendo -//--------------------------------------------------------- - -void MusE::crescendo() - { - printf("not implemented\n"); - } - -//--------------------------------------------------------- -// thinOut -//--------------------------------------------------------- - -void MusE::thinOut() - { - printf("not implemented\n"); - } - -//--------------------------------------------------------- -// eraseEvent -//--------------------------------------------------------- - -void MusE::eraseEvent() - { - printf("not implemented\n"); - } - -//--------------------------------------------------------- -// noteShift -//--------------------------------------------------------- - -void MusE::noteShift() - { - printf("not implemented\n"); - } - -//--------------------------------------------------------- -// moveClock -//--------------------------------------------------------- - -void MusE::moveClock() - { - printf("not implemented\n"); - } - -//--------------------------------------------------------- -// copyMeasure -//--------------------------------------------------------- - -void MusE::copyMeasure() - { - printf("not implemented\n"); - } - -//--------------------------------------------------------- -// eraseMeasure -//--------------------------------------------------------- - -void MusE::eraseMeasure() - { - printf("not implemented\n"); - } - -//--------------------------------------------------------- -// deleteMeasure -//--------------------------------------------------------- - -void MusE::deleteMeasure() - { - printf("not implemented\n"); - } - -//--------------------------------------------------------- -// createMeasure -//--------------------------------------------------------- - -void MusE::createMeasure() - { - printf("not implemented\n"); - } - -//--------------------------------------------------------- -// mixTrack -//--------------------------------------------------------- - -void MusE::mixTrack() - { - printf("not implemented\n"); - } //--------------------------------------------------------- // configAppearance @@ -3807,19 +3414,6 @@ void MusE::updateConfiguration() //menuSettings->setAccel(shortcuts[SHRT_CONFIG_AUDIO_PORTS].key, menu_ids[CMD_CONFIG_AUDIO_PORTS]); //menu_help->setAccel(menu_ids[CMD_START_WHATSTHIS], shortcuts[SHRT_START_WHATSTHIS].key); - // Just in case, but no, app kb handler takes care of these. - /* - loopAction->setShortcut(shortcuts[].key); - punchinAction->setShortcut(shortcuts[].key); - punchoutAction->setShortcut(shortcuts[].key); - startAction->setShortcut(shortcuts[].key); - rewindAction->setShortcut(shortcuts[].key); - forwardAction->setShortcut(shortcuts[].key); - stopAction->setShortcut(shortcuts[].key); - playAction->setShortcut(shortcuts[].key); - recordAction->setShortcut(shortcuts[].key); - panicAction->setShortcut(shortcuts[].key); - */ } //--------------------------------------------------------- @@ -3860,24 +3454,6 @@ void MusE::bigtimeClosed() viewBigtimeAction->setChecked(false); } -//--------------------------------------------------------- -// showMixer -//--------------------------------------------------------- - -/* -void MusE::showMixer(bool on) - { - if (on && audioMixer == 0) { - audioMixer = new AudioMixerApp(this); - connect(audioMixer, SIGNAL(closed()), SLOT(mixerClosed())); - audioMixer->resize(config.geometryMixer.size()); - audioMixer->move(config.geometryMixer.topLeft()); - } - if (audioMixer) - audioMixer->setVisible(on); - menuView->setItemChecked(aid1, on); - } -*/ //--------------------------------------------------------- // showMixer1 @@ -3913,17 +3489,6 @@ void MusE::showMixer2(bool on) viewMixerBAction->setChecked(on); } -//--------------------------------------------------------- -// toggleMixer -//--------------------------------------------------------- - -/* -void MusE::toggleMixer() - { - showMixer(!menuView->isItemChecked(aid1)); - } -*/ - //--------------------------------------------------------- // toggleMixer1 //--------------------------------------------------------- @@ -3942,17 +3507,6 @@ void MusE::toggleMixer2(bool checked) showMixer2(checked); } -//--------------------------------------------------------- -// mixerClosed -//--------------------------------------------------------- - -/* -void MusE::mixerClosed() - { - menuView->setItemChecked(aid1, false); - } -*/ - //--------------------------------------------------------- // mixer1Closed //--------------------------------------------------------- @@ -3972,7 +3526,6 @@ void MusE::mixer2Closed() } -//QWidget* MusE::mixerWindow() { return audioMixer; } QWidget* MusE::mixer1Window() { return mixer1; } QWidget* MusE::mixer2Window() { return mixer2; } diff --git a/muse2/muse/app.h b/muse2/muse/app.h index 3f539196..3fd93fc8 100644 --- a/muse2/muse/app.h +++ b/muse2/muse/app.h @@ -11,7 +11,6 @@ #include "config.h" #include "cobject.h" -//#include "tools.h" #include @@ -97,8 +96,6 @@ class MusE : public QMainWindow CMD_AUDIO_BOUNCE_TO_FILE, CMD_AUDIO_BOUNCE_TO_TRACK, CMD_AUDIO_RESTART, CMD_LAST }; - //int menu_ids[CMD_LAST]; - // File menu actions QAction *fileSaveAction, *fileOpenAction, *fileNewAction, *testAction; QAction *fileSaveAsAction, *fileImportMidiAction, *fileExportMidiAction; @@ -228,7 +225,6 @@ class MusE : public QMainWindow void configChanged(); private slots: - //void runPythonScript(); void loadProject(); bool save(); void configGlobalSettings(); @@ -248,7 +244,6 @@ class MusE : public QMainWindow void toggleTransport(bool); void toggleMarker(bool); void toggleBigTime(bool); - //void toggleMixer(); void toggleMixer1(bool); void toggleMixer2(bool); @@ -290,18 +285,12 @@ class MusE : public QMainWindow void cmd(int); void clipboardChanged(); void selectionChanged(); - void modifyGateTime(); - void modifyVelocity(); - void crescendo(); - void thinOut(); - void eraseEvent(); - void noteShift(); - void moveClock(); - void copyMeasure(); - void eraseMeasure(); +/* void copyMeasure(); // commented out by flo: these are not implemented, + void eraseMeasure(); // but maybe will be in future (state: revision 988) void deleteMeasure(); void createMeasure(); void mixTrack(); +*/ void startMidiInputPlugin(int); void hideMitPluginTranspose(); void hideMidiInputTransform(); @@ -323,7 +312,6 @@ class MusE : public QMainWindow void takeAutomationSnapshot(); void clearAutomation(); void bigtimeClosed(); - //void mixerClosed(); void mixer1Closed(); void mixer2Closed(); void markerClosed(); @@ -345,7 +333,6 @@ class MusE : public QMainWindow bool seqRestart(); void loadTemplate(); void showBigtime(bool); - //void showMixer(bool); void showMixer1(bool); void showMixer2(bool); void showMarker(bool); @@ -369,7 +356,6 @@ class MusE : public QMainWindow void setHeartBeat(); void importController(int, MidiPort*, int); QString projectName() { return project.fileName(); } - //QWidget* mixerWindow(); QWidget* mixer1Window(); QWidget* mixer2Window(); QWidget* transportWindow(); diff --git a/muse2/muse/event.cpp b/muse2/muse/event.cpp index 5d16fde9..77b66359 100644 --- a/muse2/muse/event.cpp +++ b/muse2/muse/event.cpp @@ -7,16 +7,10 @@ //========================================================= #include -// #include -//#include "audioconvert.h" #include "event.h" #include "eventbase.h" #include "waveevent.h" #include "midievent.h" -//#include "globals.h" - -// Added by Tim. p3.3.20 -//#define USE_SAMPLERATE //--------------------------------------------------------- // Event @@ -65,11 +59,6 @@ void EventBase::dump(int n) const Event Event::clone() { - // p3.3.31 - //printf("Event::clone() this:%p\n", this); - - // p3.3.31 - //return Event(ev->clone()); #ifdef USE_SAMPLERATE return Event(ev->clone(), _audConv); #else @@ -80,14 +69,9 @@ Event Event::clone() Event::Event() { ev = 0; - //_sfCurFrame = 0; - //_audConv = 0; } Event::Event(EventType t) { - //_sfCurFrame = 0; - //_audConv = 0; - if (t == Wave) ev = new WaveEventBase(t); else @@ -95,30 +79,21 @@ Event::Event(EventType t) { ++(ev->refCount); } Event::Event(const Event& e) { - //_sfCurFrame = 0; - //_audConv = 0; - ev = e.ev; if(ev) ++(ev->refCount); #ifdef USE_SAMPLERATE - //_audConv = AudioConverter::getAudioConverter(e._audConv); if(e._audConv) _audConv = e._audConv->reference(); #endif } Event::Event(EventBase* eb) { - //_sfCurFrame = 0; - //_audConv = 0; - ev = eb; ++(ev->refCount); #ifdef USE_SAMPLERATE if(!ev->sndFile().isNull()) - //_audConv = AudioConverter::getAudioConverter(eb, SRC_SINC_MEDIUM_QUALITY); - //_audConv = new AudioConverter(ev->sndFile().channels(), SRC_SINC_MEDIUM_QUALITY); _audConv = new SRCAudioConverter(ev->sndFile().channels(), SRC_SINC_MEDIUM_QUALITY); #endif } @@ -162,19 +137,6 @@ void Event::setType(EventType t) { } Event& Event::operator=(const Event& e) { - /* - if (ev == e.ev) - return *this; - if (ev && --(ev->refCount) == 0) { - delete ev; - ev = 0; - } - ev = e.ev; - if (ev) - ++(ev->refCount); - return *this; - */ - if (ev != e.ev) { if (ev && --(ev->refCount) == 0) { @@ -191,7 +153,6 @@ Event& Event::operator=(const Event& e) { { if(_audConv) AudioConverter::release(_audConv); - //_audConv = AudioConverter::getAudioConverter(e._audConv); _audConv = e._audConv->reference(); } #endif @@ -207,7 +168,6 @@ bool Event::selected() const { return ev->_selected; } void Event::setSelected(bool val) { ev->_selected = val; } void Event::move(int offset) { ev->move(offset); } -//void Event::read(Xml& xml) { ev->read(xml); } void Event::read(Xml& xml) { ev->read(xml); @@ -216,27 +176,14 @@ void Event::read(Xml& xml) if(!ev->sndFile().isNull()) { if(_audConv) - { _audConv->setChannels(ev->sndFile().channels()); - } else - { - //int srcerr; - //if(debugMsg) - // printf("Event::read Creating samplerate converter with %d channels\n", ev->sndFile().channels()); - //_src_state = src_new(SRC_SINC_MEDIUM_QUALITY, ev->sndFile().channels(), &srcerr); -// _audConv = new AudioConverter(ev->sndFile().channels(), SRC_SINC_MEDIUM_QUALITY); _audConv = new SRCAudioConverter(ev->sndFile().channels(), SRC_SINC_MEDIUM_QUALITY); - //if(!_src_state) - //if(!_audConv) - // printf("Event::read Creation of samplerate converter with %d channels failed:%s\n", ev->sndFile().channels(), src_strerror(srcerr)); - } } #endif } -//void Event::write(int a, Xml& xml, const Pos& o) const { ev->write(a, xml, o); } void Event::write(int a, Xml& xml, const Pos& o, bool forceWavePaths) const { ev->write(a, xml, o, forceWavePaths); } void Event::dump(int n) const { ev->dump(n); } Event Event::mid(unsigned a, unsigned b) { return Event(ev->mid(a, b)); } @@ -268,22 +215,11 @@ int Event::spos() const { return ev->spos(); } void Event::setSpos(int s) { ev->setSpos(s); } SndFileR Event::sndFile() const { return ev->sndFile(); } -//void Event::setSndFile(SndFileR& sf) { ev->setSndFile(sf); } void Event::setSndFile(SndFileR& sf) { ev->setSndFile(sf); #ifdef USE_SAMPLERATE - //if(_audConv) -// if(_audConv && !sf.isNull()) -// { - //_audConv->setSndFile(sf); - //if(sf.isNull()) - // AudioConverter::release(_audConv); - //else -// _audConv->setChannels(sf.channels()); -// } - if(_audConv) { // Do we release? Or keep the converter around, while gaining speed since no rapid creation/destruction. @@ -302,15 +238,8 @@ void Event::setSndFile(SndFileR& sf) #endif } -//void Event::read(unsigned offset, float** bpp, int channels, int nn, bool overwrite) -//void Event::readAudio(unsigned offset, float** bpp, int channels, int nn, bool doSeek, bool overwrite) -// p3.3.33 void Event::readAudio(WavePart* part, unsigned offset, float** bpp, int channels, int nn, bool doSeek, bool overwrite) { - //ev->read(offset, bpp, channels, nn, overwrite); - //ev->readAudio(offset, bpp, channels, nn, doSeek, overwrite); - //_sfCurFrame = ev->readAudio(_src_state, _sfCurFrame, offset, bpp, channels, nn, doSeek, overwrite); - // p3.3.33 ev->readAudio(part, offset, bpp, channels, nn, doSeek, overwrite); } void Event::setTick(unsigned val) { ev->setTick(val); } diff --git a/muse2/muse/event.h b/muse2/muse/event.h index 5a8a74f8..b450d1fd 100644 --- a/muse2/muse/event.h +++ b/muse2/muse/event.h @@ -10,7 +10,6 @@ #define __EVENT_H__ #include -//#include #include #include "wave.h" // wg. SndFile @@ -23,7 +22,6 @@ class QString; class Xml; class EventBase; -//class AudioConverter; class WavePart; //--------------------------------------------------------- @@ -33,20 +31,12 @@ class WavePart; class Event { EventBase* ev; - //off_t _sfCurFrame; - //AudioConverter* _audConv; - public: - //Event() { ev = 0; } Event(); Event(EventType t); Event(const Event& e); Event(EventBase* eb); - //#ifdef USE_SAMPLERATE - //Event(EventBase* eb, AudioConverter* cv); - //#endif - virtual ~Event(); bool empty() const; @@ -62,7 +52,6 @@ class Event { void move(int offset); void read(Xml& xml); - //void write(int a, Xml& xml, const Pos& offset) const; void write(int a, Xml& xml, const Pos& offset, bool ForceWavePaths = false) const; void dump(int n = 0) const; Event clone(); @@ -93,12 +82,9 @@ class Event { void setName(const QString& s); int spos() const; void setSpos(int s); - //AudioConverter* audioConverter() { return _audConv;} SndFileR sndFile() const; virtual void setSndFile(SndFileR& sf); - //virtual void read(unsigned offset, float** bpp, int channels, int nn, bool overwrite = true); - //virtual void readAudio(unsigned /*offset*/, float** /*bpp*/, int /*channels*/, int /*nn*/, bool /*doSeek*/, bool /*overwrite*/); virtual void readAudio(WavePart* /*part*/, unsigned /*offset*/, float** /*bpp*/, int /*channels*/, int /*nn*/, bool /*doSeek*/, bool /*overwrite*/); void setTick(unsigned val); diff --git a/muse2/muse/part.cpp b/muse2/muse/part.cpp index 231b947b..398720af 100644 --- a/muse2/muse/part.cpp +++ b/muse2/muse/part.cpp @@ -827,7 +827,6 @@ void Song::cmdResizePart(Track* track, Part* oPart, unsigned int len) WavePart* nPart = new WavePart(*(WavePart*)oPart); EventList* el = nPart->events(); unsigned new_partlength = tempomap.deltaTick2frame(oPart->tick(), oPart->tick() + len); - //printf("new partlength in frames: %d\n", new_partlength); // If new nr of frames is less than previous what can happen is: // - 0 or more events are beginning after the new final position. Those are removed from the part @@ -839,7 +838,6 @@ void Song::cmdResizePart(Track* track, Part* oPart, unsigned int len) Event e = i->second; unsigned event_startframe = e.frame(); unsigned event_endframe = event_startframe + e.lenFrame(); - //printf("Event frame=%d, length=%d\n", event_startframe, event_length); if (event_endframe < new_partlength) continue; if (event_startframe > new_partlength) { // If event start was after the new length, remove it from part @@ -879,7 +877,6 @@ void Song::cmdResizePart(Track* track, Part* oPart, unsigned int len) unsigned clipframes = (file.samples() - last.spos());// / file.channels(); Event newEvent = last.clone(); - //printf("SndFileR samples=%d channels=%d event samplepos=%d clipframes=%d\n", file.samples(), file.channels(), last.spos(), clipframes); unsigned new_eventlength = new_partlength - last_start; if (new_eventlength > clipframes) // Shrink event length if new partlength exceeds last clip @@ -967,7 +964,6 @@ void Track::splitPart(Part* part, int tickpos, Part*& p1, Part*& p2) p2 = newPart(part); // new right part // Added by Tim. p3.3.6 - //printf("Track::splitPart part ev %p sz:%d ref:%d p1 %p sz:%d ref:%d p2 %p sz:%d ref:%d\n", part->events(), part->events()->size(), part->events()->arefCount(), p1->events(), p1->events()->size(), p1->events()->arefCount(), p2->events(), p2->events()->size(), p2->events()->arefCount()); switch (type()) { case WAVE: diff --git a/muse2/muse/part.h b/muse2/muse/part.h index f7a864e5..9b037edd 100644 --- a/muse2/muse/part.h +++ b/muse2/muse/part.h @@ -24,17 +24,11 @@ class MidiTrack; class WaveTrack; class Xml; class Part; -//class AudioConvertMap; - -// typedef std::multimap >::iterator iEvent; struct ClonePart { - //const EventList* el; const Part* cp; int id; uuid_t uuid; - //ClonePart(const EventList* e, int i) : el(e), id(i) {} - //ClonePart(const Part* p, int i) : cp(p), id(i) {} ClonePart(const Part*, int i = -1); }; @@ -90,12 +84,8 @@ class Part : public PosLen { iEvent addEvent(Event& p); - //virtual void read(Xml&, int newPartOffset=0, bool toTrack = true); - //virtual void write(int, Xml&) const; - //virtual void write(int, Xml&, bool isCopy = false) const; virtual void write(int, Xml&, bool isCopy = false, bool forceWavePaths = false) const; -// virtual Event* newEvent() const = 0; virtual void dump(int n = 0) const; }; @@ -113,7 +103,6 @@ class MidiPart : public Part { virtual MidiPart* clone() const; MidiTrack* track() const { return (MidiTrack*)Part::track(); } -// virtual Event* newEvent() const; virtual void dump(int n = 0) const; }; @@ -134,7 +123,6 @@ class WavePart : public Part { virtual WavePart* clone() const; WaveTrack* track() const { return (WaveTrack*)Part::track(); } -// virtual Event* newEvent() const; virtual void dump(int n = 0) const; }; @@ -167,9 +155,6 @@ extern void addPortCtrlEvents(Event& event, Part* part, bool doClones); extern void removePortCtrlEvents(Part* part, bool doClones); extern void removePortCtrlEvents(Event& event, Part* part, bool doClones); extern CloneList cloneList; -//extern CloneList copyCloneList; -//extern void updateCloneList(Part* oPart, Part* nPart); -//extern void clearClipboardAndCloneList(); extern Part* readXmlPart(Xml&, Track*, bool doClone = false, bool toTrack = true); #endif -- cgit v1.2.3