diff options
-rw-r--r-- | muse2/CMakeLists.txt | 3 | ||||
-rw-r--r-- | muse2/ChangeLog | 4 | ||||
-rw-r--r-- | muse2/al/CMakeLists.txt | 12 | ||||
-rw-r--r-- | muse2/awl/CMakeLists.txt | 10 | ||||
-rw-r--r-- | muse2/muse/CMakeLists.txt | 64 | ||||
-rw-r--r-- | muse2/muse/app.cpp | 585 | ||||
-rw-r--r-- | muse2/muse/arranger/CMakeLists.txt | 13 | ||||
-rw-r--r-- | muse2/muse/cliplist/CMakeLists.txt | 12 | ||||
-rw-r--r-- | muse2/muse/ctrl/CMakeLists.txt | 12 | ||||
-rw-r--r-- | muse2/muse/driver/CMakeLists.txt | 16 | ||||
-rw-r--r-- | muse2/muse/driver/audiodev.h | 1 | ||||
-rw-r--r-- | muse2/muse/instruments/CMakeLists.txt | 12 | ||||
-rw-r--r-- | muse2/muse/liste/CMakeLists.txt | 13 | ||||
-rw-r--r-- | muse2/muse/main.cpp | 531 | ||||
-rw-r--r-- | muse2/muse/marker/CMakeLists.txt | 13 | ||||
-rw-r--r-- | muse2/muse/master/CMakeLists.txt | 14 | ||||
-rw-r--r-- | muse2/muse/midiedit/CMakeLists.txt | 14 | ||||
-rw-r--r-- | muse2/muse/mixer/CMakeLists.txt | 12 | ||||
-rw-r--r-- | muse2/muse/mplugins/CMakeLists.txt | 17 | ||||
-rw-r--r-- | muse2/muse/remote/CMakeLists.txt | 4 | ||||
-rw-r--r-- | muse2/muse/waveedit/CMakeLists.txt | 13 | ||||
-rw-r--r-- | muse2/muse/widgets/CMakeLists.txt | 12 | ||||
-rw-r--r-- | muse2/synti/libsynti/CMakeLists.txt | 5 |
23 files changed, 772 insertions, 620 deletions
diff --git a/muse2/CMakeLists.txt b/muse2/CMakeLists.txt index 2a48bbaf..1cb3ee6a 100644 --- a/muse2/CMakeLists.txt +++ b/muse2/CMakeLists.txt @@ -68,6 +68,9 @@ SET(MusE_VERSION "2.0.1") SET(MusE_VERSION_FULL "2.0.1") SET(MusE_INSTALL_NAME "muse-2.0") +SET(MUSE_MODULES_DIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/${MusE_INSTALL_NAME}/modules) +SET(CMAKE_INSTALL_RPATH ${MUSE_MODULES_DIR}) + EXEC_PROGRAM( svnversion ARGS ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE MusE_SVNVER ) diff --git a/muse2/ChangeLog b/muse2/ChangeLog index 7e84d5a5..af85a702 100644 --- a/muse2/ChangeLog +++ b/muse2/ChangeLog @@ -3,7 +3,9 @@ *Feature: Added 'global opaqueness' (transparency) appearance setting. (Tim) Currently only affects part colours. TODO: Fix the darn black rectangle drawing. Apply the opaqueness to some other things. - - Fixed arranger part drawing borders. Used QPen::setCosmetic(true) when drawing. (Tim) + - Fixed arranger part drawing borders. Used QPen::setCosmetic(true) when drawing. (Tim) + - Individual parts are now built as shared libraries. (Orcan) + - Moved main() and first degree relatives into main.cpp (Orcan) 18.12.2010: - Fixed transport shortcuts not working in some windows or situations. (Tim) Added event->ignore to PartCanvas::keyPress. Added setFocusPolicy() to WaveView, Master. diff --git a/muse2/al/CMakeLists.txt b/muse2/al/CMakeLists.txt index 12df9a72..6e2881b8 100644 --- a/muse2/al/CMakeLists.txt +++ b/muse2/al/CMakeLists.txt @@ -13,11 +13,21 @@ if (USE_SSE) set(al_src ${al_src} dspSSE.cpp dspXMM.cpp) endif (USE_SSE) -add_library(al STATIC +add_library(al SHARED ${al_src} ${PROJECT_BINARY_DIR}/all.h.pch ) +install(TARGETS al DESTINATION ${MUSE_MODULES_DIR}) + +target_link_libraries ( al + ${QT_LIBRARIES} + ) + +set_target_properties( al + PROPERTIES OUTPUT_NAME muse_al + ) + set_source_files_properties( al.cpp sig.cpp xml.cpp dsp.cpp dspXMM.cpp diff --git a/muse2/awl/CMakeLists.txt b/muse2/awl/CMakeLists.txt index 5ce5a93e..c9b0cc28 100644 --- a/muse2/awl/CMakeLists.txt +++ b/muse2/awl/CMakeLists.txt @@ -60,15 +60,23 @@ set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${SOURCE_FILES} CACHE INTERNAL "") add_library ( awl - STATIC + SHARED ${awl_src} ${PROJECT_BINARY_DIR}/all.h.pch ) +target_link_libraries ( awl + ${QT_LIBRARIES} + al + ) + set_target_properties( awl PROPERTIES COMPILE_FLAGS "-fPIC -include ${PROJECT_BINARY_DIR}/all.h" + OUTPUT_NAME muse_awl ) +install(TARGETS awl DESTINATION ${MUSE_MODULES_DIR}) + # IF (APPLE) # message("Not yet able to build awlplugin under OS X.") # ELSE (APPLE) diff --git a/muse2/muse/CMakeLists.txt b/muse2/muse/CMakeLists.txt index 5091204e..9c8bbfb4 100644 --- a/muse2/muse/CMakeLists.txt +++ b/muse2/muse/CMakeLists.txt @@ -194,7 +194,7 @@ file (GLOB SOURCE_FILES # trackinfo.cpp ticksynth.h ticksynth.cpp - vst.h vst.cpp + vst.h vst.cpp dssihost.h dssihost.cpp osc.cpp osc.h stringparam.cpp stringparam.h @@ -220,7 +220,6 @@ file (GLOB SOURCE_FILES exportmidi.cpp midifile.h midifile.cpp xml.cpp xml.h - icons.cpp icons.h event.cpp event.h eventbase.h evdata.h eventlist.cpp midievent.h midievent.cpp @@ -259,7 +258,19 @@ file (GLOB SOURCE_FILES default_click.h ) +file (GLOB MAIN_SOURCE_FILES + main.cpp + ) + +file (GLOB ICONS_SOURCE_FILES + icons.cpp icons.h + ) + add_executable ( muse + ${MAIN_SOURCE_FILES} + ) + +add_library ( core SHARED ${muse_qrc_files} ${muse_moc_headers} # ${muse_ui_headers} @@ -267,8 +278,11 @@ add_executable ( muse ${SOURCE_FILES} ) -set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${SOURCE_FILES} CACHE INTERNAL "") +add_library ( icons SHARED + ${ICONS_SOURCE_FILES} + ) +set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${MAIN_SOURCE_FILES} ${SOURCE_FILES} CACHE INTERNAL "") # AM_CXXFLAGS +=-DSVNVERSION=\"$(shell svnversion)\" # EXEC_PROGRAM( svnversion @@ -285,39 +299,35 @@ include_directories( ${CMAKE_CURRENT_BINARY_DIR}/instruments ${CMAKE_CURRENT_BINARY_DIR}/remote ) -set_target_properties( muse +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} -DSVNVERSION='\"${SVNVER}\"' -include ${PROJECT_BINARY_DIR}/all.h " # PROPERTIES COMPILE_FLAGS "${PYREM_CPP_FLAGS} -DINSTPREFIX='\"${CMAKE_INSTALL_PREFIX}\"' -DINSTLIBDIR='\"${LIBRARY_OUTPUT_DIRECTORY}\"' -DSVNVERSION='\"${SVNVER}\"' -include ${PROJECT_BINARY_DIR}/all.h " - PROPERTIES COMPILE_FLAGS "${PYREM_CPP_FLAGS} -include ${PROJECT_BINARY_DIR}/all.h " - OUTPUT_NAME muse2 + PROPERTIES COMPILE_FLAGS "${PYREM_CPP_FLAGS} -include ${PROJECT_BINARY_DIR}/all.h -fPIC" + OUTPUT_NAME muse_core ) -target_link_libraries(muse -# midiedit -# master -# instruments -# marker -# liste -# synti -# waveedit -# widgets -# al -# awl -# ctrl +set_target_properties( muse + PROPERTIES OUTPUT_NAME muse2 + ) + +set_target_properties( icons + PROPERTIES OUTPUT_NAME muse_icons + ) + +target_link_libraries(core midiedit ctrl liste mixer driver marker master waveedit mplugins arranger cliplist instruments widgets + icons synti al awl ${QT_LIBRARIES} QtSvg - ${ALSA_LIBRARIES} - ${JACK_LIBRARIES} ${SNDFILE_LIBRARIES} ${SAMPLERATE_LIBRARIES} ${UUID_LIBRARIES} @@ -326,13 +336,23 @@ target_link_libraries(muse dl ) +target_link_libraries(muse + midiedit + core + ) + +target_link_libraries(icons + ${QT_LIBRARIES} + ) + if(HAVE_LASH) - target_link_libraries(muse ${LASH_LIBRARIES}) + target_link_libraries(core ${LASH_LIBRARIES}) endif(HAVE_LASH) if(OSC_SUPPORT) - target_link_libraries(muse ${LIBLO_LIBRARIES}) + target_link_libraries(core ${LIBLO_LIBRARIES}) endif(OSC_SUPPORT) install ( TARGETS muse RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin/ ) +install(TARGETS core icons DESTINATION ${MUSE_MODULES_DIR}) diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp index f339fabf..ecee0f71 100644 --- a/muse2/muse/app.cpp +++ b/muse2/muse/app.cpp @@ -6,90 +6,48 @@ // (C) Copyright 1999-2004 Werner Schweer (ws@seh.de) //========================================================= -#include "config.h" - -#include <string> -#include <map> -#include <assert.h> -#include <getopt.h> -#include <errno.h> -#include <sys/mman.h> -#include <sys/wait.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <time.h> -#include <signal.h> -#include <stdarg.h> - -#include <QAction> -#include <QActionGroup> -#include <QApplication> -#include <QByteArray> #include <QClipboard> -#include <QCloseEvent> -#include <QFile> -#include <QFocusEvent> -#include <QKeyEvent> -#include <QMenu> #include <QMessageBox> -#include <QPixmap> #include <QShortcut> #include <QSignalMapper> -#include <QSplashScreen> -#include <QTextCodec> #include <QTimer> -#include <QTimerEvent> -#include <QTranslator> #include <QWhatsThis> #include "app.h" #include "master/lmaster.h" -#include "master/masteredit.h" -#include "marker/markerview.h" -#include "popupmenu.h" -#include "transport.h" -#include "bigtime.h" +#include "al/dsp.h" +#include "amixer.h" +#include "appearance.h" #include "arranger.h" -#include "pianoroll.h" -#include "xml.h" -#include "midi.h" +#include "audio.h" +#include "audiodev.h" +#include "audioprefetch.h" +#include "bigtime.h" +#include "cliplist/cliplist.h" #include "conf.h" -#include "listedit.h" +#include "debug.h" +#include "didyouknow.h" #include "drumedit.h" -#include "ttoolbar.h" -#include "amixer.h" -#include "cliplist/cliplist.h" -#include "midiport.h" -#include "audiodev.h" -#include "mididev.h" -#include "waveedit.h" -#include "icons.h" -#include "minstrument.h" -#include "mixdowndialog.h" -#include "midictrl.h" #include "filedialog.h" -#include "plugin.h" -#include "transpose.h" -#include "appearance.h" #include "gatetime.h" +#include "gconfig.h" +#include "gui.h" +#include "icons.h" +#include "instruments/editinstrument.h" +#include "listedit.h" +#include "marker/markerview.h" +#include "master/masteredit.h" #include "metronome.h" -#include "debug.h" -#include "event.h" -#include "audio.h" #include "midiseq.h" -#include "audioprefetch.h" -#include "wave.h" +#include "mixdowndialog.h" +#include "pianoroll.h" +#include "popupmenu.h" #include "shortcutconfig.h" -#include "gconfig.h" -#include "driver/jackaudio.h" -#include "track.h" +#include "songinfo.h" #include "ticksynth.h" -#include "instruments/editinstrument.h" -#include "synth.h" -#include "remote/pyapi.h" -#include "al/dsp.h" -#include "gui.h" +#include "transport.h" +#include "transpose.h" +#include "waveedit.h" #ifdef DSSI_SUPPORT #include "dssihost.h" @@ -99,10 +57,6 @@ #include "vst.h" #endif -#include <alsa/asoundlib.h> -#include "songinfo.h" -#include "didyouknow.h" - //extern void cacheJackRouteNames(); static pthread_t watchdogThread; @@ -129,19 +83,11 @@ static const char* infoPanicButton = QT_TRANSLATE_NOOP("@default", "send note #define PROJECT_LIST_LEN 6 static QString* projectList[PROJECT_LIST_LEN]; -static QString locale_override; -extern void initIcons(); extern void initMidiSynth(); -extern bool initJackAudio(); extern void exitJackAudio(); -extern bool initDummyAudio(); extern void exitDummyAudio(); -extern void initVST_fst_init(); -extern void initVST(); -extern void initDSSI(); // p3.3.39 -extern void initOSC(); extern void exitOSC(); #ifdef HAVE_LASH @@ -162,33 +108,6 @@ pthread_t splashThread; // } //--------------------------------------------------------- -// getCapabilities -//--------------------------------------------------------- - -static void getCapabilities() - { -#ifdef RTCAP -#ifdef __linux__ - const char* napp = getenv("GIVERTCAP"); - if (napp == 0) - napp = "givertcap"; - int pid = fork(); - if (pid == 0) { - if (execlp(napp, napp, 0) == -1) - perror("exec givertcap failed"); - } - else if (pid == -1) { - perror("fork givertcap failed"); - } - else { - waitpid(pid, 0, 0); - } -#endif // __linux__ -#endif - } - - -//--------------------------------------------------------- // sleep function //--------------------------------------------------------- void microSleep(long msleep) @@ -3140,15 +3059,6 @@ bool MusE::saveAs() } //--------------------------------------------------------- -// printVersion -//--------------------------------------------------------- - -static void printVersion(const char* prog) - { - fprintf(stderr, "%s: Linux Music Editor; Version %s, (svn revision %s)\n", prog, VERSION, SVNVERSION); - } - -//--------------------------------------------------------- // startEditor //--------------------------------------------------------- @@ -3531,141 +3441,6 @@ void MusE::kbAccel(int key) } //--------------------------------------------------------- -// MuseApplication -//--------------------------------------------------------- - -class MuseApplication : public QApplication { - MusE* muse; - - public: - MuseApplication(int& argc, char** argv) - : QApplication(argc, argv) - { - muse = 0; - } - - - void setMuse(MusE* m) { - muse = m; -#ifdef HAVE_LASH - if(useLASH) - startTimer (300); -#endif - } - - bool notify(QObject* receiver, QEvent* event) { - //if (event->type() == QEvent::KeyPress) - // printf("notify key press before app::notify accepted:%d\n", event->isAccepted()); - bool flag = QApplication::notify(receiver, event); - if (event->type() == QEvent::KeyPress) { - //printf("notify key press after app::notify accepted:%d\n", event->isAccepted()); - QKeyEvent* ke = (QKeyEvent*)event; - ///globalKeyState = ke->stateAfter(); - globalKeyState = ke->modifiers(); - bool accepted = ke->isAccepted(); - if (!accepted) { - int key = ke->key(); - ///if (ke->state() & Qt::ShiftModifier) - //if (globalKeyState & Qt::ShiftModifier) - if (((QInputEvent*)ke)->modifiers() & Qt::ShiftModifier) - key += Qt::SHIFT; - ///if (ke->state() & Qt::AltModifier) - //if (globalKeyState & Qt::AltModifier) - if (((QInputEvent*)ke)->modifiers() & Qt::AltModifier) - key += Qt::ALT; - ///if (ke->state() & Qt::ControlModifier) - //if (globalKeyState & Qt::ControlModifier) - if (((QInputEvent*)ke)->modifiers() & Qt::ControlModifier) - key+= Qt::CTRL; - muse->kbAccel(key); - return true; - } - } - if (event->type() == QEvent::KeyRelease) { - QKeyEvent* ke = (QKeyEvent*)event; - ///globalKeyState = ke->stateAfter(); - globalKeyState = ke->modifiers(); - } - - return flag; - } - -#ifdef HAVE_LASH - virtual void timerEvent (QTimerEvent * /* e */) { - if(useLASH) - muse->lash_idle_cb (); - } -#endif /* HAVE_LASH */ - - }; - -//--------------------------------------------------------- -// localeList -//--------------------------------------------------------- - -static QString localeList() - { - // Find out what translations are available: - QStringList deliveredLocaleListFiltered; - QString distLocale = QString(INSTPREFIX) + "/" + SHAREINSTPREFIX + "/" - + INSTALL_NAME + "/locale"; - QFileInfo distLocaleFi(distLocale); - if (distLocaleFi.isDir()) { - QDir dir = QDir(distLocale); - QStringList deliveredLocaleList = dir.entryList(); - for(QStringList::iterator it = deliveredLocaleList.begin(); it != deliveredLocaleList.end(); ++it) { - QString item = *it; - if (item.endsWith(".qm")) { - int inipos = item.indexOf("muse_") + 5; - int finpos = item.lastIndexOf(".qm"); - deliveredLocaleListFiltered << item.mid(inipos, finpos - inipos); - } - } - return deliveredLocaleListFiltered.join(","); - } - return QString("No translations found!"); - } - -//--------------------------------------------------------- -// usage -//--------------------------------------------------------- - -static void usage(const char* prog, const char* txt) - { - fprintf(stderr, "%s: %s\nusage: %s flags midifile\n Flags:\n", - prog, txt, prog); - fprintf(stderr, " -h this help\n"); - fprintf(stderr, " -v print version\n"); - fprintf(stderr, " -d debug mode: no threads, no RT\n"); - fprintf(stderr, " -D debug mode: enable some debug messages\n"); - fprintf(stderr, " -m debug mode: trace midi Input\n"); - fprintf(stderr, " -M debug mode: trace midi Output\n"); - fprintf(stderr, " -s debug mode: trace sync\n"); - fprintf(stderr, " -a no audio\n"); - //fprintf(stderr, " -P n set real time priority to n (default: 50)\n"); - fprintf(stderr, " -P n set audio driver real time priority to n (Dummy only, default 40. Else fixed by Jack.)\n"); - fprintf(stderr, " -Y n force midi real time priority to n (default: audio driver prio +2)\n"); - fprintf(stderr, " -p don't load LADSPA plugins\n"); -#ifdef ENABLE_PYTHON - fprintf(stderr, " -y enable Python control support\n"); -#endif -#ifdef VST_SUPPORT - fprintf(stderr, " -V don't load VST plugins\n"); -#endif -#ifdef DSSI_SUPPORT - fprintf(stderr, " -I don't load DSSI plugins\n"); -#endif -#ifdef HAVE_LASH - fprintf(stderr, " -L don't use LASH\n"); -#endif - fprintf(stderr, " -l xx force locale to the given language/country code (xx = %s)\n", localeList().toLatin1().constData()); - fprintf(stderr, "useful environment variables:\n"); - fprintf(stderr, " MUSE override library and shared directories location\n"); - fprintf(stderr, " MUSEHOME override user home directory (HOME/)\n"); - fprintf(stderr, " MUSEINSTRUMENTS override user instrument directory (MUSEHOME/muse_instruments)\n"); - } - -//--------------------------------------------------------- // catchSignal // only for debugging //--------------------------------------------------------- @@ -3690,318 +3465,6 @@ static void catchSignal(int sig) } #endif -//--------------------------------------------------------- -// main -//--------------------------------------------------------- - -int main(int argc, char* argv[]) - { - -// error = ErrorHandler::create(argv[0]); - ruid = getuid(); - euid = geteuid(); - undoSetuid(); - getCapabilities(); - int noAudio = false; - - const char* mu = getenv("MUSEHOME"); - if(mu) - museUser = QString(mu); - if(museUser.isEmpty()) - museUser = QString(getenv("HOME")); - - QString museGlobal; - const char* p = getenv("MUSE"); - if (p) - museGlobal = p; - - if (museGlobal.isEmpty()) { - //QString museGlobal(INSTPREFIX); - //QString museGlobalLibDir(INSTLIBDIR); - //QString museGlobalLibDir(LIBINSTPREFIX); // This has no prefix. - //museGlobalLib = museGlobalLibDir + "/muse"; - //museGlobalShare = museGlobal + "/share/muse"; - - // p4.0.7 - museGlobalLib = QString(INSTPREFIX) + QString("/") + - QString(LIBINSTPREFIX) + QString("/") + - QString(INSTALL_NAME); - //museGlobalShare = museGlobal + QString("/share/") + QString(INSTALL_NAME); - museGlobalShare = QString(INSTPREFIX) + QString("/") + - QString(SHAREINSTPREFIX) + QString("/") + // This has no prefix. Default is "share", set in top cmake script. - QString(INSTALL_NAME); - } - else { - //museGlobalLib = museGlobal + "/lib"; - //museGlobalShare = museGlobal + "/share"; - museGlobalLib = museGlobal + QString("/") + QString(LIBINSTPREFIX); // p4.0.7 - museGlobalShare = museGlobal + QString("/") + QString(SHAREINSTPREFIX); - } - museProject = museProjectInitPath; //getcwd(0, 0); - configName = QString(getenv("HOME")) + QString("/.MusE"); - - museInstruments = museGlobalShare + QString("/instruments"); - - const char* ins = getenv("MUSEINSTRUMENTS"); - if(ins) - museUserInstruments = QString(ins); - if(museUserInstruments.isEmpty()) - museUserInstruments = museUser + QString("/muse_instruments"); - -#ifdef HAVE_LASH - lash_args_t * lash_args = 0; - if(useLASH) - lash_args = lash_extract_args (&argc, &argv); -#endif - - srand(time(0)); // initialize random number generator -// signal(SIGCHLD, catchSignal); // interferes with initVST() - initMidiController(); - QApplication::setColorSpec(QApplication::ManyColor); - MuseApplication app(argc, argv); - - initShortCuts(); - readConfiguration(); - - if (config.useDenormalBias) - printf("Denormal protection enabled.\n"); - // SHOW MUSE SPLASH SCREEN - if (config.showSplashScreen) { - QPixmap splsh(museGlobalShare + "/splash.png"); - - if (!splsh.isNull()) { - QSplashScreen* muse_splash = new QSplashScreen(splsh, - Qt::WindowStaysOnTopHint); - muse_splash->setAttribute(Qt::WA_DeleteOnClose); // Possibly also Qt::X11BypassWindowManagerHint - muse_splash->show(); - QTimer* stimer = new QTimer(0); - muse_splash->connect(stimer, SIGNAL(timeout()), muse_splash, SLOT(close())); - stimer->setSingleShot(true); - stimer->start(6000); - } - } - - int i; - - QString optstr("ahvdDmMsP:Y:l:py"); -#ifdef VST_SUPPORT - optstr += QString("V"); -#endif -#ifdef DSSI_SUPPORT - optstr += QString("I"); -#endif -#ifdef HAVE_LASH - optstr += QString("L"); -#endif - -//#ifdef VST_SUPPORT -// while ((i = getopt(argc, argv, "ahvdDmMsVP:py")) != EOF) { -//#else -// while ((i = getopt(argc, argv, "ahvdDmMsP:py")) != EOF) { -//#endif - - while ((i = getopt(argc, argv, optstr.toLatin1().constData())) != EOF) { - char c = (char)i; - switch (c) { - case 'v': printVersion(argv[0]); return 0; - case 'd': - debugMode = true; - realTimeScheduling = false; - break; - case 'a': - noAudio = true; - break; - case 'D': debugMsg = true; break; - case 'm': midiInputTrace = true; break; - case 'M': midiOutputTrace = true; break; - case 's': debugSync = true; break; - case 'P': realTimePriority = atoi(optarg); break; - case 'Y': midiRTPrioOverride = atoi(optarg); break; - case 'p': loadPlugins = false; break; - case 'V': loadVST = false; break; - case 'I': loadDSSI = false; break; - case 'L': useLASH = false; break; - case 'y': usePythonBridge = true; break; - case 'l': locale_override = QString(optarg); break; - case 'h': usage(argv[0], argv[1]); return -1; - default: usage(argv[0], "bad argument"); return -1; - } - } - - /* - if(!config.styleSheetFile.isEmpty()) - { - if(debugMsg) - printf("loading style sheet <%s> \n", qPrintable(config.styleSheetFile)); - QFile cf(config.styleSheetFile); - if (cf.open(QIODevice::ReadOnly)) { - QByteArray ss = cf.readAll(); - QString sheet(QString::fromUtf8(ss.data())); - app.setStyleSheet(sheet); - cf.close(); - } - else - printf("loading style sheet <%s> failed\n", qPrintable(config.styleSheetFile)); - } - */ - - AL::initDsp(); - - if (debugMsg) - printf("Start euid: %d ruid: %d, Now euid %d\n", - euid, ruid, geteuid()); - if (debugMode) { - initDummyAudio(); - realTimeScheduling = false; - } - else if (noAudio) { - initDummyAudio(); - realTimeScheduling = true; - //if (debugMode) { // ?? - // realTimeScheduling = false; - // } - } - else if (initJackAudio()) { - if (!debugMode) - { - QMessageBox::critical(NULL, "MusE fatal error", "MusE <b>failed</b> to find a <b>Jack audio server</b>.<br><br>" - "<i>MusE will continue without audio support (-a switch)!</i><br><br>" - "If this was not intended check that Jack was started. " - "If Jack <i>was</i> started check that it was\n" - "started as the same user as MusE.\n"); - - initDummyAudio(); - noAudio = true; - realTimeScheduling = true; - if (debugMode) { - realTimeScheduling = false; - } - } - else - { - fprintf(stderr, "fatal error: no JACK audio server found\n"); - fprintf(stderr, "no audio functions available\n"); - fprintf(stderr, "*** experimental mode -- no play possible ***\n"); - initDummyAudio(); - //realTimeScheduling = audioDevice->isRealtime(); - } - realTimeScheduling = true; - } - else - realTimeScheduling = audioDevice->isRealtime(); - - useJackTransport.setValue(true); - // setup the prefetch fifo length now that the segmentSize is known - // Changed by Tim. p3.3.17 - // Changed to 4 *, JUST FOR TEST!!! - fifoLength = 131072/segmentSize; - //fifoLength = (131072/segmentSize) * 4; - - - argc -= optind; - ++argc; - - if (debugMsg) { - printf("global lib: <%s>\n", museGlobalLib.toLatin1().constData()); - printf("global share: <%s>\n", museGlobalShare.toLatin1().constData()); - printf("muse home: <%s>\n", museUser.toLatin1().constData()); - printf("project dir: <%s>\n", museProject.toLatin1().constData()); - printf("user instruments: <%s>\n", museUserInstruments.toLatin1().constData()); - } - - static QTranslator translator(0); - QString locale(QApplication::keyboardInputLocale().name()); - if (locale_override.length()) - locale = locale_override; - if (locale != "C") { - QString loc("muse_"); - loc += locale; - if (translator.load(loc, QString(".")) == false) { - QString lp(museGlobalShare); - lp += QString("/locale"); - if (translator.load(loc, lp) == false) { - printf("no locale <%s>/<%s>\n", loc.toLatin1().constData(), lp.toLatin1().constData()); - } - } - app.installTranslator(&translator); - } - - if (locale == "de") { - printf("locale de\n"); - hIsB = false; - } - - if (loadPlugins) - initPlugins(); - - if (loadVST) - initVST(); - - if(loadDSSI) - initDSSI(); - - // p3.3.39 - initOSC(); - - initIcons(); - - initMetronome(); - - //QApplication::clipboard()->setSelectionMode(false); ddskrjo obsolete even in Qt3 - - QApplication::addLibraryPath(museGlobalLib + "/qtplugins"); - if (debugMsg) { - QStringList list = app.libraryPaths(); - QStringList::Iterator it = list.begin(); - printf("QtLibraryPath:\n"); - while(it != list.end()) { - printf(" <%s>\n", (*it).toLatin1().constData()); - ++it; - } - } - - muse = new MusE(argc, &argv[optind]); - app.setMuse(muse); - muse->setWindowIcon(*museIcon); - - // Added by Tim. p3.3.22 - if (!debugMode) { - if (mlockall(MCL_CURRENT | MCL_FUTURE)) - perror("WARNING: Cannot lock memory:"); - } - - muse->show(); - muse->seqStart(); - -#ifdef HAVE_LASH - { - if(useLASH) - { - int lash_flags = LASH_Config_File; - const char *muse_name = PACKAGE_NAME; - lash_client = lash_init (lash_args, muse_name, lash_flags, LASH_PROTOCOL(2,0)); - lash_alsa_client_id (lash_client, snd_seq_client_id (alsaSeq)); - if (!noAudio) { - // p3.3.38 - //char *jack_name = ((JackAudioDevice*)audioDevice)->getJackName(); - const char *jack_name = audioDevice->clientName(); - lash_jack_client_name (lash_client, jack_name); - } - } - } -#endif /* HAVE_LASH */ - QTimer::singleShot(100, muse, SLOT(showDidYouKnowDialog())); - - int rv = app.exec(); - if(debugMsg) - printf("app.exec() returned:%d\nDeleting main MusE object\n", rv); - delete muse; - if(debugMsg) - printf("Finished! Exiting main, return value:%d\n", rv); - return rv; - - } - #if 0 //--------------------------------------------------------- // configPart diff --git a/muse2/muse/arranger/CMakeLists.txt b/muse2/muse/arranger/CMakeLists.txt index 47241207..adc7ef61 100644 --- a/muse2/muse/arranger/CMakeLists.txt +++ b/muse2/muse/arranger/CMakeLists.txt @@ -33,17 +33,26 @@ file (GLOB SOURCE_FILES trackinfo.cpp trackautomationview.h ) -add_library ( arranger STATIC +add_library ( arranger SHARED ${SOURCE_FILES} ${arranger_mocs} # ${arranger_ui_headers} ) +target_link_libraries ( arranger + ${QT_LIBRARIES} + awl + widgets + ) + set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${SOURCE_FILES} CACHE INTERNAL "") +install(TARGETS arranger DESTINATION ${MUSE_MODULES_DIR}) + add_dependencies(arranger mixer) set_target_properties( arranger - PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h" + PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC" + OUTPUT_NAME muse_arranger ) diff --git a/muse2/muse/cliplist/CMakeLists.txt b/muse2/muse/cliplist/CMakeLists.txt index 212a0072..52a5a791 100644 --- a/muse2/muse/cliplist/CMakeLists.txt +++ b/muse2/muse/cliplist/CMakeLists.txt @@ -27,7 +27,7 @@ file (GLOB SOURCE_FILES cliplist.h ) -add_library ( cliplist STATIC +add_library ( cliplist SHARED ${SOURCE_FILES} ${cliplist_mocs} # ${cliplist_ui_headers} @@ -35,7 +35,15 @@ add_library ( cliplist STATIC set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${SOURCE_FILES} CACHE INTERNAL "") +target_link_libraries ( cliplist + ${QT_LIBRARIES} + awl + ) + +install(TARGETS cliplist DESTINATION ${MUSE_MODULES_DIR}) + set_target_properties( cliplist - PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h" + PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC" + OUTPUT_NAME muse_cliplist ) diff --git a/muse2/muse/ctrl/CMakeLists.txt b/muse2/muse/ctrl/CMakeLists.txt index c8f7bdff..24b8bb3e 100644 --- a/muse2/muse/ctrl/CMakeLists.txt +++ b/muse2/muse/ctrl/CMakeLists.txt @@ -35,7 +35,7 @@ file (GLOB SOURCE_FILES ctrlpanel.cpp ctrlpanel.h ) -add_library ( ctrl STATIC +add_library ( ctrl SHARED # configmidictrl.cpp # definemidictrl.cpp # ctrldialog.cpp @@ -49,7 +49,15 @@ add_library ( ctrl STATIC set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${SOURCE_FILES} CACHE INTERNAL "") +target_link_libraries ( ctrl + ${QT_LIBRARIES} + widgets + ) + +install(TARGETS ctrl DESTINATION ${MUSE_MODULES_DIR}) + set_target_properties( ctrl - PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h" + PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC" + OUTPUT_NAME muse_ctrl ) diff --git a/muse2/muse/driver/CMakeLists.txt b/muse2/muse/driver/CMakeLists.txt index 8d561ee5..0116fc1f 100644 --- a/muse2/muse/driver/CMakeLists.txt +++ b/muse2/muse/driver/CMakeLists.txt @@ -24,14 +24,26 @@ file (GLOB SOURCE_FILES jackmidi.cpp jackmidi.h ) -add_library ( driver STATIC +add_library ( driver SHARED # ${PROJECT_BINARY_DIR}/all.h.pch ${SOURCE_FILES} ) set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${SOURCE_FILES} CACHE INTERNAL "") +install(TARGETS driver DESTINATION ${MUSE_MODULES_DIR}) + +target_link_libraries ( driver + ${ALSA_LIBRARIES} + ${JACK_LIBRARIES} + ${QT_LIBRARIES} + mplugins + ) + + + set_target_properties( driver - PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h" + PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC" + OUTPUT_NAME muse_driver ) diff --git a/muse2/muse/driver/audiodev.h b/muse2/muse/driver/audiodev.h index 0b4aacef..af53d7de 100644 --- a/muse2/muse/driver/audiodev.h +++ b/muse2/muse/driver/audiodev.h @@ -14,6 +14,7 @@ class QString; class MidiPlayEvent; +class Pos; //--------------------------------------------------------- // AudioDevice diff --git a/muse2/muse/instruments/CMakeLists.txt b/muse2/muse/instruments/CMakeLists.txt index 8cc5e6b8..8930edf0 100644 --- a/muse2/muse/instruments/CMakeLists.txt +++ b/muse2/muse/instruments/CMakeLists.txt @@ -40,7 +40,7 @@ file (GLOB SOURCE_FILES editinstrument.h ) -add_library ( instruments STATIC +add_library ( instruments SHARED ${SOURCE_FILES} ${instruments_mocs} ${instruments_ui_headers} @@ -48,7 +48,15 @@ add_library ( instruments STATIC set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${SOURCE_FILES} ${UI_FILES} CACHE INTERNAL "") +install(TARGETS instruments DESTINATION ${MUSE_MODULES_DIR}) + +target_link_libraries ( instruments + ${QT_LIBRARIES} + icons + ) + set_target_properties( instruments - PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h" + PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC" + OUTPUT_NAME muse_instruments ) diff --git a/muse2/muse/liste/CMakeLists.txt b/muse2/muse/liste/CMakeLists.txt index e3a30797..72081478 100644 --- a/muse2/muse/liste/CMakeLists.txt +++ b/muse2/muse/liste/CMakeLists.txt @@ -47,7 +47,7 @@ file (GLOB SOURCE_FILES editevent.cpp editevent.h ) -add_library ( liste STATIC +add_library ( liste SHARED ${SOURCE_FILES} ${liste_mocs} ${liste_ui_headers} @@ -56,10 +56,19 @@ add_library ( liste STATIC set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${SOURCE_FILES} ${UI_FILES} CACHE INTERNAL "") +install(TARGETS liste DESTINATION ${MUSE_MODULES_DIR}) + +target_link_libraries ( liste + ${QT_LIBRARIES} + awl + widgets + ) + add_dependencies(liste widgets) set_target_properties( liste - PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h" + PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC" + OUTPUT_NAME muse_liste ) diff --git a/muse2/muse/main.cpp b/muse2/muse/main.cpp new file mode 100644 index 00000000..a11b2e0b --- /dev/null +++ b/muse2/muse/main.cpp @@ -0,0 +1,531 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: app.cpp,v 1.113.2.68 2009/12/21 14:51:51 spamatica Exp $ +// +// (C) Copyright 1999-2004 Werner Schweer (ws@seh.de) +//========================================================= + +#include <QApplication> +#include <QDir> +#include <QKeyEvent> +#include <QMessageBox> +#include <QLocale> +#include <QSplashScreen> +#include <QTimer> +#include <QTranslator> + +#include <sys/mman.h> +#include <alsa/asoundlib.h> + +#include "al/dsp.h" +#include "app.h" +#include "audio.h" +#include "audiodev.h" +#include "gconfig.h" +#include "globals.h" +#include "icons.h" +#include "sync.h" + +extern bool initDummyAudio(); +extern void initIcons(); +extern bool initJackAudio(); +extern void initMidiController(); +extern void initMetronome(); +extern void initOSC(); +extern void initVST(); +extern void initPlugins(); +extern void initShortCuts(); +extern void initDSSI(); +extern void readConfiguration(); + +static QString locale_override; + +#ifdef HAVE_LASH +#include <lash/lash.h> +extern lash_client_t * lash_client; +extern snd_seq_t * alsaSeq; +#endif + +//--------------------------------------------------------- +// getCapabilities +//--------------------------------------------------------- + +static void getCapabilities() + { +#ifdef RTCAP +#ifdef __linux__ + const char* napp = getenv("GIVERTCAP"); + if (napp == 0) + napp = "givertcap"; + int pid = fork(); + if (pid == 0) { + if (execlp(napp, napp, 0) == -1) + perror("exec givertcap failed"); + } + else if (pid == -1) { + perror("fork givertcap failed"); + } + else { + waitpid(pid, 0, 0); + } +#endif // __linux__ +#endif + } + +//--------------------------------------------------------- +// printVersion +//--------------------------------------------------------- + +static void printVersion(const char* prog) + { + fprintf(stderr, "%s: Linux Music Editor; Version %s, (svn revision %s)\n", prog, VERSION, SVNVERSION); + } + +//--------------------------------------------------------- +// MuseApplication +//--------------------------------------------------------- + +class MuseApplication : public QApplication { + MusE* muse; + + public: + MuseApplication(int& argc, char** argv) + : QApplication(argc, argv) + { + muse = 0; + } + + + void setMuse(MusE* m) { + muse = m; +#ifdef HAVE_LASH + if(useLASH) + startTimer (300); +#endif + } + + bool notify(QObject* receiver, QEvent* event) { + //if (event->type() == QEvent::KeyPress) + // printf("notify key press before app::notify accepted:%d\n", event->isAccepted()); + bool flag = QApplication::notify(receiver, event); + if (event->type() == QEvent::KeyPress) { + //printf("notify key press after app::notify accepted:%d\n", event->isAccepted()); + QKeyEvent* ke = (QKeyEvent*)event; + ///globalKeyState = ke->stateAfter(); + globalKeyState = ke->modifiers(); + bool accepted = ke->isAccepted(); + if (!accepted) { + int key = ke->key(); + ///if (ke->state() & Qt::ShiftModifier) + //if (globalKeyState & Qt::ShiftModifier) + if (((QInputEvent*)ke)->modifiers() & Qt::ShiftModifier) + key += Qt::SHIFT; + ///if (ke->state() & Qt::AltModifier) + //if (globalKeyState & Qt::AltModifier) + if (((QInputEvent*)ke)->modifiers() & Qt::AltModifier) + key += Qt::ALT; + ///if (ke->state() & Qt::ControlModifier) + //if (globalKeyState & Qt::ControlModifier) + if (((QInputEvent*)ke)->modifiers() & Qt::ControlModifier) + key+= Qt::CTRL; + muse->kbAccel(key); + return true; + } + } + if (event->type() == QEvent::KeyRelease) { + QKeyEvent* ke = (QKeyEvent*)event; + ///globalKeyState = ke->stateAfter(); + globalKeyState = ke->modifiers(); + } + + return flag; + } + +#ifdef HAVE_LASH + virtual void timerEvent (QTimerEvent * /* e */) { + if(useLASH) + muse->lash_idle_cb (); + } +#endif /* HAVE_LASH */ + + }; + +//--------------------------------------------------------- +// localeList +//--------------------------------------------------------- + +static QString localeList() + { + // Find out what translations are available: + QStringList deliveredLocaleListFiltered; + QString distLocale = QString(INSTPREFIX) + "/" + SHAREINSTPREFIX + "/" + + INSTALL_NAME + "/locale"; + QFileInfo distLocaleFi(distLocale); + if (distLocaleFi.isDir()) { + QDir dir = QDir(distLocale); + QStringList deliveredLocaleList = dir.entryList(); + for(QStringList::iterator it = deliveredLocaleList.begin(); it != deliveredLocaleList.end(); ++it) { + QString item = *it; + if (item.endsWith(".qm")) { + int inipos = item.indexOf("muse_") + 5; + int finpos = item.lastIndexOf(".qm"); + deliveredLocaleListFiltered << item.mid(inipos, finpos - inipos); + } + } + return deliveredLocaleListFiltered.join(","); + } + return QString("No translations found!"); + } + +//--------------------------------------------------------- +// usage +//--------------------------------------------------------- + +static void usage(const char* prog, const char* txt) + { + fprintf(stderr, "%s: %s\nusage: %s flags midifile\n Flags:\n", + prog, txt, prog); + fprintf(stderr, " -h this help\n"); + fprintf(stderr, " -v print version\n"); + fprintf(stderr, " -d debug mode: no threads, no RT\n"); + fprintf(stderr, " -D debug mode: enable some debug messages\n"); + fprintf(stderr, " -m debug mode: trace midi Input\n"); + fprintf(stderr, " -M debug mode: trace midi Output\n"); + fprintf(stderr, " -s debug mode: trace sync\n"); + fprintf(stderr, " -a no audio\n"); + //fprintf(stderr, " -P n set real time priority to n (default: 50)\n"); + fprintf(stderr, " -P n set audio driver real time priority to n (Dummy only, default 40. Else fixed by Jack.)\n"); + fprintf(stderr, " -Y n force midi real time priority to n (default: audio driver prio +2)\n"); + fprintf(stderr, " -p don't load LADSPA plugins\n"); +#ifdef ENABLE_PYTHON + fprintf(stderr, " -y enable Python control support\n"); +#endif +#ifdef VST_SUPPORT + fprintf(stderr, " -V don't load VST plugins\n"); +#endif +#ifdef DSSI_SUPPORT + fprintf(stderr, " -I don't load DSSI plugins\n"); +#endif +#ifdef HAVE_LASH + fprintf(stderr, " -L don't use LASH\n"); +#endif + fprintf(stderr, " -l xx force locale to the given language/country code (xx = %s)\n", localeList().toLatin1().constData()); + fprintf(stderr, "useful environment variables:\n"); + fprintf(stderr, " MUSE override library and shared directories location\n"); + fprintf(stderr, " MUSEHOME override user home directory (HOME/)\n"); + fprintf(stderr, " MUSEINSTRUMENTS override user instrument directory (MUSEHOME/muse_instruments)\n"); + } + +//--------------------------------------------------------- +// main +//--------------------------------------------------------- + +int main(int argc, char* argv[]) + { + +// error = ErrorHandler::create(argv[0]); + ruid = getuid(); + euid = geteuid(); + undoSetuid(); + getCapabilities(); + int noAudio = false; + + const char* mu = getenv("MUSEHOME"); + if(mu) + museUser = QString(mu); + if(museUser.isEmpty()) + museUser = QString(getenv("HOME")); + + QString museGlobal; + const char* p = getenv("MUSE"); + if (p) + museGlobal = p; + + if (museGlobal.isEmpty()) { + //QString museGlobal(INSTPREFIX); + //QString museGlobalLibDir(INSTLIBDIR); + //QString museGlobalLibDir(LIBINSTPREFIX); // This has no prefix. + //museGlobalLib = museGlobalLibDir + "/muse"; + //museGlobalShare = museGlobal + "/share/muse"; + + // p4.0.7 + museGlobalLib = QString(INSTPREFIX) + QString("/") + + QString(LIBINSTPREFIX) + QString("/") + + QString(INSTALL_NAME); + //museGlobalShare = museGlobal + QString("/share/") + QString(INSTALL_NAME); + museGlobalShare = QString(INSTPREFIX) + QString("/") + + QString(SHAREINSTPREFIX) + QString("/") + // This has no prefix. Default is "share", set in top cmake script. + QString(INSTALL_NAME); + } + else { + //museGlobalLib = museGlobal + "/lib"; + //museGlobalShare = museGlobal + "/share"; + museGlobalLib = museGlobal + QString("/") + QString(LIBINSTPREFIX); // p4.0.7 + museGlobalShare = museGlobal + QString("/") + QString(SHAREINSTPREFIX); + } + museProject = museProjectInitPath; //getcwd(0, 0); + configName = QString(getenv("HOME")) + QString("/.MusE"); + + museInstruments = museGlobalShare + QString("/instruments"); + + const char* ins = getenv("MUSEINSTRUMENTS"); + if(ins) + museUserInstruments = QString(ins); + if(museUserInstruments.isEmpty()) + museUserInstruments = museUser + QString("/muse_instruments"); + +#ifdef HAVE_LASH + lash_args_t * lash_args = 0; + if(useLASH) + lash_args = lash_extract_args (&argc, &argv); +#endif + + srand(time(0)); // initialize random number generator +// signal(SIGCHLD, catchSignal); // interferes with initVST() + initMidiController(); + QApplication::setColorSpec(QApplication::ManyColor); + MuseApplication app(argc, argv); + + initShortCuts(); + readConfiguration(); + + if (config.useDenormalBias) + printf("Denormal protection enabled.\n"); + // SHOW MUSE SPLASH SCREEN + if (config.showSplashScreen) { + QPixmap splsh(museGlobalShare + "/splash.png"); + + if (!splsh.isNull()) { + QSplashScreen* muse_splash = new QSplashScreen(splsh, + Qt::WindowStaysOnTopHint); + muse_splash->setAttribute(Qt::WA_DeleteOnClose); // Possibly also Qt::X11BypassWindowManagerHint + muse_splash->show(); + QTimer* stimer = new QTimer(0); + muse_splash->connect(stimer, SIGNAL(timeout()), muse_splash, SLOT(close())); + stimer->setSingleShot(true); + stimer->start(6000); + } + } + + int i; + + QString optstr("ahvdDmMsP:Y:l:py"); +#ifdef VST_SUPPORT + optstr += QString("V"); +#endif +#ifdef DSSI_SUPPORT + optstr += QString("I"); +#endif +#ifdef HAVE_LASH + optstr += QString("L"); +#endif + +//#ifdef VST_SUPPORT +// while ((i = getopt(argc, argv, "ahvdDmMsVP:py")) != EOF) { +//#else +// while ((i = getopt(argc, argv, "ahvdDmMsP:py")) != EOF) { +//#endif + + while ((i = getopt(argc, argv, optstr.toLatin1().constData())) != EOF) { + char c = (char)i; + switch (c) { + case 'v': printVersion(argv[0]); return 0; + case 'd': + debugMode = true; + realTimeScheduling = false; + break; + case 'a': + noAudio = true; + break; + case 'D': debugMsg = true; break; + case 'm': midiInputTrace = true; break; + case 'M': midiOutputTrace = true; break; + case 's': debugSync = true; break; + case 'P': realTimePriority = atoi(optarg); break; + case 'Y': midiRTPrioOverride = atoi(optarg); break; + case 'p': loadPlugins = false; break; + case 'V': loadVST = false; break; + case 'I': loadDSSI = false; break; + case 'L': useLASH = false; break; + case 'y': usePythonBridge = true; break; + case 'l': locale_override = QString(optarg); break; + case 'h': usage(argv[0], argv[1]); return -1; + default: usage(argv[0], "bad argument"); return -1; + } + } + + /* + if(!config.styleSheetFile.isEmpty()) + { + if(debugMsg) + printf("loading style sheet <%s> \n", qPrintable(config.styleSheetFile)); + QFile cf(config.styleSheetFile); + if (cf.open(QIODevice::ReadOnly)) { + QByteArray ss = cf.readAll(); + QString sheet(QString::fromUtf8(ss.data())); + app.setStyleSheet(sheet); + cf.close(); + } + else + printf("loading style sheet <%s> failed\n", qPrintable(config.styleSheetFile)); + } + */ + + AL::initDsp(); + + if (debugMsg) + printf("Start euid: %d ruid: %d, Now euid %d\n", + euid, ruid, geteuid()); + if (debugMode) { + initDummyAudio(); + realTimeScheduling = false; + } + else if (noAudio) { + initDummyAudio(); + realTimeScheduling = true; + //if (debugMode) { // ?? + // realTimeScheduling = false; + // } + } + else if (initJackAudio()) { + if (!debugMode) + { + QMessageBox::critical(NULL, "MusE fatal error", "MusE <b>failed</b> to find a <b>Jack audio server</b>.<br><br>" + "<i>MusE will continue without audio support (-a switch)!</i><br><br>" + "If this was not intended check that Jack was started. " + "If Jack <i>was</i> started check that it was\n" + "started as the same user as MusE.\n"); + + initDummyAudio(); + noAudio = true; + realTimeScheduling = true; + if (debugMode) { + realTimeScheduling = false; + } + } + else + { + fprintf(stderr, "fatal error: no JACK audio server found\n"); + fprintf(stderr, "no audio functions available\n"); + fprintf(stderr, "*** experimental mode -- no play possible ***\n"); + initDummyAudio(); + //realTimeScheduling = audioDevice->isRealtime(); + } + realTimeScheduling = true; + } + else + realTimeScheduling = audioDevice->isRealtime(); + + useJackTransport.setValue(true); + // setup the prefetch fifo length now that the segmentSize is known + // Changed by Tim. p3.3.17 + // Changed to 4 *, JUST FOR TEST!!! + fifoLength = 131072/segmentSize; + //fifoLength = (131072/segmentSize) * 4; + + + argc -= optind; + ++argc; + + if (debugMsg) { + printf("global lib: <%s>\n", museGlobalLib.toLatin1().constData()); + printf("global share: <%s>\n", museGlobalShare.toLatin1().constData()); + printf("muse home: <%s>\n", museUser.toLatin1().constData()); + printf("project dir: <%s>\n", museProject.toLatin1().constData()); + printf("user instruments: <%s>\n", museUserInstruments.toLatin1().constData()); + } + + static QTranslator translator(0); + QString locale(QApplication::keyboardInputLocale().name()); + if (locale_override.length()) + locale = locale_override; + if (locale != "C") { + QString loc("muse_"); + loc += locale; + if (translator.load(loc, QString(".")) == false) { + QString lp(museGlobalShare); + lp += QString("/locale"); + if (translator.load(loc, lp) == false) { + printf("no locale <%s>/<%s>\n", loc.toLatin1().constData(), lp.toLatin1().constData()); + } + } + app.installTranslator(&translator); + } + + if (locale == "de") { + printf("locale de\n"); + hIsB = false; + } + + if (loadPlugins) + initPlugins(); + + if (loadVST) + initVST(); + + if(loadDSSI) + initDSSI(); + + // p3.3.39 + initOSC(); + + initIcons(); + + initMetronome(); + + //QApplication::clipboard()->setSelectionMode(false); ddskrjo obsolete even in Qt3 + + QApplication::addLibraryPath(museGlobalLib + "/qtplugins"); + if (debugMsg) { + QStringList list = app.libraryPaths(); + QStringList::Iterator it = list.begin(); + printf("QtLibraryPath:\n"); + while(it != list.end()) { + printf(" <%s>\n", (*it).toLatin1().constData()); + ++it; + } + } + + muse = new MusE(argc, &argv[optind]); + app.setMuse(muse); + muse->setWindowIcon(*museIcon); + + // Added by Tim. p3.3.22 + if (!debugMode) { + if (mlockall(MCL_CURRENT | MCL_FUTURE)) + perror("WARNING: Cannot lock memory:"); + } + + muse->show(); + muse->seqStart(); + +#ifdef HAVE_LASH + { + lash_client = 0; + if(useLASH) + { + int lash_flags = LASH_Config_File; + const char *muse_name = PACKAGE_NAME; + lash_client = lash_init (lash_args, muse_name, lash_flags, LASH_PROTOCOL(2,0)); + lash_alsa_client_id (lash_client, snd_seq_client_id (alsaSeq)); + if (!noAudio) { + // p3.3.38 + //char *jack_name = ((JackAudioDevice*)audioDevice)->getJackName(); + const char *jack_name = audioDevice->clientName(); + lash_jack_client_name (lash_client, jack_name); + } + } + } +#endif /* HAVE_LASH */ + QTimer::singleShot(100, muse, SLOT(showDidYouKnowDialog())); + + int rv = app.exec(); + if(debugMsg) + printf("app.exec() returned:%d\nDeleting main MusE object\n", rv); + delete muse; + if(debugMsg) + printf("Finished! Exiting main, return value:%d\n", rv); + return rv; + + } diff --git a/muse2/muse/marker/CMakeLists.txt b/muse2/muse/marker/CMakeLists.txt index b2b5084f..bc2b54ee 100644 --- a/muse2/muse/marker/CMakeLists.txt +++ b/muse2/muse/marker/CMakeLists.txt @@ -54,7 +54,7 @@ file (GLOB SOURCE_FILES markerview.cpp # markerview.h ) -add_library ( marker STATIC +add_library ( marker SHARED ${SOURCE_FILES} # ${marker_ui_headers} ${marker_mocs} @@ -62,7 +62,16 @@ add_library ( marker STATIC set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${SOURCE_FILES} CACHE INTERNAL "") +install(TARGETS marker DESTINATION ${MUSE_MODULES_DIR}) + +target_link_libraries ( marker + ${QT_LIBRARIES} + awl + icons + ) + set_target_properties( marker - PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h" + PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC" + OUTPUT_NAME muse_marker ) diff --git a/muse2/muse/master/CMakeLists.txt b/muse2/muse/master/CMakeLists.txt index 168d13ab..84977163 100644 --- a/muse2/muse/master/CMakeLists.txt +++ b/muse2/muse/master/CMakeLists.txt @@ -55,7 +55,7 @@ file (GLOB SOURCE_FILES tscale.cpp # tscale.h ) -add_library ( master STATIC +add_library ( master SHARED ${SOURCE_FILES} # ${master_ui_headers} ${master_mocs} @@ -63,7 +63,17 @@ add_library ( master STATIC set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${SOURCE_FILES} CACHE INTERNAL "") +install(TARGETS master DESTINATION ${MUSE_MODULES_DIR}) + +target_link_libraries ( master + ${QT_LIBRARIES} + al + awl + widgets + ) + set_target_properties( master - PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h" + PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC" + OUTPUT_NAME muse_master ) diff --git a/muse2/muse/midiedit/CMakeLists.txt b/muse2/muse/midiedit/CMakeLists.txt index 5fa2d5f9..1a77748a 100644 --- a/muse2/muse/midiedit/CMakeLists.txt +++ b/muse2/muse/midiedit/CMakeLists.txt @@ -76,7 +76,7 @@ file (GLOB SOURCE_FILES ecanvas.cpp # ecanvas.h ) -add_library ( midiedit STATIC +add_library ( midiedit SHARED ${SOURCE_FILES} # ${midiedit_ui_headers} ${midiedit_mocs} @@ -84,9 +84,17 @@ add_library ( midiedit STATIC set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${SOURCE_FILES} CACHE INTERNAL "") -add_dependencies(midiedit widgets) +install(TARGETS midiedit DESTINATION ${MUSE_MODULES_DIR}) + +target_link_libraries ( midiedit + ${QT_LIBRARIES} + al + icons + widgets + ) set_target_properties( midiedit - PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h" + PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC" + OUTPUT_NAME muse_midiedit ) diff --git a/muse2/muse/mixer/CMakeLists.txt b/muse2/muse/mixer/CMakeLists.txt index 2a85ff32..52e08248 100644 --- a/muse2/muse/mixer/CMakeLists.txt +++ b/muse2/muse/mixer/CMakeLists.txt @@ -33,7 +33,7 @@ file (GLOB SOURCE_FILES strip.cpp astrip.cpp mstrip.cpp ) -add_library ( mixer STATIC +add_library ( mixer SHARED ${SOURCE_FILES} ${mixer_mocs} ${mixer_uis} @@ -41,7 +41,15 @@ add_library ( mixer STATIC set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${SOURCE_FILES} ${UI_FILES} CACHE INTERNAL "") +target_link_libraries ( mixer + ${QT_LIBRARIES} + widgets + ) + +install(TARGETS mixer DESTINATION ${MUSE_MODULES_DIR}) + set_target_properties ( mixer - PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h" + PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC" + OUTPUT_NAME muse_mixer ) diff --git a/muse2/muse/mplugins/CMakeLists.txt b/muse2/muse/mplugins/CMakeLists.txt index 0c8a8a1b..3395ff0a 100644 --- a/muse2/muse/mplugins/CMakeLists.txt +++ b/muse2/muse/mplugins/CMakeLists.txt @@ -59,8 +59,7 @@ file (GLOB SOURCE_FILES random.cpp random.h ) -# add_library ( mplugins SHARED -add_library ( mplugins STATIC +add_library ( mplugins SHARED ${SOURCE_FILES} ${mplugins_mocs} ${mplugins_uis} @@ -69,12 +68,15 @@ add_library ( mplugins STATIC set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${SOURCE_FILES} ${UI_FILES} CACHE INTERNAL "") +install(TARGETS mplugins DESTINATION ${MUSE_MODULES_DIR}) + add_dependencies(mplugins widgets) -#target_link_libraries( mplugins -# # midiplugin -# ${QT_LIBRARIES} -# ) +target_link_libraries( mplugins + # midiplugin + ${QT_LIBRARIES} + widgets + ) # - tell cmake to name target transform.so instead of # libtransform.so @@ -82,7 +84,8 @@ add_dependencies(mplugins widgets) # set_target_properties ( mplugins # PROPERTIES PREFIX "" - PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h" + PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC" + OUTPUT_NAME muse_mplugins ) # install_targets ( /${CMAKE_INSTALL_LIBDIR}/${MusE_INSTALL_NAME}/midiplugins/ transform ) diff --git a/muse2/muse/remote/CMakeLists.txt b/muse2/muse/remote/CMakeLists.txt index d137b683..01605975 100644 --- a/muse2/muse/remote/CMakeLists.txt +++ b/muse2/muse/remote/CMakeLists.txt @@ -9,13 +9,15 @@ file (GLOB remote_src pyapi.cpp ) -add_library(remote STATIC +add_library(remote SHARED ${remote_src} ${PROJECT_BINARY_DIR}/all.h.pch ) set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${remote_src} CACHE INTERNAL "") +install(TARGETS remote DESTINATION ${MUSE_MODULES_DIR}) + set_source_files_properties( pyapi.cpp PROPERTIES COMPILE_FLAGS "-fPIC -include ${PROJECT_BINARY_DIR}/all.h -include ${PYTHON_INCLUDES} -DENABLE_PYTHON" diff --git a/muse2/muse/waveedit/CMakeLists.txt b/muse2/muse/waveedit/CMakeLists.txt index 4fb6915e..cdd148ff 100644 --- a/muse2/muse/waveedit/CMakeLists.txt +++ b/muse2/muse/waveedit/CMakeLists.txt @@ -38,7 +38,7 @@ file (GLOB SOURCE_FILES editgain.cpp ) -add_library ( waveedit STATIC +add_library ( waveedit SHARED ${SOURCE_FILES} ${waveedit_ui_headers} ${waveedit_mocs} @@ -46,6 +46,15 @@ add_library ( waveedit STATIC set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${SOURCE_FILES} ${UI_FILES} CACHE INTERNAL "") +install(TARGETS waveedit DESTINATION ${MUSE_MODULES_DIR}) + +target_link_libraries( waveedit + ${QT_LIBRARIES} + widgets + ) + + set_target_properties( waveedit - PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h" + PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC" + OUTPUT_NAME muse_waveedit ) diff --git a/muse2/muse/widgets/CMakeLists.txt b/muse2/muse/widgets/CMakeLists.txt index f1c6e453..989fea4a 100644 --- a/muse2/muse/widgets/CMakeLists.txt +++ b/muse2/muse/widgets/CMakeLists.txt @@ -232,14 +232,21 @@ file (GLOB SOURCE_FILES menutitleitem.h ) -add_library ( widgets STATIC +add_library ( widgets SHARED ${widget_ui_headers} ${widget_mocs} ${SOURCE_FILES} ) +target_link_libraries ( widgets + ${QT_LIBRARIES} + icons + ) + set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${SOURCE_FILES} ${UI_FILES} CACHE INTERNAL "") +install(TARGETS widgets DESTINATION ${MUSE_MODULES_DIR}) + # AM_CXXFLAGS +=-DSVNVERSION=\"$(shell svnversion)\" # EXEC_PROGRAM( svnversion @@ -248,7 +255,8 @@ set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${SOURCE_FILES} ${UI_FILES} CACHE set_target_properties( widgets # PROPERTIES COMPILE_FLAGS "-DSVNVERSION='\"${SVNVER}\"' -include ${PROJECT_BINARY_DIR}/all.h ${MUSECXXFLAGS} -I../ -I${PROJECT_SOURCE_DIR}/synti " - PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h ${MUSECXXFLAGS} -I../ -I${PROJECT_SOURCE_DIR}/synti " + PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h ${MUSECXXFLAGS} -I../ -I${PROJECT_SOURCE_DIR}/synti -fPIC" + OUTPUT_NAME muse_widgets ) diff --git a/muse2/synti/libsynti/CMakeLists.txt b/muse2/synti/libsynti/CMakeLists.txt index 94137c70..0b257249 100644 --- a/muse2/synti/libsynti/CMakeLists.txt +++ b/muse2/synti/libsynti/CMakeLists.txt @@ -31,17 +31,20 @@ file (GLOB SOURCE_FILES ## mpevent.cpp ) -add_library(synti +add_library(synti SHARED ${PROJECT_BINARY_DIR}/all-pic.h.pch ${SOURCE_FILES} ) set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${SOURCE_FILES} CACHE INTERNAL "") +install(TARGETS synti DESTINATION ${MUSE_MODULES_DIR}) + # # -fPIC is necessary for 64 bit systems # set_target_properties( synti PROPERTIES COMPILE_FLAGS "-fPIC -include ${PROJECT_BINARY_DIR}/all-pic.h" + OUTPUT_NAME muse_synti ) |