summaryrefslogtreecommitdiff
path: root/muse2/muse/app.cpp
diff options
context:
space:
mode:
authorOrcan Ogetbil <oget.fedora@gmail.com>2011-09-08 02:05:32 +0000
committerOrcan Ogetbil <oget.fedora@gmail.com>2011-09-08 02:05:32 +0000
commitd3e8a1b4c98cb3ba8b73f367ea88ad23f8dbca66 (patch)
tree921e5193e46287f0c34f4eff1590efb1df18d20f /muse2/muse/app.cpp
parentff0c5e9154e7a3d71d2465639b5e0da1ea2c7242 (diff)
introducing namespaces
Diffstat (limited to 'muse2/muse/app.cpp')
-rw-r--r--muse2/muse/app.cpp439
1 files changed, 223 insertions, 216 deletions
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