From f16b2037025918e32c5fd90527f76e1102e5ecb9 Mon Sep 17 00:00:00 2001 From: Orcan Ogetbil Date: Fri, 7 Oct 2011 02:20:29 +0000 Subject: (hopefully) final huge namespace update. --- muse2/muse/app.cpp | 910 ++++++++++++++++++++++++++--------------------------- 1 file changed, 455 insertions(+), 455 deletions(-) (limited to 'muse2/muse/app.cpp') diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp index fd024d57..8d390468 100644 --- a/muse2/muse/app.cpp +++ b/muse2/muse/app.cpp @@ -77,9 +77,16 @@ #include "widgets/unusedwavefiles.h" #include "functions.h" +namespace MusECore { +extern void initMidiSynth(); +extern void exitJackAudio(); +extern void exitDummyAudio(); +extern void exitOSC(); +extern void exitMidiAlsa(); +} -namespace MusEApp { +namespace MusEGui { //extern void cacheJackRouteNames(); @@ -108,12 +115,6 @@ static const char* infoPanicButton = QT_TRANSLATE_NOOP("@default", "send note #define PROJECT_LIST_LEN 6 static QString* projectList[PROJECT_LIST_LEN]; -extern void initMidiSynth(); -extern void exitJackAudio(); -extern void exitDummyAudio(); -extern void exitOSC(); -extern void exitMidiAlsa(); - #ifdef HAVE_LASH #include lash_client_t * lash_client = 0; @@ -144,12 +145,12 @@ void microSleep(long msleep) bool MusE::seqStart() { - if (audio->isRunning()) { + if (MusEGlobal::audio->isRunning()) { printf("seqStart(): already running\n"); return true; } - if (!audio->start()) { + if (!MusEGlobal::audio->start()) { QMessageBox::critical( MusEGlobal::muse, tr("Failed to start audio!"), tr("Was not able to start audio, check if jack is running.\n")); return false; @@ -160,11 +161,11 @@ bool MusE::seqStart() // for(int i = 0; i < 60; ++i) { - if(audio->isRunning()) + if(MusEGlobal::audio->isRunning()) break; sleep(1); } - if(!audio->isRunning()) + if(!MusEGlobal::audio->isRunning()) { QMessageBox::critical( MusEGlobal::muse, tr("Failed to start audio!"), tr("Timeout waiting for audio to run. Check if jack is running.\n")); @@ -173,7 +174,7 @@ bool MusE::seqStart() // now its safe to ask the driver for realtime // priority - MusEGlobal::realTimePriority = audioDevice->realtimePriority(); + MusEGlobal::realTimePriority = MusEGlobal::audioDevice->realtimePriority(); if(MusEGlobal::debugMsg) printf("MusE::seqStart: getting audio driver MusEGlobal::realTimePriority:%d\n", MusEGlobal::realTimePriority); @@ -216,8 +217,8 @@ bool MusE::seqStart() //MusEGlobal::midiSeqRunning = !midiSeq->start(MusEGlobal::realTimeScheduling ? MusEGlobal::realTimePriority : 0); // Changed by Tim. p3.3.22 - //midiSeq->start(MusEGlobal::realTimeScheduling ? MusEGlobal::realTimePriority : 0); - midiSeq->start(midiprio); + //MusEGlobal::midiSeq->start(MusEGlobal::realTimeScheduling ? MusEGlobal::realTimePriority : 0); + MusEGlobal::midiSeq->start(midiprio); int counter=0; while (++counter) { @@ -226,7 +227,7 @@ bool MusE::seqStart() fprintf(stderr,"midi sequencer thread does not start!? Exiting...\n"); exit(33); } - MusEGlobal::midiSeqRunning = midiSeq->isRunning(); + MusEGlobal::midiSeqRunning = MusEGlobal::midiSeq->isRunning(); if (MusEGlobal::midiSeqRunning) break; usleep(1000); @@ -250,10 +251,10 @@ void MusE::seqStop() // label sequencer as disabled before it actually happened to minimize race condition MusEGlobal::midiSeqRunning = false; - song->setStop(true); - song->setStopPlay(false); - midiSeq->stop(true); - audio->stop(true); + MusEGlobal::song->setStop(true); + MusEGlobal::song->setStopPlay(false); + MusEGlobal::midiSeq->stop(true); + MusEGlobal::audio->stop(true); audioPrefetch->stop(true); if (MusEGlobal::realTimeScheduling && watchdogThread) pthread_cancel(watchdogThread); @@ -265,11 +266,11 @@ void MusE::seqStop() bool MusE::seqRestart() { - bool restartSequencer = audio->isRunning(); + bool restartSequencer = MusEGlobal::audio->isRunning(); if (restartSequencer) { - if (audio->isPlaying()) { - audio->msgPlay(false); - while (audio->isPlaying()) + if (MusEGlobal::audio->isPlaying()) { + MusEGlobal::audio->msgPlay(false); + while (MusEGlobal::audio->isPlaying()) qApp->processEvents(); } seqStop(); @@ -277,7 +278,7 @@ bool MusE::seqRestart() if(!seqStart()) return false; - audioDevice->graphChanged(); + MusEGlobal::audioDevice->graphChanged(); return true; } @@ -357,14 +358,14 @@ MusE::MusE(int argc, char** argv) : QMainWindow() windowsMapper = new QSignalMapper(this); connect(windowsMapper, SIGNAL(mapped(QWidget*)), SLOT(bringToFront(QWidget*))); - song = new Song("song"); - song->blockSignals(true); + MusEGlobal::song = new MusECore::Song("song"); + MusEGlobal::song->blockSignals(true); MusEGlobal::heartBeatTimer = new QTimer(this); MusEGlobal::heartBeatTimer->setObjectName("timer"); - connect(MusEGlobal::heartBeatTimer, SIGNAL(timeout()), song, SLOT(beat())); + connect(MusEGlobal::heartBeatTimer, SIGNAL(timeout()), MusEGlobal::song, SLOT(beat())); - connect(this, SIGNAL(activeTopWinChanged(TopWin*)), SLOT(activeTopWinChangedSlot(TopWin*))); + connect(this, SIGNAL(activeTopWinChanged(MusEGui::TopWin*)), SLOT(activeTopWinChangedSlot(MusEGui::TopWin*))); #ifdef ENABLE_PYTHON //--------------------------------------------------- @@ -386,17 +387,17 @@ MusE::MusE(int argc, char** argv) : QMainWindow() MusEGlobal::undoRedo = new QActionGroup(this); MusEGlobal::undoRedo->setExclusive(false); - MusEGlobal::undoAction = new QAction(QIcon(*undoIconS), tr("Und&o"), + MusEGlobal::undoAction = new QAction(QIcon(*MusEGui::undoIconS), tr("Und&o"), MusEGlobal::undoRedo); - MusEGlobal::redoAction = new QAction(QIcon(*redoIconS), tr("Re&do"), + MusEGlobal::redoAction = new QAction(QIcon(*MusEGui::redoIconS), tr("Re&do"), MusEGlobal::undoRedo); 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())); + connect(MusEGlobal::redoAction, SIGNAL(activated()), MusEGlobal::song, SLOT(redo())); + connect(MusEGlobal::undoAction, SIGNAL(activated()), MusEGlobal::song, SLOT(undo())); //--------------------------------------------------- // Transport @@ -405,96 +406,96 @@ MusE::MusE(int argc, char** argv) : QMainWindow() MusEGlobal::transportAction = new QActionGroup(this); MusEGlobal::transportAction->setExclusive(false); - MusEGlobal::loopAction = new QAction(QIcon(*loop1Icon), + MusEGlobal::loopAction = new QAction(QIcon(*MusEGui::loop1Icon), tr("Loop"), MusEGlobal::transportAction); MusEGlobal::loopAction->setCheckable(true); MusEGlobal::loopAction->setWhatsThis(tr(infoLoopButton)); - connect(MusEGlobal::loopAction, SIGNAL(toggled(bool)), song, SLOT(setLoop(bool))); + connect(MusEGlobal::loopAction, SIGNAL(toggled(bool)), MusEGlobal::song, SLOT(setLoop(bool))); - MusEGlobal::punchinAction = new QAction(QIcon(*punchin1Icon), + MusEGlobal::punchinAction = new QAction(QIcon(*MusEGui::punchin1Icon), tr("Punchin"), MusEGlobal::transportAction); MusEGlobal::punchinAction->setCheckable(true); MusEGlobal::punchinAction->setWhatsThis(tr(infoPunchinButton)); - connect(MusEGlobal::punchinAction, SIGNAL(toggled(bool)), song, SLOT(setPunchin(bool))); + connect(MusEGlobal::punchinAction, SIGNAL(toggled(bool)), MusEGlobal::song, SLOT(setPunchin(bool))); - MusEGlobal::punchoutAction = new QAction(QIcon(*punchout1Icon), + MusEGlobal::punchoutAction = new QAction(QIcon(*MusEGui::punchout1Icon), tr("Punchout"), MusEGlobal::transportAction); MusEGlobal::punchoutAction->setCheckable(true); MusEGlobal::punchoutAction->setWhatsThis(tr(infoPunchoutButton)); - connect(MusEGlobal::punchoutAction, SIGNAL(toggled(bool)), song, SLOT(setPunchout(bool))); + connect(MusEGlobal::punchoutAction, SIGNAL(toggled(bool)), MusEGlobal::song, SLOT(setPunchout(bool))); QAction *tseparator = new QAction(this); tseparator->setSeparator(true); MusEGlobal::transportAction->addAction(tseparator); - MusEGlobal::startAction = new QAction(QIcon(*startIcon), + MusEGlobal::startAction = new QAction(QIcon(*MusEGui::startIcon), tr("Start"), MusEGlobal::transportAction); MusEGlobal::startAction->setWhatsThis(tr(infoStartButton)); - connect(MusEGlobal::startAction, SIGNAL(activated()), song, SLOT(rewindStart())); + connect(MusEGlobal::startAction, SIGNAL(activated()), MusEGlobal::song, SLOT(rewindStart())); - MusEGlobal::rewindAction = new QAction(QIcon(*frewindIcon), + MusEGlobal::rewindAction = new QAction(QIcon(*MusEGui::frewindIcon), tr("Rewind"), MusEGlobal::transportAction); MusEGlobal::rewindAction->setWhatsThis(tr(infoRewindButton)); - connect(MusEGlobal::rewindAction, SIGNAL(activated()), song, SLOT(rewind())); + connect(MusEGlobal::rewindAction, SIGNAL(activated()), MusEGlobal::song, SLOT(rewind())); - MusEGlobal::forwardAction = new QAction(QIcon(*fforwardIcon), + MusEGlobal::forwardAction = new QAction(QIcon(*MusEGui::fforwardIcon), tr("Forward"), MusEGlobal::transportAction); MusEGlobal::forwardAction->setWhatsThis(tr(infoForwardButton)); - connect(MusEGlobal::forwardAction, SIGNAL(activated()), song, SLOT(forward())); + connect(MusEGlobal::forwardAction, SIGNAL(activated()), MusEGlobal::song, SLOT(forward())); - MusEGlobal::stopAction = new QAction(QIcon(*stopIcon), + MusEGlobal::stopAction = new QAction(QIcon(*MusEGui::stopIcon), tr("Stop"), MusEGlobal::transportAction); MusEGlobal::stopAction->setCheckable(true); MusEGlobal::stopAction->setWhatsThis(tr(infoStopButton)); MusEGlobal::stopAction->setChecked(true); - connect(MusEGlobal::stopAction, SIGNAL(toggled(bool)), song, SLOT(setStop(bool))); + connect(MusEGlobal::stopAction, SIGNAL(toggled(bool)), MusEGlobal::song, SLOT(setStop(bool))); - MusEGlobal::playAction = new QAction(QIcon(*playIcon), + MusEGlobal::playAction = new QAction(QIcon(*MusEGui::playIcon), tr("Play"), MusEGlobal::transportAction); MusEGlobal::playAction->setCheckable(true); MusEGlobal::playAction->setWhatsThis(tr(infoPlayButton)); MusEGlobal::playAction->setChecked(false); - connect(MusEGlobal::playAction, SIGNAL(toggled(bool)), song, SLOT(setPlay(bool))); + connect(MusEGlobal::playAction, SIGNAL(toggled(bool)), MusEGlobal::song, SLOT(setPlay(bool))); - MusEGlobal::recordAction = new QAction(QIcon(*recordIcon), + MusEGlobal::recordAction = new QAction(QIcon(*MusEGui::recordIcon), tr("Record"), MusEGlobal::transportAction); MusEGlobal::recordAction->setCheckable(true); MusEGlobal::recordAction->setWhatsThis(tr(infoRecordButton)); - connect(MusEGlobal::recordAction, SIGNAL(toggled(bool)), song, SLOT(setRecord(bool))); + connect(MusEGlobal::recordAction, SIGNAL(toggled(bool)), MusEGlobal::song, SLOT(setRecord(bool))); - MusEGlobal::panicAction = new QAction(QIcon(*panicIcon), + MusEGlobal::panicAction = new QAction(QIcon(*MusEGui::panicIcon), tr("Panic"), this); MusEGlobal::panicAction->setWhatsThis(tr(infoPanicButton)); - connect(MusEGlobal::panicAction, SIGNAL(activated()), song, SLOT(panic())); + connect(MusEGlobal::panicAction, SIGNAL(activated()), MusEGlobal::song, SLOT(panic())); - initMidiInstruments(); - initMidiPorts(); - ::initMidiDevices(); + MusECore::initMidiInstruments(); + MusECore::initMidiPorts(); + MusECore::initMidiDevices(); //----Actions //-------- File Actions - fileNewAction = new QAction(QIcon(*filenewIcon), tr("&New"), this); + fileNewAction = new QAction(QIcon(*MusEGui::filenewIcon), tr("&New"), this); fileNewAction->setToolTip(tr(fileNewText)); fileNewAction->setWhatsThis(tr(fileNewText)); - fileOpenAction = new QAction(QIcon(*openIcon), tr("&Open"), this); + fileOpenAction = new QAction(QIcon(*MusEGui::openIcon), tr("&Open"), this); fileOpenAction->setToolTip(tr(fileOpenText)); fileOpenAction->setWhatsThis(tr(fileOpenText)); openRecent = new QMenu(tr("Open &Recent"), this); - fileSaveAction = new QAction(QIcon(*saveIcon), tr("&Save"), this); + fileSaveAction = new QAction(QIcon(*MusEGui::saveIcon), tr("&Save"), this); fileSaveAction->setToolTip(tr(fileSaveText)); fileSaveAction->setWhatsThis(tr(fileSaveText)); @@ -510,20 +511,20 @@ MusE::MusE(int argc, char** argv) : QMainWindow() quitAction = new QAction(tr("&Quit"), this); - editSongInfoAction = new QAction(QIcon(*edit_listIcon), tr("Song Info"), this); + editSongInfoAction = new QAction(QIcon(*MusEGui::edit_listIcon), tr("Song Info"), this); //-------- View Actions - viewTransportAction = new QAction(QIcon(*view_transport_windowIcon), tr("Transport Panel"), this); + viewTransportAction = new QAction(QIcon(*MusEGui::view_transport_windowIcon), tr("Transport Panel"), this); viewTransportAction->setCheckable(true); - viewBigtimeAction = new QAction(QIcon(*view_bigtime_windowIcon), tr("Bigtime Window"), this); + viewBigtimeAction = new QAction(QIcon(*MusEGui::view_bigtime_windowIcon), tr("Bigtime Window"), this); viewBigtimeAction->setCheckable(true); - viewMixerAAction = new QAction(QIcon(*mixerSIcon), tr("Mixer A"), this); + viewMixerAAction = new QAction(QIcon(*MusEGui::mixerSIcon), tr("Mixer A"), this); viewMixerAAction->setCheckable(true); - viewMixerBAction = new QAction(QIcon(*mixerSIcon), tr("Mixer B"), this); + viewMixerBAction = new QAction(QIcon(*MusEGui::mixerSIcon), tr("Mixer B"), this); viewMixerBAction->setCheckable(true); - viewCliplistAction = new QAction(QIcon(*cliplistSIcon), tr("Cliplist"), this); + viewCliplistAction = new QAction(QIcon(*MusEGui::cliplistSIcon), tr("Cliplist"), this); viewCliplistAction->setCheckable(true); - viewMarkerAction = new QAction(QIcon(*view_markerIcon), tr("Marker View"), this); + viewMarkerAction = new QAction(QIcon(*MusEGui::view_markerIcon), tr("Marker View"), this); viewMarkerAction->setCheckable(true); viewArrangerAction = new QAction(tr("Arranger View"), this); viewArrangerAction->setCheckable(true); @@ -533,30 +534,30 @@ MusE::MusE(int argc, char** argv) : QMainWindow() //-------- Midi Actions menuScriptPlugins = new QMenu(tr("&Plugins"), this); - midiEditInstAction = new QAction(QIcon(*midi_edit_instrumentIcon), tr("Edit Instrument"), this); + midiEditInstAction = new QAction(QIcon(*MusEGui::midi_edit_instrumentIcon), tr("Edit Instrument"), this); midiInputPlugins = new QMenu(tr("Input Plugins"), this); - midiInputPlugins->setIcon(QIcon(*midi_inputpluginsIcon)); - midiTrpAction = new QAction(QIcon(*midi_inputplugins_transposeIcon), tr("Transpose"), this); - midiInputTrfAction = new QAction(QIcon(*midi_inputplugins_midi_input_transformIcon), tr("Midi Input Transform"), this); - midiInputFilterAction = new QAction(QIcon(*midi_inputplugins_midi_input_filterIcon), tr("Midi Input Filter"), this); - midiRemoteAction = new QAction(QIcon(*midi_inputplugins_remote_controlIcon), tr("Midi Remote Control"), this); + midiInputPlugins->setIcon(QIcon(*MusEGui::midi_inputpluginsIcon)); + midiTrpAction = new QAction(QIcon(*MusEGui::midi_inputplugins_transposeIcon), tr("Transpose"), this); + midiInputTrfAction = new QAction(QIcon(*MusEGui::midi_inputplugins_midi_input_transformIcon), tr("Midi Input Transform"), this); + midiInputFilterAction = new QAction(QIcon(*MusEGui::midi_inputplugins_midi_input_filterIcon), tr("Midi Input Filter"), this); + midiRemoteAction = new QAction(QIcon(*MusEGui::midi_inputplugins_remote_controlIcon), tr("Midi Remote Control"), this); #ifdef BUILD_EXPERIMENTAL midiRhythmAction = new QAction(QIcon(*midi_inputplugins_random_rhythm_generatorIcon), tr("Rhythm Generator"), this); #endif - midiResetInstAction = new QAction(QIcon(*midi_reset_instrIcon), tr("Reset Instr."), this); - midiInitInstActions = new QAction(QIcon(*midi_init_instrIcon), tr("Init Instr."), this); - midiLocalOffAction = new QAction(QIcon(*midi_local_offIcon), tr("Local Off"), this); + midiResetInstAction = new QAction(QIcon(*MusEGui::midi_reset_instrIcon), tr("Reset Instr."), this); + midiInitInstActions = new QAction(QIcon(*MusEGui::midi_init_instrIcon), tr("Init Instr."), this); + midiLocalOffAction = new QAction(QIcon(*MusEGui::midi_local_offIcon), tr("Local Off"), this); //-------- Audio Actions - audioBounce2TrackAction = new QAction(QIcon(*audio_bounce_to_trackIcon), tr("Bounce to Track"), this); - audioBounce2FileAction = new QAction(QIcon(*audio_bounce_to_fileIcon), tr("Bounce to File"), this); - audioRestartAction = new QAction(QIcon(*audio_restartaudioIcon), tr("Restart Audio"), this); + audioBounce2TrackAction = new QAction(QIcon(*MusEGui::audio_bounce_to_trackIcon), tr("Bounce to Track"), this); + audioBounce2FileAction = new QAction(QIcon(*MusEGui::audio_bounce_to_fileIcon), tr("Bounce to File"), this); + audioRestartAction = new QAction(QIcon(*MusEGui::audio_restartaudioIcon), tr("Restart Audio"), this); //-------- Automation Actions - autoMixerAction = new QAction(QIcon(*automation_mixerIcon), tr("Mixer Automation"), this); + autoMixerAction = new QAction(QIcon(*MusEGui::automation_mixerIcon), tr("Mixer Automation"), this); autoMixerAction->setCheckable(true); - autoSnapshotAction = new QAction(QIcon(*automation_take_snapshotIcon), tr("Take Snapshot"), this); - autoClearAction = new QAction(QIcon(*automation_clear_dataIcon), tr("Clear Automation Data"), this); + autoSnapshotAction = new QAction(QIcon(*MusEGui::automation_take_snapshotIcon), tr("Take Snapshot"), this); + autoClearAction = new QAction(QIcon(*MusEGui::automation_clear_dataIcon), tr("Clear Automation Data"), this); autoClearAction->setEnabled(false); @@ -568,8 +569,8 @@ MusE::MusE(int argc, char** argv) : QMainWindow() //-------- Settings Actions - settingsGlobalAction = new QAction(QIcon(*settings_globalsettingsIcon), tr("Global Settings"), this); - settingsShortcutsAction = new QAction(QIcon(*settings_configureshortcutsIcon), tr("Configure Shortcuts"), this); + settingsGlobalAction = new QAction(QIcon(*MusEGui::settings_globalsettingsIcon), tr("Global Settings"), this); + settingsShortcutsAction = new QAction(QIcon(*MusEGui::settings_configureshortcutsIcon), tr("Configure Shortcuts"), this); follow = new QMenu(tr("Follow Song"), this); dontFollowAction = new QAction(tr("Don't Follow Song"), this); dontFollowAction->setCheckable(true); @@ -579,11 +580,11 @@ MusE::MusE(int argc, char** argv) : QMainWindow() followCtsAction = new QAction(tr("Follow Continuous"), this); followCtsAction->setCheckable(true); - settingsMetronomeAction = new QAction(QIcon(*settings_metronomeIcon), tr("Metronome"), this); - settingsMidiSyncAction = new QAction(QIcon(*settings_midisyncIcon), tr("Midi Sync"), this); - settingsMidiIOAction = new QAction(QIcon(*settings_midifileexportIcon), tr("Midi File Import/Export"), this); - settingsAppearanceAction = new QAction(QIcon(*settings_appearance_settingsIcon), tr("Appearance Settings"), this); - settingsMidiPortAction = new QAction(QIcon(*settings_midiport_softsynthsIcon), tr("Midi Ports / Soft Synth"), this); + settingsMetronomeAction = new QAction(QIcon(*MusEGui::settings_metronomeIcon), tr("Metronome"), this); + settingsMidiSyncAction = new QAction(QIcon(*MusEGui::settings_midisyncIcon), tr("Midi Sync"), this); + settingsMidiIOAction = new QAction(QIcon(*MusEGui::settings_midifileexportIcon), tr("Midi File Import/Export"), this); + settingsAppearanceAction = new QAction(QIcon(*MusEGui::settings_appearance_settingsIcon), tr("Appearance Settings"), this); + settingsMidiPortAction = new QAction(QIcon(*MusEGui::settings_midiport_softsynthsIcon), tr("Midi Ports / Soft Synth"), this); //-------- Help Actions helpManualAction = new QAction(tr("&Manual"), this); @@ -732,9 +733,9 @@ MusE::MusE(int argc, char** argv) : QMainWindow() } // Changed by Tim. p3.3.17 - //midiSeq = new MidiSeq(MusEGlobal::realTimeScheduling ? MusEGlobal::realTimePriority : 0, "Midi"); - midiSeq = new MidiSeq("Midi"); - audio = new Audio(); + //MusEGlobal::midiSeq = new MusECore::MidiSeq(MusEGlobal::realTimeScheduling ? MusEGlobal::realTimePriority : 0, "Midi"); + MusEGlobal::midiSeq = new MusECore::MidiSeq("Midi"); + MusEGlobal::audio = new MusECore::Audio(); //audioPrefetch = new AudioPrefetch(0, "Disc"); audioPrefetch = new AudioPrefetch("Prefetch"); @@ -806,7 +807,7 @@ MusE::MusE(int argc, char** argv) : QMainWindow() menuBar()->addMenu(menu_functions); trailingMenus.push_back(menu_functions); - song->populateScriptMenu(menuScriptPlugins, this); + MusEGlobal::song->populateScriptMenu(menuScriptPlugins, this); menu_functions->addMenu(menuScriptPlugins); menu_functions->addAction(midiEditInstAction); menu_functions->addMenu(midiInputPlugins); @@ -926,7 +927,7 @@ MusE::MusE(int argc, char** argv) : QMainWindow() connect(windowsCascadeAction, SIGNAL(activated()), mdiArea, SLOT(cascadeSubWindows())); - arrangerView = new MusEArranger::ArrangerView(this); + arrangerView = new MusEGui::ArrangerView(this); arrangerView->shareToolsAndMenu(true); connect(arrangerView, SIGNAL(closed()), SLOT(arrangerClosed())); toplevels.push_back(arrangerView); @@ -963,12 +964,12 @@ MusE::MusE(int argc, char** argv) : QMainWindow() fclose(f); } - initMidiSynth(); + MusECore::initMidiSynth(); arrangerView->populateAddTrack(); arrangerView->updateShortcuts(); - transport = new Transport(this, "transport"); + transport = new MusEGui::Transport(this, "transport"); bigtime = 0; //--------------------------------------------------- @@ -983,23 +984,23 @@ MusE::MusE(int argc, char** argv) : QMainWindow() bool useTemplate = false; if (argc >= 2) name = argv[0]; - else if (MusEConfig::config.startMode == 0) { + else if (MusEGlobal::config.startMode == 0) { if (argc < 2) name = projectList[0] ? *projectList[0] : QString("untitled"); else name = argv[0]; - printf("starting with selected song %s\n", MusEConfig::config.startSong.toLatin1().constData()); + printf("starting with selected song %s\n", MusEGlobal::config.startSong.toLatin1().constData()); } - else if (MusEConfig::config.startMode == 1) { + else if (MusEGlobal::config.startMode == 1) { printf("starting with default template\n"); name = MusEGlobal::museGlobalShare + QString("/templates/default.med"); useTemplate = true; } - else if (MusEConfig::config.startMode == 2) { - printf("starting with pre configured song %s\n", MusEConfig::config.startSong.toLatin1().constData()); - name = MusEConfig::config.startSong; + else if (MusEGlobal::config.startMode == 2) { + printf("starting with pre configured song %s\n", MusEGlobal::config.startSong.toLatin1().constData()); + name = MusEGlobal::config.startSong; } - song->blockSignals(false); + MusEGlobal::song->blockSignals(false); loadProjectFile(name, useTemplate, true); changeConfig(false); @@ -1007,7 +1008,7 @@ MusE::MusE(int argc, char** argv) : QMainWindow() restoreGeometry(settings.value("MusE/geometry").toByteArray()); //restoreState(settings.value("MusE/windowState").toByteArray()); - song->update(); + MusEGlobal::song->update(); updateWindowMenu(); } @@ -1022,7 +1023,7 @@ MusE::~MusE() void MusE::setHeartBeat() { - MusEGlobal::heartBeatTimer->start(1000/MusEConfig::config.guiRefresh); + MusEGlobal::heartBeatTimer->start(1000/MusEGlobal::config.guiRefresh); } //--------------------------------------------------------- @@ -1031,7 +1032,7 @@ void MusE::setHeartBeat() void MusE::resetMidiDevices() { - audio->msgResetMidiDevices(); + MusEGlobal::audio->msgResetMidiDevices(); } //--------------------------------------------------------- @@ -1041,11 +1042,11 @@ void MusE::resetMidiDevices() void MusE::initMidiDevices() { // Added by T356 - //audio->msgIdle(true); + //MusEGlobal::audio->msgIdle(true); - audio->msgInitMidiDevices(); + MusEGlobal::audio->msgInitMidiDevices(); - //audio->msgIdle(false); + //MusEGlobal::audio->msgIdle(false); } //--------------------------------------------------------- @@ -1054,7 +1055,7 @@ void MusE::initMidiDevices() void MusE::localOff() { - audio->msgLocalOff(); + MusEGlobal::audio->msgLocalOff(); } //--------------------------------------------------------- @@ -1106,11 +1107,11 @@ void MusE::loadProjectFile(const QString& name, bool songTemplate, bool loadAll) // stop audio threads if running // progress->setValue(0); - bool restartSequencer = audio->isRunning(); + bool restartSequencer = MusEGlobal::audio->isRunning(); if (restartSequencer) { - if (audio->isPlaying()) { - audio->msgPlay(false); - while (audio->isPlaying()) + if (MusEGlobal::audio->isPlaying()) { + MusEGlobal::audio->msgPlay(false); + while (MusEGlobal::audio->isPlaying()) qApp->processEvents(); } seqStop(); @@ -1130,7 +1131,7 @@ void MusE::loadProjectFile(const QString& name, bool songTemplate, bool loadAll) QApplication::restoreOverrideCursor(); - if (song->getSongInfo().length()>0 && song->showSongInfoOnStartup()) { + if (MusEGlobal::song->getSongInfo().length()>0 && MusEGlobal::song->showSongInfoOnStartup()) { startSongInfo(false); } } @@ -1189,7 +1190,7 @@ void MusE::loadProjectFile1(const QString& name, bool songTemplate, bool loadAll // read *.med file // bool popenFlag; - FILE* f = MusEWidget::fileOpen(this, fi.filePath(), QString(".med"), "r", popenFlag, true); + FILE* f = MusEGui::fileOpen(this, fi.filePath(), QString(".med"), "r", popenFlag, true); if (f == 0) { if (errno != ENOENT) { QMessageBox::critical(this, QString("MusE"), @@ -1200,7 +1201,7 @@ void MusE::loadProjectFile1(const QString& name, bool songTemplate, bool loadAll setConfigDefaults(); } else { - Xml xml(f); + MusECore::Xml xml(f); read(xml, !loadAll, songTemplate); bool fileError = ferror(f); popenFlag ? pclose(f) : fclose(f); @@ -1226,58 +1227,58 @@ void MusE::loadProjectFile1(const QString& name, bool songTemplate, bool loadAll addProject(project.absoluteFilePath()); setWindowTitle(QString("MusE: Song: ") + project.completeBaseName()); } - song->dirty = false; + MusEGlobal::song->dirty = false; progress->setValue(30); - viewTransportAction->setChecked(MusEConfig::config.transportVisible); - viewBigtimeAction->setChecked(MusEConfig::config.bigTimeVisible); - viewMarkerAction->setChecked(MusEConfig::config.markerVisible); - viewArrangerAction->setChecked(MusEConfig::config.arrangerVisible); + viewTransportAction->setChecked(MusEGlobal::config.transportVisible); + viewBigtimeAction->setChecked(MusEGlobal::config.bigTimeVisible); + viewMarkerAction->setChecked(MusEGlobal::config.markerVisible); + viewArrangerAction->setChecked(MusEGlobal::config.arrangerVisible); autoMixerAction->setChecked(MusEGlobal::automation); if (loadAll) { - showBigtime(MusEConfig::config.bigTimeVisible); - //showMixer(MusEConfig::config.mixerVisible); - showMixer1(MusEConfig::config.mixer1Visible); - showMixer2(MusEConfig::config.mixer2Visible); + showBigtime(MusEGlobal::config.bigTimeVisible); + //showMixer(MusEGlobal::config.mixerVisible); + showMixer1(MusEGlobal::config.mixer1Visible); + showMixer2(MusEGlobal::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() != MusEConfig::config.mixer1.geometry.size()) // p3.3.53 Moved below - // mixer1->resize(MusEConfig::config.mixer1.geometry.size()); + //if(mixer1->geometry().size() != MusEGlobal::config.mixer1.geometry.size()) // p3.3.53 Moved below + // mixer1->resize(MusEGlobal::config.mixer1.geometry.size()); - if(mixer1->geometry().topLeft() != MusEConfig::config.mixer1.geometry.topLeft()) - mixer1->move(MusEConfig::config.mixer1.geometry.topLeft()); + if(mixer1->geometry().topLeft() != MusEGlobal::config.mixer1.geometry.topLeft()) + mixer1->move(MusEGlobal::config.mixer1.geometry.topLeft()); } if(mixer2) { - //if(mixer2->geometry().size() != MusEConfig::config.mixer2.geometry.size()) // p3.3.53 Moved below - // mixer2->resize(MusEConfig::config.mixer2.geometry.size()); + //if(mixer2->geometry().size() != MusEGlobal::config.mixer2.geometry.size()) // p3.3.53 Moved below + // mixer2->resize(MusEGlobal::config.mixer2.geometry.size()); - if(mixer2->geometry().topLeft() != MusEConfig::config.mixer2.geometry.topLeft()) - mixer2->move(MusEConfig::config.mixer2.geometry.topLeft()); + if(mixer2->geometry().topLeft() != MusEGlobal::config.mixer2.geometry.topLeft()) + mixer2->move(MusEGlobal::config.mixer2.geometry.topLeft()); } - //showMarker(MusEConfig::config.markerVisible); // Moved below. Tim. - resize(MusEConfig::config.geometryMain.size()); - move(MusEConfig::config.geometryMain.topLeft()); + //showMarker(MusEGlobal::config.markerVisible); // Moved below. Tim. + resize(MusEGlobal::config.geometryMain.size()); + move(MusEGlobal::config.geometryMain.topLeft()); - if (MusEConfig::config.transportVisible) + if (MusEGlobal::config.transportVisible) transport->show(); - transport->move(MusEConfig::config.geometryTransport.topLeft()); - showTransport(MusEConfig::config.transportVisible); + transport->move(MusEGlobal::config.geometryTransport.topLeft()); + showTransport(MusEGlobal::config.transportVisible); } progress->setValue(40); - transport->setMasterFlag(song->masterFlag()); - MusEGlobal::punchinAction->setChecked(song->punchin()); - MusEGlobal::punchoutAction->setChecked(song->punchout()); - MusEGlobal::loopAction->setChecked(song->loop()); - song->update(); - song->updatePos(); + transport->setMasterFlag(MusEGlobal::song->masterFlag()); + MusEGlobal::punchinAction->setChecked(MusEGlobal::song->punchin()); + MusEGlobal::punchoutAction->setChecked(MusEGlobal::song->punchout()); + MusEGlobal::loopAction->setChecked(MusEGlobal::song->loop()); + MusEGlobal::song->update(); + MusEGlobal::song->updatePos(); arrangerView->clipboardChanged(); // enable/disable "Paste" arrangerView->selectionChanged(); // enable/disable "Copy" & "Paste" arrangerView->scoreNamingChanged(); // inform the score menus about the new scores and their names @@ -1288,42 +1289,42 @@ void MusE::loadProjectFile1(const QString& name, bool songTemplate, bool loadAll { if(mixer1) { - if(mixer1->geometry().size() != MusEConfig::config.mixer1.geometry.size()) + if(mixer1->geometry().size() != MusEGlobal::config.mixer1.geometry.size()) { - //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() + //printf("MusE::loadProjectFile1 resizing mixer1 x:%d y:%d w:%d h:%d\n", MusEGlobal::config.mixer1.geometry.x(), + // MusEGlobal::config.mixer1.geometry.y(), + // MusEGlobal::config.mixer1.geometry.width(), + // MusEGlobal::config.mixer1.geometry.height() // ); - mixer1->resize(MusEConfig::config.mixer1.geometry.size()); + mixer1->resize(MusEGlobal::config.mixer1.geometry.size()); } } if(mixer2) { - if(mixer2->geometry().size() != MusEConfig::config.mixer2.geometry.size()) + if(mixer2->geometry().size() != MusEGlobal::config.mixer2.geometry.size()) { - //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() + //printf("MusE::loadProjectFile1 resizing mixer2 x:%d y:%d w:%d h:%d\n", MusEGlobal::config.mixer2.geometry.x(), + // MusEGlobal::config.mixer2.geometry.y(), + // MusEGlobal::config.mixer2.geometry.width(), + // MusEGlobal::config.mixer2.geometry.height() // ); - mixer2->resize(MusEConfig::config.mixer2.geometry.size()); + mixer2->resize(MusEGlobal::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(MusEConfig::config.markerVisible); + showMarker(MusEGlobal::config.markerVisible); } if (songTemplate) { // maximize the arranger in traditional SDI mode - if (TopWin::_defaultSubwin[TopWin::ARRANGER]) + if (MusEGui::TopWin::_defaultSubwin[MusEGui::TopWin::ARRANGER]) { bool maximizeArranger=true; - for (int i=0; idirty = false; + MusECore::readConfiguration(); // used for reading midi files + MusEGlobal::song->dirty = false; } //--------------------------------------------------------- @@ -1368,11 +1369,11 @@ void MusE::setConfigDefaults() void MusE::setFollow() { - Song::FollowMode fm = song->follow(); + MusECore::Song::FollowMode fm = MusEGlobal::song->follow(); - dontFollowAction->setChecked(fm == Song::NO); - followPageAction->setChecked(fm == Song::JUMP); - followCtsAction->setChecked(fm == Song::CONTINUOUS); + dontFollowAction->setChecked(fm == MusECore::Song::NO); + followPageAction->setChecked(fm == MusECore::Song::JUMP); + followCtsAction->setChecked(fm == MusECore::Song::CONTINUOUS); } //--------------------------------------------------------- @@ -1382,7 +1383,7 @@ void MusE::setFollow() void MusE::loadProject() { bool loadAll; - QString fn = MusEWidget::getOpenFileName(QString(""), MusEGlobal::med_file_pattern, this, + QString fn = MusEGui::getOpenFileName(QString(""), MusEGlobal::med_file_pattern, this, tr("MusE: load project"), &loadAll); if (!fn.isEmpty()) { MusEGlobal::museProject = QFileInfo(fn).absolutePath(); @@ -1396,8 +1397,8 @@ void MusE::loadProject() void MusE::loadTemplate() { - QString fn = MusEWidget::getOpenFileName(QString("templates"), MusEGlobal::med_file_pattern, this, - tr("MusE: load template"), 0, MusEWidget::MFileDialog::GLOBAL_VIEW); + QString fn = MusEGui::getOpenFileName(QString("templates"), MusEGlobal::med_file_pattern, this, + tr("MusE: load template"), 0, MusEGui::MFileDialog::GLOBAL_VIEW); if (!fn.isEmpty()) { // MusEGlobal::museProject = QFileInfo(fn).absolutePath(); @@ -1449,10 +1450,10 @@ bool MusE::save(const QString& name, bool overwriteWarn) system(backupCommand.toLatin1().constData()); bool popenFlag; - FILE* f = MusEWidget::fileOpen(this, name, QString(".med"), "w", popenFlag, false, overwriteWarn); + FILE* f = MusEGui::fileOpen(this, name, QString(".med"), "w", popenFlag, false, overwriteWarn); if (f == 0) return false; - Xml xml(f); + MusECore::Xml xml(f); write(xml); if (ferror(f)) { QString s = "Write File\n" + name + "\nfailed: " @@ -1466,7 +1467,7 @@ bool MusE::save(const QString& name, bool overwriteWarn) } else { popenFlag? pclose(f) : fclose(f); - song->dirty = false; + MusEGlobal::song->dirty = false; return true; } } @@ -1487,14 +1488,14 @@ void MusE::quitDoc() void MusE::closeEvent(QCloseEvent* event) { QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); - song->setStop(true); + MusEGlobal::song->setStop(true); // // wait for sequencer // - while (audio->isPlaying()) { + while (MusEGlobal::audio->isPlaying()) { qApp->processEvents(); } - if (song->dirty) { + if (MusEGlobal::song->dirty) { int n = 0; n = QMessageBox::warning(this, appName, tr("The current Project contains unsaved data\n" @@ -1517,9 +1518,9 @@ void MusE::closeEvent(QCloseEvent* event) } seqStop(); - WaveTrackList* wt = song->waves(); - for (iWaveTrack iwt = wt->begin(); iwt != wt->end(); ++iwt) { - WaveTrack* t = *iwt; + MusECore::WaveTrackList* wt = MusEGlobal::song->waves(); + for (MusECore::iWaveTrack iwt = wt->begin(); iwt != wt->end(); ++iwt) { + MusECore::WaveTrack* t = *iwt; if (t->recFile() && t->recFile()->samples() == 0) { t->recFile()->remove(); } @@ -1543,13 +1544,13 @@ void MusE::closeEvent(QCloseEvent* event) } if(MusEGlobal::debugMsg) printf("MusE: Exiting JackAudio\n"); - exitJackAudio(); + MusECore::exitJackAudio(); if(MusEGlobal::debugMsg) printf("MusE: Exiting DummyAudio\n"); - exitDummyAudio(); + MusECore::exitDummyAudio(); if(MusEGlobal::debugMsg) printf("MusE: Exiting Metronome\n"); - exitMetronome(); + MusECore::exitMetronome(); // Make sure to delete the menu. ~routingPopupMenu() will NOT be called automatically. // Even though it is a child of MusE, it just passes MusE onto the underlying PopupMenus. p4.0.26 @@ -1563,17 +1564,17 @@ void MusE::closeEvent(QCloseEvent* event) } #endif - song->cleanupForQuit(); + MusEGlobal::song->cleanupForQuit(); // Give midi devices a chance to close first, above in cleanupForQuit. if(MusEGlobal::debugMsg) printf("Muse: Exiting ALSA midi\n"); - exitMidiAlsa(); + MusECore::exitMidiAlsa(); if(MusEGlobal::debugMsg) printf("Muse: Cleaning up temporary wavefiles + peakfiles\n"); // Cleanup temporary wavefiles + peakfiles used for undo - for (std::list::iterator i = temporaryWavFiles.begin(); i != temporaryWavFiles.end(); i++) { + for (std::list::iterator i = MusECore::temporaryWavFiles.begin(); i != MusECore::temporaryWavFiles.end(); i++) { QString filename = *i; QFileInfo f(filename); QDir d = f.dir(); @@ -1598,13 +1599,13 @@ void MusE::closeEvent(QCloseEvent* event) if(MusEGlobal::debugMsg) printf("MusE: Exiting OSC\n"); - exitOSC(); + MusECore::exitOSC(); // p3.3.47 delete audioPrefetch; - delete audio; - delete midiSeq; - delete song; + delete MusEGlobal::audio; + delete MusEGlobal::midiSeq; + delete MusEGlobal::song; qApp->quit(); } @@ -1626,7 +1627,7 @@ void MusE::showMarker(bool flag) { //printf("showMarker %d\n",flag); if (markerView == 0) { - markerView = new MarkerView(this); + markerView = new MusEGui::MarkerView(this); connect(markerView, SIGNAL(closed()), SLOT(markerClosed())); toplevels.push_back(markerView); @@ -1712,10 +1713,10 @@ void MusE::showTransport(bool flag) // by audio strip, midi strip, and midi trackinfo. //--------------------------------------------------------- -MusEWidget::RoutePopupMenu* MusE::getRoutingPopupMenu() +MusEGui::RoutePopupMenu* MusE::getRoutingPopupMenu() { if(!routingPopupMenu) - routingPopupMenu = new MusEWidget::RoutePopupMenu(this); + routingPopupMenu = new MusEGui::RoutePopupMenu(this); return routingPopupMenu; } @@ -1727,16 +1728,16 @@ bool MusE::saveAs() { QString name; if (MusEGlobal::museProject == MusEGlobal::museProjectInitPath ) { - if (MusEConfig::config.useProjectSaveDialog) { - MusEWidget::ProjectCreateImpl pci(MusEGlobal::muse); + if (MusEGlobal::config.useProjectSaveDialog) { + MusEGui::ProjectCreateImpl pci(MusEGlobal::muse); if (pci.exec() == QDialog::Rejected) { return false; } - song->setSongInfo(pci.getSongInfo(), true); + MusEGlobal::song->setSongInfo(pci.getSongInfo(), true); name = pci.getProjectPath(); } else { - name = MusEWidget::getSaveFileName(QString(""), MusEGlobal::med_file_save_pattern, this, tr("MusE: Save As")); + name = MusEGui::getSaveFileName(QString(""), MusEGlobal::med_file_save_pattern, this, tr("MusE: Save As")); if (name.isEmpty()) return false; } @@ -1749,7 +1750,7 @@ bool MusE::saveAs() } } else { - name = MusEWidget::getSaveFileName(QString(""), MusEGlobal::med_file_save_pattern, this, tr("MusE: Save As")); + name = MusEGui::getSaveFileName(QString(""), MusEGlobal::med_file_save_pattern, this, tr("MusE: Save As")); } bool ok = false; if (!name.isEmpty()) { @@ -1772,7 +1773,7 @@ bool MusE::saveAs() // startEditor //--------------------------------------------------------- -void MusE::startEditor(PartList* pl, int type) +void MusE::startEditor(MusECore::PartList* pl, int type) { switch (type) { case 0: startPianoroll(pl, true); break; @@ -1787,12 +1788,12 @@ void MusE::startEditor(PartList* pl, int type) // startEditor //--------------------------------------------------------- -void MusE::startEditor(Track* t) +void MusE::startEditor(MusECore::Track* t) { switch (t->type()) { - case Track::MIDI: startPianoroll(); break; - case Track::DRUM: startDrumEditor(); break; - case Track::WAVE: startWaveEditor(); break; + case MusECore::Track::MIDI: startPianoroll(); break; + case MusECore::Track::DRUM: startDrumEditor(); break; + case MusECore::Track::WAVE: startWaveEditor(); break; default: break; } @@ -1802,9 +1803,9 @@ void MusE::startEditor(Track* t) // getMidiPartsToEdit //--------------------------------------------------------- -PartList* MusE::getMidiPartsToEdit() +MusECore::PartList* MusE::getMidiPartsToEdit() { - PartList* pl = song->getSelectedMidiParts(); + MusECore::PartList* pl = MusEGlobal::song->getSelectedMidiParts(); if (pl->empty()) { QMessageBox::critical(this, QString("MusE"), tr("Nothing to edit")); return 0; @@ -1819,30 +1820,30 @@ PartList* MusE::getMidiPartsToEdit() void MusE::openInScoreEdit_oneStaffPerTrack(QWidget* dest) { - openInScoreEdit((ScoreEdit*)dest, false); + openInScoreEdit((MusEGui::ScoreEdit*)dest, false); } void MusE::openInScoreEdit_allInOne(QWidget* dest) { - openInScoreEdit((ScoreEdit*)dest, true); + openInScoreEdit((MusEGui::ScoreEdit*)dest, true); } -void MusE::openInScoreEdit(ScoreEdit* destination, bool allInOne) +void MusE::openInScoreEdit(MusEGui::ScoreEdit* destination, bool allInOne) { - PartList* pl = getMidiPartsToEdit(); + MusECore::PartList* pl = getMidiPartsToEdit(); if (pl == 0) return; openInScoreEdit(destination, pl, allInOne); } -void MusE::openInScoreEdit(ScoreEdit* destination, PartList* pl, bool allInOne) +void MusE::openInScoreEdit(MusEGui::ScoreEdit* destination, MusECore::PartList* pl, bool allInOne) { if (destination==NULL) // if no destination given, create a new one { - destination = new ScoreEdit(this, 0, _arranger->cursorValue()); + destination = new MusEGui::ScoreEdit(this, 0, _arranger->cursorValue()); destination->show(); toplevels.push_back(destination); - connect(destination, SIGNAL(deleted(TopWin*)), SLOT(toplevelDeleted(TopWin*))); + connect(destination, SIGNAL(deleted(MusEGui::TopWin*)), SLOT(toplevelDeleted(MusEGui::TopWin*))); connect(destination, SIGNAL(name_changed()), arrangerView, SLOT(scoreNamingChanged())); //connect(muse, SIGNAL(configChanged()), destination, SLOT(config_changed())); //commented out by flo, because the ScoreEditor connects to all @@ -1866,21 +1867,21 @@ void MusE::startScoreQuickly() void MusE::startPianoroll() { - PartList* pl = getMidiPartsToEdit(); + MusECore::PartList* pl = getMidiPartsToEdit(); if (pl == 0) return; startPianoroll(pl, true); } -void MusE::startPianoroll(PartList* pl, bool showDefaultCtrls) +void MusE::startPianoroll(MusECore::PartList* pl, bool showDefaultCtrls) { - PianoRoll* pianoroll = new PianoRoll(pl, this, 0, _arranger->cursorValue()); + MusEGui::PianoRoll* pianoroll = new MusEGui::PianoRoll(pl, this, 0, _arranger->cursorValue()); if(showDefaultCtrls) // p4.0.12 pianoroll->addCtrl(); pianoroll->show(); toplevels.push_back(pianoroll); - connect(pianoroll, SIGNAL(deleted(TopWin*)), SLOT(toplevelDeleted(TopWin*))); + connect(pianoroll, SIGNAL(deleted(MusEGui::TopWin*)), SLOT(toplevelDeleted(MusEGui::TopWin*))); connect(MusEGlobal::muse, SIGNAL(configChanged()), pianoroll, SLOT(configChanged())); updateWindowMenu(); } @@ -1891,18 +1892,18 @@ void MusE::startPianoroll(PartList* pl, bool showDefaultCtrls) void MusE::startListEditor() { - PartList* pl = getMidiPartsToEdit(); + MusECore::PartList* pl = getMidiPartsToEdit(); if (pl == 0) return; startListEditor(pl); } -void MusE::startListEditor(PartList* pl) +void MusE::startListEditor(MusECore::PartList* pl) { - ListEdit* listEditor = new ListEdit(pl); + MusEGui::ListEdit* listEditor = new MusEGui::ListEdit(pl); listEditor->show(); toplevels.push_back(listEditor); - connect(listEditor, SIGNAL(deleted(TopWin*)), SLOT(toplevelDeleted(TopWin*))); + connect(listEditor, SIGNAL(deleted(MusEGui::TopWin*)), SLOT(toplevelDeleted(MusEGui::TopWin*))); connect(MusEGlobal::muse,SIGNAL(configChanged()), listEditor, SLOT(configChanged())); updateWindowMenu(); } @@ -1913,10 +1914,10 @@ void MusE::startListEditor(PartList* pl) void MusE::startMasterEditor() { - MasterEdit* masterEditor = new MasterEdit(); + MusEGui::MasterEdit* masterEditor = new MusEGui::MasterEdit(); masterEditor->show(); toplevels.push_back(masterEditor); - connect(masterEditor, SIGNAL(deleted(TopWin*)), SLOT(toplevelDeleted(TopWin*))); + connect(masterEditor, SIGNAL(deleted(MusEGui::TopWin*)), SLOT(toplevelDeleted(MusEGui::TopWin*))); updateWindowMenu(); } @@ -1926,10 +1927,10 @@ void MusE::startMasterEditor() void MusE::startLMasterEditor() { - LMaster* lmaster = new LMaster(); + MusEGui::LMaster* lmaster = new MusEGui::LMaster(); lmaster->show(); toplevels.push_back(lmaster); - connect(lmaster, SIGNAL(deleted(TopWin*)), SLOT(toplevelDeleted(TopWin*))); + connect(lmaster, SIGNAL(deleted(MusEGui::TopWin*)), SLOT(toplevelDeleted(MusEGui::TopWin*))); connect(MusEGlobal::muse, SIGNAL(configChanged()), lmaster, SLOT(configChanged())); updateWindowMenu(); } @@ -1940,21 +1941,20 @@ void MusE::startLMasterEditor() void MusE::startDrumEditor() { - PartList* pl = getMidiPartsToEdit(); + MusECore::PartList* pl = getMidiPartsToEdit(); if (pl == 0) return; startDrumEditor(pl, true); } -void MusE::startDrumEditor(PartList* pl, bool showDefaultCtrls) +void MusE::startDrumEditor(MusECore::PartList* pl, bool showDefaultCtrls) { - - DrumEdit* drumEditor = new DrumEdit(pl, this, 0, _arranger->cursorValue()); + MusEGui::DrumEdit* drumEditor = new MusEGui::DrumEdit(pl, this, 0, _arranger->cursorValue()); if(showDefaultCtrls) // p4.0.12 drumEditor->addCtrl(); drumEditor->show(); toplevels.push_back(drumEditor); - connect(drumEditor, SIGNAL(deleted(TopWin*)), SLOT(toplevelDeleted(TopWin*))); + connect(drumEditor, SIGNAL(deleted(MusEGui::TopWin*)), SLOT(toplevelDeleted(MusEGui::TopWin*))); connect(MusEGlobal::muse, SIGNAL(configChanged()), drumEditor, SLOT(configChanged())); updateWindowMenu(); } @@ -1965,7 +1965,7 @@ void MusE::startDrumEditor(PartList* pl, bool showDefaultCtrls) void MusE::startWaveEditor() { - PartList* pl = song->getSelectedWaveParts(); + MusECore::PartList* pl = MusEGlobal::song->getSelectedWaveParts(); if (pl->empty()) { QMessageBox::critical(this, QString("MusE"), tr("Nothing to edit")); return; @@ -1973,13 +1973,13 @@ void MusE::startWaveEditor() startWaveEditor(pl); } -void MusE::startWaveEditor(PartList* pl) +void MusE::startWaveEditor(MusECore::PartList* pl) { - WaveEdit* waveEditor = new WaveEdit(pl); + MusEGui::WaveEdit* waveEditor = new MusEGui::WaveEdit(pl); waveEditor->show(); connect(MusEGlobal::muse, SIGNAL(configChanged()), waveEditor, SLOT(configChanged())); toplevels.push_back(waveEditor); - connect(waveEditor, SIGNAL(deleted(TopWin*)), SLOT(toplevelDeleted(TopWin*))); + connect(waveEditor, SIGNAL(deleted(MusEGui::TopWin*)), SLOT(toplevelDeleted(MusEGui::TopWin*))); updateWindowMenu(); } @@ -1989,16 +1989,16 @@ void MusE::startWaveEditor(PartList* pl) //--------------------------------------------------------- void MusE::startSongInfo(bool editable) { - MusEWidget::SongInfoWidget info; - info.viewCheckBox->setChecked(song->showSongInfoOnStartup()); + MusEGui::SongInfoWidget info; + info.viewCheckBox->setChecked(MusEGlobal::song->showSongInfoOnStartup()); info.viewCheckBox->setEnabled(editable); - info.songInfoText->setPlainText(song->getSongInfo()); + info.songInfoText->setPlainText(MusEGlobal::song->getSongInfo()); info.songInfoText->setReadOnly(!editable); info.setModal(true); info.show(); if( info.exec() == QDialog::Accepted) { if (editable) { - song->setSongInfo(info.songInfoText->toPlainText(), info.viewCheckBox->isChecked()); + MusEGlobal::song->setSongInfo(info.songInfoText->toPlainText(), info.viewCheckBox->isChecked()); } } @@ -2009,14 +2009,14 @@ void MusE::startSongInfo(bool editable) //--------------------------------------------------------- void MusE::showDidYouKnowDialog() { - if ((bool)MusEConfig::config.showDidYouKnow == true) { - MusEWidget::DidYouKnowWidget dyk; + if ((bool)MusEGlobal::config.showDidYouKnow == true) { + MusEGui::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"); - MusEConfig::config.showDidYouKnow=false; + MusEGlobal::config.showDidYouKnow=false; MusEGlobal::muse->changeConfig(true); // save settings } } @@ -2035,9 +2035,9 @@ void MusE::startClipList(bool checked) { if (clipListEdit == 0) { //clipListEdit = new ClipListEdit(); - clipListEdit = new ClipListEdit(this); + clipListEdit = new MusEGui::ClipListEdit(this); toplevels.push_back(clipListEdit); - connect(clipListEdit, SIGNAL(deleted(TopWin*)), SLOT(toplevelDeleted(TopWin*))); + connect(clipListEdit, SIGNAL(deleted(MusEGui::TopWin*)), SLOT(toplevelDeleted(MusEGui::TopWin*))); } clipListEdit->show(); viewCliplistAction->setChecked(checked); @@ -2086,9 +2086,9 @@ void MusE::selectProject(QAction* act) // toplevelDeleted //--------------------------------------------------------- -void MusE::toplevelDeleted(TopWin* tl) +void MusE::toplevelDeleted(MusEGui::TopWin* tl) { - for (iToplevel i = toplevels.begin(); i != toplevels.end(); ++i) { + for (MusEGui::iToplevel i = toplevels.begin(); i != toplevels.end(); ++i) { if (*i == tl) { if (tl == activeTopWin) @@ -2103,10 +2103,10 @@ void MusE::toplevelDeleted(TopWin* tl) bool mustUpdateScoreMenus=false; switch(tl->type()) { - case TopWin::MARKER: - case TopWin::ARRANGER: + case MusEGui::TopWin::MARKER: + case MusEGui::TopWin::ARRANGER: break; - case TopWin::CLIPLIST: + case MusEGui::TopWin::CLIPLIST: // ORCAN: This needs to be verified. aid2 used to correspond to Cliplist: //menu_audio->setItemChecked(aid2, false); viewCliplistAction->setChecked(false); @@ -2118,17 +2118,17 @@ void MusE::toplevelDeleted(TopWin* tl) // the following editors can exist in more than // one instantiation: - case TopWin::PIANO_ROLL: - case TopWin::LISTE: - case TopWin::DRUM: - case TopWin::MASTER: - case TopWin::WAVE: - case TopWin::LMASTER: + case MusEGui::TopWin::PIANO_ROLL: + case MusEGui::TopWin::LISTE: + case MusEGui::TopWin::DRUM: + case MusEGui::TopWin::MASTER: + case MusEGui::TopWin::WAVE: + case MusEGui::TopWin::LMASTER: break; - case TopWin::SCORE: + case MusEGui::TopWin::SCORE: mustUpdateScoreMenus=true; - case TopWin::TOPLEVELTYPE_LAST_ENTRY: //to avoid a warning + case MusEGui::TopWin::TOPLEVELTYPE_LAST_ENTRY: //to avoid a warning break; } toplevels.erase(i); @@ -2150,112 +2150,112 @@ void MusE::toplevelDeleted(TopWin* tl) void MusE::kbAccel(int key) { - if (key == shortcuts[SHRT_TOGGLE_METRO].key) { - song->setClick(!song->click()); - } - else if (key == shortcuts[SHRT_PLAY_TOGGLE].key) { - if (audio->isPlaying()) - //song->setStopPlay(false); - song->setStop(true); - else if (!MusEConfig::config.useOldStyleStopShortCut) - song->setPlay(true); - else if (song->cpos() != song->lpos()) - song->setPos(0, song->lPos()); + if (key == MusEGui::shortcuts[MusEGui::SHRT_TOGGLE_METRO].key) { + MusEGlobal::song->setClick(!MusEGlobal::song->click()); + } + else if (key == MusEGui::shortcuts[MusEGui::SHRT_PLAY_TOGGLE].key) { + if (MusEGlobal::audio->isPlaying()) + //MusEGlobal::song->setStopPlay(false); + MusEGlobal::song->setStop(true); + else if (!MusEGlobal::config.useOldStyleStopShortCut) + MusEGlobal::song->setPlay(true); + else if (MusEGlobal::song->cpos() != MusEGlobal::song->lpos()) + MusEGlobal::song->setPos(0, MusEGlobal::song->lPos()); else { - Pos p(0, true); - song->setPos(0, p); + MusECore::Pos p(0, true); + MusEGlobal::song->setPos(0, p); } } - else if (key == shortcuts[SHRT_STOP].key) { - //song->setPlay(false); - song->setStop(true); + else if (key == MusEGui::shortcuts[MusEGui::SHRT_STOP].key) { + //MusEGlobal::song->setPlay(false); + MusEGlobal::song->setStop(true); } - else if (key == shortcuts[SHRT_GOTO_START].key) { - Pos p(0, true); - song->setPos(0, p); + else if (key == MusEGui::shortcuts[MusEGui::SHRT_GOTO_START].key) { + MusECore::Pos p(0, true); + MusEGlobal::song->setPos(0, p); } - else if (key == shortcuts[SHRT_PLAY_SONG].key ) { - song->setPlay(true); + else if (key == MusEGui::shortcuts[MusEGui::SHRT_PLAY_SONG].key ) { + MusEGlobal::song->setPlay(true); } // p4.0.10 Tim. Normally each editor window handles these, to inc by the editor's raster snap value. // But users were asking for a global version - "they don't work when I'm in mixer or transport". // Since no editor claimed the key event, we don't know a specific editor's snap setting, // so adopt a policy where the arranger is the 'main' raster reference, I guess... - else if (key == shortcuts[SHRT_POS_DEC].key) { - int spos = song->cpos(); + else if (key == MusEGui::shortcuts[MusEGui::SHRT_POS_DEC].key) { + int spos = MusEGlobal::song->cpos(); if(spos > 0) { spos -= 1; // Nudge by -1, then snap down with raster1. - spos = AL::sigmap.raster1(spos, song->arrangerRaster()); + spos = AL::sigmap.raster1(spos, MusEGlobal::song->arrangerRaster()); } if(spos < 0) spos = 0; - Pos p(spos,true); - song->setPos(0, p, true, true, true); + MusECore::Pos p(spos,true); + MusEGlobal::song->setPos(0, p, true, true, true); return; } - else if (key == shortcuts[SHRT_POS_INC].key) { - int spos = AL::sigmap.raster2(song->cpos() + 1, song->arrangerRaster()); // Nudge by +1, then snap up with raster2. - Pos p(spos,true); - song->setPos(0, p, true, true, true); //CDW + else if (key == MusEGui::shortcuts[MusEGui::SHRT_POS_INC].key) { + int spos = AL::sigmap.raster2(MusEGlobal::song->cpos() + 1, MusEGlobal::song->arrangerRaster()); // Nudge by +1, then snap up with raster2. + MusECore::Pos p(spos,true); + MusEGlobal::song->setPos(0, p, true, true, true); //CDW return; } - else if (key == shortcuts[SHRT_POS_DEC_NOSNAP].key) { - int spos = song->cpos() - AL::sigmap.rasterStep(song->cpos(), song->arrangerRaster()); + else if (key == MusEGui::shortcuts[MusEGui::SHRT_POS_DEC_NOSNAP].key) { + int spos = MusEGlobal::song->cpos() - AL::sigmap.rasterStep(MusEGlobal::song->cpos(), MusEGlobal::song->arrangerRaster()); if(spos < 0) spos = 0; - Pos p(spos,true); - song->setPos(0, p, true, true, true); + MusECore::Pos p(spos,true); + MusEGlobal::song->setPos(0, p, true, true, true); return; } - else if (key == shortcuts[SHRT_POS_INC_NOSNAP].key) { - Pos p(song->cpos() + AL::sigmap.rasterStep(song->cpos(), song->arrangerRaster()), true); - song->setPos(0, p, true, true, true); + else if (key == MusEGui::shortcuts[MusEGui::SHRT_POS_INC_NOSNAP].key) { + MusECore::Pos p(MusEGlobal::song->cpos() + AL::sigmap.rasterStep(MusEGlobal::song->cpos(), MusEGlobal::song->arrangerRaster()), true); + MusEGlobal::song->setPos(0, p, true, true, true); return; } - else if (key == shortcuts[SHRT_GOTO_LEFT].key) { - if (!song->record()) - song->setPos(0, song->lPos()); + else if (key == MusEGui::shortcuts[MusEGui::SHRT_GOTO_LEFT].key) { + if (!MusEGlobal::song->record()) + MusEGlobal::song->setPos(0, MusEGlobal::song->lPos()); } - else if (key == shortcuts[SHRT_GOTO_RIGHT].key) { - if (!song->record()) - song->setPos(0, song->rPos()); + else if (key == MusEGui::shortcuts[MusEGui::SHRT_GOTO_RIGHT].key) { + if (!MusEGlobal::song->record()) + MusEGlobal::song->setPos(0, MusEGlobal::song->rPos()); } - else if (key == shortcuts[SHRT_TOGGLE_LOOP].key) { - song->setLoop(!song->loop()); + else if (key == MusEGui::shortcuts[MusEGui::SHRT_TOGGLE_LOOP].key) { + MusEGlobal::song->setLoop(!MusEGlobal::song->loop()); } - else if (key == shortcuts[SHRT_START_REC].key) { - if (!audio->isPlaying()) { - song->setRecord(!song->record()); + else if (key == MusEGui::shortcuts[MusEGui::SHRT_START_REC].key) { + if (!MusEGlobal::audio->isPlaying()) { + MusEGlobal::song->setRecord(!MusEGlobal::song->record()); } } - else if (key == shortcuts[SHRT_REC_CLEAR].key) { - if (!audio->isPlaying()) { - song->clearTrackRec(); + else if (key == MusEGui::shortcuts[MusEGui::SHRT_REC_CLEAR].key) { + if (!MusEGlobal::audio->isPlaying()) { + MusEGlobal::song->clearTrackRec(); } } - else if (key == shortcuts[SHRT_OPEN_TRANSPORT].key) { + else if (key == MusEGui::shortcuts[MusEGui::SHRT_OPEN_TRANSPORT].key) { toggleTransport(!viewTransportAction->isChecked()); } - else if (key == shortcuts[SHRT_OPEN_BIGTIME].key) { + else if (key == MusEGui::shortcuts[MusEGui::SHRT_OPEN_BIGTIME].key) { toggleBigTime(!viewBigtimeAction->isChecked()); } - //else if (key == shortcuts[SHRT_OPEN_MIXER].key) { + //else if (key == MusEGui::shortcuts[MusEGui::SHRT_OPEN_MIXER].key) { // toggleMixer(); // } - else if (key == shortcuts[SHRT_OPEN_MIXER].key) { + else if (key == MusEGui::shortcuts[MusEGui::SHRT_OPEN_MIXER].key) { toggleMixer1(!viewMixerAAction->isChecked()); } - else if (key == shortcuts[SHRT_OPEN_MIXER2].key) { + else if (key == MusEGui::shortcuts[MusEGui::SHRT_OPEN_MIXER2].key) { toggleMixer2(!viewMixerBAction->isChecked()); } - else if (key == shortcuts[SHRT_NEXT_MARKER].key) { + else if (key == MusEGui::shortcuts[MusEGui::SHRT_NEXT_MARKER].key) { if (markerView) markerView->nextMarker(); } - else if (key == shortcuts[SHRT_PREV_MARKER].key) { + else if (key == MusEGui::shortcuts[MusEGui::SHRT_PREV_MARKER].key) { if (markerView) markerView->prevMarker(); } @@ -2299,15 +2299,15 @@ void MusE::cmd(int cmd) { switch(cmd) { case CMD_FOLLOW_NO: - song->setFollow(Song::NO); + MusEGlobal::song->setFollow(MusECore::Song::NO); setFollow(); break; case CMD_FOLLOW_JUMP: - song->setFollow(Song::JUMP); + MusEGlobal::song->setFollow(MusECore::Song::JUMP); setFollow(); break; case CMD_FOLLOW_CONTINUOUS: - song->setFollow(Song::CONTINUOUS); + MusEGlobal::song->setFollow(MusECore::Song::CONTINUOUS); setFollow(); break; } @@ -2324,7 +2324,7 @@ void MusE::cmd(int cmd) void MusE::configAppearance() { if (!appearance) - appearance = new Appearance(_arranger); + appearance = new MusEGui::Appearance(_arranger); appearance->resetValues(); if(appearance->isVisible()) { appearance->raise(); @@ -2379,10 +2379,10 @@ void MusE::changeConfig(bool writeFlag) if (writeFlag) writeGlobalConfiguration(); - //loadStyleSheetFile(MusEConfig::config.styleSheetFile); - loadTheme(MusEConfig::config.style); - QApplication::setFont(MusEConfig::config.fonts[0]); - loadStyleSheetFile(MusEConfig::config.styleSheetFile); + //loadStyleSheetFile(MusEGlobal::config.styleSheetFile); + loadTheme(MusEGlobal::config.style); + QApplication::setFont(MusEGlobal::config.fonts[0]); + loadStyleSheetFile(MusEGlobal::config.styleSheetFile); emit configChanged(); updateConfiguration(); @@ -2395,7 +2395,7 @@ void MusE::changeConfig(bool writeFlag) void MusE::configMetronome() { if (!metronomeConfig) - metronomeConfig = new MusEWidget::MetronomeConfig; + metronomeConfig = new MusEGui::MetronomeConfig; if(metronomeConfig->isVisible()) { metronomeConfig->raise(); @@ -2413,7 +2413,7 @@ void MusE::configMetronome() void MusE::configShortCuts() { if (!shortcutConfig) - shortcutConfig = new MusEWidget::ShortcutConfig(this); + shortcutConfig = new MusEGui::ShortcutConfig(this); shortcutConfig->_config_changed = false; if (shortcutConfig->exec()) changeConfig(true); @@ -2439,12 +2439,12 @@ void MusE::openAudioFileManagement() void MusE::bounceToTrack() { - if(audio->bounce()) + if(MusEGlobal::audio->bounce()) return; - song->bounceOutput = 0; + MusEGlobal::song->bounceOutput = 0; - if(song->waves()->empty()) + if(MusEGlobal::song->waves()->empty()) { QMessageBox::critical(this, tr("MusE: Bounce to Track"), @@ -2453,7 +2453,7 @@ void MusE::bounceToTrack() return; } - OutputList* ol = song->outputs(); + MusECore::OutputList* ol = MusEGlobal::song->outputs(); if(ol->empty()) { QMessageBox::critical(this, @@ -2466,15 +2466,15 @@ void MusE::bounceToTrack() if(checkRegionNotNull()) return; - AudioOutput* out = 0; + MusECore::AudioOutput* out = 0; // If only one output, pick it, else pick the first selected. if(ol->size() == 1) out = ol->front(); else { - for(iAudioOutput iao = ol->begin(); iao != ol->end(); ++iao) + for(MusECore::iAudioOutput iao = ol->begin(); iao != ol->end(); ++iao) { - AudioOutput* o = *iao; + MusECore::AudioOutput* o = *iao; if(o->selected()) { if(out) @@ -2496,24 +2496,24 @@ void MusE::bounceToTrack() } // search target track - TrackList* tl = song->tracks(); - WaveTrack* track = 0; + MusECore::TrackList* tl = MusEGlobal::song->tracks(); + MusECore::WaveTrack* track = 0; - for (iTrack it = tl->begin(); it != tl->end(); ++it) { - Track* t = *it; + for (MusECore::iTrack it = tl->begin(); it != tl->end(); ++it) { + MusECore::Track* t = *it; if (t->selected()) { - if(t->type() != Track::WAVE && t->type() != Track::AUDIO_OUTPUT) { + if(t->type() != MusECore::Track::WAVE && t->type() != MusECore::Track::AUDIO_OUTPUT) { track = 0; break; } - if(t->type() == Track::WAVE) + if(t->type() == MusECore::Track::WAVE) { if(track) { track = 0; break; } - track = (WaveTrack*)t; + track = (MusECore::WaveTrack*)t; } } @@ -2537,28 +2537,28 @@ void MusE::bounceToTrack() } } - song->setPos(0,song->lPos(),0,true,true); - song->bounceOutput = out; - song->bounceTrack = track; - song->setRecord(true); - song->setRecordFlag(track, true); + MusEGlobal::song->setPos(0,MusEGlobal::song->lPos(),0,true,true); + MusEGlobal::song->bounceOutput = out; + MusEGlobal::song->bounceTrack = track; + MusEGlobal::song->setRecord(true); + MusEGlobal::song->setRecordFlag(track, true); track->prepareRecording(); - audio->msgBounce(); - song->setPlay(true); + MusEGlobal::audio->msgBounce(); + MusEGlobal::song->setPlay(true); } //--------------------------------------------------------- // bounceToFile //--------------------------------------------------------- -void MusE::bounceToFile(AudioOutput* ao) +void MusE::bounceToFile(MusECore::AudioOutput* ao) { - if(audio->bounce()) + if(MusEGlobal::audio->bounce()) return; - song->bounceOutput = 0; + MusEGlobal::song->bounceOutput = 0; if(!ao) { - OutputList* ol = song->outputs(); + MusECore::OutputList* ol = MusEGlobal::song->outputs(); if(ol->empty()) { QMessageBox::critical(this, @@ -2572,9 +2572,9 @@ void MusE::bounceToFile(AudioOutput* ao) ao = ol->front(); else { - for(iAudioOutput iao = ol->begin(); iao != ol->end(); ++iao) + for(MusECore::iAudioOutput iao = ol->begin(); iao != ol->end(); ++iao) { - AudioOutput* o = *iao; + MusECore::AudioOutput* o = *iao; if(o->selected()) { if(ao) @@ -2598,21 +2598,21 @@ void MusE::bounceToFile(AudioOutput* ao) if (checkRegionNotNull()) return; - SndFile* sf = getSndFile(0, this); + MusECore::SndFile* sf = MusECore::getSndFile(0, this); if (sf == 0) return; - song->setPos(0,song->lPos(),0,true,true); - song->bounceOutput = ao; + MusEGlobal::song->setPos(0,MusEGlobal::song->lPos(),0,true,true); + MusEGlobal::song->bounceOutput = ao; ao->setRecFile(sf); //willfoobar-2011-02-13 //old code//printf("ao->setRecFile %d\n", sf); printf("ao->setRecFile %ld\n", (unsigned long)sf); - song->setRecord(true, false); - song->setRecordFlag(ao, true); + MusEGlobal::song->setRecord(true, false); + MusEGlobal::song->setRecordFlag(ao, true); ao->prepareRecording(); - audio->msgBounce(); - song->setPlay(true); + MusEGlobal::audio->msgBounce(); + MusEGlobal::song->setPlay(true); } @@ -2623,8 +2623,8 @@ void MusE::bounceToFile(AudioOutput* ao) bool MusE::checkRegionNotNull() { - int start = song->lPos().frame(); - int end = song->rPos().frame(); + int start = MusEGlobal::song->lPos().frame(); + int end = MusEGlobal::song->rPos().frame(); if (end - start <= 0) { QMessageBox::critical(this, tr("MusE: Bounce"), @@ -2707,7 +2707,7 @@ MusE::lash_idle_cb () bool MusE::clearSong(bool clear_all) { - if (song->dirty) { + if (MusEGlobal::song->dirty) { int n = 0; n = QMessageBox::warning(this, appName, tr("The current Project contains unsaved data\n" @@ -2727,37 +2727,37 @@ bool MusE::clearSong(bool clear_all) printf("InternalError: gibt %d\n", n); } } - if (audio->isPlaying()) { - audio->msgPlay(false); - while (audio->isPlaying()) + if (MusEGlobal::audio->isPlaying()) { + MusEGlobal::audio->msgPlay(false); + while (MusEGlobal::audio->isPlaying()) qApp->processEvents(); } microSleep(100000); again: - for (iToplevel i = toplevels.begin(); i != toplevels.end(); ++i) { - TopWin* tl = *i; + for (MusEGui::iToplevel i = toplevels.begin(); i != toplevels.end(); ++i) { + MusEGui::TopWin* tl = *i; switch (tl->type()) { - case TopWin::CLIPLIST: - case TopWin::MARKER: - case TopWin::ARRANGER: + case MusEGui::TopWin::CLIPLIST: + case MusEGui::TopWin::MARKER: + case MusEGui::TopWin::ARRANGER: break; - case TopWin::PIANO_ROLL: - case TopWin::SCORE: - case TopWin::LISTE: - case TopWin::DRUM: - case TopWin::MASTER: - case TopWin::WAVE: - case TopWin::LMASTER: + case MusEGui::TopWin::PIANO_ROLL: + case MusEGui::TopWin::SCORE: + case MusEGui::TopWin::LISTE: + case MusEGui::TopWin::DRUM: + case MusEGui::TopWin::MASTER: + case MusEGui::TopWin::WAVE: + case MusEGui::TopWin::LMASTER: tl->close(); goto again; - case TopWin::TOPLEVELTYPE_LAST_ENTRY: //to avoid a warning + case MusEGui::TopWin::TOPLEVELTYPE_LAST_ENTRY: //to avoid a warning break; } } microSleep(100000); - song->clear(true, clear_all); + MusEGlobal::song->clear(true, clear_all); microSleep(100000); return false; } @@ -2770,7 +2770,7 @@ void MusE::startEditInstrument() { if(editInstrument == 0) { - editInstrument = new EditInstrument(this); + editInstrument = new MusEGui::EditInstrument(this); editInstrument->show(); } else @@ -2791,7 +2791,7 @@ void MusE::switchMixerAutomation() { MusEGlobal::automation = ! MusEGlobal::automation; // Clear all pressed and touched and rec event lists. - song->clearRecAutomation(true); + MusEGlobal::song->clearRecAutomation(true); // printf("automation = %d\n", automation); autoMixerAction->setChecked(MusEGlobal::automation); @@ -2812,14 +2812,14 @@ void MusE::clearAutomation() void MusE::takeAutomationSnapshot() { - int frame = song->cPos().frame(); - TrackList* tracks = song->tracks(); - for (iTrack i = tracks->begin(); i != tracks->end(); ++i) { + int frame = MusEGlobal::song->cPos().frame(); + MusECore::TrackList* tracks = MusEGlobal::song->tracks(); + for (MusECore::iTrack i = tracks->begin(); i != tracks->end(); ++i) { if ((*i)->isMidiTrack()) continue; - AudioTrack* track = (AudioTrack*)*i; - CtrlListList* cll = track->controller(); - for (iCtrlList icl = cll->begin(); icl != cll->end(); ++icl) { + MusECore::AudioTrack* track = (MusECore::AudioTrack*)*i; + MusECore::CtrlListList* cll = track->controller(); + for (MusECore::iCtrlList icl = cll->begin(); icl != cll->end(); ++icl) { double val = icl->second->curVal(); icl->second->add(frame, val); } @@ -2833,75 +2833,75 @@ void MusE::takeAutomationSnapshot() void MusE::updateConfiguration() { - fileOpenAction->setShortcut(shortcuts[SHRT_OPEN].key); - fileNewAction->setShortcut(shortcuts[SHRT_NEW].key); - fileSaveAction->setShortcut(shortcuts[SHRT_SAVE].key); - fileSaveAsAction->setShortcut(shortcuts[SHRT_SAVE_AS].key); + fileOpenAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_OPEN].key); + fileNewAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_NEW].key); + fileSaveAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_SAVE].key); + fileSaveAsAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_SAVE_AS].key); - //menu_file->setShortcut(shortcuts[SHRT_OPEN_RECENT].key, menu_ids[CMD_OPEN_RECENT]); // Not used. - fileImportMidiAction->setShortcut(shortcuts[SHRT_IMPORT_MIDI].key); - fileExportMidiAction->setShortcut(shortcuts[SHRT_EXPORT_MIDI].key); - fileImportPartAction->setShortcut(shortcuts[SHRT_IMPORT_PART].key); - fileImportWaveAction->setShortcut(shortcuts[SHRT_IMPORT_AUDIO].key); - quitAction->setShortcut(shortcuts[SHRT_QUIT].key); + //menu_file->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_OPEN_RECENT].key, menu_ids[CMD_OPEN_RECENT]); // Not used. + fileImportMidiAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_IMPORT_MIDI].key); + fileExportMidiAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_EXPORT_MIDI].key); + fileImportPartAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_IMPORT_PART].key); + fileImportWaveAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_IMPORT_AUDIO].key); + quitAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_QUIT].key); - //menu_file->setShortcut(shortcuts[SHRT_LOAD_TEMPLATE].key, menu_ids[CMD_LOAD_TEMPLATE]); // Not used. + //menu_file->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_LOAD_TEMPLATE].key, menu_ids[CMD_LOAD_TEMPLATE]); // Not used. - MusEGlobal::undoAction->setShortcut(shortcuts[SHRT_UNDO].key); - MusEGlobal::redoAction->setShortcut(shortcuts[SHRT_REDO].key); + MusEGlobal::undoAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_UNDO].key); + MusEGlobal::redoAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_REDO].key); //editSongInfoAction has no acceleration - viewTransportAction->setShortcut(shortcuts[SHRT_OPEN_TRANSPORT].key); - viewBigtimeAction->setShortcut(shortcuts[SHRT_OPEN_BIGTIME].key); - viewMixerAAction->setShortcut(shortcuts[SHRT_OPEN_MIXER].key); - viewMixerBAction->setShortcut(shortcuts[SHRT_OPEN_MIXER2].key); + viewTransportAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_OPEN_TRANSPORT].key); + viewBigtimeAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_OPEN_BIGTIME].key); + viewMixerAAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_OPEN_MIXER].key); + viewMixerBAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_OPEN_MIXER2].key); //viewCliplistAction has no acceleration - viewMarkerAction->setShortcut(shortcuts[SHRT_OPEN_MARKER].key); + viewMarkerAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_OPEN_MARKER].key); // midiEditInstAction does not have acceleration - midiResetInstAction->setShortcut(shortcuts[SHRT_MIDI_RESET].key); - midiInitInstActions->setShortcut(shortcuts[SHRT_MIDI_INIT].key); - midiLocalOffAction->setShortcut(shortcuts[SHRT_MIDI_LOCAL_OFF].key); - midiTrpAction->setShortcut(shortcuts[SHRT_MIDI_INPUT_TRANSPOSE].key); - midiInputTrfAction->setShortcut(shortcuts[SHRT_MIDI_INPUT_TRANSFORM].key); - midiInputFilterAction->setShortcut(shortcuts[SHRT_MIDI_INPUT_FILTER].key); - midiRemoteAction->setShortcut(shortcuts[SHRT_MIDI_REMOTE_CONTROL].key); + midiResetInstAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_MIDI_RESET].key); + midiInitInstActions->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_MIDI_INIT].key); + midiLocalOffAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_MIDI_LOCAL_OFF].key); + midiTrpAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_MIDI_INPUT_TRANSPOSE].key); + midiInputTrfAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_MIDI_INPUT_TRANSFORM].key); + midiInputFilterAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_MIDI_INPUT_FILTER].key); + midiRemoteAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_MIDI_REMOTE_CONTROL].key); #ifdef BUILD_EXPERIMENTAL - midiRhythmAction->setShortcut(shortcuts[SHRT_RANDOM_RHYTHM_GENERATOR].key); + midiRhythmAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_RANDOM_RHYTHM_GENERATOR].key); #endif - audioBounce2TrackAction->setShortcut(shortcuts[SHRT_AUDIO_BOUNCE_TO_TRACK].key); - audioBounce2FileAction->setShortcut(shortcuts[SHRT_AUDIO_BOUNCE_TO_FILE].key); - audioRestartAction->setShortcut(shortcuts[SHRT_AUDIO_RESTART].key); + audioBounce2TrackAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_AUDIO_BOUNCE_TO_TRACK].key); + audioBounce2FileAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_AUDIO_BOUNCE_TO_FILE].key); + audioRestartAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_AUDIO_RESTART].key); - autoMixerAction->setShortcut(shortcuts[SHRT_MIXER_AUTOMATION].key); - autoSnapshotAction->setShortcut(shortcuts[SHRT_MIXER_SNAPSHOT].key); - autoClearAction->setShortcut(shortcuts[SHRT_MIXER_AUTOMATION_CLEAR].key); + autoMixerAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_MIXER_AUTOMATION].key); + autoSnapshotAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_MIXER_SNAPSHOT].key); + autoClearAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_MIXER_AUTOMATION_CLEAR].key); - settingsGlobalAction->setShortcut(shortcuts[SHRT_GLOBAL_CONFIG].key); - settingsShortcutsAction->setShortcut(shortcuts[SHRT_CONFIG_SHORTCUTS].key); - settingsMetronomeAction->setShortcut(shortcuts[SHRT_CONFIG_METRONOME].key); - settingsMidiSyncAction->setShortcut(shortcuts[SHRT_CONFIG_MIDISYNC].key); + settingsGlobalAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_GLOBAL_CONFIG].key); + settingsShortcutsAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_CONFIG_SHORTCUTS].key); + settingsMetronomeAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_CONFIG_METRONOME].key); + settingsMidiSyncAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_CONFIG_MIDISYNC].key); // settingsMidiIOAction does not have acceleration - settingsAppearanceAction->setShortcut(shortcuts[SHRT_APPEARANCE_SETTINGS].key); - settingsMidiPortAction->setShortcut(shortcuts[SHRT_CONFIG_MIDI_PORTS].key); + settingsAppearanceAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_APPEARANCE_SETTINGS].key); + settingsMidiPortAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_CONFIG_MIDI_PORTS].key); - dontFollowAction->setShortcut(shortcuts[SHRT_FOLLOW_NO].key); - followPageAction->setShortcut(shortcuts[SHRT_FOLLOW_JUMP].key); - followCtsAction->setShortcut(shortcuts[SHRT_FOLLOW_CONTINUOUS].key); + dontFollowAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_FOLLOW_NO].key); + followPageAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_FOLLOW_JUMP].key); + followCtsAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_FOLLOW_CONTINUOUS].key); - helpManualAction->setShortcut(shortcuts[SHRT_OPEN_HELP].key); - fullscreenAction->setShortcut(shortcuts[SHRT_FULLSCREEN].key); + helpManualAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_OPEN_HELP].key); + fullscreenAction->setShortcut(MusEGui::shortcuts[MusEGui::SHRT_FULLSCREEN].key); // Orcan: Old stuff, needs to be converted. These aren't used anywhere so I commented them out - //menuSettings->setAccel(shortcuts[SHRT_CONFIG_AUDIO_PORTS].key, menu_ids[CMD_CONFIG_AUDIO_PORTS]); - //menu_help->setAccel(menu_ids[CMD_START_WHATSTHIS], shortcuts[SHRT_START_WHATSTHIS].key); + //menuSettings->setAccel(MusEGui::shortcuts[MusEGui::SHRT_CONFIG_AUDIO_PORTS].key, menu_ids[CMD_CONFIG_AUDIO_PORTS]); + //menu_help->setAccel(menu_ids[CMD_START_WHATSTHIS], MusEGui::shortcuts[MusEGui::SHRT_START_WHATSTHIS].key); - //arrangerView->updateShortcuts(); //commented out by flo: is done via signal + //arrangerView->updateMusEGui::Shortcuts(); //commented out by flo: is done via signal } @@ -2912,13 +2912,13 @@ void MusE::updateConfiguration() void MusE::showBigtime(bool on) { if (on && 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))); + bigtime = new MusEGui::BigTime(0); + bigtime->setPos(0, MusEGlobal::song->cpos(), false); + connect(MusEGlobal::song, SIGNAL(posChanged(int, unsigned, bool)), bigtime, SLOT(setPos(int, unsigned, bool))); connect(MusEGlobal::muse, SIGNAL(configChanged()), bigtime, SLOT(configChanged())); connect(bigtime, SIGNAL(closed()), SLOT(bigtimeClosed())); - bigtime->resize(MusEConfig::config.geometryBigTime.size()); - bigtime->move(MusEConfig::config.geometryBigTime.topLeft()); + bigtime->resize(MusEGlobal::config.geometryBigTime.size()); + bigtime->move(MusEGlobal::config.geometryBigTime.topLeft()); } if (bigtime) bigtime->setVisible(on); @@ -2951,10 +2951,10 @@ void MusE::bigtimeClosed() void MusE::showMixer1(bool on) { if (on && mixer1 == 0) { - mixer1 = new MusEMixer::AudioMixerApp(this, &(MusEConfig::config.mixer1)); + mixer1 = new MusEGui::AudioMixerApp(this, &(MusEGlobal::config.mixer1)); connect(mixer1, SIGNAL(closed()), SLOT(mixer1Closed())); - mixer1->resize(MusEConfig::config.mixer1.geometry.size()); - mixer1->move(MusEConfig::config.mixer1.geometry.topLeft()); + mixer1->resize(MusEGlobal::config.mixer1.geometry.size()); + mixer1->move(MusEGlobal::config.mixer1.geometry.topLeft()); } if (mixer1) mixer1->setVisible(on); @@ -2968,10 +2968,10 @@ void MusE::showMixer1(bool on) void MusE::showMixer2(bool on) { if (on && mixer2 == 0) { - mixer2 = new MusEMixer::AudioMixerApp(this, &(MusEConfig::config.mixer2)); + mixer2 = new MusEGui::AudioMixerApp(this, &(MusEGlobal::config.mixer2)); connect(mixer2, SIGNAL(closed()), SLOT(mixer2Closed())); - mixer2->resize(MusEConfig::config.mixer2.geometry.size()); - mixer2->move(MusEConfig::config.mixer2.geometry.topLeft()); + mixer2->resize(MusEGlobal::config.mixer2.geometry.size()); + mixer2->move(MusEGlobal::config.mixer2.geometry.topLeft()); } if (mixer2) mixer2->setVisible(on); @@ -3045,7 +3045,7 @@ void MusE::focusInEvent(QFocusEvent* ev) void MusE::execDeliveredScript(int id) { //QString scriptfile = QString(INSTPREFIX) + SCRIPTSSUFFIX + deliveredScriptNames[id]; - song->executeScript(song->getScriptPath(id, true).toLatin1().constData(), song->getSelectedMidiParts(), 0, false); // TODO: get quant from arranger + MusEGlobal::song->executeScript(MusEGlobal::song->getScriptPath(id, true).toLatin1().constData(), MusEGlobal::song->getSelectedMidiParts(), 0, false); // TODO: get quant from arranger } //--------------------------------------------------------- @@ -3053,7 +3053,7 @@ void MusE::execDeliveredScript(int id) //--------------------------------------------------------- void MusE::execUserScript(int id) { - song->executeScript(song->getScriptPath(id, false).toLatin1().constData(), song->getSelectedMidiParts(), 0, false); // TODO: get quant from arranger + MusEGlobal::song->executeScript(MusEGlobal::song->getScriptPath(id, false).toLatin1().constData(), MusEGlobal::song->getSelectedMidiParts(), 0, false); // TODO: get quant from arranger } //--------------------------------------------------------- @@ -3061,7 +3061,7 @@ void MusE::execUserScript(int id) //--------------------------------------------------------- void MusE::findUnusedWaveFiles() { - MusEWidget::UnusedWaveFiles unused(MusEGlobal::muse); + MusEGui::UnusedWaveFiles unused(MusEGlobal::muse); unused.exec(); } @@ -3079,7 +3079,7 @@ void MusE::focusChanged(QWidget*, QWidget* now) while (ptr) { - if ( (dynamic_cast(ptr)!=0) || // *ptr is a TopWin or a derived class + if ( (dynamic_cast(ptr)!=0) || // *ptr is a TopWin or a derived class (ptr==this) ) // the main window is selected break; ptr=dynamic_cast(ptr->parent()); //in the unlikely case that ptr is a QObject, this returns NULL, which stops the loop @@ -3088,7 +3088,7 @@ void MusE::focusChanged(QWidget*, QWidget* now) // ptr is either NULL, this or the pointer to a TopWin if (ptr!=this) // if the main win is selected, don't treat that as "none", but also don't handle it { - TopWin* win=dynamic_cast(ptr); + MusEGui::TopWin* win=dynamic_cast(ptr); // now 'win' is either NULL or the pointer to the active TopWin if (win!=activeTopWin) @@ -3100,7 +3100,7 @@ void MusE::focusChanged(QWidget*, QWidget* now) } -void MusE::activeTopWinChangedSlot(TopWin* win) +void MusE::activeTopWinChangedSlot(MusEGui::TopWin* win) { if (MusEGlobal::debugMsg) printf("ACTIVE TOPWIN CHANGED to '%s' (%p)\n", win ? win->windowTitle().toAscii().data() : "", win); @@ -3123,7 +3123,7 @@ void MusE::activeTopWinChangedSlot(TopWin* win) -void MusE::setCurrentMenuSharingTopwin(TopWin* win) +void MusE::setCurrentMenuSharingTopwin(MusEGui::TopWin* win) { if (win && (win->sharesToolsAndMenu()==false)) { @@ -3133,7 +3133,7 @@ void MusE::setCurrentMenuSharingTopwin(TopWin* win) if (win!=currentMenuSharingTopwin) { - TopWin* previousMenuSharingTopwin = currentMenuSharingTopwin; + MusEGui::TopWin* previousMenuSharingTopwin = currentMenuSharingTopwin; currentMenuSharingTopwin = NULL; if (MusEGlobal::debugMsg) printf("MENU SHARING TOPWIN CHANGED to '%s' (%p)\n", win ? win->windowTitle().toAscii().data() : "", win); @@ -3218,7 +3218,7 @@ void MusE::addMdiSubWindow(QMdiSubWindow* win) mdiArea->addSubWindow(win); } -void MusE::shareMenuAndToolbarChanged(TopWin* win, bool val) +void MusE::shareMenuAndToolbarChanged(MusEGui::TopWin* win, bool val) { if (val) { @@ -3250,7 +3250,7 @@ void MusE::updateWindowMenu() menuWindows->addAction(windowsColumnsAction); sep=false; - for (iToplevel it=toplevels.begin(); it!=toplevels.end(); it++) + for (MusEGui::iToplevel it=toplevels.begin(); it!=toplevels.end(); it++) if (((*it)->isVisible() || (*it)->isVisibleTo(this)) && (*it)->isMdiWin()) // the isVisibleTo check is neccessary because isVisible returns false if a // MdiSubWin is actually visible, but the muse main window is hidden for some reason @@ -3268,7 +3268,7 @@ void MusE::updateWindowMenu() } sep=false; - for (iToplevel it=toplevels.begin(); it!=toplevels.end(); it++) + for (MusEGui::iToplevel it=toplevels.begin(); it!=toplevels.end(); it++) if (((*it)->isVisible() || (*it)->isVisibleTo(this)) && !(*it)->isMdiWin()) { if (!sep) @@ -3289,7 +3289,7 @@ void MusE::updateWindowMenu() void MusE::bringToFront(QWidget* widget) { - TopWin* win=dynamic_cast(widget); + MusEGui::TopWin* win=dynamic_cast(widget); if (win->isMdiWin()) { win->show(); @@ -3324,12 +3324,12 @@ list get_all_visible_subwins(QMdiArea* mdiarea) for (QList::iterator it=wins.begin(); it!=wins.end(); it++) if ((*it)->isVisible() && ((*it)->isMinimized()==false)) - if (dynamic_cast((*it)->widget())->type()==TopWin::ARRANGER) + if (dynamic_cast((*it)->widget())->type()==MusEGui::TopWin::ARRANGER) result.push_back(*it); for (QList::iterator it=wins.begin(); it!=wins.end(); it++) if ((*it)->isVisible() && ((*it)->isMinimized()==false)) - if (dynamic_cast((*it)->widget())->type()!=TopWin::ARRANGER) + if (dynamic_cast((*it)->widget())->type()!=MusEGui::TopWin::ARRANGER) result.push_back(*it); return result; @@ -3453,4 +3453,4 @@ void MusE::tileSubWindows() } } -} //namespace MusEApp +} //namespace MusEGui -- cgit v1.2.3 From 5367067f7a36dce8a362dcc000d41ac581bffdfe Mon Sep 17 00:00:00 2001 From: Orcan Ogetbil Date: Fri, 7 Oct 2011 04:23:17 +0000 Subject: clean residual namespace work. fix python control build. --- muse2/CMakeLists.txt | 13 +++ muse2/ChangeLog | 1 + muse2/muse/CMakeLists.txt | 16 ++-- muse2/muse/app.cpp | 17 ++-- muse2/muse/arranger/pcanvas.cpp | 2 +- muse2/muse/audio.cpp | 10 +-- muse2/muse/audioprefetch.cpp | 26 +++--- muse2/muse/audioprefetch.h | 8 +- muse2/muse/controlfifo.cpp | 3 + muse2/muse/controlfifo.h | 3 + muse2/muse/driver/alsamidi.h | 10 +-- muse2/muse/driver/alsatimer.cpp | 4 + muse2/muse/driver/alsatimer.h | 3 + muse2/muse/driver/jack.cpp | 4 +- muse2/muse/driver/rtctimer.cpp | 3 + muse2/muse/driver/rtctimer.h | 3 + muse2/muse/driver/timerdev.h | 4 + muse2/muse/fastlog.h | 4 + muse2/muse/instruments/midictrledit.cpp | 4 + muse2/muse/mixer/astrip.cpp | 10 +-- muse2/muse/mixer/mstrip.cpp | 4 +- muse2/muse/plugin.cpp | 142 ++++++++++++++++---------------- muse2/muse/remote/CMakeLists.txt | 11 ++- muse2/muse/remote/pyapi.cpp | 139 ++++++++++++++++--------------- muse2/muse/remote/pyapi.h | 4 + muse2/muse/thread.cpp | 9 +- muse2/muse/thread.h | 6 ++ muse2/muse/waveedit/waveview.cpp | 2 +- muse2/muse/widgets/canvas.cpp | 2 +- muse2/muse/widgets/meter.cpp | 8 +- muse2/muse/widgets/verticalmeter.cpp | 4 +- 31 files changed, 278 insertions(+), 201 deletions(-) (limited to 'muse2/muse/app.cpp') diff --git a/muse2/CMakeLists.txt b/muse2/CMakeLists.txt index 9d438d0c..cfffaa8e 100644 --- a/muse2/CMakeLists.txt +++ b/muse2/CMakeLists.txt @@ -109,6 +109,7 @@ option ( ENABLE_DSSI "enable Disposable Soft Synth Interface (OSC also re option ( ENABLE_VST "enable VST/win support" OFF) option ( ENABLE_FLUID "enable fluidsynth softsynth plugins" ON) option ( ENABLE_EXPERIMENTAL "enable building experimental features" OFF) +option ( ENABLE_PYTHON "enable Python control support" OFF) option ( UPDATE_TRANSLATIONS "Update source translation share/locale/*.ts files (WARNING: This will modify the .ts files in the source tree!!)" OFF) option ( MODULES_BUILD_STATIC "Build type of internal modules" OFF) @@ -229,6 +230,17 @@ else (ENABLE_OSC) message("OSC disabled") endif (ENABLE_OSC) +## +## check for python >= 2.4 +## + +if (ENABLE_PYTHON) + PKG_CHECK_MODULES(PYTHON python>=2.4) + if (PYTHON_FOUND) + set(PYTHON_SUPPORT ON) + endif (PYTHON_FOUND) +endif (ENABLE_PYTHON) + ## ## check for dssi >= 0.9.0 ## @@ -400,6 +412,7 @@ add_custom_target(uninstall ## Show a summary of what we got summary_add("Lash support" HAVE_LASH) summary_add("OSC (Liblo) support" OSC_SUPPORT) +summary_add("Python support" PYTHON_SUPPORT) summary_add("DSSI support" DSSI_SUPPORT) summary_add("VST support" VST_SUPPORT) summary_add("Fluidsynth support" HAVE_FLUIDSYNTH) diff --git a/muse2/ChangeLog b/muse2/ChangeLog index 59f8de4e..11ee89bc 100644 --- a/muse2/ChangeLog +++ b/muse2/ChangeLog @@ -6,6 +6,7 @@ o MusECore: For non-gui classes o MusEGui: For gui classes One or two more namespaces will be added for the stuff outside the main tree (synti, al, etc) (Orcan) + - Fixed python control add-on building. Left it off by default. (Orcan) 05.09.2011: - SigEdit, up/down arrow in denominator only moves between powers of two, 2,4,8...128 (rj) 04.09.2011: diff --git a/muse2/muse/CMakeLists.txt b/muse2/muse/CMakeLists.txt index b26100f9..187bd41e 100644 --- a/muse2/muse/CMakeLists.txt +++ b/muse2/muse/CMakeLists.txt @@ -43,11 +43,11 @@ set (SubDirs widgets ) -if (ENABLE_PYTHON) - set ( PYREM_CPP_FLAGS "-DENABLE_PYTHON" ) - set ( PYLIBS ${PYTHON_LIB} remote) +if (PYTHON_SUPPORT) + set ( REM_CPP_FLAGS "-DENABLE_PYTHON" ) + set ( REM_LIB remote ) set ( SubDirs ${SubDirs} remote ) -endif (ENABLE_PYTHON) +endif (PYTHON_SUPPORT) subdirs (${SubDirs}) @@ -207,9 +207,9 @@ include_directories( ## set_target_properties( core # PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h" - # PROPERTIES COMPILE_FLAGS "-Imidiedit -Iarranger -Iliste -Iwidgets -Imixer -Idriver -Iwaveedit -Implugins -Iinstruments -Iremote ${PYREM_CPP_FLAGS} -include ${PROJECT_BINARY_DIR}/all.h " - # PROPERTIES COMPILE_FLAGS "${PYREM_CPP_FLAGS} -DINSTPREFIX='\"${CMAKE_INSTALL_PREFIX}\"' -DINSTLIBDIR='\"${LIBRARY_OUTPUT_DIRECTORY}\"' -include ${PROJECT_BINARY_DIR}/all.h " - PROPERTIES COMPILE_FLAGS "${PYREM_CPP_FLAGS} -include ${PROJECT_BINARY_DIR}/all.h" + # PROPERTIES COMPILE_FLAGS "-Imidiedit -Iarranger -Iliste -Iwidgets -Imixer -Idriver -Iwaveedit -Implugins -Iinstruments -Iremote ${REM_CPP_FLAGS} -include ${PROJECT_BINARY_DIR}/all.h " + # PROPERTIES COMPILE_FLAGS "${REM_CPP_FLAGS} -DINSTPREFIX='\"${CMAKE_INSTALL_PREFIX}\"' -DINSTLIBDIR='\"${LIBRARY_OUTPUT_DIRECTORY}\"' -include ${PROJECT_BINARY_DIR}/all.h " + PROPERTIES COMPILE_FLAGS "${REM_CPP_FLAGS} -include ${PROJECT_BINARY_DIR}/all.h" OUTPUT_NAME muse_core ) set_target_properties( muse @@ -246,7 +246,7 @@ target_link_libraries(core ${SNDFILE_LIBRARIES} ${SAMPLERATE_LIBRARIES} ${UUID_LIBRARIES} - ${PYLIBS} + ${REM_LIB} ${FST_LIB} dl ) diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp index 8d390468..677743b3 100644 --- a/muse2/muse/app.cpp +++ b/muse2/muse/app.cpp @@ -65,6 +65,7 @@ #include "mixdowndialog.h" #include "pianoroll.h" #include "scoreedit.h" +#include "remote/pyapi.h" #include "routepopup.h" #include "shortcutconfig.h" #include "songinfo.h" @@ -211,9 +212,9 @@ bool MusE::seqStart() // printf("MusE: WARNING: Midi realtime priority %d is the same as audio prefetch realtime priority %d. Try a different setting.\n", // midiprio, pfprio); - audioPrefetch->start(pfprio); + MusEGlobal::audioPrefetch->start(pfprio); - audioPrefetch->msgSeek(0, true); // force + MusEGlobal::audioPrefetch->msgSeek(0, true); // force //MusEGlobal::midiSeqRunning = !midiSeq->start(MusEGlobal::realTimeScheduling ? MusEGlobal::realTimePriority : 0); // Changed by Tim. p3.3.22 @@ -255,7 +256,7 @@ void MusE::seqStop() MusEGlobal::song->setStopPlay(false); MusEGlobal::midiSeq->stop(true); MusEGlobal::audio->stop(true); - audioPrefetch->stop(true); + MusEGlobal::audioPrefetch->stop(true); if (MusEGlobal::realTimeScheduling && watchdogThread) pthread_cancel(watchdogThread); } @@ -372,9 +373,9 @@ MusE::MusE(int argc, char** argv) : QMainWindow() // Python bridge //--------------------------------------------------- // Uncomment in order to enable MusE Python bridge: - if (usePythonBridge) { + if (MusEGlobal::usePythonBridge) { printf("Initializing python bridge!\n"); - if (initPythonBridge() == false) { + if (MusECore::initPythonBridge() == false) { printf("Could not initialize Python bridge\n"); exit(1); } @@ -736,8 +737,8 @@ MusE::MusE(int argc, char** argv) : QMainWindow() //MusEGlobal::midiSeq = new MusECore::MidiSeq(MusEGlobal::realTimeScheduling ? MusEGlobal::realTimePriority : 0, "Midi"); MusEGlobal::midiSeq = new MusECore::MidiSeq("Midi"); MusEGlobal::audio = new MusECore::Audio(); - //audioPrefetch = new AudioPrefetch(0, "Disc"); - audioPrefetch = new AudioPrefetch("Prefetch"); + //MusEGlobal::audioPrefetch = new MusECore::AudioPrefetch(0, "Disc"); + MusEGlobal::audioPrefetch = new MusECore::AudioPrefetch("Prefetch"); //--------------------------------------------------- // Popups @@ -1602,7 +1603,7 @@ void MusE::closeEvent(QCloseEvent* event) MusECore::exitOSC(); // p3.3.47 - delete audioPrefetch; + delete MusEGlobal::audioPrefetch; delete MusEGlobal::audio; delete MusEGlobal::midiSeq; delete MusEGlobal::song; diff --git a/muse2/muse/arranger/pcanvas.cpp b/muse2/muse/arranger/pcanvas.cpp index 1984f799..0f2f4629 100644 --- a/muse2/muse/arranger/pcanvas.cpp +++ b/muse2/muse/arranger/pcanvas.cpp @@ -3953,7 +3953,7 @@ void PartCanvas::processAutomationMovements(QPoint pos, bool addPoint) double PartCanvas::dbToVal(double inDb) { - return (20.0*fast_log10(inDb)+60.0) / 70.0; + return (20.0*MusECore::fast_log10(inDb)+60.0) / 70.0; } double PartCanvas::valToDb(double inV) { diff --git a/muse2/muse/audio.cpp b/muse2/muse/audio.cpp index 1f3dc6ad..fd90c2c2 100644 --- a/muse2/muse/audio.cpp +++ b/muse2/muse/audio.cpp @@ -260,7 +260,7 @@ bool Audio::sync(int jackState, unsigned frame) Pos p(frame, false); seek(p); if (!_freewheel) - done = audioPrefetch->seekDone(); + done = MusEGlobal::audioPrefetch->seekDone(); if (s == START_PLAY) state = START_PLAY; } @@ -269,7 +269,7 @@ bool Audio::sync(int jackState, unsigned frame) // seek during seek seek(Pos(frame, false)); } - done = audioPrefetch->seekDone(); + done = MusEGlobal::audioPrefetch->seekDone(); } } return done; @@ -399,7 +399,7 @@ void Audio::process(unsigned frames) if (isPlaying()) { if (!freewheel()) - audioPrefetch->msgTick(); + MusEGlobal::audioPrefetch->msgTick(); if (_bounce && _pos >= MusEGlobal::song->rPos()) { _bounce = false; @@ -759,11 +759,11 @@ void Audio::seek(const Pos& p) //loopPassed = true; // for record loop mode if (state != LOOP2 && !freewheel()) { - //audioPrefetch->msgSeek(_pos.frame()); + //MusEGlobal::audioPrefetch->msgSeek(_pos.frame()); // We need to force prefetch to update, to ensure the most recent data. // Things can happen to a part before play is pressed - such as part muting, // part moving etc. Without a force, the wrong data was being played. Tim 08/17/08 - audioPrefetch->msgSeek(_pos.frame(), true); + MusEGlobal::audioPrefetch->msgSeek(_pos.frame(), true); } write(sigFd, "G", 1); // signal seek to gui diff --git a/muse2/muse/audioprefetch.cpp b/muse2/muse/audioprefetch.cpp index e72b8a8c..9406911f 100644 --- a/muse2/muse/audioprefetch.cpp +++ b/muse2/muse/audioprefetch.cpp @@ -33,6 +33,12 @@ #include "audio.h" #include "sync.h" +namespace MusEGlobal { +MusECore::AudioPrefetch* audioPrefetch; +} + +namespace MusECore { + // Added by Tim. p3.3.20 //#define AUDIOPREFETCH_DEBUG @@ -47,8 +53,6 @@ struct PrefetchMsg : public ThreadMsg { int pos; }; -AudioPrefetch* audioPrefetch; - //--------------------------------------------------------- // AudioPrefetch //--------------------------------------------------------- @@ -82,7 +86,7 @@ static void readMsgP(void* p, void*) void AudioPrefetch::start(int priority) { clearPollFd(); - addPollFd(toThreadFdr, POLLIN, ::readMsgP, this, 0); + addPollFd(toThreadFdr, POLLIN, MusECore::readMsgP, this, 0); //Thread::start(); Thread::start(priority); } @@ -181,7 +185,7 @@ void AudioPrefetch::prefetch(bool doSeek) return; } if (MusEGlobal::song->loop() && !MusEGlobal::audio->bounce() && !MusEGlobal::extSyncFlag.value()) { - const MusECore::Pos& loop = MusEGlobal::song->rPos(); + const Pos& loop = MusEGlobal::song->rPos(); unsigned n = loop.frame() - writePos; if (n < MusEGlobal::segmentSize) { unsigned lpos = MusEGlobal::song->lPos().frame(); @@ -192,9 +196,9 @@ void AudioPrefetch::prefetch(bool doSeek) writePos = lpos - n; } } - MusECore::WaveTrackList* tl = MusEGlobal::song->waves(); - for (MusECore::iWaveTrack it = tl->begin(); it != tl->end(); ++it) { - MusECore::WaveTrack* track = *it; + WaveTrackList* tl = MusEGlobal::song->waves(); + for (iWaveTrack it = tl->begin(); it != tl->end(); ++it) { + WaveTrack* track = *it; // p3.3.29 // Save time. Don't bother if track is off. Track On/Off not designed for rapid repeated response (but mute is). if(track->off()) @@ -245,9 +249,9 @@ void AudioPrefetch::seek(unsigned seekTo) } writePos = seekTo; - MusECore::WaveTrackList* tl = MusEGlobal::song->waves(); - for (MusECore::iWaveTrack it = tl->begin(); it != tl->end(); ++it) { - MusECore::WaveTrack* track = *it; + WaveTrackList* tl = MusEGlobal::song->waves(); + for (iWaveTrack it = tl->begin(); it != tl->end(); ++it) { + WaveTrack* track = *it; track->clearPrefetchFifo(); } @@ -275,3 +279,5 @@ void AudioPrefetch::seek(unsigned seekTo) --seekCount; } +} // namespace MusECore + diff --git a/muse2/muse/audioprefetch.h b/muse2/muse/audioprefetch.h index e55251dc..5b34b2cc 100644 --- a/muse2/muse/audioprefetch.h +++ b/muse2/muse/audioprefetch.h @@ -26,6 +26,8 @@ #include "thread.h" +namespace MusECore { + //--------------------------------------------------------- // AudioPrefetch //--------------------------------------------------------- @@ -56,6 +58,10 @@ class AudioPrefetch : public Thread { bool seekDone() const { return seekCount == 0; } }; -extern AudioPrefetch* audioPrefetch; +} // namespace MusECore + +namespace MusEGlobal { +extern MusECore::AudioPrefetch* audioPrefetch; +} #endif diff --git a/muse2/muse/controlfifo.cpp b/muse2/muse/controlfifo.cpp index 741caad1..c9ff9ed6 100644 --- a/muse2/muse/controlfifo.cpp +++ b/muse2/muse/controlfifo.cpp @@ -21,6 +21,8 @@ #include "controlfifo.h" +namespace MusECore { + //--------------------------------------------------------- // ControlFifo // put @@ -73,5 +75,6 @@ void ControlFifo::remove() --size; } +} // namespace MusECore diff --git a/muse2/muse/controlfifo.h b/muse2/muse/controlfifo.h index 8a9578f1..6a35c8a5 100644 --- a/muse2/muse/controlfifo.h +++ b/muse2/muse/controlfifo.h @@ -24,6 +24,8 @@ #define CONTROL_FIFO_SIZE 8192 +namespace MusECore { + //--------------------------------------------------------- // ControlEvent // Item struct for ControlFifo. @@ -62,5 +64,6 @@ class ControlFifo int getSize() const { return size; } }; +} // namespace MusECore #endif diff --git a/muse2/muse/driver/alsamidi.h b/muse2/muse/driver/alsamidi.h index 832d86d7..2054a7d3 100644 --- a/muse2/muse/driver/alsamidi.h +++ b/muse2/muse/driver/alsamidi.h @@ -45,8 +45,8 @@ class MidiAlsaDevice : public MidiDevice { private: // Special for ALSA midi device: Play event list is processed in the ALSA midi sequencer thread. // Need this FIFO, to decouple from audio thread which adds events to the list. - MusECore::MidiFifo playEventFifo; - MusECore::MidiFifo stuckNotesFifo; + MidiFifo playEventFifo; + MidiFifo stuckNotesFifo; volatile bool stopPending; volatile bool seekPending; @@ -57,7 +57,7 @@ class MidiAlsaDevice : public MidiDevice { virtual int selectWfd(); bool putEvent(snd_seq_event_t*); - virtual bool putMidiEvent(const MusECore::MidiPlayEvent&); + virtual bool putMidiEvent(const MidiPlayEvent&); public: MidiAlsaDevice(const snd_seq_addr_t&, const QString& name); @@ -69,9 +69,9 @@ class MidiAlsaDevice : public MidiDevice { virtual void writeRouting(int, Xml&) const; virtual inline int deviceType() const { return ALSA_MIDI; } // Schedule an event for playback. Returns false if event cannot be delivered. - virtual bool addScheduledEvent(const MusECore::MidiPlayEvent& ev) { return !playEventFifo.put(ev); } + virtual bool addScheduledEvent(const MidiPlayEvent& ev) { return !playEventFifo.put(ev); } // Add a stuck note. Returns false if event cannot be delivered. - virtual bool addStuckNote(const MusECore::MidiPlayEvent& ev) { return !stuckNotesFifo.put(ev); } + virtual bool addStuckNote(const MidiPlayEvent& ev) { return !stuckNotesFifo.put(ev); } // Play all events up to current frame. virtual void processMidi(); virtual void handleStop(); diff --git a/muse2/muse/driver/alsatimer.cpp b/muse2/muse/driver/alsatimer.cpp index dee661fe..ee72d679 100644 --- a/muse2/muse/driver/alsatimer.cpp +++ b/muse2/muse/driver/alsatimer.cpp @@ -28,6 +28,8 @@ #include #define TIMER_DEBUG 0 + +namespace MusECore { AlsaTimer::AlsaTimer() { @@ -238,3 +240,5 @@ } return tr.ticks; } + +} // namespace MusECore diff --git a/muse2/muse/driver/alsatimer.h b/muse2/muse/driver/alsatimer.h index b906c02d..79e9193e 100644 --- a/muse2/muse/driver/alsatimer.h +++ b/muse2/muse/driver/alsatimer.h @@ -30,6 +30,7 @@ #include "alsa/asoundlib.h" #include "timerdev.h" +namespace MusECore { //--------------------------------------------------------- // AlsaTimer @@ -64,4 +65,6 @@ class AlsaTimer : public Timer{ void setFindBestTimer(bool b) { findBest = b; } }; +} // namespace MusECore + #endif //__ALSATIMER_H__ diff --git a/muse2/muse/driver/jack.cpp b/muse2/muse/driver/jack.cpp index 542c68ba..733353d8 100644 --- a/muse2/muse/driver/jack.cpp +++ b/muse2/muse/driver/jack.cpp @@ -2234,8 +2234,8 @@ void exitJackAudio() { if (JACK_DEBUG) printf("exitJackAudio()\n"); - if (MusECore::jackAudio) - delete MusECore::jackAudio; + if (jackAudio) + delete jackAudio; if (JACK_DEBUG) printf("exitJackAudio() after delete jackAudio\n"); diff --git a/muse2/muse/driver/rtctimer.cpp b/muse2/muse/driver/rtctimer.cpp index fd0fe8ed..365b8501 100644 --- a/muse2/muse/driver/rtctimer.cpp +++ b/muse2/muse/driver/rtctimer.cpp @@ -41,6 +41,7 @@ #include "globals.h" #include "gconfig.h" +namespace MusECore { RtcTimer::RtcTimer() { @@ -168,3 +169,5 @@ unsigned int RtcTimer::getTimerTicks(bool /*printTicks*/)// prevent compiler war } return nn; } + +} // namespace MusECore diff --git a/muse2/muse/driver/rtctimer.h b/muse2/muse/driver/rtctimer.h index 5befdf22..425ea643 100644 --- a/muse2/muse/driver/rtctimer.h +++ b/muse2/muse/driver/rtctimer.h @@ -29,6 +29,7 @@ #include "timerdev.h" +namespace MusECore { //--------------------------------------------------------- // AlsaTimer @@ -56,4 +57,6 @@ class RtcTimer : public Timer{ }; +} // namespace MusECore + #endif //__ALSATIMER_H__ diff --git a/muse2/muse/driver/timerdev.h b/muse2/muse/driver/timerdev.h index 960cf2f4..56f9216e 100644 --- a/muse2/muse/driver/timerdev.h +++ b/muse2/muse/driver/timerdev.h @@ -31,6 +31,8 @@ #define TIMER_DEBUG 0 +namespace MusECore { + //--------------------------------------------------------- // AlsaTimer //--------------------------------------------------------- @@ -53,4 +55,6 @@ class Timer { }; +} // namespace MusECore + #endif //__ALSATIMER_H__ diff --git a/muse2/muse/fastlog.h b/muse2/muse/fastlog.h index b992bd49..bbcf18cc 100644 --- a/muse2/muse/fastlog.h +++ b/muse2/muse/fastlog.h @@ -28,6 +28,8 @@ #include /* for HUGE_VAL */ +namespace MusECore { + static inline float fast_log2 (float val) { /* don't use reinterpret_cast<> because that prevents this @@ -57,4 +59,6 @@ static inline float fast_log10 (const float val) static inline float minus_infinity() { return -HUGE_VAL; } +} // namespace MusECore + #endif /* __pbd_fastlog_h__ */ diff --git a/muse2/muse/instruments/midictrledit.cpp b/muse2/muse/instruments/midictrledit.cpp index 71e52127..a9ca6383 100644 --- a/muse2/muse/instruments/midictrledit.cpp +++ b/muse2/muse/instruments/midictrledit.cpp @@ -34,6 +34,8 @@ #include "filedialog.h" #include "globals.h" +namespace MusEGui { + MidiControllerEditDialog* midiControllerEditDialog; static MidiController predefinedMidiController[] = { @@ -738,3 +740,5 @@ void configMidiController() midiControllerEditDialog->show(); } } + +} // namespace MusEGui diff --git a/muse2/muse/mixer/astrip.cpp b/muse2/muse/mixer/astrip.cpp index dd53dfc8..10f281fb 100644 --- a/muse2/muse/mixer/astrip.cpp +++ b/muse2/muse/mixer/astrip.cpp @@ -207,7 +207,7 @@ void AudioStrip::songChanged(int val) if (val & SC_AUX) { int n = auxKnob.size(); for (int idx = 0; idx < n; ++idx) { - double val = fast_log10(src->auxSend(idx)) * 20.0; + double val = MusECore::fast_log10(src->auxSend(idx)) * 20.0; auxKnob[idx]->blockSignals(true); auxLabel[idx]->blockSignals(true); auxKnob[idx]->setValue(val); @@ -278,7 +278,7 @@ void AudioStrip::updateVolume() slider->blockSignals(true); sl->blockSignals(true); - double val = fast_log10(vol) * 20.0; + double val = MusECore::fast_log10(vol) * 20.0; slider->setValue(val); sl->setValue(val); sl->blockSignals(false); @@ -796,7 +796,7 @@ AudioStrip::AudioStrip(QWidget* parent, MusECore::AudioTrack* at) MusEGui::Knob* ak = addKnob(1, idx, &al); auxKnob.push_back(ak); auxLabel.push_back(al); - double val = fast_log10(t->auxSend(idx))*20.0; + double val = MusECore::fast_log10(t->auxSend(idx))*20.0; ak->setValue(val); al->setValue(val); } @@ -822,7 +822,7 @@ AudioStrip::AudioStrip(QWidget* parent, MusECore::AudioTrack* at) slider->setRange(MusEGlobal::config.minSlider-0.1, 10.0); slider->setFixedWidth(20); slider->setFont(MusEGlobal::config.fonts[1]); - slider->setValue(fast_log10(t->volume())*20.0); + slider->setValue(MusECore::fast_log10(t->volume())*20.0); sliderGrid->addWidget(slider, 0, 0, Qt::AlignHCenter); @@ -845,7 +845,7 @@ AudioStrip::AudioStrip(QWidget* parent, MusECore::AudioTrack* at) sl->setFrame(true); sl->setPrecision(0); sl->setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum)); - sl->setValue(fast_log10(t->volume()) * 20.0); + sl->setValue(MusECore::fast_log10(t->volume()) * 20.0); connect(sl, SIGNAL(valueChanged(double,int)), SLOT(volLabelChanged(double))); //connect(sl, SIGNAL(valueChanged(double,int)), SLOT(volumeChanged(double))); diff --git a/muse2/muse/mixer/mstrip.cpp b/muse2/muse/mixer/mstrip.cpp index 2de0d981..2e51feb9 100644 --- a/muse2/muse/mixer/mstrip.cpp +++ b/muse2/muse/mixer/mstrip.cpp @@ -259,7 +259,7 @@ MidiStrip::MidiStrip(QWidget* parent, MusECore::MidiTrack* t) dlv = sl->minValue() - 0.5 * (sl->minValue() - sl->off()); else { - dlv = -fast_log10(float(127*127)/float(v*v))*20.0; + dlv = -MusECore::fast_log10(float(127*127)/float(v*v))*20.0; if(dlv > sl->maxValue()) dlv = sl->maxValue(); } @@ -693,7 +693,7 @@ void MidiStrip::updateControls() } else { - double v = -fast_log10(float(127*127)/float(ivol*ivol))*20.0; + double v = -MusECore::fast_log10(float(127*127)/float(ivol*ivol))*20.0; if(v > sl->maxValue()) { //printf("MidiStrip::updateControls setting volume slider label\n"); diff --git a/muse2/muse/plugin.cpp b/muse2/muse/plugin.cpp index 15e6c04c..63e65f2e 100644 --- a/muse2/muse/plugin.cpp +++ b/muse2/muse/plugin.cpp @@ -3548,13 +3548,13 @@ PluginGui::PluginGui(MusECore::PluginIBase* p) if (strcmp(obj->metaObject()->className(), "Slider") == 0) { gw[nobj].type = GuiWidgets::SLIDER; - ((MusEGui::Slider*)obj)->setId(nobj); - ((MusEGui::Slider*)obj)->setCursorHoming(true); + ((Slider*)obj)->setId(nobj); + ((Slider*)obj)->setCursorHoming(true); //for(int i = 0; i < nobj; i++) for(unsigned long i = 0; i < nobj; i++) // p4.0.21 { if(gw[i].type == GuiWidgets::DOUBLE_LABEL && gw[i].param == parameter) - ((MusEGui::DoubleLabel*)gw[i].widget)->setSlider((MusEGui::Slider*)obj); + ((DoubleLabel*)gw[i].widget)->setSlider((Slider*)obj); } connect(obj, SIGNAL(sliderMoved(double,int)), mapper, SLOT(map())); connect(obj, SIGNAL(sliderPressed(int)), SLOT(guiSliderPressed(int))); @@ -3563,13 +3563,13 @@ PluginGui::PluginGui(MusECore::PluginIBase* p) } else if (strcmp(obj->metaObject()->className(), "DoubleLabel") == 0) { gw[nobj].type = GuiWidgets::DOUBLE_LABEL; - ((MusEGui::DoubleLabel*)obj)->setId(nobj); + ((DoubleLabel*)obj)->setId(nobj); //for(int i = 0; i < nobj; i++) for(unsigned long i = 0; i < nobj; i++) { if(gw[i].type == GuiWidgets::SLIDER && gw[i].param == parameter) { - ((MusEGui::DoubleLabel*)obj)->setSlider((MusEGui::Slider*)gw[i].widget); + ((DoubleLabel*)obj)->setSlider((Slider*)gw[i].widget); break; } } @@ -3609,7 +3609,7 @@ PluginGui::PluginGui(MusECore::PluginIBase* p) unsigned long n = plugin->parameters(); // p4.0.21 params = new GuiParam[n]; - //int style = MusEGui::Slider::BgTrough | MusEGui::Slider::BgSlot; + //int style = Slider::BgTrough | Slider::BgSlot; QFontMetrics fm = fontMetrics(); int h = fm.height() + 4; @@ -3629,7 +3629,7 @@ PluginGui::PluginGui(MusECore::PluginIBase* p) if (LADSPA_IS_HINT_TOGGLED(range.HintDescriptor)) { params[i].type = GuiParam::GUI_SWITCH; - MusEGui::CheckBox* cb = new MusEGui::CheckBox(mw, i, "param"); + CheckBox* cb = new CheckBox(mw, i, "param"); cb->setId(i); cb->setText(QString(plugin->paramName(i))); cb->setChecked(plugin->param(i) != 0.0); @@ -3639,7 +3639,7 @@ PluginGui::PluginGui(MusECore::PluginIBase* p) else { label = new QLabel(QString(plugin->paramName(i)), 0); params[i].type = GuiParam::GUI_SLIDER; - params[i].label = new MusEGui::DoubleLabel(val, lower, upper, 0); + params[i].label = new DoubleLabel(val, lower, upper, 0); params[i].label->setFrame(true); params[i].label->setPrecision(2); params[i].label->setId(i); @@ -3652,8 +3652,8 @@ PluginGui::PluginGui(MusECore::PluginIBase* p) uint c3 = j * j * j * 43 % 256; QColor color(c1, c2, c3); - MusEGui::Slider* s = new MusEGui::Slider(0, "param", Qt::Horizontal, - MusEGui::Slider::None, color); + Slider* s = new Slider(0, "param", Qt::Horizontal, + Slider::None, color); s->setCursorHoming(true); s->setId(i); @@ -3663,7 +3663,7 @@ PluginGui::PluginGui(MusECore::PluginIBase* p) s->setStep(1.0); s->setValue(dval); params[i].actuator = s; - params[i].label->setSlider((MusEGui::Slider*)params[i].actuator); + params[i].label->setSlider((Slider*)params[i].actuator); } //params[i].actuator->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Maximum)); params[i].actuator->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed)); @@ -3715,22 +3715,22 @@ PluginGui::PluginGui(MusECore::PluginIBase* p) getPluginConvertedValues(range, lower, upper, dlower, dupper, dval); label = new QLabel(QString(plugin->paramOutName(i)), 0); paramsOut[i].type = GuiParam::GUI_METER; - paramsOut[i].label = new MusEGui::DoubleLabel(val, lower, upper, 0); + paramsOut[i].label = new DoubleLabel(val, lower, upper, 0); paramsOut[i].label->setFrame(true); paramsOut[i].label->setPrecision(2); paramsOut[i].label->setId(i); - MusEGui::Meter::MeterType mType=MusEGui::Meter::LinMeter; + Meter::MeterType mType=Meter::LinMeter; if(LADSPA_IS_HINT_INTEGER(range.HintDescriptor)) - mType=MusEGui::Meter::DBMeter; - MusEGui::VerticalMeter* m = new MusEGui::VerticalMeter(this, mType); + mType=Meter::DBMeter; + VerticalMeter* m = new VerticalMeter(this, mType); //printf("lower =%f upper=%f dlower=%f dupper=%f\n", lower, upper,dlower,dupper); m->setRange(dlower, dupper); m->setVal(dval); m->setFixedHeight(h); paramsOut[i].actuator = m; -// paramsOut[i].label->setSlider((MusEGui::Slider*)params[i].actuator); +// paramsOut[i].label->setSlider((Slider*)params[i].actuator); //paramsOut[i].actuator->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed)); label->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed)); paramsOut[i].label->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed)); @@ -3781,9 +3781,9 @@ void PluginGui::getPluginConvertedValues(LADSPA_PortRangeHint range, if (LADSPA_IS_HINT_LOGARITHMIC(range.HintDescriptor)) { if (lower == 0.0) lower = 0.001; - dlower = fast_log10(lower)*20.0; - dupper = fast_log10(upper)*20.0; - dval = fast_log10(dval) * 20.0; + dlower = MusECore::fast_log10(lower)*20.0; + dupper = MusECore::fast_log10(upper)*20.0; + dval = MusECore::fast_log10(dval) * 20.0; } } @@ -3820,13 +3820,13 @@ void PluginGui::ctrlPressed(int param) if(params[param].type == GuiParam::GUI_SLIDER) { - double val = ((MusEGui::Slider*)params[param].actuator)->value(); + double val = ((Slider*)params[param].actuator)->value(); if (LADSPA_IS_HINT_LOGARITHMIC(params[param].hint)) val = pow(10.0, val/20.0); else if (LADSPA_IS_HINT_INTEGER(params[param].hint)) val = rint(val); plugin->setParam(param, val); - ((MusEGui::DoubleLabel*)params[param].label)->setValue(val); + ((DoubleLabel*)params[param].label)->setValue(val); // p3.3.43 //MusEGlobal::audio->msgSetPluginCtrlVal(((PluginI*)plugin), id, val); @@ -3844,8 +3844,8 @@ void PluginGui::ctrlPressed(int param) } else if(params[param].type == GuiParam::GUI_SWITCH) { - //double val = (double)((MusEGui::CheckBox*)params[param].actuator)->isChecked(); - float val = (float)((MusEGui::CheckBox*)params[param].actuator)->isChecked(); // p4.0.21 + //double val = (double)((CheckBox*)params[param].actuator)->isChecked(); + float val = (float)((CheckBox*)params[param].actuator)->isChecked(); // p4.0.21 plugin->setParam(param, val); // p3.3.43 @@ -3888,7 +3888,7 @@ void PluginGui::ctrlReleased(int param) if(params[param].type == GuiParam::GUI_SLIDER) { - double val = ((MusEGui::Slider*)params[param].actuator)->value(); + double val = ((Slider*)params[param].actuator)->value(); if (LADSPA_IS_HINT_LOGARITHMIC(params[param].hint)) val = pow(10.0, val/20.0); else if (LADSPA_IS_HINT_INTEGER(params[param].hint)) @@ -3897,7 +3897,7 @@ void PluginGui::ctrlReleased(int param) } //else if(params[param].type == GuiParam::GUI_SWITCH) //{ - //double val = (double)((MusEGui::CheckBox*)params[param].actuator)->isChecked(); + //double val = (double)((CheckBox*)params[param].actuator)->isChecked(); // No concept of 'untouching' a checkbox. Remain 'touched' until stop. //plugin->track()->stopAutoRecord(MusECore::genACnum(plugin->id(), param), val); //} @@ -3935,7 +3935,7 @@ void PluginGui::sliderChanged(double val, int param) val = rint(val); if (plugin->param(param) != val) { plugin->setParam(param, val); - ((MusEGui::DoubleLabel*)params[param].label)->setValue(val); + ((DoubleLabel*)params[param].label)->setValue(val); } int id = plugin->id(); @@ -3974,12 +3974,12 @@ void PluginGui::labelChanged(double val, int param) double dval = val; if (LADSPA_IS_HINT_LOGARITHMIC(params[param].hint)) - dval = fast_log10(val) * 20.0; + dval = MusECore::fast_log10(val) * 20.0; else if (LADSPA_IS_HINT_INTEGER(params[param].hint)) dval = rint(val); if (plugin->param(param) != val) { plugin->setParam(param, val); - ((MusEGui::Slider*)params[param].actuator)->setValue(dval); + ((Slider*)params[param].actuator)->setValue(dval); } int id = plugin->id(); @@ -4014,12 +4014,12 @@ void PluginGui::load() s += plugin->pluginLabel(); s += "/"; - QString fn = MusEGui::getOpenFileName(s, MusEGlobal::preset_file_pattern, + QString fn = getOpenFileName(s, MusEGlobal::preset_file_pattern, this, tr("MusE: load preset"), 0); if (fn.isEmpty()) return; bool popenFlag; - FILE* f = MusEGui::fileOpen(this, fn, QString(".pre"), "r", popenFlag, true); + FILE* f = fileOpen(this, fn, QString(".pre"), "r", popenFlag, true); if (f == 0) return; @@ -4079,13 +4079,13 @@ void PluginGui::save() s += plugin->pluginLabel(); s += "/"; - //QString fn = MusEGui::getSaveFileName(s, MusEGlobal::preset_file_pattern, this, - QString fn = MusEGui::getSaveFileName(s, MusEGlobal::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; bool popenFlag; - FILE* f = MusEGui::fileOpen(this, fn, QString(".pre"), "w", popenFlag, false, true); + FILE* f = fileOpen(this, fn, QString(".pre"), "w", popenFlag, false, true); if (f == 0) return; MusECore::Xml xml(f); @@ -4135,17 +4135,17 @@ void PluginGui::updateValues() double lv = plugin->param(i); double sv = lv; if (LADSPA_IS_HINT_LOGARITHMIC(params[i].hint)) - sv = fast_log10(lv) * 20.0; + sv = MusECore::fast_log10(lv) * 20.0; else if (LADSPA_IS_HINT_INTEGER(params[i].hint)) { sv = rint(lv); lv = sv; } gp->label->setValue(lv); - ((MusEGui::Slider*)(gp->actuator))->setValue(sv); + ((Slider*)(gp->actuator))->setValue(sv); } else if (gp->type == GuiParam::GUI_SWITCH) { - ((MusEGui::CheckBox*)(gp->actuator))->setChecked(int(plugin->param(i))); + ((CheckBox*)(gp->actuator))->setChecked(int(plugin->param(i))); } } } @@ -4160,10 +4160,10 @@ void PluginGui::updateValues() float val = plugin->param(param); switch(type) { case GuiWidgets::SLIDER: - ((MusEGui::Slider*)widget)->setValue(val); // Note conversion to double + ((Slider*)widget)->setValue(val); // Note conversion to double break; case GuiWidgets::DOUBLE_LABEL: - ((MusEGui::DoubleLabel*)widget)->setValue(val); // Note conversion to double + ((DoubleLabel*)widget)->setValue(val); // Note conversion to double break; case GuiWidgets::QCHECKBOX: ((QCheckBox*)widget)->setChecked(int(val)); @@ -4194,13 +4194,13 @@ void PluginGui::updateControls() double lv = plugin->paramOut(i); double sv = lv; if (LADSPA_IS_HINT_LOGARITHMIC(params[i].hint)) - sv = fast_log10(lv) * 20.0; + sv = MusECore::fast_log10(lv) * 20.0; else if (LADSPA_IS_HINT_INTEGER(params[i].hint)) { sv = rint(lv); lv = sv; } - ((MusEGui::VerticalMeter*)(gp->actuator))->setVal(sv); + ((VerticalMeter*)(gp->actuator))->setVal(sv); gp->label->setValue(lv); } @@ -4223,22 +4223,22 @@ void PluginGui::updateControls() double lv = plugin->track()->pluginCtrlVal(MusECore::genACnum(plugin->id(), i)); double sv = lv; if (LADSPA_IS_HINT_LOGARITHMIC(params[i].hint)) - sv = fast_log10(lv) * 20.0; + sv = MusECore::fast_log10(lv) * 20.0; else if (LADSPA_IS_HINT_INTEGER(params[i].hint)) { sv = rint(lv); lv = sv; } - if(((MusEGui::Slider*)(gp->actuator))->value() != sv) + if(((Slider*)(gp->actuator))->value() != sv) { //printf("PluginGui::updateControls slider\n"); gp->label->blockSignals(true); - ((MusEGui::Slider*)(gp->actuator))->blockSignals(true); - ((MusEGui::Slider*)(gp->actuator))->setValue(sv); + ((Slider*)(gp->actuator))->blockSignals(true); + ((Slider*)(gp->actuator))->setValue(sv); gp->label->setValue(lv); - ((MusEGui::Slider*)(gp->actuator))->blockSignals(false); + ((Slider*)(gp->actuator))->blockSignals(false); gp->label->blockSignals(false); } } @@ -4248,13 +4248,13 @@ void PluginGui::updateControls() if( plugin->controllerEnabled(i) && plugin->controllerEnabled2(i) ) { bool v = (int)plugin->track()->pluginCtrlVal(MusECore::genACnum(plugin->id(), i)); - if(((MusEGui::CheckBox*)(gp->actuator))->isChecked() != v) + if(((CheckBox*)(gp->actuator))->isChecked() != v) { //printf("PluginGui::updateControls switch\n"); - ((MusEGui::CheckBox*)(gp->actuator))->blockSignals(true); - ((MusEGui::CheckBox*)(gp->actuator))->setChecked(v); - ((MusEGui::CheckBox*)(gp->actuator))->blockSignals(false); + ((CheckBox*)(gp->actuator))->blockSignals(true); + ((CheckBox*)(gp->actuator))->setChecked(v); + ((CheckBox*)(gp->actuator))->blockSignals(false); } } } @@ -4272,13 +4272,13 @@ void PluginGui::updateControls() if( plugin->controllerEnabled(param) && plugin->controllerEnabled2(param) ) { double v = plugin->track()->pluginCtrlVal(MusECore::genACnum(plugin->id(), param)); - if(((MusEGui::Slider*)widget)->value() != v) + if(((Slider*)widget)->value() != v) { //printf("PluginGui::updateControls slider\n"); - ((MusEGui::Slider*)widget)->blockSignals(true); - ((MusEGui::Slider*)widget)->setValue(v); - ((MusEGui::Slider*)widget)->blockSignals(false); + ((Slider*)widget)->blockSignals(true); + ((Slider*)widget)->setValue(v); + ((Slider*)widget)->blockSignals(false); } } break; @@ -4286,13 +4286,13 @@ void PluginGui::updateControls() if( plugin->controllerEnabled(param) && plugin->controllerEnabled2(param) ) { double v = plugin->track()->pluginCtrlVal(MusECore::genACnum(plugin->id(), param)); - if(((MusEGui::DoubleLabel*)widget)->value() != v) + if(((DoubleLabel*)widget)->value() != v) { //printf("PluginGui::updateControls label\n"); - ((MusEGui::DoubleLabel*)widget)->blockSignals(true); - ((MusEGui::DoubleLabel*)widget)->setValue(v); - ((MusEGui::DoubleLabel*)widget)->blockSignals(false); + ((DoubleLabel*)widget)->blockSignals(true); + ((DoubleLabel*)widget)->setValue(v); + ((DoubleLabel*)widget)->blockSignals(false); } } break; @@ -4351,10 +4351,10 @@ void PluginGui::guiParamChanged(int idx) double val = 0.0; switch(type) { case GuiWidgets::SLIDER: - val = ((MusEGui::Slider*)w)->value(); + val = ((Slider*)w)->value(); break; case GuiWidgets::DOUBLE_LABEL: - val = ((MusEGui::DoubleLabel*)w)->value(); + val = ((DoubleLabel*)w)->value(); break; case GuiWidgets::QCHECKBOX: val = double(((QCheckBox*)w)->isChecked()); @@ -4372,10 +4372,10 @@ void PluginGui::guiParamChanged(int idx) int type = gw[i].type; switch(type) { case GuiWidgets::SLIDER: - ((MusEGui::Slider*)widget)->setValue(val); + ((Slider*)widget)->setValue(val); break; case GuiWidgets::DOUBLE_LABEL: - ((MusEGui::DoubleLabel*)widget)->setValue(val); + ((DoubleLabel*)widget)->setValue(val); break; case GuiWidgets::QCHECKBOX: ((QCheckBox*)widget)->setChecked(int(val)); @@ -4441,13 +4441,13 @@ void PluginGui::guiParamPressed(int idx) id = MusECore::genACnum(id, param); // NOTE: For this to be of any use, the freeverb gui 2142.ui - // would have to be used, and changed to use MusEGui::CheckBox and ComboBox + // would have to be used, and changed to use CheckBox and ComboBox // instead of QCheckBox and QComboBox, since both of those would // need customization (Ex. QCheckBox doesn't check on click). /* switch(type) { case GuiWidgets::QCHECKBOX: - double val = (double)((MusEGui::CheckBox*)w)->isChecked(); + double val = (double)((CheckBox*)w)->isChecked(); track->startAutoRecord(id, val); break; case GuiWidgets::QCOMBOBOX: @@ -4487,13 +4487,13 @@ void PluginGui::guiParamReleased(int idx) id = MusECore::genACnum(id, param); // NOTE: For this to be of any use, the freeverb gui 2142.ui - // would have to be used, and changed to use MusEGui::CheckBox and ComboBox + // would have to be used, and changed to use CheckBox and ComboBox // instead of QCheckBox and QComboBox, since both of those would // need customization (Ex. QCheckBox doesn't check on click). /* switch(type) { case GuiWidgets::QCHECKBOX: - double val = (double)((MusEGui::CheckBox*)w)->isChecked(); + double val = (double)((CheckBox*)w)->isChecked(); track->stopAutoRecord(id, param); break; case GuiWidgets::QCOMBOBOX: @@ -4529,7 +4529,7 @@ void PluginGui::guiSliderPressed(int idx) id = MusECore::genACnum(id, param); - double val = ((MusEGui::Slider*)w)->value(); + double val = ((Slider*)w)->value(); plugin->setParam(param, val); //MusEGlobal::audio->msgSetPluginCtrlVal(((PluginI*)plugin), id, val); @@ -4550,10 +4550,10 @@ void PluginGui::guiSliderPressed(int idx) int type = gw[i].type; switch(type) { case GuiWidgets::SLIDER: - ((MusEGui::Slider*)widget)->setValue(val); + ((Slider*)widget)->setValue(val); break; case GuiWidgets::DOUBLE_LABEL: - ((MusEGui::DoubleLabel*)widget)->setValue(val); + ((DoubleLabel*)widget)->setValue(val); break; case GuiWidgets::QCHECKBOX: ((QCheckBox*)widget)->setChecked(int(val)); @@ -4589,7 +4589,7 @@ void PluginGui::guiSliderReleased(int idx) id = MusECore::genACnum(id, param); - double val = ((MusEGui::Slider*)w)->value(); + double val = ((Slider*)w)->value(); track->stopAutoRecord(id, val); } @@ -4612,9 +4612,9 @@ void PluginGui::guiSliderRightClicked(const QPoint &p, int idx) QWidget* PluginLoader::createWidget(const QString & className, QWidget * parent, const QString & name) { if(className == QString("DoubleLabel")) - return new MusEGui::DoubleLabel(parent, name.toLatin1().constData()); + return new DoubleLabel(parent, name.toLatin1().constData()); if(className == QString("Slider")) - return new MusEGui::Slider(parent, name.toLatin1().constData(), Qt::Horizontal); + return new Slider(parent, name.toLatin1().constData(), Qt::Horizontal); return QUiLoader::createWidget(className, parent, name); }; diff --git a/muse2/muse/remote/CMakeLists.txt b/muse2/muse/remote/CMakeLists.txt index 29ead183..b3dcb39d 100644 --- a/muse2/muse/remote/CMakeLists.txt +++ b/muse2/muse/remote/CMakeLists.txt @@ -33,7 +33,6 @@ file (GLOB remote_source_files ## add_library(remote ${MODULES_BUILD} ${remote_source_files} - ${PROJECT_BINARY_DIR}/all.h.pch ) ## @@ -48,9 +47,13 @@ set (FILES_TO_TRANSLATE ## ## Compilation flags and target name ## -set_source_files_properties( - pyapi.cpp - PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -include ${PYTHON_INCLUDES} -DENABLE_PYTHON" +set_target_properties( remote + PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -I${PYTHON_INCLUDE_DIRS} -DENABLE_PYTHON" + OUTPUT_NAME muse_remote + ) + +target_link_libraries(remote + ${PYTHON_LIBRARIES} ) ## diff --git a/muse2/muse/remote/pyapi.cpp b/muse2/muse/remote/pyapi.cpp index 27a44e49..645c639e 100644 --- a/muse2/muse/remote/pyapi.cpp +++ b/muse2/muse/remote/pyapi.cpp @@ -42,6 +42,8 @@ // Steals ref: PyList_SetItem, PyTuple_SetItem using namespace std; +namespace MusECore { + static pthread_t pyapiThread; //------------------------------------------------------------ QPybridgeEvent::QPybridgeEvent(QPybridgeEvent::EventType _type, int _p1, int _p2) @@ -56,30 +58,30 @@ QPybridgeEvent::QPybridgeEvent(QPybridgeEvent::EventType _type, int _p1, int _p2 //------------------------------------------------------------ PyObject* getCPos(PyObject*, PyObject*) { - return Py_BuildValue("i", song->cpos()); + return Py_BuildValue("i", MusEGlobal::song->cpos()); } //------------------------------------------------------------ // Get position of left locator //------------------------------------------------------------ PyObject* getLPos(PyObject*, PyObject*) { - return Py_BuildValue("i", song->lpos()); + return Py_BuildValue("i", MusEGlobal::song->lpos()); } //------------------------------------------------------------ // Get position of right locator //------------------------------------------------------------ PyObject* getRPos(PyObject*, PyObject*) { - return Py_BuildValue("i", song->rpos()); + return Py_BuildValue("i", MusEGlobal::song->rpos()); } //------------------------------------------------------------ // Start playing from current position //------------------------------------------------------------ PyObject* startPlay(PyObject*, PyObject*) { - //song->setPlay(true); + //MusEGlobal::song->setPlay(true); QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_SETPLAY); - QApplication::postEvent(song, pyevent); + QApplication::postEvent(MusEGlobal::song, pyevent); Py_INCREF(Py_None); return Py_None; } @@ -88,9 +90,9 @@ PyObject* startPlay(PyObject*, PyObject*) //------------------------------------------------------------ PyObject* stopPlay(PyObject*, PyObject*) { - //song->setStop(true); + //MusEGlobal::song->setStop(true); QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_SETSTOP); - QApplication::postEvent(song, pyevent); + QApplication::postEvent(MusEGlobal::song, pyevent); Py_INCREF(Py_None); return Py_None; } @@ -99,9 +101,9 @@ PyObject* stopPlay(PyObject*, PyObject*) //------------------------------------------------------------ PyObject* rewindStart(PyObject*, PyObject*) { - //song->rewindStart(); + //MusEGlobal::song->rewindStart(); QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_REWIND); - QApplication::postEvent(song, pyevent); + QApplication::postEvent(MusEGlobal::song, pyevent); Py_INCREF(Py_None); return Py_None; } @@ -115,7 +117,7 @@ PyObject* getTempo(PyObject*, PyObject* args) return Py_BuildValue("i", 1000); } - int tempovalue = tempomap.tempo(tick); + int tempovalue = MusEGlobal::tempomap.tempo(tick); return Py_BuildValue("i", tempovalue); } //------------------------------------------------------------ @@ -123,11 +125,11 @@ PyObject* getTempo(PyObject*, PyObject* args) //------------------------------------------------------------ PyObject* getTrackNames(PyObject*, PyObject*) { - TrackList* tracks = song->tracks(); + TrackList* tracks = MusEGlobal::song->tracks(); PyObject* res = Py_BuildValue("[]"); for (ciTrack t = tracks->begin(); t != tracks->end(); ++t) { Track* track = *t; - PyObject* ptrackname = Py_BuildValue("s", track->name().toLatin1()); + PyObject* ptrackname = Py_BuildValue("s", track->name().toLatin1().constData()); PyList_Append(res, ptrackname); Py_DECREF(ptrackname); } @@ -139,7 +141,7 @@ PyObject* getTrackNames(PyObject*, PyObject*) //------------------------------------------------------------ Part* findPartBySerial(int sn) { - TrackList* tracks = song->tracks(); + TrackList* tracks = MusEGlobal::song->tracks(); for (ciTrack t = tracks->begin(); t != tracks->end(); ++t) { Track* track = *t; PartList* parts = track->parts(); @@ -157,7 +159,7 @@ Part* findPartBySerial(int sn) //------------------------------------------------------------ PyObject* getParts(PyObject*, PyObject* args) { - TrackList* tracks = song->tracks(); + TrackList* tracks = MusEGlobal::song->tracks(); const char* trackname; if (!PyArg_ParseTuple(args, "s", &trackname)) { return NULL; @@ -351,7 +353,7 @@ PyObject* createPart(PyObject*, PyObject* args) } QString qtrackname(trackname); - MidiTrack* track = (MidiTrack*) song->findTrack(trackname); + MidiTrack* track = (MidiTrack*) MusEGlobal::song->findTrack(trackname); if (track == NULL) return NULL; @@ -360,9 +362,9 @@ PyObject* createPart(PyObject*, PyObject* args) npart->setLenTick(tickLen); addPyPartEventsToMusePart(npart, part); - song->addPart(npart); + MusEGlobal::song->addPart(npart); QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_UPDATE, SC_TRACK_MODIFIED); - QApplication::postEvent(song, pyevent); + QApplication::postEvent(MusEGlobal::song, pyevent); Py_INCREF(Py_None); return Py_None; @@ -379,7 +381,7 @@ PyObject* modifyPart(PyObject*, PyObject* part) Part* opart = NULL; // Verify a part with that id actually exists, then get it - TrackList* tracks = song->tracks(); + TrackList* tracks = MusEGlobal::song->tracks(); for (ciTrack t = tracks->begin(); t != tracks->end(); ++t) { Track* track = *t; for (ciPart p = track->parts()->begin(); p != track->parts()->end(); p++) { @@ -412,12 +414,12 @@ PyObject* modifyPart(PyObject*, PyObject* part) addPyPartEventsToMusePart(npart, part); - //song->startUndo(); - song->changePart(opart, npart); - //song->endUndo(SC_TRACK_MODIFIED | SC_PART_MODIFIED | SC_PART_INSERTED); // Crash! Probably since the call ends up in Qt GUI thread from this thread + //MusEGlobal::song->startUndo(); + MusEGlobal::song->changePart(opart, npart); + //MusEGlobal::song->endUndo(SC_TRACK_MODIFIED | SC_PART_MODIFIED | SC_PART_INSERTED); // Crash! Probably since the call ends up in Qt GUI thread from this thread QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_UPDATE, SC_TRACK_MODIFIED | SC_PART_MODIFIED | SC_PART_INSERTED); - QApplication::postEvent(song, pyevent); + QApplication::postEvent(MusEGlobal::song, pyevent); Py_INCREF(Py_None); @@ -438,9 +440,9 @@ PyObject* deletePart(PyObject*, PyObject* args) if (part == NULL) return NULL; - song->removePart(part); + MusEGlobal::song->removePart(part); QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_UPDATE, SC_TRACK_MODIFIED | SC_PART_REMOVED); - QApplication::postEvent(song, pyevent); + QApplication::postEvent(MusEGlobal::song, pyevent); Py_INCREF(Py_None); return Py_None; } @@ -456,9 +458,9 @@ PyObject* setPos(PyObject*, PyObject* args) return NULL; } - //song->setPos(index, ticks); + //MusEGlobal::song->setPos(index, ticks); QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_POSCHANGE, index, ticks); - QApplication::postEvent(song, pyevent); + QApplication::postEvent(MusEGlobal::song, pyevent); Py_INCREF(Py_None); return Py_None; @@ -475,9 +477,9 @@ PyObject* setSongLen(PyObject*, PyObject* args) if (!PyArg_ParseTuple(args, "i", &len)) { return NULL; } - //song->setLen(len);// Appears to not be ok to call from python thread, we do it with event instead + //MusEGlobal::song->setLen(len);// Appears to not be ok to call from python thread, we do it with event instead QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONGLEN_CHANGE, len); - QApplication::postEvent(song, pyevent); + QApplication::postEvent(MusEGlobal::song, pyevent); Py_INCREF(Py_None); return Py_None; } @@ -486,7 +488,7 @@ PyObject* setSongLen(PyObject*, PyObject* args) //------------------------------------------------------------ PyObject* getSongLen(PyObject*, PyObject*) { - PyObject* pylen = Py_BuildValue("i", song->len()); + PyObject* pylen = Py_BuildValue("i", MusEGlobal::song->len()); return pylen; } @@ -495,7 +497,7 @@ PyObject* getSongLen(PyObject*, PyObject*) //------------------------------------------------------------ PyObject* getDivision(PyObject*, PyObject*) { - return Py_BuildValue("i", config.division); + return Py_BuildValue("i", MusEGlobal::config.division); } //------------------------------------------------------------ // setTrackParameter @@ -508,7 +510,7 @@ PyObject* setMidiTrackParameter(PyObject*, PyObject* args) if(!PyArg_ParseTuple(args, "ssi", &trackname, ¶mname, &value)) return NULL; - Track* track = song->findTrack(QString(trackname)); + Track* track = MusEGlobal::song->findTrack(QString(trackname)); if (track == NULL) return NULL; @@ -535,7 +537,7 @@ PyObject* setMidiTrackParameter(PyObject*, PyObject* args) if (changed) { QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_UPDATE, SC_TRACK_MODIFIED); - QApplication::postEvent(song, pyevent); + QApplication::postEvent(MusEGlobal::song, pyevent); } return Py_BuildValue("b", changed); // true/false depending on whether anythin was changed @@ -549,7 +551,7 @@ PyObject* setLoop(PyObject*, PyObject* args) if(!PyArg_ParseTuple(args, "b", &loopFlag)) return NULL; - song->setLoop(loopFlag); + MusEGlobal::song->setLoop(loopFlag); Py_INCREF(Py_None); return Py_None; } @@ -558,7 +560,7 @@ PyObject* setLoop(PyObject*, PyObject* args) //------------------------------------------------------------ PyObject* getLoop(PyObject*, PyObject*) { - return Py_BuildValue("b", song->getLoop()); + return Py_BuildValue("b", MusEGlobal::song->getLoop()); } //------------------------------------------------------------ // getMute trackname @@ -570,7 +572,7 @@ PyObject* getMute(PyObject*, PyObject* args) return NULL; } - Track* track = song->findTrack(QString(trackname)); + Track* track = MusEGlobal::song->findTrack(QString(trackname)); if (track == NULL) return NULL; @@ -588,7 +590,7 @@ PyObject* setMute(PyObject*, PyObject* args) return NULL; } - Track* track = song->findTrack(QString(trackname)); + Track* track = MusEGlobal::song->findTrack(QString(trackname)); if (track == NULL) return NULL; @@ -598,7 +600,7 @@ PyObject* setMute(PyObject*, PyObject* args) QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_SETMUTE, mutedint); pyevent->setS1(trackname); - QApplication::postEvent(song, pyevent); + QApplication::postEvent(MusEGlobal::song, pyevent); Py_INCREF(Py_None); return Py_None; } @@ -609,7 +611,7 @@ void setController(const char* trackname, int ctrltype, int ctrlval) { QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_SETCTRL, ctrltype, ctrlval); pyevent->setS1(trackname); - QApplication::postEvent(song, pyevent); + QApplication::postEvent(MusEGlobal::song, pyevent); } //------------------------------------------------------------ @@ -642,7 +644,7 @@ PyObject* getMidiControllerValue(PyObject*, PyObject* args) return NULL; } - Track* t = song->findTrack(QString(trackname)); + Track* t = MusEGlobal::song->findTrack(QString(trackname)); if (t == NULL) return NULL; @@ -654,7 +656,7 @@ PyObject* getMidiControllerValue(PyObject*, PyObject* args) MidiTrack* track = (MidiTrack*) t; int channel = track->outChannel(); int outport = track->outPort(); - MidiPort* mp = &midiPorts[outport]; + MidiPort* mp = &MusEGlobal::midiPorts[outport]; if (mp == NULL) return Py_BuildValue("i", -1); @@ -676,7 +678,7 @@ PyObject* setAudioTrackVolume(PyObject*, PyObject* args) QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_SETAUDIOVOL); pyevent->setD1(volume); pyevent->setS1(trackname); - QApplication::postEvent(song, pyevent); + QApplication::postEvent(MusEGlobal::song, pyevent); Py_INCREF(Py_None); return Py_None; } @@ -691,7 +693,7 @@ PyObject* getAudioTrackVolume(PyObject*, PyObject* args) return NULL; } - Track* t = song->findTrack(QString(trackname)); + Track* t = MusEGlobal::song->findTrack(QString(trackname)); if (t == NULL) return NULL; @@ -707,11 +709,11 @@ PyObject* getAudioTrackVolume(PyObject*, PyObject* args) //------------------------------------------------------------ PyObject* getSelectedTrack(PyObject*, PyObject*) { - TrackList* tracks = song->tracks(); + TrackList* tracks = MusEGlobal::song->tracks(); for (ciTrack t = tracks->begin(); t != tracks->end(); ++t) { Track* track = *t; if (track->selected()) - return Py_BuildValue("s", track->name().toLatin1()); + return Py_BuildValue("s", track->name().toLatin1().constData()); } Py_INCREF(Py_None); @@ -734,7 +736,7 @@ PyObject* importPart(PyObject*, PyObject* args) QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_IMPORT_PART, tick); pyevent->setS1(trackname); pyevent->setS2(filename); - QApplication::postEvent(song, pyevent); + QApplication::postEvent(MusEGlobal::song, pyevent); Py_INCREF(Py_None); return Py_None; } @@ -748,7 +750,7 @@ PyObject* getTrackEffects(PyObject*, PyObject* args) return NULL; } - Track* t = song->findTrack(QString(trackname)); + Track* t = MusEGlobal::song->findTrack(QString(trackname)); if (t == NULL) return NULL; @@ -760,8 +762,8 @@ PyObject* getTrackEffects(PyObject*, PyObject* args) const Pipeline* pipeline = track->efxPipe(); for (int i = 0; i < PipelineDepth; i++) { QString name = pipeline->name(i); - printf("fx %d name: %s\n", i, name.toLatin1()); - PyObject* pyname = Py_BuildValue("s", name.toLatin1()); + printf("fx %d name: %s\n", i, name.toLatin1().constData()); + PyObject* pyname = Py_BuildValue("s", name.toLatin1().constData()); PyList_Append(pyfxnames, pyname); Py_DECREF(pyname); } @@ -780,7 +782,7 @@ PyObject* toggleTrackEffect(PyObject*, PyObject* args) if (!PyArg_ParseTuple(args, "sib", &trackname, &fxid, &onoff)) return NULL; - Track* t = song->findTrack(QString(trackname)); + Track* t = MusEGlobal::song->findTrack(QString(trackname)); if (t == NULL) return NULL; @@ -790,7 +792,7 @@ PyObject* toggleTrackEffect(PyObject*, PyObject* args) QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_TOGGLE_EFFECT, fxid, onoff); pyevent->setS1(trackname); - QApplication::postEvent(song, pyevent); + QApplication::postEvent(MusEGlobal::song, pyevent); Py_INCREF(Py_None); return Py_None; } @@ -805,16 +807,16 @@ PyObject* changeTrackName(PyObject*, PyObject* args) if (!PyArg_ParseTuple(args, "ss", &trackname, &newname)) return NULL; - Track* t = song->findTrack(QString(trackname)); + Track* t = MusEGlobal::song->findTrack(QString(trackname)); if (t == NULL) return Py_BuildValue("b", false); QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_CHANGE_TRACKNAME); pyevent->setS1(trackname); pyevent->setS2(newname); - QApplication::postEvent(song, pyevent); + QApplication::postEvent(MusEGlobal::song, pyevent); QPybridgeEvent* pyevent2 = new QPybridgeEvent(QPybridgeEvent::SONG_UPDATE, SC_TRACK_MODIFIED); - QApplication::postEvent(song, pyevent2); + QApplication::postEvent(MusEGlobal::song, pyevent2); return Py_BuildValue("b", true); } //------------------------------------------------------------ @@ -823,7 +825,7 @@ PyObject* changeTrackName(PyObject*, PyObject* args) PyObject* addMidiTrack(PyObject*, PyObject*) { QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_ADD_TRACK, Track::MIDI); - QApplication::postEvent(song, pyevent); + QApplication::postEvent(MusEGlobal::song, pyevent); Py_INCREF(Py_None); return Py_None; } @@ -833,7 +835,7 @@ PyObject* addMidiTrack(PyObject*, PyObject*) PyObject* addWaveTrack(PyObject*, PyObject*) { QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_ADD_TRACK, Track::WAVE); - QApplication::postEvent(song, pyevent); + QApplication::postEvent(MusEGlobal::song, pyevent); Py_INCREF(Py_None); return Py_None; } @@ -843,7 +845,7 @@ PyObject* addWaveTrack(PyObject*, PyObject*) PyObject* addInput(PyObject*, PyObject*) { QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_ADD_TRACK, Track::AUDIO_INPUT); - QApplication::postEvent(song, pyevent); + QApplication::postEvent(MusEGlobal::song, pyevent); Py_INCREF(Py_None); return Py_None; } @@ -853,7 +855,7 @@ PyObject* addInput(PyObject*, PyObject*) PyObject* addOutput(PyObject*, PyObject*) { QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_ADD_TRACK, Track::AUDIO_OUTPUT); - QApplication::postEvent(song, pyevent); + QApplication::postEvent(MusEGlobal::song, pyevent); return Py_None; } //------------------------------------------------------------ @@ -862,7 +864,7 @@ PyObject* addOutput(PyObject*, PyObject*) PyObject* addGroup(PyObject*, PyObject*) { QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_ADD_TRACK, Track::AUDIO_GROUP); - QApplication::postEvent(song, pyevent); + QApplication::postEvent(MusEGlobal::song, pyevent); return Py_None; } //------------------------------------------------------------ @@ -877,7 +879,7 @@ PyObject* deleteTrack(PyObject*, PyObject* args) QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_DELETE_TRACK); pyevent->setS1(trackname); - QApplication::postEvent(song, pyevent); + QApplication::postEvent(MusEGlobal::song, pyevent); return Py_None; } //------------------------------------------------------------ @@ -891,7 +893,7 @@ PyObject* getOutputRoute(PyObject*, PyObject* args) if (!PyArg_ParseTuple(args, "s", &trackname)) return NULL; - Track* tt = song->findTrack(QString(trackname)); + Track* tt = MusEGlobal::song->findTrack(QString(trackname)); if (tt == NULL) return Py_BuildValue("b", false); @@ -900,7 +902,7 @@ PyObject* getOutputRoute(PyObject*, PyObject* args) AudioTrack* t = (AudioTrack*)tt; RouteList* r = t->outRoutes(); - OutputList* al = song->outputs(); + OutputList* al = MusEGlobal::song->outputs(); for (iAudioOutput i = al->begin(); i != al->end(); ++i) { Track* track = *i; if (t == track) @@ -1011,7 +1013,7 @@ static void* pyapithreadfunc(void*) */ bool initPythonBridge() { - if (pthread_create(&pyapiThread, NULL, ::pyapithreadfunc, 0)) { + if (pthread_create(&pyapiThread, NULL, MusECore::pyapithreadfunc, 0)) { return false; } return true; // TODO: Verify that things are up and running! @@ -1078,10 +1080,10 @@ bool Song::event(QEvent* _e) int num = e->getP1(); int val = e->getP2(); - int tick = song->cpos(); + int tick = MusEGlobal::song->cpos(); MidiPlayEvent ev(tick, track->outPort(), chan, ME_CONTROLLER, num, val); - audio->msgPlayMidiEvent(&ev); - song->update(SC_MIDI_CONTROLLER); + MusEGlobal::audio->msgPlayMidiEvent(&ev); + MusEGlobal::song->update(SC_MIDI_CONTROLLER); break; } case QPybridgeEvent::SONG_SETAUDIOVOL: { @@ -1103,7 +1105,7 @@ bool Song::event(QEvent* _e) if (track == NULL) return false; - muse->importPartToTrack(filename, tick, track); + MusEGlobal::muse->importPartToTrack(filename, tick, track); break; } case QPybridgeEvent::SONG_TOGGLE_EFFECT: { @@ -1127,7 +1129,7 @@ bool Song::event(QEvent* _e) break; } case QPybridgeEvent::SONG_ADD_TRACK: - song->addTrack((Track::TrackType)e->getP1()); // Add at end of list. + MusEGlobal::song->addTrack((Track::TrackType)e->getP1()); // Add at end of list. break; case QPybridgeEvent::SONG_CHANGE_TRACKNAME: { Track* t = this->findTrack(e->getS1()); @@ -1141,7 +1143,7 @@ bool Song::event(QEvent* _e) if (t == NULL) return false; - audio->msgRemoveTrack(t); + MusEGlobal::audio->msgRemoveTrack(t); break; } default: @@ -1153,4 +1155,5 @@ bool Song::event(QEvent* _e) return true; } +} // namespace MusECore diff --git a/muse2/muse/remote/pyapi.h b/muse2/muse/remote/pyapi.h index 6cc7fbdc..fecd2fda 100644 --- a/muse2/muse/remote/pyapi.h +++ b/muse2/muse/remote/pyapi.h @@ -23,6 +23,8 @@ #include +namespace MusECore { + class QPybridgeEvent : public QEvent { public: @@ -51,5 +53,7 @@ private: bool initPythonBridge(); +} // namespace MusECore + #endif diff --git a/muse2/muse/thread.cpp b/muse2/muse/thread.cpp index ce11fba6..8fe0cdb8 100644 --- a/muse2/muse/thread.cpp +++ b/muse2/muse/thread.cpp @@ -32,6 +32,8 @@ #include "globals.h" #include "errno.h" +namespace MusECore { + //--------------------------------------------------------- // Thread //--------------------------------------------------------- @@ -104,7 +106,7 @@ void Thread::start(int prio, void* ptr) /* - if (pthread_create(&thread, attributes, ::loop, this)) + if (pthread_create(&thread, attributes, MusECore::loop, this)) perror("creating thread failed:"); // else // { @@ -114,7 +116,7 @@ void Thread::start(int prio, void* ptr) */ - int rv = pthread_create(&thread, attributes, ::loop, this); + int rv = pthread_create(&thread, attributes, MusECore::loop, this); if(rv) { // p4.0.16: MusEGlobal::realTimeScheduling is unreliable. It is true even in some clearly non-RT cases. @@ -122,7 +124,7 @@ void Thread::start(int prio, void* ptr) // MusE was failing with a stock kernel because of PTHREAD_EXPLICIT_SCHED. // So we'll just have to try again without attributes. if (MusEGlobal::realTimeScheduling && _realTimePriority > 0) - rv = pthread_create(&thread, NULL, ::loop, this); + rv = pthread_create(&thread, NULL, MusECore::loop, this); } if(rv) @@ -481,3 +483,4 @@ void Thread::readMsg1(int size) processMsg1(buffer); } +} // namespace MusECore diff --git a/muse2/muse/thread.h b/muse2/muse/thread.h index 3650f0ab..755754f9 100644 --- a/muse2/muse/thread.h +++ b/muse2/muse/thread.h @@ -27,6 +27,10 @@ #include #include +struct pollfd; + +namespace MusECore { + //--------------------------------------------------------- // Poll //--------------------------------------------------------- @@ -115,5 +119,7 @@ class Thread { virtual void threadStop() { } // called from loop before leaving }; +} // namespace MusECore + #endif diff --git a/muse2/muse/waveedit/waveview.cpp b/muse2/muse/waveedit/waveview.cpp index f22f842b..04751428 100644 --- a/muse2/muse/waveedit/waveview.cpp +++ b/muse2/muse/waveedit/waveview.cpp @@ -414,7 +414,7 @@ void WaveView::wheelEvent(QWheelEvent* ev) if (shift) { // scroll vertically int delta = -ev->delta() / WHEEL_DELTA; - int xpixelscale = 5*fast_log10(rmapxDev(1)); + int xpixelscale = 5*MusECore::fast_log10(rmapxDev(1)); if (xpixelscale <= 0) diff --git a/muse2/muse/widgets/canvas.cpp b/muse2/muse/widgets/canvas.cpp index b0f0dba8..41c5f4a4 100644 --- a/muse2/muse/widgets/canvas.cpp +++ b/muse2/muse/widgets/canvas.cpp @@ -489,7 +489,7 @@ void Canvas::wheelEvent(QWheelEvent* ev) if (shift) { // scroll horizontally int delta = -ev->delta() / WHEEL_DELTA; - int xpixelscale = 5*fast_log10(rmapxDev(1)); + int xpixelscale = 5*MusECore::fast_log10(rmapxDev(1)); if (xpixelscale <= 0) xpixelscale = 1; diff --git a/muse2/muse/widgets/meter.cpp b/muse2/muse/widgets/meter.cpp index 6b41c320..5c79ffb2 100644 --- a/muse2/muse/widgets/meter.cpp +++ b/muse2/muse/widgets/meter.cpp @@ -164,7 +164,7 @@ void Meter::setVal(double v, double max, bool ovl) { maxVal = max; if(mtype == DBMeter) - cur_ymax = maxVal == 0 ? fw : int(((maxScale - (fast_log10(maxVal) * 20.0)) * h)/range); + cur_ymax = maxVal == 0 ? fw : int(((maxScale - (MusECore::fast_log10(maxVal) * 20.0)) * h)/range); else cur_ymax = maxVal == 0 ? fw : int(((maxScale - maxVal) * h)/range); if(cur_ymax > h) cur_ymax = h; @@ -179,7 +179,7 @@ void Meter::setVal(double v, double max, bool ovl) if(ud) { if(mtype == DBMeter) - cur_yv = val == 0 ? h : int(((maxScale - (fast_log10(val) * 20.0)) * h)/range); + cur_yv = val == 0 ? h : int(((maxScale - (MusECore::fast_log10(val) * 20.0)) * h)/range); else cur_yv = val == 0 ? h : int(((maxScale - val) * h)/range); if(cur_yv > h) cur_yv = h; @@ -247,8 +247,8 @@ void Meter::paintEvent(QPaintEvent* ev) { if(mtype == DBMeter) { - cur_yv = val == 0 ? h : int(((maxScale - (fast_log10(val) * 20.0)) * h)/range); - cur_ymax = maxVal == 0 ? fw : int(((maxScale - (fast_log10(maxVal) * 20.0)) * h)/range); + cur_yv = val == 0 ? h : int(((maxScale - (MusECore::fast_log10(val) * 20.0)) * h)/range); + cur_ymax = maxVal == 0 ? fw : int(((maxScale - (MusECore::fast_log10(maxVal) * 20.0)) * h)/range); } else { diff --git a/muse2/muse/widgets/verticalmeter.cpp b/muse2/muse/widgets/verticalmeter.cpp index be2714a8..b8524d33 100644 --- a/muse2/muse/widgets/verticalmeter.cpp +++ b/muse2/muse/widgets/verticalmeter.cpp @@ -152,7 +152,7 @@ void VerticalMeter::paintEvent(QPaintEvent* /*ev*/) if(mtype == DBMeter) - xv = int(((maxScale - (fast_log10(val) * 20.0)) * w)/range); + xv = int(((maxScale - (MusECore::fast_log10(val) * 20.0)) * w)/range); else { xv = int(((maxScale - val) * w)/range); } @@ -167,7 +167,7 @@ void VerticalMeter::paintEvent(QPaintEvent* /*ev*/) /* int xcenter; if(mtype == DBMeter) - xcenter = maxVal == 0 ? 0 : int(((maxScale - (fast_log10(0) * 20.0)) * w)/range); + xcenter = maxVal == 0 ? 0 : int(((maxScale - (MusECore::fast_log10(0) * 20.0)) * w)/range); else xcenter = maxVal == 0 ? 0 : int(((maxVal) * w)/range); p.setPen(peak_color); -- cgit v1.2.3