diff options
135 files changed, 2443 insertions, 2290 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog index ca47fa73..b4ca02a7 100644 --- a/muse2/ChangeLog +++ b/muse2/ChangeLog @@ -1,3 +1,6 @@ +07.09.2011: + - Introducing namespaces. So far, we have MusEApp, MusEGlobal, MusEConfig, and I just started + MusEWidget. zynaddsubfx does not crash anymore. (Orcan) 06.09.2011: - Add licensing information (GPLv2 or later) to source code files. Update FSF mailing address to the most recent one in the existing copyright notices. (Orcan) diff --git a/muse2/al/dsp.cpp b/muse2/al/dsp.cpp index ae12f265..5c23a458 100644 --- a/muse2/al/dsp.cpp +++ b/muse2/al/dsp.cpp @@ -137,7 +137,7 @@ void initDsp() } // fall through to not hardware optimized routines #endif - if(debugMsg) + if(MusEGlobal::debugMsg) printf("Muse: using unoptimized non-SSE dsp routines\n"); dsp = new Dsp(); } diff --git a/muse2/al/sig.cpp b/muse2/al/sig.cpp index 51f0a794..8521fb5b 100644 --- a/muse2/al/sig.cpp +++ b/muse2/al/sig.cpp @@ -262,7 +262,7 @@ int SigList::ticks_beat(int n) const { ///int m = AL::division; - int m = config.division; + int m = MusEConfig::config.division; switch (n) { case 1: m <<= 2; break; // 1536 diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp index 9d2b243c..db14aa05 100644 --- a/muse2/muse/app.cpp +++ b/muse2/muse/app.cpp @@ -30,6 +30,8 @@ #include <QSettings> #include <QProgressDialog> +#include <iostream> + #include "app.h" #include "master/lmaster.h" #include "al/dsp.h" @@ -79,6 +81,9 @@ #include "vst.h" #endif + +namespace MusEApp { + //extern void cacheJackRouteNames(); static pthread_t watchdogThread; @@ -158,7 +163,7 @@ bool MusE::seqStart() } if (!audio->start()) { - QMessageBox::critical( muse, tr("Failed to start audio!"), + QMessageBox::critical( MusEGlobal::muse, tr("Failed to start audio!"), tr("Was not able to start audio, check if jack is running.\n")); return false; } @@ -174,46 +179,46 @@ bool MusE::seqStart() } if(!audio->isRunning()) { - QMessageBox::critical( muse, tr("Failed to start audio!"), + QMessageBox::critical( MusEGlobal::muse, tr("Failed to start audio!"), tr("Timeout waiting for audio to run. Check if jack is running.\n")); } // // now its safe to ask the driver for realtime // priority - realTimePriority = audioDevice->realtimePriority(); - if(debugMsg) - printf("MusE::seqStart: getting audio driver realTimePriority:%d\n", realTimePriority); + MusEGlobal::realTimePriority = audioDevice->realtimePriority(); + if(MusEGlobal::debugMsg) + printf("MusE::seqStart: getting audio driver MusEGlobal::realTimePriority:%d\n", MusEGlobal::realTimePriority); int pfprio = 0; int midiprio = 0; - // NOTE: realTimeScheduling can be true (gotten using jack_is_realtime()), - // while the determined realTimePriority can be 0. - // realTimePriority is gotten using pthread_getschedparam() on the client thread + // NOTE: MusEGlobal::realTimeScheduling can be true (gotten using jack_is_realtime()), + // while the determined MusEGlobal::realTimePriority can be 0. + // MusEGlobal::realTimePriority is gotten using pthread_getschedparam() on the client thread // in JackAudioDevice::realtimePriority() which is a bit flawed - it reports there's no RT... - if(realTimeScheduling) + if(MusEGlobal::realTimeScheduling) { { - //pfprio = realTimePriority - 5; + //pfprio = MusEGlobal::realTimePriority - 5; // p3.3.40 - pfprio = realTimePriority + 1; + pfprio = MusEGlobal::realTimePriority + 1; - //midiprio = realTimePriority - 2; + //midiprio = MusEGlobal::realTimePriority - 2; // p3.3.37 - //midiprio = realTimePriority + 1; + //midiprio = MusEGlobal::realTimePriority + 1; // p3.3.40 - midiprio = realTimePriority + 2; + midiprio = MusEGlobal::realTimePriority + 2; } } - if(midiRTPrioOverride > 0) - midiprio = midiRTPrioOverride; + if(MusEGlobal::midiRTPrioOverride > 0) + midiprio = MusEGlobal::midiRTPrioOverride; - // FIXME FIXME: The realTimePriority of the Jack thread seems to always be 5 less than the value passed to jackd command. - //if(midiprio == realTimePriority) + // FIXME FIXME: The MusEGlobal::realTimePriority of the Jack thread seems to always be 5 less than the value passed to jackd command. + //if(midiprio == MusEGlobal::realTimePriority) // printf("MusE: WARNING: Midi realtime priority %d is the same as audio realtime priority %d. Try a different setting.\n", - // midiprio, realTimePriority); + // midiprio, MusEGlobal::realTimePriority); //if(midiprio == pfprio) // printf("MusE: WARNING: Midi realtime priority %d is the same as audio prefetch realtime priority %d. Try a different setting.\n", // midiprio, pfprio); @@ -222,9 +227,9 @@ bool MusE::seqStart() audioPrefetch->msgSeek(0, true); // force - //midiSeqRunning = !midiSeq->start(realTimeScheduling ? realTimePriority : 0); + //MusEGlobal::midiSeqRunning = !midiSeq->start(MusEGlobal::realTimeScheduling ? MusEGlobal::realTimePriority : 0); // Changed by Tim. p3.3.22 - //midiSeq->start(realTimeScheduling ? realTimePriority : 0); + //midiSeq->start(MusEGlobal::realTimeScheduling ? MusEGlobal::realTimePriority : 0); midiSeq->start(midiprio); int counter=0; @@ -234,14 +239,14 @@ bool MusE::seqStart() fprintf(stderr,"midi sequencer thread does not start!? Exiting...\n"); exit(33); } - midiSeqRunning = midiSeq->isRunning(); - if (midiSeqRunning) + MusEGlobal::midiSeqRunning = midiSeq->isRunning(); + if (MusEGlobal::midiSeqRunning) break; usleep(1000); - if(debugMsg) + if(MusEGlobal::debugMsg) printf("looping waiting for sequencer thread to start\n"); } - if(!midiSeqRunning) + if(!MusEGlobal::midiSeqRunning) { fprintf(stderr, "midiSeq is not running! Exiting...\n"); exit(33); @@ -256,14 +261,14 @@ bool MusE::seqStart() void MusE::seqStop() { // label sequencer as disabled before it actually happened to minimize race condition - midiSeqRunning = false; + MusEGlobal::midiSeqRunning = false; song->setStop(true); song->setStopPlay(false); midiSeq->stop(true); audio->stop(true); audioPrefetch->stop(true); - if (realTimeScheduling && watchdogThread) + if (MusEGlobal::realTimeScheduling && watchdogThread) pthread_cancel(watchdogThread); } @@ -560,7 +565,7 @@ MusE::MusE(int argc, char** argv) : QMainWindow() setIconSize(ICON_SIZE); setFocusPolicy(Qt::WheelFocus); //setFocusPolicy(Qt::NoFocus); - muse = this; // hack + MusEGlobal::muse = this; // hack clipListEdit = 0; midiSyncConfig = 0; midiRemoteConfig = 0; @@ -595,9 +600,9 @@ MusE::MusE(int argc, char** argv) : QMainWindow() song = new Song("song"); song->blockSignals(true); - heartBeatTimer = new QTimer(this); - heartBeatTimer->setObjectName("timer"); - connect(heartBeatTimer, SIGNAL(timeout()), song, SLOT(beat())); + MusEGlobal::heartBeatTimer = new QTimer(this); + MusEGlobal::heartBeatTimer->setObjectName("timer"); + connect(MusEGlobal::heartBeatTimer, SIGNAL(timeout()), song, SLOT(beat())); #ifdef ENABLE_PYTHON //--------------------------------------------------- @@ -617,97 +622,97 @@ MusE::MusE(int argc, char** argv) : QMainWindow() // undo/redo //--------------------------------------------------- - undoRedo = new QActionGroup(this); - undoRedo->setExclusive(false); - undoAction = new QAction(QIcon(*undoIconS), tr("Und&o"), - undoRedo); - redoAction = new QAction(QIcon(*redoIconS), tr("Re&do"), - undoRedo); + MusEGlobal::undoRedo = new QActionGroup(this); + MusEGlobal::undoRedo->setExclusive(false); + MusEGlobal::undoAction = new QAction(QIcon(*undoIconS), tr("Und&o"), + MusEGlobal::undoRedo); + MusEGlobal::redoAction = new QAction(QIcon(*redoIconS), tr("Re&do"), + MusEGlobal::undoRedo); - undoAction->setWhatsThis(tr("undo last change to song")); - redoAction->setWhatsThis(tr("redo last undo")); - undoAction->setEnabled(false); - redoAction->setEnabled(false); - connect(redoAction, SIGNAL(activated()), song, SLOT(redo())); - connect(undoAction, SIGNAL(activated()), song, SLOT(undo())); + MusEGlobal::undoAction->setWhatsThis(tr("undo last change to song")); + MusEGlobal::redoAction->setWhatsThis(tr("redo last undo")); + MusEGlobal::undoAction->setEnabled(false); + MusEGlobal::redoAction->setEnabled(false); + connect(MusEGlobal::redoAction, SIGNAL(activated()), song, SLOT(redo())); + connect(MusEGlobal::undoAction, SIGNAL(activated()), song, SLOT(undo())); //--------------------------------------------------- // Transport //--------------------------------------------------- - transportAction = new QActionGroup(this); - transportAction->setExclusive(false); + MusEGlobal::transportAction = new QActionGroup(this); + MusEGlobal::transportAction->setExclusive(false); - loopAction = new QAction(QIcon(*loop1Icon), - tr("Loop"), transportAction); - loopAction->setCheckable(true); + MusEGlobal::loopAction = new QAction(QIcon(*loop1Icon), + tr("Loop"), MusEGlobal::transportAction); + MusEGlobal::loopAction->setCheckable(true); - loopAction->setWhatsThis(tr(infoLoopButton)); - connect(loopAction, SIGNAL(toggled(bool)), song, SLOT(setLoop(bool))); + MusEGlobal::loopAction->setWhatsThis(tr(infoLoopButton)); + connect(MusEGlobal::loopAction, SIGNAL(toggled(bool)), song, SLOT(setLoop(bool))); - punchinAction = new QAction(QIcon(*punchin1Icon), - tr("Punchin"), transportAction); - punchinAction->setCheckable(true); + MusEGlobal::punchinAction = new QAction(QIcon(*punchin1Icon), + tr("Punchin"), MusEGlobal::transportAction); + MusEGlobal::punchinAction->setCheckable(true); - punchinAction->setWhatsThis(tr(infoPunchinButton)); - connect(punchinAction, SIGNAL(toggled(bool)), song, SLOT(setPunchin(bool))); + MusEGlobal::punchinAction->setWhatsThis(tr(infoPunchinButton)); + connect(MusEGlobal::punchinAction, SIGNAL(toggled(bool)), song, SLOT(setPunchin(bool))); - punchoutAction = new QAction(QIcon(*punchout1Icon), - tr("Punchout"), transportAction); - punchoutAction->setCheckable(true); + MusEGlobal::punchoutAction = new QAction(QIcon(*punchout1Icon), + tr("Punchout"), MusEGlobal::transportAction); + MusEGlobal::punchoutAction->setCheckable(true); - punchoutAction->setWhatsThis(tr(infoPunchoutButton)); - connect(punchoutAction, SIGNAL(toggled(bool)), song, SLOT(setPunchout(bool))); + MusEGlobal::punchoutAction->setWhatsThis(tr(infoPunchoutButton)); + connect(MusEGlobal::punchoutAction, SIGNAL(toggled(bool)), song, SLOT(setPunchout(bool))); QAction *tseparator = new QAction(this); tseparator->setSeparator(true); - transportAction->addAction(tseparator); + MusEGlobal::transportAction->addAction(tseparator); - startAction = new QAction(QIcon(*startIcon), - tr("Start"), transportAction); + MusEGlobal::startAction = new QAction(QIcon(*startIcon), + tr("Start"), MusEGlobal::transportAction); - startAction->setWhatsThis(tr(infoStartButton)); - connect(startAction, SIGNAL(activated()), song, SLOT(rewindStart())); + MusEGlobal::startAction->setWhatsThis(tr(infoStartButton)); + connect(MusEGlobal::startAction, SIGNAL(activated()), song, SLOT(rewindStart())); - rewindAction = new QAction(QIcon(*frewindIcon), - tr("Rewind"), transportAction); + MusEGlobal::rewindAction = new QAction(QIcon(*frewindIcon), + tr("Rewind"), MusEGlobal::transportAction); - rewindAction->setWhatsThis(tr(infoRewindButton)); - connect(rewindAction, SIGNAL(activated()), song, SLOT(rewind())); + MusEGlobal::rewindAction->setWhatsThis(tr(infoRewindButton)); + connect(MusEGlobal::rewindAction, SIGNAL(activated()), song, SLOT(rewind())); - forwardAction = new QAction(QIcon(*fforwardIcon), - tr("Forward"), transportAction); + MusEGlobal::forwardAction = new QAction(QIcon(*fforwardIcon), + tr("Forward"), MusEGlobal::transportAction); - forwardAction->setWhatsThis(tr(infoForwardButton)); - connect(forwardAction, SIGNAL(activated()), song, SLOT(forward())); + MusEGlobal::forwardAction->setWhatsThis(tr(infoForwardButton)); + connect(MusEGlobal::forwardAction, SIGNAL(activated()), song, SLOT(forward())); - stopAction = new QAction(QIcon(*stopIcon), - tr("Stop"), transportAction); - stopAction->setCheckable(true); + MusEGlobal::stopAction = new QAction(QIcon(*stopIcon), + tr("Stop"), MusEGlobal::transportAction); + MusEGlobal::stopAction->setCheckable(true); - stopAction->setWhatsThis(tr(infoStopButton)); - stopAction->setChecked(true); - connect(stopAction, SIGNAL(toggled(bool)), song, SLOT(setStop(bool))); + MusEGlobal::stopAction->setWhatsThis(tr(infoStopButton)); + MusEGlobal::stopAction->setChecked(true); + connect(MusEGlobal::stopAction, SIGNAL(toggled(bool)), song, SLOT(setStop(bool))); - playAction = new QAction(QIcon(*playIcon), - tr("Play"), transportAction); - playAction->setCheckable(true); + MusEGlobal::playAction = new QAction(QIcon(*playIcon), + tr("Play"), MusEGlobal::transportAction); + MusEGlobal::playAction->setCheckable(true); - playAction->setWhatsThis(tr(infoPlayButton)); - playAction->setChecked(false); - connect(playAction, SIGNAL(toggled(bool)), song, SLOT(setPlay(bool))); + MusEGlobal::playAction->setWhatsThis(tr(infoPlayButton)); + MusEGlobal::playAction->setChecked(false); + connect(MusEGlobal::playAction, SIGNAL(toggled(bool)), song, SLOT(setPlay(bool))); - recordAction = new QAction(QIcon(*recordIcon), - tr("Record"), transportAction); - recordAction->setCheckable(true); - recordAction->setWhatsThis(tr(infoRecordButton)); - connect(recordAction, SIGNAL(toggled(bool)), song, SLOT(setRecord(bool))); + MusEGlobal::recordAction = new QAction(QIcon(*recordIcon), + tr("Record"), MusEGlobal::transportAction); + MusEGlobal::recordAction->setCheckable(true); + MusEGlobal::recordAction->setWhatsThis(tr(infoRecordButton)); + connect(MusEGlobal::recordAction, SIGNAL(toggled(bool)), song, SLOT(setRecord(bool))); - panicAction = new QAction(QIcon(*panicIcon), + MusEGlobal::panicAction = new QAction(QIcon(*panicIcon), tr("Panic"), this); - panicAction->setWhatsThis(tr(infoPanicButton)); - connect(panicAction, SIGNAL(activated()), song, SLOT(panic())); + MusEGlobal::panicAction->setWhatsThis(tr(infoPanicButton)); + connect(MusEGlobal::panicAction, SIGNAL(activated()), song, SLOT(panic())); initMidiInstruments(); initMidiPorts(); @@ -957,7 +962,7 @@ MusE::MusE(int argc, char** argv) : QMainWindow() //-------- View connections connect(viewTransportAction, SIGNAL(toggled(bool)), SLOT(toggleTransport(bool))); - connect(viewBigtimeAction, SIGNAL(toggled(bool)), SLOT(toggleBigTime(bool))); + connect(viewBigtimeAction, SIGNAL(toggled(bool)), SLOT(toggleMusEWidget::BigTime(bool))); connect(viewMixerAAction, SIGNAL(toggled(bool)),SLOT(toggleMixer1(bool))); connect(viewMixerBAction, SIGNAL(toggled(bool)), SLOT(toggleMixer2(bool))); connect(viewCliplistAction, SIGNAL(toggled(bool)), SLOT(startClipList(bool))); @@ -1054,21 +1059,21 @@ MusE::MusE(int argc, char** argv) : QMainWindow() tools->addAction(QWhatsThis::createAction(this)); tools->addSeparator(); - tools->addActions(undoRedo->actions()); + tools->addActions(MusEGlobal::undoRedo->actions()); - tools1 = new EditToolBar(this, arrangerTools); + tools1 = new MusEWidget::EditToolBar(this, MusEWidget::arrangerTools); addToolBar(tools1); - tools1->setObjectName("arrangerTools"); + tools1->setObjectName("MusEWidget::arrangerTools"); QToolBar* transportToolbar = addToolBar(tr("Transport")); transportToolbar->setObjectName("Transport"); - transportToolbar->addActions(transportAction->actions()); + transportToolbar->addActions(MusEGlobal::transportAction->actions()); QToolBar* panicToolbar = addToolBar(tr("Panic")); panicToolbar->setObjectName("Panic"); - panicToolbar->addAction(panicAction); + panicToolbar->addAction(MusEGlobal::panicAction); - visTracks = new VisibleTracks(this); + visTracks = new MusEWidget::VisibleTracks(this); addToolBar(visTracks); @@ -1076,22 +1081,22 @@ MusE::MusE(int argc, char** argv) : QMainWindow() //getrlimit(RLIMIT_RTPRIO, &lim); //printf("RLIMIT_RTPRIO soft:%d hard:%d\n", lim.rlim_cur, lim.rlim_max); // Reported 80, 80 even with non-RT kernel. - if (realTimePriority < sched_get_priority_min(SCHED_FIFO)) - realTimePriority = sched_get_priority_min(SCHED_FIFO); - else if (realTimePriority > sched_get_priority_max(SCHED_FIFO)) - realTimePriority = sched_get_priority_max(SCHED_FIFO); + if (MusEGlobal::realTimePriority < sched_get_priority_min(SCHED_FIFO)) + MusEGlobal::realTimePriority = sched_get_priority_min(SCHED_FIFO); + else if (MusEGlobal::realTimePriority > sched_get_priority_max(SCHED_FIFO)) + MusEGlobal::realTimePriority = sched_get_priority_max(SCHED_FIFO); // If we requested to force the midi thread priority... - if(midiRTPrioOverride > 0) + if(MusEGlobal::midiRTPrioOverride > 0) { - if (midiRTPrioOverride < sched_get_priority_min(SCHED_FIFO)) - midiRTPrioOverride = sched_get_priority_min(SCHED_FIFO); - else if (midiRTPrioOverride > sched_get_priority_max(SCHED_FIFO)) - midiRTPrioOverride = sched_get_priority_max(SCHED_FIFO); + if (MusEGlobal::midiRTPrioOverride < sched_get_priority_min(SCHED_FIFO)) + MusEGlobal::midiRTPrioOverride = sched_get_priority_min(SCHED_FIFO); + else if (MusEGlobal::midiRTPrioOverride > sched_get_priority_max(SCHED_FIFO)) + MusEGlobal::midiRTPrioOverride = sched_get_priority_max(SCHED_FIFO); } // Changed by Tim. p3.3.17 - //midiSeq = new MidiSeq(realTimeScheduling ? realTimePriority : 0, "Midi"); + //midiSeq = new MidiSeq(MusEGlobal::realTimeScheduling ? MusEGlobal::realTimePriority : 0, "Midi"); midiSeq = new MidiSeq("Midi"); audio = new Audio(); //audioPrefetch = new AudioPrefetch(0, "Disc"); @@ -1130,7 +1135,7 @@ MusE::MusE(int argc, char** argv) : QMainWindow() //------------------------------------------------------------- menuEdit = menuBar()->addMenu(tr("&Edit")); - menuEdit->addActions(undoRedo->actions()); + menuEdit->addActions(MusEGlobal::undoRedo->actions()); menuEdit->addSeparator(); menuEdit->addAction(editCutAction); @@ -1317,7 +1322,7 @@ MusE::MusE(int argc, char** argv) : QMainWindow() // read list of "Recent Projects" //--------------------------------------------------- - QString prjPath(configPath); + QString prjPath(MusEGlobal::configPath); prjPath += QString("/projects"); FILE* f = fopen(prjPath.toLatin1().constData(), "r"); if (f == 0) { @@ -1372,21 +1377,21 @@ MusE::MusE(int argc, char** argv) : QMainWindow() bool useTemplate = false; if (argc >= 2) name = argv[0]; - else if (config.startMode == 0) { + else if (MusEConfig::config.startMode == 0) { if (argc < 2) name = projectList[0] ? *projectList[0] : QString("untitled"); else name = argv[0]; - printf("starting with selected song %s\n", config.startSong.toLatin1().constData()); + printf("starting with selected song %s\n", MusEConfig::config.startSong.toLatin1().constData()); } - else if (config.startMode == 1) { + else if (MusEConfig::config.startMode == 1) { printf("starting with default template\n"); - name = museGlobalShare + QString("/templates/default.med"); + name = MusEGlobal::museGlobalShare + QString("/templates/default.med"); useTemplate = true; } - else if (config.startMode == 2) { - printf("starting with pre configured song %s\n", config.startSong.toLatin1().constData()); - name = config.startSong; + else if (MusEConfig::config.startMode == 2) { + printf("starting with pre configured song %s\n", MusEConfig::config.startSong.toLatin1().constData()); + name = MusEConfig::config.startSong; } song->blockSignals(false); loadProjectFile(name, useTemplate, true); @@ -1409,7 +1414,7 @@ MusE::~MusE() void MusE::setHeartBeat() { - heartBeatTimer->start(1000/config.guiRefresh); + MusEGlobal::heartBeatTimer->start(1000/MusEConfig::config.guiRefresh); } //--------------------------------------------------------- @@ -1554,11 +1559,11 @@ void MusE::loadProjectFile1(const QString& name, bool songTemplate, bool loadAll return; } project.setFile("untitled"); - museProject = museProjectInitPath; + MusEGlobal::museProject = MusEGlobal::museProjectInitPath; } else { printf("Setting project path to %s\n", fi.absolutePath().toLatin1().constData()); - museProject = fi.absolutePath(); + MusEGlobal::museProject = fi.absolutePath(); project.setFile(name); } // Changed by T356. 01/19/2010. We want the complete extension here. @@ -1616,52 +1621,52 @@ void MusE::loadProjectFile1(const QString& name, bool songTemplate, bool loadAll song->dirty = false; progress->setValue(30); - viewTransportAction->setChecked(config.transportVisible); - viewBigtimeAction->setChecked(config.bigTimeVisible); - viewMarkerAction->setChecked(config.markerVisible); + viewTransportAction->setChecked(MusEConfig::config.transportVisible); + viewBigtimeAction->setChecked(MusEConfig::config.bigTimeVisible); + viewMarkerAction->setChecked(MusEConfig::config.markerVisible); - autoMixerAction->setChecked(automation); + autoMixerAction->setChecked(MusEGlobal::automation); if (loadAll) { - showBigtime(config.bigTimeVisible); - //showMixer(config.mixerVisible); - showMixer1(config.mixer1Visible); - showMixer2(config.mixer2Visible); + showBigtime(MusEConfig::config.bigTimeVisible); + //showMixer(MusEConfig::config.mixerVisible); + showMixer1(MusEConfig::config.mixer1Visible); + showMixer2(MusEConfig::config.mixer2Visible); // Added p3.3.43 Make sure the geometry is correct because showMixerX() will NOT // set the geometry if the mixer has already been created. if(mixer1) { - //if(mixer1->geometry().size() != config.mixer1.geometry.size()) // p3.3.53 Moved below - // mixer1->resize(config.mixer1.geometry.size()); + //if(mixer1->geometry().size() != MusEConfig::config.mixer1.geometry.size()) // p3.3.53 Moved below + // mixer1->resize(MusEConfig::config.mixer1.geometry.size()); - if(mixer1->geometry().topLeft() != config.mixer1.geometry.topLeft()) - mixer1->move(config.mixer1.geometry.topLeft()); + if(mixer1->geometry().topLeft() != MusEConfig::config.mixer1.geometry.topLeft()) + mixer1->move(MusEConfig::config.mixer1.geometry.topLeft()); } if(mixer2) { - //if(mixer2->geometry().size() != config.mixer2.geometry.size()) // p3.3.53 Moved below - // mixer2->resize(config.mixer2.geometry.size()); + //if(mixer2->geometry().size() != MusEConfig::config.mixer2.geometry.size()) // p3.3.53 Moved below + // mixer2->resize(MusEConfig::config.mixer2.geometry.size()); - if(mixer2->geometry().topLeft() != config.mixer2.geometry.topLeft()) - mixer2->move(config.mixer2.geometry.topLeft()); + if(mixer2->geometry().topLeft() != MusEConfig::config.mixer2.geometry.topLeft()) + mixer2->move(MusEConfig::config.mixer2.geometry.topLeft()); } - //showMarker(config.markerVisible); // Moved below. Tim. - resize(config.geometryMain.size()); - move(config.geometryMain.topLeft()); + //showMarker(MusEConfig::config.markerVisible); // Moved below. Tim. + resize(MusEConfig::config.geometryMain.size()); + move(MusEConfig::config.geometryMain.topLeft()); - if (config.transportVisible) + if (MusEConfig::config.transportVisible) transport->show(); - transport->move(config.geometryTransport.topLeft()); - showTransport(config.transportVisible); + transport->move(MusEConfig::config.geometryTransport.topLeft()); + showTransport(MusEConfig::config.transportVisible); } progress->setValue(40); transport->setMasterFlag(song->masterFlag()); - punchinAction->setChecked(song->punchin()); - punchoutAction->setChecked(song->punchout()); - loopAction->setChecked(song->loop()); + MusEGlobal::punchinAction->setChecked(song->punchin()); + MusEGlobal::punchoutAction->setChecked(song->punchout()); + MusEGlobal::loopAction->setChecked(song->loop()); song->update(); song->updatePos(); clipboardChanged(); // enable/disable "Paste" @@ -1674,32 +1679,32 @@ void MusE::loadProjectFile1(const QString& name, bool songTemplate, bool loadAll { if(mixer1) { - if(mixer1->geometry().size() != config.mixer1.geometry.size()) + if(mixer1->geometry().size() != MusEConfig::config.mixer1.geometry.size()) { - //printf("MusE::loadProjectFile1 resizing mixer1 x:%d y:%d w:%d h:%d\n", config.mixer1.geometry.x(), - // config.mixer1.geometry.y(), - // config.mixer1.geometry.width(), - // config.mixer1.geometry.height() + //printf("MusE::loadProjectFile1 resizing mixer1 x:%d y:%d w:%d h:%d\n", MusEConfig::config.mixer1.geometry.x(), + // MusEConfig::config.mixer1.geometry.y(), + // MusEConfig::config.mixer1.geometry.width(), + // MusEConfig::config.mixer1.geometry.height() // ); - mixer1->resize(config.mixer1.geometry.size()); + mixer1->resize(MusEConfig::config.mixer1.geometry.size()); } } if(mixer2) { - if(mixer2->geometry().size() != config.mixer2.geometry.size()) + if(mixer2->geometry().size() != MusEConfig::config.mixer2.geometry.size()) { - //printf("MusE::loadProjectFile1 resizing mixer2 x:%d y:%d w:%d h:%d\n", config.mixer2.geometry.x(), - // config.mixer2.geometry.y(), - // config.mixer2.geometry.width(), - // config.mixer2.geometry.height() + //printf("MusE::loadProjectFile1 resizing mixer2 x:%d y:%d w:%d h:%d\n", MusEConfig::config.mixer2.geometry.x(), + // MusEConfig::config.mixer2.geometry.y(), + // MusEConfig::config.mixer2.geometry.width(), + // MusEConfig::config.mixer2.geometry.height() // ); - mixer2->resize(config.mixer2.geometry.size()); + mixer2->resize(MusEConfig::config.mixer2.geometry.size()); } } // Moved here from above due to crash with a song loaded and then File->New. // Marker view list was not updated, had non-existent items from marker list (cleared in ::clear()). - showMarker(config.markerVisible); + showMarker(MusEConfig::config.markerVisible); } } @@ -1712,7 +1717,7 @@ void MusE::setUntitledProject() { setConfigDefaults(); QString name("untitled"); - museProject = "./"; //QFileInfo(name).absolutePath(); + MusEGlobal::museProject = "./"; //QFileInfo(name).absolutePath(); project.setFile(name); setWindowTitle(tr("MusE: Song: ") + project.completeBaseName()); } @@ -1747,10 +1752,10 @@ void MusE::setFollow() void MusE::loadProject() { bool loadAll; - QString fn = getOpenFileName(QString(""), med_file_pattern, this, + QString fn = getOpenFileName(QString(""), MusEGlobal::med_file_pattern, this, tr("MusE: load project"), &loadAll); if (!fn.isEmpty()) { - museProject = QFileInfo(fn).absolutePath(); + MusEGlobal::museProject = QFileInfo(fn).absolutePath(); loadProjectFile(fn, false, loadAll); } } @@ -1761,10 +1766,10 @@ void MusE::loadProject() void MusE::loadTemplate() { - QString fn = getOpenFileName(QString("templates"), med_file_pattern, this, + QString fn = getOpenFileName(QString("templates"), MusEGlobal::med_file_pattern, this, tr("MusE: load template"), 0, MFileDialog::GLOBAL_VIEW); if (!fn.isEmpty()) { - // museProject = QFileInfo(fn).absolutePath(); + // MusEGlobal::museProject = QFileInfo(fn).absolutePath(); loadProjectFile(fn, true, true); // With templates, don't clear midi ports. @@ -1895,7 +1900,7 @@ void MusE::closeEvent(QCloseEvent* event) settings.setValue("MusE/windowState", saveState()); // save "Open Recent" list - QString prjPath(configPath); + QString prjPath(MusEGlobal::configPath); prjPath += "/projects"; FILE* f = fopen(prjPath.toLatin1().constData(), "w"); if (f) { @@ -1904,13 +1909,13 @@ void MusE::closeEvent(QCloseEvent* event) } fclose(f); } - if(debugMsg) + if(MusEGlobal::debugMsg) printf("MusE: Exiting JackAudio\n"); exitJackAudio(); - if(debugMsg) + if(MusEGlobal::debugMsg) printf("MusE: Exiting DummyAudio\n"); exitDummyAudio(); - if(debugMsg) + if(MusEGlobal::debugMsg) printf("MusE: Exiting Metronome\n"); exitMetronome(); @@ -1932,7 +1937,7 @@ void MusE::closeEvent(QCloseEvent* event) // delete *i; song->cleanupForQuit(); - if(debugMsg) + if(MusEGlobal::debugMsg) printf("Muse: Cleaning up temporary wavefiles + peakfiles\n"); // Cleanup temporary wavefiles + peakfiles used for undo for (std::list<QString>::iterator i = temporaryWavFiles.begin(); i != temporaryWavFiles.end(); i++) { @@ -1947,18 +1952,18 @@ void MusE::closeEvent(QCloseEvent* event) // Disconnect gracefully from LASH. Tim. p3.3.14 if(lash_client) { - if(debugMsg) + if(MusEGlobal::debugMsg) printf("MusE: Disconnecting from LASH\n"); lash_event_t* lashev = lash_event_new_with_type (LASH_Quit); lash_send_event(lash_client, lashev); } #endif - if(debugMsg) + if(MusEGlobal::debugMsg) printf("MusE: Exiting Dsp\n"); AL::exitDsp(); - if(debugMsg) + if(MusEGlobal::debugMsg) printf("MusE: Exiting OSC\n"); exitOSC(); @@ -2050,9 +2055,9 @@ RoutePopupMenu* MusE::getRoutingPopupMenu() bool MusE::saveAs() { QString name; - if (museProject == museProjectInitPath ) { - if (config.useProjectSaveDialog) { - ProjectCreateImpl pci(muse); + if (MusEGlobal::museProject == MusEGlobal::museProjectInitPath ) { + if (MusEConfig::config.useProjectSaveDialog) { + ProjectCreateImpl pci(MusEGlobal::muse); if (pci.exec() == QDialog::Rejected) { return false; } @@ -2060,25 +2065,25 @@ bool MusE::saveAs() song->setSongInfo(pci.getSongInfo(), true); name = pci.getProjectPath(); } else { - name = getSaveFileName(QString(""), med_file_save_pattern, this, tr("MusE: Save As")); + name = getSaveFileName(QString(""), MusEGlobal::med_file_save_pattern, this, tr("MusE: Save As")); if (name.isEmpty()) return false; } - museProject = QFileInfo(name).absolutePath(); + MusEGlobal::museProject = QFileInfo(name).absolutePath(); QDir dirmanipulator; - if (!dirmanipulator.mkpath(museProject)) { + if (!dirmanipulator.mkpath(MusEGlobal::museProject)) { QMessageBox::warning(this,"Path error","Can't create project path", QMessageBox::Ok); return false; } } else { - name = getSaveFileName(QString(""), med_file_save_pattern, this, tr("MusE: Save As")); + name = getSaveFileName(QString(""), MusEGlobal::med_file_save_pattern, this, tr("MusE: Save As")); } bool ok = false; if (!name.isEmpty()) { - QString tempOldProj = museProject; - museProject = QFileInfo(name).absolutePath(); + QString tempOldProj = MusEGlobal::museProject; + MusEGlobal::museProject = QFileInfo(name).absolutePath(); ok = save(name, true); if (ok) { project.setFile(name); @@ -2086,7 +2091,7 @@ bool MusE::saveAs() addProject(name); } else - museProject = tempOldProj; + MusEGlobal::museProject = tempOldProj; } return ok; @@ -2246,7 +2251,7 @@ void MusE::startPianoroll(PartList* pl, bool showDefaultCtrls) pianoroll->show(); toplevels.push_back(Toplevel(Toplevel::PIANO_ROLL, (unsigned long)(pianoroll), pianoroll)); connect(pianoroll, SIGNAL(deleted(unsigned long)), SLOT(toplevelDeleted(unsigned long))); - connect(muse, SIGNAL(configChanged()), pianoroll, SLOT(configChanged())); + connect(MusEGlobal::muse, SIGNAL(configChanged()), pianoroll, SLOT(configChanged())); } //--------------------------------------------------------- @@ -2267,7 +2272,7 @@ void MusE::startListEditor(PartList* pl) listEditor->show(); toplevels.push_back(Toplevel(Toplevel::LISTE, (unsigned long)(listEditor), listEditor)); connect(listEditor, SIGNAL(deleted(unsigned long)), SLOT(toplevelDeleted(unsigned long))); - connect(muse,SIGNAL(configChanged()), listEditor, SLOT(configChanged())); + connect(MusEGlobal::muse,SIGNAL(configChanged()), listEditor, SLOT(configChanged())); } //--------------------------------------------------------- @@ -2292,7 +2297,7 @@ void MusE::startLMasterEditor() lmaster->show(); toplevels.push_back(Toplevel(Toplevel::LMASTER, (unsigned long)(lmaster), lmaster)); connect(lmaster, SIGNAL(deleted(unsigned long)), SLOT(toplevelDeleted(unsigned long))); - connect(muse, SIGNAL(configChanged()), lmaster, SLOT(configChanged())); + connect(MusEGlobal::muse, SIGNAL(configChanged()), lmaster, SLOT(configChanged())); } //--------------------------------------------------------- @@ -2316,7 +2321,7 @@ void MusE::startDrumEditor(PartList* pl, bool showDefaultCtrls) drumEditor->show(); toplevels.push_back(Toplevel(Toplevel::DRUM, (unsigned long)(drumEditor), drumEditor)); connect(drumEditor, SIGNAL(deleted(unsigned long)), SLOT(toplevelDeleted(unsigned long))); - connect(muse, SIGNAL(configChanged()), drumEditor, SLOT(configChanged())); + connect(MusEGlobal::muse, SIGNAL(configChanged()), drumEditor, SLOT(configChanged())); } //--------------------------------------------------------- @@ -2337,7 +2342,7 @@ void MusE::startWaveEditor(PartList* pl) { WaveEdit* waveEditor = new WaveEdit(pl); waveEditor->show(); - connect(muse, SIGNAL(configChanged()), waveEditor, SLOT(configChanged())); + connect(MusEGlobal::muse, SIGNAL(configChanged()), waveEditor, SLOT(configChanged())); toplevels.push_back(Toplevel(Toplevel::WAVE, (unsigned long)(waveEditor), waveEditor)); connect(waveEditor, SIGNAL(deleted(unsigned long)), SLOT(toplevelDeleted(unsigned long))); } @@ -2368,15 +2373,15 @@ void MusE::startSongInfo(bool editable) //--------------------------------------------------------- void MusE::showDidYouKnowDialog() { - if ((bool)config.showDidYouKnow == true) { + if ((bool)MusEConfig::config.showDidYouKnow == true) { DidYouKnowWidget dyk; dyk.tipText->setText("To get started with MusE why don't you try some demo songs available at http://demos.muse-sequencer.org/"); dyk.show(); if( dyk.exec()) { if (dyk.dontShowCheckBox->isChecked()) { //printf("disables dialog!\n"); - config.showDidYouKnow=false; - muse->changeConfig(true); // save settings + MusEConfig::config.showDidYouKnow=false; + MusEGlobal::muse->changeConfig(true); // save settings } } } @@ -2515,7 +2520,7 @@ void MusE::kbAccel(int key) if (audio->isPlaying()) //song->setStopPlay(false); song->setStop(true); - else if (!config.useOldStyleStopShortCut) + else if (!MusEConfig::config.useOldStyleStopShortCut) song->setPlay(true); else if (song->cpos() != song->lpos()) song->setPos(0, song->lPos()); @@ -2618,7 +2623,7 @@ void MusE::kbAccel(int key) markerView->prevMarker(); } else { - if (debugMsg) + if (MusEGlobal::debugMsg) printf("unknown kbAccel 0x%x\n", key); } } @@ -2631,7 +2636,7 @@ void MusE::kbAccel(int key) #if 0 static void catchSignal(int sig) { - if (debugMsg) + if (MusEGlobal::debugMsg) fprintf(stderr, "MusE: signal %d catched\n", sig); if (sig == SIGSEGV) { fprintf(stderr, "MusE: segmentation fault\n"); @@ -2893,10 +2898,10 @@ void MusE::changeConfig(bool writeFlag) if (writeFlag) writeGlobalConfiguration(); - //loadStyleSheetFile(config.styleSheetFile); - loadTheme(config.style); - QApplication::setFont(config.fonts[0]); - loadStyleSheetFile(config.styleSheetFile); + //loadStyleSheetFile(MusEConfig::config.styleSheetFile); + loadTheme(MusEConfig::config.style); + QApplication::setFont(MusEConfig::config.fonts[0]); + loadStyleSheetFile(MusEConfig::config.styleSheetFile); emit configChanged(); updateConfiguration(); @@ -3154,7 +3159,7 @@ bool MusE::checkRegionNotNull() //--------------------------------------------------------- // lash_idle_cb //--------------------------------------------------------- -#include <iostream> + void MusE::lash_idle_cb () { @@ -3175,7 +3180,7 @@ MusE::lash_idle_cb () project.setFile(ss.toAscii()); setWindowTitle(tr("MusE: Song: ") + project.completeBaseName()); addProject(ss.toAscii()); - museProject = QFileInfo(ss.toAscii()).absolutePath(); + MusEGlobal::museProject = QFileInfo(ss.toAscii()).absolutePath(); } lash_send_event (lash_client, event); } @@ -3300,12 +3305,12 @@ void MusE::startEditInstrument() void MusE::switchMixerAutomation() { - automation = !automation; + MusEGlobal::automation = ! MusEGlobal::automation; // Clear all pressed and touched and rec event lists. song->clearRecAutomation(true); // printf("automation = %d\n", automation); - autoMixerAction->setChecked(automation); + autoMixerAction->setChecked(MusEGlobal::automation); } //--------------------------------------------------------- @@ -3358,8 +3363,8 @@ void MusE::updateConfiguration() //menu_file->setShortcut(shortcuts[SHRT_LOAD_TEMPLATE].key, menu_ids[CMD_LOAD_TEMPLATE]); // Not used. - undoAction->setShortcut(shortcuts[SHRT_UNDO].key); - redoAction->setShortcut(shortcuts[SHRT_REDO].key); + MusEGlobal::undoAction->setShortcut(shortcuts[SHRT_UNDO].key); + MusEGlobal::redoAction->setShortcut(shortcuts[SHRT_REDO].key); editCutAction->setShortcut(shortcuts[SHRT_CUT].key); editCopyAction->setShortcut(shortcuts[SHRT_COPY].key); @@ -3459,13 +3464,13 @@ void MusE::updateConfiguration() void MusE::showBigtime(bool on) { if (on && bigtime == 0) { - bigtime = new BigTime(0); + bigtime = new MusEWidget::BigTime(0); bigtime->setPos(0, song->cpos(), false); connect(song, SIGNAL(posChanged(int, unsigned, bool)), bigtime, SLOT(setPos(int, unsigned, bool))); - connect(muse, SIGNAL(configChanged()), bigtime, SLOT(configChanged())); + connect(MusEGlobal::muse, SIGNAL(configChanged()), bigtime, SLOT(configChanged())); connect(bigtime, SIGNAL(closed()), SLOT(bigtimeClosed())); - bigtime->resize(config.geometryBigTime.size()); - bigtime->move(config.geometryBigTime.topLeft()); + bigtime->resize(MusEConfig::config.geometryBigTime.size()); + bigtime->move(MusEConfig::config.geometryBigTime.topLeft()); } if (bigtime) bigtime->setVisible(on); @@ -3473,7 +3478,7 @@ void MusE::showBigtime(bool on) } //--------------------------------------------------------- -// toggleBigTime +// toggleMusEWidget::BigTime //--------------------------------------------------------- void MusE::toggleBigTime(bool checked) @@ -3498,10 +3503,10 @@ void MusE::bigtimeClosed() void MusE::showMixer1(bool on) { if (on && mixer1 == 0) { - mixer1 = new AudioMixerApp(this, &(config.mixer1)); + mixer1 = new AudioMixerApp(this, &(MusEConfig::config.mixer1)); connect(mixer1, SIGNAL(closed()), SLOT(mixer1Closed())); - mixer1->resize(config.mixer1.geometry.size()); - mixer1->move(config.mixer1.geometry.topLeft()); + mixer1->resize(MusEConfig::config.mixer1.geometry.size()); + mixer1->move(MusEConfig::config.mixer1.geometry.topLeft()); } if (mixer1) mixer1->setVisible(on); @@ -3515,10 +3520,10 @@ void MusE::showMixer1(bool on) void MusE::showMixer2(bool on) { if (on && mixer2 == 0) { - mixer2 = new AudioMixerApp(this, &(config.mixer2)); + mixer2 = new AudioMixerApp(this, &(MusEConfig::config.mixer2)); connect(mixer2, SIGNAL(closed()), SLOT(mixer2Closed())); - mixer2->resize(config.mixer2.geometry.size()); - mixer2->move(config.mixer2.geometry.topLeft()); + mixer2->resize(MusEConfig::config.mixer2.geometry.size()); + mixer2->move(MusEConfig::config.mixer2.geometry.topLeft()); } if (mixer2) mixer2->setVisible(on); @@ -3616,6 +3621,8 @@ void MusE::execUserScript(int id) //--------------------------------------------------------- void MusE::findUnusedWaveFiles() { - UnusedWaveFiles unused(muse); + UnusedWaveFiles unused(MusEGlobal::muse); unused.exec(); } + +} //namespace MusEApp diff --git a/muse2/muse/app.h b/muse2/muse/app.h index ecb8c091..9036de19 100644 --- a/muse2/muse/app.h +++ b/muse2/muse/app.h @@ -41,13 +41,16 @@ class QString; class QToolBar; class QToolButton; class QProgressDialog; -class VisibleTracks; + +namespace MusEWidget { +class BigTime; class EditToolBar; +class VisibleTracks; +} class Part; class PartList; class Transport; -class BigTime; class Arranger; class Instrument; class RoutePopupMenu; @@ -83,6 +86,9 @@ class Undo; #define MENU_ADD_SYNTH_ID_BASE 0x1000 +namespace MusEApp { + + //--------------------------------------------------------- // MusE //--------------------------------------------------------- @@ -162,11 +168,11 @@ class MusE : public QMainWindow QFileInfo project; QToolBar *tools; - EditToolBar *tools1; - VisibleTracks *visTracks; + MusEWidget::EditToolBar *tools1; + MusEWidget::VisibleTracks *visTracks; Transport* transport; - BigTime* bigtime; + MusEWidget::BigTime* bigtime; EditInstrument* editInstrument; QMenu *menu_file, *menuView, *menuSettings, *menu_help; @@ -389,3 +395,4 @@ class MusE : public QMainWindow extern void addProject(const QString& name); #endif +} // namespace MusEA diff --git a/muse2/muse/appearance.cpp b/muse2/muse/appearance.cpp index cc0f2fa8..253df1f9 100644 --- a/muse2/muse/appearance.cpp +++ b/muse2/muse/appearance.cpp @@ -122,7 +122,7 @@ Appearance::Appearance(Arranger* a, QWidget* parent) setupUi(this); arr = a; color = 0; - config = new GlobalConfigValues; + config = new MusEConfig::GlobalConfigValues; lastSelectedColorItem = 0; lastSelectedBgItem = 0; @@ -208,7 +208,7 @@ Appearance::Appearance(Arranger* a, QWidget* parent) new IdListViewItem(0x410, id, "Saxophon"); */ for(int i = 0; i < NUM_PARTCOLORS; ++i) - new IdListViewItem(0x400 + i, id, ::config.partColorNames[i]); + new IdListViewItem(0x400 + i, id, MusEConfig::config.partColorNames[i]); new IdListViewItem(0x41c, aid, "part canvas background"); id = new IdListViewItem(0, aid, "Track List"); @@ -272,7 +272,7 @@ Appearance::Appearance(Arranger* a, QWidget* parent) /* themeComboBox->clear(); - QString cs = muse->style().name(); + QString cs = MusEGlobal::muse->style().name(); cs = cs.lower(); themeComboBox->insertStringList(QStyleFactory::keys()); @@ -323,7 +323,7 @@ Appearance::Appearance(Arranger* a, QWidget* parent) void Appearance::resetValues() { - *config = ::config; // init with global config values + *config = MusEConfig::config; // init with global config values styleSheetPath->setText(config->styleSheetFile); updateFonts(); @@ -454,7 +454,7 @@ void Appearance::resetValues() global_bg->takeChildren(); user_bg->takeChildren(); - QDir bgdir = museGlobalShare + "/wallpapers/"; + QDir bgdir = MusEGlobal::museGlobalShare + "/wallpapers/"; QStringList filters; filters << "*.jpg" << "*.jpeg" << "*.png" << "*.gif"; bgdir.setNameFilters(filters); @@ -465,10 +465,10 @@ void Appearance::resetValues() foreach (const QString &bgfile, bglist) { QTreeWidgetItem* item = new QTreeWidgetItem(global_bg, 0); - item->setData(0, Qt::UserRole, QVariant(museGlobalShare + "/wallpapers/" + bgfile)); - BgPreviewWidget* bgw = new BgPreviewWidget(museGlobalShare + "/wallpapers/" + bgfile, backgroundTree); + item->setData(0, Qt::UserRole, QVariant(MusEGlobal::museGlobalShare + "/wallpapers/" + bgfile)); + BgPreviewWidget* bgw = new BgPreviewWidget(MusEGlobal::museGlobalShare + "/wallpapers/" + bgfile, backgroundTree); backgroundTree->setItemWidget(item, 0, bgw); - if (config->canvasBgPixmap == museGlobalShare + "/wallpapers/" + bgfile) + if (config->canvasBgPixmap == MusEGlobal::museGlobalShare + "/wallpapers/" + bgfile) backgroundTree->setCurrentItem(item); } @@ -506,7 +506,7 @@ void Appearance::resetValues() arrGrid->setChecked(config->canvasShowGrid); themeComboBox->clear(); - QString cs = muse->style()->objectName(); + QString cs = MusEGlobal::muse->style()->objectName(); //printf("Appearance::resetValues style:%s\n", cs.toAscii().data()); //printf("Appearance::resetValues App styleSheet:%s\n", qApp->styleSheet().toAscii().data()); cs = cs.toLower(); @@ -550,7 +550,7 @@ void Appearance::bgSelectionChanged(QTreeWidgetItem* item) removeBgButton->setEnabled(true); lastSelectedBgItem = item; - muse->arranger->getCanvas()->setBg(QPixmap(item->data(0, Qt::UserRole).toString())); + MusEGlobal::muse->arranger->getCanvas()->setBg(QPixmap(item->data(0, Qt::UserRole).toString())); } //--------------------------------------------------------- @@ -698,8 +698,8 @@ void Appearance::apply() config->globalAlphaBlend = globalAlphaVal->value(); // set colors... - ::config = *config; - muse->changeConfig(true); + MusEConfig::config = *config; + MusEGlobal::muse->changeConfig(true); } //--------------------------------------------------------- @@ -741,7 +741,7 @@ void Appearance::ok() void Appearance::cancel() { - muse->arranger->getCanvas()->setBg(QPixmap(config->canvasBgPixmap)); + MusEGlobal::muse->arranger->getCanvas()->setBg(QPixmap(config->canvasBgPixmap)); close(); } @@ -752,7 +752,7 @@ void Appearance::cancel() void Appearance::removeBackground() { QTreeWidgetItem* item = backgroundTree->currentItem(); - muse->arranger->getCanvas()->setBg(QPixmap()); + MusEGlobal::muse->arranger->getCanvas()->setBg(QPixmap()); user_bg->takeChild(user_bg->indexOfChild(item)); backgroundTree->setCurrentItem (0); removeBgButton->setEnabled(false); @@ -765,7 +765,7 @@ void Appearance::removeBackground() void Appearance::addBackground() { QString cur = getenv("HOME"); - QString user_bgfile = getImageFileName(cur, image_file_pattern, this, + QString user_bgfile = getImageFileName(cur, MusEGlobal::image_file_pattern, this, tr("MusE: load image")); bool image_exists = false; @@ -791,7 +791,7 @@ void Appearance::addBackground() void Appearance::clearBackground() { - muse->arranger->getCanvas()->setBg(QPixmap()); + MusEGlobal::muse->arranger->getCanvas()->setBg(QPixmap()); backgroundTree->setCurrentItem (0); removeBgButton->setEnabled(false); } diff --git a/muse2/muse/appearance.h b/muse2/muse/appearance.h index 06ee3669..5193f679 100644 --- a/muse2/muse/appearance.h +++ b/muse2/muse/appearance.h @@ -30,7 +30,9 @@ class QDialog; class MusE; class Arranger; +namespace MusEConfig { class GlobalConfigValues; +} //--------------------------------------------------------- // Appearance Dialog @@ -43,7 +45,7 @@ class Appearance : public QDialog, public Ui::AppearanceDialogBase { private: Arranger* arr; QColor* color; - GlobalConfigValues* config; + MusEConfig::GlobalConfigValues* config; QButtonGroup* aPalette; QTreeWidgetItem* user_bg; QTreeWidgetItem* global_bg; diff --git a/muse2/muse/arranger/arranger.cpp b/muse2/muse/arranger/arranger.cpp index 9caacf7f..d78ac502 100644 --- a/muse2/muse/arranger/arranger.cpp +++ b/muse2/muse/arranger/arranger.cpp @@ -392,8 +392,8 @@ Arranger::Arranger(QMainWindow* parent, const char* name) time = new MTScale(&_raster, editor, xscale); time->setOrigin(-offset, 0); canvas = new PartCanvas(&_raster, editor, xscale, yscale); - canvas->setBg(config.partCanvasBg); - canvas->setCanvasTools(arrangerTools); + canvas->setBg(MusEConfig::config.partCanvasBg); + canvas->setCanvasTools(MusEWidget::arrangerTools); canvas->setOrigin(-offset, 0); canvas->setFocus(); //parent->setFocusProxy(canvas); // Tim. @@ -533,17 +533,17 @@ void Arranger::configChanged() { //printf("Arranger::configChanged\n"); - if (config.canvasBgPixmap.isEmpty()) { - canvas->setBg(config.partCanvasBg); + if (MusEConfig::config.canvasBgPixmap.isEmpty()) { + canvas->setBg(MusEConfig::config.partCanvasBg); canvas->setBg(QPixmap()); //printf("Arranger::configChanged - no bitmap!\n"); } else { - //printf("Arranger::configChanged - bitmap %s!\n", config.canvasBgPixmap.ascii()); - canvas->setBg(QPixmap(config.canvasBgPixmap)); + //printf("Arranger::configChanged - bitmap %s!\n", MusEConfig::config.canvasBgPixmap.ascii()); + canvas->setBg(QPixmap(MusEConfig::config.canvasBgPixmap)); } - ///midiTrackInfo->setFont(config.fonts[2]); + ///midiTrackInfo->setFont(MusEConfig::config.fonts[2]); //updateTrackInfo(type); } @@ -1059,7 +1059,7 @@ void Arranger::switchInfo(int n) w = new AudioStrip(trackInfo, (AudioTrack*)selected); //w->setFocusPolicy(Qt::TabFocus); // p4.0.9 connect(song, SIGNAL(songChanged(int)), w, SLOT(songChanged(int))); - connect(muse, SIGNAL(configChanged()), w, SLOT(configChanged())); + connect(MusEGlobal::muse, SIGNAL(configChanged()), w, SLOT(configChanged())); w->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); trackInfo->addWidget(w, 2); w->show(); diff --git a/muse2/muse/arranger/pcanvas.cpp b/muse2/muse/arranger/pcanvas.cpp index 2f8cee0b..91a01d8f 100644 --- a/muse2/muse/arranger/pcanvas.cpp +++ b/muse2/muse/arranger/pcanvas.cpp @@ -99,7 +99,7 @@ NPart::NPart(Part* e) : CItem(Event(), e) //--------------------------------------------------------- PartCanvas::PartCanvas(int* r, QWidget* parent, int sx, int sy) - : Canvas(parent, sx, sy) + : MusEWidget::Canvas(parent, sx, sy) { setAcceptDrops(true); _raster = r; @@ -189,7 +189,7 @@ void PartCanvas::returnPressed() void PartCanvas::viewMouseDoubleClickEvent(QMouseEvent* event) { - if (_tool != PointerTool) { + if (_tool != MusEWidget::PointerTool) { viewMousePressEvent(event); return; } @@ -333,7 +333,7 @@ UndoOp PartCanvas::moveItem(CItem* item, const QPoint& newpos, DragType t) } if (ntrack >= tracks->size()) { ntrack = tracks->size(); - if (debugMsg) + if (MusEGlobal::debugMsg) printf("PartCanvas::moveItem - add new track\n"); Track* newTrack = song->addTrack(int(type)); if (type == Track::WAVE) { @@ -632,7 +632,7 @@ QMenu* PartCanvas::genItemPopup(CItem* item) // part color selection for (int i = 0; i < NUM_PARTCOLORS; ++i) { - QAction *act_color = colorPopup->addAction(colorRect(config.partColors[i], 80, 80), config.partColorNames[i]); + QAction *act_color = colorPopup->addAction(colorRect(MusEConfig::config.partColors[i], 80, 80), MusEConfig::config.partColorNames[i]); act_color->setData(20+i); } @@ -648,17 +648,17 @@ QMenu* PartCanvas::genItemPopup(CItem* item) partPopup->addSeparator(); switch(trackType) { case Track::MIDI: { - partPopup->addAction(muse->startPianoEditAction); - partPopup->addMenu(muse->scoreSubmenu); - partPopup->addAction(muse->startScoreEditAction); - partPopup->addAction(muse->startListEditAction); + partPopup->addAction(MusEGlobal::muse->startPianoEditAction); + partPopup->addMenu(MusEGlobal::muse->scoreSubmenu); + partPopup->addAction(MusEGlobal::muse->startScoreEditAction); + partPopup->addAction(MusEGlobal::muse->startListEditAction); QAction *act_mexport = partPopup->addAction(tr("save part to disk")); act_mexport->setData(16); } break; case Track::DRUM: { - partPopup->addAction(muse->startDrumEditAction); - partPopup->addAction(muse->startListEditAction); + partPopup->addAction(MusEGlobal::muse->startDrumEditAction); + partPopup->addAction(MusEGlobal::muse->startListEditAction); QAction *act_dexport = partPopup->addAction(tr("save part to disk")); act_dexport->setData(16); } @@ -755,7 +755,7 @@ void PartCanvas::itemPopup(CItem* item, int n, const QPoint& pt) { const Part* part = item->part(); bool popenFlag = false; - QString fn = getSaveFileName(QString(""), part_file_save_pattern, this, tr("MusE: save part")); + QString fn = getSaveFileName(QString(""), MusEGlobal::part_file_save_pattern, this, tr("MusE: save part")); if (!fn.isEmpty()) { FILE* fp = fileOpen(this, fn, ".mpt", "w", popenFlag, false, false); if (fp) { @@ -846,19 +846,19 @@ void PartCanvas::mousePress(QMouseEvent* event) } QPoint pt = event->pos(); CItem* item = items.find(pt); - if (item == 0 && _tool!=AutomationTool) + if (item == 0 && _tool!=MusEWidget::AutomationTool) return; switch (_tool) { default: emit trackChanged(item->part()->track()); break; - case CutTool: + case MusEWidget::CutTool: splitItem(item, pt); break; - case GlueTool: + case MusEWidget::GlueTool: glueItem(item); break; - case MuteTool: + case MusEWidget::MuteTool: { NPart* np = (NPart*) item; Part* p = np->part(); @@ -866,7 +866,7 @@ void PartCanvas::mousePress(QMouseEvent* event) redraw(); break; } - case AutomationTool: + case MusEWidget::AutomationTool: if (automation.controllerState != doNothing) automation.moveController=true; break; @@ -898,7 +898,7 @@ void PartCanvas::mouseMove(QMouseEvent* event) if (x < 0) x = 0; - if (_tool == AutomationTool) + if (_tool == MusEWidget::AutomationTool) processAutomationMovements(event->pos(), event->modifiers() & Qt::ShiftModifier); emit timeChanged(AL::sigmap.raster(x, *_raster)); @@ -929,7 +929,7 @@ void PartCanvas::keyPress(QKeyEvent* event) { int key = event->key(); -// if (_tool == AutomationTool) { // can't get the cursor pos to work right, skipping for now +// if (_tool == MusEWidget::AutomationTool) { // can't get the cursor pos to work right, skipping for now // // clear all the automation parameters // automation.moveController=false; // automation.controllerState = doNothing; @@ -1001,30 +1001,30 @@ void PartCanvas::keyPress(QKeyEvent* event) return; } else if (key == shortcuts[SHRT_TOOL_POINTER].key) { - emit setUsedTool(PointerTool); + emit setUsedTool(MusEWidget::PointerTool); return; } else if (key == shortcuts[SHRT_TOOL_PENCIL].key) { - emit setUsedTool(PencilTool); + emit setUsedTool(MusEWidget::PencilTool); return; } else if (key == shortcuts[SHRT_TOOL_RUBBER].key) { - emit setUsedTool(RubberTool); + emit setUsedTool(MusEWidget::RubberTool); return; } else if (key == shortcuts[SHRT_TOOL_SCISSORS].key) { - emit setUsedTool(CutTool); + emit setUsedTool(MusEWidget::CutTool); return; } else if (key == shortcuts[SHRT_TOOL_LINEDRAW].key) { - emit setUsedTool(AutomationTool); + emit setUsedTool(MusEWidget::AutomationTool); return; } else if (key == shortcuts[SHRT_TOOL_GLUE].key) { - emit setUsedTool(GlueTool); + emit setUsedTool(MusEWidget::GlueTool); return; } else if (key == shortcuts[SHRT_TOOL_MUTE].key) { - emit setUsedTool(MuteTool); + emit setUsedTool(MusEWidget::MuteTool); return; } else if (key == shortcuts[SHRT_SEL_TRACK_ABOVE].key) { @@ -1389,7 +1389,7 @@ void PartCanvas::drawItem(QPainter& p, const CItem* item, const QRect& rect) if (item->isMoving()) { QColor c(Qt::gray); - c.setAlpha(config.globalAlphaBlend); + c.setAlpha(MusEConfig::config.globalAlphaBlend); QLinearGradient gradient(r.topLeft(), r.bottomLeft()); gradient.setColorAt(0, c); gradient.setColorAt(1, c.darker()); @@ -1399,12 +1399,12 @@ void PartCanvas::drawItem(QPainter& p, const CItem* item, const QRect& rect) if (part->selected()) { QColor c(Qt::black); - c.setAlpha(config.globalAlphaBlend); + c.setAlpha(MusEConfig::config.globalAlphaBlend); QLinearGradient gradient(r.topLeft(), r.bottomLeft()); // Use a colour only about 20% lighter than black, rather than the 50% we use in gGradientFromQColor // and is used in darker()/lighter(), so that it is distinguished a bit better from grey non-part tracks. //c.setRgba(64, 64, 64, c.alpha()); - gradient.setColorAt(0, QColor(51, 51, 51, config.globalAlphaBlend)); + gradient.setColorAt(0, QColor(51, 51, 51, MusEConfig::config.globalAlphaBlend)); gradient.setColorAt(1, c); brush = QBrush(gradient); } @@ -1412,7 +1412,7 @@ void PartCanvas::drawItem(QPainter& p, const CItem* item, const QRect& rect) if (part->mute()) { QColor c(Qt::white); - c.setAlpha(config.globalAlphaBlend); + c.setAlpha(MusEConfig::config.globalAlphaBlend); QLinearGradient gradient(r.topLeft(), r.bottomLeft()); gradient.setColorAt(0, c); gradient.setColorAt(1, c.darker()); @@ -1427,8 +1427,8 @@ void PartCanvas::drawItem(QPainter& p, const CItem* item, const QRect& rect) } else { - QColor c(config.partColors[cidx]); - c.setAlpha(config.globalAlphaBlend); + QColor c(MusEConfig::config.partColors[cidx]); + c.setAlpha(MusEConfig::config.globalAlphaBlend); brush = QBrush(gGradientFromQColor(c, r.topLeft(), r.bottomLeft())); } @@ -1497,7 +1497,7 @@ void PartCanvas::drawItem(QPainter& p, const CItem* item, const QRect& rect) // int part_r, part_g, part_b, brightness, color_brightness; - config.partColors[cidx].getRgb(&part_r, &part_g, &part_b); + MusEConfig::config.partColors[cidx].getRgb(&part_r, &part_g, &part_b); brightness = part_r*29 + part_g*59 + part_b*12; //if ((brightness < 12000 || part->selected()) && !part->mute() && !item->isMoving()) // color_brightness=223; // too dark: use lighter color @@ -1507,7 +1507,7 @@ void PartCanvas::drawItem(QPainter& p, const CItem* item, const QRect& rect) color_brightness=32; // too light: use dark color else color_brightness=223; // too dark: use lighter color - QColor c(color_brightness,color_brightness,color_brightness, config.globalAlphaBlend); + QColor c(color_brightness,color_brightness,color_brightness, MusEConfig::config.globalAlphaBlend); p.setBrush(QBrush(gGradientFromQColor(c, r.topLeft(), r.bottomLeft()))); //p.setBrush(QBrush(c)); if(het & Part::RightEventsHidden) @@ -1559,7 +1559,7 @@ void PartCanvas::drawItem(QPainter& p, const CItem* item, const QRect& rect) // Works great but requires clones be drawn with the highest priority on top of all other parts, in Canvas::draw. // - QPen pen(part->selected() ? config.partColors[i] : Qt::black, 2.0, clone ? Qt::DotLine : Qt::SolidLine); + QPen pen(part->selected() ? MusEConfig::config.partColors[i] : Qt::black, 2.0, clone ? Qt::DotLine : Qt::SolidLine); pen.setCosmetic(true); p.setPen(pen); p.setBrush(Qt::NoBrush); @@ -1580,7 +1580,7 @@ void PartCanvas::drawItem(QPainter& p, const CItem* item, const QRect& rect) p.setBrush(Qt::NoBrush); - QColor pc((part->mute() || item->isMoving())? Qt::white : config.partColors[cidx]); + QColor pc((part->mute() || item->isMoving())? Qt::white : MusEConfig::config.partColors[cidx]); QPen penSelect1H(pc); QPen penSelect2H(pc, 2.0); QPen penSelect1V(pc); @@ -1695,7 +1695,7 @@ void PartCanvas::drawItem(QPainter& p, const CItem* item, const QRect& rect) //p.restore(); - if (config.canvasShowPartType & 1) { // show names + if (MusEConfig::config.canvasShowPartType & 1) { // show names // draw name // FN: Set text color depending on part color (black / white) int part_r, part_g, part_b, brightness; @@ -1703,12 +1703,12 @@ void PartCanvas::drawItem(QPainter& p, const CItem* item, const QRect& rect) // get the lowest colour in the gradient used to draw the part. QRect rr = map(r); rr.setX(rr.x() + 3); - gGradientFromQColor(config.partColors[cidx], rr.topLeft(), rr.bottomLeft()).stops().last().second.getRgb(&part_r, &part_g, &part_b); + gGradientFromQColor(MusEConfig::config.partColors[cidx], rr.topLeft(), rr.bottomLeft()).stops().last().second.getRgb(&part_r, &part_g, &part_b); brightness = part_r*29 + part_g*59 + part_b*12; //bool rev = (brightness < 12000 || part->selected()) && !part->mute() && !item->isMoving(); bool rev = brightness >= 12000 && !part->selected(); p.save(); - p.setFont(config.fonts[1]); + p.setFont(MusEConfig::config.fonts[1]); p.setWorldMatrixEnabled(false); if (rev) p.setPen(Qt::white); @@ -1814,7 +1814,7 @@ void PartCanvas::drawItem(QPainter& p, const CItem* item, const QRect& rect) if (item->isMoving()) { QColor c(Qt::gray); - c.setAlpha(config.globalAlphaBlend); + c.setAlpha(MusEConfig::config.globalAlphaBlend); QLinearGradient gradient(rr.topLeft(), rr.bottomLeft()); gradient.setColorAt(0, c); gradient.setColorAt(1, c.darker()); @@ -1824,12 +1824,12 @@ void PartCanvas::drawItem(QPainter& p, const CItem* item, const QRect& rect) if (part->selected()) { QColor c(Qt::black); - c.setAlpha(config.globalAlphaBlend); + c.setAlpha(MusEConfig::config.globalAlphaBlend); QLinearGradient gradient(rr.topLeft(), rr.bottomLeft()); // Use a colour only about 20% lighter than black, rather than the 50% we use in gGradientFromQColor // and is used in darker()/lighter(), so that it is distinguished a bit better from grey non-part tracks. //c.setRgba(64, 64, 64, c.alpha()); - gradient.setColorAt(0, QColor(51, 51, 51, config.globalAlphaBlend)); + gradient.setColorAt(0, QColor(51, 51, 51, MusEConfig::config.globalAlphaBlend)); gradient.setColorAt(1, c); brush = QBrush(gradient); } @@ -1837,7 +1837,7 @@ void PartCanvas::drawItem(QPainter& p, const CItem* item, const QRect& rect) if (part->mute()) { QColor c(Qt::white); - c.setAlpha(config.globalAlphaBlend); + c.setAlpha(MusEConfig::config.globalAlphaBlend); QLinearGradient gradient(rr.topLeft(), rr.bottomLeft()); gradient.setColorAt(0, c); gradient.setColorAt(1, c.darker()); @@ -1845,8 +1845,8 @@ void PartCanvas::drawItem(QPainter& p, const CItem* item, const QRect& rect) } else { - QColor c(config.partColors[cidx]); - c.setAlpha(config.globalAlphaBlend); + QColor c(MusEConfig::config.partColors[cidx]); + c.setAlpha(MusEConfig::config.globalAlphaBlend); brush = QBrush(gGradientFromQColor(c, rr.topLeft(), rr.bottomLeft())); } @@ -1937,7 +1937,7 @@ void PartCanvas::drawItem(QPainter& p, const CItem* item, const QRect& rect) // int part_r, part_g, part_b, brightness, color_brightness; - config.partColors[cidx].getRgb(&part_r, &part_g, &part_b); + MusEConfig::config.partColors[cidx].getRgb(&part_r, &part_g, &part_b); brightness = part_r*29 + part_g*59 + part_b*12; //if ((brightness < 12000 || part->selected()) && !part->mute() && !item->isMoving()) // color_brightness=223; // too dark: use lighter color @@ -1947,7 +1947,7 @@ void PartCanvas::drawItem(QPainter& p, const CItem* item, const QRect& rect) color_brightness=96; //0; // too light: use dark color else color_brightness=180; //255; // too dark: use lighter color - QColor c(color_brightness,color_brightness,color_brightness, config.globalAlphaBlend); + QColor c(color_brightness,color_brightness,color_brightness, MusEConfig::config.globalAlphaBlend); p.setBrush(QBrush(gGradientFromQColor(c, rr.topLeft(), rr.bottomLeft()))); //p.setBrush(QBrush(c)); if(het & Part::RightEventsHidden) @@ -2024,7 +2024,7 @@ void PartCanvas::drawItem(QPainter& p, const CItem* item, const QRect& rect) // Works great but requires clones be drawn with the highest priority on top of all other parts, in Canvas::draw. // - QPen pen(part->selected() ? config.partColors[i] : Qt::black, 2.0, clone ? Qt::DotLine : Qt::SolidLine); + QPen pen(part->selected() ? MusEConfig::config.partColors[i] : Qt::black, 2.0, clone ? Qt::DotLine : Qt::SolidLine); pen.setCosmetic(true); p.setPen(pen); p.setBrush(Qt::NoBrush); @@ -2037,7 +2037,7 @@ void PartCanvas::drawItem(QPainter& p, const CItem* item, const QRect& rect) p.setBrush(Qt::NoBrush); - QColor pc((part->mute() || item->isMoving())? Qt::white : config.partColors[cidx]); + QColor pc((part->mute() || item->isMoving())? Qt::white : MusEConfig::config.partColors[cidx]); QPen penSelect1H(pc); QPen penSelect2H(pc, 2.0); QPen penSelect1V(pc); @@ -2158,7 +2158,7 @@ void PartCanvas::drawItem(QPainter& p, const CItem* item, const QRect& rect) #endif - if (config.canvasShowPartType & 1) { // show names + if (MusEConfig::config.canvasShowPartType & 1) { // show names // draw name // FN: Set text color depending on part color (black / white) int part_r, part_g, part_b, brightness; @@ -2167,11 +2167,11 @@ void PartCanvas::drawItem(QPainter& p, const CItem* item, const QRect& rect) //QRect rr = map(r); QRect tr = rr; tr.setX(tr.x() + 3); - gGradientFromQColor(config.partColors[cidx], tr.topLeft(), tr.bottomLeft()).stops().last().second.getRgb(&part_r, &part_g, &part_b); + gGradientFromQColor(MusEConfig::config.partColors[cidx], tr.topLeft(), tr.bottomLeft()).stops().last().second.getRgb(&part_r, &part_g, &part_b); brightness = part_r*29 + part_g*59 + part_b*12; //bool rev = (brightness < 12000 || part->selected()) && !part->mute() && !item->isMoving(); bool rev = brightness >= 12000 && !part->selected(); - p.setFont(config.fonts[1]); + p.setFont(MusEConfig::config.fonts[1]); if (rev) p.setPen(Qt::white); else @@ -2197,8 +2197,8 @@ void PartCanvas::drawMoving(QPainter& p, const CItem* item, const QRect&) { p.setPen( Qt::black); Part* part = ((NPart*)item)->part(); - QColor c(part->mute() ? Qt::white : config.partColors[part->colorIndex()]); - //c.setAlpha(config.globalAlphaBlend); + QColor c(part->mute() ? Qt::white : MusEConfig::config.partColors[part->colorIndex()]); + //c.setAlpha(MusEConfig::config.globalAlphaBlend); c.setAlpha(128); // Fix this regardless of global setting. Should be OK. p.setBrush(c); p.drawRect(item->mp().x(), item->mp().y(), item->width(), item->height()); @@ -2218,7 +2218,7 @@ void PartCanvas::drawMidiPart(QPainter& p, const QRect&, EventList* events, Midi if(pt) { int part_r, part_g, part_b, brightness; - config.partColors[pt->colorIndex()].getRgb(&part_r, &part_g, &part_b); + MusEConfig::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()) && !pt->mute()) // color_brightness=192; // too dark: use lighter color @@ -2232,7 +2232,7 @@ void PartCanvas::drawMidiPart(QPainter& p, const QRect&, EventList* events, Midi else color_brightness=80; - if (config.canvasShowPartType & 2) { // show events + if (MusEConfig::config.canvasShowPartType & 2) { // show events p.setPen(QColor(color_brightness,color_brightness,color_brightness)); // Do not allow this, causes segfault. if(from <= to) @@ -2242,11 +2242,11 @@ void PartCanvas::drawMidiPart(QPainter& p, const QRect&, EventList* events, Midi for (iEvent i = events->lower_bound(from); i != ito; ++i) { EventType type = i->second.type(); if ( - ((config.canvasShowPartEvent & 1) && (type == Note)) - || ((config.canvasShowPartEvent & 2) && (type == PAfter)) - || ((config.canvasShowPartEvent & 4) && (type == Controller)) - || ((config.canvasShowPartEvent &16) && (type == CAfter)) - || ((config.canvasShowPartEvent &64) && (type == Sysex || type == Meta)) + ((MusEConfig::config.canvasShowPartEvent & 1) && (type == Note)) + || ((MusEConfig::config.canvasShowPartEvent & 2) && (type == PAfter)) + || ((MusEConfig::config.canvasShowPartEvent & 4) && (type == Controller)) + || ((MusEConfig::config.canvasShowPartEvent &16) && (type == CAfter)) + || ((MusEConfig::config.canvasShowPartEvent &64) && (type == Sysex || type == Meta)) ) { int t = i->first + pTick; int th = mt->height(); @@ -2341,7 +2341,7 @@ void PartCanvas::drawMidiPart(QPainter& p, const QRect&, EventList* events, Midi int highest_pitch=0; map<int,int> y_mapper; - if (config.canvasShowPartType & 4) //y-stretch? + if (MusEConfig::config.canvasShowPartType & 4) //y-stretch? { for (iEvent i = events->begin(); i != events->end(); ++i) { @@ -2379,7 +2379,7 @@ void PartCanvas::drawMidiPart(QPainter& p, const QRect&, EventList* events, Midi highest_pitch++; } - if (heavyDebugMsg) + if (MusEGlobal::heavyDebugMsg) { if (!isdrum) printf("DEBUG: arranger: cakewalk enabled, y-stretching from %i to %i. eventlist=%p\n",lowest_pitch, highest_pitch, events); @@ -2401,7 +2401,7 @@ void PartCanvas::drawMidiPart(QPainter& p, const QRect&, EventList* events, Midi for (int cnt=0;cnt<127;cnt++) y_mapper[cnt]=cnt; - if (heavyDebugMsg) printf("DEBUG: arranger: cakewalk enabled, y-stretch disabled\n"); + if (MusEGlobal::heavyDebugMsg) printf("DEBUG: arranger: cakewalk enabled, y-stretch disabled\n"); } p.setPen(QColor(color_brightness,color_brightness,color_brightness)); @@ -3000,7 +3000,7 @@ void PartCanvas::dragEnterEvent(QDragEnterEvent* event) void PartCanvas::viewDropEvent(QDropEvent* event) { - if (debugMsg) + if (MusEGlobal::debugMsg) printf("void PartCanvas::viewDropEvent(QDropEvent* event)\n"); if (event->source() == this) { printf("local DROP\n"); @@ -3017,7 +3017,7 @@ void PartCanvas::viewDropEvent(QDropEvent* event) type = 2; else { - if(debugMsg && event->mimeData()->formats().size() != 0) + if(MusEGlobal::debugMsg && event->mimeData()->formats().size() != 0) printf("Drop with unknown format. First format:<%s>\n", event->mimeData()->formats()[0].toLatin1().constData()); //event->ignore(); // TODO CHECK Tim. return; @@ -3080,13 +3080,13 @@ void PartCanvas::viewDropEvent(QDropEvent* event) (text.endsWith(".ogg", Qt::CaseInsensitive)))) { unsigned tick = x; - muse->importWaveToTrack(text, tick, track); + MusEGlobal::muse->importWaveToTrack(text, tick, track); } // Changed by T356. Support mixed .mpt files. else if ((track->isMidiTrack() || track->type() == Track::WAVE) && text.endsWith(".mpt", Qt::CaseInsensitive)) { unsigned tick = x; - muse->importPartToTrack(text, tick, track); + MusEGlobal::muse->importPartToTrack(text, tick, track); } } else if(text.endsWith(".med",Qt::CaseInsensitive)) @@ -3139,13 +3139,13 @@ void PartCanvas::drawCanvas(QPainter& p, const QRect& rect) ////////// // GRID // ////////// - QColor baseColor(config.partCanvasBg.light(104)); + QColor baseColor(MusEConfig::config.partCanvasBg.light(104)); p.setPen(baseColor); //-------------------------------- // vertical lines //------------------------------- - if (config.canvasShowGrid) { + if (MusEConfig::config.canvasShowGrid) { int bar, beat; unsigned tick; @@ -3166,17 +3166,17 @@ void PartCanvas::drawCanvas(QPainter& p, const QRect& rect) // append int noDivisors=0; - if (*_raster == config.division *2) // 1/2 + if (*_raster == MusEConfig::config.division *2) // 1/2 noDivisors=2; - else if (*_raster== config.division) // 1/4 + else if (*_raster== MusEConfig::config.division) // 1/4 noDivisors=4; - else if (*_raster==config.division/2) // 1/8 + else if (*_raster==MusEConfig::config.division/2) // 1/8 noDivisors=8; - else if (*_raster==config.division/4) // 1/16 + else if (*_raster==MusEConfig::config.division/4) // 1/16 noDivisors=16; - else if (*_raster==config.division/8) // 1/16 + else if (*_raster==MusEConfig::config.division/8) // 1/16 noDivisors=32; - else if (*_raster==config.division/16) // 1/16 + else if (*_raster==MusEConfig::config.division/16) // 1/16 noDivisors=64; int r = *_raster; @@ -3215,7 +3215,7 @@ void PartCanvas::drawCanvas(QPainter& p, const QRect& rect) th = track->height(); if (!th) continue; - if (config.canvasShowGrid && (track->isMidiTrack() || track->type() == Track::WAVE)) // Tim. + if (MusEConfig::config.canvasShowGrid && (track->isMidiTrack() || track->type() == Track::WAVE)) // Tim. { p.setPen(baseColor.dark(130)); //p.drawLine(x, yy + th, x + w, yy + th); @@ -3282,7 +3282,7 @@ void PartCanvas::drawTopItem(QPainter& p, const QRect& rect) int mw = mr.width(); int mh = mr.height(); - QColor baseColor(config.partCanvasBg.light(104)); + QColor baseColor(MusEConfig::config.partCanvasBg.light(104)); //p.setPen(baseColor); p.save(); @@ -3347,8 +3347,8 @@ void PartCanvas::drawTopItem(QPainter& p, const QRect& rect) if (track->recordFlag()) { QPen pen(Qt::black, 0, Qt::SolidLine); p.setPen(pen); - QColor c(config.partColors[0]); - c.setAlpha(config.globalAlphaBlend); + QColor c(MusEConfig::config.partColors[0]); + c.setAlpha(MusEConfig::config.globalAlphaBlend); QLinearGradient gradient(QPoint(startx,yPos), QPoint(startx,yPos+th)); gradient.setColorAt(0, c); gradient.setColorAt(1, c.darker()); @@ -3426,7 +3426,7 @@ void PartCanvas::drawAudioTrack(QPainter& p, const QRect& r, const QRect& bbox, p.setPen(Qt::black); QColor c(Qt::gray); - c.setAlpha(config.globalAlphaBlend); + c.setAlpha(MusEConfig::config.globalAlphaBlend); //QLinearGradient gradient(r.topLeft(), r.bottomLeft()); QLinearGradient gradient(mex + 1, mey + 1, mex + 1, mey + meh - 1); // Inside the border gradient.setColorAt(0, c); @@ -3730,7 +3730,7 @@ void PartCanvas::controllerChanged(Track* t) void PartCanvas::processAutomationMovements(QPoint pos, bool addPoint) { - if (_tool == AutomationTool) { + if (_tool == MusEWidget::AutomationTool) { if (!automation.moveController) { // currently nothing going lets's check for some action. Track * t = y2Track(pos.y()); diff --git a/muse2/muse/arranger/pcanvas.h b/muse2/muse/arranger/pcanvas.h index 058fd5ec..4f154a97 100644 --- a/muse2/muse/arranger/pcanvas.h +++ b/muse2/muse/arranger/pcanvas.h @@ -77,7 +77,7 @@ class CtrlVal; // PartCanvas //--------------------------------------------------------- -class PartCanvas : public Canvas { +class PartCanvas : public MusEWidget::Canvas { Q_OBJECT int* _raster; TrackList* tracks; diff --git a/muse2/muse/arranger/tlist.cpp b/muse2/muse/arranger/tlist.cpp index ab54ab40..4199e135 100644 --- a/muse2/muse/arranger/tlist.cpp +++ b/muse2/muse/arranger/tlist.cpp @@ -66,7 +66,9 @@ #include "dssihost.h" #endif +namespace MusEApp { extern QMenu* populateAddSynth(QWidget* parent); +} static const int MIN_TRACKHEIGHT = 20; static const int WHEEL_DELTA = 120; @@ -103,7 +105,7 @@ TList::TList(Header* hdr, QWidget* parent, const char* name) resizeFlag = false; connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); - connect(muse, SIGNAL(configChanged()), SLOT(redraw())); + connect(MusEGlobal::muse, SIGNAL(configChanged()), SLOT(redraw())); } //--------------------------------------------------------- @@ -168,7 +170,7 @@ void TList::paint(const QRect& r) QPainter p(this); if (bgPixmap.isNull()) - p.fillRect(rect, config.trackBg); + p.fillRect(rect, MusEConfig::config.trackBg); else p.drawTiledPixmap(rect, bgPixmap, QPoint(rect.x(), ypos + rect.y())); p.setClipRegion(rect); @@ -203,35 +205,35 @@ void TList::paint(const QRect& r) // QColor bg; if (track->selected()) { - bg = config.selectTrackBg; + bg = MusEConfig::config.selectTrackBg; //p.setPen(palette().active().text()); - p.setPen(config.selectTrackFg); + p.setPen(MusEConfig::config.selectTrackFg); } else { switch(type) { case Track::MIDI: - bg = config.midiTrackBg; + bg = MusEConfig::config.midiTrackBg; break; case Track::DRUM: - bg = config.drumTrackBg; + bg = MusEConfig::config.drumTrackBg; break; case Track::WAVE: - bg = config.waveTrackBg; + bg = MusEConfig::config.waveTrackBg; break; case Track::AUDIO_OUTPUT: - bg = config.outputTrackBg; + bg = MusEConfig::config.outputTrackBg; break; case Track::AUDIO_INPUT: - bg = config.inputTrackBg; + bg = MusEConfig::config.inputTrackBg; break; case Track::AUDIO_GROUP: - bg = config.groupTrackBg; + bg = MusEConfig::config.groupTrackBg; break; case Track::AUDIO_AUX: - bg = config.auxTrackBg; + bg = MusEConfig::config.auxTrackBg; break; case Track::AUDIO_SOFTSYNTH: - bg = config.synthTrackBg; + bg = MusEConfig::config.synthTrackBg; break; } p.setPen(palette().color(QPalette::Active, QPalette::Text)); @@ -627,7 +629,7 @@ void TList::portsPopupMenu(Track* t, int x, int y) // Compiler complains if simple cast from Track to SynthI... midiSeq->msgSetMidiDevice(&midiPorts[n], (midiPorts[n].device() == md) ? 0 : md); - muse->changeConfig(true); // save configuration file + MusEGlobal::muse->changeConfig(true); // save configuration file //audio->msgIdle(false); song->update(); @@ -862,7 +864,7 @@ void TList::moveSelection(int n) // rec enable track if expected TrackList recd = getRecEnabledTracks(); - if (recd.size() == 1 && config.moveArmedCheckBox) { // one rec enabled track, move rec enabled with selection + if (recd.size() == 1 && MusEConfig::config.moveArmedCheckBox) { // one rec enabled track, move rec enabled with selection song->setRecordFlag((Track*)recd.front(),false); song->setRecordFlag((*t),true); } @@ -1015,7 +1017,7 @@ void TList::mousePressEvent(QMouseEvent* ev) aaux->setData(Track::AUDIO_AUX); // Create a sub-menu and fill it with found synth types. Make p the owner. - QMenu* synp = populateAddSynth(p); + QMenu* synp = MusEApp::populateAddSynth(p); synp->setIcon(*synthIcon); synp->setTitle(QT_TRANSLATE_NOOP("@default", "Add Synth")); @@ -1055,7 +1057,7 @@ void TList::mousePressEvent(QMouseEvent* ev) if (dev==0) { midiSeq->msgSetMidiDevice(port, (SynthI*)t); - muse->changeConfig(true); // save configuration file + MusEGlobal::muse->changeConfig(true); // save configuration file song->update(); break; } @@ -1194,7 +1196,7 @@ void TList::mousePressEvent(QMouseEvent* ev) if (!t->isMidiTrack()) { if (t->type() == Track::AUDIO_OUTPUT) { if (val && t->recordFlag() == false) { - muse->bounceToFile((AudioOutput*)t); + MusEGlobal::muse->bounceToFile((AudioOutput*)t); } audio->msgSetRecord((AudioOutput*)t, val); if (!((AudioOutput*)t)->recFile()) @@ -1275,7 +1277,7 @@ void TList::mousePressEvent(QMouseEvent* ev) // rec enable track if expected TrackList recd = getRecEnabledTracks(); - if (recd.size() == 1 && config.moveArmedCheckBox) { // one rec enabled track, move rec enabled with selection + if (recd.size() == 1 && MusEConfig::config.moveArmedCheckBox) { // one rec enabled track, move rec enabled with selection song->setRecordFlag((Track*)recd.front(),false); song->setRecordFlag(t,true); } @@ -1406,7 +1408,7 @@ void TList::selectTrack(Track* tr) // rec enable track if expected TrackList recd = getRecEnabledTracks(); - if (recd.size() == 1 && config.moveArmedCheckBox) { // one rec enabled track, move rec enabled with selection + if (recd.size() == 1 && MusEConfig::config.moveArmedCheckBox) { // one rec enabled track, move rec enabled with selection song->setRecordFlag((Track*)recd.front(),false); song->setRecordFlag(tr,true); } diff --git a/muse2/muse/audio.cpp b/muse2/muse/audio.cpp index 39478a86..09acb425 100644 --- a/muse2/muse/audio.cpp +++ b/muse2/muse/audio.cpp @@ -179,10 +179,10 @@ extern bool initJackAudio(); bool Audio::start() { - //process(segmentSize); // warm up caches + //process(MusEGlobal::segmentSize); // warm up caches state = STOP; _loopCount = 0; - muse->setHeartBeat(); + MusEGlobal::muse->setHeartBeat(); if (audioDevice) { // Added by Tim. p3.3.6 //_running = true; @@ -218,7 +218,7 @@ bool Audio::start() } } - audioDevice->start(realTimePriority); + audioDevice->start(MusEGlobal::realTimePriority); _running = true; @@ -336,7 +336,7 @@ void Audio::process(unsigned frames) // extern int watchAudio; // ++watchAudio; // make a simple watchdog happy - if (!checkAudioDevice()) return; + if (!MusEGlobal::checkAudioDevice()) return; if (msg) { processMsg(msg); int sn = msg->serialNo; @@ -358,7 +358,7 @@ void Audio::process(unsigned frames) int jackState = audioDevice->getState(); - //if(debugMsg) + //if(MusEGlobal::debugMsg) // printf("Audio::process Current state:%s jackState:%s\n", audioStates[state], audioStates[jackState]); if (state == START_PLAY && jackState == PLAY) { @@ -417,7 +417,7 @@ void Audio::process(unsigned frames) AudioAux* a = (AudioAux*)((*al)[i]); float** dst = a->sendBuffer(); for (int ch = 0; ch < a->channels(); ++ch) - memset(dst[ch], 0, sizeof(float) * segmentSize); + memset(dst[ch], 0, sizeof(float) * MusEGlobal::segmentSize); } for (iAudioOutput i = ol->begin(); i != ol->end(); ++i) @@ -442,7 +442,7 @@ void Audio::process(unsigned frames) && !(song->record() || _bounce || song->loop())) { - //if(debugMsg) + //if(MusEGlobal::debugMsg) // printf("Audio::process curTickPos >= song->len\n"); audioDevice->stopTransport(); @@ -528,7 +528,7 @@ void Audio::process(unsigned frames) void Audio::process1(unsigned samplePos, unsigned offset, unsigned frames) { - if (midiSeqRunning) { + if (MusEGlobal::midiSeqRunning) { processMidi(); } //midiSeq->msgProcess(); @@ -703,14 +703,14 @@ void Audio::processMsg(AudioMsg* msg) break; case AUDIO_SET_SEG_SIZE: - segmentSize = msg->ival; - sampleRate = msg->iival; + MusEGlobal::segmentSize = msg->ival; + MusEGlobal::sampleRate = msg->iival; #if 0 //TODO - audioOutput.segmentSizeChanged(); + audioOutput.MusEGlobal::segmentSizeChanged(); for (int i = 0; i < mixerGroups; ++i) - audioGroups[i].segmentSizeChanged(); + audioGroups[i].MusEGlobal::segmentSizeChanged(); for (iSynthI ii = synthiInstances.begin(); ii != synthiInstances.end();++ii) - (*ii)->segmentSizeChanged(); + (*ii)->MusEGlobal::segmentSizeChanged(); #endif break; @@ -765,7 +765,7 @@ void Audio::processMsg(AudioMsg* msg) case SEQM_SET_TEMPO: song->processMsg(msg); if (isPlaying()) { - if (!checkAudioDevice()) return; + if (!MusEGlobal::checkAudioDevice()) return; _pos.setTick(curTickPos); int samplePos = _pos.frame(); syncFrame = audioDevice->framePos(); @@ -806,7 +806,7 @@ void Audio::processMsg(AudioMsg* msg) void Audio::seek(const Pos& p) { if (_pos == p) { - if(debugMsg) + if(MusEGlobal::debugMsg) printf("Audio::seek already there\n"); return; } @@ -814,7 +814,7 @@ void Audio::seek(const Pos& p) // p3.3.23 //printf("Audio::seek frame:%d\n", p.frame()); _pos = p; - if (!checkAudioDevice()) return; + if (!MusEGlobal::checkAudioDevice()) return; syncFrame = audioDevice->framePos(); frameOffset = syncFrame - _pos.frame(); curTickPos = _pos.tick(); @@ -862,7 +862,7 @@ void Audio::seek(const Pos& p) //if(port < -1 || port > MIDI_PORTS) // continue; - int beat = (curTickPos * 4) / config.division; + int beat = (curTickPos * 4) / MusEConfig::config.division; bool isPlaying=false; if(state == PLAY) @@ -902,7 +902,7 @@ void Audio::seek(const Pos& p) if(port < -1 || port > MIDI_PORTS) continue; - int beat = (curTickPos * 4) / config.division; + int beat = (curTickPos * 4) / MusEConfig::config.division; bool isPlaying=false; if(state == PLAY) @@ -983,7 +983,7 @@ void Audio::startRolling() { // Changed by Tim. p3.3.8 //startRecordPos = _pos; - if (debugMsg) + if (MusEGlobal::debugMsg) printf("startRolling - loopCount=%d, _pos=%d\n", _loopCount, _pos.tick()); if(_loopCount == 0) { @@ -1109,7 +1109,7 @@ void Audio::startRolling() } */ - if (precountEnableFlag + if (MusEGlobal::precountEnableFlag && song->click() && !extSyncFlag.value() && song->record()) { @@ -1164,7 +1164,7 @@ void Audio::startRolling() void Audio::stopRolling() { - //if(debugMsg) + //if(MusEGlobal::debugMsg) // printf("Audio::stopRolling state %s\n", audioStates[state]); state = STOP; @@ -1220,7 +1220,7 @@ void Audio::stopRolling() // 0, 0, 0, 0, 0 // }; // int frame = tempomap.tick2frame(curTickPos); - // MTC mtc(double(frame) / double(sampleRate)); + // MTC mtc(double(frame) / double(MusEGlobal::sampleRate)); // mmcPos[6] = mtc.h() | (mtcType << 5); // mmcPos[7] = mtc.m(); // mmcPos[8] = mtc.s(); @@ -1233,7 +1233,7 @@ void Audio::stopRolling() // send STOP and // "set song position pointer" // syncPort->sendStop(); - // syncPort->sendSongpos(curTickPos * 4 / config.division); + // syncPort->sendSongpos(curTickPos * 4 / MusEConfig::config.division); // } for(int port = 0; port < MIDI_PORTS; ++port) { @@ -1260,7 +1260,7 @@ void Audio::stopRolling() // p3.3.31 /* int frame = tempomap.tick2frame(curTickPos); - MTC mtc(double(frame) / double(sampleRate)); + MTC mtc(double(frame) / double(MusEGlobal::sampleRate)); */ //mmcPos[6] = mtc.h() | (mtcType << 5); @@ -1297,7 +1297,7 @@ void Audio::stopRolling() // Hmm, is this required? Seems to make other devices unhappy. /* if(!si.sendContNotStart()) - mp->sendSongpos(curTickPos * 4 / config.division); + mp->sendSongpos(curTickPos * 4 / MusEConfig::config.division); */ } @@ -1336,7 +1336,7 @@ void Audio::stopRolling() 0, 0, 0, 0, 0 }; int frame = tempomap.tick2frame(curTickPos); - MTC mtc(double(frame) / double(sampleRate)); + MTC mtc(double(frame) / double(MusEGlobal::sampleRate)); mmcPos[6] = mtc.h() | (mtcType << 5); mmcPos[7] = mtc.m(); mmcPos[8] = mtc.s(); @@ -1368,7 +1368,7 @@ void Audio::stopRolling() // Go through the port... { mp->sendStop(); - mp->sendSongpos(curTickPos * 4 / config.division); + mp->sendSongpos(curTickPos * 4 / MusEConfig::config.division); } else // Send straight to the device... Copied from MidiPort. @@ -1376,7 +1376,7 @@ void Audio::stopRolling() MidiPlayEvent event(0, 0, 0, ME_STOP, 0, 0); dev->putEvent(event); event.setType(ME_SONGPOS); - event.setA(curTickPos * 4 / config.division); + event.setA(curTickPos * 4 / MusEConfig::config.division); dev->putEvent(event); } } @@ -1400,7 +1400,7 @@ void Audio::stopRolling() void Audio::recordStop() { - if (debugMsg) + if (MusEGlobal::debugMsg) printf("recordStop - startRecordPos=%d\n", startRecordPos.tick()); audio->msgIdle(true); // gain access to all data structures @@ -1434,9 +1434,9 @@ void Audio::recordStop() // resolve NoteOff events, Controller etc. //--------------------------------------------------- - //buildMidiEventList(el, mpel, mt, config.division, true); + //buildMidiEventList(el, mpel, mt, MusEConfig::config.division, true); // Do SysexMeta. Do loops. - buildMidiEventList(el, mpel, mt, config.division, true, true); + buildMidiEventList(el, mpel, mt, MusEConfig::config.division, true, true); song->cmdAddRecordedEvents(mt, el, startRecordPos.tick()); el->clear(); mpel->clear(); @@ -1473,7 +1473,7 @@ void Audio::recordStop() unsigned int Audio::curFrame() const { - return lrint((curTime() - syncTime) * sampleRate) + syncFrame; + return lrint((curTime() - syncTime) * MusEGlobal::sampleRate) + syncFrame; } //--------------------------------------------------------- diff --git a/muse2/muse/audioconvert.cpp b/muse2/muse/audioconvert.cpp index 95c97883..6b67f30e 100644 --- a/muse2/muse/audioconvert.cpp +++ b/muse2/muse/audioconvert.cpp @@ -142,7 +142,7 @@ off_t AudioConverter::readAudio(SndFileR& f, unsigned offset, float** buffer, in off_t frame = offset; // _spos is added before the call. unsigned fsrate = f.samplerate(); - bool resample = isValid() && ((unsigned)sampleRate != fsrate); + bool resample = isValid() && ((unsigned)MusEGlobal::sampleRate != fsrate); // No resampling needed? if(!resample) @@ -159,7 +159,7 @@ off_t AudioConverter::readAudio(SndFileR& f, unsigned offset, float** buffer, in { // Sample rates are different. Seek to a calculated 'sample rate ratio factored' position. - double srcratio = (double)fsrate / (double)sampleRate; + double srcratio = (double)fsrate / (double)MusEGlobal::sampleRate; //long inSize = long((double)frames * _src_ratio) + 1 // From MusE-2 file converter. off_t newfr = (off_t)floor(((double)frame * srcratio)); // From simplesynth. @@ -343,13 +343,13 @@ off_t SRCAudioConverter::process(SndFileR& f, float** buffer, int channel, int n // off_t frame = offset; // _spos is added before the call. unsigned fsrate = f.samplerate(); - //bool resample = src_state && ((unsigned)sampleRate != fsrate); -// bool resample = isValid() && ((unsigned)sampleRate != fsrate); + //bool resample = src_state && ((unsigned)MusEGlobal::sampleRate != fsrate); +// bool resample = isValid() && ((unsigned)MusEGlobal::sampleRate != fsrate); - if((sampleRate == 0) || (fsrate == 0)) + if((MusEGlobal::sampleRate == 0) || (fsrate == 0)) { #ifdef AUDIOCONVERT_DEBUG - printf("SRCAudioConverter::process Error: sampleRate or file samplerate is zero!\n"); + printf("SRCAudioConverter::process Error: MusEGlobal::sampleRate or file samplerate is zero!\n"); #endif return _sfCurFrame; } @@ -357,7 +357,7 @@ off_t SRCAudioConverter::process(SndFileR& f, float** buffer, int channel, int n SRC_DATA srcdata; int fchan = f.channels(); // Ratio is defined as output sample rate over input samplerate. - double srcratio = (double)sampleRate / (double)fsrate; + double srcratio = (double)MusEGlobal::sampleRate / (double)fsrate; // Extra input compensation. long inComp = 1; @@ -369,7 +369,7 @@ off_t SRCAudioConverter::process(SndFileR& f, float** buffer, int channel, int n //long inSize = (long)floor(((double)outSize / srcratio)); // From simplesynth. //long inFrames = (long)floor(((double)outFrames / srcratio)); // From simplesynth. long inFrames = (long)ceil(((double)outFrames / srcratio)) + inComp; // From simplesynth. - //long inFrames = (long)floor(double(outFrames * sfinfo.samplerate) / double(sampleRate)); // From simplesynth. + //long inFrames = (long)floor(double(outFrames * sfinfo.samplerate) / double(MusEGlobal::sampleRate)); // From simplesynth. long inSize = inFrames * fchan; //long inSize = inFrames * channel; @@ -583,7 +583,7 @@ RubberBandAudioConverter::RubberBandAudioConverter(int channels, int options) : _rbs = 0; _channels = channels; - _rbs = new RubberBandStretcher(sampleRate, _channels, _options); // , initialTimeRatio = 1.0, initialPitchScale = 1.0 + _rbs = new RubberBandStretcher(MusEGlobal::sampleRate, _channels, _options); // , initialTimeRatio = 1.0, initialPitchScale = 1.0 } RubberBandAudioConverter::~RubberBandAudioConverter() @@ -605,7 +605,7 @@ void RubberBandAudioConverter::setChannels(int ch) _rbs = 0; _channels = ch; - _rbs = new RubberBandStretcher(sampleRate, _channels, _options); // , initialTimeRatio = 1.0, initialPitchScale = 1.0 + _rbs = new RubberBandStretcher(MusEGlobal::sampleRate, _channels, _options); // , initialTimeRatio = 1.0, initialPitchScale = 1.0 } void RubberBandAudioConverter::reset() @@ -639,13 +639,13 @@ off_t RubberBandAudioConverter::process(SndFileR& f, float** buffer, int channel // off_t frame = offset; // _spos is added before the call. unsigned fsrate = f.samplerate(); - //bool resample = src_state && ((unsigned)sampleRate != fsrate); -// bool resample = isValid() && ((unsigned)sampleRate != fsrate); + //bool resample = src_state && ((unsigned)MusEGlobal::sampleRate != fsrate); +// bool resample = isValid() && ((unsigned)MusEGlobal::sampleRate != fsrate); - if((sampleRate == 0) || (fsrate == 0)) + if((MusEGlobal::sampleRate == 0) || (fsrate == 0)) { #ifdef AUDIOCONVERT_DEBUG - printf("RubberBandAudioConverter::process Error: sampleRate or file samplerate is zero!\n"); + printf("RubberBandAudioConverter::process Error: MusEGlobal::sampleRate or file samplerate is zero!\n"); #endif return _sfCurFrame; } @@ -653,7 +653,7 @@ off_t RubberBandAudioConverter::process(SndFileR& f, float** buffer, int channel // SRC_DATA srcdata; int fchan = f.channels(); // Ratio is defined as output sample rate over input samplerate. - double srcratio = (double)sampleRate / (double)fsrate; + double srcratio = (double)MusEGlobal::sampleRate / (double)fsrate; // Extra input compensation. long inComp = 1; @@ -665,7 +665,7 @@ off_t RubberBandAudioConverter::process(SndFileR& f, float** buffer, int channel //long inSize = (long)floor(((double)outSize / srcratio)); // From simplesynth. //long inFrames = (long)floor(((double)outFrames / srcratio)); // From simplesynth. long inFrames = (long)ceil(((double)outFrames / srcratio)) + inComp; // From simplesynth. - //long inFrames = (long)floor(double(outFrames * sfinfo.samplerate) / double(sampleRate)); // From simplesynth. + //long inFrames = (long)floor(double(outFrames * sfinfo.samplerate) / double(MusEGlobal::sampleRate)); // From simplesynth. long inSize = inFrames * fchan; //long inSize = inFrames * channel; diff --git a/muse2/muse/audioprefetch.cpp b/muse2/muse/audioprefetch.cpp index 2f551fd6..cfdbb213 100644 --- a/muse2/muse/audioprefetch.cpp +++ b/muse2/muse/audioprefetch.cpp @@ -183,7 +183,7 @@ void AudioPrefetch::prefetch(bool doSeek) if (song->loop() && !audio->bounce() && !extSyncFlag.value()) { const Pos& loop = song->rPos(); unsigned n = loop.frame() - writePos; - if (n < segmentSize) { + if (n < MusEGlobal::segmentSize) { unsigned lpos = song->lPos().frame(); // adjust loop start so we get exact loop len if (n > lpos) @@ -203,18 +203,18 @@ void AudioPrefetch::prefetch(bool doSeek) int ch = track->channels(); float* bp[ch]; // printf("prefetch %d\n", writePos); - if (track->prefetchFifo()->getWriteBuffer(ch, segmentSize, bp, writePos)) { + if (track->prefetchFifo()->getWriteBuffer(ch, MusEGlobal::segmentSize, bp, writePos)) { // printf("AudioPrefetch::prefetch No write buffer!\n"); // p3.3.46 Was getting this... continue; } - //track->fetchData(writePos, segmentSize, bp); - track->fetchData(writePos, segmentSize, bp, doSeek); + //track->fetchData(writePos, MusEGlobal::segmentSize, bp); + track->fetchData(writePos, MusEGlobal::segmentSize, bp, doSeek); // p3.3.41 - //fprintf(stderr, "AudioPrefetch::prefetch data: segmentSize:%ld %e %e %e %e\n", segmentSize, bp[0][0], bp[0][1], bp[0][2], bp[0][3]); + //fprintf(stderr, "AudioPrefetch::prefetch data: MusEGlobal::segmentSize:%ld %e %e %e %e\n", MusEGlobal::segmentSize, bp[0][0], bp[0][1], bp[0][2], bp[0][3]); } - writePos += segmentSize; + writePos += MusEGlobal::segmentSize; } //--------------------------------------------------------- @@ -252,7 +252,7 @@ void AudioPrefetch::seek(unsigned seekTo) } bool isFirstPrefetch = true; - for (unsigned int i = 0; i < (fifoLength)-1; ++i)//prevent compiler warning: comparison of signed/unsigned + for (unsigned int i = 0; i < (MusEGlobal::fifoLength)-1; ++i)//prevent compiler warning: comparison of signed/unsigned { // Indicate do a seek command before read, but only on the first pass. // Changed by Tim. p3.3.17 diff --git a/muse2/muse/audiotrack.cpp b/muse2/muse/audiotrack.cpp index 62cc8edc..551b640d 100644 --- a/muse2/muse/audiotrack.cpp +++ b/muse2/muse/audiotrack.cpp @@ -112,16 +112,16 @@ AudioTrack::AudioTrack(TrackType t) // Changed by Tim. p3.3.15 //outBuffers = new float*[MAX_CHANNELS]; //for (int i = 0; i < MAX_CHANNELS; ++i) - // outBuffers[i] = new float[segmentSize]; + // outBuffers[i] = new float[MusEGlobal::segmentSize]; //for (int i = 0; i < MAX_CHANNELS; ++i) - // posix_memalign((void**)(outBuffers + i), 16, sizeof(float) * segmentSize); + // posix_memalign((void**)(outBuffers + i), 16, sizeof(float) * MusEGlobal::segmentSize); // Let's allocate it all in one block, and just point the remaining buffer pointers into the block // which allows faster one-shot buffer copying. // Nope. Nice but interferes with possibility we don't know if other buffers are contiguous (jack buffers, local stack buffers etc.). - //posix_memalign((void**)(outBuffers), 16, sizeof(float) * segmentSize * MAX_CHANNELS); + //posix_memalign((void**)(outBuffers), 16, sizeof(float) * MusEGlobal::segmentSize * MAX_CHANNELS); //for (int i = 0; i < MAX_CHANNELS; ++i) - // *(outBuffers + i) = sizeof(float) * segmentSize * i; + // *(outBuffers + i) = sizeof(float) * MusEGlobal::segmentSize * i; // p3.3.38 // Easy way, less desirable... Start out with enough for MAX_CHANNELS. Then multi-channel syntis can re-allocate, @@ -130,7 +130,7 @@ AudioTrack::AudioTrack(TrackType t) _totalOutChannels = MAX_CHANNELS; outBuffers = new float*[_totalOutChannels]; for (int i = 0; i < _totalOutChannels; ++i) - posix_memalign((void**)&outBuffers[i], 16, sizeof(float) * segmentSize); + posix_memalign((void**)&outBuffers[i], 16, sizeof(float) * MusEGlobal::segmentSize); // This is only set by multi-channel syntis... _totalInChannels = 0; @@ -159,9 +159,9 @@ AudioTrack::AudioTrack(const AudioTrack& t, bool cloneParts) // Changed by Tim. p3.3.15 //outBuffers = new float*[MAX_CHANNELS]; //for (int i = 0; i < MAX_CHANNELS; ++i) - // outBuffers[i] = new float[segmentSize]; + // outBuffers[i] = new float[MusEGlobal::segmentSize]; //for (int i = 0; i < MAX_CHANNELS; ++i) - // posix_memalign((void**)(outBuffers + i), 16, sizeof(float) * segmentSize); + // posix_memalign((void**)(outBuffers + i), 16, sizeof(float) * MusEGlobal::segmentSize); // p3.3.38 int chans = _totalOutChannels; @@ -170,7 +170,7 @@ AudioTrack::AudioTrack(const AudioTrack& t, bool cloneParts) chans = MAX_CHANNELS; outBuffers = new float*[chans]; for (int i = 0; i < chans; ++i) - posix_memalign((void**)&outBuffers[i], 16, sizeof(float) * segmentSize); + posix_memalign((void**)&outBuffers[i], 16, sizeof(float) * MusEGlobal::segmentSize); bufferPos = MAXINT; _recFile = t._recFile; @@ -565,10 +565,10 @@ void AudioTrack::processAutomationEvents() } } - // Done with the recorded automation event list. Clear it. + // Done with the recorded MusEGlobal::automation event list. Clear it. _recEvents.clear(); - // Try muse without this, so that the user can remain in automation write mode + // Try muse without this, so that the user can remain in MusEGlobal::automation write mode // after a stop. /* if (automationType() == AUTO_WRITE) @@ -742,7 +742,7 @@ double AudioTrack::volume() const if (cl == _controller.end()) return 0.0; - if (automation && + if (MusEGlobal::automation && automationType() != AUTO_OFF && _volumeEnCtrl && _volumeEn2Ctrl ) return cl->second->value(song->cPos().frame()); else @@ -774,7 +774,7 @@ double AudioTrack::pan() const if (cl == _controller.end()) return 0.0; - if (automation && + if (MusEGlobal::automation && automationType() != AUTO_OFF && _panEnCtrl && _panEn2Ctrl ) return cl->second->value(song->cPos().frame()); else @@ -805,7 +805,7 @@ double AudioTrack::pluginCtrlVal(int ctlID) const if (cl == _controller.end()) return 0.0; - if (automation && (automationType() != AUTO_OFF)) + if (MusEGlobal::automation && (automationType() != AUTO_OFF)) return cl->second->value(song->cPos().frame()); else return cl->second->curVal(); @@ -826,7 +826,7 @@ void AudioTrack::setPluginCtrlVal(int param, double val) void AudioTrack::recordAutomation(int n, double v) { - if(!automation) + if(!MusEGlobal::automation) return; if(audio->isPlaying()) _recEvents.push_back(CtrlRecVal(song->cPos().frame(), n, v)); @@ -849,7 +849,7 @@ void AudioTrack::recordAutomation(int n, double v) void AudioTrack::startAutoRecord(int n, double v) { - if(!automation) + if(!MusEGlobal::automation) return; if(audio->isPlaying()) { @@ -878,7 +878,7 @@ void AudioTrack::startAutoRecord(int n, double v) void AudioTrack::stopAutoRecord(int n, double v) { - if(!automation) + if(!MusEGlobal::automation) return; if(audio->isPlaying()) { @@ -899,7 +899,7 @@ void AudioTrack::writeProperties(int level, Xml& xml) const Track::writeProperties(level, xml); xml.intTag(level, "prefader", prefader()); xml.intTag(level, "sendMetronome", sendMetronome()); - xml.intTag(level, "automation", int(automationType())); + xml.intTag(level, "MusEGlobal::automation", int(automationType())); if (hasAuxSend()) { int naux = song->auxs()->size(); for (int idx = 0; idx < naux; ++idx) { @@ -1003,7 +1003,7 @@ bool AudioTrack::readProperties(Xml& xml, const QString& tag) _prefader = xml.parseInt(); else if (tag == "sendMetronome") _sendMetronome = xml.parseInt(); - else if (tag == "automation") + else if (tag == "MusEGlobal::automation") setAutomationType(AutomationType(xml.parseInt())); // Removed by T356 // "recfile" tag not saved anymore @@ -1014,7 +1014,7 @@ bool AudioTrack::readProperties(Xml& xml, const QString& tag) l->read(xml); // Since (until now) muse wrote a 'zero' for plugin controller current value - // in the XML file, we can't use that value, now that plugin automation is added. + // in the XML file, we can't use that value, now that plugin MusEGlobal::automation is added. // We must take the value from the plugin control value. // Otherwise we break all existing .med files with plugins, because the gui // controls would all be set to zero. @@ -1138,7 +1138,7 @@ void AudioTrack::mapRackPluginsToControllers() // No matter of the outcome of the above - rack position is not too critical - // making sure that each control has a controller is important. Otherwise they // are stuck at zero can't be adjusted. - // Muse med files created before the automation patches (before 0.9pre1) may have broken + // Muse med files created before the MusEGlobal::automation patches (before 0.9pre1) may have broken // controller sections, so this will allow more tolerance of them. for(int idx = 0; idx < PipelineDepth; idx++) { @@ -1356,7 +1356,7 @@ AudioInput::AudioInput(const AudioInput& t, bool cloneParts) AudioInput::~AudioInput() { - if (!checkAudioDevice()) return; + if (!MusEGlobal::checkAudioDevice()) return; for (int i = 0; i < _channels; ++i) if(jackPorts[i]) audioDevice->unregisterPort(jackPorts[i]); @@ -1433,7 +1433,7 @@ AudioOutput::AudioOutput(const AudioOutput& t, bool cloneParts) AudioOutput::~AudioOutput() { - if (!checkAudioDevice()) return; + if (!MusEGlobal::checkAudioDevice()) return; for (int i = 0; i < _channels; ++i) if(jackPorts[i]) audioDevice->unregisterPort(jackPorts[i]); @@ -1545,11 +1545,11 @@ AudioAux::AudioAux() //setChannels(2); // Changed by Tim. p3.3.15 //for (int i = 0; i < MAX_CHANNELS; ++i) - // buffer[i] = (i < channels()) ? new float[segmentSize] : 0; + // buffer[i] = (i < channels()) ? new float[MusEGlobal::segmentSize] : 0; for(int i = 0; i < MAX_CHANNELS; ++i) { if(i < channels()) - posix_memalign((void**)(buffer + i), 16, sizeof(float) * segmentSize); + posix_memalign((void**)(buffer + i), 16, sizeof(float) * MusEGlobal::segmentSize); else buffer[i] = 0; } @@ -1622,9 +1622,9 @@ void AudioAux::setChannels(int n) { // Changed by Tim. p3.3.15 //for (int i = channels(); i < n; ++i) - // buffer[i] = new float[segmentSize]; + // buffer[i] = new float[MusEGlobal::segmentSize]; for(int i = channels(); i < n; ++i) - posix_memalign((void**)(buffer + i), 16, sizeof(float) * segmentSize); + posix_memalign((void**)(buffer + i), 16, sizeof(float) * MusEGlobal::segmentSize); } else if(n < channels()) { @@ -1672,7 +1672,7 @@ bool AudioTrack::setRecordFlag1(bool f) setRecFile(0); remove(s.toLatin1().constData()); - if(debugMsg) + if(MusEGlobal::debugMsg) printf("AudioNode::setRecordFlag1: remove file %s if it exists\n", s.toLatin1().constData()); //_recFile = 0; } @@ -1690,7 +1690,7 @@ bool AudioTrack::setRecordFlag1(bool f) //--------------------------------------------------------- bool AudioTrack::prepareRecording() { - if(debugMsg) + if(MusEGlobal::debugMsg) printf("prepareRecording for track %s\n", _name.toLatin1().constData()); if (_recFile == 0) { @@ -1699,10 +1699,10 @@ bool AudioTrack::prepareRecording() // char buffer[128]; QFile fil; - for (;;++recFileNumber) { + for (;;++MusEGlobal::recFileNumber) { sprintf(buffer, "%s/rec%d.wav", - museProject.toLatin1().constData(), - recFileNumber); + MusEGlobal::museProject.toLatin1().constData(), + MusEGlobal::recFileNumber); fil.setFileName(QString(buffer)); if (!fil.exists()) break; @@ -1710,10 +1710,10 @@ bool AudioTrack::prepareRecording() _recFile = new SndFile(QString(buffer)); _recFile->setFormat( SF_FORMAT_WAV | SF_FORMAT_FLOAT, - _channels, sampleRate); + _channels, MusEGlobal::sampleRate); } - if (debugMsg) + if (MusEGlobal::debugMsg) printf("AudioNode::setRecordFlag1: init internal file %s\n", _recFile->path().toLatin1().constData()); if(_recFile->openWrite()) diff --git a/muse2/muse/conf.cpp b/muse2/muse/conf.cpp index e0821229..69a36d9b 100644 --- a/muse2/muse/conf.cpp +++ b/muse2/muse/conf.cpp @@ -292,18 +292,18 @@ static void readConfigMidiPort(Xml& xml) MidiDevice* dev = midiDevices.find(device); - //if(debugMsg && !dev) + //if(MusEGlobal::debugMsg && !dev) // fprintf(stderr, "readConfigMidiPort: device not found %s\n", device.toLatin1().constData()); if(!dev && type == MidiDevice::JACK_MIDI) { - if(debugMsg) + if(MusEGlobal::debugMsg) fprintf(stderr, "readConfigMidiPort: creating jack midi device %s\n", device.toLatin1().constData()); //dev = MidiJackDevice::createJackMidiDevice(device, openFlags); dev = MidiJackDevice::createJackMidiDevice(device); // p3.3.55 } - if(debugMsg && !dev) + if(MusEGlobal::debugMsg && !dev) fprintf(stderr, "readConfigMidiPort: device not found %s\n", device.toLatin1().constData()); MidiPort* mp = &midiPorts[idx]; @@ -426,37 +426,37 @@ static void loadConfigMetronom(Xml& xml) switch (token) { case Xml::TagStart: if (tag == "premeasures") - preMeasures = xml.parseInt(); + MusEGlobal::preMeasures = xml.parseInt(); else if (tag == "measurepitch") - measureClickNote = xml.parseInt(); + MusEGlobal::measureClickNote = xml.parseInt(); else if (tag == "measurevelo") - measureClickVelo = xml.parseInt(); + MusEGlobal::measureClickVelo = xml.parseInt(); else if (tag == "beatpitch") - beatClickNote = xml.parseInt(); + MusEGlobal::beatClickNote = xml.parseInt(); else if (tag == "beatvelo") - beatClickVelo = xml.parseInt(); + MusEGlobal::beatClickVelo = xml.parseInt(); else if (tag == "channel") - clickChan = xml.parseInt(); + MusEGlobal::clickChan = xml.parseInt(); else if (tag == "port") - clickPort = xml.parseInt(); + MusEGlobal::clickPort = xml.parseInt(); else if (tag == "precountEnable") - precountEnableFlag = xml.parseInt(); + MusEGlobal::precountEnableFlag = xml.parseInt(); else if (tag == "fromMastertrack") - precountFromMastertrackFlag = xml.parseInt(); + MusEGlobal::precountFromMastertrackFlag = xml.parseInt(); else if (tag == "signatureZ") - precountSigZ = xml.parseInt(); + MusEGlobal::precountSigZ = xml.parseInt(); else if (tag == "signatureN") - precountSigN = xml.parseInt(); + MusEGlobal::precountSigN = xml.parseInt(); else if (tag == "prerecord") - precountPrerecord = xml.parseInt(); + MusEGlobal::precountPrerecord = xml.parseInt(); else if (tag == "preroll") - precountPreroll = xml.parseInt(); + MusEGlobal::precountPreroll = xml.parseInt(); else if (tag == "midiClickEnable") - midiClickFlag = xml.parseInt(); + MusEGlobal::midiClickFlag = xml.parseInt(); else if (tag == "audioClickEnable") - audioClickFlag = xml.parseInt(); - else if (tag == "audioClickVolume") - audioClickVolume = xml.parseFloat(); + MusEGlobal::audioClickFlag = xml.parseInt(); + else if (tag == "MusEGlobal::audioClickVolume") + MusEGlobal::audioClickVolume = xml.parseFloat(); else xml.unknown("Metronome"); break; @@ -487,17 +487,17 @@ static void readSeqConfiguration(Xml& xml) else if (tag == "midiport") readConfigMidiPort(xml); else if (tag == "rcStop") - rcStopNote = xml.parseInt(); - else if (tag == "rcEnable") - rcEnable = xml.parseInt(); + MusEGlobal::rcStopNote = xml.parseInt(); + else if (tag == "MusEGlobal::rcEnable") + MusEGlobal::rcEnable = xml.parseInt(); else if (tag == "rcRecord") - rcRecordNote = xml.parseInt(); + MusEGlobal::rcRecordNote = xml.parseInt(); else if (tag == "rcGotoLeft") - rcGotoLeftMarkNote = xml.parseInt(); + MusEGlobal::rcGotoLeftMarkNote = xml.parseInt(); else if (tag == "rcPlay") - rcPlayNote = xml.parseInt(); + MusEGlobal::rcPlayNote = xml.parseInt(); else if (tag == "rcSteprec") - rcSteprecNote = xml.parseInt(); + MusEGlobal::rcSteprecNote = xml.parseInt(); else xml.unknown("Seq"); break; @@ -544,216 +544,216 @@ void readConfiguration(Xml& xml, bool readOnlySequencer) } if (tag == "theme") - config.style = xml.parse1(); + MusEConfig::config.style = xml.parse1(); else if (tag == "styleSheetFile") - config.styleSheetFile = xml.parse1(); + MusEConfig::config.styleSheetFile = xml.parse1(); else if (tag == "useOldStyleStopShortCut") - config.useOldStyleStopShortCut = xml.parseInt(); + MusEConfig::config.useOldStyleStopShortCut = xml.parseInt(); else if (tag == "moveArmedCheckBox") - config.moveArmedCheckBox = xml.parseInt(); + MusEConfig::config.moveArmedCheckBox = xml.parseInt(); else if (tag == "externalWavEditor") - config.externalWavEditor = xml.parse1(); + MusEConfig::config.externalWavEditor = xml.parse1(); else if (tag == "font0") - config.fonts[0].fromString(xml.parse1()); + MusEConfig::config.fonts[0].fromString(xml.parse1()); else if (tag == "font1") - config.fonts[1].fromString(xml.parse1()); + MusEConfig::config.fonts[1].fromString(xml.parse1()); else if (tag == "font2") - config.fonts[2].fromString(xml.parse1()); + MusEConfig::config.fonts[2].fromString(xml.parse1()); else if (tag == "font3") - config.fonts[3].fromString(xml.parse1()); + MusEConfig::config.fonts[3].fromString(xml.parse1()); else if (tag == "font4") - config.fonts[4].fromString(xml.parse1()); + MusEConfig::config.fonts[4].fromString(xml.parse1()); else if (tag == "font5") - config.fonts[5].fromString(xml.parse1()); + MusEConfig::config.fonts[5].fromString(xml.parse1()); else if (tag == "font6") - config.fonts[6].fromString(xml.parse1()); + MusEConfig::config.fonts[6].fromString(xml.parse1()); else if (tag == "globalAlphaBlend") - config.globalAlphaBlend = xml.parseInt(); + MusEConfig::config.globalAlphaBlend = xml.parseInt(); else if (tag == "palette0") - config.palette[0] = readColor(xml); + MusEConfig::config.palette[0] = readColor(xml); else if (tag == "palette1") - config.palette[1] = readColor(xml); + MusEConfig::config.palette[1] = readColor(xml); else if (tag == "palette2") - config.palette[2] = readColor(xml); + MusEConfig::config.palette[2] = readColor(xml); else if (tag == "palette3") - config.palette[3] = readColor(xml); + MusEConfig::config.palette[3] = readColor(xml); else if (tag == "palette4") - config.palette[4] = readColor(xml); + MusEConfig::config.palette[4] = readColor(xml); else if (tag == "palette5") - config.palette[5] = readColor(xml); + MusEConfig::config.palette[5] = readColor(xml); else if (tag == "palette6") - config.palette[6] = readColor(xml); + MusEConfig::config.palette[6] = readColor(xml); else if (tag == "palette7") - config.palette[7] = readColor(xml); + MusEConfig::config.palette[7] = readColor(xml); else if (tag == "palette8") - config.palette[8] = readColor(xml); + MusEConfig::config.palette[8] = readColor(xml); else if (tag == "palette9") - config.palette[9] = readColor(xml); + MusEConfig::config.palette[9] = readColor(xml); else if (tag == "palette10") - config.palette[10] = readColor(xml); + MusEConfig::config.palette[10] = readColor(xml); else if (tag == "palette11") - config.palette[11] = readColor(xml); + MusEConfig::config.palette[11] = readColor(xml); else if (tag == "palette12") - config.palette[12] = readColor(xml); + MusEConfig::config.palette[12] = readColor(xml); else if (tag == "palette13") - config.palette[13] = readColor(xml); + MusEConfig::config.palette[13] = readColor(xml); else if (tag == "palette14") - config.palette[14] = readColor(xml); + MusEConfig::config.palette[14] = readColor(xml); else if (tag == "palette15") - config.palette[15] = readColor(xml); + MusEConfig::config.palette[15] = readColor(xml); else if (tag == "palette16") - config.palette[16] = readColor(xml); + MusEConfig::config.palette[16] = readColor(xml); else if (tag == "partColor0") - config.partColors[0] = readColor(xml); + MusEConfig::config.partColors[0] = readColor(xml); else if (tag == "partColor1") - config.partColors[1] = readColor(xml); + MusEConfig::config.partColors[1] = readColor(xml); else if (tag == "partColor2") - config.partColors[2] = readColor(xml); + MusEConfig::config.partColors[2] = readColor(xml); else if (tag == "partColor3") - config.partColors[3] = readColor(xml); + MusEConfig::config.partColors[3] = readColor(xml); else if (tag == "partColor4") - config.partColors[4] = readColor(xml); + MusEConfig::config.partColors[4] = readColor(xml); else if (tag == "partColor5") - config.partColors[5] = readColor(xml); + MusEConfig::config.partColors[5] = readColor(xml); else if (tag == "partColor6") - config.partColors[6] = readColor(xml); + MusEConfig::config.partColors[6] = readColor(xml); else if (tag == "partColor7") - config.partColors[7] = readColor(xml); + MusEConfig::config.partColors[7] = readColor(xml); else if (tag == "partColor8") - config.partColors[8] = readColor(xml); + MusEConfig::config.partColors[8] = readColor(xml); else if (tag == "partColor9") - config.partColors[9] = readColor(xml); + MusEConfig::config.partColors[9] = readColor(xml); else if (tag == "partColor10") - config.partColors[10] = readColor(xml); + MusEConfig::config.partColors[10] = readColor(xml); else if (tag == "partColor11") - config.partColors[11] = readColor(xml); + MusEConfig::config.partColors[11] = readColor(xml); else if (tag == "partColor12") - config.partColors[12] = readColor(xml); + MusEConfig::config.partColors[12] = readColor(xml); else if (tag == "partColor13") - config.partColors[13] = readColor(xml); + MusEConfig::config.partColors[13] = readColor(xml); else if (tag == "partColor14") - config.partColors[14] = readColor(xml); + MusEConfig::config.partColors[14] = readColor(xml); else if (tag == "partColor15") - config.partColors[15] = readColor(xml); + MusEConfig::config.partColors[15] = readColor(xml); else if (tag == "partColor16") - config.partColors[16] = readColor(xml); + MusEConfig::config.partColors[16] = readColor(xml); else if (tag == "partColor17") - config.partColors[17] = readColor(xml); + MusEConfig::config.partColors[17] = readColor(xml); else if (tag == "partColorName0") - config.partColorNames[0] = xml.parse1(); + MusEConfig::config.partColorNames[0] = xml.parse1(); else if (tag == "partColorName1") - config.partColorNames[1] = xml.parse1(); + MusEConfig::config.partColorNames[1] = xml.parse1(); else if (tag == "partColorName2") - config.partColorNames[2] = xml.parse1(); + MusEConfig::config.partColorNames[2] = xml.parse1(); else if (tag == "partColorName3") - config.partColorNames[3] = xml.parse1(); + MusEConfig::config.partColorNames[3] = xml.parse1(); else if (tag == "partColorName4") - config.partColorNames[4] = xml.parse1(); + MusEConfig::config.partColorNames[4] = xml.parse1(); else if (tag == "partColorName5") - config.partColorNames[5] = xml.parse1(); + MusEConfig::config.partColorNames[5] = xml.parse1(); else if (tag == "partColorName6") - config.partColorNames[6] = xml.parse1(); + MusEConfig::config.partColorNames[6] = xml.parse1(); else if (tag == "partColorName7") - config.partColorNames[7] = xml.parse1(); + MusEConfig::config.partColorNames[7] = xml.parse1(); else if (tag == "partColorName8") - config.partColorNames[8] = xml.parse1(); + MusEConfig::config.partColorNames[8] = xml.parse1(); else if (tag == "partColorName9") - config.partColorNames[9] = xml.parse1(); + MusEConfig::config.partColorNames[9] = xml.parse1(); else if (tag == "partColorName10") - config.partColorNames[10] = xml.parse1(); + MusEConfig::config.partColorNames[10] = xml.parse1(); else if (tag == "partColorName11") - config.partColorNames[11] = xml.parse1(); + MusEConfig::config.partColorNames[11] = xml.parse1(); else if (tag == "partColorName12") - config.partColorNames[12] = xml.parse1(); + MusEConfig::config.partColorNames[12] = xml.parse1(); else if (tag == "partColorName13") - config.partColorNames[13] = xml.parse1(); + MusEConfig::config.partColorNames[13] = xml.parse1(); else if (tag == "partColorName14") - config.partColorNames[14] = xml.parse1(); + MusEConfig::config.partColorNames[14] = xml.parse1(); else if (tag == "partColorName15") - config.partColorNames[15] = xml.parse1(); + MusEConfig::config.partColorNames[15] = xml.parse1(); else if (tag == "partColorName16") - config.partColorNames[16] = xml.parse1(); + MusEConfig::config.partColorNames[16] = xml.parse1(); else if (tag == "partColorName17") - config.partColorNames[17] = xml.parse1(); + MusEConfig::config.partColorNames[17] = xml.parse1(); else if (tag == "partCanvasBg") - config.partCanvasBg = readColor(xml); + MusEConfig::config.partCanvasBg = readColor(xml); else if (tag == "trackBg") - config.trackBg = readColor(xml); + MusEConfig::config.trackBg = readColor(xml); else if (tag == "selectTrackBg") - config.selectTrackBg = readColor(xml); + MusEConfig::config.selectTrackBg = readColor(xml); else if (tag == "selectTrackFg") - config.selectTrackFg = readColor(xml); + MusEConfig::config.selectTrackFg = readColor(xml); else if (tag == "mixerBg") - config.mixerBg = readColor(xml); + MusEConfig::config.mixerBg = readColor(xml); else if (tag == "midiTrackLabelBg") - config.midiTrackLabelBg = readColor(xml); + MusEConfig::config.midiTrackLabelBg = readColor(xml); else if (tag == "drumTrackLabelBg") - config.drumTrackLabelBg = readColor(xml); + MusEConfig::config.drumTrackLabelBg = readColor(xml); else if (tag == "waveTrackLabelBg") - config.waveTrackLabelBg = readColor(xml); + MusEConfig::config.waveTrackLabelBg = readColor(xml); else if (tag == "outputTrackLabelBg") - config.outputTrackLabelBg = readColor(xml); + MusEConfig::config.outputTrackLabelBg = readColor(xml); else if (tag == "inputTrackLabelBg") - config.inputTrackLabelBg = readColor(xml); + MusEConfig::config.inputTrackLabelBg = readColor(xml); else if (tag == "groupTrackLabelBg") - config.groupTrackLabelBg = readColor(xml); + MusEConfig::config.groupTrackLabelBg = readColor(xml); else if (tag == "auxTrackLabelBg") - config.auxTrackLabelBg = readColor(xml); + MusEConfig::config.auxTrackLabelBg = readColor(xml); else if (tag == "synthTrackLabelBg") - config.synthTrackLabelBg = readColor(xml); + MusEConfig::config.synthTrackLabelBg = readColor(xml); else if (tag == "midiTrackBg") - config.midiTrackBg = readColor(xml); + MusEConfig::config.midiTrackBg = readColor(xml); else if (tag == "ctrlGraphFg") - config.ctrlGraphFg = readColor(xml); + MusEConfig::config.ctrlGraphFg = readColor(xml); else if (tag == "drumTrackBg") - config.drumTrackBg = readColor(xml); + MusEConfig::config.drumTrackBg = readColor(xml); else if (tag == "waveTrackBg") - config.waveTrackBg = readColor(xml); + MusEConfig::config.waveTrackBg = readColor(xml); else if (tag == "outputTrackBg") - config.outputTrackBg = readColor(xml); + MusEConfig::config.outputTrackBg = readColor(xml); else if (tag == "inputTrackBg") - config.inputTrackBg = readColor(xml); + MusEConfig::config.inputTrackBg = readColor(xml); else if (tag == "groupTrackBg") - config.groupTrackBg = readColor(xml); + MusEConfig::config.groupTrackBg = readColor(xml); else if (tag == "auxTrackBg") - config.auxTrackBg = readColor(xml); + MusEConfig::config.auxTrackBg = readColor(xml); else if (tag == "synthTrackBg") - config.synthTrackBg = readColor(xml); + MusEConfig::config.synthTrackBg = readColor(xml); else if (tag == "extendedMidi") - config.extendedMidi = xml.parseInt(); + MusEConfig::config.extendedMidi = xml.parseInt(); else if (tag == "midiExportDivision") - config.midiDivision = xml.parseInt(); + MusEConfig::config.midiDivision = xml.parseInt(); else if (tag == "copyright") - config.copyright = xml.parse1(); + MusEConfig::config.copyright = xml.parse1(); else if (tag == "smfFormat") - config.smfFormat = xml.parseInt(); + MusEConfig::config.smfFormat = xml.parseInt(); else if (tag == "exp2ByteTimeSigs") - config.exp2ByteTimeSigs = xml.parseInt(); + MusEConfig::config.exp2ByteTimeSigs = xml.parseInt(); else if (tag == "expOptimNoteOffs") - config.expOptimNoteOffs = xml.parseInt(); + MusEConfig::config.expOptimNoteOffs = xml.parseInt(); else if (tag == "importMidiSplitParts") - config.importMidiSplitParts = xml.parseInt(); + MusEConfig::config.importMidiSplitParts = xml.parseInt(); else if (tag == "midiInputDevice") - midiInputPorts = xml.parseInt(); - else if (tag == "midiInputChannel") - midiInputChannel = xml.parseInt(); - else if (tag == "midiRecordType") - midiRecordType = xml.parseInt(); - else if (tag == "midiThruType") - midiThruType = xml.parseInt(); - else if (tag == "midiFilterCtrl1") - midiFilterCtrl1 = xml.parseInt(); - else if (tag == "midiFilterCtrl2") - midiFilterCtrl2 = xml.parseInt(); - else if (tag == "midiFilterCtrl3") - midiFilterCtrl3 = xml.parseInt(); - else if (tag == "midiFilterCtrl4") - midiFilterCtrl4 = xml.parseInt(); + MusEGlobal::midiInputPorts = xml.parseInt(); + else if (tag == "MusEGlobal::midiInputChannel") + MusEGlobal::midiInputChannel = xml.parseInt(); + else if (tag == "MusEGlobal::midiRecordType") + MusEGlobal::midiRecordType = xml.parseInt(); + else if (tag == "MusEGlobal::midiThruType") + MusEGlobal::midiThruType = xml.parseInt(); + else if (tag == "MusEGlobal::midiFilterCtrl1") + MusEGlobal::midiFilterCtrl1 = xml.parseInt(); + else if (tag == "MusEGlobal::midiFilterCtrl2") + MusEGlobal::midiFilterCtrl2 = xml.parseInt(); + else if (tag == "MusEGlobal::midiFilterCtrl3") + MusEGlobal::midiFilterCtrl3 = xml.parseInt(); + else if (tag == "MusEGlobal::midiFilterCtrl4") + MusEGlobal::midiFilterCtrl4 = xml.parseInt(); else if (tag == "waveTracksVisible") WaveTrack::setVisible((bool)xml.parseInt()); else if (tag == "auxTracksVisible") @@ -769,67 +769,67 @@ void readConfiguration(Xml& xml, bool readOnlySequencer) else if (tag == "synthTracksVisible") SynthI::setVisible((bool)xml.parseInt()); else if (tag == "bigtimeVisible") - config.bigTimeVisible = xml.parseInt(); + MusEConfig::config.bigTimeVisible = xml.parseInt(); else if (tag == "transportVisible") - config.transportVisible = xml.parseInt(); + MusEConfig::config.transportVisible = xml.parseInt(); else if (tag == "markerVisible") - config.markerVisible = xml.parseInt(); + MusEConfig::config.markerVisible = xml.parseInt(); else if (tag == "mixerVisible") - // config.mixerVisible = xml.parseInt(); // Obsolete + // MusEConfig::config.mixerVisible = xml.parseInt(); // Obsolete xml.skip(tag); else if (tag == "mixer1Visible") - config.mixer1Visible = xml.parseInt(); + MusEConfig::config.mixer1Visible = xml.parseInt(); else if (tag == "mixer2Visible") - config.mixer2Visible = xml.parseInt(); + MusEConfig::config.mixer2Visible = xml.parseInt(); else if (tag == "showSplashScreen") - config.showSplashScreen = xml.parseInt(); + MusEConfig::config.showSplashScreen = xml.parseInt(); else if (tag == "canvasShowPartType") - config.canvasShowPartType = xml.parseInt(); + MusEConfig::config.canvasShowPartType = xml.parseInt(); else if (tag == "canvasShowPartEvent") - config.canvasShowPartEvent = xml.parseInt(); + MusEConfig::config.canvasShowPartEvent = xml.parseInt(); else if (tag == "canvasShowGrid") - config.canvasShowGrid = xml.parseInt(); + MusEConfig::config.canvasShowGrid = xml.parseInt(); else if (tag == "canvasBgPixmap") - config.canvasBgPixmap = xml.parse1(); + MusEConfig::config.canvasBgPixmap = xml.parse1(); else if (tag == "canvasCustomBgList") - config.canvasCustomBgList = xml.parse1().split(";", QString::SkipEmptyParts); + MusEConfig::config.canvasCustomBgList = xml.parse1().split(";", QString::SkipEmptyParts); else if (tag == "geometryMain") - config.geometryMain = readGeometry(xml, tag); + MusEConfig::config.geometryMain = readGeometry(xml, tag); else if (tag == "geometryTransport") - config.geometryTransport = readGeometry(xml, tag); + MusEConfig::config.geometryTransport = readGeometry(xml, tag); else if (tag == "geometryBigTime") - config.geometryBigTime = readGeometry(xml, tag); + MusEConfig::config.geometryBigTime = readGeometry(xml, tag); else if (tag == "geometryPianoroll") - config.geometryPianoroll = readGeometry(xml, tag); + MusEConfig::config.geometryPianoroll = readGeometry(xml, tag); else if (tag == "geometryDrumedit") - config.geometryDrumedit = readGeometry(xml, tag); + MusEConfig::config.geometryDrumedit = readGeometry(xml, tag); else if (tag == "geometryMixer") - // config.geometryMixer = readGeometry(xml, tag); // Obsolete + // MusEConfig::config.geometryMixer = readGeometry(xml, tag); // Obsolete xml.skip(tag); //else if (tag == "mixer1") - // config.mixer1.read(xml); + // MusEConfig::config.mixer1.read(xml); //else if (tag == "mixer2") - // config.mixer2.read(xml); + // MusEConfig::config.mixer2.read(xml); else if (tag == "Mixer") { if(mixers == 0) - config.mixer1.read(xml); + MusEConfig::config.mixer1.read(xml); else - config.mixer2.read(xml); + MusEConfig::config.mixer2.read(xml); ++mixers; } else if (tag == "bigtimeForegroundcolor") - config.bigTimeForegroundColor = readColor(xml); + MusEConfig::config.bigTimeForegroundColor = readColor(xml); else if (tag == "bigtimeBackgroundcolor") - config.bigTimeBackgroundColor = readColor(xml); + MusEConfig::config.bigTimeBackgroundColor = readColor(xml); else if (tag == "transportHandleColor") - config.transportHandleColor = readColor(xml); + MusEConfig::config.transportHandleColor = readColor(xml); else if (tag == "waveEditBackgroundColor") - config.waveEditBackgroundColor = readColor(xml); + MusEConfig::config.waveEditBackgroundColor = readColor(xml); else if (tag == "txDeviceId") //txDeviceId = xml.parseInt(); xml.parseInt(); @@ -894,8 +894,8 @@ void readConfiguration(Xml& xml, bool readOnlySequencer) //else if (tag == "midiSyncInfo") // readConfigMidiSyncInfo(xml); else if (tag == "arranger") { - if (muse && muse->arranger) - muse->arranger->readStatus(xml); + if (MusEGlobal::muse && MusEGlobal::muse->arranger) + MusEGlobal::muse->arranger->readStatus(xml); else xml.skip(tag); } @@ -914,9 +914,9 @@ void readConfiguration(Xml& xml, bool readOnlySequencer) else if (tag == "shortcuts") readShortCuts(xml); else if (tag == "division") - config.division = xml.parseInt(); + MusEConfig::config.division = xml.parseInt(); else if (tag == "guiDivision") - config.guiDivision = xml.parseInt(); + MusEConfig::config.guiDivision = xml.parseInt(); else if (tag == "samplerate") xml.parseInt(); else if (tag == "segmentsize") @@ -924,47 +924,47 @@ void readConfiguration(Xml& xml, bool readOnlySequencer) else if (tag == "segmentcount") xml.parseInt(); else if (tag == "rtcTicks") - config.rtcTicks = xml.parseInt(); + MusEConfig::config.rtcTicks = xml.parseInt(); else if (tag == "minMeter") - config.minMeter = xml.parseInt(); + MusEConfig::config.minMeter = xml.parseInt(); else if (tag == "minSlider") - config.minSlider = xml.parseDouble(); + MusEConfig::config.minSlider = xml.parseDouble(); else if (tag == "freewheelMode") - config.freewheelMode = xml.parseInt(); + MusEConfig::config.freewheelMode = xml.parseInt(); else if (tag == "denormalProtection") - config.useDenormalBias = xml.parseInt(); + MusEConfig::config.useDenormalBias = xml.parseInt(); else if (tag == "didYouKnow") - config.showDidYouKnow = xml.parseInt(); + MusEConfig::config.showDidYouKnow = xml.parseInt(); else if (tag == "outputLimiter") - config.useOutputLimiter = xml.parseInt(); + MusEConfig::config.useOutputLimiter = xml.parseInt(); else if (tag == "vstInPlace") - config.vstInPlace = xml.parseInt(); + MusEConfig::config.vstInPlace = xml.parseInt(); else if (tag == "dummyAudioSampleRate") - config.dummyAudioSampleRate = xml.parseInt(); + MusEConfig::config.dummyAudioSampleRate = xml.parseInt(); else if (tag == "dummyAudioBufSize") - config.dummyAudioBufSize = xml.parseInt(); + MusEConfig::config.dummyAudioBufSize = xml.parseInt(); else if (tag == "minControlProcessPeriod") - config.minControlProcessPeriod = xml.parseUInt(); + MusEConfig::config.minControlProcessPeriod = xml.parseUInt(); else if (tag == "guiRefresh") - config.guiRefresh = xml.parseInt(); + MusEConfig::config.guiRefresh = xml.parseInt(); else if (tag == "userInstrumentsDir") - config.userInstrumentsDir = xml.parse1(); + MusEConfig::config.userInstrumentsDir = xml.parse1(); else if (tag == "midiTransform") readMidiTransform(xml); else if (tag == "midiInputTransform") readMidiInputTransform(xml); else if (tag == "startMode") - config.startMode = xml.parseInt(); + MusEConfig::config.startMode = xml.parseInt(); else if (tag == "startSong") - config.startSong = xml.parse1(); + MusEConfig::config.startSong = xml.parse1(); else if (tag == "projectBaseFolder") - config.projectBaseFolder = xml.parse1(); + MusEConfig::config.projectBaseFolder = xml.parse1(); else if (tag == "projectStoreInFolder") - config.projectStoreInFolder = xml.parseInt(); + MusEConfig::config.projectStoreInFolder = xml.parseInt(); else if (tag == "useProjectSaveDialog") - config.useProjectSaveDialog = xml.parseInt(); + MusEConfig::config.useProjectSaveDialog = xml.parseInt(); else if (tag == "popupsDefaultStayOpen") - config.popupsDefaultStayOpen = xml.parseInt(); + MusEConfig::config.popupsDefaultStayOpen = xml.parseInt(); else xml.unknown("configuration"); @@ -999,13 +999,13 @@ void readConfiguration(Xml& xml, bool readOnlySequencer) bool readConfiguration() { - FILE* f = fopen(configName.toLatin1().constData(), "r"); + FILE* f = fopen(MusEGlobal::configName.toLatin1().constData(), "r"); if (f == 0) { - if (debugMsg || debugMode) - fprintf(stderr, "NO Config File <%s> found\n", configName.toLatin1().constData()); + if (MusEGlobal::debugMsg || MusEGlobal::debugMode) + fprintf(stderr, "NO Config File <%s> found\n", MusEGlobal::configName.toLatin1().constData()); - if (config.userInstrumentsDir.isEmpty()) - config.userInstrumentsDir = configPath + "/instruments"; + if (MusEConfig::config.userInstrumentsDir.isEmpty()) + MusEConfig::config.userInstrumentsDir = MusEGlobal::configPath + "/instruments"; return true; } Xml xml(f); @@ -1057,31 +1057,31 @@ static void writeSeqConfiguration(int level, Xml& xml, bool writePortInfo) xml.tag(level++, "sequencer"); xml.tag(level++, "metronom"); - xml.intTag(level, "premeasures", preMeasures); - xml.intTag(level, "measurepitch", measureClickNote); - xml.intTag(level, "measurevelo", measureClickVelo); - xml.intTag(level, "beatpitch", beatClickNote); - xml.intTag(level, "beatvelo", beatClickVelo); - xml.intTag(level, "channel", clickChan); - xml.intTag(level, "port", clickPort); - - xml.intTag(level, "precountEnable", precountEnableFlag); - xml.intTag(level, "fromMastertrack", precountFromMastertrackFlag); - xml.intTag(level, "signatureZ", precountSigZ); - xml.intTag(level, "signatureN", precountSigN); - xml.intTag(level, "prerecord", precountPrerecord); - xml.intTag(level, "preroll", precountPreroll); - xml.intTag(level, "midiClickEnable", midiClickFlag); - xml.intTag(level, "audioClickEnable", audioClickFlag); - xml.floatTag(level, "audioClickVolume", audioClickVolume); + xml.intTag(level, "premeasures", MusEGlobal::preMeasures); + xml.intTag(level, "measurepitch", MusEGlobal::measureClickNote); + xml.intTag(level, "measurevelo", MusEGlobal::measureClickVelo); + xml.intTag(level, "beatpitch", MusEGlobal::beatClickNote); + xml.intTag(level, "beatvelo", MusEGlobal::beatClickVelo); + xml.intTag(level, "channel", MusEGlobal::clickChan); + xml.intTag(level, "port", MusEGlobal::clickPort); + + xml.intTag(level, "precountEnable", MusEGlobal::precountEnableFlag); + xml.intTag(level, "fromMastertrack", MusEGlobal::precountFromMastertrackFlag); + xml.intTag(level, "signatureZ", MusEGlobal::precountSigZ); + xml.intTag(level, "signatureN", MusEGlobal::precountSigN); + xml.intTag(level, "prerecord", MusEGlobal::precountPrerecord); + xml.intTag(level, "preroll", MusEGlobal::precountPreroll); + xml.intTag(level, "midiClickEnable", MusEGlobal::midiClickFlag); + xml.intTag(level, "audioClickEnable", MusEGlobal::audioClickFlag); + xml.floatTag(level, "MusEGlobal::audioClickVolume", MusEGlobal::audioClickVolume); xml.tag(level--, "/metronom"); - xml.intTag(level, "rcEnable", rcEnable); - xml.intTag(level, "rcStop", rcStopNote); - xml.intTag(level, "rcRecord", rcRecordNote); - xml.intTag(level, "rcGotoLeft", rcGotoLeftMarkNote); - xml.intTag(level, "rcPlay", rcPlayNote); - xml.intTag(level, "rcSteprec", rcSteprecNote); + xml.intTag(level, "MusEGlobal::rcEnable", MusEGlobal::rcEnable); + xml.intTag(level, "rcStop", MusEGlobal::rcStopNote); + xml.intTag(level, "rcRecord", MusEGlobal::rcRecordNote); + xml.intTag(level, "rcGotoLeft", MusEGlobal::rcGotoLeftMarkNote); + xml.intTag(level, "rcPlay", MusEGlobal::rcPlayNote); + xml.intTag(level, "rcSteprec", MusEGlobal::rcSteprecNote); if (writePortInfo) { // @@ -1173,16 +1173,17 @@ static void writeSeqConfiguration(int level, Xml& xml, bool writePortInfo) xml.tag(level, "/sequencer"); } +namespace MusEApp { //--------------------------------------------------------- // writeGlobalConfiguration //--------------------------------------------------------- void MusE::writeGlobalConfiguration() const { - FILE* f = fopen(configName.toLatin1().constData(), "w"); + FILE* f = fopen(MusEGlobal::configName.toLatin1().constData(), "w"); if (f == 0) { printf("save configuration to <%s> failed: %s\n", - configName.toLatin1().constData(), strerror(errno)); + MusEGlobal::configName.toLatin1().constData(), strerror(errno)); return; } Xml xml(f); @@ -1197,105 +1198,105 @@ void MusE::writeGlobalConfiguration(int level, Xml& xml) const { xml.tag(level++, "configuration"); - xml.intTag(level, "division", config.division); - xml.intTag(level, "rtcTicks", config.rtcTicks); - xml.intTag(level, "minMeter", config.minMeter); - xml.doubleTag(level, "minSlider", config.minSlider); - xml.intTag(level, "freewheelMode", config.freewheelMode); - xml.intTag(level, "denormalProtection", config.useDenormalBias); - xml.intTag(level, "didYouKnow", config.showDidYouKnow); - xml.intTag(level, "outputLimiter", config.useOutputLimiter); - xml.intTag(level, "vstInPlace", config.vstInPlace); - xml.intTag(level, "dummyAudioBufSize", config.dummyAudioBufSize); - xml.intTag(level, "dummyAudioSampleRate", config.dummyAudioSampleRate); - xml.uintTag(level, "minControlProcessPeriod", config.minControlProcessPeriod); - - xml.intTag(level, "guiRefresh", config.guiRefresh); - xml.strTag(level, "userInstrumentsDir", config.userInstrumentsDir); + xml.intTag(level, "division", MusEConfig::config.division); + xml.intTag(level, "rtcTicks", MusEConfig::config.rtcTicks); + xml.intTag(level, "minMeter", MusEConfig::config.minMeter); + xml.doubleTag(level, "minSlider", MusEConfig::config.minSlider); + xml.intTag(level, "freewheelMode", MusEConfig::config.freewheelMode); + xml.intTag(level, "denormalProtection", MusEConfig::config.useDenormalBias); + xml.intTag(level, "didYouKnow", MusEConfig::config.showDidYouKnow); + xml.intTag(level, "outputLimiter", MusEConfig::config.useOutputLimiter); + xml.intTag(level, "vstInPlace", MusEConfig::config.vstInPlace); + xml.intTag(level, "dummyAudioBufSize", MusEConfig::config.dummyAudioBufSize); + xml.intTag(level, "dummyAudioSampleRate", MusEConfig::config.dummyAudioSampleRate); + xml.uintTag(level, "minControlProcessPeriod", MusEConfig::config.minControlProcessPeriod); + + xml.intTag(level, "guiRefresh", MusEConfig::config.guiRefresh); + xml.strTag(level, "userInstrumentsDir", MusEConfig::config.userInstrumentsDir); // Removed by Orcan. 20101220 //xml.strTag(level, "helpBrowser", config.helpBrowser); - xml.intTag(level, "extendedMidi", config.extendedMidi); - xml.intTag(level, "midiExportDivision", config.midiDivision); - xml.intTag(level, "guiDivision", config.guiDivision); - xml.strTag(level, "copyright", config.copyright); - xml.intTag(level, "smfFormat", config.smfFormat); - xml.intTag(level, "exp2ByteTimeSigs", config.exp2ByteTimeSigs); - xml.intTag(level, "expOptimNoteOffs", config.expOptimNoteOffs); - xml.intTag(level, "importMidiSplitParts", config.importMidiSplitParts); - xml.intTag(level, "startMode", config.startMode); - xml.strTag(level, "startSong", config.startSong); - xml.strTag(level, "projectBaseFolder", config.projectBaseFolder); - xml.intTag(level, "projectStoreInFolder", config.projectStoreInFolder); - xml.intTag(level, "useProjectSaveDialog", config.useProjectSaveDialog); - xml.intTag(level, "midiInputDevice", midiInputPorts); - xml.intTag(level, "midiInputChannel", midiInputChannel); - xml.intTag(level, "midiRecordType", midiRecordType); - xml.intTag(level, "midiThruType", midiThruType); - xml.intTag(level, "midiFilterCtrl1", midiFilterCtrl1); - xml.intTag(level, "midiFilterCtrl2", midiFilterCtrl2); - xml.intTag(level, "midiFilterCtrl3", midiFilterCtrl3); - xml.intTag(level, "midiFilterCtrl4", midiFilterCtrl4); + xml.intTag(level, "extendedMidi", MusEConfig::config.extendedMidi); + xml.intTag(level, "midiExportDivision", MusEConfig::config.midiDivision); + xml.intTag(level, "guiDivision", MusEConfig::config.guiDivision); + xml.strTag(level, "copyright", MusEConfig::config.copyright); + xml.intTag(level, "smfFormat", MusEConfig::config.smfFormat); + xml.intTag(level, "exp2ByteTimeSigs", MusEConfig::config.exp2ByteTimeSigs); + xml.intTag(level, "expOptimNoteOffs", MusEConfig::config.expOptimNoteOffs); + xml.intTag(level, "importMidiSplitParts", MusEConfig::config.importMidiSplitParts); + xml.intTag(level, "startMode", MusEConfig::config.startMode); + xml.strTag(level, "startSong", MusEConfig::config.startSong); + xml.strTag(level, "projectBaseFolder", MusEConfig::config.projectBaseFolder); + xml.intTag(level, "projectStoreInFolder", MusEConfig::config.projectStoreInFolder); + xml.intTag(level, "useProjectSaveDialog", MusEConfig::config.useProjectSaveDialog); + xml.intTag(level, "midiInputDevice", MusEGlobal::midiInputPorts); + xml.intTag(level, "MusEGlobal::midiInputChannel", MusEGlobal::midiInputChannel); + xml.intTag(level, "MusEGlobal::midiRecordType", MusEGlobal::midiRecordType); + xml.intTag(level, "MusEGlobal::midiThruType", MusEGlobal::midiThruType); + xml.intTag(level, "MusEGlobal::midiFilterCtrl1", MusEGlobal::midiFilterCtrl1); + xml.intTag(level, "MusEGlobal::midiFilterCtrl2", MusEGlobal::midiFilterCtrl2); + xml.intTag(level, "MusEGlobal::midiFilterCtrl3", MusEGlobal::midiFilterCtrl3); + xml.intTag(level, "MusEGlobal::midiFilterCtrl4", MusEGlobal::midiFilterCtrl4); //xml.intTag(level, "txDeviceId", txDeviceId); //xml.intTag(level, "rxDeviceId", rxDeviceId); - xml.strTag(level, "theme", config.style); - xml.strTag(level, "styleSheetFile", config.styleSheetFile); - xml.strTag(level, "externalWavEditor", config.externalWavEditor); - xml.intTag(level, "useOldStyleStopShortCut", config.useOldStyleStopShortCut); - xml.intTag(level, "moveArmedCheckBox", config.moveArmedCheckBox); - xml.intTag(level, "popupsDefaultStayOpen", config.popupsDefaultStayOpen); + xml.strTag(level, "theme", MusEConfig::config.style); + xml.strTag(level, "styleSheetFile", MusEConfig::config.styleSheetFile); + xml.strTag(level, "externalWavEditor", MusEConfig::config.externalWavEditor); + xml.intTag(level, "useOldStyleStopShortCut", MusEConfig::config.useOldStyleStopShortCut); + xml.intTag(level, "moveArmedCheckBox", MusEConfig::config.moveArmedCheckBox); + xml.intTag(level, "popupsDefaultStayOpen", MusEConfig::config.popupsDefaultStayOpen); //for (int i = 0; i < 6; ++i) { for (int i = 0; i < NUM_FONTS; ++i) { char buffer[32]; sprintf(buffer, "font%d", i); - xml.strTag(level, buffer, config.fonts[i].toString()); + xml.strTag(level, buffer, MusEConfig::config.fonts[i].toString()); } - xml.intTag(level, "globalAlphaBlend", config.globalAlphaBlend); + xml.intTag(level, "globalAlphaBlend", MusEConfig::config.globalAlphaBlend); for (int i = 0; i < 16; ++i) { char buffer[32]; sprintf(buffer, "palette%d", i); - xml.colorTag(level, buffer, config.palette[i]); + xml.colorTag(level, buffer, MusEConfig::config.palette[i]); } for (int i = 0; i < NUM_PARTCOLORS; ++i) { char buffer[32]; sprintf(buffer, "partColor%d", i); - xml.colorTag(level, buffer, config.partColors[i]); + xml.colorTag(level, buffer, MusEConfig::config.partColors[i]); } for (int i = 0; i < NUM_PARTCOLORS; ++i) { char buffer[32]; sprintf(buffer, "partColorName%d", i); - xml.strTag(level, buffer, config.partColorNames[i]); + xml.strTag(level, buffer, MusEConfig::config.partColorNames[i]); } - xml.colorTag(level, "partCanvasBg", config.partCanvasBg); - xml.colorTag(level, "trackBg", config.trackBg); - xml.colorTag(level, "selectTrackBg", config.selectTrackBg); - xml.colorTag(level, "selectTrackFg", config.selectTrackFg); + xml.colorTag(level, "partCanvasBg", MusEConfig::config.partCanvasBg); + xml.colorTag(level, "trackBg", MusEConfig::config.trackBg); + xml.colorTag(level, "selectTrackBg", MusEConfig::config.selectTrackBg); + xml.colorTag(level, "selectTrackFg", MusEConfig::config.selectTrackFg); - xml.colorTag(level, "mixerBg", config.mixerBg); - xml.colorTag(level, "midiTrackLabelBg", config.midiTrackLabelBg); - xml.colorTag(level, "drumTrackLabelBg", config.drumTrackLabelBg); - xml.colorTag(level, "waveTrackLabelBg", config.waveTrackLabelBg); - xml.colorTag(level, "outputTrackLabelBg", config.outputTrackLabelBg); - xml.colorTag(level, "inputTrackLabelBg", config.inputTrackLabelBg); - xml.colorTag(level, "groupTrackLabelBg", config.groupTrackLabelBg); - xml.colorTag(level, "auxTrackLabelBg", config.auxTrackLabelBg); - xml.colorTag(level, "synthTrackLabelBg", config.synthTrackLabelBg); + xml.colorTag(level, "mixerBg", MusEConfig::config.mixerBg); + xml.colorTag(level, "midiTrackLabelBg", MusEConfig::config.midiTrackLabelBg); + xml.colorTag(level, "drumTrackLabelBg", MusEConfig::config.drumTrackLabelBg); + xml.colorTag(level, "waveTrackLabelBg", MusEConfig::config.waveTrackLabelBg); + xml.colorTag(level, "outputTrackLabelBg", MusEConfig::config.outputTrackLabelBg); + xml.colorTag(level, "inputTrackLabelBg", MusEConfig::config.inputTrackLabelBg); + xml.colorTag(level, "groupTrackLabelBg", MusEConfig::config.groupTrackLabelBg); + xml.colorTag(level, "auxTrackLabelBg", MusEConfig::config.auxTrackLabelBg); + xml.colorTag(level, "synthTrackLabelBg", MusEConfig::config.synthTrackLabelBg); - xml.colorTag(level, "midiTrackBg", config.midiTrackBg); - xml.colorTag(level, "ctrlGraphFg", config.ctrlGraphFg); - xml.colorTag(level, "drumTrackBg", config.drumTrackBg); - xml.colorTag(level, "waveTrackBg", config.waveTrackBg); - xml.colorTag(level, "outputTrackBg", config.outputTrackBg); - xml.colorTag(level, "inputTrackBg", config.inputTrackBg); - xml.colorTag(level, "groupTrackBg", config.groupTrackBg); - xml.colorTag(level, "auxTrackBg", config.auxTrackBg); - xml.colorTag(level, "synthTrackBg", config.synthTrackBg); + xml.colorTag(level, "midiTrackBg", MusEConfig::config.midiTrackBg); + xml.colorTag(level, "ctrlGraphFg", MusEConfig::config.ctrlGraphFg); + xml.colorTag(level, "drumTrackBg", MusEConfig::config.drumTrackBg); + xml.colorTag(level, "waveTrackBg", MusEConfig::config.waveTrackBg); + xml.colorTag(level, "outputTrackBg", MusEConfig::config.outputTrackBg); + xml.colorTag(level, "inputTrackBg", MusEConfig::config.inputTrackBg); + xml.colorTag(level, "groupTrackBg", MusEConfig::config.groupTrackBg); + xml.colorTag(level, "auxTrackBg", MusEConfig::config.auxTrackBg); + xml.colorTag(level, "synthTrackBg", MusEConfig::config.synthTrackBg); // Removed by Tim. p3.3.6 //xml.intTag(level, "txSyncPort", txSyncPort); @@ -1316,35 +1317,35 @@ void MusE::writeGlobalConfiguration(int level, Xml& xml) const // xml.intTag(level, "acceptMMC", acceptMMC); // xml.intTag(level, "acceptMC", acceptMC); - xml.qrectTag(level, "geometryMain", config.geometryMain); - xml.qrectTag(level, "geometryTransport", config.geometryTransport); - xml.qrectTag(level, "geometryBigTime", config.geometryBigTime); - xml.qrectTag(level, "geometryPianoroll", config.geometryPianoroll); - xml.qrectTag(level, "geometryDrumedit", config.geometryDrumedit); - //xml.qrectTag(level, "geometryMixer", config.geometryMixer); // Obsolete + xml.qrectTag(level, "geometryMain", MusEConfig::config.geometryMain); + xml.qrectTag(level, "geometryTransport", MusEConfig::config.geometryTransport); + xml.qrectTag(level, "geometryBigTime", MusEConfig::config.geometryBigTime); + xml.qrectTag(level, "geometryPianoroll", MusEConfig::config.geometryPianoroll); + xml.qrectTag(level, "geometryDrumedit", MusEConfig::config.geometryDrumedit); + //xml.qrectTag(level, "geometryMixer", MusEConfig::config.geometryMixer); // Obsolete - xml.intTag(level, "bigtimeVisible", config.bigTimeVisible); - xml.intTag(level, "transportVisible", config.transportVisible); + xml.intTag(level, "bigtimeVisible", MusEConfig::config.bigTimeVisible); + xml.intTag(level, "transportVisible", MusEConfig::config.transportVisible); - //xml.intTag(level, "mixerVisible", config.mixerVisible); // Obsolete - xml.intTag(level, "mixer1Visible", config.mixer1Visible); - xml.intTag(level, "mixer2Visible", config.mixer2Visible); - //config.mixer1.write(level, xml, "mixer1"); - //config.mixer2.write(level, xml, "mixer2"); - config.mixer1.write(level, xml); - config.mixer2.write(level, xml); - - xml.intTag(level, "showSplashScreen", config.showSplashScreen); - xml.intTag(level, "canvasShowPartType", config.canvasShowPartType); - xml.intTag(level, "canvasShowPartEvent", config.canvasShowPartEvent); - xml.intTag(level, "canvasShowGrid", config.canvasShowGrid); - xml.strTag(level, "canvasBgPixmap", config.canvasBgPixmap); - xml.strTag(level, "canvasCustomBgList", config.canvasCustomBgList.join(";")); - - xml.colorTag(level, "transportHandleColor", config.transportHandleColor); - xml.colorTag(level, "bigtimeForegroundcolor", config.bigTimeForegroundColor); - xml.colorTag(level, "bigtimeBackgroundcolor", config.bigTimeBackgroundColor); - xml.colorTag(level, "waveEditBackgroundColor", config.waveEditBackgroundColor); + //xml.intTag(level, "mixerVisible", MusEConfig::config.mixerVisible); // Obsolete + xml.intTag(level, "mixer1Visible", MusEConfig::config.mixer1Visible); + xml.intTag(level, "mixer2Visible", MusEConfig::config.mixer2Visible); + //MusEConfig::config.mixer1.write(level, xml, "mixer1"); + //MusEConfig::config.mixer2.write(level, xml, "mixer2"); + MusEConfig::config.mixer1.write(level, xml); + MusEConfig::config.mixer2.write(level, xml); + + xml.intTag(level, "showSplashScreen", MusEConfig::config.showSplashScreen); + xml.intTag(level, "canvasShowPartType", MusEConfig::config.canvasShowPartType); + xml.intTag(level, "canvasShowPartEvent", MusEConfig::config.canvasShowPartEvent); + xml.intTag(level, "canvasShowGrid", MusEConfig::config.canvasShowGrid); + xml.strTag(level, "canvasBgPixmap", MusEConfig::config.canvasBgPixmap); + xml.strTag(level, "canvasCustomBgList", MusEConfig::config.canvasCustomBgList.join(";")); + + xml.colorTag(level, "transportHandleColor", MusEConfig::config.transportHandleColor); + xml.colorTag(level, "bigtimeForegroundcolor", MusEConfig::config.bigTimeForegroundColor); + xml.colorTag(level, "bigtimeBackgroundcolor", MusEConfig::config.bigTimeBackgroundColor); + xml.colorTag(level, "waveEditBackgroundColor", MusEConfig::config.waveEditBackgroundColor); writeSeqConfiguration(level, xml, false); @@ -1369,14 +1370,14 @@ void MusE::writeConfiguration(int level, Xml& xml) const { xml.tag(level++, "configuration"); - xml.intTag(level, "midiInputDevice", midiInputPorts); - xml.intTag(level, "midiInputChannel", midiInputChannel); - xml.intTag(level, "midiRecordType", midiRecordType); - xml.intTag(level, "midiThruType", midiThruType); - xml.intTag(level, "midiFilterCtrl1", midiFilterCtrl1); - xml.intTag(level, "midiFilterCtrl2", midiFilterCtrl2); - xml.intTag(level, "midiFilterCtrl3", midiFilterCtrl3); - xml.intTag(level, "midiFilterCtrl4", midiFilterCtrl4); + xml.intTag(level, "midiInputDevice", MusEGlobal::midiInputPorts); + xml.intTag(level, "MusEGlobal::midiInputChannel", MusEGlobal::midiInputChannel); + xml.intTag(level, "MusEGlobal::midiRecordType", MusEGlobal::midiRecordType); + xml.intTag(level, "MusEGlobal::midiThruType", MusEGlobal::midiThruType); + xml.intTag(level, "MusEGlobal::midiFilterCtrl1", MusEGlobal::midiFilterCtrl1); + xml.intTag(level, "MusEGlobal::midiFilterCtrl2", MusEGlobal::midiFilterCtrl2); + xml.intTag(level, "MusEGlobal::midiFilterCtrl3", MusEGlobal::midiFilterCtrl3); + xml.intTag(level, "MusEGlobal::midiFilterCtrl4", MusEGlobal::midiFilterCtrl4); xml.intTag(level, "waveTracksVisible", WaveTrack::visible()); xml.intTag(level, "auxTracksVisible", AudioAux::visible()); @@ -1515,6 +1516,25 @@ void MusE::configMidiFile() } //--------------------------------------------------------- +// configGlobalSettings +//--------------------------------------------------------- + +void MusE::configGlobalSettings() + { + if (!globalSettingsConfig) + globalSettingsConfig = new GlobalSettingsConfig(); + + if (globalSettingsConfig->isVisible()) { + globalSettingsConfig->raise(); + globalSettingsConfig->activateWindow(); + } + else + globalSettingsConfig->show(); + } + +} // namespace MusEApp + +//--------------------------------------------------------- // MidiFileConfig // config properties of exported midi files //--------------------------------------------------------- @@ -1534,18 +1554,18 @@ MidiFileConfig::MidiFileConfig(QWidget* parent) void MidiFileConfig::updateValues() { int divisionIdx = 2; - switch(config.midiDivision) { + switch(MusEConfig::config.midiDivision) { case 96: divisionIdx = 0; break; case 192: divisionIdx = 1; break; case 384: divisionIdx = 2; break; } divisionCombo->setCurrentIndex(divisionIdx); - formatCombo->setCurrentIndex(config.smfFormat); - extendedFormat->setChecked(config.extendedMidi); - copyrightEdit->setText(config.copyright); - optNoteOffs->setChecked(config.expOptimNoteOffs); - twoByteTimeSigs->setChecked(config.exp2ByteTimeSigs); - splitPartsCheckBox->setChecked(config.importMidiSplitParts); + formatCombo->setCurrentIndex(MusEConfig::config.smfFormat); + extendedFormat->setChecked(MusEConfig::config.extendedMidi); + copyrightEdit->setText(MusEConfig::config.copyright); + optNoteOffs->setChecked(MusEConfig::config.expOptimNoteOffs); + twoByteTimeSigs->setChecked(MusEConfig::config.exp2ByteTimeSigs); + splitPartsCheckBox->setChecked(MusEConfig::config.importMidiSplitParts); } //--------------------------------------------------------- @@ -1558,15 +1578,15 @@ void MidiFileConfig::okClicked() int divisions[3] = { 96, 192, 384 }; if (divisionIdx >= 0 && divisionIdx < 3) - config.midiDivision = divisions[divisionIdx]; - config.extendedMidi = extendedFormat->isChecked(); - config.smfFormat = formatCombo->currentIndex(); - config.copyright = copyrightEdit->text(); - config.expOptimNoteOffs = optNoteOffs->isChecked(); - config.exp2ByteTimeSigs = twoByteTimeSigs->isChecked(); - config.importMidiSplitParts = splitPartsCheckBox->isChecked(); - - muse->changeConfig(true); // write config file + MusEConfig::config.midiDivision = divisions[divisionIdx]; + MusEConfig::config.extendedMidi = extendedFormat->isChecked(); + MusEConfig::config.smfFormat = formatCombo->currentIndex(); + MusEConfig::config.copyright = copyrightEdit->text(); + MusEConfig::config.expOptimNoteOffs = optNoteOffs->isChecked(); + MusEConfig::config.exp2ByteTimeSigs = twoByteTimeSigs->isChecked(); + MusEConfig::config.importMidiSplitParts = splitPartsCheckBox->isChecked(); + + MusEGlobal::muse->changeConfig(true); // write config file close(); } @@ -1579,23 +1599,7 @@ void MidiFileConfig::cancelClicked() close(); } -//--------------------------------------------------------- -// configGlobalSettings -//--------------------------------------------------------- - -void MusE::configGlobalSettings() - { - if (!globalSettingsConfig) - globalSettingsConfig = new GlobalSettingsConfig(); - - if (globalSettingsConfig->isVisible()) { - globalSettingsConfig->raise(); - globalSettingsConfig->activateWindow(); - } - else - globalSettingsConfig->show(); - } - +namespace MusEConfig { //--------------------------------------------------------- // write @@ -1681,3 +1685,4 @@ void MixerConfig::read(Xml& xml) } +} // namespace MusEConfig diff --git a/muse2/muse/confmport.cpp b/muse2/muse/confmport.cpp index b5423699..b451a749 100644 --- a/muse2/muse/confmport.cpp +++ b/muse2/muse/confmport.cpp @@ -457,7 +457,7 @@ void MPConfig::rbClicked(QTableWidgetItem* item) case DEVCOL_INROUTES: case DEVCOL_OUTROUTES: { - if(!checkAudioDevice()) + if(!MusEGlobal::checkAudioDevice()) return; if(audioDevice->deviceType() != AudioDevice::JACK_AUDIO) // Only if Jack is running. @@ -647,7 +647,7 @@ void MPConfig::rbClicked(QTableWidgetItem* item) act->setEnabled(!song->midis()->empty()); // && midiPorts[no].device()); connect(defpup, SIGNAL(triggered(QAction*)), SLOT(changeDefInputRoutes(QAction*))); - //connect(defpup, SIGNAL(aboutToHide()), muse, SLOT(routingPopupMenuAboutToHide())); + //connect(defpup, SIGNAL(aboutToHide()), MusEGlobal::muse, SLOT(routingPopupMenuAboutToHide())); //defpup->popup(QCursor::pos()); defpup->exec(QCursor::pos()); delete defpup; @@ -690,7 +690,7 @@ void MPConfig::rbClicked(QTableWidgetItem* item) act->setEnabled(!song->midis()->empty()); // && midiPorts[no].device()); connect(defpup, SIGNAL(triggered(QAction*)), SLOT(changeDefOutputRoutes(QAction*))); - //connect(defpup, SIGNAL(aboutToHide()), muse, SLOT(routingPopupMenuAboutToHide())); + //connect(defpup, SIGNAL(aboutToHide()), MusEGlobal::muse, SLOT(routingPopupMenuAboutToHide())); //defpup->popup(QCursor::pos()); defpup->exec(QCursor::pos()); delete defpup; @@ -899,7 +899,7 @@ void MPConfig::rbClicked(QTableWidgetItem* item) } midiSeq->msgSetMidiDevice(port, sdev); - muse->changeConfig(true); // save configuration file + MusEGlobal::muse->changeConfig(true); // save configuration file song->update(); } } @@ -1352,7 +1352,7 @@ void MPConfig::addInstanceClicked() MidiDevice* dev = port->device(); if (dev==0) { midiSeq->msgSetMidiDevice(port, si); - muse->changeConfig(true); // save configuration file + MusEGlobal::muse->changeConfig(true); // save configuration file song->update(); break; } @@ -1381,6 +1381,8 @@ void MPConfig::removeInstanceClicked() audio->msgRemoveTrack(*ii); } +namespace MusEApp { + //--------------------------------------------------------- // configMidiPorts //--------------------------------------------------------- @@ -1395,3 +1397,4 @@ void MusE::configMidiPorts() midiPortConfig->activateWindow(); } +} // namespace MusEApp diff --git a/muse2/muse/ctrl.cpp b/muse2/muse/ctrl.cpp index 0355efe6..3779682d 100644 --- a/muse2/muse/ctrl.cpp +++ b/muse2/muse/ctrl.cpp @@ -156,11 +156,11 @@ double CtrlList::value(int frame) const //printf("before val1=%f val2=%f\n", val1,val2); if (_valueType == VAL_LOG) { val1 = 20.0*fast_log10(val1); - if (val1 < config.minSlider) - val1=config.minSlider; + if (val1 < MusEConfig::config.minSlider) + val1=MusEConfig::config.minSlider; val2 = 20.0*fast_log10(val2); - if (val2 < config.minSlider) - val2=config.minSlider; + if (val2 < MusEConfig::config.minSlider) + val2=MusEConfig::config.minSlider; } //printf("after val1=%f val2=%f\n", val1,val2); frame -= frame1; diff --git a/muse2/muse/ctrl/ctrlcanvas.cpp b/muse2/muse/ctrl/ctrlcanvas.cpp index 5b95a6f7..7c77a836 100644 --- a/muse2/muse/ctrl/ctrlcanvas.cpp +++ b/muse2/muse/ctrl/ctrlcanvas.cpp @@ -199,10 +199,10 @@ CtrlCanvas::CtrlCanvas(MidiEditor* e, QWidget* parent, int xmag, const char* name, CtrlPanel* pnl) : View(parent, xmag, 1, name) { setBg(Qt::white); - setFont(config.fonts[3]); + setFont(MusEConfig::config.fonts[3]); editor = e; drag = DRAG_OFF; - tool = PointerTool; + tool = MusEWidget::PointerTool; pos[0] = 0; pos[1] = 0; pos[2] = 0; @@ -227,7 +227,7 @@ CtrlCanvas::CtrlCanvas(MidiEditor* e, QWidget* parent, int xmag, setCurTrackAndPart(); } connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); - connect(muse, SIGNAL(configChanged()), SLOT(configChanged())); + connect(MusEGlobal::muse, SIGNAL(configChanged()), SLOT(configChanged())); curDrumInstrument = editor->curDrumInstrument(); //printf("CtrlCanvas::CtrlCanvas curDrumInstrument:%d\n", curDrumInstrument); @@ -472,7 +472,7 @@ void CtrlCanvas::songChanged(int type) return; if(type & SC_CONFIG) - setFont(config.fonts[3]); + setFont(MusEConfig::config.fonts[3]); bool changed = false; if(type & (SC_CONFIG | SC_PART_MODIFIED | SC_SELECTION)) @@ -678,7 +678,7 @@ void CtrlCanvas::viewMousePressEvent(QMouseEvent* event) return; start = event->pos(); - Tool activeTool = tool; + MusEWidget::Tool activeTool = tool; bool ctrlKey = event->modifiers() & Qt::ControlModifier; int xpos = start.x(); @@ -687,7 +687,7 @@ void CtrlCanvas::viewMousePressEvent(QMouseEvent* event) MidiController::ControllerType type = midiControllerType(_controller->num()); switch (activeTool) { - case PointerTool: + case MusEWidget::PointerTool: if(curPart) // p4.0.27 { drag = DRAG_LASSO_START; @@ -732,7 +732,7 @@ void CtrlCanvas::viewMousePressEvent(QMouseEvent* event) break; - case PencilTool: + case MusEWidget::PencilTool: if ((!ctrlKey) && (type != MidiController::Velo)) { drag = DRAG_NEW; song->startUndo(); @@ -745,7 +745,7 @@ void CtrlCanvas::viewMousePressEvent(QMouseEvent* event) } break; - case RubberTool: + case MusEWidget::RubberTool: if (type != MidiController::Velo) { drag = DRAG_DELETE; song->startUndo(); @@ -753,7 +753,7 @@ void CtrlCanvas::viewMousePressEvent(QMouseEvent* event) } break; - case DrawTool: + case MusEWidget::DrawTool: if (drawLineMode) { line2x = xpos; line2y = ypos; @@ -817,7 +817,7 @@ void CtrlCanvas::viewMouseMoveEvent(QMouseEvent* event) default: break; } - if (tool == DrawTool && drawLineMode) { + if (tool == MusEWidget::DrawTool && drawLineMode) { line2x = pos.x(); line2y = pos.y(); redraw(); @@ -930,8 +930,8 @@ void CtrlCanvas::newValRamp(int x1, int y1, int x2, int y2) int raster = editor->raster(); if (raster == 1) // set reasonable raster { - //raster = config.division/4; - raster = config.division/16; // Let's use 64th notes, for a bit finer resolution. p4.0.18 Tim. + //raster = MusEConfig::config.division/4; + raster = MusEConfig::config.division/16; // Let's use 64th notes, for a bit finer resolution. p4.0.18 Tim. useRaster = true; } @@ -1388,8 +1388,8 @@ void CtrlCanvas::newVal(int x1, int y1, int x2, int y2) int raster = editor->raster(); if (raster == 1) // set reasonable raster { - //raster = config.division/4; - raster = config.division/16; // Let's use 64th notes, for a bit finer resolution. p4.0.18 Tim. + //raster = MusEConfig::config.division/4; + raster = MusEConfig::config.division/16; // Let's use 64th notes, for a bit finer resolution. p4.0.18 Tim. useRaster = true; } @@ -1621,14 +1621,14 @@ void CtrlCanvas::deleteVal(int x1, int x2, int) void CtrlCanvas::setTool(int t) { - if (tool == Tool(t)) + if (tool == MusEWidget::Tool(t)) return; - tool = Tool(t); + tool = MusEWidget::Tool(t); switch(tool) { - case PencilTool: + case MusEWidget::PencilTool: setCursor(QCursor(*pencilIcon, 4, 15)); break; - case DrawTool: + case MusEWidget::DrawTool: drawLineMode = false; break; default: @@ -1673,7 +1673,7 @@ void CtrlCanvas::pdrawItems(QPainter& p, const QRect& rect, const MidiPart* part //if(!event.empty() && event.selected()) p.setPen(QPen(Qt::blue, 3)); else - p.setPen(QPen(config.ctrlGraphFg, 3)); + p.setPen(QPen(MusEConfig::config.ctrlGraphFg, 3)); } else p.setPen(QPen(Qt::darkGray, 3)); @@ -1765,7 +1765,7 @@ void CtrlCanvas::pdrawItems(QPainter& p, const QRect& rect, const MidiPart* part p.drawLine(x1, lval, tick, lval); } else - p.fillRect(x1, lval, tick - x1, wh - lval, selected ? Qt::blue : config.ctrlGraphFg); + p.fillRect(x1, lval, tick - x1, wh - lval, selected ? Qt::blue : MusEConfig::config.ctrlGraphFg); } @@ -1797,8 +1797,8 @@ void CtrlCanvas::pdrawItems(QPainter& p, const QRect& rect, const MidiPart* part p.drawLine(x1, lval, x + w, lval); } else - //p.fillRect(x1, lval, (x+w) - x1, wh - lval, config.ctrlGraphFg); - p.fillRect(x1, lval, (x+w) - x1, wh - lval, selected ? Qt::blue : config.ctrlGraphFg); + //p.fillRect(x1, lval, (x+w) - x1, wh - lval, MusEConfig::config.ctrlGraphFg); + p.fillRect(x1, lval, (x+w) - x1, wh - lval, selected ? Qt::blue : MusEConfig::config.ctrlGraphFg); } } } @@ -1911,18 +1911,18 @@ void CtrlCanvas::drawOverlay(QPainter& p) { QString s(_controller ? _controller->name() : QString("")); - //p.setFont(config.fonts[3]); // Use widget font instead. + //p.setFont(MusEConfig::config.fonts[3]); // Use widget font instead. p.setFont(font()); p.setPen(Qt::black); - //QFontMetrics fm(config.fonts[3]); // Use widget font metrics instead. + //QFontMetrics fm(MusEConfig::config.fonts[3]); // Use widget font metrics instead. //int y = fm.lineSpacing() + 2; int y = fontMetrics().lineSpacing() + 2; p.drawText(2, y, s); if (noEvents) { - //p.setFont(config.fonts[3]); + //p.setFont(MusEConfig::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"); @@ -1936,7 +1936,7 @@ void CtrlCanvas::drawOverlay(QPainter& p) QRect CtrlCanvas::overlayRect() const { - //QFontMetrics fm(config.fonts[3]); // Use widget font metrics instead (and set a widget font) !!! + //QFontMetrics fm(MusEConfig::config.fonts[3]); // Use widget font metrics instead (and set a widget font) !!! QFontMetrics fm(fontMetrics()); QRect r(fm.boundingRect(_controller ? _controller->name() : QString(""))); @@ -1969,7 +1969,7 @@ void CtrlCanvas::draw(QPainter& p, const QRect& rect) // draw line tool //--------------------------------------------------- - if (drawLineMode && (tool == DrawTool)) { + if (drawLineMode && (tool == MusEWidget::DrawTool)) { p.setPen(Qt::black); p.drawLine(line1x, line1y, line2x, line2y); } diff --git a/muse2/muse/ctrl/ctrlcanvas.h b/muse2/muse/ctrl/ctrlcanvas.h index 5fc31ed4..8846d2ce 100644 --- a/muse2/muse/ctrl/ctrlcanvas.h +++ b/muse2/muse/ctrl/ctrlcanvas.h @@ -153,7 +153,7 @@ class CtrlCanvas : public View { DragMode drag; QRect lasso; QPoint start; - Tool tool; + MusEWidget::Tool tool; unsigned pos[3]; int curDrumInstrument; //Used by the drum-editor to view velocity of only one key (one drum) diff --git a/muse2/muse/ctrl/ctrledit.cpp b/muse2/muse/ctrl/ctrledit.cpp index 836ebcfb..c9c33999 100644 --- a/muse2/muse/ctrl/ctrledit.cpp +++ b/muse2/muse/ctrl/ctrledit.cpp @@ -60,7 +60,7 @@ CtrlEdit::CtrlEdit(QWidget* parent, MidiEditor* e, int xmag, hbox->setContentsMargins(0, 0, 0, 0); hbox->setSpacing (0); - canvas->setOrigin(-(config.division/4), 0); + canvas->setOrigin(-(MusEConfig::config.division/4), 0); canvas->setMinimumHeight(50); diff --git a/muse2/muse/ctrl/ctrlpanel.cpp b/muse2/muse/ctrl/ctrlpanel.cpp index f9f399c4..998058d7 100644 --- a/muse2/muse/ctrl/ctrlpanel.cpp +++ b/muse2/muse/ctrl/ctrlpanel.cpp @@ -87,7 +87,7 @@ CtrlPanel::CtrlPanel(QWidget* parent, MidiEditor* e, const char* name) dbox->setContentsMargins(0, 0, 0, 0); selCtrl = new QPushButton(tr("S")); - selCtrl->setFont(config.fonts[3]); + selCtrl->setFont(MusEConfig::config.fonts[3]); selCtrl->setFixedHeight(20); selCtrl->setSizePolicy( QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); @@ -97,7 +97,7 @@ CtrlPanel::CtrlPanel(QWidget* parent, MidiEditor* e, const char* name) // destroy button QPushButton* destroy = new QPushButton(tr("X")); - destroy->setFont(config.fonts[3]); + destroy->setFont(MusEConfig::config.fonts[3]); destroy->setFixedHeight(20); destroy->setSizePolicy( QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); @@ -125,7 +125,7 @@ CtrlPanel::CtrlPanel(QWidget* parent, MidiEditor* e, const char* name) _dl->setPrecision(0); _dl->setToolTip(tr("double click on/off")); _dl->setSpecialText(tr("off")); - _dl->setFont(config.fonts[1]); + _dl->setFont(MusEConfig::config.fonts[1]); _dl->setBackgroundRole(QPalette::Mid); _dl->setFrame(true); _dl->setFixedWidth(36); @@ -149,7 +149,7 @@ CtrlPanel::CtrlPanel(QWidget* parent, MidiEditor* e, const char* name) dbox->addStretch(); dbox->addWidget(_dl); dbox->addStretch(); - connect(heartBeatTimer, SIGNAL(timeout()), SLOT(heartBeat())); + connect(MusEGlobal::heartBeatTimer, SIGNAL(timeout()), SLOT(heartBeat())); inHeartBeat = false; setLayout(vbox); } @@ -871,7 +871,7 @@ void CtrlPanel::ctrlPopup() int rv2 = act2->data().toInt(); if (rv2 == max + 2) // edit instrument - muse->startEditInstrument(); + MusEGlobal::muse->startEditInstrument(); else // select new instrument control { MidiController* c; @@ -903,7 +903,7 @@ void CtrlPanel::ctrlPopup() } //else if (rv == max + 2) // edit instrument - // muse->startEditInstrument(); + // MusEGlobal::muse->startEditInstrument(); else if (rv == max + 3) { // add new other controller PopupMenu* ctrlSubPop = new PopupMenu(this); diff --git a/muse2/muse/driver/alsamidi.cpp b/muse2/muse/driver/alsamidi.cpp index cde3febf..07688a33 100644 --- a/muse2/muse/driver/alsamidi.cpp +++ b/muse2/muse/driver/alsamidi.cpp @@ -294,7 +294,7 @@ void MidiAlsaDevice::writeRouting(int level, Xml& xml) const bool MidiAlsaDevice::putMidiEvent(const MidiPlayEvent& e) { - if (midiOutputTrace) { + if (MusEGlobal::midiOutputTrace) { printf("MidiOut: midiAlsa: "); e.dump(); } @@ -472,7 +472,7 @@ bool MidiAlsaDevice::putEvent(snd_seq_event_t* event) bool initMidiAlsa() { - if (debugMsg) + if (MusEGlobal::debugMsg) printf("initMidiAlsa\n"); int error = snd_seq_open(&alsaSeq, "hw", SND_SEQ_OPEN_DUPLEX, SND_SEQ_NONBLOCK); if (error < 0) { @@ -510,7 +510,7 @@ bool initMidiAlsa() if (capability & inCap) flags |= 2; dev->setrwFlags(flags); - if (debugMsg) + if (MusEGlobal::debugMsg) printf("ALSA port add: <%s>, %d:%d flags %d 0x%0x\n", snd_seq_port_info_get_name(pinfo), adr.client, adr.port, @@ -765,7 +765,7 @@ void alsaProcessMidiInput() } if (mdev == 0 || curPort == -1) { - if (debugMsg) { + if (MusEGlobal::debugMsg) { fprintf(stderr, "no port %d:%d found for received alsa event\n", ev->source.client, ev->source.port); } @@ -778,7 +778,7 @@ void alsaProcessMidiInput() { if(mdev == 0) { - if (debugMsg) + if (MusEGlobal::debugMsg) { fprintf(stderr, "no port %d:%d found for received alsa event\n", ev->source.client, ev->source.port); diff --git a/muse2/muse/driver/dummyaudio.cpp b/muse2/muse/driver/dummyaudio.cpp index dae21a26..77b08252 100644 --- a/muse2/muse/driver/dummyaudio.cpp +++ b/muse2/muse/driver/dummyaudio.cpp @@ -98,7 +98,7 @@ class DummyAudioDevice : public AudioDevice { // p3.3.30 //if (nframes > dummyFrames) { //printf("error: segment size > 1024\n"); - if (nframes > segmentSize) { + if (nframes > MusEGlobal::segmentSize) { printf("DummyAudioDevice::getBuffer nframes > segment size\n"); exit(-1); @@ -140,7 +140,7 @@ class DummyAudioDevice : public AudioDevice { return _framePos; } virtual unsigned frameTime() const { - return lrint(curTime() * sampleRate); + return lrint(curTime() * MusEGlobal::sampleRate); } virtual bool isRealtime() { return realtimeFlag; } //virtual int realtimePriority() const { return 40; } @@ -215,7 +215,7 @@ DummyAudioDevice::DummyAudioDevice() // Added by Tim. p3.3.15 // p3.3.30 //posix_memalign((void**)&buffer, 16, sizeof(float) * dummyFrames); - posix_memalign((void**)&buffer, 16, sizeof(float) * config.dummyAudioBufSize); + posix_memalign((void**)&buffer, 16, sizeof(float) * MusEConfig::config.dummyAudioBufSize); dummyThread = 0; realtimeFlag = false; @@ -227,6 +227,8 @@ DummyAudioDevice::DummyAudioDevice() cmdQueue.clear(); } +namespace MusEApp { + //--------------------------------------------------------- // exitDummyAudio //--------------------------------------------------------- @@ -239,6 +241,8 @@ void exitDummyAudio() audioDevice = NULL; } +} // namespace MusEApp + //--------------------------------------------------------- // initDummyAudio //--------------------------------------------------------- @@ -289,13 +293,13 @@ static void* dummyLoop(void* ptr) //unsigned int tickRate = 25; // p3.3.30 - //sampleRate = 25600; - sampleRate = config.dummyAudioSampleRate; - //segmentSize = dummyFrames; - segmentSize = config.dummyAudioBufSize; + //MusEGlobal::sampleRate = 25600; + MusEGlobal::sampleRate = MusEConfig::config.dummyAudioSampleRate; + //MusEGlobal::segmentSize = dummyFrames; + MusEGlobal::segmentSize = MusEConfig::config.dummyAudioBufSize; #if 0 - //unsigned int tickRate = sampleRate / dummyFrames; - unsigned int tickRate = sampleRate / segmentSize; + //unsigned int tickRate = MusEGlobal::sampleRate / dummyFrames; + unsigned int tickRate = MusEGlobal::sampleRate / MusEGlobal::segmentSize; AlsaTimer timer; fprintf(stderr, "Get alsa timer for dummy driver:\n"); @@ -312,7 +316,7 @@ static void* dummyLoop(void* ptr) /* Depending on nature of the timer, the requested tickRate might not * be available. The return value is the nearest available frequency, - * so use this to reset our dummpy sampleRate to keep everything + * so use this to reset our dummpy MusEGlobal::sampleRate to keep everything * consistent. */ tickRate = timer.setTimerFreq( /*250*/ tickRate ); @@ -322,7 +326,7 @@ static void* dummyLoop(void* ptr) if(tickRate == 0) tickRate = timer.getTimerFreq(); - sampleRate = tickRate * segmentSize; + MusEGlobal::sampleRate = tickRate * MusEGlobal::segmentSize; timer.startTimer(); #endif @@ -335,7 +339,7 @@ static void* dummyLoop(void* ptr) /* - doSetuid(); + MusEGlobal::doSetuid(); struct sched_param rt_param; int rv; memset(&rt_param, 0, sizeof(sched_param)); @@ -364,13 +368,13 @@ static void* dummyLoop(void* ptr) fprintf(stderr, "Unable to set thread to SCHED_FIFO\n"); } } - undoSetuid(); + MusEGlobal::undoSetuid(); */ #ifndef __APPLE__ - doSetuid(); + MusEGlobal::doSetuid(); //if (realTimePriority) { - if (realTimeScheduling) { + if (MusEGlobal::realTimeScheduling) { // // check if we really got realtime priviledges // @@ -382,7 +386,7 @@ static void* dummyLoop(void* ptr) { if (policy != SCHED_FIFO) printf("audio dummy thread _NOT_ running SCHED_FIFO\n"); - else if (debugMsg) { + else if (MusEGlobal::debugMsg) { struct sched_param rt_param; memset(&rt_param, 0, sizeof(sched_param)); int type; @@ -394,7 +398,7 @@ static void* dummyLoop(void* ptr) } } } - undoSetuid(); + MusEGlobal::undoSetuid(); #endif #if 0 @@ -438,8 +442,8 @@ static void* dummyLoop(void* ptr) } } } - audio->process(segmentSize); - int increment = segmentSize; // 1 //tickRate / sampleRate * segmentSize; + audio->process(MusEGlobal::segmentSize); + int increment = MusEGlobal::segmentSize; // 1 //tickRate / MusEGlobal::sampleRate * MusEGlobal::segmentSize; drvPtr->_framePos+=increment; if (drvPtr->state == Audio::PLAY) { @@ -452,12 +456,12 @@ static void* dummyLoop(void* ptr) { //if(audioState == AUDIO_RUNNING) if(audio->isRunning()) - //audio->process(segmentSize, drvPtr->state); - audio->process(segmentSize); + //audio->process(MusEGlobal::segmentSize, drvPtr->state); + audio->process(MusEGlobal::segmentSize); //else if (audioState == AUDIO_START1) // audioState = AUDIO_START2; - //usleep(dummyFrames*1000000/AL::sampleRate); - usleep(segmentSize*1000000/sampleRate); + //usleep(dummyFrames*1000000/AL::MusEGlobal::sampleRate); + usleep(MusEGlobal::segmentSize*1000000/MusEGlobal::sampleRate); //if(dummyAudio->seekflag) if(drvPtr->seekflag) { @@ -471,9 +475,9 @@ static void* dummyLoop(void* ptr) //if(dummyAudio->state == Audio::PLAY) // dummyAudio->pos += dummyFrames; - drvPtr->_framePos += segmentSize; + drvPtr->_framePos += MusEGlobal::segmentSize; if(drvPtr->state == Audio::PLAY) - drvPtr->playPos += segmentSize; + drvPtr->playPos += MusEGlobal::segmentSize; } #endif @@ -487,7 +491,7 @@ void DummyAudioDevice::start(int priority) _realTimePriority = priority; pthread_attr_t* attributes = 0; - if (realTimeScheduling && _realTimePriority > 0) { + if (MusEGlobal::realTimeScheduling && _realTimePriority > 0) { attributes = (pthread_attr_t*) malloc(sizeof(pthread_attr_t)); pthread_attr_init(attributes); @@ -514,11 +518,11 @@ void DummyAudioDevice::start(int priority) int rv = pthread_create(&dummyThread, attributes, ::dummyLoop, this); if(rv) { - // p4.0.16: realTimeScheduling is unreliable. It is true even in some clearly non-RT cases. + // p4.0.16: MusEGlobal::realTimeScheduling is unreliable. It is true even in some clearly non-RT cases. // I cannot seem to find a reliable answer to the question of "are we RT or not". // MusE was failing with a stock kernel because of PTHREAD_EXPLICIT_SCHED. // So we'll just have to try again without attributes. - if (realTimeScheduling && _realTimePriority > 0) + if (MusEGlobal::realTimeScheduling && _realTimePriority > 0) rv = pthread_create(&dummyThread, NULL, ::dummyLoop, this); } diff --git a/muse2/muse/driver/jack.cpp b/muse2/muse/driver/jack.cpp index 4bc6da0b..f99e07b9 100644 --- a/muse2/muse/driver/jack.cpp +++ b/muse2/muse/driver/jack.cpp @@ -54,8 +54,8 @@ //#include "errorhandler.h" #ifndef RTCAP -extern void doSetuid(); -extern void undoSetuid(); +extern void MusEGlobal::doSetuid(); +extern void MusEGlobal::undoSetuid(); #endif #ifdef VST_SUPPORT @@ -84,19 +84,6 @@ inline bool checkJackClient(jack_client_t* _client) } return true; } -//--------------------------------------------------------- -// checkAudioDevice - make sure audioDevice exists -//--------------------------------------------------------- -bool checkAudioDevice() - { - if (audioDevice == NULL) { - if(debugMsg) - printf("Muse:checkAudioDevice: no audioDevice\n"); - return false; - } - return true; - } - //--------------------------------------------------------- // jack_thread_init @@ -104,7 +91,7 @@ bool checkAudioDevice() static void jack_thread_init (void* ) // data { - doSetuid(); + MusEGlobal::doSetuid(); /* if (jackAudio->isRealtime()) { struct sched_param rt_param; @@ -138,7 +125,7 @@ static void jack_thread_init (void* ) // data if (loadVST) fst_adopt_thread(); #endif - undoSetuid(); + MusEGlobal::undoSetuid(); } /* @@ -287,11 +274,11 @@ int JackAudioDevice::processAudio(jack_nframes_t frames, void*) // if (JACK_DEBUG) // printf("processAudio - >>>>\n"); - segmentSize = frames; + MusEGlobal::segmentSize = frames; if (audio->isRunning()) audio->process((unsigned long)frames); else { - if (debugMsg) + if (MusEGlobal::debugMsg) puts("jack calling when audio is disconnected!\n"); } // if (JACK_DEBUG) @@ -411,7 +398,7 @@ static void processShutdown(void*) audio->shutdown(); int c=0; - while(midiSeqRunning == true) { + while(MusEGlobal::midiSeqRunning == true) { if(c++ >10) { fprintf(stderr, "sequencer still running, something is very wrong.\n"); break; @@ -555,13 +542,13 @@ bool initJackAudio() if (JACK_DEBUG) printf("initJackAudio()\n"); - if (debugMsg) { + if (MusEGlobal::debugMsg) { fprintf(stderr,"initJackAudio()\n"); jack_set_error_function(jackError); } else jack_set_error_function(noJackError); - doSetuid(); + MusEGlobal::doSetuid(); //jack_client_t* client = 0; //int i = 0; @@ -589,25 +576,25 @@ bool initJackAudio() if (status & JackVersionError) printf("jack server has wrong version\n"); printf("cannot create jack client\n"); - undoSetuid(); // p3.3.51 + MusEGlobal::undoSetuid(); // p3.3.51 return true; } - if (debugMsg) + if (MusEGlobal::debugMsg) fprintf(stderr, "initJackAudio(): client %s opened.\n", jack_get_client_name(client)); if (client) { jack_set_error_function(jackError); //jackAudio = new JackAudioDevice(client, jackIdString); jackAudio = new JackAudioDevice(client, jack_get_client_name(client)); - if (debugMsg) + if (MusEGlobal::debugMsg) fprintf(stderr, "initJackAudio(): registering client...\n"); jackAudio->registerClient(); - sampleRate = jack_get_sample_rate(client); - segmentSize = jack_get_buffer_size(client); + MusEGlobal::sampleRate = jack_get_sample_rate(client); + MusEGlobal::segmentSize = jack_get_buffer_size(client); jack_set_thread_init_callback(client, (JackThreadInitCallback) jack_thread_init, 0); //jack_set_timebase_callback(client, 0, (JackTimebaseCallback) timebase_callback, 0); } - undoSetuid(); + MusEGlobal::undoSetuid(); /* // setup midi input/output @@ -662,14 +649,14 @@ static int bufsize_callback(jack_nframes_t n, void*) static void freewheel_callback(int starting, void*) { - if (debugMsg || JACK_DEBUG) + if (MusEGlobal::debugMsg || JACK_DEBUG) printf("JACK: freewheel_callback: starting%d\n", starting); audio->setFreewheel(starting); } static int srate_callback(jack_nframes_t n, void*) { - if (debugMsg || JACK_DEBUG) + if (MusEGlobal::debugMsg || JACK_DEBUG) printf("JACK: sample rate changed: %d\n", n); return 0; } @@ -680,7 +667,7 @@ static int srate_callback(jack_nframes_t n, void*) static void registration_callback(jack_port_id_t, int, void*) { - if(debugMsg || JACK_DEBUG) + if(MusEGlobal::debugMsg || JACK_DEBUG) printf("JACK: registration changed\n"); audio->sendMsgToGui('R'); @@ -758,7 +745,7 @@ void JackAudioDevice::connectJackMidiPorts() // Ignore our own client ports. if(jack_port_is_mine(_client, port)) { - if(debugMsg) + if(MusEGlobal::debugMsg) printf(" ignoring own port: %s\n", *p); continue; } @@ -769,7 +756,7 @@ void JackAudioDevice::connectJackMidiPorts() //if(strncmp(buffer, "MusE", 4) == 0) // continue; - if(debugMsg) + if(MusEGlobal::debugMsg) printf(" found port: %s ", buffer); // If there are aliases for this port, use the first one - much better for identifying. @@ -785,7 +772,7 @@ void JackAudioDevice::connectJackMidiPorts() //char* namep = (na >= 1) ? aliases[0] : buffer; char* namep = aliases[0]; - if(debugMsg) + if(MusEGlobal::debugMsg) printf("alias: %s\n", aliases[0]); //int flags = 0; @@ -862,7 +849,7 @@ void JackAudioDevice::connectJackMidiPorts() static void client_registration_callback(const char *name, int isRegister, void*) { - if (debugMsg || JACK_DEBUG) + if (MusEGlobal::debugMsg || JACK_DEBUG) printf("JACK: client registration changed:%s register:%d\n", name, isRegister); } @@ -872,7 +859,7 @@ static void client_registration_callback(const char *name, int isRegister, void* static void port_connect_callback(jack_port_id_t a, jack_port_id_t b, int isConnect, void*) { - if (debugMsg || JACK_DEBUG) + if (MusEGlobal::debugMsg || JACK_DEBUG) { //jack_port_t* ap = jack_port_by_id(_client, a); //jack_port_t* bp = jack_port_by_id(_client, b); @@ -895,7 +882,7 @@ static int graph_callback(void*) // context, so we send a message to the gui thread which in turn // calls graphChanged() audio->sendMsgToGui('C'); - if (debugMsg) + if (MusEGlobal::debugMsg) printf("JACK: graph changed\n"); return 0; } @@ -1383,6 +1370,26 @@ void* JackAudioDevice::registerOutPort(const char* name, bool midi) return p; } +namespace MusEGlobal { + +//--------------------------------------------------------- +// checkAudioDevice - make sure audioDevice exists +//--------------------------------------------------------- + +bool checkAudioDevice() + { + if (audioDevice == NULL) { + if(MusEGlobal::debugMsg) + printf("Muse:checkAudioDevice: no audioDevice\n"); + return false; + } + return true; + } + +} // namespace MusEGlobal + +namespace MusEApp { + //--------------------------------------------------------- // exitJackAudio //--------------------------------------------------------- @@ -1401,6 +1408,7 @@ void exitJackAudio() audioDevice = NULL; } +} // namespace MusEApp //--------------------------------------------------------- // connect @@ -1473,10 +1481,10 @@ void JackAudioDevice::start(int /*priority*/) printf("JackAudioDevice::start()\n"); if(!checkJackClient(_client)) return; - doSetuid(); + MusEGlobal::doSetuid(); if (jack_activate(_client)) { - undoSetuid(); // p3.3.51 + MusEGlobal::undoSetuid(); // p3.3.51 fprintf (stderr, "JACK: cannot activate client\n"); exit(-1); } @@ -1518,7 +1526,7 @@ void JackAudioDevice::start(int /*priority*/) // Connect the Jack midi client ports to device ports. connectJackMidiPorts(); - undoSetuid(); + MusEGlobal::undoSetuid(); //MUSE_DEBUG("JackAudioDevice::start()\n"); fflush(stdin); @@ -1609,7 +1617,7 @@ int JackAudioDevice::framesSinceCycleStart() const int JackAudioDevice::frameDelay() const { - jack_nframes_t n = (segmentSize * (segmentCount-1)) - jack_frames_since_cycle_start(client); + jack_nframes_t n = (MusEGlobal::segmentSize * (segmentCount-1)) - jack_frames_since_cycle_start(client); return (int)n; } #endif @@ -1640,7 +1648,7 @@ std::list<QString> JackAudioDevice::outputPorts(bool midi, int aliases) strncpy(buffer, *p, nsz); //if (strncmp(buffer, "MusE", 4) == 0) //{ - // if(debugMsg) + // if(MusEGlobal::debugMsg) // printf("JackAudioDevice::outputPorts ignoring own MusE port: %s\n", *p); // continue; //} @@ -1648,7 +1656,7 @@ std::list<QString> JackAudioDevice::outputPorts(bool midi, int aliases) // Ignore our own client ports. if(jack_port_is_mine(_client, port)) { - if(debugMsg) + if(MusEGlobal::debugMsg) printf("JackAudioDevice::outputPorts ignoring own port: %s\n", *p); continue; } @@ -1713,7 +1721,7 @@ std::list<QString> JackAudioDevice::inputPorts(bool midi, int aliases) strncpy(buffer, *p, nsz); //if (strncmp(buffer, "MusE", 4) == 0) //{ - // if(debugMsg) + // if(MusEGlobal::debugMsg) // printf("JackAudioDevice::inputPorts ignoring own MusE port: %s\n", *p); // continue; //} @@ -1721,7 +1729,7 @@ std::list<QString> JackAudioDevice::inputPorts(bool midi, int aliases) // Ignore our own client ports. if(jack_port_is_mine(_client, port)) { - if(debugMsg) + if(MusEGlobal::debugMsg) printf("JackAudioDevice::inputPorts ignoring own port: %s\n", *p); continue; } @@ -1857,8 +1865,8 @@ void JackAudioDevice::setFreewheel(bool f) bool JackAudioDevice::dummySync(int state) { // Roughly segment time length. - //timespec ts = { 0, (1000000000 * segmentSize) / sampleRate }; // In nanoseconds. - unsigned int sl = (1000000 * segmentSize) / sampleRate; // In microseconds. + //timespec ts = { 0, (1000000000 * MusEGlobal::segmentSize) / MusEGlobal::sampleRate }; // In nanoseconds. + unsigned int sl = (1000000 * MusEGlobal::segmentSize) / MusEGlobal::sampleRate; // In microseconds. double ct = curTime(); // Wait for a default maximum of 5 seconds. @@ -2072,7 +2080,7 @@ int JackAudioDevice::setMaster(bool f) { // Make Muse the Jack timebase master. Do it unconditionally (second param = 0). r = jack_set_timebase_callback(_client, 0, (JackTimebaseCallback) timebase_callback, 0); - if(debugMsg || JACK_DEBUG) + if(MusEGlobal::debugMsg || JACK_DEBUG) { if(r) printf("JackAudioDevice::setMaster jack_set_timebase_callback failed: result:%d\n", r); @@ -2087,7 +2095,7 @@ int JackAudioDevice::setMaster(bool f) else { r = jack_release_timebase(_client); - if(debugMsg || JACK_DEBUG) + if(MusEGlobal::debugMsg || JACK_DEBUG) { if(r) printf("JackAudioDevice::setMaster jack_release_timebase failed: result:%d\n", r); @@ -2102,7 +2110,7 @@ int JackAudioDevice::setMaster(bool f) void JackAudioDevice::scanMidiPorts() { - if(debugMsg) + if(MusEGlobal::debugMsg) printf("JackAudioDevice::scanMidiPorts:\n"); /* @@ -2118,7 +2126,7 @@ void JackAudioDevice::scanMidiPorts() // Ignore our own client ports. if(jack_port_is_mine(_client, port)) { - if(debugMsg) + if(MusEGlobal::debugMsg) printf(" ignoring own port: %s\n", *p); continue; } @@ -2130,7 +2138,7 @@ void JackAudioDevice::scanMidiPorts() //if(strncmp(buffer, "MusE", 4) == 0) // continue; - if(debugMsg) + if(MusEGlobal::debugMsg) printf(" found port: %s ", buffer); // If there are aliases for this port, use the first one - much better for identifying. @@ -2146,7 +2154,7 @@ void JackAudioDevice::scanMidiPorts() //char* namep = (na >= 1) ? aliases[0] : buffer; //char* namep = aliases[0]; //names.insert(std::string(*p)); - if(debugMsg) + if(MusEGlobal::debugMsg) printf("alias: %s\n", aliases[0]); names.insert(std::string(aliases[0])); @@ -2166,7 +2174,7 @@ void JackAudioDevice::scanMidiPorts() for(std::list<MidiDevice*>::iterator imd = to_del.begin(); imd != to_del.end(); ++imd) { - if(debugMsg) + if(MusEGlobal::debugMsg) printf(" removing port device:%s\n", (*imd)->name().toLatin1()); midiDevices.remove(*imd); // This will close (and unregister) the client port. @@ -2227,7 +2235,7 @@ void JackAudioDevice::scanMidiPorts() //JackPort jp(0, QString(buffer), flags); //portList.append(jp); - if(debugMsg) + if(MusEGlobal::debugMsg) printf(" adding port device:%s\n", qname.toLatin1()); MidiJackDevice* dev = new MidiJackDevice(0, qname); diff --git a/muse2/muse/driver/jackaudio.h b/muse2/muse/driver/jackaudio.h index 2b045ac6..d116a2ff 100644 --- a/muse2/muse/driver/jackaudio.h +++ b/muse2/muse/driver/jackaudio.h @@ -28,10 +28,13 @@ class MidiPlayEvent; +namespace MusEGlobal { +bool checkAudioDevice(); +} + //--------------------------------------------------------- // JackAudioDevice //--------------------------------------------------------- -bool checkAudioDevice(); class JackAudioDevice : public AudioDevice { diff --git a/muse2/muse/driver/jackmidi.cpp b/muse2/muse/driver/jackmidi.cpp index 8fc995bb..2e790a10 100644 --- a/muse2/muse/driver/jackmidi.cpp +++ b/muse2/muse/driver/jackmidi.cpp @@ -927,7 +927,7 @@ void MidiJackDevice::recordEvent(MidiRecordEvent& event) if(audio->isPlaying()) event.setLoopNum(audio->loopCount()); - if (midiInputTrace) { + if (MusEGlobal::midiInputTrace) { printf("Jack MidiInput: "); event.dump(); } @@ -979,11 +979,11 @@ void MidiJackDevice::recordEvent(MidiRecordEvent& event) processMidiInputTransformPlugins(event); - if (filterEvent(event, midiRecordType, false)) + if (filterEvent(event, MusEGlobal::midiRecordType, false)) return; if (!applyMidiInputTransformation(event)) { - if (midiInputTrace) + if (MusEGlobal::midiInputTrace) printf(" midi input transformation: event filtered\n"); return; } @@ -1026,7 +1026,7 @@ void MidiJackDevice::eventReceived(jack_midi_event_t* ev) event.setB(0); // NOTE: From MusE-2. Not done here in Muse-1 (yet). - // move all events 2*segmentSize into the future to get + // move all events 2*MusEGlobal::segmentSize into the future to get // jitterfree playback // // cycle n-1 n n+1 @@ -1036,7 +1036,7 @@ void MidiJackDevice::eventReceived(jack_midi_event_t* ev) // // const SeqTime* st = audio->seqTime(); - //unsigned curFrame = st->startFrame() + segmentSize; + //unsigned curFrame = st->startFrame() + MusEGlobal::segmentSize; // unsigned curFrame = st->lastFrameTime; //int frameOffset = audio->getFrameOffset(); unsigned pos = audio->pos().frame(); @@ -1076,7 +1076,7 @@ void MidiJackDevice::eventReceived(jack_midi_event_t* ev) // For now, do not accept if the last byte is not EOX, meaning it's a chunk with more chunks to follow. if(*(((unsigned char*)ev->buffer) + ev->size - 1) != ME_SYSEX_END) { - if(debugMsg) + if(MusEGlobal::debugMsg) printf("MidiJackDevice::eventReceived sysex chunks not supported!\n"); return; } @@ -1108,7 +1108,7 @@ void MidiJackDevice::eventReceived(jack_midi_event_t* ev) //break; // return; default: - if(debugMsg) + if(MusEGlobal::debugMsg) printf("MidiJackDevice::eventReceived unsupported system event 0x%02x\n", type); return; } @@ -1116,13 +1116,13 @@ void MidiJackDevice::eventReceived(jack_midi_event_t* ev) //return; break; default: - if(debugMsg) + if(MusEGlobal::debugMsg) printf("MidiJackDevice::eventReceived unknown event 0x%02x\n", type); //printf("MidiJackDevice::eventReceived unknown event 0x%02x size:%d buf:0x%02x 0x%02x 0x%02x ...0x%02x\n", type, ev->size, *(ev->buffer), *(ev->buffer + 1), *(ev->buffer + 2), *(ev->buffer + (ev->size - 1))); return; } - if (midiInputTrace) { + if (MusEGlobal::midiInputTrace) { printf("MidiInput<%s>: ", name().toLatin1().constData()); event.dump(); } @@ -1148,8 +1148,8 @@ void MidiJackDevice::collectMidiEvents() if(!_in_client_jackport) // p3.3.55 return; - //void* port_buf = jack_port_get_buffer(_client_jackport, segmentSize); - void* port_buf = jack_port_get_buffer(_in_client_jackport, segmentSize); // p3.3.55 + //void* port_buf = jack_port_get_buffer(_client_jackport, MusEGlobal::segmentSize); + void* port_buf = jack_port_get_buffer(_in_client_jackport, MusEGlobal::segmentSize); // p3.3.55 jack_midi_event_t event; jack_nframes_t eventCount = jack_midi_get_event_count(port_buf); @@ -1209,14 +1209,14 @@ bool MidiJackDevice::queueEvent(const MidiPlayEvent& e) // e.dump(); // } - //if(debugMsg) + //if(MusEGlobal::debugMsg) // printf("MidiJackDevice::queueEvent\n"); //if(!_client_jackport) if(!_out_client_jackport) // p3.3.55 return false; - //void* pb = jack_port_get_buffer(_client_jackport, segmentSize); - void* pb = jack_port_get_buffer(_out_client_jackport, segmentSize); // p3.3.55 + //void* pb = jack_port_get_buffer(_client_jackport, MusEGlobal::segmentSize); + void* pb = jack_port_get_buffer(_out_client_jackport, MusEGlobal::segmentSize); // p3.3.55 //unsigned frameCounter = ->frameTime(); int frameOffset = audio->getFrameOffset(); @@ -1225,10 +1225,10 @@ bool MidiJackDevice::queueEvent(const MidiPlayEvent& e) if (ft < 0) ft = 0; - if (ft >= (int)segmentSize) { - printf("MidiJackDevice::queueEvent: Event time:%d out of range. offset:%d ft:%d (seg=%d)\n", e.time(), frameOffset, ft, segmentSize); - if (ft > (int)segmentSize) - ft = segmentSize - 1; + if (ft >= (int)MusEGlobal::segmentSize) { + printf("MidiJackDevice::queueEvent: Event time:%d out of range. offset:%d ft:%d (seg=%d)\n", e.time(), frameOffset, ft, MusEGlobal::segmentSize); + if (ft > (int)MusEGlobal::segmentSize) + ft = MusEGlobal::segmentSize - 1; } #ifdef JACK_MIDI_DEBUG @@ -1308,7 +1308,7 @@ bool MidiJackDevice::queueEvent(const MidiPlayEvent& e) case ME_START: case ME_CONTINUE: case ME_STOP: - if(debugMsg) + if(MusEGlobal::debugMsg) printf("MidiJackDevice::queueEvent: event type %x not supported\n", e.type()); //return false; return true; // Absorb the event. Don't want it hanging around in the list. FIXME: Support these? p4.0.15 Tim. @@ -1580,7 +1580,7 @@ bool MidiJackDevice::processEvent(const MidiPlayEvent& event) } else { - if(debugMsg) + if(MusEGlobal::debugMsg) printf("MidiJackDevice::processEvent: unknown controller type 0x%x\n", a); //return false; // Just ignore it. } @@ -1605,12 +1605,12 @@ void MidiJackDevice::processMidi() //if(!_out_client_jackport) // p3.3.55 // return; - //void* port_buf = jack_port_get_buffer(_client_jackport, segmentSize); - //void* port_buf = jack_port_get_buffer(_out_client_jackport, segmentSize); // p3.3.55 + //void* port_buf = jack_port_get_buffer(_client_jackport, MusEGlobal::segmentSize); + //void* port_buf = jack_port_get_buffer(_out_client_jackport, MusEGlobal::segmentSize); // p3.3.55 void* port_buf = 0; if(_out_client_jackport && _writeEnable) // p4.0.15 { - port_buf = jack_port_get_buffer(_out_client_jackport, segmentSize); + port_buf = jack_port_get_buffer(_out_client_jackport, MusEGlobal::segmentSize); jack_midi_clear_buffer(port_buf); } diff --git a/muse2/muse/driver/rtctimer.cpp b/muse2/muse/driver/rtctimer.cpp index b4b339ed..8410bb04 100644 --- a/muse2/muse/driver/rtctimer.cpp +++ b/muse2/muse/driver/rtctimer.cpp @@ -61,16 +61,16 @@ signed int RtcTimer::initTimer() fprintf(stderr,"RtcTimer::initTimer(): called on initialised timer!\n"); return -1; } - doSetuid(); + MusEGlobal::doSetuid(); timerFd = ::open("/dev/rtc", O_RDONLY); if (timerFd == -1) { fprintf(stderr, "fatal error: open /dev/rtc failed: %s\n", strerror(errno)); fprintf(stderr, "hint: check if 'rtc' kernel module is loaded, or used by something else\n"); - undoSetuid(); + MusEGlobal::undoSetuid(); return timerFd; } - if (!setTimerFreq(config.rtcTicks)) { + if (!setTimerFreq(MusEConfig::config.rtcTicks)) { // unable to set timer frequency return -1; } @@ -133,7 +133,7 @@ bool RtcTimer::startTimer() } if (ioctl(timerFd, RTC_PIE_ON, 0) == -1) { perror("MidiThread: start: RTC_PIE_ON failed"); - undoSetuid(); + MusEGlobal::undoSetuid(); return false; } return true; diff --git a/muse2/muse/dssihost.cpp b/muse2/muse/dssihost.cpp index 923192b4..9787f3f0 100644 --- a/muse2/muse/dssihost.cpp +++ b/muse2/muse/dssihost.cpp @@ -147,13 +147,13 @@ int DssiSynthIF::oscUpdate(lo_arg **argv) #ifdef DSSI_DEBUG - printf("DssiSynthIF::oscUpdate synth name:%s url:%s uiTarget:%p uiOscPath:%s uiOscConfigurePath:%s museProject:%s\n", synti->name().ascii(), url, uiTarget, uiOscPath, uiOscConfigurePath, museProject.ascii()); + printf("DssiSynthIF::oscUpdate synth name:%s url:%s uiTarget:%p uiOscPath:%s uiOscConfigurePath:%s MusEGlobal::museProject:%s\n", synti->name().ascii(), url, uiTarget, uiOscPath, uiOscConfigurePath, MusEGlobal::museProject.ascii()); #endif //lo_send(uiTarget, uiOscConfigurePath, "ss", //DSSI_PROJECT_DIRECTORY_KEY, song->projectPath().toAscii().data()); lo_send(uiTarget, uiOscConfigurePath, "ss", - DSSI_PROJECT_DIRECTORY_KEY, museProject.ascii()); + DSSI_PROJECT_DIRECTORY_KEY, MusEGlobal::museProject.ascii()); #if 0 // Send current bank/program (-FIX- another race...) @@ -382,7 +382,7 @@ static void scanDSSILib(QFileInfo& fi) // ddskrjo removed const for argument DssiSynth* s = new DssiSynth(fi, descr); - if(debugMsg) + if(MusEGlobal::debugMsg) { fprintf(stderr, "scanDSSILib: name:%s listname:%s lib:%s listlib:%s\n", label.toLatin1().constData(), s->name().toLatin1().constData(), fi.completeBaseName().toLatin1().constData(), s->baseName().toLatin1().constData()); @@ -425,7 +425,7 @@ static void scanDSSILib(QFileInfo& fi) // ddskrjo removed const for argument static void scanDSSIDir(QString& s) // ddskrjo removed const for argument { - if(debugMsg) + if(MusEGlobal::debugMsg) //printf("scan DSSI plugin dir <%s>\n", s.toAscii().data()); printf("scanDSSIDir: scan DSSI plugin dir <%s>\n", s.toLatin1().constData()); @@ -446,7 +446,7 @@ static void scanDSSIDir(QString& s) // ddskrjo removed const for argument QStringList list = pluginDir.entryList(); for(int i = 0; i < list.count(); ++i) { - if(debugMsg) + if(MusEGlobal::debugMsg) printf("scanDSSIDir: found %s\n", (s + QString("/") + list[i]).toLatin1().constData()); QFileInfo fi(s + QString("/") + list[i]); @@ -557,7 +557,7 @@ DssiSynth::DssiSynth(QFileInfo& fi, const DSSI_Descriptor* d) : // ddskrjo remov // Hack: Special flag required for example for control processing. _isDssiVst = fi.completeBaseName() == QString("dssi-vst"); // Hack: Blacklist vst plugins in-place, configurable for now. - if ((_inports != _outports) || (_isDssiVst && !config.vstInPlace)) + if ((_inports != _outports) || (_isDssiVst && !MusEConfig::config.vstInPlace)) _inPlaceCapable = false; } @@ -686,7 +686,7 @@ SynthIF* DssiSynth::createSIF(SynthI* synti) // Hack: Special flag required for example for control processing. _isDssiVst = info.completeBaseName() == QString("dssi-vst"); // Hack: Blacklist vst plugins in-place, configurable for now. - if((_inports != _outports) || (_isDssiVst && !config.vstInPlace)) + if((_inports != _outports) || (_isDssiVst && !MusEConfig::config.vstInPlace)) _inPlaceCapable = false; } } @@ -849,7 +849,7 @@ bool DssiSynthIF::init(DssiSynth* s) synth = s; const DSSI_Descriptor* dssi = synth->dssi; const LADSPA_Descriptor* ld = dssi->LADSPA_Plugin; - handle = ld->instantiate(ld, sampleRate); + handle = ld->instantiate(ld, MusEGlobal::sampleRate); #ifdef OSC_SUPPORT _oscif.oscSetSynthIF(this); @@ -863,10 +863,10 @@ bool DssiSynthIF::init(DssiSynth* s) audioInBuffers = new float*[inports]; for(int k = 0; k < inports; ++k) { - //audioInBuffers[k] = new LADSPA_Data[segmentSize]; - //posix_memalign((void**)(audioInBuffers + k), 16, sizeof(float) * segmentSize); - posix_memalign((void**)&audioInBuffers[k], 16, sizeof(float) * segmentSize); - memset(audioInBuffers[k], 0, sizeof(float) * segmentSize); + //audioInBuffers[k] = new LADSPA_Data[MusEGlobal::segmentSize]; + //posix_memalign((void**)(audioInBuffers + k), 16, sizeof(float) * MusEGlobal::segmentSize); + posix_memalign((void**)&audioInBuffers[k], 16, sizeof(float) * MusEGlobal::segmentSize); + memset(audioInBuffers[k], 0, sizeof(float) * MusEGlobal::segmentSize); ld->connect_port(handle, synth->iIdx[k], audioInBuffers[k]); } } @@ -877,10 +877,10 @@ bool DssiSynthIF::init(DssiSynth* s) audioOutBuffers = new float*[outports]; for(int k = 0; k < outports; ++k) { - //audioOutBuffers[k] = new LADSPA_Data[segmentSize]; - //posix_memalign((void**)(audioOutBuffers + k), 16, sizeof(float) * segmentSize); - posix_memalign((void**)&audioOutBuffers[k], 16, sizeof(float) * segmentSize); - memset(audioOutBuffers[k], 0, sizeof(float) * segmentSize); + //audioOutBuffers[k] = new LADSPA_Data[MusEGlobal::segmentSize]; + //posix_memalign((void**)(audioOutBuffers + k), 16, sizeof(float) * MusEGlobal::segmentSize); + posix_memalign((void**)&audioOutBuffers[k], 16, sizeof(float) * MusEGlobal::segmentSize); + memset(audioOutBuffers[k], 0, sizeof(float) * MusEGlobal::segmentSize); ld->connect_port(handle, synth->oIdx[k], audioOutBuffers[k]); //printf("DssiSynthIF::init output port name: %s\n", ld->PortNames[synth->oIdx[k]]); // out1, out2, out3 etc } @@ -1157,7 +1157,7 @@ bool DssiSynthIF::init(DssiSynth* s) if(dssi->configure) { char *rv = dssi->configure(handle, DSSI_PROJECT_DIRECTORY_KEY, - museProject.toLatin1().constData()); //song->projectPath() + MusEGlobal::museProject.toLatin1().constData()); //song->projectPath() if(rv) { @@ -2035,7 +2035,7 @@ bool DssiSynthIF::processEvent(const MidiPlayEvent& e, snd_seq_event_t* event) } break; default: - if(debugMsg) + if(MusEGlobal::debugMsg) fprintf(stderr, "DssiSynthIF::processEvent midi event unknown type:%d\n", e.type()); // Event not filled. return false; @@ -2127,11 +2127,11 @@ iMPEvent DssiSynthIF::getData(MidiPort* /*mp*/, MPEventList* el, iMPEvent i, uns int ft = i->time() - frameOffset - pos; if(ft < 0) ft = 0; - if (ft >= (int)segmentSize) + if (ft >= (int)MusEGlobal::segmentSize) { - printf("DssiSynthIF::getData: eventlist event time:%d out of range. pos:%d offset:%d ft:%d (seg=%d)\n", i->time(), pos, frameOffset, ft, segmentSize); - ///if (ft > (int)segmentSize) - ft = segmentSize - 1; + printf("DssiSynthIF::getData: eventlist event time:%d out of range. pos:%d offset:%d ft:%d (seg=%d)\n", i->time(), pos, frameOffset, ft, MusEGlobal::segmentSize); + ///if (ft > (int)MusEGlobal::segmentSize) + ft = MusEGlobal::segmentSize - 1; } // "Each event is timestamped relative to the start of the block, (mis)using the ALSA "tick time" field as a frame count. // The host is responsible for ensuring that events with differing timestamps are already ordered by time." - From dssi.h @@ -2160,11 +2160,11 @@ iMPEvent DssiSynthIF::getData(MidiPort* /*mp*/, MPEventList* el, iMPEvent i, uns int ft = e.time() - frameOffset - pos; if(ft < 0) ft = 0; - if (ft >= (int)segmentSize) + if (ft >= (int)MusEGlobal::segmentSize) { - printf("DssiSynthIF::getData: eventFifo event time:%d out of range. pos:%d offset:%d ft:%d (seg=%d)\n", e.time(), pos, frameOffset, ft, segmentSize); - ///if (ft > (int)segmentSize) - ft = segmentSize - 1; + printf("DssiSynthIF::getData: eventFifo event time:%d out of range. pos:%d offset:%d ft:%d (seg=%d)\n", e.time(), pos, frameOffset, ft, MusEGlobal::segmentSize); + ///if (ft > (int)MusEGlobal::segmentSize) + ft = MusEGlobal::segmentSize - 1; } // "Each event is timestamped relative to the start of the block, (mis)using the ALSA "tick time" field as a frame count. // The host is responsible for ensuring that events with differing timestamps are already ordered by time." - From dssi.h @@ -2200,7 +2200,7 @@ iMPEvent DssiSynthIF::getData(MidiPort* /*mp*/, MPEventList* el, iMPEvent i, uns controls[k].val = v.value; // TODO: (From plugin module, adapt for synth if/when our own plugin gui is added to synths). - // Need to update the automation value, otherwise the block above overwrites with the last automation value. + // Need to update the MusEGlobal::automation value, otherwise the block above overwrites with the last MusEGlobal::automation value. ///if(_track) ///{ // Since we are now in the audio thread context, there's no need to send a message, @@ -2253,7 +2253,7 @@ iMPEvent DssiSynthIF::getData(MidiPort* /*mp*/, MPEventList* el, iMPEvent i, uns iRoute i = irl->begin(); if(!i->track->isMidiTrack()) { - //if(debugMsg) + //if(MusEGlobal::debugMsg) printf("DssiSynthIF::getData: Error: First route is a midi track route!\n"); } else @@ -2283,7 +2283,7 @@ iMPEvent DssiSynthIF::getData(MidiPort* /*mp*/, MPEventList* el, iMPEvent i, uns { if(i->track->isMidiTrack()) { - //if(debugMsg) + //if(MusEGlobal::debugMsg) printf("DssiSynthIF::getData: Error: Route is a midi track route!\n"); continue; } @@ -2406,13 +2406,13 @@ iMPEvent DssiSynthIF::getData(MidiPort* /*mp*/, MPEventList* el, iMPEvent i, uns if(fixedsize > n) fixedsize = n; - unsigned long min_per = config.minControlProcessPeriod; + unsigned long min_per = MusEConfig::config.minControlProcessPeriod; if(min_per > n) min_per = n; - // Process automation control values now. + // Process MusEGlobal::automation control values now. // TODO: This needs to be respect frame resolution. Put this inside the sample loop below. - if(automation && synti && synti->automationType() != AUTO_OFF && id() != -1) + if(MusEGlobal::automation && synti && synti->automationType() != AUTO_OFF && id() != -1) { for(unsigned long k = 0; k < synth->_controlInPorts; ++k) { @@ -2483,8 +2483,8 @@ iMPEvent DssiSynthIF::getData(MidiPort* /*mp*/, MPEventList* el, iMPEvent i, uns controls[v.idx].val = v.value; } - // Process automation control values now. - //if(automation && synti && synti->automationType() != AUTO_OFF && id() != -1) + // Process MusEGlobal::automation control values now. + //if(MusEGlobal::automation && synti && synti->automationType() != AUTO_OFF && id() != -1) //{ // for(unsigned long k = 0; k < synth->_controlInPorts; ++k) // { @@ -2558,13 +2558,13 @@ iMPEvent DssiSynthIF::getData(MidiPort* /*mp*/, MPEventList* el, iMPEvent i, uns int ft = i->time() - frameOffset - pos; if(ft < 0) ft = 0; - //if (ft >= (int)segmentSize) + //if (ft >= (int)MusEGlobal::segmentSize) if (ft >= int(sample + nsamp)) { - //printf("DssiSynthIF::getData: eventlist event time:%d out of range. pos:%d offset:%d ft:%d (seg=%d)\n", i->time(), pos, frameOffset, ft, segmentSize); + //printf("DssiSynthIF::getData: eventlist event time:%d out of range. pos:%d offset:%d ft:%d (seg=%d)\n", i->time(), pos, frameOffset, ft, MusEGlobal::segmentSize); printf("DssiSynthIF::getData: eventlist event time:%d out of range. pos:%d offset:%d ft:%d sample:%lu nsamp:%lu\n", i->time(), pos, frameOffset, ft, sample, nsamp); - ///if (ft > (int)segmentSize) - //ft = segmentSize - 1; + ///if (ft > (int)MusEGlobal::segmentSize) + //ft = MusEGlobal::segmentSize - 1; ft = sample + nsamp - 1; } // "Each event is timestamped relative to the start of the block, (mis)using the ALSA "tick time" field as a frame count. @@ -2597,13 +2597,13 @@ iMPEvent DssiSynthIF::getData(MidiPort* /*mp*/, MPEventList* el, iMPEvent i, uns int ft = e.time() - frameOffset - pos; if(ft < 0) ft = 0; - //if (ft >= (int)segmentSize) + //if (ft >= (int)MusEGlobal::segmentSize) if (ft >= int(sample + nsamp)) { - //printf("DssiSynthIF::getData: eventFifo event time:%d out of range. pos:%d offset:%d ft:%d (seg=%d)\n", e.time(), pos, frameOffset, ft, segmentSize); + //printf("DssiSynthIF::getData: eventFifo event time:%d out of range. pos:%d offset:%d ft:%d (seg=%d)\n", e.time(), pos, frameOffset, ft, MusEGlobal::segmentSize); printf("DssiSynthIF::getData: eventFifo event time:%d out of range. pos:%d offset:%d ft:%d sample:%lu nsamp:%lu\n", e.time(), pos, frameOffset, ft, sample, nsamp); - ///if (ft > (int)segmentSize) - //ft = segmentSize - 1; + ///if (ft > (int)MusEGlobal::segmentSize) + //ft = MusEGlobal::segmentSize - 1; ft = sample + nsamp - 1; } // "Each event is timestamped relative to the start of the block, (mis)using the ALSA "tick time" field as a frame count. @@ -2625,7 +2625,7 @@ iMPEvent DssiSynthIF::getData(MidiPort* /*mp*/, MPEventList* el, iMPEvent i, uns iRoute i = irl->begin(); if(!i->track->isMidiTrack()) { - //if(debugMsg) + //if(MusEGlobal::debugMsg) printf("DssiSynthIF::getData: Error: First route is a midi track route!\n"); } else @@ -2655,7 +2655,7 @@ iMPEvent DssiSynthIF::getData(MidiPort* /*mp*/, MPEventList* el, iMPEvent i, uns { if(i->track->isMidiTrack()) { - //if(debugMsg) + //if(MusEGlobal::debugMsg) printf("DssiSynthIF::getData: Error: Route is a midi track route!\n"); continue; } @@ -2716,7 +2716,7 @@ bool DssiSynthIF::putEvent(const MidiPlayEvent& ev) fprintf(stderr, "DssiSynthIF::putEvent midi event time:%d chn:%d a:%d b:%d\n", ev.time(), ev.channel(), ev.dataA(), ev.dataB()); #endif - if (midiOutputTrace) + if (MusEGlobal::midiOutputTrace) ev.dump(); return synti->eventFifo.put(ev); @@ -2953,7 +2953,7 @@ void DssiSynthIF::guiHeartBeat() int DssiSynthIF::oscUpdate() { // Send project directory. - _oscif.oscSendConfigure(DSSI_PROJECT_DIRECTORY_KEY, museProject.toLatin1().constData()); // song->projectPath() + _oscif.oscSendConfigure(DSSI_PROJECT_DIRECTORY_KEY, MusEGlobal::museProject.toLatin1().constData()); // song->projectPath() // Send current string configuration parameters. //StringParamMap& map = synti->_stringParamMap; diff --git a/muse2/muse/exportmidi.cpp b/muse2/muse/exportmidi.cpp index cd57c22f..332ad026 100644 --- a/muse2/muse/exportmidi.cpp +++ b/muse2/muse/exportmidi.cpp @@ -128,6 +128,8 @@ static void addController(MPEventList* l, int tick, int port, int channel, int a } } +namespace MusEApp { + //--------------------------------------------------------- // exportMidi //--------------------------------------------------------- @@ -137,7 +139,7 @@ void MusE::exportMidi() MFile file(QString("midis"), QString(".mid")); //FILE* fp = file.open("w", midi_file_pattern, this, false, true, - FILE* fp = file.open("w", midi_file_save_pattern, this, false, true, + FILE* fp = file.open("w", MusEGlobal::midi_file_save_pattern, this, false, true, tr("MusE: Export Midi")); if (fp == 0) return; @@ -182,7 +184,7 @@ void MusE::exportMidi() //--------------------------------------------------- // Write Copyright // - QByteArray ba = config.copyright.toLatin1(); + QByteArray ba = MusEConfig::config.copyright.toLatin1(); const char* copyright = ba.constData(); if (copyright && *copyright) { int len = strlen(copyright); @@ -247,7 +249,7 @@ void MusE::exportMidi() for (AL::ciSigEvent e = sl->begin(); e != sl->end(); ++e) { ///SigEvent* event = e->second; AL::SigEvent* event = e->second; - int sz = (config.exp2ByteTimeSigs ? 2 : 4); // export 2 byte timesigs instead of 4 ? + int sz = (MusEConfig::config.exp2ByteTimeSigs ? 2 : 4); // export 2 byte timesigs instead of 4 ? unsigned char data[sz]; data[0] = event->sig.z; switch(event->sig.n) { @@ -264,7 +266,7 @@ void MusE::exportMidi() } // By T356. In muse the metronome pulse is fixed at 24 (once per quarter-note). // The number of 32nd notes per 24 MIDI clock signals (per quarter-note) is 8. - if(!config.exp2ByteTimeSigs) + if(!MusEConfig::config.exp2ByteTimeSigs) { data[2] = 24; data[3] = 8; @@ -359,7 +361,7 @@ void MusE::exportMidi() len = 1; l->add(MidiPlayEvent(tick, port, channel, ME_NOTEON, pitch, velo)); - if(config.expOptimNoteOffs) // Save space by replacing note offs with note on velocity 0 + if(MusEConfig::config.expOptimNoteOffs) // Save space by replacing note offs with note on velocity 0 l->add(MidiPlayEvent(tick+len, port, channel, ME_NOTEON, pitch, 0)); else l->add(MidiPlayEvent(tick+len, port, channel, ME_NOTEOFF, pitch, velo)); @@ -395,9 +397,10 @@ void MusE::exportMidi() } } } - mf.setDivision(config.midiDivision); + mf.setDivision(MusEConfig::config.midiDivision); mf.setMType(song->mtype()); mf.setTrackList(mtl, ntracks); mf.write(); } +} // namespace MusEApp diff --git a/muse2/muse/functions.cpp b/muse2/muse/functions.cpp index 4ba4ebd8..52c27629 100644 --- a/muse2/muse/functions.cpp +++ b/muse2/muse/functions.cpp @@ -143,7 +143,7 @@ bool quantize_notes(const set<Part*>& parts) if (!quantize_dialog->exec()) return false; - quantize_notes(parts, quantize_dialog->range, (config.division*4)/(1<<quantize_dialog->raster_power2), + quantize_notes(parts, quantize_dialog->range, (MusEConfig::config.division*4)/(1<<quantize_dialog->raster_power2), quantize_dialog->quant_len, quantize_dialog->strength, quantize_dialog->swing, quantize_dialog->threshold); @@ -880,8 +880,8 @@ void shrink_parts(int raster) Undo operations; unsigned min_len; - if (raster<0) raster=config.division; - if (raster>=0) min_len=raster; else min_len=config.division; + if (raster<0) raster=MusEConfig::config.division; + if (raster>=0) min_len=raster; else min_len=MusEConfig::config.division; TrackList* tracks = song->tracks(); for (iTrack track = tracks->begin(); track != tracks->end(); track++) @@ -953,8 +953,8 @@ void expand_parts(int raster) Undo operations; unsigned min_len; - if (raster<0) raster=config.division; - if (raster>=0) min_len=raster; else min_len=config.division; + if (raster<0) raster=MusEConfig::config.division; + if (raster>=0) min_len=raster; else min_len=MusEConfig::config.division; TrackList* tracks = song->tracks(); for (iTrack track = tracks->begin(); track != tracks->end(); track++) diff --git a/muse2/muse/gconfig.cpp b/muse2/muse/gconfig.cpp index 13e03f82..b47a4773 100644 --- a/muse2/muse/gconfig.cpp +++ b/muse2/muse/gconfig.cpp @@ -23,6 +23,8 @@ #include "gconfig.h" +namespace MusEConfig { + GlobalConfigValues config = { 190, // globalAlphaBlend { @@ -187,3 +189,4 @@ GlobalConfigValues config = { false // popupsDefaultStayOpen }; +} // namespace MusEConfig diff --git a/muse2/muse/gconfig.h b/muse2/muse/gconfig.h index d73e7bbf..9b4099a6 100644 --- a/muse2/muse/gconfig.h +++ b/muse2/muse/gconfig.h @@ -34,6 +34,8 @@ class Xml; +namespace MusEConfig { + //--------------------------------------------------------- // MixerConfig //--------------------------------------------------------- @@ -163,5 +165,7 @@ struct GlobalConfigValues { extern GlobalConfigValues config; +} // namespace MusEConfig + #endif diff --git a/muse2/muse/globals.cpp b/muse2/muse/globals.cpp index c72d73bf..bbcf0434 100644 --- a/muse2/muse/globals.cpp +++ b/muse2/muse/globals.cpp @@ -33,6 +33,8 @@ #include "globals.h" #include "config.h" +namespace MusEGlobal { + int recFileNumber = 1; int sampleRate = 44100; @@ -338,7 +340,7 @@ QAction* recordAction; QAction* panicAction; //AudioMixerApp* audioMixer; -MusE* muse = 0; +MusEApp::MusE* muse = 0; int preMeasures = 2; unsigned char measureClickNote = 63; @@ -459,3 +461,5 @@ bool getUniqueTmpfileName(QString subDir, QString ext,QString& newFilename) printf("Could not find a suitable tmpfilename (more than 10000 tmpfiles in tmpdir - clean up!\n"); return false; } + +} // namespace MusEGlobal diff --git a/muse2/muse/globals.h b/muse2/muse/globals.h index d317a60b..33c32c20 100644 --- a/muse2/muse/globals.h +++ b/muse2/muse/globals.h @@ -35,6 +35,13 @@ class QString; class QAction; class QActionGroup; class QStringList; +class QTimer; + +namespace MusEApp { +class MusE; +} + +namespace MusEGlobal { extern const float denormalBias; @@ -48,7 +55,6 @@ extern int segmentCount; extern bool overrideAudioOutput; extern bool overrideAudioInput; -class QTimer; extern QTimer* heartBeatTimer; extern bool hIsB; @@ -155,9 +161,8 @@ extern QAction* recordAction; extern QAction* panicAction; //class AudioMixerApp; -class MusE; //extern AudioMixerApp* audioMixer; -extern MusE* muse; +extern MusEApp::MusE* muse; extern int preMeasures; extern unsigned char measureClickNote; @@ -196,5 +201,7 @@ extern void undoSetuid(); extern bool checkAudioDevice(); extern bool getUniqueTmpfileName(QString subDir, QString ext, QString& newFilename); +} // namespace MusEGlobal + #endif diff --git a/muse2/muse/help.cpp b/muse2/muse/help.cpp index 687c5a31..ae805a60 100644 --- a/muse2/muse/help.cpp +++ b/muse2/muse/help.cpp @@ -34,6 +34,8 @@ #include "icons.h" #include "aboutbox_impl.h" +namespace MusEApp { + //--------------------------------------------------------- // startHelpBrowser //--------------------------------------------------------- @@ -82,7 +84,7 @@ void MusE::startBugBrowser() void MusE::about() { - AboutBoxImpl ab; + MusEWidget::AboutBoxImpl ab; ab.show(); ab.exec(); } @@ -107,3 +109,5 @@ void MusE::launchBrowser(QString &whereTo) printf("Unable to launch help\n"); } } + +} // namespace MusEApp diff --git a/muse2/muse/helper.cpp b/muse2/muse/helper.cpp index 705e43f7..fad9959f 100644 --- a/muse2/muse/helper.cpp +++ b/muse2/muse/helper.cpp @@ -25,7 +25,10 @@ #include "track.h" #include "song.h" +namespace MusEGlobal { extern bool hIsB; +} + static const char* vall[] = { "c","c#","d","d#","e","f","f#","g","g#","a","a#","h" }; @@ -46,7 +49,7 @@ QString pitch2string(int v) o.sprintf("%d", octave); int i = v % 12; QString s(octave < 0 ? valu[i] : vall[i]); - if (hIsB) { + if (MusEGlobal::hIsB) { if (s == "h") s = "b"; else if (s == "H") diff --git a/muse2/muse/importmidi.cpp b/muse2/muse/importmidi.cpp index 53b235c8..abf64fe2 100644 --- a/muse2/muse/importmidi.cpp +++ b/muse2/muse/importmidi.cpp @@ -53,6 +53,9 @@ using std::set; using std::pair; + +namespace MusEApp { + //--------------------------------------------------------- // importMidi //--------------------------------------------------------- @@ -67,11 +70,11 @@ void MusE::importMidi(const QString &file) { QString fn; if (file.isEmpty()) { - fn = getOpenFileName(lastMidiPath, midi_file_pattern, this, + fn = getOpenFileName(MusEGlobal::lastMidiPath, MusEGlobal::midi_file_pattern, this, tr("MusE: Import Midi"), 0); if (fn.isEmpty()) return; - lastMidiPath = fn; + MusEGlobal::lastMidiPath = fn; } else fn = file; @@ -308,7 +311,7 @@ void MusE::processTrack(MidiTrack* track) int len = song->roundUpBar(lastTick+1); // p3.3.27 - if(config.importMidiSplitParts) + if(MusEConfig::config.importMidiSplitParts) { int bar2, beat; @@ -476,7 +479,7 @@ void MusE::importPart() if (track) { bool loadAll; - QString filename = getOpenFileName(QString(""), part_file_pattern, this, tr("MusE: load part"), &loadAll); + QString filename = getOpenFileName(QString(""), MusEGlobal::part_file_pattern, this, tr("MusE: load part"), &loadAll); if (!filename.isEmpty()){ // Make a backup of the current clone list, to retain any 'copy' items, // so that pasting works properly after. @@ -623,3 +626,5 @@ void MusE::importPartToTrack(QString& filename, unsigned tick, Track* track) return; } } + +} // namespace MuseApp diff --git a/muse2/muse/instruments/editinstrument.cpp b/muse2/muse/instruments/editinstrument.cpp index f2f0331d..49bdd6c2 100644 --- a/muse2/muse/instruments/editinstrument.cpp +++ b/muse2/muse/instruments/editinstrument.cpp @@ -277,7 +277,7 @@ void EditInstrument::fileSave() // Do not allow a direct overwrite of a 'built-in' muse instrument. QFileInfo qfi(workingInstrument.filePath()); - if(qfi.absolutePath() == museInstruments) + if(qfi.absolutePath() == MusEGlobal::museInstruments) { //fileSaveAs(); saveAs(); @@ -399,34 +399,34 @@ void EditInstrument::saveAs() //MidiInstrument* instrument = (MidiInstrument*)item->data(Qt::UserRole).value<void*>(); // MidiInstrument* instrument = (MidiInstrument*)item->data(); - //QString path = QDir::homePath() + "/" + config.instrumentPath; - //QString path = QDir::homeDirPath() + "/" + museGlobalShare; - //QString path = museInstruments; - QString path = museUserInstruments; + //QString path = QDir::homePath() + "/" + MusEConfig::config.instrumentPath; + //QString path = QDir::homeDirPath() + "/" + MusEGlobal::museGlobalShare; + //QString path = MusEGlobal::museInstruments; + QString path = MusEGlobal::museUserInstruments; - if(!QDir(museUserInstruments).exists()) + if(!QDir(MusEGlobal::museUserInstruments).exists()) { if(QMessageBox::question(this, tr("MusE:"), - tr("The user instrument directory\n") + museUserInstruments + tr("\ndoes not exist yet. Create it now?\n") + + tr("The user instrument directory\n") + MusEGlobal::museUserInstruments + tr("\ndoes not exist yet. Create it now?\n") + tr("(You can change the user instruments directory at Settings->Global Settings->Midi)"), QMessageBox::Ok | QMessageBox::Default, QMessageBox::Cancel | QMessageBox::Escape, Qt::NoButton) == QMessageBox::Ok) { - if(QDir().mkdir(museUserInstruments)) - printf("Created user instrument directory: %s\n", museUserInstruments.toLatin1().constData()); + if(QDir().mkdir(MusEGlobal::museUserInstruments)) + printf("Created user instrument directory: %s\n", MusEGlobal::museUserInstruments.toLatin1().constData()); else { - printf("Unable to create user instrument directory: %s\n", museUserInstruments.toLatin1().constData()); - QMessageBox::critical(this, tr("MusE:"), tr("Unable to create user instrument directory\n") + museUserInstruments); + printf("Unable to create user instrument directory: %s\n", MusEGlobal::museUserInstruments.toLatin1().constData()); + QMessageBox::critical(this, tr("MusE:"), tr("Unable to create user instrument directory\n") + MusEGlobal::museUserInstruments); //return; - path = museUser; + path = MusEGlobal::museUser; } } else // return; - path = museUser; + path = MusEGlobal::museUser; } //if (instrument->filePath().isEmpty()) @@ -446,7 +446,7 @@ void EditInstrument::saveAs() { // Prompt only if it's a user instrument, to avoid duplicates in the user instrument dir. // This will still allow a user instrument to override a built-in instrument with the same name. - if(fi.absolutePath() != museInstruments) + if(fi.absolutePath() != MusEGlobal::museInstruments) { //QMessageBox::critical(this, // tr("MusE: Bad instrument name"), @@ -570,7 +570,7 @@ void EditInstrument::fileSaveAs() { // Allow override of built-in instrument names. QFileInfo fi((*imi)->filePath()); - if(fi.absolutePath() == museInstruments) + if(fi.absolutePath() == MusEGlobal::museInstruments) break; found = true; break; @@ -604,7 +604,7 @@ void EditInstrument::fileSaveAs() QFileInfo fi((*imi)->filePath()); // Allow override of built-in and user instruments: // If it's a user instrument, not a built-in instrument... - if(fi.absolutePath() == museUserInstruments) + if(fi.absolutePath() == MusEGlobal::museUserInstruments) { // No choice really but to overwrite the destination instrument file! // Can not have two user files containing the same instrument name. @@ -691,34 +691,34 @@ void EditInstrument::fileSaveAs() break; } - //QString path = QDir::homePath() + "/" + config.instrumentPath; - //QString path = QDir::homeDirPath() + "/" + museGlobalShare; - //QString path = museInstruments; - QString path = museUserInstruments; + //QString path = QDir::homePath() + "/" + MusEConfig::config.instrumentPath; + //QString path = QDir::homeDirPath() + "/" + MusEGlobal::museGlobalShare; + //QString path = MusEGlobal::museInstruments; + QString path = MusEGlobal::museUserInstruments; - if(!QDir(museUserInstruments).exists()) + if(!QDir(MusEGlobal::museUserInstruments).exists()) { if(QMessageBox::question(this, tr("MusE:"), - tr("The user instrument directory\n") + museUserInstruments + tr("\ndoes not exist yet. Create it now?\n") + + tr("The user instrument directory\n") + MusEGlobal::museUserInstruments + tr("\ndoes not exist yet. Create it now?\n") + tr("(You can change the user instruments directory at Settings->Global Settings->Midi)"), QMessageBox::Ok | QMessageBox::Default, QMessageBox::Cancel | QMessageBox::Escape, Qt::NoButton) == QMessageBox::Ok) { - if(QDir().mkdir(museUserInstruments)) - printf("Created user instrument directory: %s\n", museUserInstruments.toLatin1().constData()); + if(QDir().mkdir(MusEGlobal::museUserInstruments)) + printf("Created user instrument directory: %s\n", MusEGlobal::museUserInstruments.toLatin1().constData()); else { - printf("Unable to create user instrument directory: %s\n", museUserInstruments.toLatin1().constData()); - QMessageBox::critical(this, tr("MusE:"), tr("Unable to create user instrument directory\n") + museUserInstruments); + printf("Unable to create user instrument directory: %s\n", MusEGlobal::museUserInstruments.toLatin1().constData()); + QMessageBox::critical(this, tr("MusE:"), tr("Unable to create user instrument directory\n") + MusEGlobal::museUserInstruments); //return; - path = museUser; + path = MusEGlobal::museUser; } } else // return; - path = museUser; + path = MusEGlobal::museUser; } path += QString("/%1.idf").arg(so); @@ -1463,7 +1463,7 @@ void EditInstrument::patchButtonClicked() PatchGroup* pgp = *i; QMenu* pm = patchpopup->addMenu(pgp->name); //pm->setCheckable(false);//Qt4 doc says this is unnecessary - pm->setFont(config.fonts[0]); + pm->setFont(MusEConfig::config.fonts[0]); const PatchList& pl = pgp->patches; for (ciPatch ipl = pl.begin(); ipl != pl.end(); ++ipl) { const Patch* mp = *ipl; diff --git a/muse2/muse/instruments/minstrument.cpp b/muse2/muse/instruments/minstrument.cpp index 7841a2e1..299f76bb 100644 --- a/muse2/muse/instruments/minstrument.cpp +++ b/muse2/muse/instruments/minstrument.cpp @@ -42,6 +42,7 @@ #include "gconfig.h" #include "popupmenu.h" + MidiInstrumentList midiInstruments; MidiInstrument* genericMidiInstrument; @@ -155,7 +156,7 @@ static void loadIDF(QFileInfo* fi) printf("cannot open file %s\n", fi->fileName().toLatin1()); return; } - if (debugMsg) + if (MusEGlobal::debugMsg) printf(" load instrument definition <%s>\n", fi->filePath().local8Bit().data()); QDomDocument doc; int line, column; @@ -187,7 +188,7 @@ static void loadIDF(QFileInfo* fi) if (midiInstruments[idx]->iname() == i->iname()) { midiInstruments.replace(idx, i); replaced = true; - if (debugMsg) + if (MusEGlobal::debugMsg) printf("Midi Instrument Definition <%s> overwritten\n", i->iname().toLocal8Bit().data()); break; @@ -208,7 +209,7 @@ static void loadIDF(QFileInfo* fi) FILE* f = fopen(fi->filePath().toAscii().constData(), "r"); if (f == 0) return; - if (debugMsg) + if (MusEGlobal::debugMsg) printf("READ IDF %s\n", fi->filePath().toLatin1().constData()); Xml xml(f); @@ -267,9 +268,9 @@ void initMidiInstruments() { genericMidiInstrument = new MidiInstrument(QWidget::tr("generic midi")); midiInstruments.push_back(genericMidiInstrument); - if (debugMsg) - printf("load user instrument definitions from <%s>\n", museUserInstruments.toLatin1().constData()); - QDir usrInstrumentsDir(museUserInstruments, QString("*.idf")); + if (MusEGlobal::debugMsg) + printf("load user instrument definitions from <%s>\n", MusEGlobal::museUserInstruments.toLatin1().constData()); + QDir usrInstrumentsDir(MusEGlobal::museUserInstruments, QString("*.idf")); if (usrInstrumentsDir.exists()) { QFileInfoList list = usrInstrumentsDir.entryInfoList(); QFileInfoList::iterator it=list.begin(); // ddskrjo @@ -280,15 +281,15 @@ void initMidiInstruments() } //else //{ - // if(usrInstrumentsDir.mkdir(museUserInstruments)) - // printf("Created user instrument directory: %s\n", museUserInstruments.toLatin1()); + // if(usrInstrumentsDir.mkdir(MusEGlobal::museUserInstruments)) + // printf("Created user instrument directory: %s\n", MusEGlobal::museUserInstruments.toLatin1()); // else - // printf("Unable to create user instrument directory: %s\n", museUserInstruments.toLatin1()); + // printf("Unable to create user instrument directory: %s\n", MusEGlobal::museUserInstruments.toLatin1()); //} - if (debugMsg) - printf("load instrument definitions from <%s>\n", museInstruments.toLatin1().constData()); - QDir instrumentsDir(museInstruments, QString("*.idf")); + if (MusEGlobal::debugMsg) + printf("load instrument definitions from <%s>\n", MusEGlobal::museInstruments.toLatin1().constData()); + QDir instrumentsDir(MusEGlobal::museInstruments, QString("*.idf")); if (instrumentsDir.exists()) { QFileInfoList list = instrumentsDir.entryInfoList(); QFileInfoList::iterator it=list.begin(); // ddskrjo @@ -298,7 +299,7 @@ void initMidiInstruments() } } else - printf("Instrument directory not found: %s\n", museInstruments.toLatin1().constData()); + printf("Instrument directory not found: %s\n", MusEGlobal::museInstruments.toLatin1().constData()); } @@ -960,7 +961,7 @@ void MidiInstrument::populatePatchPopup(PopupMenu* menu, int chan, MType songTyp //QMenu* pm = menu->addMenu(pgp->name); PopupMenu* pm = new PopupMenu(pgp->name, menu, menu->stayOpen()); // Use the parent stayOpen here. menu->addMenu(pm); - pm->setFont(config.fonts[0]); + pm->setFont(MusEConfig::config.fonts[0]); const PatchList& pl = pgp->patches; for (ciPatch ipl = pl.begin(); ipl != pl.end(); ++ipl) { const Patch* mp = *ipl; diff --git a/muse2/muse/liste/editevent.cpp b/muse2/muse/liste/editevent.cpp index 5494e33d..0da0bbcb 100644 --- a/muse2/muse/liste/editevent.cpp +++ b/muse2/muse/liste/editevent.cpp @@ -328,7 +328,7 @@ EditMetaDialog::EditMetaDialog(int tick, const Event& ev, connect(hexButton, SIGNAL(toggled(bool)), SLOT(toggled(bool))); edit = new QTextEdit; - edit->setFont(config.fonts[5]); + edit->setFont(MusEConfig::config.fonts[5]); if (!ev.empty()) { epos->setValue(tick); diff --git a/muse2/muse/liste/listedit.cpp b/muse2/muse/liste/listedit.cpp index bb295cec..cfc7132f 100644 --- a/muse2/muse/liste/listedit.cpp +++ b/muse2/muse/liste/listedit.cpp @@ -483,7 +483,7 @@ ListEdit::ListEdit(PartList* pl) QSignalMapper *editSignalMapper = new QSignalMapper(this); menuEdit = menuBar()->addMenu(tr("&Edit")); - menuEdit->addActions(undoRedo->actions()); + menuEdit->addActions(MusEGlobal::undoRedo->actions()); menuEdit->addSeparator(); #if 0 @@ -514,7 +514,7 @@ ListEdit::ListEdit(PartList* pl) //---------ToolBar---------------------------------- listTools = addToolBar(tr("List tools")); - listTools->addActions(undoRedo->actions()); + listTools->addActions(MusEGlobal::undoRedo->actions()); QToolBar* insertTools = addToolBar(tr("Insert tools")); insertTools->addActions(insertItems->actions()); @@ -597,7 +597,7 @@ ListEdit::ListEdit(PartList* pl) ListEdit::~ListEdit() { - // undoRedo->removeFrom(listTools); // p4.0.6 Removed + // MusEGlobal::undoRedo->removeFrom(listTools); // p4.0.6 Removed } //--------------------------------------------------------- diff --git a/muse2/muse/main.cpp b/muse2/muse/main.cpp index ebf8e58a..b30c3ef5 100644 --- a/muse2/muse/main.cpp +++ b/muse2/muse/main.cpp @@ -60,7 +60,9 @@ static QString locale_override; #ifdef HAVE_LASH #include <lash/lash.h> +namespace MusEApp { extern lash_client_t * lash_client; +} extern snd_seq_t * alsaSeq; #endif @@ -104,7 +106,7 @@ static void printVersion(const char* prog) //--------------------------------------------------------- class MuseApplication : public QApplication { - MusE* muse; + MusEApp::MusE* muse; public: MuseApplication(int& argc, char** argv) @@ -114,10 +116,10 @@ class MuseApplication : public QApplication { } - void setMuse(MusE* m) { + void setMuse(MusEApp::MusE* m) { muse = m; #ifdef HAVE_LASH - if(useLASH) + if(MusEGlobal::useLASH) startTimer (300); #endif } @@ -129,21 +131,21 @@ class MuseApplication : public QApplication { if (event->type() == QEvent::KeyPress) { //printf("notify key press after app::notify accepted:%d\n", event->isAccepted()); QKeyEvent* ke = (QKeyEvent*)event; - ///globalKeyState = ke->stateAfter(); - globalKeyState = ke->modifiers(); + ///MusEGlobal::globalKeyState = ke->stateAfter(); + MusEGlobal::globalKeyState = ke->modifiers(); bool accepted = ke->isAccepted(); if (!accepted) { int key = ke->key(); ///if (ke->state() & Qt::ShiftModifier) - //if (globalKeyState & Qt::ShiftModifier) + //if (MusEGlobal::globalKeyState & Qt::ShiftModifier) if (((QInputEvent*)ke)->modifiers() & Qt::ShiftModifier) key += Qt::SHIFT; ///if (ke->state() & Qt::AltModifier) - //if (globalKeyState & Qt::AltModifier) + //if (MusEGlobal::globalKeyState & Qt::AltModifier) if (((QInputEvent*)ke)->modifiers() & Qt::AltModifier) key += Qt::ALT; ///if (ke->state() & Qt::ControlModifier) - //if (globalKeyState & Qt::ControlModifier) + //if (MusEGlobal::globalKeyState & Qt::ControlModifier) if (((QInputEvent*)ke)->modifiers() & Qt::ControlModifier) key+= Qt::CTRL; muse->kbAccel(key); @@ -152,8 +154,8 @@ class MuseApplication : public QApplication { } if (event->type() == QEvent::KeyRelease) { QKeyEvent* ke = (QKeyEvent*)event; - ///globalKeyState = ke->stateAfter(); - globalKeyState = ke->modifiers(); + ///MusEGlobal::globalKeyState = ke->stateAfter(); + MusEGlobal::globalKeyState = ke->modifiers(); } return flag; @@ -161,7 +163,7 @@ class MuseApplication : public QApplication { #ifdef HAVE_LASH virtual void timerEvent (QTimerEvent * /* e */) { - if(useLASH) + if(MusEGlobal::useLASH) muse->lash_idle_cb (); } #endif /* HAVE_LASH */ @@ -176,7 +178,7 @@ static QString localeList() { // Find out what translations are available: QStringList deliveredLocaleListFiltered; - QString distLocale = museGlobalShare + "/locale"; + QString distLocale = MusEGlobal::museGlobalShare + "/locale"; QFileInfo distLocaleFi(distLocale); if (distLocaleFi.isDir()) { QDir dir = QDir(distLocale); @@ -240,26 +242,26 @@ int main(int argc, char* argv[]) { // error = ErrorHandler::create(argv[0]); - ruid = getuid(); - euid = geteuid(); - undoSetuid(); + MusEGlobal::ruid = getuid(); + MusEGlobal::euid = geteuid(); + MusEGlobal::undoSetuid(); getCapabilities(); int noAudio = false; - museUser = QString(getenv("HOME")); - museGlobalLib = QString(LIBDIR); - museGlobalShare = QString(SHAREDIR); - museProject = museProjectInitPath; //getcwd(0, 0); - museInstruments = museGlobalShare + QString("/instruments"); + MusEGlobal::museUser = QString(getenv("HOME")); + MusEGlobal::museGlobalLib = QString(LIBDIR); + MusEGlobal::museGlobalShare = QString(SHAREDIR); + MusEGlobal::museProject = MusEGlobal::museProjectInitPath; //getcwd(0, 0); + MusEGlobal::museInstruments = MusEGlobal::museGlobalShare + QString("/instruments"); // Create config dir if it doesn't exists - QDir cPath = QDir(configPath); + QDir cPath = QDir(MusEGlobal::configPath); if (! cPath.exists()) cPath.mkpath("."); #ifdef HAVE_LASH lash_args_t * lash_args = 0; - if(useLASH) + if(MusEGlobal::useLASH) lash_args = lash_extract_args (&argc, &argv); #endif @@ -269,17 +271,17 @@ int main(int argc, char* argv[]) QApplication::setColorSpec(QApplication::ManyColor); MuseApplication app(argc, argv); - init_function_dialogs(muse); + init_function_dialogs(MusEGlobal::muse); initShortCuts(); readConfiguration(); - museUserInstruments = config.userInstrumentsDir; + MusEGlobal::museUserInstruments = MusEConfig::config.userInstrumentsDir; - if (config.useDenormalBias) + if (MusEConfig::config.useDenormalBias) printf("Denormal protection enabled.\n"); // SHOW MUSE SPLASH SCREEN - if (config.showSplashScreen) { - QPixmap splsh(museGlobalShare + "/splash.png"); + if (MusEConfig::config.showSplashScreen) { + QPixmap splsh(MusEGlobal::museGlobalShare + "/splash.png"); if (!splsh.isNull()) { QSplashScreen* muse_splash = new QSplashScreen(splsh, @@ -317,27 +319,27 @@ int main(int argc, char* argv[]) switch (c) { case 'v': printVersion(argv[0]); return 0; case 'd': - debugMode = true; - realTimeScheduling = false; + MusEGlobal::debugMode = true; + MusEGlobal::realTimeScheduling = false; break; case 'a': noAudio = true; break; case 'D': - if (!debugMsg) - debugMsg=true; + if (!MusEGlobal::debugMsg) + MusEGlobal::debugMsg=true; else - heavyDebugMsg=true; - case 'm': midiInputTrace = true; break; - case 'M': midiOutputTrace = true; break; + MusEGlobal::heavyDebugMsg=true; + case 'm': MusEGlobal::midiInputTrace = true; break; + case 'M': MusEGlobal::midiOutputTrace = true; break; case 's': debugSync = true; break; - case 'P': realTimePriority = atoi(optarg); break; - case 'Y': midiRTPrioOverride = atoi(optarg); break; - case 'p': loadPlugins = false; break; - case 'V': loadVST = false; break; - case 'I': loadDSSI = false; break; - case 'L': useLASH = false; break; - case 'y': usePythonBridge = true; break; + case 'P': MusEGlobal::realTimePriority = atoi(optarg); break; + case 'Y': MusEGlobal::midiRTPrioOverride = atoi(optarg); break; + case 'p': MusEGlobal::loadPlugins = false; break; + case 'V': MusEGlobal::loadVST = false; break; + case 'I': MusEGlobal::loadDSSI = false; break; + case 'L': MusEGlobal::useLASH = false; break; + case 'y': MusEGlobal::usePythonBridge = true; break; case 'l': locale_override = QString(optarg); break; case 'h': usage(argv[0], argv[1]); return -1; default: usage(argv[0], "bad argument"); return -1; @@ -345,11 +347,11 @@ int main(int argc, char* argv[]) } /* - if(!config.styleSheetFile.isEmpty()) + if(!MusEConfig::config.styleSheetFile.isEmpty()) { - if(debugMsg) - printf("loading style sheet <%s> \n", qPrintable(config.styleSheetFile)); - QFile cf(config.styleSheetFile); + if(MusEGlobal::debugMsg) + printf("loading style sheet <%s> \n", qPrintable(MusEConfig::config.styleSheetFile)); + QFile cf(MusEConfig::config.styleSheetFile); if (cf.open(QIODevice::ReadOnly)) { QByteArray ss = cf.readAll(); QString sheet(QString::fromUtf8(ss.data())); @@ -357,28 +359,28 @@ int main(int argc, char* argv[]) cf.close(); } else - printf("loading style sheet <%s> failed\n", qPrintable(config.styleSheetFile)); + printf("loading style sheet <%s> failed\n", qPrintable(MusEConfig::config.styleSheetFile)); } */ AL::initDsp(); - if (debugMsg) + if (MusEGlobal::debugMsg) printf("Start euid: %d ruid: %d, Now euid %d\n", - euid, ruid, geteuid()); - if (debugMode) { + MusEGlobal::euid, MusEGlobal::ruid, geteuid()); + if (MusEGlobal::debugMode) { initDummyAudio(); - realTimeScheduling = false; + MusEGlobal::realTimeScheduling = false; } else if (noAudio) { initDummyAudio(); - realTimeScheduling = true; - //if (debugMode) { // ?? - // realTimeScheduling = false; + MusEGlobal::realTimeScheduling = true; + //if (MusEGlobal::debugMode) { // ?? + // MusEGlobal::realTimeScheduling = false; // } } else if (initJackAudio()) { - if (!debugMode) + if (!MusEGlobal::debugMode) { QMessageBox::critical(NULL, "MusE fatal error", "MusE <b>failed</b> to find a <b>Jack audio server</b>.<br><br>" "<i>MusE will continue without audio support (-a switch)!</i><br><br>" @@ -388,9 +390,9 @@ int main(int argc, char* argv[]) initDummyAudio(); noAudio = true; - realTimeScheduling = true; - if (debugMode) { - realTimeScheduling = false; + MusEGlobal::realTimeScheduling = true; + if (MusEGlobal::debugMode) { + MusEGlobal::realTimeScheduling = false; } } else @@ -399,38 +401,38 @@ int main(int argc, char* argv[]) fprintf(stderr, "no audio functions available\n"); fprintf(stderr, "*** experimental mode -- no play possible ***\n"); initDummyAudio(); - //realTimeScheduling = audioDevice->isRealtime(); + //MusEGlobal::realTimeScheduling = audioDevice->isRealtime(); } - realTimeScheduling = true; + MusEGlobal::realTimeScheduling = true; } else - realTimeScheduling = audioDevice->isRealtime(); + MusEGlobal::realTimeScheduling = audioDevice->isRealtime(); // What unreliable nonsense. With Jack2 this reports true even if it is not running realtime. // Jack says: "Cannot use real-time scheduling (RR/10)(1: Operation not permitted)". The kernel is non-RT. // I cannot seem to find a reliable answer to the question, even with dummy audio and system calls. - //if (debugMsg) - // printf("realTimeScheduling:%d\n", realTimeScheduling); + //if (MusEGlobal::debugMsg) + // printf("MusEGlobal::realTimeScheduling:%d\n", MusEGlobal::realTimeScheduling); useJackTransport.setValue(true); // setup the prefetch fifo length now that the segmentSize is known // Changed by Tim. p3.3.17 // Changed to 4 *, JUST FOR TEST!!! - fifoLength = 131072/segmentSize; - //fifoLength = (131072/segmentSize) * 4; + MusEGlobal::fifoLength = 131072 / MusEGlobal::segmentSize; + //MusEGlobal::fifoLength = (131072 / MusEGlobal::segmentSize) * 4; argc -= optind; ++argc; - if (debugMsg) { - printf("global lib: <%s>\n", museGlobalLib.toLatin1().constData()); - printf("global share: <%s>\n", museGlobalShare.toLatin1().constData()); - printf("muse home: <%s>\n", museUser.toLatin1().constData()); - printf("project dir: <%s>\n", museProject.toLatin1().constData()); - printf("user instruments: <%s>\n", museUserInstruments.toLatin1().constData()); + if (MusEGlobal::debugMsg) { + printf("global lib: <%s>\n", MusEGlobal::museGlobalLib.toLatin1().constData()); + printf("global share: <%s>\n", MusEGlobal::museGlobalShare.toLatin1().constData()); + printf("muse home: <%s>\n", MusEGlobal::museUser.toLatin1().constData()); + printf("project dir: <%s>\n", MusEGlobal::museProject.toLatin1().constData()); + printf("user instruments: <%s>\n", MusEGlobal::museUserInstruments.toLatin1().constData()); } static QTranslator translator(0); @@ -441,7 +443,7 @@ int main(int argc, char* argv[]) QString loc("muse_"); loc += locale; if (translator.load(loc, QString(".")) == false) { - QString lp(museGlobalShare); + QString lp(MusEGlobal::museGlobalShare); lp += QString("/locale"); if (translator.load(loc, lp) == false) { printf("no locale <%s>/<%s>\n", loc.toLatin1().constData(), lp.toLatin1().constData()); @@ -452,16 +454,16 @@ int main(int argc, char* argv[]) if (locale == "de") { printf("locale de\n"); - hIsB = false; + MusEGlobal::hIsB = false; } - if (loadPlugins) + if (MusEGlobal::loadPlugins) initPlugins(); - if (loadVST) + if (MusEGlobal::loadVST) initVST(); - if(loadDSSI) + if(MusEGlobal::loadDSSI) initDSSI(); // p3.3.39 @@ -473,8 +475,8 @@ int main(int argc, char* argv[]) //QApplication::clipboard()->setSelectionMode(false); ddskrjo obsolete even in Qt3 - QApplication::addLibraryPath(museGlobalLib + "/qtplugins"); - if (debugMsg) { + QApplication::addLibraryPath(MusEGlobal::museGlobalLib + "/qtplugins"); + if (MusEGlobal::debugMsg) { QStringList list = app.libraryPaths(); QStringList::Iterator it = list.begin(); printf("QtLibraryPath:\n"); @@ -484,45 +486,45 @@ int main(int argc, char* argv[]) } } - muse = new MusE(argc, &argv[optind]); - app.setMuse(muse); - muse->setWindowIcon(*museIcon); + MusEGlobal::muse = new MusEApp::MusE(argc, &argv[optind]); + app.setMuse(MusEGlobal::muse); + MusEGlobal::muse->setWindowIcon(*museIcon); // Added by Tim. p3.3.22 - if (!debugMode) { + if (!MusEGlobal::debugMode) { if (mlockall(MCL_CURRENT | MCL_FUTURE)) perror("WARNING: Cannot lock memory:"); } - muse->show(); - muse->seqStart(); + MusEGlobal::muse->show(); + MusEGlobal::muse->seqStart(); #ifdef HAVE_LASH { - lash_client = 0; - if(useLASH) + MusEApp::lash_client = 0; + if(MusEGlobal::useLASH) { int lash_flags = LASH_Config_File; const char *muse_name = PACKAGE_NAME; - lash_client = lash_init (lash_args, muse_name, lash_flags, LASH_PROTOCOL(2,0)); - lash_alsa_client_id (lash_client, snd_seq_client_id (alsaSeq)); + MusEApp::lash_client = lash_init (lash_args, muse_name, lash_flags, LASH_PROTOCOL(2,0)); + lash_alsa_client_id (MusEApp::lash_client, snd_seq_client_id (alsaSeq)); if (!noAudio) { // p3.3.38 //char *jack_name = ((JackAudioDevice*)audioDevice)->getJackName(); const char *jack_name = audioDevice->clientName(); - lash_jack_client_name (lash_client, jack_name); + lash_jack_client_name (MusEApp::lash_client, jack_name); } } } #endif /* HAVE_LASH */ - QTimer::singleShot(100, muse, SLOT(showDidYouKnowDialog())); + QTimer::singleShot(100, MusEGlobal::muse, SLOT(showDidYouKnowDialog())); int rv = app.exec(); - if(debugMsg) + if(MusEGlobal::debugMsg) printf("app.exec() returned:%d\nDeleting main MusE object\n", rv); - delete muse; - if(debugMsg) + delete MusEGlobal::muse; + if(MusEGlobal::debugMsg) printf("Finished! Exiting main, return value:%d\n", rv); return rv; diff --git a/muse2/muse/marker/markerview.cpp b/muse2/muse/marker/markerview.cpp index fb630b9c..9e0b5b27 100644 --- a/muse2/muse/marker/markerview.cpp +++ b/muse2/muse/marker/markerview.cpp @@ -124,7 +124,7 @@ void MarkerItem::setTick(unsigned v) s.sprintf("%04d.%02d.%03d", bar+1, beat+1, tick); setText(COL_TICK, s); - double time = double(tempomap.tick2frame(v))/double(sampleRate); + double time = double(tempomap.tick2frame(v))/double(MusEGlobal::sampleRate); int hour = int(time) / 3600; int min = (int(time) % 3600)/60; int sec = int(time) % 60; @@ -190,7 +190,7 @@ MarkerView::MarkerView(QWidget* parent) //---------ToolBar---------------------------------- tools = addToolBar(tr("marker-tools")); - tools->addActions(undoRedo->actions()); + tools->addActions(MusEGlobal::undoRedo->actions()); QToolBar* edit = addToolBar(tr("edit tools")); edit->addAction(markerAdd); diff --git a/muse2/muse/master/lmaster.cpp b/muse2/muse/master/lmaster.cpp index dc98df42..46d1d446 100644 --- a/muse2/muse/master/lmaster.cpp +++ b/muse2/muse/master/lmaster.cpp @@ -158,7 +158,7 @@ LMaster::LMaster() //---------Pulldown Menu---------------------------- menuEdit = menuBar()->addMenu(tr("&Edit")); QSignalMapper *signalMapper = new QSignalMapper(this); - menuEdit->addActions(undoRedo->actions()); + menuEdit->addActions(MusEGlobal::undoRedo->actions()); menuEdit->addSeparator(); tempoAction = menuEdit->addAction(tr("Insert Tempo")); signAction = menuEdit->addAction(tr("Insert Signature")); @@ -186,7 +186,7 @@ LMaster::LMaster() //---------ToolBar---------------------------------- tools = addToolBar(tr("Master tools")); - tools->addActions(undoRedo->actions()); + tools->addActions(MusEGlobal::undoRedo->actions()); QToolBar* edit = addToolBar(tr("Edit tools")); QToolButton* tempoButton = new QToolButton(); @@ -802,7 +802,7 @@ LMasterKeyEventItem::LMasterKeyEventItem(QTreeWidget* parent, const KeyEvent& ev AL::sigmap.tickValues(t, &bar, &beat, &tick); c1.sprintf("%04d.%02d.%03d", bar+1, beat+1, tick); - double time = double(tempomap.tick2frame(t)) / double(sampleRate); + double time = double(tempomap.tick2frame(t)) / double(MusEGlobal::sampleRate); int min = int(time) / 60; int sec = int(time) % 60; int msec = int((time - (min*60 + sec)) * 1000.0); @@ -833,7 +833,7 @@ LMasterTempoItem::LMasterTempoItem(QTreeWidget* parent, const TEvent* ev) AL::sigmap.tickValues(t, &bar, &beat, &tick); c1.sprintf("%04d.%02d.%03d", bar+1, beat+1, tick); - double time = double(tempomap.tick2frame(t) /*ev->frame*/) / double(sampleRate); + double time = double(tempomap.tick2frame(t) /*ev->frame*/) / double(MusEGlobal::sampleRate); int min = int(time) / 60; int sec = int(time) % 60; int msec = int((time - (min*60 + sec)) * 1000.0); @@ -861,7 +861,7 @@ LMasterSigEventItem::LMasterSigEventItem(QTreeWidget* parent, const AL::SigEvent AL::sigmap.tickValues(t, &bar, &beat, &tick); c1.sprintf("%04d.%02d.%03d", bar+1, beat+1, tick); - double time = double(tempomap.tick2frame(t)) / double (sampleRate); + double time = double(tempomap.tick2frame(t)) / double (MusEGlobal::sampleRate); int min = int(time) / 60; int sec = int(time) % 60; int msec = int((time - (min*60 + sec)) * 1000.0); diff --git a/muse2/muse/master/master.cpp b/muse2/muse/master/master.cpp index 284692a4..e9212be9 100644 --- a/muse2/muse/master/master.cpp +++ b/muse2/muse/master/master.cpp @@ -206,21 +206,21 @@ void Master::draw(QPainter& p, const QRect& rect) void Master::viewMousePressEvent(QMouseEvent* event) { start = event->pos(); - Tool activeTool = tool; + MusEWidget::Tool activeTool = tool; // bool shift = event->state() & ShiftButton; switch (activeTool) { - case PointerTool: + case MusEWidget::PointerTool: drag = DRAG_LASSO_START; break; - case PencilTool: + case MusEWidget::PencilTool: drag = DRAG_NEW; song->startUndo(); newVal(start.x(), start.x(), start.y()); break; - case RubberTool: + case MusEWidget::RubberTool: drag = DRAG_DELETE; song->startUndo(); deleteVal(start.x(), start.x()); @@ -317,11 +317,11 @@ void Master::deleteVal(int x1, int x2) void Master::setTool(int t) { - if (tool == Tool(t)) + if (tool == MusEWidget::Tool(t)) return; - tool = Tool(t); + tool = MusEWidget::Tool(t); switch(tool) { - case PencilTool: + case MusEWidget::PencilTool: setCursor(QCursor(*pencilIcon, 4, 15)); break; default: diff --git a/muse2/muse/master/master.h b/muse2/muse/master/master.h index 796c0e46..9cdbf6cc 100644 --- a/muse2/muse/master/master.h +++ b/muse2/muse/master/master.h @@ -49,7 +49,7 @@ class Master : public View { ScrollScale* vscroll; unsigned pos[3]; QPoint start; - Tool tool; + MusEWidget::Tool tool; DragMode drag; MidiEditor* editor; diff --git a/muse2/muse/master/masteredit.cpp b/muse2/muse/master/masteredit.cpp index beb7090e..3e400399 100644 --- a/muse2/muse/master/masteredit.cpp +++ b/muse2/muse/master/masteredit.cpp @@ -115,9 +115,9 @@ MasterEdit::MasterEdit() tools = addToolBar(tr("Master tools")); tools->setObjectName("Master tools"); - tools->addActions(undoRedo->actions()); + tools->addActions(MusEGlobal::undoRedo->actions()); - EditToolBar* tools2 = new EditToolBar(this, PointerTool | PencilTool | RubberTool); + MusEWidget::EditToolBar* tools2 = new MusEWidget::EditToolBar(this, MusEWidget::PointerTool | MusEWidget::PencilTool | MusEWidget::RubberTool); addToolBar(tools2); QToolBar* enableMaster = addToolBar(tr("Enable master")); diff --git a/muse2/muse/master/tscale.cpp b/muse2/muse/master/tscale.cpp index b1a33970..e25c3454 100644 --- a/muse2/muse/master/tscale.cpp +++ b/muse2/muse/master/tscale.cpp @@ -35,8 +35,8 @@ TScale::TScale(QWidget* parent, int ymag) : View(parent, 1, ymag) { - setFont(config.fonts[4]); - //int w = 4 * QFontMetrics(config.fonts[4]).width('0'); + setFont(MusEConfig::config.fonts[4]); + //int w = 4 * QFontMetrics(MusEConfig::config.fonts[4]).width('0'); int w = 4 * fontMetrics().width('0'); setFixedWidth(w); setMouseTracking(true); @@ -50,7 +50,7 @@ void TScale::pdraw(QPainter& p, const QRect& r) { int y = r.y(); int h = r.height(); - //p.setFont(config.fonts[4]); + //p.setFont(MusEConfig::config.fonts[4]); QString s; for (int i = 30000; i <= 250000; i += 10000) { int yy = mapy(280000 - i); @@ -60,7 +60,7 @@ void TScale::pdraw(QPainter& p, const QRect& r) continue; p.drawLine(0, yy, width(), yy); s.setNum(i/1000); - //QFontMetrics fm(config.fonts[4]); + //QFontMetrics fm(MusEConfig::config.fonts[4]); //p.drawText(width() - fm.width(s) - 1, yy-2, s); p.drawText(width() - fontMetrics().width(s) - 1, yy-2, s); // Use the window font. Tim p4.0.31 } diff --git a/muse2/muse/midi.cpp b/muse2/muse/midi.cpp index 7ba82d71..42f5bed7 100644 --- a/muse2/muse/midi.cpp +++ b/muse2/muse/midi.cpp @@ -67,7 +67,7 @@ const unsigned int mmcDeferredPlayMsgLen = sizeof(mmcDeferredPlayMsg); const unsigned int mmcStopMsgLen = sizeof(mmcStopMsg); const unsigned int mmcLocateMsgLen = sizeof(mmcLocateMsg); -#define CALC_TICK(the_tick) lrintf((float(the_tick) * float(config.division) + float(div/2)) / float(div)); +#define CALC_TICK(the_tick) lrintf((float(the_tick) * float(MusEConfig::config.division) + float(div/2)) / float(div)); /*--------------------------------------------------------- * midi_meta_name *---------------------------------------------------------*/ @@ -423,7 +423,7 @@ void buildMidiEventList(EventList* del, const MPEventList* el, MidiTrack* track, break; case 0x6: // Marker { - unsigned ltick = CALC_TICK(tick);//(tick * config.division + div/2) / div; + unsigned ltick = CALC_TICK(tick);//(tick * MusEConfig::config.division + div/2) / div; song->addMarker(QString((const char*)(data)), ltick, false); } break; @@ -439,7 +439,7 @@ void buildMidiEventList(EventList* del, const MPEventList* el, MidiTrack* track, case 0x51: // Tempo { unsigned tempo = data[2] + (data[1] << 8) + (data[0] <<16); - unsigned ltick = CALC_TICK(tick);// (unsigned(tick) * unsigned(config.division) + unsigned(div/2)) / unsigned(div); + unsigned ltick = CALC_TICK(tick);// (unsigned(tick) * unsigned(MusEConfig::config.division) + unsigned(div/2)) / unsigned(div); // After ca 10 mins 32 bits will not be enough... This expression has to be changed/factorized or so in some "sane" way... tempomap.addTempo(ltick, tempo); } @@ -451,7 +451,7 @@ void buildMidiEventList(EventList* del, const MPEventList* el, MidiTrack* track, int timesig_n = 1; for (int i = 0; i < n; i++) timesig_n *= 2; - int ltick = CALC_TICK(tick);//(tick * config.division + div/2) / div; + int ltick = CALC_TICK(tick);//(tick * MusEConfig::config.division + div/2) / div; ///sigmap.add(ltick, timesig_z, timesig_n); AL::sigmap.add(ltick, AL::TimeSignature(timesig_z, timesig_n)); } @@ -494,7 +494,7 @@ void buildMidiEventList(EventList* del, const MPEventList* el, MidiTrack* track, if (ev.isNoteOff(event)) { int t = k->first - i->first; if (t <= 0) { - if (debugMsg) { + if (MusEGlobal::debugMsg) { printf("Note len is (%d-%d)=%d, set to 1\n", k->first, i->first, k->first - i->first); ev.dump(); @@ -538,9 +538,9 @@ void buildMidiEventList(EventList* del, const MPEventList* el, MidiTrack* track, i->first, ev.pitch(), ev.velo()); continue; } - int tick = CALC_TICK(ev.tick()); //(ev.tick() * config.division + div/2) / div; + int tick = CALC_TICK(ev.tick()); //(ev.tick() * MusEConfig::config.division + div/2) / div; if (ev.isNote()) { - int lenTick = CALC_TICK(ev.lenTick()); //(ev.lenTick() * config.division + div/2) / div; + int lenTick = CALC_TICK(ev.lenTick()); //(ev.lenTick() * MusEConfig::config.division + div/2) / div; ev.setLenTick(lenTick); } ev.setTick(tick); @@ -580,7 +580,7 @@ void Audio::panic() if (port == 0) // ?? continue; for (int chan = 0; chan < MIDI_CHANNELS; ++chan) { - if (debugMsg) + if (MusEGlobal::debugMsg) printf("send all sound of to midi port %d channel %d\n", i, chan); port->sendEvent(MidiPlayEvent(0, i, chan, ME_CONTROLLER, CTRL_ALL_SOUNDS_OFF, 0), true); port->sendEvent(MidiPlayEvent(0, i, chan, ME_CONTROLLER, CTRL_RESET_ALL_CTRL, 0), true); @@ -609,7 +609,7 @@ void Audio::initDevices() activePorts[track->outPort()] = true; } if (song->click()) - activePorts[clickPort] = true; + activePorts[MusEGlobal::clickPort] = true; // // test for explicit instrument initialization @@ -1043,7 +1043,7 @@ void Audio::processMidi() MidiPlayEvent event(rf.peek(i)); //unsigned time = event.time() + segmentSize*(segmentCount-1); - //unsigned time = event.time() + (extsync ? config.division/24 : segmentSize*(segmentCount-1)); + //unsigned time = event.time() + (extsync ? MusEConfig::config.division/24 : segmentSize*(segmentCount-1)); //unsigned time = extsync ? curTickPos : (event.time() + segmentSize*(segmentCount-1)); //event.setTime(time); //if(!extsync) @@ -1202,7 +1202,7 @@ void Audio::processMidi() // 384/24=16 for a division of 16 sub-frames (16 MusE 'ticks'). // That is what we'll use if syncing externally. //unsigned time = event.time() + segmentSize*(segmentCount-1); - //unsigned time = event.time() + (extsync ? config.division/24 : segmentSize*(segmentCount-1)); + //unsigned time = event.time() + (extsync ? MusEConfig::config.division/24 : segmentSize*(segmentCount-1)); // p3.3.34 // Oops, use the current tick. //unsigned time = extsync ? curTickPos : (event.time() + segmentSize*(segmentCount-1)); @@ -1363,8 +1363,8 @@ void Audio::processMidi() //--------------------------------------------------- MidiDevice* md = 0; - if (midiClickFlag) - md = midiPorts[clickPort].device(); + if (MusEGlobal::midiClickFlag) + md = midiPorts[MusEGlobal::clickPort].device(); if (song->click() && (isPlaying() || state == PRECOUNT)) { MPEventList* playEvents = 0; MPEventList* stuckNotes = 0; @@ -1389,23 +1389,23 @@ void Audio::processMidi() int evtime = extsync ? midiClick : tempomap.tick2frame(midiClick) + frameOffset; // p3.3.25 - //MidiPlayEvent ev(frame, clickPort, clickChan, ME_NOTEON, - MidiPlayEvent ev(evtime, clickPort, clickChan, ME_NOTEON, - beatClickNote, beatClickVelo); + //MidiPlayEvent ev(frame, MusEGlobal::clickPort, MusEGlobal::clickChan, ME_NOTEON, + MidiPlayEvent ev(evtime, MusEGlobal::clickPort, MusEGlobal::clickChan, ME_NOTEON, + MusEGlobal::beatClickNote, MusEGlobal::beatClickVelo); if (md) { // p3.3.25 - //MidiPlayEvent ev(frame, clickPort, clickChan, ME_NOTEON, - MidiPlayEvent ev(evtime, clickPort, clickChan, ME_NOTEON, - beatClickNote, beatClickVelo); + //MidiPlayEvent ev(frame, MusEGlobal::clickPort, MusEGlobal::clickChan, ME_NOTEON, + MidiPlayEvent ev(evtime, MusEGlobal::clickPort, MusEGlobal::clickChan, ME_NOTEON, + MusEGlobal::beatClickNote, MusEGlobal::beatClickVelo); if (isMeasure) { - ev.setA(measureClickNote); - ev.setB(measureClickVelo); + ev.setA(MusEGlobal::measureClickNote); + ev.setB(MusEGlobal::measureClickVelo); } playEvents->add(ev); } - if (audioClickFlag) { + if (MusEGlobal::audioClickFlag) { // p3.3.25 //MidiPlayEvent ev1(frame, 0, 0, ME_NOTEON, 0, 0); MidiPlayEvent ev1(evtime, 0, 0, ME_NOTEON, 0, 0); @@ -1448,9 +1448,9 @@ void Audio::processMidi() //} // Removed p4.0.15 Tim. - ///if (audioClickFlag) + ///if (MusEGlobal::audioClickFlag) /// metronome->setNextPlayEvent(metronome->playEvents()->begin()); - //if(audioClickFlag) + //if(MusEGlobal::audioClickFlag) //{ // if(metronome->nextPlayEvent() != metronome->playEvents()->begin()) // printf("Audio::processMidi metronome: metronome->nextPlayEvent() != metronome->playEvents->begin()\n"); diff --git a/muse2/muse/midictrl.cpp b/muse2/muse/midictrl.cpp index 093da0ba..d7cf1230 100644 --- a/muse2/muse/midictrl.cpp +++ b/muse2/muse/midictrl.cpp @@ -803,7 +803,7 @@ void MidiCtrlValList::delMCtlVal(int tick, Part* part) { iMidiCtrlVal e = findMCtlVal(tick, part); if (e == end()) { - if(debugMsg) + if(MusEGlobal::debugMsg) printf("MidiCtrlValList::delMCtlVal(%d): not found (size %zd)\n", tick, size()); return; } diff --git a/muse2/muse/mididev.cpp b/muse2/muse/mididev.cpp index ca5c01f0..a97ac1fb 100644 --- a/muse2/muse/mididev.cpp +++ b/muse2/muse/mididev.cpp @@ -148,10 +148,10 @@ bool filterEvent(const MEvent& event, int type, bool thru) case ME_CONTROLLER: if (type & MIDI_FILTER_CTRL) return true; - if (!thru && (midiFilterCtrl1 == event.dataA() - || midiFilterCtrl2 == event.dataA() - || midiFilterCtrl3 == event.dataA() - || midiFilterCtrl4 == event.dataA())) { + if (!thru && (MusEGlobal::midiFilterCtrl1 == event.dataA() + || MusEGlobal::midiFilterCtrl2 == event.dataA() + || MusEGlobal::midiFilterCtrl3 == event.dataA() + || MusEGlobal::midiFilterCtrl4 == event.dataA())) { return true; } break; @@ -269,7 +269,7 @@ void MidiDevice::recordEvent(MidiRecordEvent& event) if(audio->isPlaying()) event.setLoopNum(audio->loopCount()); - if (midiInputTrace) { + if (MusEGlobal::midiInputTrace) { printf("MidiInput: "); event.dump(); } @@ -328,11 +328,11 @@ void MidiDevice::recordEvent(MidiRecordEvent& event) processMidiInputTransformPlugins(event); - if (filterEvent(event, midiRecordType, false)) + if (filterEvent(event, MusEGlobal::midiRecordType, false)) return; if (!applyMidiInputTransformation(event)) { - if (midiInputTrace) + if (MusEGlobal::midiInputTrace) printf(" midi input transformation: event filtered\n"); return; } @@ -662,7 +662,7 @@ void MidiDevice::handleStop() // (Could try now that this is in MidiDevice. p4.0.22 ) /* if(!si.sendContNotStart()) - mp->sendSongpos(audio->tickPos() * 4 / config.division); + mp->sendSongpos(audio->tickPos() * 4 / MusEConfig::config.division); */ } } @@ -753,7 +753,7 @@ void MidiDevice::handleSeek() //if(port < -1 || port > MIDI_PORTS) // continue; - int beat = (pos * 4) / config.division; + int beat = (pos * 4) / MusEConfig::config.division; //bool isPlaying = false; //if(state == PLAY) diff --git a/muse2/muse/midiedit/dcanvas.cpp b/muse2/muse/midiedit/dcanvas.cpp index efa6d0b5..da8bb884 100644 --- a/muse2/muse/midiedit/dcanvas.cpp +++ b/muse2/muse/midiedit/dcanvas.cpp @@ -506,7 +506,7 @@ void DrumCanvas::drawCanvas(QPainter& p, const QRect& rect) void DrumCanvas::drawTopItem(QPainter& p, const QRect&) { // draw cursor - if (_tool == CursorTool) { + if (_tool == MusEWidget::CursorTool) { p.setPen(Qt::black); int y = mapy(TH * cursorPos.y()); @@ -747,7 +747,7 @@ void DrumCanvas::keyPressed(int index, int velocity) audio->msgPlayMidiEvent(&e); if (_steprec && pos[0] >= start_tick /* && pos[0] < end_tick [removed by flo93: this is handled in steprec->record] */ && curPart) - steprec->record(curPart,index,drumMap[index].len,editor->raster(),velocity,globalKeyState&Qt::ControlModifier,globalKeyState&Qt::ShiftModifier); + steprec->record(curPart,index,drumMap[index].len,editor->raster(),velocity,MusEGlobal::globalKeyState&Qt::ControlModifier,MusEGlobal::globalKeyState&Qt::ShiftModifier); } @@ -957,7 +957,7 @@ int DrumCanvas::getNextStep(unsigned int pos, int basicStep, int stepSize) //--------------------------------------------------------- void DrumCanvas::keyPress(QKeyEvent* event) { - if (_tool == CursorTool) { + if (_tool == MusEWidget::CursorTool) { int key = event->key(); if (((QInputEvent*)event)->modifiers() & Qt::ShiftModifier) @@ -1036,7 +1036,7 @@ void DrumCanvas::keyPress(QKeyEvent* event) //--------------------------------------------------------- void DrumCanvas::setTool2(int) { - if (_tool == CursorTool) + if (_tool == MusEWidget::CursorTool) deselectAll(); if (unsigned(cursorPos.x()) < curPart->tick()) cursorPos.setX(curPart->tick()); @@ -1064,7 +1064,7 @@ void DrumCanvas::setStep(int v) //--------------------------------------------------------- Event *DrumCanvas::getEventAtCursorPos() { - if (_tool != CursorTool) + if (_tool != MusEWidget::CursorTool) return 0; EventList* el = curPart->events(); iEvent lower = el->lower_bound(cursorPos.x()-curPart->tick()); @@ -1131,12 +1131,12 @@ void DrumCanvas::moveAwayUnused() //--------------------------------------------------------- void DrumCanvas::midiNote(int pitch, int velo) { - if (debugMsg) printf("DrumCanvas::midiNote: pitch=%i, velo=%i\n", pitch, velo); + if (MusEGlobal::debugMsg) printf("DrumCanvas::midiNote: pitch=%i, velo=%i\n", pitch, velo); if (_midiin && _steprec && curPart && !audio->isPlaying() && velo && pos[0] >= start_tick /* && pos[0] < end_tick [removed by flo93: this is handled in steprec->record] */ - && !(globalKeyState & Qt::AltModifier)) { - steprec->record(curPart,drumInmap[pitch],drumMap[(int)drumInmap[pitch]].len,editor->raster(),velo,globalKeyState&Qt::ControlModifier,globalKeyState&Qt::ShiftModifier); + && !(MusEGlobal::globalKeyState & Qt::AltModifier)) { + steprec->record(curPart,drumInmap[pitch],drumMap[(int)drumInmap[pitch]].len,editor->raster(),velo,MusEGlobal::globalKeyState&Qt::ControlModifier,MusEGlobal::globalKeyState&Qt::ShiftModifier); } } diff --git a/muse2/muse/midiedit/drumedit.cpp b/muse2/muse/midiedit/drumedit.cpp index 529ac91f..e7fafac4 100644 --- a/muse2/muse/midiedit/drumedit.cpp +++ b/muse2/muse/midiedit/drumedit.cpp @@ -84,7 +84,7 @@ QByteArray DrumEdit::_toolbarInit; static const int xscale = -10; static const int yscale = 1; -static const int drumeditTools = PointerTool | PencilTool | RubberTool | CursorTool | DrawTool; +static const int drumeditTools = MusEWidget::PointerTool | MusEWidget::PencilTool | MusEWidget::RubberTool | MusEWidget::CursorTool | MusEWidget::DrawTool; enum DrumColumn { COL_MUTE = 0, @@ -194,7 +194,7 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini signalMapper->setMapping(resetAction, DrumCanvas::CMD_RESET); menuEdit = menuBar()->addMenu(tr("&Edit")); - menuEdit->addActions(undoRedo->actions()); + menuEdit->addActions(MusEGlobal::undoRedo->actions()); menuEdit->addSeparator(); cutAction = menuEdit->addAction(QIcon(*editcutIconSet), tr("Cut")); @@ -303,7 +303,7 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini tools->addAction(QWhatsThis::createAction()); tools->addSeparator(); - tools->addActions(undoRedo->actions()); + tools->addActions(MusEGlobal::undoRedo->actions()); tools->addSeparator(); srec = new QToolButton(); @@ -319,7 +319,7 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini tools->addWidget(midiin); - tools2 = new EditToolBar(this, drumeditTools); + tools2 = new MusEWidget::EditToolBar(this, drumeditTools); addToolBar(tools2); QToolBar* cursorToolbar = addToolBar(tr("cursor tools")); @@ -343,11 +343,11 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini QToolBar* panicToolbar = addToolBar(tr("panic")); panicToolbar->setObjectName("panic"); - panicToolbar->addAction(panicAction); + panicToolbar->addAction(MusEGlobal::panicAction); QToolBar* transport = addToolBar(tr("transport")); transport->setObjectName("transport"); - transport->addActions(transportAction->actions()); + transport->addActions(MusEGlobal::transportAction->actions()); addToolBarBreak(); // don't show pitch value in toolbar @@ -365,7 +365,7 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini split1 = new Splitter(Qt::Vertical, mainw, "split1"); QPushButton* ctrl = new QPushButton(tr("ctrl"), mainw); ctrl->setObjectName("Ctrl"); - ctrl->setFont(config.fonts[3]); + ctrl->setFont(MusEConfig::config.fonts[3]); //hscroll = new ScrollScale(-25, -2, xscale, 20000, Qt::Horizontal, mainw); // Increased scale to -1. To resolve/select/edit 1-tick-wide (controller graph) events. p4.0.18 Tim. hscroll = new ScrollScale(-25, -1, xscale, 20000, Qt::Horizontal, mainw); @@ -397,7 +397,7 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini time = new MTScale(&_raster, split1w2, xscale); canvas = new DrumCanvas(this, split1w2, xscale, yscale); vscroll = new ScrollScale(-4, 1, yscale, DRUM_MAPSIZE*TH, Qt::Vertical, split1w2); - int offset = -(config.division/4); + int offset = -(MusEConfig::config.division/4); canvas->setOrigin(offset, 0); canvas->setCanvasTools(drumeditTools); canvas->setFocus(); @@ -593,7 +593,7 @@ void DrumEdit::setTime(unsigned tick) DrumEdit::~DrumEdit() { - //undoRedo->removeFrom(tools); // p4.0.6 Removed + //MusEGlobal::undoRedo->removeFrom(tools); // p4.0.6 Removed } //--------------------------------------------------------- @@ -821,7 +821,7 @@ void DrumEdit::writeConfiguration(int level, Xml& xml) void DrumEdit::load() { //QString fn = getOpenFileName("drummaps", map_file_pattern, - QString fn = getOpenFileName("drummaps", drum_map_file_pattern, + QString fn = getOpenFileName("drummaps", MusEGlobal::drum_map_file_pattern, this, tr("Muse: Load Drum Map"), 0); if (fn.isEmpty()) return; @@ -874,7 +874,7 @@ ende: void DrumEdit::save() { //QString fn = getSaveFileName(QString("drummaps"), map_file_pattern, - QString fn = getSaveFileName(QString("drummaps"), drum_map_file_save_pattern, + QString fn = getSaveFileName(QString("drummaps"), MusEGlobal::drum_map_file_save_pattern, this, tr("MusE: Store Drum Map")); if (fn.isEmpty()) return; @@ -935,7 +935,7 @@ void DrumEdit::cmd(int cmd) case DrumCanvas::CMD_QUANTIZE: if (quantize_dialog->exec()) quantize_notes(partlist_to_set(parts()), quantize_dialog->range, - (config.division*4)/(1<<quantize_dialog->raster_power2), + (MusEConfig::config.division*4)/(1<<quantize_dialog->raster_power2), /* quant_len= */false, quantize_dialog->strength, quantize_dialog->swing, quantize_dialog->threshold); break; @@ -1185,19 +1185,19 @@ void DrumEdit::keyPressEvent(QKeyEvent* event) } else if (key == shortcuts[SHRT_TOOL_POINTER].key) { - tools2->set(PointerTool); + tools2->set(MusEWidget::PointerTool); return; } else if (key == shortcuts[SHRT_TOOL_PENCIL].key) { - tools2->set(PencilTool); + tools2->set(MusEWidget::PencilTool); return; } else if (key == shortcuts[SHRT_TOOL_RUBBER].key) { - tools2->set(RubberTool); + tools2->set(MusEWidget::RubberTool); return; } else if (key == shortcuts[SHRT_TOOL_CURSOR].key) { - tools2->set(CursorTool); + tools2->set(MusEWidget::CursorTool); return; } else if (key == shortcuts[SHRT_ZOOM_IN].key) { @@ -1224,14 +1224,14 @@ void DrumEdit::keyPressEvent(QKeyEvent* event) return; } else if (key == shortcuts[SHRT_SCROLL_LEFT].key) { - int pos = hscroll->pos() - config.division; + int pos = hscroll->pos() - MusEConfig::config.division; if (pos < 0) pos = 0; hscroll->setPos(pos); return; } else if (key == shortcuts[SHRT_SCROLL_RIGHT].key) { - int pos = hscroll->pos() + config.division; + int pos = hscroll->pos() + MusEConfig::config.division; hscroll->setPos(pos); return; } diff --git a/muse2/muse/midiedit/drumedit.h b/muse2/muse/midiedit/drumedit.h index 1b4f07f4..3ca3df5d 100644 --- a/muse2/muse/midiedit/drumedit.h +++ b/muse2/muse/midiedit/drumedit.h @@ -74,7 +74,7 @@ class DrumEdit : public MidiEditor { NoteInfo* info; QToolButton* srec; QToolButton* midiin; - EditToolBar* tools2; + MusEWidget::EditToolBar* tools2; Toolbar1* toolbar; Splitter* split1; diff --git a/muse2/muse/midiedit/ecanvas.h b/muse2/muse/midiedit/ecanvas.h index 9ed308bf..773675b9 100644 --- a/muse2/muse/midiedit/ecanvas.h +++ b/muse2/muse/midiedit/ecanvas.h @@ -49,7 +49,7 @@ typedef std::map<Part*, PartToChange>::iterator iPartToChange; // EventCanvas //--------------------------------------------------------- -class EventCanvas : public Canvas { +class EventCanvas : public MusEWidget::Canvas { Q_OBJECT virtual void leaveEvent(QEvent*e); virtual void enterEvent(QEvent*e); diff --git a/muse2/muse/midiedit/pianoroll.cpp b/muse2/muse/midiedit/pianoroll.cpp index 3aac96db..c207ed45 100644 --- a/muse2/muse/midiedit/pianoroll.cpp +++ b/muse2/muse/midiedit/pianoroll.cpp @@ -76,7 +76,7 @@ QByteArray PianoRoll::_toolbarInit; static const int xscale = -10; static const int yscale = 1; static const int pianoWidth = 40; -static int pianorollTools = PointerTool | PencilTool | RubberTool | DrawTool; +static int pianorollTools = MusEWidget::PointerTool | MusEWidget::PencilTool | MusEWidget::RubberTool | MusEWidget::DrawTool; //--------------------------------------------------------- @@ -99,7 +99,7 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i menuEdit = menuBar()->addMenu(tr("&Edit")); - menuEdit->addActions(undoRedo->actions()); + menuEdit->addActions(MusEGlobal::undoRedo->actions()); menuEdit->addSeparator(); @@ -242,7 +242,7 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i //---------ToolBar---------------------------------- tools = addToolBar(tr("Pianoroll tools")); tools->setObjectName("Pianoroll tools"); - tools->addActions(undoRedo->actions()); + tools->addActions(MusEGlobal::undoRedo->actions()); tools->addSeparator(); srec = new QToolButton(); @@ -263,18 +263,18 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i speaker->setCheckable(true); tools->addWidget(speaker); - tools2 = new EditToolBar(this, pianorollTools); + tools2 = new MusEWidget::EditToolBar(this, pianorollTools); addToolBar(tools2); QToolBar* panicToolbar = addToolBar(tr("panic")); panicToolbar->setObjectName("panic"); - panicToolbar->addAction(panicAction); + panicToolbar->addAction(MusEGlobal::panicAction); //------------------------------------------------------------- // Transport Bar QToolBar* transport = addToolBar(tr("transport")); transport->setObjectName("transport"); - transport->addActions(transportAction->actions()); + transport->addActions(MusEGlobal::transportAction->actions()); addToolBarBreak(); toolbar = new Toolbar1(this, _rasterInit); @@ -298,7 +298,7 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i QPushButton* ctrl = new QPushButton(tr("ctrl"), mainw); //QPushButton* ctrl = new QPushButton(tr("C"), mainw); // Tim. ctrl->setObjectName("Ctrl"); - ctrl->setFont(config.fonts[3]); + ctrl->setFont(MusEConfig::config.fonts[3]); ctrl->setToolTip(tr("Add Controller View")); //hscroll = new ScrollScale(-25, -2, xscale, 20000, Qt::Horizontal, mainw); // Increased scale to -1. To resolve/select/edit 1-tick-wide (controller graph) events. p4.0.18 Tim. @@ -310,7 +310,7 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i /* QPushButton* trackInfoButton = new QPushButton(tr("T"), mainw); trackInfoButton->setObjectName("TrackInfo"); - trackInfoButton->setFont(config.fonts[3]); + trackInfoButton->setFont(MusEConfig::config.fonts[3]); trackInfoButton->setToolTip(tr("Show track info")); trackInfoButton->setFixedSize(pianoWidth / 2, hscroll->sizeHint().height()); */ @@ -377,7 +377,7 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i //setFocusProxy(canvas); // Tim. - int offset = -(config.division/4); + int offset = -(MusEConfig::config.division/4); canvas->setOrigin(offset, 0); canvas->setCanvasTools(pianorollTools); canvas->setFocus(); @@ -608,7 +608,7 @@ void PianoRoll::setTime(unsigned tick) PianoRoll::~PianoRoll() { - // undoRedo->removeFrom(tools); // p4.0.6 Removed + // MusEGlobal::undoRedo->removeFrom(tools); // p4.0.6 Removed } //--------------------------------------------------------- @@ -1022,19 +1022,19 @@ void PianoRoll::keyPressEvent(QKeyEvent* event) return; } else if (key == shortcuts[SHRT_TOOL_POINTER].key) { - tools2->set(PointerTool); + tools2->set(MusEWidget::PointerTool); return; } else if (key == shortcuts[SHRT_TOOL_PENCIL].key) { - tools2->set(PencilTool); + tools2->set(MusEWidget::PencilTool); return; } else if (key == shortcuts[SHRT_TOOL_RUBBER].key) { - tools2->set(RubberTool); + tools2->set(MusEWidget::RubberTool); return; } else if (key == shortcuts[SHRT_TOOL_LINEDRAW].key) { - tools2->set(DrawTool); + tools2->set(MusEWidget::DrawTool); return; } else if (key == shortcuts[SHRT_POS_INC].key) { @@ -1090,14 +1090,14 @@ void PianoRoll::keyPressEvent(QKeyEvent* event) return; } else if (key == shortcuts[SHRT_SCROLL_LEFT].key) { - int pos = hscroll->pos() - config.division; + int pos = hscroll->pos() - MusEConfig::config.division; if (pos < 0) pos = 0; hscroll->setPos(pos); return; } else if (key == shortcuts[SHRT_SCROLL_RIGHT].key) { - int pos = hscroll->pos() + config.division; + int pos = hscroll->pos() + MusEConfig::config.division; hscroll->setPos(pos); return; } diff --git a/muse2/muse/midiedit/pianoroll.h b/muse2/muse/midiedit/pianoroll.h index d195e437..885d6538 100644 --- a/muse2/muse/midiedit/pianoroll.h +++ b/muse2/muse/midiedit/pianoroll.h @@ -127,7 +127,7 @@ class PianoRoll : public MidiEditor { QToolButton* speaker; QToolBar* tools; - EditToolBar* tools2; + MusEWidget::EditToolBar* tools2; int colorMode; diff --git a/muse2/muse/midiedit/prcanvas.cpp b/muse2/muse/midiedit/prcanvas.cpp index e7d47c73..1a2644f6 100644 --- a/muse2/muse/midiedit/prcanvas.cpp +++ b/muse2/muse/midiedit/prcanvas.cpp @@ -261,7 +261,7 @@ void PianoCanvas::drawItem(QPainter& p, const CItem* item, //int mfh = mh; //if(mfh == meh) mfh -= 1; //if(mfy == mey) mfh -= 1; - color.setAlpha(config.globalAlphaBlend); + color.setAlpha(MusEConfig::config.globalAlphaBlend); //QLinearGradient gradient(mex + 1, mey + 1, mex + 1, mey + meh - 2); // Inside the border //gradient.setColorAt(0, color); //gradient.setColorAt(1, color.darker()); @@ -316,7 +316,7 @@ void PianoCanvas::drawMoving(QPainter& p, const CItem* item, const QRect& rect) void PianoCanvas::viewMouseDoubleClickEvent(QMouseEvent* event) { - if ((_tool != PointerTool) && (event->button() != Qt::LeftButton)) { + if ((_tool != MusEWidget::PointerTool) && (event->button() != Qt::LeftButton)) { mousePress(event); return; } @@ -731,7 +731,7 @@ void PianoCanvas::pianoPressed(int pitch, int velocity, bool shift) audio->msgPlayMidiEvent(&e); if (_steprec && pos[0] >= start_tick /* && pos[0] < end_tick [removed by flo93: this is handled in steprec->record] */ && curPart) - steprec->record(curPart,pitch,editor->raster(),editor->raster(),velocity,globalKeyState&Qt::ControlModifier,shift); + steprec->record(curPart,pitch,editor->raster(),editor->raster(),velocity,MusEGlobal::globalKeyState&Qt::ControlModifier,shift); } //--------------------------------------------------------- @@ -927,14 +927,14 @@ void PianoCanvas::cmd(int cmd) //--------------------------------------------------------- void PianoCanvas::midiNote(int pitch, int velo) { - if (debugMsg) printf("PianoCanvas::midiNote: pitch=%i, velo=%i\n", pitch, velo); + if (MusEGlobal::debugMsg) printf("PianoCanvas::midiNote: pitch=%i, velo=%i\n", pitch, velo); if (velo) noteHeldDown[pitch]=true; else noteHeldDown[pitch]=false; - if (heavyDebugMsg) + if (MusEGlobal::heavyDebugMsg) { printf(" held down notes are: "); for (int i=0;i<128;i++) @@ -946,8 +946,8 @@ void PianoCanvas::midiNote(int pitch, int velo) if (_midiin && _steprec && curPart && !audio->isPlaying() && velo && pos[0] >= start_tick /* && pos[0] < end_tick [removed by flo93: this is handled in steprec->record] */ - && !(globalKeyState & Qt::AltModifier)) { - steprec->record(curPart,pitch,editor->raster(),editor->raster(),velo,globalKeyState&Qt::ControlModifier,globalKeyState&Qt::ShiftModifier); + && !(MusEGlobal::globalKeyState & Qt::AltModifier)) { + steprec->record(curPart,pitch,editor->raster(),editor->raster(),velo,MusEGlobal::globalKeyState&Qt::ControlModifier,MusEGlobal::globalKeyState&Qt::ShiftModifier); } } diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index e8ebc22a..7965be1a 100644 --- a/muse2/muse/midiedit/scoreedit.cpp +++ b/muse2/muse/midiedit/scoreedit.cpp @@ -229,7 +229,7 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos) // Toolbars --------------------------------------------------------- QToolBar* undo_tools=addToolBar(tr("Undo/Redo tools")); undo_tools->setObjectName("Undo/Redo tools"); - undo_tools->addActions(undoRedo->actions()); + undo_tools->addActions(MusEGlobal::undoRedo->actions()); addToolBar(undo_tools); QToolBar* steprec_tools=addToolBar(tr("Step recording tools")); @@ -242,19 +242,19 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos) connect(srec, SIGNAL(toggled(bool)), score_canvas, SLOT(set_steprec(bool))); - edit_tools = new EditToolBar(this, PointerTool | PencilTool | RubberTool); + edit_tools = new MusEWidget::EditToolBar(this, MusEWidget::PointerTool | MusEWidget::PencilTool | MusEWidget::RubberTool); addToolBar(edit_tools); - edit_tools->set(PointerTool); - score_canvas->set_tool(PointerTool); + edit_tools->set(MusEWidget::PointerTool); + score_canvas->set_tool(MusEWidget::PointerTool); connect(edit_tools, SIGNAL(toolChanged(int)), score_canvas, SLOT(set_tool(int))); QToolBar* panic_toolbar = addToolBar(tr("panic")); panic_toolbar->setObjectName("panic"); - panic_toolbar->addAction(panicAction); + panic_toolbar->addAction(MusEGlobal::panicAction); QToolBar* transport_toolbar = addToolBar(tr("transport")); transport_toolbar->setObjectName("transport"); - transport_toolbar->addActions(transportAction->actions()); + transport_toolbar->addActions(MusEGlobal::transportAction->actions()); addToolBarBreak(); @@ -356,7 +356,7 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos) QMenu* edit_menu = menuBar()->addMenu(tr("&Edit")); - edit_menu->addActions(undoRedo->actions()); + edit_menu->addActions(MusEGlobal::undoRedo->actions()); edit_menu->addSeparator(); cut_action = edit_menu->addAction(QIcon(*editcutIconSet), tr("C&ut")); @@ -465,7 +465,7 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos) init_shortcuts(); - connect(muse, SIGNAL(configChanged()), SLOT(init_shortcuts())); + connect(MusEGlobal::muse, SIGNAL(configChanged()), SLOT(init_shortcuts())); QClipboard* cb = QApplication::clipboard(); connect(cb, SIGNAL(dataChanged()), SLOT(clipboard_changed())); @@ -770,11 +770,11 @@ Part* read_part(Xml& xml, QString tag_name="part") else { sscanf(tag.toLatin1().constData(), "%d:%d", &trackIdx, &partIdx); - if (debugMsg) cout << "read_part: trackIdx="<<trackIdx<<", partIdx="<<partIdx; + if (MusEGlobal::debugMsg) cout << "read_part: trackIdx="<<trackIdx<<", partIdx="<<partIdx; Track* track = song->tracks()->index(trackIdx); if (track) part = track->parts()->find(partIdx); - if (debugMsg) cout << ", track="<<track<<", part="<<part<<endl; + if (MusEGlobal::debugMsg) cout << ", track="<<track<<", part="<<part<<endl; } } break; @@ -1235,11 +1235,11 @@ ScoreCanvas::ScoreCanvas(ScoreEdit* pr, QWidget* parent_widget) : View(parent_wi x_scroll_pos=0; y_scroll_speed=0; y_scroll_pos=0; - connect (heartBeatTimer, SIGNAL(timeout()), SLOT(heartbeat_timer_event())); + connect (MusEGlobal::heartBeatTimer, SIGNAL(timeout()), SLOT(heartbeat_timer_event())); connect(song, SIGNAL(posChanged(int, unsigned, bool)), SLOT(pos_changed(int,unsigned,bool))); connect(song, SIGNAL(playChanged(bool)), SLOT(play_changed(bool))); - connect(muse, SIGNAL(configChanged()), SLOT(config_changed())); + connect(MusEGlobal::muse, SIGNAL(configChanged()), SLOT(config_changed())); staff_menu=new QMenu(this); @@ -1558,13 +1558,13 @@ void ScoreCanvas::init_pixmaps() { if (!pixmaps_initalized) { - if (debugMsg) cout << "initalizing colors..." << endl; + if (MusEGlobal::debugMsg) cout << "initalizing colors..." << endl; mycolors=new QColor[NUM_MYCOLORS]; mycolors[0]=Qt::black; for (int i=1;i<NUM_PARTCOLORS;i++) - mycolors[i]=config.partColors[i]; + mycolors[i]=MusEConfig::config.partColors[i]; mycolors[BLACK_PIXMAP]=Qt::black; mycolors[HIGHLIGHTED_PIXMAP]=Qt::red; mycolors[SELECTED_PIXMAP]=QColor(255,160,0); @@ -1575,7 +1575,7 @@ void ScoreCanvas::init_pixmaps() mycolors[i+VELO_PIXMAP_BEGIN]=QColor(0xff,0,(127-i)*4); - if (debugMsg) cout << "loading pixmaps..." << endl; + if (MusEGlobal::debugMsg) cout << "loading pixmaps..." << endl; pix_whole=new QPixmap[NUM_MYCOLORS]; pix_half=new QPixmap[NUM_MYCOLORS]; @@ -1602,38 +1602,38 @@ void ScoreCanvas::init_pixmaps() - load_colored_pixmaps(museGlobalShare + "/scoreglyphs/whole.png", pix_whole); - load_colored_pixmaps(museGlobalShare + "/scoreglyphs/half.png", pix_half); - load_colored_pixmaps(museGlobalShare + "/scoreglyphs/quarter.png", pix_quarter); - load_colored_pixmaps(museGlobalShare + "/scoreglyphs/dot.png", pix_dot); - load_colored_pixmaps(museGlobalShare + "/scoreglyphs/acc_none.png", pix_noacc); - load_colored_pixmaps(museGlobalShare + "/scoreglyphs/acc_sharp.png", pix_sharp); - load_colored_pixmaps(museGlobalShare + "/scoreglyphs/acc_b.png", pix_b); - - pix_r1->load(museGlobalShare + "/scoreglyphs/rest1.png"); - pix_r2->load(museGlobalShare + "/scoreglyphs/rest2.png"); - pix_r4->load(museGlobalShare + "/scoreglyphs/rest4.png"); - pix_r8->load(museGlobalShare + "/scoreglyphs/rest8.png"); - pix_r16->load(museGlobalShare + "/scoreglyphs/rest16.png"); - pix_r32->load(museGlobalShare + "/scoreglyphs/rest32.png"); - pix_flag_up[0].load(museGlobalShare + "/scoreglyphs/flags8u.png"); - pix_flag_up[1].load(museGlobalShare + "/scoreglyphs/flags16u.png"); - pix_flag_up[2].load(museGlobalShare + "/scoreglyphs/flags32u.png"); - pix_flag_up[3].load(museGlobalShare + "/scoreglyphs/flags64u.png"); - pix_flag_down[0].load(museGlobalShare + "/scoreglyphs/flags8d.png"); - pix_flag_down[1].load(museGlobalShare + "/scoreglyphs/flags16d.png"); - pix_flag_down[2].load(museGlobalShare + "/scoreglyphs/flags32d.png"); - pix_flag_down[3].load(museGlobalShare + "/scoreglyphs/flags64d.png"); + load_colored_pixmaps(MusEGlobal::museGlobalShare + "/scoreglyphs/whole.png", pix_whole); + load_colored_pixmaps(MusEGlobal::museGlobalShare + "/scoreglyphs/half.png", pix_half); + load_colored_pixmaps(MusEGlobal::museGlobalShare + "/scoreglyphs/quarter.png", pix_quarter); + load_colored_pixmaps(MusEGlobal::museGlobalShare + "/scoreglyphs/dot.png", pix_dot); + load_colored_pixmaps(MusEGlobal::museGlobalShare + "/scoreglyphs/acc_none.png", pix_noacc); + load_colored_pixmaps(MusEGlobal::museGlobalShare + "/scoreglyphs/acc_sharp.png", pix_sharp); + load_colored_pixmaps(MusEGlobal::museGlobalShare + "/scoreglyphs/acc_b.png", pix_b); + + pix_r1->load(MusEGlobal::museGlobalShare + "/scoreglyphs/rest1.png"); + pix_r2->load(MusEGlobal::museGlobalShare + "/scoreglyphs/rest2.png"); + pix_r4->load(MusEGlobal::museGlobalShare + "/scoreglyphs/rest4.png"); + pix_r8->load(MusEGlobal::museGlobalShare + "/scoreglyphs/rest8.png"); + pix_r16->load(MusEGlobal::museGlobalShare + "/scoreglyphs/rest16.png"); + pix_r32->load(MusEGlobal::museGlobalShare + "/scoreglyphs/rest32.png"); + pix_flag_up[0].load(MusEGlobal::museGlobalShare + "/scoreglyphs/flags8u.png"); + pix_flag_up[1].load(MusEGlobal::museGlobalShare + "/scoreglyphs/flags16u.png"); + pix_flag_up[2].load(MusEGlobal::museGlobalShare + "/scoreglyphs/flags32u.png"); + pix_flag_up[3].load(MusEGlobal::museGlobalShare + "/scoreglyphs/flags64u.png"); + pix_flag_down[0].load(MusEGlobal::museGlobalShare + "/scoreglyphs/flags8d.png"); + pix_flag_down[1].load(MusEGlobal::museGlobalShare + "/scoreglyphs/flags16d.png"); + pix_flag_down[2].load(MusEGlobal::museGlobalShare + "/scoreglyphs/flags32d.png"); + pix_flag_down[3].load(MusEGlobal::museGlobalShare + "/scoreglyphs/flags64d.png"); - pix_clef_violin->load(museGlobalShare + "/scoreglyphs/clef_violin_big.png"); - pix_clef_bass->load(museGlobalShare + "/scoreglyphs/clef_bass_big.png"); + pix_clef_violin->load(MusEGlobal::museGlobalShare + "/scoreglyphs/clef_violin_big.png"); + pix_clef_bass->load(MusEGlobal::museGlobalShare + "/scoreglyphs/clef_bass_big.png"); for (int i=0;i<10;i++) - pix_num[i].load(museGlobalShare + "/scoreglyphs/"+IntToQStr(i)+".png"); + pix_num[i].load(MusEGlobal::museGlobalShare + "/scoreglyphs/"+IntToQStr(i)+".png"); pixmaps_initalized=true; - if (debugMsg) cout << "done" << endl; + if (MusEGlobal::debugMsg) cout << "done" << endl; } } @@ -1715,11 +1715,11 @@ void staff_t::create_appropriate_eventlist() end=flo_quantize(event.endTick()+part->tick(), parent->quant_ticks()); if (end==begin) { - if (heavyDebugMsg) cout << "note len would be quantized to zero. using minimal possible length" << endl; + if (MusEGlobal::heavyDebugMsg) cout << "note len would be quantized to zero. using minimal possible length" << endl; end=begin+parent->quant_ticks(); } - if (heavyDebugMsg) cout << "inserting note on at "<<begin<<" with pitch="<<event.pitch()<<" and len="<<end-begin<<endl; + if (MusEGlobal::heavyDebugMsg) cout << "inserting note on at "<<begin<<" with pitch="<<event.pitch()<<" and len="<<end-begin<<endl; eventlist.insert(pair<unsigned, FloEvent>(begin, FloEvent(begin,event.pitch(), event.velo(),end-begin,FloEvent::NOTE_ON,part,&it->second))); } //else ignore it @@ -1736,7 +1736,7 @@ void staff_t::create_appropriate_eventlist() if (to > unsigned(SONG_LENGTH)) to=SONG_LENGTH; - if (heavyDebugMsg) cout << "new signature from tick "<<from<<" to " << to << ": "<<it->second->sig.z<<"/"<<it->second->sig.n<<"; ticks per measure = "<<ticks_per_measure<<endl; + if (MusEGlobal::heavyDebugMsg) cout << "new signature from tick "<<from<<" to " << to << ": "<<it->second->sig.z<<"/"<<it->second->sig.n<<"; ticks per measure = "<<ticks_per_measure<<endl; eventlist.insert(pair<unsigned, FloEvent>(from, FloEvent(from, FloEvent::TIME_SIG, it->second->sig.z, it->second->sig.n) ) ); for (unsigned t=from; t<to; t+=ticks_per_measure) eventlist.insert(pair<unsigned, FloEvent>(t, FloEvent(t,0,0,ticks_per_measure,FloEvent::BAR) ) ); @@ -1913,7 +1913,7 @@ int calc_measure_len(const list<int>& nums, int denom) vector<int> create_emphasize_list(const list<int>& nums, int denom) { - if (heavyDebugMsg) + if (MusEGlobal::heavyDebugMsg) { cout << "creating emphasize list for "; for (list<int>::const_iterator it=nums.begin(); it!=nums.end(); it++) @@ -1941,7 +1941,7 @@ vector<int> create_emphasize_list(const list<int>& nums, int denom) result[0]=0; - if (heavyDebugMsg) + if (MusEGlobal::heavyDebugMsg) { for (int i=0;i<len;i++) { @@ -2023,7 +2023,7 @@ list<note_len_t> parse_note_len(int len_ticks, int begin_tick, vector<int>& foo, len_now=len_now*TICKS_PER_WHOLE/64; - if (heavyDebugMsg) cout << "add " << len_now << " ticks" << endl; + if (MusEGlobal::heavyDebugMsg) cout << "add " << len_now << " ticks" << endl; if (allow_dots) { for (int i=0;i<=MAX_QUANT_POWER;i++) @@ -2166,7 +2166,7 @@ void staff_t::create_itemlist() note_pos_t notepos=note_pos(pitch,tmp_key,clef); - if (heavyDebugMsg) + if (MusEGlobal::heavyDebugMsg) { printf("FLO: t=%i\ttype=%i\tpitch=%i\tvel=%i\tlen=%i\n",it->first, it->second.type, it->second.pitch, it->second.vel, it->second.len); cout << "\tline="<<notepos.height<<"\tvorzeichen="<<notepos.vorzeichen << endl; @@ -2179,7 +2179,7 @@ void staff_t::create_itemlist() if (lastevent==last_measure) //there was no note? { unsigned tmppos=(last_measure+t-parent->quant_ticks())/2; - if (heavyDebugMsg) cout << "\tend-of-measure: this was an empty measure. inserting rest in between at t="<<tmppos << endl; + if (MusEGlobal::heavyDebugMsg) cout << "\tend-of-measure: this was an empty measure. inserting rest in between at t="<<tmppos << endl; itemlist[tmppos].insert( FloItem(FloItem::REST,notepos,0,0) ); itemlist[t].insert( FloItem(FloItem::REST_END,notepos,0,0) ); } @@ -2189,13 +2189,13 @@ void staff_t::create_itemlist() int rest=t-lastevent; if (rest) { - if (heavyDebugMsg) printf("\tend-of-measure: set rest at %i with len %i\n",lastevent,rest); + if (MusEGlobal::heavyDebugMsg) printf("\tend-of-measure: set rest at %i with len %i\n",lastevent,rest); list<note_len_t> lens=parse_note_len(rest,lastevent-last_measure,emphasize_list,DOTTED_RESTS,UNSPLIT_RESTS); unsigned tmppos=lastevent; for (list<note_len_t>::iterator x=lens.begin(); x!=lens.end(); x++) { - if (heavyDebugMsg) cout << "\t\tpartial rest with len="<<x->len<<", dots="<<x->dots<<endl; + if (MusEGlobal::heavyDebugMsg) cout << "\t\tpartial rest with len="<<x->len<<", dots="<<x->dots<<endl; itemlist[tmppos].insert( FloItem(FloItem::REST,notepos,x->len,x->dots) ); tmppos+=calc_len(x->len,x->dots); itemlist[tmppos].insert( FloItem(FloItem::REST_END,notepos,0,0) ); @@ -2215,7 +2215,7 @@ void staff_t::create_itemlist() int rest=t-lastevent; if (rest) { - if (heavyDebugMsg) printf("\tset rest at %i with len %i\n",lastevent,rest); + if (MusEGlobal::heavyDebugMsg) printf("\tset rest at %i with len %i\n",lastevent,rest); // no need to check if the rest crosses measure boundaries; // it can't. @@ -2223,7 +2223,7 @@ void staff_t::create_itemlist() unsigned tmppos=lastevent; for (list<note_len_t>::iterator x=lens.begin(); x!=lens.end(); x++) { - if (heavyDebugMsg) cout << "\t\tpartial rest with len="<<x->len<<", dots="<<x->dots<<endl; + if (MusEGlobal::heavyDebugMsg) cout << "\t\tpartial rest with len="<<x->len<<", dots="<<x->dots<<endl; itemlist[tmppos].insert( FloItem(FloItem::REST,notepos,x->len,x->dots) ); tmppos+=calc_len(x->len,x->dots); itemlist[tmppos].insert( FloItem(FloItem::REST_END,notepos,0,0) ); @@ -2232,7 +2232,7 @@ void staff_t::create_itemlist() - if (heavyDebugMsg) printf("\tset note at %i with len=%i\n", t, len); + if (MusEGlobal::heavyDebugMsg) printf("\tset note at %i with len=%i\n", t, len); int tmplen; bool tied_note; @@ -2249,14 +2249,14 @@ void staff_t::create_itemlist() eventlist.insert(pair<unsigned, FloEvent>(next_measure, FloEvent(actual_tick,pitch, velo,0,FloEvent::NOTE_OFF, it->second.source_part, it->second.source_event))); eventlist.insert(pair<unsigned, FloEvent>(next_measure, FloEvent(actual_tick,pitch, velo,newlen,FloEvent::NOTE_ON, it->second.source_part, it->second.source_event))); - if (heavyDebugMsg) cout << "\t\tnote was split to length "<<tmplen<<" + " << newlen<<endl; + if (MusEGlobal::heavyDebugMsg) cout << "\t\tnote was split to length "<<tmplen<<" + " << newlen<<endl; } else { tmplen=len; tied_note=false; - if (heavyDebugMsg) cout << "\t\tinserting NOTE OFF at "<<t+len<<endl; + if (MusEGlobal::heavyDebugMsg) cout << "\t\tinserting NOTE OFF at "<<t+len<<endl; eventlist.insert(pair<unsigned, FloEvent>(t+len, FloEvent(t+len,pitch, velo,0,FloEvent::NOTE_OFF,it->second.source_part, it->second.source_event))); } @@ -2266,7 +2266,7 @@ void staff_t::create_itemlist() int count=0; for (list<note_len_t>::iterator x=lens.begin(); x!=lens.end(); x++) { - if (heavyDebugMsg) cout << "\t\tpartial note with len="<<x->len<<", dots="<<x->dots<<endl; + if (MusEGlobal::heavyDebugMsg) cout << "\t\tpartial note with len="<<x->len<<", dots="<<x->dots<<endl; count++; bool tie; @@ -2287,14 +2287,14 @@ void staff_t::create_itemlist() } else if (type==FloEvent::TIME_SIG) { - if (heavyDebugMsg) cout << "inserting TIME SIGNATURE "<<it->second.num<<"/"<<it->second.denom<<" at "<<t<<endl; + if (MusEGlobal::heavyDebugMsg) cout << "inserting TIME SIGNATURE "<<it->second.num<<"/"<<it->second.denom<<" at "<<t<<endl; itemlist[t].insert( FloItem(FloItem::TIME_SIG, it->second.num, it->second.denom) ); emphasize_list=create_emphasize_list(it->second.num, it->second.denom); } else if (type==FloEvent::KEY_CHANGE) { - if (heavyDebugMsg) cout << "inserting KEY CHANGE ("<<it->second.key<<") at "<<t<<endl; + if (MusEGlobal::heavyDebugMsg) cout << "inserting KEY CHANGE ("<<it->second.key<<") at "<<t<<endl; itemlist[t].insert( FloItem(FloItem::KEY_CHANGE, it->second.key) ); tmp_key=it->second.key; } @@ -2312,7 +2312,7 @@ void staff_t::process_itemlist() { set<FloItem, floComp>& curr_items=it2->second; - if (heavyDebugMsg) cout << "at t="<<it2->first<<endl; + if (MusEGlobal::heavyDebugMsg) cout << "at t="<<it2->first<<endl; // phase 0: keep track of active notes, rests ------------------- // (and occupied lines) and the last measure @@ -2329,7 +2329,7 @@ void staff_t::process_itemlist() emphasize_list=create_emphasize_list(it->num, it->denom); } - if (heavyDebugMsg) + if (MusEGlobal::heavyDebugMsg) { cout << "occupied: "; for (map<int,int>::iterator i=occupied.begin(); i!=occupied.end(); i++) @@ -2355,7 +2355,7 @@ void staff_t::process_itemlist() //(can be seen on already_grouped) if ((it->type==FloItem::REST) && (it->already_grouped==false)) { - if (heavyDebugMsg) cout << "trying to group" << endl; + if (MusEGlobal::heavyDebugMsg) cout << "trying to group" << endl; int lastheight; int height_cumulative=0; @@ -2366,12 +2366,12 @@ void staff_t::process_itemlist() set<FloItem, floComp>::iterator tmp; for (tmp=it; tmp!=curr_items.end();) { - if (heavyDebugMsg) cout << "checking if we can proceed with an item at height="<<tmp->pos.height<<endl; + if (MusEGlobal::heavyDebugMsg) cout << "checking if we can proceed with an item at height="<<tmp->pos.height<<endl; for (int i=lastheight+1; i<=tmp->pos.height-1; i++) if (occupied[i]!=0) { - if (heavyDebugMsg) cout << "we can NOT, because occ["<<i<<"] != 0" << endl; + if (MusEGlobal::heavyDebugMsg) cout << "we can NOT, because occ["<<i<<"] != 0" << endl; //stop grouping that rest goto get_out_here; } @@ -2383,7 +2383,7 @@ void staff_t::process_itemlist() { // füge diese pause zur gruppe dazu und entferne sie von diesem set hier // entfernen aber nur, wenn sie nicht it, also die erste pause ist, die brauchen wir noch! - if (heavyDebugMsg) cout << "\tgrouping rest at height="<<tmp->pos.height<<endl; + if (MusEGlobal::heavyDebugMsg) cout << "\tgrouping rest at height="<<tmp->pos.height<<endl; height_cumulative+=tmp->pos.height; counter++; if (tmp!=it) @@ -2393,12 +2393,12 @@ void staff_t::process_itemlist() } else //it's something else? well, we can stop grouping that rest then { - if (heavyDebugMsg) cout << "we can NOT, because that item is not a rest" << endl; + if (MusEGlobal::heavyDebugMsg) cout << "we can NOT, because that item is not a rest" << endl; //stop grouping that rest goto get_out_here; } } - if (heavyDebugMsg) cout << "no items to proceed on left, continuing" << endl; + if (MusEGlobal::heavyDebugMsg) cout << "no items to proceed on left, continuing" << endl; get_out_here: n_groups++; @@ -2413,7 +2413,7 @@ void staff_t::process_itemlist() // have we grouped all available rests into one single? if ( (n_groups==1) && (tmp==curr_items.end()) && !dont_group) { - if (heavyDebugMsg) cout << "wow, we were able to group all rests into one single" << endl; + if (MusEGlobal::heavyDebugMsg) cout << "wow, we were able to group all rests into one single" << endl; if (temp.len==0) //the whole rest is shifted one line (one space and one line) temp.pos.height=DEFAULT_REST_HEIGHT+2; else @@ -2421,7 +2421,7 @@ void staff_t::process_itemlist() } else { - if (heavyDebugMsg) cout << "creating group #"<<n_groups<<endl; + if (MusEGlobal::heavyDebugMsg) cout << "creating group #"<<n_groups<<endl; temp.pos.height=nearbyint((float)height_cumulative/counter); } @@ -2432,7 +2432,7 @@ void staff_t::process_itemlist() // the item. effect: you don't have the rest at all curr_items.erase(it++); - if (heavyDebugMsg) cout << "replacing all grouped rests with a rest at height="<<temp.pos.height<<endl; + if (MusEGlobal::heavyDebugMsg) cout << "replacing all grouped rests with a rest at height="<<temp.pos.height<<endl; curr_items.insert(temp); } @@ -2523,7 +2523,7 @@ group_them_again: if (it->type==FloItem::NOTE) lengths[it->len].add(it->pos.height); - if (heavyDebugMsg) + if (MusEGlobal::heavyDebugMsg) { cout << "note lengths at that time are:"; for (map<int, cumulative_t>::iterator it=lengths.begin(); it!=lengths.end(); it++) @@ -2536,14 +2536,14 @@ group_them_again: if (lengths.size()==0) { - if (heavyDebugMsg) cout << "no notes other than wholes, or no notes at all. we can relax" << endl; + if (MusEGlobal::heavyDebugMsg) cout << "no notes other than wholes, or no notes at all. we can relax" << endl; } else if (lengths.size()==1) { pair<const int, cumulative_t>& group=*(lengths.begin()); stem_t stem; int shift=0; - if (heavyDebugMsg) cout << "only one non-whole note group (len="<<group.first<<") at height="<<group.second.mean()<< endl; + if (MusEGlobal::heavyDebugMsg) cout << "only one non-whole note group (len="<<group.first<<") at height="<<group.second.mean()<< endl; if (group.second.mean()>=6) { @@ -2574,7 +2574,7 @@ group_them_again: pair<const int, cumulative_t>& group2=*it; stem_t stem1, stem2; int shift1=0, shift2=0; - if (heavyDebugMsg) cout << "two non-whole note group: len="<<group1.first<<" at height="<<group1.second.mean()<<" and len="<<group2.first<<" at height="<<group2.second.mean()<< endl; + if (MusEGlobal::heavyDebugMsg) cout << "two non-whole note group: len="<<group1.first<<" at height="<<group1.second.mean()<<" and len="<<group2.first<<" at height="<<group2.second.mean()<< endl; if (group1.second.mean()<group2.second.mean()) { @@ -2632,17 +2632,17 @@ group_them_again: group1_len_ticks=calc_len(group1_len,0); group2_len_ticks=calc_len(group2_len,0); - if (heavyDebugMsg) cout << "we have "<<lengths.size()<<" groups. putting the "<<group1_n<<" longest and the "<<group2_n<<"shortest groups together"<<endl << + if (MusEGlobal::heavyDebugMsg) cout << "we have "<<lengths.size()<<" groups. putting the "<<group1_n<<" longest and the "<<group2_n<<"shortest groups together"<<endl << "\tgroup1 will have len="<<group1_len<<" ("<<group1_len_ticks<<" ticks), group2 will have len="<<group2_len<<" ("<<group2_len_ticks<<" ticks)"<<endl; for (set<FloItem, floComp>::iterator it=curr_items.begin(); it!=curr_items.end();) if (it->type==FloItem::NOTE) { //if *it belongs to group1 and has not already its destination length - if (heavyDebugMsg) cout << "\tprocessing note-item with len="<<it->len<<endl; + if (MusEGlobal::heavyDebugMsg) cout << "\tprocessing note-item with len="<<it->len<<endl; if (it->len<group1_len) { - if (heavyDebugMsg) cout << "\t\thas to be changed to fit into group 1" << endl; + if (MusEGlobal::heavyDebugMsg) cout << "\t\thas to be changed to fit into group 1" << endl; FloItem tmp=*it; curr_items.erase(it++); @@ -2667,7 +2667,7 @@ group_them_again: int count=0; for (list<note_len_t>::iterator x=lens.begin(); x!=lens.end(); x++) { - if (heavyDebugMsg) cout << "\t\twhile regrouping: partial note with len="<<x->len<<", dots="<<x->dots<<endl; + if (MusEGlobal::heavyDebugMsg) cout << "\t\twhile regrouping: partial note with len="<<x->len<<", dots="<<x->dots<<endl; count++; bool tie; @@ -2686,7 +2686,7 @@ group_them_again: //else if *it belongs to group2 and has not already its destination length else if ((it->len<group2_len) && (it->len>group1_len)) { - if (heavyDebugMsg) cout << "\t\thas to be changed to fit into group 2" << endl; + if (MusEGlobal::heavyDebugMsg) cout << "\t\thas to be changed to fit into group 2" << endl; FloItem tmp=*it; curr_items.erase(it++); @@ -2712,7 +2712,7 @@ group_them_again: int count=0; for (list<note_len_t>::iterator x=lens.begin(); x!=lens.end(); x++) { - if (heavyDebugMsg) cout << "\t\twhile regrouping: partial note with len="<<x->len<<", dots="<<x->dots<<endl; + if (MusEGlobal::heavyDebugMsg) cout << "\t\twhile regrouping: partial note with len="<<x->len<<", dots="<<x->dots<<endl; count++; bool tie; @@ -2730,7 +2730,7 @@ group_them_again: } else //nothing to do? { - if (heavyDebugMsg) cout << "\t\tnothing to do" << endl; + if (MusEGlobal::heavyDebugMsg) cout << "\t\tnothing to do" << endl; it++; } } @@ -2746,7 +2746,7 @@ group_them_again: //draw a pixmap centered void ScoreCanvas::draw_pixmap(QPainter& p, int x, int y, const QPixmap& pm) { - if (heavyDebugMsg) cout << "drawing pixmap with size="<<pm.width()<<"/"<<pm.height()<<" at "<<x<<"/"<<y<<endl; + if (MusEGlobal::heavyDebugMsg) cout << "drawing pixmap with size="<<pm.width()<<"/"<<pm.height()<<" at "<<x<<"/"<<y<<endl; p.drawPixmap(x-pm.width()/2,y-pm.height()/2,pm); } @@ -2963,7 +2963,7 @@ void ScoreCanvas::draw_items(QPainter& p, int y_offset, staff_t& staff, ScoreIte for (ScoreItemList::iterator it2=from_it; it2!=to_it; it2++) { - if (heavyDebugMsg) cout << "at t="<<it2->first << endl; + if (MusEGlobal::heavyDebugMsg) cout << "at t="<<it2->first << endl; int upstem_y1 = -1, upstem_y2=-1, upstem_x=-1, upflag=-1; int downstem_y1 = -1, downstem_y2=-1, downstem_x=-1, downflag=-1; @@ -2972,7 +2972,7 @@ void ScoreCanvas::draw_items(QPainter& p, int y_offset, staff_t& staff, ScoreIte { if (it->type==FloItem::NOTE) { - if (heavyDebugMsg) + if (MusEGlobal::heavyDebugMsg) { cout << "\tNOTE at line"<<it->pos.height<<" with acc.="<<it->pos.vorzeichen<<", len="<<pow(2,it->len); for (int i=0;i<it->dots;i++) cout << "."; @@ -3106,7 +3106,7 @@ void ScoreCanvas::draw_items(QPainter& p, int y_offset, staff_t& staff, ScoreIte //if needed, draw tie if (it->is_tie_dest) { - if (heavyDebugMsg) cout << "drawing tie" << endl; + if (MusEGlobal::heavyDebugMsg) cout << "drawing tie" << endl; draw_tie(p,it->tie_from_x-x_pos+x_left,it->x -x_pos+x_left,y_offset + it->y, (it->len==0) ? true : (it->stem==DOWNWARDS) , mycolors[color_index]); // in english: "if it's a whole note, tie is upwards (true). if not, tie is upwards if // stem is downwards and vice versa" @@ -3114,7 +3114,7 @@ void ScoreCanvas::draw_items(QPainter& p, int y_offset, staff_t& staff, ScoreIte } else if (it->type==FloItem::REST) { - if (heavyDebugMsg) + if (MusEGlobal::heavyDebugMsg) { cout << "\tREST at line"<<it->pos.height<<" with len="<<pow(2,it->len); for (int i=0;i<it->dots;i++) cout << "."; @@ -3144,7 +3144,7 @@ void ScoreCanvas::draw_items(QPainter& p, int y_offset, staff_t& staff, ScoreIte } else if (it->type==FloItem::BAR) { - if (heavyDebugMsg) cout << "\tBAR" << endl; + if (MusEGlobal::heavyDebugMsg) cout << "\tBAR" << endl; p.setPen(Qt::black); p.drawLine(it->x -x_pos+x_left,y_offset -2*YLEN,it->x -x_pos+x_left,y_offset +2*YLEN); @@ -3154,14 +3154,14 @@ void ScoreCanvas::draw_items(QPainter& p, int y_offset, staff_t& staff, ScoreIte } else if (it->type==FloItem::TIME_SIG) { - if (heavyDebugMsg) cout << "\tTIME SIGNATURE: "<<it->num<<"/"<<it->denom<<endl; + if (MusEGlobal::heavyDebugMsg) cout << "\tTIME SIGNATURE: "<<it->num<<"/"<<it->denom<<endl; draw_timesig(p, it->x - x_pos+x_left, y_offset, it->num, it->denom); } else if (it->type==FloItem::KEY_CHANGE) { key_enum new_key=it->key; - if (heavyDebugMsg) cout << "\tKEY CHANGE: from "<<curr_key<<" to "<<new_key<<endl; + if (MusEGlobal::heavyDebugMsg) cout << "\tKEY CHANGE: from "<<curr_key<<" to "<<new_key<<endl; list<int> aufloes_list=calc_accidentials(curr_key, staff.clef, new_key); list<int> new_acc_list=calc_accidentials(new_key, staff.clef); @@ -3372,7 +3372,7 @@ void ScoreCanvas::draw_number(QPainter& p, int x, int y, int n) void ScoreCanvas::draw(QPainter& p, const QRect&) { - if (debugMsg) cout <<"now in ScoreCanvas::draw"<<endl; + if (MusEGlobal::debugMsg) cout <<"now in ScoreCanvas::draw"<<endl; @@ -3395,7 +3395,7 @@ void ScoreCanvas::draw(QPainter& p, const QRect&) p.drawRect(lasso); } - if (debugMsg) cout << "drawing done." << endl; + if (MusEGlobal::debugMsg) cout << "drawing done." << endl; } @@ -3578,7 +3578,7 @@ void ScoreCanvas::mousePressEvent (QMouseEvent* event) { ScoreItemList& itemlist=staff_it->itemlist; - if (debugMsg) cout << "mousePressEvent at "<<x<<"/"<<y<<"; tick="<<tick<<endl; + if (MusEGlobal::debugMsg) cout << "mousePressEvent at "<<x<<"/"<<y<<"; tick="<<tick<<endl; set<FloItem, floComp>::iterator set_it; for (set_it=itemlist[tick].begin(); set_it!=itemlist[tick].end(); set_it++) if (set_it->type==FloItem::NOTE) @@ -3634,7 +3634,7 @@ void ScoreCanvas::mousePressEvent (QMouseEvent* event) mouse_x_drag_operation=NO_OP; } - if (debugMsg) + if (MusEGlobal::debugMsg) cout << "you clicked at a note with begin at "<<set_it->begin_tick<<" and end at "<<t<<endl << "x-drag-operation will be "<<mouse_x_drag_operation<<endl << "pointer to part is "<<set_it->source_part << endl; @@ -3702,13 +3702,13 @@ void ScoreCanvas::mousePressEvent (QMouseEvent* event) 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 << + if (MusEGlobal::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="<<newevent.endTick()<<" to len="<<(curr_part->lenTick() - newevent.tick())<<endl; + if (MusEGlobal::debugMsg) cout << "clipping inserted note from len="<<newevent.endTick()<<" to len="<<(curr_part->lenTick() - newevent.tick())<<endl; newevent.setLenTick(curr_part->lenTick() - newevent.tick()); } @@ -3757,7 +3757,7 @@ void ScoreCanvas::mouseReleaseEvent (QMouseEvent* event) { if (flo_quantize(dragged_event.lenTick(), quant_ticks()) <= 0) { - if (debugMsg) cout << "new length <= 0, erasing item" << endl; + if (MusEGlobal::debugMsg) cout << "new length <= 0, erasing item" << endl; if (undo_started) song->undo(); audio->msgDeleteEvent(dragged_event, dragged_event_part, true, false, false); } @@ -3857,13 +3857,13 @@ void ScoreCanvas::mouseMoveEvent (QMouseEvent* event) { if ((abs(dx)>DRAG_INIT_DISTANCE) && (mouse_x_drag_operation!=NO_OP)) { - if (debugMsg) cout << "mouse-operation is now "<<mouse_x_drag_operation<<endl; + if (MusEGlobal::debugMsg) cout << "mouse-operation is now "<<mouse_x_drag_operation<<endl; mouse_operation=mouse_x_drag_operation; setCursor(Qt::SizeHorCursor); } else if (abs(dy)>DRAG_INIT_DISTANCE) { - if (debugMsg) cout << "mouse-operation is now PITCH" << endl; + if (MusEGlobal::debugMsg) cout << "mouse-operation is now PITCH" << endl; mouse_operation=PITCH; setCursor(Qt::SizeVerCursor); } @@ -3894,7 +3894,7 @@ void ScoreCanvas::mouseMoveEvent (QMouseEvent* event) break; case PITCH: - if (heavyDebugMsg) cout << "trying to change pitch, delta="<<-nearbyint((float)dy/PITCH_DELTA)<<endl; + if (MusEGlobal::heavyDebugMsg) cout << "trying to change pitch, delta="<<-nearbyint((float)dy/PITCH_DELTA)<<endl; new_pitch=original_dragged_event.pitch() - nearbyint((float)dy/PITCH_DELTA); if (new_pitch < 0) new_pitch=0; @@ -3902,7 +3902,7 @@ void ScoreCanvas::mouseMoveEvent (QMouseEvent* event) if (new_pitch != old_pitch) { - if (debugMsg) cout << "changing pitch, delta="<<new_pitch-original_dragged_event.pitch()<<endl; + if (MusEGlobal::debugMsg) cout << "changing pitch, delta="<<new_pitch-original_dragged_event.pitch()<<endl; if (undo_started) song->undo(); undo_started=transpose_notes(part_to_set(dragged_event_part),1, new_pitch-original_dragged_event.pitch()); old_pitch=new_pitch; @@ -3920,7 +3920,7 @@ void ScoreCanvas::mouseMoveEvent (QMouseEvent* event) else { dest_tick=0; - if (debugMsg) cout << "not moving note before begin of part; setting it directly to the begin" << endl; + if (MusEGlobal::debugMsg) cout << "not moving note before begin of part; setting it directly to the begin" << endl; } if (dest_tick != old_dest_tick) @@ -3946,7 +3946,7 @@ void ScoreCanvas::mouseMoveEvent (QMouseEvent* event) else { tmp.setLenTick(0); - if (debugMsg) cout << "not setting len to a negative value. using 0 instead" << endl; + if (MusEGlobal::debugMsg) cout << "not setting len to a negative value. using 0 instead" << endl; } unsigned newpartlen=dragged_event_part->lenTick(); @@ -3955,12 +3955,12 @@ void ScoreCanvas::mouseMoveEvent (QMouseEvent* event) if (dragged_event_part->hasHiddenEvents()) // do not allow autoexpand { tmp.setLenTick(dragged_event_part->lenTick() - tmp.tick()); - if (debugMsg) cout << "resized note would exceed its part; limiting length to " << tmp.lenTick() << endl; + if (MusEGlobal::debugMsg) cout << "resized note would exceed its part; limiting length to " << tmp.lenTick() << endl; } else { newpartlen=tmp.endTick(); - if (debugMsg) cout << "resized note would exceeds its part; expanding the part..." << endl; + if (MusEGlobal::debugMsg) cout << "resized note would exceeds its part; expanding the part..." << endl; } } @@ -4036,7 +4036,7 @@ void ScoreCanvas::heartbeat_timer_event() { int old_xpos=x_pos; - x_scroll_pos+=x_scroll_speed*heartBeatTimer->interval()/1000.0; + x_scroll_pos+=x_scroll_speed*MusEGlobal::heartBeatTimer->interval()/1000.0; int tmp=int(x_scroll_pos); if (tmp!=0) x_pos+=tmp; @@ -4052,7 +4052,7 @@ void ScoreCanvas::heartbeat_timer_event() { int old_ypos=y_pos; - y_scroll_pos+=y_scroll_speed*heartBeatTimer->interval()/1000.0; + y_scroll_pos+=y_scroll_speed*MusEGlobal::heartBeatTimer->interval()/1000.0; int tmp=int(y_scroll_pos); if (tmp!=0) y_pos+=tmp; @@ -4067,14 +4067,14 @@ void ScoreCanvas::heartbeat_timer_event() void ScoreCanvas::x_scroll_event(int x) { - if (debugMsg) cout << "SCROLL EVENT: x="<<x<<endl; + if (MusEGlobal::debugMsg) cout << "SCROLL EVENT: x="<<x<<endl; x_pos=x; redraw(); } void ScoreCanvas::y_scroll_event(int y) { - if (debugMsg) cout << "SCROLL EVENT: y="<<y<<endl; + if (MusEGlobal::debugMsg) cout << "SCROLL EVENT: y="<<y<<endl; y_pos=y; redraw(); } @@ -4217,9 +4217,9 @@ void ScoreCanvas::set_tool(int tool) { switch (tool) { - case PointerTool: mouse_erases_notes=false; mouse_inserts_notes=false; break; - case RubberTool: mouse_erases_notes=true; mouse_inserts_notes=false; break; - case PencilTool: mouse_erases_notes=false; mouse_inserts_notes=true; break; + case MusEWidget::PointerTool: mouse_erases_notes=false; mouse_inserts_notes=false; break; + case MusEWidget::RubberTool: mouse_erases_notes=true; mouse_inserts_notes=false; break; + case MusEWidget::PencilTool: mouse_erases_notes=false; mouse_inserts_notes=true; break; default: cerr << "ERROR: THIS SHOULD NEVER HAPPEN: set_tool called with unknown tool ("<<tool<<")"<<endl; } @@ -4278,7 +4278,7 @@ void ScoreCanvas::set_quant(int val) void ScoreCanvas::set_pixels_per_whole(int val) { - if (debugMsg) cout << "setting px per whole to " << val << endl; + if (MusEGlobal::debugMsg) cout << "setting px per whole to " << val << endl; int tick; int old_xpos=x_pos; @@ -4300,7 +4300,7 @@ void ScoreCanvas::set_pixels_per_whole(int val) if (old_xpos!=0) { x_pos=tick_to_x(tick); - if (debugMsg) cout << "x_pos was not zero, readjusting to " << x_pos << endl; + if (MusEGlobal::debugMsg) cout << "x_pos was not zero, readjusting to " << x_pos << endl; emit xscroll_changed(x_pos); } @@ -4430,7 +4430,7 @@ void ScoreCanvas::midi_note(int pitch, int velo) held_notes[pitch]=false; if ( srec && selected_part && !audio->isPlaying() && velo ) - steprec->record(selected_part,pitch,quant_ticks(),quant_ticks(),velo,globalKeyState&Qt::ControlModifier,globalKeyState&Qt::ShiftModifier); + steprec->record(selected_part,pitch,quant_ticks(),quant_ticks(),velo,MusEGlobal::globalKeyState&Qt::ControlModifier,MusEGlobal::globalKeyState&Qt::ShiftModifier); } diff --git a/muse2/muse/midiedit/scoreedit.h b/muse2/muse/midiedit/scoreedit.h index f839b77a..f340a9b0 100644 --- a/muse2/muse/midiedit/scoreedit.h +++ b/muse2/muse/midiedit/scoreedit.h @@ -67,7 +67,7 @@ using std::string; -#define TICKS_PER_WHOLE (config.division*4) +#define TICKS_PER_WHOLE (MusEConfig::config.division*4) #define SONG_LENGTH (song->len()) @@ -85,7 +85,10 @@ enum {CMD_COLOR_BLACK, CMD_COLOR_VELO, CMD_COLOR_PART, class ScoreCanvas; + +namespace MusEWidget { class EditToolBar; +} //--------------------------------------------------------- // ScoreEdit @@ -106,7 +109,7 @@ class ScoreEdit : public TopWin QGridLayout* mainGrid; QWidget* mainw; - EditToolBar* edit_tools; + MusEWidget::EditToolBar* edit_tools; QSpinBox* velo_spinbox; QSpinBox* velo_off_spinbox; diff --git a/muse2/muse/midifile.cpp b/muse2/muse/midifile.cpp index 31be74bb..3abf34b6 100644 --- a/muse2/muse/midifile.cpp +++ b/muse2/muse/midifile.cpp @@ -535,7 +535,7 @@ bool MidiFile::writeTrack(const MidiFileTrack* t) printf("MidiFile::writeTrack: ntick %d < tick %d\n", ntick, tick); ntick = tick; } - putvl(((ntick - tick) * config.midiDivision + config.division/2)/config.division); + putvl(((ntick - tick) * MusEConfig::config.midiDivision + MusEConfig::config.division/2)/MusEConfig::config.division); tick = ntick; writeEvent(&(*i)); } @@ -567,7 +567,7 @@ void MidiFile::writeEvent(const MidiPlayEvent* event) // we dont save meta data into smf type 0 files: - if (config.smfFormat == 0 && nstat == ME_META) + if (MusEConfig::config.smfFormat == 0 && nstat == ME_META) return; nstat |= c; @@ -617,8 +617,8 @@ bool MidiFile::write() { write("MThd", 4); writeLong(6); // header len - writeShort(config.smfFormat); - if (config.smfFormat == 0) { + writeShort(MusEConfig::config.smfFormat); + if (MusEConfig::config.smfFormat == 0) { writeShort(1); MidiFileTrack dst; for (iMidiFileTrack i = _tracks->begin(); i != _tracks->end(); ++i) { diff --git a/muse2/muse/midiport.cpp b/muse2/muse/midiport.cpp index b00446c2..a2e23cee 100644 --- a/muse2/muse/midiport.cpp +++ b/muse2/muse/midiport.cpp @@ -815,7 +815,7 @@ bool MidiPort::sendEvent(const MidiPlayEvent& ev, bool forceSend) // } // printf("set HW Ctrl State ch:%d 0x%x 0x%x\n", ev.channel(), ev.dataA(), ev.dataB()); if(!setHwCtrlState(ev.channel(), da, db)) { - if (debugMsg && forceSend) + if (MusEGlobal::debugMsg && forceSend) printf("sendEvent: State already set. Forcing anyway...\n"); if (!forceSend) return false; @@ -845,7 +845,7 @@ bool MidiPort::sendEvent(const MidiPlayEvent& ev, bool forceSend) if (!_device) { - if (debugMsg) + if (MusEGlobal::debugMsg) printf("no device for this midi port\n"); return true; } @@ -876,7 +876,7 @@ int MidiPort::hwCtrlState(int ch, int ctrl) const ch &= 0xff; iMidiCtrlValList cl = _controller->find(ch, ctrl); if (cl == _controller->end()) { - //if (debugMsg) + //if (MusEGlobal::debugMsg) // printf("hwCtrlState: chan %d ctrl 0x%x not found\n", ch, ctrl); return CTRL_VAL_UNKNOWN; } @@ -899,7 +899,7 @@ bool MidiPort::setHwCtrlState(int ch, int ctrl, int val) // muse->importController(ch, this, ctrl); // cl = _controller->find(ch, ctrl); // if (cl == _controller->end()) { - // if (debugMsg) + // if (MusEGlobal::debugMsg) // printf("setHwCtrlState(%d,0x%x,0x%x): not found\n", ch, ctrl, val); // return; // } @@ -937,11 +937,11 @@ bool MidiPort::setHwCtrlStates(int ch, int ctrl, int val, int lastval) //bool MidiPort::setCtrl(int ch, int tick, int ctrl, int val) // { -// if (debugMsg) +// if (MusEGlobal::debugMsg) // printf("setCtrl(tick=%d val=%d)\n",tick,val); // iMidiCtrlValList cl = _controller->find(ch, ctrl); // if (cl == _controller->end()) { -// if (debugMsg) +// if (MusEGlobal::debugMsg) // printf("setCtrl: controller 0x%x for channel %d not found\n", ctrl, ch); // return false; // } @@ -978,7 +978,7 @@ int MidiPort::getCtrl(int ch, int tick, int ctrl) const { iMidiCtrlValList cl = _controller->find(ch, ctrl); if (cl == _controller->end()) { - //if (debugMsg) + //if (MusEGlobal::debugMsg) // printf("getCtrl: controller %d(0x%x) for channel %d not found size %zd\n", // ctrl, ctrl, ch, _controller->size()); return CTRL_VAL_UNKNOWN; @@ -990,7 +990,7 @@ int MidiPort::getCtrl(int ch, int tick, int ctrl, Part* part) const { iMidiCtrlValList cl = _controller->find(ch, ctrl); if (cl == _controller->end()) { - //if (debugMsg) + //if (MusEGlobal::debugMsg) // printf("getCtrl: controller %d(0x%x) for channel %d not found size %zd\n", // ctrl, ctrl, ch, _controller->size()); return CTRL_VAL_UNKNOWN; @@ -1005,7 +1005,7 @@ void MidiPort::deleteController(int ch, int tick, int ctrl, Part* part) { iMidiCtrlValList cl = _controller->find(ch, ctrl); if (cl == _controller->end()) { - if (debugMsg) + if (MusEGlobal::debugMsg) printf("deleteController: controller %d(0x%x) for channel %d not found size %zd\n", ctrl, ctrl, ch, _controller->size()); return; diff --git a/muse2/muse/midiseq.cpp b/muse2/muse/midiseq.cpp index 97346edc..c2f3c7bd 100644 --- a/muse2/muse/midiseq.cpp +++ b/muse2/muse/midiseq.cpp @@ -81,9 +81,9 @@ void MidiSeq::processMsg(const ThreadMsg* m) processStop(); break; case MS_SET_RTC: - doSetuid(); + MusEGlobal::doSetuid(); setRtcTicks(); - undoSetuid(); + MusEGlobal::undoSetuid(); break; case MS_UPDATE_POLL_FD: updatePollFd(); @@ -276,9 +276,9 @@ MidiSeq::MidiSeq(const char* name) lastTempo = 0; storedtimediffs = 0; playStateExt = false; // not playing - doSetuid(); + MusEGlobal::doSetuid(); timerFd=selectTimer(); - undoSetuid(); + MusEGlobal::undoSetuid(); } @@ -414,7 +414,7 @@ void MidiSeq::updatePollFd() if (timerFd == -1) { fprintf(stderr, "updatePollFd: no timer fd\n"); - if (!debugMode) + if (!MusEGlobal::debugMode) exit(-1); } @@ -472,11 +472,11 @@ void MidiSeq::threadStop() bool MidiSeq::setRtcTicks() { - //timer.setTimerFreq(config.rtcTicks); + //timer.setTimerFreq(MusEConfig::config.rtcTicks); //timer.startTimer(); - timer->setTimerFreq(config.rtcTicks); + timer->setTimerFreq(MusEConfig::config.rtcTicks); timer->startTimer(); - realRtcTicks = config.rtcTicks; + realRtcTicks = MusEConfig::config.rtcTicks; return true; } @@ -494,12 +494,12 @@ void MidiSeq::start(int priority) //timerFd = -1; - doSetuid(); + MusEGlobal::doSetuid(); //timerFd = selectTimer(); //timerFd = timer.initTimer(); //printf("timerFd=%d\n",timerFd); setRtcTicks(); - undoSetuid(); + MusEGlobal::undoSetuid(); //Thread::start(); Thread::start(priority); //return false; @@ -526,7 +526,7 @@ void MidiSeq::processMidiClock() midiClick = sigmap.bar2tick(bar, beat+1, 0); double cpos = tempomap.tick2time(playTickPos); - samplePosStart = samplePos - lrint(cpos * sampleRate); + samplePosStart = samplePos - lrint(cpos * MusEGlobal::sampleRate); rtcTickStart = rtcTick - lrint(cpos * realRtcTicks); endSlice = playTickPos; @@ -538,7 +538,7 @@ void MidiSeq::processMidiClock() startRecordPos.setPosTick(playTickPos); } */ -// midiClock += config.division/24; +// midiClock += MusEConfig::config.division/24; } //--------------------------------------------------------- @@ -608,10 +608,10 @@ void MidiSeq::processTimerTick() if (!extSyncFlag.value()) { //int curTick = tempomap.frame2tick(curFrame); // Copied from Tempomap. - //int curTick = lrint((double(curFrame)/double(sampleRate)) * tempomap.globalTempo() * config.division * 10000.0 / double(tempomap.tempo(song->cpos()))); - //int curTick = lrint((double(curFrame)/double(sampleRate)) * tempomap.globalTempo() * 240000.0 / double(tempomap.tempo(song->cpos()))); - int curTick = lrint((double(curFrame)/double(sampleRate)) * double(tempomap.globalTempo()) * double(config.division) * 10000.0 / double(tempomap.tempo(song->cpos()))); - //int curTick = int((double(curFrame)/double(sampleRate)) * double(tempomap.globalTempo()) * double(config.division * 10000.0) / double(tempomap.tempo(song->cpos()))); + //int curTick = lrint((double(curFrame)/double(MusEGlobal::sampleRate)) * tempomap.globalTempo() * MusEConfig::config.division * 10000.0 / double(tempomap.tempo(song->cpos()))); + //int curTick = lrint((double(curFrame)/double(MusEGlobal::sampleRate)) * tempomap.globalTempo() * 240000.0 / double(tempomap.tempo(song->cpos()))); + int curTick = lrint((double(curFrame)/double(MusEGlobal::sampleRate)) * double(tempomap.globalTempo()) * double(MusEConfig::config.division) * 10000.0 / double(tempomap.tempo(song->cpos()))); + //int curTick = int((double(curFrame)/double(MusEGlobal::sampleRate)) * double(tempomap.globalTempo()) * double(MusEConfig::config.division * 10000.0) / double(tempomap.tempo(song->cpos()))); /* if ( midiClock > curTick + 100) // reinitialize { @@ -625,7 +625,7 @@ void MidiSeq::processTimerTick() if(midiClock > curTick) midiClock = curTick; - int div = config.division/24; + int div = MusEConfig::config.division/24; if(curTick >= midiClock + div) { //if(curTick >= midiClock) { //processMidiClock(); @@ -689,7 +689,7 @@ void MidiSeq::processTimerTick() } */ - if(debugMsg && used && perr > 1) + if(MusEGlobal::debugMsg && used && perr > 1) printf("Dropped %d midi out clock(s). curTick:%d midiClock:%d div:%d\n", perr, curTick, midiClock, div); //} diff --git a/muse2/muse/miditransform.cpp b/muse2/muse/miditransform.cpp index 259f0abf..76a39306 100644 --- a/muse2/muse/miditransform.cpp +++ b/muse2/muse/miditransform.cpp @@ -128,7 +128,7 @@ class MidiTransformation { procPos = Keep; procPosA = 0; funcOp = Select; - quantVal = config.division; + quantVal = MusEConfig::config.division; selectedTracks = false; insideLoop = false; } diff --git a/muse2/muse/mixer/amixer.cpp b/muse2/muse/mixer/amixer.cpp index 5b03f854..0aa246a2 100644 --- a/muse2/muse/mixer/amixer.cpp +++ b/muse2/muse/mixer/amixer.cpp @@ -45,7 +45,9 @@ #include "gconfig.h" #include "xml.h" +namespace MusEApp { extern QActionGroup* populateAddTrack(QMenu* addTrack); +} #define __WIDTH_COMPENSATION 4 @@ -158,7 +160,7 @@ bool ScrollArea::viewportEvent(QEvent* event) // inputs | synthis | tracks | groups | master //--------------------------------------------------------- -AudioMixerApp::AudioMixerApp(QWidget* parent, MixerConfig* c) +AudioMixerApp::AudioMixerApp(QWidget* parent, MusEConfig::MixerConfig* c) : QMainWindow(parent) { cfg = c; @@ -169,7 +171,7 @@ AudioMixerApp::AudioMixerApp(QWidget* parent, MixerConfig* c) setWindowIcon(*museIcon); QMenu* menuConfig = menuBar()->addMenu(tr("&Create")); - populateAddTrack(menuConfig); + MusEApp::populateAddTrack(menuConfig); QMenu* menuView = menuBar()->addMenu(tr("&View")); routingId = menuView->addAction(tr("Routing"), this, SLOT(toggleRouteDialog())); @@ -234,7 +236,7 @@ AudioMixerApp::AudioMixerApp(QWidget* parent, MixerConfig* c) ///connect(this, SIGNAL(layoutRequest()), SLOT(setSizing())); connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); - connect(muse, SIGNAL(configChanged()), SLOT(configChanged())); + connect(MusEGlobal::muse, SIGNAL(configChanged()), SLOT(configChanged())); song->update(); // calls update mixer } diff --git a/muse2/muse/mixer/amixer.h b/muse2/muse/mixer/amixer.h index 28066ba3..1726ba7b 100644 --- a/muse2/muse/mixer/amixer.h +++ b/muse2/muse/mixer/amixer.h @@ -48,7 +48,9 @@ class ComboBox; class RouteDialog; class Strip; +namespace MusEConfig { struct MixerConfig; +} #define EFX_HEIGHT 16 @@ -80,7 +82,7 @@ class AudioMixerApp : public QMainWindow { Q_OBJECT //QString name; - MixerConfig* cfg; + MusEConfig::MixerConfig* cfg; StripList stripList; QScrollArea* view; QWidget* central; @@ -138,7 +140,7 @@ class AudioMixerApp : public QMainWindow { public: //AudioMixerApp(QWidget* parent); - AudioMixerApp(QWidget* parent, MixerConfig* c); + AudioMixerApp(QWidget* parent, MusEConfig::MixerConfig* c); //void write(Xml&, const char* name); //void write(int level, Xml& xml, const char* name); void write(int level, Xml& xml); diff --git a/muse2/muse/mixer/astrip.cpp b/muse2/muse/mixer/astrip.cpp index 34ee77d7..11927e25 100644 --- a/muse2/muse/mixer/astrip.cpp +++ b/muse2/muse/mixer/astrip.cpp @@ -132,7 +132,7 @@ void AudioStrip::songChanged(int val) AudioTrack* src = (AudioTrack*)track; - // Do channels before config... + // Do channels before MusEConfig::config... if (val & SC_CHANNELS) updateChannels(); @@ -142,12 +142,12 @@ void AudioStrip::songChanged(int val) // Added by Tim. p3.3.9 // Set the strip label's font. - //label->setFont(config.fonts[1]); + //label->setFont(MusEConfig::config.fonts[1]); setLabelFont(); // Adjust minimum volume slider and label values. - slider->setRange(config.minSlider-0.1, 10.0); - sl->setRange(config.minSlider, 10.0); + slider->setRange(MusEConfig::config.minSlider-0.1, 10.0); + sl->setRange(MusEConfig::config.minSlider, 10.0); // Adjust minimum aux knob and label values. int n = auxKnob.size(); @@ -155,15 +155,15 @@ void AudioStrip::songChanged(int val) { auxKnob[idx]->blockSignals(true); auxLabel[idx]->blockSignals(true); - auxKnob[idx]->setRange(config.minSlider-0.1, 10.0); - auxLabel[idx]->setRange(config.minSlider, 10.1); + auxKnob[idx]->setRange(MusEConfig::config.minSlider-0.1, 10.0); + auxLabel[idx]->setRange(MusEConfig::config.minSlider, 10.1); auxKnob[idx]->blockSignals(false); auxLabel[idx]->blockSignals(false); } // Adjust minimum meter values. for(int c = 0; c < channel; ++c) - meter[c]->setRange(config.minMeter, 10.0); + meter[c]->setRange(MusEConfig::config.minMeter, 10.0); } if (mute && (val & SC_MUTE)) { // mute && off @@ -388,7 +388,7 @@ void AudioStrip::stereoToggled(bool val) void AudioStrip::auxChanged(double val, int idx) { double vol; - if (val <= config.minSlider) { + if (val <= MusEConfig::config.minSlider) { vol = 0.0; val -= 1.0; // display special value "off" } @@ -420,7 +420,7 @@ void AudioStrip::volumeChanged(double val) track->enableVolumeController(false); double vol; - if (val <= config.minSlider) { + if (val <= MusEConfig::config.minSlider) { vol = 0.0; val -= 1.0; // display special value "off" } @@ -450,7 +450,7 @@ void AudioStrip::volumePressed() double val = slider->value(); double vol; - if (val <= config.minSlider) { + if (val <= MusEConfig::config.minSlider) { vol = 0.0; //val -= 1.0; // display special value "off" } @@ -496,7 +496,7 @@ void AudioStrip::volLabelChanged(double val) track->enableVolumeController(false); double vol; - if (val <= config.minSlider) { + if (val <= MusEConfig::config.minSlider) { vol = 0.0; val -= 1.0; // display special value "off" } @@ -602,8 +602,8 @@ void AudioStrip::updateChannels() if (c > channel) { for (int cc = channel; cc < c; ++cc) { meter[cc] = new Meter(this); - //meter[cc]->setRange(config.minSlider, 10.0); - meter[cc]->setRange(config.minMeter, 10.0); + //meter[cc]->setRange(MusEConfig::config.minSlider, 10.0); + meter[cc]->setRange(MusEConfig::config.minMeter, 10.0); meter[cc]->setFixedWidth(15); connect(meter[cc], SIGNAL(mousePress()), this, SLOT(resetPeaks())); sliderGrid->addWidget(meter[cc], 0, cc+1, Qt::AlignLeft); @@ -636,7 +636,7 @@ Knob* AudioStrip::addKnob(int type, int id, DoubleLabel** dlabel) if (type == 0) knob->setRange(-1.0, +1.0); else - knob->setRange(config.minSlider-0.1, 10.0); + knob->setRange(MusEConfig::config.minSlider-0.1, 10.0); knob->setBackgroundRole(QPalette::Mid); if (type == 0) @@ -648,12 +648,12 @@ Knob* AudioStrip::addKnob(int type, int id, DoubleLabel** dlabel) if (type == 0) pl = new DoubleLabel(0, -1.0, +1.0, this); else - pl = new DoubleLabel(0.0, config.minSlider, 10.1, this); + pl = new DoubleLabel(0.0, MusEConfig::config.minSlider, 10.1, this); if (dlabel) *dlabel = pl; pl->setSlider(knob); - pl->setFont(config.fonts[1]); + pl->setFont(MusEConfig::config.fonts[1]); pl->setBackgroundRole(QPalette::Mid); pl->setFrame(true); if (type == 0) @@ -670,7 +670,7 @@ Knob* AudioStrip::addKnob(int type, int id, DoubleLabel** dlabel) label.sprintf("Aux%d", id+1); QLabel* plb = new QLabel(label, this); - plb->setFont(config.fonts[1]); + plb->setFont(MusEConfig::config.fonts[1]); plb->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); plb->setAlignment(Qt::AlignCenter); @@ -750,7 +750,7 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at) //--------------------------------------------------- stereo = new QToolButton(); - stereo->setFont(config.fonts[1]); + stereo->setFont(MusEConfig::config.fonts[1]); QIcon stereoSet; stereoSet.addPixmap(*monoIcon, QIcon::Normal, QIcon::Off); stereoSet.addPixmap(*stereoIcon, QIcon::Normal, QIcon::On); @@ -768,7 +768,7 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at) stereo->setEnabled(false); pre = new QToolButton(); - pre->setFont(config.fonts[1]); + pre->setFont(MusEConfig::config.fonts[1]); pre->setCheckable(true); pre->setText(tr("Pre")); pre->setToolTip(tr("pre fader - post fader")); @@ -813,16 +813,16 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at) slider = new Slider(this, "vol", Qt::Vertical, Slider::None); slider->setCursorHoming(true); - slider->setRange(config.minSlider-0.1, 10.0); + slider->setRange(MusEConfig::config.minSlider-0.1, 10.0); slider->setFixedWidth(20); - slider->setFont(config.fonts[1]); + slider->setFont(MusEConfig::config.fonts[1]); slider->setValue(fast_log10(t->volume())*20.0); sliderGrid->addWidget(slider, 0, 0, Qt::AlignHCenter); for (int i = 0; i < channel; ++i) { - //meter[i]->setRange(config.minSlider, 10.0); - meter[i]->setRange(config.minMeter, 10.0); + //meter[i]->setRange(MusEConfig::config.minSlider, 10.0); + meter[i]->setRange(MusEConfig::config.minMeter, 10.0); meter[i]->setFixedWidth(15); connect(meter[i], SIGNAL(mousePress()), this, SLOT(resetPeaks())); sliderGrid->addWidget(meter[i], 0, i+1, Qt::AlignHCenter); @@ -831,9 +831,9 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at) sliderGrid->addItem(new QSpacerItem(2,0),0,3); grid->addLayout(sliderGrid, _curGridRow++, 0, 1, 2); - sl = new DoubleLabel(0.0, config.minSlider, 10.0, this); + sl = new DoubleLabel(0.0, MusEConfig::config.minSlider, 10.0, this); sl->setSlider(slider); - sl->setFont(config.fonts[1]); + sl->setFont(MusEConfig::config.fonts[1]); sl->setBackgroundRole(QPalette::Mid); sl->setSuffix(tr("dB")); sl->setFrame(true); @@ -945,7 +945,7 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at) if (type != Track::AUDIO_AUX) { iR = new QToolButton(); - iR->setFont(config.fonts[1]); + iR->setFont(MusEConfig::config.fonts[1]); iR->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); iR->setText(tr("iR")); iR->setCheckable(false); @@ -955,7 +955,7 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at) } oR = new QToolButton(); - oR->setFont(config.fonts[1]); + oR->setFont(MusEConfig::config.fonts[1]); oR->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); oR->setText(tr("oR")); oR->setCheckable(false); @@ -968,7 +968,7 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at) //--------------------------------------------------- autoType = new ComboBox(); - autoType->setFont(config.fonts[1]); + autoType->setFont(MusEConfig::config.fonts[1]); autoType->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); autoType->addAction(tr("Off"), AUTO_OFF); @@ -1016,7 +1016,7 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at) updateOffState(); // init state off->blockSignals(false); } - connect(heartBeatTimer, SIGNAL(timeout()), SLOT(heartBeat())); + connect(MusEGlobal::heartBeatTimer, SIGNAL(timeout()), SLOT(heartBeat())); } //--------------------------------------------------------- @@ -1025,7 +1025,7 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at) void AudioStrip::iRoutePressed() { - RoutePopupMenu* pup = muse->getRoutingPopupMenu(); + RoutePopupMenu* pup = MusEGlobal::muse->getRoutingPopupMenu(); iR->setDown(false); pup->exec(QCursor::pos(), track, false); } @@ -1036,7 +1036,7 @@ void AudioStrip::iRoutePressed() void AudioStrip::oRoutePressed() { - RoutePopupMenu* pup = muse->getRoutingPopupMenu(); + RoutePopupMenu* pup = MusEGlobal::muse->getRoutingPopupMenu(); oR->setDown(false); pup->exec(QCursor::pos(), track, true); } diff --git a/muse2/muse/mixer/auxknob.cpp b/muse2/muse/mixer/auxknob.cpp index 1c358b17..d770fe7b 100644 --- a/muse2/muse/mixer/auxknob.cpp +++ b/muse2/muse/mixer/auxknob.cpp @@ -33,7 +33,7 @@ AuxKnob::AuxKnob(QWidget* parent, int i) : Knob(parent, "aux") { idx = i; - setRange(config.minSlider-0.1, 10.0); + setRange(MusEConfig::config.minSlider-0.1, 10.0); connect(this, SIGNAL(valueChanged(double,int)), SLOT(valueChanged(double))); } @@ -44,7 +44,7 @@ AuxKnob::AuxKnob(QWidget* parent, int i) void AuxKnob::valueChanged(double val) { double vol; - if (val <= config.minSlider) { + if (val <= MusEConfig::config.minSlider) { vol = 0.0; val -= 1.0; // display special value "off" } diff --git a/muse2/muse/mixer/mstrip.cpp b/muse2/muse/mixer/mstrip.cpp index e3064208..17d21b21 100644 --- a/muse2/muse/mixer/mstrip.cpp +++ b/muse2/muse/mixer/mstrip.cpp @@ -107,7 +107,7 @@ void MidiStrip::addKnob(int idx, const QString& tt, const QString& label, dl->setSpecialText(tr("off")); dl->setToolTip(tr("double click on/off")); controller[idx].dl = dl; - dl->setFont(config.fonts[1]); + dl->setFont(MusEConfig::config.fonts[1]); dl->setBackgroundRole(QPalette::Mid); dl->setFrame(true); dl->setPrecision(0); @@ -150,7 +150,7 @@ void MidiStrip::addKnob(int idx, const QString& tt, const QString& label, QLabel* lb = new QLabel(label, this); controller[idx].lb = lb; - lb->setFont(config.fonts[1]); + lb->setFont(MusEConfig::config.fonts[1]); lb->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); lb->setAlignment(Qt::AlignCenter); lb->setEnabled(enabled); @@ -208,7 +208,7 @@ MidiStrip::MidiStrip(QWidget* parent, MidiTrack* t) slider->setCursorHoming(true); slider->setRange(double(mn), double(mx), 1.0); slider->setFixedWidth(20); - slider->setFont(config.fonts[1]); + slider->setFont(MusEConfig::config.fonts[1]); slider->setId(CTRL_VOLUME); meter[0] = new Meter(this, Meter::LinMeter); @@ -223,7 +223,7 @@ MidiStrip::MidiStrip(QWidget* parent, MidiTrack* t) grid->addLayout(sliderGrid, _curGridRow++, 0, 1, 2); sl = new DoubleLabel(0.0, -98.0, 0.0, this); - sl->setFont(config.fonts[1]); + sl->setFont(MusEConfig::config.fonts[1]); sl->setBackgroundRole(QPalette::Mid); sl->setSpecialText(tr("off")); sl->setSuffix(tr("dB")); @@ -367,10 +367,10 @@ MidiStrip::MidiStrip(QWidget* parent, MidiTrack* t) dcs.sprintf("%d-%d", port + 1, channel + 1); dev_ch_label->setText(dcs); //dev_ch_label->setBackgroundColor(QColor(0, 160, 255)); // Med blue - //dev_ch_label->setFont(config.fonts[6]); - dev_ch_label->setFont(config.fonts[1]); + //dev_ch_label->setFont(MusEConfig::config.fonts[6]); + dev_ch_label->setFont(MusEConfig::config.fonts[1]); // Dealing with a horizontally constrained label. Ignore vertical. Use a minimum readable point size. - //autoAdjustFontSize(dev_ch_label, dev_ch_label->text(), false, true, config.fonts[6].pointSize(), 5); + //autoAdjustFontSize(dev_ch_label, dev_ch_label->text(), false, true, MusEConfig::config.fonts[6].pointSize(), 5); QToolTip::add(dev_ch_label, tr("output port and channel")); */ @@ -397,7 +397,7 @@ MidiStrip::MidiStrip(QWidget* parent, MidiTrack* t) //--------------------------------------------------- iR = new QToolButton(); - iR->setFont(config.fonts[1]); + iR->setFont(MusEConfig::config.fonts[1]); iR->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); iR->setText(tr("iR")); iR->setCheckable(false); @@ -405,7 +405,7 @@ MidiStrip::MidiStrip(QWidget* parent, MidiTrack* t) grid->addWidget(iR, _curGridRow, 0); connect(iR, SIGNAL(pressed()), SLOT(iRoutePressed())); oR = new QToolButton(); - oR->setFont(config.fonts[1]); + oR->setFont(MusEConfig::config.fonts[1]); oR->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); oR->setText(tr("oR")); oR->setCheckable(false); @@ -421,7 +421,7 @@ MidiStrip::MidiStrip(QWidget* parent, MidiTrack* t) //--------------------------------------------------- autoType = new ComboBox(); - autoType->setFont(config.fonts[1]); + autoType->setFont(MusEConfig::config.fonts[1]); autoType->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); autoType->setEnabled(false); @@ -436,7 +436,7 @@ MidiStrip::MidiStrip(QWidget* parent, MidiTrack* t) //connect(autoType, SIGNAL(activated(int)), SLOT(setAutomationType(int))); grid->addWidget(autoType, _curGridRow++, 0, 1, 2); - connect(heartBeatTimer, SIGNAL(timeout()), SLOT(heartBeat())); + connect(MusEGlobal::heartBeatTimer, SIGNAL(timeout()), SLOT(heartBeat())); inHeartBeat = false; } @@ -520,7 +520,7 @@ void MidiStrip::songChanged(int val) if (val & SC_CONFIG) { // Set the strip label's font. - //label->setFont(config.fonts[1]); + //label->setFont(MusEConfig::config.fonts[1]); setLabelFont(); } } @@ -1012,7 +1012,7 @@ void MidiStrip::setReverbSend(double val) void MidiStrip::iRoutePressed() { - RoutePopupMenu* pup = muse->getRoutingPopupMenu(); + RoutePopupMenu* pup = MusEGlobal::muse->getRoutingPopupMenu(); iR->setDown(false); pup->exec(QCursor::pos(), track, false); } @@ -1023,7 +1023,7 @@ void MidiStrip::iRoutePressed() void MidiStrip::oRoutePressed() { - RoutePopupMenu* pup = muse->getRoutingPopupMenu(); + RoutePopupMenu* pup = MusEGlobal::muse->getRoutingPopupMenu(); oR->setDown(false); pup->exec(QCursor::pos(), track, true); } diff --git a/muse2/muse/mixer/rack.cpp b/muse2/muse/mixer/rack.cpp index d32921d9..86c3ff77 100644 --- a/muse2/muse/mixer/rack.cpp +++ b/muse2/muse/mixer/rack.cpp @@ -159,7 +159,7 @@ EffectRack::EffectRack(QWidget* parent, AudioTrack* t) setAttribute(Qt::WA_DeleteOnClose); track = t; itemheight = 19; - setFont(config.fonts[1]); + setFont(MusEConfig::config.fonts[1]); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); @@ -415,7 +415,7 @@ void EffectRack::doubleClicked(QListWidgetItem* it) void EffectRack::savePreset(int idx) { //QString name = getSaveFileName(QString(""), plug_file_pattern, this, - QString name = getSaveFileName(QString(""), preset_file_save_pattern, this, + QString name = getSaveFileName(QString(""), MusEGlobal::preset_file_save_pattern, this, tr("MusE: Save Preset")); if(name.isEmpty()) @@ -471,9 +471,9 @@ void EffectRack::startDrag(int idx) return; } FILE *tmp; - if (debugMsg) { + if (MusEGlobal::debugMsg) { QString fileName; - getUniqueTmpfileName("tmp","preset", fileName); + MusEGlobal::getUniqueTmpfileName("tmp","preset", fileName); tmp = fopen(fileName.toLatin1().data(), "w+"); } else diff --git a/muse2/muse/mixer/routedialog.cpp b/muse2/muse/mixer/routedialog.cpp index 2a37c310..53b8d48b 100644 --- a/muse2/muse/mixer/routedialog.cpp +++ b/muse2/muse/mixer/routedialog.cpp @@ -101,7 +101,7 @@ void RouteDialog::routingChanged() new QTreeWidgetItem(routeList, QStringList() << src << r->name()); } } - if (!checkAudioDevice()) return; + if (!MusEGlobal::checkAudioDevice()) return; std::list<QString> sl = audioDevice->outputPorts(); for (std::list<QString>::iterator i = sl.begin(); i != sl.end(); ++i) newSrcList->addItem(*i); diff --git a/muse2/muse/mixer/strip.cpp b/muse2/muse/mixer/strip.cpp index ba28c040..8f899c13 100644 --- a/muse2/muse/mixer/strip.cpp +++ b/muse2/muse/mixer/strip.cpp @@ -69,7 +69,7 @@ void Strip::recordToggled(bool val) { if (track->type() == Track::AUDIO_OUTPUT) { if (val && track->recordFlag() == false) { - muse->bounceToFile((AudioOutput*)track); + MusEGlobal::muse->bounceToFile((AudioOutput*)track); } audio->msgSetRecord((AudioOutput*)track, val); if (!((AudioOutput*)track)->recFile()) @@ -95,9 +95,9 @@ void Strip::setLabelFont() { // Use the new font #6 I created just for these labels (so far). // Set the label's font. - label->setFont(config.fonts[6]); + label->setFont(MusEConfig::config.fonts[6]); // Dealing with a horizontally constrained label. Ignore vertical. Use a minimum readable point size. - autoAdjustFontSize(label, label->text(), false, true, config.fonts[6].pointSize(), 5); + autoAdjustFontSize(label, label->text(), false, true, MusEConfig::config.fonts[6].pointSize(), 5); } //--------------------------------------------------------- @@ -110,35 +110,35 @@ void Strip::setLabelText() switch(track->type()) { case Track::AUDIO_OUTPUT: //c = Qt::green; - c = config.outputTrackLabelBg; + c = MusEConfig::config.outputTrackLabelBg; break; case Track::AUDIO_GROUP: //c = Qt::yellow; - c = config.groupTrackLabelBg; + c = MusEConfig::config.groupTrackLabelBg; break; case Track::AUDIO_AUX: //c = QColor(120, 255, 255); // Light blue - c = config.auxTrackLabelBg; + c = MusEConfig::config.auxTrackLabelBg; break; case Track::WAVE: //c = Qt::magenta; - c = config.waveTrackLabelBg; + c = MusEConfig::config.waveTrackLabelBg; break; case Track::AUDIO_INPUT: //c = Qt::red; - c = config.inputTrackLabelBg; + c = MusEConfig::config.inputTrackLabelBg; break; case Track::AUDIO_SOFTSYNTH: //c = QColor(255, 130, 0); // Med orange - c = config.synthTrackLabelBg; + c = MusEConfig::config.synthTrackLabelBg; break; case Track::MIDI: //c = QColor(0, 160, 255); // Med blue - c = config.midiTrackLabelBg; + c = MusEConfig::config.midiTrackLabelBg; break; case Track::DRUM: //c = QColor(0, 160, 255); // Med blue - c = config.drumTrackLabelBg; + c = MusEConfig::config.drumTrackLabelBg; break; default: return; @@ -222,7 +222,7 @@ Strip::Strip(QWidget* parent, Track* t) // Moved by Tim. p3.3.9 //setLabelText(); - //label->setFont(config.fonts[1]); + //label->setFont(MusEConfig::config.fonts[1]); //printf("Strip::Strip w:%d frw:%d layoutmarg:%d lx:%d ly:%d lw:%d lh:%d\n", STRIP_WIDTH, frameWidth(), layout->margin(), label->x(), label->y(), label->width(), label->height()); diff --git a/muse2/muse/mplugins/midifilterimpl.cpp b/muse2/muse/mplugins/midifilterimpl.cpp index 89a3aba6..50dcd601 100644 --- a/muse2/muse/mplugins/midifilterimpl.cpp +++ b/muse2/muse/mplugins/midifilterimpl.cpp @@ -33,19 +33,19 @@ void MidiFilterConfig::setCtrl1(int n) { - midiFilterCtrl1 = n-1; + MusEGlobal::midiFilterCtrl1 = n-1; } void MidiFilterConfig::setCtrl2(int n) { - midiFilterCtrl2 = n-1; + MusEGlobal::midiFilterCtrl2 = n-1; } void MidiFilterConfig::setCtrl3(int n) { - midiFilterCtrl3 = n-1; + MusEGlobal::midiFilterCtrl3 = n-1; } void MidiFilterConfig::setCtrl4(int n) { - midiFilterCtrl4 = n-1; + MusEGlobal::midiFilterCtrl4 = n-1; } @@ -57,18 +57,18 @@ MidiFilterConfig::MidiFilterConfig(QDialog* parent) : QDialog(parent) { setupUi(this); - cb1->setCurrentIndex(midiFilterCtrl1); - cb2->setCurrentIndex(midiFilterCtrl2); - cb3->setCurrentIndex(midiFilterCtrl3); - cb4->setCurrentIndex(midiFilterCtrl4); - - rf1->setChecked(midiRecordType & 1); - rf2->setChecked(midiRecordType & 2); - rf3->setChecked(midiRecordType & 4); - rf4->setChecked(midiRecordType & 8); - rf5->setChecked(midiRecordType & 16); - rf6->setChecked(midiRecordType & 32); - rf7->setChecked(midiRecordType & 64); + cb1->setCurrentIndex(MusEGlobal::midiFilterCtrl1); + cb2->setCurrentIndex(MusEGlobal::midiFilterCtrl2); + cb3->setCurrentIndex(MusEGlobal::midiFilterCtrl3); + cb4->setCurrentIndex(MusEGlobal::midiFilterCtrl4); + + rf1->setChecked(MusEGlobal::midiRecordType & 1); + rf2->setChecked(MusEGlobal::midiRecordType & 2); + rf3->setChecked(MusEGlobal::midiRecordType & 4); + rf4->setChecked(MusEGlobal::midiRecordType & 8); + rf5->setChecked(MusEGlobal::midiRecordType & 16); + rf6->setChecked(MusEGlobal::midiRecordType & 32); + rf7->setChecked(MusEGlobal::midiRecordType & 64); connect(rf1, SIGNAL(toggled(bool)), SLOT(recordChanged1(bool))); connect(rf2, SIGNAL(toggled(bool)), SLOT(recordChanged2(bool))); connect(rf3, SIGNAL(toggled(bool)), SLOT(recordChanged3(bool))); @@ -77,13 +77,13 @@ MidiFilterConfig::MidiFilterConfig(QDialog* parent) connect(rf6, SIGNAL(toggled(bool)), SLOT(recordChanged6(bool))); connect(rf7, SIGNAL(toggled(bool)), SLOT(recordChanged7(bool))); - tf1->setChecked(midiThruType & 1); - tf2->setChecked(midiThruType & 2); - tf3->setChecked(midiThruType & 4); - tf4->setChecked(midiThruType & 8); - tf5->setChecked(midiThruType & 16); - tf6->setChecked(midiThruType & 32); - tf7->setChecked(midiThruType & 64); + tf1->setChecked(MusEGlobal::midiThruType & 1); + tf2->setChecked(MusEGlobal::midiThruType & 2); + tf3->setChecked(MusEGlobal::midiThruType & 4); + tf4->setChecked(MusEGlobal::midiThruType & 8); + tf5->setChecked(MusEGlobal::midiThruType & 16); + tf6->setChecked(MusEGlobal::midiThruType & 32); + tf7->setChecked(MusEGlobal::midiThruType & 64); connect(tf1, SIGNAL(toggled(bool)), SLOT(thruChanged1(bool))); connect(tf2, SIGNAL(toggled(bool)), SLOT(thruChanged2(bool))); connect(tf3, SIGNAL(toggled(bool)), SLOT(thruChanged3(bool))); @@ -92,22 +92,22 @@ MidiFilterConfig::MidiFilterConfig(QDialog* parent) connect(tf6, SIGNAL(toggled(bool)), SLOT(thruChanged6(bool))); connect(tf7, SIGNAL(toggled(bool)), SLOT(thruChanged7(bool))); - cf1->setChecked(midiInputChannel & 1); - cf2->setChecked(midiInputChannel & 2); - cf3->setChecked(midiInputChannel & 4); - cf4->setChecked(midiInputChannel & 8); - cf5->setChecked(midiInputChannel & 0x10); - cf6->setChecked(midiInputChannel & 0x20); - cf7->setChecked(midiInputChannel & 0x40); - cf8->setChecked(midiInputChannel & 0x80); - cf9->setChecked(midiInputChannel & 0x100); - cf10->setChecked(midiInputChannel & 0x200); - cf11->setChecked(midiInputChannel & 0x400); - cf12->setChecked(midiInputChannel & 0x800); - cf13->setChecked(midiInputChannel & 0x1000); - cf14->setChecked(midiInputChannel & 0x2000); - cf15->setChecked(midiInputChannel & 0x4000); - cf16->setChecked(midiInputChannel & 0x8000); + cf1->setChecked(MusEGlobal::midiInputChannel & 1); + cf2->setChecked(MusEGlobal::midiInputChannel & 2); + cf3->setChecked(MusEGlobal::midiInputChannel & 4); + cf4->setChecked(MusEGlobal::midiInputChannel & 8); + cf5->setChecked(MusEGlobal::midiInputChannel & 0x10); + cf6->setChecked(MusEGlobal::midiInputChannel & 0x20); + cf7->setChecked(MusEGlobal::midiInputChannel & 0x40); + cf8->setChecked(MusEGlobal::midiInputChannel & 0x80); + cf9->setChecked(MusEGlobal::midiInputChannel & 0x100); + cf10->setChecked(MusEGlobal::midiInputChannel & 0x200); + cf11->setChecked(MusEGlobal::midiInputChannel & 0x400); + cf12->setChecked(MusEGlobal::midiInputChannel & 0x800); + cf13->setChecked(MusEGlobal::midiInputChannel & 0x1000); + cf14->setChecked(MusEGlobal::midiInputChannel & 0x2000); + cf15->setChecked(MusEGlobal::midiInputChannel & 0x4000); + cf16->setChecked(MusEGlobal::midiInputChannel & 0x8000); connect(cb1, SIGNAL(activated(int)), SLOT(setCtrl1(int))); connect(cb2, SIGNAL(activated(int)), SLOT(setCtrl2(int))); diff --git a/muse2/muse/mplugins/midifilterimpl.h b/muse2/muse/mplugins/midifilterimpl.h index 95f62d5c..de276f44 100644 --- a/muse2/muse/mplugins/midifilterimpl.h +++ b/muse2/muse/mplugins/midifilterimpl.h @@ -38,21 +38,21 @@ class MidiFilterConfig : public QDialog, public Ui::MidiFilterConfigBase { void rChanged(bool f, int val) { if (f) - midiRecordType |= val; + MusEGlobal::midiRecordType |= val; else - midiRecordType &= ~val; + MusEGlobal::midiRecordType &= ~val; } void tChanged(bool f, int val) { if (f) - midiThruType |= val; + MusEGlobal::midiThruType |= val; else - midiThruType &= ~val; + MusEGlobal::midiThruType &= ~val; } void chChanged(bool f, int val) { if (f) - midiInputChannel |= val; + MusEGlobal::midiInputChannel |= val; else - midiInputChannel &= ~val; + MusEGlobal::midiInputChannel &= ~val; } virtual void closeEvent(QCloseEvent*); diff --git a/muse2/muse/mplugins/midiitransform.cpp b/muse2/muse/mplugins/midiitransform.cpp index 4dd10b8c..8cc881ff 100644 --- a/muse2/muse/mplugins/midiitransform.cpp +++ b/muse2/muse/mplugins/midiitransform.cpp @@ -130,7 +130,7 @@ class MidiInputTransformation { procVal2a = 0; procVal2b = 0; funcOp = Transform; - quantVal = config.division; + quantVal = MusEConfig::config.division; selPort = Ignore; selChannel = Ignore; selChannela = 0; @@ -177,7 +177,7 @@ bool applyMidiInputTransformation(MidiRecordEvent& event) int rv = modules[i].transform->apply(event); if (rv == 1) { - if(debugMsg) + if(MusEGlobal::debugMsg) printf("drop input event\n"); } if (rv) @@ -1630,7 +1630,7 @@ void MidiInputTransformDialog::presetChanged(QListWidgetItem* item) iMidiInputTransformation i; for (i = mtlist.begin(); i != mtlist.end(); ++i) { if (item->text() == (*i)->name) { - if(debugMsg) + if(MusEGlobal::debugMsg) printf("found %s\n", (*i)->name.toLatin1().constData()); cmt = *i; if (cmodul != -1) { diff --git a/muse2/muse/mplugins/mitplugin.cpp b/muse2/muse/mplugins/mitplugin.cpp index dafad993..b60e47e8 100644 --- a/muse2/muse/mplugins/mitplugin.cpp +++ b/muse2/muse/mplugins/mitplugin.cpp @@ -37,6 +37,8 @@ MITPluginList mitPlugins; +namespace MusEApp { + //--------------------------------------------------------- // startMidiInputPlugin //--------------------------------------------------------- @@ -128,24 +130,26 @@ void MusE::hideMidiRhythmGenerator() #endif //--------------------------------------------------------- -// processMidiInputTransformPlugins +// startMidiTransformer //--------------------------------------------------------- -void processMidiInputTransformPlugins(MEvent& event) +void MusE::startMidiTransformer() { - for (iMITPlugin i = mitPlugins.begin(); i != mitPlugins.end(); ++i) - (*i)->process(event); + if (midiTransformerDialog == 0) + midiTransformerDialog = new MidiTransformerDialog; + midiTransformerDialog->show(); } +} // namespace MusEApp + //--------------------------------------------------------- -// startMidiTransformer +// processMidiInputTransformPlugins //--------------------------------------------------------- -void MusE::startMidiTransformer() +void processMidiInputTransformPlugins(MEvent& event) { - if (midiTransformerDialog == 0) - midiTransformerDialog = new MidiTransformerDialog; - midiTransformerDialog->show(); + for (iMITPlugin i = mitPlugins.begin(); i != mitPlugins.end(); ++i) + (*i)->process(event); } //--------------------------------------------------------- diff --git a/muse2/muse/mplugins/mittranspose.cpp b/muse2/muse/mplugins/mittranspose.cpp index 5dd377cd..feefccad 100644 --- a/muse2/muse/mplugins/mittranspose.cpp +++ b/muse2/muse/mplugins/mittranspose.cpp @@ -51,7 +51,7 @@ MITPluginTranspose::MITPluginTranspose(QWidget* parent, Qt::WFlags fl) connect(onCheckBox, SIGNAL(toggled(bool)), SLOT(onToggled(bool))); connect(triggerKeySpinBox, SIGNAL(valueChanged(int)), SLOT(triggerKeyChanged(int))); - connect(heartBeatTimer, SIGNAL(timeout()), SLOT(noteReceived())); + connect(MusEGlobal::heartBeatTimer, SIGNAL(timeout()), SLOT(noteReceived())); } //--------------------------------------------------------- diff --git a/muse2/muse/mplugins/mrconfig.cpp b/muse2/muse/mplugins/mrconfig.cpp index c6780d31..26788389 100644 --- a/muse2/muse/mplugins/mrconfig.cpp +++ b/muse2/muse/mplugins/mrconfig.cpp @@ -36,12 +36,12 @@ MRConfig::MRConfig(QWidget* parent, Qt::WFlags fl) : QWidget(parent, fl) { setupUi(this); - b1->setChecked(rcEnable); - sb1->setValue(rcStopNote); - sb2->setValue(rcRecordNote); - sb3->setValue(rcGotoLeftMarkNote); - sb4->setValue(rcPlayNote); - steprec_box->setValue(rcSteprecNote); + b1->setChecked(MusEGlobal::rcEnable); + sb1->setValue(MusEGlobal::rcStopNote); + sb2->setValue(MusEGlobal::rcRecordNote); + sb3->setValue(MusEGlobal::rcGotoLeftMarkNote); + sb4->setValue(MusEGlobal::rcPlayNote); + steprec_box->setValue(MusEGlobal::rcSteprecNote); connect(b1, SIGNAL(toggled(bool)), SLOT(setRcEnable(bool))); connect(sb1, SIGNAL(valueChanged(int)), SLOT(setRcStopNote(int))); @@ -63,31 +63,31 @@ void MRConfig::closeEvent(QCloseEvent* ev) void MRConfig::setRcEnable(bool f) { - rcEnable = f; + MusEGlobal::rcEnable = f; } void MRConfig::setRcStopNote(int val) { - rcStopNote = val; + MusEGlobal::rcStopNote = val; } void MRConfig::setRcRecordNote(int val) { - rcRecordNote = val; + MusEGlobal::rcRecordNote = val; } void MRConfig::setRcGotoLeftMarkNote(int val) { - rcGotoLeftMarkNote = val; + MusEGlobal::rcGotoLeftMarkNote = val; } void MRConfig::setRcPlayNote(int val) { - rcPlayNote = val; + MusEGlobal::rcPlayNote = val; } void MRConfig::setRcSteprecNote(int val) { - rcSteprecNote = val; + MusEGlobal::rcSteprecNote = val; } diff --git a/muse2/muse/node.cpp b/muse2/muse/node.cpp index be7db6a7..8b9e44d8 100644 --- a/muse2/muse/node.cpp +++ b/muse2/muse/node.cpp @@ -390,10 +390,10 @@ void AudioTrack::copyData(unsigned pos, int dstChannels, int srcStartChan, int s // No data was available from a previous call during this process cycle. Zero the supplied buffers and just return. for(i = 0; i < dstChannels; ++i) { - if(config.useDenormalBias) + if(MusEConfig::config.useDenormalBias) { for(unsigned int q = 0; q < nframes; ++q) - dstBuffer[i][q] = denormalBias; + dstBuffer[i][q] = MusEGlobal::denormalBias; } else memset(dstBuffer[i], 0, sizeof(float) * nframes); @@ -431,10 +431,10 @@ void AudioTrack::copyData(unsigned pos, int dstChannels, int srcStartChan, int s unsigned int q; for(i = 0; i < dstChannels; ++i) { - if(config.useDenormalBias) + if(MusEConfig::config.useDenormalBias) { for(q = 0; q < nframes; ++q) - dstBuffer[i][q] = denormalBias; + dstBuffer[i][q] = MusEGlobal::denormalBias; } else memset(dstBuffer[i], 0, sizeof(float) * nframes); @@ -448,10 +448,10 @@ void AudioTrack::copyData(unsigned pos, int dstChannels, int srcStartChan, int s /* if(!usedirectbuf) { - if(config.useDenormalBias) + if(MusEConfig::config.useDenormalBias) { for(q = 0; q < nframes; ++q) - outBuffers[i][q] = denormalBias; + outBuffers[i][q] = MusEGlobal::denormalBias; } else memset(outBuffers[i], 0, sizeof(float) * nframes); @@ -540,10 +540,10 @@ void AudioTrack::copyData(unsigned pos, int dstChannels, int srcStartChan, int s unsigned int q; for(i = 0; i < dstChannels; ++i) { - if(config.useDenormalBias) + if(MusEConfig::config.useDenormalBias) { for(q = 0; q < nframes; q++) - dstBuffer[i][q] = denormalBias; + dstBuffer[i][q] = MusEGlobal::denormalBias; } else memset(dstBuffer[i], 0, sizeof(float) * nframes); @@ -554,10 +554,10 @@ void AudioTrack::copyData(unsigned pos, int dstChannels, int srcStartChan, int s { for(i = 0; i < srcChannels; ++i) { - if(config.useDenormalBias) + if(MusEConfig::config.useDenormalBias) { for(q = 0; q < nframes; ++q) - outBuffers[i][q] = denormalBias; + outBuffers[i][q] = MusEGlobal::denormalBias; } else memset(outBuffers[i], 0, sizeof(float) * nframes); @@ -590,10 +590,10 @@ void AudioTrack::copyData(unsigned pos, int dstChannels, int srcStartChan, int s unsigned int q; for(i = 0; i < dstChannels; ++i) { - if(config.useDenormalBias) + if(MusEConfig::config.useDenormalBias) { for(q = 0; q < nframes; q++) - dstBuffer[i][q] = denormalBias; + dstBuffer[i][q] = MusEGlobal::denormalBias; } else memset(dstBuffer[i], 0, sizeof(float) * nframes); @@ -838,10 +838,10 @@ void AudioTrack::addData(unsigned pos, int dstChannels, int srcStartChan, int sr /* if(!usedirectbuf) { - if(config.useDenormalBias) + if(MusEConfig::config.useDenormalBias) { for(unsigned int q = 0; q < nframes; ++q) - outBuffers[i][q] = denormalBias; + outBuffers[i][q] = MusEGlobal::denormalBias; } else memset(outBuffers[i], 0, sizeof(float) * nframes); @@ -862,14 +862,14 @@ void AudioTrack::addData(unsigned pos, int dstChannels, int srcStartChan, int sr unsigned int q; for(i = 0; i < srcChans; ++i) { - if(config.useDenormalBias) + if(MusEConfig::config.useDenormalBias) { for(q = 0; q < nframes; ++q) { if(q & 1) - buffer[i][q] -= denormalBias; + buffer[i][q] -= MusEGlobal::denormalBias; else - buffer[i][q] += denormalBias; + buffer[i][q] += MusEGlobal::denormalBias; } } } @@ -958,10 +958,10 @@ void AudioTrack::addData(unsigned pos, int dstChannels, int srcStartChan, int sr { for(i = 0; i < srcChannels; ++i) { - if(config.useDenormalBias) + if(MusEConfig::config.useDenormalBias) { for(unsigned int q = 0; q < nframes; ++q) - outBuffers[i][q] = denormalBias; + outBuffers[i][q] = MusEGlobal::denormalBias; } else memset(outBuffers[i], 0, sizeof(float) * nframes); @@ -994,10 +994,10 @@ void AudioTrack::addData(unsigned pos, int dstChannels, int srcStartChan, int sr unsigned int q; for(i = 0; i < dstChannels; ++i) { - if(config.useDenormalBias) + if(MusEConfig::config.useDenormalBias) { for(q = 0; q < nframes; q++) - dstBuffer[i][q] = denormalBias; + dstBuffer[i][q] = MusEGlobal::denormalBias; } else memset(dstBuffer[i], 0, sizeof(float) * nframes); @@ -1328,7 +1328,7 @@ bool AudioTrack::getData(unsigned pos, int channels, unsigned nframes, float** b bool AudioInput::getData(unsigned, int channels, unsigned nframes, float** buffer) { - if (!checkAudioDevice()) return false; + if (!MusEGlobal::checkAudioDevice()) return false; for (int ch = 0; ch < channels; ++ch) { void* jackPort = jackPorts[ch]; @@ -1352,10 +1352,10 @@ bool AudioInput::getData(unsigned, int channels, unsigned nframes, float** buffe //memcpy(buffer[ch], jackbuf, nframes* sizeof(float)); AL::dsp->cpy(buffer[ch], jackbuf, nframes); - if (config.useDenormalBias) + if (MusEConfig::config.useDenormalBias) { for (unsigned int i=0; i < nframes; i++) - buffer[ch][i] += denormalBias; + buffer[ch][i] += MusEGlobal::denormalBias; // p3.3.41 //fprintf(stderr, "AudioInput::getData %s Jack port %p efx apply channels:%d nframes:%ld %e %e %e %e\n", @@ -1364,10 +1364,10 @@ bool AudioInput::getData(unsigned, int channels, unsigned nframes, float** buffe } else { - if (config.useDenormalBias) + if (MusEConfig::config.useDenormalBias) { for (unsigned int i=0; i < nframes; i++) - buffer[ch][i] = denormalBias; + buffer[ch][i] = MusEGlobal::denormalBias; } else { @@ -1389,7 +1389,7 @@ bool AudioInput::getData(unsigned, int channels, unsigned nframes, float** buffe void AudioInput::setName(const QString& s) { _name = s; - if (!checkAudioDevice()) return; + if (!MusEGlobal::checkAudioDevice()) return; for (int i = 0; i < channels(); ++i) { char buffer[128]; snprintf(buffer, 128, "%s-%d", _name.toLatin1().constData(), i); @@ -1505,7 +1505,7 @@ void AudioTrack::record() while(fifo.getCount()) { - if (fifo.get(_channels, segmentSize, buffer, &pos)) { + if (fifo.get(_channels, MusEGlobal::segmentSize, buffer, &pos)) { printf("AudioTrack::record(): empty fifo\n"); return; } @@ -1561,7 +1561,7 @@ void AudioTrack::record() //printf("AudioTrack::record loopcnt:%d lframe:%d newpos:%d curpos:%d start:%d end:%d\n", audio->loopCount(), audio->loopFrame(), pos, position, audio->getStartRecordPos().frame(), audio->getEndRecordPos().frame()); _recFile->seek(pos, 0); - _recFile->write(_channels, buffer, segmentSize); + _recFile->write(_channels, buffer, MusEGlobal::segmentSize); } } @@ -1578,13 +1578,13 @@ void AudioTrack::record() void AudioOutput::processInit(unsigned nframes) { _nframes = nframes; - if (!checkAudioDevice()) return; + if (!MusEGlobal::checkAudioDevice()) return; for (int i = 0; i < channels(); ++i) { if (jackPorts[i]) { buffer[i] = audioDevice->getBuffer(jackPorts[i], nframes); - if (config.useDenormalBias) { + if (MusEConfig::config.useDenormalBias) { for (unsigned int j=0; j < nframes; j++) - buffer[i][j] += denormalBias; + buffer[i][j] += MusEGlobal::denormalBias; } } else @@ -1622,9 +1622,9 @@ void AudioOutput::silence(unsigned n) { processInit(n); for (int i = 0; i < channels(); ++i) - if (config.useDenormalBias) { + if (MusEConfig::config.useDenormalBias) { for (unsigned int j=0; j < n; j++) - buffer[i][j] = denormalBias; + buffer[i][j] = MusEGlobal::denormalBias; } else { memset(buffer[i], 0, n * sizeof(float)); } @@ -1653,8 +1653,8 @@ void AudioOutput::processWrite() } } // Changed by Tim. p3.3.18 - //if (audioClickFlag && song->click()) { - if (sendMetronome() && audioClickFlag && song->click()) { + //if (MusEGlobal::audioClickFlag && song->click()) { + if (sendMetronome() && MusEGlobal::audioClickFlag && song->click()) { // Added by Tim. p3.3.18 #ifdef METRONOME_DEBUG @@ -1673,7 +1673,7 @@ void AudioOutput::processWrite() void AudioOutput::setName(const QString& s) { _name = s; - if (!checkAudioDevice()) return; + if (!MusEGlobal::checkAudioDevice()) return; for (int i = 0; i < channels(); ++i) { char buffer[128]; snprintf(buffer, 128, "%s-%d", _name.toLatin1().constData(), i); @@ -1695,7 +1695,7 @@ Fifo::Fifo() { muse_atomic_init(&count); //nbuffer = FIFO_BUFFER; - nbuffer = fifoLength; + nbuffer = MusEGlobal::fifoLength; buffer = new FifoBuffer*[nbuffer]; for (int i = 0; i < nbuffer; ++i) buffer[i] = new FifoBuffer; @@ -1930,7 +1930,7 @@ void AudioTrack::setTotalOutChannels(int num) outBuffers = new float*[chans]; for (int i = 0; i < chans; ++i) - posix_memalign((void**)&outBuffers[i], 16, sizeof(float) * segmentSize); + posix_memalign((void**)&outBuffers[i], 16, sizeof(float) * MusEGlobal::segmentSize); //chans = num; // Limit the actual track (meters, copying etc, all 'normal' operation) to two-channel stereo. diff --git a/muse2/muse/osc.cpp b/muse2/muse/osc.cpp index 1ab45b98..ba0941f9 100644 --- a/muse2/muse/osc.cpp +++ b/muse2/muse/osc.cpp @@ -365,6 +365,8 @@ void initOSC() lo_server_thread_start(serverThread); } +namespace MusEApp { + //--------------------------------------------------------- // exitOSC //--------------------------------------------------------- @@ -405,7 +407,7 @@ void stopOSC() oscServerRunning = false; } - +} // namespace MusEApp /* //--------------------------------------------------------- @@ -624,7 +626,7 @@ int OscIF::oscUpdate(lo_arg **argv) #endif // Send sample rate. - lo_send(_uiOscTarget, _uiOscSampleRatePath, "i", sampleRate); + lo_send(_uiOscTarget, _uiOscSampleRatePath, "i", MusEGlobal::sampleRate); // Send project directory. //lo_send(_uiOscTarget, _uiOscConfigurePath, "ss", diff --git a/muse2/muse/part.cpp b/muse2/muse/part.cpp index 434e1d4d..51478928 100644 --- a/muse2/muse/part.cpp +++ b/muse2/muse/part.cpp @@ -646,7 +646,7 @@ int PartList::index(Part* part) if (i->second == part) { return index; } - if(debugMsg) + if(MusEGlobal::debugMsg) printf("PartList::index(): not found!\n"); //return 0; return -1; diff --git a/muse2/muse/plugin.cpp b/muse2/muse/plugin.cpp index a34e0378..a6a76a21 100644 --- a/muse2/muse/plugin.cpp +++ b/muse2/muse/plugin.cpp @@ -79,13 +79,13 @@ PluginList plugins; /* -static const char* preset_file_pattern[] = { +static const char* MusEGlobal::preset_file_pattern[] = { QT_TRANSLATE_NOOP("@default", "Presets (*.pre *.pre.gz *.pre.bz2)"), QT_TRANSLATE_NOOP("@default", "All Files (*)"), 0 }; -static const char* preset_file_save_pattern[] = { +static const char* MusEGlobal::preset_file_save_pattern[] = { QT_TRANSLATE_NOOP("@default", "Presets (*.pre)"), QT_TRANSLATE_NOOP("@default", "gzip compressed presets (*.pre.gz)"), QT_TRANSLATE_NOOP("@default", "bzip2 compressed presets (*.pre.bz2)"), @@ -141,7 +141,7 @@ bool ladspa2MidiControlValues(const LADSPA_Descriptor* plugin, unsigned long por printf("ladspa2MidiControlValues: has LADSPA_HINT_SAMPLE_RATE\n"); #endif - m = float(sampleRate); + m = float(MusEGlobal::sampleRate); } if(desc & LADSPA_HINT_BOUNDED_BELOW) @@ -321,7 +321,7 @@ float midi2LadspaValue(const LADSPA_Descriptor* plugin, unsigned long port, int printf("midi2LadspaValue: has LADSPA_HINT_SAMPLE_RATE\n"); #endif - m = float(sampleRate); + m = float(MusEGlobal::sampleRate); } if(desc & LADSPA_HINT_BOUNDED_BELOW) @@ -533,7 +533,7 @@ bool ladspaDefaultValue(const LADSPA_Descriptor* plugin, unsigned long port, flo LADSPA_PortRangeHintDescriptor rh = range.HintDescriptor; // bool isLog = LADSPA_IS_HINT_LOGARITHMIC(rh); //double val = 1.0; - float m = (rh & LADSPA_HINT_SAMPLE_RATE) ? float(sampleRate) : 1.0f; + float m = (rh & LADSPA_HINT_SAMPLE_RATE) ? float(MusEGlobal::sampleRate) : 1.0f; if (LADSPA_IS_HINT_DEFAULT_MINIMUM(rh)) { *val = range.LowerBound * m; @@ -636,7 +636,7 @@ void ladspaControlRange(const LADSPA_Descriptor* plugin, unsigned long port, flo } float m = 1.0; if (desc & LADSPA_HINT_SAMPLE_RATE) - m = float(sampleRate); + m = float(MusEGlobal::sampleRate); if (desc & LADSPA_HINT_BOUNDED_BELOW) *min = range.LowerBound * m; @@ -668,7 +668,7 @@ void PluginBase::range(unsigned long i, float* min, float* max) const } float m = 1.0; if (desc & LADSPA_HINT_SAMPLE_RATE) - m = float(sampleRate); + m = float(MusEGlobal::sampleRate); if (desc & LADSPA_HINT_BOUNDED_BELOW) *min = range.LowerBound * m; @@ -762,7 +762,7 @@ Plugin::Plugin(QFileInfo* f, const LADSPA_Descriptor* d, bool isDssi) // Hack: Special Flag required for example for control processing. _isDssiVst = fi.completeBaseName() == QString("dssi-vst"); // Hack: Blacklist vst plugins in-place, configurable for now. - if ((_inports != _outports) || (_isDssiVst && !config.vstInPlace)) + if ((_inports != _outports) || (_isDssiVst && !MusEConfig::config.vstInPlace)) _inPlaceCapable = false; } @@ -940,7 +940,7 @@ int Plugin::incReferences(int val) // Hack: Special flag required for example for control processing. _isDssiVst = fi.completeBaseName() == QString("dssi-vst"); // Hack: Blacklist vst plugins in-place, configurable for now. - if ((_inports != _outports) || (_isDssiVst && !config.vstInPlace)) + if ((_inports != _outports) || (_isDssiVst && !MusEConfig::config.vstInPlace)) _inPlaceCapable = false; } } @@ -979,7 +979,7 @@ void Plugin::range(unsigned long i, float* min, float* max) const } float m = 1.0; if (desc & LADSPA_HINT_SAMPLE_RATE) - m = float(sampleRate); + m = float(MusEGlobal::sampleRate); if (desc & LADSPA_HINT_BOUNDED_BELOW) *min = range.LowerBound * m; @@ -1115,7 +1115,7 @@ static void loadPluginLib(QFileInfo* fi) //LADSPA_Properties properties = descr->LADSPA_Plugin->Properties; //bool inPlaceBroken = LADSPA_IS_INPLACE_BROKEN(properties); //plugins.add(fi, descr, !inPlaceBroken); - if(debugMsg) + if(MusEGlobal::debugMsg) fprintf(stderr, "loadPluginLib: adding dssi effect plugin:%s name:%s label:%s\n", fi->filePath().toLatin1().constData(), descr->LADSPA_Plugin->Name, descr->LADSPA_Plugin->Label); plugins.add(fi, descr->LADSPA_Plugin, true); @@ -1161,7 +1161,7 @@ static void loadPluginLib(QFileInfo* fi) //LADSPA_Properties properties = descr->Properties; //bool inPlaceBroken = LADSPA_IS_INPLACE_BROKEN(properties); //plugins.add(fi, ladspa, descr, !inPlaceBroken); - if(debugMsg) + if(MusEGlobal::debugMsg) fprintf(stderr, "loadPluginLib: adding ladspa plugin:%s name:%s label:%s\n", fi->filePath().toLatin1().constData(), descr->Name, descr->Label); plugins.add(fi, descr); } @@ -1176,7 +1176,7 @@ static void loadPluginLib(QFileInfo* fi) static void loadPluginDir(const QString& s) { - if (debugMsg) + if (MusEGlobal::debugMsg) printf("scan ladspa plugin dir <%s>\n", s.toLatin1().constData()); QDir pluginDir(s, QString("*.so")); // ddskrjo if (pluginDir.exists()) { @@ -1195,7 +1195,7 @@ static void loadPluginDir(const QString& s) void initPlugins() { - loadPluginDir(museGlobalLib + QString("/plugins")); + loadPluginDir(MusEGlobal::museGlobalLib + QString("/plugins")); const char* p = 0; @@ -1230,7 +1230,7 @@ void initPlugins() ladspaPath = "/usr/local/lib64/ladspa:/usr/lib64/ladspa:/usr/local/lib/ladspa:/usr/lib/ladspa"; p = ladspaPath; - if(debugMsg) + if(MusEGlobal::debugMsg) fprintf(stderr, "loadPluginDir: ladspa path:%s\n", ladspaPath); while (*p != '\0') { @@ -1243,7 +1243,7 @@ void initPlugins() char* buffer = new char[n + 1]; strncpy(buffer, p, n); buffer[n] = '\0'; - if(debugMsg) + if(MusEGlobal::debugMsg) fprintf(stderr, "loadPluginDir: loading ladspa dir:%s\n", buffer); loadPluginDir(QString(buffer)); @@ -1278,7 +1278,7 @@ Pipeline::Pipeline() { // Added by Tim. p3.3.15 for (int i = 0; i < MAX_CHANNELS; ++i) - posix_memalign((void**)(buffer + i), 16, sizeof(float) * segmentSize); + posix_memalign((void**)(buffer + i), 16, sizeof(float) * MusEGlobal::segmentSize); for (int i = 0; i < PipelineDepth; ++i) push_back(0); @@ -1917,7 +1917,7 @@ float PluginI::defaultValue(unsigned long param) const LADSPA_Handle Plugin::instantiate() { - LADSPA_Handle h = plugin->instantiate(plugin, sampleRate); + LADSPA_Handle h = plugin->instantiate(plugin, MusEGlobal::sampleRate); if(h == NULL) { fprintf(stderr, "Plugin::instantiate() Error: plugin:%s instantiate failed!\n", plugin->Label); @@ -2521,7 +2521,7 @@ void PluginI::enable2AllControllers(bool v) void PluginI::apply(unsigned long n) { // Process control value changes. - //if(automation && _track && _track->automationType() != AUTO_OFF && _id != -1) + //if(MusEGlobal::automation && _track && _track->automationType() != AUTO_OFF && _id != -1) //{ // for(int i = 0; i < controlPorts; ++i) // { @@ -2557,7 +2557,7 @@ void PluginI::apply(unsigned long n) // Set the ladspa control port value. controls[k].tmpVal = v.value; - // Need to update the automation value, otherwise it overwrites later with the last automation value. + // Need to update the MusEGlobal::automation value, otherwise it overwrites later with the last MusEGlobal::automation value. if(_track && _id != -1) { // Since we are now in the audio thread context, there's no need to send a message, @@ -2567,7 +2567,7 @@ void PluginI::apply(unsigned long n) //audio->msgSetPluginCtrlVal(_track, genACnum(_id, k), controls[k].val); _track->setPluginCtrlVal(genACnum(_id, k), v.value); - // Record automation. + // Record MusEGlobal::automation. // NO! Take care of this immediately in the OSC control handler, because we don't want // the silly delay associated with processing the fifo one-at-a-time here. @@ -2583,8 +2583,8 @@ void PluginI::apply(unsigned long n) else #endif // OSC_SUPPORT { - // Process automation control value. - if(automation && _track && _track->automationType() != AUTO_OFF && _id != -1) + // Process MusEGlobal::automation control value. + if(MusEGlobal::automation && _track && _track->automationType() != AUTO_OFF && _id != -1) { if(controls[k].enCtrl && controls[k].en2Ctrl ) controls[k].tmpVal = _track->pluginCtrlVal(genACnum(_id, k)); @@ -2612,7 +2612,7 @@ void PluginI::apply(unsigned long n) void PluginI::apply(unsigned long n, unsigned long ports, float** bufIn, float** bufOut) { // Process control value changes. - //if(automation && _track && _track->automationType() != AUTO_OFF && _id != -1) + //if(MusEGlobal::automation && _track && _track->automationType() != AUTO_OFF && _id != -1) //{ // for(int i = 0; i < controlPorts; ++i) // { @@ -2646,13 +2646,13 @@ void PluginI::apply(unsigned long n, unsigned long ports, float** bufIn, float** if(fixedsize > n) fixedsize = n; - unsigned long min_per = config.minControlProcessPeriod; + unsigned long min_per = MusEConfig::config.minControlProcessPeriod; if(min_per > n) min_per = n; - // Process automation control values now. + // Process MusEGlobal::automation control values now. // TODO: This needs to be respect frame resolution. Put this inside the sample loop below. - if(automation && _track && _track->automationType() != AUTO_OFF && _id != -1) + if(MusEGlobal::automation && _track && _track->automationType() != AUTO_OFF && _id != -1) { for(unsigned long k = 0; k < controlPorts; ++k) { @@ -2725,7 +2725,7 @@ void PluginI::apply(unsigned long n, unsigned long ports, float** bufIn, float** controls[v.idx].tmpVal = v.value; /* - // Need to update the automation value, otherwise it overwrites later with the last automation value. + // Need to update the MusEGlobal::automation value, otherwise it overwrites later with the last MusEGlobal::automation value. if(_track && _id != -1) { // Since we are now in the audio thread context, there's no need to send a message, @@ -2735,11 +2735,11 @@ void PluginI::apply(unsigned long n, unsigned long ports, float** bufIn, float** //audio->msgSetPluginCtrlVal(_track, genACnum(_id, k), controls[k].val); _track->setPluginCtrlVal(genACnum(_id, v.idx), v.value); - // Record automation. + // Record MusEGlobal::automation. // NO! Take care of this immediately in the OSC control handler, because we don't want // any delay. // OTOH Since this is the actual place and time where the control ports values - // are set, best to reflect what happens here to automation. + // are set, best to reflect what happens here to MusEGlobal::automation. // However for dssi-vst it might be best to handle it that way. //AutomationType at = _track->automationType(); @@ -2893,7 +2893,7 @@ int PluginI::oscUpdate() { #ifdef DSSI_SUPPORT // Send project directory. - _oscif.oscSendConfigure(DSSI_PROJECT_DIRECTORY_KEY, museProject.toLatin1().constData()); // song->projectPath() + _oscif.oscSendConfigure(DSSI_PROJECT_DIRECTORY_KEY, MusEGlobal::museProject.toLatin1().constData()); // song->projectPath() /* // Send current string configuration parameters. @@ -3019,7 +3019,7 @@ int PluginI::oscControl(unsigned long port, float value) } - // Record automation: + // Record MusEGlobal::automation: // Take care of this immediately, because we don't want the silly delay associated with // processing the fifo one-at-a-time in the apply(). // NOTE: With some vsts we don't receive control events until the user RELEASES a control. @@ -3426,7 +3426,7 @@ PluginGui::PluginGui(PluginIBase* p) QString id; id.setNum(plugin->pluginID()); - QString name(museGlobalShare + QString("/plugins/") + id + QString(".ui")); + QString name(MusEGlobal::museGlobalShare + QString("/plugins/") + id + QString(".ui")); QFile uifile(name); if (uifile.exists()) { // @@ -3691,7 +3691,7 @@ PluginGui::PluginGui(PluginIBase* p) mw->setLayout(grid); view->setWidget(mw); } - connect(heartBeatTimer, SIGNAL(timeout()), SLOT(heartBeat())); + connect(MusEGlobal::heartBeatTimer, SIGNAL(timeout()), SLOT(heartBeat())); } //--------------------------------------------------------- @@ -3718,8 +3718,8 @@ void PluginGui::getPluginConvertedValues(LADSPA_PortRangeHint range, dupper = upper = range.UpperBound; } if (LADSPA_IS_HINT_SAMPLE_RATE(range.HintDescriptor)) { - lower *= sampleRate; - upper *= sampleRate; + lower *= MusEGlobal::sampleRate; + upper *= MusEGlobal::sampleRate; dlower = lower; dupper = upper; } @@ -3955,7 +3955,7 @@ void PluginGui::load() s += plugin->pluginLabel(); s += "/"; - QString fn = getOpenFileName(s, preset_file_pattern, + QString fn = getOpenFileName(s, MusEGlobal::preset_file_pattern, this, tr("MusE: load preset"), 0); if (fn.isEmpty()) return; @@ -4020,8 +4020,8 @@ void PluginGui::save() s += plugin->pluginLabel(); s += "/"; - //QString fn = getSaveFileName(s, preset_file_pattern, this, - QString fn = getSaveFileName(s, preset_file_save_pattern, this, + //QString fn = getSaveFileName(s, MusEGlobal::preset_file_pattern, this, + QString fn = getSaveFileName(s, MusEGlobal::preset_file_save_pattern, this, tr("MusE: save preset")); if (fn.isEmpty()) return; @@ -4149,7 +4149,7 @@ void PluginGui::updateControls() } - if(!automation) + if(!MusEGlobal::automation) return; AutomationType at = plugin->track()->automationType(); if(at == AUTO_OFF) diff --git a/muse2/muse/pos.cpp b/muse2/muse/pos.cpp index e3465ffa..d731a5b1 100644 --- a/muse2/muse/pos.cpp +++ b/muse2/muse/pos.cpp @@ -101,7 +101,7 @@ Pos::Pos(int min, int sec, int frame, int subframe) break; } _type = FRAMES; - _frame = lrint(time * sampleRate); + _frame = lrint(time * MusEGlobal::sampleRate); sn = -1; } @@ -541,7 +541,7 @@ void Pos::mbt(int* bar, int* beat, int* tk) const void Pos::msf(int* min, int* sec, int* fr, int* subFrame) const { - double time = double(frame()) / double(sampleRate); + double time = double(frame()) / double(MusEGlobal::sampleRate); *min = int(time) / 60; *sec = int(time) % 60; double rest = time - (*min * 60 + *sec); diff --git a/muse2/muse/route.cpp b/muse2/muse/route.cpp index b194bc7e..fbf42436 100644 --- a/muse2/muse/route.cpp +++ b/muse2/muse/route.cpp @@ -1080,7 +1080,7 @@ QString Route::name() const else if(type == JACK_ROUTE) { - if (!checkAudioDevice()) return ""; + if (!MusEGlobal::checkAudioDevice()) return ""; //return s + audioDevice->portName(jackPort); return audioDevice->portName(jackPort); } @@ -1116,7 +1116,7 @@ Route name2route(const QString& rn, bool /*dst*/, int rtype) { //if(dst) //{ - if(checkAudioDevice()) + if(MusEGlobal::checkAudioDevice()) { void* p = audioDevice->findPort(s.toLatin1().constData()); if(p) @@ -1213,7 +1213,7 @@ Route name2route(const QString& rn, bool /*dst*/, int rtype) else if(rtype == Route::JACK_ROUTE) { - if(checkAudioDevice()) + if(MusEGlobal::checkAudioDevice()) { void* p = audioDevice->findPort(s.toLatin1().constData()); if(p) @@ -1652,7 +1652,7 @@ void Route::dump() const else if (type == JACK_ROUTE) { - if(checkAudioDevice()) + if(MusEGlobal::checkAudioDevice()) printf("Route dump: jack audio port <%s> channel %d\n", audioDevice->portName(jackPort).toLatin1().constData(), channel); } else @@ -1668,7 +1668,7 @@ void Route::dump() const { if(device->deviceType() == MidiDevice::JACK_MIDI) { - if(checkAudioDevice()) + if(MusEGlobal::checkAudioDevice()) //printf("jack midi port device <%s> ", audioDevice->portName(device->clientPort()).toLatin1().constData()); // p3.3.55 { @@ -1725,7 +1725,7 @@ bool Route::operator==(const Route& a) const { if (type == JACK_ROUTE) { - //if (!checkAudioDevice()) return false; + //if (!MusEGlobal::checkAudioDevice()) return false; //return audioDevice->portName(jackPort) == audioDevice->portName(a.jackPort); // p3.3.55 Simplified. return jackPort == a.jackPort; @@ -1745,7 +1745,7 @@ bool Route::operator==(const Route& a) const { if(device->deviceType() == MidiDevice::JACK_MIDI) { - if (!checkAudioDevice()) return false; + if (!MusEGlobal::checkAudioDevice()) return false; return audioDevice->portName(device->clientPort()) == audioDevice->portName(a.device->clientPort()); } else diff --git a/muse2/muse/seqmsg.cpp b/muse2/muse/seqmsg.cpp index c126fc52..6c3fc5ab 100644 --- a/muse2/muse/seqmsg.cpp +++ b/muse2/muse/seqmsg.cpp @@ -92,10 +92,10 @@ bool Audio::sendMessage(AudioMsg* m, bool doUndo) void Audio::msgRemoveRoute(Route src, Route dst) { msgRemoveRoute1(src, dst); - //if (!checkAudioDevice()) return; + //if (!MusEGlobal::checkAudioDevice()) return; if (src.type == Route::JACK_ROUTE) { - if (!checkAudioDevice()) return; + if (!MusEGlobal::checkAudioDevice()) return; //if(dst.type == Route::JACK_MIDI_ROUTE) if(dst.type == Route::MIDI_DEVICE_ROUTE) @@ -120,7 +120,7 @@ void Audio::msgRemoveRoute(Route src, Route dst) } else if (dst.type == Route::JACK_ROUTE) { - if (!checkAudioDevice()) return; + if (!MusEGlobal::checkAudioDevice()) return; //if(src.type == Route::JACK_MIDI_ROUTE) if(src.type == Route::MIDI_DEVICE_ROUTE) @@ -169,10 +169,10 @@ void Audio::msgRemoveRoutes(Route src, Route dst) // TODO /* - //if (!checkAudioDevice()) return; + //if (!MusEGlobal::checkAudioDevice()) return; if (src.type == Route::JACK_ROUTE) { - if (!checkAudioDevice()) return; + if (!MusEGlobal::checkAudioDevice()) return; //if(dst.type == Route::JACK_MIDI_ROUTE) if(dst.type == Route::MIDI_DEVICE_ROUTE) @@ -197,7 +197,7 @@ void Audio::msgRemoveRoutes(Route src, Route dst) } else if (dst.type == Route::JACK_ROUTE) { - if (!checkAudioDevice()) return; + if (!MusEGlobal::checkAudioDevice()) return; //if(src.type == Route::JACK_MIDI_ROUTE) if(src.type == Route::MIDI_DEVICE_ROUTE) @@ -246,7 +246,7 @@ void Audio::msgAddRoute(Route src, Route dst) { if (src.type == Route::JACK_ROUTE) { - if (!checkAudioDevice()) return; + if (!MusEGlobal::checkAudioDevice()) return; if (isRunning()) { //if(dst.type == Route::JACK_MIDI_ROUTE) @@ -273,7 +273,7 @@ void Audio::msgAddRoute(Route src, Route dst) } else if (dst.type == Route::JACK_ROUTE) { - if (!checkAudioDevice()) return; + if (!MusEGlobal::checkAudioDevice()) return; if (audio->isRunning()) { //if(src.type == Route::JACK_MIDI_ROUTE) @@ -401,7 +401,7 @@ void Audio::msgSetChannels(AudioTrack* node, int n) { if (node->type() == Track::AUDIO_INPUT) { - if (!checkAudioDevice()) return; + if (!MusEGlobal::checkAudioDevice()) return; AudioInput* ai = (AudioInput*)node; for (int i = 0; i < mc; ++i) { @@ -431,7 +431,7 @@ void Audio::msgSetChannels(AudioTrack* node, int n) } else if (node->type() == Track::AUDIO_OUTPUT) { - if (!checkAudioDevice()) return; + if (!MusEGlobal::checkAudioDevice()) return; AudioOutput* ao = (AudioOutput*)node; for (int i = 0; i < mc; ++i) { @@ -702,7 +702,7 @@ void Audio::msgSetSegSize(int bs, int sr) void Audio::msgSeek(const Pos& pos) { - if (!checkAudioDevice()) return; + if (!MusEGlobal::checkAudioDevice()) return; //audioDevice->seekTransport(pos.frame()); // p3.3.23 //printf("Audio::msgSeek before audioDevice->seekTransport frame:%d\n", pos.frame()); @@ -1329,7 +1329,7 @@ void Audio::msgSetSendMetronome(AudioTrack* track, bool b) void Audio::msgBounce() { _bounce = true; - if (!checkAudioDevice()) return; + if (!MusEGlobal::checkAudioDevice()) return; //audioDevice->seekTransport(song->lPos().frame()); audioDevice->seekTransport(song->lPos()); } diff --git a/muse2/muse/sig.cpp b/muse2/muse/sig.cpp index c224dab6..22acf6f8 100644 --- a/muse2/muse/sig.cpp +++ b/muse2/muse/sig.cpp @@ -187,7 +187,7 @@ int SigList::ticksBeat(unsigned tick) const int SigList::ticks_beat(int n) const { - int m = config.division; + int m = MusEConfig::config.division; switch (n) { case 1: m <<= 2; break; // 1536 case 2: m <<= 1; break; // 768 diff --git a/muse2/muse/song.cpp b/muse2/muse/song.cpp index 160de3b4..f5a5ed90 100644 --- a/muse2/muse/song.cpp +++ b/muse2/muse/song.cpp @@ -192,7 +192,7 @@ Track* Song::addNewTrack(QAction* action) if (dev==0) { midiSeq->msgSetMidiDevice(port, si); - muse->changeConfig(true); // save configuration file + MusEGlobal::muse->changeConfig(true); // save configuration file deselectTracks(); si->setSelected(true); update(); @@ -466,7 +466,7 @@ bool Song::addEvent(Event& event, Part* part) if(part->events()->find(event) != part->events()->end()) { // This can be normal for some (redundant) operations. - if(debugMsg) + if(MusEGlobal::debugMsg) printf("Song::addEvent event already found in part:%s size:%zd\n", part->name().toLatin1().constData(), part->events()->size()); return false; } @@ -485,7 +485,7 @@ void Song::changeEvent(Event& oldEvent, Event& newEvent, Part* part) if (i == part->events()->end()) { // This can be normal for some (redundant) operations. - if(debugMsg) + if(MusEGlobal::debugMsg) printf("Song::changeEvent event not found in part:%s size:%zd\n", part->name().toLatin1().constData(), part->events()->size()); // abort(); // Removed by T356. Allow it to add the new event. @@ -587,7 +587,7 @@ void Song::deleteEvent(Event& event, Part* part) iEvent ev = part->events()->find(event); if (ev == part->events()->end()) { // This can be normal for some (redundant) operations. - if(debugMsg) + if(MusEGlobal::debugMsg) printf("Song::deleteEvent event not found in part:%s size:%zd\n", part->name().toLatin1().constData(), part->events()->size()); return; } @@ -754,7 +754,7 @@ void Song::controllerChange(Track* t) void Song::cmdAddRecordedEvents(MidiTrack* mt, EventList* events, unsigned startTick) { if (events->empty()) { - if (debugMsg) + if (MusEGlobal::debugMsg) printf("no events recorded\n"); return; } @@ -804,7 +804,7 @@ void Song::cmdAddRecordedEvents(MidiTrack* mt, EventList* events, unsigned start e = events->end(); if (startTick > endTick) { - if (debugMsg) + if (MusEGlobal::debugMsg) printf("no events in record area\n"); return; } @@ -827,7 +827,7 @@ void Song::cmdAddRecordedEvents(MidiTrack* mt, EventList* events, unsigned start break; } if (ip == pl->end()) { - if (debugMsg) + if (MusEGlobal::debugMsg) printf("create new part for recorded events\n"); // create new part part = new MidiPart(mt); @@ -1094,7 +1094,7 @@ void Song::setLoop(bool f) { if (loopFlag != f) { loopFlag = f; - loopAction->setChecked(loopFlag); + MusEGlobal::loopAction->setChecked(loopFlag); emit loopChanged(loopFlag); } } @@ -1113,12 +1113,12 @@ void Song::clearTrackRec() //--------------------------------------------------------- void Song::setRecord(bool f, bool autoRecEnable) { - if(debugMsg) + if(MusEGlobal::debugMsg) printf("setRecord recordflag =%d f(record state)=%d autoRecEnable=%d\n", recordFlag, f, autoRecEnable); - if (f && config.useProjectSaveDialog && museProject == museProjectInitPath ) { // check that there is a project stored before commencing + if (f && MusEConfig::config.useProjectSaveDialog && MusEGlobal::museProject == MusEGlobal::museProjectInitPath ) { // check that there is a project stored before commencing // no project, we need to create one. - if (!muse->saveAs()) + if (!MusEGlobal::muse->saveAs()) return; // could not store project, won't enable record } if (recordFlag != f) { @@ -1192,7 +1192,7 @@ void Song::setRecord(bool f, bool autoRecEnable) if (audio->isPlaying() && f) f = false; recordFlag = f; - recordAction->setChecked(recordFlag); + MusEGlobal::recordAction->setChecked(recordFlag); emit recordChanged(recordFlag); } } @@ -1206,7 +1206,7 @@ void Song::setPunchin(bool f) { if (punchinFlag != f) { punchinFlag = f; - punchinAction->setChecked(punchinFlag); + MusEGlobal::punchinAction->setChecked(punchinFlag); emit punchinChanged(punchinFlag); } } @@ -1220,7 +1220,7 @@ void Song::setPunchout(bool f) { if (punchoutFlag != f) { punchoutFlag = f; - punchoutAction->setChecked(punchoutFlag); + MusEGlobal::punchoutAction->setChecked(punchoutFlag); emit punchoutChanged(punchoutFlag); } } @@ -1273,13 +1273,13 @@ void Song::setMasterFlag(bool val) void Song::setPlay(bool f) { if (extSyncFlag.value()) { - if (debugMsg) + if (MusEGlobal::debugMsg) printf("not allowed while using external sync"); return; } // only allow the user to set the button "on" if (!f) - playAction->setChecked(true); + MusEGlobal::playAction->setChecked(true); else audio->msgPlay(true); } @@ -1287,29 +1287,29 @@ void Song::setPlay(bool f) void Song::setStop(bool f) { if (extSyncFlag.value()) { - if (debugMsg) + if (MusEGlobal::debugMsg) printf("not allowed while using external sync"); return; } // only allow the user to set the button "on" if (!f) - stopAction->setChecked(true); + MusEGlobal::stopAction->setChecked(true); else audio->msgPlay(false); } void Song::setStopPlay(bool f) { - playAction->blockSignals(true); - stopAction->blockSignals(true); + MusEGlobal::playAction->blockSignals(true); + MusEGlobal::stopAction->blockSignals(true); emit playChanged(f); // signal transport window - playAction->setChecked(f); - stopAction->setChecked(!f); + MusEGlobal::playAction->setChecked(f); + MusEGlobal::stopAction->setChecked(!f); - stopAction->blockSignals(false); - playAction->blockSignals(false); + MusEGlobal::stopAction->blockSignals(false); + MusEGlobal::playAction->blockSignals(false); } //--------------------------------------------------------- @@ -1428,7 +1428,7 @@ void Song::setPos(int idx, const Pos& val, bool sig, void Song::forward() { - unsigned newPos = pos[0].tick() + config.division; + unsigned newPos = pos[0].tick() + MusEConfig::config.division; audio->msgSeek(Pos(newPos, true)); } @@ -1439,10 +1439,10 @@ void Song::forward() void Song::rewind() { unsigned newPos; - if (unsigned(config.division) > pos[0].tick()) + if (unsigned(MusEConfig::config.division) > pos[0].tick()) newPos = 0; else - newPos = pos[0].tick() - config.division; + newPos = pos[0].tick() - MusEConfig::config.division; audio->msgSeek(Pos(newPos, true)); } @@ -1728,14 +1728,14 @@ void Song::beat() // filter midi remote control events //--------------------------------------------------- - if (rcEnable && velo != 0) { - if (pitch == rcStopNote) + if (MusEGlobal::rcEnable && velo != 0) { + if (pitch == MusEGlobal::rcStopNote) setStop(true); - else if (pitch == rcRecordNote) + else if (pitch == MusEGlobal::rcRecordNote) setRecord(true); - else if (pitch == rcGotoLeftMarkNote) + else if (pitch == MusEGlobal::rcGotoLeftMarkNote) setPos(0, pos[LPOS].tick(), true, true, true); - else if (pitch == rcPlayNote) + else if (pitch == MusEGlobal::rcPlayNote) setPlay(true); } emit song->midiNote(pitch, velo); @@ -1870,8 +1870,8 @@ void Song::endMsgCmd() { if (updateFlags) { redoList->clear(); // TODO: delete elements in list - undoAction->setEnabled(true); - redoAction->setEnabled(false); + MusEGlobal::undoAction->setEnabled(true); + MusEGlobal::redoAction->setEnabled(false); emit songChanged(updateFlags); } } @@ -1887,8 +1887,8 @@ void Song::undo() return; audio->msgUndo(); doUndo3(); - redoAction->setEnabled(true); - undoAction->setEnabled(!undoList->empty()); + MusEGlobal::redoAction->setEnabled(true); + MusEGlobal::undoAction->setEnabled(!undoList->empty()); if(updateFlags && (SC_TRACK_REMOVED | SC_TRACK_INSERTED)) audio->msgUpdateSoloStates(); @@ -1907,8 +1907,8 @@ void Song::redo() return; audio->msgRedo(); doRedo3(); - undoAction->setEnabled(true); - redoAction->setEnabled(!redoList->empty()); + MusEGlobal::undoAction->setEnabled(true); + MusEGlobal::redoAction->setEnabled(!redoList->empty()); if(updateFlags && (SC_TRACK_REMOVED | SC_TRACK_INSERTED)) audio->msgUpdateSoloStates(); @@ -2117,7 +2117,7 @@ void Song::panic() void Song::clear(bool signal, bool /*clear_all*/) { - if(debugMsg) + if(MusEGlobal::debugMsg) printf("Song::clear\n"); bounceTrack = 0; @@ -2239,36 +2239,36 @@ void Song::cleanupForQuit() { bounceTrack = 0; - if(debugMsg) + if(MusEGlobal::debugMsg) printf("MusE: Song::cleanupForQuit...\n"); _tracks.clear(); - if(debugMsg) + if(MusEGlobal::debugMsg) printf("deleting _midis\n"); _midis.clearDelete(); - if(debugMsg) + if(MusEGlobal::debugMsg) printf("deleting _waves\n"); _waves.clearDelete(); - if(debugMsg) + if(MusEGlobal::debugMsg) printf("deleting _inputs\n"); _inputs.clearDelete(); // audio input ports - if(debugMsg) + if(MusEGlobal::debugMsg) printf("deleting _outputs\n"); _outputs.clearDelete(); // audio output ports - if(debugMsg) + if(MusEGlobal::debugMsg) printf("deleting _groups\n"); _groups.clearDelete(); // mixer groups - if(debugMsg) + if(MusEGlobal::debugMsg) printf("deleting _auxs\n"); _auxs.clearDelete(); // aux sends - if(debugMsg) + if(MusEGlobal::debugMsg) printf("deleting _synthIs\n"); _synthIs.clearDelete(); // each ~SynthI() -> deactivate3() -> ~SynthIF() @@ -2276,19 +2276,19 @@ void Song::cleanupForQuit() AL::sigmap.clear(); keymap.clear(); - if(debugMsg) + if(MusEGlobal::debugMsg) printf("deleting undoList, clearing redoList\n"); undoList->clearDelete(); redoList->clear(); // Check this - Should we do a clearDelete? IIRC it was OK this way - no clearDelete in case of same items in both lists. _markerList->clear(); - if(debugMsg) + if(MusEGlobal::debugMsg) printf("deleting transforms\n"); clearMidiTransforms(); // Deletes stuff. clearMidiInputTransforms(); // Deletes stuff. - if(debugMsg) + if(MusEGlobal::debugMsg) printf("deleting midiport controllers\n"); // Clear all midi port controllers and values. for(int i = 0; i < MIDI_PORTS; ++i) @@ -2297,7 +2297,7 @@ void Song::cleanupForQuit() // Can't do this here. Jack isn't running. Fixed. Test OK so far. #if 1 - if(debugMsg) + if(MusEGlobal::debugMsg) printf("deleting midi devices except synths\n"); for(iMidiDevice imd = midiDevices.begin(); imd != midiDevices.end(); ++imd) { @@ -2309,7 +2309,7 @@ void Song::cleanupForQuit() midiDevices.clear(); // midi devices #endif - if(debugMsg) + if(MusEGlobal::debugMsg) printf("deleting global available synths\n"); // Delete all synths. std::vector<Synth*>::iterator is; @@ -2322,7 +2322,7 @@ void Song::cleanupForQuit() } synthis.clear(); - if(debugMsg) + if(MusEGlobal::debugMsg) printf("deleting midi instruments\n"); for(iMidiInstrument imi = midiInstruments.begin(); imi != midiInstruments.end(); ++imi) { @@ -2338,7 +2338,7 @@ void Song::cleanupForQuit() // Nothing required for ladspa plugin list, and rack instances of them // are handled by ~AudioTrack. - if(debugMsg) + if(MusEGlobal::debugMsg) printf("...finished cleaning up.\n"); } @@ -2381,11 +2381,11 @@ void Song::seqSignal(int fd) setPos(0, audio->tickPos(), true, false, true); break; case 'S': // shutdown audio - muse->seqStop(); + MusEGlobal::muse->seqStop(); { // give the user a sensible explanation - int btn = QMessageBox::critical( muse, tr("Jack shutdown!"), + int btn = QMessageBox::critical( MusEGlobal::muse, tr("Jack shutdown!"), tr("Jack has detected a performance problem which has lead to\n" "MusE being disconnected.\n" "This could happen due to a number of reasons:\n" @@ -2403,27 +2403,27 @@ void Song::seqSignal(int fd) "click on the Restart button."), "restart", "cancel"); if (btn == 0) { printf("restarting!\n"); - muse->seqRestart(); + MusEGlobal::muse->seqRestart(); } } break; case 'f': // start freewheel - if(debugMsg) + if(MusEGlobal::debugMsg) printf("Song: seqSignal: case f: setFreewheel start\n"); // Enabled by Tim. p3.3.6 - if(config.freewheelMode) + if(MusEConfig::config.freewheelMode) audioDevice->setFreewheel(true); break; case 'F': // stop freewheel - if(debugMsg) + if(MusEGlobal::debugMsg) printf("Song: seqSignal: case F: setFreewheel stop\n"); // Enabled by Tim. p3.3.6 - if(config.freewheelMode) + if(MusEConfig::config.freewheelMode) audioDevice->setFreewheel(false); audio->msgPlay(false); @@ -2552,8 +2552,8 @@ int Song::execAutomationCtlPopup(AudioTrack* track, const QPoint& menupos, int a //printf("pos[0]:%d f:%d tickPos:%d f:%d\n", pos[0].tick(), pos[0].frame(), audio->tickPos(), Pos(audio->tickPos(), true).frame()); //ctlval = cl->curVal(); - //AutomationType at = track->automationType(); - //if(!automation || track->automationType() == AUTO_OFF) + //AutomationType at = track->MusEGlobal::automationType(); + //if(!MusEGlobal::automation || track->MusEGlobal::automationType() == AUTO_OFF) ctlval = cl->curVal(); //else // ctlval = cl->value(frame); @@ -2612,7 +2612,7 @@ int Song::execAutomationCtlPopup(AudioTrack* track, const QPoint& menupos, int a eraseRangeAction->setData(CLEAR_RANGE); eraseRangeAction->setEnabled(canEraseRange); - QAction* clearAction = menu->addAction(tr("clear automation")); + QAction* clearAction = menu->addAction(tr("clear MusEGlobal::automation")); clearAction->setData(CLEAR_ALL_EVENTS); clearAction->setEnabled((bool)count); @@ -2644,7 +2644,7 @@ int Song::execAutomationCtlPopup(AudioTrack* track, const QPoint& menupos, int a break; case CLEAR_ALL_EVENTS: - if(QMessageBox::question(muse, QString("Muse"), + if(QMessageBox::question(MusEGlobal::muse, QString("Muse"), tr("Clear all controller events?"), tr("&Ok"), tr("&Cancel"), QString::null, 0, 1 ) == 0) audio->msgClearControllerEvents(track, acid); @@ -2795,7 +2795,7 @@ int Song::execMidiAutomationCtlPopup(MidiTrack* track, MidiPart* part, const QPo // menu->insertItem(tr("erase range"), CLEAR_RANGE, CLEAR_RANGE); // menu->setItemEnabled(CLEAR_RANGE, canEraseRange); -// menu->insertItem(tr("clear automation"), CLEAR_ALL_EVENTS, CLEAR_ALL_EVENTS); +// menu->insertItem(tr("clear MusEGlobal::automation"), CLEAR_ALL_EVENTS, CLEAR_ALL_EVENTS); // menu->setItemEnabled(CLEAR_ALL_EVENTS, (bool)count); @@ -2872,7 +2872,7 @@ int Song::execMidiAutomationCtlPopup(MidiTrack* track, MidiPart* part, const QPo //break; //case CLEAR_ALL_EVENTS: - //if(QMessageBox::question(muse, QString("Muse"), + //if(QMessageBox::question(MusEGlobal::muse, QString("Muse"), // tr("Clear all controller events?"), tr("&Ok"), tr("&Cancel"), // QString::null, 0, 1 ) == 0) //audio->msgClearControllerEvents(track, acid); @@ -2928,7 +2928,7 @@ void Song::processAutomationEvents() { // Just clear all pressed and touched flags, not rec event lists. clearRecAutomation(false); - if (!automation) + if (!MusEGlobal::automation) return; for(iTrack i = _tracks.begin(); i != _tracks.end(); ++i) { @@ -2974,7 +2974,7 @@ void Song::connectJackRoutes(AudioTrack* track, bool disconnect) if(!disconnect) ao->setName(ao->name()); // Now reconnect the output routes. - if(checkAudioDevice() && audio->isRunning()) + if(MusEGlobal::checkAudioDevice() && audio->isRunning()) { for(int ch = 0; ch < ao->channels(); ++ch) { @@ -3007,7 +3007,7 @@ void Song::connectJackRoutes(AudioTrack* track, bool disconnect) if(!disconnect) ai->setName(ai->name()); // Now reconnect the input routes. - if(checkAudioDevice() && audio->isRunning()) + if(MusEGlobal::checkAudioDevice() && audio->isRunning()) { for(int ch = 0; ch < ai->channels(); ++ch) { @@ -3140,7 +3140,7 @@ void Song::chooseMidiRoutes(QButton* parent, MidiTrack* track, bool dst) // MenuTitleItem* titel = new MenuTitleItem(QString(buffer)); // pup->insertItem(titel); -// if (!checkAudioDevice()) return; +// if (!MusEGlobal::checkAudioDevice()) return; // std::list<QString> ol = audioDevice->outputPorts(); // for (std::list<QString>::iterator ip = ol.begin(); ip != ol.end(); ++ip) { // int id = pup->insertItem(*ip, (gid * 16) + i); @@ -3171,7 +3171,7 @@ void Song::chooseMidiRoutes(QButton* parent, MidiTrack* track, bool dst) int mdidx = n / MIDI_CHANNELS; int ch = n % MIDI_CHANNELS; - //if(debugMsg) + //if(MusEGlobal::debugMsg) //printf("Song::chooseMidiRoutes mdidx:%d ch:%d\n", mdidx, ch); MidiPort* mp = &midiPorts[mdidx]; @@ -3738,7 +3738,7 @@ void Song::executeScript(const char* scriptfile, PartList* parts, int quant, boo //const char* tmp = tmpnam(NULL); char tmp[16] = "muse-tmp-XXXXXX"; int fd = mkstemp(tmp); - if (debugMsg) + if (MusEGlobal::debugMsg) printf("executeScript: script input filename=%s\n",tmp); FILE *fp = fdopen(fd , "w"); MidiPart *part = (MidiPart*)(i->second); @@ -3773,13 +3773,13 @@ void Song::executeScript(const char* scriptfile, PartList* parts, int quant, boo QStringList arguments; arguments << tmp; - QProcess *myProcess = new QProcess(muse); + QProcess *myProcess = new QProcess(MusEGlobal::muse); myProcess->start(scriptfile, arguments); myProcess->waitForFinished(); QByteArray errStr = myProcess->readAllStandardError(); if (myProcess->exitCode()) { - QMessageBox::warning(muse, tr("MusE - external script failed"), + QMessageBox::warning(MusEGlobal::muse, tr("MusE - external script failed"), tr("MusE was unable to launch the script, error message:\n ")+ QString(errStr) ); endUndo(SC_EVENT_REMOVED); @@ -3842,9 +3842,9 @@ void Song::populateScriptMenu(QMenu* menuPlugins, QObject* receiver) // // List scripts // - QString distScripts = museGlobalShare + "/scripts"; + QString distScripts = MusEGlobal::museGlobalShare + "/scripts"; - QString userScripts = configPath + "/scripts"; + QString userScripts = MusEGlobal::configPath + "/scripts"; QFileInfo distScriptsFi(distScripts); if (distScriptsFi.isDir()) { @@ -3897,11 +3897,11 @@ void Song::populateScriptMenu(QMenu* menuPlugins, QObject* receiver) QString Song::getScriptPath(int id, bool isdelivered) { if (isdelivered) { - QString path = museGlobalShare + "/scripts/" + deliveredScriptNames[id]; + QString path = MusEGlobal::museGlobalShare + "/scripts/" + deliveredScriptNames[id]; return path; } - QString path = configPath + "/scripts/" + userScriptNames[id - deliveredScriptNames.size()]; + QString path = MusEGlobal::configPath + "/scripts/" + userScriptNames[id - deliveredScriptNames.size()]; return path; } diff --git a/muse2/muse/songfile.cpp b/muse2/muse/songfile.cpp index 0c2b6fa4..0f2f3527 100644 --- a/muse2/muse/songfile.cpp +++ b/muse2/muse/songfile.cpp @@ -959,6 +959,8 @@ QFont Song::readFont(Xml& xml, const char* name) return f; } +namespace MusEApp { + //--------------------------------------------------------- // readPart //--------------------------------------------------------- @@ -1214,6 +1216,102 @@ void MusE::readMidiport(Xml& xml) } //--------------------------------------------------------- +// read +// read song +//--------------------------------------------------------- + +void MusE::read(Xml& xml, bool skipConfig, bool isTemplate) + { + bool skipmode = true; + for (;;) { + if (progress) + progress->setValue(progress->value()+1); + Xml::Token token = xml.parse(); + const QString& tag = xml.s1(); + switch (token) { + case Xml::Error: + case Xml::End: + return; + case Xml::TagStart: + if (skipmode && tag == "muse") + skipmode = false; + else if (skipmode) + break; + else if (tag == "configuration") + if (skipConfig) + //xml.skip(tag); + readConfiguration(xml,true /* only read sequencer settings */); + else + readConfiguration(xml, false); + else if (tag == "song") + { + song->read(xml, isTemplate); + audio->msgUpdateSoloStates(); + } + else if (tag == "midiport") + readMidiport(xml); + else if (tag == "Controller") { // obsolete + MidiController* ctrl = new MidiController; + ctrl->read(xml); + delete ctrl; + } + else if (tag == "mplugin") + readStatusMidiInputTransformPlugin(xml); + else if (tag == "toplevels") + readToplevels(xml); + else + xml.unknown("muse"); + break; + case Xml::Attribut: + if (tag == "version") { + int major = xml.s2().section('.', 0, 0).toInt(); + int minor = xml.s2().section('.', 1, 1).toInt(); + xml.setVersion(major, minor); + } + break; + case Xml::TagEnd: + if (!skipmode && tag == "muse") + return; + default: + break; + } + } + } + + +//--------------------------------------------------------- +// write +// write song +//--------------------------------------------------------- + +void MusE::write(Xml& xml) const + { + xml.header(); + + int level = 0; + xml.tag(level++, "muse version=\"2.0\""); + writeConfiguration(level, xml); + + writeStatusMidiInputTransformPlugins(level, xml); + + song->write(level, xml); + + if (!toplevels.empty()) { + xml.tag(level++, "toplevels"); + for (ciToplevel i = toplevels.begin(); i != toplevels.end(); ++i) { + if (i->cobject()->isVisible()) + i->cobject()->writeStatus(level, xml); + } + xml.tag(level--, "/toplevels"); + } + + xml.tag(level, "/muse"); + } + +} // namespace MusEApp + + +//--------------------------------------------------------- // readMarker //--------------------------------------------------------- @@ -1232,8 +1330,8 @@ void Song::read(Xml& xml, bool isTemplate) { cloneList.clear(); for (;;) { - if (muse->progress) - muse->progress->setValue(muse->progress->value()+1); + if (MusEGlobal::muse->progress) + MusEGlobal::muse->progress->setValue(MusEGlobal::muse->progress->value()+1); Xml::Token token; token = xml.parse(); @@ -1275,8 +1373,8 @@ void Song::read(Xml& xml, bool isTemplate) _follow = FollowMode(xml.parseInt()); else if (tag == "sampleRate") { int sRate = xml.parseInt(); - if (!isTemplate && audioDevice->deviceType() != AudioDevice::DUMMY_AUDIO && sRate != sampleRate) - QMessageBox::warning(muse,"Wrong sample rate", "The sample rate in this project and the current system setting differs, the project may not work as intended!"); + if (!isTemplate && audioDevice->deviceType() != AudioDevice::DUMMY_AUDIO && sRate != MusEGlobal::sampleRate) + QMessageBox::warning(MusEGlobal::muse,"Wrong sample rate", "The sample rate in this project and the current system setting differs, the project may not work as intended!"); } else if (tag == "tempolist") { tempomap.read(xml); @@ -1344,8 +1442,8 @@ void Song::read(Xml& xml, bool isTemplate) readMarker(xml); else if (tag == "globalPitchShift") _globalPitchShift = xml.parseInt(); - else if (tag == "automation") - automation = xml.parseInt(); + else if (tag == "MusEGlobal::automation") + MusEGlobal::automation = xml.parseInt(); else if (tag == "cpos") { int pos = xml.parseInt(); Pos p(pos, true); @@ -1384,69 +1482,6 @@ void Song::read(Xml& xml, bool isTemplate) } //--------------------------------------------------------- -// read -// read song -//--------------------------------------------------------- - -void MusE::read(Xml& xml, bool skipConfig, bool isTemplate) - { - bool skipmode = true; - for (;;) { - if (progress) - progress->setValue(progress->value()+1); - Xml::Token token = xml.parse(); - const QString& tag = xml.s1(); - switch (token) { - case Xml::Error: - case Xml::End: - return; - case Xml::TagStart: - if (skipmode && tag == "muse") - skipmode = false; - else if (skipmode) - break; - else if (tag == "configuration") - if (skipConfig) - //xml.skip(tag); - readConfiguration(xml,true /* only read sequencer settings */); - else - readConfiguration(xml, false); - else if (tag == "song") - { - song->read(xml, isTemplate); - audio->msgUpdateSoloStates(); - } - else if (tag == "midiport") - readMidiport(xml); - else if (tag == "Controller") { // obsolete - MidiController* ctrl = new MidiController; - ctrl->read(xml); - delete ctrl; - } - else if (tag == "mplugin") - readStatusMidiInputTransformPlugin(xml); - else if (tag == "toplevels") - readToplevels(xml); - else - xml.unknown("muse"); - break; - case Xml::Attribut: - if (tag == "version") { - int major = xml.s2().section('.', 0, 0).toInt(); - int minor = xml.s2().section('.', 1, 1).toInt(); - xml.setVersion(major, minor); - } - break; - case Xml::TagEnd: - if (!skipmode && tag == "muse") - return; - default: - break; - } - } - } - -//--------------------------------------------------------- // write //--------------------------------------------------------- @@ -1455,7 +1490,7 @@ void Song::write(int level, Xml& xml) const xml.tag(level++, "song"); xml.strTag(level, "info", songInfoStr); xml.intTag(level, "showinfo", showSongInfo); - xml.intTag(level, "automation", automation); + xml.intTag(level, "MusEGlobal::automation", MusEGlobal::automation); xml.intTag(level, "cpos", song->cpos()); xml.intTag(level, "rpos", song->rpos()); xml.intTag(level, "lpos", song->lpos()); @@ -1472,7 +1507,7 @@ void Song::write(int level, Xml& xml) const xml.intTag(level, "quantize", _quantize); xml.intTag(level, "len", _len); xml.intTag(level, "follow", _follow); - xml.intTag(level, "sampleRate", sampleRate); + xml.intTag(level, "sampleRate", MusEGlobal::sampleRate); if (_globalPitchShift) xml.intTag(level, "globalPitchShift", _globalPitchShift); @@ -1526,32 +1561,3 @@ void Song::write(int level, Xml& xml) const cloneList = copyCloneList; } -//--------------------------------------------------------- -// write -// write song -//--------------------------------------------------------- - -void MusE::write(Xml& xml) const - { - xml.header(); - - int level = 0; - xml.tag(level++, "muse version=\"2.0\""); - writeConfiguration(level, xml); - - writeStatusMidiInputTransformPlugins(level, xml); - - song->write(level, xml); - - if (!toplevels.empty()) { - xml.tag(level++, "toplevels"); - for (ciToplevel i = toplevels.begin(); i != toplevels.end(); ++i) { - if (i->cobject()->isVisible()) - i->cobject()->writeStatus(level, xml); - } - xml.tag(level--, "/toplevels"); - } - - xml.tag(level, "/muse"); - } - diff --git a/muse2/muse/steprec.cpp b/muse2/muse/steprec.cpp index 06da235b..a7a7546f 100644 --- a/muse2/muse/steprec.cpp +++ b/muse2/muse/steprec.cpp @@ -59,7 +59,7 @@ void StepRec::record(Part* part, int pitch, int len, int step, int velo, bool ct unsigned lasttick=0; Undo operations; - if (pitch!=rcSteprecNote) + if (pitch!=MusEGlobal::rcSteprecNote) { chord_timer->stop(); @@ -122,7 +122,7 @@ void StepRec::record(Part* part, int pitch, int len, int step, int velo, bool ct operations.push_back(UndoOp(UndoOp::AddEvent, e, part, false, false)); lasttick=e.endTick(); - if (! (globalKeyState & Qt::ShiftModifier)) + if (! (MusEGlobal::globalKeyState & Qt::ShiftModifier)) { chord_timer_set_to_tick = tick + step; chord_timer->start(); @@ -130,7 +130,7 @@ void StepRec::record(Part* part, int pitch, int len, int step, int velo, bool ct goto steprec_record_foot; // this is actually unneccessary, but for clarity } - else // equals if (pitch==rcSteprecNote) + else // equals if (pitch==MusEGlobal::rcSteprecNote) { bool held_notes=false; if (note_held_down!=NULL) diff --git a/muse2/muse/structure.cpp b/muse2/muse/structure.cpp index 3b8081c2..665dac68 100644 --- a/muse2/muse/structure.cpp +++ b/muse2/muse/structure.cpp @@ -32,6 +32,7 @@ #include "audio.h" #include "marker/marker.h" +namespace MusEApp { //--------------------------------------------------------- // adjustGlobalLists @@ -354,3 +355,4 @@ void MusE::cutEvents() tr("not implemented") ); } +} // namespace MusEApp diff --git a/muse2/muse/sync.cpp b/muse2/muse/sync.cpp index f2818568..afc378af 100644 --- a/muse2/muse/sync.cpp +++ b/muse2/muse/sync.cpp @@ -614,12 +614,12 @@ void MidiSeq::mmcInput(int port, const unsigned char* p, int n) break; } else if (p[5] == 1) { - if (!checkAudioDevice()) return; + if (!MusEGlobal::checkAudioDevice()) return; MTC mtc(p[6] & 0x1f, p[7], p[8], p[9], p[10]); int type = (p[6] >> 5) & 3; - //int mmcPos = tempomap.frame2tick(lrint(mtc.time()*sampleRate)); - //int mmcPos = lrint(mtc.time()*sampleRate); - int mmcPos = lrint(mtc.time(type) * sampleRate); + //int mmcPos = tempomap.frame2tick(lrint(mtc.time()*MusEGlobal::sampleRate)); + //int mmcPos = lrint(mtc.time()*MusEGlobal::sampleRate); + int mmcPos = lrint(mtc.time(type) * MusEGlobal::sampleRate); //Pos tp(mmcPos, true); Pos tp(mmcPos, false); @@ -776,8 +776,8 @@ void MidiSeq::mtcInputFull(int port, const unsigned char* p, int n) //if(extSyncFlag.value() && msync.MTCIn()) if(msync.MTCIn()) { - //Pos tp(lrint(mtcCurTime.time() * sampleRate), false); - Pos tp(lrint(mtcCurTime.time(type) * sampleRate), false); + //Pos tp(lrint(mtcCurTime.time() * MusEGlobal::sampleRate), false); + Pos tp(lrint(mtcCurTime.time(type) * MusEGlobal::sampleRate), false); audioDevice->seekTransport(tp); alignAllTicks(); } @@ -813,7 +813,7 @@ void MidiSeq::nonRealtimeSystemSysex(int /*port*/, const unsigned char* p, int n void MidiSeq::setSongPosition(int port, int midiBeat) { - if (midiInputTrace) + if (MusEGlobal::midiInputTrace) printf("set song position port:%d %d\n", port, midiBeat); //midiPorts[port].syncInfo().trigMCSyncDetect(); @@ -831,13 +831,13 @@ void MidiSeq::setSongPosition(int port, int midiBeat) if(p != port && midiPorts[p].syncInfo().MRTOut()) midiPorts[p].sendSongpos(midiBeat); - curExtMidiSyncTick = (config.division * midiBeat) / 4; + curExtMidiSyncTick = (MusEConfig::config.division * midiBeat) / 4; lastExtMidiSyncTick = curExtMidiSyncTick; - //Pos pos((config.division * midiBeat) / 4, true); + //Pos pos((MusEConfig::config.division * midiBeat) / 4, true); Pos pos(curExtMidiSyncTick, true); - if (!checkAudioDevice()) return; + if (!MusEGlobal::checkAudioDevice()) return; //audioDevice->seekTransport(pos.frame()); audioDevice->seekTransport(pos); @@ -870,8 +870,8 @@ void MidiSeq::alignAllTicks(int frameOverride) mclock2=mclock1=0.0; // set all clock values to "in sync" - recTick = (int) ((double(curFrame)/double(sampleRate)) * - double(config.division * 1000000.0) / double(tempo) //prevent compiler warning: casting double to int + recTick = (int) ((double(curFrame)/double(MusEGlobal::sampleRate)) * + double(MusEConfig::config.division * 1000000.0) / double(tempo) //prevent compiler warning: casting double to int ); songtick1 = recTick - songTickSpan; if (songtick1 < 0) @@ -897,10 +897,10 @@ void MidiSeq::alignAllTicks(int frameOverride) void MidiSeq::realtimeSystemInput(int port, int c) { - if (midiInputTrace) + if (MusEGlobal::midiInputTrace) printf("realtimeSystemInput port:%d 0x%x\n", port+1, c); - //if (midiInputTrace && (rxSyncPort != port) && rxSyncPort != -1) { + //if (MusEGlobal::midiInputTrace && (rxSyncPort != port) && rxSyncPort != -1) { // if (debugSync) // printf("rxSyncPort configured as %d; received sync from port %d\n", // rxSyncPort, port); @@ -967,7 +967,7 @@ void MidiSeq::realtimeSystemInput(int port, int c) { lastExtMidiSyncTime = curExtMidiSyncTime; curExtMidiSyncTime = curTime(); - int div = config.division/24; + int div = MusEConfig::config.division/24; midiExtSyncTicks += div; lastExtMidiSyncTick = curExtMidiSyncTick; curExtMidiSyncTick += div; @@ -1002,11 +1002,11 @@ void MidiSeq::realtimeSystemInput(int port, int c) // Compare w audio if playing: if (playStateExt == true ) { //audio->isPlaying() state == PLAY //BEGIN standard setup: - recTick += config.division / 24; // The one we're syncing to + recTick += MusEConfig::config.division / 24; // The one we're syncing to int tempo = tempomap.tempo(0); unsigned curFrame = audio->pos().frame(); - double songtick = (double(curFrame)/double(sampleRate)) * - double(config.division * 1000000.0) / double(tempo); + double songtick = (double(curFrame)/double(MusEGlobal::sampleRate)) * + double(MusEConfig::config.division * 1000000.0) / double(tempo); double scale = double(tdiff0/averagetimediff); double tickdiff = songtick - ((double) recTick - 24 + scale*24.0); @@ -1017,7 +1017,7 @@ void MidiSeq::realtimeSystemInput(int port, int c) audio->pos().mbt(&m, &b, &t); int song_beat = b + m*4; // if the time-signature is different than 4/4, this will be wrong. - int sync_beat = recTick/config.division; + int sync_beat = recTick/MusEConfig::config.division; printf("pT=%.3f rT=%d diff=%.3f songB=%d syncB=%d scale=%.3f, curFrame=%d", songtick, recTick, tickdiff, song_beat, sync_beat, scale, curFrame); } @@ -1117,11 +1117,11 @@ void MidiSeq::realtimeSystemInput(int port, int c) //if (playStateExt == true ) { //audio->isPlaying() state == PLAY if (0) { //BEGIN standard setup: - recTick += config.division / 24; // The one we're syncing to + recTick += MusEConfig::config.division / 24; // The one we're syncing to int tempo = tempomap.tempo(0); //unsigned curFrame = audio->pos().frame(); - //double songtick = (double(curFrame)/double(sampleRate)) * - // double(config.division * 1000000.0) / double(tempo); + //double songtick = (double(curFrame)/double(MusEGlobal::sampleRate)) * + // double(MusEConfig::config.division * 1000000.0) / double(tempo); double songtick = tempomap.curTickExt(mclock0); double scale = double(tdiff0/averagetimediff); @@ -1133,7 +1133,7 @@ void MidiSeq::realtimeSystemInput(int port, int c) audio->pos().mbt(&m, &b, &t); int song_beat = b + m*4; // if the time-signature is different than 4/4, this will be wrong. - int sync_beat = recTick/config.division; + int sync_beat = recTick/MusEConfig::config.division; printf("pT=%.3f rT=%d diff=%.3f songB=%d syncB=%d scale=%.3f, curFrame=%d averagetimediff:%.3lf", songtick, recTick, tickdiff, song_beat, sync_beat, scale, audio->pos().frame(), averagetimediff); } @@ -1251,7 +1251,7 @@ void MidiSeq::realtimeSystemInput(int port, int c) //printf("midi start:%f\n", curTime()); if (1 /* !audio->isPlaying()*/ /*state == IDLE*/) { - if (!checkAudioDevice()) return; + if (!MusEGlobal::checkAudioDevice()) return; // p3.3.31 // Rew on start option. @@ -1329,8 +1329,8 @@ void MidiSeq::realtimeSystemInput(int port, int c) //playPendingFirstClock = false; - //lastStoppedBeat = (audio->tickPos() * 4) / config.division; - //curExtMidiSyncTick = (config.division * lastStoppedBeat) / 4; + //lastStoppedBeat = (audio->tickPos() * 4) / MusEConfig::config.division; + //curExtMidiSyncTick = (MusEConfig::config.division * lastStoppedBeat) / 4; //printf("stop:%f\n", curTime()); @@ -1346,7 +1346,7 @@ void MidiSeq::realtimeSystemInput(int port, int c) // audio tick position to increment, reset the incrementer and force // the transport position to what the hardware thinks is the current position. //midiExtSyncTicks = 0; - //Pos pos((config.division * lastStoppedBeat) / 4, true); + //Pos pos((MusEConfig::config.division * lastStoppedBeat) / 4, true); //Pos pos(curExtMidiSyncTick, true); //audioDevice->seekTransport(pos); } @@ -1379,7 +1379,7 @@ void MidiSeq::mtcSyncMsg(const MTC& mtc, int type, bool seekFlag) // int tick = tempomap.time2tick(time); //state = PLAY; //write(sigFd, "1", 1); // say PLAY to gui - if (!checkAudioDevice()) return; + if (!MusEGlobal::checkAudioDevice()) return; if (debugSync) printf("MidiSeq::mtcSyncMsg starting transport.\n"); audioDevice->startTransport(); @@ -1388,7 +1388,7 @@ void MidiSeq::mtcSyncMsg(const MTC& mtc, int type, bool seekFlag) /*if (tempoSN != tempomap.tempoSN()) { double cpos = tempomap.tick2time(_midiTick, 0); - samplePosStart = samplePos - lrint(cpos * sampleRate); + samplePosStart = samplePos - lrint(cpos * MusEGlobal::sampleRate); rtcTickStart = rtcTick - lrint(cpos * realRtcTicks); tempoSN = tempomap.tempoSN(); }*/ @@ -1396,7 +1396,7 @@ void MidiSeq::mtcSyncMsg(const MTC& mtc, int type, bool seekFlag) // // diff is the time in sec MusE is out of sync // - /*double diff = time - (double(samplePosStart)/double(sampleRate)); + /*double diff = time - (double(samplePosStart)/double(MusEGlobal::sampleRate)); if (debugSync) printf(" state %d diff %f\n", mtcState, diff); */ diff --git a/muse2/muse/synth.cpp b/muse2/muse/synth.cpp index 5898d96b..467aca72 100644 --- a/muse2/muse/synth.cpp +++ b/muse2/muse/synth.cpp @@ -212,7 +212,7 @@ void* MessSynth::instantiate(const QString& instanceName) //n.setNum(_instances); //QString instanceName = baseName() + "-" + n; - doSetuid(); + MusEGlobal::doSetuid(); QByteArray ba = info.filePath().toLatin1(); const char* path = ba.constData(); @@ -221,7 +221,7 @@ void* MessSynth::instantiate(const QString& instanceName) if (handle == 0) { fprintf(stderr, "Synth::instantiate: dlopen(%s) failed: %s\n", path, dlerror()); - undoSetuid(); + MusEGlobal::undoSetuid(); return 0; } typedef const MESS* (*MESS_Function)(); @@ -235,18 +235,18 @@ void* MessSynth::instantiate(const QString& instanceName) "library file \"%s\": %s.\n" "Are you sure this is a MESS plugin file?\n", info.filePath().toAscii().constData(), txt); - undoSetuid(); + MusEGlobal::undoSetuid(); return 0; } } _descr = msynth(); if (_descr == 0) { fprintf(stderr, "Synth::instantiate: no MESS descr found\n"); - undoSetuid(); + MusEGlobal::undoSetuid(); return 0; } - Mess* mess = _descr->instantiate(sampleRate, muse, &museProject, instanceName.toLatin1().constData()); - undoSetuid(); + Mess* mess = _descr->instantiate(MusEGlobal::sampleRate, MusEGlobal::muse, &MusEGlobal::museProject, instanceName.toLatin1().constData()); + MusEGlobal::undoSetuid(); return mess; } @@ -523,13 +523,13 @@ void SynthI::deactivate3() // Moved below by Tim. p3.3.14 //synthesizer->incInstances(-1); - if(debugMsg) + if(MusEGlobal::debugMsg) printf("SynthI::deactivate3 deleting _sif...\n"); delete _sif; _sif = 0; - if(debugMsg) + if(MusEGlobal::debugMsg) printf("SynthI::deactivate3 decrementing synth instances...\n"); synthesizer->incInstances(-1); @@ -553,6 +553,8 @@ SynthI::~SynthI() deactivate3(); } +namespace MusEApp { + //--------------------------------------------------------- // initMidiSynth // search for software synthis and advertise @@ -560,10 +562,10 @@ SynthI::~SynthI() void initMidiSynth() { - QString s = museGlobalLib + "/synthi"; + QString s = MusEGlobal::museGlobalLib + "/synthi"; QDir pluginDir(s, QString("*.so")); // ddskrjo - if (debugMsg) + if (MusEGlobal::debugMsg) printf("searching for software synthesizer in <%s>\n", s.toLatin1().constData()); if (pluginDir.exists()) { QFileInfoList list = pluginDir.entryInfoList(); @@ -572,7 +574,7 @@ void initMidiSynth() while(it!=list.end()) { fi = &*it; - //doSetuid(); + //MusEGlobal::doSetuid(); QByteArray ba = fi->filePath().toLatin1(); const char* path = ba.constData(); @@ -581,7 +583,7 @@ void initMidiSynth() void* handle = dlopen(path, RTLD_NOW); if (handle == 0) { fprintf(stderr, "initMidiSynth: MESS dlopen(%s) failed: %s\n", path, dlerror()); - //undoSetuid(); + //MusEGlobal::undoSetuid(); //return 0; ++it; continue; @@ -598,7 +600,7 @@ void initMidiSynth() "library file \"%s\": %s.\n" "Are you sure this is a MESS plugin file?\n", path, txt); - //undoSetuid(); + //MusEGlobal::undoSetuid(); //return 0; } #endif @@ -609,14 +611,14 @@ void initMidiSynth() const MESS* descr = msynth(); if (descr == 0) { fprintf(stderr, "initMidiSynth: no MESS descr found in %s\n", path); - //undoSetuid(); + //MusEGlobal::undoSetuid(); //return 0; dlclose(handle); ++it; continue; } - //Mess* mess = descr->instantiate(sampleRate, muse, &museProject, instanceName.toLatin1().constData()); - //undoSetuid(); + //Mess* mess = descr->instantiate(MusEGlobal::sampleRate, muse, &museProject, instanceName.toLatin1().constData()); + //MusEGlobal::undoSetuid(); @@ -627,10 +629,12 @@ void initMidiSynth() dlclose(handle); ++it; } - if (debugMsg) + if (MusEGlobal::debugMsg) printf("%zd soft synth found\n", synthis.size()); } } +} // namespace MusEApp + //--------------------------------------------------------- // createSynthI @@ -1068,7 +1072,7 @@ iMPEvent MessSynthIF::getData(MidiPort* mp, MPEventList* el, iMPEvent i, unsigne bool MessSynthIF::putEvent(const MidiPlayEvent& ev) { - if (midiOutputTrace) + if (MusEGlobal::midiOutputTrace) ev.dump(); if (_mess) return _mess->processEvent(ev); diff --git a/muse2/muse/tempo.cpp b/muse2/muse/tempo.cpp index c8c66e4c..e41e39c6 100644 --- a/muse2/muse/tempo.cpp +++ b/muse2/muse/tempo.cpp @@ -83,8 +83,8 @@ void TempoList::normalize() for (iTEvent e = begin(); e != end(); ++e) { e->second->frame = frame; unsigned dtick = e->first - e->second->tick; - double dtime = double(dtick) / (config.division * _globalTempo * 10000.0/e->second->tempo); - frame += lrint(dtime * sampleRate); + double dtime = double(dtick) / (MusEConfig::config.division * _globalTempo * 10000.0/e->second->tempo); + frame += lrint(dtime * MusEGlobal::sampleRate); } } @@ -270,13 +270,13 @@ unsigned TempoList::tick2frame(unsigned tick, int* sn) const return 0; } unsigned dtick = tick - i->second->tick; - double dtime = double(dtick) / (config.division * _globalTempo * 10000.0/ i->second->tempo); - unsigned dframe = lrint(dtime * sampleRate); + double dtime = double(dtick) / (MusEConfig::config.division * _globalTempo * 10000.0/ i->second->tempo); + unsigned dframe = lrint(dtime * MusEGlobal::sampleRate); f = i->second->frame + dframe; } else { - double t = (double(tick) * double(_tempo)) / (double(config.division) * _globalTempo * 10000.0); - f = lrint(t * sampleRate); + double t = (double(tick) * double(_tempo)) / (double(MusEConfig::config.division) * _globalTempo * 10000.0); + f = lrint(t * MusEGlobal::sampleRate); } if (sn) *sn = _tempoSN; @@ -313,11 +313,11 @@ unsigned TempoList::frame2tick(unsigned frame, int* sn) const } unsigned te = e->second->tempo; int dframe = frame - e->second->frame; - double dtime = double(dframe) / double(sampleRate); - tick = e->second->tick + lrint(dtime * _globalTempo * config.division * 10000.0 / te); + double dtime = double(dframe) / double(MusEGlobal::sampleRate); + tick = e->second->tick + lrint(dtime * _globalTempo * MusEConfig::config.division * 10000.0 / te); } else - tick = lrint((double(frame)/double(sampleRate)) * _globalTempo * config.division * 10000.0 / double(_tempo)); + tick = lrint((double(frame)/double(MusEGlobal::sampleRate)) * _globalTempo * MusEConfig::config.division * 10000.0 / double(_tempo)); if (sn) *sn = _tempoSN; return tick; @@ -338,8 +338,8 @@ unsigned TempoList::deltaTick2frame(unsigned tick1, unsigned tick2, int* sn) con return 0; } unsigned dtick = tick1 - i->second->tick; - double dtime = double(dtick) / (config.division * _globalTempo * 10000.0/ i->second->tempo); - unsigned dframe = lrint(dtime * sampleRate); + double dtime = double(dtick) / (MusEConfig::config.division * _globalTempo * 10000.0/ i->second->tempo); + unsigned dframe = lrint(dtime * MusEGlobal::sampleRate); f1 = i->second->frame + dframe; i = upper_bound(tick2); @@ -347,16 +347,16 @@ unsigned TempoList::deltaTick2frame(unsigned tick1, unsigned tick2, int* sn) con return 0; } dtick = tick2 - i->second->tick; - dtime = double(dtick) / (config.division * _globalTempo * 10000.0/ i->second->tempo); - dframe = lrint(dtime * sampleRate); + dtime = double(dtick) / (MusEConfig::config.division * _globalTempo * 10000.0/ i->second->tempo); + dframe = lrint(dtime * MusEGlobal::sampleRate); f2 = i->second->frame + dframe; } else { - double t = (double(tick1) * double(_tempo)) / (double(config.division) * _globalTempo * 10000.0); - f1 = lrint(t * sampleRate); + double t = (double(tick1) * double(_tempo)) / (double(MusEConfig::config.division) * _globalTempo * 10000.0); + f1 = lrint(t * MusEGlobal::sampleRate); - t = (double(tick2) * double(_tempo)) / (double(config.division) * _globalTempo * 10000.0); - f2 = lrint(t * sampleRate); + t = (double(tick2) * double(_tempo)) / (double(MusEConfig::config.division) * _globalTempo * 10000.0); + f2 = lrint(t * MusEGlobal::sampleRate); } if (sn) *sn = _tempoSN; @@ -386,8 +386,8 @@ unsigned TempoList::deltaFrame2tick(unsigned frame1, unsigned frame2, int* sn) c } unsigned te = e->second->tempo; int dframe = frame1 - e->second->frame; - double dtime = double(dframe) / double(sampleRate); - tick1 = e->second->tick + lrint(dtime * _globalTempo * config.division * 10000.0 / te); + double dtime = double(dframe) / double(MusEGlobal::sampleRate); + tick1 = e->second->tick + lrint(dtime * _globalTempo * MusEConfig::config.division * 10000.0 / te); for (e = begin(); e != end();) { ciTEvent ee = e; @@ -400,13 +400,13 @@ unsigned TempoList::deltaFrame2tick(unsigned frame1, unsigned frame2, int* sn) c } te = e->second->tempo; dframe = frame2 - e->second->frame; - dtime = double(dframe) / double(sampleRate); - tick2 = e->second->tick + lrint(dtime * _globalTempo * config.division * 10000.0 / te); + dtime = double(dframe) / double(MusEGlobal::sampleRate); + tick2 = e->second->tick + lrint(dtime * _globalTempo * MusEConfig::config.division * 10000.0 / te); } else { - tick1 = lrint((double(frame1)/double(sampleRate)) * _globalTempo * config.division * 10000.0 / double(_tempo)); - tick2 = lrint((double(frame2)/double(sampleRate)) * _globalTempo * config.division * 10000.0 / double(_tempo)); + tick1 = lrint((double(frame1)/double(MusEGlobal::sampleRate)) * _globalTempo * MusEConfig::config.division * 10000.0 / double(_tempo)); + tick2 = lrint((double(frame2)/double(MusEGlobal::sampleRate)) * _globalTempo * MusEConfig::config.division * 10000.0 / double(_tempo)); } if (sn) *sn = _tempoSN; diff --git a/muse2/muse/thread.cpp b/muse2/muse/thread.cpp index 36d5b31f..ce11fba6 100644 --- a/muse2/muse/thread.cpp +++ b/muse2/muse/thread.cpp @@ -79,7 +79,7 @@ void Thread::start(int prio, void* ptr) //if (_realTimePriority) { - if (realTimeScheduling && _realTimePriority > 0) { // p4.0.16 + if (MusEGlobal::realTimeScheduling && _realTimePriority > 0) { // p4.0.16 attributes = (pthread_attr_t*) malloc(sizeof(pthread_attr_t)); pthread_attr_init(attributes); @@ -117,11 +117,11 @@ void Thread::start(int prio, void* ptr) int rv = pthread_create(&thread, attributes, ::loop, this); if(rv) { - // p4.0.16: realTimeScheduling is unreliable. It is true even in some clearly non-RT cases. + // p4.0.16: MusEGlobal::realTimeScheduling is unreliable. It is true even in some clearly non-RT cases. // I cannot seem to find a reliable answer to the question of "are we RT or not". // MusE was failing with a stock kernel because of PTHREAD_EXPLICIT_SCHED. // So we'll just have to try again without attributes. - if (realTimeScheduling && _realTimePriority > 0) + if (MusEGlobal::realTimeScheduling && _realTimePriority > 0) rv = pthread_create(&thread, NULL, ::loop, this); } @@ -181,7 +181,7 @@ Thread::Thread(const char* s) _pollWait = -1; thread = 0; - //if (debugMsg) + //if (MusEGlobal::debugMsg) // printf("Start thread %s with priority %d\n", s, prio); // create message channels @@ -264,7 +264,7 @@ void Thread::loop() { // Changed by Tim. p3.3.17 - if (!debugMode) { + if (!MusEGlobal::debugMode) { if (mlockall(MCL_CURRENT | MCL_FUTURE)) perror("WARNING: Cannot lock memory:"); } @@ -274,7 +274,7 @@ void Thread::loop() attributes = (pthread_attr_t*) malloc(sizeof(pthread_attr_t)); pthread_attr_init(attributes); - if (realTimeScheduling && realTimePriority > 0) { + if (MusEGlobal::realTimeScheduling && realTimePriority > 0) { doSetuid(); // if (pthread_attr_setschedpolicy(attributes, SCHED_FIFO)) { @@ -298,7 +298,7 @@ void Thread::loop() if (error != 0) perror( "error set_schedparam 2:"); -// if (!debugMode) { +// if (!MusEGlobal::debugMode) { // if (mlockall(MCL_CURRENT|MCL_FUTURE)) // perror("WARNING: Cannot lock memory:"); // } @@ -336,12 +336,12 @@ void Thread::loop() } /* - if (debugMsg) + if (MusEGlobal::debugMsg) printf("Thread <%s> set to %s priority %d\n", _name, policy == SCHED_FIFO ? "SCHED_FIFO" : "SCHED_OTHER", realTimePriority); */ - if (debugMsg) + if (MusEGlobal::debugMsg) printf("Thread <%s, id %p> has %s priority %d\n", _name, (void *)pthread_self(), policy == SCHED_FIFO ? "SCHED_FIFO" : "SCHED_OTHER", policy == SCHED_FIFO ? _realTimePriority : 0); @@ -355,7 +355,7 @@ void Thread::loop() threadStart(userPtr); while (_running) { - if (debugMode) // DEBUG + if (MusEGlobal::debugMode) // DEBUG _pollWait = 10; // ms else _pollWait = -1; diff --git a/muse2/muse/ticksynth.cpp b/muse2/muse/ticksynth.cpp index 92aa20fe..41e0a170 100644 --- a/muse2/muse/ticksynth.cpp +++ b/muse2/muse/ticksynth.cpp @@ -202,7 +202,7 @@ void MetronomeSynthIF::process(float** buffer, int offset, int n) int l = std::min(n, len); for (int i = 0; i < l; ++i) - *d++ += *s++ * audioClickVolume; + *d++ += *s++ * MusEGlobal::audioClickVolume; pos += l; len -= l; if (len <= 0) diff --git a/muse2/muse/track.cpp b/muse2/muse/track.cpp index 65c64392..57c4a658 100644 --- a/muse2/muse/track.cpp +++ b/muse2/muse/track.cpp @@ -155,7 +155,7 @@ int Track::y() const yy += (*it)->height(); } // FIXME Get this when loading a song with automation graphs showing. Benign. Likely song not fully loaded yet. p4.0.32 - if(debugMsg) + if(MusEGlobal::debugMsg) printf("Track::y(%s): track not in tracklist\n", name().toLatin1().constData()); return -1; } diff --git a/muse2/muse/transport.cpp b/muse2/muse/transport.cpp index 55bb187a..e51a1676 100644 --- a/muse2/muse/transport.cpp +++ b/muse2/muse/transport.cpp @@ -92,7 +92,7 @@ Handle::Handle(QWidget* r, QWidget* parent) setFixedWidth(20); setCursor(Qt::PointingHandCursor); QPalette palette; - palette.setColor(this->backgroundRole(), config.transportHandleColor); + palette.setColor(this->backgroundRole(), MusEConfig::config.transportHandleColor); this->setPalette(palette); setAutoFillBackground(true); } @@ -152,7 +152,7 @@ TempoSig::TempoSig(QWidget* parent) vb1->addWidget(f); l3 = new QLabel(tr("Tempo/Sig")); - l3->setFont(config.fonts[2]); + l3->setFont(MusEConfig::config.fonts[2]); vb1->addWidget(l3); l1->setBackgroundRole(QPalette::Light); @@ -167,7 +167,7 @@ TempoSig::TempoSig(QWidget* parent) connect(l1, SIGNAL(valueChanged(double,int)), SLOT(setTempo(double))); ///connect(l2, SIGNAL(valueChanged(int,int)), SIGNAL(sigChanged(int,int))); connect(l2, SIGNAL(valueChanged(const AL::TimeSignature&)), SIGNAL(sigChanged(const AL::TimeSignature&))); - connect(muse, SIGNAL(configChanged()), SLOT(configChanged())); + connect(MusEGlobal::muse, SIGNAL(configChanged()), SLOT(configChanged())); this->setLayout(vb1); } @@ -178,7 +178,7 @@ TempoSig::TempoSig(QWidget* parent) void TempoSig::configChanged() { - l3->setFont(config.fonts[2]); + l3->setFont(MusEConfig::config.fonts[2]); } //--------------------------------------------------------- @@ -263,7 +263,7 @@ Transport::Transport(QWidget* parent, const char* name) box1->addWidget(recMode); l2 = new QLabel(tr("Rec Mode")); - l2->setFont(config.fonts[2]); + l2->setFont(MusEConfig::config.fonts[2]); l2->setAlignment(Qt::AlignCenter); connect(recMode, SIGNAL(activated(int)), SLOT(setRecMode(int))); box1->addWidget(l2); @@ -278,7 +278,7 @@ Transport::Transport(QWidget* parent, const char* name) box1->addWidget(cycleMode); l3 = new QLabel(tr("Cycle Rec")); - l3->setFont(config.fonts[2]); + l3->setFont(MusEConfig::config.fonts[2]); l3->setAlignment(Qt::AlignCenter); connect(cycleMode, SIGNAL(activated(int)), SLOT(setCycleMode(int))); box1->addWidget(l3); @@ -340,7 +340,7 @@ Transport::Transport(QWidget* parent, const char* name) marken->addWidget(tl1); l5 = new QLabel(tr("Left Mark")); - l5->setFont(config.fonts[2]); + l5->setFont(MusEConfig::config.fonts[2]); l5->setAlignment(Qt::AlignCenter); marken->addWidget(l5); @@ -352,7 +352,7 @@ Transport::Transport(QWidget* parent, const char* name) tl2->setFocusPolicy(Qt::NoFocus); l6 = new QLabel(tr("Right Mark")); - l6->setFont(config.fonts[2]); + l6->setFont(MusEConfig::config.fonts[2]); l6->setAlignment(Qt::AlignCenter); marken->addWidget(l6); @@ -517,7 +517,7 @@ Transport::Transport(QWidget* parent, const char* name) connect(tempo, SIGNAL(sigChanged(const AL::TimeSignature&)), song, SLOT(setSig(const AL::TimeSignature&))); connect(song, SIGNAL(playChanged(bool)), SLOT(setPlay(bool))); connect(song, SIGNAL(songChanged(int)), this, SLOT(songChanged(int))); - connect(muse, SIGNAL(configChanged()), SLOT(configChanged())); + connect(MusEGlobal::muse, SIGNAL(configChanged()), SLOT(configChanged())); this->setLayout(hbox); @@ -536,13 +536,13 @@ Transport::~Transport() void Transport::configChanged() { - l2->setFont(config.fonts[2]); - l3->setFont(config.fonts[2]); - l5->setFont(config.fonts[2]); - l6->setFont(config.fonts[2]); + l2->setFont(MusEConfig::config.fonts[2]); + l3->setFont(MusEConfig::config.fonts[2]); + l5->setFont(MusEConfig::config.fonts[2]); + l6->setFont(MusEConfig::config.fonts[2]); QPalette pal; - pal.setColor(lefthandle->backgroundRole(), config.transportHandleColor); + pal.setColor(lefthandle->backgroundRole(), MusEConfig::config.transportHandleColor); lefthandle->setPalette(pal); righthandle->setPalette(pal); } @@ -771,11 +771,11 @@ void Transport::syncChanged(bool flag) } else tempo->setTempo(tempomap.tempo(song->cpos())); - playAction->setEnabled(!flag); - startAction->setEnabled(!flag); - stopAction->setEnabled(!flag); - rewindAction->setEnabled(!flag); - forwardAction->setEnabled(!flag); + MusEGlobal::playAction->setEnabled(!flag); + MusEGlobal::startAction->setEnabled(!flag); + MusEGlobal::stopAction->setEnabled(!flag); + MusEGlobal::rewindAction->setEnabled(!flag); + MusEGlobal::forwardAction->setEnabled(!flag); } void Transport::jackSyncChanged(bool flag) diff --git a/muse2/muse/undo.cpp b/muse2/muse/undo.cpp index 571c7e99..c0191362 100644 --- a/muse2/muse/undo.cpp +++ b/muse2/muse/undo.cpp @@ -204,7 +204,7 @@ void UndoList::clearDelete() void Song::startUndo() { redoList->clear(); // added by flo93: redo must be invalidated when - redoAction->setEnabled(false); // a new undo is started + MusEGlobal::redoAction->setEnabled(false); // a new undo is started undoList->push_back(Undo()); updateFlags = 0; @@ -267,12 +267,12 @@ bool Song::applyOperationGroup(Undo& group, bool doUndo) if (!doUndo) { undoList->pop_back(); - undoAction->setEnabled(!undoList->empty()); + MusEGlobal::undoAction->setEnabled(!undoList->empty()); } else { redoList->clear(); // added by flo93: redo must be invalidated when - redoAction->setEnabled(false); // a new undo is started + MusEGlobal::redoAction->setEnabled(false); // a new undo is started } return doUndo; diff --git a/muse2/muse/wave.cpp b/muse2/muse/wave.cpp index abb7d31d..584d2882 100644 --- a/muse2/muse/wave.cpp +++ b/muse2/muse/wave.cpp @@ -637,12 +637,12 @@ SndFile* getWave(const QString& inName, bool readOnlyFlag) QString name = inName; if (QFileInfo(name).isRelative()) { - name = museProject + QString("/") + name; + name = MusEGlobal::museProject + QString("/") + name; } else { if (!QFile::exists(name)) { - if (QFile::exists(museProject + QString("/") + name)) { - name = museProject + QString("/") + name; + if (QFile::exists(MusEGlobal::museProject + QString("/") + name)) { + name = MusEGlobal::museProject + QString("/") + name; } } } @@ -807,6 +807,8 @@ void SndFile::applyUndoFile(const QString& original, const QString& tmpfile, uns audio->msgIdle(false); } +namespace MusEApp { + //--------------------------------------------------------- // importAudio //--------------------------------------------------------- @@ -820,11 +822,11 @@ void MusE::importWave() "a wave track")); return; } - //QString fn = getOpenFileName(lastWavePath, audioFilePattern, this, - QString fn = getOpenFileName(lastWavePath, audio_file_pattern, this, + //QString fn = getOpenFileName(MusEGlobal::lastWavePath, audioFilePattern, this, + QString fn = getOpenFileName(MusEGlobal::lastWavePath, MusEGlobal::audio_file_pattern, this, tr("Import Wave File"), 0); if (!fn.isEmpty()) { - lastWavePath = fn; + MusEGlobal::lastWavePath = fn; importWaveToTrack(fn); } } @@ -845,11 +847,11 @@ bool MusE::importWaveToTrack(QString& name, unsigned tick, Track* track) return true; } int samples = f->samples(); - if ((unsigned)sampleRate !=f->samplerate()) { + if ((unsigned)MusEGlobal::sampleRate !=f->samplerate()) { if(QMessageBox::question(this, tr("Import Wavefile"), tr("This wave file has a samplerate of %1,\n" "as opposed to current setting %2.\n" - "Do you still want to import it?").arg(f->samplerate()).arg(sampleRate), + "Do you still want to import it?").arg(f->samplerate()).arg(MusEGlobal::sampleRate), tr("&Yes"), tr("&No"), QString::null, 0, 1 )) { @@ -882,6 +884,9 @@ bool MusE::importWaveToTrack(QString& name, unsigned tick, Track* track) song->setLen(endTick); return false; } + +} // namespace MusEApp + #if 0 //--------------------------------------------------------- // Clip @@ -953,7 +958,7 @@ void ClipBase::write(int level, Xml& xml) const // waves in the project dirctory are stored // with relative path name, others with absolute path // - if (path == museProject) + if (path == MusEGlobal::museProject) xml.strTag(level, "file", f.name()); else xml.strTag(level, "file", f.path()); @@ -1059,7 +1064,7 @@ int ClipList::idx(const Clip& clip) const //void Song::cmdAddRecordedWave(WaveTrack* track, const Pos& s, const Pos& e) void Song::cmdAddRecordedWave(WaveTrack* track, Pos s, Pos e) { - if (debugMsg) + if (MusEGlobal::debugMsg) printf("cmdAddRecordedWave - loopCount = %d, punchin = %d", audio->loopCount(), punchin()); SndFile* f = track->recFile(); @@ -1091,7 +1096,7 @@ void Song::cmdAddRecordedWave(WaveTrack* track, Pos s, Pos e) // The function which calls this function already does this immediately after. But do it here anyway. track->setRecFile(0); remove(st.toLatin1().constData()); - if(debugMsg) + if(MusEGlobal::debugMsg) printf("Song::cmdAddRecordedWave: remove file %s - start=%d end=%d\n", st.toLatin1().constData(), s.tick(), e.tick()); return; } diff --git a/muse2/muse/waveedit/waveedit.cpp b/muse2/muse/waveedit/waveedit.cpp index 0586d778..7ba69e95 100644 --- a/muse2/muse/waveedit/waveedit.cpp +++ b/muse2/muse/waveedit/waveedit.cpp @@ -173,15 +173,15 @@ WaveEdit::WaveEdit(PartList* pl) tools = addToolBar(tr("Wave edit tools")); tools->setObjectName("Wave edit tools"); - tools->addActions(undoRedo->actions()); + tools->addActions(MusEGlobal::undoRedo->actions()); - connect(muse, SIGNAL(configChanged()), SLOT(configChanged())); + connect(MusEGlobal::muse, SIGNAL(configChanged()), SLOT(configChanged())); //-------------------------------------------------- // Transport Bar QToolBar* transport = addToolBar(tr("transport")); transport->setObjectName("transport"); - transport->addActions(transportAction->actions()); + transport->addActions(MusEGlobal::transportAction->actions()); //-------------------------------------------------- // ToolBar: Solo Cursor1 Cursor2 @@ -305,7 +305,7 @@ void WaveEdit::initShortcuts() void WaveEdit::configChanged() { - view->setBg(config.waveEditBackgroundColor); + view->setBg(MusEConfig::config.waveEditBackgroundColor); selectAllAction->setShortcut(shortcuts[SHRT_SELECT_ALL].key); selectNoneAction->setShortcut(shortcuts[SHRT_SELECT_NONE].key); } @@ -349,7 +349,7 @@ void WaveEdit::setTime(unsigned samplepos) WaveEdit::~WaveEdit() { - // undoRedo->removeFrom(tools); // p4.0.6 Removed + // MusEGlobal::undoRedo->removeFrom(tools); // p4.0.6 Removed } //--------------------------------------------------------- @@ -373,7 +373,7 @@ void WaveEdit::readConfiguration(Xml& xml) switch (token) { case Xml::TagStart: if (tag == "bgcolor") - config.waveEditBackgroundColor = readColor(xml); + MusEConfig::config.waveEditBackgroundColor = readColor(xml); else if (tag == "width") _widthInit = xml.parseInt(); else if (tag == "height") @@ -402,7 +402,7 @@ void WaveEdit::readConfiguration(Xml& xml) void WaveEdit::writeConfiguration(int level, Xml& xml) { xml.tag(level++, "waveedit"); - xml.colorTag(level, "bgcolor", config.waveEditBackgroundColor); + xml.colorTag(level, "bgcolor", MusEConfig::config.waveEditBackgroundColor); xml.intTag(level, "width", _widthInit); xml.intTag(level, "height", _heightInit); xml.strTag(level, "toolbars", _toolbarInit.toHex().data()); diff --git a/muse2/muse/waveedit/waveview.cpp b/muse2/muse/waveedit/waveview.cpp index fa9699c4..b28b1914 100644 --- a/muse2/muse/waveedit/waveview.cpp +++ b/muse2/muse/waveedit/waveview.cpp @@ -728,7 +728,7 @@ void WaveView::modifySelection(int operation, unsigned startpos, unsigned stoppo unsigned file_channels = file.channels(); QString tmpWavFile = QString::null; - if (!getUniqueTmpfileName("tmp_musewav",".wav", tmpWavFile)) { + if (!MusEGlobal::getUniqueTmpfileName("tmp_musewav",".wav", tmpWavFile)) { break; } @@ -834,7 +834,7 @@ void WaveView::copySelection(unsigned file_channels, float** tmpdata, unsigned l if (copiedPart!="") { QFile::remove(copiedPart); } - if (!getUniqueTmpfileName("tmp_musewav",".wav", copiedPart)) { + if (!MusEGlobal::getUniqueTmpfileName("tmp_musewav",".wav", copiedPart)) { return; } @@ -951,7 +951,7 @@ void WaveView::editExternal(unsigned file_format, unsigned file_samplerate, unsi { // Create yet another tmp-file QString exttmpFileName; - if (!getUniqueTmpfileName("tmp_musewav",".wav", exttmpFileName)) { + if (!MusEGlobal::getUniqueTmpfileName("tmp_musewav",".wav", exttmpFileName)) { printf("Could not create temp file - aborting...\n"); return; } @@ -969,7 +969,7 @@ void WaveView::editExternal(unsigned file_format, unsigned file_samplerate, unsi // Forkaborkabork int pid = fork(); if (pid == 0) { - if (execlp(config.externalWavEditor.toLatin1().constData(), config.externalWavEditor.toLatin1().constData(), exttmpFileName.toLatin1().constData(), NULL) == -1) { + if (execlp(MusEConfig::config.externalWavEditor.toLatin1().constData(), MusEConfig::config.externalWavEditor.toLatin1().constData(), exttmpFileName.toLatin1().constData(), NULL) == -1) { perror("Failed to launch external editor"); // Get out of here diff --git a/muse2/muse/waveevent.cpp b/muse2/muse/waveevent.cpp index 715dbee5..759e8991 100644 --- a/muse2/muse/waveevent.cpp +++ b/muse2/muse/waveevent.cpp @@ -150,10 +150,10 @@ void WaveEventBase::write(int level, Xml& xml, const Pos& offset, bool forcePath // QString path = f.dirPath(); - //if (path.contains(museProject)) { - if (!forcePath && path.contains(museProject)) { - // extract museProject. - QString newName = f.path().remove(museProject+"/"); + //if (path.contains(MusEGlobal::museProject)) { + if (!forcePath && path.contains(MusEGlobal::museProject)) { + // extract MusEGlobal::museProject. + QString newName = f.path().remove(MusEGlobal::museProject+"/"); xml.strTag(level, "file", newName); } else diff --git a/muse2/muse/wavetrack.cpp b/muse2/muse/wavetrack.cpp index 4b185fae..efc0b274 100644 --- a/muse2/muse/wavetrack.cpp +++ b/muse2/muse/wavetrack.cpp @@ -116,19 +116,19 @@ void WaveTrack::fetchData(unsigned pos, unsigned samples, float** bp, bool doSee } } - if(config.useDenormalBias) { + if(MusEConfig::config.useDenormalBias) { // add denormal bias to outdata for (int i = 0; i < channels(); ++i) for (unsigned int j = 0; j < samples; ++j) { - bp[i][j] +=denormalBias; + bp[i][j] +=MusEGlobal::denormalBias; /* // p3.3.41 if(j & 1) - bp[i][j] -=denormalBias; + bp[i][j] -=MusEGlobal::denormalBias; else - bp[i][j] +=denormalBias; + bp[i][j] +=MusEGlobal::denormalBias; */ } } @@ -219,7 +219,7 @@ Part* WaveTrack::newPart(Part*p, bool clone) bool WaveTrack::getData(unsigned framePos, int channels, unsigned nframe, float** bp) { - //if(debugMsg) + //if(MusEGlobal::debugMsg) // printf("WaveTrack::getData framePos:%u channels:%d nframe:%u processed?:%d\n", framePos, channels, nframe, processed()); if ((song->bounceTrack != this) && !noInRoute()) { @@ -227,7 +227,7 @@ bool WaveTrack::getData(unsigned framePos, int channels, unsigned nframe, float* ciRoute i = irl->begin(); if(i->track->isMidiTrack()) { - if(debugMsg) + if(MusEGlobal::debugMsg) printf("WaveTrack::getData: Error: First route is a midi track route!\n"); return false; } @@ -244,7 +244,7 @@ bool WaveTrack::getData(unsigned framePos, int channels, unsigned nframe, float* { if(i->track->isMidiTrack()) { - if(debugMsg) + if(MusEGlobal::debugMsg) printf("WaveTrack::getData: Error: Route is a midi track route!\n"); //return false; continue; @@ -296,7 +296,7 @@ bool WaveTrack::getData(unsigned framePos, int channels, unsigned nframe, float* if (pos != framePos) { printf("fifo get error expected %d, got %d\n", framePos, pos); - if (debugMsg) + if (MusEGlobal::debugMsg) printf("fifo get error expected %d, got %d\n", framePos, pos); while (pos < framePos) { @@ -335,7 +335,7 @@ bool WaveTrack::getData(unsigned framePos, int channels, unsigned nframe, float* return false; } if (pos != framePos) { - if (debugMsg) + if (MusEGlobal::debugMsg) printf("fifo get error expected %d, got %d\n", framePos, pos); while (pos < framePos) { diff --git a/muse2/muse/widgets/aboutbox_impl.cpp b/muse2/muse/widgets/aboutbox_impl.cpp index 7eeaf3f8..36ba299e 100644 --- a/muse2/muse/widgets/aboutbox_impl.cpp +++ b/muse2/muse/widgets/aboutbox_impl.cpp @@ -24,6 +24,8 @@ #include "config.h" #include "icons.h" +namespace MusEWidget { + AboutBoxImpl::AboutBoxImpl() { setupUi(this); @@ -32,3 +34,5 @@ AboutBoxImpl::AboutBoxImpl() QString svnrevision(SVNVERSION); versionLabel->setText("Version: " + version + " (svn revision: "+ svnrevision +")"); } + +} diff --git a/muse2/muse/widgets/aboutbox_impl.h b/muse2/muse/widgets/aboutbox_impl.h index 2fe134e1..3ad3cd93 100644 --- a/muse2/muse/widgets/aboutbox_impl.h +++ b/muse2/muse/widgets/aboutbox_impl.h @@ -25,6 +25,8 @@ #include "ui_aboutbox.h" +namespace MusEWidget { + class AboutBoxImpl : public QDialog, public Ui::AboutBox { Q_OBJECT @@ -35,4 +37,6 @@ public: }; +} + #endif // ABOUTBOXIMPL_H diff --git a/muse2/muse/widgets/action.h b/muse2/muse/widgets/action.h index 3bb01cb8..efc7c2ee 100644 --- a/muse2/muse/widgets/action.h +++ b/muse2/muse/widgets/action.h @@ -25,6 +25,8 @@ #include <QAction> +namespace MusEWidget { + //--------------------------------------------------------- // Action //--------------------------------------------------------- @@ -43,6 +45,7 @@ class Action : public QAction { int id() const { return _id; } }; +} #endif diff --git a/muse2/muse/widgets/bigtime.cpp b/muse2/muse/widgets/bigtime.cpp index 22dfc136..572710e2 100644 --- a/muse2/muse/widgets/bigtime.cpp +++ b/muse2/muse/widgets/bigtime.cpp @@ -35,6 +35,8 @@ extern int mtcType; +namespace MusEWidget { + // // the bigtime widget // display is split into several parts to avoid flickering. @@ -187,8 +189,8 @@ void BigTime::fmtButtonToggled(bool v) void BigTime::configChanged() { - setBgColor(config.bigTimeBackgroundColor); - setFgColor(config.bigTimeForegroundColor); + setBgColor(MusEConfig::config.bigTimeBackgroundColor); + setFgColor(MusEConfig::config.bigTimeForegroundColor); } //--------------------------------------------------------- @@ -230,7 +232,7 @@ bool BigTime::setString(unsigned v) int bar, beat; unsigned tick; AL::sigmap.tickValues(v, &bar, &beat, &tick); - double time = double(absFrame)/double(sampleRate); + double time = double(absFrame)/double(MusEGlobal::sampleRate); //int hour = int(time) / 3600; //int min = (int(time) / 60) % 60; int min = int(time) / 60; @@ -357,8 +359,8 @@ void BigTime::resizeEvent(QResizeEvent *ev) //dwin->setFont(f); QString fstr = QString("font-size:%1px; font-family:'Courier'; ").arg(fs); // Tim p4.0.8 dwin->setStyleSheet(fstr); - setBgColor(config.bigTimeBackgroundColor); - setFgColor(config.bigTimeForegroundColor); + setBgColor(MusEConfig::config.bigTimeBackgroundColor); + setFgColor(MusEConfig::config.bigTimeForegroundColor); int digitWidth = dwin->fontMetrics().width(QString("0")); int vspace = (ev->size().height() - (fs*2)) / 3; @@ -468,3 +470,4 @@ void BigTime::setBgColor(QColor c) setPalette(newpalette); } +} // namespace MusEWidget diff --git a/muse2/muse/widgets/bigtime.h b/muse2/muse/widgets/bigtime.h index c7fb0653..636abfb3 100644 --- a/muse2/muse/widgets/bigtime.h +++ b/muse2/muse/widgets/bigtime.h @@ -28,7 +28,11 @@ class QCheckBox; class QLabel; +namespace MusEApp { class MusE; +} + +namespace MusEWidget { //--------------------------------------------------------- // BigTime @@ -38,7 +42,7 @@ class BigTime : public QWidget { Q_OBJECT bool tickmode; - MusE* seq; + MusEApp::MusE* seq; bool setString(unsigned); @@ -74,4 +78,6 @@ class BigTime : public QWidget { BigTime(QWidget* parent); }; +} // namespace MusEWidget + #endif diff --git a/muse2/muse/widgets/canvas.cpp b/muse2/muse/widgets/canvas.cpp index 4b674006..c498bfd1 100644 --- a/muse2/muse/widgets/canvas.cpp +++ b/muse2/muse/widgets/canvas.cpp @@ -46,6 +46,8 @@ #define ABS(x) ((x) < 0) ? -(x) : (x) +namespace MusEWidget { + //--------------------------------------------------------- // Canvas //--------------------------------------------------------- @@ -1540,3 +1542,5 @@ void Canvas::setCurrentPart(Part* part) curPartId = curPart->sn(); curPartChanged(); } + +} // namespace MusEWidget diff --git a/muse2/muse/widgets/canvas.h b/muse2/muse/widgets/canvas.h index 62d6c09d..553ef407 100644 --- a/muse2/muse/widgets/canvas.h +++ b/muse2/muse/widgets/canvas.h @@ -35,6 +35,8 @@ class QMenu; +namespace MusEWidget { + //--------------------------------------------------------- // Canvas //--------------------------------------------------------- @@ -195,5 +197,8 @@ class Canvas : public View { void setCurrentPart(Part*); void setCanvasTools(int n) { canvasTools = n; } }; + +} // namespace MusEWidget + #endif diff --git a/muse2/muse/widgets/filedialog.cpp b/muse2/muse/widgets/filedialog.cpp index 19714194..ada1505c 100644 --- a/muse2/muse/widgets/filedialog.cpp +++ b/muse2/muse/widgets/filedialog.cpp @@ -34,6 +34,7 @@ #include "../globals.h" #include "gconfig.h" + MFileDialog::ViewType MFileDialog::lastViewUsed = GLOBAL_VIEW; //QString MFileDialog::lastUserDir = ""; //QString MFileDialog::lastGlobalDir = ""; @@ -102,7 +103,7 @@ void MFileDialog::globalToggled(bool flag) buttons.userButton->setChecked(!flag); buttons.projectButton->setChecked(!flag); if (lastGlobalDir.isEmpty()) - lastGlobalDir = museGlobalShare + QString("/") + baseDir; // Initialize if first time + lastGlobalDir = MusEGlobal::museGlobalShare + QString("/") + baseDir; // Initialize if first time QString dir = lastGlobalDir; setDirectory(dir); lastViewUsed = GLOBAL_VIEW; @@ -121,11 +122,11 @@ void MFileDialog::userToggled(bool flag) if (lastUserDir.isEmpty()) { - lastUserDir = museUser + QString("/") + baseDir; // Initialize if first time + lastUserDir = MusEGlobal::museUser + QString("/") + baseDir; // Initialize if first time } if (testDirCreate(this, lastUserDir)) - setDirectory(museUser); + setDirectory(MusEGlobal::museUser); else setDirectory(lastUserDir); @@ -144,17 +145,17 @@ void MFileDialog::projectToggled(bool flag) buttons.userButton->setChecked(!flag); QString s; - if (museProject == museProjectInitPath ) { + if (MusEGlobal::museProject == MusEGlobal::museProjectInitPath ) { // if project path is uninitialized, meaning it is still set to museProjectInitPath. // then project path is set to current pwd instead. //s = QString(getcwd(0,0)) + QString("/"); - s = config.projectBaseFolder; + s = MusEConfig::config.projectBaseFolder; } else - s = museProject + QString("/"); // + baseDir; + s = MusEGlobal::museProject + QString("/"); // + baseDir; if (testDirCreate(this, s)) - setDirectory(museProject); + setDirectory(MusEGlobal::museProject); else setDirectory(s); lastViewUsed = PROJECT_VIEW; diff --git a/muse2/muse/widgets/genset.cpp b/muse2/muse/widgets/genset.cpp index 83b19987..d910e5a8 100644 --- a/muse2/muse/widgets/genset.cpp +++ b/muse2/muse/widgets/genset.cpp @@ -60,51 +60,51 @@ GlobalSettingsConfig::GlobalSettingsConfig(QWidget* parent) startSongGroup->addButton(startEmptyButton, 1); startSongGroup->addButton(startSongButton, 2); for (unsigned i = 0; i < sizeof(rtcResolutions)/sizeof(*rtcResolutions); ++i) { - if (rtcResolutions[i] == config.rtcTicks) { + if (rtcResolutions[i] == MusEConfig::config.rtcTicks) { rtcResolutionSelect->setCurrentIndex(i); break; } } for (unsigned i = 0; i < sizeof(divisions)/sizeof(*divisions); ++i) { - if (divisions[i] == config.division) { + if (divisions[i] == MusEConfig::config.division) { midiDivisionSelect->setCurrentIndex(i); break; } } for (unsigned i = 0; i < sizeof(divisions)/sizeof(*divisions); ++i) { - if (divisions[i] == config.guiDivision) { + if (divisions[i] == MusEConfig::config.guiDivision) { guiDivisionSelect->setCurrentIndex(i); break; } } for (unsigned i = 0; i < sizeof(dummyAudioBufSizes)/sizeof(*dummyAudioBufSizes); ++i) { - if (dummyAudioBufSizes[i] == config.dummyAudioBufSize) { + if (dummyAudioBufSizes[i] == MusEConfig::config.dummyAudioBufSize) { dummyAudioSize->setCurrentIndex(i); break; } } for (unsigned i = 0; i < sizeof(minControlProcessPeriods)/sizeof(*minControlProcessPeriods); ++i) { - if (minControlProcessPeriods[i] == config.minControlProcessPeriod) { + if (minControlProcessPeriods[i] == MusEConfig::config.minControlProcessPeriod) { minControlProcessPeriodComboBox->setCurrentIndex(i); break; } } - userInstrumentsPath->setText(config.userInstrumentsDir); + userInstrumentsPath->setText(MusEConfig::config.userInstrumentsDir); selectInstrumentsDirButton->setIcon(*openIcon); defaultInstrumentsDirButton->setIcon(*undoIcon); connect(selectInstrumentsDirButton, SIGNAL(clicked()), SLOT(selectInstrumentsPath())); connect(defaultInstrumentsDirButton, SIGNAL(clicked()), SLOT(defaultInstrumentsPath())); - guiRefreshSelect->setValue(config.guiRefresh); - minSliderSelect->setValue(int(config.minSlider)); - minMeterSelect->setValue(config.minMeter); - freewheelCheckBox->setChecked(config.freewheelMode); - denormalCheckBox->setChecked(config.useDenormalBias); - outputLimiterCheckBox->setChecked(config.useOutputLimiter); - vstInPlaceCheckBox->setChecked(config.vstInPlace); - dummyAudioRate->setValue(config.dummyAudioSampleRate); + guiRefreshSelect->setValue(MusEConfig::config.guiRefresh); + minSliderSelect->setValue(int(MusEConfig::config.minSlider)); + minMeterSelect->setValue(MusEConfig::config.minMeter); + freewheelCheckBox->setChecked(MusEConfig::config.freewheelMode); + denormalCheckBox->setChecked(MusEConfig::config.useDenormalBias); + outputLimiterCheckBox->setChecked(MusEConfig::config.useOutputLimiter); + vstInPlaceCheckBox->setChecked(MusEConfig::config.vstInPlace); + dummyAudioRate->setValue(MusEConfig::config.dummyAudioSampleRate); //DummyAudioDevice* dad = dynamic_cast<DummyAudioDevice*>(audioDevice); //dummyAudioRealRate->setText(dad ? QString().setNum(sampleRate) : "---"); @@ -118,55 +118,55 @@ Period affects midi playback resolution. Shorter periods are desirable.</string> </property> */ - startSongEntry->setText(config.startSong); - startSongGroup->button(config.startMode)->setChecked(true); - - showTransport->setChecked(config.transportVisible); - showBigtime->setChecked(config.bigTimeVisible); - //showMixer->setChecked(config.mixerVisible); - showMixer->setChecked(config.mixer1Visible); - showMixer2->setChecked(config.mixer2Visible); - - arrangerX->setValue(config.geometryMain.x()); - arrangerY->setValue(config.geometryMain.y()); - arrangerW->setValue(config.geometryMain.width()); - arrangerH->setValue(config.geometryMain.height()); - - transportX->setValue(config.geometryTransport.x()); - transportY->setValue(config.geometryTransport.y()); - - bigtimeX->setValue(config.geometryBigTime.x()); - bigtimeY->setValue(config.geometryBigTime.y()); - bigtimeW->setValue(config.geometryBigTime.width()); - bigtimeH->setValue(config.geometryBigTime.height()); - - //mixerX->setValue(config.geometryMixer.x()); - //mixerY->setValue(config.geometryMixer.y()); - //mixerW->setValue(config.geometryMixer.width()); - //mixerH->setValue(config.geometryMixer.height()); - mixerX->setValue(config.mixer1.geometry.x()); - mixerY->setValue(config.mixer1.geometry.y()); - mixerW->setValue(config.mixer1.geometry.width()); - mixerH->setValue(config.mixer1.geometry.height()); - mixer2X->setValue(config.mixer2.geometry.x()); - mixer2Y->setValue(config.mixer2.geometry.y()); - mixer2W->setValue(config.mixer2.geometry.width()); - mixer2H->setValue(config.mixer2.geometry.height()); - - //setMixerCurrent->setEnabled(muse->mixerWindow()); - setMixerCurrent->setEnabled(muse->mixer1Window()); - setMixer2Current->setEnabled(muse->mixer2Window()); + startSongEntry->setText(MusEConfig::config.startSong); + startSongGroup->button(MusEConfig::config.startMode)->setChecked(true); + + showTransport->setChecked(MusEConfig::config.transportVisible); + showBigtime->setChecked(MusEConfig::config.bigTimeVisible); + //showMixer->setChecked(MusEConfig::config.mixerVisible); + showMixer->setChecked(MusEConfig::config.mixer1Visible); + showMixer2->setChecked(MusEConfig::config.mixer2Visible); + + arrangerX->setValue(MusEConfig::config.geometryMain.x()); + arrangerY->setValue(MusEConfig::config.geometryMain.y()); + arrangerW->setValue(MusEConfig::config.geometryMain.width()); + arrangerH->setValue(MusEConfig::config.geometryMain.height()); + + transportX->setValue(MusEConfig::config.geometryTransport.x()); + transportY->setValue(MusEConfig::config.geometryTransport.y()); + + bigtimeX->setValue(MusEConfig::config.geometryBigTime.x()); + bigtimeY->setValue(MusEConfig::config.geometryBigTime.y()); + bigtimeW->setValue(MusEConfig::config.geometryBigTime.width()); + bigtimeH->setValue(MusEConfig::config.geometryBigTime.height()); + + //mixerX->setValue(MusEConfig::config.geometryMixer.x()); + //mixerY->setValue(MusEConfig::config.geometryMixer.y()); + //mixerW->setValue(MusEConfig::config.geometryMixer.width()); + //mixerH->setValue(MusEConfig::config.geometryMixer.height()); + mixerX->setValue(MusEConfig::config.mixer1.geometry.x()); + mixerY->setValue(MusEConfig::config.mixer1.geometry.y()); + mixerW->setValue(MusEConfig::config.mixer1.geometry.width()); + mixerH->setValue(MusEConfig::config.mixer1.geometry.height()); + mixer2X->setValue(MusEConfig::config.mixer2.geometry.x()); + mixer2Y->setValue(MusEConfig::config.mixer2.geometry.y()); + mixer2W->setValue(MusEConfig::config.mixer2.geometry.width()); + mixer2H->setValue(MusEConfig::config.mixer2.geometry.height()); + + //setMixerCurrent->setEnabled(MusEGlobal::muse->mixerWindow()); + setMixerCurrent->setEnabled(MusEGlobal::muse->mixer1Window()); + setMixer2Current->setEnabled(MusEGlobal::muse->mixer2Window()); - setBigtimeCurrent->setEnabled(muse->bigtimeWindow()); - setTransportCurrent->setEnabled(muse->transportWindow()); - - showSplash->setChecked(config.showSplashScreen); - showDidYouKnow->setChecked(config.showDidYouKnow); - externalWavEditorSelect->setText(config.externalWavEditor); - oldStyleStopCheckBox->setChecked(config.useOldStyleStopShortCut); - moveArmedCheckBox->setChecked(config.moveArmedCheckBox); - projectSaveCheckBox->setChecked(config.useProjectSaveDialog); - popsDefStayOpenCheckBox->setChecked(config.popupsDefaultStayOpen); + setBigtimeCurrent->setEnabled(MusEGlobal::muse->bigtimeWindow()); + setTransportCurrent->setEnabled(MusEGlobal::muse->transportWindow()); + + showSplash->setChecked(MusEConfig::config.showSplashScreen); + showDidYouKnow->setChecked(MusEConfig::config.showDidYouKnow); + externalWavEditorSelect->setText(MusEConfig::config.externalWavEditor); + oldStyleStopCheckBox->setChecked(MusEConfig::config.useOldStyleStopShortCut); + moveArmedCheckBox->setChecked(MusEConfig::config.moveArmedCheckBox); + projectSaveCheckBox->setChecked(MusEConfig::config.useProjectSaveDialog); + popsDefStayOpenCheckBox->setChecked(MusEConfig::config.popupsDefaultStayOpen); //updateSettings(); // TESTING @@ -187,99 +187,99 @@ Shorter periods are desirable.</string> void GlobalSettingsConfig::updateSettings() { for (unsigned i = 0; i < sizeof(rtcResolutions)/sizeof(*rtcResolutions); ++i) { - if (rtcResolutions[i] == config.rtcTicks) { + if (rtcResolutions[i] == MusEConfig::config.rtcTicks) { rtcResolutionSelect->setCurrentIndex(i); break; } } for (unsigned i = 0; i < sizeof(divisions)/sizeof(*divisions); ++i) { - if (divisions[i] == config.division) { + if (divisions[i] == MusEConfig::config.division) { midiDivisionSelect->setCurrentIndex(i); break; } } for (unsigned i = 0; i < sizeof(divisions)/sizeof(*divisions); ++i) { - if (divisions[i] == config.guiDivision) { + if (divisions[i] == MusEConfig::config.guiDivision) { guiDivisionSelect->setCurrentIndex(i); break; } } for (unsigned i = 0; i < sizeof(dummyAudioBufSizes)/sizeof(*dummyAudioBufSizes); ++i) { - if (dummyAudioBufSizes[i] == config.dummyAudioBufSize) { + if (dummyAudioBufSizes[i] == MusEConfig::config.dummyAudioBufSize) { dummyAudioSize->setCurrentIndex(i); break; } } for (unsigned i = 0; i < sizeof(minControlProcessPeriods)/sizeof(*minControlProcessPeriods); ++i) { - if (minControlProcessPeriods[i] == config.minControlProcessPeriod) { + if (minControlProcessPeriods[i] == MusEConfig::config.minControlProcessPeriod) { minControlProcessPeriodComboBox->setCurrentIndex(i); break; } } - guiRefreshSelect->setValue(config.guiRefresh); - minSliderSelect->setValue(int(config.minSlider)); - minMeterSelect->setValue(config.minMeter); - freewheelCheckBox->setChecked(config.freewheelMode); - denormalCheckBox->setChecked(config.useDenormalBias); - outputLimiterCheckBox->setChecked(config.useOutputLimiter); - vstInPlaceCheckBox->setChecked(config.vstInPlace); - dummyAudioRate->setValue(config.dummyAudioSampleRate); + guiRefreshSelect->setValue(MusEConfig::config.guiRefresh); + minSliderSelect->setValue(int(MusEConfig::config.minSlider)); + minMeterSelect->setValue(MusEConfig::config.minMeter); + freewheelCheckBox->setChecked(MusEConfig::config.freewheelMode); + denormalCheckBox->setChecked(MusEConfig::config.useDenormalBias); + outputLimiterCheckBox->setChecked(MusEConfig::config.useOutputLimiter); + vstInPlaceCheckBox->setChecked(MusEConfig::config.vstInPlace); + dummyAudioRate->setValue(MusEConfig::config.dummyAudioSampleRate); //DummyAudioDevice* dad = dynamic_cast<DummyAudioDevice*>(audioDevice); //dummyAudioRealRate->setText(dad ? QString().setNum(sampleRate) : "---"); //dummyAudioRealRate->setText(QString().setNum(sampleRate)); // Not used any more. p4.0.20 - startSongEntry->setText(config.startSong); - startSongGroup->button(config.startMode)->setChecked(true); - - showTransport->setChecked(config.transportVisible); - showBigtime->setChecked(config.bigTimeVisible); - //showMixer->setChecked(config.mixerVisible); - showMixer->setChecked(config.mixer1Visible); - showMixer2->setChecked(config.mixer2Visible); - - arrangerX->setValue(config.geometryMain.x()); - arrangerY->setValue(config.geometryMain.y()); - arrangerW->setValue(config.geometryMain.width()); - arrangerH->setValue(config.geometryMain.height()); - - transportX->setValue(config.geometryTransport.x()); - transportY->setValue(config.geometryTransport.y()); - - bigtimeX->setValue(config.geometryBigTime.x()); - bigtimeY->setValue(config.geometryBigTime.y()); - bigtimeW->setValue(config.geometryBigTime.width()); - bigtimeH->setValue(config.geometryBigTime.height()); - - //mixerX->setValue(config.geometryMixer.x()); - //mixerY->setValue(config.geometryMixer.y()); - //mixerW->setValue(config.geometryMixer.width()); - //mixerH->setValue(config.geometryMixer.height()); - mixerX->setValue(config.mixer1.geometry.x()); - mixerY->setValue(config.mixer1.geometry.y()); - mixerW->setValue(config.mixer1.geometry.width()); - mixerH->setValue(config.mixer1.geometry.height()); - mixer2X->setValue(config.mixer2.geometry.x()); - mixer2Y->setValue(config.mixer2.geometry.y()); - mixer2W->setValue(config.mixer2.geometry.width()); - mixer2H->setValue(config.mixer2.geometry.height()); - - //setMixerCurrent->setEnabled(muse->mixerWindow()); - setMixerCurrent->setEnabled(muse->mixer1Window()); - setMixer2Current->setEnabled(muse->mixer2Window()); + startSongEntry->setText(MusEConfig::config.startSong); + startSongGroup->button(MusEConfig::config.startMode)->setChecked(true); + + showTransport->setChecked(MusEConfig::config.transportVisible); + showBigtime->setChecked(MusEConfig::config.bigTimeVisible); + //showMixer->setChecked(MusEConfig::config.mixerVisible); + showMixer->setChecked(MusEConfig::config.mixer1Visible); + showMixer2->setChecked(MusEConfig::config.mixer2Visible); + + arrangerX->setValue(MusEConfig::config.geometryMain.x()); + arrangerY->setValue(MusEConfig::config.geometryMain.y()); + arrangerW->setValue(MusEConfig::config.geometryMain.width()); + arrangerH->setValue(MusEConfig::config.geometryMain.height()); + + transportX->setValue(MusEConfig::config.geometryTransport.x()); + transportY->setValue(MusEConfig::config.geometryTransport.y()); + + bigtimeX->setValue(MusEConfig::config.geometryBigTime.x()); + bigtimeY->setValue(MusEConfig::config.geometryBigTime.y()); + bigtimeW->setValue(MusEConfig::config.geometryBigTime.width()); + bigtimeH->setValue(MusEConfig::config.geometryBigTime.height()); + + //mixerX->setValue(MusEConfig::config.geometryMixer.x()); + //mixerY->setValue(MusEConfig::config.geometryMixer.y()); + //mixerW->setValue(MusEConfig::config.geometryMixer.width()); + //mixerH->setValue(MusEConfig::config.geometryMixer.height()); + mixerX->setValue(MusEConfig::config.mixer1.geometry.x()); + mixerY->setValue(MusEConfig::config.mixer1.geometry.y()); + mixerW->setValue(MusEConfig::config.mixer1.geometry.width()); + mixerH->setValue(MusEConfig::config.mixer1.geometry.height()); + mixer2X->setValue(MusEConfig::config.mixer2.geometry.x()); + mixer2Y->setValue(MusEConfig::config.mixer2.geometry.y()); + mixer2W->setValue(MusEConfig::config.mixer2.geometry.width()); + mixer2H->setValue(MusEConfig::config.mixer2.geometry.height()); + + //setMixerCurrent->setEnabled(MusEGlobal::muse->mixerWindow()); + setMixerCurrent->setEnabled(MusEGlobal::muse->mixer1Window()); + setMixer2Current->setEnabled(MusEGlobal::muse->mixer2Window()); - setBigtimeCurrent->setEnabled(muse->bigtimeWindow()); - setTransportCurrent->setEnabled(muse->transportWindow()); - - showSplash->setChecked(config.showSplashScreen); - showDidYouKnow->setChecked(config.showDidYouKnow); - externalWavEditorSelect->setText(config.externalWavEditor); - oldStyleStopCheckBox->setChecked(config.useOldStyleStopShortCut); - moveArmedCheckBox->setChecked(config.moveArmedCheckBox); - projectSaveCheckBox->setChecked(config.useProjectSaveDialog); - popsDefStayOpenCheckBox->setChecked(config.popupsDefaultStayOpen); + setBigtimeCurrent->setEnabled(MusEGlobal::muse->bigtimeWindow()); + setTransportCurrent->setEnabled(MusEGlobal::muse->transportWindow()); + + showSplash->setChecked(MusEConfig::config.showSplashScreen); + showDidYouKnow->setChecked(MusEConfig::config.showDidYouKnow); + externalWavEditorSelect->setText(MusEConfig::config.externalWavEditor); + oldStyleStopCheckBox->setChecked(MusEConfig::config.useOldStyleStopShortCut); + moveArmedCheckBox->setChecked(MusEConfig::config.moveArmedCheckBox); + projectSaveCheckBox->setChecked(MusEConfig::config.useProjectSaveDialog); + popsDefStayOpenCheckBox->setChecked(MusEConfig::config.popupsDefaultStayOpen); } //--------------------------------------------------------- @@ -299,109 +299,109 @@ void GlobalSettingsConfig::showEvent(QShowEvent* e) void GlobalSettingsConfig::apply() { int rtcticks = rtcResolutionSelect->currentIndex(); - config.guiRefresh = guiRefreshSelect->value(); - config.minSlider = minSliderSelect->value(); - config.minMeter = minMeterSelect->value(); - config.freewheelMode = freewheelCheckBox->isChecked(); - config.useDenormalBias = denormalCheckBox->isChecked(); - config.useOutputLimiter = outputLimiterCheckBox->isChecked(); - config.vstInPlace = vstInPlaceCheckBox->isChecked(); - config.rtcTicks = rtcResolutions[rtcticks]; - config.userInstrumentsDir = userInstrumentsPath->text(); - config.startSong = startSongEntry->text(); - config.startMode = startSongGroup->checkedId(); + MusEConfig::config.guiRefresh = guiRefreshSelect->value(); + MusEConfig::config.minSlider = minSliderSelect->value(); + MusEConfig::config.minMeter = minMeterSelect->value(); + MusEConfig::config.freewheelMode = freewheelCheckBox->isChecked(); + MusEConfig::config.useDenormalBias = denormalCheckBox->isChecked(); + MusEConfig::config.useOutputLimiter = outputLimiterCheckBox->isChecked(); + MusEConfig::config.vstInPlace = vstInPlaceCheckBox->isChecked(); + MusEConfig::config.rtcTicks = rtcResolutions[rtcticks]; + MusEConfig::config.userInstrumentsDir = userInstrumentsPath->text(); + MusEConfig::config.startSong = startSongEntry->text(); + MusEConfig::config.startMode = startSongGroup->checkedId(); int das = dummyAudioSize->currentIndex(); - config.dummyAudioBufSize = dummyAudioBufSizes[das]; - config.dummyAudioSampleRate = dummyAudioRate->value(); + MusEConfig::config.dummyAudioBufSize = dummyAudioBufSizes[das]; + MusEConfig::config.dummyAudioSampleRate = dummyAudioRate->value(); int mcp = minControlProcessPeriodComboBox->currentIndex(); - config.minControlProcessPeriod = minControlProcessPeriods[mcp]; + MusEConfig::config.minControlProcessPeriod = minControlProcessPeriods[mcp]; int div = midiDivisionSelect->currentIndex(); - config.division = divisions[div]; + MusEConfig::config.division = divisions[div]; div = guiDivisionSelect->currentIndex(); - config.guiDivision = divisions[div]; + MusEConfig::config.guiDivision = divisions[div]; - config.transportVisible = showTransport->isChecked(); - config.bigTimeVisible = showBigtime->isChecked(); - //config.mixerVisible = showMixer->isChecked(); - config.mixer1Visible = showMixer->isChecked(); - config.mixer2Visible = showMixer2->isChecked(); - - config.geometryMain.setX(arrangerX->value()); - config.geometryMain.setY(arrangerY->value()); - config.geometryMain.setWidth(arrangerW->value()); - config.geometryMain.setHeight(arrangerH->value()); - - config.geometryTransport.setX(transportX->value()); - config.geometryTransport.setY(transportY->value()); - config.geometryTransport.setWidth(0); - config.geometryTransport.setHeight(0); - - config.geometryBigTime.setX(bigtimeX->value()); - config.geometryBigTime.setY(bigtimeY->value()); - config.geometryBigTime.setWidth(bigtimeW->value()); - config.geometryBigTime.setHeight(bigtimeH->value()); - - //config.geometryMixer.setX(mixerX->value()); - //config.geometryMixer.setY(mixerY->value()); - //config.geometryMixer.setWidth(mixerW->value()); - //config.geometryMixer.setHeight(mixerH->value()); - config.mixer1.geometry.setX(mixerX->value()); - config.mixer1.geometry.setY(mixerY->value()); - config.mixer1.geometry.setWidth(mixerW->value()); - config.mixer1.geometry.setHeight(mixerH->value()); - config.mixer2.geometry.setX(mixer2X->value()); - config.mixer2.geometry.setY(mixer2Y->value()); - config.mixer2.geometry.setWidth(mixer2W->value()); - config.mixer2.geometry.setHeight(mixer2H->value()); - - config.showSplashScreen = showSplash->isChecked(); - config.showDidYouKnow = showDidYouKnow->isChecked(); - config.externalWavEditor = externalWavEditorSelect->text(); - config.useOldStyleStopShortCut = oldStyleStopCheckBox->isChecked(); - config.moveArmedCheckBox = moveArmedCheckBox->isChecked(); - config.useProjectSaveDialog = projectSaveCheckBox->isChecked(); - config.popupsDefaultStayOpen = popsDefStayOpenCheckBox->isChecked(); - - //muse->showMixer(config.mixerVisible); - muse->showMixer1(config.mixer1Visible); - muse->showMixer2(config.mixer2Visible); + MusEConfig::config.transportVisible = showTransport->isChecked(); + MusEConfig::config.bigTimeVisible = showBigtime->isChecked(); + //MusEConfig::config.mixerVisible = showMixer->isChecked(); + MusEConfig::config.mixer1Visible = showMixer->isChecked(); + MusEConfig::config.mixer2Visible = showMixer2->isChecked(); + + MusEConfig::config.geometryMain.setX(arrangerX->value()); + MusEConfig::config.geometryMain.setY(arrangerY->value()); + MusEConfig::config.geometryMain.setWidth(arrangerW->value()); + MusEConfig::config.geometryMain.setHeight(arrangerH->value()); + + MusEConfig::config.geometryTransport.setX(transportX->value()); + MusEConfig::config.geometryTransport.setY(transportY->value()); + MusEConfig::config.geometryTransport.setWidth(0); + MusEConfig::config.geometryTransport.setHeight(0); + + MusEConfig::config.geometryBigTime.setX(bigtimeX->value()); + MusEConfig::config.geometryBigTime.setY(bigtimeY->value()); + MusEConfig::config.geometryBigTime.setWidth(bigtimeW->value()); + MusEConfig::config.geometryBigTime.setHeight(bigtimeH->value()); + + //MusEConfig::config.geometryMixer.setX(mixerX->value()); + //MusEConfig::config.geometryMixer.setY(mixerY->value()); + //MusEConfig::config.geometryMixer.setWidth(mixerW->value()); + //MusEConfig::config.geometryMixer.setHeight(mixerH->value()); + MusEConfig::config.mixer1.geometry.setX(mixerX->value()); + MusEConfig::config.mixer1.geometry.setY(mixerY->value()); + MusEConfig::config.mixer1.geometry.setWidth(mixerW->value()); + MusEConfig::config.mixer1.geometry.setHeight(mixerH->value()); + MusEConfig::config.mixer2.geometry.setX(mixer2X->value()); + MusEConfig::config.mixer2.geometry.setY(mixer2Y->value()); + MusEConfig::config.mixer2.geometry.setWidth(mixer2W->value()); + MusEConfig::config.mixer2.geometry.setHeight(mixer2H->value()); + + MusEConfig::config.showSplashScreen = showSplash->isChecked(); + MusEConfig::config.showDidYouKnow = showDidYouKnow->isChecked(); + MusEConfig::config.externalWavEditor = externalWavEditorSelect->text(); + MusEConfig::config.useOldStyleStopShortCut = oldStyleStopCheckBox->isChecked(); + MusEConfig::config.moveArmedCheckBox = moveArmedCheckBox->isChecked(); + MusEConfig::config.useProjectSaveDialog = projectSaveCheckBox->isChecked(); + MusEConfig::config.popupsDefaultStayOpen = popsDefStayOpenCheckBox->isChecked(); + + //MusEGlobal::muse->showMixer(MusEConfig::config.mixerVisible); + MusEGlobal::muse->showMixer1(MusEConfig::config.mixer1Visible); + MusEGlobal::muse->showMixer2(MusEConfig::config.mixer2Visible); - muse->showBigtime(config.bigTimeVisible); - muse->showTransport(config.transportVisible); - QWidget* w = muse->transportWindow(); + MusEGlobal::muse->showBigtime(MusEConfig::config.bigTimeVisible); + MusEGlobal::muse->showTransport(MusEConfig::config.transportVisible); + QWidget* w = MusEGlobal::muse->transportWindow(); if (w) { - w->resize(config.geometryTransport.size()); - w->move(config.geometryTransport.topLeft()); + w->resize(MusEConfig::config.geometryTransport.size()); + w->move(MusEConfig::config.geometryTransport.topLeft()); } - //w = muse->mixerWindow(); + //w = MusEGlobal::muse->mixerWindow(); //if (w) { - // w->resize(config.geometryMixer.size()); - // w->move(config.geometryMixer.topLeft()); + // w->resize(MusEConfig::config.geometryMixer.size()); + // w->move(MusEConfig::config.geometryMixer.topLeft()); // } - w = muse->mixer1Window(); + w = MusEGlobal::muse->mixer1Window(); if (w) { - w->resize(config.mixer1.geometry.size()); - w->move(config.mixer1.geometry.topLeft()); + w->resize(MusEConfig::config.mixer1.geometry.size()); + w->move(MusEConfig::config.mixer1.geometry.topLeft()); } - w = muse->mixer2Window(); + w = MusEGlobal::muse->mixer2Window(); if (w) { - w->resize(config.mixer2.geometry.size()); - w->move(config.mixer2.geometry.topLeft()); + w->resize(MusEConfig::config.mixer2.geometry.size()); + w->move(MusEConfig::config.mixer2.geometry.topLeft()); } - w = muse->bigtimeWindow(); + w = MusEGlobal::muse->bigtimeWindow(); if (w) { - w->resize(config.geometryBigTime.size()); - w->move(config.geometryBigTime.topLeft()); + w->resize(MusEConfig::config.geometryBigTime.size()); + w->move(MusEConfig::config.geometryBigTime.topLeft()); } - muse->resize(config.geometryMain.size()); - muse->move(config.geometryMain.topLeft()); + MusEGlobal::muse->resize(MusEConfig::config.geometryMain.size()); + MusEGlobal::muse->move(MusEConfig::config.geometryMain.topLeft()); - museUserInstruments = config.userInstrumentsDir; + MusEGlobal::museUserInstruments = MusEConfig::config.userInstrumentsDir; - muse->setHeartBeat(); // set guiRefresh + MusEGlobal::muse->setHeartBeat(); // set guiRefresh midiSeq->msgSetRtc(); // set midi tick rate - muse->changeConfig(true); // save settings + MusEGlobal::muse->changeConfig(true); // save settings } //--------------------------------------------------------- @@ -429,7 +429,7 @@ void GlobalSettingsConfig::cancel() void GlobalSettingsConfig::mixerCurrent() { - QWidget* w = muse->mixer1Window(); + QWidget* w = MusEGlobal::muse->mixer1Window(); if (!w) return; QRect r(w->frameGeometry()); @@ -445,7 +445,7 @@ void GlobalSettingsConfig::mixerCurrent() void GlobalSettingsConfig::mixer2Current() { - QWidget* w = muse->mixer2Window(); + QWidget* w = MusEGlobal::muse->mixer2Window(); if (!w) return; QRect r(w->frameGeometry()); @@ -461,7 +461,7 @@ void GlobalSettingsConfig::mixer2Current() void GlobalSettingsConfig::bigtimeCurrent() { - QWidget* w = muse->bigtimeWindow(); + QWidget* w = MusEGlobal::muse->bigtimeWindow(); if (!w) return; QRect r(w->frameGeometry()); @@ -477,7 +477,7 @@ void GlobalSettingsConfig::bigtimeCurrent() void GlobalSettingsConfig::arrangerCurrent() { - QRect r(muse->frameGeometry()); + QRect r(MusEGlobal::muse->frameGeometry()); arrangerX->setValue(r.x()); arrangerY->setValue(r.y()); arrangerW->setValue(r.width()); @@ -490,7 +490,7 @@ void GlobalSettingsConfig::arrangerCurrent() void GlobalSettingsConfig::transportCurrent() { - QWidget* w = muse->transportWindow(); + QWidget* w = MusEGlobal::muse->transportWindow(); if (!w) return; QRect r(w->frameGeometry()); @@ -502,12 +502,12 @@ void GlobalSettingsConfig::selectInstrumentsPath() { QString dir = QFileDialog::getExistingDirectory(this, tr("Selects instruments directory"), - config.userInstrumentsDir); + MusEConfig::config.userInstrumentsDir); userInstrumentsPath->setText(dir); } void GlobalSettingsConfig::defaultInstrumentsPath() { - QString dir = configPath + "/instruments"; + QString dir = MusEGlobal::configPath + "/instruments"; userInstrumentsPath->setText(dir); } diff --git a/muse2/muse/widgets/meter.cpp b/muse2/muse/widgets/meter.cpp index eec7fbf0..c4216c0c 100644 --- a/muse2/muse/widgets/meter.cpp +++ b/muse2/muse/widgets/meter.cpp @@ -52,7 +52,7 @@ Meter::Meter(QWidget* parent, MeterType type) overflow = false; val = 0.0; maxVal = 0.0; - minScale = mtype == DBMeter ? config.minMeter : 0.0; // min value in dB or int + minScale = mtype == DBMeter ? MusEConfig::config.minMeter : 0.0; // min value in dB or int maxScale = mtype == DBMeter ? 10.0 : 127.0; yellowScale = -10; redScale = 0; diff --git a/muse2/muse/widgets/metronome.cpp b/muse2/muse/widgets/metronome.cpp index 82a913f0..4bb58160 100644 --- a/muse2/muse/widgets/metronome.cpp +++ b/muse2/muse/widgets/metronome.cpp @@ -46,15 +46,15 @@ MetronomeConfig::MetronomeConfig(QDialog* parent) connect(audioBeepRoutesButton, SIGNAL(clicked()), SLOT(audioBeepRoutesClicked())); connect(volumeSlider, SIGNAL(valueChanged(int)), SLOT(beepVolumeChanged(int))); - measureNote->setValue(measureClickNote); - measureVelocity->setValue(measureClickVelo); - beatNote->setValue(beatClickNote); - beatVelocity->setValue(beatClickVelo); - midiChannel->setValue(clickChan+1); - midiPort->setValue(clickPort+1); + measureNote->setValue(MusEGlobal::measureClickNote); + measureVelocity->setValue(MusEGlobal::measureClickVelo); + beatNote->setValue(MusEGlobal::beatClickNote); + beatVelocity->setValue(MusEGlobal::beatClickVelo); + midiChannel->setValue(MusEGlobal::clickChan+1); + midiPort->setValue(MusEGlobal::clickPort+1); /* - precountBars->setValue(preMeasures); + precountBars->setValue(MusEGlobal::preMeasures); precountEnable->setChecked(precountEnableFlag); precountFromMastertrack->setChecked(precountFromMastertrackFlag); precountSigZ->setValue(::precountSigZ); @@ -63,8 +63,8 @@ MetronomeConfig::MetronomeConfig(QDialog* parent) precountPreroll->setChecked(::precountPreroll); */ - midiClick->setChecked(midiClickFlag); - audioBeep->setChecked(audioClickFlag); + midiClick->setChecked(MusEGlobal::midiClickFlag); + audioBeep->setChecked(MusEGlobal::audioClickFlag); } //--------------------------------------------------------- @@ -130,13 +130,13 @@ void MetronomeConfig::accept() void MetronomeConfig::apply() { - measureClickNote = measureNote->value(); - measureClickVelo = measureVelocity->value(); - beatClickNote = beatNote->value(); - beatClickVelo = beatVelocity->value(); - clickChan = midiChannel->value() - 1; - clickPort = midiPort->value() - 1; - preMeasures = precountBars->value(); + MusEGlobal::measureClickNote = measureNote->value(); + MusEGlobal::measureClickVelo = measureVelocity->value(); + MusEGlobal::beatClickNote = beatNote->value(); + MusEGlobal::beatClickVelo = beatVelocity->value(); + MusEGlobal::clickChan = midiChannel->value() - 1; + MusEGlobal::clickPort = midiPort->value() - 1; + MusEGlobal::preMeasures = precountBars->value(); /* precountEnableFlag = precountEnable->isChecked(); precountFromMastertrackFlag = precountFromMastertrack->isChecked(); @@ -145,8 +145,8 @@ void MetronomeConfig::apply() ::precountPrerecord = precountPrerecord->isChecked(); ::precountPreroll = precountPreroll->isChecked(); */ - midiClickFlag = midiClick->isChecked(); - audioClickFlag = audioBeep->isChecked(); + MusEGlobal::midiClickFlag = midiClick->isChecked(); + MusEGlobal::audioClickFlag = audioBeep->isChecked(); //audioVolumeChanged = volumeSlider->value(); } @@ -194,5 +194,5 @@ void MetronomeConfig::precountFromMastertrackChanged(bool /*flag*/) void MetronomeConfig::beepVolumeChanged(int volume) { // this value is directly applied, not using th Apply button, it just seems more usable this way. - audioClickVolume=volume/100.0; + MusEGlobal::audioClickVolume=volume/100.0; } diff --git a/muse2/muse/widgets/midisyncimpl.cpp b/muse2/muse/widgets/midisyncimpl.cpp index 73326440..1e6e27e2 100644 --- a/muse2/muse/widgets/midisyncimpl.cpp +++ b/muse2/muse/widgets/midisyncimpl.cpp @@ -311,7 +311,7 @@ MidiSyncConfig::MidiSyncConfig(QWidget* parent) // Done in show(). //connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); - //connect(heartBeatTimer, SIGNAL(timeout()), SLOT(heartBeat())); + //connect(MusEGlobal::heartBeatTimer, SIGNAL(timeout()), SLOT(heartBeat())); //inHeartBeat = false; } @@ -661,7 +661,7 @@ void MidiSyncConfig::show() { songChanged(-1); connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); - connect(heartBeatTimer, SIGNAL(timeout()), SLOT(heartBeat())); + connect(MusEGlobal::heartBeatTimer, SIGNAL(timeout()), SLOT(heartBeat())); QDialog::show(); } @@ -690,7 +690,7 @@ void MidiSyncConfig::closeEvent(QCloseEvent* e) //emit deleted((unsigned long)this); - disconnect(heartBeatTimer, SIGNAL(timeout()), this, SLOT(heartBeat())); + disconnect(MusEGlobal::heartBeatTimer, SIGNAL(timeout()), this, SLOT(heartBeat())); disconnect(song, SIGNAL(songChanged(int)), this, SLOT(songChanged(int))); e->accept(); diff --git a/muse2/muse/widgets/mixdowndialog.cpp b/muse2/muse/widgets/mixdowndialog.cpp index 57c1f57f..40bf69c3 100644 --- a/muse2/muse/widgets/mixdowndialog.cpp +++ b/muse2/muse/widgets/mixdowndialog.cpp @@ -99,7 +99,7 @@ void MixdownFileDialog::accept() if (path.right(4) != ".wav") path += ".wav"; sf = new SndFile(path); - sf->setFormat(format, channel, sampleRate); + sf->setFormat(format, channel, MusEGlobal::sampleRate); done(1); } diff --git a/muse2/muse/widgets/mtrackinfo.cpp b/muse2/muse/widgets/mtrackinfo.cpp index f19b8ba0..60baebce 100644 --- a/muse2/muse/widgets/mtrackinfo.cpp +++ b/muse2/muse/widgets/mtrackinfo.cpp @@ -61,10 +61,10 @@ void MidiTrackInfo::setTrack(Track* t) QPalette pal; if(selected->type() == Track::DRUM) { - pal.setColor(trackNameLabel->backgroundRole(), config.drumTrackLabelBg); + pal.setColor(trackNameLabel->backgroundRole(), MusEConfig::config.drumTrackLabelBg); iOutputChannel->setEnabled(false); } else { - pal.setColor(trackNameLabel->backgroundRole(), config.midiTrackLabelBg); + pal.setColor(trackNameLabel->backgroundRole(), MusEConfig::config.midiTrackLabelBg); iOutputChannel->setEnabled(true); } trackNameLabel->setPalette(pal); @@ -90,7 +90,7 @@ MidiTrackInfo::MidiTrackInfo(QWidget* parent, Track* sel_track) : QWidget(parent pan = -65; volume = -1; - setFont(config.fonts[2]); + setFont(MusEConfig::config.fonts[2]); //iChanDetectLabel->setPixmap(*darkgreendotIcon); iChanDetectLabel->setPixmap(*darkRedLedIcon); @@ -115,14 +115,14 @@ MidiTrackInfo::MidiTrackInfo(QWidget* parent, Track* sel_track) : QWidget(parent QPalette pal; //pal.setColor(trackNameLabel->backgroundRole(), QColor(0, 160, 255)); // Med blue if(selected->type() == Track::DRUM) - pal.setColor(trackNameLabel->backgroundRole(), config.drumTrackLabelBg); + pal.setColor(trackNameLabel->backgroundRole(), MusEConfig::config.drumTrackLabelBg); else - pal.setColor(trackNameLabel->backgroundRole(), config.midiTrackLabelBg); + pal.setColor(trackNameLabel->backgroundRole(), MusEConfig::config.midiTrackLabelBg); trackNameLabel->setPalette(pal); } //else //{ - // pal.setColor(trackNameLabel->backgroundRole(), config.midiTrackLabelBg); + // pal.setColor(trackNameLabel->backgroundRole(), MusEConfig::config.midiTrackLabelBg); // trackNameLabel->setPalette(pal); //} @@ -180,9 +180,9 @@ MidiTrackInfo::MidiTrackInfo(QWidget* parent, Track* sel_track) : QWidget(parent connect(oRButton, SIGNAL(pressed()), SLOT(outRoutesPressed())); connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); - connect(muse, SIGNAL(configChanged()), SLOT(configChanged())); + connect(MusEGlobal::muse, SIGNAL(configChanged()), SLOT(configChanged())); - connect(heartBeatTimer, SIGNAL(timeout()), SLOT(heartBeat())); + connect(MusEGlobal::heartBeatTimer, SIGNAL(timeout()), SLOT(heartBeat())); } //--------------------------------------------------------- @@ -502,15 +502,15 @@ void MidiTrackInfo::configChanged() { //printf("MidiTrackInfo::configChanged\n"); - //if (config.canvasBgPixmap.isEmpty()) { - // canvas->setBg(config.partCanvasBg); + //if (MusEConfig::config.canvasBgPixmap.isEmpty()) { + // canvas->setBg(MusEConfig::config.partCanvasBg); // canvas->setBg(QPixmap()); //} //else { - // canvas->setBg(QPixmap(config.canvasBgPixmap)); + // canvas->setBg(QPixmap(MusEConfig::config.canvasBgPixmap)); //} - setFont(config.fonts[2]); + setFont(MusEConfig::config.fonts[2]); //updateTrackInfo(type); } @@ -555,9 +555,9 @@ void MidiTrackInfo::setLabelFont() // Use the new font #6 I created just for these labels (so far). // Set the label's font. - trackNameLabel->setFont(config.fonts[6]); + trackNameLabel->setFont(MusEConfig::config.fonts[6]); // Dealing with a horizontally constrained label. Ignore vertical. Use a minimum readable point size. - autoAdjustFontSize(trackNameLabel, trackNameLabel->text(), false, true, config.fonts[6].pointSize(), 5); + autoAdjustFontSize(trackNameLabel, trackNameLabel->text(), false, true, MusEConfig::config.fonts[6].pointSize(), 5); } //--------------------------------------------------------- @@ -622,7 +622,7 @@ void MidiTrackInfo::inRoutesPressed() if(!selected->isMidiTrack()) return; - RoutePopupMenu* pup = muse->getRoutingPopupMenu(); + RoutePopupMenu* pup = MusEGlobal::muse->getRoutingPopupMenu(); iRButton->setDown(false); pup->exec(QCursor::pos(), selected, false); } @@ -638,7 +638,7 @@ void MidiTrackInfo::outRoutesPressed() if(!selected->isMidiTrack()) return; - RoutePopupMenu* pup = muse->getRoutingPopupMenu(); + RoutePopupMenu* pup = MusEGlobal::muse->getRoutingPopupMenu(); oRButton->setDown(false); pup->exec(QCursor::pos(), selected, true); } diff --git a/muse2/muse/widgets/mtscale.cpp b/muse2/muse/widgets/mtscale.cpp index d4f27373..d7046fa7 100644 --- a/muse2/muse/widgets/mtscale.cpp +++ b/muse2/muse/widgets/mtscale.cpp @@ -230,7 +230,7 @@ void MTScale::pdraw(QPainter& p, const QRect& r) int y = 12; p.setPen(Qt::black); - p.setFont(config.fonts[4]); + p.setFont(MusEConfig::config.fonts[4]); p.drawLine(r.x(), y+1, r.x() + r.width(), y+1); QRect tr(r); tr.setHeight(12); @@ -391,7 +391,7 @@ void MTScale::pdraw(QPainter& p, const QRect& r) n = 32; if (bar % n) continue; - p.setFont(config.fonts[3]); + p.setFont(MusEConfig::config.fonts[3]); int x = mapx(waveMode ? b : stick); QString s; s.setNum(bar + 1); @@ -415,12 +415,12 @@ void MTScale::pdraw(QPainter& p, const QRect& r) if (beat == 0) { num = bar + 1; y1 = y + 1; - p.setFont(config.fonts[3]); + p.setFont(MusEConfig::config.fonts[3]); } else { num = beat + 1; y1 = y + 7; - p.setFont(config.fonts[1]); + p.setFont(MusEConfig::config.fonts[1]); r.setY(y+3); } s.setNum(num); diff --git a/muse2/muse/widgets/mtscale_flo.cpp b/muse2/muse/widgets/mtscale_flo.cpp index 43b5a908..e60738bb 100644 --- a/muse2/muse/widgets/mtscale_flo.cpp +++ b/muse2/muse/widgets/mtscale_flo.cpp @@ -186,7 +186,7 @@ void MTScaleFlo::draw(QPainter& p, const QRect& r) int y = 12; p.setPen(Qt::black); - p.setFont(config.fonts[4]); + p.setFont(MusEConfig::config.fonts[4]); p.drawLine(r.x(), y+1, r.x() + r.width(), y+1); QRect tr(r); tr.setHeight(12); @@ -285,7 +285,7 @@ void MTScaleFlo::draw(QPainter& p, const QRect& r) n = 32; if (bar % n) continue; - p.setFont(config.fonts[3]); + p.setFont(MusEConfig::config.fonts[3]); int x = parent->tick_to_x(stick) + xoffset - xpos; QString s; s.setNum(bar + 1); @@ -306,12 +306,12 @@ void MTScaleFlo::draw(QPainter& p, const QRect& r) if (beat == 0) { num = bar + 1; y1 = y + 1; - p.setFont(config.fonts[3]); + p.setFont(MusEConfig::config.fonts[3]); } else { num = beat + 1; y1 = y + 7; - p.setFont(config.fonts[1]); + p.setFont(MusEConfig::config.fonts[1]); r.setY(y+3); } s.setNum(num); diff --git a/muse2/muse/widgets/popupmenu.cpp b/muse2/muse/widgets/popupmenu.cpp index ac7d16ac..827e60b9 100644 --- a/muse2/muse/widgets/popupmenu.cpp +++ b/muse2/muse/widgets/popupmenu.cpp @@ -172,7 +172,7 @@ bool PopupMenu::event(QEvent* event) case QEvent::MouseButtonDblClick: { if(_stayOpen) - //if(_stayOpen && config.popupsDefaultStayOpen) + //if(_stayOpen && MusEConfig::config.popupsDefaultStayOpen) { QMouseEvent* e = static_cast<QMouseEvent*>(event); if(e->modifiers() == Qt::NoModifier) @@ -191,7 +191,7 @@ bool PopupMenu::event(QEvent* event) case QEvent::KeyPress: { if(_stayOpen) - //if(_stayOpen && config.popupsDefaultStayOpen) + //if(_stayOpen && MusEConfig::config.popupsDefaultStayOpen) { QKeyEvent* e = static_cast<QKeyEvent*>(event); if(e->modifiers() == Qt::NoModifier && e->key() == Qt::Key_Space) @@ -345,7 +345,7 @@ void PopupMenu::mouseReleaseEvent(QMouseEvent *e) #else // Check for Ctrl to stay open. - if(!_stayOpen || (!config.popupsDefaultStayOpen && (e->modifiers() & Qt::ControlModifier) == 0)) + if(!_stayOpen || (!MusEConfig::config.popupsDefaultStayOpen && (e->modifiers() & Qt::ControlModifier) == 0)) { QMenu::mouseReleaseEvent(e); return; diff --git a/muse2/muse/widgets/poslabel.cpp b/muse2/muse/widgets/poslabel.cpp index 8df5eea7..cb54de0c 100644 --- a/muse2/muse/widgets/poslabel.cpp +++ b/muse2/muse/widgets/poslabel.cpp @@ -81,7 +81,7 @@ void PosLabel::updateValue() { QString s; if (_smpte) { - double time = double(_sampleValue) / double(sampleRate); + double time = double(_sampleValue) / double(MusEGlobal::sampleRate); int min = int(time) / 60; int sec = int(time) % 60; double rest = time - (min * 60 + sec); diff --git a/muse2/muse/widgets/projectcreateimpl.cpp b/muse2/muse/widgets/projectcreateimpl.cpp index 9591350f..bb36f6f4 100644 --- a/muse2/muse/widgets/projectcreateimpl.cpp +++ b/muse2/muse/widgets/projectcreateimpl.cpp @@ -33,7 +33,7 @@ ProjectCreateImpl::ProjectCreateImpl(QWidget *parent) : { setupUi(this); - createFolderCheckbox->setChecked(config.projectStoreInFolder); + createFolderCheckbox->setChecked(MusEConfig::config.projectStoreInFolder); connect(browseDirButton,SIGNAL(clicked()), this, SLOT(selectDirectory())); connect(projectNameEdit,SIGNAL(textChanged(QString)), this, SLOT(updateDirectoryPath())); connect(createFolderCheckbox,SIGNAL(clicked()), this, SLOT(updateDirectoryPath())); @@ -44,7 +44,7 @@ ProjectCreateImpl::ProjectCreateImpl(QWidget *parent) : // as of Qt-4.7.1 //commentEdit->setPlaceholderText("<Add information about project here>"); #endif - directoryPath = config.projectBaseFolder; + directoryPath = MusEConfig::config.projectBaseFolder; updateDirectoryPath(); show(); } @@ -86,8 +86,8 @@ QString ProjectCreateImpl::getSongInfo() } void ProjectCreateImpl::ok() { - config.projectStoreInFolder = createFolderCheckbox->isChecked(); - config.projectBaseFolder = directoryPath; - muse->changeConfig(true); + MusEConfig::config.projectStoreInFolder = createFolderCheckbox->isChecked(); + MusEConfig::config.projectBaseFolder = directoryPath; + MusEGlobal::muse->changeConfig(true); emit accept(); } diff --git a/muse2/muse/widgets/routepopup.cpp b/muse2/muse/widgets/routepopup.cpp index 97a47655..e2d83b65 100644 --- a/muse2/muse/widgets/routepopup.cpp +++ b/muse2/muse/widgets/routepopup.cpp @@ -889,7 +889,7 @@ void RoutePopupMenu::popupActivated(QAction* action) { int n = action->data().value<int>(); if(!_isOutMenu && n == 0) - muse->configMidiPorts(); + MusEGlobal::muse->configMidiPorts(); return; } } @@ -1219,7 +1219,7 @@ void RoutePopupMenu::prepare() MenuTitleItem* titel = new MenuTitleItem(QString(buffer), _pup); _pup->addAction(titel); - if(!checkAudioDevice()) + if(!MusEGlobal::checkAudioDevice()) { _pup->clear(); return; @@ -1304,7 +1304,7 @@ void RoutePopupMenu::prepare() MenuTitleItem* titel = new MenuTitleItem(QString(buffer), _pup); _pup->addAction(titel); - if(!checkAudioDevice()) + if(!MusEGlobal::checkAudioDevice()) { _pup->clear(); return; diff --git a/muse2/muse/widgets/sigscale.cpp b/muse2/muse/widgets/sigscale.cpp index 560fbb86..8ec0ca70 100644 --- a/muse2/muse/widgets/sigscale.cpp +++ b/muse2/muse/widgets/sigscale.cpp @@ -130,7 +130,7 @@ void SigScale::pdraw(QPainter& p, const QRect& r) if (x < 0) x = 0; - p.setFont(config.fonts[3]); + p.setFont(MusEConfig::config.fonts[3]); ///for (ciSigEvent si = sigmap.begin(); si != sigmap.end(); ++si) { for (AL::ciSigEvent si = AL::sigmap.begin(); si != AL::sigmap.end(); ++si) { ///SigEvent* e = si->second; diff --git a/muse2/muse/widgets/tools.cpp b/muse2/muse/widgets/tools.cpp index 56989807..ccd0f89b 100644 --- a/muse2/muse/widgets/tools.cpp +++ b/muse2/muse/widgets/tools.cpp @@ -28,6 +28,8 @@ #include "icons.h" #include "action.h" +namespace MusEWidget { + const char* infoPointer = QT_TRANSLATE_NOOP("@default", "select Pointer Tool:\n" "with the pointer tool you can:\n" " select parts\n" @@ -160,3 +162,4 @@ int EditToolBar::curTool() return -1; } +} // namespace MusEWidget diff --git a/muse2/muse/widgets/tools.h b/muse2/muse/widgets/tools.h index b3d55324..55c75c4a 100644 --- a/muse2/muse/widgets/tools.h +++ b/muse2/muse/widgets/tools.h @@ -25,12 +25,15 @@ #include <QToolBar> -class Action; class QAction; class QPixmap; class QWidget; +namespace MusEWidget { + +class Action; + enum Tool { PointerTool=1, PencilTool=2, @@ -81,5 +84,7 @@ class EditToolBar : public QToolBar { int curTool(); }; +} // namespace MusEWidget + #endif diff --git a/muse2/muse/widgets/ttoolbar.cpp b/muse2/muse/widgets/ttoolbar.cpp index fad6b480..dddc42c1 100644 --- a/muse2/muse/widgets/ttoolbar.cpp +++ b/muse2/muse/widgets/ttoolbar.cpp @@ -29,11 +29,11 @@ void syncChanged(bool flag) { - startAction->setEnabled(!flag); - forwardAction->setEnabled(!flag); - rewindAction->setEnabled(!flag); - stopAction->setEnabled(!flag); - playAction->setEnabled(!flag); + MusEGlobal::startAction->setEnabled(!flag); + MusEGlobal::forwardAction->setEnabled(!flag); + MusEGlobal::rewindAction->setEnabled(!flag); + MusEGlobal::stopAction->setEnabled(!flag); + MusEGlobal::playAction->setEnabled(!flag); } diff --git a/muse2/muse/widgets/unusedwavefiles.cpp b/muse2/muse/widgets/unusedwavefiles.cpp index 842491c4..810105bf 100644 --- a/muse2/muse/widgets/unusedwavefiles.cpp +++ b/muse2/muse/widgets/unusedwavefiles.cpp @@ -47,10 +47,10 @@ UnusedWaveFiles::UnusedWaveFiles(QWidget *parent) : void UnusedWaveFiles::findWaveFiles() { ui->filelistWidget->clear(); - //printf("museProject =%s\n", museProject.toLatin1().data()); -// QFileInfo proj(museProject); + //printf("MusEGlobal::museProject =%s\n", MusEGlobal::museProject.toLatin1().data()); +// QFileInfo proj(MusEGlobal::museProject); // QString projPath = proj.absolutePath(); - QDir dir(museProject); + QDir dir(MusEGlobal::museProject); QStringList filter; filter.append("*.wav"); filter.append("*.ogg"); @@ -60,14 +60,14 @@ void UnusedWaveFiles::findWaveFiles() // get med files QStringList medFiles; if (ui->currentProjRadioButton->isChecked()) { - medFiles.append(muse->projectName()); + medFiles.append(MusEGlobal::muse->projectName()); } else { //printf("get ALLL *.med files!\n"); QStringList medFilter("*.med"); medFiles = dir.entryList(medFilter); } foreach (QString medFile, medFiles) { - QString fname = museProject+"/"+ medFile; + QString fname = MusEGlobal::museProject+"/"+ medFile; //printf("fopen %s\n", fname.toLatin1().data()); FILE *fp =fopen(fname.toLatin1().data(),"r"); QTextStream fileContent(fp); @@ -102,15 +102,15 @@ void UnusedWaveFiles::accept() int ret = QMessageBox::question(this,"Move files", "Are you sure you want to move away the unused files?", QMessageBox::Ok, QMessageBox::Cancel); if (ret == QMessageBox::Ok) { - QDir currDir(museProject); + QDir currDir(MusEGlobal::museProject); currDir.mkdir("unused"); foreach(QString file, allWaveFiles) { - QFile::rename(museProject+ "/"+file, museProject + "/unused/" +file); + QFile::rename(MusEGlobal::museProject+ "/"+file, MusEGlobal::museProject + "/unused/" +file); // move the wca file if it exists - QFileInfo wf(museProject + "/" + file); - if (QFile::exists(museProject + "/" + wf.baseName()+".wca")) { - QFile::rename(museProject + "/" + wf.baseName()+".wca", museProject + "/unused/" +wf.baseName()+".wca"); + QFileInfo wf(MusEGlobal::museProject + "/" + file); + if (QFile::exists(MusEGlobal::museProject + "/" + wf.baseName()+".wca")) { + QFile::rename(MusEGlobal::museProject + "/" + wf.baseName()+".wca", MusEGlobal::museProject + "/unused/" +wf.baseName()+".wca"); } } diff --git a/muse2/muse/widgets/verticalmeter.cpp b/muse2/muse/widgets/verticalmeter.cpp index 7ce7a4cc..e76d7015 100644 --- a/muse2/muse/widgets/verticalmeter.cpp +++ b/muse2/muse/widgets/verticalmeter.cpp @@ -50,7 +50,7 @@ VerticalMeter::VerticalMeter(QWidget* parent, MeterType type) overflow = false; val = 0.0; maxVal = 0.0; - minScale = mtype == DBMeter ? config.minMeter : 0.0; // min value in dB or int + minScale = mtype == DBMeter ? MusEConfig::config.minMeter : 0.0; // min value in dB or int maxScale = mtype == DBMeter ? 10.0 : 127.0; yellowScale = -10; redScale = 0; diff --git a/muse2/muse/widgets/visibletracks.cpp b/muse2/muse/widgets/visibletracks.cpp index ae09b27c..1b549975 100644 --- a/muse2/muse/widgets/visibletracks.cpp +++ b/muse2/muse/widgets/visibletracks.cpp @@ -30,6 +30,8 @@ #include "track.h" #include "synth.h" +namespace MusEWidget { + const char* waveTrack = QT_TRANSLATE_NOOP("@default", "Show wave tracks"); const char* groupTrack = QT_TRANSLATE_NOOP("@default", "Show group tracks"); const char* auxTrack = QT_TRANSLATE_NOOP("@default", "Show aux tracks"); @@ -140,3 +142,4 @@ VisibleTracks::~VisibleTracks() delete actions; } +} // namespace MusEWidget diff --git a/muse2/muse/widgets/visibletracks.h b/muse2/muse/widgets/visibletracks.h index 6c04c339..b0e92d26 100644 --- a/muse2/muse/widgets/visibletracks.h +++ b/muse2/muse/widgets/visibletracks.h @@ -25,12 +25,14 @@ #include <QToolBar> -class Action; - class QAction; class QPixmap; class QWidget; +namespace MusEWidget { + +class Action; + struct VisibleToolB { QPixmap** icon; const char* tip; @@ -60,6 +62,6 @@ class VisibleTracks : public QToolBar { ~VisibleTracks(); }; - +} // namespace MusEWidget #endif // VISIBLETRACKS_H diff --git a/muse2/synti/deicsonze/deicsonze.cpp b/muse2/synti/deicsonze/deicsonze.cpp index 7e1d0133..01608fcb 100644 --- a/muse2/synti/deicsonze/deicsonze.cpp +++ b/muse2/synti/deicsonze/deicsonze.cpp @@ -125,7 +125,7 @@ DeicsOnze::DeicsOnze() : Mess(2) { _saveConfig = true; _isInitSet = true; //false if an initial bank must be download - QString sharePath(museGlobalShare); + QString sharePath(MusEGlobal::museGlobalShare); _initSetPath = sharePath + QString("/presets/deicsonze/SutulaBank.dei"); @@ -170,7 +170,7 @@ DeicsOnze::DeicsOnze() : Mess(2) { //Load configuration QString defaultConf = - (configPath + QString("/" DEICSONZESTR ".dco")); + (MusEGlobal::configPath + QString("/" DEICSONZESTR ".dco")); FILE* f; f = fopen(defaultConf.toAscii().data(), "r"); if(f) { diff --git a/muse2/synti/deicsonze/deicsonzegui.cpp b/muse2/synti/deicsonze/deicsonzegui.cpp index 4b0c0132..b88a47fc 100644 --- a/muse2/synti/deicsonze/deicsonzegui.cpp +++ b/muse2/synti/deicsonze/deicsonzegui.cpp @@ -418,7 +418,7 @@ DeicsOnzeGui::DeicsOnzeGui(DeicsOnze* deicsOnze) QSocketNotifier* s = new QSocketNotifier(readFd, QSocketNotifier::Read); connect(s, SIGNAL(activated(int)), SLOT(readMessage(int))); - QString sharePath(museGlobalShare); + QString sharePath(MusEGlobal::museGlobalShare); // Tim. updateInitSetPath(sharePath + QString("/presets/deicsonze/SutulaBank.dei")); // Tim. updateBackgroundPixPath(sharePath + QString("/wallpapers/paper2.jpg")); // Tim. @@ -555,7 +555,7 @@ void DeicsOnzeGui::saveConfiguration() { // saveDefaultConfiguration //----------------------------------------------------------- void DeicsOnzeGui::saveDefaultConfiguration() { - QString filename = configPath + QString("/" DEICSONZESTR ".dco"); + QString filename = MusEGlobal::configPath + QString("/" DEICSONZESTR ".dco"); if(!filename.isEmpty()) { QFile f(filename); f.open(QIODevice::WriteOnly); diff --git a/muse2/synti/vam/vamgui.cpp b/muse2/synti/vam/vamgui.cpp index c75b2568..0993087b 100644 --- a/muse2/synti/vam/vamgui.cpp +++ b/muse2/synti/vam/vamgui.cpp @@ -601,7 +601,7 @@ void VAMGui::loadPresetsPressed() { #if 1 // TODO QString iname; - QString s(configPath); + QString s(MusEGlobal::configPath); /* QString filename = QFileDialog::getOpenFileName(lastdir, QString("*.[Ss][Ff]2"), this, @@ -716,7 +716,7 @@ void VAMGui::doSavePresets(const QString& fn, bool showWarning) void VAMGui::savePresetsPressed() { #if 1 // TODO - QString s(configPath); + QString s(MusEGlobal::configPath); QString fn = QFileDialog::getSaveFileName(this, tr("MusE: Save VAM Presets"), s, "Presets (*.vam)"); if (fn.isEmpty()) @@ -734,7 +734,7 @@ void VAMGui::savePresetsToFilePressed() { if (!presetFileName ) { - QString s(configPath); + QString s(MusEGlobal::configPath); QString fn = QFileDialog::getSaveFileName(this, tr("MusE: Save VAM Presets"), s, "Presets (*.vam)"); presetFileName = new QString(fn); |