diff options
444 files changed, 11968 insertions, 10843 deletions
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) @@ -230,6 +231,17 @@ else (ENABLE_OSC) 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 4c45bc99..11ee89bc 100644 --- a/muse2/ChangeLog +++ b/muse2/ChangeLog @@ -1,3 +1,16 @@ +06.09.2011: + - SigEdit, up/down arrow in denominator only moves between powers of two (decreased thick headedness), + numerator is no longer validated (rj) + - Hopefully last big namespace update. The only namespaces in use are + o MusEGlobal: For global variables + 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: + - More fixes to SigEdit, close on enter, navigate with arrows and / between values, fixed background color, focus (rj) 02.09.2011: - SigEdit reworked to use two spinboxes, plan on adding Enter/Return detection so the widget will close when Enter/Return is pressed (rj) diff --git a/muse2/al/sig.cpp b/muse2/al/sig.cpp index 8521fb5b..675a6392 100644 --- a/muse2/al/sig.cpp +++ b/muse2/al/sig.cpp @@ -262,7 +262,7 @@ int SigList::ticks_beat(int n) const { ///int m = AL::division; - int m = MusEConfig::config.division; + int m = MusEGlobal::config.division; switch (n) { case 1: m <<= 2; break; // 1536 @@ -457,7 +457,7 @@ int SigList::rasterStep(unsigned t, int raster) const //--------------------------------------------------------- #if 0 -void SigList::write(Xml& xml) const +void SigList::write(MusECore::Xml& xml) const { xml.stag("siglist"); for (ciSigEvent i = begin(); i != end(); ++i) @@ -466,7 +466,7 @@ void SigList::write(Xml& xml) const } #endif -void SigList::write(int level, Xml& xml) const +void SigList::write(int level, MusECore::Xml& xml) const { xml.tag(level++, "siglist"); for (ciSigEvent i = begin(); i != end(); ++i) @@ -499,16 +499,16 @@ void SigList::read(QDomNode node) } #endif -void SigList::read(Xml& xml) +void SigList::read(MusECore::Xml& xml) { for (;;) { - Xml::Token token = xml.parse(); + MusECore::Xml::Token token = xml.parse(); const QString& tag = xml.s1(); switch (token) { - case Xml::Error: - case Xml::End: + case MusECore::Xml::Error: + case MusECore::Xml::End: return; - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "sig") { SigEvent* t = new SigEvent(); unsigned tick = t->read(xml); @@ -520,9 +520,9 @@ void SigList::read(Xml& xml) else xml.unknown("SigList"); break; - case Xml::Attribut: + case MusECore::Xml::Attribut: break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "siglist") { normalize(); return; @@ -538,7 +538,7 @@ void SigList::read(Xml& xml) //--------------------------------------------------------- #if 0 -void SigEvent::write(Xml& xml, int at) const +void SigEvent::write(MusECore::Xml& xml, int at) const { xml.stag(QString("sig at=\"%1\"").arg(at)); xml.tag("tick", tick); @@ -548,7 +548,7 @@ void SigEvent::write(Xml& xml, int at) const } #endif -void SigEvent::write(int level, Xml& xml, int at) const +void SigEvent::write(int level, MusECore::Xml& xml, int at) const { xml.tag(level++, "sig at=\"%d\"", at); xml.intTag(level, "tick", tick); @@ -586,17 +586,17 @@ int SigEvent::read(QDomNode node) } #endif -int SigEvent::read(Xml& xml) +int SigEvent::read(MusECore::Xml& xml) { int at = 0; for (;;) { - Xml::Token token = xml.parse(); + MusECore::Xml::Token token = xml.parse(); const QString& tag = xml.s1(); switch (token) { - case Xml::Error: - case Xml::End: + case MusECore::Xml::Error: + case MusECore::Xml::End: return 0; - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "tick") tick = xml.parseInt(); else if (tag == "nom") @@ -606,11 +606,11 @@ int SigEvent::read(Xml& xml) else xml.unknown("SigEvent"); break; - case Xml::Attribut: + case MusECore::Xml::Attribut: if (tag == "at") at = xml.s2().toInt(); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "sig") return at; default: diff --git a/muse2/al/sig.h b/muse2/al/sig.h index f5010822..02582399 100644 --- a/muse2/al/sig.h +++ b/muse2/al/sig.h @@ -26,7 +26,10 @@ #include <map> #include "../muse/xml.h" + +namespace MusECore { class Xml; +} namespace AL { @@ -57,9 +60,9 @@ struct SigEvent { int bar; // precomputed ///int read(QDomNode); - ///void write(Xml&, int) const; - int read(Xml&); - void write(int, Xml&, int) const; + ///void write(MusECore::Xml&, int) const; + int read(MusECore::Xml&); + void write(int, MusECore::Xml&, int) const; SigEvent() { } SigEvent(const TimeSignature& s, unsigned tk) { @@ -94,9 +97,9 @@ class SigList : public SIGLIST { void del(unsigned tick); ///void read(QDomNode); - ///void write(Xml&) const; - void read(Xml&); - void write(int, Xml&) const; + ///void write(MusECore::Xml&) const; + void read(MusECore::Xml&); + void write(int, MusECore::Xml&) const; void dump() const; diff --git a/muse2/awl/CMakeLists.txt b/muse2/awl/CMakeLists.txt index f84194a8..7586b1c2 100644 --- a/muse2/awl/CMakeLists.txt +++ b/muse2/awl/CMakeLists.txt @@ -45,6 +45,7 @@ QT4_WRAP_CPP (awl_mocs posedit.h # poslabel.h sigedit.h + sigspinbox.h slider.h # tcanvas.h tempoedit.h @@ -80,6 +81,7 @@ file (GLOB awl_source_files posedit.cpp # poslabel.cpp sigedit.cpp + sigspinbox.cpp slider.cpp # tcanvas.cpp tempoedit.cpp diff --git a/muse2/awl/floatentry.cpp b/muse2/awl/floatentry.cpp index 573420df..9b4b3e99 100644 --- a/muse2/awl/floatentry.cpp +++ b/muse2/awl/floatentry.cpp @@ -220,7 +220,7 @@ void FloatEntry::repeat() switch (button) { case Qt::LeftButton: - if (!MusEConfig::config.leftMouseButtonCanDecrease) + if (!MusEGlobal::config.leftMouseButtonCanDecrease) return; // else fall through case Qt::MidButton: diff --git a/muse2/awl/pitchedit.cpp b/muse2/awl/pitchedit.cpp index e0ede87b..3d9f1037 100644 --- a/muse2/awl/pitchedit.cpp +++ b/muse2/awl/pitchedit.cpp @@ -27,7 +27,9 @@ #include <QKeyEvent> +namespace MusEGlobal { extern QObject* song; // TODO FINDME this is a really dirty hack! +} namespace Awl { @@ -40,7 +42,7 @@ PitchEdit::PitchEdit(QWidget* parent) { setRange(0, 127); deltaMode = false; - connect(song, SIGNAL(midiNote(int, int)), SLOT(midiNote(int,int))); + connect(MusEGlobal::song, SIGNAL(midiNote(int, int)), SLOT(midiNote(int,int))); } //--------------------------------------------------------- diff --git a/muse2/awl/posedit.cpp b/muse2/awl/posedit.cpp index 5666f39f..049b59bd 100644 --- a/muse2/awl/posedit.cpp +++ b/muse2/awl/posedit.cpp @@ -32,7 +32,9 @@ #include <QLineEdit> #include <QStyle> +namespace MusEGlobal { extern int mtcType; +} namespace Awl { @@ -217,7 +219,7 @@ void PosEdit::setSmpte(bool f) // setValue //--------------------------------------------------------- -void PosEdit::setValue(const Pos& time) +void PosEdit::setValue(const MusECore::Pos& time) { if(_pos == time) return; @@ -227,13 +229,13 @@ void PosEdit::setValue(const Pos& time) void PosEdit::setValue(const QString& s) { - Pos time(s); + MusECore::Pos time(s); setValue(time); } void PosEdit::setValue(int t) { - Pos time(t); + MusECore::Pos time(t); setValue(time); } @@ -287,7 +289,7 @@ QAbstractSpinBox::StepEnabled PosEdit::stepEnabled() const else { int nf = 23; // 24 frames sec - switch(mtcType) { + switch(MusEGlobal::mtcType) { //case 0: // 24 frames sec // nf = 23; // break; @@ -398,7 +400,7 @@ QValidator::State PosEdit::validate(QString& s,int& /*i*/) const rv = state; int nf = 23; // 24 frames sec - switch(mtcType) { + switch(MusEGlobal::mtcType) { //case 0: // 24 frames sec // nf = 23; // break; @@ -541,7 +543,7 @@ void PosEdit::stepBy(int steps) case 2: { int nf = 23; // 24 frames sec - switch(mtcType) { + switch(MusEGlobal::mtcType) { //case 0: // 24 frames sec // nf = 23; // break; @@ -578,7 +580,7 @@ void PosEdit::stepBy(int steps) default: return; } - Pos newPos(minute, sec, frame, subframe); + MusECore::Pos newPos(minute, sec, frame, subframe); if (!(newPos == _pos)) { changed = true; _pos = newPos; @@ -623,7 +625,7 @@ void PosEdit::stepBy(int steps) default: return; } - Pos newPos(bar, beat, tick); + MusECore::Pos newPos(bar, beat, tick); if (!(newPos == _pos)) { changed = true; _pos = newPos; @@ -666,7 +668,7 @@ void PosEdit::finishEdit() return; } - Pos newPos(sl[0].toInt(), sl[1].toInt(), sl[2].toInt(), sl[3].toInt()); + MusECore::Pos newPos(sl[0].toInt(), sl[1].toInt(), sl[2].toInt(), sl[3].toInt()); if (!(newPos == _pos)) { changed = true; @@ -681,7 +683,7 @@ void PosEdit::finishEdit() return; } - Pos newPos(sl[0].toInt() - 1, sl[1].toInt() - 1, sl[2].toInt()); + MusECore::Pos newPos(sl[0].toInt() - 1, sl[1].toInt() - 1, sl[2].toInt()); if (!(newPos == _pos)) { changed = true; diff --git a/muse2/awl/posedit.h b/muse2/awl/posedit.h index 2da74d41..29692124 100644 --- a/muse2/awl/posedit.h +++ b/muse2/awl/posedit.h @@ -42,7 +42,7 @@ class PosEdit : public QAbstractSpinBox Q_PROPERTY(bool smpte READ smpte WRITE setSmpte) bool _smpte; - Pos _pos; + MusECore::Pos _pos; bool initialized; QIntValidator* validator; @@ -58,7 +58,7 @@ class PosEdit : public QAbstractSpinBox void finishEdit(); signals: - void valueChanged(const Pos&); + void valueChanged(const MusECore::Pos&); // Choose these three carefully, watch out for focusing recursion. void returnPressed(); @@ -67,7 +67,7 @@ class PosEdit : public QAbstractSpinBox void editingFinished(); public slots: - void setValue(const Pos& time); + void setValue(const MusECore::Pos& time); void setValue(int t); void setValue(const QString& s); @@ -76,7 +76,7 @@ class PosEdit : public QAbstractSpinBox ~PosEdit(); QSize sizeHint() const; - Pos pos() const { return _pos; } + MusECore::Pos pos() const { return _pos; } void setSmpte(bool); bool smpte() const { return _smpte; } // void* operator new(size_t); // What was this for? Tim. diff --git a/muse2/awl/sigedit.cpp b/muse2/awl/sigedit.cpp index 74e4b060..d3685a53 100644 --- a/muse2/awl/sigedit.cpp +++ b/muse2/awl/sigedit.cpp @@ -43,20 +43,26 @@ SigEdit::SigEdit(QWidget* parent) { initialized = false; slash = new QLabel("/",this); - zSpin = new QSpinBox(this); - nSpin = new QSpinBox(this); + zSpin = new SigSpinBox(this); + nSpin = new SigSpinBox(this); zSpin->setRange(1,100); - nSpin->setRange(1,100); + nSpin->setDenominator(); + nSpin->setRange(1,128); layout = new QHBoxLayout(this); layout->setContentsMargins(0,0,0,0); layout->setSpacing(1); layout->addWidget(zSpin); layout->addWidget(slash); layout->addWidget(nSpin); - layout->addSpacing(40); + layout->addSpacing(30); connect(zSpin, SIGNAL(valueChanged(int)), SLOT(setZ(int))); connect(nSpin, SIGNAL(valueChanged(int)), SLOT(setN(int))); + connect(nSpin, SIGNAL(returnPressed()), SIGNAL(returnPressed())); + connect(zSpin, SIGNAL(returnPressed()), SIGNAL(returnPressed())); + connect(zSpin, SIGNAL(moveFocus()), SLOT(moveFocus())); + connect(nSpin, SIGNAL(moveFocus()), SLOT(moveFocus())); + zSpin->selectAll(); } SigEdit::~SigEdit() @@ -68,18 +74,29 @@ SigEdit::~SigEdit() //--------------------------------------------------------- +// moveFocus +//--------------------------------------------------------- + +void SigEdit::moveFocus() +{ + if (zSpin->hasFocus()) { + nSpin->setFocus(); + nSpin->selectAll(); + } + else { + zSpin->setFocus(); + zSpin->selectAll(); + } +} + +//--------------------------------------------------------- // setZ //--------------------------------------------------------- void SigEdit::setZ(const int z) { _sig.z=z; - if (_sig.isValid()) { - zSpin->setStyleSheet(""); - emit valueChanged(_sig); - } - else - zSpin->setStyleSheet("QSpinBox { background-color: red; }"); + emit valueChanged(_sig); } //--------------------------------------------------------- // setN @@ -118,13 +135,18 @@ void SigEdit::updateValue() nSpin->setValue(_sig.n); } - void SigEdit::paintEvent(QPaintEvent* event) { +void SigEdit::paintEvent(QPaintEvent* event) { if (!initialized) updateValue(); initialized = true; QPainter p(this); - p.fillRect(event->rect(), Qt::white); + p.fillRect(event->rect(), p.background()); QWidget::paintEvent(event); } +void SigEdit::setFocus() +{ + zSpin->setFocus(); +} + } diff --git a/muse2/awl/sigedit.h b/muse2/awl/sigedit.h index acb0b9d8..5fe8186d 100644 --- a/muse2/awl/sigedit.h +++ b/muse2/awl/sigedit.h @@ -25,9 +25,9 @@ #include "al/sig.h" //#include "sig.h" +#include <awl/sigspinbox.h> #include <QWidget> -#include <QSpinBox> #include <QHBoxLayout> #include <QLabel> @@ -48,8 +48,8 @@ class SigEdit : public QWidget AL::TimeSignature _sig; bool initialized; QLabel *slash; - QSpinBox *zSpin; - QSpinBox *nSpin; + SigSpinBox *zSpin; + SigSpinBox *nSpin; QHBoxLayout *layout; virtual void paintEvent(QPaintEvent* event); @@ -57,13 +57,16 @@ class SigEdit : public QWidget signals: void valueChanged(const AL::TimeSignature&); + void returnPressed(); private slots: void setN(const int n); void setZ(const int z); + void moveFocus(); public slots: void setValue(const AL::TimeSignature&); + void setFocus(); public: SigEdit(QWidget* parent = 0); diff --git a/muse2/awl/sigspinbox.cpp b/muse2/awl/sigspinbox.cpp new file mode 100644 index 00000000..6e38b164 --- /dev/null +++ b/muse2/awl/sigspinbox.cpp @@ -0,0 +1,57 @@ +#include "sigspinbox.h" +#include "al/sig.h" +#include <QKeyEvent> +#include <stdio.h> + +SigSpinBox::SigSpinBox(QWidget *parent) : + QSpinBox(parent) +{ + _denominator=false; +} +void SigSpinBox::keyPressEvent(QKeyEvent*ev) +{ + switch (ev->key()) { + case Qt::Key_Return: + emit returnPressed(); + return; + break; + case Qt::Key_Left: + case Qt::Key_Right: + case Qt::Key_Slash: + emit moveFocus(); + return; + break; + default: + break; + } + QSpinBox::keyPressEvent(ev); +} + +void SigSpinBox::setDenominator() +{ + _denominator=true; +} + +void SigSpinBox::stepBy(int step) +{ + if (!_denominator) { + setValue(value() + step); + return; + } + + AL::TimeSignature sig(4, value()); + if (step == 1) { + // make sure that sig is valid then increase + if (sig.isValid()) + setValue(value() * 2); + } + else if (step == -1) { + // make sure that sig is valid then increase + if (sig.isValid()) { + int v = value() / 2; + if (v < 2) + v = 2; + setValue(v); + } + } +} diff --git a/muse2/awl/sigspinbox.h b/muse2/awl/sigspinbox.h new file mode 100644 index 00000000..92fd1cbc --- /dev/null +++ b/muse2/awl/sigspinbox.h @@ -0,0 +1,25 @@ +#ifndef SIGSPINBOX_H +#define SIGSPINBOX_H + +#include <QSpinBox> + +class SigSpinBox : public QSpinBox +{ + Q_OBJECT + bool _denominator; +protected: + virtual void keyPressEvent(QKeyEvent*); + virtual void stepBy(int); +public: + explicit SigSpinBox(QWidget *parent = 0); + void setDenominator(); + +signals: + void returnPressed(); + void moveFocus(); + +public slots: + +}; + +#endif // SIGSPINBOX_H diff --git a/muse2/awl/tcanvas.cpp b/muse2/awl/tcanvas.cpp index d39080e2..70fe909f 100644 --- a/muse2/awl/tcanvas.cpp +++ b/muse2/awl/tcanvas.cpp @@ -300,7 +300,7 @@ bool TimeCanvas::eventFilter(QObject* obj, QEvent* event) //else if (b & Qt::RightButton) // i = 2; else if (b & Qt::RightButton) { - if ((MusEConfig::config.rangeMarkerWithoutMMB) && (event->modifiers() & Qt::ControlModifier)) + if ((MusEGlobal::config.rangeMarkerWithoutMMB) && (event->modifiers() & Qt::ControlModifier)) i = 1; else i = 2; 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 c56376fe..386cf226 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" @@ -77,9 +78,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 +116,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/lash.h> lash_client_t * lash_client = 0; @@ -144,12 +146,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 +162,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 +175,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); @@ -210,14 +212,14 @@ 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 - //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 +228,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,11 +252,11 @@ 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); - audioPrefetch->stop(true); + MusEGlobal::song->setStop(true); + MusEGlobal::song->setStopPlay(false); + MusEGlobal::midiSeq->stop(true); + MusEGlobal::audio->stop(true); + MusEGlobal::audioPrefetch->stop(true); if (MusEGlobal::realTimeScheduling && watchdogThread) pthread_cancel(watchdogThread); } @@ -265,11 +267,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 +279,7 @@ bool MusE::seqRestart() if(!seqStart()) return false; - audioDevice->graphChanged(); + MusEGlobal::audioDevice->graphChanged(); return true; } @@ -357,23 +359,23 @@ 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 //--------------------------------------------------- // 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); } @@ -386,17 +388,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 +407,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 +512,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 +535,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 +570,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 +581,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,11 +734,11 @@ 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(); - //audioPrefetch = new AudioPrefetch(0, "Disc"); - audioPrefetch = new AudioPrefetch("Prefetch"); + //MusEGlobal::midiSeq = new MusECore::MidiSeq(MusEGlobal::realTimeScheduling ? MusEGlobal::realTimePriority : 0, "Midi"); + MusEGlobal::midiSeq = new MusECore::MidiSeq("Midi"); + MusEGlobal::audio = new MusECore::Audio(); + //MusEGlobal::audioPrefetch = new MusECore::AudioPrefetch(0, "Disc"); + MusEGlobal::audioPrefetch = new MusECore::AudioPrefetch("Prefetch"); //--------------------------------------------------- // Popups @@ -806,7 +808,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 +928,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 +965,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 +985,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 +1009,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 +1024,7 @@ MusE::~MusE() void MusE::setHeartBeat() { - MusEGlobal::heartBeatTimer->start(1000/MusEConfig::config.guiRefresh); + MusEGlobal::heartBeatTimer->start(1000/MusEGlobal::config.guiRefresh); } //--------------------------------------------------------- @@ -1031,7 +1033,7 @@ void MusE::setHeartBeat() void MusE::resetMidiDevices() { - audio->msgResetMidiDevices(); + MusEGlobal::audio->msgResetMidiDevices(); } //--------------------------------------------------------- @@ -1041,11 +1043,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 +1056,7 @@ void MusE::initMidiDevices() void MusE::localOff() { - audio->msgLocalOff(); + MusEGlobal::audio->msgLocalOff(); } //--------------------------------------------------------- @@ -1106,11 +1108,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 +1132,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 +1191,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 +1202,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 +1228,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 +1290,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; i<TopWin::TOPLEVELTYPE_LAST_ENTRY; i++) - if ((i!=TopWin::ARRANGER) && TopWin::_defaultSubwin[i]) + for (int i=0; i<MusEGui::TopWin::TOPLEVELTYPE_LAST_ENTRY; i++) + if ((i!=MusEGui::TopWin::ARRANGER) && MusEGui::TopWin::_defaultSubwin[i]) { maximizeArranger=false; break; @@ -1358,8 +1360,8 @@ void MusE::setUntitledProject() void MusE::setConfigDefaults() { - readConfiguration(); // used for reading midi files - song->dirty = false; + MusECore::readConfiguration(); // used for reading midi files + MusEGlobal::song->dirty = false; } //--------------------------------------------------------- @@ -1368,11 +1370,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 +1384,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 +1398,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 +1451,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 +1468,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 +1489,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 +1519,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 +1545,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 +1565,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<QString>::iterator i = temporaryWavFiles.begin(); i != temporaryWavFiles.end(); i++) { + for (std::list<QString>::iterator i = MusECore::temporaryWavFiles.begin(); i != MusECore::temporaryWavFiles.end(); i++) { QString filename = *i; QFileInfo f(filename); QDir d = f.dir(); @@ -1598,13 +1600,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::audioPrefetch; + delete MusEGlobal::audio; + delete MusEGlobal::midiSeq; + delete MusEGlobal::song; qApp->quit(); } @@ -1626,7 +1628,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 +1714,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 +1729,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 +1751,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 +1774,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,13 +1789,13 @@ 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::NEW_DRUM: startDrumEditor(); break; - case Track::WAVE: startWaveEditor(); break; + case MusECore::Track::MIDI: startPianoroll(); break; + case MusECore::Track::DRUM: startDrumEditor(); break; + case MusECore::Track::NEW_DRUM: startDrumEditor(); break; + case MusECore::Track::WAVE: startWaveEditor(); break; default: break; } @@ -1803,9 +1805,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; @@ -1820,30 +1822,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 @@ -1867,21 +1869,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(); } @@ -1892,18 +1894,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(); } @@ -1914,10 +1916,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(); } @@ -1927,10 +1929,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(); } @@ -1941,21 +1943,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(); } @@ -1966,7 +1967,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; @@ -1974,13 +1975,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(); } @@ -1990,16 +1991,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()); } } @@ -2010,14 +2011,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 } } @@ -2036,9 +2037,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); @@ -2087,9 +2088,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) @@ -2104,10 +2105,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); @@ -2119,17 +2120,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); @@ -2151,112 +2152,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(); } @@ -2300,15 +2301,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; } @@ -2325,7 +2326,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(); @@ -2380,10 +2381,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(); @@ -2396,7 +2397,7 @@ void MusE::changeConfig(bool writeFlag) void MusE::configMetronome() { if (!metronomeConfig) - metronomeConfig = new MusEWidget::MetronomeConfig; + metronomeConfig = new MusEGui::MetronomeConfig; if(metronomeConfig->isVisible()) { metronomeConfig->raise(); @@ -2414,7 +2415,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); @@ -2440,12 +2441,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"), @@ -2454,7 +2455,7 @@ void MusE::bounceToTrack() return; } - OutputList* ol = song->outputs(); + MusECore::OutputList* ol = MusEGlobal::song->outputs(); if(ol->empty()) { QMessageBox::critical(this, @@ -2467,15 +2468,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) @@ -2497,24 +2498,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; } } @@ -2538,28 +2539,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, @@ -2573,9 +2574,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) @@ -2599,21 +2600,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); } @@ -2624,8 +2625,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"), @@ -2708,7 +2709,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" @@ -2728,37 +2729,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; } @@ -2771,7 +2772,7 @@ void MusE::startEditInstrument() { if(editInstrument == 0) { - editInstrument = new EditInstrument(this); + editInstrument = new MusEGui::EditInstrument(this); editInstrument->show(); } else @@ -2792,7 +2793,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); @@ -2813,14 +2814,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); } @@ -2834,75 +2835,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 } @@ -2913,13 +2914,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); @@ -2952,10 +2953,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); @@ -2969,10 +2970,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); @@ -3046,7 +3047,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 } //--------------------------------------------------------- @@ -3054,7 +3055,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 } //--------------------------------------------------------- @@ -3062,7 +3063,7 @@ void MusE::execUserScript(int id) //--------------------------------------------------------- void MusE::findUnusedWaveFiles() { - MusEWidget::UnusedWaveFiles unused(MusEGlobal::muse); + MusEGui::UnusedWaveFiles unused(MusEGlobal::muse); unused.exec(); } @@ -3080,7 +3081,7 @@ void MusE::focusChanged(QWidget*, QWidget* now) while (ptr) { - if ( (dynamic_cast<TopWin*>(ptr)!=0) || // *ptr is a TopWin or a derived class + if ( (dynamic_cast<MusEGui::TopWin*>(ptr)!=0) || // *ptr is a TopWin or a derived class (ptr==this) ) // the main window is selected break; ptr=dynamic_cast<QWidget*>(ptr->parent()); //in the unlikely case that ptr is a QObject, this returns NULL, which stops the loop @@ -3089,7 +3090,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<TopWin*>(ptr); + MusEGui::TopWin* win=dynamic_cast<MusEGui::TopWin*>(ptr); // now 'win' is either NULL or the pointer to the active TopWin if (win!=activeTopWin) @@ -3101,7 +3102,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() : "<None>", win); @@ -3124,7 +3125,7 @@ void MusE::activeTopWinChangedSlot(TopWin* win) -void MusE::setCurrentMenuSharingTopwin(TopWin* win) +void MusE::setCurrentMenuSharingTopwin(MusEGui::TopWin* win) { if (win && (win->sharesToolsAndMenu()==false)) { @@ -3134,7 +3135,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() : "<None>", win); @@ -3219,7 +3220,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) { @@ -3251,7 +3252,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 @@ -3269,7 +3270,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) @@ -3290,7 +3291,7 @@ void MusE::updateWindowMenu() void MusE::bringToFront(QWidget* widget) { - TopWin* win=dynamic_cast<TopWin*>(widget); + MusEGui::TopWin* win=dynamic_cast<MusEGui::TopWin*>(widget); if (win->isMdiWin()) { win->show(); @@ -3325,12 +3326,12 @@ list<QMdiSubWindow*> get_all_visible_subwins(QMdiArea* mdiarea) for (QList<QMdiSubWindow*>::iterator it=wins.begin(); it!=wins.end(); it++) if ((*it)->isVisible() && ((*it)->isMinimized()==false)) - if (dynamic_cast<TopWin*>((*it)->widget())->type()==TopWin::ARRANGER) + if (dynamic_cast<MusEGui::TopWin*>((*it)->widget())->type()==MusEGui::TopWin::ARRANGER) result.push_back(*it); for (QList<QMdiSubWindow*>::iterator it=wins.begin(); it!=wins.end(); it++) if ((*it)->isVisible() && ((*it)->isMinimized()==false)) - if (dynamic_cast<TopWin*>((*it)->widget())->type()!=TopWin::ARRANGER) + if (dynamic_cast<MusEGui::TopWin*>((*it)->widget())->type()!=MusEGui::TopWin::ARRANGER) result.push_back(*it); return result; @@ -3454,4 +3455,4 @@ void MusE::tileSubWindows() } } -} //namespace MusEApp +} //namespace MusEGui diff --git a/muse2/muse/app.h b/muse2/muse/app.h index 23f3f4c4..46e9f99b 100644 --- a/muse2/muse/app.h +++ b/muse2/muse/app.h @@ -30,7 +30,6 @@ #include <QFileInfo> #include <list> -class TopWin; class QCloseEvent; class QFocusEvent; class QMainWindow; @@ -45,61 +44,55 @@ class QToolButton; class QProgressDialog; class QMdiArea; -namespace MusEWidget { -class BigTime; -class EditToolBar; -class GlobalSettingsConfig; -class MetronomeConfig; -class MidiSyncConfig; -class RoutePopupMenu; -class ShortcutConfig; -class VisibleTracks; -} - -namespace MusEArranger { -class Arranger; -class ArrangerView; -} - +namespace MusECore { +class AudioOutput; +class Instrument; +class MidiInstrument; +class MidiPort; +class MidiTrack; class Part; class PartList; -class Transport; -class Instrument; +class SynthI; class Track; -class PrinterConfig; -class MRConfig; -class AudioConf; +class Undo; +class WaveTrack; class Xml; - -namespace MusEMixer { -class AudioMixerApp; } -class ClipListEdit; + +namespace MusEGui { +class Appearance; +class Arranger; +class ArrangerView; +class AudioConf; +class AudioMixerApp; class AudioRecord; -class MidiFileConfig; -class MidiFilterConfig; -class MarkerView; +class BigTime; +class ClipListEdit; +class EditInstrument; +class EditToolBar; +class GlobalSettingsConfig; class GlobalSettingsConfig; +class MRConfig; +class MarkerView; +class MetronomeConfig; class MidiControllerEditDialog; +class MidiFileConfig; +class MidiFilterConfig; class MidiInputTransformDialog; +class MidiSyncConfig; class MidiTransformerDialog; -class SynthI; +class PrinterConfig; class RhythmGen; -class MidiTrack; -class MidiInstrument; -class MidiPort; -class Appearance; -class WaveTrack; -class AudioOutput; -class EditInstrument; +class RoutePopupMenu; class ScoreEdit; -class Undo; +class ShortcutConfig; +class TopWin; +class Transport; +class VisibleTracks; #define MENU_ADD_SYNTH_ID_BASE 0x1000 -namespace MusEApp { - //--------------------------------------------------------- // MusE @@ -181,7 +174,7 @@ class MusE : public QMainWindow // either the requiredToolbars or optionalToolbars list! Transport* transport; - MusEWidget::BigTime* bigtime; + BigTime* bigtime; EditInstrument* editInstrument; // when adding a menu to the main window, remember adding it to @@ -191,40 +184,40 @@ class MusE : public QMainWindow QMenu* menu_functions, *menuScriptPlugins; // Special common menu for routes. Used (so far) by audio and midi strip, and midi trackinfo. - MusEWidget::RoutePopupMenu* routingPopupMenu; + RoutePopupMenu* routingPopupMenu; QMenu* follow; QMenu* midiInputPlugins; QWidget* midiPortConfig; QWidget* softSynthesizerConfig; - MusEWidget::MidiSyncConfig* midiSyncConfig; + MidiSyncConfig* midiSyncConfig; MRConfig* midiRemoteConfig; RhythmGen* midiRhythmGenerator; - MusEWidget::MetronomeConfig* metronomeConfig; + MetronomeConfig* metronomeConfig; AudioConf* audioConfig; MidiFileConfig* midiFileConfig; - MusEWidget::GlobalSettingsConfig* globalSettingsConfig; + GlobalSettingsConfig* globalSettingsConfig; MidiFilterConfig* midiFilterConfig; MidiInputTransformDialog* midiInputTransform; - MusEWidget::ShortcutConfig* shortcutConfig; + ShortcutConfig* shortcutConfig; Appearance* appearance; - MusEMixer::AudioMixerApp* mixer1; - MusEMixer::AudioMixerApp* mixer2; + AudioMixerApp* mixer1; + AudioMixerApp* mixer2; - MusEArranger::Arranger* _arranger; + Arranger* _arranger; ToplevelList toplevels; ClipListEdit* clipListEdit; MarkerView* markerView; - MusEArranger::ArrangerView* arrangerView; + ArrangerView* arrangerView; MidiTransformerDialog* midiTransformerDialog; QMenu* openRecent; bool readMidi(FILE*); - void read(Xml& xml, bool skipConfig, bool isTemplate); - void processTrack(MidiTrack* track); + void read(MusECore::Xml& xml, bool skipConfig, bool isTemplate); + void processTrack(MusECore::MidiTrack* track); - void write(Xml& xml) const; + void write(MusECore::Xml& xml) const; // If clear_all is false, it will not touch things like midi ports. bool clearSong(bool clear_all = true); bool save(const QString&, bool); @@ -232,17 +225,17 @@ class MusE : public QMainWindow void setConfigDefaults(); void setFollow(); - void readConfigParts(Xml& xml); - void readMidiport(Xml& xml); - void readMidichannel(Xml& xml, int port); - void readCtrl(Xml& xml, int port, int channel); - void readToplevels(Xml& xml); - PartList* getMidiPartsToEdit(); - Part* readPart(Xml& xml); + void readConfigParts(MusECore::Xml& xml); + void readMidiport(MusECore::Xml& xml); + void readMidichannel(MusECore::Xml& xml, int port); + void readCtrl(MusECore::Xml& xml, int port, int channel); + void readToplevels(MusECore::Xml& xml); + MusECore::PartList* getMidiPartsToEdit(); + MusECore::Part* readPart(MusECore::Xml& xml); bool checkRegionNotNull(); void loadProjectFile1(const QString&, bool songTemplate, bool loadAll); - void writeGlobalConfiguration(int level, Xml&) const; - void writeConfiguration(int level, Xml&) const; + void writeGlobalConfiguration(int level, MusECore::Xml&) const; + void writeConfiguration(int level, MusECore::Xml&) const; void updateConfiguration(); virtual void focusInEvent(QFocusEvent*); @@ -253,7 +246,7 @@ class MusE : public QMainWindow signals: void configChanged(); - void activeTopWinChanged(TopWin*); + void activeTopWinChanged(MusEGui::TopWin*); private slots: void loadProject(); @@ -324,8 +317,8 @@ class MusE : public QMainWindow void execDeliveredScript(int); void execUserScript(int); - void activeTopWinChangedSlot(TopWin*); - void setCurrentMenuSharingTopwin(TopWin*); + void activeTopWinChangedSlot(MusEGui::TopWin*); + void setCurrentMenuSharingTopwin(MusEGui::TopWin*); void bringToFront(QWidget* win); void setFullscreen(bool); @@ -336,11 +329,11 @@ class MusE : public QMainWindow public slots: bool saveAs(); - void bounceToFile(AudioOutput* ao = 0); + void bounceToFile(MusECore::AudioOutput* ao = 0); void closeEvent(QCloseEvent*e); void loadProjectFile(const QString&); void loadProjectFile(const QString&, bool songTemplate, bool loadAll); - void toplevelDeleted(TopWin* tl); + void toplevelDeleted(MusEGui::TopWin* tl); void loadTheme(const QString&); void loadStyleSheetFile(const QString&); bool seqRestart(); @@ -355,36 +348,36 @@ class MusE : public QMainWindow void startEditInstrument(); void configMidiPorts(); - void startEditor(PartList*, int); + void startEditor(MusECore::PartList*, int); void startScoreQuickly(); void startPianoroll(); - void startPianoroll(PartList* /*pl*/, bool /*showDefaultCtrls*/ = false); + void startPianoroll(MusECore::PartList* /*pl*/, bool /*showDefaultCtrls*/ = false); void startWaveEditor(); - void startWaveEditor(PartList*); - void openInScoreEdit(ScoreEdit* destination, PartList* pl, bool allInOne=false); + void startWaveEditor(MusECore::PartList*); + void openInScoreEdit(ScoreEdit* destination, MusECore::PartList* pl, bool allInOne=false); void openInScoreEdit(ScoreEdit* destination, bool allInOne=false); void openInScoreEdit_allInOne(QWidget* destination); void openInScoreEdit_oneStaffPerTrack(QWidget* destination); void startMasterEditor(); void startLMasterEditor(); void startListEditor(); - void startListEditor(PartList*); + void startListEditor(MusECore::PartList*); void startDrumEditor(); - void startDrumEditor(PartList* /*pl*/, bool /*showDefaultCtrls*/ = false); - void startEditor(Track*); + void startDrumEditor(MusECore::PartList* /*pl*/, bool /*showDefaultCtrls*/ = false); + void startEditor(MusECore::Track*); void startMidiTransformer(); void focusChanged(QWidget* old, QWidget* now); void addMdiSubWindow(QMdiSubWindow*); - void shareMenuAndToolbarChanged(TopWin*, bool); + void shareMenuAndToolbarChanged(MusEGui::TopWin*, bool); void updateWindowMenu(); public: MusE(int argc, char** argv); ~MusE(); - MusEArranger::Arranger* arranger() const { return _arranger; } + Arranger* arranger() const { return _arranger; } QRect configGeometryMain; QProgressDialog *progress; bool importMidi(const QString name, bool merge); @@ -393,16 +386,16 @@ class MusE : public QMainWindow void seqStop(); bool seqStart(); void setHeartBeat(); - void importController(int, MidiPort*, int); + void importController(int, MusECore::MidiPort*, int); QString projectName() { return project.fileName(); } QWidget* mixer1Window(); QWidget* mixer2Window(); QWidget* transportWindow(); QWidget* bigtimeWindow(); - bool importWaveToTrack(QString& name, unsigned tick=0, Track* track=NULL); - void importPartToTrack(QString& filename, unsigned tick, Track* track); + bool importWaveToTrack(QString& name, unsigned tick=0, MusECore::Track* track=NULL); + void importPartToTrack(QString& filename, unsigned tick, MusECore::Track* track); void showTransport(bool flag); - MusEWidget::RoutePopupMenu* getRoutingPopupMenu(); + RoutePopupMenu* getRoutingPopupMenu(); const ToplevelList* getToplevels() { return &toplevels; } @@ -416,4 +409,4 @@ class MusE : public QMainWindow extern void addProject(const QString& name); #endif -} // namespace MusEA +} // namespace MusEGui diff --git a/muse2/muse/appearance.cpp b/muse2/muse/appearance.cpp index a702965c..6c3ee2e4 100644 --- a/muse2/muse/appearance.cpp +++ b/muse2/muse/appearance.cpp @@ -47,6 +47,8 @@ #include "conf.h" #include "gconfig.h" +namespace MusEGui { + int BG_ITEM_HEIGHT = 30; class BgPreviewWidget : public QWidget { @@ -115,13 +117,13 @@ class IdListViewItem : public QTreeWidgetItem { // Appearance //--------------------------------------------------------- -Appearance::Appearance(MusEArranger::Arranger* a, QWidget* parent) +Appearance::Appearance(Arranger* a, QWidget* parent) : QDialog(parent, Qt::Window) { setupUi(this); arr = a; color = 0; - config = new MusEConfig::GlobalConfigValues; + config = new GlobalConfigValues; lastSelectedColorItem = 0; lastSelectedBgItem = 0; @@ -207,7 +209,7 @@ Appearance::Appearance(MusEArranger::Arranger* a, QWidget* parent) new IdListViewItem(0x410, id, "Saxophon"); */ for(int i = 0; i < NUM_PARTCOLORS; ++i) - new IdListViewItem(0x400 + i, id, MusEConfig::config.partColorNames[i]); + new IdListViewItem(0x400 + i, id, MusEGlobal::config.partColorNames[i]); new IdListViewItem(0x41c, aid, "part canvas background"); id = new IdListViewItem(0, aid, "Track List"); @@ -322,7 +324,7 @@ Appearance::Appearance(MusEArranger::Arranger* a, QWidget* parent) void Appearance::resetValues() { - *config = MusEConfig::config; // init with global config values + *config = MusEGlobal::config; // init with global config values styleSheetPath->setText(config->styleSheetFile); updateFonts(); @@ -697,7 +699,7 @@ void Appearance::apply() config->globalAlphaBlend = globalAlphaVal->value(); // set colors... - MusEConfig::config = *config; + MusEGlobal::config = *config; MusEGlobal::muse->changeConfig(true); } @@ -764,7 +766,7 @@ void Appearance::removeBackground() void Appearance::addBackground() { QString cur = getenv("HOME"); - QString user_bgfile = MusEWidget::getImageFileName(cur, MusEGlobal::image_file_pattern, this, + QString user_bgfile = getImageFileName(cur, MusEGlobal::image_file_pattern, this, tr("MusE: load image")); bool image_exists = false; @@ -1136,3 +1138,5 @@ void Appearance::browseFont(int n) } } +} // namespace MusEGui + diff --git a/muse2/muse/appearance.h b/muse2/muse/appearance.h index 2020d199..d8ec3dc5 100644 --- a/muse2/muse/appearance.h +++ b/muse2/muse/appearance.h @@ -28,13 +28,11 @@ class QColor; class QDialog; -class MusE; -namespace MusEArranger { + +namespace MusEGui { class Arranger; -} -namespace MusEConfig { class GlobalConfigValues; -} +class MusE; //--------------------------------------------------------- // Appearance Dialog @@ -45,9 +43,9 @@ class Appearance : public QDialog, public Ui::AppearanceDialogBase { Q_OBJECT private: - MusEArranger::Arranger* arr; + Arranger* arr; QColor* color; - MusEConfig::GlobalConfigValues* config; + GlobalConfigValues* config; QButtonGroup* aPalette; QTreeWidgetItem* user_bg; QTreeWidgetItem* global_bg; @@ -90,9 +88,11 @@ class Appearance : public QDialog, public Ui::AppearanceDialogBase { void colorNameEditFinished(); public: - Appearance(MusEArranger::Arranger*, QWidget* parent=0); + Appearance(Arranger*, QWidget* parent=0); ~Appearance(); void resetValues(); }; +} // namespace MusEGui + #endif diff --git a/muse2/muse/arranger/alayout.cpp b/muse2/muse/arranger/alayout.cpp index 2c2ee719..a892356c 100644 --- a/muse2/muse/arranger/alayout.cpp +++ b/muse2/muse/arranger/alayout.cpp @@ -25,7 +25,7 @@ #include <QScrollBar> -namespace MusEArranger { +namespace MusEGui { //--------------------------------------------------------- // wadd @@ -216,4 +216,4 @@ void TLLayout::clear() } } -} // namespace MusEArranger +} // namespace MusEGui diff --git a/muse2/muse/arranger/alayout.h b/muse2/muse/arranger/alayout.h index fe41eeb2..2ffef621 100644 --- a/muse2/muse/arranger/alayout.h +++ b/muse2/muse/arranger/alayout.h @@ -29,7 +29,7 @@ class QLayoutItem; class QScrollBar; -namespace MusEArranger { +namespace MusEGui { class WidgetStack; @@ -75,6 +75,6 @@ class TLLayout : public QLayout ///virtual int count() const { return ilist.count(); } // ddskrjo, is pure virtual, overridden }; -} // namespace MusEArranger +} // namespace MusEGui #endif diff --git a/muse2/muse/arranger/arranger.cpp b/muse2/muse/arranger/arranger.cpp index 1900b622..89245d64 100644 --- a/muse2/muse/arranger/arranger.cpp +++ b/muse2/muse/arranger/arranger.cpp @@ -70,7 +70,7 @@ #include "spinbox.h" #include "shortcuts.h" -namespace MusEArranger { +namespace MusEGui { //--------------------------------------------------------- // Arranger::setHeaderToolTips @@ -146,7 +146,7 @@ Arranger::Arranger(ArrangerView* parent, const char* name) label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); label->setIndent(3); toolbar->addWidget(label); - cursorPos = new MusEWidget::PosLabel(0); + cursorPos = new PosLabel(0); cursorPos->setEnabled(false); cursorPos->setFixedHeight(22); toolbar->addWidget(cursorPos); @@ -163,7 +163,7 @@ Arranger::Arranger(ArrangerView* parent, const char* name) raster->insertItem(i, tr(rastval[i])); raster->setCurrentIndex(1); // Set the audio record part snapping. Set to 0 (bar), the same as this combo box intial raster. - song->setArrangerRaster(0); + MusEGlobal::song->setArrangerRaster(0); toolbar->addWidget(raster); connect(raster, SIGNAL(activated(int)), SLOT(_setRaster(int))); ///raster->setFocusPolicy(Qt::NoFocus); @@ -178,14 +178,14 @@ Arranger::Arranger(ArrangerView* parent, const char* name) // song length is limited to 10000 bars; the real song len is limited // by overflows in tick computations // - lenEntry = new MusEWidget::SpinBox(1, 10000, 1); - lenEntry->setValue(song->len()); + lenEntry = new SpinBox(1, 10000, 1); + lenEntry->setValue(MusEGlobal::song->len()); lenEntry->setToolTip(tr("song length - bars")); lenEntry->setWhatsThis(tr("song length - bars")); toolbar->addWidget(lenEntry); connect(lenEntry, SIGNAL(valueChanged(int)), SLOT(songlenChanged(int))); - typeBox = new MusEWidget::LabelCombo(tr("Type"), 0); + typeBox = new LabelCombo(tr("Type"), 0); typeBox->insertItem(0, tr("NO")); typeBox->insertItem(1, tr("GM")); typeBox->insertItem(2, tr("GS")); @@ -203,8 +203,8 @@ Arranger::Arranger(ArrangerView* parent, const char* name) label->setIndent(3); toolbar->addWidget(label); - globalPitchSpinBox = new MusEWidget::SpinBox(-127, 127, 1); - globalPitchSpinBox->setValue(song->globalPitchShift()); + globalPitchSpinBox = new SpinBox(-127, 127, 1); + globalPitchSpinBox->setValue(MusEGlobal::song->globalPitchShift()); globalPitchSpinBox->setToolTip(tr("midi pitch")); globalPitchSpinBox->setWhatsThis(tr("global midi pitch shift")); toolbar->addWidget(globalPitchSpinBox); @@ -215,9 +215,9 @@ Arranger::Arranger(ArrangerView* parent, const char* name) label->setIndent(3); toolbar->addWidget(label); - globalTempoSpinBox = new MusEWidget::SpinBox(50, 200, 1, toolbar); + globalTempoSpinBox = new SpinBox(50, 200, 1, toolbar); globalTempoSpinBox->setSuffix(QString("%")); - globalTempoSpinBox->setValue(tempomap.globalTempo()); + globalTempoSpinBox->setValue(MusEGlobal::tempomap.globalTempo()); globalTempoSpinBox->setToolTip(tr("midi tempo")); globalTempoSpinBox->setWhatsThis(tr("midi tempo")); toolbar->addWidget(globalTempoSpinBox); @@ -241,8 +241,8 @@ Arranger::Arranger(ArrangerView* parent, const char* name) QVBoxLayout* box = new QVBoxLayout(this); box->setContentsMargins(0, 0, 0, 0); box->setSpacing(0); - box->addWidget(MusEUtil::hLine(this), Qt::AlignTop); - //QFrame* hline = MusEUtil::hLine(this); + box->addWidget(MusECore::hLine(this), Qt::AlignTop); + //QFrame* hline = MusECore::hLine(this); //hline->setLineWidth(0); //box->addWidget(hline, Qt::AlignTop); @@ -253,7 +253,7 @@ Arranger::Arranger(ArrangerView* parent, const char* name) int xscale = -100; int yscale = 1; - split = new MusEWidget::Splitter(Qt::Horizontal, this, "split"); + split = new Splitter(Qt::Horizontal, this, "split"); split->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); box->addWidget(split, 1000); //split->setHandleWidth(10); @@ -295,7 +295,7 @@ Arranger::Arranger(ArrangerView* parent, const char* name) ib->setFocusPolicy(Qt::NoFocus); connect(ib, SIGNAL(toggled(bool)), SLOT(showTrackInfo(bool))); - header = new MusEWidget::Header(tracklist, "header"); + header = new Header(tracklist, "header"); header->setFixedHeight(30); @@ -332,8 +332,8 @@ Arranger::Arranger(ArrangerView* parent, const char* name) genTrackInfo(tracklist); ///connect(list, SIGNAL(selectionChanged()), SLOT(trackSelectionChanged())); - connect(list, SIGNAL(selectionChanged(Track*)), SLOT(trackSelectionChanged())); - connect(list, SIGNAL(selectionChanged(Track*)), midiTrackInfo, SLOT(setTrack(Track*))); + connect(list, SIGNAL(selectionChanged(MusECore::Track*)), SLOT(trackSelectionChanged())); + connect(list, SIGNAL(selectionChanged(MusECore::Track*)), midiTrackInfo, SLOT(setTrack(MusECore::Track*))); connect(header, SIGNAL(sectionResized(int,int,int)), list, SLOT(redraw())); connect(header, SIGNAL(sectionMoved(int,int,int)), list, SLOT(redraw())); connect(header, SIGNAL(sectionMoved(int,int,int)), this, SLOT(headerMoved())); @@ -357,7 +357,7 @@ Arranger::Arranger(ArrangerView* parent, const char* name) tgrid->wadd(1, infoScroll); tgrid->wadd(2, header); tgrid->wadd(3, list); - tgrid->wadd(4, MusEUtil::hLine(tracklist)); + tgrid->wadd(4, MusECore::hLine(tracklist)); tgrid->wadd(5, ib); //--------------------------------------------------- @@ -365,7 +365,7 @@ Arranger::Arranger(ArrangerView* parent, const char* name) //--------------------------------------------------- int offset = AL::sigmap.ticksMeasure(0); - hscroll = new MusEWidget::ScrollScale(-1000, -10, xscale, song->len(), Qt::Horizontal, editor, -offset); + hscroll = new ScrollScale(-1000, -10, xscale, MusEGlobal::song->len(), Qt::Horizontal, editor, -offset); hscroll->setFocusPolicy(Qt::NoFocus); ib->setFixedHeight(hscroll->sizeHint().height()); @@ -393,17 +393,17 @@ Arranger::Arranger(ArrangerView* parent, const char* name) egrid->setContentsMargins(0, 0, 0, 0); egrid->setSpacing(0); - time = new MusEWidget::MTScale(&_raster, editor, xscale); + time = new MTScale(&_raster, editor, xscale); time->setOrigin(-offset, 0); canvas = new PartCanvas(&_raster, editor, xscale, yscale); - canvas->setBg(MusEConfig::config.partCanvasBg); - canvas->setCanvasTools(MusEWidget::arrangerTools); + canvas->setBg(MusEGlobal::config.partCanvasBg); + canvas->setCanvasTools(arrangerTools); canvas->setOrigin(-offset, 0); canvas->setFocus(); setFocusProxy(canvas); // once removed by Tim (r735), added by flo again connect(canvas, SIGNAL(setUsedTool(int)), this, SIGNAL(setUsedTool(int))); - connect(canvas, SIGNAL(trackChanged(Track*)), list, SLOT(selectTrack(Track*))); + connect(canvas, SIGNAL(trackChanged(MusECore::Track*)), list, SLOT(selectTrack(MusECore::Track*))); connect(list, SIGNAL(keyPressExt(QKeyEvent*)), canvas, SLOT(redirKeypress(QKeyEvent*))); connect(canvas, SIGNAL(selectTrackAbove()), list, SLOT(selectTrackAbove())); connect(canvas, SIGNAL(selectTrackBelow()), list, SLOT(selectTrackBelow())); @@ -414,9 +414,9 @@ Arranger::Arranger(ArrangerView* parent, const char* name) connect(list, SIGNAL(redirectWheelEvent(QWheelEvent*)), canvas, SLOT(redirectedWheelEvent(QWheelEvent*))); //egrid->addMultiCellWidget(time, 0, 0, 0, 1); - //egrid->addMultiCellWidget(MusEUtil::hLine(editor), 1, 1, 0, 1); + //egrid->addMultiCellWidget(MusECore::hLine(editor), 1, 1, 0, 1); egrid->addWidget(time, 0, 0, 1, 2); - egrid->addWidget(MusEUtil::hLine(editor), 1, 0, 1, 2); + egrid->addWidget(MusECore::hLine(editor), 1, 0, 1, 2); egrid->addWidget(canvas, 2, 0); egrid->addWidget(vscroll, 2, 1); @@ -435,19 +435,19 @@ Arranger::Arranger(ArrangerView* parent, const char* name) connect(time, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned))); connect(canvas, SIGNAL(tracklistChanged()), list, SLOT(tracklistChanged())); - connect(canvas, SIGNAL(dclickPart(Track*)), SIGNAL(editPart(Track*))); - connect(canvas, SIGNAL(startEditor(PartList*,int)), SIGNAL(startEditor(PartList*, int))); + connect(canvas, SIGNAL(dclickPart(MusECore::Track*)), SIGNAL(editPart(MusECore::Track*))); + connect(canvas, SIGNAL(startEditor(MusECore::PartList*,int)), SIGNAL(startEditor(MusECore::PartList*, int))); - connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); - //connect(song, SIGNAL(mTypeChanged(MType)), SLOT(setMode((int)MType))); // p4.0.7 Tim. + connect(MusEGlobal::song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); + //connect(MusEGlobal::song, SIGNAL(mTypeChanged(MType)), SLOT(setMode((int)MType))); // p4.0.7 Tim. connect(canvas, SIGNAL(followEvent(int)), hscroll, SLOT(setOffset(int))); connect(canvas, SIGNAL(selectionChanged()), SIGNAL(selectionChanged())); connect(canvas, SIGNAL(dropSongFile(const QString&)), SIGNAL(dropSongFile(const QString&))); connect(canvas, SIGNAL(dropMidiFile(const QString&)), SIGNAL(dropMidiFile(const QString&))); connect(canvas, SIGNAL(toolChanged(int)), SIGNAL(toolChanged(int))); - connect(song, SIGNAL(controllerChanged(Track*)), SLOT(controllerChanged(Track*))); -// connect(song, SIGNAL(posChanged(int, unsigned, bool)), SLOT(seek())); + connect(MusEGlobal::song, SIGNAL(controllerChanged(MusECore::Track*)), SLOT(controllerChanged(MusECore::Track*))); +// connect(MusEGlobal::song, SIGNAL(posChanged(int, unsigned, bool)), SLOT(seek())); // Removed p3.3.43 // Song::addMarker() already emits a 'markerChanged'. @@ -473,7 +473,7 @@ Arranger::Arranger(ArrangerView* parent, const char* name) //void Arranger::updateHScrollRange() //{ -// int s = 0, e = song->len(); +// int s = 0, e = MusEGlobal::song->len(); // Show one more measure. // e += AL::sigmap.ticksMeasure(e); // Show another quarter measure due to imprecise drawing at canvas end point. @@ -524,7 +524,7 @@ void Arranger::setTool(int t) // dclickPart //--------------------------------------------------------- -void Arranger::dclickPart(Track* t) +void Arranger::dclickPart(MusECore::Track* t) { emit editPart(t); } @@ -537,17 +537,17 @@ void Arranger::configChanged() { //printf("Arranger::configChanged\n"); - if (MusEConfig::config.canvasBgPixmap.isEmpty()) { - canvas->setBg(MusEConfig::config.partCanvasBg); + if (MusEGlobal::config.canvasBgPixmap.isEmpty()) { + canvas->setBg(MusEGlobal::config.partCanvasBg); canvas->setBg(QPixmap()); //printf("Arranger::configChanged - no bitmap!\n"); } else { - //printf("Arranger::configChanged - bitmap %s!\n", MusEConfig::config.canvasBgPixmap.ascii()); - canvas->setBg(QPixmap(MusEConfig::config.canvasBgPixmap)); + //printf("Arranger::configChanged - bitmap %s!\n", MusEGlobal::config.canvasBgPixmap.ascii()); + canvas->setBg(QPixmap(MusEGlobal::config.canvasBgPixmap)); } - ///midiTrackInfo->setFont(MusEConfig::config.fonts[2]); + ///midiTrackInfo->setFont(MusEGlobal::config.fonts[2]); //updateTrackInfo(type); } @@ -558,7 +558,7 @@ void Arranger::configChanged() void Arranger::songlenChanged(int n) { int newLen = AL::sigmap.bar2tick(n, 0, 0); - song->setLen(newLen); + MusEGlobal::song->setLen(newLen); } //--------------------------------------------------------- // songChanged @@ -569,7 +569,7 @@ void Arranger::songChanged(int type) // Is it simply a midi controller value adjustment? Forget it. if(type != SC_MIDI_CONTROLLER) { - unsigned endTick = song->len(); + unsigned endTick = MusEGlobal::song->len(); int offset = AL::sigmap.ticksMeasure(endTick); hscroll->setRange(-offset, endTick + offset); //DEBUG canvas->setOrigin(-offset, 0); @@ -585,27 +585,27 @@ void Arranger::songChanged(int type) lenEntry->blockSignals(false); if(type & SC_SONG_TYPE) // p4.0.7 Tim. - setMode(song->mtype()); + setMode(MusEGlobal::song->mtype()); trackSelectionChanged(); canvas->partsChanged(); - typeBox->setCurrentIndex(int(song->mtype())); + typeBox->setCurrentIndex(int(MusEGlobal::song->mtype())); if (type & SC_SIG) time->redraw(); if (type & SC_TEMPO) - setGlobalTempo(tempomap.globalTempo()); + setGlobalTempo(MusEGlobal::tempomap.globalTempo()); if(type & SC_TRACK_REMOVED) { - MusEMixer::AudioStrip* w = (MusEMixer::AudioStrip*)(trackInfo->getWidget(2)); + AudioStrip* w = (AudioStrip*)(trackInfo->getWidget(2)); //AudioStrip* w = (AudioStrip*)(trackInfo->widget(2)); if(w) { - Track* t = w->getTrack(); + MusECore::Track* t = w->getTrack(); if(t) { - TrackList* tl = song->tracks(); - iTrack it = tl->find(t); + MusECore::TrackList* tl = MusEGlobal::song->tracks(); + MusECore::iTrack it = tl->find(t); if(it == tl->end()) { delete w; @@ -627,9 +627,9 @@ void Arranger::songChanged(int type) void Arranger::trackSelectionChanged() { - TrackList* tracks = song->tracks(); - Track* track = 0; - for (iTrack t = tracks->begin(); t != tracks->end(); ++t) { + MusECore::TrackList* tracks = MusEGlobal::song->tracks(); + MusECore::Track* track = 0; + for (MusECore::iTrack t = tracks->begin(); t != tracks->end(); ++t) { if ((*t)->selected()) { track = *t; break; @@ -647,7 +647,7 @@ void Arranger::trackSelectionChanged() void Arranger::modeChange(int mode) { - song->setMType(MType(mode)); + MusEGlobal::song->setMType(MType(mode)); updateTrackInfo(-1); } @@ -667,7 +667,7 @@ void Arranger::setMode(int mode) // writeStatus //--------------------------------------------------------- -void Arranger::writeStatus(int level, Xml& xml) +void Arranger::writeStatus(int level, MusECore::Xml& xml) { xml.tag(level++, "arranger"); xml.intTag(level, "info", ib->isChecked()); @@ -684,16 +684,16 @@ void Arranger::writeStatus(int level, Xml& xml) // readStatus //--------------------------------------------------------- -void Arranger::readStatus(Xml& xml) +void Arranger::readStatus(MusECore::Xml& xml) { for (;;) { - Xml::Token token(xml.parse()); + MusECore::Xml::Token token(xml.parse()); const QString& tag(xml.s1()); switch (token) { - case Xml::Error: - case Xml::End: + case MusECore::Xml::Error: + case MusECore::Xml::End: return; - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "info") showTrackinfoFlag = xml.parseInt(); else if (tag == split->objectName()) @@ -711,7 +711,7 @@ void Arranger::readStatus(Xml& xml) else xml.unknown("Arranger"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "arranger") { ib->setChecked(showTrackinfoFlag); return; @@ -733,7 +733,7 @@ void Arranger::_setRaster(int index) }; _raster = rasterTable[index]; // Set the audio record part snapping. - song->setArrangerRaster(_raster); + MusEGlobal::song->setArrangerRaster(_raster); canvas->redraw(); } @@ -795,7 +795,7 @@ void Arranger::cmd(int cmd) void Arranger::globalPitchChanged(int val) { - song->setGlobalPitchShift(val); + MusEGlobal::song->setGlobalPitchShift(val); } //--------------------------------------------------------- @@ -804,8 +804,8 @@ void Arranger::globalPitchChanged(int val) void Arranger::globalTempoChanged(int val) { - audio->msgSetGlobalTempo(val); - song->tempoChanged(); + MusEGlobal::audio->msgSetGlobalTempo(val); + MusEGlobal::song->tempoChanged(); } //--------------------------------------------------------- @@ -956,7 +956,7 @@ QSize WidgetStack::minimumSizeHint() const void Arranger::clear() { - MusEMixer::AudioStrip* w = (MusEMixer::AudioStrip*)(trackInfo->getWidget(2)); + AudioStrip* w = (AudioStrip*)(trackInfo->getWidget(2)); if (w) delete w; trackInfo->addWidget(0, 2); @@ -969,7 +969,7 @@ void Arranger::wheelEvent(QWheelEvent* ev) emit redirectWheelEvent(ev); } -void Arranger::controllerChanged(Track *t) +void Arranger::controllerChanged(MusECore::Track *t) { canvas->controllerChanged(t); } @@ -1010,7 +1010,7 @@ void Arranger::genTrackInfo(QWidget* parent) noTrackInfo->setGeometry(0, 0, 65, 200); noTrackInfo->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding)); - midiTrackInfo = new MusEWidget::MidiTrackInfo(trackInfo); + midiTrackInfo = new MidiTrackInfo(trackInfo); //midiTrackInfo->setFocusPolicy(Qt::TabFocus); // p4.0.9 //midiTrackInfo->setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum)); trackInfo->addWidget(noTrackInfo, 0); @@ -1056,13 +1056,13 @@ void Arranger::updateTrackInfo(int flags) void Arranger::switchInfo(int n) { if (n == 2) { - MusEMixer::AudioStrip* w = (MusEMixer::AudioStrip*)(trackInfo->getWidget(2)); + AudioStrip* w = (AudioStrip*)(trackInfo->getWidget(2)); if (w == 0 || selected != w->getTrack()) { if (w) delete w; - w = new MusEMixer::AudioStrip(trackInfo, (AudioTrack*)selected); + w = new AudioStrip(trackInfo, (MusECore::AudioTrack*)selected); //w->setFocusPolicy(Qt::TabFocus); // p4.0.9 - connect(song, SIGNAL(songChanged(int)), w, SLOT(songChanged(int))); + connect(MusEGlobal::song, SIGNAL(songChanged(int)), w, SLOT(songChanged(int))); connect(MusEGlobal::muse, SIGNAL(configChanged()), w, SLOT(configChanged())); w->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); trackInfo->addWidget(w, 2); @@ -1118,11 +1118,11 @@ void Arranger::keyPressEvent(QKeyEvent* event) void Arranger::horizontalZoomIn() { int mag = hscroll->mag(); - int zoomlvl = MusEWidget::ScrollScale::getQuickZoomLevel(mag); + int zoomlvl = ScrollScale::getQuickZoomLevel(mag); if (zoomlvl < 23) zoomlvl++; - int newmag = MusEWidget::ScrollScale::convertQuickZoomLevelToMag(zoomlvl); + int newmag = ScrollScale::convertQuickZoomLevelToMag(zoomlvl); hscroll->setMag(newmag); @@ -1131,14 +1131,14 @@ void Arranger::horizontalZoomIn() void Arranger::horizontalZoomOut() { int mag = hscroll->mag(); - int zoomlvl = MusEWidget::ScrollScale::getQuickZoomLevel(mag); + int zoomlvl = ScrollScale::getQuickZoomLevel(mag); if (zoomlvl > 1) zoomlvl--; - int newmag = MusEWidget::ScrollScale::convertQuickZoomLevelToMag(zoomlvl); + int newmag = ScrollScale::convertQuickZoomLevelToMag(zoomlvl); hscroll->setMag(newmag); } -} // namespace MusEArranger +} // namespace MusEGui diff --git a/muse2/muse/arranger/arranger.h b/muse2/muse/arranger/arranger.h index f65c69a6..d4193c01 100644 --- a/muse2/muse/arranger/arranger.h +++ b/muse2/muse/arranger/arranger.h @@ -39,29 +39,25 @@ class QWheelEvent; class QKeyEvent; //class QStackedWidget; +namespace MusECore { class Track; class Xml; -class WidgetStack; - -namespace MusEMixer { -class AudioStrip; } -namespace MusEWidget { +namespace MusEGui { +class ArrangerView; +class AudioStrip; class Header; class LabelCombo; -class MidiTrackInfo; class MTScale; +class MidiTrackInfo; class PosLabel; class ScrollScale; -class Splitter; class SpinBox; -} - -namespace MusEArranger { -class ArrangerView; -class TList; +class Splitter; class TLLayout; +class TList; +class WidgetStack; //--------------------------------------------------------- // WidgetStack @@ -93,33 +89,33 @@ class Arranger : public QWidget { int _quant, _raster; PartCanvas* canvas; - MusEWidget::ScrollScale* hscroll; + ScrollScale* hscroll; QScrollBar* vscroll; TList* list; - MusEWidget::Header* header; - MusEWidget::MTScale* time; - MusEWidget::SpinBox* lenEntry; + Header* header; + MTScale* time; + SpinBox* lenEntry; bool showTrackinfoFlag; WidgetStack* trackInfo; //QStackedWidget* trackInfo; QScrollBar* infoScroll; //MidiTrackInfoBase* midiTrackInfo; - MusEWidget::MidiTrackInfo* midiTrackInfo; - MusEMixer::AudioStrip* waveTrackInfo; + MidiTrackInfo* midiTrackInfo; + AudioStrip* waveTrackInfo; QWidget* noTrackInfo; TLLayout* tgrid; - Track* selected; + MusECore::Track* selected; - MusEWidget::LabelCombo* typeBox; + LabelCombo* typeBox; QToolButton* ib; int trackInfoType; - MusEWidget::Splitter* split; + Splitter* split; ///QMenu* pop; int songType; - MusEWidget::PosLabel* cursorPos; - MusEWidget::SpinBox* globalTempoSpinBox; - MusEWidget::SpinBox* globalPitchSpinBox; + PosLabel* cursorPos; + SpinBox* globalTempoSpinBox; + SpinBox* globalPitchSpinBox; unsigned cursVal; void genTrackInfo(QWidget* parent); @@ -151,11 +147,11 @@ class Arranger : public QWidget { signals: void redirectWheelEvent(QWheelEvent*); - void editPart(Track*); + void editPart(MusECore::Track*); void selectionChanged(); void dropSongFile(const QString&); void dropMidiFile(const QString&); - void startEditor(PartList*, int); + void startEditor(MusECore::PartList*, int); void toolChanged(int); //void addMarker(int); void setUsedTool(int); @@ -166,11 +162,11 @@ class Arranger : public QWidget { virtual void keyPressEvent(QKeyEvent* event); public slots: - void dclickPart(Track*); + void dclickPart(MusECore::Track*); void setTool(int); void updateTrackInfo(int flags); void configChanged(); - void controllerChanged(Track *t); + void controllerChanged(MusECore::Track *t); public: enum { CMD_CUT_PART, CMD_COPY_PART, CMD_COPY_PART_IN_RANGE, CMD_PASTE_PART, CMD_PASTE_CLONE_PART, @@ -182,10 +178,10 @@ class Arranger : public QWidget { void setMode(int); void reset(); - void writeStatus(int level, Xml&); - void readStatus(Xml&); + void writeStatus(int level, MusECore::Xml&); + void readStatus(MusECore::Xml&); - Track* curTrack() const { return selected; } + MusECore::Track* curTrack() const { return selected; } void cmd(int); bool isSingleSelection() { return canvas->isSingleSelection(); } int selectionSize() { return canvas->selectionSize(); } @@ -197,7 +193,7 @@ class Arranger : public QWidget { ArrangerView* parentWin; }; -} // namespace MusEArranger +} // namespace MusEGui #endif diff --git a/muse2/muse/arranger/arrangerview.cpp b/muse2/muse/arranger/arrangerview.cpp index d828feeb..a565da13 100644 --- a/muse2/muse/arranger/arrangerview.cpp +++ b/muse2/muse/arranger/arrangerview.cpp @@ -68,7 +68,7 @@ #include "visibletracks.h" #include "xml.h" -namespace MusEArranger { +namespace MusEGui { //--------------------------------------------------------- // ArrangerView @@ -110,21 +110,21 @@ ArrangerView::ArrangerView(QWidget* parent) transport_toolbar->setObjectName("transport"); transport_toolbar->addActions(MusEGlobal::transportAction->actions()); - editTools = new MusEWidget::EditToolBar(this, MusEWidget::arrangerTools); + editTools = new EditToolBar(this, arrangerTools); addToolBar(editTools); editTools->setObjectName("arrangerTools"); - visTracks = new MusEWidget::VisibleTracks(this); + visTracks = new VisibleTracks(this); addToolBar(visTracks); connect(editTools, SIGNAL(toolChanged(int)), arranger, SLOT(setTool(int))); - connect(visTracks, SIGNAL(visibilityChanged()), song, SLOT(update()) ); - connect(arranger, SIGNAL(editPart(Track*)), muse, SLOT(startEditor(Track*))); + connect(visTracks, SIGNAL(visibilityChanged()), MusEGlobal::song, SLOT(update()) ); + connect(arranger, SIGNAL(editPart(MusECore::Track*)), muse, SLOT(startEditor(MusECore::Track*))); connect(arranger, SIGNAL(dropSongFile(const QString&)), muse, SLOT(loadProjectFile(const QString&))); connect(arranger, SIGNAL(dropMidiFile(const QString&)), muse, SLOT(importMidi(const QString&))); - connect(arranger, SIGNAL(startEditor(PartList*,int)), muse, SLOT(startEditor(PartList*,int))); + connect(arranger, SIGNAL(startEditor(MusECore::PartList*,int)), muse, SLOT(startEditor(MusECore::PartList*,int))); connect(arranger, SIGNAL(toolChanged(int)), editTools, SLOT(set(int))); connect(muse, SIGNAL(configChanged()), arranger, SLOT(configChanged())); connect(arranger, SIGNAL(setUsedTool(int)), editTools, SLOT(set(int))); @@ -375,7 +375,7 @@ void ArrangerView::closeEvent(QCloseEvent* e) -void ArrangerView::writeStatus(int level, Xml& xml) const +void ArrangerView::writeStatus(int level, MusECore::Xml& xml) const { xml.tag(level++, "arrangerview"); TopWin::writeStatus(level, xml); @@ -384,18 +384,18 @@ void ArrangerView::writeStatus(int level, Xml& xml) const xml.tag(level, "/arrangerview"); } -void ArrangerView::readStatus(Xml& xml) +void ArrangerView::readStatus(MusECore::Xml& xml) { for (;;) { - Xml::Token token = xml.parse(); - if (token == Xml::Error || token == Xml::End) + MusECore::Xml::Token token = xml.parse(); + if (token == MusECore::Xml::Error || token == MusECore::Xml::End) break; const QString& tag = xml.s1(); switch (token) { - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "tool") editTools->set(xml.parseInt()); else if (tag == "topwin") @@ -406,7 +406,7 @@ void ArrangerView::readStatus(Xml& xml) xml.unknown("ArrangerView"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "arrangerview") return; @@ -420,22 +420,22 @@ void ArrangerView::readStatus(Xml& xml) // readConfiguration //--------------------------------------------------------- -void ArrangerView::readConfiguration(Xml& xml) +void ArrangerView::readConfiguration(MusECore::Xml& xml) { for (;;) { - Xml::Token token = xml.parse(); + MusECore::Xml::Token token = xml.parse(); const QString& tag = xml.s1(); switch (token) { - case Xml::Error: - case Xml::End: + case MusECore::Xml::Error: + case MusECore::Xml::End: return; - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "topwin") TopWin::readConfiguration(ARRANGER, xml); else xml.unknown("ArrangerView"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "arrangerview") return; default: @@ -448,7 +448,7 @@ void ArrangerView::readConfiguration(Xml& xml) // writeConfiguration //--------------------------------------------------------- -void ArrangerView::writeConfiguration(int level, Xml& xml) +void ArrangerView::writeConfiguration(int level, MusECore::Xml& xml) { xml.tag(level++, "arrangerview"); TopWin::writeConfiguration(ARRANGER, level, xml); @@ -458,9 +458,9 @@ void ArrangerView::writeConfiguration(int level, Xml& xml) void ArrangerView::cmd(int cmd) { - TrackList* tracks = song->tracks(); - int l = song->lpos(); - int r = song->rpos(); + MusECore::TrackList* tracks = MusEGlobal::song->tracks(); + int l = MusEGlobal::song->lpos(); + int r = MusEGlobal::song->rpos(); switch(cmd) { case CMD_CUT: @@ -488,19 +488,19 @@ void ArrangerView::cmd(int cmd) arranger->cmd(Arranger::CMD_INSERT_EMPTYMEAS); break; case CMD_DELETE: - if (!song->msgRemoveParts()) //automatically does undo if neccessary and returns true then + if (!MusEGlobal::song->msgRemoveParts()) //automatically does undo if neccessary and returns true then { //msgRemoveParts() returned false -> no parts to remove? - song->startUndo(); - audio->msgRemoveTracks(); //TODO FINDME this could still be speeded up! - song->endUndo(SC_TRACK_REMOVED); + MusEGlobal::song->startUndo(); + MusEGlobal::audio->msgRemoveTracks(); //TODO FINDME this could still be speeded up! + MusEGlobal::song->endUndo(SC_TRACK_REMOVED); } break; case CMD_DELETE_TRACK: - song->startUndo(); - audio->msgRemoveTracks(); - song->endUndo(SC_TRACK_REMOVED); - audio->msgUpdateSoloStates(); + MusEGlobal::song->startUndo(); + MusEGlobal::audio->msgRemoveTracks(); + MusEGlobal::song->endUndo(SC_TRACK_REMOVED); + MusEGlobal::audio->msgUpdateSoloStates(); break; case CMD_SELECT_ALL: @@ -508,9 +508,9 @@ void ArrangerView::cmd(int cmd) case CMD_SELECT_INVERT: case CMD_SELECT_ILOOP: case CMD_SELECT_OLOOP: - for (iTrack i = tracks->begin(); i != tracks->end(); ++i) { - PartList* parts = (*i)->parts(); - for (iPart p = parts->begin(); p != parts->end(); ++p) { + for (MusECore::iTrack i = tracks->begin(); i != tracks->end(); ++i) { + MusECore::PartList* parts = (*i)->parts(); + for (MusECore::iPart p = parts->begin(); p != parts->end(); ++p) { bool f = false; int t1 = p->second->tick(); int t2 = t1 + p->second->lenTick(); @@ -538,34 +538,34 @@ void ArrangerView::cmd(int cmd) p->second->setSelected(f); } } - song->update(); + MusEGlobal::song->update(); break; case CMD_SELECT_PARTS: - for (iTrack i = tracks->begin(); i != tracks->end(); ++i) { + for (MusECore::iTrack i = tracks->begin(); i != tracks->end(); ++i) { if (!(*i)->selected()) continue; - PartList* parts = (*i)->parts(); - for (iPart p = parts->begin(); p != parts->end(); ++p) + MusECore::PartList* parts = (*i)->parts(); + for (MusECore::iPart p = parts->begin(); p != parts->end(); ++p) p->second->setSelected(true); } - song->update(); + MusEGlobal::song->update(); break; - case CMD_SHRINK_PART: shrink_parts(); break; - case CMD_EXPAND_PART: expand_parts(); break; - case CMD_CLEAN_PART: clean_parts(); break; - - case CMD_QUANTIZE: quantize_notes(); break; - case CMD_VELOCITY: modify_velocity(); break; - case CMD_CRESCENDO: crescendo(); break; - case CMD_NOTELEN: modify_notelen(); break; - case CMD_TRANSPOSE: transpose_notes(); break; - case CMD_ERASE: erase_notes(); break; - case CMD_MOVE: move_notes(); break; - case CMD_FIXED_LEN: set_notelen(); break; - case CMD_DELETE_OVERLAPS: delete_overlaps(); break; - case CMD_LEGATO: legato(); break; + case CMD_SHRINK_PART: MusECore::shrink_parts(); break; + case CMD_EXPAND_PART: MusECore::expand_parts(); break; + case CMD_CLEAN_PART: MusECore::clean_parts(); break; + + case CMD_QUANTIZE: MusECore::quantize_notes(); break; + case CMD_VELOCITY: MusECore::modify_velocity(); break; + case CMD_CRESCENDO: MusECore::crescendo(); break; + case CMD_NOTELEN: MusECore::modify_notelen(); break; + case CMD_TRANSPOSE: MusECore::transpose_notes(); break; + case CMD_ERASE: MusECore::erase_notes(); break; + case CMD_MOVE: MusECore::move_notes(); break; + case CMD_FIXED_LEN: MusECore::set_notelen(); break; + case CMD_DELETE_OVERLAPS: MusECore::delete_overlaps(); break; + case CMD_LEGATO: MusECore::legato(); break; } } @@ -629,7 +629,7 @@ void ArrangerView::clearScoreMenuMappers() void ArrangerView::populateAddTrack() { - QActionGroup *grp = MusEUtil::populateAddTrack(addTrack); + QActionGroup *grp = MusEGui::populateAddTrack(addTrack); connect(addTrack, SIGNAL(triggered(QAction *)), SLOT(addNewTrack(QAction *))); trackMidiAction = grp->actions()[0]; @@ -644,8 +644,8 @@ void ArrangerView::populateAddTrack() void ArrangerView::addNewTrack(QAction* action) { - song->addNewTrack(action, MusEGlobal::muse->arranger()->curTrack()); // Insert at current selected track. - //song->addNewTrack(action); // Add at end. + MusEGlobal::song->addNewTrack(action, MusEGlobal::muse->arranger()->curTrack()); // Insert at current selected track. + //MusEGlobal::song->addNewTrack(action); // Add at end. } void ArrangerView::updateShortcuts() @@ -727,8 +727,8 @@ void ArrangerView::updateVisibleTracksButtons() visTracks->updateVisibleTracksButtons(); } -void ArrangerView::globalCut() { ::globalCut(); } -void ArrangerView::globalInsert() { ::globalInsert(); } -void ArrangerView::globalSplit() { ::globalSplit(); } +void ArrangerView::globalCut() { MusECore::globalCut(); } +void ArrangerView::globalInsert() { MusECore::globalInsert(); } +void ArrangerView::globalSplit() { MusECore::globalSplit(); } -} // namespace MusEArranger +} // namespace MusEGui diff --git a/muse2/muse/arranger/arrangerview.h b/muse2/muse/arranger/arrangerview.h index 7c273ad8..d52c5cc4 100644 --- a/muse2/muse/arranger/arrangerview.h +++ b/muse2/muse/arranger/arrangerview.h @@ -53,9 +53,10 @@ #include "helper.h" #include "arranger.h" -namespace MusEWidget { class VisibleTracks; } -namespace MusEArranger { +namespace MusEGui { + +class VisibleTracks; class ArrangerView : public TopWin { @@ -77,8 +78,8 @@ class ArrangerView : public TopWin QGridLayout* mainGrid; QWidget* mainw; - MusEWidget::EditToolBar* editTools; - MusEWidget::VisibleTracks* visTracks; + EditToolBar* editTools; + VisibleTracks* visTracks; Arranger* arranger; @@ -122,7 +123,7 @@ class ArrangerView : public TopWin void addNewTrack(QAction* action); signals: - void deleted(TopWin*); + void deleted(MusEGui::TopWin*); void closed(); public slots: @@ -144,13 +145,13 @@ class ArrangerView : public TopWin Arranger* getArranger() {return arranger;} - void writeStatus(int level, Xml& xml) const; - void readStatus(Xml& xml); - static void readConfiguration(Xml&); - static void writeConfiguration(int, Xml&); + void writeStatus(int level, MusECore::Xml& xml) const; + void readStatus(MusECore::Xml& xml); + static void readConfiguration(MusECore::Xml&); + static void writeConfiguration(int, MusECore::Xml&); }; -} // namespace MusEArranger +} // namespace MusEGui #endif diff --git a/muse2/muse/arranger/pcanvas.cpp b/muse2/muse/arranger/pcanvas.cpp index eaeec291..8226c440 100644 --- a/muse2/muse/arranger/pcanvas.cpp +++ b/muse2/muse/arranger/pcanvas.cpp @@ -70,13 +70,13 @@ using std::set; -namespace MusEArranger { +namespace MusEGui { //--------------------------------------------------------- // NPart //--------------------------------------------------------- -NPart::NPart(Part* e) : MusEWidget::CItem(Event(), e) +NPart::NPart(MusECore::Part* e) : CItem(MusECore::Event(), e) { leftBorderTouches = false; rightBorderTouches = false; @@ -91,7 +91,7 @@ NPart::NPart(Part* e) : MusEWidget::CItem(Event(), e) //--------------------------------------------------------- PartCanvas::PartCanvas(int* r, QWidget* parent, int sx, int sy) - : MusEWidget::Canvas(parent, sx, sy) + : Canvas(parent, sx, sy) { setAcceptDrops(true); _raster = r; @@ -101,7 +101,7 @@ PartCanvas::PartCanvas(int* r, QWidget* parent, int sx, int sy) lineEditor = 0; editMode = false; - tracks = song->tracks(); + tracks = MusEGlobal::song->tracks(); setMouseTracking(true); drag = DRAG_OFF; curColorIndex = 0; @@ -123,10 +123,10 @@ PartCanvas::~PartCanvas() int PartCanvas::y2pitch(int y) const { - TrackList* tl = song->tracks(); + MusECore::TrackList* tl = MusEGlobal::song->tracks(); int yy = 0; int idx = 0; - for (iTrack it = tl->begin(); it != tl->end(); ++it, ++idx) { + for (MusECore::iTrack it = tl->begin(); it != tl->end(); ++it, ++idx) { int h = (*it)->height(); // if ((y >= yy) && (y < yy+h)) if (y < yy+h) @@ -142,10 +142,10 @@ int PartCanvas::y2pitch(int y) const int PartCanvas::pitch2y(int p) const { - TrackList* tl = song->tracks(); + MusECore::TrackList* tl = MusEGlobal::song->tracks(); int yy = 0; int idx = 0; - for (iTrack it = tl->begin(); it != tl->end(); ++it, ++idx) { + for (MusECore::iTrack it = tl->begin(); it != tl->end(); ++it, ++idx) { if (idx == p) break; yy += (*it)->height(); @@ -172,13 +172,13 @@ void PartCanvas::returnPressed() if (editMode) { //this check is neccessary, because it returnPressed may be called //twice. the second call would cause a crash, however! - Part* oldPart = editPart->part(); - Part* newPart = oldPart->clone(); + MusECore::Part* oldPart = editPart->part(); + MusECore::Part* newPart = oldPart->clone(); //printf("PartCanvas::returnPressed before msgChangePart oldPart refs:%d Arefs:%d newPart refs:%d Arefs:%d\n", oldPart->events()->refCount(), oldPart->events()->arefCount(), newPart->events()->refCount(), newPart->events()->arefCount()); newPart->setName(lineEditor->text()); // Indicate do undo, and do port controller values but not clone parts. - audio->msgChangePart(oldPart, newPart, true, true, false); + MusEGlobal::audio->msgChangePart(oldPart, newPart, true, true, false); editMode = false; } @@ -190,7 +190,7 @@ void PartCanvas::returnPressed() void PartCanvas::viewMouseDoubleClickEvent(QMouseEvent* event) { - if (_tool != MusEWidget::PointerTool) { + if (_tool != PointerTool) { viewMousePressEvent(event); return; } @@ -223,8 +223,8 @@ void PartCanvas::viewMouseDoubleClickEvent(QMouseEvent* event) // right mark else { - TrackList* tl = song->tracks(); - iTrack it; + MusECore::TrackList* tl = MusEGlobal::song->tracks(); + MusECore::iTrack it; int yy = 0; int y = event->y(); for (it = tl->begin(); it != tl->end(); ++it) { @@ -234,13 +234,13 @@ void PartCanvas::viewMouseDoubleClickEvent(QMouseEvent* event) yy += h; } if (pos[2] - pos[1] > 0 && it != tl->end()) { - Track* track = *it; + MusECore::Track* track = *it; switch(track->type()) { - case Track::MIDI: - case Track::DRUM: - case Track::NEW_DRUM: + case MusECore::Track::MIDI: + case MusECore::Track::DRUM: + case MusECore::Track::NEW_DRUM: { - MidiPart* part = new MidiPart((MidiTrack*)track); + MusECore::MidiPart* part = new MusECore::MidiPart((MusECore::MidiTrack*)track); part->setTick(pos[1]); part->setLenTick(pos[2]-pos[1]); part->setName(track->name()); @@ -248,15 +248,15 @@ void PartCanvas::viewMouseDoubleClickEvent(QMouseEvent* event) items.add(np); deselectAll(); part->setSelected(true); - audio->msgAddPart(part); + MusEGlobal::audio->msgAddPart(part); } break; - case Track::WAVE: - case Track::AUDIO_OUTPUT: - case Track::AUDIO_INPUT: - case Track::AUDIO_GROUP: - case Track::AUDIO_AUX: - case Track::AUDIO_SOFTSYNTH: + case MusECore::Track::WAVE: + case MusECore::Track::AUDIO_OUTPUT: + case MusECore::Track::AUDIO_INPUT: + case MusECore::Track::AUDIO_GROUP: + case MusECore::Track::AUDIO_AUX: + case MusECore::Track::AUDIO_SOFTSYNTH: break; } } @@ -269,7 +269,7 @@ void PartCanvas::viewMouseDoubleClickEvent(QMouseEvent* event) void PartCanvas::updateSong(DragType t, int flags) { - song->update(flags | ((t == MOVE_COPY || t == MOVE_CLONE) + MusEGlobal::song->update(flags | ((t == MOVE_COPY || t == MOVE_CLONE) ? SC_PART_INSERTED : SC_PART_MODIFIED)); } @@ -277,16 +277,16 @@ void PartCanvas::updateSong(DragType t, int flags) // moveCanvasItems //--------------------------------------------------------- -void PartCanvas::moveCanvasItems(MusEWidget::CItemList& items, int dp, int dx, DragType dtype) +void PartCanvas::moveCanvasItems(CItemList& items, int dp, int dx, DragType dtype) { - Undo operations; + MusECore::Undo operations; - for(MusEWidget::iCItem ici = items.begin(); ici != items.end(); ++ici) + for(iCItem ici = items.begin(); ici != items.end(); ++ici) { - MusEWidget::CItem* ci = ici->second; + CItem* ci = ici->second; // If this item's part is in the parts2change list, change the item's part to the new part. - //Part* pt = ci->part(); + //MusECore::Part* pt = ci->part(); //iP2C ip2c = parts2change.find(pt); //if(ip2c != parts2change.end()) // ci->setPart(ip2c->second); @@ -298,8 +298,8 @@ void PartCanvas::moveCanvasItems(MusEWidget::CItemList& items, int dp, int dx, D QPoint newpos = raster(QPoint(nx, ny)); selectItem(ci, true); - UndoOp operation=moveItem(ci, newpos, dtype); - if (operation.type != UndoOp::DoNothing) + MusECore::UndoOp operation=moveItem(ci, newpos, dtype); + if (operation.type != MusECore::UndoOp::DoNothing) { ci->move(newpos); operations.push_back(operation); @@ -312,7 +312,7 @@ void PartCanvas::moveCanvasItems(MusEWidget::CItemList& items, int dp, int dx, D selectItem(ci, false); } - song->applyOperationGroup(operations); + MusEGlobal::song->applyOperationGroup(operations); partsChanged(); } @@ -322,38 +322,38 @@ void PartCanvas::moveCanvasItems(MusEWidget::CItemList& items, int dp, int dx, D //--------------------------------------------------------- // Changed by T356. -UndoOp PartCanvas::moveItem(MusEWidget::CItem* item, const QPoint& newpos, DragType t) +MusECore::UndoOp PartCanvas::moveItem(CItem* item, const QPoint& newpos, DragType t) { - UndoOp result; + MusECore::UndoOp result; NPart* npart = (NPart*) item; - Part* spart = npart->part(); - Track* track = npart->track(); + MusECore::Part* spart = npart->part(); + MusECore::Track* track = npart->track(); unsigned dtick = newpos.x(); unsigned ntrack = y2pitch(item->mp().y()); - Track::TrackType type = track->type(); + MusECore::Track::TrackType type = track->type(); if (tracks->index(track) == ntrack && (dtick == spart->tick())) { - return UndoOp(UndoOp::DoNothing); + return MusECore::UndoOp(MusECore::UndoOp::DoNothing); } if (ntrack >= tracks->size()) { ntrack = tracks->size(); if (MusEGlobal::debugMsg) printf("PartCanvas::moveItem - add new track\n"); - Track* newTrack = song->addTrack(type); // Add at end of list. - if (type == Track::WAVE) { - WaveTrack* st = (WaveTrack*) track; - WaveTrack* dt = (WaveTrack*) newTrack; + MusECore::Track* newTrack = MusEGlobal::song->addTrack(type); // Add at end of list. + if (type == MusECore::Track::WAVE) { + MusECore::WaveTrack* st = (MusECore::WaveTrack*) track; + MusECore::WaveTrack* dt = (MusECore::WaveTrack*) newTrack; dt->setChannels(st->channels()); } emit tracklistChanged(); } - Track* dtrack = tracks->index(ntrack); + MusECore::Track* dtrack = tracks->index(ntrack); if (dtrack->type() != type) { QMessageBox::critical(this, QString("MusE"), tr("Cannot copy/move/clone to different Track-Type")); - return UndoOp(UndoOp::DoNothing); + return MusECore::UndoOp(MusECore::UndoOp::DoNothing); } - Part* dpart; + MusECore::Part* dpart; bool clone = (t == MOVE_CLONE || (t == MOVE_COPY && spart->events()->arefCount() > 1)); if(t == MOVE_MOVE) @@ -374,17 +374,17 @@ UndoOp PartCanvas::moveItem(MusEWidget::CItem* item, const QPoint& newpos, DragT if(t == MOVE_MOVE) item->setPart(dpart); if (t == MOVE_COPY && !clone) { - dpart->events()->incARef(-1); // the later song->applyOperationGroup() will increment it + dpart->events()->incARef(-1); // the later MusEGlobal::song->applyOperationGroup() will increment it // so we must decrement it first :/ // // Copy Events // - EventList* se = spart->events(); - EventList* de = dpart->events(); - for (iEvent i = se->begin(); i != se->end(); ++i) { - Event oldEvent = i->second; - Event ev = oldEvent.clone(); + MusECore::EventList* se = spart->events(); + MusECore::EventList* de = dpart->events(); + for (MusECore::iEvent i = se->begin(); i != se->end(); ++i) { + MusECore::Event oldEvent = i->second; + MusECore::Event ev = oldEvent.clone(); de->add(ev); } } @@ -393,20 +393,20 @@ UndoOp PartCanvas::moveItem(MusEWidget::CItem* item, const QPoint& newpos, DragT if (t == MOVE_COPY || t == MOVE_CLONE) { // These will not increment ref count, and will not chain clones... // TODO FINDMICH: is this still correct (by flo93)? i doubt it! - result=UndoOp(UndoOp::AddPart,dpart); + result=MusECore::UndoOp(MusECore::UndoOp::AddPart,dpart); } else if (t == MOVE_MOVE) { dpart->setSelected(spart->selected()); // These will increment ref count if not a clone, and will chain clones... // TODO FINDMICH: is this still correct (by flo93)? i doubt it! - result=UndoOp(UndoOp::ModifyPart,spart, dpart, true, false); + result=MusECore::UndoOp(MusECore::UndoOp::ModifyPart,spart, dpart, true, false); spart->setSelected(false); } // else // will never happen -> result will always be defined - if (song->len() < (dpart->lenTick() + dpart->tick())) - song->setLen(dpart->lenTick() + dpart->tick()); + if (MusEGlobal::song->len() < (dpart->lenTick() + dpart->tick())) + MusEGlobal::song->setLen(dpart->lenTick() + dpart->tick()); return result; } @@ -435,10 +435,10 @@ void PartCanvas::partsChanged() { //items.clear(); items.clearDelete(); - for (iTrack t = tracks->begin(); t != tracks->end(); ++t) { - PartList* pl = (*t)->parts(); - for (iPart i = pl->begin(); i != pl->end(); ++i) { - Part* part = i->second; + for (MusECore::iTrack t = tracks->begin(); t != tracks->end(); ++t) { + MusECore::PartList* pl = (*t)->parts(); + for (MusECore::iPart i = pl->begin(); i != pl->end(); ++i) { + MusECore::Part* part = i->second; NPart* np = new NPart(part); items.add(np); if (i->second->selected()) { @@ -446,8 +446,8 @@ void PartCanvas::partsChanged() } // Check for touching borders. p4.0.29 - Part* pp; - for(ciPart ii = pl->begin(); ii != pl->end(); ++ii) + MusECore::Part* pp; + for(MusECore::ciPart ii = pl->begin(); ii != pl->end(); ++ii) { pp = ii->second; if(pp == part) // Ignore this part @@ -470,7 +470,7 @@ void PartCanvas::partsChanged() void PartCanvas::updateSelection() { - for (MusEWidget::iCItem i = items.begin(); i != items.end(); ++i) { + for (iCItem i = items.begin(); i != items.end(); ++i) { NPart* part = (NPart*)(i->second); part->part()->setSelected(i->second->isSelected()); } @@ -482,10 +482,10 @@ void PartCanvas::updateSelection() // resizeItem //--------------------------------------------------------- -void PartCanvas::resizeItem(MusEWidget::CItem* i, bool noSnap, bool ctrl) +void PartCanvas::resizeItem(CItem* i, bool noSnap, bool ctrl) { - Track* t = ((NPart*)(i))->track(); - Part* p = ((NPart*)(i))->part(); + MusECore::Track* t = ((NPart*)(i))->track(); + MusECore::Part* p = ((NPart*)(i))->part(); int pos = p->tick() + i->width(); int snappedpos = p->tick(); @@ -496,7 +496,7 @@ void PartCanvas::resizeItem(MusEWidget::CItem* i, bool noSnap, bool ctrl) if (newwidth == 0) newwidth = AL::sigmap.rasterStep(p->tick(), *_raster); - song->cmdResizePart(t, p, newwidth, !ctrl); + MusEGlobal::song->cmdResizePart(t, p, newwidth, !ctrl); } //--------------------------------------------------------- @@ -504,7 +504,7 @@ void PartCanvas::resizeItem(MusEWidget::CItem* i, bool noSnap, bool ctrl) // first create local Item //--------------------------------------------------------- -MusEWidget::CItem* PartCanvas::newItem(const QPoint& pos, int) +CItem* PartCanvas::newItem(const QPoint& pos, int) { int x = pos.x(); if (x < 0) @@ -513,30 +513,30 @@ MusEWidget::CItem* PartCanvas::newItem(const QPoint& pos, int) unsigned trackIndex = y2pitch(pos.y()); if (trackIndex >= tracks->size()) return 0; - Track* track = tracks->index(trackIndex); + MusECore::Track* track = tracks->index(trackIndex); if(!track) return 0; - Part* pa = 0; + MusECore::Part* pa = 0; NPart* np = 0; switch(track->type()) { - case Track::MIDI: - case Track::DRUM: - case Track::NEW_DRUM: - pa = new MidiPart((MidiTrack*)track); + case MusECore::Track::MIDI: + case MusECore::Track::DRUM: + case MusECore::Track::NEW_DRUM: + pa = new MusECore::MidiPart((MusECore::MidiTrack*)track); pa->setTick(x); pa->setLenTick(0); break; - case Track::WAVE: - pa = new WavePart((WaveTrack*)track); + case MusECore::Track::WAVE: + pa = new MusECore::WavePart((MusECore::WaveTrack*)track); pa->setTick(x); pa->setLenTick(0); break; - case Track::AUDIO_OUTPUT: - case Track::AUDIO_INPUT: - case Track::AUDIO_GROUP: - case Track::AUDIO_AUX: - case Track::AUDIO_SOFTSYNTH: + case MusECore::Track::AUDIO_OUTPUT: + case MusECore::Track::AUDIO_INPUT: + case MusECore::Track::AUDIO_GROUP: + case MusECore::Track::AUDIO_AUX: + case MusECore::Track::AUDIO_SOFTSYNTH: return 0; } pa->setName(track->name()); @@ -549,9 +549,9 @@ MusEWidget::CItem* PartCanvas::newItem(const QPoint& pos, int) // newItem //--------------------------------------------------------- -void PartCanvas::newItem(MusEWidget::CItem* i, bool noSnap) +void PartCanvas::newItem(CItem* i, bool noSnap) { - Part* p = ((NPart*)(i))->part(); + MusECore::Part* p = ((NPart*)(i))->part(); int len = i->width(); if (!noSnap) @@ -560,17 +560,17 @@ void PartCanvas::newItem(MusEWidget::CItem* i, bool noSnap) len = AL::sigmap.rasterStep(p->tick(), *_raster); p->setLenTick(len); p->setSelected(true); - audio->msgAddPart(p, true); //indicate undo + MusEGlobal::audio->msgAddPart(p, true); //indicate undo } //--------------------------------------------------------- // deleteItem //--------------------------------------------------------- -bool PartCanvas::deleteItem(MusEWidget::CItem* i) +bool PartCanvas::deleteItem(CItem* i) { - Part* p = ((NPart*)(i))->part(); - audio->msgRemovePart(p, true); //Invokes songChanged which calls partsChanged which makes it difficult to delete them there + MusECore::Part* p = ((NPart*)(i))->part(); + MusEGlobal::audio->msgRemovePart(p, true); //Invokes songChanged which calls partsChanged which makes it difficult to delete them there return true; } @@ -578,37 +578,37 @@ bool PartCanvas::deleteItem(MusEWidget::CItem* i) // splitItem //--------------------------------------------------------- -void PartCanvas::splitItem(MusEWidget::CItem* item, const QPoint& pt) +void PartCanvas::splitItem(CItem* item, const QPoint& pt) { NPart* np = (NPart*) item; - Track* t = np->track(); - Part* p = np->part(); + MusECore::Track* t = np->track(); + MusECore::Part* p = np->part(); int x = pt.x(); if (x < 0) x = 0; - song->cmdSplitPart(t, p, AL::sigmap.raster(x, *_raster)); + MusEGlobal::song->cmdSplitPart(t, p, AL::sigmap.raster(x, *_raster)); } //--------------------------------------------------------- // glueItem //--------------------------------------------------------- -void PartCanvas::glueItem(MusEWidget::CItem* item) +void PartCanvas::glueItem(CItem* item) { NPart* np = (NPart*) item; - Track* t = np->track(); - Part* p = np->part(); - song->cmdGluePart(t, p); + MusECore::Track* t = np->track(); + MusECore::Part* p = np->part(); + MusEGlobal::song->cmdGluePart(t, p); } //--------------------------------------------------------- // genItemPopup //--------------------------------------------------------- -QMenu* PartCanvas::genItemPopup(MusEWidget::CItem* item) +QMenu* PartCanvas::genItemPopup(CItem* item) { NPart* npart = (NPart*) item; - Track::TrackType trackType = npart->track()->type(); + MusECore::Track::TrackType trackType = npart->track()->type(); QMenu* partPopup = new QMenu(this); @@ -637,7 +637,7 @@ QMenu* PartCanvas::genItemPopup(MusEWidget::CItem* item) // part color selection for (int i = 0; i < NUM_PARTCOLORS; ++i) { - QAction *act_color = colorPopup->addAction(MusEUtil::colorRect(MusEConfig::config.partColors[i], 80, 80), MusEConfig::config.partColorNames[i]); + QAction *act_color = colorPopup->addAction(MusECore::colorRect(MusEGlobal::config.partColors[i], 80, 80), MusEGlobal::config.partColorNames[i]); act_color->setData(20+i); } @@ -652,7 +652,7 @@ QMenu* PartCanvas::genItemPopup(MusEWidget::CItem* item) partPopup->addSeparator(); switch(trackType) { - case Track::MIDI: { + case MusECore::Track::MIDI: { partPopup->addAction(MusEGlobal::muse->arranger()->parentWin->startPianoEditAction); partPopup->addMenu(MusEGlobal::muse->arranger()->parentWin->scoreSubmenu); partPopup->addAction(MusEGlobal::muse->arranger()->parentWin->startScoreEditAction); @@ -661,15 +661,15 @@ QMenu* PartCanvas::genItemPopup(MusEWidget::CItem* item) act_mexport->setData(16); } break; - case Track::NEW_DRUM: - case Track::DRUM: { + case MusECore::Track::NEW_DRUM: + case MusECore::Track::DRUM: { partPopup->addAction(MusEGlobal::muse->arranger()->parentWin->startDrumEditAction); partPopup->addAction(MusEGlobal::muse->arranger()->parentWin->startListEditAction); QAction *act_dexport = partPopup->addAction(tr("save part to disk")); act_dexport->setData(16); } break; - case Track::WAVE: { + case MusECore::Track::WAVE: { QAction *act_wedit = partPopup->addAction(QIcon(*edit_waveIcon), tr("wave edit")); act_wedit->setData(14); QAction *act_wexport = partPopup->addAction(tr("save part to disk")); @@ -678,11 +678,11 @@ QMenu* PartCanvas::genItemPopup(MusEWidget::CItem* item) act_wfinfo->setData(17); } break; - case Track::AUDIO_OUTPUT: - case Track::AUDIO_INPUT: - case Track::AUDIO_GROUP: - case Track::AUDIO_AUX: - case Track::AUDIO_SOFTSYNTH: + case MusECore::Track::AUDIO_OUTPUT: + case MusECore::Track::AUDIO_INPUT: + case MusECore::Track::AUDIO_GROUP: + case MusECore::Track::AUDIO_AUX: + case MusECore::Track::AUDIO_SOFTSYNTH: break; } @@ -698,9 +698,9 @@ QMenu* PartCanvas::genItemPopup(MusEWidget::CItem* item) // itemPopup //--------------------------------------------------------- -void PartCanvas::itemPopup(MusEWidget::CItem* item, int n, const QPoint& pt) +void PartCanvas::itemPopup(CItem* item, int n, const QPoint& pt) { - PartList* pl = new PartList; + MusECore::PartList* pl = new MusECore::PartList; NPart* npart = (NPart*)(item); pl->add(npart->part()); switch(n) { @@ -731,7 +731,7 @@ void PartCanvas::itemPopup(MusEWidget::CItem* item, int n, const QPoint& pt) break; case 4: copy(pl); - audio->msgRemovePart(npart->part()); + MusEGlobal::audio->msgRemovePart(npart->part()); break; case 5: copy(pl); @@ -742,31 +742,31 @@ void PartCanvas::itemPopup(MusEWidget::CItem* item, int n, const QPoint& pt) return; case 15: // declone { - Part* spart = npart->part(); - Track* track = npart->track(); - Part* dpart = track->newPart(spart, false); - - EventList* se = spart->events(); - EventList* de = dpart->events(); - for (iEvent i = se->begin(); i != se->end(); ++i) { - Event oldEvent = i->second; - Event ev = oldEvent.clone(); + MusECore::Part* spart = npart->part(); + MusECore::Track* track = npart->track(); + MusECore::Part* dpart = track->newPart(spart, false); + + MusECore::EventList* se = spart->events(); + MusECore::EventList* de = dpart->events(); + for (MusECore::iEvent i = se->begin(); i != se->end(); ++i) { + MusECore::Event oldEvent = i->second; + MusECore::Event ev = oldEvent.clone(); de->add(ev); } // Indicate undo, and do port controller values but not clone parts. // changed by flo93: removed start and endUndo, instead changed first bool to true - audio->msgChangePart(spart, dpart, true, true, false); + MusEGlobal::audio->msgChangePart(spart, dpart, true, true, false); break; // Has to be break here, right? } case 16: // Export to file { - const Part* part = item->part(); + const MusECore::Part* part = item->part(); bool popenFlag = false; QString fn = getSaveFileName(QString(""), MusEGlobal::part_file_save_pattern, this, tr("MusE: save part")); if (!fn.isEmpty()) { FILE* fp = fileOpen(this, fn, ".mpt", "w", popenFlag, false, false); if (fp) { - Xml tmpXml = Xml(fp); + MusECore::Xml tmpXml = MusECore::Xml(fp); // Write the part. Indicate that it's a copy operation - to add special markers, // and force full wave paths. part->write(0, tmpXml, true, true); @@ -778,13 +778,13 @@ void PartCanvas::itemPopup(MusEWidget::CItem* item, int n, const QPoint& pt) case 17: // File info { - Part* p = item->part(); - EventList* el = p->events(); + MusECore::Part* p = item->part(); + MusECore::EventList* el = p->events(); QString str = tr("Part name: %1\nFiles:").arg(p->name()); - for (iEvent e = el->begin(); e != el->end(); ++e) + for (MusECore::iEvent e = el->begin(); e != el->end(); ++e) { - Event event = e->second; - SndFileR f = event.sndFile(); + MusECore::Event event = e->second; + MusECore::SndFileR f = event.sndFile(); if (f.isNull()) continue; str.append(QString("\n@") + QString().setNum(event.tick()) + QString(" len:") + @@ -795,11 +795,11 @@ void PartCanvas::itemPopup(MusEWidget::CItem* item, int n, const QPoint& pt) } case 18: // Select clones { - Part* part = item->part(); + MusECore::Part* part = item->part(); // Traverse and process the clone chain ring until we arrive at the same part again. // The loop is a safety net. - Part* p = part; + MusECore::Part* p = part; int j = part->cevents()->arefCount(); if(j > 0) { @@ -810,7 +810,7 @@ void PartCanvas::itemPopup(MusEWidget::CItem* item, int n, const QPoint& pt) if(p == part) break; } - song->update(SC_SELECTION); + MusEGlobal::song->update(SC_SELECTION); } break; @@ -820,7 +820,7 @@ void PartCanvas::itemPopup(MusEWidget::CItem* item, int n, const QPoint& pt) curColorIndex = n - 20; bool selfound = false; //Loop through all parts and set color on selected: - for (MusEWidget::iCItem i = items.begin(); i != items.end(); i++) { + for (iCItem i = items.begin(); i != items.end(); i++) { if (i->second->isSelected()) { selfound = true; i->second->part()->setColorIndex(curColorIndex); @@ -831,7 +831,7 @@ void PartCanvas::itemPopup(MusEWidget::CItem* item, int n, const QPoint& pt) if(!selfound) item->part()->setColorIndex(curColorIndex); - song->update(SC_PART_MODIFIED); + MusEGlobal::song->update(SC_PART_MODIFIED); redraw(); break; } @@ -852,9 +852,9 @@ void PartCanvas::mousePress(QMouseEvent* event) return; } QPoint pt = event->pos(); - MusEWidget::CItem* item = items.find(pt); + CItem* item = items.find(pt); - //if (item == 0 && _tool!=MusEWidget::AutomationTool) // FINDMICHJETZT. neccessary? (flo93) + //if (item == 0 && _tool!=AutomationTool) // FINDMICHJETZT. neccessary? (flo93) // return; switch (_tool) { @@ -864,23 +864,23 @@ void PartCanvas::mousePress(QMouseEvent* event) else emit trackChanged(NULL); break; - case MusEWidget::CutTool: + case CutTool: if (item) splitItem(item, pt); break; - case MusEWidget::GlueTool: + case GlueTool: if (item) glueItem(item); break; - case MusEWidget::MuteTool: + case MuteTool: { if (item) { NPart* np = (NPart*) item; - Part* p = np->part(); + MusECore::Part* p = np->part(); p->setMute(!p->mute()); redraw(); break; } } - case MusEWidget::AutomationTool: + case AutomationTool: if (automation.controllerState != doNothing) automation.moveController=true; break; @@ -912,7 +912,7 @@ void PartCanvas::mouseMove(QMouseEvent* event) if (x < 0) x = 0; - if (_tool == MusEWidget::AutomationTool) + if (_tool == AutomationTool) processAutomationMovements(event->pos(), event->modifiers() & Qt::ShiftModifier); emit timeChanged(AL::sigmap.raster(x, *_raster)); @@ -922,11 +922,11 @@ void PartCanvas::mouseMove(QMouseEvent* event) // y2Track //--------------------------------------------------------- -Track* PartCanvas::y2Track(int y) const +MusECore::Track* PartCanvas::y2Track(int y) const { - TrackList* l = song->tracks(); + MusECore::TrackList* l = MusEGlobal::song->tracks(); int ty = 0; - for (iTrack it = l->begin(); it != l->end(); ++it) { + for (MusECore::iTrack it = l->begin(); it != l->end(); ++it) { int h = (*it)->height(); if (y >= ty && y < ty + h) return *it; @@ -943,7 +943,7 @@ void PartCanvas::keyPress(QKeyEvent* event) { int key = event->key(); -// if (_tool == MusEWidget::AutomationTool) { // can't get the cursor pos to work right, skipping for now +// if (_tool == AutomationTool) { // can't get the cursor pos to work right, skipping for now // // clear all the automation parameters // automation.moveController=false; // automation.controllerState = doNothing; @@ -979,7 +979,7 @@ void PartCanvas::keyPress(QKeyEvent* event) if (getCurrentDrag()) return; - song->msgRemoveParts(); + MusEGlobal::song->msgRemoveParts(); return; } else if (key == shortcuts[SHRT_POS_DEC].key) { @@ -991,54 +991,54 @@ void PartCanvas::keyPress(QKeyEvent* event) } 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(pos[0] + 1, *_raster); // Nudge by +1, then snap up with raster2. - 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_DEC_NOSNAP].key) { int spos = pos[0] - AL::sigmap.rasterStep(pos[0], *_raster); 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(pos[0] + AL::sigmap.rasterStep(pos[0], *_raster), true); - song->setPos(0, p, true, true, true); + MusECore::Pos p(pos[0] + AL::sigmap.rasterStep(pos[0], *_raster), true); + MusEGlobal::song->setPos(0, p, true, true, true); return; } else if (key == shortcuts[SHRT_TOOL_POINTER].key) { - emit setUsedTool(MusEWidget::PointerTool); + emit setUsedTool(PointerTool); return; } else if (key == shortcuts[SHRT_TOOL_PENCIL].key) { - emit setUsedTool(MusEWidget::PencilTool); + emit setUsedTool(PencilTool); return; } else if (key == shortcuts[SHRT_TOOL_RUBBER].key) { - emit setUsedTool(MusEWidget::RubberTool); + emit setUsedTool(RubberTool); return; } else if (key == shortcuts[SHRT_TOOL_SCISSORS].key) { - emit setUsedTool(MusEWidget::CutTool); + emit setUsedTool(CutTool); return; } else if (key == shortcuts[SHRT_TOOL_LINEDRAW].key) { - emit setUsedTool(MusEWidget::AutomationTool); + emit setUsedTool(AutomationTool); return; } else if (key == shortcuts[SHRT_TOOL_GLUE].key) { - emit setUsedTool(MusEWidget::GlueTool); + emit setUsedTool(GlueTool); return; } else if (key == shortcuts[SHRT_TOOL_MUTE].key) { - emit setUsedTool(MusEWidget::MuteTool); + emit setUsedTool(MuteTool); return; } else if (key == shortcuts[SHRT_SEL_TRACK_ABOVE].key) { @@ -1057,7 +1057,7 @@ void PartCanvas::keyPress(QKeyEvent* event) event->ignore(); // give global accelerators a chance return; } - for (MusEWidget::iCItem i = items.begin(); i != items.end(); ++i) { + for (iCItem i = items.begin(); i != items.end(); ++i) { NPart* part = (NPart*)(i->second); if (part->isSelected()) { curItem=part; @@ -1068,13 +1068,13 @@ void PartCanvas::keyPress(QKeyEvent* event) curItem = (NPart*)items.begin()->second; // just grab the first part } - MusEWidget::CItem* newItem = 0; + CItem* newItem = 0; bool singleSelection = isSingleSelection(); bool add = false; //Locators to selection if (key == shortcuts[SHRT_LOCATORS_TO_SELECTION].key) { - MusEWidget::CItem *leftmost = 0, *rightmost = 0; - for (MusEWidget::iCItem i = items.begin(); i != items.end(); i++) { + CItem *leftmost = 0, *rightmost = 0; + for (iCItem i = items.begin(); i != items.end(); i++) { if (i->second->isSelected()) { // Check leftmost: if (!leftmost) @@ -1094,10 +1094,10 @@ void PartCanvas::keyPress(QKeyEvent* event) int left_tick = leftmost->part()->tick(); int right_tick = rightmost->part()->tick() + rightmost->part()->lenTick(); - Pos p1(left_tick, true); - Pos p2(right_tick, true); - song->setPos(1, p1); - song->setPos(2, p2); + MusECore::Pos p1(left_tick, true); + MusECore::Pos p2(right_tick, true); + MusEGlobal::song->setPos(1, p1); + MusEGlobal::song->setPos(2, p2); return; } @@ -1106,13 +1106,13 @@ void PartCanvas::keyPress(QKeyEvent* event) if (key == shortcuts[SHRT_SEL_RIGHT_ADD].key) add = true; - Part* part = curItem->part(); - Track* track = part->track(); + MusECore::Part* part = curItem->part(); + MusECore::Track* track = part->track(); unsigned int tick = part->tick(); bool afterthis = false; - for (MusEWidget::iCItem i = items.begin(); i != items.end(); ++i) { + for (iCItem i = items.begin(); i != items.end(); ++i) { NPart* npart = (NPart*)(i->second); - Part* ipart = npart->part(); + MusECore::Part* ipart = npart->part(); if (ipart->track() != track) continue; if (ipart->tick() < tick) @@ -1134,13 +1134,13 @@ void PartCanvas::keyPress(QKeyEvent* event) if (key == shortcuts[SHRT_SEL_LEFT_ADD].key) add = true; - Part* part = curItem->part(); - Track* track = part->track(); + MusECore::Part* part = curItem->part(); + MusECore::Track* track = part->track(); unsigned int tick = part->tick(); - for (MusEWidget::iCItem i = items.begin(); i != items.end(); ++i) { + for (iCItem i = items.begin(); i != items.end(); ++i) { NPart* npart = (NPart*)(i->second); - Part* ipart = npart->part(); + MusECore::Part* ipart = npart->part(); if (ipart->track() != track) continue; @@ -1158,7 +1158,7 @@ void PartCanvas::keyPress(QKeyEvent* event) add = true; //To get an idea of which track is above us: int stepsize = rmapxDev(1); - Track* track = curItem->part()->track();//top->part()->track(); + MusECore::Track* track = curItem->part()->track();//top->part()->track(); track = y2Track(track->y() - 1); //If we're at topmost, leave @@ -1167,9 +1167,9 @@ void PartCanvas::keyPress(QKeyEvent* event) return; } int middle = curItem->x() + curItem->part()->lenTick()/2; - MusEWidget::CItem *aboveL = 0, *aboveR = 0; + CItem *aboveL = 0, *aboveR = 0; //Upper limit: song end, lower limit: song start - int ulimit = song->len(); + int ulimit = MusEGlobal::song->len(); int llimit = 0; while (newItem == 0) { @@ -1188,7 +1188,7 @@ void PartCanvas::keyPress(QKeyEvent* event) } if ((aboveL || aboveR) != 0) { //We've hit something - MusEWidget::CItem* above = 0; + CItem* above = 0; above = (aboveL !=0) ? aboveL : aboveR; newItem = above; } @@ -1207,16 +1207,16 @@ void PartCanvas::keyPress(QKeyEvent* event) //To get an idea of which track is below us: int stepsize = rmapxDev(1); - Track* track = curItem->part()->track();//bottom->part()->track(); + MusECore::Track* track = curItem->part()->track();//bottom->part()->track(); track = y2Track(track->y() + track->height() + 1 ); int middle = curItem->x() + curItem->part()->lenTick()/2; //If we're at bottommost, leave if (!track) return; - MusEWidget::CItem *belowL = 0, *belowR = 0; + CItem *belowL = 0, *belowR = 0; //Upper limit: song end , lower limit: song start - int ulimit = song->len(); + int ulimit = MusEGlobal::song->len(); int llimit = 0; while (newItem == 0) { int y = track->y() + 1; @@ -1234,7 +1234,7 @@ void PartCanvas::keyPress(QKeyEvent* event) } if ((belowL || belowR) != 0) { //We've hit something - MusEWidget::CItem* below = 0; + CItem* below = 0; below = (belowL !=0) ? belowL : belowR; newItem = below; } @@ -1252,9 +1252,9 @@ void PartCanvas::keyPress(QKeyEvent* event) event->ignore(); return; } - PartList* pl = new PartList; + MusECore::PartList* pl = new MusECore::PartList; NPart* npart = (NPart*)(curItem); - Track* track = npart->part()->track(); + MusECore::Track* track = npart->part()->track(); pl->add(npart->part()); int type = 0; @@ -1262,21 +1262,21 @@ void PartCanvas::keyPress(QKeyEvent* event) // else track is midi switch (track->type()) { - case Track::NEW_DRUM: - case Track::DRUM: + case MusECore::Track::NEW_DRUM: + case MusECore::Track::DRUM: type = 3; break; - case Track::WAVE: + case MusECore::Track::WAVE: type = 4; break; - case Track::MIDI: - case Track::AUDIO_OUTPUT: - case Track::AUDIO_INPUT: - case Track::AUDIO_GROUP: - case Track::AUDIO_AUX: - case Track::AUDIO_SOFTSYNTH: //TODO + case MusECore::Track::MIDI: + case MusECore::Track::AUDIO_OUTPUT: + case MusECore::Track::AUDIO_INPUT: + case MusECore::Track::AUDIO_GROUP: + case MusECore::Track::AUDIO_AUX: + case MusECore::Track::AUDIO_SOFTSYNTH: //TODO break; } emit startEditor(pl, type); @@ -1319,13 +1319,13 @@ void PartCanvas::keyPress(QKeyEvent* event) //--------------------------------------------------------- #if 0 -void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRect& rect) +void PartCanvas::drawItem(QPainter& p, const CItem* item, const QRect& rect) { int from = rect.x(); int to = from + rect.width(); //printf("from %d to %d\n", from,to); - Part* part = ((NPart*)item)->part(); + MusECore::Part* part = ((NPart*)item)->part(); int pTick = part->tick(); from -= pTick; to -= pTick; @@ -1404,7 +1404,7 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec if (item->isMoving()) { QColor c(Qt::gray); - c.setAlpha(MusEConfig::config.globalAlphaBlend); + c.setAlpha(MusEGlobal::config.globalAlphaBlend); QLinearGradient gradient(r.topLeft(), r.bottomLeft()); gradient.setColorAt(0, c); gradient.setColorAt(1, c.darker()); @@ -1414,12 +1414,12 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec if (part->selected()) { QColor c(Qt::black); - c.setAlpha(MusEConfig::config.globalAlphaBlend); + c.setAlpha(MusEGlobal::config.globalAlphaBlend); QLinearGradient gradient(r.topLeft(), r.bottomLeft()); - // Use a colour only about 20% lighter than black, rather than the 50% we use in MusEUtil::gGradientFromQColor + // Use a colour only about 20% lighter than black, rather than the 50% we use in MusECore::gGradientFromQColor // and is used in darker()/lighter(), so that it is distinguished a bit better from grey non-part tracks. //c.setRgba(64, 64, 64, c.alpha()); - gradient.setColorAt(0, QColor(51, 51, 51, MusEConfig::config.globalAlphaBlend)); + gradient.setColorAt(0, QColor(51, 51, 51, MusEGlobal::config.globalAlphaBlend)); gradient.setColorAt(1, c); brush = QBrush(gradient); } @@ -1427,7 +1427,7 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec if (part->mute()) { QColor c(Qt::white); - c.setAlpha(MusEConfig::config.globalAlphaBlend); + c.setAlpha(MusEGlobal::config.globalAlphaBlend); QLinearGradient gradient(r.topLeft(), r.bottomLeft()); gradient.setColorAt(0, c); gradient.setColorAt(1, c.darker()); @@ -1442,9 +1442,9 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec } else { - QColor c(MusEConfig::config.partColors[cidx]); - c.setAlpha(MusEConfig::config.globalAlphaBlend); - brush = QBrush(MusEUtil::gGradientFromQColor(c, r.topLeft(), r.bottomLeft())); + QColor c(MusEGlobal::config.partColors[cidx]); + c.setAlpha(MusEGlobal::config.globalAlphaBlend); + brush = QBrush(MusECore::gGradientFromQColor(c, r.topLeft(), r.bottomLeft())); } double h = r.height(); @@ -1467,7 +1467,7 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec if(het) { pts = 0; - if(het == (Part::LeftEventsHidden | Part::RightEventsHidden)) + if(het == (MusECore::Part::LeftEventsHidden | MusECore::Part::RightEventsHidden)) { points[pts++] = QPointF(xs_0, y0); points[pts++] = QPointF(xe_0, y0); @@ -1482,7 +1482,7 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec p.drawConvexPolygon(points, pts); // Help says may be faster on some platforms (X11). } else - if(het == Part::LeftEventsHidden) + if(het == MusECore::Part::LeftEventsHidden) { points[pts++] = QPointF(xs_0, y0); points[pts++] = QPointF(xe_0, y0); @@ -1494,7 +1494,7 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec p.drawConvexPolygon(points, pts); } else - if(het == Part::RightEventsHidden) + if(het == MusECore::Part::RightEventsHidden) { points[pts++] = QPointF(xs_0, y0); points[pts++] = QPointF(xe_0, y0); @@ -1512,7 +1512,7 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec // int part_r, part_g, part_b, brightness, color_brightness; - MusEConfig::config.partColors[cidx].getRgb(&part_r, &part_g, &part_b); + MusEGlobal::config.partColors[cidx].getRgb(&part_r, &part_g, &part_b); brightness = part_r*29 + part_g*59 + part_b*12; //if ((brightness < 12000 || part->selected()) && !part->mute() && !item->isMoving()) // color_brightness=223; // too dark: use lighter color @@ -1522,10 +1522,10 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec color_brightness=32; // too light: use dark color else color_brightness=223; // too dark: use lighter color - QColor c(color_brightness,color_brightness,color_brightness, MusEConfig::config.globalAlphaBlend); - p.setBrush(QBrush(MusEUtil::gGradientFromQColor(c, r.topLeft(), r.bottomLeft()))); + QColor c(color_brightness,color_brightness,color_brightness, MusEGlobal::config.globalAlphaBlend); + p.setBrush(QBrush(MusECore::gGradientFromQColor(c, r.topLeft(), r.bottomLeft()))); //p.setBrush(QBrush(c)); - if(het & Part::RightEventsHidden) + if(het & MusECore::Part::RightEventsHidden) { pts = 0; points[pts++] = QPointF(xe_0, y0); @@ -1535,7 +1535,7 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec points[pts++] = QPointF(xe_6, y1); p.drawConvexPolygon(points, pts); } - if(het & Part::LeftEventsHidden) + if(het & MusECore::Part::LeftEventsHidden) { pts = 0; points[pts++] = QPointF(xs_0, y0); @@ -1551,21 +1551,21 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec p.fillRect(r, brush); } - MidiPart* mp = 0; - WavePart* wp = 0; - Track::TrackType type = part->track()->type(); - if (type == Track::WAVE) { - wp =(WavePart*)part; + MusECore::MidiPart* mp = 0; + MusECore::WavePart* wp = 0; + MusECore::Track::TrackType type = part->track()->type(); + if (type == MusECore::Track::WAVE) { + wp =(MusECore::WavePart*)part; } else { - mp = (MidiPart*)part; + mp = (MusECore::MidiPart*)part; } if (wp) drawWavePart(p, rect, wp, r); else if (mp) { - drawMidiPart(p, rect, mp->events(), (MidiTrack*)part->track(), mp, r, mp->tick(), from, to); + drawMidiPart(p, rect, mp->events(), (MusECore::MidiTrack*)part->track(), mp, r, mp->tick(), from, to); } #if 0 @@ -1574,7 +1574,7 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec // Works great but requires clones be drawn with the highest priority on top of all other parts, in Canvas::draw. // - QPen pen(part->selected() ? MusEConfig::config.partColors[i] : Qt::black, 2.0, clone ? Qt::DotLine : Qt::SolidLine); + QPen pen(part->selected() ? MusEGlobal::config.partColors[i] : Qt::black, 2.0, clone ? Qt::DotLine : Qt::SolidLine); pen.setCosmetic(true); p.setPen(pen); p.setBrush(Qt::NoBrush); @@ -1595,7 +1595,7 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec p.setBrush(Qt::NoBrush); - QColor pc((part->mute() || item->isMoving())? Qt::white : MusEConfig::config.partColors[cidx]); + QColor pc((part->mute() || item->isMoving())? Qt::white : MusEGlobal::config.partColors[cidx]); QPen penSelect1H(pc); QPen penSelect2H(pc, 2.0); QPen penSelect1V(pc); @@ -1650,7 +1650,7 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec QLineF l3( lbt?xs_1:xs_0, ye_0, rbt?xe_1:xe_0, ye_0); // Bottom //QLineF l4(r.x(), r.y() + (lbt?y_1:y_2), r.x(), r.y() + r.height() - (lbt?y_1:y_2)); // Left - if(het & Part::RightEventsHidden) + if(het & MusECore::Part::RightEventsHidden) p.setPen(((NPart*)item)->rightBorderTouches ? penHidden1 : penHidden2); else { @@ -1676,7 +1676,7 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec else p.drawLine(QPointF(xx, rbt?ys_1:ys_2), QPointF(xx, rbt?ye_1:ye_2)); // Right line - if(het & Part::LeftEventsHidden) + if(het & MusECore::Part::LeftEventsHidden) p.setPen(((NPart*)item)->leftBorderTouches ? penHidden1 : penHidden2); else { @@ -1710,7 +1710,7 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec //p.restore(); - if (MusEConfig::config.canvasShowPartType & 1) { // show names + if (MusEGlobal::config.canvasShowPartType & 1) { // show names // draw name // FN: Set text color depending on part color (black / white) int part_r, part_g, part_b, brightness; @@ -1718,12 +1718,12 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec // get the lowest colour in the gradient used to draw the part. QRect rr = map(r); rr.setX(rr.x() + 3); - MusEUtil::gGradientFromQColor(MusEConfig::config.partColors[cidx], rr.topLeft(), rr.bottomLeft()).stops().last().second.getRgb(&part_r, &part_g, &part_b); + MusECore::gGradientFromQColor(MusEGlobal::config.partColors[cidx], rr.topLeft(), rr.bottomLeft()).stops().last().second.getRgb(&part_r, &part_g, &part_b); brightness = part_r*29 + part_g*59 + part_b*12; //bool rev = (brightness < 12000 || part->selected()) && !part->mute() && !item->isMoving(); bool rev = brightness >= 12000 && !part->selected(); p.save(); - p.setFont(MusEConfig::config.fonts[1]); + p.setFont(MusEGlobal::config.fonts[1]); p.setWorldMatrixEnabled(false); if (rev) p.setPen(Qt::white); @@ -1740,13 +1740,13 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec } #endif -void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRect& rect) +void PartCanvas::drawItem(QPainter& p, const CItem* item, const QRect& rect) { int from = rect.x(); int to = from + rect.width(); //printf("from %d to %d\n", from,to); - Part* part = ((NPart*)item)->part(); + MusECore::Part* part = ((NPart*)item)->part(); int pTick = part->tick(); from -= pTick; to -= pTick; @@ -1835,7 +1835,7 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec if (item->isMoving()) { QColor c(Qt::gray); - c.setAlpha(MusEConfig::config.globalAlphaBlend); + c.setAlpha(MusEGlobal::config.globalAlphaBlend); QLinearGradient gradient(rr.topLeft(), rr.bottomLeft()); gradient.setColorAt(0, c); gradient.setColorAt(1, c.darker()); @@ -1845,12 +1845,12 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec if (part->selected()) { QColor c(Qt::black); - c.setAlpha(MusEConfig::config.globalAlphaBlend); + c.setAlpha(MusEGlobal::config.globalAlphaBlend); QLinearGradient gradient(rr.topLeft(), rr.bottomLeft()); - // Use a colour only about 20% lighter than black, rather than the 50% we use in MusEUtil::gGradientFromQColor + // Use a colour only about 20% lighter than black, rather than the 50% we use in MusECore::gGradientFromQColor // and is used in darker()/lighter(), so that it is distinguished a bit better from grey non-part tracks. //c.setRgba(64, 64, 64, c.alpha()); - gradient.setColorAt(0, QColor(51, 51, 51, MusEConfig::config.globalAlphaBlend)); + gradient.setColorAt(0, QColor(51, 51, 51, MusEGlobal::config.globalAlphaBlend)); gradient.setColorAt(1, c); brush = QBrush(gradient); } @@ -1858,7 +1858,7 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec if (part->mute()) { QColor c(Qt::white); - c.setAlpha(MusEConfig::config.globalAlphaBlend); + c.setAlpha(MusEGlobal::config.globalAlphaBlend); QLinearGradient gradient(rr.topLeft(), rr.bottomLeft()); gradient.setColorAt(0, c); gradient.setColorAt(1, c.darker()); @@ -1866,9 +1866,9 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec } else { - QColor c(MusEConfig::config.partColors[cidx]); - c.setAlpha(MusEConfig::config.globalAlphaBlend); - brush = QBrush(MusEUtil::gGradientFromQColor(c, rr.topLeft(), rr.bottomLeft())); + QColor c(MusEGlobal::config.partColors[cidx]); + c.setAlpha(MusEGlobal::config.globalAlphaBlend); + brush = QBrush(MusECore::gGradientFromQColor(c, rr.topLeft(), rr.bottomLeft())); } int h = rr.height(); @@ -1895,7 +1895,7 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec // TODO: Make this part respect the requested drawing rectangle (rr & mr), for speed ! pts = 0; - if(het == (Part::LeftEventsHidden | Part::RightEventsHidden)) + if(het == (MusECore::Part::LeftEventsHidden | MusECore::Part::RightEventsHidden)) { //points[pts++] = QPoint(xs_0, y0); //points[pts++] = QPoint(xe_0, y0); @@ -1918,7 +1918,7 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec p.drawConvexPolygon(points, pts); // Help says may be faster on some platforms (X11). } else - if(het == Part::LeftEventsHidden) + if(het == MusECore::Part::LeftEventsHidden) { //points[pts++] = QPoint(xs_0, y0); //points[pts++] = QPoint(xe_0, y0); @@ -1937,7 +1937,7 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec p.drawConvexPolygon(points, pts); } else - if(het == Part::RightEventsHidden) + if(het == MusECore::Part::RightEventsHidden) { //points[pts++] = QPoint(xs_0, y0); //points[pts++] = QPoint(xe_0, y0); @@ -1961,7 +1961,7 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec // int part_r, part_g, part_b, brightness, color_brightness; - MusEConfig::config.partColors[cidx].getRgb(&part_r, &part_g, &part_b); + MusEGlobal::config.partColors[cidx].getRgb(&part_r, &part_g, &part_b); brightness = part_r*29 + part_g*59 + part_b*12; //if ((brightness < 12000 || part->selected()) && !part->mute() && !item->isMoving()) // color_brightness=223; // too dark: use lighter color @@ -1971,10 +1971,10 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec color_brightness=96; //0; // too light: use dark color else color_brightness=180; //255; // too dark: use lighter color - QColor c(color_brightness,color_brightness,color_brightness, MusEConfig::config.globalAlphaBlend); - p.setBrush(QBrush(MusEUtil::gGradientFromQColor(c, rr.topLeft(), rr.bottomLeft()))); + QColor c(color_brightness,color_brightness,color_brightness, MusEGlobal::config.globalAlphaBlend); + p.setBrush(QBrush(MusECore::gGradientFromQColor(c, rr.topLeft(), rr.bottomLeft()))); //p.setBrush(QBrush(c)); - if(het & Part::RightEventsHidden) + if(het & MusECore::Part::RightEventsHidden) { pts = 0; //points[pts++] = QPoint(xe_0, y0); @@ -1989,7 +1989,7 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec p.drawConvexPolygon(points, pts); } - if(het & Part::LeftEventsHidden) + if(het & MusECore::Part::LeftEventsHidden) { pts = 0; //points[pts++] = QPoint(xs_0, y0); @@ -2025,21 +2025,21 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec p.setWorldMatrixEnabled(true); - MidiPart* mp = 0; - WavePart* wp = 0; - Track::TrackType type = part->track()->type(); - if (type == Track::WAVE) { - wp =(WavePart*)part; + MusECore::MidiPart* mp = 0; + MusECore::WavePart* wp = 0; + MusECore::Track::TrackType type = part->track()->type(); + if (type == MusECore::Track::WAVE) { + wp =(MusECore::WavePart*)part; } else { - mp = (MidiPart*)part; + mp = (MusECore::MidiPart*)part; } if (wp) drawWavePart(p, rect, wp, r); else if (mp) { - drawMidiPart(p, rect, mp->events(), (MidiTrack*)part->track(), mp, r, mp->tick(), from, to); + drawMidiPart(p, rect, mp->events(), (MusECore::MidiTrack*)part->track(), mp, r, mp->tick(), from, to); } p.setWorldMatrixEnabled(false); @@ -2050,7 +2050,7 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec // Works great but requires clones be drawn with the highest priority on top of all other parts, in Canvas::draw. // - QPen pen(part->selected() ? MusEConfig::config.partColors[i] : Qt::black, 2.0, clone ? Qt::DotLine : Qt::SolidLine); + QPen pen(part->selected() ? MusEGlobal::config.partColors[i] : Qt::black, 2.0, clone ? Qt::DotLine : Qt::SolidLine); pen.setCosmetic(true); p.setPen(pen); p.setBrush(Qt::NoBrush); @@ -2066,7 +2066,7 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec p.setBrush(Qt::NoBrush); - QColor pc((part->mute() || item->isMoving())? Qt::white : MusEConfig::config.partColors[cidx]); + QColor pc((part->mute() || item->isMoving())? Qt::white : MusEGlobal::config.partColors[cidx]); QPen penSelect1H(pc); QPen penSelect2H(pc, 2.0); QPen penSelect1V(pc); @@ -2127,7 +2127,7 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec } } - //if(het & Part::RightEventsHidden) + //if(het & MusECore::Part::RightEventsHidden) // p.setPen(((NPart*)item)->rightBorderTouches ? penHidden1 : penHidden2); //else { @@ -2160,7 +2160,7 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec p.drawLine(QPoint(xx, rbt?ys_1:ys_2), QPoint(xx, rbt?ye_1:ye_2)); // Right line */ - //if(het & Part::LeftEventsHidden) + //if(het & MusECore::Part::LeftEventsHidden) // p.setPen(((NPart*)item)->leftBorderTouches ? penHidden1 : penHidden2); //else { @@ -2203,7 +2203,7 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec #endif - if (MusEConfig::config.canvasShowPartType & 1) { // show names + if (MusEGlobal::config.canvasShowPartType & 1) { // show names // draw name // FN: Set text color depending on part color (black / white) int part_r, part_g, part_b, brightness; @@ -2212,11 +2212,11 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec //QRect rr = map(r); QRect tr = rr; tr.setX(tr.x() + 3); - MusEUtil::gGradientFromQColor(MusEConfig::config.partColors[cidx], tr.topLeft(), tr.bottomLeft()).stops().last().second.getRgb(&part_r, &part_g, &part_b); + MusECore::gGradientFromQColor(MusEGlobal::config.partColors[cidx], tr.topLeft(), tr.bottomLeft()).stops().last().second.getRgb(&part_r, &part_g, &part_b); brightness = part_r*29 + part_g*59 + part_b*12; //bool rev = (brightness < 12000 || part->selected()) && !part->mute() && !item->isMoving(); bool rev = brightness >= 12000 && !part->selected(); - p.setFont(MusEConfig::config.fonts[1]); + p.setFont(MusEGlobal::config.fonts[1]); if (rev) p.setPen(Qt::white); else @@ -2238,12 +2238,12 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec // draws moving items //--------------------------------------------------------- -void PartCanvas::drawMoving(QPainter& p, const MusEWidget::CItem* item, const QRect&) +void PartCanvas::drawMoving(QPainter& p, const CItem* item, const QRect&) { p.setPen( Qt::black); - Part* part = ((NPart*)item)->part(); - QColor c(part->mute() ? Qt::white : MusEConfig::config.partColors[part->colorIndex()]); - //c.setAlpha(MusEConfig::config.globalAlphaBlend); + MusECore::Part* part = ((NPart*)item)->part(); + QColor c(part->mute() ? Qt::white : MusEGlobal::config.partColors[part->colorIndex()]); + //c.setAlpha(MusEGlobal::config.globalAlphaBlend); c.setAlpha(128); // Fix this regardless of global setting. Should be OK. p.setBrush(c); p.drawRect(item->mp().x(), item->mp().y(), item->width(), item->height()); @@ -2256,14 +2256,14 @@ void PartCanvas::drawMoving(QPainter& p, const MusEWidget::CItem* item, const QR // pr - part rectangle //--------------------------------------------------------- -void PartCanvas::drawMidiPart(QPainter& p, const QRect&, EventList* events, MidiTrack *mt, MidiPart *pt, const QRect& r, int pTick, int from, int to) +void PartCanvas::drawMidiPart(QPainter& p, const QRect&, MusECore::EventList* events, MusECore::MidiTrack *mt, MusECore::MidiPart *pt, const QRect& r, int pTick, int from, int to) { int color_brightness; if(pt) { int part_r, part_g, part_b, brightness; - MusEConfig::config.partColors[pt->colorIndex()].getRgb(&part_r, &part_g, &part_b); + MusEGlobal::config.partColors[pt->colorIndex()].getRgb(&part_r, &part_g, &part_b); brightness = part_r*29 + part_g*59 + part_b*12; //if ((brightness < 12000 || pt->selected()) && !pt->mute()) // color_brightness=192; // too dark: use lighter color @@ -2277,21 +2277,21 @@ void PartCanvas::drawMidiPart(QPainter& p, const QRect&, EventList* events, Midi else color_brightness=80; - if (MusEConfig::config.canvasShowPartType & 2) { // show events + if (MusEGlobal::config.canvasShowPartType & 2) { // show events p.setPen(QColor(color_brightness,color_brightness,color_brightness)); // Do not allow this, causes segfault. if(from <= to) { - iEvent ito(events->lower_bound(to)); + MusECore::iEvent ito(events->lower_bound(to)); - for (iEvent i = events->lower_bound(from); i != ito; ++i) { - EventType type = i->second.type(); + for (MusECore::iEvent i = events->lower_bound(from); i != ito; ++i) { + MusECore::EventType type = i->second.type(); if ( - ((MusEConfig::config.canvasShowPartEvent & 1) && (type == Note)) - || ((MusEConfig::config.canvasShowPartEvent & 2) && (type == PAfter)) - || ((MusEConfig::config.canvasShowPartEvent & 4) && (type == Controller)) - || ((MusEConfig::config.canvasShowPartEvent &16) && (type == CAfter)) - || ((MusEConfig::config.canvasShowPartEvent &64) && (type == Sysex || type == Meta)) + ((MusEGlobal::config.canvasShowPartEvent & 1) && (type == MusECore::Note)) + || ((MusEGlobal::config.canvasShowPartEvent & 2) && (type == MusECore::PAfter)) + || ((MusEGlobal::config.canvasShowPartEvent & 4) && (type == MusECore::Controller)) + || ((MusEGlobal::config.canvasShowPartEvent &16) && (type == MusECore::CAfter)) + || ((MusEGlobal::config.canvasShowPartEvent &64) && (type == MusECore::Sysex || type == MusECore::Meta)) ) { int t = i->first + pTick; int th = mt->height(); @@ -2305,33 +2305,33 @@ void PartCanvas::drawMidiPart(QPainter& p, const QRect&, EventList* events, Midi using std::map; using std::pair; - iEvent ito(events->lower_bound(to)); - bool isdrum = (mt->type() == Track::DRUM || mt->type() == Track::NEW_DRUM); + MusECore::iEvent ito(events->lower_bound(to)); + bool isdrum = (mt->type() == MusECore::Track::DRUM || mt->type() == MusECore::Track::NEW_DRUM); // draw controllers ------------------------------------------ p.setPen(QColor(192,192,color_brightness/2)); - for (iEvent i = events->begin(); i != ito; ++i) { // PITCH BEND + for (MusECore::iEvent i = events->begin(); i != ito; ++i) { // PITCH BEND int t = i->first + pTick; - EventType type = i->second.type(); - if (type == Controller) { + MusECore::EventType type = i->second.type(); + if (type == MusECore::Controller) { int ctrl_type=i->second.dataA(); int val=i->second.dataB(); int th = int(mt->height() * 0.75); // only draw on three quarters int hoffset = (mt->height() - th ) / 2; // offset from bottom - if (ctrl_type == CTRL_PITCH) + if (ctrl_type == MusECore::CTRL_PITCH) p.drawLine(t, hoffset + r.y() + th/2, t, hoffset + r.y() - val*th/8192/2 + th/2); } } p.setPen(QColor(192,color_brightness/2,color_brightness/2)); - for (iEvent i = events->begin(); i != ito; ++i) { // PAN + for (MusECore::iEvent i = events->begin(); i != ito; ++i) { // PAN int t = i->first + pTick; - EventType type = i->second.type(); - if (type == Controller) { + MusECore::EventType type = i->second.type(); + if (type == MusECore::Controller) { int ctrl_type=i->second.dataA(); int val=i->second.dataB(); @@ -2344,11 +2344,11 @@ void PartCanvas::drawMidiPart(QPainter& p, const QRect&, EventList* events, Midi } p.setPen(QColor(color_brightness/2,192,color_brightness/2)); - for (iEvent i = events->begin(); i != ito; ++i) { // VOLUME + for (MusECore::iEvent i = events->begin(); i != ito; ++i) { // VOLUME int t = i->first + pTick; - EventType type = i->second.type(); - if (type == Controller) { + MusECore::EventType type = i->second.type(); + if (type == MusECore::Controller) { int ctrl_type=i->second.dataA(); int val=i->second.dataB(); @@ -2361,17 +2361,17 @@ void PartCanvas::drawMidiPart(QPainter& p, const QRect&, EventList* events, Midi } p.setPen(QColor(0,0,255)); - for (iEvent i = events->begin(); i != ito; ++i) { // PROGRAM CHANGE + for (MusECore::iEvent i = events->begin(); i != ito; ++i) { // PROGRAM CHANGE int t = i->first + pTick; - EventType type = i->second.type(); - if (type == Controller) { + MusECore::EventType type = i->second.type(); + if (type == MusECore::Controller) { int ctrl_type=i->second.dataA(); int th = int(mt->height() * 0.75); // only draw on three quarters int hoffset = (mt->height() - th ) / 2; // offset from bottom - if (ctrl_type == CTRL_PROGRAM) + if (ctrl_type == MusECore::CTRL_PROGRAM) p.drawLine(t, hoffset + r.y(), t, hoffset + r.y() + th); } } @@ -2386,11 +2386,11 @@ void PartCanvas::drawMidiPart(QPainter& p, const QRect&, EventList* events, Midi int highest_pitch=0; map<int,int> y_mapper; - if (MusEConfig::config.canvasShowPartType & 4) //y-stretch? + if (MusEGlobal::config.canvasShowPartType & 4) //y-stretch? { - for (iEvent i = events->begin(); i != events->end(); ++i) + for (MusECore::iEvent i = events->begin(); i != events->end(); ++i) { - if (i->second.type()==Note) + if (i->second.type()==MusECore::Note) { int pitch=i->second.pitch(); @@ -2450,7 +2450,7 @@ void PartCanvas::drawMidiPart(QPainter& p, const QRect&, EventList* events, Midi } p.setPen(QColor(color_brightness,color_brightness,color_brightness)); - for (iEvent i = events->begin(); i != ito; ++i) { + for (MusECore::iEvent i = events->begin(); i != ito; ++i) { int t = i->first + pTick; int te = t + i->second.lenTick(); @@ -2462,8 +2462,8 @@ void PartCanvas::drawMidiPart(QPainter& p, const QRect&, EventList* events, Midi if (te >= (to + pTick)) te = lrint(rmapxDev_f(rmapx_f(to + pTick) - 1.0)); - EventType type = i->second.type(); - if (type == Note) { + MusECore::EventType type = i->second.type(); + if (type == MusECore::Note) { int pitch = i->second.pitch(); int th = int(mt->height() * 0.75); // only draw on three quarters int hoffset = (mt->height() - th ) / 2; // offset from bottom @@ -2486,7 +2486,7 @@ void PartCanvas::drawMidiPart(QPainter& p, const QRect&, EventList* events, Midi //--------------------------------------------------------- void PartCanvas::drawWavePart(QPainter& p, - const QRect& bb, WavePart* wp, const QRect& _pr) + const QRect& bb, MusECore::WavePart* wp, const QRect& _pr) { //QRect rr = p.worldMatrix().mapRect(bb); // Gives inconsistent positions. Source shows wrong operation for our needs. QRect rr = map(bb); // Use our own map instead. @@ -2508,11 +2508,11 @@ void PartCanvas::drawWavePart(QPainter& p, int h = hh/2; int y = pr.y() + h; - EventList* el = wp->events(); - for (iEvent e = el->begin(); e != el->end(); ++e) { + MusECore::EventList* el = wp->events(); + for (MusECore::iEvent e = el->begin(); e != el->end(); ++e) { int cc = hh % 2 ? 0 : 1; - Event event = e->second; - SndFileR f = event.sndFile(); + MusECore::Event event = e->second; + MusECore::SndFileR f = event.sndFile(); if (f.isNull()) continue; unsigned channels = f.channels(); @@ -2524,7 +2524,7 @@ void PartCanvas::drawWavePart(QPainter& p, int xScale; int pos; int tickstep = rmapxDev(1); - int postick = tempomap.frame2tick(wp->frame() + event.frame()); + int postick = MusEGlobal::tempomap.frame2tick(wp->frame() + event.frame()); int eventx = mapx(postick); int drawoffset; if((x1 - eventx) < 0) @@ -2532,14 +2532,14 @@ void PartCanvas::drawWavePart(QPainter& p, else drawoffset = rmapxDev(x1 - eventx); postick += drawoffset; - pos = event.spos() + tempomap.tick2frame(postick) - wp->frame() - event.frame(); + pos = event.spos() + MusEGlobal::tempomap.tick2frame(postick) - wp->frame() - event.frame(); int i; if(x1 < eventx) i = eventx; else i = x1; - int ex = mapx(tempomap.frame2tick(wp->frame() + event.frame() + event.lenFrame())); + int ex = mapx(MusEGlobal::tempomap.frame2tick(wp->frame() + event.frame() + event.lenFrame())); if(ex > x2) ex = x2; if (h < 20) { @@ -2549,8 +2549,8 @@ void PartCanvas::drawWavePart(QPainter& p, //printf("PartCanvas::drawWavePart i:%d ex:%d\n", i, ex); for (; i < ex; i++) { - SampleV sa[channels]; - xScale = tempomap.deltaTick2frame(postick, postick + tickstep); + MusECore::SampleV sa[channels]; + xScale = MusEGlobal::tempomap.deltaTick2frame(postick, postick + tickstep); f.read(sa, xScale, pos); postick += tickstep; pos += xScale; @@ -2578,8 +2578,8 @@ void PartCanvas::drawWavePart(QPainter& p, int cc = hh % (channels * 2) ? 0 : 1; for (; i < ex; i++) { y = pr.y() + hm; - SampleV sa[channels]; - xScale = tempomap.deltaTick2frame(postick, postick + tickstep); + MusECore::SampleV sa[channels]; + xScale = MusEGlobal::tempomap.deltaTick2frame(postick, postick + tickstep); f.read(sa, xScale, pos); postick += tickstep; pos += xScale; @@ -2604,8 +2604,8 @@ void PartCanvas::drawWavePart(QPainter& p, void PartCanvas::cmd(int cmd) { - PartList pl; - for (MusEWidget::iCItem i = items.begin(); i != items.end(); ++i) { + MusECore::PartList pl; + for (iCItem i = items.begin(); i != items.end(); ++i) { if (!i->second->isSelected()) continue; NPart* npart = (NPart*)(i->second); @@ -2616,17 +2616,17 @@ void PartCanvas::cmd(int cmd) { copy(&pl); - Undo operations; + MusECore::Undo operations; - for (MusEWidget::iCItem i = items.begin(); i != items.end(); ++i) { + for (iCItem i = items.begin(); i != items.end(); ++i) { if (i->second->isSelected()) { NPart* p = (NPart*)(i->second); - Part* part = p->part(); - operations.push_back(UndoOp(UndoOp::DeletePart, part)); + MusECore::Part* part = p->part(); + operations.push_back(MusECore::UndoOp(MusECore::UndoOp::DeletePart, part)); } } - song->applyOperationGroup(operations); + MusEGlobal::song->applyOperationGroup(operations); break; } @@ -2645,8 +2645,8 @@ void PartCanvas::cmd(int cmd) case CMD_PASTE_DIALOG: case CMD_PASTE_CLONE_DIALOG: { - unsigned temp_begin = AL::sigmap.raster1(song->vcpos(),0); - unsigned temp_end = AL::sigmap.raster2(temp_begin + MusEUtil::get_paste_len(), 0); + unsigned temp_begin = AL::sigmap.raster1(MusEGlobal::song->vcpos(),0); + unsigned temp_end = AL::sigmap.raster2(temp_begin + MusECore::get_paste_len(), 0); paste_dialog->raster = temp_end - temp_begin; paste_dialog->clone = (cmd == CMD_PASTE_CLONE_DIALOG); @@ -2667,10 +2667,10 @@ void PartCanvas::cmd(int cmd) break; } case CMD_INSERT_EMPTYMEAS: - int startPos=song->vcpos(); + int startPos=MusEGlobal::song->vcpos(); int oneMeas=AL::sigmap.ticksMeasure(startPos); - Undo temp=movePartsTotheRight(startPos,oneMeas); - song->applyOperationGroup(temp); + MusECore::Undo temp=MusECore::movePartsTotheRight(startPos,oneMeas); + MusEGlobal::song->applyOperationGroup(temp); break; } } @@ -2680,42 +2680,42 @@ void PartCanvas::cmd(int cmd) // cut copy paste //--------------------------------------------------------- -void PartCanvas::copy_in_range(PartList* pl_) +void PartCanvas::copy_in_range(MusECore::PartList* pl_) { - PartList pl; - PartList result_pl; - unsigned int lpos = song->lpos(); - unsigned int rpos = song->rpos(); + MusECore::PartList pl; + MusECore::PartList result_pl; + unsigned int lpos = MusEGlobal::song->lpos(); + unsigned int rpos = MusEGlobal::song->rpos(); if (pl_->empty()) { - for (MusEWidget::iCItem i = items.begin(); i != items.end(); ++i) + for (iCItem i = items.begin(); i != items.end(); ++i) { - Part* part=static_cast<NPart*>(i->second)->part(); - if ( (part->track()->isMidiTrack()) || (part->track()->type() == Track::WAVE) ) + MusECore::Part* part=static_cast<NPart*>(i->second)->part(); + if ( (part->track()->isMidiTrack()) || (part->track()->type() == MusECore::Track::WAVE) ) pl.add(part); } } else { - for(ciPart p = pl_->begin(); p != pl_->end(); ++p) - if ( (p->second->track()->isMidiTrack()) || (p->second->track()->type() == Track::WAVE) ) + for(MusECore::ciPart p = pl_->begin(); p != pl_->end(); ++p) + if ( (p->second->track()->isMidiTrack()) || (p->second->track()->type() == MusECore::Track::WAVE) ) pl.add(p->second); } if (!pl.empty() && (rpos>lpos)) { - for(ciPart p = pl.begin(); p != pl.end(); ++p) + for(MusECore::ciPart p = pl.begin(); p != pl.end(); ++p) { - Part* part=p->second; - Track* track=part->track(); + MusECore::Part* part=p->second; + MusECore::Track* track=part->track(); if ((part->tick() < rpos) && (part->endTick() > lpos)) //is the part in the range? { if ((lpos > part->tick()) && (lpos < part->endTick())) { - Part* p1; - Part* p2; + MusECore::Part* p1; + MusECore::Part* p2; track->splitPart(part, lpos, p1, p2); p1->events()->incARef(-1); @@ -2726,8 +2726,8 @@ void PartCanvas::copy_in_range(PartList* pl_) if ((rpos > part->tick()) && (rpos < part->endTick())) { - Part* p1; - Part* p2; + MusECore::Part* p1; + MusECore::Part* p2; track->splitPart(part, rpos, p1, p2); p1->events()->incARef(-1); @@ -2744,18 +2744,18 @@ void PartCanvas::copy_in_range(PartList* pl_) } } -void PartCanvas::copy(PartList* pl) +void PartCanvas::copy(MusECore::PartList* pl) { if (pl->empty()) return; bool wave = false; bool midi = false; - for(ciPart p = pl->begin(); p != pl->end(); ++p) + for(MusECore::ciPart p = pl->begin(); p != pl->end(); ++p) { if(p->second->track()->isMidiTrack()) midi = true; else - if(p->second->track()->type() == Track::WAVE) + if(p->second->track()->type() == MusECore::Track::WAVE) wave = true; if(midi && wave) break; @@ -2773,14 +2773,14 @@ void PartCanvas::copy(PartList* pl) strerror(errno)); return; } - Xml xml(tmp); + MusECore::Xml xml(tmp); // Clear the copy clone list. - cloneList.clear(); + MusEGlobal::cloneList.clear(); int level = 0; int tick = 0; - for (ciPart p = pl->begin(); p != pl->end(); ++p) { + for (MusECore::ciPart p = pl->begin(); p != pl->end(); ++p) { // Indicate this is a copy operation. Also force full wave paths. p->second->write(level, xml, true, true); @@ -2788,8 +2788,8 @@ void PartCanvas::copy(PartList* pl) if (endTick > tick) tick = endTick; } - Pos p(tick, true); - song->setPos(0, p); + MusECore::Pos p(tick, true); + MusEGlobal::song->setPos(0, p); //--------------------------------------------------- // read tmp file into QTextDrag Object @@ -2828,13 +2828,13 @@ void PartCanvas::copy(PartList* pl) } -Undo PartCanvas::pasteAt(const QString& pt, Track* track, unsigned int pos, bool clone, bool toTrack, int* finalPosPtr, set<Track*>* affected_tracks) +MusECore::Undo PartCanvas::pasteAt(const QString& pt, MusECore::Track* track, unsigned int pos, bool clone, bool toTrack, int* finalPosPtr, set<MusECore::Track*>* affected_tracks) { - Undo operations; + MusECore::Undo operations; QByteArray ba = pt.toLatin1(); const char* ptxt = ba.constData(); - Xml xml(ptxt); + MusECore::Xml xml(ptxt); bool firstPart=true; int posOffset=0; unsigned int finalPos = pos; @@ -2843,17 +2843,17 @@ Undo PartCanvas::pasteAt(const QString& pt, Track* track, unsigned int pos, bool bool end = false; for (;;) { - Xml::Token token = xml.parse(); + MusECore::Xml::Token token = xml.parse(); const QString& tag = xml.s1(); switch (token) { - case Xml::Error: - case Xml::End: + case MusECore::Xml::Error: + case MusECore::Xml::End: end = true; break; - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "part") { // Read the part. - Part* p = 0; + MusECore::Part* p = 0; p = readXmlPart(xml, track, clone, toTrack); // If it could not be created... @@ -2864,7 +2864,7 @@ Undo PartCanvas::pasteAt(const QString& pt, Track* track, unsigned int pos, bool break; } - p->events()->incARef(-1); // the later song->applyOperationGroup() will increment it + p->events()->incARef(-1); // the later MusEGlobal::song->applyOperationGroup() will increment it // so we must decrement it first :/ // Increment the number of parts done. @@ -2879,14 +2879,14 @@ Undo PartCanvas::pasteAt(const QString& pt, Track* track, unsigned int pos, bool finalPos=p->tick()+p->lenTick(); } p->setSelected(true); - operations.push_back(UndoOp(UndoOp::AddPart,p)); + operations.push_back(MusECore::UndoOp(MusECore::UndoOp::AddPart,p)); if (affected_tracks) affected_tracks->insert(p->track()); } else xml.unknown("PartCanvas::pasteAt"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: break; default: end = true; @@ -2917,13 +2917,13 @@ Undo PartCanvas::pasteAt(const QString& pt, Track* track, unsigned int pos, bool void PartCanvas::paste(bool clone, paste_mode_t paste_mode, bool to_single_track, int amount, int raster) { - Track* track = 0; + MusECore::Track* track = 0; // If we want to paste to a selected track... if (to_single_track) { - TrackList* tl = song->tracks(); - for (iTrack i = tl->begin(); i != tl->end(); ++i) { + MusECore::TrackList* tl = MusEGlobal::song->tracks(); + for (MusECore::iTrack i = tl->begin(); i != tl->end(); ++i) { if ((*i)->selected()) { if (track) { QMessageBox::critical(this, QString("MusE"), @@ -2964,7 +2964,7 @@ void PartCanvas::paste(bool clone, paste_mode_t paste_mode, bool to_single_track else if(md->hasFormat(pfx + wvpl)) { // If we want to paste to a selected track... - if(to_single_track && track->type() != Track::WAVE) + if(to_single_track && track->type() != MusECore::Track::WAVE) { QMessageBox::critical(this, QString("MusE"), tr("Can only paste to wave track")); @@ -2975,7 +2975,7 @@ void PartCanvas::paste(bool clone, paste_mode_t paste_mode, bool to_single_track else if(md->hasFormat(pfx + mxpl)) { // If we want to paste to a selected track... - if(to_single_track && !track->isMidiTrack() && track->type() != Track::WAVE) + if(to_single_track && !track->isMidiTrack() && track->type() != MusECore::Track::WAVE) { QMessageBox::critical(this, QString("MusE"), tr("Can only paste to midi or wave track")); @@ -2993,20 +2993,20 @@ void PartCanvas::paste(bool clone, paste_mode_t paste_mode, bool to_single_track if (!txt.isEmpty()) { int endPos=0; - unsigned int startPos=song->vcpos(); - set<Track*> affected_tracks; + unsigned int startPos=MusEGlobal::song->vcpos(); + set<MusECore::Track*> affected_tracks; deselectAll(); - Undo operations; + MusECore::Undo operations; for (int i=0;i<amount;i++) { - Undo temp = pasteAt(txt, track, startPos + i*raster, clone, to_single_track, &endPos, &affected_tracks); + MusECore::Undo temp = pasteAt(txt, track, startPos + i*raster, clone, to_single_track, &endPos, &affected_tracks); operations.insert(operations.end(), temp.begin(), temp.end()); } - Pos p(endPos, true); - song->setPos(0, p); + MusECore::Pos p(endPos, true); + MusEGlobal::song->setPos(0, p); if (paste_mode != PASTEMODE_MIX) { @@ -3014,16 +3014,16 @@ void PartCanvas::paste(bool clone, paste_mode_t paste_mode, bool to_single_track if (amount==1) offset = endPos-startPos; else offset = amount*raster; - Undo temp; + MusECore::Undo temp; if (paste_mode==PASTEMODE_MOVESOME) - temp=movePartsTotheRight(startPos, offset, false, &affected_tracks); + temp=MusECore::movePartsTotheRight(startPos, offset, false, &affected_tracks); else - temp=movePartsTotheRight(startPos, offset); + temp=MusECore::movePartsTotheRight(startPos, offset); operations.insert(operations.end(), temp.begin(), temp.end()); } - song->applyOperationGroup(operations); + MusEGlobal::song->applyOperationGroup(operations); } } @@ -3032,10 +3032,10 @@ void PartCanvas::paste(bool clone, paste_mode_t paste_mode, bool to_single_track // startDrag //--------------------------------------------------------- -void PartCanvas::startDrag(MusEWidget::CItem* item, DragType t) +void PartCanvas::startDrag(CItem* item, DragType t) { NPart* p = (NPart*)(item); - Part* part = p->part(); + MusECore::Part* part = p->part(); //--------------------------------------------------- // write part as XML into tmp file @@ -3047,7 +3047,7 @@ void PartCanvas::startDrag(MusEWidget::CItem* item, DragType t) strerror(errno)); return; } - Xml xml(tmp); + MusECore::Xml xml(tmp); int level = 0; part->write(level, xml); @@ -3073,7 +3073,7 @@ void PartCanvas::startDrag(MusEWidget::CItem* item, DragType t) md->setData("text/x-muse-partlist", data); - // "Note that setMimeData() assigns ownership of the QMimeData object to the QDrag object. + // "MusECore::Note that setMimeData() assigns ownership of the QMimeData object to the QDrag object. // The QDrag must be constructed on the heap with a parent QWidget to ensure that Qt can // clean up after the drag and drop operation has been completed. " QDrag* drag = new QDrag(this); @@ -3132,10 +3132,10 @@ void PartCanvas::viewDropEvent(QDropEvent* event) // Make a backup of the current clone list, to retain any 'copy' items, // so that pasting works properly after. - CloneList copyCloneList = cloneList; + MusECore::CloneList copyCloneList = MusEGlobal::cloneList; // Clear the clone list to prevent any dangerous associations with // current non-original parts. - cloneList.clear(); + MusEGlobal::cloneList.clear(); if (type == 1) { @@ -3146,20 +3146,20 @@ void PartCanvas::viewDropEvent(QDropEvent* event) if (x < 0) x = 0; unsigned trackNo = y2pitch(event->pos().y()); - Track* track = 0; + MusECore::Track* track = 0; if (trackNo < tracks->size()) track = tracks->index(trackNo); if (track) { deselectAll(); - Undo temp=pasteAt(text, track, x); - song->applyOperationGroup(temp); + MusECore::Undo temp=pasteAt(text, track, x); + MusEGlobal::song->applyOperationGroup(temp); } } else if (type == 2) { unsigned trackNo = y2pitch(event->pos().y()); - Track* track = 0; + MusECore::Track* track = 0; if (trackNo < tracks->size()) track = tracks->index(trackNo); @@ -3178,12 +3178,12 @@ void PartCanvas::viewDropEvent(QDropEvent* event) if (!track) { // we need to create a track for this drop if (text.endsWith(".mpt", Qt::CaseInsensitive)) { - track = song->addTrack(Track::MIDI); // Add at end of list. + track = MusEGlobal::song->addTrack(MusECore::Track::MIDI); // Add at end of list. } else { - track = song->addTrack(Track::WAVE); // Add at end of list. + track = MusEGlobal::song->addTrack(MusECore::Track::WAVE); // Add at end of list. } } - if (track->type() == Track::WAVE && + if (track->type() == MusECore::Track::WAVE && (text.endsWith(".wav", Qt::CaseInsensitive) || (text.endsWith(".ogg", Qt::CaseInsensitive)))) { @@ -3191,7 +3191,7 @@ void PartCanvas::viewDropEvent(QDropEvent* event) MusEGlobal::muse->importWaveToTrack(text, tick, track); } // Changed by T356. Support mixed .mpt files. - else if ((track->isMidiTrack() || track->type() == Track::WAVE) && text.endsWith(".mpt", Qt::CaseInsensitive)) + else if ((track->isMidiTrack() || track->type() == MusECore::Track::WAVE) && text.endsWith(".mpt", Qt::CaseInsensitive)) { unsigned tick = x; MusEGlobal::muse->importPartToTrack(text, tick, track); @@ -3216,8 +3216,8 @@ void PartCanvas::viewDropEvent(QDropEvent* event) // Restore backup of the clone list, to retain any 'copy' items, // so that pasting works properly after. - cloneList.clear(); - cloneList = copyCloneList; + MusEGlobal::cloneList.clear(); + MusEGlobal::cloneList = copyCloneList; } //--------------------------------------------------------- @@ -3247,13 +3247,13 @@ void PartCanvas::drawCanvas(QPainter& p, const QRect& rect) ////////// // GRID // ////////// - QColor baseColor(MusEConfig::config.partCanvasBg.light(104)); + QColor baseColor(MusEGlobal::config.partCanvasBg.light(104)); p.setPen(baseColor); //-------------------------------- // vertical lines //------------------------------- - if (MusEConfig::config.canvasShowGrid) { + if (MusEGlobal::config.canvasShowGrid) { int bar, beat; unsigned tick; @@ -3274,17 +3274,17 @@ void PartCanvas::drawCanvas(QPainter& p, const QRect& rect) // append int noDivisors=0; - if (*_raster == MusEConfig::config.division *2) // 1/2 + if (*_raster == MusEGlobal::config.division *2) // 1/2 noDivisors=2; - else if (*_raster== MusEConfig::config.division) // 1/4 + else if (*_raster== MusEGlobal::config.division) // 1/4 noDivisors=4; - else if (*_raster==MusEConfig::config.division/2) // 1/8 + else if (*_raster==MusEGlobal::config.division/2) // 1/8 noDivisors=8; - else if (*_raster==MusEConfig::config.division/4) // 1/16 + else if (*_raster==MusEGlobal::config.division/4) // 1/16 noDivisors=16; - else if (*_raster==MusEConfig::config.division/8) // 1/16 + else if (*_raster==MusEGlobal::config.division/8) // 1/16 noDivisors=32; - else if (*_raster==MusEConfig::config.division/16) // 1/16 + else if (*_raster==MusEGlobal::config.division/16) // 1/16 noDivisors=64; int r = *_raster; @@ -3311,19 +3311,19 @@ void PartCanvas::drawCanvas(QPainter& p, const QRect& rect) // horizontal lines //-------------------------------- - TrackList* tl = song->tracks(); + MusECore::TrackList* tl = MusEGlobal::song->tracks(); //int yy = 0; int yy = -rmapy(yorg) - ypos; int th; - for (iTrack it = tl->begin(); it != tl->end(); ++it) { + for (MusECore::iTrack it = tl->begin(); it != tl->end(); ++it) { //if (yy > y + h) if (yy > my + mh) break; - Track* track = *it; + MusECore::Track* track = *it; th = track->height(); if (!th) continue; - if (MusEConfig::config.canvasShowGrid && (track->isMidiTrack() || track->type() == Track::WAVE)) // Tim. + if (MusEGlobal::config.canvasShowGrid && (track->isMidiTrack() || track->type() == MusECore::Track::WAVE)) // Tim. { p.setPen(baseColor.dark(130)); //p.drawLine(x, yy + th, x + w, yy + th); @@ -3343,9 +3343,9 @@ void PartCanvas::drawCanvas(QPainter& p, const QRect& rect) QRect r(mx, yy, mw, th); //if(r.intersects(mr)) { - if (!track->isMidiTrack() && (track->type() != Track::WAVE)) { + if (!track->isMidiTrack() && (track->type() != MusECore::Track::WAVE)) { //QRect r = rect & QRect(x, yy, w, track->height()); - drawAudioTrack(p, mr, r, (AudioTrack*)track); + drawAudioTrack(p, mr, r, (MusECore::AudioTrack*)track); //p.setPen(baseColor); } @@ -3353,9 +3353,9 @@ void PartCanvas::drawCanvas(QPainter& p, const QRect& rect) /* //p.setWorldMatrixEnabled(true); //if (!track->isMidiTrack()) { // draw automation - if (!track->isMidiTrack() && (track->type() != Track::WAVE)) { + if (!track->isMidiTrack() && (track->type() != MusECore::Track::WAVE)) { //QRect r = rect & QRect(x, yy, w, track->height()); - drawAutomation(p, r, (AudioTrack*)track); + drawAutomation(p, r, (MusECore::AudioTrack*)track); //p.setPen(baseColor); } //p.setWorldMatrixEnabled(false); @@ -3390,22 +3390,22 @@ void PartCanvas::drawTopItem(QPainter& p, const QRect& rect) int mw = mr.width(); int mh = mr.height(); - QColor baseColor(MusEConfig::config.partCanvasBg.light(104)); + QColor baseColor(MusEGlobal::config.partCanvasBg.light(104)); //p.setPen(baseColor); p.save(); p.setWorldMatrixEnabled(false); - TrackList* tl = song->tracks(); + MusECore::TrackList* tl = MusEGlobal::song->tracks(); int yoff = -rmapy(yorg) - ypos; //int yy = 0; int yy = yoff; int th; - for (iTrack it = tl->begin(); it != tl->end(); ++it) { + for (MusECore::iTrack it = tl->begin(); it != tl->end(); ++it) { //if (yy > y + h) if (yy > my + mh) break; - Track* track = *it; + MusECore::Track* track = *it; th = track->height(); if (!th) continue; @@ -3414,7 +3414,7 @@ void PartCanvas::drawTopItem(QPainter& p, const QRect& rect) QRect r(mx, yy, mw, th); if(r.intersects(mr)) { - drawAutomation(p, r, (AudioTrack*)track); + drawAutomation(p, r, (MusECore::AudioTrack*)track); //p.setPen(baseColor); } } @@ -3422,18 +3422,18 @@ void PartCanvas::drawTopItem(QPainter& p, const QRect& rect) yy += th; } - unsigned int startPos = audio->getStartRecordPos().tick(); - if (song->punchin()) - startPos=song->lpos(); + unsigned int startPos = MusEGlobal::audio->getStartRecordPos().tick(); + if (MusEGlobal::song->punchin()) + startPos=MusEGlobal::song->lpos(); int startx = mapx(startPos); - int width = mapx(song->cpos()) - mapx(startPos); + int width = mapx(MusEGlobal::song->cpos()) - mapx(startPos); - if (song->cpos() < startPos) { + if (MusEGlobal::song->cpos() < startPos) { //p.setWorldMatrixEnabled(true); p.restore(); return; // no drawing if we are before punch out } - if (song->punchout() && song->cpos() > song->rpos()) { + if (MusEGlobal::song->punchout() && MusEGlobal::song->cpos() > MusEGlobal::song->rpos()) { //p.setWorldMatrixEnabled(true); p.restore(); return; // no drawing if we are beyond punch out. @@ -3446,17 +3446,17 @@ void PartCanvas::drawTopItem(QPainter& p, const QRect& rect) // should be enhanced with solution that draws waveform also //int yPos=0; int yPos = yoff; - if (song->record() && audio->isPlaying()) { - for (iTrack it = tl->begin(); it != tl->end(); ++it) { - Track* track = *it; + if (MusEGlobal::song->record() && MusEGlobal::audio->isPlaying()) { + for (MusECore::iTrack it = tl->begin(); it != tl->end(); ++it) { + MusECore::Track* track = *it; th = track->height(); if (!th) continue; if (track->recordFlag()) { QPen pen(Qt::black, 0, Qt::SolidLine); p.setPen(pen); - QColor c(MusEConfig::config.partColors[0]); - c.setAlpha(MusEConfig::config.globalAlphaBlend); + QColor c(MusEGlobal::config.partColors[0]); + c.setAlpha(MusEGlobal::config.globalAlphaBlend); QLinearGradient gradient(QPoint(startx,yPos), QPoint(startx,yPos+th)); gradient.setColorAt(0, c); gradient.setColorAt(1, c.darker()); @@ -3473,31 +3473,31 @@ void PartCanvas::drawTopItem(QPainter& p, const QRect& rect) // draw midi events on yPos=0; - if (song->record() && audio->isPlaying()) { - for (iTrack it = tl->begin(); it != tl->end(); ++it) { - Track* track = *it; + if (MusEGlobal::song->record() && MusEGlobal::audio->isPlaying()) { + for (MusECore::iTrack it = tl->begin(); it != tl->end(); ++it) { + MusECore::Track* track = *it; if (track->isMidiTrack() && track->recordFlag()) { - MidiTrack *mt = (MidiTrack*)track; - QRect partRect(startPos,yPos, song->cpos()-startPos, track->height()); // probably the wrong rect - EventList myEventList; - MPEventList *el = mt->mpevents(); + MusECore::MidiTrack *mt = (MusECore::MidiTrack*)track; + QRect partRect(startPos,yPos, MusEGlobal::song->cpos()-startPos, track->height()); // probably the wrong rect + MusECore::EventList myEventList; + MusECore::MPEventList *el = mt->mpevents(); if (el->size()) { - for (iMPEvent i = el->begin(); i != el->end(); ++i) { - MidiPlayEvent pe = *i; + for (MusECore::iMPEvent i = el->begin(); i != el->end(); ++i) { + MusECore::MidiPlayEvent pe = *i; if (pe.isNote() && !pe.isNoteOff()) { - Event e(Note); + MusECore::Event e(MusECore::Note); e.setPitch(pe.dataA()); e.setTick(pe.time()-startPos); - e.setLenTick(song->cpos()-pe.time()); + e.setLenTick(MusEGlobal::song->cpos()-pe.time()); e.setC(1); // we abuse this value to determine that this note hasn't been concluded myEventList.add(e); } else if (pe.isNoteOff()) { - for (iEvent i = myEventList.begin(); i != myEventList.end(); ++i) { - Event &e = i->second; + for (MusECore::iEvent i = myEventList.begin(); i != myEventList.end(); ++i) { + MusECore::Event &e = i->second; if (e.pitch() == pe.dataA() && e.dataC() == 1) { e.setLenTick(pe.time() - e.tick()- startPos); e.setC(0); // reset the variable we borrowed for state handling @@ -3507,7 +3507,7 @@ void PartCanvas::drawTopItem(QPainter& p, const QRect& rect) } } } - drawMidiPart(p, rect, &myEventList, mt, 0, partRect,startPos,0,song->cpos()-startPos); + drawMidiPart(p, rect, &myEventList, mt, 0, partRect,startPos,0,MusEGlobal::song->cpos()-startPos); } yPos+=track->height(); } @@ -3518,7 +3518,7 @@ void PartCanvas::drawTopItem(QPainter& p, const QRect& rect) //--------------------------------------------------------- // drawAudioTrack //--------------------------------------------------------- -void PartCanvas::drawAudioTrack(QPainter& p, const QRect& r, const QRect& bbox, AudioTrack* /*t*/) +void PartCanvas::drawAudioTrack(QPainter& p, const QRect& r, const QRect& bbox, MusECore::AudioTrack* /*t*/) { QRect mr = r & bbox; if(mr.isNull()) @@ -3534,7 +3534,7 @@ void PartCanvas::drawAudioTrack(QPainter& p, const QRect& r, const QRect& bbox, p.setPen(Qt::black); QColor c(Qt::gray); - c.setAlpha(MusEConfig::config.globalAlphaBlend); + c.setAlpha(MusEGlobal::config.globalAlphaBlend); //QLinearGradient gradient(r.topLeft(), r.bottomLeft()); QLinearGradient gradient(mex + 1, mey + 1, mex + 1, mey + meh - 1); // Inside the border gradient.setColorAt(0, c); @@ -3563,7 +3563,7 @@ void PartCanvas::drawAudioTrack(QPainter& p, const QRect& r, const QRect& bbox, // drawAutomation //--------------------------------------------------------- -void PartCanvas::drawAutomation(QPainter& p, const QRect& rr, AudioTrack *t) +void PartCanvas::drawAutomation(QPainter& p, const QRect& rr, MusECore::AudioTrack *t) { //QRect rr = p.worldMatrix().mapRect(r); //p.save(); @@ -3576,13 +3576,13 @@ void PartCanvas::drawAutomation(QPainter& p, const QRect& rr, AudioTrack *t) p.setBrush(Qt::NoBrush); - CtrlListList* cll = t->controller(); - for(CtrlListList::iterator icll =cll->begin();icll!=cll->end();++icll) + MusECore::CtrlListList* cll = t->controller(); + for(MusECore::CtrlListList::iterator icll =cll->begin();icll!=cll->end();++icll) { - CtrlList *cl = icll->second; + MusECore::CtrlList *cl = icll->second; if (cl->dontShow() || !cl->isVisible()) continue; - iCtrl ic=cl->begin(); + MusECore::iCtrl ic=cl->begin(); int oldX = mapx(0); if(rr.right() < oldX) { @@ -3594,8 +3594,8 @@ void PartCanvas::drawAutomation(QPainter& p, const QRect& rr, AudioTrack *t) int ypixel = oldY; double min, max; cl->range(&min,&max); - //bool discrete = cl->valueType() == VAL_BOOL || cl->mode() == CtrlList::DISCRETE; - bool discrete = cl->mode() == CtrlList::DISCRETE; + //bool discrete = cl->valueType() == VAL_BOOL || cl->mode() == MusECore::CtrlList::DISCRETE; + bool discrete = cl->mode() == MusECore::CtrlList::DISCRETE; QPen pen1(cl->color(), 0); QPen pen2(cl->color(), 2); pen2.setCosmetic(true); @@ -3604,7 +3604,7 @@ void PartCanvas::drawAutomation(QPainter& p, const QRect& rr, AudioTrack *t) if (ic == cl->end()) { double y; - if (cl->valueType() == VAL_LOG ) { // use db scale for volume + if (cl->valueType() == MusECore::VAL_LOG ) { // use db scale for volume y = dbToVal(cl->curVal()); // represent volume between 0 and 1 if (y < 0) y = 0.0; } @@ -3617,7 +3617,7 @@ void PartCanvas::drawAutomation(QPainter& p, const QRect& rr, AudioTrack *t) for (; ic !=cl->end(); ++ic) { double y = ic->second.val; - if (cl->valueType() == VAL_LOG ) { // use db scale for volume + if (cl->valueType() == MusECore::VAL_LOG ) { // use db scale for volume y = dbToVal(y); // represent volume between 0 and 1 if (y < 0) y = 0.0; } @@ -3625,7 +3625,7 @@ void PartCanvas::drawAutomation(QPainter& p, const QRect& rr, AudioTrack *t) y = (y-min)/(max-min); // we need to set curVal between 0 and 1 ypixel = bottom - rmapy_f(y) * height; - xpixel = mapx(tempomap.frame2tick(ic->second.frame)); + xpixel = mapx(MusEGlobal::tempomap.frame2tick(ic->second.frame)); if (oldY==-1) oldY = ypixel; @@ -3643,8 +3643,8 @@ void PartCanvas::drawAutomation(QPainter& p, const QRect& rr, AudioTrack *t) break; // draw a square around the point - //p.drawRect(mapx(tempomap.frame2tick(prevPosFrame))-2, (rr.bottom()-2)-prevVal*height-2, 5, 5); - //p.drawRect(mapx(tempomap.frame2tick(prevPosFrame))-1, (rr.bottom()-1)-prevVal*height-2, 3, 3); + //p.drawRect(mapx(MusEGlobal::tempomap.frame2tick(prevPosFrame))-2, (rr.bottom()-2)-prevVal*height-2, 5, 5); + //p.drawRect(mapx(MusEGlobal::tempomap.frame2tick(prevPosFrame))-1, (rr.bottom()-1)-prevVal*height-2, 3, 3); pen2.setColor((automation.currentCtrlValid && automation.currentCtrlList == cl && automation.currentCtrlFrame == ic->second.frame) ? Qt::white : cl->color()); @@ -3677,7 +3677,7 @@ void PartCanvas::drawAutomation(QPainter& p, const QRect& rr, AudioTrack *t) // controller added. //--------------------------------------------------------- -void PartCanvas::checkAutomation(Track * t, const QPoint &pointer, bool addNewCtrl) +void PartCanvas::checkAutomation(MusECore::Track * t, const QPoint &pointer, bool addNewCtrl) { if (t->isMidiTrack()) return; @@ -3694,14 +3694,14 @@ void PartCanvas::checkAutomation(Track * t, const QPoint &pointer, bool addNewCt int currX = mapx(pointer.x()); int circumference = 5; - CtrlListList* cll = ((AudioTrack*) t)->controller(); - for(CtrlListList::iterator icll =cll->begin();icll!=cll->end();++icll) + MusECore::CtrlListList* cll = ((MusECore::AudioTrack*) t)->controller(); + for(MusECore::CtrlListList::iterator icll =cll->begin();icll!=cll->end();++icll) { - CtrlList *cl = icll->second; + MusECore::CtrlList *cl = icll->second; if (cl->dontShow() || !cl->isVisible()) { continue; } - iCtrl ic=cl->begin(); + MusECore::iCtrl ic=cl->begin(); int oldX = mapx(0); int xpixel = oldX; @@ -3709,14 +3709,14 @@ void PartCanvas::checkAutomation(Track * t, const QPoint &pointer, bool addNewCt int ypixel = oldY; double min, max; cl->range(&min,&max); - //bool discrete = cl->valueType() == VAL_BOOL || cl->mode() == CtrlList::DISCRETE; // Tim - bool discrete = cl->mode() == CtrlList::DISCRETE; + //bool discrete = cl->valueType() == VAL_BOOL || cl->mode() == MusECore::CtrlList::DISCRETE; // Tim + bool discrete = cl->mode() == MusECore::CtrlList::DISCRETE; // First check that there IS automation, ic == cl->end means no automation if (ic == cl->end()) { double y; - if (cl->valueType() == VAL_LOG ) { // use db scale for volume + if (cl->valueType() == MusECore::VAL_LOG ) { // use db scale for volume y = dbToVal(cl->curVal()); // represent volume between 0 and 1 if (y < 0) y = 0.0; } @@ -3729,7 +3729,7 @@ void PartCanvas::checkAutomation(Track * t, const QPoint &pointer, bool addNewCt for (; ic !=cl->end(); ic++) { double y = ic->second.val; - if (cl->valueType() == VAL_LOG ) { // use db scale for volume + if (cl->valueType() == MusECore::VAL_LOG ) { // use db scale for volume y = dbToVal(y); // represent volume between 0 and 1 if (y < 0) y = 0; } @@ -3737,7 +3737,7 @@ void PartCanvas::checkAutomation(Track * t, const QPoint &pointer, bool addNewCt y = (y-min)/(max-min); // we need to set curVal between 0 and 1 ypixel = mapy(trackY + trackH - 2 - y * trackH); - xpixel = mapx(tempomap.frame2tick(ic->second.frame)); + xpixel = mapx(MusEGlobal::tempomap.frame2tick(ic->second.frame)); if (oldY==-1) oldY = ypixel; //printf(" oldX:%d oldY:%d xpixel:%d ypixel:%d\n", oldX, oldY, xpixel, ypixel); @@ -3829,7 +3829,7 @@ void PartCanvas::checkAutomation(Track * t, const QPoint &pointer, bool addNewCt setCursor(); } -void PartCanvas::controllerChanged(Track* t) +void PartCanvas::controllerChanged(MusECore::Track* t) { //redraw(); redraw((QRect(0, mapy(t->y()), width(), rmapy(t->height())))); // TODO Check this - correct? @@ -3838,10 +3838,10 @@ void PartCanvas::controllerChanged(Track* t) void PartCanvas::processAutomationMovements(QPoint pos, bool addPoint) { - if (_tool == MusEWidget::AutomationTool) { + if (_tool == AutomationTool) { if (!automation.moveController) { // currently nothing going lets's check for some action. - Track * t = y2Track(pos.y()); + MusECore::Track * t = y2Track(pos.y()); if (t) { checkAutomation(t, pos, addPoint); } @@ -3857,14 +3857,14 @@ void PartCanvas::processAutomationMovements(QPoint pos, bool addPoint) if (automation.controllerState == addNewController) { //printf("adding a new ctrler!\n"); - int frame = tempomap.tick2frame(pos.x()); + int frame = MusEGlobal::tempomap.tick2frame(pos.x()); // FIXME Inefficient to add with wait here, then remove and add with wait again below. Tim. - audio->msgAddACEvent((AudioTrack*)automation.currentTrack, automation.currentCtrlList->id(), frame, 1.0 /*dummy value */); - //song->addACEvent((AudioTrack*)automation.currentTrack, automation.currentCtrlList->id(), frame, 1.0 /*dummy value */); + MusEGlobal::audio->msgAddACEvent((MusECore::AudioTrack*)automation.currentTrack, automation.currentCtrlList->id(), frame, 1.0 /*dummy value */); + //MusEGlobal::song->addACEvent((MusECore::AudioTrack*)automation.currentTrack, automation.currentCtrlList->id(), frame, 1.0 /*dummy value */); - iCtrl ic=automation.currentCtrlList->begin(); + MusECore::iCtrl ic=automation.currentCtrlList->begin(); for (; ic !=automation.currentCtrlList->end(); ++ic) { - CtrlVal &cv = ic->second; + MusECore::CtrlVal &cv = ic->second; if (cv.frame == frame) { //automation.currentCtrl = &cv; automation.currentCtrlFrame = cv.frame; @@ -3877,11 +3877,11 @@ void PartCanvas::processAutomationMovements(QPoint pos, bool addPoint) } // get previous and next frame position to give x bounds for this event. - iCtrl ic=automation.currentCtrlList->begin(); - iCtrl iprev = ic; + MusECore::iCtrl ic=automation.currentCtrlList->begin(); + MusECore::iCtrl iprev = ic; for (; ic !=automation.currentCtrlList->end(); ++ic) { - CtrlVal &cv = ic->second; + MusECore::CtrlVal &cv = ic->second; //if (&cv == automation.currentCtrl) if (cv.frame == automation.currentCtrlFrame) { @@ -3892,17 +3892,17 @@ void PartCanvas::processAutomationMovements(QPoint pos, bool addPoint) iprev = ic; } - iCtrl icc = ic; + MusECore::iCtrl icc = ic; if ( ++ic != automation.currentCtrlList->end()) { - CtrlVal &cv = ic->second; + MusECore::CtrlVal &cv = ic->second; nextFrame = cv.frame; } // A perfectly straight vertical line (two points with same frame) is impossible: // there is only one value at t, and the next value at t+1, and so on. // Also these are maps, not multimaps. p4.0.32 Tim. - int newFrame = tempomap.tick2frame(pos.x()); + int newFrame = MusEGlobal::tempomap.tick2frame(pos.x()); //if(currFrame == 0) // newFrame = 0; // Force first item to stay at x = 0. //else @@ -3921,7 +3921,7 @@ void PartCanvas::processAutomationMovements(QPoint pos, bool addPoint) double min, max; automation.currentCtrlList->range(&min,&max); double cvval; - if (automation.currentCtrlList->valueType() == VAL_LOG ) { // use db scale for volume + if (automation.currentCtrlList->valueType() == MusECore::VAL_LOG ) { // use db scale for volume cvval = valToDb(yfraction); //printf("calc yfraction = %f v=%f ",yfraction,cvval); if (cvval< min) cvval=min; @@ -3932,7 +3932,7 @@ void PartCanvas::processAutomationMovements(QPoint pos, bool addPoint) cvval = yfraction * (max-min) + min; // 'Snap' to integer or boolean //if (automation.currentCtrlList->valueType() == VAL_INT || automation.currentCtrlList->valueType() == VAL_BOOL) - if (automation.currentCtrlList->mode() == CtrlList::DISCRETE) + if (automation.currentCtrlList->mode() == MusECore::CtrlList::DISCRETE) cvval = rint(cvval + 0.1); // LADSPA docs say add a slight bias to avoid rounding errors. Try this. if (cvval< min) cvval=min; if (cvval>max) cvval=max; @@ -3943,11 +3943,11 @@ void PartCanvas::processAutomationMovements(QPoint pos, bool addPoint) automation.currentCtrlValid = true; if(icc != automation.currentCtrlList->end()) - audio->msgChangeACEvent((AudioTrack*)automation.currentTrack, automation.currentCtrlList->id(), icc->second.frame, newFrame, cvval); - //song->changeACEvent((AudioTrack*)automation.currentTrack, automation.currentCtrlList->id(), icc->second.frame, newFrame, cvval); + MusEGlobal::audio->msgChangeACEvent((MusECore::AudioTrack*)automation.currentTrack, automation.currentCtrlList->id(), icc->second.frame, newFrame, cvval); + //MusEGlobal::song->changeACEvent((MusECore::AudioTrack*)automation.currentTrack, automation.currentCtrlList->id(), icc->second.frame, newFrame, cvval); else - audio->msgAddACEvent((AudioTrack*)automation.currentTrack, automation.currentCtrlList->id(), newFrame, cvval); - //song->addACEvent((AudioTrack*)automation.currentTrack, automation.currentCtrlList->id(), newFrame, cvval); + MusEGlobal::audio->msgAddACEvent((MusECore::AudioTrack*)automation.currentTrack, automation.currentCtrlList->id(), newFrame, cvval); + //MusEGlobal::song->addACEvent((MusECore::AudioTrack*)automation.currentTrack, automation.currentCtrlList->id(), newFrame, cvval); // Not needed. Redraw is now handled by msgXXX(). //controllerChanged(automation.currentTrack); @@ -3957,7 +3957,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) { @@ -3988,4 +3988,4 @@ void PartCanvas::endMoveItems(const QPoint& pos, DragType dragtype, int dir) redraw(); } -} // namespace MusEArranger +} // namespace MusEGui diff --git a/muse2/muse/arranger/pcanvas.h b/muse2/muse/arranger/pcanvas.h index e0c601fe..8a108055 100644 --- a/muse2/muse/arranger/pcanvas.h +++ b/muse2/muse/arranger/pcanvas.h @@ -37,15 +37,18 @@ class QKeyEvent; class QEvent; class QDragEnterEvent; class QLineEdit; - -class MidiEditor; class QMenu; -class Xml; + +namespace MusECore { class CtrlVal; +class Xml; +} #define beats 4 -namespace MusEArranger { +namespace MusEGui { + +class MidiEditor; //--------------------------------------------------------- // NPart @@ -54,12 +57,12 @@ namespace MusEArranger { // for displaying //--------------------------------------------------------- -class NPart : public MusEWidget::CItem { +class NPart : public CItem { public: - NPart(Part* e); + NPart(MusECore::Part* e); const QString name() const { return part()->name(); } void setName(const QString& s) { part()->setName(s); } - Track* track() const { return part()->track(); } + MusECore::Track* track() const { return part()->track(); } bool leftBorderTouches; // Whether the borders touch other part borders. bool rightBorderTouches; @@ -67,11 +70,11 @@ class NPart : public MusEWidget::CItem { enum ControllerVals { doNothing, movingController, addNewController }; struct AutomationObject { - //CtrlVal *currentCtrl; + //MusECore::CtrlVal *currentCtrl; int currentCtrlFrame; bool currentCtrlValid; - CtrlList *currentCtrlList; - Track *currentTrack; + MusECore::CtrlList *currentCtrlList; + MusECore::Track *currentTrack; bool moveController; ControllerVals controllerState; }; @@ -80,12 +83,12 @@ struct AutomationObject { // PartCanvas //--------------------------------------------------------- -class PartCanvas : public MusEWidget::Canvas { +class PartCanvas : public Canvas { Q_OBJECT int* _raster; - TrackList* tracks; + MusECore::TrackList* tracks; - Part* resizePart; + MusECore::Part* resizePart; QLineEdit* lineEditor; NPart* editPart; int curColorIndex; @@ -101,46 +104,46 @@ class PartCanvas : public MusEWidget::Canvas { virtual void mouseRelease(const QPoint&); virtual void viewMouseDoubleClickEvent(QMouseEvent*); virtual void leaveEvent(QEvent*e); - virtual void drawItem(QPainter&, const MusEWidget::CItem*, const QRect&); - virtual void drawMoving(QPainter&, const MusEWidget::CItem*, const QRect&); + virtual void drawItem(QPainter&, const CItem*, const QRect&); + virtual void drawMoving(QPainter&, const CItem*, const QRect&); virtual void updateSelection(); virtual QPoint raster(const QPoint&) const; virtual int y2pitch(int y) const; virtual int pitch2y(int p) const; - virtual MusEWidget::CItem* newItem(const QPoint&, int); - virtual void resizeItem(MusEWidget::CItem*,bool, bool ctrl); - virtual void newItem(MusEWidget::CItem*,bool); - virtual bool deleteItem(MusEWidget::CItem*); - virtual void moveCanvasItems(MusEWidget::CItemList&, int, int, DragType); - virtual UndoOp moveItem(MusEWidget::CItem*, const QPoint&, DragType); + virtual CItem* newItem(const QPoint&, int); + virtual void resizeItem(CItem*,bool, bool ctrl); + virtual void newItem(CItem*,bool); + virtual bool deleteItem(CItem*); + virtual void moveCanvasItems(CItemList&, int, int, DragType); + virtual MusECore::UndoOp moveItem(CItem*, const QPoint&, DragType); virtual void updateSong(DragType, int); - virtual void startDrag(MusEWidget::CItem*, DragType); + virtual void startDrag(CItem*, DragType); virtual void dragEnterEvent(QDragEnterEvent*); virtual void viewDropEvent(QDropEvent*); - virtual QMenu* genItemPopup(MusEWidget::CItem*); - virtual void itemPopup(MusEWidget::CItem*, int, const QPoint&); + virtual QMenu* genItemPopup(CItem*); + virtual void itemPopup(CItem*, int, const QPoint&); - void glueItem(MusEWidget::CItem* item); - void splitItem(MusEWidget::CItem* item, const QPoint&); + void glueItem(CItem* item); + void splitItem(CItem* item, const QPoint&); - void copy(PartList*); - void copy_in_range(PartList*); + void copy(MusECore::PartList*); + void copy_in_range(MusECore::PartList*); enum paste_mode_t { PASTEMODE_MIX, PASTEMODE_MOVEALL, PASTEMODE_MOVESOME }; void paste(bool clone = false, paste_mode_t paste_mode = PASTEMODE_MIX, bool to_single_track=false, int amount=1, int raster=1536); - Undo pasteAt(const QString&, Track*, unsigned int, bool clone = false, bool toTrack = true, int* finalPosPtr = NULL, std::set<Track*>* affected_tracks = NULL); - //Part* readClone(Xml&, Track*, bool toTrack = true); - void drawWavePart(QPainter&, const QRect&, WavePart*, const QRect&); - //void drawMidiPart(QPainter&, const QRect& rect, EventList* events, MidiTrack*mt, const QRect& r, int pTick, int from, int to); - void drawMidiPart(QPainter&, const QRect& rect, EventList* events, MidiTrack*mt, MidiPart*pt, const QRect& r, int pTick, int from, int to); - Track* y2Track(int) const; - void drawAudioTrack(QPainter& p, const QRect& r, const QRect& bbox, AudioTrack* track); - void drawAutomation(QPainter& p, const QRect& r, AudioTrack* track); + MusECore::Undo pasteAt(const QString&, MusECore::Track*, unsigned int, bool clone = false, bool toTrack = true, int* finalPosPtr = NULL, std::set<MusECore::Track*>* affected_tracks = NULL); + //MusECore::Part* readClone(MusECore::Xml&, MusECore::Track*, bool toTrack = true); + void drawWavePart(QPainter&, const QRect&, MusECore::WavePart*, const QRect&); + //void drawMidiPart(QPainter&, const QRect& rect, MusECore::EventList* events, MusECore::MidiTrack*mt, const QRect& r, int pTick, int from, int to); + void drawMidiPart(QPainter&, const QRect& rect, MusECore::EventList* events, MusECore::MidiTrack*mt, MusECore::MidiPart*pt, const QRect& r, int pTick, int from, int to); + MusECore::Track* y2Track(int) const; + void drawAudioTrack(QPainter& p, const QRect& r, const QRect& bbox, MusECore::AudioTrack* track); + void drawAutomation(QPainter& p, const QRect& r, MusECore::AudioTrack* track); void drawTopItem(QPainter& p, const QRect& rect); - void checkAutomation(Track * t, const QPoint& pointer, bool addNewCtrl); + void checkAutomation(MusECore::Track * t, const QPoint& pointer, bool addNewCtrl); void processAutomationMovements(QPoint pos, bool addPoint); double dbToVal(double inDb); double valToDb(double inV); @@ -152,16 +155,16 @@ class PartCanvas : public MusEWidget::Canvas { signals: void timeChanged(unsigned); void tracklistChanged(); - void dclickPart(Track*); + void dclickPart(MusECore::Track*); void selectionChanged(); void dropSongFile(const QString&); void dropMidiFile(const QString&); void setUsedTool(int); - void trackChanged(Track*); + void trackChanged(MusECore::Track*); void selectTrackAbove(); void selectTrackBelow(); - void startEditor(PartList*, int); + void startEditor(MusECore::PartList*, int); private slots: void returnPressed(); @@ -176,10 +179,10 @@ class PartCanvas : public MusEWidget::Canvas { void cmd(int); public slots: void redirKeypress(QKeyEvent* e) { keyPress(e); } - void controllerChanged(Track *t); + void controllerChanged(MusECore::Track *t); }; -} // namespace MusEArranger +} // namespace MusEGui #endif diff --git a/muse2/muse/arranger/tlist.cpp b/muse2/muse/arranger/tlist.cpp index 73c8eec7..be33808e 100644 --- a/muse2/muse/arranger/tlist.cpp +++ b/muse2/muse/arranger/tlist.cpp @@ -67,7 +67,7 @@ #include "dssihost.h" #endif -namespace MusEArranger { +namespace MusEGui { static const int MIN_TRACKHEIGHT = 20; static const int WHEEL_DELTA = 120; @@ -77,7 +77,7 @@ QColor collist[] = { Qt::red, Qt::yellow, Qt::blue , Qt::black, Qt::white, Qt::g // TList //--------------------------------------------------------- -TList::TList(MusEWidget::Header* hdr, QWidget* parent, const char* name) +TList::TList(Header* hdr, QWidget* parent, const char* name) : QWidget(parent) // Qt::WNoAutoErase | Qt::WResizeNoErase are no longer needed according to Qt4 doc { setBackgroundRole(QPalette::NoRole); @@ -104,7 +104,7 @@ TList::TList(MusEWidget::Header* hdr, QWidget* parent, const char* name) //setAttribute(Qt::WA_OpaquePaintEvent); resizeFlag = false; - connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); + connect(MusEGlobal::song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); connect(MusEGlobal::muse, SIGNAL(configChanged()), SLOT(redraw())); } @@ -170,7 +170,7 @@ void TList::paint(const QRect& r) QPainter p(this); if (bgPixmap.isNull()) - p.fillRect(rect, MusEConfig::config.trackBg); + p.fillRect(rect, MusEGlobal::config.trackBg); else p.drawTiledPixmap(rect, bgPixmap, QPoint(rect.x(), ypos + rect.y())); p.setClipRegion(rect); @@ -197,12 +197,12 @@ void TList::paint(const QRect& r) mask.setColorAt(1, mask_edge); - TrackList* l = song->tracks(); + MusECore::TrackList* l = MusEGlobal::song->tracks(); int idx = 0; int yy = -ypos; - for (iTrack i = l->begin(); i != l->end(); ++idx, yy += (*i)->height(), ++i) { - Track* track = *i; - Track::TrackType type = track->type(); + for (MusECore::iTrack i = l->begin(); i != l->end(); ++idx, yy += (*i)->height(), ++i) { + MusECore::Track* track = *i; + MusECore::Track::TrackType type = track->type(); int trackHeight = track->height(); if (trackHeight==0) // not visible continue; @@ -215,37 +215,37 @@ void TList::paint(const QRect& r) // QColor bg; if (track->selected()) { - bg = MusEConfig::config.selectTrackBg; - p.setPen(MusEConfig::config.selectTrackFg); + bg = MusEGlobal::config.selectTrackBg; + p.setPen(MusEGlobal::config.selectTrackFg); } else { switch(type) { - case Track::MIDI: - bg = MusEConfig::config.midiTrackBg; + case MusECore::Track::MIDI: + bg = MusEGlobal::config.midiTrackBg; break; - case Track::DRUM: - bg = MusEConfig::config.drumTrackBg; + case MusECore::Track::DRUM: + bg = MusEGlobal::config.drumTrackBg; break; - case Track::NEW_DRUM: - bg = MusEConfig::config.newDrumTrackBg; + case MusECore::Track::NEW_DRUM: + bg = MusEGlobal::config.newDrumTrackBg; break; - case Track::WAVE: - bg = MusEConfig::config.waveTrackBg; + case MusECore::Track::WAVE: + bg = MusEGlobal::config.waveTrackBg; break; - case Track::AUDIO_OUTPUT: - bg = MusEConfig::config.outputTrackBg; + case MusECore::Track::AUDIO_OUTPUT: + bg = MusEGlobal::config.outputTrackBg; break; - case Track::AUDIO_INPUT: - bg = MusEConfig::config.inputTrackBg; + case MusECore::Track::AUDIO_INPUT: + bg = MusEGlobal::config.inputTrackBg; break; - case Track::AUDIO_GROUP: - bg = MusEConfig::config.groupTrackBg; + case MusECore::Track::AUDIO_GROUP: + bg = MusEGlobal::config.groupTrackBg; break; - case Track::AUDIO_AUX: - bg = MusEConfig::config.auxTrackBg; + case MusECore::Track::AUDIO_AUX: + bg = MusEGlobal::config.auxTrackBg; break; - case Track::AUDIO_SOFTSYNTH: - bg = MusEConfig::config.synthTrackBg; + case MusECore::Track::AUDIO_SOFTSYNTH: + bg = MusEGlobal::config.synthTrackBg; break; } @@ -281,29 +281,29 @@ void TList::paint(const QRect& r) break; const QPixmap* pm = 0; switch(type) { - case Track::MIDI: + case MusECore::Track::MIDI: pm = addtrack_addmiditrackIcon; break; - case Track::NEW_DRUM: - case Track::DRUM: + case MusECore::Track::NEW_DRUM: + case MusECore::Track::DRUM: pm = addtrack_drumtrackIcon; break; - case Track::WAVE: + case MusECore::Track::WAVE: pm = addtrack_wavetrackIcon; break; - case Track::AUDIO_OUTPUT: + case MusECore::Track::AUDIO_OUTPUT: pm = addtrack_audiooutputIcon; break; - case Track::AUDIO_INPUT: + case MusECore::Track::AUDIO_INPUT: pm = addtrack_audioinputIcon; break; - case Track::AUDIO_GROUP: + case MusECore::Track::AUDIO_GROUP: pm = addtrack_audiogroupIcon; break; - case Track::AUDIO_AUX: + case MusECore::Track::AUDIO_AUX: pm = addtrack_auxsendIcon; break; - case Track::AUDIO_SOFTSYNTH: + case MusECore::Track::AUDIO_SOFTSYNTH: //pm = waveIcon; pm = synthIcon; break; @@ -340,16 +340,16 @@ void TList::paint(const QRect& r) { QString s; int n; - if (track->isMidiTrack() && track->type() == Track::DRUM) { + if (track->isMidiTrack() && track->type() == MusECore::Track::DRUM) { p.drawText(r, Qt::AlignVCenter|Qt::AlignHCenter, "-"); break; } else if (track->isMidiTrack()) { - n = ((MidiTrack*)track)->outChannel() + 1; + n = ((MusECore::MidiTrack*)track)->outChannel() + 1; } else { // show number of ports - n = ((WaveTrack*)track)->channels(); + n = ((MusECore::WaveTrack*)track)->channels(); } s.setNum(n); p.drawText(r, Qt::AlignVCenter|Qt::AlignHCenter, s); @@ -359,20 +359,20 @@ void TList::paint(const QRect& r) { QString s; if (track->isMidiTrack()) { - int outport = ((MidiTrack*)track)->outPort(); - s.sprintf("%d:%s", outport+1, midiPorts[outport].portname().toLatin1().constData()); + int outport = ((MusECore::MidiTrack*)track)->outPort(); + s.sprintf("%d:%s", outport+1, MusEGlobal::midiPorts[outport].portname().toLatin1().constData()); } // Added by Tim. p3.3.9 else - if(track->type() == Track::AUDIO_SOFTSYNTH) + if(track->type() == MusECore::Track::AUDIO_SOFTSYNTH) { - MidiDevice* md = dynamic_cast<MidiDevice*>(track); + MusECore::MidiDevice* md = dynamic_cast<MusECore::MidiDevice*>(track); if(md) { int outport = md->midiPort(); if((outport >= 0) && (outport < MIDI_PORTS)) - s.sprintf("%d:%s", outport+1, midiPorts[outport].portname().toLatin1().constData()); + s.sprintf("%d:%s", outport+1, MusEGlobal::midiPorts[outport].portname().toLatin1().constData()); else s = tr("<none>"); } @@ -386,16 +386,16 @@ void TList::paint(const QRect& r) QString s="-"; if (!track->isMidiTrack()) { - CtrlListList* cll = ((AudioTrack*)track)->controller(); + MusECore::CtrlListList* cll = ((MusECore::AudioTrack*)track)->controller(); int countAll=0, countVisible=0; - for(CtrlListList::iterator icll =cll->begin();icll!=cll->end();++icll) { - CtrlList *cl = icll->second; + for(MusECore::CtrlListList::iterator icll =cll->begin();icll!=cll->end();++icll) { + MusECore::CtrlList *cl = icll->second; if (!cl->dontShow()) countAll++; if (cl->isVisible()) countVisible++; } - //int count = ((AudioTrack*)track)->controller()->size(); //commented out by flo: gives a "unused variable" warning + //int count = ((MusECore::AudioTrack*)track)->controller()->size(); //commented out by flo: gives a "unused variable" warning s.sprintf(" %d(%d) visible",countVisible, countAll); } @@ -404,13 +404,13 @@ void TList::paint(const QRect& r) } break; case COL_CLEF: - if (track->isMidiTrack() && track->type() == Track::MIDI) { // no drum tracks! + if (track->isMidiTrack() && track->type() == MusECore::Track::MIDI) { // no drum tracks! QString s = tr("no clef"); - if (((MidiTrack*)track)->getClef() == trebleClef) + if (((MusECore::MidiTrack*)track)->getClef() == trebleClef) s=tr("Treble"); - else if (((MidiTrack*)track)->getClef() == bassClef) + else if (((MusECore::MidiTrack*)track)->getClef() == bassClef) s=tr("Bass"); - else if (((MidiTrack*)track)->getClef() == grandStaff) + else if (((MusECore::MidiTrack*)track)->getClef() == grandStaff) s=tr("Grand"); p.drawText(r, Qt::AlignVCenter|Qt::AlignLeft, s); } @@ -454,8 +454,8 @@ void TList::returnPressed() { editor->hide(); if (editor->text() != editTrack->name()) { - TrackList* tl = song->tracks(); - for (iTrack i = tl->begin(); i != tl->end(); ++i) { + MusECore::TrackList* tl = MusEGlobal::song->tracks(); + for (MusECore::iTrack i = tl->begin(); i != tl->end(); ++i) { if ((*i)->name() == editor->text()) { QMessageBox::critical(this, tr("MusE: bad trackname"), @@ -468,10 +468,10 @@ void TList::returnPressed() return; } } - //Track* track = editTrack->clone(); - Track* track = editTrack->clone(false); + //MusECore::Track* track = editTrack->clone(); + MusECore::Track* track = editTrack->clone(false); editTrack->setName(editor->text()); - audio->msgChangeTrack(track, editTrack); + MusEGlobal::audio->msgChangeTrack(track, editTrack); } editTrack = 0; editMode = false; @@ -480,9 +480,9 @@ void TList::returnPressed() void TList::chanValueChanged(int val) { - Track* track = editTrack->clone(false); - ((MidiTrack*)editTrack)->setOutChannel(val-1); - audio->msgChangeTrack(track, editTrack); + MusECore::Track* track = editTrack->clone(false); + ((MusECore::MidiTrack*)editTrack)->setOutChannel(val-1); + MusEGlobal::audio->msgChangeTrack(track, editTrack); } void TList::chanValueFinished() @@ -499,8 +499,8 @@ void TList::chanValueFinished() void TList::adjustScrollbar() { int h = 0; - TrackList* l = song->tracks(); - for (iTrack it = l->begin(); it != l->end(); ++it) + MusECore::TrackList* l = MusEGlobal::song->tracks(); + for (MusECore::iTrack it = l->begin(); it != l->end(); ++it) h += (*it)->height(); _scroll->setMaximum(h +30); redraw(); @@ -510,11 +510,11 @@ void TList::adjustScrollbar() // y2Track //--------------------------------------------------------- -Track* TList::y2Track(int y) const +MusECore::Track* TList::y2Track(int y) const { - TrackList* l = song->tracks(); + MusECore::TrackList* l = MusEGlobal::song->tracks(); int ty = 0; - for (iTrack it = l->begin(); it != l->end(); ++it) { + for (MusECore::iTrack it = l->begin(); it != l->end(); ++it) { int h = (*it)->height(); if (y >= ty && y < ty + h) return *it; @@ -534,7 +534,7 @@ void TList::mouseDoubleClickEvent(QMouseEvent* ev) if (section == -1) return; - Track* t = y2Track(ev->y() + ypos); + MusECore::Track* t = y2Track(ev->y() + ypos); if (t) { int colx = header->sectionPosition(section); @@ -557,7 +557,7 @@ void TList::mouseDoubleClickEvent(QMouseEvent* ev) editor->show(); } else if (section == COL_OCHANNEL) { - if (t->isMidiTrack() && t->type() != Track::DRUM) + if (t->isMidiTrack() && t->type() != MusECore::Track::DRUM) { editTrack=t; if (chan_edit==0) { @@ -567,7 +567,7 @@ void TList::mouseDoubleClickEvent(QMouseEvent* ev) connect(chan_edit, SIGNAL(valueChanged(int)), SLOT(chanValueChanged(int))); connect(chan_edit, SIGNAL(editingFinished()), SLOT(chanValueFinished())); } - chan_edit->setValue(((MidiTrack*)editTrack)->outChannel()+1); + chan_edit->setValue(((MusECore::MidiTrack*)editTrack)->outChannel()+1); int w=colw; if (w < chan_edit->sizeHint().width()) w=chan_edit->sizeHint().width(); chan_edit->setGeometry(colx, coly, w, colh); @@ -584,101 +584,101 @@ void TList::mouseDoubleClickEvent(QMouseEvent* ev) // portsPopupMenu //--------------------------------------------------------- -void TList::portsPopupMenu(Track* t, int x, int y) +void TList::portsPopupMenu(MusECore::Track* t, int x, int y) { switch(t->type()) { - case Track::MIDI: - case Track::DRUM: - case Track::NEW_DRUM: - case Track::AUDIO_SOFTSYNTH: + case MusECore::Track::MIDI: + case MusECore::Track::DRUM: + case MusECore::Track::NEW_DRUM: + case MusECore::Track::AUDIO_SOFTSYNTH: { - MidiTrack* track = (MidiTrack*)t; + MusECore::MidiTrack* track = (MusECore::MidiTrack*)t; - //QPopupMenu* p = midiPortsPopup(0); - MidiDevice* md = 0; + //QPopupMenu* p = MusECore::midiPortsPopup(0); + MusECore::MidiDevice* md = 0; int port = -1; - if(t->type() == Track::AUDIO_SOFTSYNTH) + if(t->type() == MusECore::Track::AUDIO_SOFTSYNTH) { - //MidiDevice* md = dynamic_cast<MidiDevice*>((SynthI*)t); - md = dynamic_cast<MidiDevice*>(t); + //MusECore::MidiDevice* md = dynamic_cast<MusECore::MidiDevice*>((MusECore::SynthI*)t); + md = dynamic_cast<MusECore::MidiDevice*>(t); if(md) port = md->midiPort(); } else port = track->outPort(); - QMenu* p = midiPortsPopup(0, port); + QMenu* p = MusECore::midiPortsPopup(0, port); QAction* act = p->exec(mapToGlobal(QPoint(x, y)), 0); if (act) { int n = act->data().toInt(); // Changed by T356. //track->setOutPort(n); - //audio->msgSetTrackOutPort(track, n); + //MusEGlobal::audio->msgSetTrackOutPort(track, n); - //song->update(); - if (t->type() == Track::DRUM) { + //MusEGlobal::song->update(); + if (t->type() == MusECore::Track::DRUM) { bool change = QMessageBox::question(this, tr("Update drummap?"), tr("Do you want to use same port for all instruments in the drummap?"), tr("&Yes"), tr("&No"), QString::null, 0, 1); - audio->msgIdle(true); + MusEGlobal::audio->msgIdle(true); if (!change) { // Delete all port controller events. - //audio->msgChangeAllPortDrumCtrlEvents(false); - song->changeAllPortDrumCtrlEvents(false); + //MusEGlobal::audio->msgChangeAllPortDrumCtrlEvents(false); + MusEGlobal::song->changeAllPortDrumCtrlEvents(false); track->setOutPort(n); for (int i=0; i<DRUM_MAPSIZE; i++) //Remap all drum instruments to this port - drumMap[i].port = track->outPort(); + MusEGlobal::drumMap[i].port = track->outPort(); // Add all port controller events. - //audio->msgChangeAllPortDrumCtrlEvents(true); - song->changeAllPortDrumCtrlEvents(true); + //MusEGlobal::audio->msgChangeAllPortDrumCtrlEvents(true); + MusEGlobal::song->changeAllPortDrumCtrlEvents(true); } else { - //audio->msgSetTrackOutPort(track, n); + //MusEGlobal::audio->msgSetTrackOutPort(track, n); track->setOutPortAndUpdate(n); } - audio->msgIdle(false); - audio->msgUpdateSoloStates(); // (p4.0.14) p4.0.17 - song->update(); + MusEGlobal::audio->msgIdle(false); + MusEGlobal::audio->msgUpdateSoloStates(); // (p4.0.14) p4.0.17 + MusEGlobal::song->update(); } else - if (t->type() == Track::AUDIO_SOFTSYNTH) + if (t->type() == MusECore::Track::AUDIO_SOFTSYNTH) { if(md != 0) { // Idling is already handled in msgSetMidiDevice. - //audio->msgIdle(true); + //MusEGlobal::audio->msgIdle(true); - // Compiler complains if simple cast from Track to SynthI... - midiSeq->msgSetMidiDevice(&midiPorts[n], (midiPorts[n].device() == md) ? 0 : md); + // Compiler complains if simple cast from Track to MusECore::SynthI... + MusEGlobal::midiSeq->msgSetMidiDevice(&MusEGlobal::midiPorts[n], (MusEGlobal::midiPorts[n].device() == md) ? 0 : md); MusEGlobal::muse->changeConfig(true); // save configuration file - //audio->msgIdle(false); - song->update(); + //MusEGlobal::audio->msgIdle(false); + MusEGlobal::song->update(); } } else { - audio->msgIdle(true); - //audio->msgSetTrackOutPort(track, n); + MusEGlobal::audio->msgIdle(true); + //MusEGlobal::audio->msgSetTrackOutPort(track, n); track->setOutPortAndUpdate(n); - audio->msgIdle(false); - //song->update(); - audio->msgUpdateSoloStates(); // (p4.0.14) p4.0.17 - song->update(SC_MIDI_TRACK_PROP); // + MusEGlobal::audio->msgIdle(false); + //MusEGlobal::song->update(); + MusEGlobal::audio->msgUpdateSoloStates(); // (p4.0.14) p4.0.17 + MusEGlobal::song->update(SC_MIDI_TRACK_PROP); // } } delete p; } break; - case Track::WAVE: - case Track::AUDIO_OUTPUT: - case Track::AUDIO_INPUT: - case Track::AUDIO_GROUP: - case Track::AUDIO_AUX: //TODO + case MusECore::Track::WAVE: + case MusECore::Track::AUDIO_OUTPUT: + case MusECore::Track::AUDIO_INPUT: + case MusECore::Track::AUDIO_GROUP: + case MusECore::Track::AUDIO_AUX: //TODO break; } } @@ -687,12 +687,12 @@ void TList::portsPopupMenu(Track* t, int x, int y) // oportPropertyPopupMenu //--------------------------------------------------------- -void TList::oportPropertyPopupMenu(Track* t, int x, int y) +void TList::oportPropertyPopupMenu(MusECore::Track* t, int x, int y) { // Added by Tim. p3.3.9 - if(t->type() == Track::AUDIO_SOFTSYNTH) + if(t->type() == MusECore::Track::AUDIO_SOFTSYNTH) { - SynthI* synth = (SynthI*)t; + MusECore::SynthI* synth = (MusECore::SynthI*)t; QMenu* p = new QMenu; //QAction* act = p->addAction(tr("Show Gui")); @@ -717,7 +717,7 @@ void TList::oportPropertyPopupMenu(Track* t, int x, int y) // If it has a gui but we don't have OSC, disable the action. #ifndef OSC_SUPPORT #ifdef DSSI_SUPPORT - if(dynamic_cast<DssiSynthIF*>(synth->sif())) + if(dynamic_cast<DssiMusECore::SynthIF*>(synth->sif())) { //act->setChecked(false); //act->setEnabled(false); @@ -731,12 +731,12 @@ void TList::oportPropertyPopupMenu(Track* t, int x, int y) //if (ract == act) { if (ract == gact) { bool show = !synth->guiVisible(); - //audio->msgShowInstrumentGui(synth, show); + //MusEGlobal::audio->msgShowInstrumentGui(synth, show); synth->showGui(show); } else if (ract == nact) { bool show = !synth->nativeGuiVisible(); - //audio->msgShowInstrumentNativeGui(synth, show); + //MusEGlobal::audio->msgShowInstrumentNativeGui(synth, show); synth->showNativeGui(show); } delete p; @@ -744,10 +744,10 @@ void TList::oportPropertyPopupMenu(Track* t, int x, int y) } - if (t->type() != Track::MIDI && t->type() != Track::DRUM && t->type() != Track::NEW_DRUM) + if (t->type() != MusECore::Track::MIDI && t->type() != MusECore::Track::DRUM && t->type() != MusECore::Track::NEW_DRUM) return; - int oPort = ((MidiTrack*)t)->outPort(); - MidiPort* port = &midiPorts[oPort]; + int oPort = ((MusECore::MidiTrack*)t)->outPort(); + MusECore::MidiPort* port = &MusEGlobal::midiPorts[oPort]; QMenu* p = new QMenu; //QAction* act = p->addAction(tr("Show Gui")); @@ -769,8 +769,8 @@ void TList::oportPropertyPopupMenu(Track* t, int x, int y) // If it has a gui but we don't have OSC, disable the action. #ifndef OSC_SUPPORT #ifdef DSSI_SUPPORT - MidiDevice* dev = port->device(); - if(dev && dev->isSynti() && (dynamic_cast<DssiSynthIF*>(((SynthI*)dev)->sif()))) + MusECore::MidiDevice* dev = port->device(); + if(dev && dev->isSynti() && (dynamic_cast<DssiMusECore::SynthIF*>(((MusECore::SynthI*)dev)->sif()))) { //act->setChecked(false); //act->setEnabled(false); @@ -784,12 +784,12 @@ void TList::oportPropertyPopupMenu(Track* t, int x, int y) //if (ract == act) { if (ract == gact) { bool show = !port->guiVisible(); - //audio->msgShowInstrumentGui(port->instrument(), show); + //MusEGlobal::audio->msgShowInstrumentGui(port->instrument(), show); port->instrument()->showGui(show); } else if (ract == nact) { bool show = !port->nativeGuiVisible(); - //audio->msgShowInstrumentNativeGui(port->instrument(), show); + //MusEGlobal::audio->msgShowInstrumentNativeGui(port->instrument(), show); port->instrument()->showNativeGui(show); } delete p; @@ -857,18 +857,18 @@ void TList::keyPressEvent(QKeyEvent* e) void TList::moveSelection(int n) { - TrackList* tracks = song->tracks(); + MusECore::TrackList* tracks = MusEGlobal::song->tracks(); // check for single selection int nselect = 0; - for (iTrack t = tracks->begin(); t != tracks->end(); ++t) + for (MusECore::iTrack t = tracks->begin(); t != tracks->end(); ++t) if ((*t)->selected()) ++nselect; if (nselect != 1) return; - Track* selTrack = 0; - for (iTrack t = tracks->begin(); t != tracks->end(); ++t) { - iTrack s = t; + MusECore::Track* selTrack = 0; + for (MusECore::iTrack t = tracks->begin(); t != tracks->end(); ++t) { + MusECore::iTrack s = t; if ((*t)->selected()) { selTrack = *t; if (n > 0) { @@ -891,10 +891,10 @@ void TList::moveSelection(int n) (*t)->setSelected(true); // rec enable track if expected - TrackList recd = getRecEnabledTracks(); - if (recd.size() == 1 && MusEConfig::config.moveArmedCheckBox) { // one rec enabled track, move rec enabled with selection - song->setRecordFlag((Track*)recd.front(),false); - song->setRecordFlag((*t),true); + MusECore::TrackList recd = getRecEnabledTracks(); + if (recd.size() == 1 && MusEGlobal::config.moveArmedCheckBox) { // one rec enabled track, move rec enabled with selection + MusEGlobal::song->setRecordFlag((MusECore::Track*)recd.front(),false); + MusEGlobal::song->setRecordFlag((*t),true); } if (editTrack && editTrack != *t) @@ -907,12 +907,12 @@ void TList::moveSelection(int n) emit selectionChanged(selTrack); } -TrackList TList::getRecEnabledTracks() +MusECore::TrackList TList::getRecEnabledTracks() { //printf("getRecEnabledTracks\n"); - TrackList recEnabled; - TrackList* tracks = song->tracks(); - for (iTrack t = tracks->begin(); t != tracks->end(); ++t) { + MusECore::TrackList recEnabled; + MusECore::TrackList* tracks = MusEGlobal::song->tracks(); + for (MusECore::iTrack t = tracks->begin(); t != tracks->end(); ++t) { if ((*t)->recordFlag()) { //printf("rec enabled track\n"); recEnabled.push_back(*t); @@ -928,7 +928,7 @@ TrackList TList::getRecEnabledTracks() void TList::changeAutomation(QAction* act) { //printf("changeAutomation %d\n", act->data().toInt()); - if ( (editAutomation->type() == Track::MIDI) || (editAutomation->type() == Track::DRUM) || (editAutomation->type() == Track::NEW_DRUM) ) { + if ( (editAutomation->type() == MusECore::Track::MIDI) || (editAutomation->type() == MusECore::Track::DRUM) || (editAutomation->type() == MusECore::Track::NEW_DRUM) ) { printf("this is wrong, we can't edit automation for midi tracks from arranger yet!\n"); return; } @@ -940,13 +940,13 @@ void TList::changeAutomation(QAction* act) // this is just to get it up and running... - CtrlListList* cll = ((AudioTrack*)editAutomation)->controller(); - for(CtrlListList::iterator icll =cll->begin();icll!=cll->end();++icll) { - CtrlList *cl = icll->second; + MusECore::CtrlListList* cll = ((MusECore::AudioTrack*)editAutomation)->controller(); + for(MusECore::CtrlListList::iterator icll =cll->begin();icll!=cll->end();++icll) { + MusECore::CtrlList *cl = icll->second; if (id == cl->id()) // got it, change state cl->setVisible(act->isChecked()); } - song->update(SC_TRACK_MODIFIED); + MusEGlobal::song->update(SC_TRACK_MODIFIED); } //--------------------------------------------------------- @@ -954,7 +954,7 @@ void TList::changeAutomation(QAction* act) //--------------------------------------------------------- void TList::changeAutomationColor(QAction* act) { - if (editAutomation->type() == Track::MIDI) { //FINDMICHJETZT is this correct? see above + if ( (editAutomation->type() == MusECore::Track::MIDI) || (editAutomation->type() == MusECore::Track::DRUM) || (editAutomation->type() == MusECore::Track::NEW_DRUM) ) { printf("this is wrong, we can't edit automation for midi tracks from arranger yet!\n"); return; } @@ -968,23 +968,23 @@ void TList::changeAutomationColor(QAction* act) //printf("change automation color %d %d\n", id, colindex); - CtrlListList* cll = ((AudioTrack*)editAutomation)->controller(); - for(CtrlListList::iterator icll =cll->begin();icll!=cll->end();++icll) { - CtrlList *cl = icll->second; + MusECore::CtrlListList* cll = ((MusECore::AudioTrack*)editAutomation)->controller(); + for(MusECore::CtrlListList::iterator icll =cll->begin();icll!=cll->end();++icll) { + MusECore::CtrlList *cl = icll->second; if (cl->id() == id) // got it, change color cl->setColor(collist[colindex]); } - song->update(SC_TRACK_MODIFIED); + MusEGlobal::song->update(SC_TRACK_MODIFIED); } //--------------------------------------------------------- // colorMenu //--------------------------------------------------------- //QMenu* TList::colorMenu(QColor c, int id) -MusEWidget::PopupMenu* TList::colorMenu(QColor c, int id) +PopupMenu* TList::colorMenu(QColor c, int id) { //QMenu * m = new QMenu(this); - MusEWidget::PopupMenu * m = new MusEWidget::PopupMenu(this); //, true); TODO + PopupMenu * m = new PopupMenu(this); //, true); TODO for (int i = 0; i< 6; i++) { QPixmap pix(10,10); QPainter p(&pix); @@ -1015,7 +1015,7 @@ void TList::mousePressEvent(QMouseEvent* ev) int button = ev->button(); bool ctrl = ((QInputEvent*)ev)->modifiers() & Qt::ControlModifier; - Track* t = y2Track(y + ypos); + MusECore::Track* t = y2Track(y + ypos); // FIXME Observed: Ancient bug: Track Info doesn't change if selecting multiple tracks in reverse order. // Will need to be fixed if/when adding 'multiple track global editing'. @@ -1024,7 +1024,7 @@ void TList::mousePressEvent(QMouseEvent* ev) if (t == 0) { if (button == Qt::RightButton) { QMenu* p = new QMenu; - MusEUtil::populateAddTrack(p); + MusEGui::populateAddTrack(p); // Show the menu QAction* act = p->exec(ev->globalPos(), 0); @@ -1032,10 +1032,10 @@ void TList::mousePressEvent(QMouseEvent* ev) // Valid click? if(act) { - t = song->addNewTrack(act); // Add at end of list. + t = MusEGlobal::song->addNewTrack(act); // Add at end of list. if(t) { - song->deselectTracks(); + MusEGlobal::song->deselectTracks(); t->setSelected(true); ///emit selectionChanged(); @@ -1051,14 +1051,14 @@ void TList::mousePressEvent(QMouseEvent* ev) else if (button == Qt::LeftButton) { if (!ctrl) { - song->deselectTracks(); + MusEGlobal::song->deselectTracks(); emit selectionChanged(0); } } return; } - TrackList* tracks = song->tracks(); + MusECore::TrackList* tracks = MusEGlobal::song->tracks(); dragYoff = y - (t->y() - ypos); startY = y; @@ -1067,7 +1067,7 @@ void TList::mousePressEvent(QMouseEvent* ev) int y = ev->y(); int ty = -ypos; sTrack = 0; - for (iTrack it = tracks->begin(); it != tracks->end(); ++it, ++sTrack) { + for (MusECore::iTrack it = tracks->begin(); it != tracks->end(); ++it, ++sTrack) { int h = (*it)->height(); ty += h; if (y >= (ty-2)) { @@ -1096,7 +1096,7 @@ void TList::mousePressEvent(QMouseEvent* ev) switch (col) { case COL_CLEF: - if (t->isMidiTrack() && t->type() == Track::MIDI) { + if (t->isMidiTrack() && t->type() == MusECore::Track::MIDI) { QMenu* p = new QMenu; p->addAction(tr("Treble clef"))->setData(0); p->addAction(tr("Bass clef"))->setData(1); @@ -1107,13 +1107,13 @@ void TList::mousePressEvent(QMouseEvent* ev) if (act) { switch (act->data().toInt()) { case 0: - ((MidiTrack*)t)->setClef(trebleClef); + ((MusECore::MidiTrack*)t)->setClef(trebleClef); break; case 1: - ((MidiTrack*)t)->setClef(bassClef); + ((MusECore::MidiTrack*)t)->setClef(bassClef); break; case 2: - ((MidiTrack*)t)->setClef(grandStaff); + ((MusECore::MidiTrack*)t)->setClef(grandStaff); break; default: break; @@ -1127,14 +1127,14 @@ void TList::mousePressEvent(QMouseEvent* ev) { if (!t->isMidiTrack()) { editAutomation = t; - MusEWidget::PopupMenu* p = new MusEWidget::PopupMenu(true); + PopupMenu* p = new PopupMenu(true); p->disconnect(); p->clear(); p->setTitle(tr("Viewable automation")); - CtrlListList* cll = ((AudioTrack*)t)->controller(); + MusECore::CtrlListList* cll = ((MusECore::AudioTrack*)t)->controller(); QAction* act = 0; - for(CtrlListList::iterator icll =cll->begin();icll!=cll->end();++icll) { - CtrlList *cl = icll->second; + for(MusECore::CtrlListList::iterator icll =cll->begin();icll!=cll->end();++icll) { + MusECore::CtrlList *cl = icll->second; //printf("id = %d", cl->id()); if (cl->dontShow()) continue; @@ -1145,7 +1145,7 @@ void TList::mousePressEvent(QMouseEvent* ev) data += 150; // illegal color > 100 act->setData(data); //QMenu *m = colorMenu(cl->color(), cl->id()); - MusEWidget::PopupMenu *m = colorMenu(cl->color(), cl->id()); + PopupMenu *m = colorMenu(cl->color(), cl->id()); act->setMenu(m); } connect(p, SIGNAL(triggered(QAction*)), SLOT(changeAutomation(QAction*))); @@ -1161,35 +1161,35 @@ void TList::mousePressEvent(QMouseEvent* ev) bool val = !(t->recordFlag()); if (button == Qt::LeftButton) { if (!t->isMidiTrack()) { - if (t->type() == Track::AUDIO_OUTPUT) { + if (t->type() == MusECore::Track::AUDIO_OUTPUT) { if (val && t->recordFlag() == false) { - MusEGlobal::muse->bounceToFile((AudioOutput*)t); + MusEGlobal::muse->bounceToFile((MusECore::AudioOutput*)t); } - audio->msgSetRecord((AudioOutput*)t, val); - if (!((AudioOutput*)t)->recFile()) + MusEGlobal::audio->msgSetRecord((MusECore::AudioOutput*)t, val); + if (!((MusECore::AudioOutput*)t)->recFile()) val = false; else return; } - song->setRecordFlag(t, val); + MusEGlobal::song->setRecordFlag(t, val); } else - song->setRecordFlag(t, val); + MusEGlobal::song->setRecordFlag(t, val); } else if (button == Qt::RightButton) { // enable or disable ALL tracks of this type if (!t->isMidiTrack()) { - if (t->type() == Track::AUDIO_OUTPUT) { + if (t->type() == MusECore::Track::AUDIO_OUTPUT) { return; } - WaveTrackList* wtl = song->waves(); - foreach (WaveTrack *wt, *wtl) { - song->setRecordFlag(wt, val); + MusECore::WaveTrackList* wtl = MusEGlobal::song->waves(); + foreach (MusECore::WaveTrack *wt, *wtl) { + MusEGlobal::song->setRecordFlag(wt, val); } } else { - MidiTrackList* mtl = song->midis(); - foreach (MidiTrack *mt, *mtl) { - song->setRecordFlag(mt, val); + MusECore::MidiTrackList* mtl = MusEGlobal::song->midis(); + foreach (MusECore::MidiTrack *mt, *mtl) { + MusEGlobal::song->setRecordFlag(mt, val); } } } @@ -1208,14 +1208,14 @@ void TList::mousePressEvent(QMouseEvent* ev) portsPopupMenu(t, x, t->y() - ypos); else if (button == Qt::RightButton) oportPropertyPopupMenu(t, x, t->y() - ypos); - //if(((button == QMouseEvent::LeftButton) && (t->type() == Track::AUDIO_SOFTSYNTH)) || (button == QMouseEvent::RightButton)) + //if(((button == QMouseEvent::LeftButton) && (t->type() == MusECore::Track::AUDIO_SOFTSYNTH)) || (button == QMouseEvent::RightButton)) // oportPropertyPopupMenu(t, x, t->y() - ypos); //else //if(button == QMouseEvent::LeftButton) // portsPopupMenu(t, x, t->y() - ypos); - //audio->msgUpdateSoloStates(); // p4.0.14 - //song->update(SC_ROUTE); // + //MusEGlobal::audio->msgUpdateSoloStates(); // p4.0.14 + //MusEGlobal::song->update(SC_ROUTE); // break; case COL_MUTE: @@ -1229,24 +1229,24 @@ void TList::mousePressEvent(QMouseEvent* ev) else t->setMute(!t->mute()); } - song->update(SC_MUTE); + MusEGlobal::song->update(SC_MUTE); break; case COL_SOLO: - audio->msgSetSolo(t, !t->solo()); - song->update(SC_SOLO); + MusEGlobal::audio->msgSetSolo(t, !t->solo()); + MusEGlobal::song->update(SC_SOLO); break; case COL_NAME: if (button == Qt::LeftButton) { if (!ctrl) { - song->deselectTracks(); + MusEGlobal::song->deselectTracks(); t->setSelected(true); // rec enable track if expected - TrackList recd = getRecEnabledTracks(); - if (recd.size() == 1 && MusEConfig::config.moveArmedCheckBox) { // one rec enabled track, move rec enabled with selection - song->setRecordFlag((Track*)recd.front(),false); - song->setRecordFlag(t,true); + MusECore::TrackList recd = getRecEnabledTracks(); + if (recd.size() == 1 && MusEGlobal::config.moveArmedCheckBox) { // one rec enabled track, move rec enabled with selection + MusEGlobal::song->setRecordFlag((MusECore::Track*)recd.front(),false); + MusEGlobal::song->setRecordFlag(t,true); } } else @@ -1261,29 +1261,29 @@ void TList::mousePressEvent(QMouseEvent* ev) QMenu* p = new QMenu; //p->clear(); // Leave room for normal track IDs - base these at AUDIO_SOFTSYNTH. - p->addAction(QIcon(*automation_clear_dataIcon), tr("Delete Track"))->setData(Track::AUDIO_SOFTSYNTH + 1); - p->addAction(QIcon(*track_commentIcon), tr("Track Comment"))->setData(Track::AUDIO_SOFTSYNTH + 2); + p->addAction(QIcon(*automation_clear_dataIcon), tr("Delete Track"))->setData(MusECore::Track::AUDIO_SOFTSYNTH + 1); + p->addAction(QIcon(*track_commentIcon), tr("Track Comment"))->setData(MusECore::Track::AUDIO_SOFTSYNTH + 2); p->addSeparator(); QMenu* pnew = new QMenu(p); pnew->setTitle(tr("Insert Track")); pnew->setIcon(QIcon(*edit_track_addIcon)); - MusEUtil::populateAddTrack(pnew); + MusEGui::populateAddTrack(pnew); p->addMenu(pnew); QAction* act = p->exec(ev->globalPos(), 0); if (act) { int n = act->data().toInt(); - if(n >= Track::AUDIO_SOFTSYNTH && n < MENU_ADD_SYNTH_ID_BASE) + if(n >= MusECore::Track::AUDIO_SOFTSYNTH && n < MENU_ADD_SYNTH_ID_BASE) { - n -= Track::AUDIO_SOFTSYNTH; + n -= MusECore::Track::AUDIO_SOFTSYNTH; switch (n) { case 1: // delete track - song->removeTrack0(t); - audio->msgUpdateSoloStates(); + MusEGlobal::song->removeTrack0(t); + MusEGlobal::audio->msgUpdateSoloStates(); break; case 2: // show track comment { - MusEWidget::TrackComment* tc = new MusEWidget::TrackComment(t, 0); + TrackComment* tc = new TrackComment(t, 0); tc->show(); //QToolTip::add( this, "FOOOOOOOOOOOOO" ); } @@ -1296,10 +1296,10 @@ void TList::mousePressEvent(QMouseEvent* ev) } else { - t = song->addNewTrack(act, t); // Let addNewTrack handle it. Insert before clicked-on track 't'. + t = MusEGlobal::song->addNewTrack(act, t); // Let addNewTrack handle it. Insert before clicked-on track 't'. if(t) { - song->deselectTracks(); + MusEGlobal::song->deselectTracks(); t->setSelected(true); emit selectionChanged(t); adjustScrollbar(); @@ -1323,10 +1323,10 @@ void TList::mousePressEvent(QMouseEvent* ev) delta = -1; if (t->isMidiTrack()) { - MidiTrack* mt = dynamic_cast<MidiTrack*>(t); + MusECore::MidiTrack* mt = dynamic_cast<MusECore::MidiTrack*>(t); if (mt == 0) break; - if (mt->type() == Track::DRUM) + if (mt->type() == MusECore::Track::DRUM) break; int channel = mt->outChannel(); @@ -1335,36 +1335,36 @@ void TList::mousePressEvent(QMouseEvent* ev) channel = MIDI_CHANNELS - 1; if(channel < 0) channel = 0; - //if (channel != ((MidiTrack*)t)->outChannel()) + //if (channel != ((MusECore::MidiTrack*)t)->outChannel()) if (channel != mt->outChannel()) { // Changed by T356. //mt->setOutChannel(channel); - audio->msgIdle(true); - //audio->msgSetTrackOutChannel(mt, channel); + MusEGlobal::audio->msgIdle(true); + //MusEGlobal::audio->msgSetTrackOutChannel(mt, channel); mt->setOutChanAndUpdate(channel); - audio->msgIdle(false); + MusEGlobal::audio->msgIdle(false); /* --- I really don't like this, you can mess up the whole map "as easy as dell" - if (mt->type() == MidiTrack::DRUM) {//Change channel on all drum instruments + if (mt->type() == MusECore::MidiTrack::DRUM) {//Change channel on all drum instruments for (int i=0; i<DRUM_MAPSIZE; i++) - drumMap[i].channel = channel; + MusEGlobal::drumMap[i].channel = channel; }*/ // may result in adding/removing mixer strip: - //song->update(-1); - //song->update(SC_CHANNELS); - //song->update(SC_MIDI_TRACK_PROP); - audio->msgUpdateSoloStates(); // p4.0.14 - //song->update(SC_MIDI_TRACK_PROP | SC_ROUTE); // - song->update(SC_MIDI_TRACK_PROP); // + //MusEGlobal::song->update(-1); + //MusEGlobal::song->update(SC_CHANNELS); + //MusEGlobal::song->update(SC_MIDI_TRACK_PROP); + MusEGlobal::audio->msgUpdateSoloStates(); // p4.0.14 + //MusEGlobal::song->update(SC_MIDI_TRACK_PROP | SC_ROUTE); // + MusEGlobal::song->update(SC_MIDI_TRACK_PROP); // } } else { - if(t->type() != Track::AUDIO_SOFTSYNTH) + if(t->type() != MusECore::Track::AUDIO_SOFTSYNTH) { - AudioTrack* at = dynamic_cast<AudioTrack*>(t); + MusECore::AudioTrack* at = dynamic_cast<MusECore::AudioTrack*>(t); if (at == 0) break; @@ -1374,8 +1374,8 @@ void TList::mousePressEvent(QMouseEvent* ev) else if (n < 1) n = 1; if (n != t->channels()) { - audio->msgSetChannels(at, n); - song->update(SC_CHANNELS); + MusEGlobal::audio->msgSetChannels(at, n); + MusEGlobal::song->update(SC_CHANNELS); } } } @@ -1388,19 +1388,19 @@ void TList::mousePressEvent(QMouseEvent* ev) //--------------------------------------------------------- // selectTrack //--------------------------------------------------------- -void TList::selectTrack(Track* tr) +void TList::selectTrack(MusECore::Track* tr) { - song->deselectTracks(); + MusEGlobal::song->deselectTracks(); if (tr) { tr->setSelected(true); // rec enable track if expected - TrackList recd = getRecEnabledTracks(); - if (recd.size() == 1 && MusEConfig::config.moveArmedCheckBox) { // one rec enabled track, move rec enabled with selection - song->setRecordFlag((Track*)recd.front(),false); - song->setRecordFlag(tr,true); + MusECore::TrackList recd = getRecEnabledTracks(); + if (recd.size() == 1 && MusEGlobal::config.moveArmedCheckBox) { // one rec enabled track, move rec enabled with selection + MusEGlobal::song->setRecordFlag((MusECore::Track*)recd.front(),false); + MusEGlobal::song->setRecordFlag(tr,true); } } @@ -1432,8 +1432,8 @@ void TList::mouseMoveEvent(QMouseEvent* ev) if ((((QInputEvent*)ev)->modifiers() | ev->buttons()) == 0) { int y = ev->y(); int ty = -ypos; - TrackList* tracks = song->tracks(); - iTrack it; + MusECore::TrackList* tracks = MusEGlobal::song->tracks(); + MusECore::iTrack it; for (it = tracks->begin(); it != tracks->end(); ++it) { int h = (*it)->height(); ty += h; @@ -1468,13 +1468,13 @@ void TList::mouseMoveEvent(QMouseEvent* ev) if (delta <= 2) break; { - Track* t = y2Track(startY + ypos); + MusECore::Track* t = y2Track(startY + ypos); if (t == 0) mode = NORMAL; else { mode = DRAG; dragHeight = t->height(); - sTrack = song->tracks()->index(t); + sTrack = MusEGlobal::song->tracks()->index(t); setCursor(QCursor(Qt::SizeVerCursor)); redraw(); } @@ -1487,9 +1487,9 @@ void TList::mouseMoveEvent(QMouseEvent* ev) break; case RESIZE: { - if(sTrack >= 0 && (unsigned) sTrack < song->tracks()->size()) + if(sTrack >= 0 && (unsigned) sTrack < MusEGlobal::song->tracks()->size()) { - Track* t = song->tracks()->index(sTrack); + MusECore::Track* t = MusEGlobal::song->tracks()->index(sTrack); if(t) { int h = t->height() + delta; @@ -1497,7 +1497,7 @@ void TList::mouseMoveEvent(QMouseEvent* ev) if (h < MIN_TRACKHEIGHT) h = MIN_TRACKHEIGHT; t->setHeight(h); - song->update(SC_TRACK_MODIFIED); + MusEGlobal::song->update(SC_TRACK_MODIFIED); } } } @@ -1512,10 +1512,10 @@ void TList::mouseMoveEvent(QMouseEvent* ev) void TList::mouseReleaseEvent(QMouseEvent* ev) { if (mode == DRAG) { - Track* t = y2Track(ev->y() + ypos); + MusECore::Track* t = y2Track(ev->y() + ypos); if (t) { - int dTrack = song->tracks()->index(t); - audio->msgMoveTrack(sTrack, dTrack); + int dTrack = MusEGlobal::song->tracks()->index(t); + MusEGlobal::audio->msgMoveTrack(sTrack, dTrack); } } if (mode != NORMAL) { @@ -1536,7 +1536,7 @@ void TList::wheelEvent(QWheelEvent* ev) { int x = ev->x(); int y = ev->y(); - Track* t = y2Track(y + ypos); + MusECore::Track* t = y2Track(y + ypos); if (t == 0) { emit redirectWheelEvent(ev); return; @@ -1563,12 +1563,12 @@ void TList::wheelEvent(QWheelEvent* ev) else t->setMute(!t->mute()); } - song->update(SC_MUTE); + MusEGlobal::song->update(SC_MUTE); break; case COL_SOLO: - audio->msgSetSolo(t, !t->solo()); - song->update(SC_SOLO); + MusEGlobal::audio->msgSetSolo(t, !t->solo()); + MusEGlobal::song->update(SC_SOLO); break; case COL_TIMELOCK: @@ -1577,32 +1577,32 @@ void TList::wheelEvent(QWheelEvent* ev) case COL_OPORT: if (t->isMidiTrack()) { - MidiTrack* mt = (MidiTrack*)t; + MusECore::MidiTrack* mt = (MusECore::MidiTrack*)t; int port = mt->outPort() + delta; if (port >= MIDI_PORTS) port = MIDI_PORTS-1; else if (port < 0) port = 0; - if (port != ((MidiTrack*)t)->outPort()) { + if (port != ((MusECore::MidiTrack*)t)->outPort()) { // Changed by T356. //mt->setOutPort(port); - audio->msgIdle(true); - //audio->msgSetTrackOutPort(mt, port); + MusEGlobal::audio->msgIdle(true); + //MusEGlobal::audio->msgSetTrackOutPort(mt, port); mt->setOutPortAndUpdate(port); - audio->msgIdle(false); + MusEGlobal::audio->msgIdle(false); - audio->msgUpdateSoloStates(); // p4.0.14 - //song->update(SC_ROUTE); - song->update(SC_MIDI_TRACK_PROP); // p4.0.17 + MusEGlobal::audio->msgUpdateSoloStates(); // p4.0.14 + //MusEGlobal::song->update(SC_ROUTE); + MusEGlobal::song->update(SC_MIDI_TRACK_PROP); // p4.0.17 } } break; case COL_OCHANNEL: if (t->isMidiTrack()) { - MidiTrack* mt = (MidiTrack*)t; - if (mt && mt->type() == Track::DRUM) + MusECore::MidiTrack* mt = (MusECore::MidiTrack*)t; + if (mt && mt->type() == MusECore::Track::DRUM) break; int channel = mt->outChannel() + delta; @@ -1611,18 +1611,18 @@ void TList::wheelEvent(QWheelEvent* ev) channel = MIDI_CHANNELS-1; else if (channel < 0) channel = 0; - if (channel != ((MidiTrack*)t)->outChannel()) { + if (channel != ((MusECore::MidiTrack*)t)->outChannel()) { // Changed by T356. //mt->setOutChannel(channel); - audio->msgIdle(true); - //audio->msgSetTrackOutChannel(mt, channel); + MusEGlobal::audio->msgIdle(true); + //MusEGlobal::audio->msgSetTrackOutChannel(mt, channel); mt->setOutChanAndUpdate(channel); - audio->msgIdle(false); + MusEGlobal::audio->msgIdle(false); // may result in adding/removing mixer strip: - //song->update(-1); - audio->msgUpdateSoloStates(); // p4.0.14 - song->update(SC_MIDI_TRACK_PROP); + //MusEGlobal::song->update(-1); + MusEGlobal::audio->msgUpdateSoloStates(); // p4.0.14 + MusEGlobal::song->update(SC_MIDI_TRACK_PROP); } } else { @@ -1632,8 +1632,8 @@ void TList::wheelEvent(QWheelEvent* ev) else if (n < 1) n = 1; if (n != t->channels()) { - audio->msgSetChannels((AudioTrack*)t, n); - song->update(SC_CHANNELS); + MusEGlobal::audio->msgSetChannels((MusECore::AudioTrack*)t, n); + MusEGlobal::song->update(SC_CHANNELS); } } break; @@ -1646,7 +1646,7 @@ void TList::wheelEvent(QWheelEvent* ev) // writeStatus //--------------------------------------------------------- -void TList::writeStatus(int level, Xml& xml, const char* name) const +void TList::writeStatus(int level, MusECore::Xml& xml, const char* name) const { xml.tag(level++, name); header->writeStatus(level, xml); @@ -1657,22 +1657,22 @@ void TList::writeStatus(int level, Xml& xml, const char* name) const // readStatus //--------------------------------------------------------- -void TList::readStatus(Xml& xml, const char* name) +void TList::readStatus(MusECore::Xml& xml, const char* name) { for (;;) { - Xml::Token token(xml.parse()); + MusECore::Xml::Token token(xml.parse()); const QString& tag(xml.s1()); switch (token) { - case Xml::Error: - case Xml::End: + case MusECore::Xml::Error: + case MusECore::Xml::End: return; - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == header->objectName()) header->readStatus(xml); else xml.unknown("Tlist"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == name) return; default: @@ -1706,58 +1706,58 @@ void TList::setYPos(int y) // classesPopupMenu //--------------------------------------------------------- -void TList::classesPopupMenu(Track* t, int x, int y) +void TList::classesPopupMenu(MusECore::Track* t, int x, int y) { QMenu p; p.clear(); - p.addAction(QIcon(*addtrack_addmiditrackIcon), tr("Midi"))->setData(Track::MIDI); - p.addAction(QIcon(*addtrack_drumtrackIcon), tr("Drum"))->setData(Track::DRUM); - p.addAction(QIcon(*addtrack_drumtrackIcon), tr("New style drum"))->setData(Track::NEW_DRUM); + p.addAction(QIcon(*addtrack_addmiditrackIcon), tr("Midi"))->setData(MusECore::Track::MIDI); + p.addAction(QIcon(*addtrack_drumtrackIcon), tr("Drum"))->setData(MusECore::Track::DRUM); + p.addAction(QIcon(*addtrack_drumtrackIcon), tr("New style drum"))->setData(MusECore::Track::NEW_DRUM); QAction* act = p.exec(mapToGlobal(QPoint(x, y)), 0); if (!act) return; int n = act->data().toInt(); - if ((Track::TrackType(n) == Track::MIDI || Track::TrackType(n) == Track::NEW_DRUM) && t->type() == Track::DRUM) { //FINDMICHJETZT passt das? + if ((MusECore::Track::TrackType(n) == MusECore::Track::MIDI || MusECore::Track::TrackType(n) == MusECore::Track::NEW_DRUM) && t->type() == MusECore::Track::DRUM) { //FINDMICHJETZT passt das? // // Drum -> Midi // - audio->msgIdle(true); - PartList* pl = t->parts(); - MidiTrack* m = (MidiTrack*) t; - for (iPart ip = pl->begin(); ip != pl->end(); ++ip) { - EventList* el = ip->second->events(); - for (iEvent ie = el->begin(); ie != el->end(); ++ie) { - Event ev = ie->second; - if(ev.type() == Note) + MusEGlobal::audio->msgIdle(true); + MusECore::PartList* pl = t->parts(); + MusECore::MidiTrack* m = (MusECore::MidiTrack*) t; + for (MusECore::iPart ip = pl->begin(); ip != pl->end(); ++ip) { + MusECore::EventList* el = ip->second->events(); + for (MusECore::iEvent ie = el->begin(); ie != el->end(); ++ie) { + MusECore::Event ev = ie->second; + if(ev.type() == MusECore::Note) { int pitch = ev.pitch(); // Changed by T356. // Tested: Notes were being mixed up switching back and forth between midi and drum. - //pitch = drumMap[pitch].anote; - pitch = drumMap[pitch].enote; + //pitch = MusEGlobal::drumMap[pitch].anote; + pitch = MusEGlobal::drumMap[pitch].enote; ev.setPitch(pitch); } else - if(ev.type() == Controller) + if(ev.type() == MusECore::Controller) { int ctl = ev.dataA(); // Is it a drum controller event, according to the track port's instrument? - MidiController *mc = midiPorts[m->outPort()].drumController(ctl); + MusECore::MidiController *mc = MusEGlobal::midiPorts[m->outPort()].drumController(ctl); if(mc) // Change the controller event's index into the drum map to an instrument note. - ev.setA((ctl & ~0xff) | drumMap[ctl & 0x7f].enote); + ev.setA((ctl & ~0xff) | MusEGlobal::drumMap[ctl & 0x7f].enote); } } } - t->setType(Track::TrackType(n)); - audio->msgIdle(false); - song->update(SC_EVENT_MODIFIED); + t->setType(MusECore::Track::TrackType(n)); + MusEGlobal::audio->msgIdle(false); + MusEGlobal::song->update(SC_EVENT_MODIFIED); } - else if (Track::TrackType(n) == Track::DRUM && (t->type() == Track::MIDI || t->type() == Track::NEW_DRUM)) { //FINDMICHJETZT passt das? + else if (MusECore::Track::TrackType(n) == MusECore::Track::DRUM && (t->type() == MusECore::Track::MIDI || t->type() == MusECore::Track::NEW_DRUM)) { //FINDMICHJETZT passt das? // // Midi -> Drum // @@ -1765,62 +1765,62 @@ void TList::classesPopupMenu(Track* t, int x, int y) tr("Do you want to use same port and channel for all instruments in the drummap?"), tr("&Yes"), tr("&No"), QString::null, 0, 1); - audio->msgIdle(true); + MusEGlobal::audio->msgIdle(true); // Delete all port controller events. - //audio->msgChangeAllPortDrumCtrlEvents(false); - song->changeAllPortDrumCtrlEvents(false); + //MusEGlobal::audio->msgChangeAllPortDrumCtrlEvents(false); + MusEGlobal::song->changeAllPortDrumCtrlEvents(false); if (!change) { - MidiTrack* m = (MidiTrack*) t; + MusECore::MidiTrack* m = (MusECore::MidiTrack*) t; for (int i=0; i<DRUM_MAPSIZE; i++) { - drumMap[i].channel = m->outChannel(); - drumMap[i].port = m->outPort(); + MusEGlobal::drumMap[i].channel = m->outChannel(); + MusEGlobal::drumMap[i].port = m->outPort(); } } - //audio->msgIdle(true); - PartList* pl = t->parts(); - MidiTrack* m = (MidiTrack*) t; - for (iPart ip = pl->begin(); ip != pl->end(); ++ip) { - EventList* el = ip->second->events(); - for (iEvent ie = el->begin(); ie != el->end(); ++ie) { - Event ev = ie->second; - if (ev.type() == Note) + //MusEGlobal::audio->msgIdle(true); + MusECore::PartList* pl = t->parts(); + MusECore::MidiTrack* m = (MusECore::MidiTrack*) t; + for (MusECore::iPart ip = pl->begin(); ip != pl->end(); ++ip) { + MusECore::EventList* el = ip->second->events(); + for (MusECore::iEvent ie = el->begin(); ie != el->end(); ++ie) { + MusECore::Event ev = ie->second; + if (ev.type() == MusECore::Note) { int pitch = ev.pitch(); - pitch = drumInmap[pitch]; + pitch = MusEGlobal::drumInmap[pitch]; ev.setPitch(pitch); } else { - if(ev.type() == Controller) + if(ev.type() == MusECore::Controller) { int ctl = ev.dataA(); // Is it a drum controller event, according to the track port's instrument? - MidiController *mc = midiPorts[m->outPort()].drumController(ctl); + MusECore::MidiController *mc = MusEGlobal::midiPorts[m->outPort()].drumController(ctl); if(mc) // Change the controller event's instrument note to an index into the drum map. - ev.setA((ctl & ~0xff) | drumInmap[ctl & 0x7f]); + ev.setA((ctl & ~0xff) | MusEGlobal::drumInmap[ctl & 0x7f]); } } } } - t->setType(Track::DRUM); + t->setType(MusECore::Track::DRUM); // Add all port controller events. - //audio->msgChangeAllPortDrumCtrlEvents(true); - song->changeAllPortDrumCtrlEvents(true); - audio->msgIdle(false); - song->update(SC_EVENT_MODIFIED); + //MusEGlobal::audio->msgChangeAllPortDrumCtrlEvents(true); + MusEGlobal::song->changeAllPortDrumCtrlEvents(true); + MusEGlobal::audio->msgIdle(false); + MusEGlobal::song->update(SC_EVENT_MODIFIED); } else // MIDI -> NEW_DRUM or vice versa. added by flo. FINDMICHJETZT does this work properly? { - Track* t2 = t->clone(false); - t->setType(Track::TrackType(n)); - audio->msgChangeTrack(t2, t, true); + MusECore::Track* t2 = t->clone(false); + t->setType(MusECore::Track::TrackType(n)); + MusEGlobal::audio->msgChangeTrack(t2, t, true); } } -} // namespace MusEArranger +} // namespace MusEGui diff --git a/muse2/muse/arranger/tlist.h b/muse2/muse/arranger/tlist.h index db19ef6b..2aeae939 100644 --- a/muse2/muse/arranger/tlist.h +++ b/muse2/muse/arranger/tlist.h @@ -37,16 +37,15 @@ class QScrollBar; class QWheelEvent; //class QMenu; -class ScrollScale; +namespace MusECore { class Track; class Xml; +} -namespace MusEWidget { +namespace MusEGui { class Header; class PopupMenu; -} - -namespace MusEArranger { +class ScrollScale; enum TrackColumn { COL_RECORD = 0, @@ -75,12 +74,12 @@ class TList : public QWidget { QPixmap bgPixmap; // background Pixmap bool resizeFlag; // true if resize cursor is shown - MusEWidget::Header* header; + Header* header; QScrollBar* _scroll; QLineEdit* editor; QSpinBox* chan_edit; - Track* editTrack; - Track* editAutomation; + MusECore::Track* editTrack; + MusECore::Track* editAutomation; int startY; int curY; @@ -98,19 +97,19 @@ class TList : public QWidget { virtual void keyPressEvent(QKeyEvent* e); virtual void wheelEvent(QWheelEvent* e); - void portsPopupMenu(Track*, int, int); - void oportPropertyPopupMenu(Track*, int x, int y); + void portsPopupMenu(MusECore::Track*, int, int); + void oportPropertyPopupMenu(MusECore::Track*, int x, int y); void moveSelection(int n); void adjustScrollbar(); void paint(const QRect& r); //virtual void resizeEvent(QResizeEvent*); void redraw(const QRect& r); - Track* y2Track(int) const; - void classesPopupMenu(Track*, int x, int y); - TrackList getRecEnabledTracks(); + MusECore::Track* y2Track(int) const; + void classesPopupMenu(MusECore::Track*, int x, int y); + MusECore::TrackList getRecEnabledTracks(); void setHeaderToolTips(); //QMenu* colorMenu(QColor c, int id); - MusEWidget::PopupMenu* colorMenu(QColor c, int id); + PopupMenu* colorMenu(QColor c, int id); private slots: void returnPressed(); @@ -122,7 +121,7 @@ class TList : public QWidget { signals: ///void selectionChanged(); - void selectionChanged(Track*); + void selectionChanged(MusECore::Track*); void keyPressExt(QKeyEvent*); void redirectWheelEvent(QWheelEvent*); @@ -130,19 +129,19 @@ class TList : public QWidget { void tracklistChanged(); void setYPos(int); void redraw(); - void selectTrack(Track*); + void selectTrack(MusECore::Track*); void selectTrackAbove(); void selectTrackBelow(); public: - TList(MusEWidget::Header*, QWidget* parent, const char* name); + TList(Header*, QWidget* parent, const char* name); void setScroll(QScrollBar* s) { _scroll = s; } - Track* track() const { return editTrack; } - void writeStatus(int level, Xml&, const char* name) const; - void readStatus(Xml&, const char* name); + MusECore::Track* track() const { return editTrack; } + void writeStatus(int level, MusECore::Xml&, const char* name) const; + void readStatus(MusECore::Xml&, const char* name); }; -} // namespace MusEArranger +} // namespace MusEGui #endif diff --git a/muse2/muse/arranger/trackautomationview.cpp b/muse2/muse/arranger/trackautomationview.cpp index 13973a68..6307c167 100644 --- a/muse2/muse/arranger/trackautomationview.cpp +++ b/muse2/muse/arranger/trackautomationview.cpp @@ -28,9 +28,9 @@ #include "track.h" -namespace MusEArranger { +namespace MusEGui { -TrackAutomationView::TrackAutomationView(QWidget *parent, Track *t) : QWidget(parent) +TrackAutomationView::TrackAutomationView(QWidget *parent, MusECore::Track *t) : QWidget(parent) { printf("created trackautomationview\n"); _t = t; @@ -75,4 +75,4 @@ void TrackAutomationView::collectAutomationData() // cll.count() } -} // namespace MusEArranger +} // namespace MusEGui diff --git a/muse2/muse/arranger/trackautomationview.h b/muse2/muse/arranger/trackautomationview.h index 8c7aed84..781e3a23 100644 --- a/muse2/muse/arranger/trackautomationview.h +++ b/muse2/muse/arranger/trackautomationview.h @@ -28,19 +28,19 @@ class QWidget; #include "track.h" -namespace MusEArranger { +namespace MusEGui { class TrackAutomationView : public QWidget { - Track *_t; + MusECore::Track *_t; virtual void paintEvent(QPaintEvent *e); std::map<int,int> automationList; public: - TrackAutomationView(QWidget *parent, Track *t); - Track *track() { return _t; } + TrackAutomationView(QWidget *parent, MusECore::Track *t); + MusECore::Track *track() { return _t; } void collectAutomationData(); }; -} // namespace MusEArranger +} // namespace MusEGui #endif // TRACKAUTOMATIONVIEW_H diff --git a/muse2/muse/audio.cpp b/muse2/muse/audio.cpp index f50d7d75..fd90c2c2 100644 --- a/muse2/muse/audio.cpp +++ b/muse2/muse/audio.cpp @@ -47,15 +47,15 @@ #include "pos.h" #include "ticksynth.h" -namespace MusEUtil { -extern double curTime(); -} - -Audio* audio; -AudioDevice* audioDevice; // current audio device in use +namespace MusEGlobal { +MusECore::Audio* audio; +MusECore::AudioDevice* audioDevice; // current audio device in use extern unsigned int volatile midiExtSyncTicks; // p3.3.25 +} +namespace MusECore { +extern double curTime(); //static const unsigned char mmcDeferredPlayMsg[] = { 0x7f, 0x7f, 0x06, 0x03 }; //static const unsigned char mmcStopMsg[] = { 0x7f, 0x7f, 0x06, 0x01 }; @@ -167,7 +167,7 @@ Audio::Audio() } sigFd = filedes[1]; QSocketNotifier* ss = new QSocketNotifier(filedes[0], QSocketNotifier::Read); - song->connect(ss, SIGNAL(activated(int)), song, SLOT(seqSignal(int))); + MusEGlobal::song->connect(ss, SIGNAL(activated(int)), MusEGlobal::song, SLOT(seqSignal(int))); } //--------------------------------------------------------- @@ -183,14 +183,14 @@ bool Audio::start() state = STOP; _loopCount = 0; MusEGlobal::muse->setHeartBeat(); - if (audioDevice) { + if (MusEGlobal::audioDevice) { //_running = true; - //audioDevice->start(); + //MusEGlobal::audioDevice->start(); } else { if(false == initJackAudio()) { //_running = true; - InputList* itl = song->inputs(); + InputList* itl = MusEGlobal::song->inputs(); for (iAudioInput i = itl->begin(); i != itl->end(); ++i) { //printf("reconnecting input %s\n", (*i)->name().ascii()); for (int x=0; x < (*i)->channels();x++) @@ -198,7 +198,7 @@ bool Audio::start() (*i)->setName((*i)->name()); // restore jack connection } - OutputList* otl = song->outputs(); + OutputList* otl = MusEGlobal::song->outputs(); for (iAudioOutput i = otl->begin(); i != otl->end(); ++i) { //printf("reconnecting output %s\n", (*i)->name().ascii()); for (int x=0; x < (*i)->channels();x++) @@ -206,7 +206,7 @@ bool Audio::start() //printf("name=%s\n",(*i)->name().toLatin1()); (*i)->setName((*i)->name()); // restore jack connection } - //audioDevice->start(); + //MusEGlobal::audioDevice->start(); } else { printf("Failed to init audio!\n"); @@ -214,16 +214,16 @@ bool Audio::start() } } - audioDevice->start(MusEGlobal::realTimePriority); + MusEGlobal::audioDevice->start(MusEGlobal::realTimePriority); _running = true; // shall we really stop JACK transport and locate to // saved position? - audioDevice->stopTransport(); - //audioDevice->seekTransport(song->cPos().frame()); - audioDevice->seekTransport(song->cPos()); + MusEGlobal::audioDevice->stopTransport(); + //MusEGlobal::audioDevice->seekTransport(MusEGlobal::song->cPos().frame()); + MusEGlobal::audioDevice->seekTransport(MusEGlobal::song->cPos()); return true; } @@ -234,8 +234,8 @@ bool Audio::start() void Audio::stop(bool) { - if (audioDevice) - audioDevice->stop(); + if (MusEGlobal::audioDevice) + MusEGlobal::audioDevice->stop(); _running = false; } @@ -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; @@ -320,7 +320,7 @@ void Audio::process(unsigned frames) } } - OutputList* ol = song->outputs(); + OutputList* ol = MusEGlobal::song->outputs(); if (idle) { // deliver no audio for (iAudioOutput i = ol->begin(); i != ol->end(); ++i) @@ -328,7 +328,7 @@ void Audio::process(unsigned frames) return; } - int jackState = audioDevice->getState(); + int jackState = MusEGlobal::audioDevice->getState(); //if(MusEGlobal::debugMsg) // printf("Audio::process Current state:%s jackState:%s\n", audioStates[state], audioStates[jackState]); @@ -361,7 +361,7 @@ void Audio::process(unsigned frames) else if (state == START_PLAY && jackState == STOP) { state = STOP; if (_bounce) { - audioDevice->startTransport(); + MusEGlobal::audioDevice->startTransport(); } else write(sigFd, "3", 1); // abort rolling @@ -384,7 +384,7 @@ void Audio::process(unsigned frames) // // clear aux send buffers // - AuxList* al = song->auxs(); + AuxList* al = MusEGlobal::song->auxs(); for (unsigned i = 0; i < al->size(); ++i) { AudioAux* a = (AudioAux*)((*al)[i]); float** dst = a->sendBuffer(); @@ -399,9 +399,9 @@ void Audio::process(unsigned frames) if (isPlaying()) { if (!freewheel()) - audioPrefetch->msgTick(); + MusEGlobal::audioPrefetch->msgTick(); - if (_bounce && _pos >= song->rPos()) { + if (_bounce && _pos >= MusEGlobal::song->rPos()) { _bounce = false; write(sigFd, "F", 1); return; @@ -410,26 +410,26 @@ void Audio::process(unsigned frames) // // check for end of song // - if ((curTickPos >= song->len()) - && !(song->record() + if ((curTickPos >= MusEGlobal::song->len()) + && !(MusEGlobal::song->record() || _bounce - || song->loop())) { + || MusEGlobal::song->loop())) { //if(MusEGlobal::debugMsg) - // printf("Audio::process curTickPos >= song->len\n"); + // printf("Audio::process curTickPos >= MusEGlobal::song->len\n"); - audioDevice->stopTransport(); + MusEGlobal::audioDevice->stopTransport(); return; } // // check for loop end // - if (state == PLAY && song->loop() && !_bounce && !extSyncFlag.value()) { - const Pos& loop = song->rPos(); + if (state == PLAY && MusEGlobal::song->loop() && !_bounce && !MusEGlobal::extSyncFlag.value()) { + const Pos& loop = MusEGlobal::song->rPos(); unsigned n = loop.frame() - samplePos - (3 * frames); if (n < frames) { // loop end in current cycle - unsigned lpos = song->lPos().frame(); + unsigned lpos = MusEGlobal::song->lPos().frame(); // adjust loop start so we get exact loop len if (n > lpos) n = 0; @@ -438,7 +438,7 @@ void Audio::process(unsigned frames) // clear sustain for (int i = 0; i < MIDI_PORTS; ++i) { - MidiPort* mp = &midiPorts[i]; + MidiPort* mp = &MusEGlobal::midiPorts[i]; for (int ch = 0; ch < MIDI_CHANNELS; ++ch) { if (mp->hwCtrlState(ch, CTRL_SUSTAIN) == 127) { if (mp->device()!=NULL) { @@ -451,18 +451,18 @@ void Audio::process(unsigned frames) } } - //audioDevice->seekTransport(_loopFrame); + //MusEGlobal::audioDevice->seekTransport(_loopFrame); Pos lp(_loopFrame, false); - audioDevice->seekTransport(lp); + MusEGlobal::audioDevice->seekTransport(lp); // printf(" process: seek to %d, end %d\n", _loopFrame, loop.frame()); } } - if(extSyncFlag.value()) // p3.3.25 + if(MusEGlobal::extSyncFlag.value()) // p3.3.25 { - nextTickPos = curTickPos + midiExtSyncTicks; + nextTickPos = curTickPos + MusEGlobal::midiExtSyncTicks; // Probably not good - interfere with midi thread. - midiExtSyncTicks = 0; + MusEGlobal::midiExtSyncTicks = 0; } else { @@ -475,8 +475,8 @@ void Audio::process(unsigned frames) // // resync with audio interface // - syncFrame = audioDevice->framePos(); - syncTime = MusEUtil::curTime(); + syncFrame = MusEGlobal::audioDevice->framePos(); + syncTime = curTime(); frameOffset = syncFrame - samplePos; //printf("Audio::process calling process1:\n"); @@ -499,13 +499,13 @@ void Audio::process1(unsigned samplePos, unsigned offset, unsigned frames) if (MusEGlobal::midiSeqRunning) { processMidi(); } - //midiSeq->msgProcess(); + //MusEGlobal::midiSeq->msgProcess(); // // process not connected tracks // to animate meter display // - TrackList* tl = song->tracks(); + TrackList* tl = MusEGlobal::song->tracks(); AudioTrack* track; int channels; for(ciTrack it = tl->begin(); it != tl->end(); ++it) @@ -531,7 +531,7 @@ void Audio::process1(unsigned samplePos, unsigned offset, unsigned frames) // Pre-process the metronome. ((AudioTrack*)metronome)->preProcessAlways(); - OutputList* ol = song->outputs(); + OutputList* ol = MusEGlobal::song->outputs(); for (ciAudioOutput i = ol->begin(); i != ol->end(); ++i) (*i)->process(samplePos, offset, frames); @@ -651,8 +651,8 @@ void Audio::processMsg(AudioMsg* msg) //printf("Audio::processMsg SEQM_RESET_DEVICES\n"); for (int i = 0; i < MIDI_PORTS; ++i) { - if(midiPorts[i].device()) - midiPorts[i].instrument()->reset(i, song->mtype()); + if(MusEGlobal::midiPorts[i].device()) + MusEGlobal::midiPorts[i].instrument()->reset(i, MusEGlobal::song->mtype()); } break; case SEQM_INIT_DEVICES: @@ -667,7 +667,7 @@ void Audio::processMsg(AudioMsg* msg) case SEQM_PLAY_MIDI_EVENT: { MidiPlayEvent* ev = (MidiPlayEvent*)(msg->p1); - midiPorts[ev->port()].sendEvent(*ev); + MusEGlobal::midiPorts[ev->port()].sendEvent(*ev); // Record?? } break; @@ -687,22 +687,22 @@ void Audio::processMsg(AudioMsg* msg) alsaScanMidiPorts(); break; //case MIDI_SHOW_INSTR_GUI: - // midiSeq->msgUpdatePollFd(); + // MusEGlobal::midiSeq->msgUpdatePollFd(); // break; //case MIDI_SHOW_INSTR_NATIVE_GUI: - // midiSeq->msgUpdatePollFd(); + // MusEGlobal::midiSeq->msgUpdatePollFd(); // break; case SEQM_ADD_TEMPO: case SEQM_REMOVE_TEMPO: case SEQM_SET_GLOBAL_TEMPO: case SEQM_SET_TEMPO: - song->processMsg(msg); + MusEGlobal::song->processMsg(msg); if (isPlaying()) { if (!MusEGlobal::checkAudioDevice()) return; _pos.setTick(curTickPos); int samplePos = _pos.frame(); - syncFrame = audioDevice->framePos(); - syncTime = MusEUtil::curTime(); + syncFrame = MusEGlobal::audioDevice->framePos(); + syncTime = curTime(); frameOffset = syncFrame - samplePos; } break; @@ -716,16 +716,16 @@ void Audio::processMsg(AudioMsg* msg) case SEQM_SET_TRACK_OUT_PORT: case SEQM_REMAP_PORT_DRUM_CTL_EVS: case SEQM_CHANGE_ALL_PORT_DRUM_CTL_EVS: - midiSeq->sendMsg(msg); + MusEGlobal::midiSeq->sendMsg(msg); break; case SEQM_IDLE: idle = msg->a; - midiSeq->sendMsg(msg); + MusEGlobal::midiSeq->sendMsg(msg); break; default: - song->processMsg(msg); + MusEGlobal::song->processMsg(msg); break; } } @@ -746,24 +746,24 @@ void Audio::seek(const Pos& p) //printf("Audio::seek frame:%d\n", p.frame()); _pos = p; if (!MusEGlobal::checkAudioDevice()) return; - syncFrame = audioDevice->framePos(); + syncFrame = MusEGlobal::audioDevice->framePos(); frameOffset = syncFrame - _pos.frame(); curTickPos = _pos.tick(); - if (curTickPos == 0 && !song->record()) - audio->initDevices(); + if (curTickPos == 0 && !MusEGlobal::song->record()) + MusEGlobal::audio->initDevices(); - for(iMidiDevice i = midiDevices.begin(); i != midiDevices.end(); ++i) + for(iMidiDevice i = MusEGlobal::midiDevices.begin(); i != MusEGlobal::midiDevices.end(); ++i) (*i)->handleSeek(); //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 @@ -777,13 +777,13 @@ void Audio::seek(const Pos& p) void Audio::writeTick() { - AudioOutput* ao = song->bounceOutput; - if(ao && song->outputs()->find(ao) != song->outputs()->end()) + AudioOutput* ao = MusEGlobal::song->bounceOutput; + if(ao && MusEGlobal::song->outputs()->find(ao) != MusEGlobal::song->outputs()->end()) { if(ao->recordFlag()) ao->record(); } - WaveTrackList* tl = song->waves(); + WaveTrackList* tl = MusEGlobal::song->waves(); for (iWaveTrack t = tl->begin(); t != tl->end(); ++t) { WaveTrack* track = *t; if (track->recordFlag()) @@ -803,9 +803,9 @@ void Audio::startRolling() if(_loopCount == 0) { startRecordPos = _pos; } - if (song->record()) { + if (MusEGlobal::song->record()) { recording = true; - TrackList* tracks = song->tracks(); + TrackList* tracks = MusEGlobal::song->tracks(); for (iTrack i = tracks->begin(); i != tracks->end(); ++i) { if ((*i)->isMidiTrack()) continue; @@ -817,11 +817,11 @@ void Audio::startRolling() write(sigFd, "1", 1); // Play // Don't send if external sync is on. The master, and our sync routing system will take care of that. - if(!extSyncFlag.value()) + if(!MusEGlobal::extSyncFlag.value()) { for(int port = 0; port < MIDI_PORTS; ++port) { - MidiPort* mp = &midiPorts[port]; + MidiPort* mp = &MusEGlobal::midiPorts[port]; MidiDevice* dev = mp->device(); if(!dev) continue; @@ -847,9 +847,9 @@ void Audio::startRolling() } if (MusEGlobal::precountEnableFlag - && song->click() - && !extSyncFlag.value() - && song->record()) { + && MusEGlobal::song->click() + && !MusEGlobal::extSyncFlag.value() + && MusEGlobal::song->record()) { #if 0 state = PRECOUNT; int z, n; @@ -878,7 +878,7 @@ void Audio::startRolling() // reenable sustain for (int i = 0; i < MIDI_PORTS; ++i) { - MidiPort* mp = &midiPorts[i]; + MidiPort* mp = &MusEGlobal::midiPorts[i]; for (int ch = 0; ch < MIDI_CHANNELS; ++ch) { if (mp->hwCtrlState(ch, CTRL_SUSTAIN) == 127) { if(mp->device() != NULL) { @@ -904,15 +904,15 @@ void Audio::stopRolling() state = STOP; - midiSeq->setExternalPlayState(false); // not playing Moved here from MidiSeq::processStop() p4.0.34 + MusEGlobal::midiSeq->setExternalPlayState(false); // not playing Moved here from MidiSeq::processStop() p4.0.34 - for(iMidiDevice id = midiDevices.begin(); id != midiDevices.end(); ++id) + for(iMidiDevice id = MusEGlobal::midiDevices.begin(); id != MusEGlobal::midiDevices.end(); ++id) { MidiDevice* md = *id; md->handleStop(); } - WaveTrackList* tracks = song->waves(); + WaveTrackList* tracks = MusEGlobal::song->waves(); for (iWaveTrack i = tracks->begin(); i != tracks->end(); ++i) { WaveTrack* track = *i; track->resetMeter(); @@ -932,28 +932,28 @@ void Audio::recordStop() if (MusEGlobal::debugMsg) printf("recordStop - startRecordPos=%d\n", startRecordPos.tick()); - audio->msgIdle(true); // gain access to all data structures + MusEGlobal::audio->msgIdle(true); // gain access to all data structures - song->startUndo(); - WaveTrackList* wl = song->waves(); + MusEGlobal::song->startUndo(); + WaveTrackList* wl = MusEGlobal::song->waves(); for (iWaveTrack it = wl->begin(); it != wl->end(); ++it) { WaveTrack* track = *it; - if (track->recordFlag() || song->bounceTrack == track) { - song->cmdAddRecordedWave(track, startRecordPos, endRecordPos); + if (track->recordFlag() || MusEGlobal::song->bounceTrack == track) { + MusEGlobal::song->cmdAddRecordedWave(track, startRecordPos, endRecordPos); // The track's _recFile pointer may have been kept and turned // into a SndFileR and added to a new part. // Or _recFile may have been discarded (no new recorded part created). // Regardless, we are done with the pointer itself. Set to zero so - // song->setRecordFlag knows about it... + // MusEGlobal::song->setRecordFlag knows about it... track->setRecFile(0); // flush out the old file - song->setRecordFlag(track, false); // + MusEGlobal::song->setRecordFlag(track, false); // //track->setRecordFlag1(true); // and re-arm the track here - //song->setRecordFlag(track, true); // here + //MusEGlobal::song->setRecordFlag(track, true); // here } } - MidiTrackList* ml = song->midis(); + MidiTrackList* ml = MusEGlobal::song->midis(); for (iMidiTrack it = ml->begin(); it != ml->end(); ++it) { MidiTrack* mt = *it; MPEventList* mpel = mt->mpevents(); @@ -963,10 +963,10 @@ void Audio::recordStop() // resolve NoteOff events, Controller etc. //--------------------------------------------------- - //buildMidiEventList(el, mpel, mt, MusEConfig::config.division, true); + //buildMidiEventList(el, mpel, mt, MusEGlobal::config.division, true); // Do SysexMeta. Do loops. - buildMidiEventList(el, mpel, mt, MusEConfig::config.division, true, true); - song->cmdAddRecordedEvents(mt, el, startRecordPos.tick()); + buildMidiEventList(el, mpel, mt, MusEGlobal::config.division, true, true); + MusEGlobal::song->cmdAddRecordedEvents(mt, el, startRecordPos.tick()); el->clear(); mpel->clear(); } @@ -976,12 +976,12 @@ void Audio::recordStop() // selected output port // - AudioOutput* ao = song->bounceOutput; - if(ao && song->outputs()->find(ao) != song->outputs()->end()) + AudioOutput* ao = MusEGlobal::song->bounceOutput; + if(ao && MusEGlobal::song->outputs()->find(ao) != MusEGlobal::song->outputs()->end()) { if(ao->recordFlag()) { - song->bounceOutput = 0; + MusEGlobal::song->bounceOutput = 0; SndFile* sf = ao->recFile(); if (sf) delete sf; // close @@ -990,9 +990,9 @@ void Audio::recordStop() msgSetRecord(ao, false); } } - audio->msgIdle(false); - song->endUndo(0); - song->setRecord(false); + MusEGlobal::audio->msgIdle(false); + MusEGlobal::song->endUndo(0); + MusEGlobal::song->setRecord(false); } //--------------------------------------------------------- @@ -1002,7 +1002,7 @@ void Audio::recordStop() unsigned int Audio::curFrame() const { - return lrint((MusEUtil::curTime() - syncTime) * MusEGlobal::sampleRate) + syncFrame; + return lrint((curTime() - syncTime) * MusEGlobal::sampleRate) + syncFrame; } //--------------------------------------------------------- @@ -1024,3 +1024,4 @@ void Audio::sendMsgToGui(char c) write(sigFd, &c, 1); } +} // namespace MusECore diff --git a/muse2/muse/audio.h b/muse2/muse/audio.h index 90acae13..8d89be78 100644 --- a/muse2/muse/audio.h +++ b/muse2/muse/audio.h @@ -31,21 +31,22 @@ #include "route.h" #include "event.h" -class SndFile; -class PluginI; -class SynthI; -class MidiDevice; +namespace MusECore { class AudioDevice; -class Track; class AudioTrack; -class Part; class Event; -class MidiPlayEvent; class Event; -class MidiPort; class EventList; +class MidiDevice; class MidiInstrument; +class MidiPlayEvent; +class MidiPort; class MidiTrack; +class Part; +class PluginI; +class SndFile; +class SynthI; +class Track; //--------------------------------------------------------- // AudioMsgId @@ -314,7 +315,12 @@ class Audio { extern int processAudio(unsigned long, void*); extern void processAudio1(void*, void*); -extern Audio* audio; -extern AudioDevice* audioDevice; // current audio device in use +} // namespace MusECore + +namespace MusEGlobal { +extern MusECore::Audio* audio; +extern MusECore::AudioDevice* audioDevice; // current audio device in use +} + #endif diff --git a/muse2/muse/audioconvert.cpp b/muse2/muse/audioconvert.cpp index 6b67f30e..eeb11676 100644 --- a/muse2/muse/audioconvert.cpp +++ b/muse2/muse/audioconvert.cpp @@ -35,6 +35,8 @@ //#define AUDIOCONVERT_DEBUG //#define AUDIOCONVERT_DEBUG_PRC +namespace MusECore { + //--------------------------------------------------------- // AudioConvertMap //--------------------------------------------------------- @@ -129,7 +131,7 @@ AudioConverter* AudioConverter::release(AudioConverter* cv) } //off_t AudioConverter::readAudio(SndFileR& f, off_t sfCurFrame, unsigned offset, float** buffer, int channel, int n, bool doSeek, bool overwrite) -off_t AudioConverter::readAudio(SndFileR& f, unsigned offset, float** buffer, int channel, int n, bool doSeek, bool overwrite) +off_t AudioConverter::readAudio(MusECore::SndFileR& f, unsigned offset, float** buffer, int channel, int n, bool doSeek, bool overwrite) { if(f.isNull()) return _sfCurFrame; @@ -327,7 +329,7 @@ void SRCAudioConverter::reset() } //off_t SRCAudioConverter::process(SndFileR& f, off_t sfCurFrame, float** buffer, int channel, int n, bool overwrite) -off_t SRCAudioConverter::process(SndFileR& f, float** buffer, int channel, int n, bool overwrite) +off_t SRCAudioConverter::process(MusECore::SndFileR& f, float** buffer, int channel, int n, bool overwrite) { //return src_process(_src_state, sd); @@ -623,7 +625,7 @@ void RubberBandAudioConverter::reset() // TODO: Not finished yet.. //////////////////////////////// //off_t RubberBandAudioConverter::process(SndFileR& f, off_t sfCurFrame, float** buffer, int channel, int n, bool overwrite) -off_t RubberBandAudioConverter::process(SndFileR& f, float** buffer, int channel, int n, bool overwrite) +off_t RubberBandAudioConverter::process(MusECore::SndFileR& f, float** buffer, int channel, int n, bool overwrite) { //return src_process(_src_state, sd); @@ -901,3 +903,5 @@ off_t RubberBandAudioConverter::process(SndFileR& f, float** buffer, int channel } #endif // RUBBERBAND_SUPPORT + +} // namespace MusECore diff --git a/muse2/muse/audioconvert.h b/muse2/muse/audioconvert.h index 13331a67..d9d312ed 100644 --- a/muse2/muse/audioconvert.h +++ b/muse2/muse/audioconvert.h @@ -37,11 +37,13 @@ #include <sys/types.h> //#include "eventbase.h" + +namespace MusECore { class EventBase; class EventList; - class SndFileR; + //--------------------------------------------------------- // AudioConverter //--------------------------------------------------------- @@ -61,7 +63,7 @@ class AudioConverter //off_t readAudio(SndFileR& /*sf*/, off_t /*sfCurFrame*/, unsigned /*offset*/, float** /*buffer*/, // int /*channels*/, int /*frames*/, bool /*doSeek*/, bool /*overwrite*/); - off_t readAudio(SndFileR& /*sf*/, unsigned /*offset*/, float** /*buffer*/, + off_t readAudio(MusECore::SndFileR& /*sf*/, unsigned /*offset*/, float** /*buffer*/, int /*channels*/, int /*frames*/, bool /*doSeek*/, bool /*overwrite*/); virtual bool isValid() = 0; @@ -69,7 +71,7 @@ class AudioConverter virtual void setChannels(int ch) = 0; //virtual off_t process(SndFileR& /*sf*/, off_t /*sfCurFrame*/, float** /*buffer*/, // int /*channels*/, int /*frames*/, bool /*overwrite*/) = 0; // Interleaved buffer if stereo. - virtual off_t process(SndFileR& /*sf*/, float** /*buffer*/, + virtual off_t process(MusECore::SndFileR& /*sf*/, float** /*buffer*/, int /*channels*/, int /*frames*/, bool /*overwrite*/) = 0; // Interleaved buffer if stereo. }; @@ -92,7 +94,7 @@ class SRCAudioConverter : public AudioConverter virtual void setChannels(int ch); //virtual off_t process(SndFileR& /*sf*/, off_t /*sfCurFrame*/, float** /*buffer*/, // int /*channels*/, int /*frames*/, bool /*overwrite*/); // Interleaved buffer if stereo. - virtual off_t process(SndFileR& /*sf*/, float** /*buffer*/, + virtual off_t process(MusECore::SndFileR& /*sf*/, float** /*buffer*/, int /*channels*/, int /*frames*/, bool /*overwrite*/); // Interleaved buffer if stereo. }; @@ -117,7 +119,7 @@ class RubberBandAudioConverter : public AudioConverter virtual void setChannels(int ch); //virtual off_t process(SndFileR& /*sf*/, off_t /*sfCurFrame*/, float** /*buffer*/, // int /*channels*/, int /*frames*/, bool /*overwrite*/); // Interleaved buffer if stereo. - virtual off_t process(SndFileR& /*sf*/, float** /*buffer*/, + virtual off_t process(MusECore::SndFileR& /*sf*/, float** /*buffer*/, int /*channels*/, int /*frames*/, bool /*overwrite*/); // Interleaved buffer if stereo. }; @@ -141,5 +143,7 @@ class AudioConvertMap : public std::map<EventBase*, AudioConverter*, std::less<E iAudioConvertMap getConverter(EventBase*); }; +} // namespace MusECore + #endif diff --git a/muse2/muse/audioprefetch.cpp b/muse2/muse/audioprefetch.cpp index cfdbb213..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); } @@ -104,9 +108,9 @@ void AudioPrefetch::processMsg1(const void* m) const PrefetchMsg* msg = (PrefetchMsg*)m; switch(msg->id) { case PREFETCH_TICK: - if (audio->isRecording()) { + if (MusEGlobal::audio->isRecording()) { //puts("writeTick"); - audio->writeTick(); + MusEGlobal::audio->writeTick(); } // Indicate do not seek file before each read. // Changed by Tim. p3.3.17 @@ -180,11 +184,11 @@ void AudioPrefetch::prefetch(bool doSeek) printf("AudioPrefetch::prefetch: invalid write position\n"); return; } - if (song->loop() && !audio->bounce() && !extSyncFlag.value()) { - const Pos& loop = song->rPos(); + if (MusEGlobal::song->loop() && !MusEGlobal::audio->bounce() && !MusEGlobal::extSyncFlag.value()) { + const Pos& loop = MusEGlobal::song->rPos(); unsigned n = loop.frame() - writePos; if (n < MusEGlobal::segmentSize) { - unsigned lpos = song->lPos().frame(); + unsigned lpos = MusEGlobal::song->lPos().frame(); // adjust loop start so we get exact loop len if (n > lpos) n = 0; @@ -192,7 +196,7 @@ void AudioPrefetch::prefetch(bool doSeek) writePos = lpos - n; } } - WaveTrackList* tl = song->waves(); + WaveTrackList* tl = MusEGlobal::song->waves(); for (iWaveTrack it = tl->begin(); it != tl->end(); ++it) { WaveTrack* track = *it; // p3.3.29 @@ -245,7 +249,7 @@ void AudioPrefetch::seek(unsigned seekTo) } writePos = seekTo; - WaveTrackList* tl = song->waves(); + 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/audiotrack.cpp b/muse2/muse/audiotrack.cpp index 6426a377..7de92434 100644 --- a/muse2/muse/audiotrack.cpp +++ b/muse2/muse/audiotrack.cpp @@ -40,6 +40,8 @@ #include "dssihost.h" #include "app.h" +namespace MusECore { + bool AudioAux::_isVisible=true; bool AudioInput::_isVisible=true; bool AudioOutput::_isVisible=true; @@ -59,7 +61,7 @@ typedef std::map <const AudioTrack*, jackRouteNameMap>::const_iterator ciJackRou void cacheJackRouteNames() { jackRouteNameCache.clear(); - const InputList* il = song->inputs(); + const InputList* il = MusEGlobal::song->inputs(); for(ciAudioInput iai = il->begin(); iai != il->end(); ++iai) { const RouteList* rl = (*iai)->inRoutes(); @@ -71,7 +73,7 @@ void cacheJackRouteNames() jackRouteNameCache.insert(std::pair<const AudioTrack*, jackRouteNameMap>(*iai, rm)); } } - const OutputList* ol = song->outputs(); + const OutputList* ol = MusEGlobal::song->outputs(); for(ciAudioOutput iao = ol->begin(); iao != ol->end(); ++iao) { const RouteList* rl = (*iao)->outRoutes(); @@ -486,8 +488,8 @@ void AudioTrack::processAutomationEvents() // Remove old events from record region. if (_automationType == AUTO_WRITE) { - int start = audio->getStartRecordPos().frame(); - int end = audio->getEndRecordPos().frame(); + int start = MusEGlobal::audio->getStartRecordPos().frame(); + int end = MusEGlobal::audio->getEndRecordPos().frame(); iCtrl s = cl->lower_bound(start); iCtrl e = cl->lower_bound(end); @@ -514,7 +516,7 @@ void AudioTrack::processAutomationEvents() if(icr == _recEvents.end()) { - int end = audio->getEndRecordPos().frame(); + int end = MusEGlobal::audio->getEndRecordPos().frame(); iCtrl s = cl->lower_bound(start); iCtrl e = cl->lower_bound(end); cl->erase(s, e); @@ -577,7 +579,7 @@ void AudioTrack::processAutomationEvents() if (automationType() == AUTO_WRITE) { setAutomationType(AUTO_READ); - song->update(SC_AUTOMATION); + MusEGlobal::song->update(SC_AUTOMATION); } */ @@ -625,13 +627,13 @@ void AudioTrack::seekPrevACEvent(int id) if(cl->empty()) return; - //iCtrl s = cl->lower_bound(song->cPos().frame()); - iCtrl s = cl->lower_bound(audio->pos().frame()); // p4.0.33 + //iCtrl s = cl->lower_bound(MusEGlobal::song->cPos().frame()); + iCtrl s = cl->lower_bound(MusEGlobal::audio->pos().frame()); // p4.0.33 if(s != cl->begin()) --s; - //song->setPos(Song::CPOS, Pos(s->second.frame, false), true, false, true); - song->setPos(Song::CPOS, Pos(s->second.frame, false), false, true, false); // p4.0.33 + //MusEGlobal::song->setPos(Song::CPOS, Pos(s->second.frame, false), true, false, true); + MusEGlobal::song->setPos(Song::CPOS, Pos(s->second.frame, false), false, true, false); // p4.0.33 return; } @@ -649,16 +651,16 @@ void AudioTrack::seekNextACEvent(int id) if(cl->empty()) return; - //iCtrl s = cl->upper_bound(song->cPos().frame()); - iCtrl s = cl->upper_bound(audio->pos().frame()); // p4.0.33 + //iCtrl s = cl->upper_bound(MusEGlobal::song->cPos().frame()); + iCtrl s = cl->upper_bound(MusEGlobal::audio->pos().frame()); // p4.0.33 if(s == cl->end()) { --s; } - //song->setPos(Song::CPOS, Pos(s->second.frame, false), true, false, true); - song->setPos(Song::CPOS, Pos(s->second.frame, false), false, true, false); // p4.0.33 + //MusEGlobal::song->setPos(Song::CPOS, Pos(s->second.frame, false), true, false, true); + MusEGlobal::song->setPos(Song::CPOS, Pos(s->second.frame, false), false, true, false); // p4.0.33 return; } @@ -747,7 +749,7 @@ double AudioTrack::volume() const if (MusEGlobal::automation && automationType() != AUTO_OFF && _volumeEnCtrl && _volumeEn2Ctrl ) - return cl->second->value(song->cPos().frame()); + return cl->second->value(MusEGlobal::song->cPos().frame()); else return cl->second->curVal(); } @@ -779,7 +781,7 @@ double AudioTrack::pan() const if (MusEGlobal::automation && automationType() != AUTO_OFF && _panEnCtrl && _panEn2Ctrl ) - return cl->second->value(song->cPos().frame()); + return cl->second->value(MusEGlobal::song->cPos().frame()); else return cl->second->curVal(); } @@ -809,7 +811,7 @@ double AudioTrack::pluginCtrlVal(int ctlID) const return 0.0; if (MusEGlobal::automation && (automationType() != AUTO_OFF)) - return cl->second->value(song->cPos().frame()); + return cl->second->value(MusEGlobal::song->cPos().frame()); else return cl->second->curVal(); } @@ -831,12 +833,12 @@ void AudioTrack::recordAutomation(int n, double v) { if(!MusEGlobal::automation) return; - if(audio->isPlaying()) - _recEvents.push_back(CtrlRecVal(song->cPos().frame(), n, v)); + if(MusEGlobal::audio->isPlaying()) + _recEvents.push_back(CtrlRecVal(MusEGlobal::song->cPos().frame(), n, v)); else { if(automationType() == AUTO_WRITE) - _recEvents.push_back(CtrlRecVal(song->cPos().frame(), n, v)); + _recEvents.push_back(CtrlRecVal(MusEGlobal::song->cPos().frame(), n, v)); else if(automationType() == AUTO_TOUCH) // In touch mode and not playing. Send directly to controller list. @@ -845,7 +847,7 @@ void AudioTrack::recordAutomation(int n, double v) if (cl == _controller.end()) return; // Add will replace if found. - cl->second->add(song->cPos().frame(), v); + cl->second->add(MusEGlobal::song->cPos().frame(), v); } } } @@ -854,13 +856,13 @@ void AudioTrack::startAutoRecord(int n, double v) { if(!MusEGlobal::automation) return; - if(audio->isPlaying()) + if(MusEGlobal::audio->isPlaying()) { if(automationType() == AUTO_TOUCH) - _recEvents.push_back(CtrlRecVal(song->cPos().frame(), n, v, ARVT_START)); + _recEvents.push_back(CtrlRecVal(MusEGlobal::song->cPos().frame(), n, v, ARVT_START)); else if(automationType() == AUTO_WRITE) - _recEvents.push_back(CtrlRecVal(song->cPos().frame(), n, v)); + _recEvents.push_back(CtrlRecVal(MusEGlobal::song->cPos().frame(), n, v)); } else { @@ -871,11 +873,11 @@ void AudioTrack::startAutoRecord(int n, double v) if (cl == _controller.end()) return; // Add will replace if found. - cl->second->add(song->cPos().frame(), v); + cl->second->add(MusEGlobal::song->cPos().frame(), v); } else if(automationType() == AUTO_WRITE) - _recEvents.push_back(CtrlRecVal(song->cPos().frame(), n, v)); + _recEvents.push_back(CtrlRecVal(MusEGlobal::song->cPos().frame(), n, v)); } } @@ -883,12 +885,12 @@ void AudioTrack::stopAutoRecord(int n, double v) { if(!MusEGlobal::automation) return; - if(audio->isPlaying()) + if(MusEGlobal::audio->isPlaying()) { if(automationType() == AUTO_TOUCH) { - audio->msgAddACEvent(this, n, song->cPos().frame(), v); - _recEvents.push_back(CtrlRecVal(song->cPos().frame(), n, v, ARVT_STOP)); + MusEGlobal::audio->msgAddACEvent(this, n, MusEGlobal::song->cPos().frame(), v); + _recEvents.push_back(CtrlRecVal(MusEGlobal::song->cPos().frame(), n, v, ARVT_STOP)); } } } @@ -904,7 +906,7 @@ void AudioTrack::writeProperties(int level, Xml& xml) const xml.intTag(level, "sendMetronome", sendMetronome()); xml.intTag(level, "automation", int(automationType())); if (hasAuxSend()) { - int naux = song->auxs()->size(); + int naux = MusEGlobal::song->auxs()->size(); for (int idx = 0; idx < naux; ++idx) { //QString s("<auxSend idx=%1>%2</auxSend>\n"); QString s("<auxSend idx=\"%1\">%2</auxSend>\n"); // Aux fix from Remon, thanks. @@ -1362,7 +1364,7 @@ AudioInput::~AudioInput() if (!MusEGlobal::checkAudioDevice()) return; for (int i = 0; i < _channels; ++i) if(jackPorts[i]) - audioDevice->unregisterPort(jackPorts[i]); + MusEGlobal::audioDevice->unregisterPort(jackPorts[i]); } //--------------------------------------------------------- @@ -1439,7 +1441,7 @@ AudioOutput::~AudioOutput() if (!MusEGlobal::checkAudioDevice()) return; for (int i = 0; i < _channels; ++i) if(jackPorts[i]) - audioDevice->unregisterPort(jackPorts[i]); + MusEGlobal::audioDevice->unregisterPort(jackPorts[i]); } //--------------------------------------------------------- @@ -1654,7 +1656,7 @@ bool AudioTrack::setRecordFlag1(bool f) return true; if (f) { // do nothing - if (_recFile == 0 && song->record()) { + if (_recFile == 0 && MusEGlobal::song->record()) { // this rec-enables a track if the global arm already was done // the standard case would be that rec-enable be done there prepareRecording(); @@ -1686,7 +1688,7 @@ bool AudioTrack::setRecordFlag1(bool f) //--------------------------------------------------------- // prepareRecording -// normally called from song->setRecord to defer creating +// normally called from MusEGlobal::song->setRecord to defer creating // wave files until MusE is globally rec-enabled // also called from track->setRecordFlag (above) // if global rec enable already was done @@ -1710,7 +1712,7 @@ bool AudioTrack::prepareRecording() if (!fil.exists()) break; } - _recFile = new SndFile(QString(buffer)); + _recFile = new MusECore::SndFile(QString(buffer)); _recFile->setFormat( SF_FORMAT_WAV | SF_FORMAT_FLOAT, _channels, MusEGlobal::sampleRate); @@ -1775,6 +1777,7 @@ int AudioGroup::height() const return _height; return 0; } + int WaveTrack::height() const { if (_isVisible) @@ -1782,3 +1785,4 @@ int WaveTrack::height() const return 0; } +} // namespace MusECore diff --git a/muse2/muse/cliplist/cliplist.cpp b/muse2/muse/cliplist/cliplist.cpp index 95f58f80..a4702137 100644 --- a/muse2/muse/cliplist/cliplist.cpp +++ b/muse2/muse/cliplist/cliplist.cpp @@ -34,6 +34,8 @@ #include "ui_cliplisteditorbase.h" +namespace MusEGui { + extern int mtcType; enum { COL_NAME=0, COL_REFS, COL_POS, COL_LEN }; @@ -42,16 +44,16 @@ enum { COL_NAME=0, COL_REFS, COL_POS, COL_LEN }; //--------------------------------------------------------- class ClipItem : public QTreeWidgetItem { - SndFileR _wf; + MusECore::SndFileR _wf; //virtual QString text(int) const; public: - ClipItem(QTreeWidget*, const SndFileR&); - SndFileR* wf() { return &_wf; } + ClipItem(QTreeWidget*, const MusECore::SndFileR&); + MusECore::SndFileR* wf() { return &_wf; } }; -ClipItem::ClipItem(QTreeWidget* parent, const SndFileR& w) +ClipItem::ClipItem(QTreeWidget* parent, const MusECore::SndFileR& w) : QTreeWidgetItem(parent), _wf(w) { setText(COL_NAME, _wf.name()); @@ -161,9 +163,9 @@ ClipListEdit::ClipListEdit(QWidget* parent) connect(editor->view, SIGNAL(itemSelectionChanged()), SLOT(clipSelectionChanged())); connect(editor->view, SIGNAL(itemClicked(QTreeWidgetItem*, int)), SLOT(clicked(QTreeWidgetItem*, int))); - connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); - connect(editor->start, SIGNAL(valueChanged(const Pos&)), SLOT(startChanged(const Pos&))); - connect(editor->len, SIGNAL(valueChanged(const Pos&)), SLOT(lenChanged(const Pos&))); + connect(MusEGlobal::song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); + connect(editor->start, SIGNAL(valueChanged(const MusECore::Pos&)), SLOT(startChanged(const MusECore::Pos&))); + connect(editor->len, SIGNAL(valueChanged(const MusECore::Pos&)), SLOT(lenChanged(const MusECore::Pos&))); updateList(); } @@ -180,7 +182,7 @@ ClipListEdit::~ClipListEdit() void ClipListEdit::updateList() { editor->view->clear(); - for (iSndFile f = SndFile::sndFiles.begin(); f != SndFile::sndFiles.end(); ++f) { + for (MusECore::iSndFile f = MusECore::SndFile::sndFiles.begin(); f != MusECore::SndFile::sndFiles.end(); ++f) { new ClipItem(editor->view, *f); } clipSelectionChanged(); @@ -213,21 +215,21 @@ void ClipListEdit::songChanged(int type) // readStatus //--------------------------------------------------------- -void ClipListEdit::readStatus(Xml& xml) +void ClipListEdit::readStatus(MusECore::Xml& xml) { for (;;) { - Xml::Token token = xml.parse(); + MusECore::Xml::Token token = xml.parse(); const QString& tag = xml.s1(); - if (token == Xml::Error || token == Xml::End) + if (token == MusECore::Xml::Error || token == MusECore::Xml::End) break; switch (token) { - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "topwin") TopWin::readStatus(xml); else xml.unknown("CliplistEdit"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "cliplist") return; default: @@ -240,7 +242,7 @@ void ClipListEdit::readStatus(Xml& xml) // writeStatus //--------------------------------------------------------- -void ClipListEdit::writeStatus(int level, Xml& xml) const +void ClipListEdit::writeStatus(int level, MusECore::Xml& xml) const { xml.tag(level++, "cliplist"); TopWin::writeStatus(level, xml); @@ -251,22 +253,22 @@ void ClipListEdit::writeStatus(int level, Xml& xml) const // readConfiguration //--------------------------------------------------------- -void ClipListEdit::readConfiguration(Xml& xml) +void ClipListEdit::readConfiguration(MusECore::Xml& xml) { for (;;) { - Xml::Token token = xml.parse(); + MusECore::Xml::Token token = xml.parse(); const QString& tag = xml.s1(); switch (token) { - case Xml::Error: - case Xml::End: + case MusECore::Xml::Error: + case MusECore::Xml::End: return; - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "topwin") TopWin::readConfiguration(CLIPLIST, xml); else xml.unknown("ClipListEdit"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "cliplistedit") return; default: @@ -279,7 +281,7 @@ void ClipListEdit::readConfiguration(Xml& xml) // writeConfiguration //--------------------------------------------------------- -void ClipListEdit::writeConfiguration(int level, Xml& xml) +void ClipListEdit::writeConfiguration(int level, MusECore::Xml& xml) { xml.tag(level++, "cliplistedit"); TopWin::writeConfiguration(CLIPLIST, level, xml); @@ -290,7 +292,7 @@ void ClipListEdit::writeConfiguration(int level, Xml& xml) // startChanged //--------------------------------------------------------- -void ClipListEdit::startChanged(const Pos& /*pos*/)//prevent compiler warning: unsused parameter +void ClipListEdit::startChanged(const MusECore::Pos& /*pos*/)//prevent compiler warning: unsused parameter { // editor->view->triggerUpdate(); } @@ -299,7 +301,7 @@ void ClipListEdit::startChanged(const Pos& /*pos*/)//prevent compiler warning: u // lenChanged //--------------------------------------------------------- -void ClipListEdit::lenChanged(const Pos& /*pos*/) //prevent compiler warning: unsused parameter +void ClipListEdit::lenChanged(const MusECore::Pos& /*pos*/) //prevent compiler warning: unsused parameter { // curClip.setLenFrame(pos.frame()); // editor->view->triggerUpdate(); @@ -321,9 +323,9 @@ void ClipListEdit::clipSelectionChanged() } editor->start->setEnabled(true); editor->len->setEnabled(true); - Pos pos, len; - pos.setType(Pos::FRAMES); - len.setType(Pos::FRAMES); + MusECore::Pos pos, len; + pos.setType(MusECore::Pos::FRAMES); + len.setType(MusECore::Pos::FRAMES); pos.setFrame(curClip.spos()); len.setFrame(curClip.lenFrame()); editor->start->setValue(pos); @@ -340,3 +342,4 @@ void ClipListEdit::clicked(QTreeWidgetItem*, int) // printf("clicked\n"); } +} // namespace MusEGui diff --git a/muse2/muse/cliplist/cliplist.h b/muse2/muse/cliplist/cliplist.h index e4c8503b..b490663c 100644 --- a/muse2/muse/cliplist/cliplist.h +++ b/muse2/muse/cliplist/cliplist.h @@ -34,8 +34,12 @@ class QDialog; class QWidget; class QTreeWidgetItem; +namespace MusECore { class Xml; class Pos; +} + +namespace MusEGui { //--------------------------------------------------------- // ClipListEditorBaseWidget @@ -63,22 +67,24 @@ class ClipListEdit : public TopWin { private slots: void songChanged(int); - void startChanged(const Pos&); - void lenChanged(const Pos&); + void startChanged(const MusECore::Pos&); + void lenChanged(const MusECore::Pos&); void clipSelectionChanged(); void clicked(QTreeWidgetItem*, int); signals: - void deleted(TopWin*); + void deleted(MusEGui::TopWin*); public: ClipListEdit(QWidget* parent); ~ClipListEdit(); - virtual void readStatus(Xml&); - virtual void writeStatus(int, Xml&) const; - static void readConfiguration(Xml&); - static void writeConfiguration(int, Xml&); + virtual void readStatus(MusECore::Xml&); + virtual void writeStatus(int, MusECore::Xml&) const; + static void readConfiguration(MusECore::Xml&); + static void writeConfiguration(int, MusECore::Xml&); }; +} // namespace MusEGui + #endif diff --git a/muse2/muse/cobject.cpp b/muse2/muse/cobject.cpp index 46d53f27..59a9463e 100644 --- a/muse2/muse/cobject.cpp +++ b/muse2/muse/cobject.cpp @@ -36,6 +36,8 @@ using std::list; using MusEGlobal::muse; +namespace MusEGui { + int TopWin::_widthInit[TOPLEVELTYPE_LAST_ENTRY]; int TopWin::_heightInit[TOPLEVELTYPE_LAST_ENTRY]; QByteArray TopWin::_toolbarSharedInit[TOPLEVELTYPE_LAST_ENTRY]; @@ -92,18 +94,18 @@ TopWin::TopWin(ToplevelType t, QWidget* parent, const char* name, Qt::WindowFlag // readStatus //--------------------------------------------------------- -void TopWin::readStatus(Xml& xml) +void TopWin::readStatus(MusECore::Xml& xml) { for (;;) { - Xml::Token token = xml.parse(); - if (token == Xml::Error || token == Xml::End) + MusECore::Xml::Token token = xml.parse(); + if (token == MusECore::Xml::Error || token == MusECore::Xml::End) break; QString tag = xml.s1(); switch (token) { - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "geometry_state") { if (!restoreGeometry(QByteArray::fromHex(xml.parse1().toAscii()))) @@ -135,7 +137,7 @@ void TopWin::readStatus(Xml& xml) xml.unknown("TopWin"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "topwin") return; @@ -149,7 +151,7 @@ void TopWin::readStatus(Xml& xml) // writeStatus //--------------------------------------------------------- -void TopWin::writeStatus(int level, Xml& xml) const +void TopWin::writeStatus(int level, MusECore::Xml& xml) const { xml.tag(level++, "topwin"); @@ -394,21 +396,21 @@ void TopWin::initConfiguration() // readConfiguration //--------------------------------------------------------- -void TopWin::readConfiguration(ToplevelType t, Xml& xml) +void TopWin::readConfiguration(ToplevelType t, MusECore::Xml& xml) { if (initInited==false) initConfiguration(); for (;;) { - Xml::Token token = xml.parse(); - if (token == Xml::Error || token == Xml::End) + MusECore::Xml::Token token = xml.parse(); + if (token == MusECore::Xml::Error || token == MusECore::Xml::End) break; const QString& tag = xml.s1(); switch (token) { - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "width") _widthInit[t] = xml.parseInt(); else if (tag == "height") @@ -427,7 +429,7 @@ void TopWin::readConfiguration(ToplevelType t, Xml& xml) xml.unknown("TopWin"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "topwin") return; @@ -442,7 +444,7 @@ void TopWin::readConfiguration(ToplevelType t, Xml& xml) // writeConfiguration //--------------------------------------------------------- -void TopWin::writeConfiguration(ToplevelType t, int level, Xml& xml) +void TopWin::writeConfiguration(ToplevelType t, int level, MusECore::Xml& xml) { if (!initInited) { @@ -516,3 +518,5 @@ void TopWin::resize(const QSize& s) { resize(s.width(), s.height()); } + +} // namespace MusEGui diff --git a/muse2/muse/cobject.h b/muse2/muse/cobject.h index 1ee2b581..c1c45039 100644 --- a/muse2/muse/cobject.h +++ b/muse2/muse/cobject.h @@ -34,9 +34,14 @@ class QMdiSubWindow; class QFocusEvent; class QToolBar; -class Xml; class QAction; +namespace MusECore { +class Xml; +} + +namespace MusEGui { + //--------------------------------------------------------- // TopWin //--------------------------------------------------------- @@ -58,11 +63,11 @@ class TopWin : public QMainWindow static QString typeName(ToplevelType t); - virtual void readStatus(Xml&); - virtual void writeStatus(int, Xml&) const; + virtual void readStatus(MusECore::Xml&); + virtual void writeStatus(int, MusECore::Xml&) const; - static void readConfiguration(ToplevelType, Xml&); - static void writeConfiguration(ToplevelType, int, Xml&); + static void readConfiguration(ToplevelType, MusECore::Xml&); + static void writeConfiguration(ToplevelType, int, MusECore::Xml&); bool isMdiWin() const; @@ -134,5 +139,8 @@ typedef std::list <TopWin*> ToplevelList; typedef ToplevelList::iterator iToplevel; typedef ToplevelList::const_iterator ciToplevel; +} // namespace MusEGui + + #endif diff --git a/muse2/muse/conf.cpp b/muse2/muse/conf.cpp index e1d141e7..027ad431 100644 --- a/muse2/muse/conf.cpp +++ b/muse2/muse/conf.cpp @@ -66,6 +66,8 @@ #include "amixer.h" #include "track.h" +namespace MusECore { + extern void writeMidiTransforms(int level, Xml& xml); extern void readMidiTransform(Xml&); @@ -168,7 +170,7 @@ static void readController(Xml& xml, int midiPort, int channel) break; case Xml::TagEnd: if (tag == "controller") { - MidiPort* port = &midiPorts[midiPort]; + MidiPort* port = &MusEGlobal::midiPorts[midiPort]; //port->addManagedController(channel, id); val = port->limitValToInstrCtlRange(id, val); // The value here will actually be sent to the device LATER, in MidiPort::setMidiDevice() @@ -269,7 +271,7 @@ static void readConfigMidiPort(Xml& xml) else if (tag == "instrument") { instrument = xml.parse1(); // Moved by Tim. - //midiPorts[idx].setInstrument( + //MusEGlobal::midiPorts[idx].setInstrument( // registerMidiInstrument(instrument) // ); } @@ -295,7 +297,7 @@ static void readConfigMidiPort(Xml& xml) idx = 0; } - MidiDevice* dev = midiDevices.find(device); + MidiDevice* dev = MusEGlobal::midiDevices.find(device); //if(MusEGlobal::debugMsg && !dev) // fprintf(stderr, "readConfigMidiPort: device not found %s\n", device.toLatin1().constData()); @@ -311,7 +313,7 @@ static void readConfigMidiPort(Xml& xml) if(MusEGlobal::debugMsg && !dev) fprintf(stderr, "readConfigMidiPort: device not found %s\n", device.toLatin1().constData()); - MidiPort* mp = &midiPorts[idx]; + MidiPort* mp = &MusEGlobal::midiPorts[idx]; mp->setInstrument(registerMidiInstrument(instrument)); // By Tim. if(dic != -1) // p4.0.17 Leave them alone unless set by song. @@ -330,7 +332,7 @@ static void readConfigMidiPort(Xml& xml) if (dev) { dev->setOpenFlags(openFlags); - midiSeq->msgSetMidiDevice(mp, dev); + MusEGlobal::midiSeq->msgSetMidiDevice(mp, dev); } return; } @@ -390,7 +392,7 @@ static void readConfigMidiSyncInfo(Xml& xml) case Xml::TagEnd: if(tag == "midiSyncInfo") { - MidiDevice* dev = midiDevices.find(device); + MidiDevice* dev = MusEGlobal::midiDevices.find(device); if(dev) { MidiSyncInfo& si = dev->syncInfo(); @@ -583,28 +585,28 @@ void readConfiguration(Xml& xml, bool readOnlySequencer, bool doReadGlobalConfig else if (tag == "synthTracksVisible") SynthI::setVisible((bool)xml.parseInt()); else if (tag == "bigtimeVisible") - MusEConfig::config.bigTimeVisible = xml.parseInt(); + MusEGlobal::config.bigTimeVisible = xml.parseInt(); else if (tag == "transportVisible") - MusEConfig::config.transportVisible = xml.parseInt(); + MusEGlobal::config.transportVisible = xml.parseInt(); else if (tag == "mixer1Visible") - MusEConfig::config.mixer1Visible = xml.parseInt(); + MusEGlobal::config.mixer1Visible = xml.parseInt(); else if (tag == "mixer2Visible") - MusEConfig::config.mixer2Visible = xml.parseInt(); + MusEGlobal::config.mixer2Visible = xml.parseInt(); else if (tag == "mtctype") - mtcType= xml.parseInt(); + MusEGlobal::mtcType= xml.parseInt(); else if (tag == "sendClockDelay") - syncSendFirstClockDelay = xml.parseUInt(); + MusEGlobal::syncSendFirstClockDelay = xml.parseUInt(); else if (tag == "extSync") - extSyncFlag.setValue(xml.parseInt()); + MusEGlobal::extSyncFlag.setValue(xml.parseInt()); else if (tag == "useJackTransport") { - useJackTransport.setValue(xml.parseInt()); + MusEGlobal::useJackTransport.setValue(xml.parseInt()); } else if (tag == "jackTransportMaster") { - jackTransportMaster = xml.parseInt(); - if(audioDevice) - audioDevice->setMaster(jackTransportMaster); + MusEGlobal::jackTransportMaster = xml.parseInt(); + if(MusEGlobal::audioDevice) + MusEGlobal::audioDevice->setMaster(MusEGlobal::jackTransportMaster); } else if (tag == "mtcoffset") { QString qs(xml.parse1()); @@ -612,16 +614,16 @@ void readConfiguration(Xml& xml, bool readOnlySequencer, bool doReadGlobalConfig const char* str = ba.constData(); int h, m, s, f, sf; sscanf(str, "%d:%d:%d:%d:%d", &h, &m, &s, &f, &sf); - mtcOffset = MTC(h, m, s, f, sf); + MusEGlobal::mtcOffset = MTC(h, m, s, f, sf); } else if (tag == "midiTransform") readMidiTransform(xml); else if (tag == "midiInputTransform") readMidiInputTransform(xml); else if (tag == "geometryTransport") - MusEConfig::config.geometryTransport = readGeometry(xml, tag); + MusEGlobal::config.geometryTransport = readGeometry(xml, tag); else if (tag == "geometryBigTime") - MusEConfig::config.geometryBigTime = readGeometry(xml, tag); + MusEGlobal::config.geometryBigTime = readGeometry(xml, tag); else if (!doReadGlobalConfig) { xml.skip(tag); @@ -635,242 +637,242 @@ void readConfiguration(Xml& xml, bool readOnlySequencer, bool doReadGlobalConfig // ---- Global config stuff begins here ---- else if (tag == "geometryMain") - MusEConfig::config.geometryMain = readGeometry(xml, tag); + MusEGlobal::config.geometryMain = readGeometry(xml, tag); else if (tag == "theme") - MusEConfig::config.style = xml.parse1(); + MusEGlobal::config.style = xml.parse1(); else if (tag == "styleSheetFile") - MusEConfig::config.styleSheetFile = xml.parse1(); + MusEGlobal::config.styleSheetFile = xml.parse1(); else if (tag == "useOldStyleStopShortCut") - MusEConfig::config.useOldStyleStopShortCut = xml.parseInt(); + MusEGlobal::config.useOldStyleStopShortCut = xml.parseInt(); else if (tag == "moveArmedCheckBox") - MusEConfig::config.moveArmedCheckBox = xml.parseInt(); + MusEGlobal::config.moveArmedCheckBox = xml.parseInt(); else if (tag == "externalWavEditor") - MusEConfig::config.externalWavEditor = xml.parse1(); + MusEGlobal::config.externalWavEditor = xml.parse1(); else if (tag == "font0") - MusEConfig::config.fonts[0].fromString(xml.parse1()); + MusEGlobal::config.fonts[0].fromString(xml.parse1()); else if (tag == "font1") - MusEConfig::config.fonts[1].fromString(xml.parse1()); + MusEGlobal::config.fonts[1].fromString(xml.parse1()); else if (tag == "font2") - MusEConfig::config.fonts[2].fromString(xml.parse1()); + MusEGlobal::config.fonts[2].fromString(xml.parse1()); else if (tag == "font3") - MusEConfig::config.fonts[3].fromString(xml.parse1()); + MusEGlobal::config.fonts[3].fromString(xml.parse1()); else if (tag == "font4") - MusEConfig::config.fonts[4].fromString(xml.parse1()); + MusEGlobal::config.fonts[4].fromString(xml.parse1()); else if (tag == "font5") - MusEConfig::config.fonts[5].fromString(xml.parse1()); + MusEGlobal::config.fonts[5].fromString(xml.parse1()); else if (tag == "font6") - MusEConfig::config.fonts[6].fromString(xml.parse1()); + MusEGlobal::config.fonts[6].fromString(xml.parse1()); else if (tag == "globalAlphaBlend") - MusEConfig::config.globalAlphaBlend = xml.parseInt(); + MusEGlobal::config.globalAlphaBlend = xml.parseInt(); else if (tag == "palette0") - MusEConfig::config.palette[0] = readColor(xml); + MusEGlobal::config.palette[0] = readColor(xml); else if (tag == "palette1") - MusEConfig::config.palette[1] = readColor(xml); + MusEGlobal::config.palette[1] = readColor(xml); else if (tag == "palette2") - MusEConfig::config.palette[2] = readColor(xml); + MusEGlobal::config.palette[2] = readColor(xml); else if (tag == "palette3") - MusEConfig::config.palette[3] = readColor(xml); + MusEGlobal::config.palette[3] = readColor(xml); else if (tag == "palette4") - MusEConfig::config.palette[4] = readColor(xml); + MusEGlobal::config.palette[4] = readColor(xml); else if (tag == "palette5") - MusEConfig::config.palette[5] = readColor(xml); + MusEGlobal::config.palette[5] = readColor(xml); else if (tag == "palette6") - MusEConfig::config.palette[6] = readColor(xml); + MusEGlobal::config.palette[6] = readColor(xml); else if (tag == "palette7") - MusEConfig::config.palette[7] = readColor(xml); + MusEGlobal::config.palette[7] = readColor(xml); else if (tag == "palette8") - MusEConfig::config.palette[8] = readColor(xml); + MusEGlobal::config.palette[8] = readColor(xml); else if (tag == "palette9") - MusEConfig::config.palette[9] = readColor(xml); + MusEGlobal::config.palette[9] = readColor(xml); else if (tag == "palette10") - MusEConfig::config.palette[10] = readColor(xml); + MusEGlobal::config.palette[10] = readColor(xml); else if (tag == "palette11") - MusEConfig::config.palette[11] = readColor(xml); + MusEGlobal::config.palette[11] = readColor(xml); else if (tag == "palette12") - MusEConfig::config.palette[12] = readColor(xml); + MusEGlobal::config.palette[12] = readColor(xml); else if (tag == "palette13") - MusEConfig::config.palette[13] = readColor(xml); + MusEGlobal::config.palette[13] = readColor(xml); else if (tag == "palette14") - MusEConfig::config.palette[14] = readColor(xml); + MusEGlobal::config.palette[14] = readColor(xml); else if (tag == "palette15") - MusEConfig::config.palette[15] = readColor(xml); + MusEGlobal::config.palette[15] = readColor(xml); else if (tag == "palette16") - MusEConfig::config.palette[16] = readColor(xml); + MusEGlobal::config.palette[16] = readColor(xml); else if (tag == "partColor0") - MusEConfig::config.partColors[0] = readColor(xml); + MusEGlobal::config.partColors[0] = readColor(xml); else if (tag == "partColor1") - MusEConfig::config.partColors[1] = readColor(xml); + MusEGlobal::config.partColors[1] = readColor(xml); else if (tag == "partColor2") - MusEConfig::config.partColors[2] = readColor(xml); + MusEGlobal::config.partColors[2] = readColor(xml); else if (tag == "partColor3") - MusEConfig::config.partColors[3] = readColor(xml); + MusEGlobal::config.partColors[3] = readColor(xml); else if (tag == "partColor4") - MusEConfig::config.partColors[4] = readColor(xml); + MusEGlobal::config.partColors[4] = readColor(xml); else if (tag == "partColor5") - MusEConfig::config.partColors[5] = readColor(xml); + MusEGlobal::config.partColors[5] = readColor(xml); else if (tag == "partColor6") - MusEConfig::config.partColors[6] = readColor(xml); + MusEGlobal::config.partColors[6] = readColor(xml); else if (tag == "partColor7") - MusEConfig::config.partColors[7] = readColor(xml); + MusEGlobal::config.partColors[7] = readColor(xml); else if (tag == "partColor8") - MusEConfig::config.partColors[8] = readColor(xml); + MusEGlobal::config.partColors[8] = readColor(xml); else if (tag == "partColor9") - MusEConfig::config.partColors[9] = readColor(xml); + MusEGlobal::config.partColors[9] = readColor(xml); else if (tag == "partColor10") - MusEConfig::config.partColors[10] = readColor(xml); + MusEGlobal::config.partColors[10] = readColor(xml); else if (tag == "partColor11") - MusEConfig::config.partColors[11] = readColor(xml); + MusEGlobal::config.partColors[11] = readColor(xml); else if (tag == "partColor12") - MusEConfig::config.partColors[12] = readColor(xml); + MusEGlobal::config.partColors[12] = readColor(xml); else if (tag == "partColor13") - MusEConfig::config.partColors[13] = readColor(xml); + MusEGlobal::config.partColors[13] = readColor(xml); else if (tag == "partColor14") - MusEConfig::config.partColors[14] = readColor(xml); + MusEGlobal::config.partColors[14] = readColor(xml); else if (tag == "partColor15") - MusEConfig::config.partColors[15] = readColor(xml); + MusEGlobal::config.partColors[15] = readColor(xml); else if (tag == "partColor16") - MusEConfig::config.partColors[16] = readColor(xml); + MusEGlobal::config.partColors[16] = readColor(xml); else if (tag == "partColor17") - MusEConfig::config.partColors[17] = readColor(xml); + MusEGlobal::config.partColors[17] = readColor(xml); else if (tag == "partColorName0") - MusEConfig::config.partColorNames[0] = xml.parse1(); + MusEGlobal::config.partColorNames[0] = xml.parse1(); else if (tag == "partColorName1") - MusEConfig::config.partColorNames[1] = xml.parse1(); + MusEGlobal::config.partColorNames[1] = xml.parse1(); else if (tag == "partColorName2") - MusEConfig::config.partColorNames[2] = xml.parse1(); + MusEGlobal::config.partColorNames[2] = xml.parse1(); else if (tag == "partColorName3") - MusEConfig::config.partColorNames[3] = xml.parse1(); + MusEGlobal::config.partColorNames[3] = xml.parse1(); else if (tag == "partColorName4") - MusEConfig::config.partColorNames[4] = xml.parse1(); + MusEGlobal::config.partColorNames[4] = xml.parse1(); else if (tag == "partColorName5") - MusEConfig::config.partColorNames[5] = xml.parse1(); + MusEGlobal::config.partColorNames[5] = xml.parse1(); else if (tag == "partColorName6") - MusEConfig::config.partColorNames[6] = xml.parse1(); + MusEGlobal::config.partColorNames[6] = xml.parse1(); else if (tag == "partColorName7") - MusEConfig::config.partColorNames[7] = xml.parse1(); + MusEGlobal::config.partColorNames[7] = xml.parse1(); else if (tag == "partColorName8") - MusEConfig::config.partColorNames[8] = xml.parse1(); + MusEGlobal::config.partColorNames[8] = xml.parse1(); else if (tag == "partColorName9") - MusEConfig::config.partColorNames[9] = xml.parse1(); + MusEGlobal::config.partColorNames[9] = xml.parse1(); else if (tag == "partColorName10") - MusEConfig::config.partColorNames[10] = xml.parse1(); + MusEGlobal::config.partColorNames[10] = xml.parse1(); else if (tag == "partColorName11") - MusEConfig::config.partColorNames[11] = xml.parse1(); + MusEGlobal::config.partColorNames[11] = xml.parse1(); else if (tag == "partColorName12") - MusEConfig::config.partColorNames[12] = xml.parse1(); + MusEGlobal::config.partColorNames[12] = xml.parse1(); else if (tag == "partColorName13") - MusEConfig::config.partColorNames[13] = xml.parse1(); + MusEGlobal::config.partColorNames[13] = xml.parse1(); else if (tag == "partColorName14") - MusEConfig::config.partColorNames[14] = xml.parse1(); + MusEGlobal::config.partColorNames[14] = xml.parse1(); else if (tag == "partColorName15") - MusEConfig::config.partColorNames[15] = xml.parse1(); + MusEGlobal::config.partColorNames[15] = xml.parse1(); else if (tag == "partColorName16") - MusEConfig::config.partColorNames[16] = xml.parse1(); + MusEGlobal::config.partColorNames[16] = xml.parse1(); else if (tag == "partColorName17") - MusEConfig::config.partColorNames[17] = xml.parse1(); + MusEGlobal::config.partColorNames[17] = xml.parse1(); else if (tag == "partCanvasBg") - MusEConfig::config.partCanvasBg = readColor(xml); + MusEGlobal::config.partCanvasBg = readColor(xml); else if (tag == "trackBg") - MusEConfig::config.trackBg = readColor(xml); + MusEGlobal::config.trackBg = readColor(xml); else if (tag == "selectTrackBg") - MusEConfig::config.selectTrackBg = readColor(xml); + MusEGlobal::config.selectTrackBg = readColor(xml); else if (tag == "selectTrackFg") - MusEConfig::config.selectTrackFg = readColor(xml); + MusEGlobal::config.selectTrackFg = readColor(xml); else if (tag == "mixerBg") - MusEConfig::config.mixerBg = readColor(xml); + MusEGlobal::config.mixerBg = readColor(xml); else if (tag == "midiTrackLabelBg") - MusEConfig::config.midiTrackLabelBg = readColor(xml); + MusEGlobal::config.midiTrackLabelBg = readColor(xml); else if (tag == "drumTrackLabelBg") - MusEConfig::config.drumTrackLabelBg = readColor(xml); + MusEGlobal::config.drumTrackLabelBg = readColor(xml); else if (tag == "newDrumTrackLabelBg") - MusEConfig::config.newDrumTrackLabelBg = readColor(xml); + MusEGlobal::config.newDrumTrackLabelBg = readColor(xml); else if (tag == "waveTrackLabelBg") - MusEConfig::config.waveTrackLabelBg = readColor(xml); + MusEGlobal::config.waveTrackLabelBg = readColor(xml); else if (tag == "outputTrackLabelBg") - MusEConfig::config.outputTrackLabelBg = readColor(xml); + MusEGlobal::config.outputTrackLabelBg = readColor(xml); else if (tag == "inputTrackLabelBg") - MusEConfig::config.inputTrackLabelBg = readColor(xml); + MusEGlobal::config.inputTrackLabelBg = readColor(xml); else if (tag == "groupTrackLabelBg") - MusEConfig::config.groupTrackLabelBg = readColor(xml); + MusEGlobal::config.groupTrackLabelBg = readColor(xml); else if (tag == "auxTrackLabelBg") - MusEConfig::config.auxTrackLabelBg = readColor(xml); + MusEGlobal::config.auxTrackLabelBg = readColor(xml); else if (tag == "synthTrackLabelBg") - MusEConfig::config.synthTrackLabelBg = readColor(xml); + MusEGlobal::config.synthTrackLabelBg = readColor(xml); else if (tag == "midiTrackBg") - MusEConfig::config.midiTrackBg = readColor(xml); + MusEGlobal::config.midiTrackBg = readColor(xml); else if (tag == "ctrlGraphFg") - MusEConfig::config.ctrlGraphFg = readColor(xml); + MusEGlobal::config.ctrlGraphFg = readColor(xml); else if (tag == "drumTrackBg") - MusEConfig::config.drumTrackBg = readColor(xml); + MusEGlobal::config.drumTrackBg = readColor(xml); else if (tag == "newDrumTrackBg") - MusEConfig::config.newDrumTrackBg = readColor(xml); + MusEGlobal::config.newDrumTrackBg = readColor(xml); else if (tag == "waveTrackBg") - MusEConfig::config.waveTrackBg = readColor(xml); + MusEGlobal::config.waveTrackBg = readColor(xml); else if (tag == "outputTrackBg") - MusEConfig::config.outputTrackBg = readColor(xml); + MusEGlobal::config.outputTrackBg = readColor(xml); else if (tag == "inputTrackBg") - MusEConfig::config.inputTrackBg = readColor(xml); + MusEGlobal::config.inputTrackBg = readColor(xml); else if (tag == "groupTrackBg") - MusEConfig::config.groupTrackBg = readColor(xml); + MusEGlobal::config.groupTrackBg = readColor(xml); else if (tag == "auxTrackBg") - MusEConfig::config.auxTrackBg = readColor(xml); + MusEGlobal::config.auxTrackBg = readColor(xml); else if (tag == "synthTrackBg") - MusEConfig::config.synthTrackBg = readColor(xml); + MusEGlobal::config.synthTrackBg = readColor(xml); else if (tag == "extendedMidi") - MusEConfig::config.extendedMidi = xml.parseInt(); + MusEGlobal::config.extendedMidi = xml.parseInt(); else if (tag == "midiExportDivision") - MusEConfig::config.midiDivision = xml.parseInt(); + MusEGlobal::config.midiDivision = xml.parseInt(); else if (tag == "copyright") - MusEConfig::config.copyright = xml.parse1(); + MusEGlobal::config.copyright = xml.parse1(); else if (tag == "smfFormat") - MusEConfig::config.smfFormat = xml.parseInt(); + MusEGlobal::config.smfFormat = xml.parseInt(); else if (tag == "exp2ByteTimeSigs") - MusEConfig::config.exp2ByteTimeSigs = xml.parseInt(); + MusEGlobal::config.exp2ByteTimeSigs = xml.parseInt(); else if (tag == "expOptimNoteOffs") - MusEConfig::config.expOptimNoteOffs = xml.parseInt(); + MusEGlobal::config.expOptimNoteOffs = xml.parseInt(); else if (tag == "importMidiSplitParts") - MusEConfig::config.importMidiSplitParts = xml.parseInt(); + MusEGlobal::config.importMidiSplitParts = xml.parseInt(); else if (tag == "showSplashScreen") - MusEConfig::config.showSplashScreen = xml.parseInt(); + MusEGlobal::config.showSplashScreen = xml.parseInt(); else if (tag == "canvasShowPartType") - MusEConfig::config.canvasShowPartType = xml.parseInt(); + MusEGlobal::config.canvasShowPartType = xml.parseInt(); else if (tag == "canvasShowPartEvent") - MusEConfig::config.canvasShowPartEvent = xml.parseInt(); + MusEGlobal::config.canvasShowPartEvent = xml.parseInt(); else if (tag == "canvasShowGrid") - MusEConfig::config.canvasShowGrid = xml.parseInt(); + MusEGlobal::config.canvasShowGrid = xml.parseInt(); else if (tag == "canvasBgPixmap") - MusEConfig::config.canvasBgPixmap = xml.parse1(); + MusEGlobal::config.canvasBgPixmap = xml.parse1(); else if (tag == "canvasCustomBgList") - MusEConfig::config.canvasCustomBgList = xml.parse1().split(";", QString::SkipEmptyParts); + MusEGlobal::config.canvasCustomBgList = xml.parse1().split(";", QString::SkipEmptyParts); //else if (tag == "mixer1") - // MusEConfig::config.mixer1.read(xml); + // MusEGlobal::config.mixer1.read(xml); //else if (tag == "mixer2") - // MusEConfig::config.mixer2.read(xml); + // MusEGlobal::config.mixer2.read(xml); else if (tag == "Mixer") { if(mixers == 0) - MusEConfig::config.mixer1.read(xml); + MusEGlobal::config.mixer1.read(xml); else - MusEConfig::config.mixer2.read(xml); + MusEGlobal::config.mixer2.read(xml); ++mixers; } else if (tag == "bigtimeForegroundcolor") - MusEConfig::config.bigTimeForegroundColor = readColor(xml); + MusEGlobal::config.bigTimeForegroundColor = readColor(xml); else if (tag == "bigtimeBackgroundcolor") - MusEConfig::config.bigTimeBackgroundColor = readColor(xml); + MusEGlobal::config.bigTimeBackgroundColor = readColor(xml); else if (tag == "transportHandleColor") - MusEConfig::config.transportHandleColor = readColor(xml); + MusEGlobal::config.transportHandleColor = readColor(xml); else if (tag == "waveEditBackgroundColor") - MusEConfig::config.waveEditBackgroundColor = readColor(xml); + MusEGlobal::config.waveEditBackgroundColor = readColor(xml); //else if (tag == "midiSyncInfo") // readConfigMidiSyncInfo(xml); /* Obsolete. done by song's toplevel list. arrangerview also handles arranger. @@ -882,88 +884,88 @@ void readConfiguration(Xml& xml, bool readOnlySequencer, bool doReadGlobalConfig } */ else if (tag == "drumedit") - DrumEdit::readConfiguration(xml); + MusEGui::DrumEdit::readConfiguration(xml); else if (tag == "pianoroll") - PianoRoll::readConfiguration(xml); + MusEGui::PianoRoll::readConfiguration(xml); else if (tag == "scoreedit") - ScoreEdit::read_configuration(xml); + MusEGui::ScoreEdit::read_configuration(xml); else if (tag == "masteredit") - MasterEdit::readConfiguration(xml); + MusEGui::MasterEdit::readConfiguration(xml); else if (tag == "waveedit") - WaveEdit::readConfiguration(xml); + MusEGui::WaveEdit::readConfiguration(xml); else if (tag == "listedit") - ListEdit::readConfiguration(xml); + MusEGui::ListEdit::readConfiguration(xml); else if (tag == "cliplistedit") - ClipListEdit::readConfiguration(xml); + MusEGui::ClipListEdit::readConfiguration(xml); else if (tag == "lmaster") - LMaster::readConfiguration(xml); + MusEGui::LMaster::readConfiguration(xml); else if (tag == "marker") - MarkerView::readConfiguration(xml); + MusEGui::MarkerView::readConfiguration(xml); else if (tag == "arrangerview") - MusEArranger::ArrangerView::readConfiguration(xml); + MusEGui::ArrangerView::readConfiguration(xml); else if (tag == "dialogs") - read_function_dialog_config(xml); + MusEGui::read_function_dialog_config(xml); else if (tag == "shortcuts") - readShortCuts(xml); + MusEGui::readShortCuts(xml); else if (tag == "division") - MusEConfig::config.division = xml.parseInt(); + MusEGlobal::config.division = xml.parseInt(); else if (tag == "guiDivision") - MusEConfig::config.guiDivision = xml.parseInt(); + MusEGlobal::config.guiDivision = xml.parseInt(); else if (tag == "rtcTicks") - MusEConfig::config.rtcTicks = xml.parseInt(); + MusEGlobal::config.rtcTicks = xml.parseInt(); else if (tag == "minMeter") - MusEConfig::config.minMeter = xml.parseInt(); + MusEGlobal::config.minMeter = xml.parseInt(); else if (tag == "minSlider") - MusEConfig::config.minSlider = xml.parseDouble(); + MusEGlobal::config.minSlider = xml.parseDouble(); else if (tag == "freewheelMode") - MusEConfig::config.freewheelMode = xml.parseInt(); + MusEGlobal::config.freewheelMode = xml.parseInt(); else if (tag == "denormalProtection") - MusEConfig::config.useDenormalBias = xml.parseInt(); + MusEGlobal::config.useDenormalBias = xml.parseInt(); else if (tag == "didYouKnow") - MusEConfig::config.showDidYouKnow = xml.parseInt(); + MusEGlobal::config.showDidYouKnow = xml.parseInt(); else if (tag == "outputLimiter") - MusEConfig::config.useOutputLimiter = xml.parseInt(); + MusEGlobal::config.useOutputLimiter = xml.parseInt(); else if (tag == "vstInPlace") - MusEConfig::config.vstInPlace = xml.parseInt(); + MusEGlobal::config.vstInPlace = xml.parseInt(); else if (tag == "dummyAudioSampleRate") - MusEConfig::config.dummyAudioSampleRate = xml.parseInt(); + MusEGlobal::config.dummyAudioSampleRate = xml.parseInt(); else if (tag == "dummyAudioBufSize") - MusEConfig::config.dummyAudioBufSize = xml.parseInt(); + MusEGlobal::config.dummyAudioBufSize = xml.parseInt(); else if (tag == "minControlProcessPeriod") - MusEConfig::config.minControlProcessPeriod = xml.parseUInt(); + MusEGlobal::config.minControlProcessPeriod = xml.parseUInt(); else if (tag == "guiRefresh") - MusEConfig::config.guiRefresh = xml.parseInt(); + MusEGlobal::config.guiRefresh = xml.parseInt(); else if (tag == "userInstrumentsDir") - MusEConfig::config.userInstrumentsDir = xml.parse1(); + MusEGlobal::config.userInstrumentsDir = xml.parse1(); else if (tag == "startMode") - MusEConfig::config.startMode = xml.parseInt(); + MusEGlobal::config.startMode = xml.parseInt(); else if (tag == "startSong") - MusEConfig::config.startSong = xml.parse1(); + MusEGlobal::config.startSong = xml.parse1(); else if (tag == "projectBaseFolder") - MusEConfig::config.projectBaseFolder = xml.parse1(); + MusEGlobal::config.projectBaseFolder = xml.parse1(); else if (tag == "projectStoreInFolder") - MusEConfig::config.projectStoreInFolder = xml.parseInt(); + MusEGlobal::config.projectStoreInFolder = xml.parseInt(); else if (tag == "useProjectSaveDialog") - MusEConfig::config.useProjectSaveDialog = xml.parseInt(); + MusEGlobal::config.useProjectSaveDialog = xml.parseInt(); else if (tag == "popupsDefaultStayOpen") - MusEConfig::config.popupsDefaultStayOpen = xml.parseInt(); + MusEGlobal::config.popupsDefaultStayOpen = xml.parseInt(); else if (tag == "leftMouseButtonCanDecrease") - MusEConfig::config.leftMouseButtonCanDecrease = xml.parseInt(); + MusEGlobal::config.leftMouseButtonCanDecrease = xml.parseInt(); else if (tag == "rangeMarkerWithoutMMB") - MusEConfig::config.rangeMarkerWithoutMMB = xml.parseInt(); + MusEGlobal::config.rangeMarkerWithoutMMB = xml.parseInt(); // ---- the following only skips obsolete entries ---- else if ((tag == "arranger") || (tag == "geometryPianoroll") || (tag == "geometryDrumedit")) xml.skip(tag); else if (tag == "markerVisible") - //MusEConfig::config.markerVisible = xml.parseInt(); //Obsolete (done by song's toplevel list) + //MusEGlobal::config.markerVisible = xml.parseInt(); //Obsolete (done by song's toplevel list) xml.skip(tag); else if (tag == "mixerVisible") - // MusEConfig::config.mixerVisible = xml.parseInt(); // Obsolete + // MusEGlobal::config.mixerVisible = xml.parseInt(); // Obsolete xml.skip(tag); else if (tag == "geometryMixer") - // MusEConfig::config.geometryMixer = readGeometry(xml, tag); // Obsolete + // MusEGlobal::config.geometryMixer = readGeometry(xml, tag); // Obsolete xml.skip(tag); else if (tag == "txDeviceId") //txDeviceId = xml.parseInt(); @@ -1042,8 +1044,8 @@ bool readConfiguration() if (MusEGlobal::debugMsg || MusEGlobal::debugMode) fprintf(stderr, "NO Config File <%s> found\n", MusEGlobal::configName.toLatin1().constData()); - if (MusEConfig::config.userInstrumentsDir.isEmpty()) - MusEConfig::config.userInstrumentsDir = MusEGlobal::configPath + "/instruments"; + if (MusEGlobal::config.userInstrumentsDir.isEmpty()) + MusEGlobal::config.userInstrumentsDir = MusEGlobal::configPath + "/instruments"; return true; } Xml xml(f); @@ -1128,7 +1130,7 @@ static void writeSeqConfiguration(int level, Xml& xml, bool writePortInfo) // for (int i = 0; i < MIDI_PORTS; ++i) { bool used = false; - MidiPort* mport = &midiPorts[i]; + MidiPort* mport = &MusEGlobal::midiPorts[i]; MidiDevice* dev = mport->device(); // Route check by Tim. Port can now be used for routing even if no device. // Also, check for other non-defaults and save port, to preserve settings even if no device. @@ -1146,7 +1148,7 @@ static void writeSeqConfiguration(int level, Xml& xml, bool writePortInfo) used = true; else { - MidiTrackList* tl = song->midis(); + MidiTrackList* tl = MusEGlobal::song->midis(); for (iMidiTrack it = tl->begin(); it != tl->end(); ++it) { MidiTrack* t = *it; @@ -1211,7 +1213,10 @@ static void writeSeqConfiguration(int level, Xml& xml, bool writePortInfo) xml.tag(level, "/sequencer"); } -namespace MusEApp { +} // namespace MusECore + +namespace MusEGui { + //--------------------------------------------------------- // writeGlobalConfiguration //--------------------------------------------------------- @@ -1224,7 +1229,7 @@ void MusE::writeGlobalConfiguration() const MusEGlobal::configName.toLatin1().constData(), strerror(errno)); return; } - Xml xml(f); + MusECore::Xml xml(f); xml.header(); xml.tag(0, "muse version=\"2.0\""); writeGlobalConfiguration(1, xml); @@ -1232,40 +1237,40 @@ void MusE::writeGlobalConfiguration() const fclose(f); } -void MusE::writeGlobalConfiguration(int level, Xml& xml) const +void MusE::writeGlobalConfiguration(int level, MusECore::Xml& xml) const { xml.tag(level++, "configuration"); - xml.intTag(level, "division", MusEConfig::config.division); - xml.intTag(level, "rtcTicks", MusEConfig::config.rtcTicks); - xml.intTag(level, "minMeter", MusEConfig::config.minMeter); - xml.doubleTag(level, "minSlider", MusEConfig::config.minSlider); - xml.intTag(level, "freewheelMode", MusEConfig::config.freewheelMode); - xml.intTag(level, "denormalProtection", MusEConfig::config.useDenormalBias); - xml.intTag(level, "didYouKnow", MusEConfig::config.showDidYouKnow); - xml.intTag(level, "outputLimiter", MusEConfig::config.useOutputLimiter); - xml.intTag(level, "vstInPlace", MusEConfig::config.vstInPlace); - xml.intTag(level, "dummyAudioBufSize", MusEConfig::config.dummyAudioBufSize); - xml.intTag(level, "dummyAudioSampleRate", MusEConfig::config.dummyAudioSampleRate); - xml.uintTag(level, "minControlProcessPeriod", MusEConfig::config.minControlProcessPeriod); - - xml.intTag(level, "guiRefresh", MusEConfig::config.guiRefresh); - xml.strTag(level, "userInstrumentsDir", MusEConfig::config.userInstrumentsDir); + xml.intTag(level, "division", MusEGlobal::config.division); + xml.intTag(level, "rtcTicks", MusEGlobal::config.rtcTicks); + xml.intTag(level, "minMeter", MusEGlobal::config.minMeter); + xml.doubleTag(level, "minSlider", MusEGlobal::config.minSlider); + xml.intTag(level, "freewheelMode", MusEGlobal::config.freewheelMode); + xml.intTag(level, "denormalProtection", MusEGlobal::config.useDenormalBias); + xml.intTag(level, "didYouKnow", MusEGlobal::config.showDidYouKnow); + xml.intTag(level, "outputLimiter", MusEGlobal::config.useOutputLimiter); + xml.intTag(level, "vstInPlace", MusEGlobal::config.vstInPlace); + xml.intTag(level, "dummyAudioBufSize", MusEGlobal::config.dummyAudioBufSize); + xml.intTag(level, "dummyAudioSampleRate", MusEGlobal::config.dummyAudioSampleRate); + xml.uintTag(level, "minControlProcessPeriod", MusEGlobal::config.minControlProcessPeriod); + + xml.intTag(level, "guiRefresh", MusEGlobal::config.guiRefresh); + xml.strTag(level, "userInstrumentsDir", MusEGlobal::config.userInstrumentsDir); // Removed by Orcan. 20101220 //xml.strTag(level, "helpBrowser", config.helpBrowser); - xml.intTag(level, "extendedMidi", MusEConfig::config.extendedMidi); - xml.intTag(level, "midiExportDivision", MusEConfig::config.midiDivision); - xml.intTag(level, "guiDivision", MusEConfig::config.guiDivision); - xml.strTag(level, "copyright", MusEConfig::config.copyright); - xml.intTag(level, "smfFormat", MusEConfig::config.smfFormat); - xml.intTag(level, "exp2ByteTimeSigs", MusEConfig::config.exp2ByteTimeSigs); - xml.intTag(level, "expOptimNoteOffs", MusEConfig::config.expOptimNoteOffs); - xml.intTag(level, "importMidiSplitParts", MusEConfig::config.importMidiSplitParts); - xml.intTag(level, "startMode", MusEConfig::config.startMode); - xml.strTag(level, "startSong", MusEConfig::config.startSong); - xml.strTag(level, "projectBaseFolder", MusEConfig::config.projectBaseFolder); - xml.intTag(level, "projectStoreInFolder", MusEConfig::config.projectStoreInFolder); - xml.intTag(level, "useProjectSaveDialog", MusEConfig::config.useProjectSaveDialog); + xml.intTag(level, "extendedMidi", MusEGlobal::config.extendedMidi); + xml.intTag(level, "midiExportDivision", MusEGlobal::config.midiDivision); + xml.intTag(level, "guiDivision", MusEGlobal::config.guiDivision); + xml.strTag(level, "copyright", MusEGlobal::config.copyright); + xml.intTag(level, "smfFormat", MusEGlobal::config.smfFormat); + xml.intTag(level, "exp2ByteTimeSigs", MusEGlobal::config.exp2ByteTimeSigs); + xml.intTag(level, "expOptimNoteOffs", MusEGlobal::config.expOptimNoteOffs); + xml.intTag(level, "importMidiSplitParts", MusEGlobal::config.importMidiSplitParts); + xml.intTag(level, "startMode", MusEGlobal::config.startMode); + xml.strTag(level, "startSong", MusEGlobal::config.startSong); + xml.strTag(level, "projectBaseFolder", MusEGlobal::config.projectBaseFolder); + xml.intTag(level, "projectStoreInFolder", MusEGlobal::config.projectStoreInFolder); + xml.intTag(level, "useProjectSaveDialog", MusEGlobal::config.useProjectSaveDialog); xml.intTag(level, "midiInputDevice", MusEGlobal::midiInputPorts); xml.intTag(level, "midiInputChannel", MusEGlobal::midiInputChannel); xml.intTag(level, "midiRecordType", MusEGlobal::midiRecordType); @@ -1277,79 +1282,80 @@ void MusE::writeGlobalConfiguration(int level, Xml& xml) const //xml.intTag(level, "txDeviceId", txDeviceId); //xml.intTag(level, "rxDeviceId", rxDeviceId); - xml.strTag(level, "theme", MusEConfig::config.style); - xml.strTag(level, "styleSheetFile", MusEConfig::config.styleSheetFile); - xml.strTag(level, "externalWavEditor", MusEConfig::config.externalWavEditor); - xml.intTag(level, "useOldStyleStopShortCut", MusEConfig::config.useOldStyleStopShortCut); - xml.intTag(level, "moveArmedCheckBox", MusEConfig::config.moveArmedCheckBox); - xml.intTag(level, "popupsDefaultStayOpen", MusEConfig::config.popupsDefaultStayOpen); - xml.intTag(level, "leftMouseButtonCanDecrease", MusEConfig::config.leftMouseButtonCanDecrease); - xml.intTag(level, "rangeMarkerWithoutMMB", MusEConfig::config.rangeMarkerWithoutMMB); + xml.strTag(level, "theme", MusEGlobal::config.style); + xml.strTag(level, "styleSheetFile", MusEGlobal::config.styleSheetFile); + xml.strTag(level, "externalWavEditor", MusEGlobal::config.externalWavEditor); + xml.intTag(level, "useOldStyleStopShortCut", MusEGlobal::config.useOldStyleStopShortCut); + xml.intTag(level, "moveArmedCheckBox", MusEGlobal::config.moveArmedCheckBox); + xml.intTag(level, "popupsDefaultStayOpen", MusEGlobal::config.popupsDefaultStayOpen); + xml.intTag(level, "leftMouseButtonCanDecrease", MusEGlobal::config.leftMouseButtonCanDecrease); + xml.intTag(level, "rangeMarkerWithoutMMB", MusEGlobal::config.rangeMarkerWithoutMMB); //for (int i = 0; i < 6; ++i) { for (int i = 0; i < NUM_FONTS; ++i) { char buffer[32]; sprintf(buffer, "font%d", i); - xml.strTag(level, buffer, MusEConfig::config.fonts[i].toString()); + xml.strTag(level, buffer, MusEGlobal::config.fonts[i].toString()); } - xml.intTag(level, "globalAlphaBlend", MusEConfig::config.globalAlphaBlend); + xml.intTag(level, "globalAlphaBlend", MusEGlobal::config.globalAlphaBlend); for (int i = 0; i < 16; ++i) { char buffer[32]; sprintf(buffer, "palette%d", i); - xml.colorTag(level, buffer, MusEConfig::config.palette[i]); + xml.colorTag(level, buffer, MusEGlobal::config.palette[i]); } for (int i = 0; i < NUM_PARTCOLORS; ++i) { char buffer[32]; sprintf(buffer, "partColor%d", i); - xml.colorTag(level, buffer, MusEConfig::config.partColors[i]); + xml.colorTag(level, buffer, MusEGlobal::config.partColors[i]); } for (int i = 0; i < NUM_PARTCOLORS; ++i) { char buffer[32]; sprintf(buffer, "partColorName%d", i); - xml.strTag(level, buffer, MusEConfig::config.partColorNames[i]); + xml.strTag(level, buffer, MusEGlobal::config.partColorNames[i]); } - xml.colorTag(level, "partCanvasBg", MusEConfig::config.partCanvasBg); - xml.colorTag(level, "trackBg", MusEConfig::config.trackBg); - xml.colorTag(level, "selectTrackBg", MusEConfig::config.selectTrackBg); - xml.colorTag(level, "selectTrackFg", MusEConfig::config.selectTrackFg); + xml.colorTag(level, "partCanvasBg", MusEGlobal::config.partCanvasBg); + xml.colorTag(level, "trackBg", MusEGlobal::config.trackBg); + xml.colorTag(level, "selectTrackBg", MusEGlobal::config.selectTrackBg); + xml.colorTag(level, "selectTrackFg", MusEGlobal::config.selectTrackFg); - xml.colorTag(level, "mixerBg", MusEConfig::config.mixerBg); - xml.colorTag(level, "midiTrackLabelBg", MusEConfig::config.midiTrackLabelBg); - xml.colorTag(level, "drumTrackLabelBg", MusEConfig::config.drumTrackLabelBg); - xml.colorTag(level, "newDrumTrackLabelBg", MusEConfig::config.newDrumTrackLabelBg); - xml.colorTag(level, "waveTrackLabelBg", MusEConfig::config.waveTrackLabelBg); - xml.colorTag(level, "outputTrackLabelBg", MusEConfig::config.outputTrackLabelBg); - xml.colorTag(level, "inputTrackLabelBg", MusEConfig::config.inputTrackLabelBg); - xml.colorTag(level, "groupTrackLabelBg", MusEConfig::config.groupTrackLabelBg); - xml.colorTag(level, "auxTrackLabelBg", MusEConfig::config.auxTrackLabelBg); - xml.colorTag(level, "synthTrackLabelBg", MusEConfig::config.synthTrackLabelBg); + xml.colorTag(level, "mixerBg", MusEGlobal::config.mixerBg); + xml.colorTag(level, "midiTrackLabelBg", MusEGlobal::config.midiTrackLabelBg); + xml.colorTag(level, "drumTrackLabelBg", MusEGlobal::config.drumTrackLabelBg); + xml.colorTag(level, "newDrumTrackLabelBg",MusEGlobal::config.newDrumTrackLabelBg); + xml.colorTag(level, "waveTrackLabelBg", MusEGlobal::config.waveTrackLabelBg); + xml.colorTag(level, "outputTrackLabelBg", MusEGlobal::config.outputTrackLabelBg); + xml.colorTag(level, "inputTrackLabelBg", MusEGlobal::config.inputTrackLabelBg); + xml.colorTag(level, "groupTrackLabelBg", MusEGlobal::config.groupTrackLabelBg); + xml.colorTag(level, "auxTrackLabelBg", MusEGlobal::config.auxTrackLabelBg); + xml.colorTag(level, "synthTrackLabelBg", MusEGlobal::config.synthTrackLabelBg); - xml.colorTag(level, "midiTrackBg", MusEConfig::config.midiTrackBg); - xml.colorTag(level, "ctrlGraphFg", MusEConfig::config.ctrlGraphFg); - xml.colorTag(level, "newDrumTrackBg", MusEConfig::config.newDrumTrackBg); - xml.colorTag(level, "waveTrackBg", MusEConfig::config.waveTrackBg); - xml.colorTag(level, "outputTrackBg", MusEConfig::config.outputTrackBg); - xml.colorTag(level, "inputTrackBg", MusEConfig::config.inputTrackBg); - xml.colorTag(level, "groupTrackBg", MusEConfig::config.groupTrackBg); - xml.colorTag(level, "auxTrackBg", MusEConfig::config.auxTrackBg); - xml.colorTag(level, "synthTrackBg", MusEConfig::config.synthTrackBg); + xml.colorTag(level, "midiTrackBg", MusEGlobal::config.midiTrackBg); + xml.colorTag(level, "ctrlGraphFg", MusEGlobal::config.ctrlGraphFg); + xml.colorTag(level, "drumTrackBg", MusEGlobal::config.drumTrackBg); + xml.colorTag(level, "newDrumTrackBg",MusEGlobal::config.newDrumTrackBg); + xml.colorTag(level, "waveTrackBg", MusEGlobal::config.waveTrackBg); + xml.colorTag(level, "outputTrackBg", MusEGlobal::config.outputTrackBg); + xml.colorTag(level, "inputTrackBg", MusEGlobal::config.inputTrackBg); + xml.colorTag(level, "groupTrackBg", MusEGlobal::config.groupTrackBg); + xml.colorTag(level, "auxTrackBg", MusEGlobal::config.auxTrackBg); + xml.colorTag(level, "synthTrackBg", MusEGlobal::config.synthTrackBg); // Removed by Tim. p3.3.6 //xml.intTag(level, "txSyncPort", txSyncPort); //xml.intTag(level, "rxSyncPort", rxSyncPort); - xml.intTag(level, "mtctype", mtcType); + xml.intTag(level, "mtctype", MusEGlobal::mtcType); xml.nput(level, "<mtcoffset>%02d:%02d:%02d:%02d:%02d</mtcoffset>\n", - mtcOffset.h(), mtcOffset.m(), mtcOffset.s(), - mtcOffset.f(), mtcOffset.sf()); - //xml.uintTag(level, "sendClockDelay", syncSendFirstClockDelay); - //xml.intTag(level, "useJackTransport", useJackTransport); - //xml.intTag(level, "jackTransportMaster", jackTransportMaster); - extSyncFlag.save(level, xml); + MusEGlobal::mtcOffset.h(), MusEGlobal::mtcOffset.m(), MusEGlobal::mtcOffset.s(), + MusEGlobal::mtcOffset.f(), MusEGlobal::mtcOffset.sf()); + //xml.uintTag(level, "sendClockDelay", MusEGlobal::syncSendFirstClockDelay); + //xml.intTag(level, "useJackTransport", MusEGlobal::useJackTransport); + //xml.intTag(level, "jackTransportMaster", MusEGlobal::jackTransportMaster); + MusEGlobal::extSyncFlag.save(level, xml); // xml.intTag(level, "genMTCSync", genMTCSync); // xml.intTag(level, "genMCSync", genMCSync); @@ -1358,50 +1364,50 @@ void MusE::writeGlobalConfiguration(int level, Xml& xml) const // xml.intTag(level, "acceptMMC", acceptMMC); // xml.intTag(level, "acceptMC", acceptMC); - xml.qrectTag(level, "geometryMain", MusEConfig::config.geometryMain); - xml.qrectTag(level, "geometryTransport", MusEConfig::config.geometryTransport); - xml.qrectTag(level, "geometryBigTime", MusEConfig::config.geometryBigTime); - //xml.qrectTag(level, "geometryMixer", MusEConfig::config.geometryMixer); // Obsolete + xml.qrectTag(level, "geometryMain", MusEGlobal::config.geometryMain); + xml.qrectTag(level, "geometryTransport", MusEGlobal::config.geometryTransport); + xml.qrectTag(level, "geometryBigTime", MusEGlobal::config.geometryBigTime); + //xml.qrectTag(level, "geometryMixer", MusEGlobal::config.geometryMixer); // Obsolete - xml.intTag(level, "bigtimeVisible", MusEConfig::config.bigTimeVisible); - xml.intTag(level, "transportVisible", MusEConfig::config.transportVisible); + xml.intTag(level, "bigtimeVisible", MusEGlobal::config.bigTimeVisible); + xml.intTag(level, "transportVisible", MusEGlobal::config.transportVisible); - //xml.intTag(level, "mixerVisible", MusEConfig::config.mixerVisible); // Obsolete - xml.intTag(level, "mixer1Visible", MusEConfig::config.mixer1Visible); - xml.intTag(level, "mixer2Visible", MusEConfig::config.mixer2Visible); - //MusEConfig::config.mixer1.write(level, xml, "mixer1"); - //MusEConfig::config.mixer2.write(level, xml, "mixer2"); - MusEConfig::config.mixer1.write(level, xml); - MusEConfig::config.mixer2.write(level, xml); - - xml.intTag(level, "showSplashScreen", MusEConfig::config.showSplashScreen); - xml.intTag(level, "canvasShowPartType", MusEConfig::config.canvasShowPartType); - xml.intTag(level, "canvasShowPartEvent", MusEConfig::config.canvasShowPartEvent); - xml.intTag(level, "canvasShowGrid", MusEConfig::config.canvasShowGrid); - xml.strTag(level, "canvasBgPixmap", MusEConfig::config.canvasBgPixmap); - xml.strTag(level, "canvasCustomBgList", MusEConfig::config.canvasCustomBgList.join(";")); - - xml.colorTag(level, "transportHandleColor", MusEConfig::config.transportHandleColor); - xml.colorTag(level, "bigtimeForegroundcolor", MusEConfig::config.bigTimeForegroundColor); - xml.colorTag(level, "bigtimeBackgroundcolor", MusEConfig::config.bigTimeBackgroundColor); - xml.colorTag(level, "waveEditBackgroundColor", MusEConfig::config.waveEditBackgroundColor); + //xml.intTag(level, "mixerVisible", MusEGlobal::config.mixerVisible); // Obsolete + xml.intTag(level, "mixer1Visible", MusEGlobal::config.mixer1Visible); + xml.intTag(level, "mixer2Visible", MusEGlobal::config.mixer2Visible); + //MusEGlobal::config.mixer1.write(level, xml, "mixer1"); + //MusEGlobal::config.mixer2.write(level, xml, "mixer2"); + MusEGlobal::config.mixer1.write(level, xml); + MusEGlobal::config.mixer2.write(level, xml); + + xml.intTag(level, "showSplashScreen", MusEGlobal::config.showSplashScreen); + xml.intTag(level, "canvasShowPartType", MusEGlobal::config.canvasShowPartType); + xml.intTag(level, "canvasShowPartEvent", MusEGlobal::config.canvasShowPartEvent); + xml.intTag(level, "canvasShowGrid", MusEGlobal::config.canvasShowGrid); + xml.strTag(level, "canvasBgPixmap", MusEGlobal::config.canvasBgPixmap); + xml.strTag(level, "canvasCustomBgList", MusEGlobal::config.canvasCustomBgList.join(";")); + + xml.colorTag(level, "transportHandleColor", MusEGlobal::config.transportHandleColor); + xml.colorTag(level, "bigtimeForegroundcolor", MusEGlobal::config.bigTimeForegroundColor); + xml.colorTag(level, "bigtimeBackgroundcolor", MusEGlobal::config.bigTimeBackgroundColor); + xml.colorTag(level, "waveEditBackgroundColor", MusEGlobal::config.waveEditBackgroundColor); writeSeqConfiguration(level, xml, false); - DrumEdit::writeConfiguration(level, xml); - PianoRoll::writeConfiguration(level, xml); - ScoreEdit::write_configuration(level, xml); - MasterEdit::writeConfiguration(level, xml); - WaveEdit::writeConfiguration(level, xml); - ListEdit::writeConfiguration(level, xml); - ClipListEdit::writeConfiguration(level, xml); - LMaster::writeConfiguration(level, xml); - MarkerView::writeConfiguration(level, xml); - MusEArranger::ArrangerView::writeConfiguration(level, xml); + MusEGui::DrumEdit::writeConfiguration(level, xml); + MusEGui::PianoRoll::writeConfiguration(level, xml); + MusEGui::ScoreEdit::write_configuration(level, xml); + MusEGui::MasterEdit::writeConfiguration(level, xml); + MusEGui::WaveEdit::writeConfiguration(level, xml); + MusEGui::ListEdit::writeConfiguration(level, xml); + MusEGui::ClipListEdit::writeConfiguration(level, xml); + MusEGui::LMaster::writeConfiguration(level, xml); + MusEGui::MarkerView::writeConfiguration(level, xml); + MusEGui::ArrangerView::writeConfiguration(level, xml); - write_function_dialog_config(level, xml); + MusEGui::write_function_dialog_config(level, xml); - writeShortCuts(level, xml); + MusEGui::writeShortCuts(level, xml); xml.etag(level, "configuration"); } @@ -1410,7 +1416,7 @@ void MusE::writeGlobalConfiguration(int level, Xml& xml) const // write song specific configuration //--------------------------------------------------------- -void MusE::writeConfiguration(int level, Xml& xml) const +void MusE::writeConfiguration(int level, MusECore::Xml& xml) const { xml.tag(level++, "configuration"); @@ -1423,13 +1429,13 @@ void MusE::writeConfiguration(int level, Xml& xml) const xml.intTag(level, "midiFilterCtrl3", MusEGlobal::midiFilterCtrl3); xml.intTag(level, "midiFilterCtrl4", MusEGlobal::midiFilterCtrl4); - xml.intTag(level, "waveTracksVisible", WaveTrack::visible()); - xml.intTag(level, "auxTracksVisible", AudioAux::visible()); - xml.intTag(level, "groupTracksVisible", AudioGroup::visible()); - xml.intTag(level, "midiTracksVisible", MidiTrack::visible()); - xml.intTag(level, "inputTracksVisible", AudioInput::visible()); - xml.intTag(level, "outputTracksVisible", AudioOutput::visible()); - xml.intTag(level, "synthTracksVisible", SynthI::visible()); + xml.intTag(level, "waveTracksVisible", MusECore::WaveTrack::visible()); + xml.intTag(level, "auxTracksVisible", MusECore::AudioAux::visible()); + xml.intTag(level, "groupTracksVisible", MusECore::AudioGroup::visible()); + xml.intTag(level, "midiTracksVisible", MusECore::MidiTrack::visible()); + xml.intTag(level, "inputTracksVisible", MusECore::AudioInput::visible()); + xml.intTag(level, "outputTracksVisible", MusECore::AudioOutput::visible()); + xml.intTag(level, "synthTracksVisible", MusECore::SynthI::visible()); // Removed by Tim. p3.3.6 //xml.intTag(level, "txDeviceId", txDeviceId); @@ -1461,22 +1467,22 @@ void MusE::writeConfiguration(int level, Xml& xml) const // Added by Tim. p3.3.6 //xml.tag(level++, "midiSyncInfo"); - //for(iMidiDevice id = midiDevices.begin(); id != midiDevices.end(); ++id) + //for(iMusECore::MidiDevice id = MusECore::MusEGlobal::midiDevices.begin(); id != MusECore::MusEGlobal::midiDevices.end(); ++id) //{ - // MidiDevice* md = *id; + // MusECore::MidiDevice* md = *id; // md->syncInfo().write(level, xml, md); //} //xml.etag(level, "midiSyncInfo"); //xml.intTag(level, "rxSyncPort", rxSyncPort); - xml.intTag(level, "mtctype", mtcType); + xml.intTag(level, "mtctype", MusEGlobal::mtcType); xml.nput(level, "<mtcoffset>%02d:%02d:%02d:%02d:%02d</mtcoffset>\n", - mtcOffset.h(), mtcOffset.m(), mtcOffset.s(), - mtcOffset.f(), mtcOffset.sf()); - xml.uintTag(level, "sendClockDelay", syncSendFirstClockDelay); - xml.intTag(level, "useJackTransport", useJackTransport.value()); - xml.intTag(level, "jackTransportMaster", jackTransportMaster); - extSyncFlag.save(level, xml); + MusEGlobal::mtcOffset.h(), MusEGlobal::mtcOffset.m(), MusEGlobal::mtcOffset.s(), + MusEGlobal::mtcOffset.f(), MusEGlobal::mtcOffset.sf()); + xml.uintTag(level, "sendClockDelay", MusEGlobal::syncSendFirstClockDelay); + xml.intTag(level, "useJackTransport", MusEGlobal::useJackTransport.value()); + xml.intTag(level, "jackTransportMaster", MusEGlobal::jackTransportMaster); + MusEGlobal::extSyncFlag.save(level, xml); // xml.intTag(level, "genMTCSync", genMTCSync); // xml.intTag(level, "genMCSync", genMCSync); @@ -1511,7 +1517,7 @@ void MusE::writeConfiguration(int level, Xml& xml) const //_arranger->writeStatus(level, xml); // Obsolete. done by song's toplevel list. arrangerview also handles arranger. writeSeqConfiguration(level, xml, true); - write_function_dialog_config(level, xml); + MusEGui::write_function_dialog_config(level, xml); writeMidiTransforms(level, xml); writeMidiInputTransforms(level, xml); @@ -1525,8 +1531,8 @@ void MusE::writeConfiguration(int level, Xml& xml) const void MusE::configMidiSync() { if (!midiSyncConfig) - //midiSyncConfig = new MusEWidget::MidiSyncConfig(this); - midiSyncConfig = new MusEWidget::MidiSyncConfig; + //midiSyncConfig = new MusEGui::MidiSyncConfig(this); + midiSyncConfig = new MusEGui::MidiSyncConfig; if (midiSyncConfig->isVisible()) { midiSyncConfig->raise(); @@ -1543,7 +1549,7 @@ void MusE::configMidiSync() void MusE::configMidiFile() { if (!midiFileConfig) - midiFileConfig = new MidiFileConfig(); + midiFileConfig = new MusEGui::MidiFileConfig(); midiFileConfig->updateValues(); if (midiFileConfig->isVisible()) { @@ -1561,7 +1567,7 @@ void MusE::configMidiFile() void MusE::configGlobalSettings() { if (!globalSettingsConfig) - globalSettingsConfig = new MusEWidget::GlobalSettingsConfig(); + globalSettingsConfig = new MusEGui::GlobalSettingsConfig(); if (globalSettingsConfig->isVisible()) { globalSettingsConfig->raise(); @@ -1571,7 +1577,6 @@ void MusE::configGlobalSettings() globalSettingsConfig->show(); } -} // namespace MusEApp //--------------------------------------------------------- // MidiFileConfig @@ -1593,18 +1598,18 @@ MidiFileConfig::MidiFileConfig(QWidget* parent) void MidiFileConfig::updateValues() { int divisionIdx = 2; - switch(MusEConfig::config.midiDivision) { + switch(MusEGlobal::config.midiDivision) { case 96: divisionIdx = 0; break; case 192: divisionIdx = 1; break; case 384: divisionIdx = 2; break; } divisionCombo->setCurrentIndex(divisionIdx); - formatCombo->setCurrentIndex(MusEConfig::config.smfFormat); - extendedFormat->setChecked(MusEConfig::config.extendedMidi); - copyrightEdit->setText(MusEConfig::config.copyright); - optNoteOffs->setChecked(MusEConfig::config.expOptimNoteOffs); - twoByteTimeSigs->setChecked(MusEConfig::config.exp2ByteTimeSigs); - splitPartsCheckBox->setChecked(MusEConfig::config.importMidiSplitParts); + formatCombo->setCurrentIndex(MusEGlobal::config.smfFormat); + extendedFormat->setChecked(MusEGlobal::config.extendedMidi); + copyrightEdit->setText(MusEGlobal::config.copyright); + optNoteOffs->setChecked(MusEGlobal::config.expOptimNoteOffs); + twoByteTimeSigs->setChecked(MusEGlobal::config.exp2ByteTimeSigs); + splitPartsCheckBox->setChecked(MusEGlobal::config.importMidiSplitParts); } //--------------------------------------------------------- @@ -1617,13 +1622,13 @@ void MidiFileConfig::okClicked() int divisions[3] = { 96, 192, 384 }; if (divisionIdx >= 0 && divisionIdx < 3) - MusEConfig::config.midiDivision = divisions[divisionIdx]; - MusEConfig::config.extendedMidi = extendedFormat->isChecked(); - MusEConfig::config.smfFormat = formatCombo->currentIndex(); - MusEConfig::config.copyright = copyrightEdit->text(); - MusEConfig::config.expOptimNoteOffs = optNoteOffs->isChecked(); - MusEConfig::config.exp2ByteTimeSigs = twoByteTimeSigs->isChecked(); - MusEConfig::config.importMidiSplitParts = splitPartsCheckBox->isChecked(); + MusEGlobal::config.midiDivision = divisions[divisionIdx]; + MusEGlobal::config.extendedMidi = extendedFormat->isChecked(); + MusEGlobal::config.smfFormat = formatCombo->currentIndex(); + MusEGlobal::config.copyright = copyrightEdit->text(); + MusEGlobal::config.expOptimNoteOffs = optNoteOffs->isChecked(); + MusEGlobal::config.exp2ByteTimeSigs = twoByteTimeSigs->isChecked(); + MusEGlobal::config.importMidiSplitParts = splitPartsCheckBox->isChecked(); MusEGlobal::muse->changeConfig(true); // write config file close(); @@ -1638,15 +1643,14 @@ void MidiFileConfig::cancelClicked() close(); } -namespace MusEConfig { //--------------------------------------------------------- // write //--------------------------------------------------------- -//void MixerConfig::write(Xml& xml, const char* name) -void MixerConfig::write(int level, Xml& xml) -//void MixerConfig::write(int level, Xml& xml, const char* name) +//void MixerConfig::write(MusECore::Xml& xml, const char* name) +void MixerConfig::write(int level, MusECore::Xml& xml) +//void MixerConfig::write(int level, MusECore::Xml& xml, const char* name) { //xml.stag(QString(name)); //xml.tag(level++, name.toLatin1().constData()); @@ -1679,17 +1683,17 @@ void MixerConfig::write(int level, Xml& xml) //--------------------------------------------------------- //void MixerConfig::read(QDomNode node) -void MixerConfig::read(Xml& xml) -//void MixerConfig::read(Xml& xml, const QString& name) +void MixerConfig::read(MusECore::Xml& xml) +//void MixerConfig::read(MusECore::Xml& xml, const QString& name) { for (;;) { - Xml::Token token(xml.parse()); + MusECore::Xml::Token token(xml.parse()); const QString& tag(xml.s1()); switch (token) { - case Xml::Error: - case Xml::End: + case MusECore::Xml::Error: + case MusECore::Xml::End: return; - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "name") name = xml.parse1(); else if (tag == "geometry") @@ -1716,7 +1720,7 @@ void MixerConfig::read(Xml& xml) //xml.unknown(name.toLatin1().constData()); xml.unknown("Mixer"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: //if (tag == name) if (tag == "Mixer") return; @@ -1727,4 +1731,5 @@ void MixerConfig::read(Xml& xml) } -} // namespace MusEConfig +} // namespace MusEGui + diff --git a/muse2/muse/conf.h b/muse2/muse/conf.h index 4190b671..f3f4753c 100644 --- a/muse2/muse/conf.h +++ b/muse2/muse/conf.h @@ -29,6 +29,9 @@ class QDialog; class QLineEdit; + +namespace MusEGui { + //--------------------------------------------------------- // MidiFileConfig // config properties of exported midi files @@ -46,8 +49,13 @@ class MidiFileConfig : public QDialog, public Ui::ConfigMidiFileBase { void updateValues(); }; +} // namespace MusEGui + +namespace MusECore { class Xml; extern bool readConfiguration(); extern void readConfiguration(Xml&, bool readOnlySequencer, bool doReadGlobalConfig); +} + #endif diff --git a/muse2/muse/confmport.cpp b/muse2/muse/confmport.cpp index 724b5a51..315e686e 100644 --- a/muse2/muse/confmport.cpp +++ b/muse2/muse/confmport.cpp @@ -57,7 +57,11 @@ #include "utils.h" #include "popupmenu.h" -extern std::vector<Synth*> synthis; +namespace MusEGlobal { +extern std::vector<MusECore::Synth*> synthis; +} + +namespace MusEGui { enum { DEVCOL_NO = 0, DEVCOL_GUI, DEVCOL_REC, DEVCOL_PLAY, DEVCOL_INSTR, DEVCOL_NAME, DEVCOL_INROUTES, DEVCOL_OUTROUTES, DEVCOL_DEF_IN_CHANS, DEVCOL_DEF_OUT_CHANS, DEVCOL_STATE }; @@ -86,13 +90,13 @@ void MPConfig::changeDefInputRoutes(QAction* act) return; int actid = act->data().toInt(); int allch = (1 << MIDI_CHANNELS) - 1; - int defch = midiPorts[no].defaultInChannels(); + int defch = MusEGlobal::midiPorts[no].defaultInChannels(); if(actid == MIDI_CHANNELS + 1) // Apply to all tracks now. { // Are there tracks, and is there a port device? // Tested: Hmm, allow ports with no device since that is a valid situation. - if(!song->midis()->empty()) // && midiPorts[no].device()) + if(!MusEGlobal::song->midis()->empty()) // && MusEGlobal::midiPorts[no].device()) { int ret = QMessageBox::question(this, tr("Default input connections"), tr("Are you sure you want to apply to all existing midi tracks now?"), @@ -100,16 +104,16 @@ void MPConfig::changeDefInputRoutes(QAction* act) QMessageBox::Cancel); if(ret == QMessageBox::Ok) { - MidiTrackList* mtl = song->midis(); - for(iMidiTrack it = mtl->begin(); it != mtl->end(); ++it) + MusECore::MidiTrackList* mtl = MusEGlobal::song->midis(); + for(MusECore::iMidiTrack it = mtl->begin(); it != mtl->end(); ++it) { // Remove all routes from this port to the tracks first. - audio->msgRemoveRoute(Route(no, allch), Route(*it, allch)); + MusEGlobal::audio->msgRemoveRoute(MusECore::Route(no, allch), MusECore::Route(*it, allch)); if(defch) - audio->msgAddRoute(Route(no, defch), Route(*it, defch)); + MusEGlobal::audio->msgAddRoute(MusECore::Route(no, defch), MusECore::Route(*it, defch)); } - //audio->msgUpdateSoloStates(); - song->update(SC_ROUTE); + //MusEGlobal::audio->msgUpdateSoloStates(); + MusEGlobal::song->update(SC_ROUTE); } } } @@ -129,8 +133,8 @@ void MPConfig::changeDefInputRoutes(QAction* act) } else chbits = defch ^ (1 << actid); - midiPorts[no].setDefaultInChannels(chbits); - mdevView->item(item->row(), DEVCOL_DEF_IN_CHANS)->setText(MusEUtil::bitmap2String(chbits)); + MusEGlobal::midiPorts[no].setDefaultInChannels(chbits); + mdevView->item(item->row(), DEVCOL_DEF_IN_CHANS)->setText(MusECore::bitmap2String(chbits)); } } @@ -148,7 +152,7 @@ void MPConfig::changeDefOutputRoutes(QAction* act) if(no < 0 || no >= MIDI_PORTS) return; int actid = act->data().toInt(); - int defch = midiPorts[no].defaultOutChannels(); + int defch = MusEGlobal::midiPorts[no].defaultOutChannels(); // Turn on if and when multiple output routes are supported. #if 0 int allch = (1 << MIDI_CHANNELS) - 1; @@ -158,7 +162,7 @@ void MPConfig::changeDefOutputRoutes(QAction* act) { // Are there tracks, and is there a port device? // Tested: Hmm, allow ports with no device since that is a valid situation. - if(!song->midis()->empty()) // && midiPorts[no].device()) + if(!MusEGlobal::song->midis()->empty()) // && MusEGlobal::midiPorts[no].device()) { int ret = QMessageBox::question(this, tr("Default output connections"), tr("Are you sure you want to apply to all existing midi tracks now?"), @@ -166,35 +170,35 @@ void MPConfig::changeDefOutputRoutes(QAction* act) QMessageBox::Cancel); if(ret == QMessageBox::Ok) { - MidiTrackList* mtl = song->midis(); + MusECore::MidiTrackList* mtl = MusEGlobal::song->midis(); // Turn on if and when multiple output routes are supported. #if 0 - for(iMidiTrack it = mtl->begin(); it != mtl->end(); ++it) + for(MusECore::iMidiTrack it = mtl->begin(); it != mtl->end(); ++it) { // Remove all routes from this port to the tracks first. - audio->msgRemoveRoute(Route(no, allch), Route(*it, allch)); + MusEGlobal::audio->msgRemoveRoute(MusECore::Route(no, allch), MusECore::Route(*it, allch)); if(defch) - audio->msgAddRoute(Route(no, defch), Route(*it, defch)); + MusEGlobal::audio->msgAddRoute(MusECore::Route(no, defch), MusECore::Route(*it, defch)); } - audio->msgUpdateSoloStates(); - song->update(SC_ROUTE); + MusEGlobal::audio->msgUpdateSoloStates(); + MusEGlobal::song->update(SC_ROUTE); #else int ch = 0; for( ; ch < MIDI_CHANNELS; ++ch) if(defch & (1 << ch)) break; - audio->msgIdle(true); - for(iMidiTrack it = mtl->begin(); it != mtl->end(); ++it) + MusEGlobal::audio->msgIdle(true); + for(MusECore::iMidiTrack it = mtl->begin(); it != mtl->end(); ++it) { // Leave drum track channel at current setting. - if((*it)->type() == Track::DRUM) + if((*it)->type() == MusECore::Track::DRUM) (*it)->setOutPortAndUpdate(no); else (*it)->setOutPortAndChannelAndUpdate(no, ch); } - audio->msgIdle(false); - audio->msgUpdateSoloStates(); - song->update(SC_MIDI_TRACK_PROP); + MusEGlobal::audio->msgIdle(false); + MusEGlobal::audio->msgUpdateSoloStates(); + MusEGlobal::song->update(SC_MIDI_TRACK_PROP); #endif } } @@ -216,17 +220,17 @@ void MPConfig::changeDefOutputRoutes(QAction* act) } else chbits = defch ^ (1 << actid); - midiPorts[no].setDefaultOutChannels(chbits); - mdevView->item(item->row(), DEVCOL_DEF_OUT_CHANS)->setText(MusEUtil::bitmap2String(chbits)); + MusEGlobal::midiPorts[no].setDefaultOutChannels(chbits); + mdevView->item(item->row(), DEVCOL_DEF_OUT_CHANS)->setText(MusECore::bitmap2String(chbits)); #else if(actid < MIDI_CHANNELS) { int chbits = 1 << actid; // Multiple out routes not supported. Make the setting exclusive to this port - exclude all other ports. - setPortExclusiveDefOutChan(no, chbits); + MusECore::setPortExclusiveDefOutChan(no, chbits); int j = mdevView->rowCount(); for(int i = 0; i < j; ++i) - mdevView->item(i, DEVCOL_DEF_OUT_CHANS)->setText(MusEUtil::bitmap2String(i == no ? chbits : 0)); + mdevView->item(i, DEVCOL_DEF_OUT_CHANS)->setText(MusECore::bitmap2String(i == no ? chbits : 0)); if(defpup) { QAction* a; @@ -266,9 +270,9 @@ void MPConfig::mdevViewItemRenamed(QTableWidgetItem* item) return; int allch = (1 << MIDI_CHANNELS) - 1; int ch = allch & string2bitmap(s); - midiPorts[no].setDefaultInChannels(ch); + MusEGlobal::midiPorts[no].setDefaultInChannels(ch); - if(!song->midis()->empty() && midiPorts[no].device()) // Only if there are tracks, and device is valid. + if(!MusEGlobal::song->midis()->empty() && MusEGlobal::midiPorts[no].device()) // Only if there are tracks, and device is valid. { int ret = QMessageBox::question(this, tr("Default input connections"), tr("Setting will apply to new midi tracks.\n" @@ -277,17 +281,17 @@ void MPConfig::mdevViewItemRenamed(QTableWidgetItem* item) QMessageBox::No); if(ret == QMessageBox::Yes) { - MidiTrackList* mtl = song->midis(); - for(iMidiTrack it = mtl->begin(); it != mtl->end(); ++it) + MusECore::MidiTrackList* mtl = MusEGlobal::song->midis(); + for(MusECore::iMidiTrack it = mtl->begin(); it != mtl->end(); ++it) { // Remove all routes from this port to the tracks first. - audio->msgRemoveRoute(Route(no, allch), Route(*it, allch)); + MusEGlobal::audio->msgRemoveRoute(MusECore::Route(no, allch), MusECore::Route(*it, allch)); if(ch) - audio->msgAddRoute(Route(no, ch), Route(*it, ch)); + MusEGlobal::audio->msgAddRoute(MusECore::Route(no, ch), MusECore::Route(*it, ch)); } } } - song->update(); + MusEGlobal::song->update(); } break; #endif @@ -304,9 +308,9 @@ void MPConfig::mdevViewItemRenamed(QTableWidgetItem* item) return; int allch = (1 << MIDI_CHANNELS) - 1; int ch = allch & string2bitmap(s); - midiPorts[no].setDefaultOutChannels(ch); + MusEGlobal::midiPorts[no].setDefaultOutChannels(ch); - if(!song->midis()->empty() && midiPorts[no].device()) // Only if there are tracks, and device is valid. + if(!MusEGlobal::song->midis()->empty() && MusEGlobal::midiPorts[no].device()) // Only if there are tracks, and device is valid. { int ret = QMessageBox::question(this, tr("Default output connections"), tr("Setting will apply to new midi tracks.\n" @@ -315,17 +319,17 @@ void MPConfig::mdevViewItemRenamed(QTableWidgetItem* item) QMessageBox::No); if(ret == QMessageBox::Yes) { - MidiTrackList* mtl = song->midis(); - for(iMidiTrack it = mtl->begin(); it != mtl->end(); ++it) + MusECore::MidiTrackList* mtl = MusEGlobal::song->midis(); + for(MusECore::iMidiTrack it = mtl->begin(); it != mtl->end(); ++it) { // Remove all routes from the tracks to this port first. - audio->msgRemoveRoute(Route(*it, allch), Route(no, allch)); + MusEGlobal::audio->msgRemoveRoute(MusECore::Route(*it, allch), MusECore::Route(no, allch)); if(ch) - audio->msgAddRoute(Route(*it, ch), Route(no, ch)); + MusEGlobal::audio->msgAddRoute(MusECore::Route(*it, ch), MusECore::Route(no, ch)); } } } - song->update(); + MusEGlobal::song->update(); } break; # endif @@ -337,15 +341,15 @@ void MPConfig::mdevViewItemRenamed(QTableWidgetItem* item) if(no < 0 || no >= MIDI_PORTS) return; - MidiPort* port = &midiPorts[no]; - MidiDevice* dev = port->device(); + MusECore::MidiPort* port = &MusEGlobal::midiPorts[no]; + MusECore::MidiDevice* dev = port->device(); // Only Jack midi devices. - if(!dev || dev->deviceType() != MidiDevice::JACK_MIDI) + if(!dev || dev->deviceType() != MusECore::MidiDevice::JACK_MIDI) return; if(dev->name() == s) return; - if(midiDevices.find(s)) + if(MusEGlobal::midiDevices.find(s)) { QMessageBox::critical(this, tr("MusE: bad device name"), @@ -357,7 +361,7 @@ void MPConfig::mdevViewItemRenamed(QTableWidgetItem* item) return; } dev->setName(s); - song->update(); + MusEGlobal::song->update(); } break; default: @@ -380,8 +384,8 @@ void MPConfig::rbClicked(QTableWidgetItem* item) return; int n; - MidiPort* port = &midiPorts[no]; - MidiDevice* dev = port->device(); + MusECore::MidiPort* port = &MusEGlobal::midiPorts[no]; + MusECore::MidiDevice* dev = port->device(); int rwFlags = dev ? dev->rwFlags() : 0; int openFlags = dev ? dev->openFlags() : 0; QTableWidget* listView = item->tableWidget(); @@ -413,10 +417,10 @@ void MPConfig::rbClicked(QTableWidgetItem* item) return; openFlags ^= 0x2; dev->setOpenFlags(openFlags); - midiSeq->msgSetMidiDevice(port, dev); // reopen device + MusEGlobal::midiSeq->msgSetMidiDevice(port, dev); // reopen device item->setIcon(openFlags & 2 ? QIcon(*dotIcon) : QIcon(*dothIcon)); - if(dev->deviceType() == MidiDevice::JACK_MIDI) + if(dev->deviceType() == MusECore::MidiDevice::JACK_MIDI) { if(dev->openFlags() & 2) { @@ -436,10 +440,10 @@ void MPConfig::rbClicked(QTableWidgetItem* item) return; openFlags ^= 0x1; dev->setOpenFlags(openFlags); - midiSeq->msgSetMidiDevice(port, dev); // reopen device + MusEGlobal::midiSeq->msgSetMidiDevice(port, dev); // reopen device item->setIcon(openFlags & 1 ? QIcon(*dotIcon) : QIcon(*dothIcon)); - if(dev->deviceType() == MidiDevice::JACK_MIDI) + if(dev->deviceType() == MusECore::MidiDevice::JACK_MIDI) { if(dev->openFlags() & 1) { @@ -460,24 +464,24 @@ void MPConfig::rbClicked(QTableWidgetItem* item) if(!MusEGlobal::checkAudioDevice()) return; - if(audioDevice->deviceType() != AudioDevice::JACK_AUDIO) // Only if Jack is running. + if(MusEGlobal::audioDevice->deviceType() != MusECore::AudioDevice::JACK_AUDIO) // Only if Jack is running. return; if(!dev) return; // Only Jack midi devices. - //MidiJackDevice* mjd = dynamic_cast<MidiJackDevice*>(dev); + //MusECore::MidiJackDevice* mjd = dynamic_cast<MusECore::MidiJackDevice*>(dev); //if(!mjd) - if(dev->deviceType() != MidiDevice::JACK_MIDI) + if(dev->deviceType() != MusECore::MidiDevice::JACK_MIDI) return; //if(!(dev->rwFlags() & ((col == DEVCOL_OUTROUTES) ? 1 : 2))) if(!(dev->openFlags() & ((col == DEVCOL_OUTROUTES) ? 1 : 2))) return; - //RouteList* rl = (dev->rwFlags() & 1) ? dev->outRoutes() : dev->inRoutes(); - RouteList* rl = (col == DEVCOL_OUTROUTES) ? dev->outRoutes() : dev->inRoutes(); + //MusECore::RouteList* rl = (dev->rwFlags() & 1) ? dev->outRoutes() : dev->inRoutes(); + MusECore::RouteList* rl = (col == DEVCOL_OUTROUTES) ? dev->outRoutes() : dev->inRoutes(); QMenu* pup = 0; int gid = 0; std::list<QString> sl; @@ -488,8 +492,8 @@ void MPConfig::rbClicked(QTableWidgetItem* item) gid = 0; // Jack input ports if device is writable, and jack output ports if device is readable. - //sl = (dev->rwFlags() & 1) ? audioDevice->inputPorts(true, _showAliases) : audioDevice->outputPorts(true, _showAliases); - sl = (col == DEVCOL_OUTROUTES) ? audioDevice->inputPorts(true, _showAliases) : audioDevice->outputPorts(true, _showAliases); + //sl = (dev->rwFlags() & 1) ? MusEGlobal::audioDevice->inputPorts(true, _showAliases) : MusEGlobal::audioDevice->outputPorts(true, _showAliases); + sl = (col == DEVCOL_OUTROUTES) ? MusEGlobal::audioDevice->inputPorts(true, _showAliases) : MusEGlobal::audioDevice->outputPorts(true, _showAliases); //for (int i = 0; i < channel; ++i) //{ @@ -519,10 +523,10 @@ void MPConfig::rbClicked(QTableWidgetItem* item) act->setData(gid); act->setCheckable(true); - //Route dst(*ip, true, i); - //Route rt(*ip, (dev->rwFlags() & 1), -1, Route::JACK_ROUTE); - Route rt(*ip, (col == DEVCOL_OUTROUTES), -1, Route::JACK_ROUTE); - for(ciRoute ir = rl->begin(); ir != rl->end(); ++ir) + //MusECore::Route dst(*ip, true, i); + //MusECore::Route rt(*ip, (dev->rwFlags() & 1), -1, MusECore::Route::JACK_ROUTE); + MusECore::Route rt(*ip, (col == DEVCOL_OUTROUTES), -1, MusECore::Route::JACK_ROUTE); + for(MusECore::ciRoute ir = rl->begin(); ir != rl->end(); ++ir) { if (*ir == rt) { @@ -565,10 +569,10 @@ void MPConfig::rbClicked(QTableWidgetItem* item) //if(dev->rwFlags() & 1) // Writeable if(col == DEVCOL_OUTROUTES) // Writeable { - Route srcRoute(dev, -1); - Route dstRoute(s, true, -1, Route::JACK_ROUTE); + MusECore::Route srcRoute(dev, -1); + MusECore::Route dstRoute(s, true, -1, MusECore::Route::JACK_ROUTE); - ciRoute iir = rl->begin(); + MusECore::ciRoute iir = rl->begin(); for(; iir != rl->end(); ++iir) { if(*iir == dstRoute) @@ -576,19 +580,19 @@ void MPConfig::rbClicked(QTableWidgetItem* item) } if(iir != rl->end()) // disconnect - audio->msgRemoveRoute(srcRoute, dstRoute); + MusEGlobal::audio->msgRemoveRoute(srcRoute, dstRoute); else // connect - audio->msgAddRoute(srcRoute, dstRoute); + MusEGlobal::audio->msgAddRoute(srcRoute, dstRoute); } else //if(dev->rwFlags() & 2) // Readable //if(col == DEVCOL_INROUTES) // Readable { - Route srcRoute(s, false, -1, Route::JACK_ROUTE); - Route dstRoute(dev, -1); + MusECore::Route srcRoute(s, false, -1, MusECore::Route::JACK_ROUTE); + MusECore::Route dstRoute(dev, -1); - ciRoute iir = rl->begin(); + MusECore::ciRoute iir = rl->begin(); for(; iir != rl->end(); ++iir) { if(*iir == srcRoute) @@ -596,14 +600,14 @@ void MPConfig::rbClicked(QTableWidgetItem* item) } if(iir != rl->end()) // disconnect - audio->msgRemoveRoute(srcRoute, dstRoute); + MusEGlobal::audio->msgRemoveRoute(srcRoute, dstRoute); else // connect - audio->msgAddRoute(srcRoute, dstRoute); + MusEGlobal::audio->msgAddRoute(srcRoute, dstRoute); } - audio->msgUpdateSoloStates(); - song->update(SC_ROUTE); + MusEGlobal::audio->msgUpdateSoloStates(); + MusEGlobal::song->update(SC_ROUTE); //delete pup; // FIXME: @@ -624,10 +628,10 @@ void MPConfig::rbClicked(QTableWidgetItem* item) return; #else { - defpup = new MusEWidget::PopupMenu(this, true); - defpup->addAction(new MusEWidget::MenuTitleItem("Channel", defpup)); + defpup = new MusEGui::PopupMenu(this, true); + defpup->addAction(new MusEGui::MenuTitleItem("Channel", defpup)); QAction* act = 0; - int chbits = midiPorts[no].defaultInChannels(); + int chbits = MusEGlobal::midiPorts[no].defaultInChannels(); for(int i = 0; i < MIDI_CHANNELS; ++i) { act = defpup->addAction(QString().setNum(i + 1)); @@ -644,7 +648,7 @@ void MPConfig::rbClicked(QTableWidgetItem* item) act->setData(MIDI_CHANNELS + 1); // Enable only if there are tracks, and port has a device. // Tested: Hmm, allow ports with no device since that is a valid situation. - act->setEnabled(!song->midis()->empty()); // && midiPorts[no].device()); + act->setEnabled(!MusEGlobal::song->midis()->empty()); // && MusEGlobal::midiPorts[no].device()); connect(defpup, SIGNAL(triggered(QAction*)), SLOT(changeDefInputRoutes(QAction*))); //connect(defpup, SIGNAL(aboutToHide()), MusEGlobal::muse, SLOT(routingPopupMenuAboutToHide())); @@ -664,10 +668,10 @@ void MPConfig::rbClicked(QTableWidgetItem* item) return; #else { - defpup = new MusEWidget::PopupMenu(this, true); - defpup->addAction(new MusEWidget::MenuTitleItem("Channel", defpup)); + defpup = new MusEGui::PopupMenu(this, true); + defpup->addAction(new MusEGui::MenuTitleItem("Channel", defpup)); QAction* act = 0; - int chbits = midiPorts[no].defaultOutChannels(); + int chbits = MusEGlobal::midiPorts[no].defaultOutChannels(); for(int i = 0; i < MIDI_CHANNELS; ++i) { act = defpup->addAction(QString().setNum(i + 1)); @@ -687,7 +691,7 @@ void MPConfig::rbClicked(QTableWidgetItem* item) act->setData(MIDI_CHANNELS + 1); // Enable only if there are tracks, and port has a device. // Tested: Hmm, allow ports with no device since that is a valid situation. - act->setEnabled(!song->midis()->empty()); // && midiPorts[no].device()); + act->setEnabled(!MusEGlobal::song->midis()->empty()); // && MusEGlobal::midiPorts[no].device()); connect(defpup, SIGNAL(triggered(QAction*)), SLOT(changeDefOutputRoutes(QAction*))); //connect(defpup, SIGNAL(aboutToHide()), MusEGlobal::muse, SLOT(routingPopupMenuAboutToHide())); @@ -739,27 +743,27 @@ void MPConfig::rbClicked(QTableWidgetItem* item) int aix = 0x10000000; int jix = 0x20000000; int six = 0x30000000; - for(iMidiDevice i = midiDevices.begin(); i != midiDevices.end(); ++i) + for(MusECore::iMidiDevice i = MusEGlobal::midiDevices.begin(); i != MusEGlobal::midiDevices.end(); ++i) { //devALSA = dynamic_cast<MidiAlsaDevice*>(*i); //if(devALSA) - if((*i)->deviceType() == MidiDevice::ALSA_MIDI) + if((*i)->deviceType() == MusECore::MidiDevice::ALSA_MIDI) { //mapALSA.insert( std::pair<std::string, int> (std::string(devALSA->name().lower().toLatin1().constData()), ii) ); mapALSA.insert( std::pair<std::string, int> (std::string((*i)->name().toLatin1().constData()), aix) ); ++aix; } else - if((*i)->deviceType() == MidiDevice::JACK_MIDI) + if((*i)->deviceType() == MusECore::MidiDevice::JACK_MIDI) { - //devJACK = dynamic_cast<MidiJackDevice*>(*i); + //devJACK = dynamic_cast<MusECore::MidiJackDevice*>(*i); //if(devJACK) //mapJACK.insert( std::pair<std::string, int> (std::string(devJACK->name().lower().toLatin1().constData()), ii) ); mapJACK.insert( std::pair<std::string, int> (std::string((*i)->name().toLatin1().constData()), jix) ); ++jix; } else - if((*i)->deviceType() == MidiDevice::SYNTH_MIDI) + if((*i)->deviceType() == MusECore::MidiDevice::SYNTH_MIDI) { mapSYNTH.insert( std::pair<std::string, int> (std::string((*i)->name().toLatin1().constData()), six) ); ++six; @@ -768,11 +772,11 @@ void MPConfig::rbClicked(QTableWidgetItem* item) printf("MPConfig::rbClicked unknown midi device: %s\n", (*i)->name().toLatin1().constData()); } - //int sz = midiDevices.size(); + //int sz = MusEGlobal::midiDevices.size(); //if(!mapALSA.empty()) { pup->addSeparator(); - pup->addAction(new MusEWidget::MenuTitleItem(QT_TRANSLATE_NOOP("@default", "ALSA:"), pup)); + pup->addAction(new MusEGui::MenuTitleItem(QT_TRANSLATE_NOOP("@default", "ALSA:"), pup)); for(imap i = mapALSA.begin(); i != mapALSA.end(); ++i) { @@ -780,11 +784,11 @@ void MPConfig::rbClicked(QTableWidgetItem* item) //if(idx > sz) // Sanity check // continue; QString s(i->first.c_str()); - MidiDevice* md = midiDevices.find(s, MidiDevice::ALSA_MIDI); + MusECore::MidiDevice* md = MusEGlobal::midiDevices.find(s, MusECore::MidiDevice::ALSA_MIDI); if(md) { //if(!dynamic_cast<MidiAlsaDevice*>(md)) - if(md->deviceType() != MidiDevice::ALSA_MIDI) + if(md->deviceType() != MusECore::MidiDevice::ALSA_MIDI) continue; act = pup->addAction(QT_TRANSLATE_NOOP("@default", md->name())); @@ -798,7 +802,7 @@ void MPConfig::rbClicked(QTableWidgetItem* item) if(!mapSYNTH.empty()) { pup->addSeparator(); - pup->addAction(new MusEWidget::MenuTitleItem(QT_TRANSLATE_NOOP("@default", "SYNTH:"), pup)); + pup->addAction(new MusEGui::MenuTitleItem(QT_TRANSLATE_NOOP("@default", "SYNTH:"), pup)); for(imap i = mapSYNTH.begin(); i != mapSYNTH.end(); ++i) { @@ -806,11 +810,11 @@ void MPConfig::rbClicked(QTableWidgetItem* item) //if(idx > sz) // continue; QString s(i->first.c_str()); - MidiDevice* md = midiDevices.find(s, MidiDevice::SYNTH_MIDI); + MusECore::MidiDevice* md = MusEGlobal::midiDevices.find(s, MusECore::MidiDevice::SYNTH_MIDI); if(md) { - //if(!dynamic_cast<MidiJackDevice*>(md)) - if(md->deviceType() != MidiDevice::SYNTH_MIDI) + //if(!dynamic_cast<MusECore::MidiJackDevice*>(md)) + if(md->deviceType() != MusECore::MidiDevice::SYNTH_MIDI) continue; act = pup->addAction(QT_TRANSLATE_NOOP("@default", md->name())); @@ -824,7 +828,7 @@ void MPConfig::rbClicked(QTableWidgetItem* item) //if(!mapJACK.empty()) { pup->addSeparator(); - pup->addAction(new MusEWidget::MenuTitleItem(QT_TRANSLATE_NOOP("@default", "JACK:"), pup)); + pup->addAction(new MusEGui::MenuTitleItem(QT_TRANSLATE_NOOP("@default", "JACK:"), pup)); for(imap i = mapJACK.begin(); i != mapJACK.end(); ++i) { @@ -832,11 +836,11 @@ void MPConfig::rbClicked(QTableWidgetItem* item) //if(idx > sz) // continue; QString s(i->first.c_str()); - MidiDevice* md = midiDevices.find(s, MidiDevice::JACK_MIDI); + MusECore::MidiDevice* md = MusEGlobal::midiDevices.find(s, MusECore::MidiDevice::JACK_MIDI); if(md) { - //if(!dynamic_cast<MidiJackDevice*>(md)) - if(md->deviceType() != MidiDevice::JACK_MIDI) + //if(!dynamic_cast<MusECore::MidiJackDevice*>(md)) + if(md->deviceType() != MusECore::MidiDevice::JACK_MIDI) continue; act = pup->addAction(QT_TRANSLATE_NOOP("@default", md->name())); @@ -858,13 +862,13 @@ void MPConfig::rbClicked(QTableWidgetItem* item) n = act->data().toInt(); //printf("MPConfig::rbClicked n:%d\n", n); - MidiDevice* sdev = 0; + MusECore::MidiDevice* sdev = 0; if(n < 0x10000000) { delete pup; if(n <= 2) { - sdev = MidiJackDevice::createJackMidiDevice(); + sdev = MusECore::MidiJackDevice::createJackMidiDevice(); if(sdev) { @@ -883,24 +887,24 @@ void MPConfig::rbClicked(QTableWidgetItem* item) { int typ; if(n < 0x20000000) - typ = MidiDevice::ALSA_MIDI; + typ = MusECore::MidiDevice::ALSA_MIDI; else if(n < 0x30000000) - typ = MidiDevice::JACK_MIDI; + typ = MusECore::MidiDevice::JACK_MIDI; else //if(n < 0x40000000) - typ = MidiDevice::SYNTH_MIDI; + typ = MusECore::MidiDevice::SYNTH_MIDI; - sdev = midiDevices.find(act->text(), typ); + sdev = MusEGlobal::midiDevices.find(act->text(), typ); delete pup; // Is it the current device? Reset it to <none>. if(sdev == dev) sdev = 0; } - midiSeq->msgSetMidiDevice(port, sdev); + MusEGlobal::midiSeq->msgSetMidiDevice(port, sdev); MusEGlobal::muse->changeConfig(true); // save configuration file - song->update(); + MusEGlobal::song->update(); } } //break; @@ -914,15 +918,15 @@ void MPConfig::rbClicked(QTableWidgetItem* item) if (instrPopup == 0) instrPopup = new QMenu(this); instrPopup->clear(); - for (iMidiInstrument i = midiInstruments.begin(); i - != midiInstruments.end(); ++i) + for (MusECore::iMidiInstrument i = MusECore::midiInstruments.begin(); i + != MusECore::midiInstruments.end(); ++i) { // By T356. // Do not list synths. Although it is possible to assign a synth // as an instrument to a non-synth device, we should not allow this. // (One reason is that the 'show gui' column is then enabled, which // makes no sense for a non-synth device). - SynthI* si = dynamic_cast<SynthI*>(*i); + MusECore::SynthI* si = dynamic_cast<MusECore::SynthI*>(*i); if(!si) instrPopup->addAction((*i)->iname()); } @@ -933,14 +937,14 @@ void MPConfig::rbClicked(QTableWidgetItem* item) return; QString s = act->text(); item->tableWidget()->item(item->row(), DEVCOL_INSTR)->setText(s); - for (iMidiInstrument i = midiInstruments.begin(); i - != midiInstruments.end(); ++i) { + for (MusECore::iMidiInstrument i = MusECore::midiInstruments.begin(); i + != MusECore::midiInstruments.end(); ++i) { if ((*i)->iname() == s) { port->setInstrument(*i); break; } } - song->update(); + MusEGlobal::song->update(); } //break; return; @@ -1084,7 +1088,7 @@ MPConfig::MPConfig(QWidget* parent) this, SLOT(rbClicked(QTableWidgetItem*))); connect(mdevView, SIGNAL(itemChanged(QTableWidgetItem*)), this, SLOT(mdevViewItemRenamed(QTableWidgetItem*))); - connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); + connect(MusEGlobal::song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); connect(synthList, SIGNAL(itemSelectionChanged()), SLOT(selectionChanged())); connect(instanceList, SIGNAL(itemSelectionChanged()), SLOT(selectionChanged())); @@ -1142,8 +1146,8 @@ void MPConfig::songChanged(int flags) for (int i = MIDI_PORTS-1; i >= 0; --i) { mdevView->blockSignals(true); // otherwise itemChanged() is triggered and bad things happen. - MidiPort* port = &midiPorts[i]; - MidiDevice* dev = port->device(); + MusECore::MidiPort* port = &MusEGlobal::midiPorts[i]; + MusECore::MidiDevice* dev = port->device(); QString s; s.setNum(i+1); QTableWidgetItem* itemno = new QTableWidgetItem(s); @@ -1179,10 +1183,10 @@ void MPConfig::songChanged(int flags) QTableWidgetItem* itemin = new QTableWidgetItem; addItem(i, DEVCOL_INROUTES, itemin, mdevView); itemin->setFlags(Qt::ItemIsEnabled); - //QTableWidgetItem* itemdefin = new QTableWidgetItem(MusEUtil::bitmap2String(port->defaultInChannels())); + //QTableWidgetItem* itemdefin = new QTableWidgetItem(MusECore::bitmap2String(port->defaultInChannels())); // Ignore synth devices. Default input routes make no sense for them (right now). QTableWidgetItem* itemdefin = new QTableWidgetItem((dev && dev->isSynti()) ? - QString() : MusEUtil::bitmap2String(port->defaultInChannels())); + QString() : MusECore::bitmap2String(port->defaultInChannels())); addItem(i, DEVCOL_DEF_IN_CHANS, itemdefin, mdevView); // Enabled: Use editor (not good). Disabled: Use pop-up menu. #if 0 @@ -1199,12 +1203,12 @@ void MPConfig::songChanged(int flags) // Turn on if and when multiple output routes are supported. #if 0 - QTableWidgetItem* itemdefout = new QTableWidgetItem(MusEUtil::bitmap2String(port->defaultOutChannels())); + QTableWidgetItem* itemdefout = new QTableWidgetItem(MusECore::bitmap2String(port->defaultOutChannels())); addItem(i, DEVCOL_DEF_OUT_CHANS, itemdefout, mdevView); itemdefout->setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled); #else //QTableWidgetItem* itemdefout = new QTableWidgetItem(QString("--")); - QTableWidgetItem* itemdefout = new QTableWidgetItem(MusEUtil::bitmap2String(0)); + QTableWidgetItem* itemdefout = new QTableWidgetItem(MusECore::bitmap2String(0)); defochs = port->defaultOutChannels(); if(defochs) { @@ -1228,8 +1232,8 @@ void MPConfig::songChanged(int flags) itemname->setText(dev->name()); // Is it a Jack midi device? Allow renaming. - //if(dynamic_cast<MidiJackDevice*>(dev)) - if (dev->deviceType() == MidiDevice::JACK_MIDI) + //if(dynamic_cast<MusECore::MidiJackDevice*>(dev)) + if (dev->deviceType() == MusECore::MidiDevice::JACK_MIDI) itemname->setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled); if (dev->rwFlags() & 0x2) @@ -1260,8 +1264,8 @@ void MPConfig::songChanged(int flags) itemname->setIcon(QIcon(*buttondownIcon)); - //if(dev && dynamic_cast<MidiJackDevice*>(dev)) - if(dev && dev->deviceType() == MidiDevice::JACK_MIDI) + //if(dev && dynamic_cast<MusECore::MidiJackDevice*>(dev)) + if(dev && dev->deviceType() == MusECore::MidiDevice::JACK_MIDI) { //item->setPixmap(DEVCOL_ROUTES, *buttondownIcon); //item->setText(DEVCOL_ROUTES, tr("routes")); @@ -1293,8 +1297,8 @@ void MPConfig::songChanged(int flags) QString s; synthList->clear(); - for (std::vector<Synth*>::iterator i = synthis.begin(); - i != synthis.end(); ++i) { + for (std::vector<MusECore::Synth*>::iterator i = MusEGlobal::synthis.begin(); + i != MusEGlobal::synthis.end(); ++i) { //s = (*i)->baseName(); //s = (*i)->name(); @@ -1311,8 +1315,8 @@ void MPConfig::songChanged(int flags) item->setText(4, QString((*i)->description())); } instanceList->clear(); - SynthIList* sl = song->syntis(); - for (iSynthI si = sl->begin(); si != sl->end(); ++si) { + MusECore::SynthIList* sl = MusEGlobal::song->syntis(); + for (MusECore::iSynthI si = sl->begin(); si != sl->end(); ++si) { QTreeWidgetItem* iitem = new QTreeWidgetItem(instanceList); iitem->setText(0, (*si)->name()); if ((*si)->midiPort() == -1) @@ -1341,18 +1345,18 @@ void MPConfig::addInstanceClicked() QTreeWidgetItem* item = synthList->currentItem(); if (item == 0) return; - SynthI *si = song->createSynthI(item->text(0), item->text(2)); // Add at end of list. + MusECore::SynthI *si = MusEGlobal::song->createSynthI(item->text(0), item->text(2)); // Add at end of list. if(!si) return; // add instance last in midi device list for (int i = 0; i < MIDI_PORTS; ++i) { - MidiPort* port = &midiPorts[i]; - MidiDevice* dev = port->device(); + MusECore::MidiPort* port = &MusEGlobal::midiPorts[i]; + MusECore::MidiDevice* dev = port->device(); if (dev==0) { - midiSeq->msgSetMidiDevice(port, si); + MusEGlobal::midiSeq->msgSetMidiDevice(port, si); MusEGlobal::muse->changeConfig(true); // save configuration file - song->update(); + MusEGlobal::song->update(); break; } } @@ -1367,8 +1371,8 @@ void MPConfig::removeInstanceClicked() QTreeWidgetItem* item = instanceList->currentItem(); if (item == 0) return; - SynthIList* sl = song->syntis(); - iSynthI ii; + MusECore::SynthIList* sl = MusEGlobal::song->syntis(); + MusECore::iSynthI ii; for (ii = sl->begin(); ii != sl->end(); ++ii) { if ((*ii)->iname() == item->text(0)) break; @@ -1377,10 +1381,9 @@ void MPConfig::removeInstanceClicked() printf("synthesizerConfig::removeInstanceClicked(): synthi not found\n"); return; } - audio->msgRemoveTrack(*ii); + MusEGlobal::audio->msgRemoveTrack(*ii); } -namespace MusEApp { //--------------------------------------------------------- // configMidiPorts @@ -1389,11 +1392,12 @@ namespace MusEApp { void MusE::configMidiPorts() { if (!midiPortConfig) { - midiPortConfig = new MPConfig(this); + midiPortConfig = new MusEGui::MPConfig(this); } midiPortConfig->show(); midiPortConfig->raise(); midiPortConfig->activateWindow(); } -} // namespace MusEApp +} // namespace MusEGui + diff --git a/muse2/muse/confmport.h b/muse2/muse/confmport.h index 3e286b60..5d360319 100644 --- a/muse2/muse/confmport.h +++ b/muse2/muse/confmport.h @@ -34,11 +34,13 @@ class QTableWidget; class QPoint; class QMenu; class QAction; + +namespace MusECore { class Xml; +} -namespace MusEWidget { +namespace MusEGui { class PopupMenu; -} //--------------------------------------------------------- // MPConfig @@ -49,7 +51,7 @@ class MPConfig : public QDialog, Ui::SynthConfigBase { Q_OBJECT QMenu* instrPopup; //QMenu* popup; - MusEWidget::PopupMenu* defpup; + MusEGui::PopupMenu* defpup; int _showAliases; // -1: None. 0: First aliases. 1: Second aliases etc. void setWhatsThis(QTableWidgetItem *item, int col); void setToolTip(QTableWidgetItem *item, int col); @@ -74,4 +76,6 @@ class MPConfig : public QDialog, Ui::SynthConfigBase { ~MPConfig(); }; +} // namespace MusEGui + #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/ctrl.cpp b/muse2/muse/ctrl.cpp index 3779682d..bc4ce246 100644 --- a/muse2/muse/ctrl.cpp +++ b/muse2/muse/ctrl.cpp @@ -37,6 +37,8 @@ #include "xml.h" #include "audio.h" +namespace MusECore { + void CtrlList::initColor(int i) { QColor collist[] = { Qt::red, Qt::yellow, Qt::blue , Qt::black, Qt::white, Qt::green }; @@ -156,11 +158,11 @@ double CtrlList::value(int frame) const //printf("before val1=%f val2=%f\n", val1,val2); if (_valueType == VAL_LOG) { val1 = 20.0*fast_log10(val1); - if (val1 < MusEConfig::config.minSlider) - val1=MusEConfig::config.minSlider; + if (val1 < MusEGlobal::config.minSlider) + val1=MusEGlobal::config.minSlider; val2 = 20.0*fast_log10(val2); - if (val2 < MusEConfig::config.minSlider) - val2=MusEConfig::config.minSlider; + if (val2 < MusEGlobal::config.minSlider) + val2=MusEGlobal::config.minSlider; } //printf("after val1=%f val2=%f\n", val1,val2); frame -= frame1; @@ -395,3 +397,4 @@ void CtrlListList::add(CtrlList* vl) insert(std::pair<const int, CtrlList*>(vl->id(), vl)); } +} // namespace MusECore diff --git a/muse2/muse/ctrl.h b/muse2/muse/ctrl.h index 1b603251..5e4ee531 100644 --- a/muse2/muse/ctrl.h +++ b/muse2/muse/ctrl.h @@ -31,19 +31,21 @@ #include <list> #include <qcolor.h> -const int AC_VOLUME = 0; -const int AC_PAN = 1; -const int AC_MUTE = 2; - #define AC_PLUGIN_CTL_BASE 0x1000 #define AC_PLUGIN_CTL_BASE_POW 12 #define AC_PLUGIN_CTL_ID_MASK 0xFFF -//inline int genACnum(int plugin, int ctrl) { return (plugin + 1) * AC_PLUGIN_CTL_BASE + ctrl; } -inline unsigned long genACnum(unsigned long plugin, unsigned long ctrl) { return (plugin + 1) * AC_PLUGIN_CTL_BASE + ctrl; } +namespace MusECore { class Xml; +const int AC_VOLUME = 0; +const int AC_PAN = 1; +const int AC_MUTE = 2; + +//inline int genACnum(int plugin, int ctrl) { return (plugin + 1) * AC_PLUGIN_CTL_BASE + ctrl; } +inline unsigned long genACnum(unsigned long plugin, unsigned long ctrl) { return (plugin + 1) * AC_PLUGIN_CTL_BASE + ctrl; } + enum CtrlValueType { VAL_LOG, VAL_LINEAR, VAL_INT, VAL_BOOL }; enum CtrlRecValueType { ARVT_VAL, ARVT_START, ARVT_STOP }; @@ -168,5 +170,7 @@ class CtrlListList : public std::map<int, CtrlList*, std::less<int> > { } }; +} // namespace MusECore + #endif diff --git a/muse2/muse/ctrl/ctrlcanvas.cpp b/muse2/muse/ctrl/ctrlcanvas.cpp index fb4816f9..9c5d636f 100644 --- a/muse2/muse/ctrl/ctrlcanvas.cpp +++ b/muse2/muse/ctrl/ctrlcanvas.cpp @@ -40,16 +40,18 @@ #include "ctrlpanel.h" #include "midiedit/drummap.h" -static MidiCtrlValList veloList(CTRL_VELOCITY); // dummy +static MusECore::MidiCtrlValList veloList(MusECore::CTRL_VELOCITY); // dummy + +namespace MusEGui { //--------------------------------------------------------- // computeVal //--------------------------------------------------------- -static int computeVal(MidiController* mc, int y, int height) +static int computeVal(MusECore::MidiController* mc, int y, int height) { int min; int max; - if(mc->num() == CTRL_PROGRAM) + if(mc->num() == MusECore::CTRL_PROGRAM) { min = 1; max = 128; @@ -64,7 +66,7 @@ static int computeVal(MidiController* mc, int y, int height) val = min; if (val > max) val = max; - if(mc->num() != CTRL_PROGRAM) + if(mc->num() != MusECore::CTRL_PROGRAM) val += mc->bias(); return val; } @@ -73,10 +75,10 @@ static int computeVal(MidiController* mc, int y, int height) // computeY //--------------------------------------------------------- -static int computeY(const MidiController* mc, int val, int height) +static int computeY(const MusECore::MidiController* mc, int val, int height) { int min; int max; - if(mc->num() == CTRL_PROGRAM) + if(mc->num() == MusECore::CTRL_PROGRAM) { min = 1; max = 128; @@ -89,7 +91,7 @@ static int computeY(const MidiController* mc, int val, int height) //printf("computeY #1 min:%d max:%d val:%d bias:%d height:%d\n", min, max, val, mc->bias(), height); - if(mc->num() != CTRL_PROGRAM) + if(mc->num() != MusECore::CTRL_PROGRAM) val -= mc->bias(); if (val < min) @@ -108,7 +110,7 @@ static int computeY(const MidiController* mc, int val, int height) // CEvent //--------------------------------------------------------- -CEvent::CEvent(Event e, MidiPart* pt, int v) +CEvent::CEvent(MusECore::Event e, MusECore::MidiPart* pt, int v) { _event = e; //_state = Normal; @@ -121,7 +123,7 @@ CEvent::CEvent(Event e, MidiPart* pt, int v) // intersects //--------------------------------------------------------- -bool CEvent::intersects(const MidiController* mc, const QRect& r, const int tickstep, const int wh) const +bool CEvent::intersects(const MusECore::MidiController* mc, const QRect& r, const int tickstep, const int wh) const { if(_event.empty()) return false; @@ -143,7 +145,7 @@ bool CEvent::intersects(const MidiController* mc, const QRect& r, const int tick // Remember, each drawn pixel represents one tickstep which varies with zoom. // So that's 3 x tickstep for each velocity line. // Hmm, actually, for better pin-point accuracy just use one tickstep for now. - if(midiControllerType(mc->num()) == MidiController::Velo) + if(MusECore::midiControllerType(mc->num()) == MusECore::MidiController::Velo) { //tick1 -= tickstep; //if(tick1 <= 0) @@ -199,10 +201,10 @@ CtrlCanvas::CtrlCanvas(MidiEditor* e, QWidget* parent, int xmag, const char* name, CtrlPanel* pnl) : View(parent, xmag, 1, name) { setBg(Qt::white); - setFont(MusEConfig::config.fonts[3]); + setFont(MusEGlobal::config.fonts[3]); editor = e; drag = DRAG_OFF; - tool = MusEWidget::PointerTool; + tool = MusEGui::PointerTool; pos[0] = 0; pos[1] = 0; pos[2] = 0; @@ -211,12 +213,12 @@ CtrlCanvas::CtrlCanvas(MidiEditor* e, QWidget* parent, int xmag, //_lastDelta = QPoint(0, 0); ctrl = &veloList; - _controller = &veloCtrl; + _controller = &MusECore::veloCtrl; _panel = pnl; - _cnum = CTRL_VELOCITY; - _dnum = CTRL_VELOCITY; - _didx = CTRL_VELOCITY; - connect(song, SIGNAL(posChanged(int, unsigned, bool)), this, SLOT(setPos(int, unsigned, bool))); + _cnum = MusECore::CTRL_VELOCITY; + _dnum = MusECore::CTRL_VELOCITY; + _didx = MusECore::CTRL_VELOCITY; + connect(MusEGlobal::song, SIGNAL(posChanged(int, unsigned, bool)), this, SLOT(setPos(int, unsigned, bool))); setMouseTracking(true); if (editor->parts()->empty()) { @@ -226,7 +228,7 @@ CtrlCanvas::CtrlCanvas(MidiEditor* e, QWidget* parent, int xmag, else { setCurTrackAndPart(); } - connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); + connect(MusEGlobal::song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); connect(MusEGlobal::muse, SIGNAL(configChanged()), SLOT(configChanged())); curDrumInstrument = editor->curDrumInstrument(); @@ -257,10 +259,10 @@ void CtrlCanvas::setPos(int idx, unsigned val, bool adjustScrollbar) int npos = mapx(val); if (adjustScrollbar && idx == 0) { - switch (song->follow()) { - case Song::NO: + switch (MusEGlobal::song->follow()) { + case MusECore::Song::NO: break; - case Song::JUMP: + case MusECore::Song::JUMP: if (npos >= width()) { int ppos = val - rmapxDev(width()/4); if (ppos < 0) @@ -278,7 +280,7 @@ void CtrlCanvas::setPos(int idx, unsigned val, bool adjustScrollbar) npos = mapx(val); } break; - case Song::CONTINUOUS: + case MusECore::Song::CONTINUOUS: if (npos > (width()*5)/8) { int ppos = pos[idx] - rmapxDev(width()*5/8); if (ppos < 0) @@ -325,8 +327,8 @@ void CtrlCanvas::setMidiController(int num) if(_panel) { - if(_cnum == CTRL_VELOCITY) - _panel->setHWController(curTrack, &veloCtrl); + if(_cnum == MusECore::CTRL_VELOCITY) + _panel->setHWController(curTrack, &MusECore::veloCtrl); else _panel->setHWController(curTrack, _controller); } @@ -419,17 +421,17 @@ void CtrlCanvas::setController(int num) bool CtrlCanvas::setCurTrackAndPart() { bool changed = false; - MidiPart* part = 0; - MidiTrack* track = 0; + MusECore::MidiPart* part = 0; + MusECore::MidiTrack* track = 0; if(!editor->parts()->empty()) { - Part* pt = editor->curCanvasPart(); + MusECore::Part* pt = editor->curCanvasPart(); if(pt && pt->track()) { if(pt->track()->isMidiTrack()) { - part = (MidiPart*)pt; + part = (MusECore::MidiPart*)pt; track = part->track(); } } @@ -472,7 +474,7 @@ void CtrlCanvas::songChanged(int type) return; if(type & SC_CONFIG) - setFont(MusEConfig::config.fonts[3]); + setFont(MusEGlobal::config.fonts[3]); bool changed = false; if(type & (SC_CONFIG | SC_PART_MODIFIED | SC_SELECTION)) @@ -502,14 +504,14 @@ void CtrlCanvas::songChanged(int type) // partControllers //--------------------------------------------------------- -void CtrlCanvas::partControllers(const MidiPart* part, int num, int* dnum, int* didx, MidiController** mc, MidiCtrlValList** mcvl) +void CtrlCanvas::partControllers(const MusECore::MidiPart* part, int num, int* dnum, int* didx, MusECore::MidiController** mc, MusECore::MidiCtrlValList** mcvl) { - if(num == CTRL_VELOCITY) // special case + if(num == MusECore::CTRL_VELOCITY) // special case { if(mcvl) *mcvl = &veloList; if(mc) - *mc = &veloCtrl; + *mc = &MusECore::veloCtrl; if(dnum) *dnum = num; if(didx) @@ -530,26 +532,26 @@ void CtrlCanvas::partControllers(const MidiPart* part, int num, int* dnum, int* return; } - MidiTrack* mt = part->track(); - MidiPort* mp; + MusECore::MidiTrack* mt = part->track(); + MusECore::MidiPort* mp; int di; int n; - if((mt->type() != Track::DRUM) && curDrumInstrument != -1) //FINDMICHJETZT was ist das? + if((mt->type() != MusECore::Track::DRUM) && curDrumInstrument != -1) //FINDMICHJETZT was ist das? printf("keyfilter != -1 in non drum track?\n"); - if((mt->type() == Track::DRUM) && (curDrumInstrument != -1) && ((num & 0xff) == 0xff)) //FINDMICHJETZT was ist das? + if((mt->type() == MusECore::Track::DRUM) && (curDrumInstrument != -1) && ((num & 0xff) == 0xff)) //FINDMICHJETZT was ist das? { di = (num & ~0xff) | curDrumInstrument; - n = (num & ~0xff) | drumMap[curDrumInstrument].anote; // construct real controller number + n = (num & ~0xff) | MusEGlobal::drumMap[curDrumInstrument].anote; // construct real controller number //num = (num & ~0xff) | curDrumInstrument); // construct real controller number - mp = &midiPorts[drumMap[curDrumInstrument].port]; + mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[curDrumInstrument].port]; } else { di = num; n = num; - mp = &midiPorts[mt->outPort()]; + mp = &MusEGlobal::midiPorts[mt->outPort()]; } if(dnum) @@ -563,9 +565,9 @@ void CtrlCanvas::partControllers(const MidiPart* part, int num, int* dnum, int* if(mcvl) { - MidiCtrlValList* tmcvl = 0; - MidiCtrlValListList* cvll = mp->controller(); - for(iMidiCtrlValList i = cvll->begin(); i != cvll->end(); ++i) + MusECore::MidiCtrlValList* tmcvl = 0; + MusECore::MidiCtrlValListList* cvll = mp->controller(); + for(MusECore::iMidiCtrlValList i = cvll->begin(); i != cvll->end(); ++i) { if(i->second->num() == n) { @@ -593,29 +595,29 @@ void CtrlCanvas::updateItems() { CEvent *newev = 0; - for (iPart p = editor->parts()->begin(); p != editor->parts()->end(); ++p) + for (MusECore::iPart p = editor->parts()->begin(); p != editor->parts()->end(); ++p) { - Event last; + MusECore::Event last; CEvent* lastce = 0; - MidiPart* part = (MidiPart*)(p->second); - EventList* el = part->events(); - //MidiController* mc; - MidiCtrlValList* mcvl; + MusECore::MidiPart* part = (MusECore::MidiPart*)(p->second); + MusECore::EventList* el = part->events(); + //MusECore::MidiController* mc; + MusECore::MidiCtrlValList* mcvl; //partControllers(part, _cnum, 0, 0, &mc, &mcvl); partControllers(part, _cnum, 0, 0, 0, &mcvl); unsigned len = part->lenTick(); - for (iEvent i = el->begin(); i != el->end(); ++i) + for (MusECore::iEvent i = el->begin(); i != el->end(); ++i) { - Event e = i->second; + MusECore::Event e = i->second; // Added by T356. Do not add events which are past the end of the part. if(e.tick() >= len) break; - if(_cnum == CTRL_VELOCITY && e.type() == Note) + if(_cnum == MusECore::CTRL_VELOCITY && e.type() == MusECore::Note) { - //printf("CtrlCanvas::updateItems CTRL_VELOCITY curDrumInstrument:%d\n", curDrumInstrument); + //printf("CtrlCanvas::updateItems MusECore::CTRL_VELOCITY curDrumInstrument:%d\n", curDrumInstrument); newev = 0; if(curDrumInstrument == -1) { @@ -628,11 +630,11 @@ void CtrlCanvas::updateItems() if(newev && e.selected()) selection.push_back(newev); } - else if (e.type() == Controller && e.dataA() == _didx) + else if (e.type() == MusECore::Controller && e.dataA() == _didx) { if(mcvl && last.empty()) { - lastce = new CEvent(Event(), part, mcvl->value(part->tick())); + lastce = new CEvent(MusECore::Event(), part, mcvl->value(part->tick())); items.add(lastce); } if (lastce) @@ -678,16 +680,16 @@ void CtrlCanvas::viewMousePressEvent(QMouseEvent* event) return; start = event->pos(); - MusEWidget::Tool activeTool = tool; + MusEGui::Tool activeTool = tool; bool ctrlKey = event->modifiers() & Qt::ControlModifier; int xpos = start.x(); int ypos = start.y(); - MidiController::ControllerType type = midiControllerType(_controller->num()); + MusECore::MidiController::ControllerType type = MusECore::midiControllerType(_controller->num()); switch (activeTool) { - case MusEWidget::PointerTool: + case MusEGui::PointerTool: if(curPart) // p4.0.27 { drag = DRAG_LASSO_START; @@ -707,7 +709,7 @@ void CtrlCanvas::viewMousePressEvent(QMouseEvent* event) CEvent* ev = *i; if(ev->part() != curPart) continue; - Event event = ev->event(); + MusECore::Event event = ev->event(); if(event.empty()) continue; int ax = event.tick() + partTick; @@ -732,32 +734,32 @@ void CtrlCanvas::viewMousePressEvent(QMouseEvent* event) break; - case MusEWidget::PencilTool: - if ((!ctrlKey) && (type != MidiController::Velo)) { + case MusEGui::PencilTool: + if ((!ctrlKey) && (type != MusECore::MidiController::Velo)) { drag = DRAG_NEW; - song->startUndo(); + MusEGlobal::song->startUndo(); newVal(xpos, ypos); } else { drag = DRAG_RESIZE; - song->startUndo(); + MusEGlobal::song->startUndo(); changeVal(xpos, xpos, ypos); } break; - case MusEWidget::RubberTool: - if (type != MidiController::Velo) { + case MusEGui::RubberTool: + if (type != MusECore::MidiController::Velo) { drag = DRAG_DELETE; - song->startUndo(); + MusEGlobal::song->startUndo(); deleteVal(xpos, xpos, ypos); } break; - case MusEWidget::DrawTool: + case MusEGui::DrawTool: if (drawLineMode) { line2x = xpos; line2y = ypos; - if ((!ctrlKey) && (type != MidiController::Velo)) + if ((!ctrlKey) && (type != MusECore::MidiController::Velo)) newValRamp(line1x, line1y, line2x, line2y); else changeValRamp(line1x, line1y, line2x, line2y); @@ -817,7 +819,7 @@ void CtrlCanvas::viewMouseMoveEvent(QMouseEvent* event) default: break; } - if (tool == MusEWidget::DrawTool && drawLineMode) { + if (tool == MusEGui::DrawTool && drawLineMode) { line2x = pos.x(); line2y = pos.y(); redraw(); @@ -841,16 +843,16 @@ void CtrlCanvas::viewMouseReleaseEvent(QMouseEvent* event) ///case DRAG_RESIZE: ///case DRAG_NEW: ///case DRAG_DELETE: - ///song->endUndo(SC_EVENT_MODIFIED | SC_EVENT_INSERTED); + ///MusEGlobal::song->endUndo(SC_EVENT_MODIFIED | SC_EVENT_INSERTED); ///break; case DRAG_RESIZE: - song->endUndo(SC_EVENT_MODIFIED); + MusEGlobal::song->endUndo(SC_EVENT_MODIFIED); break; case DRAG_NEW: - song->endUndo(SC_EVENT_MODIFIED | SC_EVENT_INSERTED | SC_EVENT_REMOVED); + MusEGlobal::song->endUndo(SC_EVENT_MODIFIED | SC_EVENT_INSERTED | SC_EVENT_REMOVED); break; case DRAG_DELETE: - song->endUndo(SC_EVENT_REMOVED); + MusEGlobal::song->endUndo(SC_EVENT_REMOVED); break; case DRAG_LASSO_START: @@ -888,7 +890,7 @@ void CtrlCanvas::viewMouseReleaseEvent(QMouseEvent* event) } drag = DRAG_OFF; // Let songChanged handle the redraw upon SC_SELECTION. - song->update(SC_SELECTION); // + MusEGlobal::song->update(SC_SELECTION); // } break; @@ -930,22 +932,22 @@ void CtrlCanvas::newValRamp(int x1, int y1, int x2, int y2) int raster = editor->raster(); if (raster == 1) // set reasonable raster { - //raster = MusEConfig::config.division/4; - raster = MusEConfig::config.division/16; // Let's use 64th notes, for a bit finer resolution. p4.0.18 Tim. + //raster = MusEGlobal::config.division/4; + raster = MusEGlobal::config.division/16; // Let's use 64th notes, for a bit finer resolution. p4.0.18 Tim. useRaster = true; } - Undo operations; + MusECore::Undo operations; // delete existing events unsigned curPartTick = curPart->tick(); - int lastpv = CTRL_VAL_UNKNOWN; + int lastpv = MusECore::CTRL_VAL_UNKNOWN; for (ciCEvent i = items.begin(); i != items.end(); ++i) { CEvent* ev = *i; if (ev->part() != curPart) continue; - Event event = ev->event(); + MusECore::Event event = ev->event(); if (event.empty()) continue; int x = event.tick() + curPartTick; @@ -957,7 +959,7 @@ void CtrlCanvas::newValRamp(int x1, int y1, int x2, int y2) break; // Do port controller values and clone parts. - operations.push_back(UndoOp(UndoOp::DeleteEvent, event, curPart, true, true)); + operations.push_back(MusECore::UndoOp(MusECore::UndoOp::DeleteEvent, event, curPart, true, true)); } if (ctrl) @@ -977,14 +979,14 @@ void CtrlCanvas::newValRamp(int x1, int y1, int x2, int y2) // Do not add events which are past the end of the part. if (tick >= curPartLen) break; - Event event(Controller); + MusECore::Event event(MusECore::Controller); event.setTick(tick); event.setA(_didx); - if (type == CTRL_PROGRAM) + if (type == MusECore::CTRL_PROGRAM) { - if (lastpv == CTRL_VAL_UNKNOWN) + if (lastpv == MusECore::CTRL_VAL_UNKNOWN) { - if (song->mtype() == MT_GM) + if (MusEGlobal::song->mtype() == MT_GM) event.setB(0xffff00 | (nval - 1)); else event.setB(nval - 1); @@ -996,10 +998,10 @@ void CtrlCanvas::newValRamp(int x1, int y1, int x2, int y2) event.setB(nval); // Do port controller values and clone parts. - operations.push_back(UndoOp(UndoOp::AddEvent, event, curPart, true, true)); + operations.push_back(MusECore::UndoOp(MusECore::UndoOp::AddEvent, event, curPart, true, true)); } - song->applyOperationGroup(operations); + MusEGlobal::song->applyOperationGroup(operations); } //--------------------------------------------------------- @@ -1015,26 +1017,26 @@ void CtrlCanvas::changeValRamp(int x1, int y1, int x2, int y2) bool changed = false; int type = _controller->num(); - Undo operations; + MusECore::Undo operations; for (ciCEvent i = items.begin(); i != items.end(); ++i) { if ((*i)->contains(x1, x2)) { CEvent* ev = *i; if (ev->part() != curPart) continue; - Event event = ev->event(); + MusECore::Event event = ev->event(); if (event.empty()) continue; int x = event.tick() + curPart->tick(); int y = (x2==x1) ? y1 : (((y2-y1)*(x-x1))/(x2-x1))+y1; int nval = computeVal(_controller, y, h); - if (type == CTRL_PROGRAM) + if (type == MusECore::CTRL_PROGRAM) { - if (event.dataB() == CTRL_VAL_UNKNOWN) + if (event.dataB() == MusECore::CTRL_VAL_UNKNOWN) { --nval; - if(song->mtype() == MT_GM) + if(MusEGlobal::song->mtype() == MT_GM) nval |= 0xffff00; } else @@ -1043,24 +1045,24 @@ void CtrlCanvas::changeValRamp(int x1, int y1, int x2, int y2) ev->setVal(nval); - if (type == CTRL_VELOCITY) { + if (type == MusECore::CTRL_VELOCITY) { if ((event.velo() != nval)) { - Event newEvent = event.clone(); + MusECore::Event newEvent = event.clone(); newEvent.setVelo(nval); ev->setEvent(newEvent); // Do not do port controller values and clone parts. - operations.push_back(UndoOp(UndoOp::ModifyEvent, newEvent, event, curPart, false, false)); + operations.push_back(MusECore::UndoOp(MusECore::UndoOp::ModifyEvent, newEvent, event, curPart, false, false)); changed = true; } } else { if (!event.empty()) { if ((event.dataB() != nval)) { - Event newEvent = event.clone(); + MusECore::Event newEvent = event.clone(); newEvent.setB(nval); ev->setEvent(newEvent); // Do port controller values and clone parts. - operations.push_back(UndoOp(UndoOp::ModifyEvent, newEvent, event, curPart, true, true)); + operations.push_back(MusECore::UndoOp(MusECore::UndoOp::ModifyEvent, newEvent, event, curPart, true, true)); changed = true; } } @@ -1068,7 +1070,7 @@ void CtrlCanvas::changeValRamp(int x1, int y1, int x2, int y2) } } - song->applyOperationGroup(operations); + MusEGlobal::song->applyOperationGroup(operations); } //--------------------------------------------------------- @@ -1091,16 +1093,16 @@ void CtrlCanvas::changeVal(int x1, int x2, int y) CEvent* ev = *i; if(ev->part() != curPart) continue; - Event event = ev->event(); + MusECore::Event event = ev->event(); - if (type == CTRL_VELOCITY) { + if (type == MusECore::CTRL_VELOCITY) { if ((event.velo() != newval)) { ev->setVal(newval); - Event newEvent = event.clone(); + MusECore::Event newEvent = event.clone(); newEvent.setVelo(newval); ev->setEvent(newEvent); // Indicate no undo, and do not do port controller values and clone parts. - audio->msgChangeEvent(event, newEvent, curPart, false, false, false); + MusEGlobal::audio->msgChangeEvent(event, newEvent, curPart, false, false, false); ///ev->setEvent(newEvent); changed = true; } @@ -1108,12 +1110,12 @@ void CtrlCanvas::changeVal(int x1, int x2, int y) else { if (!event.empty()) { int nval = newval; - if(type == CTRL_PROGRAM) + if(type == MusECore::CTRL_PROGRAM) { - if(event.dataB() == CTRL_VAL_UNKNOWN) + if(event.dataB() == MusECore::CTRL_VAL_UNKNOWN) { --nval; - if(song->mtype() == MT_GM) + if(MusEGlobal::song->mtype() == MT_GM) nval |= 0xffff00; } else @@ -1122,11 +1124,11 @@ void CtrlCanvas::changeVal(int x1, int x2, int y) ev->setVal(nval); if ((event.dataB() != nval)) { - Event newEvent = event.clone(); + MusECore::Event newEvent = event.clone(); newEvent.setB(nval); ev->setEvent(newEvent); // Indicate no undo, and do port controller values and clone parts. - audio->msgChangeEvent(event, newEvent, curPart, false, true, true); + MusEGlobal::audio->msgChangeEvent(event, newEvent, curPart, false, true, true); ///ev->setEvent(newEvent); changed = true; } @@ -1164,7 +1166,7 @@ void CtrlCanvas::newVal(int x1, int y) iCEvent insertPoint = items.end(); // Similar case here. bool curPartFound = false; - int lastpv = CTRL_VAL_UNKNOWN; + int lastpv = MusECore::CTRL_VAL_UNKNOWN; if(ctrl) lastpv = ctrl->hwVal(); @@ -1189,7 +1191,7 @@ void CtrlCanvas::newVal(int x1, int y) curPartFound = true; //int partTick = ev->part()->tick(); - Event event = ev->event(); + MusECore::Event event = ev->event(); if (event.empty()) { prev_ev = i; @@ -1207,7 +1209,7 @@ void CtrlCanvas::newVal(int x1, int y) } //if(ax <= xx1) //{ - // if(type == CTRL_PROGRAM && event.dataB() != CTRL_VAL_UNKNOWN && ((event.dataB() & 0xffffff) != 0xffffff)) + // if(type == MusECore::CTRL_PROGRAM && event.dataB() != MusECore::CTRL_VAL_UNKNOWN && ((event.dataB() & 0xffffff) != 0xffffff)) // lastpv = event.dataB(); // if(ax < xx1) // continue; @@ -1223,17 +1225,17 @@ void CtrlCanvas::newVal(int x1, int y) // break; int nval = newval; - if(type == CTRL_PROGRAM) + if(type == MusECore::CTRL_PROGRAM) { - if(event.dataB() == CTRL_VAL_UNKNOWN) + if(event.dataB() == MusECore::CTRL_VAL_UNKNOWN) { - //if(lastpv == CTRL_VAL_UNKNOWN) + //if(lastpv == MusECore::CTRL_VAL_UNKNOWN) // lastpv = ctrl->hwVal(); - if(lastpv == CTRL_VAL_UNKNOWN) + if(lastpv == MusECore::CTRL_VAL_UNKNOWN) { --nval; - if(song->mtype() == MT_GM) + if(MusEGlobal::song->mtype() == MT_GM) nval |= 0xffff00; } else @@ -1250,14 +1252,14 @@ void CtrlCanvas::newVal(int x1, int y) ev->setVal(nval); if ((event.dataB() != nval)) { - Event newEvent = event.clone(); + MusECore::Event newEvent = event.clone(); newEvent.setB(nval); //printf("CtrlCanvas::newVal2 change xx1:%d xx2:%d len:%d\n", xx1, xx2, curPart->lenTick()); ev->setEvent(newEvent); // Indicate no undo, and do port controller values and clone parts. - audio->msgChangeEvent(event, newEvent, curPart, false, true, true); + MusEGlobal::audio->msgChangeEvent(event, newEvent, curPart, false, true, true); ///ev->setEvent(newEvent); @@ -1274,7 +1276,7 @@ void CtrlCanvas::newVal(int x1, int y) deselectItem(ev); // Indicate no undo, and do port controller values and clone parts. - audio->msgDeleteEvent(event, curPart, false, true, true); + MusEGlobal::audio->msgDeleteEvent(event, curPart, false, true, true); delete (ev); i = items.erase(i); @@ -1302,14 +1304,14 @@ void CtrlCanvas::newVal(int x1, int y) // Do not add events which are past the end of the part. if((unsigned)tick < curPart->lenTick()) { - Event event(Controller); + MusECore::Event event(MusECore::Controller); event.setTick(tick); event.setA(_didx); - if(type == CTRL_PROGRAM) + if(type == MusECore::CTRL_PROGRAM) { - if(lastpv == CTRL_VAL_UNKNOWN) + if(lastpv == MusECore::CTRL_VAL_UNKNOWN) { - if(song->mtype() == MT_GM) + if(MusEGlobal::song->mtype() == MT_GM) event.setB(0xffff00 | (newval - 1)); else event.setB(newval - 1); @@ -1323,7 +1325,7 @@ void CtrlCanvas::newVal(int x1, int y) //printf("CtrlCanvas::newVal2 add tick:%d A:%d B:%d\n", tick, event.dataA(), event.dataB()); // Indicate no undo, and do port controller values and clone parts. - audio->msgAddEvent(event, curPart, false, true, true); + MusEGlobal::audio->msgAddEvent(event, curPart, false, true, true); CEvent* newev = new CEvent(event, curPart, event.dataB()); insertPoint = items.insert(insertPoint, newev); @@ -1388,8 +1390,8 @@ void CtrlCanvas::newVal(int x1, int y1, int x2, int y2) int raster = editor->raster(); if (raster == 1) // set reasonable raster { - //raster = MusEConfig::config.division/4; - raster = MusEConfig::config.division/16; // Let's use 64th notes, for a bit finer resolution. p4.0.18 Tim. + //raster = MusEGlobal::config.division/4; + raster = MusEGlobal::config.division/16; // Let's use 64th notes, for a bit finer resolution. p4.0.18 Tim. useRaster = true; } @@ -1401,7 +1403,7 @@ void CtrlCanvas::newVal(int x1, int y1, int x2, int y2) iCEvent insertPoint = items.end(); // Similar case here. iCEvent ice_tmp; bool curPartFound = false; - int lastpv = CTRL_VAL_UNKNOWN; + int lastpv = MusECore::CTRL_VAL_UNKNOWN; int partTick = curPart->tick(); for (iCEvent i = items.begin(); i != items.end() ; ) { @@ -1421,7 +1423,7 @@ void CtrlCanvas::newVal(int x1, int y1, int x2, int y2) } curPartFound = true; - Event event = ev->event(); + MusECore::Event event = ev->event(); if (event.empty()) { prev_ev = i; @@ -1439,7 +1441,7 @@ void CtrlCanvas::newVal(int x1, int y1, int x2, int y2) } //if (x <= xx1) //{ - // if(type == CTRL_PROGRAM && event.dataB() != CTRL_VAL_UNKNOWN && ((event.dataB() & 0xffffff) != 0xffffff)) + // if(type == MusECore::CTRL_PROGRAM && event.dataB() != MusECore::CTRL_VAL_UNKNOWN && ((event.dataB() & 0xffffff) != 0xffffff)) // lastpv = event.dataB(); // if (x < xx1) // continue; @@ -1452,7 +1454,7 @@ void CtrlCanvas::newVal(int x1, int y1, int x2, int y2) deselectItem(ev); // Indicate no undo, and do port controller values and clone parts. - audio->msgDeleteEvent(event, curPart, false, true, true); + MusEGlobal::audio->msgDeleteEvent(event, curPart, false, true, true); delete (ev); i = items.erase(i); @@ -1486,14 +1488,14 @@ void CtrlCanvas::newVal(int x1, int y1, int x2, int y2) // Do not add events which are past the end of the part. if((unsigned)tick >= curPart->lenTick()) break; - Event event(Controller); + MusECore::Event event(MusECore::Controller); event.setTick(tick); event.setA(_didx); - if(type == CTRL_PROGRAM) + if(type == MusECore::CTRL_PROGRAM) { - if(lastpv == CTRL_VAL_UNKNOWN) + if(lastpv == MusECore::CTRL_VAL_UNKNOWN) { - if(song->mtype() == MT_GM) + if(MusEGlobal::song->mtype() == MT_GM) event.setB(0xffff00 | (nval - 1)); else event.setB(nval - 1); @@ -1505,7 +1507,7 @@ void CtrlCanvas::newVal(int x1, int y1, int x2, int y2) event.setB(nval); // Indicate no undo, and do port controller values and clone parts. - audio->msgAddEvent(event, curPart, false, true, true); + MusEGlobal::audio->msgAddEvent(event, curPart, false, true, true); CEvent* newev = new CEvent(event, curPart, event.dataB()); insertPoint = items.insert(insertPoint, newev); @@ -1574,7 +1576,7 @@ void CtrlCanvas::deleteVal(int x1, int x2, int) } curPartFound = true; - Event event = ev->event(); + MusECore::Event event = ev->event(); if (event.empty()) { prev_ev = i; @@ -1593,7 +1595,7 @@ void CtrlCanvas::deleteVal(int x1, int x2, int) deselectItem(ev); // Indicate no undo, and do port controller values and clone parts. - audio->msgDeleteEvent(event, curPart, false, true, true); + MusEGlobal::audio->msgDeleteEvent(event, curPart, false, true, true); delete (ev); i = items.erase(i); @@ -1621,14 +1623,14 @@ void CtrlCanvas::deleteVal(int x1, int x2, int) void CtrlCanvas::setTool(int t) { - if (tool == MusEWidget::Tool(t)) + if (tool == MusEGui::Tool(t)) return; - tool = MusEWidget::Tool(t); + tool = MusEGui::Tool(t); switch(tool) { - case MusEWidget::PencilTool: + case MusEGui::PencilTool: setCursor(QCursor(*pencilIcon, 4, 15)); break; - case MusEWidget::DrawTool: + case MusEGui::DrawTool: drawLineMode = false; break; default: @@ -1641,7 +1643,7 @@ void CtrlCanvas::setTool(int t) // pdrawItems //--------------------------------------------------------- -void CtrlCanvas::pdrawItems(QPainter& p, const QRect& rect, const MidiPart* part, bool velo, bool fg) +void CtrlCanvas::pdrawItems(QPainter& p, const QRect& rect, const MusECore::MidiPart* part, bool velo, bool fg) { int x = rect.x() - 1; // compensate for 3 pixel line width int w = rect.width() + 2; @@ -1659,7 +1661,7 @@ void CtrlCanvas::pdrawItems(QPainter& p, const QRect& rect, const MidiPart* part //if((fg && e->part() != part) || (!fg && e->part() == part)) if(e->part() != part) continue; - Event event = e->event(); + MusECore::Event event = e->event(); int tick = mapx(event.tick() + e->part()->tick()); if (tick <= x) continue; @@ -1673,7 +1675,7 @@ void CtrlCanvas::pdrawItems(QPainter& p, const QRect& rect, const MidiPart* part //if(!event.empty() && event.selected()) p.setPen(QPen(Qt::blue, 3)); else - p.setPen(QPen(MusEConfig::config.ctrlGraphFg, 3)); + p.setPen(QPen(MusEGlobal::config.ctrlGraphFg, 3)); } else p.setPen(QPen(Qt::darkGray, 3)); @@ -1685,20 +1687,20 @@ void CtrlCanvas::pdrawItems(QPainter& p, const QRect& rect, const MidiPart* part if(!part) // p4.0.27 return; - MidiTrack* mt = part->track(); - MidiPort* mp; + MusECore::MidiTrack* mt = part->track(); + MusECore::MidiPort* mp; - if((mt->type() == Track::DRUM) && (curDrumInstrument != -1) && ((_cnum & 0xff) == 0xff)) //FINDMICHJETZT was ist das? - mp = &midiPorts[drumMap[curDrumInstrument].port]; + if((mt->type() == MusECore::Track::DRUM) && (curDrumInstrument != -1) && ((_cnum & 0xff) == 0xff)) //FINDMICHJETZT was ist das? + mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[curDrumInstrument].port]; else - mp = &midiPorts[mt->outPort()]; + mp = &MusEGlobal::midiPorts[mt->outPort()]; - MidiController* mc = mp->midiController(_cnum); + MusECore::MidiController* mc = mp->midiController(_cnum); int min; int max; int bias; - if(_cnum == CTRL_PROGRAM) + if(_cnum == MusECore::CTRL_PROGRAM) { min = 1; max = 128; @@ -1711,7 +1713,7 @@ void CtrlCanvas::pdrawItems(QPainter& p, const QRect& rect, const MidiPart* part bias = mc->bias(); } int x1 = rect.x(); - int lval = CTRL_VAL_UNKNOWN; + int lval = MusECore::CTRL_VAL_UNKNOWN; ///noEvents=false; bool selected = false; for (iCEvent i = items.begin(); i != items.end(); ++i) @@ -1724,11 +1726,11 @@ void CtrlCanvas::pdrawItems(QPainter& p, const QRect& rect, const MidiPart* part { continue; } - Event ev = e->event(); + MusECore::Event ev = e->event(); int tick = mapx(!ev.empty() ? ev.tick() + e->part()->tick() : 0); int val = e->val(); int pval = val; - if(_cnum == CTRL_PROGRAM) + if(_cnum == MusECore::CTRL_PROGRAM) { if((val & 0xff) == 0xff) // What to do here? prog = 0xff should not be allowed, but may still be encountered. @@ -1737,11 +1739,11 @@ void CtrlCanvas::pdrawItems(QPainter& p, const QRect& rect, const MidiPart* part pval = (val & 0x7f) + 1; } if (tick <= x) { - if (val == CTRL_VAL_UNKNOWN) - lval = CTRL_VAL_UNKNOWN; + if (val == MusECore::CTRL_VAL_UNKNOWN) + lval = MusECore::CTRL_VAL_UNKNOWN; else { - if(_cnum == CTRL_PROGRAM) + if(_cnum == MusECore::CTRL_PROGRAM) lval = wh - ((pval - min - bias) * wh / (max - min)); else lval = wh - ((val - min - bias) * wh / (max - min)); @@ -1751,7 +1753,7 @@ void CtrlCanvas::pdrawItems(QPainter& p, const QRect& rect, const MidiPart* part } if (tick > x+w) break; - if (lval == CTRL_VAL_UNKNOWN) + if (lval == MusECore::CTRL_VAL_UNKNOWN) { // fg means 'draw unselected parts'. if(!fg) @@ -1765,16 +1767,16 @@ void CtrlCanvas::pdrawItems(QPainter& p, const QRect& rect, const MidiPart* part p.drawLine(x1, lval, tick, lval); } else - p.fillRect(x1, lval, tick - x1, wh - lval, selected ? Qt::blue : MusEConfig::config.ctrlGraphFg); + p.fillRect(x1, lval, tick - x1, wh - lval, selected ? Qt::blue : MusEGlobal::config.ctrlGraphFg); } x1 = tick; - if (val == CTRL_VAL_UNKNOWN) - lval = CTRL_VAL_UNKNOWN; + if (val == MusECore::CTRL_VAL_UNKNOWN) + lval = MusECore::CTRL_VAL_UNKNOWN; else { - if(_cnum == CTRL_PROGRAM) + if(_cnum == MusECore::CTRL_PROGRAM) lval = wh - ((pval - min - bias) * wh / (max - min)); else lval = wh - ((val - min - bias) * wh / (max - min)); @@ -1782,7 +1784,7 @@ void CtrlCanvas::pdrawItems(QPainter& p, const QRect& rect, const MidiPart* part selected = e->selected(); //selected = !ev.empty() && ev.selected(); } - if (lval == CTRL_VAL_UNKNOWN) + if (lval == MusECore::CTRL_VAL_UNKNOWN) { if(!fg) { p.fillRect(x1, 0, (x+w) - x1, wh, Qt::darkGray); @@ -1797,8 +1799,8 @@ void CtrlCanvas::pdrawItems(QPainter& p, const QRect& rect, const MidiPart* part p.drawLine(x1, lval, x + w, lval); } else - //p.fillRect(x1, lval, (x+w) - x1, wh - lval, MusEConfig::config.ctrlGraphFg); - p.fillRect(x1, lval, (x+w) - x1, wh - lval, selected ? Qt::blue : MusEConfig::config.ctrlGraphFg); + //p.fillRect(x1, lval, (x+w) - x1, wh - lval, MusEGlobal::config.ctrlGraphFg); + p.fillRect(x1, lval, (x+w) - x1, wh - lval, selected ? Qt::blue : MusEGlobal::config.ctrlGraphFg); } } } @@ -1821,7 +1823,7 @@ void CtrlCanvas::pdraw(QPainter& p, const QRect& rect) // draw Canvas Items //--------------------------------------------------- - bool velo = (midiControllerType(_controller->num()) == MidiController::Velo); + bool velo = (MusECore::midiControllerType(_controller->num()) == MusECore::MidiController::Velo); if(velo) { //--------------------------------------------------- @@ -1851,9 +1853,9 @@ void CtrlCanvas::pdraw(QPainter& p, const QRect& rect) // Draw non-fg non-velocity items for the current part pdrawItems(p, rect, curPart, false, false); - for(iPart ip = editor->parts()->begin(); ip != editor->parts()->end(); ++ip) + for(MusECore::iPart ip = editor->parts()->begin(); ip != editor->parts()->end(); ++ip) { - MidiPart* part = (MidiPart*)(ip->second); + MusECore::MidiPart* part = (MusECore::MidiPart*)(ip->second); //if((velo && part == curPart) || (!velo && part != curPart)) if(part == curPart) continue; @@ -1911,18 +1913,18 @@ void CtrlCanvas::drawOverlay(QPainter& p) { QString s(_controller ? _controller->name() : QString("")); - //p.setFont(MusEConfig::config.fonts[3]); // Use widget font instead. + //p.setFont(MusEGlobal::config.fonts[3]); // Use widget font instead. p.setFont(font()); p.setPen(Qt::black); - //QFontMetrics fm(MusEConfig::config.fonts[3]); // Use widget font metrics instead. + //QFontMetrics fm(MusEGlobal::config.fonts[3]); // Use widget font metrics instead. //int y = fm.lineSpacing() + 2; int y = fontMetrics().lineSpacing() + 2; p.drawText(2, y, s); if (noEvents) { - //p.setFont(MusEConfig::config.fonts[3]); + //p.setFont(MusEGlobal::config.fonts[3]); //p.setPen(Qt::black); //p.drawText(width()/2-100,height()/2-10, "Use shift + pencil or line tool to draw new events"); p.drawText(2 , y * 2, "Use shift + pencil or line tool to draw new events"); @@ -1936,7 +1938,7 @@ void CtrlCanvas::drawOverlay(QPainter& p) QRect CtrlCanvas::overlayRect() const { - //QFontMetrics fm(MusEConfig::config.fonts[3]); // Use widget font metrics instead (and set a widget font) !!! + //QFontMetrics fm(MusEGlobal::config.fonts[3]); // Use widget font metrics instead (and set a widget font) !!! QFontMetrics fm(fontMetrics()); QRect r(fm.boundingRect(_controller ? _controller->name() : QString(""))); @@ -1969,7 +1971,7 @@ void CtrlCanvas::draw(QPainter& p, const QRect& rect) // draw line tool //--------------------------------------------------- - if (drawLineMode && (tool == MusEWidget::DrawTool)) { + if (drawLineMode && (tool == MusEGui::DrawTool)) { p.setPen(Qt::black); p.drawLine(line1x, line1y, line2x, line2y); } @@ -1989,13 +1991,15 @@ void CtrlCanvas::setCurDrumInstrument(int di) // a specific drum instrument // // Removed by T356. - //if(curTrack && (curTrack->type() == Track::DRUM) && ((_controller->num() & 0xff) == 0xff)) { - //if(curTrack && (curTrack->type() == Track::DRUM) && ((_cnum & 0xff) == 0xff)) { + //if(curTrack && (curTrack->type() == MusECore::Track::DRUM) && ((_controller->num() & 0xff) == 0xff)) { + //if(curTrack && (curTrack->type() == MusECore::Track::DRUM) && ((_cnum & 0xff) == 0xff)) { // reset to default // TODO: check, if new drum instrument has a similar controller // configured - // _cnum = CTRL_VELOCITY; + // _cnum = MusECore::CTRL_VELOCITY; // } // Removed by T356 //songChanged(-1); } + +} // namespace MusEGui diff --git a/muse2/muse/ctrl/ctrlcanvas.h b/muse2/muse/ctrl/ctrlcanvas.h index c9baf752..815898ac 100644 --- a/muse2/muse/ctrl/ctrlcanvas.h +++ b/muse2/muse/ctrl/ctrlcanvas.h @@ -35,12 +35,17 @@ class QMouseEvent; class QEvent; class QWidget; +namespace MusECore { class Event; class MidiPart; -class PartList; class MidiTrack; -class MidiEditor; +class PartList; +} + +namespace MusEGui { + class CtrlPanel; +class MidiEditor; //--------------------------------------------------------- // CEvent @@ -52,16 +57,16 @@ class CEvent { //enum State { Normal, Selected }; private: - Event _event; + MusECore::Event _event; //State _state; int _val; - MidiPart* _part; + MusECore::MidiPart* _part; int ex; public: - CEvent(Event e, MidiPart* part, int v); - Event event() const { return _event; } - void setEvent(Event& ev) { _event = ev; } + CEvent(MusECore::Event e, MusECore::MidiPart* part, int v); + MusECore::Event event() const { return _event; } + void setEvent(MusECore::Event& ev) { _event = ev; } //State state() { return _state; } //void setState(State s) { _state = s; } //bool isSelected() { return _state == Selected; } @@ -70,9 +75,9 @@ class CEvent { int val() const { return _val; } void setVal(int v) { _val = v; } void setEX(int v) { ex = v; } - MidiPart* part() const { return _part; } + MusECore::MidiPart* part() const { return _part; } bool contains(int /*x1*/, int /*x2*/) const; - bool intersects(const MidiController*, const QRect&, const int /*tickstep*/, const int /*windowHeight*/) const; + bool intersects(const MusECore::MidiController*, const QRect&, const int /*tickstep*/, const int /*windowHeight*/) const; int x() { return ex; } }; @@ -91,18 +96,19 @@ class CEventList: public std::list<CEvent*> { void clearDelete(); }; + //--------------------------------------------------------- // CtrlCanvas //--------------------------------------------------------- -class CtrlCanvas : public MusEWidget::View { +class CtrlCanvas : public MusEGui::View { Q_OBJECT MidiEditor* editor; - MidiTrack* curTrack; - MidiPart* curPart; - MidiCtrlValList* ctrl; - MidiController* _controller; + MusECore::MidiTrack* curTrack; + MusECore::MidiPart* curPart; + MusECore::MidiCtrlValList* ctrl; + MusECore::MidiController* _controller; CtrlPanel* _panel; int _cnum; // Current real drum controller number (anote). @@ -134,8 +140,8 @@ class CtrlCanvas : public MusEWidget::View { void deleteVal(int x1, int x2, int y); bool setCurTrackAndPart(); - void pdrawItems(QPainter&, const QRect&, const MidiPart*, bool, bool); - void partControllers(const MidiPart*, int, int*, int*, MidiController**, MidiCtrlValList**); + void pdrawItems(QPainter&, const QRect&, const MusECore::MidiPart*, bool, bool); + void partControllers(const MusECore::MidiPart*, int, int*, int*, MusECore::MidiController**, MusECore::MidiCtrlValList**); @@ -153,7 +159,7 @@ class CtrlCanvas : public MusEWidget::View { DragMode drag; QRect lasso; QPoint start; - MusEWidget::Tool tool; + MusEGui::Tool tool; unsigned pos[3]; int curDrumInstrument; //Used by the drum-editor to view velocity of only one key (one drum) @@ -190,9 +196,12 @@ class CtrlCanvas : public MusEWidget::View { const char* name = 0, CtrlPanel* pnl = 0); ~CtrlCanvas(); void setPanel(CtrlPanel* pnl) { _panel = pnl; } - MidiCtrlValList* ctrlValList() { return ctrl; } - MidiController* controller() { return _controller; } - MidiTrack* track() const { return curTrack; } + MusECore::MidiCtrlValList* ctrlValList() { return ctrl; } + MusECore::MidiController* controller() { return _controller; } + MusECore::MidiTrack* track() const { return curTrack; } }; + +} // namespace MusEGui + #endif diff --git a/muse2/muse/ctrl/ctrledit.cpp b/muse2/muse/ctrl/ctrledit.cpp index 61f87d28..7c960dd8 100644 --- a/muse2/muse/ctrl/ctrledit.cpp +++ b/muse2/muse/ctrl/ctrledit.cpp @@ -34,6 +34,8 @@ #include <QHBoxLayout> +namespace MusEGui { + //--------------------------------------------------------- // setTool //--------------------------------------------------------- @@ -55,12 +57,12 @@ CtrlEdit::CtrlEdit(QWidget* parent, MidiEditor* e, int xmag, QHBoxLayout* hbox = new QHBoxLayout; panel = new CtrlPanel(0, e, "panel"); canvas = new CtrlCanvas(e, 0, xmag, "ctrlcanvas", panel); - QWidget* vscale = new MusEWidget::VScale; + QWidget* vscale = new MusEGui::VScale; hbox->setContentsMargins(0, 0, 0, 0); hbox->setSpacing (0); - canvas->setOrigin(-(MusEConfig::config.division/4), 0); + canvas->setOrigin(-(MusEGlobal::config.division/4), 0); canvas->setMinimumHeight(50); @@ -80,7 +82,7 @@ CtrlEdit::CtrlEdit(QWidget* parent, MidiEditor* e, int xmag, // writeStatus //--------------------------------------------------------- -void CtrlEdit::writeStatus(int level, Xml& xml) +void CtrlEdit::writeStatus(int level, MusECore::Xml& xml) { if (canvas->controller()) { xml.tag(level++, "ctrledit"); @@ -94,26 +96,26 @@ void CtrlEdit::writeStatus(int level, Xml& xml) // readStatus //--------------------------------------------------------- -void CtrlEdit::readStatus(Xml& xml) +void CtrlEdit::readStatus(MusECore::Xml& xml) { for (;;) { - Xml::Token token = xml.parse(); + MusECore::Xml::Token token = xml.parse(); const QString& tag = xml.s1(); switch (token) { - case Xml::Error: - case Xml::End: + case MusECore::Xml::Error: + case MusECore::Xml::End: return; - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "ctrl") { xml.parse1(); // Obsolete. /* QString name = xml.parse1(); int portno = canvas->track()->outPort(); - MidiPort* port = &midiPorts[portno]; - MidiInstrument* instr = port->instrument(); - MidiControllerList* mcl = instr->controller(); + MusECore::MidiPort* port = &midiPorts[portno]; + MusECore::MidiInstrument* instr = port->instrument(); + MusECore::MidiControllerList* mcl = instr->controller(); - for (iMidiController ci = mcl->begin(); ci != mcl->end(); ++ci) { + for (MusECore::iMidiController ci = mcl->begin(); ci != mcl->end(); ++ci) { if (ci->second->name() == name) { canvas->setController(ci->second->num()); break; @@ -128,7 +130,7 @@ void CtrlEdit::readStatus(Xml& xml) else xml.unknown("CtrlEdit"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "ctrledit") return; default: @@ -164,11 +166,11 @@ void CtrlEdit::setController(int n) void CtrlEdit::setController(const QString& name) { int portno = canvas->track()->outPort(); - MidiPort* port = &midiPorts[portno]; - MidiInstrument* instr = port->instrument(); - MidiControllerList* mcl = instr->controller(); + MusECore::MidiPort* port = &MusEGlobal::midiPorts[portno]; + MusECore::MidiInstrument* instr = port->instrument(); + MusECore::MidiControllerList* mcl = instr->controller(); - for (iMidiController ci = mcl->begin(); ci != mcl->end(); ++ci) + for (MusECore::iMidiController ci = mcl->begin(); ci != mcl->end(); ++ci) { if (ci->second->name() == name) { @@ -177,3 +179,5 @@ void CtrlEdit::setController(const QString& name) } } } + +} // namespace MusEGui diff --git a/muse2/muse/ctrl/ctrledit.h b/muse2/muse/ctrl/ctrledit.h index e9ab3a52..1f7a67a9 100644 --- a/muse2/muse/ctrl/ctrledit.h +++ b/muse2/muse/ctrl/ctrledit.h @@ -28,12 +28,18 @@ #include "ctrlcanvas.h" #include "song.h" +namespace MusECore { +class Xml; +} + +#define CTRL_PANEL_FIXED_WIDTH 40 + +namespace MusEGui { + class MidiEditor; class CtrlView; class CtrlPanel; -class Xml; -#define CTRL_PANEL_FIXED_WIDTH 40 //--------------------------------------------------------- // CtrlEdit //--------------------------------------------------------- @@ -64,10 +70,12 @@ class CtrlEdit : public QWidget { public: CtrlEdit(QWidget*, MidiEditor* e, int xmag, bool expand = false, const char* name = 0); - void readStatus(Xml&); - void writeStatus(int, Xml&); + void readStatus(MusECore::Xml&); + void writeStatus(int, MusECore::Xml&); void setController(const QString& name); }; +} // namespace MusEGui + #endif diff --git a/muse2/muse/ctrl/ctrlpanel.cpp b/muse2/muse/ctrl/ctrlpanel.cpp index ef2196fa..88787c47 100644 --- a/muse2/muse/ctrl/ctrlpanel.cpp +++ b/muse2/muse/ctrl/ctrlpanel.cpp @@ -58,6 +58,8 @@ #include "menutitleitem.h" #include "popupmenu.h" +namespace MusEGui { + //--------------------------------------------------------- // CtrlPanel //--------------------------------------------------------- @@ -87,7 +89,7 @@ CtrlPanel::CtrlPanel(QWidget* parent, MidiEditor* e, const char* name) dbox->setContentsMargins(0, 0, 0, 0); selCtrl = new QPushButton(tr("S")); - selCtrl->setFont(MusEConfig::config.fonts[3]); + selCtrl->setFont(MusEGlobal::config.fonts[3]); selCtrl->setFixedHeight(20); selCtrl->setSizePolicy( QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); @@ -97,7 +99,7 @@ CtrlPanel::CtrlPanel(QWidget* parent, MidiEditor* e, const char* name) // destroy button QPushButton* destroy = new QPushButton(tr("X")); - destroy->setFont(MusEConfig::config.fonts[3]); + destroy->setFont(MusEGlobal::config.fonts[3]); destroy->setFixedHeight(20); destroy->setSizePolicy( QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); @@ -108,10 +110,10 @@ CtrlPanel::CtrlPanel(QWidget* parent, MidiEditor* e, const char* name) _track = 0; _ctrl = 0; - _val = CTRL_VAL_UNKNOWN; + _val = MusECore::CTRL_VAL_UNKNOWN; _dnum = -1; - _knob = new MusEWidget::Knob; + _knob = new MusEGui::Knob; _knob->setFixedWidth(25); _knob->setFixedHeight(25); _knob->setToolTip(tr("manual adjust")); @@ -121,11 +123,11 @@ CtrlPanel::CtrlPanel(QWidget* parent, MidiEditor* e, const char* name) _knob->hide(); _knob->setAltFaceColor(Qt::red); - _dl = new MusEWidget::DoubleLabel(-1.0, 0.0, +127.0); + _dl = new MusEGui::DoubleLabel(-1.0, 0.0, +127.0); _dl->setPrecision(0); _dl->setToolTip(tr("double click on/off")); _dl->setSpecialText(tr("off")); - _dl->setFont(MusEConfig::config.fonts[1]); + _dl->setFont(MusEGlobal::config.fonts[1]); _dl->setBackgroundRole(QPalette::Mid); _dl->setFrame(true); _dl->setFixedWidth(36); @@ -163,34 +165,34 @@ void CtrlPanel::heartBeat() if(_track && _ctrl && _dnum != -1) { - //if(_dnum != CTRL_VELOCITY && _dnum != CTRL_PROGRAM) - if(_dnum != CTRL_VELOCITY) + //if(_dnum != MusECore::CTRL_VELOCITY && _dnum != MusECore::CTRL_PROGRAM) + if(_dnum != MusECore::CTRL_VELOCITY) { int outport; int chan; int cdi = editor->curDrumInstrument(); - if(_track->type() == Track::DRUM && ((_ctrl->num() & 0xff) == 0xff) && cdi != -1) //FINDMICHJETZT was ist das? und ähnliche dinger + if(_track->type() == MusECore::Track::DRUM && ((_ctrl->num() & 0xff) == 0xff) && cdi != -1) //FINDMICHJETZT was ist das? und ähnliche dinger { - outport = drumMap[cdi].port; - chan = drumMap[cdi].channel; + outport = MusEGlobal::drumMap[cdi].port; + chan = MusEGlobal::drumMap[cdi].channel; } else { outport = _track->outPort(); chan = _track->outChannel(); } - MidiPort* mp = &midiPorts[outport]; + MusECore::MidiPort* mp = &MusEGlobal::midiPorts[outport]; int v = mp->hwCtrlState(chan, _dnum); - if(v == CTRL_VAL_UNKNOWN) + if(v == MusECore::CTRL_VAL_UNKNOWN) { - // MusEWidget::DoubleLabel ignores the value if already set... + // MusEGui::DoubleLabel ignores the value if already set... _dl->setValue(_dl->off() - 1.0); - _val = CTRL_VAL_UNKNOWN; + _val = MusECore::CTRL_VAL_UNKNOWN; v = mp->lastValidHWCtrlState(chan, _dnum); - if(v != CTRL_VAL_UNKNOWN && ((_dnum != CTRL_PROGRAM) || ((v & 0xff) != 0xff) )) + if(v != MusECore::CTRL_VAL_UNKNOWN && ((_dnum != MusECore::CTRL_PROGRAM) || ((v & 0xff) != 0xff) )) { - if(_dnum == CTRL_PROGRAM) + if(_dnum == MusECore::CTRL_PROGRAM) v = (v & 0x7f) + 1; else // Auto bias... @@ -208,15 +210,15 @@ void CtrlPanel::heartBeat() if(v != _val) { _val = v; - if(v == CTRL_VAL_UNKNOWN || ((_dnum == CTRL_PROGRAM) && ((v & 0xff) == 0xff) )) + if(v == MusECore::CTRL_VAL_UNKNOWN || ((_dnum == MusECore::CTRL_PROGRAM) && ((v & 0xff) == 0xff) )) { - // MusEWidget::DoubleLabel ignores the value if already set... + // MusEGui::DoubleLabel ignores the value if already set... //_dl->setValue(double(_ctrl->minVal() - 1)); _dl->setValue(_dl->off() - 1.0); } else { - if(_dnum == CTRL_PROGRAM) + if(_dnum == MusECore::CTRL_PROGRAM) v = (v & 0x7f) + 1; else // Auto bias... @@ -247,66 +249,66 @@ void CtrlPanel::labelDoubleClicked() int outport; int chan; int cdi = editor->curDrumInstrument(); - if(_track->type() == Track::DRUM && ((_ctrl->num() & 0xff) == 0xff) && cdi != -1) + if(_track->type() == MusECore::Track::DRUM && ((_ctrl->num() & 0xff) == 0xff) && cdi != -1) { - outport = drumMap[cdi].port; - chan = drumMap[cdi].channel; + outport = MusEGlobal::drumMap[cdi].port; + chan = MusEGlobal::drumMap[cdi].channel; } else { outport = _track->outPort(); chan = _track->outChannel(); } - MidiPort* mp = &midiPorts[outport]; + MusECore::MidiPort* mp = &MusEGlobal::midiPorts[outport]; int lastv = mp->lastValidHWCtrlState(chan, _dnum); int curv = mp->hwCtrlState(chan, _dnum); - if(_dnum == CTRL_PROGRAM) + if(_dnum == MusECore::CTRL_PROGRAM) { - if(curv == CTRL_VAL_UNKNOWN || ((curv & 0xffffff) == 0xffffff)) + if(curv == MusECore::CTRL_VAL_UNKNOWN || ((curv & 0xffffff) == 0xffffff)) { // If no value has ever been set yet, use the current knob value // (or the controller's initial value?) to 'turn on' the controller. - if(lastv == CTRL_VAL_UNKNOWN || ((lastv & 0xffffff) == 0xffffff)) + if(lastv == MusECore::CTRL_VAL_UNKNOWN || ((lastv & 0xffffff) == 0xffffff)) { //int kiv = _ctrl->initVal()); int kiv = lrint(_knob->value()); --kiv; kiv &= 0x7f; kiv |= 0xffff00; - //MidiPlayEvent ev(song->cpos(), outport, chan, ME_CONTROLLER, _dnum, kiv); - MidiPlayEvent ev(0, outport, chan, ME_CONTROLLER, _dnum, kiv); - audio->msgPlayMidiEvent(&ev); + //MusECore::MidiPlayEvent ev(MusEGlobal::song->cpos(), outport, chan, MusECore::ME_CONTROLLER, _dnum, kiv); + MusECore::MidiPlayEvent ev(0, outport, chan, MusECore::ME_CONTROLLER, _dnum, kiv); + MusEGlobal::audio->msgPlayMidiEvent(&ev); } else { - //MidiPlayEvent ev(song->cpos(), outport, chan, ME_CONTROLLER, _dnum, lastv); - MidiPlayEvent ev(0, outport, chan, ME_CONTROLLER, _dnum, lastv); - audio->msgPlayMidiEvent(&ev); + //MusECore::MidiPlayEvent ev(MusEGlobal::song->cpos(), outport, chan, MusECore::ME_CONTROLLER, _dnum, lastv); + MusECore::MidiPlayEvent ev(0, outport, chan, MusECore::ME_CONTROLLER, _dnum, lastv); + MusEGlobal::audio->msgPlayMidiEvent(&ev); } } else { //if((curv & 0xffff00) == 0xffff00) //{ - ////if(mp->hwCtrlState(chan, _dnum) != CTRL_VAL_UNKNOWN) - audio->msgSetHwCtrlState(mp, chan, _dnum, CTRL_VAL_UNKNOWN); + ////if(mp->hwCtrlState(chan, _dnum) != MusECore::CTRL_VAL_UNKNOWN) + MusEGlobal::audio->msgSetHwCtrlState(mp, chan, _dnum, MusECore::CTRL_VAL_UNKNOWN); //} //else //{ - // MidiPlayEvent ev(song->cpos(), outport, chan, ME_CONTROLLER, _dnum, (curv & 0xffff00) | 0xff); - // audio->msgPlayMidiEvent(&ev); + // MusECore::MidiPlayEvent ev(MusEGlobal::song->cpos(), outport, chan, MusECore::ME_CONTROLLER, _dnum, (curv & 0xffff00) | 0xff); + // MusEGlobal::audio->msgPlayMidiEvent(&ev); //} } } else { - if(curv == CTRL_VAL_UNKNOWN) + if(curv == MusECore::CTRL_VAL_UNKNOWN) { // If no value has ever been set yet, use the current knob value // (or the controller's initial value?) to 'turn on' the controller. - if(lastv == CTRL_VAL_UNKNOWN) + if(lastv == MusECore::CTRL_VAL_UNKNOWN) { //int kiv = _ctrl->initVal()); int kiv = lrint(_knob->value()); @@ -315,24 +317,24 @@ void CtrlPanel::labelDoubleClicked() if(kiv > _ctrl->maxVal()) kiv = _ctrl->maxVal(); kiv += _ctrl->bias(); - //MidiPlayEvent ev(song->cpos(), outport, chan, ME_CONTROLLER, _dnum, kiv); - MidiPlayEvent ev(0, outport, chan, ME_CONTROLLER, _dnum, kiv); - audio->msgPlayMidiEvent(&ev); + //MusECore::MidiPlayEvent ev(MusEGlobal::song->cpos(), outport, chan, MusECore::ME_CONTROLLER, _dnum, kiv); + MusECore::MidiPlayEvent ev(0, outport, chan, MusECore::ME_CONTROLLER, _dnum, kiv); + MusEGlobal::audio->msgPlayMidiEvent(&ev); } else { - //MidiPlayEvent ev(song->cpos(), outport, chan, ME_CONTROLLER, _dnum, lastv); - MidiPlayEvent ev(0, outport, chan, ME_CONTROLLER, _dnum, lastv); - audio->msgPlayMidiEvent(&ev); + //MusECore::MidiPlayEvent ev(MusEGlobal::song->cpos(), outport, chan, MusECore::ME_CONTROLLER, _dnum, lastv); + MusECore::MidiPlayEvent ev(0, outport, chan, MusECore::ME_CONTROLLER, _dnum, lastv); + MusEGlobal::audio->msgPlayMidiEvent(&ev); } } else { - //if(mp->hwCtrlState(chan, _dnum) != CTRL_VAL_UNKNOWN) - audio->msgSetHwCtrlState(mp, chan, _dnum, CTRL_VAL_UNKNOWN); + //if(mp->hwCtrlState(chan, _dnum) != MusECore::CTRL_VAL_UNKNOWN) + MusEGlobal::audio->msgSetHwCtrlState(mp, chan, _dnum, MusECore::CTRL_VAL_UNKNOWN); } } - song->update(SC_MIDI_CONTROLLER); + MusEGlobal::song->update(SC_MIDI_CONTROLLER); } //--------------------------------------------------------- @@ -351,57 +353,57 @@ void CtrlPanel::ctrlChanged(double val) int outport; int chan; int cdi = editor->curDrumInstrument(); - if(_track->type() == Track::DRUM && ((_ctrl->num() & 0xff) == 0xff) && cdi != -1) + if(_track->type() == MusECore::Track::DRUM && ((_ctrl->num() & 0xff) == 0xff) && cdi != -1) { - outport = drumMap[cdi].port; - chan = drumMap[cdi].channel; + outport = MusEGlobal::drumMap[cdi].port; + chan = MusEGlobal::drumMap[cdi].channel; } else { outport = _track->outPort(); chan = _track->outChannel(); } - MidiPort* mp = &midiPorts[outport]; + MusECore::MidiPort* mp = &MusEGlobal::midiPorts[outport]; int curval = mp->hwCtrlState(chan, _dnum); - if(_dnum == CTRL_PROGRAM) + if(_dnum == MusECore::CTRL_PROGRAM) { --ival; ival &= 0x7f; - if(curval == CTRL_VAL_UNKNOWN) + if(curval == MusECore::CTRL_VAL_UNKNOWN) ival |= 0xffff00; else ival |= (curval & 0xffff00); - //MidiPlayEvent ev(song->cpos(), outport, chan, ME_CONTROLLER, _dnum, ival); - MidiPlayEvent ev(0, outport, chan, ME_CONTROLLER, _dnum, ival); - audio->msgPlayMidiEvent(&ev); + //MusECore::MidiPlayEvent ev(MusEGlobal::song->cpos(), outport, chan, MusECore::ME_CONTROLLER, _dnum, ival); + MusECore::MidiPlayEvent ev(0, outport, chan, MusECore::ME_CONTROLLER, _dnum, ival); + MusEGlobal::audio->msgPlayMidiEvent(&ev); } else // Shouldn't happen, but... if((ival < _ctrl->minVal()) || (ival > _ctrl->maxVal())) { - //if(mp->hwCtrlState(chan, _dnum) != CTRL_VAL_UNKNOWN) - if(curval != CTRL_VAL_UNKNOWN) - audio->msgSetHwCtrlState(mp, chan, _dnum, CTRL_VAL_UNKNOWN); + //if(mp->hwCtrlState(chan, _dnum) != MusECore::CTRL_VAL_UNKNOWN) + if(curval != MusECore::CTRL_VAL_UNKNOWN) + MusEGlobal::audio->msgSetHwCtrlState(mp, chan, _dnum, MusECore::CTRL_VAL_UNKNOWN); } else { // Auto bias... ival += _ctrl->bias(); - //MidiPlayEvent ev(song->cpos(), outport, chan, ME_CONTROLLER, _dnum, ival); - MidiPlayEvent ev(0, outport, chan, ME_CONTROLLER, _dnum, ival); - audio->msgPlayMidiEvent(&ev); + //MusECore::MidiPlayEvent ev(MusEGlobal::song->cpos(), outport, chan, MusECore::ME_CONTROLLER, _dnum, ival); + MusECore::MidiPlayEvent ev(0, outport, chan, MusECore::ME_CONTROLLER, _dnum, ival); + MusEGlobal::audio->msgPlayMidiEvent(&ev); } - song->update(SC_MIDI_CONTROLLER); + MusEGlobal::song->update(SC_MIDI_CONTROLLER); } //--------------------------------------------------------- // setHWController //--------------------------------------------------------- -void CtrlPanel::setHWController(MidiTrack* t, MidiController* ctrl) +void CtrlPanel::setHWController(MusECore::MidiTrack* t, MusECore::MidiController* ctrl) { inHeartBeat = true; @@ -417,24 +419,24 @@ void CtrlPanel::setHWController(MidiTrack* t, MidiController* ctrl) return; } - MidiPort* mp; + MusECore::MidiPort* mp; int ch; int cdi = editor->curDrumInstrument(); _dnum = _ctrl->num(); - if(_track->type() == Track::DRUM && ((_dnum & 0xff) == 0xff) && cdi != -1) + if(_track->type() == MusECore::Track::DRUM && ((_dnum & 0xff) == 0xff) && cdi != -1) { - _dnum = (_dnum & ~0xff) | drumMap[cdi].anote; - mp = &midiPorts[drumMap[cdi].port]; - ch = drumMap[cdi].channel; + _dnum = (_dnum & ~0xff) | MusEGlobal::drumMap[cdi].anote; + mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[cdi].port]; + ch = MusEGlobal::drumMap[cdi].channel; } else { - mp = &midiPorts[_track->outPort()]; + mp = &MusEGlobal::midiPorts[_track->outPort()]; ch = _track->outChannel(); } - //if(_dnum == CTRL_VELOCITY || _dnum == CTRL_PROGRAM) - if(_dnum == CTRL_VELOCITY) + //if(_dnum == MusECore::CTRL_VELOCITY || _dnum == MusECore::CTRL_PROGRAM) + if(_dnum == MusECore::CTRL_VELOCITY) { _knob->setEnabled(false); _dl->setEnabled(false); @@ -447,7 +449,7 @@ void CtrlPanel::setHWController(MidiTrack* t, MidiController* ctrl) _dl->setEnabled(true); double dlv; int mn; int mx; int v; - if(_dnum == CTRL_PROGRAM) + if(_dnum == MusECore::CTRL_PROGRAM) { mn = 1; mx = 128; @@ -456,13 +458,13 @@ void CtrlPanel::setHWController(MidiTrack* t, MidiController* ctrl) _knob->setRange(double(mn), double(mx), 1.0); _dl->setRange(double(mn), double(mx)); //_dl->setOff(double(mn - 1)); - if(v == CTRL_VAL_UNKNOWN || ((v & 0xffffff) == 0xffffff)) + if(v == MusECore::CTRL_VAL_UNKNOWN || ((v & 0xffffff) == 0xffffff)) { int lastv = mp->lastValidHWCtrlState(ch, _dnum); - if(lastv == CTRL_VAL_UNKNOWN || ((lastv & 0xffffff) == 0xffffff)) + if(lastv == MusECore::CTRL_VAL_UNKNOWN || ((lastv & 0xffffff) == 0xffffff)) { int initv = _ctrl->initVal(); - if(initv == CTRL_VAL_UNKNOWN || ((initv & 0xffffff) == 0xffffff)) + if(initv == MusECore::CTRL_VAL_UNKNOWN || ((initv & 0xffffff) == 0xffffff)) v = 1; else v = (initv + 1) & 0xff; @@ -492,12 +494,12 @@ void CtrlPanel::setHWController(MidiTrack* t, MidiController* ctrl) _knob->setRange(double(mn), double(mx), 1.0); _dl->setRange(double(mn), double(mx)); //_dl->setOff(double(mn - 1)); - if(v == CTRL_VAL_UNKNOWN) + if(v == MusECore::CTRL_VAL_UNKNOWN) { int lastv = mp->lastValidHWCtrlState(ch, _dnum); - if(lastv == CTRL_VAL_UNKNOWN) + if(lastv == MusECore::CTRL_VAL_UNKNOWN) { - if(_ctrl->initVal() == CTRL_VAL_UNKNOWN) + if(_ctrl->initVal() == MusECore::CTRL_VAL_UNKNOWN) v = 0; else v = _ctrl->initVal(); @@ -551,16 +553,16 @@ void CtrlPanel::ctrlPopup() { //--------------------------------------------------- // build list of midi controllers for current - // MidiPort/channel + // MusECore::MidiPort/channel //--------------------------------------------------- - PartList* parts = editor->parts(); - Part* part = editor->curCanvasPart(); - MidiTrack* track = (MidiTrack*)(part->track()); + MusECore::PartList* parts = editor->parts(); + MusECore::Part* part = editor->curCanvasPart(); + MusECore::MidiTrack* track = (MusECore::MidiTrack*)(part->track()); int channel = track->outChannel(); - MidiPort* port = &midiPorts[track->outPort()]; + MusECore::MidiPort* port = &MusEGlobal::midiPorts[track->outPort()]; int curDrumInstrument = editor->curDrumInstrument(); - bool isDrum = track->type() == Track::DRUM; //FINDMICHJETZT ist das wichtig? + bool isDrum = track->type() == MusECore::Track::DRUM; //FINDMICHJETZT ist das wichtig? QMenu* pop = new QMenu; //pop->clear(); @@ -573,15 +575,15 @@ void CtrlPanel::ctrlPopup() std::list<CI> sList; typedef std::list<CI>::iterator isList; - for (iMidiCtrlValList i = cll->lower_bound(min); i != cll->lower_bound(max); ++i) { + for (MusECore::iMidiCtrlValList i = cll->lower_bound(min); i != cll->lower_bound(max); ++i) { MidiCtrlValList* cl = i->second; - MidiController* c = port->midiController(cl->num()); + MusECore::MidiController* c = port->midiController(cl->num()); // dont show drum specific controller if not a drum track if ((c->num() & 0xff) == 0xff) { if (!isDrum) continue; // only show controller for curDrumInstrument: - if ((cl->num() & 0xff) != drumMap[curDrumInstrument].anote) { + if ((cl->num() & 0xff) != MusEGlobal::drumMap[curDrumInstrument].anote) { continue; } } @@ -592,11 +594,11 @@ void CtrlPanel::ctrlPopup() } if (i == sList.end()) { bool used = false; - for (iPart ip = parts->begin(); ip != parts->end(); ++ip) { - EventList* el = ip->second->events(); - for (iEvent ie = el->begin(); ie != el->end(); ++ie) { - Event e = ie->second; - if ((e.type() == Controller) && (e.dataA() == cl->num())) { + for (MusECore::iPart ip = parts->begin(); ip != parts->end(); ++ip) { + MusECore::EventList* el = ip->second->events(); + for (MusECore::iEvent ie = el->begin(); ie != el->end(); ++ie) { + MusECore::Event e = ie->second; + if ((e.type() == MusECore::Controller) && (e.dataA() == cl->num())) { used = true; break; } @@ -629,7 +631,7 @@ void CtrlPanel::ctrlPopup() delete pop; if (rv == 1) { // special case velocity - emit controllerChanged(CTRL_VELOCITY); + emit controllerChanged(MusECore::CTRL_VELOCITY); } else if (rv == 2) { // @@ -642,12 +644,12 @@ void CtrlPanel::ctrlPopup() // current instrument // MidiInstrument* instr = port->instrument(); - MidiControllerList* mcl = instr->controller(); - for (iMidiController ci = mcl->begin(); ci != mcl->end(); ++ci) + MusECore::MidiControllerList* mcl = instr->controller(); + for (iMusECore::MidiController ci = mcl->begin(); ci != mcl->end(); ++ci) { int num = ci->second->num(); if (isDrum && ((num & 0xff) == 0xff)) - num = (num & ~0xff) + drumMap[curDrumInstrument].anote; + num = (num & ~0xff) + MusEGlobal::drumMap[curDrumInstrument].anote; if(cll->find(channel, num) == cll->end()) pop1->addAction(ci->second->name()); @@ -655,13 +657,13 @@ void CtrlPanel::ctrlPopup() QAction *act2 = pop1->exec(selCtrl->mapToGlobal(QPoint(0,0))); if (act2) { QString s = act2->text(); - MidiController* c; - for (iMidiController ci = mcl->begin(); ci != mcl->end(); ++ci) { + MusECore::MidiController* c; + for (iMusECore::MidiController ci = mcl->begin(); ci != mcl->end(); ++ci) { c = ci->second; if (c->name() == s) { int num = c->num(); if (isDrum && ((num & 0xff) == 0xff)) - num = (num & ~0xff) + drumMap[curDrumInstrument].anote; + num = (num & ~0xff) + MusEGlobal::drumMap[curDrumInstrument].anote; if(cll->find(channel, num) == cll->end()) { @@ -669,7 +671,7 @@ void CtrlPanel::ctrlPopup() cll->add(channel, vl); emit controllerChanged(c->num()); - //song->update(SC_MIDI_CONTROLLER_ADD); + //MusEGlobal::song->update(SC_MIDI_CONTROLLER_ADD); } else emit controllerChanged(c->num()); @@ -681,10 +683,10 @@ void CtrlPanel::ctrlPopup() } else { ///QString s = act->text(); - iMidiCtrlValList i = cll->begin(); + MusECore::iMidiCtrlValList i = cll->begin(); for (; i != cll->end(); ++i) { MidiCtrlValList* cl = i->second; - MidiController* c = port->midiController(cl->num()); + MusECore::MidiController* c = port->midiController(cl->num()); if (c->name() == s) { emit controllerChanged(c->num()); break; @@ -709,35 +711,35 @@ void CtrlPanel::ctrlPopup() { //--------------------------------------------------- // build list of midi controllers for current - // MidiPort/channel + // MusECore::MidiPort/channel //--------------------------------------------------- - PartList* parts = editor->parts(); - Part* part = editor->curCanvasPart(); - MidiTrack* track = (MidiTrack*)(part->track()); + MusECore::PartList* parts = editor->parts(); + MusECore::Part* part = editor->curCanvasPart(); + MusECore::MidiTrack* track = (MusECore::MidiTrack*)(part->track()); int channel = track->outChannel(); - MidiPort* port = &midiPorts[track->outPort()]; + MusECore::MidiPort* port = &MusEGlobal::midiPorts[track->outPort()]; int curDrumInstrument = editor->curDrumInstrument(); - bool isDrum = track->type() == Track::DRUM; //FINDMICHJETZT ist das wichtig? - MidiInstrument* instr = port->instrument(); - MidiControllerList* mcl = instr->controller(); + bool isDrum = track->type() == MusECore::Track::DRUM; //FINDMICHJETZT ist das wichtig? + MusECore::MidiInstrument* instr = port->instrument(); + MusECore::MidiControllerList* mcl = instr->controller(); - MidiCtrlValListList* cll = port->controller(); + MusECore::MidiCtrlValListList* cll = port->controller(); int min = channel << 24; int max = min + 0x1000000; std::list<CI> sList; typedef std::list<CI>::iterator isList; - for (iMidiCtrlValList i = cll->lower_bound(min); i != cll->lower_bound(max); ++i) { - MidiCtrlValList* cl = i->second; - MidiController* c = port->midiController(cl->num()); + for (MusECore::iMidiCtrlValList i = cll->lower_bound(min); i != cll->lower_bound(max); ++i) { + MusECore::MidiCtrlValList* cl = i->second; + MusECore::MidiController* c = port->midiController(cl->num()); // dont show drum specific controller if not a drum track if ((c->num() & 0xff) == 0xff) { if (!isDrum) continue; // only show controller for curDrumInstrument: - if ((cl->num() & 0xff) != drumMap[curDrumInstrument].anote) { + if ((cl->num() & 0xff) != MusEGlobal::drumMap[curDrumInstrument].anote) { continue; } } @@ -749,11 +751,11 @@ void CtrlPanel::ctrlPopup() } if (i == sList.end()) { bool used = false; - for (iPart ip = parts->begin(); ip != parts->end(); ++ip) { - EventList* el = ip->second->events(); - for (iEvent ie = el->begin(); ie != el->end(); ++ie) { - Event e = ie->second; - if ((e.type() == Controller) && (e.dataA() == cl->num())) { + for (MusECore::iPart ip = parts->begin(); ip != parts->end(); ++ip) { + MusECore::EventList* el = ip->second->events(); + for (MusECore::iEvent ie = el->begin(); ie != el->end(); ++ie) { + MusECore::Event e = ie->second; + if ((e.type() == MusECore::Controller) && (e.dataA() == cl->num())) { used = true; break; } @@ -769,15 +771,15 @@ void CtrlPanel::ctrlPopup() // ie they 'overtake' definition of a global controller such that the // global def is no longer available. sList.push_back(CI(cnum, - isinstr ? midiCtrlNumString(cnum, true) + c->name() : midiCtrlName(cnum, true), + isinstr ? MusECore::midiCtrlNumString(cnum, true) + c->name() : MusECore::midiCtrlName(cnum, true), used, isinstr)); } } - MusEWidget::PopupMenu* ctrlMainPop = new MusEWidget::PopupMenu; + MusEGui::PopupMenu* ctrlMainPop = new MusEGui::PopupMenu; //ctrlMainPop->addSeparator(); - ctrlMainPop->addAction(new MusEWidget::MenuTitleItem(tr("Instrument-defined"), ctrlMainPop)); + ctrlMainPop->addAction(new MusEGui::MenuTitleItem(tr("Instrument-defined"), ctrlMainPop)); //ctrlMainPop->addAction(QIcon(*configureIcon), tr("Add ..."))->setData(max + 1); @@ -796,7 +798,7 @@ void CtrlPanel::ctrlPopup() //ctrlMainPop->addAction(QIcon(*midi_edit_instrumentIcon), tr("Edit instruments"))->setData(max + 2); ctrlMainPop->addSeparator(); - ctrlMainPop->addAction(new MusEWidget::MenuTitleItem(tr("Others"), ctrlMainPop)); + ctrlMainPop->addAction(new MusEGui::MenuTitleItem(tr("Others"), ctrlMainPop)); //ctrlMainPop->addAction(QIcon(*configureIcon), tr("Add ..."))->setData(max + 3); @@ -830,12 +832,12 @@ void CtrlPanel::ctrlPopup() delete ctrlMainPop; if (rv == max) { // special case velocity - emit controllerChanged(CTRL_VELOCITY); + emit controllerChanged(MusECore::CTRL_VELOCITY); } else if (rv == max + 1) { // add new instrument controller - MusEWidget::PopupMenu * ctrlSubPop = new MusEWidget::PopupMenu(this); - ctrlSubPop->addAction(new MusEWidget::MenuTitleItem(tr("Instrument-defined"), ctrlSubPop)); + MusEGui::PopupMenu * ctrlSubPop = new MusEGui::PopupMenu(this); + ctrlSubPop->addAction(new MusEGui::MenuTitleItem(tr("Instrument-defined"), ctrlSubPop)); // // populate popup with all controllers available for @@ -844,7 +846,7 @@ void CtrlPanel::ctrlPopup() //ctrlSubPop->addAction(QIcon(*midi_edit_instrumentIcon), tr("Edit instruments"))->setData(max + 2); - for (iMidiController ci = mcl->begin(); ci != mcl->end(); ++ci) + for (MusECore::iMidiController ci = mcl->begin(); ci != mcl->end(); ++ci) { int num = ci->second->num(); if((num & 0xff) == 0xff) @@ -852,15 +854,15 @@ void CtrlPanel::ctrlPopup() // dont show drum specific controller if not a drum track if(!isDrum) continue; - num = (num & ~0xff) + drumMap[curDrumInstrument].anote; + num = (num & ~0xff) + MusEGlobal::drumMap[curDrumInstrument].anote; } if(cll->find(channel, num) == cll->end()) - ctrlSubPop->addAction(midiCtrlNumString(num, true) + ci->second->name())->setData(num); + ctrlSubPop->addAction(MusECore::midiCtrlNumString(num, true) + ci->second->name())->setData(num); } // Don't allow editing instrument if it's a synth - if(!port->device() || port->device()->deviceType() != MidiDevice::SYNTH_MIDI) + if(!port->device() || port->device()->deviceType() != MusECore::MidiDevice::SYNTH_MIDI) ctrlSubPop->addAction(QIcon(*midi_edit_instrumentIcon), tr("Edit instrument ..."))->setData(max + 2); //connect(ctrlSubPop, SIGNAL(hovered(QAction*)), SLOT(ctrlSubPopHovered(QAction*))); @@ -874,24 +876,24 @@ void CtrlPanel::ctrlPopup() MusEGlobal::muse->startEditInstrument(); else // select new instrument control { - MidiController* c; - for (iMidiController ci = mcl->begin(); ci != mcl->end(); ++ci) + MusECore::MidiController* c; + for (MusECore::iMidiController ci = mcl->begin(); ci != mcl->end(); ++ci) { c = ci->second; int num = c->num(); if (isDrum && ((num & 0xff) == 0xff)) - num = (num & ~0xff) + drumMap[curDrumInstrument].anote; + num = (num & ~0xff) + MusEGlobal::drumMap[curDrumInstrument].anote; if(num != rv2) continue; if(cll->find(channel, num) == cll->end()) { - MidiCtrlValList* vl = new MidiCtrlValList(num); + MusECore::MidiCtrlValList* vl = new MusECore::MidiCtrlValList(num); cll->add(channel, vl); emit controllerChanged(c->num()); - //song->update(SC_MIDI_CONTROLLER_ADD); + //MusEGlobal::song->update(SC_MIDI_CONTROLLER_ADD); } else emit controllerChanged(c->num()); @@ -906,25 +908,25 @@ void CtrlPanel::ctrlPopup() // MusEGlobal::muse->startEditInstrument(); else if (rv == max + 3) { // add new other controller - MusEWidget::PopupMenu* ctrlSubPop = new MusEWidget::PopupMenu(this); - ctrlSubPop->addAction(new MusEWidget::MenuTitleItem(tr("Common Controls"), ctrlSubPop)); + MusEGui::PopupMenu* ctrlSubPop = new MusEGui::PopupMenu(this); + ctrlSubPop->addAction(new MusEGui::MenuTitleItem(tr("Common Controls"), ctrlSubPop)); for(int num = 0; num < 127; ++num) if(cll->find(channel, num) == cll->end()) - ctrlSubPop->addAction(midiCtrlName(num, true))->setData(num); + ctrlSubPop->addAction(MusECore::midiCtrlName(num, true))->setData(num); QAction *act2 = ctrlSubPop->exec(selCtrl->mapToGlobal(QPoint(0,0))); if (act2) { int rv2 = act2->data().toInt(); int num = rv2; if (isDrum && ((num & 0xff) == 0xff)) - num = (num & ~0xff) + drumMap[curDrumInstrument].anote; + num = (num & ~0xff) + MusEGlobal::drumMap[curDrumInstrument].anote; if(cll->find(channel, num) == cll->end()) { - MidiCtrlValList* vl = new MidiCtrlValList(num); + MusECore::MidiCtrlValList* vl = new MusECore::MidiCtrlValList(num); cll->add(channel, vl); emit controllerChanged(rv2); - //song->update(SC_MIDI_CONTROLLER_ADD); + //MusEGlobal::song->update(SC_MIDI_CONTROLLER_ADD); } else emit controllerChanged(rv2); @@ -933,10 +935,10 @@ void CtrlPanel::ctrlPopup() } else { // Select a control //QString s = act->text(); - iMidiCtrlValList i = cll->begin(); + MusECore::iMidiCtrlValList i = cll->begin(); for (; i != cll->end(); ++i) { - MidiCtrlValList* cl = i->second; - MidiController* c = port->midiController(cl->num()); + MusECore::MidiCtrlValList* cl = i->second; + MusECore::MidiController* c = port->midiController(cl->num()); //if (c->name() == s) { if (c->num() == rv) { emit controllerChanged(c->num()); @@ -966,12 +968,12 @@ void CtrlPanel::ctrlRightClicked(const QPoint& p, int /*id*/) int cdi = editor->curDrumInstrument(); int ctlnum = _ctrl->num(); - if(_track->type() == Track::DRUM && ((ctlnum & 0xff) == 0xff) && cdi != -1) - //ctlnum = (ctlnum & ~0xff) | drumMap[cdi].enote; + if(_track->type() == MusECore::Track::DRUM && ((ctlnum & 0xff) == 0xff) && cdi != -1) + //ctlnum = (ctlnum & ~0xff) | MusEGlobal::drumMap[cdi].enote; ctlnum = (ctlnum & ~0xff) | cdi; - MidiPart* part = dynamic_cast<MidiPart*>(editor->curCanvasPart()); - song->execMidiAutomationCtlPopup(0, part, p, ctlnum); + MusECore::MidiPart* part = dynamic_cast<MusECore::MidiPart*>(editor->curCanvasPart()); + MusEGlobal::song->execMidiAutomationCtlPopup(0, part, p, ctlnum); } /* @@ -985,3 +987,6 @@ void CtrlPanel::ctrlReleased(int id) // _knob->selectFaceColor(false); } */ + +} // namespace MusEGui + diff --git a/muse2/muse/ctrl/ctrlpanel.h b/muse2/muse/ctrl/ctrlpanel.h index 0376a245..c28708cb 100644 --- a/muse2/muse/ctrl/ctrlpanel.h +++ b/muse2/muse/ctrl/ctrlpanel.h @@ -25,18 +25,18 @@ #include <QWidget> -class MidiController; - class QPushButton; -namespace MusEWidget { -class Knob; -class DoubleLabel; +namespace MusECore { +class MidiController; +class MidiPort; +class MidiTrack; } +namespace MusEGui { +class DoubleLabel; +class Knob; class MidiEditor; -class MidiPort; -class MidiTrack; //--------------------------------------------------------- // CtrlPanel @@ -49,12 +49,12 @@ class CtrlPanel: public QWidget { QPushButton* selCtrl; MidiEditor* editor; - MidiTrack* _track; - MidiController* _ctrl; + MusECore::MidiTrack* _track; + MusECore::MidiController* _ctrl; int _dnum; bool inHeartBeat; - MusEWidget::Knob* _knob; - MusEWidget::DoubleLabel* _dl; + MusEGui::Knob* _knob; + MusEGui::DoubleLabel* _dl; int _val; @@ -78,6 +78,9 @@ class CtrlPanel: public QWidget { public: CtrlPanel(QWidget*, MidiEditor*, const char* name = 0); - void setHWController(MidiTrack* t, MidiController* ctrl); + void setHWController(MusECore::MidiTrack* t, MusECore::MidiController* ctrl); }; + +} // namespace MusEGui + #endif diff --git a/muse2/muse/dialogs.cpp b/muse2/muse/dialogs.cpp index b63d86d3..d88977ff 100644 --- a/muse2/muse/dialogs.cpp +++ b/muse2/muse/dialogs.cpp @@ -40,36 +40,38 @@ using namespace std; -MusEDialog::GateTime* gatetime_dialog=NULL; -MusEDialog::Velocity* velocity_dialog=NULL; -MusEDialog::Quantize* quantize_dialog=NULL; -MusEDialog::Remove* erase_dialog=NULL; -MusEDialog::DelOverlaps* del_overlaps_dialog=NULL; -MusEDialog::Setlen* set_notelen_dialog=NULL; -MusEDialog::Move* move_notes_dialog=NULL; -MusEDialog::Transpose* transpose_dialog=NULL; -MusEDialog::Crescendo* crescendo_dialog=NULL; -MusEDialog::Legato* legato_dialog=NULL; -MusEDialog::PasteDialog* paste_dialog=NULL; -MusEDialog::PasteEventsDialog* paste_events_dialog=NULL; +namespace MusEGui { + +GateTime* gatetime_dialog=NULL; +Velocity* velocity_dialog=NULL; +Quantize* quantize_dialog=NULL; +Remove* erase_dialog=NULL; +DelOverlaps* del_overlaps_dialog=NULL; +Setlen* set_notelen_dialog=NULL; +Move* move_notes_dialog=NULL; +Transpose* transpose_dialog=NULL; +Crescendo* crescendo_dialog=NULL; +Legato* legato_dialog=NULL; +PasteDialog* paste_dialog=NULL; +PasteEventsDialog* paste_events_dialog=NULL; void init_function_dialogs(QWidget* parent) { - gatetime_dialog = new MusEDialog::GateTime(parent); - velocity_dialog = new MusEDialog::Velocity(parent); - quantize_dialog = new MusEDialog::Quantize(parent); - erase_dialog = new MusEDialog::Remove(parent); - del_overlaps_dialog = new MusEDialog::DelOverlaps(parent); - set_notelen_dialog = new MusEDialog::Setlen(parent); - move_notes_dialog = new MusEDialog::Move(parent); - transpose_dialog = new MusEDialog::Transpose(parent); - crescendo_dialog = new MusEDialog::Crescendo(parent); - legato_dialog = new MusEDialog::Legato(parent); - paste_dialog = new MusEDialog::PasteDialog(parent); - paste_events_dialog = new MusEDialog::PasteEventsDialog(parent); + gatetime_dialog = new GateTime(parent); + velocity_dialog = new Velocity(parent); + quantize_dialog = new Quantize(parent); + erase_dialog = new Remove(parent); + del_overlaps_dialog = new DelOverlaps(parent); + set_notelen_dialog = new Setlen(parent); + move_notes_dialog = new Move(parent); + transpose_dialog = new Transpose(parent); + crescendo_dialog = new Crescendo(parent); + legato_dialog = new Legato(parent); + paste_dialog = new PasteDialog(parent); + paste_events_dialog = new PasteEventsDialog(parent); } -void read_function_dialog_config(Xml& xml) +void read_function_dialog_config(MusECore::Xml& xml) { if (erase_dialog==NULL) { @@ -80,14 +82,14 @@ void read_function_dialog_config(Xml& xml) for (;;) { - Xml::Token token = xml.parse(); - if (token == Xml::Error || token == Xml::End) + MusECore::Xml::Token token = xml.parse(); + if (token == MusECore::Xml::Error || token == MusECore::Xml::End) break; const QString& tag = xml.s1(); switch (token) { - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "mod_len") gatetime_dialog->read_configuration(xml); else if (tag == "mod_velo") @@ -116,7 +118,7 @@ void read_function_dialog_config(Xml& xml) xml.unknown("dialogs"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "dialogs") return; @@ -126,7 +128,7 @@ void read_function_dialog_config(Xml& xml) } } -void write_function_dialog_config(int level, Xml& xml) +void write_function_dialog_config(int level, MusECore::Xml& xml) { xml.tag(level++, "dialogs"); @@ -145,3 +147,5 @@ void write_function_dialog_config(int level, Xml& xml) xml.tag(level, "/dialogs"); } + +} diff --git a/muse2/muse/dialogs.h b/muse2/muse/dialogs.h index 0cb5107a..08830fe0 100644 --- a/muse2/muse/dialogs.h +++ b/muse2/muse/dialogs.h @@ -24,7 +24,12 @@ #define __DIALOGS_H__ class QWidget; -namespace MusEDialog + +namespace MusECore { +class Xml; +} + +namespace MusEGui { class GateTime; class Velocity; @@ -38,25 +43,25 @@ namespace MusEDialog class Legato; class PasteDialog; class PasteEventsDialog; -} -class Xml; -extern MusEDialog::GateTime* gatetime_dialog; -extern MusEDialog::Velocity* velocity_dialog; -extern MusEDialog::Quantize* quantize_dialog; -extern MusEDialog::Remove* erase_dialog; -extern MusEDialog::DelOverlaps* del_overlaps_dialog; -extern MusEDialog::Setlen* set_notelen_dialog; -extern MusEDialog::Move* move_notes_dialog; -extern MusEDialog::Transpose* transpose_dialog; -extern MusEDialog::Crescendo* crescendo_dialog; -extern MusEDialog::Legato* legato_dialog; -extern MusEDialog::PasteDialog* paste_dialog; -extern MusEDialog::PasteEventsDialog* paste_events_dialog; +extern GateTime* gatetime_dialog; +extern Velocity* velocity_dialog; +extern Quantize* quantize_dialog; +extern Remove* erase_dialog; +extern DelOverlaps* del_overlaps_dialog; +extern Setlen* set_notelen_dialog; +extern Move* move_notes_dialog; +extern Transpose* transpose_dialog; +extern Crescendo* crescendo_dialog; +extern Legato* legato_dialog; +extern PasteDialog* paste_dialog; +extern PasteEventsDialog* paste_events_dialog; void init_function_dialogs(QWidget* parent); -void read_function_dialog_config(Xml& xml); -void write_function_dialog_config(int level, Xml& xml); +void read_function_dialog_config(MusECore::Xml& xml); +void write_function_dialog_config(int level, MusECore::Xml& xml); + +} #endif diff --git a/muse2/muse/driver/alsamidi.cpp b/muse2/muse/driver/alsamidi.cpp index 8ad9c510..eae695db 100644 --- a/muse2/muse/driver/alsamidi.cpp +++ b/muse2/muse/driver/alsamidi.cpp @@ -39,6 +39,8 @@ #include "part.h" #include "gconfig.h" +namespace MusECore { + static int alsaSeqFdi = -1; static int alsaSeqFdo = -1; @@ -407,12 +409,12 @@ void MidiAlsaDevice::processMidi() if (_playEvents.empty()) return; int port = midiPort(); - MidiPort* mp = port != -1 ? &midiPorts[port] : 0; - unsigned curFrame = audio->curFrame(); - int tickpos = audio->tickPos(); - bool extsync = extSyncFlag.value(); + MidiPort* mp = port != -1 ? &MusEGlobal::midiPorts[port] : 0; + unsigned curFrame = MusEGlobal::audio->curFrame(); + int tickpos = MusEGlobal::audio->tickPos(); + bool extsync = MusEGlobal::extSyncFlag.value(); //int frameOffset = getFrameOffset(); - //int nextTick = audio->nextTick(); + //int nextTick = MusEGlobal::audio->nextTick(); // Play all events up to current frame. iMPEvent i = _playEvents.begin(); @@ -443,12 +445,12 @@ void MidiAlsaDevice::processMidi() while(!stuckNotesFifo.isEmpty()) _stuckNotes.add(stuckNotesFifo.get()); - bool extsync = extSyncFlag.value(); + bool extsync = MusEGlobal::extSyncFlag.value(); //int frameOffset = getFrameOffset(); - //int nextTick = audio->nextTick(); + //int nextTick = MusEGlobal::audio->nextTick(); - // We're in the ALSA midi thread. audio->isPlaying() might not be true during seek right now. - //if(stop || (seek && audio->isPlaying())) + // We're in the ALSA midi thread. MusEGlobal::audio->isPlaying() might not be true during seek right now. + //if(stop || (seek && MusEGlobal::audio->isPlaying())) if(stop || seek) { //--------------------------------------------------- @@ -473,7 +475,7 @@ void MidiAlsaDevice::processMidi() _playEvents.add(playEventFifo.get()); /* TODO Handle these more directly than putting them into play events list. - //if(audio->isPlaying()) + //if(MusEGlobal::audio->isPlaying()) { iMPEvent k; for (k = _stuckNotes.begin(); k != _stuckNotes.end(); ++k) { @@ -496,7 +498,7 @@ void MidiAlsaDevice::processMidi() if(stop) { // reset sustain... - MidiPort* mp = &midiPorts[_port]; + MidiPort* mp = &MusEGlobal::midiPorts[_port]; for(int ch = 0; ch < MIDI_CHANNELS; ++ch) { if(mp->hwCtrlState(ch, CTRL_SUSTAIN) == 127) @@ -528,9 +530,9 @@ void MidiAlsaDevice::processMidi() return; int port = midiPort(); - MidiPort* mp = port != -1 ? &midiPorts[port] : 0; - unsigned curFrame = audio->curFrame(); - int tickpos = audio->tickPos(); + MidiPort* mp = port != -1 ? &MusEGlobal::midiPorts[port] : 0; + unsigned curFrame = MusEGlobal::audio->curFrame(); + int tickpos = MusEGlobal::audio->tickPos(); // Play all events up to current frame. iMPEvent i = _playEvents.begin(); @@ -564,7 +566,7 @@ void MidiAlsaDevice::handleStop() // reset sustain //--------------------------------------------------- - MidiPort* mp = &midiPorts[_port]; + MidiPort* mp = &MusEGlobal::midiPorts[_port]; for(int ch = 0; ch < MIDI_CHANNELS; ++ch) { if(mp->hwCtrlState(ch, CTRL_SUSTAIN) == 127) @@ -580,7 +582,7 @@ void MidiAlsaDevice::handleStop() //--------------------------------------------------- // Don't send if external sync is on. The master, and our sync routing system will take care of that. - if(!extSyncFlag.value()) + if(!MusEGlobal::extSyncFlag.value()) { // Shall we check open flags? //if(!(dev->rwFlags() & 0x1) || !(dev->openFlags() & 1)) @@ -600,7 +602,7 @@ void MidiAlsaDevice::handleStop() // Hmm, is this required? Seems to make other devices unhappy. // (Could try now that this is in MidiDevice. p4.0.22 ) //if(!si.sendContNotStart()) - // mp->sendSongpos(audio->tickPos() * 4 / config.division); + // mp->sendSongpos(MusEGlobal::audio->tickPos() * 4 / config.division); } } } @@ -617,9 +619,9 @@ void MidiAlsaDevice::handleSeek() seekPending = true; // Trigger seek handling in processMidi. - MidiPort* mp = &midiPorts[_port]; + MidiPort* mp = &MusEGlobal::midiPorts[_port]; MidiCtrlValListList* cll = mp->controller(); - int pos = audio->tickPos(); + int pos = MusEGlobal::audio->tickPos(); //--------------------------------------------------- // Send new contoller values @@ -646,7 +648,7 @@ void MidiAlsaDevice::handleSeek() //--------------------------------------------------- // Don't send if external sync is on. The master, and our sync routing system will take care of that. p3.3.31 - if(!extSyncFlag.value()) + if(!MusEGlobal::extSyncFlag.value()) { if(mp->syncInfo().MRTOut()) { @@ -657,10 +659,10 @@ void MidiAlsaDevice::handleSeek() //if(!(openFlags() & 1)) // continue; - int beat = (pos * 4) / MusEConfig::config.division; + int beat = (pos * 4) / MusEGlobal::config.division; //bool isPlaying = (state == PLAY); - bool isPlaying = audio->isPlaying(); // TODO Check this it includes LOOP1 and LOOP2 besides PLAY. p4.0.22 + bool isPlaying = MusEGlobal::audio->isPlaying(); // TODO Check this it includes LOOP1 and LOOP2 besides PLAY. p4.0.22 mp->sendStop(); mp->sendSongpos(beat); @@ -721,18 +723,18 @@ bool initMidiAlsa() snd_seq_port_info_get_name(pinfo), adr.client, adr.port, flags, capability); - midiDevices.add(dev); + MusEGlobal::midiDevices.add(dev); /* // Experimental... Need to list 'sensible' devices first and ignore unwanted ones... // Add instance last in midi device list. for(int i = 0; i < MIDI_PORTS; ++i) { - MidiPort* mp = &midiPorts[i]; + MidiPort* mp = &MusEGlobal::midiPorts[i]; if(mp->device() == 0) { // midiSeq might not be initialzed yet! - //midiSeq->msgSetMidiDevice(mp, dev); + //MusEGlobal::midiSeq->msgSetMidiDevice(mp, dev); mp->setMidiDevice(dev); //muse->changeConfig(true); // save configuration file @@ -746,7 +748,7 @@ bool initMidiAlsa() } //snd_seq_set_client_name(alsaSeq, "MusE Sequencer"); - snd_seq_set_client_name(alsaSeq, audioDevice->clientName()); + snd_seq_set_client_name(alsaSeq, MusEGlobal::audioDevice->clientName()); int ci = snd_seq_poll_descriptors_count(alsaSeq, POLLIN); int co = snd_seq_poll_descriptors_count(alsaSeq, POLLOUT); @@ -795,7 +797,6 @@ bool initMidiAlsa() return false; } -namespace MusEApp { //--------------------------------------------------------- // exitMidiAlsa @@ -813,8 +814,6 @@ void exitMidiAlsa() } } -} // namespace MusEApp - struct AlsaPort { snd_seq_addr_t adr; @@ -873,7 +872,7 @@ void alsaScanMidiPorts() // // check for devices to delete // - for (iMidiDevice i = midiDevices.begin(); i != midiDevices.end();) { + for (iMidiDevice i = MusEGlobal::midiDevices.begin(); i != MusEGlobal::midiDevices.end();) { MidiAlsaDevice* d = dynamic_cast<MidiAlsaDevice*>(*i); if (d == 0) { ++i; @@ -888,11 +887,11 @@ void alsaScanMidiPorts() } if (k == portList.end()) { if (d->midiPort() != -1) - midiPorts[d->midiPort()].setMidiDevice(0); + MusEGlobal::midiPorts[d->midiPort()].setMidiDevice(0); iMidiDevice k = i; // printf("erase device\n"); ++i; - midiDevices.erase(k); + MusEGlobal::midiDevices.erase(k); } else { ++i; @@ -902,9 +901,9 @@ void alsaScanMidiPorts() // check for devices to add // for (std::list<AlsaPort>::iterator k = portList.begin(); k != portList.end(); ++k) { - iMidiDevice i = midiDevices.begin(); + iMidiDevice i = MusEGlobal::midiDevices.begin(); // printf("ALSA port: <%s>\n", k->name); - for (;i != midiDevices.end(); ++i) { + for (;i != MusEGlobal::midiDevices.end(); ++i) { MidiAlsaDevice* d = dynamic_cast<MidiAlsaDevice*>(*i); if (d == 0) continue; @@ -912,12 +911,12 @@ void alsaScanMidiPorts() break; } } - if (i == midiDevices.end()) { + if (i == MusEGlobal::midiDevices.end()) { // add device MidiAlsaDevice* dev = new MidiAlsaDevice(k->adr, QString(k->name)); dev->setrwFlags(k->flags); - midiDevices.add(dev); + MusEGlobal::midiDevices.add(dev); // printf("add device\n"); } } @@ -971,7 +970,7 @@ void alsaProcessMidiInput() case SND_SEQ_EVENT_PORT_START: case SND_SEQ_EVENT_PORT_EXIT: alsaScanMidiPorts(); - audio->midiPortsChanged(); // signal gui + MusEGlobal::audio->midiPortsChanged(); // signal gui snd_seq_free_event(ev); return; } @@ -981,7 +980,7 @@ void alsaProcessMidiInput() // // find real source device // - for (iMidiDevice i = midiDevices.begin(); i != midiDevices.end(); ++i) { + for (iMidiDevice i = MusEGlobal::midiDevices.begin(); i != MusEGlobal::midiDevices.end(); ++i) { MidiAlsaDevice* d = dynamic_cast<MidiAlsaDevice*>(*i); if (d && d->adr.client == ev->source.client && d->adr.port == ev->source.port) { @@ -1046,24 +1045,24 @@ void alsaProcessMidiInput() break; case SND_SEQ_EVENT_CLOCK: - midiSeq->realtimeSystemInput(curPort, ME_CLOCK); + MusEGlobal::midiSeq->realtimeSystemInput(curPort, ME_CLOCK); //mdev->syncInfo().trigMCSyncDetect(); break; case SND_SEQ_EVENT_START: - midiSeq->realtimeSystemInput(curPort, ME_START); + MusEGlobal::midiSeq->realtimeSystemInput(curPort, ME_START); break; case SND_SEQ_EVENT_CONTINUE: - midiSeq->realtimeSystemInput(curPort, ME_CONTINUE); + MusEGlobal::midiSeq->realtimeSystemInput(curPort, ME_CONTINUE); break; case SND_SEQ_EVENT_STOP: - midiSeq->realtimeSystemInput(curPort, ME_STOP); + MusEGlobal::midiSeq->realtimeSystemInput(curPort, ME_STOP); break; case SND_SEQ_EVENT_TICK: - midiSeq->realtimeSystemInput(curPort, ME_TICK); + MusEGlobal::midiSeq->realtimeSystemInput(curPort, ME_TICK); //mdev->syncInfo().trigTickDetect(); break; @@ -1087,12 +1086,12 @@ void alsaProcessMidiInput() case SND_SEQ_EVENT_PORT_UNSUBSCRIBED: // write port is released break; case SND_SEQ_EVENT_SONGPOS: - midiSeq->setSongPosition(curPort, ev->data.control.value); + MusEGlobal::midiSeq->setSongPosition(curPort, ev->data.control.value); break; case SND_SEQ_EVENT_SENSING: break; case SND_SEQ_EVENT_QFRAME: - midiSeq->mtcInputQuarter(curPort, ev->data.control.value); + MusEGlobal::midiSeq->mtcInputQuarter(curPort, ev->data.control.value); break; // case SND_SEQ_EVENT_CLIENT_START: // case SND_SEQ_EVENT_CLIENT_EXIT: @@ -1124,3 +1123,4 @@ void alsaProcessMidiInput() } } +} // namespace MusECore diff --git a/muse2/muse/driver/alsamidi.h b/muse2/muse/driver/alsamidi.h index 9badd7c4..2054a7d3 100644 --- a/muse2/muse/driver/alsamidi.h +++ b/muse2/muse/driver/alsamidi.h @@ -30,6 +30,8 @@ #include "mpevent.h" #include "mididev.h" +namespace MusECore { + class Xml; //--------------------------------------------------------- @@ -77,12 +79,14 @@ class MidiAlsaDevice : public MidiDevice { }; extern bool initMidiAlsa(); -extern bool exitMidiAlsa(); +extern void exitMidiAlsa(); extern int alsaSelectRfd(); extern int alsaSelectWfd(); extern void alsaProcessMidiInput(); extern void alsaScanMidiPorts(); +} // namespace MusECore + #endif 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 <climits> #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/audiodev.h b/muse2/muse/driver/audiodev.h index 3fe06fb9..14fb60b3 100644 --- a/muse2/muse/driver/audiodev.h +++ b/muse2/muse/driver/audiodev.h @@ -28,7 +28,8 @@ class QString; -class MidiPlayEvent; +namespace MusECore { + class Pos; //--------------------------------------------------------- @@ -87,5 +88,7 @@ class AudioDevice { virtual int setMaster(bool f) = 0; }; +} // namespace MusECore + #endif diff --git a/muse2/muse/driver/dummyaudio.cpp b/muse2/muse/driver/dummyaudio.cpp index 4466e293..1738027d 100644 --- a/muse2/muse/driver/dummyaudio.cpp +++ b/muse2/muse/driver/dummyaudio.cpp @@ -38,9 +38,12 @@ #include "gconfig.h" #include "utils.h" +#define DEBUG_DUMMY 0 + +namespace MusECore { + class MidiPlayEvent; -#define DEBUG_DUMMY 0 //--------------------------------------------------------- // DummyAudioDevice //--------------------------------------------------------- @@ -140,7 +143,7 @@ class DummyAudioDevice : public AudioDevice { return _framePos; } virtual unsigned frameTime() const { - return lrint(MusEUtil::curTime() * MusEGlobal::sampleRate); + return lrint(curTime() * MusEGlobal::sampleRate); } virtual bool isRealtime() { return realtimeFlag; } //virtual int realtimePriority() const { return 40; } @@ -215,19 +218,18 @@ DummyAudioDevice::DummyAudioDevice() // Added by Tim. p3.3.15 // p3.3.30 //posix_memalign((void**)&buffer, 16, sizeof(float) * dummyFrames); - posix_memalign((void**)&buffer, 16, sizeof(float) * MusEConfig::config.dummyAudioBufSize); + posix_memalign((void**)&buffer, 16, sizeof(float) * MusEGlobal::config.dummyAudioBufSize); dummyThread = 0; realtimeFlag = false; seekflag = false; state = Audio::STOP; - //startTime = MusEUtil::curTime(); + //startTime = curTime(); _framePos = 0; playPos = 0; cmdQueue.clear(); } -namespace MusEApp { //--------------------------------------------------------- // exitDummyAudio @@ -238,10 +240,9 @@ void exitDummyAudio() if(dummyAudio) delete dummyAudio; dummyAudio = NULL; - audioDevice = NULL; + MusEGlobal::audioDevice = NULL; } -} // namespace MusEApp //--------------------------------------------------------- // initDummyAudio @@ -250,7 +251,7 @@ void exitDummyAudio() bool initDummyAudio() { dummyAudio = new DummyAudioDevice(); - audioDevice = dummyAudio; + MusEGlobal::audioDevice = dummyAudio; return false; } @@ -294,9 +295,9 @@ static void* dummyLoop(void* ptr) // p3.3.30 //MusEGlobal::sampleRate = 25600; - MusEGlobal::sampleRate = MusEConfig::config.dummyAudioSampleRate; + MusEGlobal::sampleRate = MusEGlobal::config.dummyAudioSampleRate; //MusEGlobal::segmentSize = dummyFrames; - MusEGlobal::segmentSize = MusEConfig::config.dummyAudioBufSize; + MusEGlobal::segmentSize = MusEGlobal::config.dummyAudioBufSize; #if 0 //unsigned int tickRate = MusEGlobal::sampleRate / dummyFrames; unsigned int tickRate = MusEGlobal::sampleRate / MusEGlobal::segmentSize; @@ -455,19 +456,19 @@ static void* dummyLoop(void* ptr) for(;;) { //if(audioState == AUDIO_RUNNING) - if(audio->isRunning()) - //audio->process(MusEGlobal::segmentSize, drvPtr->state); - audio->process(MusEGlobal::segmentSize); + if(MusEGlobal::audio->isRunning()) + //MusEGlobal::audio->process(MusEGlobal::segmentSize, drvPtr->state); + MusEGlobal::audio->process(MusEGlobal::segmentSize); //else if (audioState == AUDIO_START1) // audioState = AUDIO_START2; - //usleep(dummyFrames*1000000/AL::MusEGlobal::sampleRate); + //usleep(dummyFrames*1000000/AL::sampleRate); usleep(MusEGlobal::segmentSize*1000000/MusEGlobal::sampleRate); //if(dummyAudio->seekflag) if(drvPtr->seekflag) { - //audio->sync(Audio::STOP, dummyAudio->pos); - //audio->sync(drvPtr->state, drvPtr->playPos); - audio->sync(Audio::STOP, drvPtr->playPos); + //MusEGlobal::audio->sync(Audio::STOP, dummyAudio->pos); + //MusEGlobal::audio->sync(drvPtr->state, drvPtr->playPos); + MusEGlobal::audio->sync(Audio::STOP, drvPtr->playPos); //dummyAudio->seekflag = false; drvPtr->seekflag = false; @@ -515,7 +516,7 @@ void DummyAudioDevice::start(int priority) } } - int rv = pthread_create(&dummyThread, attributes, ::dummyLoop, this); + int rv = pthread_create(&dummyThread, attributes, dummyLoop, this); if(rv) { // p4.0.16: MusEGlobal::realTimeScheduling is unreliable. It is true even in some clearly non-RT cases. @@ -523,7 +524,7 @@ void DummyAudioDevice::start(int priority) // 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(&dummyThread, NULL, ::dummyLoop, this); + rv = pthread_create(&dummyThread, NULL, dummyLoop, this); } if(rv) @@ -543,3 +544,4 @@ void DummyAudioDevice::stop () dummyThread = 0; } +} // namespace MusECore diff --git a/muse2/muse/driver/jack.cpp b/muse2/muse/driver/jack.cpp index 31179ea3..733353d8 100644 --- a/muse2/muse/driver/jack.cpp +++ b/muse2/muse/driver/jack.cpp @@ -53,15 +53,35 @@ //#include "errorhandler.h" -#ifndef RTCAP -extern void MusEGlobal::doSetuid(); -extern void MusEGlobal::undoSetuid(); -#endif - #ifdef VST_SUPPORT #include <fst.h> #endif +namespace MusEGlobal { + +#ifndef RTCAP +extern void doSetuid(); +extern void undoSetuid(); +#endif + +//--------------------------------------------------------- +// checkAudioDevice - make sure audioDevice exists +//--------------------------------------------------------- + +bool checkAudioDevice() + { + if (audioDevice == NULL) { + if(debugMsg) + printf("Muse:checkAudioDevice: no audioDevice\n"); + return false; + } + return true; + } + +} // namespace MusEGlobal + +namespace MusECore { + //extern int jackmidi_pi[2]; //extern int jackmidi_po[2]; @@ -275,8 +295,8 @@ int JackAudioDevice::processAudio(jack_nframes_t frames, void*) // if (JACK_DEBUG) // printf("processAudio - >>>>\n"); MusEGlobal::segmentSize = frames; - if (audio->isRunning()) - audio->process((unsigned long)frames); + if (MusEGlobal::audio->isRunning()) + MusEGlobal::audio->process((unsigned long)frames); else { if (MusEGlobal::debugMsg) puts("jack calling when audio is disconnected!\n"); @@ -296,7 +316,7 @@ static int processSync(jack_transport_state_t state, jack_position_t* pos, void* if (JACK_DEBUG) printf("processSync()\n"); - if(!useJackTransport.value()) + if(!MusEGlobal::useJackTransport.value()) return 1; int audioState = Audio::STOP; @@ -327,10 +347,10 @@ static int processSync(jack_transport_state_t state, jack_position_t* pos, void* //printf("processSync valid:%d frame:%d\n", pos->valid, frame); // p3.3.23 - //printf("Jack processSync() before audio->sync frame:%d\n", frame); - //return audio->sync(audioState, frame); - int rv = audio->sync(audioState, frame); - //printf("Jack processSync() after audio->sync frame:%d\n", frame); + //printf("Jack processSync() before MusEGlobal::audio->sync frame:%d\n", frame); + //return MusEGlobal::audio->sync(audioState, frame); + int rv = MusEGlobal::audio->sync(audioState, frame); + //printf("Jack processSync() after MusEGlobal::audio->sync frame:%d\n", frame); return rv; } @@ -344,13 +364,13 @@ static void timebase_callback(jack_transport_state_t /* state */, int /* new_pos */, void*) { - //printf("Jack timebase_callback pos->frame:%u audio->tickPos:%d song->cpos:%d\n", pos->frame, audio->tickPos(), song->cpos()); + //printf("Jack timebase_callback pos->frame:%u MusEGlobal::audio->tickPos:%d MusEGlobal::song->cpos:%d\n", pos->frame, MusEGlobal::audio->tickPos(), MusEGlobal::song->cpos()); // p3.3.27 //Pos p(pos->frame, false); - Pos p(extSyncFlag.value() ? audio->tickPos() : pos->frame, extSyncFlag.value() ? true : false); + Pos p(MusEGlobal::extSyncFlag.value() ? MusEGlobal::audio->tickPos() : pos->frame, MusEGlobal::extSyncFlag.value() ? true : false); // Can't use song pos - it is only updated every (slow) GUI heartbeat ! - //Pos p(extSyncFlag.value() ? song->cpos() : pos->frame, extSyncFlag.value() ? true : false); + //Pos p(MusEGlobal::extSyncFlag.value() ? MusEGlobal::song->cpos() : pos->frame, MusEGlobal::extSyncFlag.value() ? true : false); pos->valid = JackPositionBBT; p.mbt(&pos->bar, &pos->beat, &pos->tick); @@ -381,8 +401,8 @@ static void timebase_callback(jack_transport_state_t /* state */, //pos->ticks_per_beat = config.division; pos->ticks_per_beat = 24; - int tempo = tempomap.tempo(p.tick()); - pos->beats_per_minute = (60000000.0 / tempo) * tempomap.globalTempo()/100.0; + int tempo = MusEGlobal::tempomap.tempo(p.tick()); + pos->beats_per_minute = (60000000.0 / tempo) * MusEGlobal::tempomap.globalTempo()/100.0; } //--------------------------------------------------------- @@ -395,7 +415,7 @@ static void processShutdown(void*) printf("processShutdown()\n"); //printf("processShutdown\n"); jackAudio->nullify_client(); - audio->shutdown(); + MusEGlobal::audio->shutdown(); int c=0; while(MusEGlobal::midiSeqRunning == true) { @@ -407,7 +427,7 @@ static void processShutdown(void*) } delete jackAudio; jackAudio=0; - audioDevice=0; + MusEGlobal::audioDevice=0; } //--------------------------------------------------------- @@ -630,7 +650,7 @@ bool initJackAudio() */ if (client) { - audioDevice = jackAudio; + MusEGlobal::audioDevice = jackAudio; jackAudio->scanMidiPorts(); return false; } @@ -651,7 +671,7 @@ static void freewheel_callback(int starting, void*) { if (MusEGlobal::debugMsg || JACK_DEBUG) printf("JACK: freewheel_callback: starting%d\n", starting); - audio->setFreewheel(starting); + MusEGlobal::audio->setFreewheel(starting); } static int srate_callback(jack_nframes_t n, void*) @@ -670,7 +690,7 @@ static void registration_callback(jack_port_id_t, int, void*) if(MusEGlobal::debugMsg || JACK_DEBUG) printf("JACK: registration changed\n"); - audio->sendMsgToGui('R'); + MusEGlobal::audio->sendMsgToGui('R'); } //--------------------------------------------------------- @@ -699,7 +719,7 @@ void JackAudioDevice::connectJackMidiPorts() if(JACK_DEBUG) printf("JackAudioDevice::connectJackMidiPorts()\n"); - for (iMidiDevice i = midiDevices.begin(); i != midiDevices.end(); ++i) + for (iMidiDevice i = MusEGlobal::midiDevices.begin(); i != MusEGlobal::midiDevices.end(); ++i) { //MidiJackDevice* mjd = dynamic_cast<MidiJackDevice*>(*i); //if(!mjd) @@ -794,7 +814,7 @@ void JackAudioDevice::connectJackMidiPorts() if(JACK_DEBUG) printf("JackAudioDevice::graphChanged %s\n", name.toLatin1()); - for(iMidiDevice imd = midiDevices.begin(); imd != midiDevices.end(); ++imd) + for(iMidiDevice imd = MusEGlobal::midiDevices.begin(); imd != MusEGlobal::midiDevices.end(); ++imd) { // Is it a Jack midi device? MidiJackDevice* mjd = dynamic_cast<MidiJackDevice*>(*imd); @@ -823,7 +843,7 @@ void JackAudioDevice::connectJackMidiPorts() { if(JACK_DEBUG) printf("JackAudioDevice::graphChanged connecting MusE output\n"); - audioDevice->connect(port, devport); + MusEGlobal::audioDevice->connect(port, devport); } else // If Jack port can send data to us and we actually want it... @@ -831,7 +851,7 @@ void JackAudioDevice::connectJackMidiPorts() { if(JACK_DEBUG) printf("JackAudioDevice::graphChanged connecting MusE input\n"); - audioDevice->connect(devport, port); + MusEGlobal::audioDevice->connect(devport, port); } break; @@ -881,7 +901,7 @@ static int graph_callback(void*) // we cannot call JackAudioDevice::graphChanged() from this // context, so we send a message to the gui thread which in turn // calls graphChanged() - audio->sendMsgToGui('C'); + MusEGlobal::audio->sendMsgToGui('C'); if (MusEGlobal::debugMsg) printf("JACK: graph changed\n"); return 0; @@ -898,7 +918,7 @@ void JackAudioDevice::graphChanged() if (JACK_DEBUG) printf("graphChanged()\n"); if(!checkJackClient(_client)) return; - InputList* il = song->inputs(); + InputList* il = MusEGlobal::song->inputs(); for (iAudioInput ii = il->begin(); ii != il->end(); ++ii) { AudioInput* it = *ii; int channels = it->channels(); @@ -935,7 +955,7 @@ void JackAudioDevice::graphChanged() ++pn; } if (!found) { - audio->msgRemoveRoute1( + MusEGlobal::audio->msgRemoveRoute1( //Route(portName, false, channel), Route(portName, false, channel, Route::JACK_ROUTE), Route(it, channel) @@ -968,7 +988,7 @@ void JackAudioDevice::graphChanged() } } if (!found) { - audio->msgAddRoute1( + MusEGlobal::audio->msgAddRoute1( //Route(*pn, false, channel), Route(*pn, false, channel, Route::JACK_ROUTE), Route(it, channel) @@ -986,7 +1006,7 @@ void JackAudioDevice::graphChanged() } } } - OutputList* ol = song->outputs(); + OutputList* ol = MusEGlobal::song->outputs(); for (iAudioOutput ii = ol->begin(); ii != ol->end(); ++ii) { AudioOutput* it = *ii; int channels = it->channels(); @@ -1022,7 +1042,7 @@ void JackAudioDevice::graphChanged() ++pn; } if (!found) { - audio->msgRemoveRoute1( + MusEGlobal::audio->msgRemoveRoute1( Route(it, channel), //Route(portName, false, channel) Route(portName, false, channel, Route::JACK_ROUTE) @@ -1055,7 +1075,7 @@ void JackAudioDevice::graphChanged() } } if (!found) { - audio->msgAddRoute1( + MusEGlobal::audio->msgAddRoute1( Route(it, channel), //Route(*pn, false, channel) Route(*pn, false, channel, Route::JACK_ROUTE) @@ -1074,7 +1094,7 @@ void JackAudioDevice::graphChanged() } } - for (iMidiDevice ii = midiDevices.begin(); ii != midiDevices.end(); ++ii) + for (iMidiDevice ii = MusEGlobal::midiDevices.begin(); ii != MusEGlobal::midiDevices.end(); ++ii) { MidiDevice* md = *ii; if(md->deviceType() != MidiDevice::JACK_MIDI) @@ -1135,7 +1155,7 @@ void JackAudioDevice::graphChanged() ++pn; } if (!found) { - audio->msgRemoveRoute1( + MusEGlobal::audio->msgRemoveRoute1( //Route(it, channel), //Route(mjd), Route(md, -1), @@ -1172,7 +1192,7 @@ void JackAudioDevice::graphChanged() } } if (!found) { - audio->msgAddRoute1( + MusEGlobal::audio->msgAddRoute1( //Route(it, channel), //Route(mjd), Route(md, -1), @@ -1234,7 +1254,7 @@ void JackAudioDevice::graphChanged() ++pn; } if (!found) { - audio->msgRemoveRoute1( + MusEGlobal::audio->msgRemoveRoute1( //Route(portName, false, channel), //Route(portName, false, -1), Route(portName, false, -1, Route::JACK_ROUTE), @@ -1271,7 +1291,7 @@ void JackAudioDevice::graphChanged() } } if (!found) { - audio->msgAddRoute1( + MusEGlobal::audio->msgAddRoute1( //Route(*pn, false, channel), //Route(*pn, false, -1), Route(*pn, false, -1, Route::JACK_ROUTE), @@ -1370,46 +1390,6 @@ void* JackAudioDevice::registerOutPort(const char* name, bool midi) return p; } -namespace MusEGlobal { - -//--------------------------------------------------------- -// checkAudioDevice - make sure audioDevice exists -//--------------------------------------------------------- - -bool checkAudioDevice() - { - if (audioDevice == NULL) { - if(MusEGlobal::debugMsg) - printf("Muse:checkAudioDevice: no audioDevice\n"); - return false; - } - return true; - } - -} // namespace MusEGlobal - -namespace MusEApp { - -//--------------------------------------------------------- -// exitJackAudio -//--------------------------------------------------------- - -void exitJackAudio() - { - if (JACK_DEBUG) - printf("exitJackAudio()\n"); - if (jackAudio) - delete jackAudio; - - if (JACK_DEBUG) - printf("exitJackAudio() after delete jackAudio\n"); - - // Added by Tim. p3.3.14 - audioDevice = NULL; - - } -} // namespace MusEApp - //--------------------------------------------------------- // connect //--------------------------------------------------------- @@ -1494,7 +1474,7 @@ void JackAudioDevice::start(int /*priority*/) running. */ - InputList* il = song->inputs(); + InputList* il = MusEGlobal::song->inputs(); for (iAudioInput i = il->begin(); i != il->end(); ++i) { AudioInput* ai = *i; int channel = ai->channels(); @@ -1507,7 +1487,7 @@ void JackAudioDevice::start(int /*priority*/) } } } - OutputList* ol = song->outputs(); + OutputList* ol = MusEGlobal::song->outputs(); for (iAudioOutput i = ol->begin(); i != ol->end(); ++i) { AudioOutput* ai = *i; int channel = ai->channels(); @@ -1571,7 +1551,7 @@ unsigned int JackAudioDevice::getCurFrame() if (JACK_DEBUG) printf("JackAudioDevice::getCurFrame pos.frame:%d\n", pos.frame); - if(!useJackTransport.value()) + if(!MusEGlobal::useJackTransport.value()) return (unsigned int)dummyPos; return pos.frame; @@ -1583,7 +1563,7 @@ unsigned int JackAudioDevice::getCurFrame() int JackAudioDevice::framePos() const { - //if(!useJackTransport.value()) + //if(!MusEGlobal::useJackTransport.value()) //{ // if (JACK_DEBUG) // printf("JackAudioDevice::framePos dummyPos:%d\n", dummyPos); @@ -1805,11 +1785,11 @@ void JackAudioDevice::unregisterPort(void* p) int JackAudioDevice::getState() { // If we're not using Jack's transport, just return current state. - if(!useJackTransport.value()) + if(!MusEGlobal::useJackTransport.value()) { //pos.valid = jack_position_bits_t(0); - //pos.frame = audio->pos().frame(); - //return audio->getState(); + //pos.frame = MusEGlobal::audio->pos().frame(); + //return MusEGlobal::audio->getState(); //if (JACK_DEBUG) // printf("JackAudioDevice::getState dummyState:%d\n", dummyState); return dummyState; @@ -1868,14 +1848,14 @@ bool JackAudioDevice::dummySync(int state) //timespec ts = { 0, (1000000000 * MusEGlobal::segmentSize) / MusEGlobal::sampleRate }; // In nanoseconds. unsigned int sl = (1000000 * MusEGlobal::segmentSize) / MusEGlobal::sampleRate; // In microseconds. - double ct = MusEUtil::curTime(); + double ct = curTime(); // Wait for a default maximum of 5 seconds. // Similar to how Jack is supposed to wait a default of 2 seconds for slow clients. // TODO: Make this timeout a 'settings' option so it can be applied both to Jack and here. - while((MusEUtil::curTime() - ct) < 5.0) + while((curTime() - ct) < 5.0) { // Is MusE audio ready to roll? - if(audio->sync(state, dummyPos)) + if(MusEGlobal::audio->sync(state, dummyPos)) return true; // Not ready. Wait a 'segment', try again... @@ -1900,7 +1880,7 @@ void JackAudioDevice::startTransport() // If we're not using Jack's transport, just pass PLAY and current frame along // as if processSync was called. - if(!useJackTransport.value()) + if(!MusEGlobal::useJackTransport.value()) { //dummyState = Audio::START_PLAY; @@ -1934,7 +1914,7 @@ void JackAudioDevice::stopTransport() dummyState = Audio::STOP; - if(!useJackTransport.value()) + if(!MusEGlobal::useJackTransport.value()) { //dummyState = Audio::STOP; return; @@ -1958,7 +1938,7 @@ void JackAudioDevice::seekTransport(unsigned frame) printf("JackAudioDevice::seekTransport() frame:%d\n", frame); dummyPos = frame; - if(!useJackTransport.value()) + if(!MusEGlobal::useJackTransport.value()) { // If we're not using Jack's transport, just pass the current state and new frame along // as if processSync was called. @@ -1967,7 +1947,7 @@ void JackAudioDevice::seekTransport(unsigned frame) //dummyState = Audio::START_PLAY; // Is MusE audio ready yet? - //audio->sync(dummyState, dummyPos); + //MusEGlobal::audio->sync(dummyState, dummyPos); //if(dummySync(dummyState)) if(dummySync(Audio::START_PLAY)) { @@ -2001,7 +1981,7 @@ void JackAudioDevice::seekTransport(const Pos &p) printf("JackAudioDevice::seekTransport() frame:%d\n", p.frame()); dummyPos = p.frame(); - if(!useJackTransport.value()) + if(!MusEGlobal::useJackTransport.value()) { // If we're not using Jack's transport, just pass the current state and new frame along // as if processSync was called. @@ -2010,7 +1990,7 @@ void JackAudioDevice::seekTransport(const Pos &p) //dummyState = Audio::START_PLAY; // Is MusE audio ready yet? - //audio->sync(dummyState, dummyPos); + //MusEGlobal::audio->sync(dummyState, dummyPos); //if(dummySync(dummyState)) if(dummySync(Audio::START_PLAY)) { @@ -2040,8 +2020,8 @@ void JackAudioDevice::seekTransport(const Pos &p) jp.beats_per_bar = 4; jp.beat_type = 4; jp.ticks_per_beat = 384; - int tempo = tempomap.tempo(p.tick()); - jp.beats_per_minute = (60000000.0 / tempo) * tempomap.globalTempo()/100.0; + int tempo = MusEGlobal::tempomap.tempo(p.tick()); + jp.beats_per_minute = (60000000.0 / tempo) * MusEGlobal::tempomap.globalTempo()/100.0; jack_transport_reposition(_client, &jp); */ @@ -2076,7 +2056,7 @@ int JackAudioDevice::setMaster(bool f) int r = 0; if(f) { - if(useJackTransport.value()) + if(MusEGlobal::useJackTransport.value()) { // Make Muse the Jack timebase master. Do it unconditionally (second param = 0). r = jack_set_timebase_callback(_client, 0, (JackTimebaseCallback) timebase_callback, 0); @@ -2163,7 +2143,7 @@ void JackAudioDevice::scanMidiPorts() free(ports); std::list<MidiDevice*> to_del; - for(iMidiDevice imd = midiDevices.begin(); imd != midiDevices.end(); ++imd) + for(iMidiDevice imd = MusEGlobal::midiDevices.begin(); imd != MusEGlobal::midiDevices.end(); ++imd) { // Only Jack midi devices. if(dynamic_cast<MidiJackDevice*>(*imd) == 0) @@ -2176,7 +2156,7 @@ void JackAudioDevice::scanMidiPorts() { if(MusEGlobal::debugMsg) printf(" removing port device:%s\n", (*imd)->name().toLatin1()); - midiDevices.remove(*imd); + MusEGlobal::midiDevices.remove(*imd); // This will close (and unregister) the client port. delete (*imd); } @@ -2218,7 +2198,7 @@ void JackAudioDevice::scanMidiPorts() QString qname(is->c_str()); // Port already exists? - if(midiDevices.find(qname)) + if(MusEGlobal::midiDevices.find(qname)) continue; int flags = 0; @@ -2240,8 +2220,30 @@ void JackAudioDevice::scanMidiPorts() MidiJackDevice* dev = new MidiJackDevice(0, qname); dev->setrwFlags(flags); - midiDevices.add(dev); + MusEGlobal::midiDevices.add(dev); } */ } + +//--------------------------------------------------------- +// exitJackAudio +//--------------------------------------------------------- + +void exitJackAudio() + { + if (JACK_DEBUG) + printf("exitJackAudio()\n"); + if (jackAudio) + delete jackAudio; + + if (JACK_DEBUG) + printf("exitJackAudio() after delete jackAudio\n"); + + // Added by Tim. p3.3.14 + MusEGlobal::audioDevice = NULL; + + } +} // namespace MusECore + + diff --git a/muse2/muse/driver/jackaudio.h b/muse2/muse/driver/jackaudio.h index d116a2ff..bd78d481 100644 --- a/muse2/muse/driver/jackaudio.h +++ b/muse2/muse/driver/jackaudio.h @@ -26,12 +26,13 @@ #include <jack/jack.h> #include "audiodev.h" -class MidiPlayEvent; - namespace MusEGlobal { bool checkAudioDevice(); } +namespace MusECore { +class MidiPlayEvent; + //--------------------------------------------------------- // JackAudioDevice //--------------------------------------------------------- @@ -111,5 +112,7 @@ class JackAudioDevice : public AudioDevice { //static bool jackStarted; }; +} // namespace MusECore + #endif diff --git a/muse2/muse/driver/jackmidi.cpp b/muse2/muse/driver/jackmidi.cpp index a4577f0b..fa23d336 100644 --- a/muse2/muse/driver/jackmidi.cpp +++ b/muse2/muse/driver/jackmidi.cpp @@ -47,7 +47,11 @@ // Turn on debug messages. //#define JACK_MIDI_DEBUG +namespace MusEGlobal { extern unsigned int volatile lastExtMidiSyncTick; +} + +namespace MusECore { //--------------------------------------------------------- // MidiJackDevice @@ -68,12 +72,12 @@ MidiJackDevice::~MidiJackDevice() printf("MidiJackDevice::~MidiJackDevice()\n"); #endif - if(audioDevice) + if(MusEGlobal::audioDevice) { if(_in_client_jackport) - audioDevice->unregisterPort(_in_client_jackport); + MusEGlobal::audioDevice->unregisterPort(_in_client_jackport); if(_out_client_jackport) - audioDevice->unregisterPort(_out_client_jackport); + MusEGlobal::audioDevice->unregisterPort(_out_client_jackport); } //close(); @@ -92,7 +96,7 @@ MidiDevice* MidiJackDevice::createJackMidiDevice(QString name, int rwflags) // 1 for( ; ni < 65536; ++ni) { name.sprintf("jack-midi-%d", ni); - if(!midiDevices.find(name)) + if(!MusEGlobal::midiDevices.find(name)) break; } } @@ -104,7 +108,7 @@ MidiDevice* MidiJackDevice::createJackMidiDevice(QString name, int rwflags) // 1 MidiJackDevice* dev = new MidiJackDevice(name); dev->setrwFlags(rwflags); - midiDevices.add(dev); + MusEGlobal::midiDevices.add(dev); return dev; } @@ -120,9 +124,9 @@ void MidiJackDevice::setName(const QString& s) _name = s; if(inClientPort()) - audioDevice->setPortName(inClientPort(), (s + QString(JACK_MIDI_IN_PORT_SUFFIX)).toLatin1().constData()); + MusEGlobal::audioDevice->setPortName(inClientPort(), (s + QString(JACK_MIDI_IN_PORT_SUFFIX)).toLatin1().constData()); if(outClientPort()) - audioDevice->setPortName(outClientPort(), (s + QString(JACK_MIDI_OUT_PORT_SUFFIX)).toLatin1().constData()); + MusEGlobal::audioDevice->setPortName(outClientPort(), (s + QString(JACK_MIDI_OUT_PORT_SUFFIX)).toLatin1().constData()); } //--------------------------------------------------------- @@ -142,10 +146,10 @@ QString MidiJackDevice::open() { if(!_out_client_jackport) { - if(audioDevice->deviceType() == AudioDevice::JACK_AUDIO) + if(MusEGlobal::audioDevice->deviceType() == AudioDevice::JACK_AUDIO) { s = name() + QString(JACK_MIDI_OUT_PORT_SUFFIX); - _out_client_jackport = (jack_port_t*)audioDevice->registerOutPort(s.toLatin1().constData(), true); + _out_client_jackport = (jack_port_t*)MusEGlobal::audioDevice->registerOutPort(s.toLatin1().constData(), true); if(!_out_client_jackport) { fprintf(stderr, "MusE: MidiJackDevice::open failed creating output port name %s\n", s.toLatin1().constData()); @@ -178,8 +182,8 @@ QString MidiJackDevice::open() // When I toggle the lights again (which kills, then recreates the ports here), the problem can disappear or come back again. // Also once observed a weird double connection from the port to two different Jack ports but one of // the connections should not have been there and kept toggling along with the other (like a 'ghost' connection). - audio->msgRemoveRoutes(Route(this, 0), Route()); // New function msgRemoveRoutes simply uses Routes, for their pointers. - audioDevice->unregisterPort(_out_client_jackport); + MusEGlobal::audio->msgRemoveRoutes(Route(this, 0), Route()); // New function msgRemoveRoutes simply uses Routes, for their pointers. + MusEGlobal::audioDevice->unregisterPort(_out_client_jackport); } _out_client_jackport = NULL; } @@ -188,10 +192,10 @@ QString MidiJackDevice::open() { if(!_in_client_jackport) { - if(audioDevice->deviceType() == AudioDevice::JACK_AUDIO) + if(MusEGlobal::audioDevice->deviceType() == AudioDevice::JACK_AUDIO) { s = name() + QString(JACK_MIDI_IN_PORT_SUFFIX); - _in_client_jackport = (jack_port_t*)audioDevice->registerInPort(s.toLatin1().constData(), true); + _in_client_jackport = (jack_port_t*)MusEGlobal::audioDevice->registerInPort(s.toLatin1().constData(), true); if(!_in_client_jackport) { fprintf(stderr, "MusE: MidiJackDevice::open failed creating input port name %s\n", s.toLatin1().constData()); @@ -204,8 +208,8 @@ QString MidiJackDevice::open() { if(_in_client_jackport) { - audio->msgRemoveRoutes(Route(), Route(this, 0)); - audioDevice->unregisterPort(_in_client_jackport); + MusEGlobal::audio->msgRemoveRoutes(Route(), Route(this, 0)); + MusEGlobal::audioDevice->unregisterPort(_in_client_jackport); } _in_client_jackport = NULL; } @@ -241,7 +245,7 @@ void MidiJackDevice::close() else if(pf & JackPortIsInput) _nextInIdNum--; - audioDevice->unregisterPort(_client_jackport); + MusEGlobal::audioDevice->unregisterPort(_client_jackport); _client_jackport = 0; _writeEnable = false; _readEnable = false; @@ -327,9 +331,9 @@ bool MidiJackDevice::putMidiEvent(const MidiPlayEvent& /*event*/) void MidiJackDevice::recordEvent(MidiRecordEvent& event) { // Set the loop number which the event came in at. - //if(audio->isRecording()) - if(audio->isPlaying()) - event.setLoopNum(audio->loopCount()); + //if(MusEGlobal::audio->isRecording()) + if(MusEGlobal::audio->isPlaying()) + event.setLoopNum(MusEGlobal::audio->loopCount()); if (MusEGlobal::midiInputTrace) { printf("Jack MidiInput: "); @@ -340,7 +344,7 @@ void MidiJackDevice::recordEvent(MidiRecordEvent& event) if(_port != -1) { - int idin = midiPorts[_port].syncInfo().idIn(); + int idin = MusEGlobal::midiPorts[_port].syncInfo().idIn(); //--------------------------------------------------- // filter some SYSEX events @@ -355,25 +359,25 @@ void MidiJackDevice::recordEvent(MidiRecordEvent& event) && ((p[1] == 0x7f) || (idin == 0x7f) || (p[1] == idin))) { if (p[2] == 0x06) { //mmcInput(p, n); - midiSeq->mmcInput(_port, p, n); + MusEGlobal::midiSeq->mmcInput(_port, p, n); return; } if (p[2] == 0x01) { //mtcInputFull(p, n); - midiSeq->mtcInputFull(_port, p, n); + MusEGlobal::midiSeq->mtcInputFull(_port, p, n); return; } } else if (p[0] == 0x7e) { //nonRealtimeSystemSysex(p, n); - midiSeq->nonRealtimeSystemSysex(_port, p, n); + MusEGlobal::midiSeq->nonRealtimeSystemSysex(_port, p, n); return; } } } else // Trigger general activity indicator detector. Sysex has no channel, don't trigger. - midiPorts[_port].syncInfo().trigActDetect(event.channel()); + MusEGlobal::midiPorts[_port].syncInfo().trigActDetect(event.channel()); } // @@ -398,11 +402,11 @@ void MidiJackDevice::recordEvent(MidiRecordEvent& event) // if (typ == ME_NOTEON) { int pv = ((event.dataA() & 0xff)<<8) + (event.dataB() & 0xff); - song->putEvent(pv); + MusEGlobal::song->putEvent(pv); } else if (typ == ME_NOTEOFF) { int pv = ((event.dataA() & 0xff)<<8) + (0x00); //send an event with velo=0 - song->putEvent(pv); + MusEGlobal::song->putEvent(pv); } //if(_recordFifo.put(MidiPlayEvent(event))) @@ -438,10 +442,10 @@ void MidiJackDevice::eventReceived(jack_midi_event_t* ev) // catch process play // - //int frameOffset = audio->getFrameOffset(); - unsigned pos = audio->pos().frame(); + //int frameOffset = MusEGlobal::audio->getFrameOffset(); + unsigned pos = MusEGlobal::audio->pos().frame(); - event.setTime(extSyncFlag.value() ? lastExtMidiSyncTick : (pos + ev->time)); // p3.3.25 + event.setTime(MusEGlobal::extSyncFlag.value() ? MusEGlobal::lastExtMidiSyncTick : (pos + ev->time)); // p3.3.25 event.setChannel(*(ev->buffer) & 0xf); int type = *(ev->buffer) & 0xf0; @@ -486,11 +490,11 @@ void MidiJackDevice::eventReceived(jack_midi_event_t* ev) break; case ME_MTC_QUARTER: if(_port != -1) - midiSeq->mtcInputQuarter(_port, *(ev->buffer + 1)); + MusEGlobal::midiSeq->mtcInputQuarter(_port, *(ev->buffer + 1)); return; case ME_SONGPOS: if(_port != -1) - midiSeq->setSongPosition(_port, *(ev->buffer + 1) | (*(ev->buffer + 2) >> 2 )); // LSB then MSB + MusEGlobal::midiSeq->setSongPosition(_port, *(ev->buffer + 1) | (*(ev->buffer + 2) >> 2 )); // LSB then MSB return; //case ME_SONGSEL: //case ME_TUNE_REQ: @@ -501,7 +505,7 @@ void MidiJackDevice::eventReceived(jack_midi_event_t* ev) case ME_CONTINUE: case ME_STOP: if(_port != -1) - midiSeq->realtimeSystemInput(_port, type); + MusEGlobal::midiSeq->realtimeSystemInput(_port, type); return; //case ME_SYSEX_END: //break; @@ -609,8 +613,8 @@ bool MidiJackDevice::queueEvent(const MidiPlayEvent& e) void* pb = jack_port_get_buffer(_out_client_jackport, MusEGlobal::segmentSize); //unsigned frameCounter = ->frameTime(); - int frameOffset = audio->getFrameOffset(); - unsigned pos = audio->pos().frame(); + int frameOffset = MusEGlobal::audio->getFrameOffset(); + unsigned pos = MusEGlobal::audio->pos().frame(); int ft = e.time() - frameOffset - pos; if (ft < 0) @@ -715,8 +719,8 @@ bool MidiJackDevice::queueEvent(const MidiPlayEvent& e) bool MidiJackDevice::processEvent(const MidiPlayEvent& event) { - //int frameOffset = audio->getFrameOffset(); - //unsigned pos = audio->pos().frame(); + //int frameOffset = MusEGlobal::audio->getFrameOffset(); + //unsigned pos = MusEGlobal::audio->pos().frame(); int chn = event.channel(); unsigned t = event.time(); @@ -730,11 +734,11 @@ bool MidiJackDevice::processEvent(const MidiPlayEvent& event) // Just do this 'standard midi 64T timing thing' for now until we figure out more precise external timings. // Does require relatively short audio buffers, in order to catch the resolution, but buffer <= 256 should be OK... // Tested OK so far with 128. - //if(extSyncFlag.value()) + //if(MusEGlobal::extSyncFlag.value()) // p4.0.15 Or, is the event marked to be played immediately? // Nothing to do but stamp the event to be queued for frame 0+. - if(t == 0 || extSyncFlag.value()) - t = audio->getFrameOffset() + audio->pos().frame(); + if(t == 0 || MusEGlobal::extSyncFlag.value()) + t = MusEGlobal::audio->getFrameOffset() + MusEGlobal::audio->pos().frame(); //t = frameOffset + pos; #ifdef JACK_MIDI_DEBUG @@ -744,7 +748,7 @@ bool MidiJackDevice::processEvent(const MidiPlayEvent& event) if(event.type() == ME_PROGRAM) { // don't output program changes for GM drum channel - //if (!(song->mtype() == MT_GM && chn == 9)) { + //if (!(MusEGlobal::song->mtype() == MT_GM && chn == 9)) { int hb = (a >> 16) & 0xff; int lb = (a >> 8) & 0xff; int pr = a & 0x7f; @@ -782,7 +786,7 @@ bool MidiJackDevice::processEvent(const MidiPlayEvent& event) int nvl = 0xff; if(_port != -1) { - int nv = midiPorts[_port].nullSendValue(); + int nv = MusEGlobal::midiPorts[_port].nullSendValue(); if(nv != -1) { nvh = (nv >> 8) & 0xff; @@ -800,7 +804,7 @@ bool MidiJackDevice::processEvent(const MidiPlayEvent& event) else if (a == CTRL_PROGRAM) { // don't output program changes for GM drum channel - //if (!(song->mtype() == MT_GM && chn == 9)) { + //if (!(MusEGlobal::song->mtype() == MT_GM && chn == 9)) { int hb = (b >> 16) & 0xff; int lb = (b >> 8) & 0xff; int pr = b & 0x7f; @@ -1016,7 +1020,7 @@ void MidiJackDevice::processMidi() // Same code as in MidiPort::sendEvent() if(_port != -1) { - MidiPort* mp = &midiPorts[_port]; + MidiPort* mp = &MusEGlobal::midiPorts[_port]; if(i->type() == ME_CONTROLLER) { int da = i->dataA(); @@ -1063,3 +1067,4 @@ bool initMidiJack() return false; } +} // namespace MusECore diff --git a/muse2/muse/driver/jackmidi.h b/muse2/muse/driver/jackmidi.h index e79e9288..d2c14190 100644 --- a/muse2/muse/driver/jackmidi.h +++ b/muse2/muse/driver/jackmidi.h @@ -36,9 +36,11 @@ class QString; //class MidiFifo; +//class RouteList; + +namespace MusECore { class MidiRecordEvent; class MidiPlayEvent; -//class RouteList; class Xml; // It appears one client port per remote port will be necessary. @@ -93,6 +95,8 @@ class MidiJackDevice : public MidiDevice { extern bool initMidiJack(); +} // namespace MusECore + #endif diff --git a/muse2/muse/driver/rtctimer.cpp b/muse2/muse/driver/rtctimer.cpp index 8410bb04..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() { @@ -70,7 +71,7 @@ signed int RtcTimer::initTimer() MusEGlobal::undoSetuid(); return timerFd; } - if (!setTimerFreq(MusEConfig::config.rtcTicks)) { + if (!setTimerFreq(MusEGlobal::config.rtcTicks)) { // unable to set timer frequency return -1; } @@ -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/dssihost.cpp b/muse2/muse/dssihost.cpp index ad4b2401..92120dbb 100644 --- a/muse2/muse/dssihost.cpp +++ b/muse2/muse/dssihost.cpp @@ -57,6 +57,8 @@ #include "gconfig.h" #include "popupmenu.h" +namespace MusECore { + //--------------------------------------------------------- // scanDSSILib //--------------------------------------------------------- @@ -106,7 +108,7 @@ static void scanDSSILib(QFileInfo& fi) // ddskrjo removed const for argument // Make sure it doesn't already exist. std::vector<Synth*>::iterator is; - for(is = synthis.begin(); is != synthis.end(); ++is) + for(is = MusEGlobal::synthis.begin(); is != MusEGlobal::synthis.end(); ++is) { Synth* s = *is; //#ifdef DSSI_DEBUG @@ -117,7 +119,7 @@ static void scanDSSILib(QFileInfo& fi) // ddskrjo removed const for argument if(s->name() == label && s->baseName() == fi.completeBaseName()) break; } - if(is != synthis.end()) + if(is != MusEGlobal::synthis.end()) { //delete descr; continue; @@ -144,10 +146,10 @@ static void scanDSSILib(QFileInfo& fi) // ddskrjo removed const for argument if(LADSPA_IS_PORT_OUTPUT(pd) && LADSPA_IS_PORT_CONTROL(pd)) co++; } - fprintf(stderr, "audio ins:%d outs:%d control ins:%d outs:%d\n", ai, ao, ci, co); + fprintf(stderr, "MusEGlobal::audio ins:%d outs:%d control ins:%d outs:%d\n", ai, ao, ci, co); } - synthis.push_back(s); + MusEGlobal::synthis.push_back(s); } //else // delete descr; @@ -267,7 +269,7 @@ DssiSynth::DssiSynth(QFileInfo& fi, const DSSI_Descriptor* d) : // ddskrjo remov // Hack: Special flag required for example for control processing. _isDssiVst = fi.completeBaseName() == QString("dssi-vst"); // Hack: Blacklist vst plugins in-place, configurable for now. - if ((_inports != _outports) || (_isDssiVst && !MusEConfig::config.vstInPlace)) + if ((_inports != _outports) || (_isDssiVst && !MusEGlobal::config.vstInPlace)) _inPlaceCapable = false; } @@ -382,7 +384,7 @@ SynthIF* DssiSynth::createSIF(SynthI* synti) // Hack: Special flag required for example for control processing. _isDssiVst = info.completeBaseName() == QString("dssi-vst"); // Hack: Blacklist vst plugins in-place, configurable for now. - if((_inports != _outports) || (_isDssiVst && !MusEConfig::config.vstInPlace)) + if((_inports != _outports) || (_isDssiVst && !MusEGlobal::config.vstInPlace)) _inPlaceCapable = false; } } @@ -467,9 +469,9 @@ void DssiSynthIF::showGui(bool v) // receiveEvent //--------------------------------------------------------- -MidiPlayEvent DssiSynthIF::receiveEvent() +MusECore::MidiPlayEvent DssiSynthIF::receiveEvent() { - return MidiPlayEvent(); + return MusECore::MidiPlayEvent(); } //--------------------------------------------------------- @@ -581,7 +583,7 @@ bool DssiSynthIF::init(DssiSynth* s) // If CC Controller7 is chosen we must make sure to use only non-common numbers. An already limited range // of 127 now becomes narrower. See the cool document midi-controllers.txt in the DSSI source for a // nice roundup of numbers and how to choose them and how they relate to synths and DSSI synths etc. ! - ctlnum = CTRL_NRPN14_OFFSET + 0x2000 + cip; + ctlnum = MusECore::CTRL_NRPN14_OFFSET + 0x2000 + cip; } else { @@ -606,7 +608,7 @@ bool DssiSynthIF::init(DssiSynth* s) printf("DssiSynthIF::init is NRPN control\n"); #endif - ctlnum = DSSI_NRPN_NUMBER(c) + CTRL_NRPN14_OFFSET; + ctlnum = DSSI_NRPN_NUMBER(c) + MusECore::CTRL_NRPN14_OFFSET; } } @@ -626,7 +628,7 @@ bool DssiSynthIF::init(DssiSynth* s) float min, max; ladspaControlRange(ld, k, &min, &max); CtrlList* cl; - CtrlListList* cll = ((AudioTrack*)synti)->controller(); + CtrlListList* cll = ((MusECore::AudioTrack*)synti)->controller(); iCtrlList icl = cll->find(id); if (icl == cll->end()) { @@ -675,7 +677,7 @@ bool DssiSynthIF::init(DssiSynth* s) if(dssi->configure) { char *rv = dssi->configure(handle, DSSI_PROJECT_DIRECTORY_KEY, - MusEGlobal::museProject.toLatin1().constData()); //song->projectPath() + MusEGlobal::museProject.toLatin1().constData()); //MusEGlobal::song->projectPath() if(rv) { @@ -861,10 +863,10 @@ void DssiSynthIF::setParameter(unsigned long n, float v) // Time-stamp the event. This does a possibly slightly slow call to gettimeofday via timestamp(). // timestamp() is more or less an estimate of the current frame. (This is exactly how ALSA events // are treated when they arrive in our ALSA driver.) - //ce.frame = audio->timestamp(); + //ce.frame = MusEGlobal::audio->timestamp(); // p4.0.23 timestamp() is circular, which is making it impossible to deal with 'modulo' events which // slip in 'under the wire' before processing the ring buffers. So try this linear timestamp instead: - ce.frame = audio->curFrame(); + ce.frame = MusEGlobal::audio->curFrame(); if(_controlFifo.put(ce)) { fprintf(stderr, "DssiSynthIF::setParameter: fifo overflow: in control number:%lu\n", n); @@ -1048,7 +1050,7 @@ void DssiSynthIF::preProcessAlways() // Return true if event pointer filled. //-------------------------------------------------------- -bool DssiSynthIF::processEvent(const MidiPlayEvent& e, snd_seq_event_t* event) +bool DssiSynthIF::processEvent(const MusECore::MidiPlayEvent& e, snd_seq_event_t* event) { const DSSI_Descriptor* dssi = synth->dssi; @@ -1082,9 +1084,9 @@ bool DssiSynthIF::processEvent(const MidiPlayEvent& e, snd_seq_event_t* event) switch(e.type()) { - case ME_NOTEON: + case MusECore::ME_NOTEON: #ifdef DSSI_DEBUG - fprintf(stderr, "DssiSynthIF::processEvent midi event is ME_NOTEON\n"); + fprintf(stderr, "DssiSynthIF::processEvent midi event is MusECore::ME_NOTEON\n"); #endif snd_seq_ev_clear(event); @@ -1094,15 +1096,15 @@ bool DssiSynthIF::processEvent(const MidiPlayEvent& e, snd_seq_event_t* event) else snd_seq_ev_set_noteoff(event, chn, a, 0); break; - case ME_NOTEOFF: + case MusECore::ME_NOTEOFF: snd_seq_ev_clear(event); event->queue = SND_SEQ_QUEUE_DIRECT; snd_seq_ev_set_noteoff(event, chn, a, 0); break; - case ME_PROGRAM: + case MusECore::ME_PROGRAM: { #ifdef DSSI_DEBUG - fprintf(stderr, "DssiSynthIF::processEvent midi event is ME_PROGRAM\n"); + fprintf(stderr, "DssiSynthIF::processEvent midi event is MusECore::ME_PROGRAM\n"); #endif int bank = (a >> 8) & 0xff; @@ -1123,19 +1125,19 @@ bool DssiSynthIF::processEvent(const MidiPlayEvent& e, snd_seq_event_t* event) return false; } break; - case ME_CONTROLLER: + case MusECore::ME_CONTROLLER: { #ifdef DSSI_DEBUG - fprintf(stderr, "DssiSynthIF::processEvent midi event is ME_CONTROLLER\n"); + fprintf(stderr, "DssiSynthIF::processEvent midi event is MusECore::ME_CONTROLLER\n"); #endif if((a == 0) || (a == 32)) return false; - if(a == CTRL_PROGRAM) + if(a == MusECore::CTRL_PROGRAM) { #ifdef DSSI_DEBUG - fprintf(stderr, "DssiSynthIF::processEvent midi event is ME_CONTROLLER, dataA is CTRL_PROGRAM\n"); + fprintf(stderr, "DssiSynthIF::processEvent midi event is MusECore::ME_CONTROLLER, dataA is MusECore::CTRL_PROGRAM\n"); #endif int bank = (b >> 8) & 0xff; @@ -1155,10 +1157,10 @@ bool DssiSynthIF::processEvent(const MidiPlayEvent& e, snd_seq_event_t* event) return false; } - if(a == CTRL_PITCH) + if(a == MusECore::CTRL_PITCH) { #ifdef DSSI_DEBUG - fprintf(stderr, "DssiSynthIF::processEvent midi event is ME_CONTROLLER, dataA is CTRL_PITCH\n"); + fprintf(stderr, "DssiSynthIF::processEvent midi event is MusECore::ME_CONTROLLER, dataA is MusECore::CTRL_PITCH\n"); #endif b &= 0x3fff; @@ -1171,7 +1173,7 @@ bool DssiSynthIF::processEvent(const MidiPlayEvent& e, snd_seq_event_t* event) const LADSPA_Descriptor* ld = dssi->LADSPA_Plugin; - ciMidiCtl2LadspaPort ip = synth->midiCtl2PortMap.find(a); + MusECore::ciMidiCtl2LadspaPort ip = synth->midiCtl2PortMap.find(a); // Is it just a regular midi controller, not mapped to a LADSPA port (either by the plugin or by us)? // NOTE: There's no way to tell which of these controllers is supported by the plugin. // For example sustain footpedal or pitch bend may be supported, but not mapped to any LADSPA port. @@ -1194,7 +1196,7 @@ bool DssiSynthIF::processEvent(const MidiPlayEvent& e, snd_seq_event_t* event) //return true; int ctlnum = a; - if(midiControllerType(a) != MidiController::Controller7) + if(MusECore::midiControllerType(a) != MusECore::MidiController::Controller7) return false; // Event pointer not filled. Return false. else { @@ -1236,7 +1238,7 @@ bool DssiSynthIF::processEvent(const MidiPlayEvent& e, snd_seq_event_t* event) //} // Simple but flawed solution: Start them at 0x60000 + 0x2000 = 0x62000. Max NRPN number is 0x3fff. - ctlnum = k + (CTRL_NRPN14_OFFSET + 0x2000); + ctlnum = k + (MusECore::CTRL_NRPN14_OFFSET + 0x2000); } else { @@ -1262,7 +1264,7 @@ bool DssiSynthIF::processEvent(const MidiPlayEvent& e, snd_seq_event_t* event) else if(DSSI_IS_NRPN(ctlnum)) { - ctlnum = DSSI_NRPN_NUMBER(c) + CTRL_NRPN14_OFFSET; + ctlnum = DSSI_NRPN_NUMBER(c) + MusECore::CTRL_NRPN14_OFFSET; #ifdef DSSI_DEBUG printf("DssiSynthIF::processEvent is NRPN ctlnum:%x(h) %d(d)\n", ctlnum, ctlnum); @@ -1289,20 +1291,20 @@ bool DssiSynthIF::processEvent(const MidiPlayEvent& e, snd_seq_event_t* event) return false; } break; - case ME_PITCHBEND: + case MusECore::ME_PITCHBEND: snd_seq_ev_clear(event); event->queue = SND_SEQ_QUEUE_DIRECT; snd_seq_ev_set_pitchbend(event, chn, a); break; - case ME_AFTERTOUCH: + case MusECore::ME_AFTERTOUCH: snd_seq_ev_clear(event); event->queue = SND_SEQ_QUEUE_DIRECT; snd_seq_ev_set_chanpress(event, chn, a); break; - case ME_SYSEX: + case MusECore::ME_SYSEX: { #ifdef DSSI_DEBUG - fprintf(stderr, "DssiSynthIF::processEvent midi event is ME_SYSEX\n"); + fprintf(stderr, "DssiSynthIF::processEvent midi event is MusECore::ME_SYSEX\n"); #endif const unsigned char* data = e.data(); @@ -1341,7 +1343,7 @@ bool DssiSynthIF::processEvent(const MidiPlayEvent& e, snd_seq_event_t* event) if (QString((const char*)e.data()).startsWith("PARAMSAVE")) { #ifdef DSSI_DEBUG - fprintf(stderr, "DssiSynthIF::processEvent midi event is ME_SYSEX PARAMSAVE\n"); + fprintf(stderr, "DssiSynthIF::processEvent midi event is MusECore::ME_SYSEX PARAMSAVE\n"); #endif unsigned long dlen = e.len() - 9; // Minus "PARAMSAVE" @@ -1392,7 +1394,7 @@ bool DssiSynthIF::processEvent(const MidiPlayEvent& e, snd_seq_event_t* event) //else { // NOTE: There is a limit on the size of a sysex. Got this: - // "DssiSynthIF::processEvent midi event is ME_SYSEX" + // "DssiSynthIF::processEvent midi event is MusECore::ME_SYSEX" // "WARNING: MIDI event of type ? decoded to 367 bytes, discarding" // That might be ALSA doing that. snd_seq_ev_clear(event); @@ -1418,7 +1420,7 @@ bool DssiSynthIF::processEvent(const MidiPlayEvent& e, snd_seq_event_t* event) // getData //--------------------------------------------------------- -iMPEvent DssiSynthIF::getData(MidiPort* /*mp*/, MPEventList* el, iMPEvent i, unsigned pos, int ports, unsigned n, float** buffer) +MusECore::iMPEvent DssiSynthIF::getData(MusECore::MidiPort* /*mp*/, MusECore::MPEventList* el, MusECore::iMPEvent i, unsigned pos, int ports, unsigned n, float** buffer) { //#ifdef DSSI_DEBUG // fprintf(stderr, "DssiSynthIF::getData elsize:%d pos:%d ports:%d samples:%d processed already?:%d\n", el->size(), pos, ports, n, synti->processed()); @@ -1433,8 +1435,8 @@ iMPEvent DssiSynthIF::getData(MidiPort* /*mp*/, MPEventList* el, iMPEvent i, uns // No, do this in processEvent. //memset(events, 0, sizeof(events)); - int frameOffset = audio->getFrameOffset(); - unsigned long syncFrame = audio->curSyncFrame(); + int frameOffset = MusEGlobal::audio->getFrameOffset(); + unsigned long syncFrame = MusEGlobal::audio->curSyncFrame(); // All ports must be connected to something! unsigned long nop, k; @@ -1479,18 +1481,18 @@ iMPEvent DssiSynthIF::getData(MidiPort* /*mp*/, MPEventList* el, iMPEvent i, uns //const bool usefixedrate = true; const bool usefixedrate = synth->_isDssiVst; // Try this. // TODO Make this number a global setting. - // Note for dssi-vst this MUST equal audio period. It doesn't like broken-up runs (it stutters), + // Note for dssi-vst this MUST equal MusEGlobal::audio period. It doesn't like broken-up runs (it stutters), // even with fixed sizes. Could be a Wine + Jack thing, wanting a full Jack buffer's length. //unsigned long fixedsize = 2048; unsigned long fixedsize = n; - // For now, the fixed size is clamped to the audio buffer size. + // For now, the fixed size is clamped to the MusEGlobal::audio buffer size. // TODO: We could later add slower processing over several cycles - - // so that users can select a small audio period but a larger control period. + // so that users can select a small MusEGlobal::audio period but a larger control period. if(fixedsize > n) fixedsize = n; - unsigned long min_per = MusEConfig::config.minControlProcessPeriod; + unsigned long min_per = MusEGlobal::config.minControlProcessPeriod; if(min_per > n) min_per = n; @@ -1520,7 +1522,7 @@ iMPEvent DssiSynthIF::getData(MidiPort* /*mp*/, MPEventList* el, iMPEvent i, uns { //ControlValue v = _controlFifo.get(); ControlEvent v = _controlFifo.peek(); - // The events happened in the last period or even before that. Shift into this period with + n. This will sync with audio. + // The events happened in the last period or even before that. Shift into this period with + n. This will sync with MusEGlobal::audio. // If the events happened even before current frame - n, make sure they are counted immediately as zero-frame. //evframe = (pos + frameOffset > v.frame + n) ? 0 : v.frame - pos - frameOffset + n; evframe = (syncFrame > v.frame + n) ? 0 : v.frame - syncFrame + n; @@ -1608,8 +1610,8 @@ iMPEvent DssiSynthIF::getData(MidiPort* /*mp*/, MPEventList* el, iMPEvent i, uns // Same code as in MidiPort::sendEvent() if(synti->midiPort() != -1) { - MidiPort* mp = &midiPorts[synti->midiPort()]; - if(i->type() == ME_CONTROLLER) + MusECore::MidiPort* mp = &MusEGlobal::midiPorts[synti->midiPort()]; + if(i->type() == MusECore::ME_CONTROLLER) { int da = i->dataA(); int db = i->dataB(); @@ -1618,16 +1620,16 @@ iMPEvent DssiSynthIF::getData(MidiPort* /*mp*/, MPEventList* el, iMPEvent i, uns continue; } else - if(i->type() == ME_PITCHBEND) + if(i->type() == MusECore::ME_PITCHBEND) { - int da = mp->limitValToInstrCtlRange(CTRL_PITCH, i->dataA()); - if(!mp->setHwCtrlState(i->channel(), CTRL_PITCH, da)) + int da = mp->limitValToInstrCtlRange(MusECore::CTRL_PITCH, i->dataA()); + if(!mp->setHwCtrlState(i->channel(), MusECore::CTRL_PITCH, da)) continue; } else - if(i->type() == ME_PROGRAM) + if(i->type() == MusECore::ME_PROGRAM) { - if(!mp->setHwCtrlState(i->channel(), CTRL_PROGRAM, i->dataA())) + if(!mp->setHwCtrlState(i->channel(), MusECore::CTRL_PROGRAM, i->dataA())) continue; } } @@ -1658,8 +1660,8 @@ iMPEvent DssiSynthIF::getData(MidiPort* /*mp*/, MPEventList* el, iMPEvent i, uns // Now process putEvent events... while(!synti->eventFifo.isEmpty()) { - //MidiPlayEvent e = synti->eventFifo.get(); - MidiPlayEvent e = synti->eventFifo.peek(); + //MusECore::MidiPlayEvent e = synti->eventFifo.get(); + MusECore::MidiPlayEvent e = synti->eventFifo.peek(); #ifdef DSSI_DEBUG fprintf(stderr, "DssiSynthIF::getData eventFifo event time:%d\n", e.time()); @@ -1698,10 +1700,10 @@ iMPEvent DssiSynthIF::getData(MidiPort* /*mp*/, MPEventList* el, iMPEvent i, uns // // p3.3.39 Handle inputs... // - //if((song->bounceTrack != this) && !noInRoute()) - if(!((AudioTrack*)synti)->noInRoute()) + //if((MusEGlobal::song->bounceTrack != this) && !noInRoute()) + if(!((MusECore::AudioTrack*)synti)->noInRoute()) { - RouteList* irl = ((AudioTrack*)synti)->inRoutes(); + RouteList* irl = ((MusECore::AudioTrack*)synti)->inRoutes(); iRoute i = irl->begin(); if(!i->track->isMidiTrack()) { @@ -1720,8 +1722,8 @@ iMPEvent DssiSynthIF::getData(MidiPort* /*mp*/, MPEventList* el, iMPEvent i, uns //if(chs == 2) // iUsedIdx[ch + 1] = true; - //((AudioTrack*)i->track)->copyData(framePos, channels, nframe, bp); - ((AudioTrack*)i->track)->copyData(pos, ports, + //((MusECore::AudioTrack*)i->track)->copyData(framePos, channels, nframe, bp); + ((MusECore::AudioTrack*)i->track)->copyData(pos, ports, //(i->track->type() == Track::AUDIO_SOFTSYNTH && i->channel != -1) ? i->channel : 0, i->channel, i->channels, @@ -1739,8 +1741,8 @@ iMPEvent DssiSynthIF::getData(MidiPort* /*mp*/, MPEventList* el, iMPEvent i, uns printf("DssiSynthIF::getData: Error: Route is a midi track route!\n"); continue; } - //((AudioTrack*)i->track)->addData(framePos, channels, nframe, bp); - ((AudioTrack*)i->track)->addData(framePos, channels, + //((MusECore::AudioTrack*)i->track)->addData(framePos, channels, nframe, bp); + ((MusECore::AudioTrack*)i->track)->addData(framePos, channels, //(i->track->type() == Track::AUDIO_SOFTSYNTH && i->channel != -1) ? i->channel : 0, i->channel, i->channels, @@ -1789,7 +1791,7 @@ iMPEvent DssiSynthIF::getData(MidiPort* /*mp*/, MPEventList* el, iMPEvent i, uns //--------------------------------------------------------- //bool DssiSynthIF::putEvent(const MidiEvent& ev) -bool DssiSynthIF::putEvent(const MidiPlayEvent& ev) +bool DssiSynthIF::putEvent(const MusECore::MidiPlayEvent& ev) { #ifdef DSSI_DEBUG fprintf(stderr, "DssiSynthIF::putEvent midi event time:%d chn:%d a:%d b:%d\n", ev.time(), ev.channel(), ev.dataA(), ev.dataB()); @@ -1879,7 +1881,7 @@ void DssiSynthIF::guiHeartBeat() int DssiSynthIF::oscUpdate() { // Send project directory. - _oscif.oscSendConfigure(DSSI_PROJECT_DIRECTORY_KEY, MusEGlobal::museProject.toLatin1().constData()); // song->projectPath() + _oscif.oscSendConfigure(DSSI_PROJECT_DIRECTORY_KEY, MusEGlobal::museProject.toLatin1().constData()); // MusEGlobal::song->projectPath() // Send current string configuration parameters. int i = 0; @@ -1926,18 +1928,18 @@ int DssiSynthIF::oscProgram(unsigned long program, unsigned long bank) bank &= 0xff; program &= 0xff; - //MidiEvent event(0, ch, ME_CONTROLLER, CTRL_PROGRAM, (bank << 8) + program); + //MidiEvent event(0, ch, MusECore::ME_CONTROLLER, MusECore::CTRL_PROGRAM, (bank << 8) + program); if(port != -1) { - //MidiPlayEvent event(0, port, ch, ME_CONTROLLER, CTRL_PROGRAM, (bank << 8) + program); - MidiPlayEvent event(0, port, ch, ME_PROGRAM, (bank << 8) + program, 0); + //MusECore::MidiPlayEvent event(0, port, ch, MusECore::ME_CONTROLLER, MusECore::CTRL_PROGRAM, (bank << 8) + program); + MusECore::MidiPlayEvent event(0, port, ch, MusECore::ME_PROGRAM, (bank << 8) + program, 0); #ifdef DSSI_DEBUG fprintf(stderr, "DssiSynthIF::oscProgram midi event chn:%d a:%d b:%d\n", event.channel(), event.dataA(), event.dataB()); #endif - midiPorts[port].sendEvent(event); + MusEGlobal::midiPorts[port].sendEvent(event); } //synti->playMidiEvent(&event); // TODO @@ -2007,7 +2009,7 @@ int DssiSynthIF::oscControl(unsigned long port, float value) // Time-stamp the event. Looks like no choice but to use the (possibly slow) call to gettimeofday via timestamp(), // because these are asynchronous events arriving from OSC. timestamp() is more or less an estimate of the // current frame. (This is exactly how ALSA events are treated when they arrive in our ALSA driver.) p4.0.15 Tim. - cv.frame = audio->timestamp(); + cv.frame = MusEGlobal::audio->timestamp(); if(cfifo->put(cv)) { fprintf(stderr, "DssiSynthIF::oscControl: fifo overflow: in control number:%lu\n", cport); @@ -2022,16 +2024,16 @@ int DssiSynthIF::oscControl(unsigned long port, float value) // Time-stamp the event. This does a possibly slightly slow call to gettimeofday via timestamp(). // timestamp() is more or less an estimate of the current frame. (This is exactly how ALSA events // are treated when they arrive in our ALSA driver.) - //ce.frame = audio->timestamp(); + //ce.frame = MusEGlobal::audio->timestamp(); // p4.0.23 timestamp() is circular, which is making it impossible to deal with 'modulo' events which // slip in 'under the wire' before processing the ring buffers. So try this linear timestamp instead: - ce.frame = audio->curFrame(); + ce.frame = MusEGlobal::audio->curFrame(); if(_controlFifo.put(ce)) { fprintf(stderr, "DssiSynthIF::oscControl: fifo overflow: in control number:%lu\n", cport); } - ciMidiCtl2LadspaPort ip = synth->port2MidiCtlMap.find(cport); + MusECore::ciMidiCtl2LadspaPort ip = synth->port2MidiCtlMap.find(cport); if(ip != synth->port2MidiCtlMap.end()) { // TODO: TODO: Update midi MusE's midi controller knobs, sliders, boxes etc with a call to the midi port's setHwCtrlState() etc. @@ -2051,8 +2053,8 @@ int DssiSynthIF::oscControl(unsigned long port, float value) int DssiSynthIF::oscMidi(int a, int b, int c) { - if (a == ME_NOTEOFF) { - a = ME_NOTEON; + if (a == MusECore::ME_NOTEOFF) { + a = MusECore::ME_NOTEON; c = 0; } int channel = 0; // TODO: ?? @@ -2060,13 +2062,13 @@ int DssiSynthIF::oscMidi(int a, int b, int c) if(port != -1) { - MidiPlayEvent event(0, port, channel, a, b, c); + MusECore::MidiPlayEvent event(0, port, channel, a, b, c); #ifdef DSSI_DEBUG printf(stderr, "DssiSynthIF::oscMidi midi event chn:%d a:%d b:%d\n", event.channel(), event.dataA(), event.dataB()); #endif - midiPorts[port].sendEvent(event); + MusEGlobal::midiPorts[port].sendEvent(event); } //synti->playMidiEvent(&event); // TODO @@ -2192,7 +2194,7 @@ const char* DssiSynthIF::getPatchName(int /*chan*/, int prog, MType /*type*/, bo // populatePatchPopup //--------------------------------------------------------- -void DssiSynthIF::populatePatchPopup(MusEWidget::PopupMenu* menu, int /*ch*/, MType /*type*/, bool /*drum*/) +void DssiSynthIF::populatePatchPopup(MusEGui::PopupMenu* menu, int /*ch*/, MType /*type*/, bool /*drum*/) { // The plugin can change the programs, patches etc. // So make sure we're up to date by calling queryPrograms. @@ -2247,7 +2249,7 @@ int DssiSynthIF::getControllerInfo(int id, const char** name, int* ctrl, int* mi //} // Simple but flawed solution: Start them at 0x60000 + 0x2000 = 0x62000. Max NRPN number is 0x3fff. - ctlnum = CTRL_NRPN14_OFFSET + 0x2000 + id; + ctlnum = MusECore::CTRL_NRPN14_OFFSET + 0x2000 + id; } else { @@ -2277,15 +2279,15 @@ int DssiSynthIF::getControllerInfo(int id, const char** name, int* ctrl, int* mi printf("DssiSynthIF::getControllerInfo is NRPN control\n"); #endif - ctlnum = DSSI_NRPN_NUMBER(c) + CTRL_NRPN14_OFFSET; + ctlnum = DSSI_NRPN_NUMBER(c) + MusECore::CTRL_NRPN14_OFFSET; } } - int def = CTRL_VAL_UNKNOWN; + int def = MusECore::CTRL_VAL_UNKNOWN; if(ladspa2MidiControlValues(ld, i, ctlnum, min, max, &def)) *initval = def; else - *initval = CTRL_VAL_UNKNOWN; + *initval = MusECore::CTRL_VAL_UNKNOWN; #ifdef DSSI_DEBUG printf("DssiSynthIF::getControllerInfo passed ctlnum:%d min:%d max:%d initval:%d\n", ctlnum, *min, *max, *initval); @@ -2327,7 +2329,7 @@ QString DssiSynthIF::name() const { return synti->nam QString DssiSynthIF::lib() const { return synth ? synth->completeBaseName() : QString(); } QString DssiSynthIF::dirPath() const { return synth ? synth->absolutePath() : QString(); } QString DssiSynthIF::fileName() const { return synth ? synth->fileName() : QString(); } -AudioTrack* DssiSynthIF::track() { return (AudioTrack*)synti; } +MusECore::AudioTrack* DssiSynthIF::track() { return (MusECore::AudioTrack*)synti; } void DssiSynthIF::enableController(unsigned long i, bool v) { controls[i].enCtrl = v; } bool DssiSynthIF::controllerEnabled(unsigned long i) const { return controls[i].enCtrl; } bool DssiSynthIF::controllerEnabled2(unsigned long i) const { return controls[i].en2Ctrl; } @@ -2347,8 +2349,11 @@ LADSPA_PortRangeHint DssiSynthIF::rangeOut(unsigned long i) { return synth->dss CtrlValueType DssiSynthIF::ctrlValueType(unsigned long i) const { return ladspaCtrlValueType(synth->dssi->LADSPA_Plugin, controls[i].idx); } CtrlList::Mode DssiSynthIF::ctrlMode(unsigned long i) const { return ladspaCtrlMode(synth->dssi->LADSPA_Plugin, controls[i].idx); }; +} // namespace MusECore #else //DSSI_SUPPORT +namespace MusECore { void initDSSI() {} +} #endif diff --git a/muse2/muse/dssihost.h b/muse2/muse/dssihost.h index 05e3b91c..9b00b642 100644 --- a/muse2/muse/dssihost.h +++ b/muse2/muse/dssihost.h @@ -55,6 +55,8 @@ #define DSSI_PARAMSAVE_VERSION_MAJOR 0 #define DSSI_PARAMSAVE_VERSION_MINOR 1 + +namespace MusECore { struct _DSSI; class DssiPluginIF; @@ -76,8 +78,8 @@ class DssiSynth : public Synth { std::vector<unsigned long> oIdx; // Audio output index to port number. std::vector<bool> iUsedIdx; // During process, tells whether an audio input port was used by any input routes. std::vector<unsigned long> rpIdx; // Port number to control input index. Item is -1 if it's not a control input. - MidiCtl2LadspaPortMap midiCtl2PortMap; // Maps midi controller numbers to DSSI port numbers. - MidiCtl2LadspaPortMap port2MidiCtlMap; // Maps DSSI port numbers to midi controller numbers. + MusECore::MidiCtl2LadspaPortMap midiCtl2PortMap; // Maps midi controller numbers to DSSI port numbers. + MusECore::MidiCtl2LadspaPortMap port2MidiCtlMap; // Maps DSSI port numbers to midi controller numbers. bool _hasGui; bool _inPlaceCapable; // Hack: Special flag required. @@ -116,7 +118,7 @@ class DssiSynthIF : public SynthIF, public PluginIBase std::vector<DSSI_Program_Descriptor> programs; void queryPrograms(); - bool processEvent(const MidiPlayEvent&, snd_seq_event_t*); + bool processEvent(const MusECore::MidiPlayEvent&, snd_seq_event_t*); float** audioInBuffers; float** audioOutBuffers; @@ -146,9 +148,9 @@ class DssiSynthIF : public SynthIF, public PluginIBase virtual void setNativeGeometry(int, int, int, int) {} virtual void preProcessAlways(); - virtual iMPEvent getData(MidiPort*, MPEventList*, iMPEvent, unsigned pos, int ports, unsigned n, float** buffer); - virtual bool putEvent(const MidiPlayEvent& ev); - virtual MidiPlayEvent receiveEvent(); + virtual MusECore::iMPEvent getData(MusECore::MidiPort*, MusECore::MPEventList*, MusECore::iMPEvent, unsigned pos, int ports, unsigned n, float** buffer); + virtual bool putEvent(const MusECore::MidiPlayEvent& ev); + virtual MusECore::MidiPlayEvent receiveEvent(); virtual int eventsPending() const { return 0; } virtual int channels() const; @@ -159,7 +161,7 @@ class DssiSynthIF : public SynthIF, public PluginIBase virtual const char* getPatchName(int, int, int, bool) const { return ""; } virtual const char* getPatchName(int, int, MType, bool); - virtual void populatePatchPopup(MusEWidget::PopupMenu*, int, MType, bool); + virtual void populatePatchPopup(MusEGui::PopupMenu*, int, MType, bool); virtual void write(int level, Xml& xml) const; @@ -193,7 +195,7 @@ class DssiSynthIF : public SynthIF, public PluginIBase QString lib() const; QString dirPath() const; QString fileName() const; - AudioTrack* track(); + MusECore::AudioTrack* track(); void enableController(unsigned long /*i*/, bool v = true); bool controllerEnabled(unsigned long /*i*/) const; bool controllerEnabled2(unsigned long /*i*/) const; @@ -218,5 +220,7 @@ class DssiSynthIF : public SynthIF, public PluginIBase extern void initDSSI(); +} // namespace MusECore + #endif diff --git a/muse2/muse/evdata.h b/muse2/muse/evdata.h index 821bd9f4..4700e20a 100644 --- a/muse2/muse/evdata.h +++ b/muse2/muse/evdata.h @@ -27,6 +27,8 @@ #include <string.h> // #include <memory.h> +namespace MusECore { + //--------------------------------------------------------- // EvData // variable len event data (sysex, meta etc.) @@ -80,5 +82,7 @@ class EvData { } }; +} // namespace MusECore + #endif diff --git a/muse2/muse/event.cpp b/muse2/muse/event.cpp index fa12860b..2993b286 100644 --- a/muse2/muse/event.cpp +++ b/muse2/muse/event.cpp @@ -27,6 +27,8 @@ #include "waveevent.h" #include "midievent.h" +namespace MusECore { + //--------------------------------------------------------- // Event //--------------------------------------------------------- @@ -88,9 +90,9 @@ Event::Event() Event::Event(EventType t) { if (t == Wave) - ev = new WaveEventBase(t); + ev = new MusECore::WaveEventBase(t); else - ev = new MidiEventBase(t); + ev = new MusECore::MidiEventBase(t); ++(ev->refCount); } Event::Event(const Event& e) { @@ -145,9 +147,9 @@ void Event::setType(EventType t) { ev = 0; } if (t == Wave) - ev = new WaveEventBase(t); + ev = new MusECore::WaveEventBase(t); else - ev = new MidiEventBase(t); + ev = new MusECore::MidiEventBase(t); ++(ev->refCount); } @@ -228,9 +230,9 @@ const QString Event::name() const { return ev->name(); } void Event::setName(const QString& s) { ev->setName(s); } int Event::spos() const { return ev->spos(); } void Event::setSpos(int s) { ev->setSpos(s); } -SndFileR Event::sndFile() const { return ev->sndFile(); } +MusECore::SndFileR Event::sndFile() const { return ev->sndFile(); } -void Event::setSndFile(SndFileR& sf) +void Event::setSndFile(MusECore::SndFileR& sf) { ev->setSndFile(sf); @@ -253,7 +255,7 @@ void Event::setSndFile(SndFileR& sf) #endif } -void Event::readAudio(WavePart* part, unsigned offset, float** bpp, int channels, int nn, bool doSeek, bool overwrite) +void Event::readAudio(MusECore::WavePart* part, unsigned offset, float** bpp, int channels, int nn, bool doSeek, bool overwrite) { ev->readAudio(part, offset, bpp, channels, nn, doSeek, overwrite); } @@ -270,3 +272,4 @@ unsigned Event::endTick() const { return ev->end().tick(); } unsigned Event::endFrame() const { return ev->end().frame(); } void Event::setPos(const Pos& p) { ev->setPos(p); } +} // namespace MusECore diff --git a/muse2/muse/event.h b/muse2/muse/event.h index 94c41e55..01e8e9c2 100644 --- a/muse2/muse/event.h +++ b/muse2/muse/event.h @@ -31,14 +31,17 @@ #include "pos.h" #include "evdata.h" -enum EventType { Note, Controller, Sysex, PAfter, CAfter, Meta, Wave }; - class QString; +namespace MusECore { + class Xml; class EventBase; class WavePart; +enum EventType { Note, Controller, Sysex, PAfter, CAfter, Meta, Wave }; + + //--------------------------------------------------------- // Event //--------------------------------------------------------- @@ -97,10 +100,10 @@ class Event { void setName(const QString& s); int spos() const; void setSpos(int s); - SndFileR sndFile() const; - virtual void setSndFile(SndFileR& sf); + MusECore::SndFileR sndFile() const; + virtual void setSndFile(MusECore::SndFileR& sf); - virtual void readAudio(WavePart* /*part*/, unsigned /*offset*/, float** /*bpp*/, int /*channels*/, int /*nn*/, bool /*doSeek*/, bool /*overwrite*/); + virtual void readAudio(MusECore::WavePart* /*part*/, unsigned /*offset*/, float** /*bpp*/, int /*channels*/, int /*nn*/, bool /*doSeek*/, bool /*overwrite*/); void setTick(unsigned val); unsigned tick() const; @@ -148,5 +151,7 @@ class EventList : public EL { void read(Xml& xml, const char* name, bool midi); }; +} // namespace MusECore + #endif diff --git a/muse2/muse/eventbase.h b/muse2/muse/eventbase.h index c41d1d0e..89d38ec3 100644 --- a/muse2/muse/eventbase.h +++ b/muse2/muse/eventbase.h @@ -31,6 +31,7 @@ #include "event.h" //class AudioConverter; +namespace MusECore { class WavePart; //--------------------------------------------------------- @@ -108,5 +109,8 @@ class EventBase : public PosLen { virtual void readAudio(WavePart* /*part*/, unsigned /*offset*/, float** /*bpp*/, int /*channels*/, int /*nn*/, bool /*doSeek*/, bool /*overwrite*/) { } }; + +} // namespace MusECore + #endif diff --git a/muse2/muse/eventlist.cpp b/muse2/muse/eventlist.cpp index 0615d435..a411fc61 100644 --- a/muse2/muse/eventlist.cpp +++ b/muse2/muse/eventlist.cpp @@ -25,6 +25,8 @@ #include "event.h" #include "xml.h" +namespace MusECore { + //--------------------------------------------------------- // readEventList //--------------------------------------------------------- @@ -90,7 +92,7 @@ void EventList::move(Event& event, unsigned tick) // Added by T356. if(event.type() == Wave) - std::multimap<unsigned, Event, std::less<unsigned> >::insert(std::pair<const unsigned, Event> (tempomap.tick2frame(tick), event)); + std::multimap<unsigned, Event, std::less<unsigned> >::insert(std::pair<const unsigned, Event> (MusEGlobal::tempomap.tick2frame(tick), event)); else std::multimap<unsigned, Event, std::less<unsigned> >::insert(std::pair<const unsigned, Event> (tick, event)); @@ -125,3 +127,4 @@ void EventList::dump() const i->second.dump(); } +} // namespace MusECore diff --git a/muse2/muse/exportmidi.cpp b/muse2/muse/exportmidi.cpp index 450aa992..b892e808 100644 --- a/muse2/muse/exportmidi.cpp +++ b/muse2/muse/exportmidi.cpp @@ -40,6 +40,8 @@ #include "drummap.h" #include "gconfig.h" +namespace MusECore { + //--------------------------------------------------------- // addController //--------------------------------------------------------- @@ -86,7 +88,7 @@ static void addController(MPEventList* l, int tick, int port, int channel, int a int lb = (b >> 8) & 0xff; int pr = b & 0x7f; int tickoffset = 0; - switch(song->mtype()) { + switch(MusEGlobal::song->mtype()) { case MT_GM: // no HBANK/LBANK break; case MT_GS: @@ -128,7 +130,9 @@ static void addController(MPEventList* l, int tick, int port, int channel, int a } } -namespace MusEApp { +} // namespace MusECore + +namespace MusEGui { //--------------------------------------------------------- // exportMidi @@ -136,25 +140,25 @@ namespace MusEApp { void MusE::exportMidi() { - MusEWidget::MFile file(QString("midis"), QString(".mid")); + MusEGui::MFile file(QString("midis"), QString(".mid")); //FILE* fp = file.open("w", midi_file_pattern, this, false, true, FILE* fp = file.open("w", MusEGlobal::midi_file_save_pattern, this, false, true, tr("MusE: Export Midi")); if (fp == 0) return; - MidiFile mf(fp); + MusECore::MidiFile mf(fp); - MidiTrackList* tl = song->midis(); + MusECore::MidiTrackList* tl = MusEGlobal::song->midis(); int ntracks = tl->size(); - MidiFileTrackList* mtl = new MidiFileTrackList; + MusECore::MidiFileTrackList* mtl = new MusECore::MidiFileTrackList; int i = 0; - for (iMidiTrack im = tl->begin(); im != tl->end(); ++im, ++i) { - MidiTrack* track = *im; - MidiFileTrack* mft = new MidiFileTrack; + for (MusECore::iMidiTrack im = tl->begin(); im != tl->end(); ++im, ++i) { + MusECore::MidiTrack* track = *im; + MusECore::MidiFileTrack* mft = new MusECore::MidiFileTrack; mtl->push_back(mft); - MPEventList* l = &(mft->events); + MusECore::MPEventList* l = &(mft->events); int port = track->outPort(); int channel = track->outChannel(); @@ -171,12 +175,12 @@ void MusE::exportMidi() //--------------------------------------------------- // Write Track Marker // - MarkerList* ml = song->marker(); - for (ciMarker m = ml->begin(); m != ml->end(); ++m) { + MusECore::MarkerList* ml = MusEGlobal::song->marker(); + for (MusECore::ciMarker m = ml->begin(); m != ml->end(); ++m) { QByteArray ba = m->second.name().toLatin1(); const char* name = ba.constData(); int len = strlen(name); - MidiPlayEvent ev(m->first, port, ME_META, (unsigned char*)name, len); + MusECore::MidiPlayEvent ev(m->first, port, MusECore::ME_META, (unsigned char*)name, len); ev.setA(0x6); l->add(ev); } @@ -184,11 +188,11 @@ void MusE::exportMidi() //--------------------------------------------------- // Write Copyright // - QByteArray ba = MusEConfig::config.copyright.toLatin1(); + QByteArray ba = MusEGlobal::config.copyright.toLatin1(); const char* copyright = ba.constData(); if (copyright && *copyright) { int len = strlen(copyright); - MidiPlayEvent ev(0, port, ME_META, (unsigned char*)copyright, len); + MusECore::MidiPlayEvent ev(0, port, MusECore::ME_META, (unsigned char*)copyright, len); ev.setA(0x2); l->add(ev); } @@ -199,7 +203,7 @@ void MusE::exportMidi() QString comment = track->comment(); if (!comment.isEmpty()) { int len = comment.length(); - MidiPlayEvent ev(0, port, ME_META, (const unsigned char*)(comment.toLatin1().constData()), len); + MusECore::MidiPlayEvent ev(0, port, MusECore::ME_META, (const unsigned char*)(comment.toLatin1().constData()), len); ev.setA(0x1); l->add(ev); } @@ -208,17 +212,17 @@ void MusE::exportMidi() // Write Songtype SYSEX: GM/GS/XG // - switch(song->mtype()) { + switch(MusEGlobal::song->mtype()) { case MT_GM: - l->add(MidiPlayEvent(0, port, ME_SYSEX, gmOnMsg, gmOnMsgLen)); + l->add(MusECore::MidiPlayEvent(0, port, MusECore::ME_SYSEX, MusECore::gmOnMsg, MusECore::gmOnMsgLen)); break; case MT_GS: - l->add(MidiPlayEvent(0, port, ME_SYSEX, gmOnMsg, gmOnMsgLen)); - l->add(MidiPlayEvent(250, port, ME_SYSEX, gsOnMsg, gsOnMsgLen)); + l->add(MusECore::MidiPlayEvent(0, port, MusECore::ME_SYSEX, MusECore::gmOnMsg, MusECore::gmOnMsgLen)); + l->add(MusECore::MidiPlayEvent(250, port, MusECore::ME_SYSEX, MusECore::gsOnMsg, MusECore::gsOnMsgLen)); break; case MT_XG: - l->add(MidiPlayEvent(0, port, ME_SYSEX, gmOnMsg, gmOnMsgLen)); - l->add(MidiPlayEvent(250, port, ME_SYSEX, xgOnMsg, xgOnMsgLen)); + l->add(MusECore::MidiPlayEvent(0, port, MusECore::ME_SYSEX, MusECore::gmOnMsg, MusECore::gmOnMsgLen)); + l->add(MusECore::MidiPlayEvent(250, port, MusECore::ME_SYSEX, MusECore::xgOnMsg, MusECore::xgOnMsgLen)); break; case MT_UNKNOWN: break; @@ -227,15 +231,15 @@ void MusE::exportMidi() //--------------------------------------------------- // Write Tempomap // - TempoList* tl = &tempomap; - for (ciTEvent e = tl->begin(); e != tl->end(); ++e) { - TEvent* event = e->second; + MusECore::TempoList* tl = &MusEGlobal::tempomap; + for (MusECore::ciTEvent e = tl->begin(); e != tl->end(); ++e) { + MusECore::TEvent* event = e->second; unsigned char data[3]; int tempo = event->tempo; data[2] = tempo & 0xff; data[1] = (tempo >> 8) & 0xff; data[0] = (tempo >> 16) & 0xff; - MidiPlayEvent ev(event->tick, port, ME_META, data, 3); + MusECore::MidiPlayEvent ev(event->tick, port, MusECore::ME_META, data, 3); ev.setA(0x51); l->add(ev); } @@ -249,7 +253,7 @@ void MusE::exportMidi() for (AL::ciSigEvent e = sl->begin(); e != sl->end(); ++e) { ///SigEvent* event = e->second; AL::SigEvent* event = e->second; - int sz = (MusEConfig::config.exp2ByteTimeSigs ? 2 : 4); // export 2 byte timesigs instead of 4 ? + int sz = (MusEGlobal::config.exp2ByteTimeSigs ? 2 : 4); // export 2 byte timesigs instead of 4 ? unsigned char data[sz]; data[0] = event->sig.z; switch(event->sig.n) { @@ -266,13 +270,13 @@ void MusE::exportMidi() } // By T356. In muse the metronome pulse is fixed at 24 (once per quarter-note). // The number of 32nd notes per 24 MIDI clock signals (per quarter-note) is 8. - if(!MusEConfig::config.exp2ByteTimeSigs) + if(!MusEGlobal::config.exp2ByteTimeSigs) { data[2] = 24; data[3] = 8; } - MidiPlayEvent ev(event->tick, port, ME_META, data, sz); + MusECore::MidiPlayEvent ev(event->tick, port, MusECore::ME_META, data, sz); ev.setA(0x58); l->add(ev); @@ -287,7 +291,7 @@ void MusE::exportMidi() QByteArray ba = track->name().toLatin1(); const char* name = ba.constData(); int len = strlen(name); - MidiPlayEvent ev(0, port, ME_META, (unsigned char*)name, len+1); + MusECore::MidiPlayEvent ev(0, port, MusECore::ME_META, (unsigned char*)name, len+1); ev.setA(0x3); // Meta Sequence/Track Name l->add(ev); } @@ -300,34 +304,34 @@ void MusE::exportMidi() QByteArray ba = track->comment().toLatin1(); const char* comment = ba.constData(); int len = strlen(comment); - MidiPlayEvent ev(0, port, ME_META, (unsigned char*)comment, len+1); + MusECore::MidiPlayEvent ev(0, port, MusECore::ME_META, (unsigned char*)comment, len+1); ev.setA(0xf); // Meta Text l->add(ev); } - PartList* parts = track->parts(); - for (iPart p = parts->begin(); p != parts->end(); ++p) { - MidiPart* part = (MidiPart*) (p->second); - EventList* evlist = part->events(); - for (iEvent i = evlist->begin(); i != evlist->end(); ++i) { - Event ev = i->second; + MusECore::PartList* parts = track->parts(); + for (MusECore::iPart p = parts->begin(); p != parts->end(); ++p) { + MusECore::MidiPart* part = (MusECore::MidiPart*) (p->second); + MusECore::EventList* evlist = part->events(); + for (MusECore::iEvent i = evlist->begin(); i != evlist->end(); ++i) { + MusECore::Event ev = i->second; int tick = ev.tick() + part->tick(); switch (ev.type()) { - case Note: + case MusECore::Note: { if (ev.velo() == 0) { printf("Warning: midi note has velocity 0, (ignored)\n"); continue; } int pitch; - if (track->type() == Track::DRUM) { + if (track->type() == MusECore::Track::DRUM) { // // Map drum-notes to the drum-map values // int instr = ev.pitch(); - pitch = drumMap[instr].anote; - // port = drumMap[instr].port; - // channel = drumMap[instr].channel; + pitch = MusEGlobal::drumMap[instr].anote; + // port = MusEGlobal::drumMap[instr].port; + // channel = MusEGlobal::drumMap[instr].channel; } else pitch = ev.pitch(); @@ -359,48 +363,48 @@ void MusE::exportMidi() } if (len <= 0) len = 1; - l->add(MidiPlayEvent(tick, port, channel, ME_NOTEON, pitch, velo)); + l->add(MusECore::MidiPlayEvent(tick, port, channel, MusECore::ME_NOTEON, pitch, velo)); - if(MusEConfig::config.expOptimNoteOffs) // Save space by replacing note offs with note on velocity 0 - l->add(MidiPlayEvent(tick+len, port, channel, ME_NOTEON, pitch, 0)); + if(MusEGlobal::config.expOptimNoteOffs) // Save space by replacing note offs with note on velocity 0 + l->add(MusECore::MidiPlayEvent(tick+len, port, channel, MusECore::ME_NOTEON, pitch, 0)); else - l->add(MidiPlayEvent(tick+len, port, channel, ME_NOTEOFF, pitch, velo)); + l->add(MusECore::MidiPlayEvent(tick+len, port, channel, MusECore::ME_NOTEOFF, pitch, velo)); } break; - case Controller: + case MusECore::Controller: addController(l, tick, port, channel, ev.dataA(), ev.dataB()); break; - case Sysex: - l->add(MidiPlayEvent(tick, port, ME_SYSEX, ev.eventData())); + case MusECore::Sysex: + l->add(MusECore::MidiPlayEvent(tick, port, MusECore::ME_SYSEX, ev.eventData())); break; - case PAfter: - l->add(MidiPlayEvent(tick, port, channel, ME_AFTERTOUCH, ev.dataA(), ev.dataB())); + case MusECore::PAfter: + l->add(MusECore::MidiPlayEvent(tick, port, channel, MusECore::ME_AFTERTOUCH, ev.dataA(), ev.dataB())); break; - case CAfter: - l->add(MidiPlayEvent(tick, port, channel, ME_POLYAFTER, ev.dataA(), ev.dataB())); + case MusECore::CAfter: + l->add(MusECore::MidiPlayEvent(tick, port, channel, MusECore::ME_POLYAFTER, ev.dataA(), ev.dataB())); break; - case Meta: + case MusECore::Meta: { - MidiPlayEvent mpev(tick, port, ME_META, ev.eventData()); + MusECore::MidiPlayEvent mpev(tick, port, MusECore::ME_META, ev.eventData()); mpev.setA(ev.dataA()); l->add(mpev); } break; - case Wave: + case MusECore::Wave: break; } } } } - mf.setDivision(MusEConfig::config.midiDivision); - mf.setMType(song->mtype()); + mf.setDivision(MusEGlobal::config.midiDivision); + mf.setMType(MusEGlobal::song->mtype()); mf.setTrackList(mtl, ntracks); mf.write(); } -} // namespace MusEApp +} // namespace MusEGui 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 <math.h> /* 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/functions.cpp b/muse2/muse/functions.cpp index b6bff169..e0f9690c 100644 --- a/muse2/muse/functions.cpp +++ b/muse2/muse/functions.cpp @@ -60,8 +60,9 @@ using namespace std; -using MusEConfig::config; +using MusEGlobal::config; +namespace MusECore { // unit private functions: @@ -92,7 +93,7 @@ set<Part*> get_all_parts() { set<Part*> result; - TrackList* tracks=song->tracks(); + TrackList* tracks=MusEGlobal::song->tracks(); for (TrackList::const_iterator t_it=tracks->begin(); t_it!=tracks->end(); t_it++) { const PartList* parts=(*t_it)->cparts(); @@ -107,7 +108,7 @@ set<Part*> get_all_selected_parts() { set<Part*> result; - TrackList* tracks=song->tracks(); + TrackList* tracks=MusEGlobal::song->tracks(); for (TrackList::const_iterator t_it=tracks->begin(); t_it!=tracks->end(); t_it++) { const PartList* parts=(*t_it)->cparts(); @@ -129,7 +130,7 @@ bool is_relevant(const Event& event, const Part* part, int range) { case 0: return true; case 1: return event.selected(); - case 2: tick=event.tick()+part->tick(); return (tick >= song->lpos()) && (tick < song->rpos()); + case 2: tick=event.tick()+part->tick(); return (tick >= MusEGlobal::song->lpos()) && (tick < MusEGlobal::song->rpos()); case 3: return is_relevant(event,part,1) && is_relevant(event,part,2); default: cout << "ERROR: ILLEGAL FUNCTION CALL in is_relevant: range is illegal: "<<range<<endl; return false; @@ -154,109 +155,109 @@ map<Event*, Part*> get_events(const set<Part*>& parts, int range) bool modify_notelen(const set<Part*>& parts) { - if (!gatetime_dialog->exec()) + if (!MusEGui::gatetime_dialog->exec()) return false; - modify_notelen(parts,gatetime_dialog->range,gatetime_dialog->rateVal,gatetime_dialog->offsetVal); + modify_notelen(parts,MusEGui::gatetime_dialog->range,MusEGui::gatetime_dialog->rateVal,MusEGui::gatetime_dialog->offsetVal); return true; } bool modify_velocity(const set<Part*>& parts) { - if (!velocity_dialog->exec()) + if (!MusEGui::velocity_dialog->exec()) return false; - modify_velocity(parts,velocity_dialog->range,velocity_dialog->rateVal,velocity_dialog->offsetVal); + modify_velocity(parts,MusEGui::velocity_dialog->range,MusEGui::velocity_dialog->rateVal,MusEGui::velocity_dialog->offsetVal); return true; } bool quantize_notes(const set<Part*>& parts) { - if (!quantize_dialog->exec()) + if (!MusEGui::quantize_dialog->exec()) return false; - quantize_notes(parts, quantize_dialog->range, (MusEConfig::config.division*4)/(1<<quantize_dialog->raster_power2), - quantize_dialog->quant_len, quantize_dialog->strength, quantize_dialog->swing, - quantize_dialog->threshold); + quantize_notes(parts, MusEGui::quantize_dialog->range, (MusEGlobal::config.division*4)/(1<<MusEGui::quantize_dialog->raster_power2), + MusEGui::quantize_dialog->quant_len, MusEGui::quantize_dialog->strength, MusEGui::quantize_dialog->swing, + MusEGui::quantize_dialog->threshold); return true; } bool erase_notes(const set<Part*>& parts) { - if (!erase_dialog->exec()) + if (!MusEGui::erase_dialog->exec()) return false; - erase_notes(parts,erase_dialog->range, erase_dialog->velo_threshold, erase_dialog->velo_thres_used, - erase_dialog->len_threshold, erase_dialog->len_thres_used ); + erase_notes(parts,MusEGui::erase_dialog->range, MusEGui::erase_dialog->velo_threshold, MusEGui::erase_dialog->velo_thres_used, + MusEGui::erase_dialog->len_threshold, MusEGui::erase_dialog->len_thres_used ); return true; } bool delete_overlaps(const set<Part*>& parts) { - if (!del_overlaps_dialog->exec()) + if (!MusEGui::del_overlaps_dialog->exec()) return false; - delete_overlaps(parts,erase_dialog->range); + delete_overlaps(parts,MusEGui::erase_dialog->range); return true; } bool set_notelen(const set<Part*>& parts) { - if (!set_notelen_dialog->exec()) + if (!MusEGui::set_notelen_dialog->exec()) return false; - set_notelen(parts,set_notelen_dialog->range,set_notelen_dialog->len); + set_notelen(parts,MusEGui::set_notelen_dialog->range,MusEGui::set_notelen_dialog->len); return true; } bool move_notes(const set<Part*>& parts) { - if (!move_notes_dialog->exec()) + if (!MusEGui::move_notes_dialog->exec()) return false; - move_notes(parts,move_notes_dialog->range,move_notes_dialog->amount); + move_notes(parts,MusEGui::move_notes_dialog->range,MusEGui::move_notes_dialog->amount); return true; } bool transpose_notes(const set<Part*>& parts) { - if (!transpose_dialog->exec()) + if (!MusEGui::transpose_dialog->exec()) return false; - transpose_notes(parts,transpose_dialog->range,transpose_dialog->amount); + transpose_notes(parts,MusEGui::transpose_dialog->range,MusEGui::transpose_dialog->amount); return true; } bool crescendo(const set<Part*>& parts) { - if (song->rpos() <= song->lpos()) + if (MusEGlobal::song->rpos() <= MusEGlobal::song->lpos()) { QMessageBox::warning(NULL, QObject::tr("Error"), QObject::tr("Please first select the range for crescendo with the loop markers.")); return false; } - if (!crescendo_dialog->exec()) + if (!MusEGui::crescendo_dialog->exec()) return false; - crescendo(parts,crescendo_dialog->range,crescendo_dialog->start_val,crescendo_dialog->end_val,crescendo_dialog->absolute); + crescendo(parts,MusEGui::crescendo_dialog->range,MusEGui::crescendo_dialog->start_val,MusEGui::crescendo_dialog->end_val,MusEGui::crescendo_dialog->absolute); return true; } bool legato(const set<Part*>& parts) { - if (!legato_dialog->exec()) + if (!MusEGui::legato_dialog->exec()) return false; - legato(parts,legato_dialog->range, legato_dialog->min_len, !legato_dialog->allow_shortening); + legato(parts,MusEGui::legato_dialog->range, MusEGui::legato_dialog->min_len, !MusEGui::legato_dialog->allow_shortening); return true; } @@ -265,169 +266,169 @@ bool legato(const set<Part*>& parts) bool modify_notelen() { - if (!gatetime_dialog->exec()) + if (!MusEGui::gatetime_dialog->exec()) return false; set<Part*> parts; - if (gatetime_dialog->range & FUNCTION_RANGE_ONLY_SELECTED) + if (MusEGui::gatetime_dialog->range & FUNCTION_RANGE_ONLY_SELECTED) parts=get_all_selected_parts(); else parts=get_all_parts(); - modify_notelen(parts,gatetime_dialog->range & FUNCTION_RANGE_ONLY_BETWEEN_MARKERS, gatetime_dialog->rateVal,gatetime_dialog->offsetVal); + modify_notelen(parts,MusEGui::gatetime_dialog->range & FUNCTION_RANGE_ONLY_BETWEEN_MARKERS, MusEGui::gatetime_dialog->rateVal,MusEGui::gatetime_dialog->offsetVal); return true; } bool modify_velocity() { - if (!velocity_dialog->exec()) + if (!MusEGui::velocity_dialog->exec()) return false; set<Part*> parts; - if (velocity_dialog->range & FUNCTION_RANGE_ONLY_SELECTED) + if (MusEGui::velocity_dialog->range & FUNCTION_RANGE_ONLY_SELECTED) parts=get_all_selected_parts(); else parts=get_all_parts(); - modify_velocity(parts,velocity_dialog->range & FUNCTION_RANGE_ONLY_BETWEEN_MARKERS,velocity_dialog->rateVal,velocity_dialog->offsetVal); + modify_velocity(parts,MusEGui::velocity_dialog->range & FUNCTION_RANGE_ONLY_BETWEEN_MARKERS,MusEGui::velocity_dialog->rateVal,MusEGui::velocity_dialog->offsetVal); return true; } bool quantize_notes() { - if (!quantize_dialog->exec()) + if (!MusEGui::quantize_dialog->exec()) return false; set<Part*> parts; - if (quantize_dialog->range & FUNCTION_RANGE_ONLY_SELECTED) + if (MusEGui::quantize_dialog->range & FUNCTION_RANGE_ONLY_SELECTED) parts=get_all_selected_parts(); else parts=get_all_parts(); - quantize_notes(parts, quantize_dialog->range & FUNCTION_RANGE_ONLY_BETWEEN_MARKERS, (config.division*4)/(1<<quantize_dialog->raster_power2), - quantize_dialog->quant_len, quantize_dialog->strength, quantize_dialog->swing, - quantize_dialog->threshold); + quantize_notes(parts, MusEGui::quantize_dialog->range & FUNCTION_RANGE_ONLY_BETWEEN_MARKERS, (config.division*4)/(1<<MusEGui::quantize_dialog->raster_power2), + MusEGui::quantize_dialog->quant_len, MusEGui::quantize_dialog->strength, MusEGui::quantize_dialog->swing, + MusEGui::quantize_dialog->threshold); return true; } bool erase_notes() { - if (!erase_dialog->exec()) + if (!MusEGui::erase_dialog->exec()) return false; set<Part*> parts; - if (erase_dialog->range & FUNCTION_RANGE_ONLY_SELECTED) + if (MusEGui::erase_dialog->range & FUNCTION_RANGE_ONLY_SELECTED) parts=get_all_selected_parts(); else parts=get_all_parts(); - erase_notes(parts,erase_dialog->range & FUNCTION_RANGE_ONLY_BETWEEN_MARKERS, erase_dialog->velo_threshold, erase_dialog->velo_thres_used, - erase_dialog->len_threshold, erase_dialog->len_thres_used ); + erase_notes(parts,MusEGui::erase_dialog->range & FUNCTION_RANGE_ONLY_BETWEEN_MARKERS, MusEGui::erase_dialog->velo_threshold, MusEGui::erase_dialog->velo_thres_used, + MusEGui::erase_dialog->len_threshold, MusEGui::erase_dialog->len_thres_used ); return true; } bool delete_overlaps() { - if (!del_overlaps_dialog->exec()) + if (!MusEGui::del_overlaps_dialog->exec()) return false; set<Part*> parts; - if (del_overlaps_dialog->range & FUNCTION_RANGE_ONLY_SELECTED) + if (MusEGui::del_overlaps_dialog->range & FUNCTION_RANGE_ONLY_SELECTED) parts=get_all_selected_parts(); else parts=get_all_parts(); - delete_overlaps(parts,erase_dialog->range & FUNCTION_RANGE_ONLY_BETWEEN_MARKERS); + delete_overlaps(parts,MusEGui::erase_dialog->range & FUNCTION_RANGE_ONLY_BETWEEN_MARKERS); return true; } bool set_notelen() { - if (!set_notelen_dialog->exec()) + if (!MusEGui::set_notelen_dialog->exec()) return false; set<Part*> parts; - if (set_notelen_dialog->range & FUNCTION_RANGE_ONLY_SELECTED) + if (MusEGui::set_notelen_dialog->range & FUNCTION_RANGE_ONLY_SELECTED) parts=get_all_selected_parts(); else parts=get_all_parts(); - set_notelen(parts,set_notelen_dialog->range & FUNCTION_RANGE_ONLY_BETWEEN_MARKERS, set_notelen_dialog->len); + set_notelen(parts,MusEGui::set_notelen_dialog->range & FUNCTION_RANGE_ONLY_BETWEEN_MARKERS, MusEGui::set_notelen_dialog->len); return true; } bool move_notes() { - if (!move_notes_dialog->exec()) + if (!MusEGui::move_notes_dialog->exec()) return false; set<Part*> parts; - if (move_notes_dialog->range & FUNCTION_RANGE_ONLY_SELECTED) + if (MusEGui::move_notes_dialog->range & FUNCTION_RANGE_ONLY_SELECTED) parts=get_all_selected_parts(); else parts=get_all_parts(); - move_notes(parts,move_notes_dialog->range & FUNCTION_RANGE_ONLY_BETWEEN_MARKERS, move_notes_dialog->amount); + move_notes(parts,MusEGui::move_notes_dialog->range & FUNCTION_RANGE_ONLY_BETWEEN_MARKERS, MusEGui::move_notes_dialog->amount); return true; } bool transpose_notes() { - if (!transpose_dialog->exec()) + if (!MusEGui::transpose_dialog->exec()) return false; set<Part*> parts; - if (transpose_dialog->range & FUNCTION_RANGE_ONLY_SELECTED) + if (MusEGui::transpose_dialog->range & FUNCTION_RANGE_ONLY_SELECTED) parts=get_all_selected_parts(); else parts=get_all_parts(); - transpose_notes(parts,transpose_dialog->range & FUNCTION_RANGE_ONLY_BETWEEN_MARKERS, transpose_dialog->amount); + transpose_notes(parts,MusEGui::transpose_dialog->range & FUNCTION_RANGE_ONLY_BETWEEN_MARKERS, MusEGui::transpose_dialog->amount); return true; } bool crescendo() { - if (song->rpos() <= song->lpos()) + if (MusEGlobal::song->rpos() <= MusEGlobal::song->lpos()) { QMessageBox::warning(NULL, QObject::tr("Error"), QObject::tr("Please first select the range for crescendo with the loop markers.")); return false; } - if (!crescendo_dialog->exec()) + if (!MusEGui::crescendo_dialog->exec()) return false; set<Part*> parts; - if (crescendo_dialog->range & FUNCTION_RANGE_ONLY_SELECTED) + if (MusEGui::crescendo_dialog->range & FUNCTION_RANGE_ONLY_SELECTED) parts=get_all_selected_parts(); else parts=get_all_parts(); - crescendo(parts,crescendo_dialog->range & FUNCTION_RANGE_ONLY_BETWEEN_MARKERS, crescendo_dialog->start_val,crescendo_dialog->end_val,crescendo_dialog->absolute); + crescendo(parts,MusEGui::crescendo_dialog->range & FUNCTION_RANGE_ONLY_BETWEEN_MARKERS, MusEGui::crescendo_dialog->start_val,MusEGui::crescendo_dialog->end_val,MusEGui::crescendo_dialog->absolute); return true; } bool legato() { - if (!legato_dialog->exec()) + if (!MusEGui::legato_dialog->exec()) return false; set<Part*> parts; - if (legato_dialog->range & FUNCTION_RANGE_ONLY_SELECTED) + if (MusEGui::legato_dialog->range & FUNCTION_RANGE_ONLY_SELECTED) parts=get_all_selected_parts(); else parts=get_all_parts(); - legato(parts,legato_dialog->range & FUNCTION_RANGE_ONLY_BETWEEN_MARKERS, legato_dialog->min_len, !legato_dialog->allow_shortening); + legato(parts,MusEGui::legato_dialog->range & FUNCTION_RANGE_ONLY_BETWEEN_MARKERS, MusEGui::legato_dialog->min_len, !MusEGui::legato_dialog->allow_shortening); return true; } @@ -467,7 +468,7 @@ bool modify_velocity(const set<Part*>& parts, int range, int rate, int offset) } } - return song->applyOperationGroup(operations); + return MusEGlobal::song->applyOperationGroup(operations); } else return false; @@ -503,7 +504,7 @@ bool modify_off_velocity(const set<Part*>& parts, int range, int rate, int offse } } - return song->applyOperationGroup(operations); + return MusEGlobal::song->applyOperationGroup(operations); } else return false; @@ -544,7 +545,7 @@ bool modify_notelen(const set<Part*>& parts, int range, int rate, int offset) for (map<Part*, int>::iterator it=partlen.begin(); it!=partlen.end(); it++) schedule_resize_all_same_len_clone_parts(it->first, it->second, operations); - return song->applyOperationGroup(operations); + return MusEGlobal::song->applyOperationGroup(operations); } else return false; @@ -617,7 +618,7 @@ bool quantize_notes(const set<Part*>& parts, int range, int raster, bool quant_l } } - return song->applyOperationGroup(operations); + return MusEGlobal::song->applyOperationGroup(operations); } else return false; @@ -641,7 +642,7 @@ bool erase_notes(const set<Part*>& parts, int range, int velo_threshold, bool ve operations.push_back(UndoOp(UndoOp::DeleteEvent, event, part, false, false)); } - return song->applyOperationGroup(operations); + return MusEGlobal::song->applyOperationGroup(operations); } else return false; @@ -667,7 +668,7 @@ bool transpose_notes(const set<Part*>& parts, int range, signed int halftonestep operations.push_back(UndoOp(UndoOp::ModifyEvent, newEvent, event, part, false, false)); } - return song->applyOperationGroup(operations); + return MusEGlobal::song->applyOperationGroup(operations); } else return false; @@ -678,8 +679,8 @@ bool crescendo(const set<Part*>& parts, int range, int start_val, int end_val, b map<Event*, Part*> events = get_events(parts, range); Undo operations; - int from=song->lpos(); - int to=song->rpos(); + int from=MusEGlobal::song->lpos(); + int to=MusEGlobal::song->rpos(); if ( (!events.empty()) && (to>from) ) { @@ -705,7 +706,7 @@ bool crescendo(const set<Part*>& parts, int range, int start_val, int end_val, b operations.push_back(UndoOp(UndoOp::ModifyEvent, newEvent, event, part, false, false)); } - return song->applyOperationGroup(operations); + return MusEGlobal::song->applyOperationGroup(operations); } else return false; @@ -753,7 +754,7 @@ bool move_notes(const set<Part*>& parts, int range, signed int ticks) for (map<Part*, int>::iterator it=partlen.begin(); it!=partlen.end(); it++) schedule_resize_all_same_len_clone_parts(it->first, it->second, operations); - return song->applyOperationGroup(operations); + return MusEGlobal::song->applyOperationGroup(operations); } else return false; @@ -809,7 +810,7 @@ bool delete_overlaps(const set<Part*>& parts, int range) } } - return song->applyOperationGroup(operations); + return MusEGlobal::song->applyOperationGroup(operations); } else return false; @@ -859,7 +860,7 @@ bool legato(const set<Part*>& parts, int range, int min_len, bool dont_shorten) } } - return song->applyOperationGroup(operations); + return MusEGlobal::song->applyOperationGroup(operations); } else return false; @@ -926,17 +927,17 @@ unsigned get_clipboard_len() bool paste_notes(Part* paste_into_part) { - unsigned temp_begin = AL::sigmap.raster1(song->cpos(),0); + unsigned temp_begin = AL::sigmap.raster1(MusEGlobal::song->cpos(),0); unsigned temp_end = AL::sigmap.raster2(temp_begin + get_clipboard_len(), 0); - paste_events_dialog->raster = temp_end - temp_begin; - paste_events_dialog->into_single_part_allowed = (paste_into_part!=NULL); + MusEGui::paste_events_dialog->raster = temp_end - temp_begin; + MusEGui::paste_events_dialog->into_single_part_allowed = (paste_into_part!=NULL); - if (!paste_events_dialog->exec()) + if (!MusEGui::paste_events_dialog->exec()) return false; - paste_notes(paste_events_dialog->max_distance, paste_events_dialog->always_new_part, - paste_events_dialog->never_new_part, paste_events_dialog->into_single_part ? paste_into_part : NULL, - paste_events_dialog->number, paste_events_dialog->raster); + paste_notes(MusEGui::paste_events_dialog->max_distance, MusEGui::paste_events_dialog->always_new_part, + MusEGui::paste_events_dialog->never_new_part, MusEGui::paste_events_dialog->into_single_part ? paste_into_part : NULL, + MusEGui::paste_events_dialog->number, MusEGui::paste_events_dialog->raster); return true; } @@ -945,7 +946,7 @@ void paste_notes(int max_distance, bool always_new_part, bool never_new_part, Pa { QString tmp="x-muse-groupedeventlists"; // QClipboard::text() expects a QString&, not a QString :( QString s = QApplication::clipboard()->text(tmp, QClipboard::Clipboard); // TODO CHECK Tim. - paste_at(s, song->cpos(), max_distance, always_new_part, never_new_part, paste_into_part, amount, raster); + paste_at(s, MusEGlobal::song->cpos(), max_distance, always_new_part, never_new_part, paste_into_part, amount, raster); } @@ -1088,7 +1089,7 @@ void paste_at(const QString& pt, int pos, int max_distance, bool always_new_part Part* old_dest_part; if (paste_into_part == NULL) - dest_part = MusEUtil::partFromSerialNumber(part_id); + dest_part = partFromSerialNumber(part_id); else dest_part=paste_into_part; @@ -1113,7 +1114,7 @@ void paste_at(const QString& pt, int pos, int max_distance, bool always_new_part if (create_new_part) { dest_part = dest_track->newPart(); - dest_part->events()->incARef(-1); // the later song->applyOperationGroup() will increment it + dest_part->events()->incARef(-1); // the later MusEGlobal::song->applyOperationGroup() will increment it // so we must decrement it first :/ dest_part->setTick(AL::sigmap.raster1(first_paste_tick, config.division)); @@ -1177,10 +1178,10 @@ void paste_at(const QString& pt, int pos, int max_distance, bool always_new_part if (it->second != it->first->lenTick()) schedule_resize_all_same_len_clone_parts(it->first, it->second, operations); - song->informAboutNewParts(new_part_map); // must be called before apply. otherwise + MusEGlobal::song->informAboutNewParts(new_part_map); // must be called before apply. otherwise // pointer changes (by resize) screw it up - song->applyOperationGroup(operations); - song->update(SC_SELECTION); + MusEGlobal::song->applyOperationGroup(operations); + MusEGlobal::song->update(SC_SELECTION); } void select_all(const std::set<Part*>& parts) @@ -1191,7 +1192,7 @@ void select_all(const std::set<Part*>& parts) Event& event=ev_it->second; event.setSelected(true); } - song->update(SC_SELECTION); + MusEGlobal::song->update(SC_SELECTION); } void select_none(const std::set<Part*>& parts) @@ -1202,7 +1203,7 @@ void select_none(const std::set<Part*>& parts) Event& event=ev_it->second; event.setSelected(false); } - song->update(SC_SELECTION); + MusEGlobal::song->update(SC_SELECTION); } void select_invert(const std::set<Part*>& parts) @@ -1213,7 +1214,7 @@ void select_invert(const std::set<Part*>& parts) Event& event=ev_it->second; event.setSelected(!event.selected()); } - song->update(SC_SELECTION); + MusEGlobal::song->update(SC_SELECTION); } void select_in_loop(const std::set<Part*>& parts) @@ -1223,9 +1224,9 @@ void select_in_loop(const std::set<Part*>& parts) for (iEvent ev_it=(*part)->events()->begin(); ev_it!=(*part)->events()->end(); ev_it++) { Event& event=ev_it->second; - event.setSelected((event.tick()>=song->lpos() && event.endTick()<=song->rpos())); + event.setSelected((event.tick()>=MusEGlobal::song->lpos() && event.endTick()<=MusEGlobal::song->rpos())); } - song->update(SC_SELECTION); + MusEGlobal::song->update(SC_SELECTION); } void select_not_in_loop(const std::set<Part*>& parts) @@ -1235,9 +1236,9 @@ void select_not_in_loop(const std::set<Part*>& parts) for (iEvent ev_it=(*part)->events()->begin(); ev_it!=(*part)->events()->end(); ev_it++) { Event& event=ev_it->second; - event.setSelected(!(event.tick()>=song->lpos() && event.endTick()<=song->rpos())); + event.setSelected(!(event.tick()>=MusEGlobal::song->lpos() && event.endTick()<=MusEGlobal::song->rpos())); } - song->update(SC_SELECTION); + MusEGlobal::song->update(SC_SELECTION); } @@ -1246,10 +1247,10 @@ void shrink_parts(int raster) Undo operations; unsigned min_len; - if (raster<0) raster=MusEConfig::config.division; - if (raster>=0) min_len=raster; else min_len=MusEConfig::config.division; + if (raster<0) raster=MusEGlobal::config.division; + if (raster>=0) min_len=raster; else min_len=MusEGlobal::config.division; - TrackList* tracks = song->tracks(); + TrackList* tracks = MusEGlobal::song->tracks(); for (iTrack track = tracks->begin(); track != tracks->end(); track++) for (iPart part = (*track)->parts()->begin(); part != (*track)->parts()->end(); part++) if (part->second->selected()) @@ -1272,7 +1273,7 @@ void shrink_parts(int raster) } } - song->applyOperationGroup(operations); + MusEGlobal::song->applyOperationGroup(operations); } void internal_schedule_expand_part(Part* part, int raster, Undo& operations) @@ -1319,10 +1320,10 @@ void expand_parts(int raster) Undo operations; unsigned min_len; - if (raster<0) raster=MusEConfig::config.division; - if (raster>=0) min_len=raster; else min_len=MusEConfig::config.division; + if (raster<0) raster=MusEGlobal::config.division; + if (raster>=0) min_len=raster; else min_len=MusEGlobal::config.division; - TrackList* tracks = song->tracks(); + TrackList* tracks = MusEGlobal::song->tracks(); for (iTrack track = tracks->begin(); track != tracks->end(); track++) for (iPart part = (*track)->parts()->begin(); part != (*track)->parts()->end(); part++) if (part->second->selected()) @@ -1345,7 +1346,7 @@ void expand_parts(int raster) } } - song->applyOperationGroup(operations); + MusEGlobal::song->applyOperationGroup(operations); } void clean_parts() @@ -1353,7 +1354,7 @@ void clean_parts() Undo operations; set<Part*> already_processed; - TrackList* tracks = song->tracks(); + TrackList* tracks = MusEGlobal::song->tracks(); for (iTrack track = tracks->begin(); track != tracks->end(); track++) for (iPart part = (*track)->parts()->begin(); part != (*track)->parts()->end(); part++) if ((part->second->selected()) && (already_processed.find(part->second)==already_processed.end())) @@ -1389,6 +1390,7 @@ void clean_parts() } } - song->applyOperationGroup(operations); + MusEGlobal::song->applyOperationGroup(operations); } +} // namespace MusECore diff --git a/muse2/muse/functions.h b/muse2/muse/functions.h index 77777f04..2cf9c245 100644 --- a/muse2/muse/functions.h +++ b/muse2/muse/functions.h @@ -30,14 +30,15 @@ class QString; class QMimeData; -class Undo; - #define FUNCTION_RANGE_ONLY_SELECTED 1 #define FUNCTION_RANGE_ONLY_BETWEEN_MARKERS 2 +namespace MusECore { +class Undo; + std::set<Part*> partlist_to_set(PartList* pl); std::set<Part*> part_to_set(Part* p); std::map<Event*, Part*> get_events(const std::set<Part*>& parts, int range); @@ -102,4 +103,6 @@ void expand_parts(int raster=-1); void schedule_resize_all_same_len_clone_parts(Part* part, unsigned new_len, Undo& operations); void clean_parts(); +} // namespace MusECore + #endif diff --git a/muse2/muse/gconfig.cpp b/muse2/muse/gconfig.cpp index f8334b1e..65397fe4 100644 --- a/muse2/muse/gconfig.cpp +++ b/muse2/muse/gconfig.cpp @@ -23,9 +23,9 @@ #include "gconfig.h" -namespace MusEConfig { +namespace MusEGlobal { -GlobalConfigValues config = { +MusEGui::GlobalConfigValues config = { 190, // globalAlphaBlend { QColor(0xff, 0xff, 0xff), // palette @@ -192,4 +192,4 @@ GlobalConfigValues config = { false // rangeMarkerWithoutMMB }; -} // namespace MusEConfig +} // namespace MusEGlobal diff --git a/muse2/muse/gconfig.h b/muse2/muse/gconfig.h index 0d173b26..a6b55557 100644 --- a/muse2/muse/gconfig.h +++ b/muse2/muse/gconfig.h @@ -32,9 +32,11 @@ #include <QRect> #include <QString> +namespace MusECore { class Xml; +} -namespace MusEConfig { +namespace MusEGui { //--------------------------------------------------------- // MixerConfig @@ -53,12 +55,12 @@ struct MixerConfig { bool showAuxTracks; bool showSyntiTracks; - //void write(Xml&, const char* name); - //void write(int level, Xml& xml, const char* name); - void write(int level, Xml& xml); + //void write(MusECore::Xml&, const char* name); + //void write(int level, MusECore::Xml& xml, const char* name); + void write(int level, MusECore::Xml& xml); //void read(QDomNode); - //void read(Xml& xml, const QString& name); - void read(Xml& xml); + //void read(MusECore::Xml& xml, const QString& name); + void read(MusECore::Xml& xml); }; //--------------------------------------------------------- @@ -167,8 +169,11 @@ struct GlobalConfigValues { bool rangeMarkerWithoutMMB; }; -extern GlobalConfigValues config; -} // namespace MusEConfig +} // namespace MusEGui + +namespace MusEGlobal { +extern MusEGui::GlobalConfigValues config; +} // namespace MusEGlobal #endif diff --git a/muse2/muse/globals.cpp b/muse2/muse/globals.cpp index bbcf0434..fad6472e 100644 --- a/muse2/muse/globals.cpp +++ b/muse2/muse/globals.cpp @@ -340,7 +340,7 @@ QAction* recordAction; QAction* panicAction; //AudioMixerApp* audioMixer; -MusEApp::MusE* muse = 0; +MusEGui::MusE* muse = 0; int preMeasures = 2; unsigned char measureClickNote = 63; diff --git a/muse2/muse/globals.h b/muse2/muse/globals.h index 33c32c20..c0a3395a 100644 --- a/muse2/muse/globals.h +++ b/muse2/muse/globals.h @@ -37,7 +37,7 @@ class QActionGroup; class QStringList; class QTimer; -namespace MusEApp { +namespace MusEGui { class MusE; } @@ -162,7 +162,7 @@ extern QAction* panicAction; //class AudioMixerApp; //extern AudioMixerApp* audioMixer; -extern MusEApp::MusE* muse; +extern MusEGui::MusE* muse; extern int preMeasures; extern unsigned char measureClickNote; diff --git a/muse2/muse/help.cpp b/muse2/muse/help.cpp index ae805a60..c7ae1ff7 100644 --- a/muse2/muse/help.cpp +++ b/muse2/muse/help.cpp @@ -34,7 +34,7 @@ #include "icons.h" #include "aboutbox_impl.h" -namespace MusEApp { +namespace MusEGui { //--------------------------------------------------------- // startHelpBrowser @@ -84,7 +84,7 @@ void MusE::startBugBrowser() void MusE::about() { - MusEWidget::AboutBoxImpl ab; + MusEGui::AboutBoxImpl ab; ab.show(); ab.exec(); } @@ -110,4 +110,4 @@ void MusE::launchBrowser(QString &whereTo) } } -} // namespace MusEApp +} // namespace MusEGui diff --git a/muse2/muse/helper.cpp b/muse2/muse/helper.cpp index 2c128ef3..e3cdee7e 100644 --- a/muse2/muse/helper.cpp +++ b/muse2/muse/helper.cpp @@ -43,7 +43,7 @@ namespace MusEGlobal { extern bool hIsB; } -namespace MusEUtil { +namespace MusECore { static const char* vall[] = { "c","c#","d","d#","e","f","f#","g","g#","a","a#","h" @@ -79,7 +79,7 @@ QString pitch2string(int v) Part* partFromSerialNumber(int serial) { - TrackList* tl = song->tracks(); + TrackList* tl = MusEGlobal::song->tracks(); for (iTrack it = tl->begin(); it != tl->end(); ++it) { PartList* pl = (*it)->parts(); @@ -93,6 +93,27 @@ Part* partFromSerialNumber(int serial) return NULL; } +bool any_event_selected(const set<Part*>& parts, bool in_range) +{ + return !get_events(parts, in_range ? 3 : 1).empty(); +} + +bool drummaps_almost_equal(DrumMap* one, DrumMap* two, int len) +{ + for (int i=0; i<len; i++) + { + DrumMap tmp = one[i]; + tmp.mute=two[i].mute; + if (tmp!=two[i]) + return false; + } + return true; +} + + +} // namespace MusECore + +namespace MusEGui { //--------------------------------------------------------- // populateAddSynth @@ -108,18 +129,18 @@ QMenu* populateAddSynth(QWidget* parent) //typedef std::multimap<std::string, int, addSynth_cmp_str >::iterator imap; typedef std::multimap<std::string, int >::iterator imap; - MessSynth* synMESS = 0; + MusECore::MessSynth* synMESS = 0; QMenu* synpMESS = 0; asmap mapMESS; #ifdef DSSI_SUPPORT - DssiSynth* synDSSI = 0; + MusECore::DssiSynth* synDSSI = 0; QMenu* synpDSSI = 0; asmap mapDSSI; #endif #ifdef VST_SUPPORT - VstSynth* synVST = 0; + MusECore::VstSynth* synVST = 0; QMenu* synpVST = 0; asmap mapVST; #endif @@ -130,9 +151,9 @@ QMenu* populateAddSynth(QWidget* parent) //const int synth_base_id = 0x1000; int ii = 0; - for(std::vector<Synth*>::iterator i = synthis.begin(); i != synthis.end(); ++i) + for(std::vector<MusECore::Synth*>::iterator i = MusEGlobal::synthis.begin(); i != MusEGlobal::synthis.end(); ++i) { - synMESS = dynamic_cast<MessSynth*>(*i); + synMESS = dynamic_cast<MusECore::MessSynth*>(*i); if(synMESS) { mapMESS.insert( std::pair<std::string, int> (std::string(synMESS->description().toLower().toLatin1().constData()), ii) ); @@ -141,7 +162,7 @@ QMenu* populateAddSynth(QWidget* parent) { #ifdef DSSI_SUPPORT - synDSSI = dynamic_cast<DssiSynth*>(*i); + synDSSI = dynamic_cast<MusECore::DssiSynth*>(*i); if(synDSSI) { mapDSSI.insert( std::pair<std::string, int> (std::string(synDSSI->description().toLower().toLatin1().constData()), ii) ); @@ -151,7 +172,7 @@ QMenu* populateAddSynth(QWidget* parent) { #ifdef VST_SUPPORT - synVST = dynamic_cast<VstSynth*>(*i); + synVST = dynamic_cast<MusECore::VstSynth*>(*i); if(synVST) { mapVST.insert( std::pair<std::string, int> (std::string(synVST->description().toLower().toLatin1().constData()), ii) ); @@ -168,13 +189,13 @@ QMenu* populateAddSynth(QWidget* parent) ++ii; } - int sz = synthis.size(); + int sz = MusEGlobal::synthis.size(); for(imap i = mapMESS.begin(); i != mapMESS.end(); ++i) { int idx = i->second; if(idx > sz) // Sanity check continue; - Synth* s = synthis[idx]; + MusECore::Synth* s = MusEGlobal::synthis[idx]; if(s) { // No MESS sub-menu yet? Create it now. @@ -191,7 +212,7 @@ QMenu* populateAddSynth(QWidget* parent) int idx = i->second; if(idx > sz) continue; - Synth* s = synthis[idx]; + MusECore::Synth* s = MusEGlobal::synthis[idx]; if(s) { // No DSSI sub-menu yet? Create it now. @@ -210,7 +231,7 @@ QMenu* populateAddSynth(QWidget* parent) int idx = i->second; if(idx > sz) continue; - Synth* s = synthis[idx]; + Synth* s = MusEGlobal::synthis[idx]; if(s) { // No VST sub-menu yet? Create it now. @@ -227,7 +248,7 @@ QMenu* populateAddSynth(QWidget* parent) int idx = i->second; if(idx > sz) continue; - Synth* s = synthis[idx]; + MusECore::Synth* s = MusEGlobal::synthis[idx]; // No Other sub-menu yet? Create it now. if(!synpOther) synpOther = new QMenu(parent); @@ -283,49 +304,49 @@ QActionGroup* populateAddTrack(QMenu* addTrack) QAction* midi = addTrack->addAction(QIcon(*addtrack_addmiditrackIcon), QT_TRANSLATE_NOOP("@default", "Add Midi Track")); - midi->setData(Track::MIDI); + midi->setData(MusECore::Track::MIDI); grp->addAction(midi); QAction* drum = addTrack->addAction(QIcon(*addtrack_drumtrackIcon), QT_TRANSLATE_NOOP("@default", "Add Drum Track")); - drum->setData(Track::DRUM); + drum->setData(MusECore::Track::DRUM); grp->addAction(drum); QAction* newdrum = addTrack->addAction(QIcon(*addtrack_drumtrackIcon), QT_TRANSLATE_NOOP("@default", "Add New Style Drum Track")); - newdrum->setData(Track::NEW_DRUM); + newdrum->setData(MusECore::Track::NEW_DRUM); grp->addAction(newdrum); QAction* wave = addTrack->addAction(QIcon(*addtrack_wavetrackIcon), QT_TRANSLATE_NOOP("@default", "Add Wave Track")); - wave->setData(Track::WAVE); + wave->setData(MusECore::Track::WAVE); grp->addAction(wave); QAction* aoutput = addTrack->addAction(QIcon(*addtrack_audiooutputIcon), QT_TRANSLATE_NOOP("@default", "Add Audio Output")); - aoutput->setData(Track::AUDIO_OUTPUT); + aoutput->setData(MusECore::Track::AUDIO_OUTPUT); grp->addAction(aoutput); QAction* agroup = addTrack->addAction(QIcon(*addtrack_audiogroupIcon), QT_TRANSLATE_NOOP("@default", "Add Audio Group")); - agroup->setData(Track::AUDIO_GROUP); + agroup->setData(MusECore::Track::AUDIO_GROUP); grp->addAction(agroup); QAction* ainput = addTrack->addAction(QIcon(*addtrack_audioinputIcon), QT_TRANSLATE_NOOP("@default", "Add Audio Input")); - ainput->setData(Track::AUDIO_INPUT); + ainput->setData(MusECore::Track::AUDIO_INPUT); grp->addAction(ainput); QAction* aaux = addTrack->addAction(QIcon(*addtrack_auxsendIcon), QT_TRANSLATE_NOOP("@default", "Add Aux Send")); - aaux->setData(Track::AUDIO_AUX); + aaux->setData(MusECore::Track::AUDIO_AUX); grp->addAction(aaux); // Create a sub-menu and fill it with found synth types. Make addTrack the owner. @@ -336,26 +357,9 @@ QActionGroup* populateAddTrack(QMenu* addTrack) // Add the sub-menu to the given menu. addTrack->addMenu(synp); - //QObject::connect(addTrack, SIGNAL(triggered(QAction *)), song, SLOT(addNewTrack(QAction *))); + //QObject::connect(addTrack, SIGNAL(triggered(QAction *)), MusEGlobal::song, SLOT(addNewTrack(QAction *))); return grp; } -bool any_event_selected(const set<Part*>& parts, bool in_range) -{ - return !get_events(parts, in_range ? 3 : 1).empty(); -} - -bool drummaps_almost_equal(DrumMap* one, DrumMap* two, int len) -{ - for (int i=0; i<len; i++) - { - DrumMap tmp = one[i]; - tmp.mute=two[i].mute; - if (tmp!=two[i]) - return false; - } - return true; -} - -} // namespace MusEUtil +} // namespace MusEGui diff --git a/muse2/muse/helper.h b/muse2/muse/helper.h index b8ff391e..f014ee1e 100644 --- a/muse2/muse/helper.h +++ b/muse2/muse/helper.h @@ -32,21 +32,20 @@ class QString; class QMenu; class QWidget; -class Part; - -namespace MusEUtil { +namespace MusECore { +class Part; QString pitch2string(int v); - Part* partFromSerialNumber(int serial); - bool any_event_selected(const std::set<Part*>&, bool in_range=false); +bool drummaps_almost_equal(DrumMap* one, DrumMap* two, int drummap_size=128); +} + +namespace MusEGui { QMenu* populateAddSynth(QWidget* parent); QActionGroup* populateAddTrack(QMenu* addTrack); +} -bool drummaps_almost_equal(DrumMap* one, DrumMap* two, int drummap_size=128); - -} #endif diff --git a/muse2/muse/icons.cpp b/muse2/muse/icons.cpp index 34493d13..67bb4827 100644 --- a/muse2/muse/icons.cpp +++ b/muse2/muse/icons.cpp @@ -1,5 +1,4 @@ //========================================================= -//========================================================= // MusE // Linux Music Editor // $Id: icons.cpp,v 1.13.2.8 2009/11/14 03:37:48 terminator356 Exp $ @@ -253,6 +252,8 @@ #define MICON(a,b) QIcon(QPixmap(a)) #endif +namespace MusEGui { + /* Quick API reference: ------------------- @@ -722,3 +723,4 @@ void initIcons() sawIcon = new MPIXMAP(saw_xpm, NULL); } +} // namespace MusEGui diff --git a/muse2/muse/icons.h b/muse2/muse/icons.h index 30852f81..32f08a58 100644 --- a/muse2/muse/icons.h +++ b/muse2/muse/icons.h @@ -27,6 +27,8 @@ class QPixmap; class QIcon; +namespace MusEGui { + extern QPixmap* track_commentIcon; extern QPixmap* pointerIcon; extern QPixmap* pencilIcon; @@ -257,5 +259,7 @@ extern QIcon* userIcon; extern QPixmap* sineIcon; extern QPixmap* sawIcon; +} // namespace MusEGui + #endif diff --git a/muse2/muse/importmidi.cpp b/muse2/muse/importmidi.cpp index 0e09ecfa..593ddb79 100644 --- a/muse2/muse/importmidi.cpp +++ b/muse2/muse/importmidi.cpp @@ -54,7 +54,7 @@ using std::set; using std::pair; -namespace MusEApp { +namespace MusEGui { //--------------------------------------------------------- // importMidi @@ -70,7 +70,7 @@ void MusE::importMidi(const QString &file) { QString fn; if (file.isEmpty()) { - fn = MusEWidget::getOpenFileName(MusEGlobal::lastMidiPath, MusEGlobal::midi_file_pattern, this, + fn = MusEGui::getOpenFileName(MusEGlobal::lastMidiPath, MusEGlobal::midi_file_pattern, this, tr("MusE: Import Midi"), 0); if (fn.isEmpty()) return; @@ -88,7 +88,7 @@ void MusE::importMidi(const QString &file) switch (n) { case 0: importMidi(fn, true); - song->update(); + MusEGlobal::song->update(); break; case 1: loadProjectFile(fn, false, false); // replace @@ -106,10 +106,10 @@ void MusE::importMidi(const QString &file) bool MusE::importMidi(const QString name, bool merge) { bool popenFlag; - FILE* fp = MusEWidget::fileOpen(this, name, QString(".mid"), "r", popenFlag); + FILE* fp = MusEGui::fileOpen(this, name, QString(".mid"), "r", popenFlag); if (fp == 0) return true; - MidiFile mf(fp); + MusECore::MidiFile mf(fp); bool rv = mf.read(); popenFlag ? pclose(fp) : fclose(fp); if (rv) { @@ -123,14 +123,14 @@ bool MusE::importMidi(const QString name, bool merge) // // evaluate song Type (GM, XG, GS, unknown) // - MType t = song->mtype(); + MType t = MusEGlobal::song->mtype(); if (!merge) { t = mf.mtype(); - song->setMType(t); + MusEGlobal::song->setMType(t); } - MidiInstrument* instr = 0; - for (iMidiInstrument i = midiInstruments.begin(); i != midiInstruments.end(); ++i) { - MidiInstrument* mi = *i; + MusECore::MidiInstrument* instr = 0; + for (MusECore::iMidiInstrument i = MusECore::midiInstruments.begin(); i != MusECore::midiInstruments.end(); ++i) { + MusECore::MidiInstrument* mi = *i; if ((mi->iname() == "GM" && ((t == MT_UNKNOWN) || (t == MT_GM))) || ((mi->iname() == "GS") && (t == MT_GS)) || ((mi->iname() == "XG") && (t == MT_XG))) { @@ -144,7 +144,7 @@ bool MusE::importMidi(const QString name, bool merge) abort(); } - MidiFileTrackList* etl = mf.trackList(); + MusECore::MidiFileTrackList* etl = mf.trackList(); int division = mf.division(); // @@ -152,8 +152,8 @@ bool MusE::importMidi(const QString name, bool merge) // - combine note on/off events // - calculate tick value for internal resolution // - for (iMidiFileTrack t = etl->begin(); t != etl->end(); ++t) { - MPEventList* el = &((*t)->events); + for (MusECore::iMidiFileTrack t = etl->begin(); t != etl->end(); ++t) { + MusECore::MPEventList* el = &((*t)->events); if (el->empty()) continue; // @@ -166,11 +166,11 @@ bool MusE::importMidi(const QString name, bool merge) // with that already_processed-set-check. // this makes stuff really fast :) - iMPEvent ev; + MusECore::iMPEvent ev; set< pair<int,int> > already_processed; for (ev = el->begin(); ev != el->end(); ++ev) { - if (ev->type() != ME_SYSEX && ev->type() != ME_META) + if (ev->type() != MusECore::ME_SYSEX && ev->type() != MusECore::ME_META) { int channel=ev->channel(); int port=ev->port(); @@ -179,18 +179,18 @@ bool MusE::importMidi(const QString name, bool merge) { already_processed.insert(pair<int,int>(channel, port)); - MidiTrack* track = new MidiTrack(); + MusECore::MidiTrack* track = new MusECore::MidiTrack(); if ((*t)->isDrumTrack) - track->setType(Track::DRUM); //FINDMICHJETZT + track->setType(MusECore::Track::DRUM); //FINDMICHJETZT track->setOutChannel(channel); track->setOutPort(port); - MidiPort* mport = &midiPorts[track->outPort()]; + MusECore::MidiPort* mport = &MusEGlobal::midiPorts[track->outPort()]; // this overwrites any instrument set for this port: mport->setInstrument(instr); - EventList* mel = track->events(); + MusECore::EventList* mel = track->events(); //buildMidiEventList(mel, el, track, division, first); // Don't do loops. buildMidiEventList(mel, el, track, division, first, false); @@ -199,32 +199,32 @@ bool MusE::importMidi(const QString name, bool merge) // Comment Added by T356. // Hmm. buildMidiEventList already takes care of this. // But it seems to work. How? Must test. - if (channel == 9 && song->mtype() != MT_UNKNOWN) { - track->setType(Track::DRUM); //FINDMICHJETZT + if (channel == 9 && MusEGlobal::song->mtype() != MT_UNKNOWN) { + track->setType(MusECore::Track::DRUM); //FINDMICHJETZT // // remap drum pitch with drumInmap // - EventList* tevents = track->events(); - for (iEvent i = tevents->begin(); i != tevents->end(); ++i) { - Event ev = i->second; + MusECore::EventList* tevents = track->events(); + for (MusECore::iEvent i = tevents->begin(); i != tevents->end(); ++i) { + MusECore::Event ev = i->second; if (ev.isNote()) { - int pitch = drumInmap[ev.pitch()]; + int pitch = MusEGlobal::drumInmap[ev.pitch()]; ev.setPitch(pitch); } else - if(ev.type() == Controller) + if(ev.type() == MusECore::Controller) { int ctl = ev.dataA(); - MidiController *mc = mport->drumController(ctl); + MusECore::MidiController *mc = mport->drumController(ctl); if(mc) - ev.setA((ctl & ~0xff) | drumInmap[ctl & 0x7f]); + ev.setA((ctl & ~0xff) | MusEGlobal::drumInmap[ctl & 0x7f]); } } } processTrack(track); - song->insertTrack0(track, -1); + MusEGlobal::song->insertTrack0(track, -1); } } } @@ -234,45 +234,45 @@ bool MusE::importMidi(const QString name, bool merge) // track does only contain non-channel messages // (SYSEX or META) // - MidiTrack* track = new MidiTrack(); + MusECore::MidiTrack* track = new MusECore::MidiTrack(); track->setOutChannel(0); track->setOutPort(0); - EventList* mel = track->events(); + MusECore::EventList* mel = track->events(); //buildMidiEventList(mel, el, track, division, true); // Do SysexMeta. Don't do loops. buildMidiEventList(mel, el, track, division, true, false); processTrack(track); - song->insertTrack0(track, -1); + MusEGlobal::song->insertTrack0(track, -1); } } if (!merge) { - TrackList* tl = song->tracks(); + MusECore::TrackList* tl = MusEGlobal::song->tracks(); if (!tl->empty()) { - Track* track = tl->front(); + MusECore::Track* track = tl->front(); track->setSelected(true); } - song->initLen(); + MusEGlobal::song->initLen(); int z, n; ///sigmap.timesig(0, z, n); AL::sigmap.timesig(0, z, n); - int tempo = tempomap.tempo(0); + int tempo = MusEGlobal::tempomap.tempo(0); transport->setTimesig(z, n); transport->setTempo(tempo); - bool masterF = !tempomap.empty(); - song->setMasterFlag(masterF); + bool masterF = !MusEGlobal::tempomap.empty(); + MusEGlobal::song->setMasterFlag(masterF); transport->setMasterFlag(masterF); - song->updatePos(); + MusEGlobal::song->updatePos(); _arranger->reset(); - ///_arranger->setMode(int(song->mtype())); // p4.0.7 Tim + ///_arranger->setMode(int(MusEGlobal::song->mtype())); // p4.0.7 Tim } else { - song->initLen(); + MusEGlobal::song->initLen(); } return false; @@ -283,9 +283,9 @@ bool MusE::importMidi(const QString name, bool merge) // divide events into parts //--------------------------------------------------------- -void MusE::processTrack(MidiTrack* track) +void MusE::processTrack(MusECore::MidiTrack* track) { - EventList* tevents = track->events(); + MusECore::EventList* tevents = track->events(); if (tevents->empty()) return; @@ -297,21 +297,21 @@ void MusE::processTrack(MidiTrack* track) // Takte aufgerundet und aligned //--------------------------------------------------- - PartList* pl = track->parts(); + MusECore::PartList* pl = track->parts(); int lastTick = 0; - for (iEvent i = tevents->begin(); i != tevents->end(); ++i) { - Event event = i->second; + for (MusECore::iEvent i = tevents->begin(); i != tevents->end(); ++i) { + MusECore::Event event = i->second; int epos = event.tick() + event.lenTick(); if (epos > lastTick) lastTick = epos; } QString partname = track->name(); - int len = song->roundUpBar(lastTick+1); + int len = MusEGlobal::song->roundUpBar(lastTick+1); // p3.3.27 - if(MusEConfig::config.importMidiSplitParts) + if(MusEGlobal::config.importMidiSplitParts) { int bar2, beat; @@ -331,12 +331,12 @@ void MusE::processTrack(MidiTrack* track) // this measure is busy! continue; } - iEvent i1 = tevents->lower_bound(x1); - iEvent i2 = tevents->lower_bound(x2); + MusECore::iEvent i1 = tevents->lower_bound(x1); + MusECore::iEvent i2 = tevents->lower_bound(x2); if (i1 == i2) { // empty? if (st != -1) { - MidiPart* part = new MidiPart(track); + MusECore::MidiPart* part = new MusECore::MidiPart(track); part->setTick(st); part->setLenTick(x1-st); // printf("new part %d len: %d\n", st, x1-st); @@ -350,9 +350,9 @@ void MusE::processTrack(MidiTrack* track) st = x1; // begin new part //HACK: //lastOff: - for (iEvent i = i1; i != i2; ++i) { - Event event = i->second; - if (event.type() == Note) { + for (MusECore::iEvent i = i1; i != i2; ++i) { + MusECore::Event event = i->second; + if (event.type() == MusECore::Note) { int off = event.tick() + event.lenTick(); if (off > lastOff) lastOff = off; @@ -361,7 +361,7 @@ void MusE::processTrack(MidiTrack* track) } } if (st != -1) { - MidiPart* part = new MidiPart(track); + MusECore::MidiPart* part = new MusECore::MidiPart(track); part->setTick(st); // printf("new part %d len: %d\n", st, x2-st); part->setLenTick(x2-st); @@ -372,7 +372,7 @@ void MusE::processTrack(MidiTrack* track) else { // Just one long part... - MidiPart* part = new MidiPart(track); + MusECore::MidiPart* part = new MusECore::MidiPart(track); //part->setTick(st); part->setTick(0); part->setLenTick(len); @@ -384,17 +384,17 @@ void MusE::processTrack(MidiTrack* track) // assign events to parts //------------------------------------------------------------- - for (iPart p = pl->begin(); p != pl->end(); ++p) { - MidiPart* part = (MidiPart*)(p->second); + for (MusECore::iPart p = pl->begin(); p != pl->end(); ++p) { + MusECore::MidiPart* part = (MusECore::MidiPart*)(p->second); int stick = part->tick(); int etick = part->tick() + part->lenTick(); - iEvent r1 = tevents->lower_bound(stick); - iEvent r2 = tevents->lower_bound(etick); + MusECore::iEvent r1 = tevents->lower_bound(stick); + MusECore::iEvent r2 = tevents->lower_bound(etick); int startTick = part->tick(); - EventList* el = part->events(); - for (iEvent i = r1; i != r2; ++i) { - Event ev = i->second; + MusECore::EventList* el = part->events(); + for (MusECore::iEvent i = r1; i != r2; ++i) { + MusECore::Event ev = i->second; int ntick = ev.tick() - startTick; ev.setTick(ntick); el->add(ev); @@ -404,7 +404,7 @@ void MusE::processTrack(MidiTrack* track) if (tevents->size()) printf("-----------events left: %zd\n", tevents->size()); - for (iEvent i = tevents->begin(); i != tevents->end(); ++i) { + for (MusECore::iEvent i = tevents->begin(); i != tevents->end(); ++i) { printf("%d===\n", i->first); i->second.dump(); } @@ -416,18 +416,18 @@ void MusE::processTrack(MidiTrack* track) // importController //--------------------------------------------------------- -void MusE::importController(int channel, MidiPort* mport, int n) +void MusE::importController(int channel, MusECore::MidiPort* mport, int n) { - MidiInstrument* instr = mport->instrument(); - MidiCtrlValListList* vll = mport->controller(); - iMidiCtrlValList i = vll->find(channel, n); + MusECore::MidiInstrument* instr = mport->instrument(); + MusECore::MidiCtrlValListList* vll = mport->controller(); + MusECore::iMidiCtrlValList i = vll->find(channel, n); if (i != vll->end()) return; // controller does already exist - MidiController* ctrl = 0; - MidiControllerList* mcl = instr->controller(); + MusECore::MidiController* ctrl = 0; + MusECore::MidiControllerList* mcl = instr->controller(); // printf("import Ctrl\n"); - for (iMidiController i = mcl->begin(); i != mcl->end(); ++i) { - MidiController* mc = i->second; + for (MusECore::iMidiController i = mcl->begin(); i != mcl->end(); ++i) { + MusECore::MidiController* mc = i->second; int cn = mc->num(); // printf(" %x %x\n", n, cn); if (cn == n) { @@ -444,9 +444,9 @@ void MusE::importController(int channel, MidiPort* mport, int n) printf("controller 0x%x not defined for instrument %s, channel %d\n", n, instr->iname().toLatin1().constData(), channel); // TODO: register default Controller -// MidiController* MidiPort::midiController(int num) const +// MusECore::MidiController* MusECore::MidiPort::midiController(int num) const } - MidiCtrlValList* newValList = new MidiCtrlValList(n); + MusECore::MidiCtrlValList* newValList = new MusECore::MidiCtrlValList(n); vll->add(channel, newValList); } @@ -456,16 +456,16 @@ void MusE::importController(int channel, MidiPort* mport, int n) //--------------------------------------------------------- void MusE::importPart() { - unsigned curPos = song->cpos(); - TrackList* tracks = song->tracks(); - Track* track = 0; + unsigned curPos = MusEGlobal::song->cpos(); + MusECore::TrackList* tracks = MusEGlobal::song->tracks(); + MusECore::Track* track = 0; // Get first selected track: - for (iTrack i = tracks->begin(); i != tracks->end(); i++) { - Track* t = *i; + for (MusECore::iTrack i = tracks->begin(); i != tracks->end(); i++) { + MusECore::Track* t = *i; if (t->selected()) { // Changed by T356. Support mixed .mpt files. //if (t->isMidiTrack()) { - if (t->isMidiTrack() || t->type() == Track::WAVE) { + if (t->isMidiTrack() || t->type() == MusECore::Track::WAVE) { track = t; break; } @@ -479,21 +479,21 @@ void MusE::importPart() if (track) { bool loadAll; - QString filename = MusEWidget::getOpenFileName(QString(""), MusEGlobal::part_file_pattern, this, tr("MusE: load part"), &loadAll); + QString filename = MusEGui::getOpenFileName(QString(""), MusEGlobal::part_file_pattern, this, tr("MusE: load part"), &loadAll); if (!filename.isEmpty()){ // Make a backup of the current clone list, to retain any 'copy' items, // so that pasting works properly after. - CloneList copyCloneList = cloneList; + MusECore::CloneList copyCloneList = MusEGlobal::cloneList; // Clear the clone list to prevent any dangerous associations with // current non-original parts. - cloneList.clear(); + MusEGlobal::cloneList.clear(); importPartToTrack(filename, curPos, track); // Restore backup of the clone list, to retain any 'copy' items, // so that pasting works properly after. - cloneList.clear(); - cloneList = copyCloneList; + MusEGlobal::cloneList.clear(); + MusEGlobal::cloneList = copyCloneList; } } else { @@ -504,38 +504,38 @@ void MusE::importPart() //--------------------------------------------------------- // importPartToTrack //--------------------------------------------------------- -void MusE::importPartToTrack(QString& filename, unsigned tick, Track* track) +void MusE::importPartToTrack(QString& filename, unsigned tick, MusECore::Track* track) { // Changed by T356 /* bool popenFlag = false; - FILE* fp = MusEWidget::fileOpen(this, filename, ".mpt", "r", popenFlag, false, false); + FILE* fp = MusEGui::fileOpen(this, filename, ".mpt", "r", popenFlag, false, false); if(fp) { - MidiPart* importedPart = new MidiPart((MidiTrack*)track); - Xml tmpXml = Xml(fp); + MusECore::MidiPart* importedPart = new MusECore::MidiPart((MusECore::MidiTrack*)track); + MusECore::Xml tmpXml = MusECore::Xml(fp); - Xml::Token token = tmpXml.parse(); + MusECore::Xml::Token token = tmpXml.parse(); const QString& tag = tmpXml.s1(); - if (token == Xml::TagStart && tag == "part") + if (token == MusECore::Xml::TagStart && tag == "part") { // Make a backup of the current clone list, to retain any 'copy' items, // so that pasting works properly after. - CloneList copyCloneList = cloneList; + MusECore::CloneList copyCloneList = MusEGlobal::cloneList; // Clear the clone list to prevent any dangerous associations with // current non-original parts. - cloneList.clear(); + MusEGlobal::cloneList.clear(); importedPart->read(tmpXml); importedPart->setTick(tick); // Restore backup of the clone list, to retain any 'copy' items, // so that pasting works properly after. - cloneList.clear(); - cloneList = copyCloneList; + MusEGlobal::cloneList.clear(); + MusEGlobal::cloneList = copyCloneList; - audio->msgAddPart(importedPart); + MusEGlobal::audio->msgAddPart(importedPart); } else { @@ -548,35 +548,35 @@ void MusE::importPartToTrack(QString& filename, unsigned tick, Track* track) bool popenFlag = false; - FILE* fp = MusEWidget::fileOpen(this, filename, ".mpt", "r", popenFlag, false, false); + FILE* fp = MusEGui::fileOpen(this, filename, ".mpt", "r", popenFlag, false, false); if(fp) { - Xml xml = Xml(fp); + MusECore::Xml xml = MusECore::Xml(fp); bool firstPart = true; int posOffset = 0; int notDone = 0; int done = 0; bool end = false; - song->startUndo(); + MusEGlobal::song->startUndo(); for (;;) { - Xml::Token token = xml.parse(); + MusECore::Xml::Token token = xml.parse(); const QString& tag = xml.s1(); switch (token) { - case Xml::Error: - case Xml::End: + case MusECore::Xml::Error: + case MusECore::Xml::End: end = true; break; - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "part") { - //MidiPart* p = new MidiPart((MidiTrack*)track); + //MusECore::MidiPart* p = new MusECore::MidiPart((MusECore::MidiTrack*)track); //p->read(xml); // Read the part. - Part* p = 0; + MusECore::Part* p = 0; p = readXmlPart(xml, track); // If it could not be created... if(!p) @@ -597,12 +597,12 @@ void MusE::importPartToTrack(QString& filename, unsigned tick, Track* track) p->setTick(p->tick() + posOffset); //finalPos=p->tick() + p->lenTick(); ////pos += p->lenTick(); - audio->msgAddPart(p,false); + MusEGlobal::audio->msgAddPart(p,false); } else xml.unknown("MusE::importPartToTrack"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: break; default: end = true; @@ -612,7 +612,7 @@ void MusE::importPartToTrack(QString& filename, unsigned tick, Track* track) break; } fclose(fp); - song->endUndo(SC_PART_INSERTED); + MusEGlobal::song->endUndo(SC_PART_INSERTED); if(notDone) { @@ -626,4 +626,4 @@ void MusE::importPartToTrack(QString& filename, unsigned tick, Track* track) } } -} // namespace MuseApp +} // namespace MuseGui diff --git a/muse2/muse/instruments/editinstrument.cpp b/muse2/muse/instruments/editinstrument.cpp index e1639d04..742e0626 100644 --- a/muse2/muse/instruments/editinstrument.cpp +++ b/muse2/muse/instruments/editinstrument.cpp @@ -42,6 +42,7 @@ #include "gconfig.h" #include "icons.h" +namespace MusEGui { enum { COL_NAME = 0, COL_TYPE, @@ -72,12 +73,12 @@ EditInstrument::EditInstrument(QWidget* parent, Qt::WFlags fl) // Populate common controller list. for(int i = 0; i < 128; ++i) { - QListWidgetItem *lci = new QListWidgetItem(midiCtrlName(i)); + QListWidgetItem *lci = new QListWidgetItem(MusECore::midiCtrlName(i)); listController->addItem(lci); } oldMidiInstrument = 0; oldPatchItem = 0; - for (iMidiInstrument i = midiInstruments.begin(); i != midiInstruments.end(); ++i) { + for (MusECore::iMidiInstrument i = MusECore::midiInstruments.begin(); i != MusECore::midiInstruments.end(); ++i) { // Imperfect, crude way of ignoring internal instruments, soft synths etc. If it has a gui, // it must be an internal instrument. But this will still allow some vst instruments (without a gui) // to show up in the list. @@ -94,11 +95,11 @@ EditInstrument::EditInstrument(QWidget* parent, Qt::WFlags fl) instrumentList->setSelectionMode(QAbstractItemView::SingleSelection); if(instrumentList->item(0)) instrumentList->setCurrentItem(instrumentList->item(0)); - //oldMidiInstrument = (MidiInstrument*)((ListBoxData*)instrumentList->item(0))->data(); + //oldMidiInstrument = (MusECore::MidiInstrument*)((ListBoxData*)instrumentList->item(0))->data(); //oldMidiInstrument = (ListBoxData*)instrumentList->item(0); //oldMidiInstrument = (ListBoxData*)instrumentList->selectedItem(); -// MidiInstrument* wip = (MidiInstrument*)((ListBoxData*)instrumentList->item(0))->data(); +// MusECore::MidiInstrument* wip = (MusECore::MidiInstrument*)((ListBoxData*)instrumentList->item(0))->data(); // if(wip) // Assignment // workingInstrument.assign( *wip ); @@ -173,7 +174,7 @@ void EditInstrument::fileNew() for (int i = 1;; ++i) { QString s = QString("Instrument-%1").arg(i); bool found = false; - for (iMidiInstrument i = midiInstruments.begin(); i != midiInstruments.end(); ++i) { + for (MusECore::iMidiInstrument i = MusECore::midiInstruments.begin(); i != MusECore::midiInstruments.end(); ++i) { if (s == (*i)->iname()) { found = true; break; @@ -182,10 +183,10 @@ void EditInstrument::fileNew() if (!found) { //if(oldMidiInstrument) //{ - MidiInstrument* oi = 0; + MusECore::MidiInstrument* oi = 0; if(oldMidiInstrument) - oi = (MidiInstrument*)oldMidiInstrument->data(Qt::UserRole).value<void*>(); - MidiInstrument* wip = &workingInstrument; + oi = (MusECore::MidiInstrument*)oldMidiInstrument->data(Qt::UserRole).value<void*>(); + MusECore::MidiInstrument* wip = &workingInstrument; //checkDirty(oi); //if(checkDirty(oi)) if(checkDirty(wip)) @@ -214,9 +215,9 @@ void EditInstrument::fileNew() workingInstrument.setDirty(false); //} - MidiInstrument* ni = new MidiInstrument(s); - //midiInstruments.append(ni); - midiInstruments.push_back(ni); + MusECore::MidiInstrument* ni = new MusECore::MidiInstrument(s); + //MusECore::midiInstruments.append(ni); + MusECore::midiInstruments.push_back(ni); //QListWidgetItem* item = new QListWidgetItem(ni->iname()); //InstrumentListItem* item = new InstrumentListItem(ni->iname()); QListWidgetItem* item = new QListWidgetItem(ni->iname()); @@ -322,7 +323,7 @@ void EditInstrument::fileSave() // fileSave //--------------------------------------------------------- -bool EditInstrument::fileSave(MidiInstrument* instrument, const QString& name) +bool EditInstrument::fileSave(MusECore::MidiInstrument* instrument, const QString& name) { //QFile f(name); //if (!f.open(QIODevice::WriteOnly)) { @@ -332,7 +333,7 @@ bool EditInstrument::fileSave(MidiInstrument* instrument, const QString& name) // tr("MusE: Create file failed"), s); // return false; // } - //Xml xml(&f); + //MusECore::Xml xml(&f); FILE* f = fopen(name.toAscii().constData(), "w"); if(f == 0) @@ -346,7 +347,7 @@ bool EditInstrument::fileSave(MidiInstrument* instrument, const QString& name) return false; } - Xml xml(f); + MusECore::Xml xml(f); updateInstrument(instrument); @@ -356,14 +357,14 @@ bool EditInstrument::fileSave(MidiInstrument* instrument, const QString& name) // Assign the working instrument values to the actual current selected instrument... if(oldMidiInstrument) { - MidiInstrument* oi = (MidiInstrument*)oldMidiInstrument->data(Qt::UserRole).value<void*>(); + MusECore::MidiInstrument* oi = (MusECore::MidiInstrument*)oldMidiInstrument->data(Qt::UserRole).value<void*>(); if(oi) { oi->assign(workingInstrument); // Now signal the rest of the app so stuff can change... - song->update(SC_CONFIG | SC_MIDI_CONTROLLER); - //song->update(SC_CONFIG | SC_MIDI_CONTROLLER | SC_MIDI_CONTROLLER_ADD); + MusEGlobal::song->update(SC_CONFIG | SC_MIDI_CONTROLLER); + //MusEGlobal::song->update(SC_CONFIG | SC_MIDI_CONTROLLER | SC_MIDI_CONTROLLER_ADD); } } @@ -396,10 +397,10 @@ void EditInstrument::saveAs() // ListBoxData* item = (ListBoxData*)instrumentList->selectedItem(); // if (item == 0) // return; - //MidiInstrument* instrument = (MidiInstrument*)item->data(Qt::UserRole).value<void*>(); -// MidiInstrument* instrument = (MidiInstrument*)item->data(); + //MusECore::MidiInstrument* instrument = (MusECore::MidiInstrument*)item->data(Qt::UserRole).value<void*>(); +// MusECore::MidiInstrument* instrument = (MusECore::MidiInstrument*)item->data(); - //QString path = QDir::homePath() + "/" + MusEConfig::config.instrumentPath; + //QString path = QDir::homePath() + "/" + MusEGlobal::config.instrumentPath; //QString path = QDir::homeDirPath() + "/" + MusEGlobal::museGlobalShare; //QString path = MusEGlobal::museInstruments; QString path = MusEGlobal::museUserInstruments; @@ -439,7 +440,7 @@ void EditInstrument::saveAs() // Prompt for a new instrument name if the name has not been changed, to avoid duplicates. if(oldMidiInstrument) { - MidiInstrument* oi = (MidiInstrument*)oldMidiInstrument->data(Qt::UserRole).value<void*>(); + MusECore::MidiInstrument* oi = (MusECore::MidiInstrument*)oldMidiInstrument->data(Qt::UserRole).value<void*>(); if(oi) { if(oi->iname() == workingInstrument.iname()) @@ -498,9 +499,9 @@ void EditInstrument::fileSaveAs() patchNameReturn(); ctrlNameReturn(); - MidiInstrument* oi = 0; + MusECore::MidiInstrument* oi = 0; if(oldMidiInstrument) - oi = (MidiInstrument*)oldMidiInstrument->data(Qt::UserRole).value<void*>(); + oi = (MusECore::MidiInstrument*)oldMidiInstrument->data(Qt::UserRole).value<void*>(); int res = checkDirty(&workingInstrument, true); switch(res) @@ -549,8 +550,8 @@ void EditInstrument::fileSaveAs() // ListBoxData* item = (ListBoxData*)instrumentList->selectedItem(); // if (item == 0) // return; - //MidiInstrument* instrument = (MidiInstrument*)item->data(Qt::UserRole).value<void*>(); -// MidiInstrument* instrument = (MidiInstrument*)item->data(); + //MusECore::MidiInstrument* instrument = (MusECore::MidiInstrument*)item->data(Qt::UserRole).value<void*>(); +// MusECore::MidiInstrument* instrument = (MusECore::MidiInstrument*)item->data(); bool isuser = false; QString so; @@ -564,7 +565,7 @@ void EditInstrument::fileSaveAs() QString s = so + QString("-%1").arg(i); bool found = false; - for(iMidiInstrument imi = midiInstruments.begin(); imi != midiInstruments.end(); ++imi) + for(MusECore::iMidiInstrument imi = MusECore::midiInstruments.begin(); imi != MusECore::midiInstruments.end(); ++imi) { if(s == (*imi)->iname()) { @@ -593,7 +594,7 @@ void EditInstrument::fileSaveAs() isuser = false; bool builtin = false; found = false; - for(iMidiInstrument imi = midiInstruments.begin(); imi != midiInstruments.end(); ++imi) + for(MusECore::iMidiInstrument imi = MusECore::midiInstruments.begin(); imi != MusECore::midiInstruments.end(); ++imi) { // If an instrument with the same name is found... if((*imi)->iname() == s) @@ -654,12 +655,12 @@ void EditInstrument::fileSaveAs() // If the name does not belong to a built-in instrument... if(!builtin) { - MidiInstrument* ni = new MidiInstrument(); + MusECore::MidiInstrument* ni = new MusECore::MidiInstrument(); ni->assign(workingInstrument); ni->setIName(so); ni->setFilePath(QString()); - //midiInstruments.append(ni); - midiInstruments.push_back(ni); + //MusECore::midiInstruments.append(ni); + MusECore::midiInstruments.push_back(ni); //QListWidgetItem* item = new QListWidgetItem(ni->iname()); //InstrumentListItem* item = new InstrumentListItem(ni->iname()); //ListBoxData* item = new ListBoxData(ni->iname()); @@ -691,7 +692,7 @@ void EditInstrument::fileSaveAs() break; } - //QString path = QDir::homePath() + "/" + MusEConfig::config.instrumentPath; + //QString path = QDir::homePath() + "/" + MusEGlobal::config.instrumentPath; //QString path = QDir::homeDirPath() + "/" + MusEGlobal::museGlobalShare; //QString path = MusEGlobal::museInstruments; QString path = MusEGlobal::museUserInstruments; @@ -773,12 +774,12 @@ void EditInstrument::closeEvent(QCloseEvent* ev) // if(item) // { - //MidiInstrument* instrument = (MidiInstrument*)item->data(Qt::UserRole).value<void*>(); -// MidiInstrument* instrument = (MidiInstrument*)item->data(); + //MusECore::MidiInstrument* instrument = (MusECore::MidiInstrument*)item->data(Qt::UserRole).value<void*>(); +// MusECore::MidiInstrument* instrument = (MusECore::MidiInstrument*)item->data(); // int res = checkDirty(instrument, true); - MidiInstrument* oi = 0; + MusECore::MidiInstrument* oi = 0; if(oldMidiInstrument) - oi = (MidiInstrument*)oldMidiInstrument->data(Qt::UserRole).value<void*>(); + oi = (MusECore::MidiInstrument*)oldMidiInstrument->data(Qt::UserRole).value<void*>(); int res = checkDirty(&workingInstrument, true); switch(res) @@ -840,13 +841,13 @@ void EditInstrument::changeInstrument() if(!sel) return; - //oldMidiInstrument = (MidiInstrument*)sel->data(); + //oldMidiInstrument = (MusECore::MidiInstrument*)sel->data(); oldMidiInstrument = sel; // Assignment - //workingInstrument = *((MidiInstrument*)sel->data()); + //workingInstrument = *((MusECore::MidiInstrument*)sel->data()); // Assign will 'delete' any existing patches, groups, or controllers. - workingInstrument.assign( *((MidiInstrument*)sel->data(Qt::UserRole).value<void*>()) ); + workingInstrument.assign( *((MusECore::MidiInstrument*)sel->data(Qt::UserRole).value<void*>()) ); workingInstrument.setDirty(false); @@ -868,8 +869,8 @@ void EditInstrument::changeInstrument() //sysexList->clear(); - //MidiInstrument* instrument = (MidiInstrument*)sel->data(Qt::UserRole).value<void*>(); - //MidiInstrument* instrument = (MidiInstrument*)sel->data(); + //MusECore::MidiInstrument* instrument = (MusECore::MidiInstrument*)sel->data(Qt::UserRole).value<void*>(); + //MusECore::MidiInstrument* instrument = (MusECore::MidiInstrument*)sel->data(); //instrument->setDirty(false); instrumentName->blockSignals(true); @@ -901,12 +902,12 @@ void EditInstrument::changeInstrument() nullParamSpinBoxH->blockSignals(false); nullParamSpinBoxL->blockSignals(false); - //std::vector<PatchGroup>* pg = instrument->groups(); - //PatchGroupList* pg = instrument->groups(); - PatchGroupList* pg = workingInstrument.groups(); - //for (std::vector<PatchGroup>::iterator g = pg->begin(); g != pg->end(); ++g) { - for (ciPatchGroup g = pg->begin(); g != pg->end(); ++g) { - PatchGroup* pgp = *g; + //std::vector<MusECore::PatchGroup>* pg = instrument->groups(); + //MusECore::PatchGroupList* pg = instrument->groups(); + MusECore::PatchGroupList* pg = workingInstrument.groups(); + //for (std::vector<MusECore::PatchGroup>::iterator g = pg->begin(); g != pg->end(); ++g) { + for (MusECore::ciPatchGroup g = pg->begin(); g != pg->end(); ++g) { + MusECore::PatchGroup* pgp = *g; if(pgp) { //QTreeWidgetItem* item = new QTreeWidgetItem; @@ -924,11 +925,11 @@ void EditInstrument::changeInstrument() item->setData(0, Qt::UserRole, v); //patchView->addTopLevelItem(item); - //for (ciPatch p = g->patches.begin(); p != g->patches.end(); ++p) - for (ciPatch p = pgp->patches.begin(); p != pgp->patches.end(); ++p) + //for (MusECore::ciPatch p = g->patches.begin(); p != g->patches.end(); ++p) + for (MusECore::ciPatch p = pgp->patches.begin(); p != pgp->patches.end(); ++p) { //const Patch& patch = *p; - Patch* patch = *p; + MusECore::Patch* patch = *p; if(patch) { //QTreeWidgetItem* sitem = new QTreeWidgetItem; @@ -975,15 +976,16 @@ void EditInstrument::changeInstrument() // if(oldPatchItem) // { // if(oldPatchItem->parent()) -// patchNameEdit->setText( ((Patch*)oldPatchItem->data())->name ); +// patchNameEdit->setText( ((MusECore::Patch*)oldPatchItem->data())->name ); // else -// patchNameEdit->setText( ((PatchGroup*)oldPatchItem->data())->name ); +// patchNameEdit->setText( ((MusECore::PatchGroup*)oldPatchItem->data())->name ); // } - //MidiControllerList* cl = instrument->controller(); - MidiControllerList* cl = workingInstrument.controller(); - for (ciMidiController ic = cl->begin(); ic != cl->end(); ++ic) { - MidiController* c = ic->second; + //MusECore::MidiControllerList* cl = instrument->controller(); + + MusECore::MidiControllerList* cl = workingInstrument.controller(); + for (MusECore::ciMidiController ic = cl->begin(); ic != cl->end(); ++ic) { + MusECore::MidiController* c = ic->second; //QListWidgetItem* item = new QListWidgetItem(c->name()); // ListBoxData* item = new ListBoxData(c->name()); //QVariant v = QVariant::fromValue((void*)c); @@ -1064,10 +1066,10 @@ void EditInstrument::instrumentChanged() //if (old) { //if(oldMidiInstrument) //{ - MidiInstrument* oi = 0; + MusECore::MidiInstrument* oi = 0; if(oldMidiInstrument) - oi = (MidiInstrument*)oldMidiInstrument->data(Qt::UserRole).value<void*>(); - MidiInstrument* wip = &workingInstrument; + oi = (MusECore::MidiInstrument*)oldMidiInstrument->data(Qt::UserRole).value<void*>(); + MusECore::MidiInstrument* wip = &workingInstrument; // Returns true if aborted. //checkDirty(oi); //if(checkDirty(oi)) @@ -1122,9 +1124,9 @@ void EditInstrument::instrumentNameReturn() if(s == item->text()) return; - MidiInstrument* curins = (MidiInstrument*)item->data(Qt::UserRole).value<void*>(); + MusECore::MidiInstrument* curins = (MusECore::MidiInstrument*)item->data(Qt::UserRole).value<void*>(); - for(iMidiInstrument i = midiInstruments.begin(); i != midiInstruments.end(); ++i) + for(MusECore::iMidiInstrument i = MusECore::midiInstruments.begin(); i != MusECore::midiInstruments.end(); ++i) { if((*i) != curins && s == (*i)->iname()) { @@ -1147,8 +1149,8 @@ void EditInstrument::instrumentNameReturn() //if (s != workingInstrument.iname()) { item->setText(s); - //MidiInstrument* instrument = (MidiInstrument*)item->data(Qt::UserRole).value<void*>(); - //MidiInstrument* instrument = (MidiInstrument*)item->data(); + //MusECore::MidiInstrument* instrument = (MusECore::MidiInstrument*)item->data(Qt::UserRole).value<void*>(); + //MusECore::MidiInstrument* instrument = (MusECore::MidiInstrument*)item->data(); //instrument->setDirty(true); workingInstrument.setIName(s); workingInstrument.setDirty(true); @@ -1168,7 +1170,7 @@ void EditInstrument::deleteInstrument(QListWidgetItem* item) //ListBoxData* curritem = (ListBoxData*)instrumentList->selectedItem(); - MidiInstrument* ins = (MidiInstrument*)item->data(Qt::UserRole).value<void*>(); + MusECore::MidiInstrument* ins = (MusECore::MidiInstrument*)item->data(Qt::UserRole).value<void*>(); // Be kind to the list item, just in case we install a delete handler or something. //item->setData(0); @@ -1187,7 +1189,7 @@ void EditInstrument::deleteInstrument(QListWidgetItem* item) return; // Remove the instrument from the list. - midiInstruments.remove(ins); + MusECore::midiInstruments.remove(ins); // Delete the instrument. delete ins; @@ -1212,9 +1214,9 @@ void EditInstrument::tabChanged(QWidget* w) { // Don't bother calling patchChanged, just update the patch or group. if(oldPatchItem->QTreeWidgetItem::parent()) - updatePatch(&workingInstrument, (Patch*)oldPatchItem->data(0, Qt::UserRole).value<void*>()); + updatePatch(&workingInstrument, (MusECore::Patch*)oldPatchItem->data(0, Qt::UserRole).value<void*>()); else - updatePatchGroup(&workingInstrument, (PatchGroup*)oldPatchItem->data(0, Qt::UserRole).value<void*>()); + updatePatchGroup(&workingInstrument, (MusECore::PatchGroup*)oldPatchItem->data(0, Qt::UserRole).value<void*>()); } // We're still on the same item. No need to set oldPatchItem as in patchChanged... @@ -1227,12 +1229,12 @@ void EditInstrument::tabChanged(QWidget* w) if(!sel || !sel->data(0, Qt::UserRole).value<void*>()) return; - MidiController* c = (MidiController*)sel->data(0, Qt::UserRole).value<void*>(); - MidiController::ControllerType type = midiControllerType(c->num()); + MusECore::MidiController* c = (MusECore::MidiController*)sel->data(0, Qt::UserRole).value<void*>(); + MusECore::MidiController::ControllerType type = MusECore::midiControllerType(c->num()); // Grab the controller number from the actual values showing // and set the patch button text. - if(type == MidiController::Program) + if(type == MusECore::MidiController::Program) setDefaultPatchName(getDefaultPatchNumber()); } } @@ -1253,15 +1255,15 @@ void EditInstrument::patchNameReturn() if(item->text(0) == s) return; - PatchGroupList* pg = workingInstrument.groups(); - for(iPatchGroup g = pg->begin(); g != pg->end(); ++g) + MusECore::PatchGroupList* pg = workingInstrument.groups(); + for(MusECore::iPatchGroup g = pg->begin(); g != pg->end(); ++g) { - PatchGroup* pgp = *g; + MusECore::PatchGroup* pgp = *g; // If the item has a parent, it's a patch item. if(item->QTreeWidgetItem::parent()) { - Patch* curp = (Patch*)item->data(0, Qt::UserRole).value<void*>(); - for(iPatch p = pgp->patches.begin(); p != pgp->patches.end(); ++p) + MusECore::Patch* curp = (MusECore::Patch*)item->data(0, Qt::UserRole).value<void*>(); + for(MusECore::iPatch p = pgp->patches.begin(); p != pgp->patches.end(); ++p) { if((*p) != curp && (*p)->name == s) { @@ -1285,7 +1287,7 @@ void EditInstrument::patchNameReturn() else // The item has no parent. It's a patch group item. { - PatchGroup* curpg = (PatchGroup*)item->data(0, Qt::UserRole).value<void*>(); + MusECore::PatchGroup* curpg = (MusECore::PatchGroup*)item->data(0, Qt::UserRole).value<void*>(); if(pgp != curpg && pgp->name == s) { patchNameEdit->blockSignals(true); @@ -1315,7 +1317,7 @@ void EditInstrument::patchNameReturn() // If the item has a parent, it's a patch item. if(item->parent()) { - Patch* p = item->data(); + MusECore::Patch* p = item->data(); if(s != p->name) { item->setText(s); @@ -1327,7 +1329,7 @@ void EditInstrument::patchNameReturn() else // The item has no parent. It's a patch group item. { - PatchGroup* pg = (PatchGroup*)item->data(); + MusECore::PatchGroup* pg = (MusECore::PatchGroup*)item->data(); if(s != pg->name) { item->setText(s); @@ -1350,13 +1352,13 @@ void EditInstrument::patchChanged() //QListWidgetItem* item = instrumentList->currentItem(); //if (item == 0) // return; - //MidiInstrument* instrument = (MidiInstrument*)item->data(Qt::UserRole).value<void*>(); - //Patch* p = (Patch*)old->data(0, Qt::UserRole).value<void*>(); + //MusECore::MidiInstrument* instrument = (MusECore::MidiInstrument*)item->data(Qt::UserRole).value<void*>(); + //MusECore::Patch* p = (MusECore::Patch*)old->data(0, Qt::UserRole).value<void*>(); //updatePatch(instrument, p); if(oldPatchItem->parent()) - updatePatch(&workingInstrument, (Patch*)oldPatchItem->data(0, Qt::UserRole).value<void*>()); + updatePatch(&workingInstrument, (MusECore::Patch*)oldPatchItem->data(0, Qt::UserRole).value<void*>()); else - updatePatchGroup(&workingInstrument, (PatchGroup*)oldPatchItem->data(0, Qt::UserRole).value<void*>()); + updatePatchGroup(&workingInstrument, (MusECore::PatchGroup*)oldPatchItem->data(0, Qt::UserRole).value<void*>()); } QTreeWidgetItem* sel = patchView->selectedItems().size() ? patchView->selectedItems()[0] : 0; @@ -1378,7 +1380,7 @@ void EditInstrument::patchChanged() // If the item has a parent, it's a patch item. if(sel->parent()) { - Patch* p = (Patch*)sel->data(0, Qt::UserRole).value<void*>(); + MusECore::Patch* p = (MusECore::Patch*)sel->data(0, Qt::UserRole).value<void*>(); patchNameEdit->setText(p->name); spinBoxHBank->setEnabled(true); spinBoxLBank->setEnabled(true); @@ -1404,7 +1406,7 @@ void EditInstrument::patchChanged() else // The item is a patch group item. { - patchNameEdit->setText( ((PatchGroup*)sel->data(0, Qt::UserRole).value<void*>())->name ); + patchNameEdit->setText( ((MusECore::PatchGroup*)sel->data(0, Qt::UserRole).value<void*>())->name ); spinBoxHBank->setEnabled(false); spinBoxLBank->setEnabled(false); spinBoxProgram->setEnabled(false); @@ -1426,12 +1428,12 @@ void EditInstrument::defPatchChanged(int) if (!item) return; - MidiController* c = (MidiController*)item->data(0, Qt::UserRole).value<void*>(); + MusECore::MidiController* c = (MusECore::MidiController*)item->data(0, Qt::UserRole).value<void*>(); int val = getDefaultPatchNumber(); //if(val == c->minVal() - 1) - // c->setInitVal(CTRL_VAL_UNKNOWN); + // c->setInitVal(MusECore::CTRL_VAL_UNKNOWN); //else c->setInitVal(val); @@ -1450,23 +1452,23 @@ void EditInstrument::patchButtonClicked() //MidiTrack* track = (MidiTrack*)selected; //int channel = track->outChannel(); //int port = track->outPort(); - //MidiInstrument* instr = midiPorts[port].instrument(); + //MusECore::MidiInstrument* instr = midiPorts[port].instrument(); //patchpopup->clear(); QMenu* patchpopup = new QMenu; - PatchGroupList* pg = workingInstrument.groups(); + MusECore::PatchGroupList* pg = workingInstrument.groups(); if (pg->size() > 1) { - for (ciPatchGroup i = pg->begin(); i != pg->end(); ++i) { - PatchGroup* pgp = *i; + for (MusECore::ciPatchGroup i = pg->begin(); i != pg->end(); ++i) { + MusECore::PatchGroup* pgp = *i; QMenu* pm = patchpopup->addMenu(pgp->name); //pm->setCheckable(false);//Qt4 doc says this is unnecessary - pm->setFont(MusEConfig::config.fonts[0]); - const PatchList& pl = pgp->patches; - for (ciPatch ipl = pl.begin(); ipl != pl.end(); ++ipl) { - const Patch* mp = *ipl; + pm->setFont(MusEGlobal::config.fonts[0]); + const MusECore::PatchList& pl = pgp->patches; + for (MusECore::ciPatch ipl = pl.begin(); ipl != pl.end(); ++ipl) { + const MusECore::Patch* mp = *ipl; //if ((mp->typ & mask) && // ((drum && songType != MT_GM) || // (mp->drum == drumchan)) ) @@ -1483,9 +1485,9 @@ void EditInstrument::patchButtonClicked() } else if (pg->size() == 1 ){ // no groups - const PatchList& pl = pg->front()->patches; - for (ciPatch ipl = pl.begin(); ipl != pl.end(); ++ipl) { - const Patch* mp = *ipl; + const MusECore::PatchList& pl = pg->front()->patches; + for (MusECore::ciPatch ipl = pl.begin(); ipl != pl.end(); ++ipl) { + const MusECore::Patch* mp = *ipl; //if (mp->typ & mask) { int id = ((mp->hbank & 0xff) << 16) + ((mp->lbank & 0xff) << 8) + (mp->prog & 0xff); @@ -1521,7 +1523,7 @@ void EditInstrument::patchButtonClicked() if(item) { - MidiController* c = (MidiController*)item->data(0, Qt::UserRole).value<void*>(); + MusECore::MidiController* c = (MusECore::MidiController*)item->data(0, Qt::UserRole).value<void*>(); c->setInitVal(rv); item->setText(COL_DEF, getPatchItemText(rv)); @@ -1535,7 +1537,7 @@ void EditInstrument::patchButtonClicked() // addControllerToView //--------------------------------------------------------- -QTreeWidgetItem* EditInstrument::addControllerToView(MidiController* mctrl) +QTreeWidgetItem* EditInstrument::addControllerToView(MusECore::MidiController* mctrl) { QString hnum; QString lnum; @@ -1550,12 +1552,12 @@ QTreeWidgetItem* EditInstrument::addControllerToView(MidiController* mctrl) if((n & 0xff) == 0xff) l = -1; - MidiController::ControllerType t = midiControllerType(n); + MusECore::MidiController::ControllerType t = MusECore::midiControllerType(n); switch(t) { - case MidiController::Controller7: - //case MidiController::RPN: - //case MidiController::NRPN: + case MusECore::MidiController::Controller7: + //case MusECore::MidiController::RPN: + //case MusECore::MidiController::NRPN: hnum = "---"; if(l == -1) lnum = "*"; @@ -1563,16 +1565,16 @@ QTreeWidgetItem* EditInstrument::addControllerToView(MidiController* mctrl) lnum.setNum(l); min.setNum(mctrl->minVal()); max.setNum(mctrl->maxVal()); - if(defval == CTRL_VAL_UNKNOWN) + if(defval == MusECore::CTRL_VAL_UNKNOWN) def = "---"; else def.setNum(defval); break; - case MidiController::RPN: - case MidiController::NRPN: - case MidiController::RPN14: - case MidiController::NRPN14: - case MidiController::Controller14: + case MusECore::MidiController::RPN: + case MusECore::MidiController::NRPN: + case MusECore::MidiController::RPN14: + case MusECore::MidiController::NRPN14: + case MusECore::MidiController::Controller14: hnum.setNum(h); if(l == -1) lnum = "*"; @@ -1580,22 +1582,22 @@ QTreeWidgetItem* EditInstrument::addControllerToView(MidiController* mctrl) lnum.setNum(l); min.setNum(mctrl->minVal()); max.setNum(mctrl->maxVal()); - if(defval == CTRL_VAL_UNKNOWN) + if(defval == MusECore::CTRL_VAL_UNKNOWN) def = "---"; else def.setNum(defval); break; - case MidiController::Pitch: + case MusECore::MidiController::Pitch: hnum = "---"; lnum = "---"; min.setNum(mctrl->minVal()); max.setNum(mctrl->maxVal()); - if(defval == CTRL_VAL_UNKNOWN) + if(defval == MusECore::CTRL_VAL_UNKNOWN) def = "---"; else def.setNum(defval); break; - case MidiController::Program: + case MusECore::MidiController::Program: hnum = "---"; lnum = "---"; min = "---"; @@ -1637,10 +1639,10 @@ void EditInstrument::controllerChanged() //QListWidgetItem* item = instrumentList->currentItem(); //if (item == 0) // return; - //MidiInstrument* instrument = (MidiInstrument*)item->data(Qt::UserRole).value<void*>(); - //MidiController* oc = (MidiController*)old->data(Qt::UserRole).value<void*>(); + //MusECore::MidiInstrument* instrument = (MusECore::MidiInstrument*)item->data(Qt::UserRole).value<void*>(); + //MusECore::MidiController* oc = (MusECore::MidiController*)old->data(Qt::UserRole).value<void*>(); //updateController(instrument, oc); -// updateController(&workingInstrument, (MidiController*)oldController->data()); +// updateController(&workingInstrument, (MusECore::MidiController*)oldController->data()); // } // ListBoxData* sel = (ListBoxData*)listController->selectedItem(); @@ -1657,7 +1659,7 @@ void EditInstrument::controllerChanged() return; } - MidiController* c = (MidiController*)sel->data(0, Qt::UserRole).value<void*>(); + MusECore::MidiController* c = (MusECore::MidiController*)sel->data(0, Qt::UserRole).value<void*>(); ctrlName->blockSignals(true); ctrlName->setText(c->name()); @@ -1670,7 +1672,7 @@ void EditInstrument::controllerChanged() ctrlL = -1; //int type = int(c->type()); - MidiController::ControllerType type = midiControllerType(c->num()); + MusECore::MidiController::ControllerType type = MusECore::midiControllerType(c->num()); //ctrlType->setCurrentIndex(type); ctrlType->blockSignals(true); @@ -1688,9 +1690,9 @@ void EditInstrument::controllerChanged() //ctrlTypeChanged(type); switch (type) { - //case MidiController::RPN: - //case MidiController::NRPN: - case MidiController::Controller7: + //case MusECore::MidiController::RPN: + //case MusECore::MidiController::NRPN: + case MusECore::MidiController::Controller7: spinBoxHCtrlNo->setEnabled(false); spinBoxLCtrlNo->setEnabled(true); spinBoxHCtrlNo->setValue(0); @@ -1703,8 +1705,8 @@ void EditInstrument::controllerChanged() spinBoxMax->setValue(c->maxVal()); enableDefaultControls(true, false); break; - case MidiController::RPN: - case MidiController::NRPN: + case MusECore::MidiController::RPN: + case MusECore::MidiController::NRPN: spinBoxHCtrlNo->setEnabled(true); spinBoxLCtrlNo->setEnabled(true); spinBoxHCtrlNo->setValue(ctrlH); @@ -1717,9 +1719,9 @@ void EditInstrument::controllerChanged() spinBoxMax->setValue(c->maxVal()); enableDefaultControls(true, false); break; - case MidiController::Controller14: - case MidiController::RPN14: - case MidiController::NRPN14: + case MusECore::MidiController::Controller14: + case MusECore::MidiController::RPN14: + case MusECore::MidiController::NRPN14: spinBoxHCtrlNo->setEnabled(true); spinBoxLCtrlNo->setEnabled(true); spinBoxHCtrlNo->setValue(ctrlH); @@ -1732,7 +1734,7 @@ void EditInstrument::controllerChanged() spinBoxMax->setValue(c->maxVal()); enableDefaultControls(true, false); break; - case MidiController::Pitch: + case MusECore::MidiController::Pitch: spinBoxHCtrlNo->setEnabled(false); spinBoxLCtrlNo->setEnabled(false); spinBoxHCtrlNo->setValue(0); @@ -1745,7 +1747,7 @@ void EditInstrument::controllerChanged() spinBoxMax->setValue(c->maxVal()); enableDefaultControls(true, false); break; - case MidiController::Program: + case MusECore::MidiController::Program: spinBoxHCtrlNo->setEnabled(false); spinBoxLCtrlNo->setEnabled(false); spinBoxHCtrlNo->setValue(0); @@ -1767,7 +1769,7 @@ void EditInstrument::controllerChanged() break; } - if(type == MidiController::Program) + if(type == MusECore::MidiController::Program) { spinBoxDefault->setRange(0, 0); spinBoxDefault->setValue(0); @@ -1776,7 +1778,7 @@ void EditInstrument::controllerChanged() else { spinBoxDefault->setRange(c->minVal() - 1, c->maxVal()); - if(c->initVal() == CTRL_VAL_UNKNOWN) + if(c->initVal() == MusECore::CTRL_VAL_UNKNOWN) //spinBoxDefault->setValue(c->minVal() - 1); spinBoxDefault->setValue(spinBoxDefault->minimum()); else @@ -1803,18 +1805,18 @@ void EditInstrument::ctrlNameReturn() if (item == 0) return; - MidiController* c = (MidiController*)item->data(0, Qt::UserRole).value<void*>(); + MusECore::MidiController* c = (MusECore::MidiController*)item->data(0, Qt::UserRole).value<void*>(); QString cName = ctrlName->text(); if(c->name() == cName) return; - //MidiControllerList* cl = instrument->controller(); - MidiControllerList* cl = workingInstrument.controller(); - for(ciMidiController ic = cl->begin(); ic != cl->end(); ++ic) + //MusECore::MidiControllerList* cl = instrument->controller(); + MusECore::MidiControllerList* cl = workingInstrument.controller(); + for(MusECore::ciMidiController ic = cl->begin(); ic != cl->end(); ++ic) { - MidiController* mc = ic->second; + MusECore::MidiController* mc = ic->second; if(mc != c && mc->name() == cName) { ctrlName->blockSignals(true); @@ -1850,9 +1852,9 @@ void EditInstrument::ctrlTypeChanged(int idx) if (item == 0) return; - MidiController::ControllerType t = (MidiController::ControllerType)idx; - MidiController* c = (MidiController*)item->data(0, Qt::UserRole).value<void*>(); - if(t == midiControllerType(c->num())) + MusECore::MidiController::ControllerType t = (MusECore::MidiController::ControllerType)idx; + MusECore::MidiController* c = (MusECore::MidiController*)item->data(0, Qt::UserRole).value<void*>(); + if(t == MusECore::midiControllerType(c->num())) return; //if(item) @@ -1867,9 +1869,9 @@ void EditInstrument::ctrlTypeChanged(int idx) spinBoxDefault->blockSignals(true); switch (t) { - //case MidiController::RPN: - //case MidiController::NRPN: - case MidiController::Controller7: + //case MusECore::MidiController::RPN: + //case MusECore::MidiController::NRPN: + case MusECore::MidiController::Controller7: spinBoxHCtrlNo->setEnabled(false); spinBoxLCtrlNo->setEnabled(true); spinBoxMin->setEnabled(true); @@ -1900,8 +1902,8 @@ void EditInstrument::ctrlTypeChanged(int idx) item->setText(COL_DEF, QString("---")); //} break; - case MidiController::RPN: - case MidiController::NRPN: + case MusECore::MidiController::RPN: + case MusECore::MidiController::NRPN: spinBoxHCtrlNo->setEnabled(true); spinBoxLCtrlNo->setEnabled(true); spinBoxMin->setEnabled(true); @@ -1934,9 +1936,9 @@ void EditInstrument::ctrlTypeChanged(int idx) item->setText(COL_DEF, QString("---")); //} break; - case MidiController::Controller14: - case MidiController::RPN14: - case MidiController::NRPN14: + case MusECore::MidiController::Controller14: + case MusECore::MidiController::RPN14: + case MusECore::MidiController::NRPN14: spinBoxHCtrlNo->setEnabled(true); spinBoxLCtrlNo->setEnabled(true); spinBoxMin->setEnabled(true); @@ -1969,7 +1971,7 @@ void EditInstrument::ctrlTypeChanged(int idx) item->setText(COL_DEF, QString("---")); //} break; - case MidiController::Pitch: + case MusECore::MidiController::Pitch: spinBoxHCtrlNo->setEnabled(false); spinBoxLCtrlNo->setEnabled(false); spinBoxMin->setEnabled(true); @@ -1995,7 +1997,7 @@ void EditInstrument::ctrlTypeChanged(int idx) item->setText(COL_DEF, QString("---")); //} break; - case MidiController::Program: + case MusECore::MidiController::Program: spinBoxHCtrlNo->setEnabled(false); spinBoxLCtrlNo->setEnabled(false); spinBoxMin->setEnabled(false); @@ -2039,10 +2041,10 @@ void EditInstrument::ctrlTypeChanged(int idx) spinBoxMax->blockSignals(false); spinBoxDefault->blockSignals(false); - c->setNum(MidiController::genNum(t, hnum, lnum)); + c->setNum(MusECore::MidiController::genNum(t, hnum, lnum)); setDefaultPatchControls(0xffffff); - if(t == MidiController::Program) + if(t == MusECore::MidiController::Program) { c->setMinVal(0); c->setMaxVal(0xffffff); @@ -2053,7 +2055,7 @@ void EditInstrument::ctrlTypeChanged(int idx) c->setMinVal(spinBoxMin->value()); c->setMaxVal(spinBoxMax->value()); if(spinBoxDefault->value() == spinBoxDefault->minimum()) - c->setInitVal(CTRL_VAL_UNKNOWN); + c->setInitVal(MusECore::CTRL_VAL_UNKNOWN); else c->setInitVal(spinBoxDefault->value()); } @@ -2108,7 +2110,7 @@ void EditInstrument::ctrlTypeChanged(int idx) spinBoxDefault->setRange(spinBoxMin->value() - 1, spinBoxMax->value()); int inval = c->initVal(); - if(inval == CTRL_VAL_UNKNOWN) + if(inval == MusECore::CTRL_VAL_UNKNOWN) spinBoxDefault->setValue(spinBoxDefault->minimum()); else { @@ -2147,7 +2149,7 @@ void EditInstrument::ctrlHNumChanged(int val) return; QString s; s.setNum(val); - MidiController* c = (MidiController*)item->data(0, Qt::UserRole).value<void*>(); + MusECore::MidiController* c = (MusECore::MidiController*)item->data(0, Qt::UserRole).value<void*>(); //int n = c->num() & 0xff; int n = c->num() & 0x7fff00ff; c->setNum(n | ((val & 0xff) << 8)); @@ -2165,7 +2167,7 @@ void EditInstrument::ctrlLNumChanged(int val) if (item == 0) return; - MidiController* c = (MidiController*)item->data(0, Qt::UserRole).value<void*>(); + MusECore::MidiController* c = (MusECore::MidiController*)item->data(0, Qt::UserRole).value<void*>(); //int n = c->num() & 0xff00; int n = c->num() & ~0xff; c->setNum(n | (val & 0xff)); @@ -2195,22 +2197,22 @@ void EditInstrument::ctrlMinChanged(int val) s.setNum(val); item->setText(COL_MIN, s); - MidiController* c = (MidiController*)item->data(0, Qt::UserRole).value<void*>(); + MusECore::MidiController* c = (MusECore::MidiController*)item->data(0, Qt::UserRole).value<void*>(); c->setMinVal(val); int rng = 0; - //switch((MidiController::ControllerType)ctrlType->currentItem()) - switch(midiControllerType(c->num())) + //switch((MusECore::MidiController::ControllerType)ctrlType->currentItem()) + switch(MusECore::midiControllerType(c->num())) { - case MidiController::Controller7: - case MidiController::RPN: - case MidiController::NRPN: + case MusECore::MidiController::Controller7: + case MusECore::MidiController::RPN: + case MusECore::MidiController::NRPN: rng = 127; break; - case MidiController::Controller14: - case MidiController::RPN14: - case MidiController::NRPN14: - case MidiController::Pitch: + case MusECore::MidiController::Controller14: + case MusECore::MidiController::RPN14: + case MusECore::MidiController::NRPN14: + case MusECore::MidiController::Pitch: rng = 16383; break; default: @@ -2244,7 +2246,7 @@ void EditInstrument::ctrlMinChanged(int val) spinBoxDefault->setRange(spinBoxMin->value() - 1, spinBoxMax->value()); int inval = c->initVal(); - if(inval == CTRL_VAL_UNKNOWN) + if(inval == MusECore::CTRL_VAL_UNKNOWN) spinBoxDefault->setValue(spinBoxDefault->minimum()); else { @@ -2281,22 +2283,22 @@ void EditInstrument::ctrlMaxChanged(int val) s.setNum(val); item->setText(COL_MAX, s); - MidiController* c = (MidiController*)item->data(0, Qt::UserRole).value<void*>(); + MusECore::MidiController* c = (MusECore::MidiController*)item->data(0, Qt::UserRole).value<void*>(); c->setMaxVal(val); int rng = 0; - //switch((MidiController::ControllerType)ctrlType->currentItem()) - switch(midiControllerType(c->num())) + //switch((MusECore::MidiController::ControllerType)ctrlType->currentItem()) + switch(MusECore::midiControllerType(c->num())) { - case MidiController::Controller7: - case MidiController::RPN: - case MidiController::NRPN: + case MusECore::MidiController::Controller7: + case MusECore::MidiController::RPN: + case MusECore::MidiController::NRPN: rng = 127; break; - case MidiController::Controller14: - case MidiController::RPN14: - case MidiController::NRPN14: - case MidiController::Pitch: + case MusECore::MidiController::Controller14: + case MusECore::MidiController::RPN14: + case MusECore::MidiController::NRPN14: + case MusECore::MidiController::Pitch: rng = 16383; break; default: @@ -2330,7 +2332,7 @@ void EditInstrument::ctrlMaxChanged(int val) spinBoxDefault->setRange(spinBoxMin->value() - 1, spinBoxMax->value()); int inval = c->initVal(); - if(inval == CTRL_VAL_UNKNOWN) + if(inval == MusECore::CTRL_VAL_UNKNOWN) spinBoxDefault->setValue(spinBoxDefault->minimum()); else { @@ -2363,11 +2365,11 @@ void EditInstrument::ctrlDefaultChanged(int val) if (item == 0) return; - MidiController* c = (MidiController*)item->data(0, Qt::UserRole).value<void*>(); + MusECore::MidiController* c = (MusECore::MidiController*)item->data(0, Qt::UserRole).value<void*>(); if(val == c->minVal() - 1) { - c->setInitVal(CTRL_VAL_UNKNOWN); + c->setInitVal(MusECore::CTRL_VAL_UNKNOWN); item->setText(COL_DEF, QString("---")); } else @@ -2450,8 +2452,8 @@ void EditInstrument::deletePatchClicked() // ListBoxData* item = (ListBoxData*)instrumentList->selectedItem(); // if (item == 0) // return; - //MidiInstrument* instrument = (MidiInstrument*)item->data(Qt::UserRole).value<void*>(); -// MidiInstrument* instrument = (MidiInstrument*)item->data(); + //MusECore::MidiInstrument* instrument = (MusECore::MidiInstrument*)item->data(Qt::UserRole).value<void*>(); +// MusECore::MidiInstrument* instrument = (MusECore::MidiInstrument*)item->data(); //QTreeWidgetItem* pi = patchView->currentItem(); QTreeWidgetItem* pi = patchView->currentItem(); @@ -2459,7 +2461,7 @@ void EditInstrument::deletePatchClicked() return; //void* p = pi->data(0, Qt::UserRole).value<void*>(); -// Patch* patch = (Patch*)pi->data(); +// MusECore::Patch* patch = (MusECore::Patch*)pi->data(); //if (p == 0) // If patch is zero it's a patch group. // if(patch == 0) @@ -2467,11 +2469,11 @@ void EditInstrument::deletePatchClicked() // If the item has a parent item, it's a patch item... if(pi->parent()) { - PatchGroup* group = (PatchGroup*)(pi->parent())->data(0, Qt::UserRole).value<void*>(); + MusECore::PatchGroup* group = (MusECore::PatchGroup*)(pi->parent())->data(0, Qt::UserRole).value<void*>(); // If there is an allocated patch in the data, delete it. - //Patch* patch = (Patch*)pi->auxData(); - Patch* patch = (Patch*)pi->data(0, Qt::UserRole).value<void*>(); + //MusECore::Patch* patch = (MusECore::Patch*)pi->auxData(); + MusECore::Patch* patch = (MusECore::Patch*)pi->data(0, Qt::UserRole).value<void*>(); if(patch) { if(group) @@ -2496,14 +2498,14 @@ void EditInstrument::deletePatchClicked() // The item has no parent item, it's a patch group item... { // Is there an allocated patch group in the data? - //PatchGroup* group = (PatchGroup*)pi->auxData(); - PatchGroup* group = (PatchGroup*)pi->data(0, Qt::UserRole).value<void*>(); + //MusECore::PatchGroup* group = (MusECore::PatchGroup*)pi->auxData(); + MusECore::PatchGroup* group = (MusECore::PatchGroup*)pi->data(0, Qt::UserRole).value<void*>(); if(group) { - PatchGroupList* pg = workingInstrument.groups(); - //for(ciPatchGroup ipg = pg->begin(); ipg != pg->end(); ++ipg) - for(iPatchGroup ipg = pg->begin(); ipg != pg->end(); ++ipg) + MusECore::PatchGroupList* pg = workingInstrument.groups(); + //for(MusECore::ciPatchGroup ipg = pg->begin(); ipg != pg->end(); ++ipg) + for(MusECore::iPatchGroup ipg = pg->begin(); ipg != pg->end(); ++ipg) { //printf("deletePatchClicked: working patch group name:%s ad:%X group name:%s ad:%X\n", (*ipg)->name.toLatin1().constData(), (unsigned int)(*ipg), group->name.toLatin1().constData(), (unsigned int) group); @@ -2519,14 +2521,14 @@ void EditInstrument::deletePatchClicked() // Iterate all child list view (patch) items. Find and delete any allocated patches in the items' data. // for(ListViewData* i = (ListViewData*)pi->firstChild(); i; i = (ListViewData*)i->nextSibling()) // { - //Patch* patch = (Patch*)i->auxData(); -// Patch* patch = (Patch*)i->data(); + //MusECore::Patch* patch = (MusECore::Patch*)i->auxData(); +// MusECore::Patch* patch = (MusECore::Patch*)i->data(); // if(patch) // { //delete patch; //group->patches.remove(*patch); - const PatchList& pl = group->patches; - for(ciPatch ip = pl.begin(); ip != pl.end(); ++ip) + const MusECore::PatchList& pl = group->patches; + for(MusECore::ciPatch ip = pl.begin(); ip != pl.end(); ++ip) { // if(&*ip == patch) // { @@ -2564,11 +2566,11 @@ void EditInstrument::deletePatchClicked() oldPatchItem = 0; patchChanged(); - //Patch* patch = (Patch*)p; + //MusECore::Patch* patch = (MusECore::Patch*)p; - //std::vector<PatchGroup>* pg = instrument->groups(); - //for (std::vector<PatchGroup>::iterator g = pg->begin(); g != pg->end(); ++g) { - // for (iPatch p = g->patches.begin(); p != g->patches.end(); ++p) { + //std::vector<MusECore::PatchGroup>* pg = instrument->groups(); + //for (std::vector<MusECore::PatchGroup>::iterator g = pg->begin(); g != pg->end(); ++g) { + // for (MusECore::iPatch p = g->patches.begin(); p != g->patches.end(); ++p) { // if (patch == *p) { // g->patches.erase(p); // delete pi; @@ -2599,26 +2601,26 @@ void EditInstrument::newPatchClicked() if(oldPatchItem) { if(oldPatchItem->parent()) - updatePatch(&workingInstrument, (Patch*)oldPatchItem->data(0, Qt::UserRole).value<void*>()); + updatePatch(&workingInstrument, (MusECore::Patch*)oldPatchItem->data(0, Qt::UserRole).value<void*>()); else - updatePatchGroup(&workingInstrument, (PatchGroup*)oldPatchItem->data(0, Qt::UserRole).value<void*>()); + updatePatchGroup(&workingInstrument, (MusECore::PatchGroup*)oldPatchItem->data(0, Qt::UserRole).value<void*>()); } - //MidiInstrument* instrument = (MidiInstrument*)item->data(Qt::UserRole).value<void*>(); -// MidiInstrument* instrument = (MidiInstrument*)item->data(); - //std::vector<PatchGroup>* pg = instrument->groups(); -// PatchGroupList* pg = instrument->groups(); - PatchGroupList* pg = workingInstrument.groups(); + //MusECore::MidiInstrument* instrument = (MusECore::MidiInstrument*)item->data(Qt::UserRole).value<void*>(); +// MusECore::MidiInstrument* instrument = (MusECore::MidiInstrument*)item->data(); + //std::vector<MusECore::PatchGroup>* pg = instrument->groups(); +// MusECore::PatchGroupList* pg = instrument->groups(); + MusECore::PatchGroupList* pg = workingInstrument.groups(); QString patchName; for (int i = 1;; ++i) { patchName = QString("Patch-%1").arg(i); bool found = false; - //for (std::vector<PatchGroup>::iterator g = pg->begin(); g != pg->end(); ++g) { - for (iPatchGroup g = pg->begin(); g != pg->end(); ++g) { - PatchGroup* pgp = *g; - //for (iPatch p = g->patches.begin(); p != g->patches.end(); ++p) { - for (iPatch p = pgp->patches.begin(); p != pgp->patches.end(); ++p) { + //for (std::vector<MusECore::PatchGroup>::iterator g = pg->begin(); g != pg->end(); ++g) { + for (MusECore::iPatchGroup g = pg->begin(); g != pg->end(); ++g) { + MusECore::PatchGroup* pgp = *g; + //for (MusECore::iPatch p = g->patches.begin(); p != g->patches.end(); ++p) { + for (MusECore::iPatch p = pgp->patches.begin(); p != pgp->patches.end(); ++p) { //if (p->name == patchName) { if ((*p)->name == patchName) { found = true; @@ -2635,7 +2637,7 @@ void EditInstrument::newPatchClicked() // // search current patch group // - //PatchGroup* pGroup = 0; + //MusECore::PatchGroup* pGroup = 0; //QTreeWidgetItem* pi = patchView->currentItem(); QTreeWidgetItem* pi = patchView->currentItem(); @@ -2646,23 +2648,23 @@ void EditInstrument::newPatchClicked() //if (pi->data(0, Qt::UserRole).value<void*>()) //if (pi->data()) - Patch* selpatch = 0; + MusECore::Patch* selpatch = 0; // If there is a parent item then pi is a patch item, and there must be a parent patch group item. if(pi->parent()) { // Remember the current selected patch. - selpatch = (Patch*)pi->data(0, Qt::UserRole).value<void*>(); + selpatch = (MusECore::Patch*)pi->data(0, Qt::UserRole).value<void*>(); pi = pi->parent(); } - PatchGroup* group = (PatchGroup*)pi->data(0, Qt::UserRole).value<void*>(); + MusECore::PatchGroup* group = (MusECore::PatchGroup*)pi->data(0, Qt::UserRole).value<void*>(); if(!group) return; - //for (std::vector<PatchGroup>::iterator g = pg->begin(); g != pg->end(); ++g) { -// for (ciPatchGroup g = pg->begin(); g != pg->end(); ++g) { + //for (std::vector<MusECore::PatchGroup>::iterator g = pg->begin(); g != pg->end(); ++g) { +// for (MusECore::ciPatchGroup g = pg->begin(); g != pg->end(); ++g) { // if (g->name == pi->text(0)) { // pGroup = &*g; // break; @@ -2677,7 +2679,7 @@ void EditInstrument::newPatchClicked() // to be added later to the patch group only upon save... //Patch patch; //patch.name = patchName; - Patch* patch = new Patch; + MusECore::Patch* patch = new MusECore::Patch; int hb = -1; int lb = -1; int prg = 0; @@ -2708,12 +2710,12 @@ void EditInstrument::newPatchClicked() { found = false; - for(iPatchGroup g = pg->begin(); g != pg->end(); ++g) + for(MusECore::iPatchGroup g = pg->begin(); g != pg->end(); ++g) { - PatchGroup* pgp = *g; - for(iPatch ip = pgp->patches.begin(); ip != pgp->patches.end(); ++ip) + MusECore::PatchGroup* pgp = *g; + for(MusECore::iPatch ip = pgp->patches.begin(); ip != pgp->patches.end(); ++ip) { - Patch* p = *ip; + MusECore::Patch* p = *ip; if((p->prog == ((prg + i) & 0x7f)) && ((p->lbank == -1 && lb == -1) || (p->lbank == ((lb + j) & 0x7f))) && ((p->hbank == -1 && hb == -1) || (p->hbank == ((hb + k) & 0x7f)))) @@ -2755,7 +2757,7 @@ void EditInstrument::newPatchClicked() patch->name = patchName; group->patches.push_back(patch); - //Patch* pp = &(group->patches.back()); + //MusECore::Patch* pp = &(group->patches.back()); //QTreeWidgetItem* sitem = new QTreeWidgetItem; QTreeWidgetItem* sitem = new QTreeWidgetItem(pi); @@ -2823,23 +2825,23 @@ void EditInstrument::newGroupClicked() if(oldPatchItem) { if(oldPatchItem->parent()) - updatePatch(&workingInstrument, (Patch*)oldPatchItem->data(0, Qt::UserRole).value<void*>()); + updatePatch(&workingInstrument, (MusECore::Patch*)oldPatchItem->data(0, Qt::UserRole).value<void*>()); else - updatePatchGroup(&workingInstrument, (PatchGroup*)oldPatchItem->data(0, Qt::UserRole).value<void*>()); + updatePatchGroup(&workingInstrument, (MusECore::PatchGroup*)oldPatchItem->data(0, Qt::UserRole).value<void*>()); } - //MidiInstrument* instrument = (MidiInstrument*)item->data(Qt::UserRole).value<void*>(); -// MidiInstrument* instrument = (MidiInstrument*)item->data(); - //std::vector<PatchGroup>* pg = instrument->groups(); -// PatchGroupList* pg = instrument->groups(); - PatchGroupList* pg = workingInstrument.groups(); + //MusECore::MidiInstrument* instrument = (MusECore::MidiInstrument*)item->data(Qt::UserRole).value<void*>(); +// MusECore::MidiInstrument* instrument = (MusECore::MidiInstrument*)item->data(); + //std::vector<MusECore::PatchGroup>* pg = instrument->groups(); +// MusECore::PatchGroupList* pg = instrument->groups(); + MusECore::PatchGroupList* pg = workingInstrument.groups(); QString groupName; for (int i = 1;; ++i) { groupName = QString("Group-%1").arg(i); bool found = false; - //for (std::vector<PatchGroup>::iterator g = pg->begin(); g != pg->end(); ++g) { - for (ciPatchGroup g = pg->begin(); g != pg->end(); ++g) { + //for (std::vector<MusECore::PatchGroup>::iterator g = pg->begin(); g != pg->end(); ++g) { + for (MusECore::ciPatchGroup g = pg->begin(); g != pg->end(); ++g) { //if (g->name == groupName) { if ((*g)->name == groupName) { found = true; @@ -2852,13 +2854,13 @@ void EditInstrument::newGroupClicked() // Create a new PatchGroup, then store its pointer in a new patch group item, // to be added later to the instrument only upon save... - PatchGroup* group = new PatchGroup; + MusECore::PatchGroup* group = new MusECore::PatchGroup; group->name = groupName; - //PatchGroup group; + //MusECore::PatchGroup group; //group.name = groupName; pg->push_back(group); - //PatchGroup* pgp = &(pg->back()); + //MusECore::PatchGroup* pgp = &(pg->back()); QTreeWidgetItem* sitem = new QTreeWidgetItem(patchView); sitem->setText(0, groupName); @@ -2916,14 +2918,14 @@ void EditInstrument::deleteControllerClicked() //if (item == 0 || item2 == 0) if(!item) return; - //MidiInstrument* instrument = (MidiInstrument*)item->data(Qt::UserRole).value<void*>(); -// MidiInstrument* instrument = (MidiInstrument*)item->data(); - //MidiController* ctrl = (MidiController*)item2->data(Qt::UserRole).value<void*>(); - //MidiController* ctrl = (MidiController*)item2->data(); - //MidiControllerList* cl = instrument->controller(); + //MusECore::MidiInstrument* instrument = (MusECore::MidiInstrument*)item->data(Qt::UserRole).value<void*>(); +// MusECore::MidiInstrument* instrument = (MusECore::MidiInstrument*)item->data(); + //MusECore::MidiController* ctrl = (MusECore::MidiController*)item2->data(Qt::UserRole).value<void*>(); + //MusECore::MidiController* ctrl = (MusECore::MidiController*)item2->data(); + //MusECore::MidiControllerList* cl = instrument->controller(); //cl->removeAll(ctrl); - MidiController* ctrl = (MidiController*)item->data(0, Qt::UserRole).value<void*>(); + MusECore::MidiController* ctrl = (MusECore::MidiController*)item->data(0, Qt::UserRole).value<void*>(); if(!ctrl) return; @@ -2959,20 +2961,20 @@ void EditInstrument::newControllerClicked() //QListWidgetItem* item = instrumentList->currentItem(); //if (item == 0) // return; - //MidiInstrument* instrument = (MidiInstrument*)item->data(Qt::UserRole).value<void*>(); + //MusECore::MidiInstrument* instrument = (MusECore::MidiInstrument*)item->data(Qt::UserRole).value<void*>(); // if(oldController) -// updateController(&workingInstrument, (MidiController*)oldController->data()); +// updateController(&workingInstrument, (MusECore::MidiController*)oldController->data()); QString cName; - //MidiControllerList* cl = instrument->controller(); - MidiControllerList* cl = workingInstrument.controller(); + //MusECore::MidiControllerList* cl = instrument->controller(); + MusECore::MidiControllerList* cl = workingInstrument.controller(); for (int i = 1;; ++i) { //ctrlName = QString("Controller-%d").arg(i); cName = QString("Controller-%1").arg(i); bool found = false; - for (iMidiController ic = cl->begin(); ic != cl->end(); ++ic) { - MidiController* c = ic->second; + for (MusECore::iMidiController ic = cl->begin(); ic != cl->end(); ++ic) { + MusECore::MidiController* c = ic->second; if (c->name() == cName) { found = true; break; @@ -2982,11 +2984,11 @@ void EditInstrument::newControllerClicked() break; } - MidiController* ctrl = new MidiController(); - ctrl->setNum(CTRL_MODULATION); + MusECore::MidiController* ctrl = new MusECore::MidiController(); + ctrl->setNum(MusECore::CTRL_MODULATION); ctrl->setMinVal(0); ctrl->setMaxVal(127); - ctrl->setInitVal(CTRL_VAL_UNKNOWN); + ctrl->setInitVal(MusECore::CTRL_VAL_UNKNOWN); QTreeWidgetItem* ci = viewController->currentItem(); @@ -2995,7 +2997,7 @@ void EditInstrument::newControllerClicked() bool found = false; if(ci) { - MidiController* selctl = (MidiController*)ci->data(0, Qt::UserRole).value<void*>(); + MusECore::MidiController* selctl = (MusECore::MidiController*)ci->data(0, Qt::UserRole).value<void*>(); // Assign. // *ctrl = *selctl; @@ -3018,9 +3020,9 @@ void EditInstrument::newControllerClicked() //cName = QString("Controller-%1").arg(i); int j = ((i + l) & 0x7f) | h; found = false; - for (iMidiController ic = cl->begin(); ic != cl->end(); ++ic) + for (MusECore::iMidiController ic = cl->begin(); ic != cl->end(); ++ic) { - MidiController* c = ic->second; + MusECore::MidiController* c = ic->second; if(c->num() == j) { found = true; @@ -3089,7 +3091,7 @@ void EditInstrument::addControllerClicked() QString name = listController->currentItem()->text(); for(int i = 0; i < 128; i++) { - if(midiCtrlName(i) == name) + if(MusECore::midiCtrlName(i) == name) { lnum = i; break; @@ -3101,12 +3103,12 @@ void EditInstrument::addControllerClicked() return; } - int num = MidiController::genNum(MidiController::Controller7, 0, lnum); + int num = MusECore::MidiController::genNum(MusECore::MidiController::Controller7, 0, lnum); - MidiControllerList* cl = workingInstrument.controller(); - for(iMidiController ic = cl->begin(); ic != cl->end(); ++ic) + MusECore::MidiControllerList* cl = workingInstrument.controller(); + for(MusECore::iMidiController ic = cl->begin(); ic != cl->end(); ++ic) { - MidiController* c = ic->second; + MusECore::MidiController* c = ic->second; if(c->name() == name) { QMessageBox::critical(this, @@ -3132,11 +3134,11 @@ void EditInstrument::addControllerClicked() } } - MidiController* ctrl = new MidiController(); + MusECore::MidiController* ctrl = new MusECore::MidiController(); ctrl->setNum(num); ctrl->setMinVal(0); ctrl->setMaxVal(127); - ctrl->setInitVal(CTRL_VAL_UNKNOWN); + ctrl->setInitVal(MusECore::CTRL_VAL_UNKNOWN); ctrl->setName(name); workingInstrument.controller()->add(ctrl); @@ -3164,7 +3166,7 @@ void EditInstrument::deleteSysexClicked() //if (item == 0 || item2 == 0) // return; - //MidiInstrument* instrument = (MidiInstrument*)item->data(Qt::UserRole).value<void*>(); + //MusECore::MidiInstrument* instrument = (MusECore::MidiInstrument*)item->data(Qt::UserRole).value<void*>(); //SysEx* sysex = (SysEx*)item2->data(Qt::UserRole).value<void*>(); //QList<SysEx*> sl = instrument->sysex(); //instrument->removeSysex(sysex); @@ -3188,7 +3190,7 @@ void EditInstrument::deleteSysexClicked() // updatePatchGroup //--------------------------------------------------------- -void EditInstrument::updatePatchGroup(MidiInstrument* instrument, PatchGroup* pg) +void EditInstrument::updatePatchGroup(MusECore::MidiInstrument* instrument, MusECore::PatchGroup* pg) { QString a = pg->name; QString b = patchNameEdit->text(); @@ -3202,7 +3204,7 @@ void EditInstrument::updatePatchGroup(MidiInstrument* instrument, PatchGroup* pg // updatePatch //--------------------------------------------------------- -void EditInstrument::updatePatch(MidiInstrument* instrument, Patch* p) +void EditInstrument::updatePatch(MusECore::MidiInstrument* instrument, MusECore::Patch* p) { if (p->name != patchNameEdit->text()) { p->name = patchNameEdit->text(); @@ -3269,15 +3271,15 @@ void EditInstrument::updatePatch(MidiInstrument* instrument, Patch* p) // updateController //--------------------------------------------------------- -void EditInstrument::updateController(MidiInstrument* instrument, MidiController* oc) +void EditInstrument::updateController(MusECore::MidiInstrument* instrument, MusECore::MidiController* oc) { printf("updateController: A\n"); int ctrlH = spinBoxHCtrlNo->value(); int ctrlL = spinBoxLCtrlNo->value(); - //MidiController::ControllerType type = (MidiController::ControllerType)ctrlType->currentIndex(); - MidiController::ControllerType type = (MidiController::ControllerType)ctrlType->currentItem(); - int num = MidiController::genNum(type, ctrlH, ctrlL); + //MusECore::MidiController::ControllerType type = (MusECore::MidiController::ControllerType)ctrlType->currentIndex(); + MusECore::MidiController::ControllerType type = (MusECore::MidiController::ControllerType)ctrlType->currentItem(); + int num = MusECore::MidiController::genNum(type, ctrlH, ctrlL); //int num = (ctrlH << 8) & 0x7f + ctrlL & 0x7f; printf("updateController: B\n"); @@ -3290,7 +3292,7 @@ void EditInstrument::updateController(MidiInstrument* instrument, MidiController instrument->setDirty(true); } - if(type != MidiController::Pitch && type != MidiController::Program) + if(type != MusECore::MidiController::Pitch && type != MusECore::MidiController::Program) { if (spinBoxMin->value() != oc->minVal()) { @@ -3309,7 +3311,7 @@ void EditInstrument::updateController(MidiInstrument* instrument, MidiController int dv = spinBoxDefault->value(); if(dv == oc->minVal() - 1) - dv = CTRL_VAL_UNKNOWN; + dv = MusECore::CTRL_VAL_UNKNOWN; //if (spinBoxDefault->value() != oc->initVal()) { if(dv != oc->initVal()) { @@ -3350,7 +3352,7 @@ void EditInstrument::updateController(MidiInstrument* instrument, MidiController // updateInstrument //--------------------------------------------------------- -void EditInstrument::updateInstrument(MidiInstrument* instrument) +void EditInstrument::updateInstrument(MusECore::MidiInstrument* instrument) { //QListWidgetItem* sysexItem = sysexList->currentItem(); //ListBoxData* sysexItem = sysexList->currentItem(); @@ -3365,11 +3367,11 @@ void EditInstrument::updateInstrument(MidiInstrument* instrument) // ListViewData* ctrlItem = (ListViewData*)viewController->selectedItem(); // if (ctrlItem) { - //MidiController* ctrl = (MidiController*)ctrlItem->data(Qt::UserRole).value<void*>(); + //MusECore::MidiController* ctrl = (MusECore::MidiController*)ctrlItem->data(Qt::UserRole).value<void*>(); // printf("updateInstrument: AB\n"); -// MidiController* ctrl = (MidiController*)ctrlItem->data(); +// MusECore::MidiController* ctrl = (MusECore::MidiController*)ctrlItem->data(); // printf("updateInstrument: AC\n"); @@ -3382,13 +3384,13 @@ void EditInstrument::updateInstrument(MidiInstrument* instrument) if (patchItem) { - //Patch* p = (Patch*)patchItem->data(0, Qt::UserRole).value<void*>(); + //MusECore::Patch* p = (MusECore::Patch*)patchItem->data(0, Qt::UserRole).value<void*>(); // If the item has a parent, it's a patch item. if(patchItem->parent()) - updatePatch(instrument, (Patch*)patchItem->data(0, Qt::UserRole).value<void*>()); + updatePatch(instrument, (MusECore::Patch*)patchItem->data(0, Qt::UserRole).value<void*>()); else - updatePatchGroup(instrument, (PatchGroup*)patchItem->data(0, Qt::UserRole).value<void*>()); + updatePatchGroup(instrument, (MusECore::PatchGroup*)patchItem->data(0, Qt::UserRole).value<void*>()); } } @@ -3398,7 +3400,7 @@ void EditInstrument::updateInstrument(MidiInstrument* instrument) // return true on Abort //--------------------------------------------------------- -int EditInstrument::checkDirty(MidiInstrument* i, bool isClose) +int EditInstrument::checkDirty(MusECore::MidiInstrument* i, bool isClose) { updateInstrument(i); if (!i->dirty()) @@ -3451,7 +3453,7 @@ int EditInstrument::checkDirty(MidiInstrument* i, bool isClose) QString EditInstrument::getPatchItemText(int val) { QString s; - if(val == CTRL_VAL_UNKNOWN) + if(val == MusECore::CTRL_VAL_UNKNOWN) s = "---"; else { @@ -3529,7 +3531,7 @@ void EditInstrument::setDefaultPatchNumbers(int val) int lb; int pr; - if(val == CTRL_VAL_UNKNOWN) + if(val == MusECore::CTRL_VAL_UNKNOWN) hb = lb = pr = 0; else { @@ -3547,7 +3549,7 @@ void EditInstrument::setDefaultPatchNumbers(int val) defPatchH->blockSignals(true); defPatchL->blockSignals(true); defPatchProg->blockSignals(true); - defPatchH->setValue(hb); + defPatchH->setValue(hb); defPatchL->setValue(lb); defPatchProg->setValue(pr); defPatchH->blockSignals(false); @@ -3572,7 +3574,7 @@ void EditInstrument::setDefaultPatchControls(int val) QString EditInstrument::getPatchName(int prog) { int pr = prog & 0xff; - if(prog == CTRL_VAL_UNKNOWN || pr == 0xff) + if(prog == MusECore::CTRL_VAL_UNKNOWN || pr == 0xff) return "---"; //int hbank = (prog >> 16) & 0x7f; @@ -3580,12 +3582,12 @@ QString EditInstrument::getPatchName(int prog) int hbank = (prog >> 16) & 0xff; int lbank = (prog >> 8) & 0xff; - PatchGroupList* pg = workingInstrument.groups(); + MusECore::PatchGroupList* pg = workingInstrument.groups(); - for(ciPatchGroup i = pg->begin(); i != pg->end(); ++i) { - const PatchList& pl = (*i)->patches; - for (ciPatch ipl = pl.begin(); ipl != pl.end(); ++ipl) { - const Patch* mp = *ipl; + for(MusECore::ciPatchGroup i = pg->begin(); i != pg->end(); ++i) { + const MusECore::PatchList& pl = (*i)->patches; + for (MusECore::ciPatch ipl = pl.begin(); ipl != pl.end(); ++ipl) { + const MusECore::Patch* mp = *ipl; if (//(mp->typ & tmask) && (pr == mp->prog) //&& ((drum && mode != MT_GM) || @@ -3601,3 +3603,4 @@ QString EditInstrument::getPatchName(int prog) return "---"; } +} // namespace MusEGui diff --git a/muse2/muse/instruments/editinstrument.h b/muse2/muse/instruments/editinstrument.h index 645a5b98..ba53aae1 100644 --- a/muse2/muse/instruments/editinstrument.h +++ b/muse2/muse/instruments/editinstrument.h @@ -32,6 +32,8 @@ class QDialog; class QMenu; class QCloseEvent; +namespace MusEGui { + //--------------------------------------------------------- // EditInstrument //--------------------------------------------------------- @@ -39,18 +41,18 @@ class QCloseEvent; class EditInstrument : public QMainWindow, public Ui::EditInstrumentBase { Q_OBJECT - MidiInstrument workingInstrument; + MusECore::MidiInstrument workingInstrument; QListWidgetItem* oldMidiInstrument; QTreeWidgetItem* oldPatchItem; void closeEvent(QCloseEvent*); - int checkDirty(MidiInstrument*, bool isClose = false); - bool fileSave(MidiInstrument*, const QString&); + int checkDirty(MusECore::MidiInstrument*, bool isClose = false); + bool fileSave(MusECore::MidiInstrument*, const QString&); void saveAs(); - void updateInstrument(MidiInstrument*); - void updatePatch(MidiInstrument*, Patch*); - void updatePatchGroup(MidiInstrument*, PatchGroup*); + void updateInstrument(MusECore::MidiInstrument*); + void updatePatch(MusECore::MidiInstrument*, MusECore::Patch*); + void updatePatchGroup(MusECore::MidiInstrument*, MusECore::PatchGroup*); void changeInstrument(); - QTreeWidgetItem* addControllerToView(MidiController* mctrl); + QTreeWidgetItem* addControllerToView(MusECore::MidiController* mctrl); QString getPatchItemText(int); void enableDefaultControls(bool, bool); void setDefaultPatchName(int); @@ -102,5 +104,7 @@ class EditInstrument : public QMainWindow, public Ui::EditInstrumentBase { EditInstrument(QWidget* parent = 0, Qt::WFlags fl = Qt::Window); }; +} // namespace MusEGui + #endif diff --git a/muse2/muse/instruments/midictrledit.cpp b/muse2/muse/instruments/midictrledit.cpp index 56f4cabf..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[] = { @@ -130,7 +132,7 @@ MidiControllerEditDialog::MidiControllerEditDialog(QWidget* parent, const char* updateViewController(); _modified = false; buttonApply->setEnabled(false); - connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); + connect(MusEGlobal::song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); } //--------------------------------------------------------- @@ -337,7 +339,7 @@ void MidiControllerEditDialog::apply() // Update the list before closing this dialog. //updateViewController(); //setModified(false); - song->update(SC_CONFIG | SC_MIDI_CONTROLLER); + MusEGlobal::song->update(SC_CONFIG | SC_MIDI_CONTROLLER); } //--------------------------------------------------------- @@ -738,3 +740,5 @@ void configMidiController() midiControllerEditDialog->show(); } } + +} // namespace MusEGui diff --git a/muse2/muse/instruments/minstrument.cpp b/muse2/muse/instruments/minstrument.cpp index 20bee129..8e8bb6c3 100644 --- a/muse2/muse/instruments/minstrument.cpp +++ b/muse2/muse/instruments/minstrument.cpp @@ -42,6 +42,7 @@ #include "gconfig.h" #include "popupmenu.h" +namespace MusECore { MidiInstrumentList midiInstruments; MidiInstrument* genericMidiInstrument; @@ -530,7 +531,7 @@ MidiInstrument& MidiInstrument::assign(const MidiInstrument& ins) void MidiInstrument::reset(int portNo, MType) { - MidiPort* port = &midiPorts[portNo]; + MusECore::MidiPort* port = &MusEGlobal::midiPorts[portNo]; //if (port == 0) // return; if(port->device() == 0) // p4.0.15 @@ -538,7 +539,7 @@ void MidiInstrument::reset(int portNo, MType) //printf("MidiInstrument::reset port device is 0\n"); return; } - MidiPlayEvent ev; + MusECore::MidiPlayEvent ev; ev.setType(0x90); ev.setPort(portNo); ev.setTime(0); // p4.0.15 @@ -935,7 +936,11 @@ QString MidiInstrument::getPatchName(int channel, int prog, MType mode, bool dru // populatePatchPopup //--------------------------------------------------------- -void MidiInstrument::populatePatchPopup(MusEWidget::PopupMenu* menu, int chan, MType songType, bool drum) +} // namespace MusECore + +namespace MusEGui { + +void populatePatchPopup(MusECore::MidiInstrument* midiInstrument, PopupMenu* menu, int chan, MType songType, bool drum) { menu->clear(); int mask = 0; @@ -947,7 +952,7 @@ void MidiInstrument::populatePatchPopup(MusEWidget::PopupMenu* menu, int chan, M if(drumchan) { int id = (0xff << 16) + (0xff << 8) + 0x00; // First patch - QAction* act = menu->addAction(gmdrumname); + QAction* act = menu->addAction(MusECore::gmdrumname); //act->setCheckable(true); act->setData(id); return; @@ -956,16 +961,16 @@ void MidiInstrument::populatePatchPopup(MusEWidget::PopupMenu* menu, int chan, M break; case MT_UNKNOWN: mask = 7; break; } - if (pg.size() > 1) { - for (ciPatchGroup i = pg.begin(); i != pg.end(); ++i) { - PatchGroup* pgp = *i; + if (midiInstrument->groups()->size() > 1) { + for (MusECore::ciPatchGroup i = midiInstrument->groups()->begin(); i != midiInstrument->groups()->end(); ++i) { + MusECore::PatchGroup* pgp = *i; //QMenu* pm = menu->addMenu(pgp->name); - MusEWidget::PopupMenu* pm = new MusEWidget::PopupMenu(pgp->name, menu, menu->stayOpen()); // Use the parent stayOpen here. + PopupMenu* pm = new PopupMenu(pgp->name, menu, menu->stayOpen()); // Use the parent stayOpen here. menu->addMenu(pm); - pm->setFont(MusEConfig::config.fonts[0]); - const PatchList& pl = pgp->patches; - for (ciPatch ipl = pl.begin(); ipl != pl.end(); ++ipl) { - const Patch* mp = *ipl; + pm->setFont(MusEGlobal::config.fonts[0]); + const MusECore::PatchList& pl = pgp->patches; + for (MusECore::ciPatch ipl = pl.begin(); ipl != pl.end(); ++ipl) { + const MusECore::Patch* mp = *ipl; if ((mp->typ & mask) && ((drum && songType != MT_GM) || (mp->drum == drumchan)) ) @@ -980,11 +985,11 @@ void MidiInstrument::populatePatchPopup(MusEWidget::PopupMenu* menu, int chan, M } } } - else if (pg.size() == 1 ){ + else if (midiInstrument->groups()->size() == 1 ){ // no groups - const PatchList& pl = pg.front()->patches; - for (ciPatch ipl = pl.begin(); ipl != pl.end(); ++ipl) { - const Patch* mp = *ipl; + const MusECore::PatchList& pl = midiInstrument->groups()->front()->patches; + for (MusECore::ciPatch ipl = pl.begin(); ipl != pl.end(); ++ipl) { + const MusECore::Patch* mp = *ipl; if (mp->typ & mask) { int id = ((mp->hbank & 0xff) << 16) + ((mp->lbank & 0xff) << 8) + (mp->prog & 0xff); @@ -996,3 +1001,4 @@ void MidiInstrument::populatePatchPopup(MusEWidget::PopupMenu* menu, int chan, M } } +} // namespace MusEGui diff --git a/muse2/muse/instruments/minstrument.h b/muse2/muse/instruments/minstrument.h index e7800eea..3a645d7f 100644 --- a/muse2/muse/instruments/minstrument.h +++ b/muse2/muse/instruments/minstrument.h @@ -30,15 +30,17 @@ class QString; +namespace MusEGui { +class PopupMenu; +} + +namespace MusECore { +class EventList; +class MidiControllerList; class MidiPort; class MidiPlayEvent; class Xml; -class EventList; -class MidiControllerList; -namespace MusEWidget { -class PopupMenu; -} //--------------------------------------------------------- // Patch @@ -141,7 +143,7 @@ class MidiInstrument { virtual void reset(int, MType); virtual QString getPatchName(int,int,MType,bool); //virtual void populatePatchPopup(QMenu*, int, MType, bool); - virtual void populatePatchPopup(MusEWidget::PopupMenu*, int, MType, bool); + //virtual void populatePatchPopup(MusEGui::PopupMenu*, int, MType, bool); void read(Xml&); void write(int level, Xml&); @@ -167,5 +169,10 @@ extern MidiInstrument* registerMidiInstrument(const QString&); extern void removeMidiInstrument(const QString& name); extern void removeMidiInstrument(const MidiInstrument* instr); +} // namespace MusECore + +namespace MusEGui { +extern void populatePatchPopup(MusECore::MidiInstrument*, PopupMenu*, int, MType, bool); +} #endif diff --git a/muse2/muse/key.cpp b/muse2/muse/key.cpp index 26dbfbde..1aa1c875 100644 --- a/muse2/muse/key.cpp +++ b/muse2/muse/key.cpp @@ -25,6 +25,8 @@ #include "key.h" #include "globals.h" +namespace MusECore { + int NKey::offsets[14] = { 0, 7, 14, -7, -(12), @@ -48,3 +50,4 @@ int Scale::width() const return i * 7; } +} // namespace MusECore diff --git a/muse2/muse/key.h b/muse2/muse/key.h index e895adf7..b6179bed 100644 --- a/muse2/muse/key.h +++ b/muse2/muse/key.h @@ -27,6 +27,9 @@ #include <stdio.h> class QPainter; class QPoint; + +namespace MusECore { + class Xml; //--------------------------------------------------------- @@ -65,5 +68,8 @@ class Scale { void setMajorMinor(bool f) { minor = f; } // true == minor int width() const; }; + +} // namespace MusECore + #endif diff --git a/muse2/muse/keyevent.cpp b/muse2/muse/keyevent.cpp index 1dfe09dc..9d95e0cc 100644 --- a/muse2/muse/keyevent.cpp +++ b/muse2/muse/keyevent.cpp @@ -31,7 +31,11 @@ #include "xml.h" #include "keyevent.h" -KeyList keymap; +namespace MusEGlobal { + MusECore::KeyList keymap; +} + +namespace MusECore { #define DEFAULT_KEY KEY_C @@ -259,5 +263,6 @@ int KeyEvent::read(Xml& xml) return 0; } +} // namespace MusECore diff --git a/muse2/muse/keyevent.h b/muse2/muse/keyevent.h index e3237d25..7a7ffe78 100644 --- a/muse2/muse/keyevent.h +++ b/muse2/muse/keyevent.h @@ -29,6 +29,8 @@ #define MAX_TICK (0x7fffffff/100) #endif +namespace MusECore { + class Xml; //don't change this enum! changing the numeric values will affect @@ -113,7 +115,10 @@ class KeyList : public KEYLIST { void delKey(unsigned tick); }; -extern KeyList keymap; +} // namespace MusECore +namespace MusEGlobal { +extern MusECore::KeyList keymap; +} #endif // KEYEVENT_H diff --git a/muse2/muse/liste/editevent.cpp b/muse2/muse/liste/editevent.cpp index 702e61e5..ce53069d 100644 --- a/muse2/muse/liste/editevent.cpp +++ b/muse2/muse/liste/editevent.cpp @@ -53,6 +53,8 @@ #include "midi.h" #include "popupmenu.h" +namespace MusEGui { + //--------------------------------------------------------- // string2qhex //--------------------------------------------------------- @@ -114,10 +116,10 @@ char* hex2string(QWidget* parent, const char* src, int& len) // getEvent //--------------------------------------------------------- -Event EditNoteDialog::getEvent(int tick, const Event& event, QWidget* parent) +MusECore::Event EditNoteDialog::getEvent(int tick, const MusECore::Event& event, QWidget* parent) { EditNoteDialog* dlg = new EditNoteDialog(tick, event, parent); - Event nevent; + MusECore::Event nevent; if (dlg->exec() == QDialog::Accepted) { nevent = dlg->event(); } @@ -125,10 +127,10 @@ Event EditNoteDialog::getEvent(int tick, const Event& event, QWidget* parent) return nevent; } -Event EditSysexDialog::getEvent(int tick, const Event& event, QWidget* parent) +MusECore::Event EditSysexDialog::getEvent(int tick, const MusECore::Event& event, QWidget* parent) { EditSysexDialog* dlg = new EditSysexDialog(tick, event, parent); - Event nevent; + MusECore::Event nevent; if (dlg->exec() == QDialog::Accepted) { nevent = dlg->event(); } @@ -136,10 +138,10 @@ Event EditSysexDialog::getEvent(int tick, const Event& event, QWidget* parent) return nevent; } -Event EditMetaDialog::getEvent(int tick, const Event& event, QWidget* parent) +MusECore::Event EditMetaDialog::getEvent(int tick, const MusECore::Event& event, QWidget* parent) { EditEventDialog* dlg = new EditMetaDialog(tick, event, parent); - Event nevent; + MusECore::Event nevent; if (dlg->exec() == QDialog::Accepted) { nevent = dlg->event(); } @@ -147,10 +149,10 @@ Event EditMetaDialog::getEvent(int tick, const Event& event, QWidget* parent) return nevent; } -Event EditCAfterDialog::getEvent(int tick, const Event& event, QWidget* parent) +MusECore::Event EditCAfterDialog::getEvent(int tick, const MusECore::Event& event, QWidget* parent) { EditEventDialog* dlg = new EditCAfterDialog(tick, event, parent); - Event nevent; + MusECore::Event nevent; if (dlg->exec() == QDialog::Accepted) { nevent = dlg->event(); } @@ -158,10 +160,10 @@ Event EditCAfterDialog::getEvent(int tick, const Event& event, QWidget* parent) return nevent; } -Event EditPAfterDialog::getEvent(int tick, const Event& event, QWidget* parent) +MusECore::Event EditPAfterDialog::getEvent(int tick, const MusECore::Event& event, QWidget* parent) { EditEventDialog* dlg = new EditPAfterDialog(tick, event, parent); - Event nevent; + MusECore::Event nevent; if (dlg->exec() == QDialog::Accepted) { nevent = dlg->event(); } @@ -204,7 +206,7 @@ EditEventDialog::EditEventDialog(QWidget* parent) // EditNoteDialog //--------------------------------------------------------- -EditNoteDialog::EditNoteDialog(int tick, const Event& event, +EditNoteDialog::EditNoteDialog(int tick, const MusECore::Event& event, QWidget* parent) : QDialog(parent) { @@ -229,9 +231,9 @@ EditNoteDialog::EditNoteDialog(int tick, const Event& event, // EditNoteDialog::event //--------------------------------------------------------- -Event EditNoteDialog::event() +MusECore::Event EditNoteDialog::event() { - Event event(Note); + MusECore::Event event(MusECore::Note); event.setTick(epos->pos().tick()); event.setA(pl->value()); event.setB(il2->value()); @@ -244,7 +246,7 @@ Event EditNoteDialog::event() // EditSysExDialog //--------------------------------------------------------- -EditSysexDialog::EditSysexDialog(int tick, const Event& event, +EditSysexDialog::EditSysexDialog(int tick, const MusECore::Event& event, QWidget* parent) : QDialog(parent) { @@ -273,9 +275,9 @@ EditSysexDialog::~EditSysexDialog() // EditSysExDialog::event //--------------------------------------------------------- -Event EditSysexDialog::event() +MusECore::Event EditSysexDialog::event() { - Event event(Sysex); + MusECore::Event event(MusECore::Sysex); event.setTick(epos->pos().tick()); event.setData(sysex, len); return event; @@ -300,7 +302,7 @@ void EditSysexDialog::accept() // EditMetaDialog //--------------------------------------------------------- -EditMetaDialog::EditMetaDialog(int tick, const Event& ev, +EditMetaDialog::EditMetaDialog(int tick, const MusECore::Event& ev, QWidget* parent) : EditEventDialog(parent) { @@ -312,7 +314,7 @@ EditMetaDialog::EditMetaDialog(int tick, const Event& ev, epos = new Awl::PosEdit; QLabel* l2 = new QLabel(tr("Meta Type")); - il2 = new MusEWidget::IntLabel(-1, 0, 127, this, -1); + il2 = new MusEGui::IntLabel(-1, 0, 127, this, -1); il2->setFixedWidth(100); il2->setFrame(true); il2->setDark(); @@ -328,7 +330,7 @@ EditMetaDialog::EditMetaDialog(int tick, const Event& ev, connect(hexButton, SIGNAL(toggled(bool)), SLOT(toggled(bool))); edit = new QTextEdit; - edit->setFont(MusEConfig::config.fonts[5]); + edit->setFont(MusEGlobal::config.fonts[5]); if (!ev.empty()) { epos->setValue(tick); @@ -363,7 +365,7 @@ EditMetaDialog::EditMetaDialog(int tick, const Event& ev, void EditMetaDialog::typeChanged(int val) { - typeLabel->setText(midiMetaName(val)); + typeLabel->setText(MusECore::midiMetaName(val)); } //--------------------------------------------------------- @@ -402,9 +404,9 @@ EditMetaDialog::~EditMetaDialog() // EditMetaDialog::event //--------------------------------------------------------- -Event EditMetaDialog::event() +MusECore::Event EditMetaDialog::event() { - Event event(Meta); + MusECore::Event event(MusECore::Meta); event.setTick(epos->pos().tick()); event.setA(il2->value()); event.setData(meta, len); // TODO ?? @@ -436,7 +438,7 @@ void EditMetaDialog::accept() // EditCAfterDialog //--------------------------------------------------------- -EditCAfterDialog::EditCAfterDialog(int tick, const Event& event, +EditCAfterDialog::EditCAfterDialog(int tick, const MusECore::Event& event, QWidget* parent) : EditEventDialog(parent) { @@ -447,7 +449,7 @@ EditCAfterDialog::EditCAfterDialog(int tick, const Event& event, epos = new Awl::PosEdit; QLabel* l2 = new QLabel(tr("Pressure")); - il2 = new MusEWidget::IntLabel(-1, 0, 127, this, -1); + il2 = new MusEGui::IntLabel(-1, 0, 127, this, -1); il2->setFrame(true); il2->setDark(); @@ -483,9 +485,9 @@ EditCAfterDialog::EditCAfterDialog(int tick, const Event& event, // EditCAfterDialog::event //--------------------------------------------------------- -Event EditCAfterDialog::event() +MusECore::Event EditCAfterDialog::event() { - Event event(CAfter); + MusECore::Event event(MusECore::CAfter); event.setTick(epos->pos().tick()); event.setA(il2->value()); return event; @@ -495,7 +497,7 @@ Event EditCAfterDialog::event() // EditPAfterDialog //--------------------------------------------------------- -EditPAfterDialog::EditPAfterDialog(int tick, const Event& event, +EditPAfterDialog::EditPAfterDialog(int tick, const MusECore::Event& event, QWidget* parent) : EditEventDialog(parent) { @@ -506,9 +508,9 @@ EditPAfterDialog::EditPAfterDialog(int tick, const Event& event, epos = new Awl::PosEdit; QLabel* l2 = new QLabel(tr("Pitch")); - pl = new MusEWidget::PitchEdit; + pl = new MusEGui::PitchEdit; QLabel* l3 = new QLabel(tr("Pressure")); - il2 = new MusEWidget::IntLabel(-1, 0, 127, this, -1); + il2 = new MusEGui::IntLabel(-1, 0, 127, this, -1); il2->setFrame(true); il2->setDark(); @@ -548,9 +550,9 @@ EditPAfterDialog::EditPAfterDialog(int tick, const Event& event, // EditPAfterDialog::event //--------------------------------------------------------- -Event EditPAfterDialog::event() +MusECore::Event EditPAfterDialog::event() { - Event event(PAfter); + MusECore::Event event(MusECore::PAfter); event.setTick(epos->pos().tick()); event.setA(pl->value()); event.setB(il2->value()); @@ -560,11 +562,11 @@ Event EditPAfterDialog::event() // getEvent //--------------------------------------------------------- -Event EditCtrlDialog::getEvent(int tick, const Event& event, - const MidiPart* part, QWidget* parent) +MusECore::Event EditCtrlDialog::getEvent(int tick, const MusECore::Event& event, + const MusECore::MidiPart* part, QWidget* parent) { EditCtrlDialog* dlg = new EditCtrlDialog(tick, event, part, parent); - Event nevent; + MusECore::Event nevent; if (dlg->exec() == QDialog::Accepted) { nevent = dlg->event(); } @@ -576,15 +578,15 @@ Event EditCtrlDialog::getEvent(int tick, const Event& event, // EditCtrlDialog::event //--------------------------------------------------------- -Event EditCtrlDialog::event() +MusECore::Event EditCtrlDialog::event() { - Event event(Controller); + MusECore::Event event(MusECore::Controller); event.setTick(timePos->pos().tick()); event.setA(num); - if (num == CTRL_PROGRAM) + if (num == MusECore::CTRL_PROGRAM) event.setB(val); else - event.setB(valSlider->value() + midiPorts[part->track()->outPort()].midiController(num)->bias()); + event.setB(valSlider->value() + MusEGlobal::midiPorts[part->track()->outPort()].midiController(num)->bias()); return event; } @@ -598,8 +600,8 @@ Event EditCtrlDialog::event() // QPushButton* buttonNewController; //--------------------------------------------------------- -EditCtrlDialog::EditCtrlDialog(int tick, const Event& event, - const MidiPart* p, QWidget* parent) +EditCtrlDialog::EditCtrlDialog(int tick, const MusECore::Event& event, + const MusECore::MidiPart* p, QWidget* parent) : QDialog(parent), part(p) { setupUi(this); @@ -614,11 +616,11 @@ EditCtrlDialog::EditCtrlDialog(int tick, const Event& event, ///pop = new QMenu(this); //pop->setCheckable(false);//not necessary in Qt4 - MidiTrack* track = part->track(); + MusECore::MidiTrack* track = part->track(); int portn = track->outPort(); - MidiPort* port = &midiPorts[portn]; - bool isDrum = track->type() == Track::DRUM; //FINDMICHJETZT was soll das? - MidiCtrlValListList* cll = port->controller(); + MusECore::MidiPort* port = &MusEGlobal::midiPorts[portn]; + bool isDrum = track->type() == MusECore::Track::DRUM; //FINDMICHJETZT was soll das? + MusECore::MidiCtrlValListList* cll = port->controller(); ctrlList->clear(); ctrlList->setSelectionMode(QAbstractItemView::SingleSelection); @@ -630,8 +632,8 @@ EditCtrlDialog::EditCtrlDialog(int tick, const Event& event, std::list<QString> sList; typedef std::list<QString>::iterator isList; - for (iMidiCtrlValList i = cll->begin(); i != cll->end(); ++i) { - MidiCtrlValList* cl = i->second; + for (MusECore::iMidiCtrlValList i = cll->begin(); i != cll->end(); ++i) { + MusECore::MidiCtrlValList* cl = i->second; int num = cl->num(); // dont show drum specific controller if not a drum track @@ -639,7 +641,7 @@ EditCtrlDialog::EditCtrlDialog(int tick, const Event& event, if (!isDrum) continue; } - MidiController* c = port->midiController(num); + MusECore::MidiController* c = port->midiController(num); isList i = sList.begin(); for (; i != sList.end(); ++i) { if (*i == c->name()) @@ -648,7 +650,7 @@ EditCtrlDialog::EditCtrlDialog(int tick, const Event& event, if (i == sList.end()) sList.push_back(c->name()); } - MidiController* mc = port->midiController(num); + MusECore::MidiController* mc = port->midiController(num); int idx = 0; int selectionIndex = 0; for (isList i = sList.begin(); i != sList.end(); ++i, ++idx) { @@ -665,7 +667,7 @@ EditCtrlDialog::EditCtrlDialog(int tick, const Event& event, if(!event.empty()) { - if(num == CTRL_PROGRAM) + if(num == MusECore::CTRL_PROGRAM) { widgetStack->setCurrentIndex(1); updatePatch(); @@ -696,22 +698,22 @@ EditCtrlDialog::EditCtrlDialog(int tick, const Event& event, void EditCtrlDialog::newController() { //QMenu* pup = new QMenu(this); - MusEWidget::PopupMenu* pup = new MusEWidget::PopupMenu(this); + MusEGui::PopupMenu* pup = new MusEGui::PopupMenu(this); //pup->setCheckable(this);//not necessary in Qt4 // // populate popup with all controllers available for // current instrument // - MidiTrack* track = part->track(); + MusECore::MidiTrack* track = part->track(); int portn = track->outPort(); - MidiPort* port = &midiPorts[portn]; - MidiInstrument* instr = port->instrument(); - MidiControllerList* mcl = instr->controller(); + MusECore::MidiPort* port = &MusEGlobal::midiPorts[portn]; + MusECore::MidiInstrument* instr = port->instrument(); + MusECore::MidiControllerList* mcl = instr->controller(); - MidiCtrlValListList* cll = port->controller(); + MusECore::MidiCtrlValListList* cll = port->controller(); int channel = track->outChannel(); int nn = 0; - for (iMidiController ci = mcl->begin(); ci != mcl->end(); ++ci) + for (MusECore::iMidiController ci = mcl->begin(); ci != mcl->end(); ++ci) { if(cll->find(channel, ci->second->num()) == cll->end()) { @@ -723,14 +725,14 @@ void EditCtrlDialog::newController() QAction* rv = pup->exec(buttonNewController->mapToGlobal(QPoint(0,0))); if (rv) { QString s = rv->text(); - for (iMidiController ci = mcl->begin(); ci != mcl->end(); ++ci) { - MidiController* mc = ci->second; + for (MusECore::iMidiController ci = mcl->begin(); ci != mcl->end(); ++ci) { + MusECore::MidiController* mc = ci->second; if (mc->name() == s) { if(cll->find(channel, mc->num()) == cll->end()) { - MidiCtrlValList* vl = new MidiCtrlValList(mc->num()); + MusECore::MidiCtrlValList* vl = new MusECore::MidiCtrlValList(mc->num()); cll->add(channel, vl); - //song->update(SC_MIDI_CONTROLLER_ADD); + //MusEGlobal::song->update(SC_MIDI_CONTROLLER_ADD); } //for (int idx = 0; ;++idx) { int idx = 0; @@ -773,22 +775,22 @@ void EditCtrlDialog::ctrlListClicked(QListWidgetItem* item) return; QString s(item->text()); - MidiTrack* track = part->track(); + MusECore::MidiTrack* track = part->track(); int portn = track->outPort(); - MidiPort* port = &midiPorts[portn]; - MidiCtrlValListList* cll = port->controller(); + MusECore::MidiPort* port = &MusEGlobal::midiPorts[portn]; + MusECore::MidiCtrlValListList* cll = port->controller(); - iMidiCtrlValList i; + MusECore::iMidiCtrlValList i; for (i = cll->begin(); i != cll->end(); ++i) { - MidiCtrlValList* cl = i->second; + MusECore::MidiCtrlValList* cl = i->second; num = cl->num(); - MidiController* c = port->midiController(num); + MusECore::MidiController* c = port->midiController(num); if (s == c->name()) { - if (num == CTRL_PROGRAM) { + if (num == MusECore::CTRL_PROGRAM) { widgetStack->setCurrentIndex(1); val = c->initVal(); - if(val == CTRL_VAL_UNKNOWN) + if(val == MusECore::CTRL_VAL_UNKNOWN) val = 0; updatePatch(); } @@ -799,14 +801,14 @@ void EditCtrlDialog::ctrlListClicked(QListWidgetItem* item) controllerName->setText(s); val = c->initVal(); - if(val == CTRL_VAL_UNKNOWN || val == 0) + if(val == MusECore::CTRL_VAL_UNKNOWN || val == 0) { switch(num) { - case CTRL_PANPOT: + case MusECore::CTRL_PANPOT: val = 64 - c->bias(); break; - case CTRL_VOLUME: + case MusECore::CTRL_VOLUME: val = 100; break; default: @@ -829,11 +831,11 @@ void EditCtrlDialog::ctrlListClicked(QListWidgetItem* item) void EditCtrlDialog::updatePatch() { - MidiTrack* track = part->track(); + MusECore::MidiTrack* track = part->track(); int port = track->outPort(); int channel = track->outChannel(); - MidiInstrument* instr = midiPorts[port].instrument(); - patchName->setText(instr->getPatchName(channel, val, song->mtype(), track->type() == Track::DRUM)); //FINDMICHJETZT was soll das? + MusECore::MidiInstrument* instr = MusEGlobal::midiPorts[port].instrument(); + patchName->setText(instr->getPatchName(channel, val, MusEGlobal::song->mtype(), track->type() == MusECore::Track::DRUM)); //FINDMICHJETZT was soll das? int hb = ((val >> 16) & 0xff) + 1; if (hb == 0x100) @@ -864,15 +866,15 @@ void EditCtrlDialog::updatePatch() void EditCtrlDialog::instrPopup() { - MidiTrack* track = part->track(); + MusECore::MidiTrack* track = part->track(); int channel = track->outChannel(); int port = track->outPort(); - MidiInstrument* instr = midiPorts[port].instrument(); + MusECore::MidiInstrument* instr = MusEGlobal::midiPorts[port].instrument(); - ///instr->populatePatchPopup(pop, channel, song->mtype(), track->type() == Track::DRUM); + ///instr->populatePatchPopup(pop, channel, MusEGlobal::song->mtype(), track->type() == MusECore::Track::DRUM); //QMenu* pup = new QMenu(this); - MusEWidget::PopupMenu* pup = new MusEWidget::PopupMenu(this); - instr->populatePatchPopup(pup, channel, song->mtype(), track->type() == Track::DRUM); //FINDMICHJETZT was soll das? + MusEGui::PopupMenu* pup = new MusEGui::PopupMenu(this); + populatePatchPopup(instr, pup, channel, MusEGlobal::song->mtype(), track->type() == MusECore::Track::DRUM); //FINDMICHJETZT was soll das? ///if(pop->actions().count() == 0) /// return; @@ -898,7 +900,7 @@ void EditCtrlDialog::instrPopup() void EditCtrlDialog::programChanged() { -// MidiTrack* track = part->track(); +// MusECore::MidiTrack* track = part->track(); // int channel = track->outChannel(); // int port = track->outPort(); int hb = hbank->value(); @@ -922,3 +924,4 @@ void EditCtrlDialog::programChanged() updatePatch(); } +} // namespace MusEGui diff --git a/muse2/muse/liste/editevent.h b/muse2/muse/liste/editevent.h index 02befe7e..51ba80d0 100644 --- a/muse2/muse/liste/editevent.h +++ b/muse2/muse/liste/editevent.h @@ -28,24 +28,29 @@ #include "ui_editctrlbase.h" #include "event.h" -namespace Awl { - class PosEdit; - }; - -///class PosEdit; -namespace MusEWidget { -class IntLabel; -class PitchEdit; -} - class QDialog; class QLabel; class QGridLayout; class QTextEdit; class QRadioButton; -class MidiPart; class QListWidgetItem; class QMenu; + +namespace Awl { + class PosEdit; + }; + +namespace MusECore { +class MidiPart; +} + +namespace MusEGui { + +class IntLabel; +class PitchEdit; +///class PosEdit; + + //--------------------------------------------------------- // EditEventDialog //--------------------------------------------------------- @@ -58,7 +63,7 @@ class EditEventDialog : public QDialog { public: EditEventDialog(QWidget* parent=0); - virtual Event event() = 0; + virtual MusECore::Event event() = 0; }; //--------------------------------------------------------- @@ -69,11 +74,11 @@ class EditNoteDialog : public QDialog, public Ui::EditNoteDialogBase { Q_OBJECT public: - EditNoteDialog(int tick, const Event&, + EditNoteDialog(int tick, const MusECore::Event&, QWidget* parent=0); - static Event getEvent(int tick, const Event&, + static MusECore::Event getEvent(int tick, const MusECore::Event&, QWidget* parent = 0); - virtual Event event(); + virtual MusECore::Event event(); }; //--------------------------------------------------------- @@ -93,12 +98,12 @@ class EditSysexDialog : public QDialog, public Ui::EditSysexDialogBase { virtual void accept(); public: - EditSysexDialog(int tick, const Event&, + EditSysexDialog(int tick, const MusECore::Event&, QWidget* parent=0); ~EditSysexDialog(); - static Event getEvent(int tick, const Event&, + static MusECore::Event getEvent(int tick, const MusECore::Event&, QWidget* parent = 0); - virtual Event event(); + virtual MusECore::Event event(); }; //--------------------------------------------------------- @@ -111,7 +116,7 @@ class EditCtrlDialog : public QDialog, public Ui::EditCtrlBase { int num; // controller number int val; // controller value (for prog. changes) - const MidiPart* part; + const MusECore::MidiPart* part; ///QMenu* pop; void updatePatch(); @@ -127,11 +132,11 @@ class EditCtrlDialog : public QDialog, public Ui::EditCtrlBase { public: - EditCtrlDialog(int tick, const Event&, - const MidiPart*, QWidget* parent=0); - static Event getEvent(int tick, const Event&, const MidiPart*, + EditCtrlDialog(int tick, const MusECore::Event&, + const MusECore::MidiPart*, QWidget* parent=0); + static MusECore::Event getEvent(int tick, const MusECore::Event&, const MusECore::MidiPart*, QWidget* parent = 0); - virtual Event event(); + virtual MusECore::Event event(); }; //--------------------------------------------------------- @@ -146,7 +151,7 @@ class EditMetaDialog : public EditEventDialog { ///PosEdit* epos; Awl::PosEdit* epos; QTextEdit* edit; - MusEWidget::IntLabel* il2; + MusEGui::IntLabel* il2; QRadioButton* hexButton; QLabel* typeLabel; @@ -159,12 +164,12 @@ class EditMetaDialog : public EditEventDialog { void typeChanged(int); public: - EditMetaDialog(int tick, const Event&, + EditMetaDialog(int tick, const MusECore::Event&, QWidget* parent=0); ~EditMetaDialog(); - static Event getEvent(int tick, const Event&, + static MusECore::Event getEvent(int tick, const MusECore::Event&, QWidget* parent = 0); - virtual Event event(); + virtual MusECore::Event event(); }; //--------------------------------------------------------- @@ -176,17 +181,17 @@ class EditCAfterDialog : public EditEventDialog { ///PosEdit* epos; Awl::PosEdit* epos; - MusEWidget::IntLabel* il2; + MusEGui::IntLabel* il2; protected: QGridLayout* layout; public: - EditCAfterDialog(int tick, const Event&, + EditCAfterDialog(int tick, const MusECore::Event&, QWidget* parent=0); - static Event getEvent(int tick, const Event&, + static MusECore::Event getEvent(int tick, const MusECore::Event&, QWidget* parent = 0); - virtual Event event(); + virtual MusECore::Event event(); }; //--------------------------------------------------------- @@ -198,19 +203,21 @@ class EditPAfterDialog : public EditEventDialog { ///PosEdit* epos; Awl::PosEdit* epos; - MusEWidget::PitchEdit* pl; - MusEWidget::IntLabel* il2; + MusEGui::PitchEdit* pl; + MusEGui::IntLabel* il2; protected: QGridLayout* layout; public: - EditPAfterDialog(int tick, const Event&, + EditPAfterDialog(int tick, const MusECore::Event&, QWidget* parent=0); - static Event getEvent(int tick, const Event&, + static MusECore::Event getEvent(int tick, const MusECore::Event&, QWidget* parent = 0); - virtual Event event(); + virtual MusECore::Event event(); }; +} // namespace MusEGui + #endif diff --git a/muse2/muse/liste/listedit.cpp b/muse2/muse/liste/listedit.cpp index 9766ba71..eadfa68c 100644 --- a/muse2/muse/liste/listedit.cpp +++ b/muse2/muse/liste/listedit.cpp @@ -46,16 +46,18 @@ #include "midiport.h" #include "midictrl.h" +namespace MusEGui { + //--------------------------------------------------------- // EventListItem //--------------------------------------------------------- class EventListItem : public QTreeWidgetItem { public: - Event event; - MidiPart* part; + MusECore::Event event; + MusECore::MidiPart* part; - EventListItem(QTreeWidget* parent, Event ev, MidiPart* p) + EventListItem(QTreeWidget* parent, MusECore::Event ev, MusECore::MidiPart* p) : QTreeWidgetItem(parent) { event = ev; part = p; @@ -107,10 +109,10 @@ class EventListItem : public QTreeWidgetItem { * midi_meta_name *---------------------------------------------------------*/ -static QString midiMetaComment(const Event& ev) +static QString midiMetaComment(const MusECore::Event& ev) { int meta = ev.dataA(); - QString s = midiMetaName(meta); + QString s = MusECore::midiMetaName(meta); switch (meta) { case 0: @@ -260,12 +262,12 @@ void ListEdit::songChanged(int type) curTrack = 0; liste->blockSignals(true); liste->clear(); - for (iPart p = parts()->begin(); p != parts()->end(); ++p) { - MidiPart* part = (MidiPart*) (p->second); + for (MusECore::iPart p = parts()->begin(); p != parts()->end(); ++p) { + MusECore::MidiPart* part = (MusECore::MidiPart*) (p->second); if (part->sn() == curPartId) curPart = part; - EventList* el = part->events(); - for (iEvent i = el->begin(); i != el->end(); ++i) { + MusECore::EventList* el = part->events(); + for (MusECore::iEvent i = el->begin(); i != el->end(); ++i) { EventListItem* item = new EventListItem(liste, i->second, part); for (int col = 0; col < liste->columnCount(); ++col) item->setText(col, item->text(col)); @@ -284,7 +286,7 @@ void ListEdit::songChanged(int type) { if(!parts()->empty()) { - curPart = (MidiPart*)(parts()->begin()->second); + curPart = (MusECore::MidiPart*)(parts()->begin()->second); if(curPart) curTrack = curPart->track(); else @@ -318,27 +320,27 @@ QString EventListItem::text(int col) const break; case 2: switch(event.type()) { - case Note: + case MusECore::Note: s = QString("Note"); break; - case Controller: + case MusECore::Controller: { const char* cs; - switch (midiControllerType(event.dataA())) { - case MidiController::Controller7: cs = "Ctrl7"; break; - case MidiController::Controller14: cs = "Ctrl14"; break; - case MidiController::RPN: cs = "RPN"; break; - case MidiController::NRPN: cs = "NRPN"; break; - case MidiController::Pitch: cs = "Pitch"; break; - case MidiController::Program: cs = "Program"; break; - case MidiController::RPN14: cs = "RPN14"; break; - case MidiController::NRPN14: cs = "NRPN14"; break; + switch (MusECore::midiControllerType(event.dataA())) { + case MusECore::MidiController::Controller7: cs = "Ctrl7"; break; + case MusECore::MidiController::Controller14: cs = "Ctrl14"; break; + case MusECore::MidiController::RPN: cs = "RPN"; break; + case MusECore::MidiController::NRPN: cs = "NRPN"; break; + case MusECore::MidiController::Pitch: cs = "Pitch"; break; + case MusECore::MidiController::Program: cs = "Program"; break; + case MusECore::MidiController::RPN14: cs = "RPN14"; break; + case MusECore::MidiController::NRPN14: cs = "NRPN14"; break; default: cs = "Ctrl?"; break; } s = QString(cs); } break; - case Sysex: + case MusECore::Sysex: { commentLabel = QString("len "); QString k; @@ -346,7 +348,7 @@ QString EventListItem::text(int col) const commentLabel += k; commentLabel += QString(" "); - commentLabel += nameSysex(event.dataLen(), event.data()); + commentLabel += MusECore::nameSysex(event.dataLen(), event.data()); int i; for (i = 0; i < 10; ++i) { if (i >= event.dataLen()) @@ -361,17 +363,17 @@ QString EventListItem::text(int col) const } s = QString("SysEx"); break; - case PAfter: + case MusECore::PAfter: s = QString("PoAT"); break; - case CAfter: + case MusECore::CAfter: s = QString("ChAT"); break; - case Meta: + case MusECore::Meta: commentLabel = midiMetaComment(event); s = QString("Meta"); break; - case Wave: + case MusECore::Wave: break; default: printf("unknown event type %d\n", event.type()); @@ -381,16 +383,16 @@ QString EventListItem::text(int col) const s.setNum(part->track()->outChannel() + 1); break; case 4: - if (event.isNote() || event.type() == PAfter) - s = MusEUtil::pitch2string(event.dataA()); - else if (event.type() == Controller) + if (event.isNote() || event.type() == MusECore::PAfter) + s = MusECore::pitch2string(event.dataA()); + else if (event.type() == MusECore::Controller) s.setNum(event.dataA() & 0xffff); // mask off type bits else s.setNum(event.dataA()); break; case 5: - if(event.type() == Controller && - midiControllerType(event.dataA()) == MidiController::Program) + if(event.type() == MusECore::Controller && + MusECore::midiControllerType(event.dataA()) == MusECore::MidiController::Program) { int val = event.dataB(); int hb = ((val >> 16) & 0xff) + 1; @@ -415,14 +417,14 @@ QString EventListItem::text(int col) const break; case 8: switch(event.type()) { - case Controller: + case MusECore::Controller: { - MidiPort* mp = &midiPorts[part->track()->outPort()]; - MidiController* mc = mp->midiController(event.dataA()); + MusECore::MidiPort* mp = &MusEGlobal::midiPorts[part->track()->outPort()]; + MusECore::MidiController* mc = mp->midiController(event.dataA()); s = mc->name(); } break; - case Sysex: + case MusECore::Sysex: { s = QString("len "); QString k; @@ -430,7 +432,7 @@ QString EventListItem::text(int col) const s += k; s += QString(" "); - commentLabel += nameSysex(event.dataLen(), event.data()); + commentLabel += MusECore::nameSysex(event.dataLen(), event.data()); int i; for (i = 0; i < 10; ++i) { if (i >= event.dataLen()) @@ -444,7 +446,7 @@ QString EventListItem::text(int col) const s += QString("..."); } break; - case Meta: + case MusECore::Meta: s = midiMetaComment(event); break; default: @@ -460,7 +462,7 @@ QString EventListItem::text(int col) const // ListEdit //--------------------------------------------------------- -ListEdit::ListEdit(PartList* pl) +ListEdit::ListEdit(MusECore::PartList* pl) : MidiEditor(TopWin::LISTE, 0, pl) { insertItems = new QActionGroup(this); @@ -584,7 +586,7 @@ ListEdit::ListEdit(PartList* pl) mainGrid->setRowStretch(1, 100); mainGrid->setColumnStretch(0, 100); mainGrid->addWidget(liste, 1, 0, 2, 1); - connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); + connect(MusEGlobal::song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); songChanged(-1); if(pl->empty()) @@ -594,7 +596,7 @@ ListEdit::ListEdit(PartList* pl) } else { - curPart = (MidiPart*)pl->begin()->second; + curPart = (MusECore::MidiPart*)pl->begin()->second; if(curPart) curPartId = curPart->sn(); else @@ -627,7 +629,7 @@ void ListEdit::editInsertNote() if(!curPart) return; - Event event = EditNoteDialog::getEvent(curPart->tick(), Event(), this); + MusECore::Event event = EditNoteDialog::getEvent(curPart->tick(), MusECore::Event(), this); if (!event.empty()) { //No events before beginning of part + take Part offset into consideration unsigned tick = event.tick(); @@ -637,7 +639,7 @@ void ListEdit::editInsertNote() tick-= curPart->tick(); event.setTick(tick); // Indicate do undo, and do not handle port controller values. - audio->msgAddEvent(event, curPart, true, false, false); + MusEGlobal::audio->msgAddEvent(event, curPart, true, false, false); } } @@ -650,7 +652,7 @@ void ListEdit::editInsertSysEx() if(!curPart) return; - Event event = EditSysexDialog::getEvent(curPart->tick(), Event(), this); + MusECore::Event event = EditSysexDialog::getEvent(curPart->tick(), MusECore::Event(), this); if (!event.empty()) { //No events before beginning of part + take Part offset into consideration unsigned tick = event.tick(); @@ -660,7 +662,7 @@ void ListEdit::editInsertSysEx() tick-= curPart->tick(); event.setTick(tick); // Indicate do undo, and do not handle port controller values. - audio->msgAddEvent(event, curPart, true, false, false); + MusEGlobal::audio->msgAddEvent(event, curPart, true, false, false); } } @@ -673,7 +675,7 @@ void ListEdit::editInsertCtrl() if(!curPart) return; - Event event = EditCtrlDialog::getEvent(curPart->tick(), Event(), curPart, this); + MusECore::Event event = EditCtrlDialog::getEvent(curPart->tick(), MusECore::Event(), curPart, this); if (!event.empty()) { //No events before beginning of part + take Part offset into consideration unsigned tick = event.tick(); @@ -683,7 +685,7 @@ void ListEdit::editInsertCtrl() tick-= curPart->tick(); event.setTick(tick); // Indicate do undo, and do port controller values and clone parts. - audio->msgAddEvent(event, curPart, true, true, true); + MusEGlobal::audio->msgAddEvent(event, curPart, true, true, true); } } @@ -696,7 +698,7 @@ void ListEdit::editInsertMeta() if(!curPart) return; - Event event = EditMetaDialog::getEvent(curPart->tick(), Event(), this); + MusECore::Event event = EditMetaDialog::getEvent(curPart->tick(), MusECore::Event(), this); if (!event.empty()) { //No events before beginning of part + take Part offset into consideration unsigned tick = event.tick(); @@ -706,7 +708,7 @@ void ListEdit::editInsertMeta() tick-= curPart->tick(); event.setTick(tick); // Indicate do undo, and do not handle port controller values. - audio->msgAddEvent(event, curPart, true, false, false); + MusEGlobal::audio->msgAddEvent(event, curPart, true, false, false); } } @@ -719,7 +721,7 @@ void ListEdit::editInsertCAfter() if(!curPart) return; - Event event = EditCAfterDialog::getEvent(curPart->tick(), Event(), this); + MusECore::Event event = EditCAfterDialog::getEvent(curPart->tick(), MusECore::Event(), this); if (!event.empty()) { //No events before beginning of part + take Part offset into consideration unsigned tick = event.tick(); @@ -729,7 +731,7 @@ void ListEdit::editInsertCAfter() tick-= curPart->tick(); event.setTick(tick); // Indicate do undo, and do not handle port controller values. - audio->msgAddEvent(event, curPart, true, false, false); + MusEGlobal::audio->msgAddEvent(event, curPart, true, false, false); } } @@ -742,8 +744,8 @@ void ListEdit::editInsertPAfter() if(!curPart) return; - Event ev; - Event event = EditPAfterDialog::getEvent(curPart->tick(), ev, this); + MusECore::Event ev; + MusECore::Event event = EditPAfterDialog::getEvent(curPart->tick(), ev, this); if (!event.empty()) { //No events before beginning of part + take Part offset into consideration unsigned tick = event.tick(); @@ -753,7 +755,7 @@ void ListEdit::editInsertPAfter() tick-= curPart->tick(); event.setTick(tick); // Indicate do undo, and do not handle port controller values. - audio->msgAddEvent(event, curPart, true, false, false); + MusEGlobal::audio->msgAddEvent(event, curPart, true, false, false); } } @@ -761,27 +763,27 @@ void ListEdit::editInsertPAfter() // editEvent //--------------------------------------------------------- -void ListEdit::editEvent(Event& event, MidiPart* part) +void ListEdit::editEvent(MusECore::Event& event, MusECore::MidiPart* part) { int tick = event.tick() + part->tick(); - Event nevent; + MusECore::Event nevent; switch(event.type()) { - case Note: + case MusECore::Note: nevent = EditNoteDialog::getEvent(tick, event, this); break; - case Controller: + case MusECore::Controller: nevent = EditCtrlDialog::getEvent(tick, event, part, this); break; - case Sysex: + case MusECore::Sysex: nevent = EditSysexDialog::getEvent(tick, event, this); break; - case PAfter: + case MusECore::PAfter: nevent = EditPAfterDialog::getEvent(tick, event, this); break; - case CAfter: + case MusECore::CAfter: nevent = EditCAfterDialog::getEvent(tick, event, this); break; - case Meta: + case MusECore::Meta: nevent = EditMetaDialog::getEvent(tick, event, this); break; default: @@ -796,12 +798,12 @@ void ListEdit::editEvent(Event& event, MidiPart* part) nevent.tick(), part->tick() + part->lenTick()); else { - if(event.type() == Controller) + if(event.type() == MusECore::Controller) // Indicate do undo, and do port controller values and clone parts. - audio->msgChangeEvent(event, nevent, part, true, true, true); + MusEGlobal::audio->msgChangeEvent(event, nevent, part, true, true, true); else // Indicate do undo, and do not do port controller values and clone parts. - audio->msgChangeEvent(event, nevent, part, true, false, false); + MusEGlobal::audio->msgChangeEvent(event, nevent, part, true, false, false); } } } @@ -810,21 +812,21 @@ void ListEdit::editEvent(Event& event, MidiPart* part) // readStatus //--------------------------------------------------------- -void ListEdit::readStatus(Xml& xml) +void ListEdit::readStatus(MusECore::Xml& xml) { for (;;) { - Xml::Token token = xml.parse(); + MusECore::Xml::Token token = xml.parse(); const QString& tag = xml.s1(); - if (token == Xml::Error || token == Xml::End) + if (token == MusECore::Xml::Error || token == MusECore::Xml::End) break; switch (token) { - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "midieditor") MidiEditor::readStatus(xml); else xml.unknown("ListEdit"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "listeditor") return; default: @@ -837,7 +839,7 @@ void ListEdit::readStatus(Xml& xml) // writeStatus //--------------------------------------------------------- -void ListEdit::writeStatus(int level, Xml& xml) const +void ListEdit::writeStatus(int level, MusECore::Xml& xml) const { writePartList(level, xml); xml.tag(level++, "listeditor"); @@ -849,22 +851,22 @@ void ListEdit::writeStatus(int level, Xml& xml) const // readConfiguration //--------------------------------------------------------- -void ListEdit::readConfiguration(Xml& xml) +void ListEdit::readConfiguration(MusECore::Xml& xml) { for (;;) { - Xml::Token token = xml.parse(); + MusECore::Xml::Token token = xml.parse(); const QString& tag = xml.s1(); switch (token) { - case Xml::Error: - case Xml::End: + case MusECore::Xml::Error: + case MusECore::Xml::End: return; - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "topwin") TopWin::readConfiguration(LISTE, xml); else xml.unknown("ListEdit"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "listedit") return; default: @@ -877,7 +879,7 @@ void ListEdit::readConfiguration(Xml& xml) // writeConfiguration //--------------------------------------------------------- -void ListEdit::writeConfiguration(int level, Xml& xml) +void ListEdit::writeConfiguration(int level, MusECore::Xml& xml) { xml.tag(level++, "listedit"); TopWin::writeConfiguration(LISTE, level, xml); @@ -899,7 +901,7 @@ void ListEdit::selectionChanged() } } if (update) - song->update(SC_SELECTION); + MusEGlobal::song->update(SC_SELECTION); } //--------------------------------------------------------- @@ -935,7 +937,7 @@ void ListEdit::cmd(int cmd) if(!found) break; - Undo operations; + MusECore::Undo operations; EventListItem *deletedEvent=NULL; for (int row = 0; row < liste->topLevelItemCount(); ++row) { @@ -945,7 +947,7 @@ void ListEdit::cmd(int cmd) if (i->isSelected() || item->event.selected()) { deletedEvent=item; // Port controller values and clone parts. - operations.push_back(UndoOp(UndoOp::DeleteEvent,item->event, item->part, true, true)); + operations.push_back(MusECore::UndoOp(MusECore::UndoOp::DeleteEvent,item->event, item->part, true, true)); } } @@ -969,7 +971,7 @@ void ListEdit::cmd(int cmd) } selectedTick=nextTick; - song->applyOperationGroup(operations); + MusEGlobal::song->applyOperationGroup(operations); break; } } @@ -1009,3 +1011,5 @@ if (key == Qt::Key_Escape) { return; } } + +} // namespace MusEGui diff --git a/muse2/muse/liste/listedit.h b/muse2/muse/liste/listedit.h index ba26b6b6..7548fc86 100644 --- a/muse2/muse/liste/listedit.h +++ b/muse2/muse/liste/listedit.h @@ -35,12 +35,15 @@ class QTreeWidget; class QTreeWidgetItem; +namespace MusECore { class Event; +class MidiPart; class MidiTrack; class PartList; -class MidiPart; -class MidiPart; class Xml; +} + +namespace MusEGui { //--------------------------------------------------------- // ListEdit @@ -53,8 +56,8 @@ class ListEdit : public MidiEditor { QMenu* menuEdit; QActionGroup* insertItems; QToolBar* listTools; - MidiTrack* curTrack; - MidiPart* curPart; + MusECore::MidiTrack* curTrack; + MusECore::MidiPart* curPart; int selectedTick; int curPartId; @@ -73,7 +76,7 @@ class ListEdit : public MidiEditor { void editInsertMeta(); void editInsertCAfter(); void editInsertPAfter(); - void editEvent(Event&, MidiPart*); + void editEvent(MusECore::Event&, MusECore::MidiPart*); void selectionChanged(); void doubleClicked(QTreeWidgetItem*); void cmd(int cmd); @@ -83,16 +86,18 @@ class ListEdit : public MidiEditor { void songChanged(int); signals: - void deleted(TopWin*); + void deleted(MusEGui::TopWin*); public: - ListEdit(PartList*); + ListEdit(MusECore::PartList*); ~ListEdit(); - virtual void readStatus(Xml&); - virtual void writeStatus(int, Xml&) const; - static void readConfiguration(Xml&); - static void writeConfiguration(int, Xml&); + virtual void readStatus(MusECore::Xml&); + virtual void writeStatus(int, MusECore::Xml&) const; + static void readConfiguration(MusECore::Xml&); + static void writeConfiguration(int, MusECore::Xml&); }; +} // namespace MusEGui + #endif diff --git a/muse2/muse/main.cpp b/muse2/muse/main.cpp index 11644e2f..27a8926e 100644 --- a/muse2/muse/main.cpp +++ b/muse2/muse/main.cpp @@ -45,27 +45,32 @@ #include "sync.h" #include "functions.h" +#ifdef HAVE_LASH +#include <lash/lash.h> +#endif + +namespace MusECore { 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(); +extern snd_seq_t * alsaSeq; +} -static QString locale_override; - +namespace MusEGui { +extern void initIcons(); +extern void initShortCuts(); #ifdef HAVE_LASH -#include <lash/lash.h> -namespace MusEApp { extern lash_client_t * lash_client; -} -extern snd_seq_t * alsaSeq; #endif +} + +static QString locale_override; //--------------------------------------------------------- // getCapabilities @@ -107,7 +112,7 @@ static void printVersion(const char* prog) //--------------------------------------------------------- class MuseApplication : public QApplication { - MusEApp::MusE* muse; + MusEGui::MusE* muse; public: MuseApplication(int& argc, char** argv) @@ -117,7 +122,7 @@ class MuseApplication : public QApplication { } - void setMuse(MusEApp::MusE* m) { + void setMuse(MusEGui::MusE* m) { muse = m; connect(this,SIGNAL(focusChanged(QWidget*,QWidget*)),muse,SLOT(focusChanged(QWidget*,QWidget*))); @@ -292,20 +297,20 @@ int main(int argc, char* argv[]) srand(time(0)); // initialize random number generator // signal(SIGCHLD, catchSignal); // interferes with initVST() - initMidiController(); + MusECore::initMidiController(); QApplication::setColorSpec(QApplication::ManyColor); MuseApplication app(argc, argv); - init_function_dialogs(MusEGlobal::muse); - initShortCuts(); - readConfiguration(); + MusEGui::init_function_dialogs(MusEGlobal::muse); + MusEGui::initShortCuts(); + MusECore::readConfiguration(); - MusEGlobal::museUserInstruments = MusEConfig::config.userInstrumentsDir; + MusEGlobal::museUserInstruments = MusEGlobal::config.userInstrumentsDir; - if (MusEConfig::config.useDenormalBias) + if (MusEGlobal::config.useDenormalBias) printf("Denormal protection enabled.\n"); // SHOW MUSE SPLASH SCREEN - if (MusEConfig::config.showSplashScreen) { + if (MusEGlobal::config.showSplashScreen) { QPixmap splsh(MusEGlobal::museGlobalShare + "/splash.png"); if (!splsh.isNull()) { @@ -357,7 +362,7 @@ int main(int argc, char* argv[]) MusEGlobal::heavyDebugMsg=true; case 'm': MusEGlobal::midiInputTrace = true; break; case 'M': MusEGlobal::midiOutputTrace = true; break; - case 's': debugSync = true; break; + case 's': MusEGlobal::debugSync = true; break; case 'P': MusEGlobal::realTimePriority = atoi(optarg); break; case 'Y': MusEGlobal::midiRTPrioOverride = atoi(optarg); break; case 'p': MusEGlobal::loadPlugins = false; break; @@ -372,11 +377,11 @@ int main(int argc, char* argv[]) } /* - if(!MusEConfig::config.styleSheetFile.isEmpty()) + if(!MusEGlobal::config.styleSheetFile.isEmpty()) { if(MusEGlobal::debugMsg) - printf("loading style sheet <%s> \n", qPrintable(MusEConfig::config.styleSheetFile)); - QFile cf(MusEConfig::config.styleSheetFile); + printf("loading style sheet <%s> \n", qPrintable(MusEGlobal::config.styleSheetFile)); + QFile cf(MusEGlobal::config.styleSheetFile); if (cf.open(QIODevice::ReadOnly)) { QByteArray ss = cf.readAll(); QString sheet(QString::fromUtf8(ss.data())); @@ -384,7 +389,7 @@ int main(int argc, char* argv[]) cf.close(); } else - printf("loading style sheet <%s> failed\n", qPrintable(MusEConfig::config.styleSheetFile)); + printf("loading style sheet <%s> failed\n", qPrintable(MusEGlobal::config.styleSheetFile)); } */ @@ -394,17 +399,17 @@ int main(int argc, char* argv[]) printf("Start euid: %d ruid: %d, Now euid %d\n", MusEGlobal::euid, MusEGlobal::ruid, geteuid()); if (MusEGlobal::debugMode) { - initDummyAudio(); + MusECore::initDummyAudio(); MusEGlobal::realTimeScheduling = false; } else if (noAudio) { - initDummyAudio(); + MusECore::initDummyAudio(); MusEGlobal::realTimeScheduling = true; //if (MusEGlobal::debugMode) { // ?? // MusEGlobal::realTimeScheduling = false; // } } - else if (initJackAudio()) { + else if (MusECore::initJackAudio()) { if (!MusEGlobal::debugMode) { QMessageBox::critical(NULL, "MusE fatal error", "MusE <b>failed</b> to find a <b>Jack audio server</b>.<br><br>" @@ -413,7 +418,7 @@ int main(int argc, char* argv[]) "If Jack <i>was</i> started check that it was\n" "started as the same user as MusE.\n"); - initDummyAudio(); + MusECore::initDummyAudio(); noAudio = true; MusEGlobal::realTimeScheduling = true; if (MusEGlobal::debugMode) { @@ -425,13 +430,13 @@ int main(int argc, char* argv[]) 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(); - //MusEGlobal::realTimeScheduling = audioDevice->isRealtime(); + MusECore::initDummyAudio(); + //MusEGlobal::realTimeScheduling = MusEGlobal::audioDevice->isRealtime(); } MusEGlobal::realTimeScheduling = true; } else - MusEGlobal::realTimeScheduling = audioDevice->isRealtime(); + MusEGlobal::realTimeScheduling = MusEGlobal::audioDevice->isRealtime(); // What unreliable nonsense. With Jack2 this reports true even if it is not running realtime. @@ -440,7 +445,7 @@ int main(int argc, char* argv[]) //if (MusEGlobal::debugMsg) // printf("MusEGlobal::realTimeScheduling:%d\n", MusEGlobal::realTimeScheduling); - useJackTransport.setValue(true); + MusEGlobal::useJackTransport.setValue(true); // setup the prefetch fifo length now that the segmentSize is known // Changed by Tim. p3.3.17 @@ -483,20 +488,20 @@ int main(int argc, char* argv[]) } if (MusEGlobal::loadPlugins) - initPlugins(); + MusECore::initPlugins(); if (MusEGlobal::loadVST) - initVST(); + MusECore::initVST(); if(MusEGlobal::loadDSSI) - initDSSI(); + MusECore::initDSSI(); // p3.3.39 - initOSC(); + MusECore::initOSC(); - initIcons(); + MusEGui::initIcons(); - initMetronome(); + MusECore::initMetronome(); //QApplication::clipboard()->setSelectionMode(false); ddskrjo obsolete even in Qt3 @@ -511,9 +516,9 @@ int main(int argc, char* argv[]) } } - MusEGlobal::muse = new MusEApp::MusE(argc, &argv[optind]); + MusEGlobal::muse = new MusEGui::MusE(argc, &argv[optind]); app.setMuse(MusEGlobal::muse); - MusEGlobal::muse->setWindowIcon(*museIcon); + MusEGlobal::muse->setWindowIcon(*MusEGui::museIcon); // Added by Tim. p3.3.22 @@ -527,18 +532,18 @@ int main(int argc, char* argv[]) #ifdef HAVE_LASH { - MusEApp::lash_client = 0; + MusEGui::lash_client = 0; if(MusEGlobal::useLASH) { int lash_flags = LASH_Config_File; const char *muse_name = PACKAGE_NAME; - MusEApp::lash_client = lash_init (lash_args, muse_name, lash_flags, LASH_PROTOCOL(2,0)); - lash_alsa_client_id (MusEApp::lash_client, snd_seq_client_id (alsaSeq)); + MusEGui::lash_client = lash_init (lash_args, muse_name, lash_flags, LASH_PROTOCOL(2,0)); + lash_alsa_client_id (MusEGui::lash_client, snd_seq_client_id (MusECore::alsaSeq)); if (!noAudio) { // p3.3.38 - //char *jack_name = ((JackAudioDevice*)audioDevice)->getJackName(); - const char *jack_name = audioDevice->clientName(); - lash_jack_client_name (MusEApp::lash_client, jack_name); + //char *jack_name = ((JackAudioDevice*)MusEGlobal::audioDevice)->getJackName(); + const char *jack_name = MusEGlobal::audioDevice->clientName(); + lash_jack_client_name (MusEGui::lash_client, jack_name); } } } diff --git a/muse2/muse/marker/marker.cpp b/muse2/muse/marker/marker.cpp index 00f76e81..fe643ccf 100644 --- a/muse2/muse/marker/marker.cpp +++ b/muse2/muse/marker/marker.cpp @@ -23,6 +23,8 @@ #include "marker.h" #include "xml.h" +namespace MusECore { + Marker* MarkerList::add(const Marker& marker) { iMarker i = insert(std::pair<const int, Marker> (marker.tick(), Marker(marker))); @@ -103,3 +105,4 @@ void MarkerList::remove(Marker* m) printf("MarkerList::remove(): marker not found\n"); } +} // namespace MusECore diff --git a/muse2/muse/marker/marker.h b/muse2/muse/marker/marker.h index 4d222b01..5d0bfbf9 100644 --- a/muse2/muse/marker/marker.h +++ b/muse2/muse/marker/marker.h @@ -30,6 +30,8 @@ class QString; +namespace MusECore { + //--------------------------------------------------------- // Marker //--------------------------------------------------------- @@ -64,5 +66,7 @@ class MarkerList : public std::multimap<unsigned, Marker, std::less<unsigned> > typedef std::multimap<unsigned, Marker, std::less<unsigned> >::iterator iMarker; typedef std::multimap<unsigned, Marker, std::less<unsigned> >::const_iterator ciMarker; +} // namespace MusECore + #endif diff --git a/muse2/muse/marker/markerview.cpp b/muse2/muse/marker/markerview.cpp index 3aa1908c..bc9e48b9 100644 --- a/muse2/muse/marker/markerview.cpp +++ b/muse2/muse/marker/markerview.cpp @@ -43,6 +43,7 @@ #include <QToolButton> #include <QVBoxLayout> +namespace MusEGui { enum { COL_TICK = 0, COL_SMPTE, COL_LOCK, COL_NAME }; @@ -70,22 +71,22 @@ const QString MarkerItem::name() const bool MarkerItem::lock() const { - return _marker->type() == Pos::FRAMES; + return _marker->type() == MusECore::Pos::FRAMES; } //--------------------------------------------------------- // MarkerItem //--------------------------------------------------------- -MarkerItem::MarkerItem(QTreeWidget* parent, Marker* m) +MarkerItem::MarkerItem(QTreeWidget* parent, MusECore::Marker* m) : QTreeWidgetItem(parent) { _marker = m; setText(COL_NAME, m->name()); setTick(m->tick()); - if (m->type() == Pos::FRAMES) + if (m->type() == MusECore::Pos::FRAMES) setIcon(COL_LOCK, QIcon(*lockIcon)); - setLock(m->type() == Pos::FRAMES); + setLock(m->type() == MusECore::Pos::FRAMES); } //--------------------------------------------------------- @@ -95,7 +96,7 @@ MarkerItem::MarkerItem(QTreeWidget* parent, Marker* m) void MarkerItem::setName(const QString& s) { setText(COL_NAME, s); - _marker = song->setMarkerName(_marker, s); + _marker = MusEGlobal::song->setMarkerName(_marker, s); } //--------------------------------------------------------- @@ -105,7 +106,7 @@ void MarkerItem::setName(const QString& s) void MarkerItem::setLock(bool lck) { setIcon(COL_LOCK, QIcon(lck ? *lockIcon : 0)); - _marker = song->setMarkerLock(_marker, lck); + _marker = MusEGlobal::song->setMarkerLock(_marker, lck); } //--------------------------------------------------------- @@ -115,7 +116,7 @@ void MarkerItem::setLock(bool lck) void MarkerItem::setTick(unsigned v) { if (_marker->tick() != v) - _marker = song->setMarkerTick(_marker, v); + _marker = MusEGlobal::song->setMarkerTick(_marker, v); QString s; int bar, beat; unsigned tick; @@ -124,12 +125,12 @@ void MarkerItem::setTick(unsigned v) s.sprintf("%04d.%02d.%03d", bar+1, beat+1, tick); setText(COL_TICK, s); - double time = double(tempomap.tick2frame(v))/double(MusEGlobal::sampleRate); + double time = double(MusEGlobal::tempomap.tick2frame(v))/double(MusEGlobal::sampleRate); int hour = int(time) / 3600; int min = (int(time) % 3600)/60; int sec = int(time) % 60; double rest = time - (hour*3600 + min * 60 + sec); - switch(mtcType) { + switch(MusEGlobal::mtcType) { case 0: // 24 frames sec rest *= 24; break; @@ -270,17 +271,17 @@ MarkerView::MarkerView(QWidget* parent) connect(editName, SIGNAL(textChanged(const QString&)), SLOT(nameChanged(const QString&))); - connect(editTick, SIGNAL(valueChanged(const Pos&)), - SLOT(tickChanged(const Pos&))); - connect(editSMPTE, SIGNAL(valueChanged(const Pos&)), - SLOT(tickChanged(const Pos&))); - connect(editSMPTE, SIGNAL(valueChanged(const Pos&)), - editTick, SLOT(setValue(const Pos&))); - connect(editTick, SIGNAL(valueChanged(const Pos&)), - editSMPTE, SLOT(setValue(const Pos&))); + connect(editTick, SIGNAL(valueChanged(const MusECore::Pos&)), + SLOT(tickChanged(const MusECore::Pos&))); + connect(editSMPTE, SIGNAL(valueChanged(const MusECore::Pos&)), + SLOT(tickChanged(const MusECore::Pos&))); + connect(editSMPTE, SIGNAL(valueChanged(const MusECore::Pos&)), + editTick, SLOT(setValue(const MusECore::Pos&))); + connect(editTick, SIGNAL(valueChanged(const MusECore::Pos&)), + editSMPTE, SLOT(setValue(const MusECore::Pos&))); connect(lock, SIGNAL(toggled(bool)), SLOT(lockChanged(bool))); - connect(song, SIGNAL(markerChanged(int)), + connect(MusEGlobal::song, SIGNAL(markerChanged(int)), SLOT(markerChanged(int))); vbox->addWidget(table); @@ -291,7 +292,7 @@ MarkerView::MarkerView(QWidget* parent) //--------------------------------------------------- //connect(song, SIGNAL(songChanged(int)), SLOT(updateList())); - connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); + connect(MusEGlobal::song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); updateList(); @@ -318,21 +319,21 @@ MarkerView::~MarkerView() // readStatus //--------------------------------------------------------- -void MarkerView::readStatus(Xml& xml) +void MarkerView::readStatus(MusECore::Xml& xml) { for (;;) { - Xml::Token token = xml.parse(); + MusECore::Xml::Token token = xml.parse(); const QString& tag = xml.s1(); - if (token == Xml::Error || token == Xml::End) + if (token == MusECore::Xml::Error || token == MusECore::Xml::End) break; switch (token) { - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag=="topwin") TopWin::readStatus(xml); else xml.unknown("Marker"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "marker") return; default: @@ -345,7 +346,7 @@ void MarkerView::readStatus(Xml& xml) // writeStatus //--------------------------------------------------------- -void MarkerView::writeStatus(int level, Xml& xml) const +void MarkerView::writeStatus(int level, MusECore::Xml& xml) const { xml.tag(level++, "marker"); TopWin::writeStatus(level, xml); @@ -356,22 +357,22 @@ void MarkerView::writeStatus(int level, Xml& xml) const // readConfiguration //--------------------------------------------------------- -void MarkerView::readConfiguration(Xml& xml) +void MarkerView::readConfiguration(MusECore::Xml& xml) { for (;;) { - Xml::Token token = xml.parse(); + MusECore::Xml::Token token = xml.parse(); const QString& tag = xml.s1(); switch (token) { - case Xml::Error: - case Xml::End: + case MusECore::Xml::Error: + case MusECore::Xml::End: return; - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "topwin") TopWin::readConfiguration(MARKER, xml); else xml.unknown("MarkerView"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "marker") return; default: @@ -384,7 +385,7 @@ void MarkerView::readConfiguration(Xml& xml) // writeConfiguration //--------------------------------------------------------- -void MarkerView::writeConfiguration(int level, Xml& xml) +void MarkerView::writeConfiguration(int level, MusECore::Xml& xml) { xml.tag(level++, "marker"); TopWin::writeConfiguration(MARKER, level, xml); @@ -400,15 +401,15 @@ void MarkerView::addMarker() } void MarkerView::addMarker(int i) { - if( i==-1 ) i = song->cpos(); + if( i==-1 ) i = MusEGlobal::song->cpos(); - // Changed p3.3.43 Let Song::addMarker emit markerChanged(MARKER_ADD) + // Changed p3.3.43 Let MusECore::Song::addMarker emit markerChanged(MARKER_ADD) // and handle it in MarkerView::markerChanged(int) - //Marker* m = song->addMarker(QString(""), i, false); + //MusECore::Marker* m = MusEGlobal::song->addMarker(QString(""), i, false); //MarkerItem* newItem = new MarkerItem(table, m); //table->setSelected(newItem, true); // - song->addMarker(QString(""), i, false); + MusEGlobal::song->addMarker(QString(""), i, false); } //--------------------------------------------------------- @@ -420,9 +421,9 @@ void MarkerView::deleteMarker() MarkerItem* item = (MarkerItem*)table->currentItem(); if (item) { table->blockSignals(true); - song->removeMarker(item->marker()); + MusEGlobal::song->removeMarker(item->marker()); table->blockSignals(false); - // Removed p3.3.43 Let Song::removeMarker emit markerChanged(MARKER_REMOVE) + // Removed p3.3.43 Let MusECore::Song::removeMarker emit markerChanged(MARKER_REMOVE) // and handle it in MarkerView::markerChanged(int) //delete item; } @@ -448,9 +449,9 @@ void MarkerView::songChanged(int flags) void MarkerView::updateList() { // Added p3.3.43 Manage selected item, due to clearing of table... - MarkerList* marker = song->marker(); + MusECore::MarkerList* marker = MusEGlobal::song->marker(); MarkerItem* selitem = (MarkerItem*)table->currentItem(); - Marker* selm = selitem ? selitem->marker() : 0; + MusECore::Marker* selm = selitem ? selitem->marker() : 0; // p3.3.44 Look for removed markers before added markers... if(selitem) { @@ -458,9 +459,9 @@ void MarkerView::updateList() while(mitem) { bool found = false; - for(iMarker i = marker->begin(); i != marker->end(); ++i) + for(MusECore::iMarker i = marker->begin(); i != marker->end(); ++i) { - Marker* m = &i->second; + MusECore::Marker* m = &i->second; if(m == mitem->marker()) { found = true; @@ -485,9 +486,9 @@ void MarkerView::updateList() } } // Look for added markers... - for(iMarker i = marker->begin(); i != marker->end(); ++i) + for(MusECore::iMarker i = marker->begin(); i != marker->end(); ++i) { - Marker* m = &i->second; + MusECore::Marker* m = &i->second; bool found = false; MarkerItem* item = (MarkerItem*)table->topLevelItem(0); while(item) @@ -509,10 +510,10 @@ void MarkerView::updateList() table->clear(); table->blockSignals(false); - //MarkerList* marker = song->marker(); - for (iMarker i = marker->begin(); i != marker->end(); ++i) + //MusECore::MarkerList* marker = MusEGlobal::song->marker(); + for (MusECore::iMarker i = marker->begin(); i != marker->end(); ++i) { - Marker* m = &i->second; + MusECore::Marker* m = &i->second; // Changed p3.3.43 //QString tick; @@ -570,8 +571,8 @@ void MarkerView::clicked(QTreeWidgetItem* i) table->clearSelection(); return; } - Pos p(item->tick(), true); - song->setPos(0, p, true, true, false); + MusECore::Pos p(item->tick(), true); + MusEGlobal::song->setPos(0, p, true, true, false); } //--------------------------------------------------------- @@ -589,13 +590,13 @@ void MarkerView::nameChanged(const QString& s) // tickChanged //--------------------------------------------------------- -void MarkerView::tickChanged(const Pos& pos) +void MarkerView::tickChanged(const MusECore::Pos& pos) { MarkerItem* item = (MarkerItem*)table->currentItem(); if (item) { item->setTick(pos.tick()); - Pos p(pos.tick(), true); - song->setPos(0, p, true, true, false); + MusECore::Pos p(pos.tick(), true); + MusEGlobal::song->setPos(0, p, true, true, false); table->sortByColumn(COL_TICK, Qt::AscendingOrder); } } @@ -621,23 +622,23 @@ void MarkerView::lockChanged(bool lck) void MarkerView::markerChanged(int val) { - //if (val != Song::MARKER_CUR) + //if (val != MusECore::Song::MARKER_CUR) // return; // p3.3.43 switch(val) { // MARKER_CUR, MARKER_ADD, MARKER_REMOVE, MARKER_NAME, // MARKER_TICK, MARKER_LOCK - case Song::MARKER_ADD: - case Song::MARKER_REMOVE: + case MusECore::Song::MARKER_ADD: + case MusECore::Song::MARKER_REMOVE: updateList(); break; // Try falling through and let it try to select something. No, let updateList() do it... - case Song::MARKER_CUR: + case MusECore::Song::MARKER_CUR: { - MarkerList* marker = song->marker(); - for (iMarker i = marker->begin(); i != marker->end(); ++i) { + MusECore::MarkerList* marker = MusEGlobal::song->marker(); + for (MusECore::iMarker i = marker->begin(); i != marker->end(); ++i) { if (i->second.current()) { MarkerItem* item = (MarkerItem*)table->topLevelItem(0); while (item) { @@ -659,30 +660,32 @@ void MarkerView::markerChanged(int val) void MarkerView::nextMarker() { - unsigned int curPos = song->cpos();//prevent compiler warning: comparison of sigend/unsigned + unsigned int curPos = MusEGlobal::song->cpos();//prevent compiler warning: comparison of sigend/unsigned unsigned int nextPos = 0xFFFFFFFF; - MarkerList* marker = song->marker(); - for (iMarker i = marker->begin(); i != marker->end(); ++i) { + MusECore::MarkerList* marker = MusEGlobal::song->marker(); + for (MusECore::iMarker i = marker->begin(); i != marker->end(); ++i) { if (i->second.tick() > curPos && i->second.tick() < nextPos) nextPos = i->second.tick(); } if (nextPos == 0xFFFFFFFF) return; - Pos p(nextPos, true); - song->setPos(0, p, true, true, false); + MusECore::Pos p(nextPos, true); + MusEGlobal::song->setPos(0, p, true, true, false); } void MarkerView::prevMarker() { - unsigned int curPos = song->cpos();//prevent compiler warning: comparison of sigend/unsigned + unsigned int curPos = MusEGlobal::song->cpos();//prevent compiler warning: comparison of sigend/unsigned unsigned int nextPos = 0; - MarkerList* marker = song->marker(); - for (iMarker i = marker->begin(); i != marker->end(); ++i) { + MusECore::MarkerList* marker = MusEGlobal::song->marker(); + for (MusECore::iMarker i = marker->begin(); i != marker->end(); ++i) { if (i->second.tick() < curPos && i->second.tick() > nextPos) nextPos = i->second.tick(); } /* if (nextPos == 0) return;*/ - Pos p(nextPos, true); - song->setPos(0, p, true, true, false); + MusECore::Pos p(nextPos, true); + MusEGlobal::song->setPos(0, p, true, true, false); } + +} // namespace MusEGui diff --git a/muse2/muse/marker/markerview.h b/muse2/muse/marker/markerview.h index 48d4901a..b50ab7a4 100644 --- a/muse2/muse/marker/markerview.h +++ b/muse2/muse/marker/markerview.h @@ -37,20 +37,24 @@ namespace Awl { class PosEdit; }; +namespace MusECore { class Marker; ///class PosEdit; class Pos; +} + +namespace MusEGui { //--------------------------------------------------------- // MarkerItem //--------------------------------------------------------- class MarkerItem : public QTreeWidgetItem { - Marker* _marker; + MusECore::Marker* _marker; public: - MarkerItem(QTreeWidget* parent, Marker* m); - Marker* marker() const { return _marker; } + MarkerItem(QTreeWidget* parent, MusECore::Marker* m); + MusECore::Marker* marker() const { return _marker; } unsigned tick() const; const QString name() const; bool lock() const; @@ -84,7 +88,7 @@ class MarkerView : public TopWin { void deleteMarker(); void markerSelectionChanged(); void nameChanged(const QString&); - void tickChanged(const Pos&); + void tickChanged(const MusECore::Pos&); void lockChanged(bool); void markerChanged(int); void clicked(QTreeWidgetItem*); @@ -92,19 +96,21 @@ class MarkerView : public TopWin { void songChanged(int); signals: - void deleted(TopWin*); + void deleted(MusEGui::TopWin*); void closed(); public: MarkerView(QWidget* parent); ~MarkerView(); - virtual void readStatus(Xml&); - virtual void writeStatus(int, Xml&) const; - static void readConfiguration(Xml&); - static void writeConfiguration(int, Xml&); + virtual void readStatus(MusECore::Xml&); + virtual void writeStatus(int, MusECore::Xml&) const; + static void readConfiguration(MusECore::Xml&); + static void writeConfiguration(int, MusECore::Xml&); void nextMarker(); void prevMarker(); }; +} + #endif diff --git a/muse2/muse/master/lmaster.cpp b/muse2/muse/master/lmaster.cpp index ce6010c7..bf31cc91 100644 --- a/muse2/muse/master/lmaster.cpp +++ b/muse2/muse/master/lmaster.cpp @@ -55,6 +55,7 @@ #define LMASTER_MSGBOX_STRING "MusE: List Editor" +namespace MusECore { //don't remove or insert new elements in keyStrs. //only renaming (keeping the semantic sense) is allowed! (flo) @@ -111,6 +112,10 @@ QString keyToString(key_enum key) return keyStrs[keyToIndex(key)]; } +} // namespace MusECore + +namespace MusEGui { + //--------------------------------------------------------- // closeEvent //--------------------------------------------------------- @@ -262,15 +267,15 @@ LMaster::LMaster() pos_editor->hide(); connect(pos_editor, SIGNAL(returnPressed()), SLOT(returnPressed())); key_editor = new QComboBox(view->viewport()); - key_editor->addItems(keyStrs); + key_editor->addItems(MusECore::keyStrs); key_editor->hide(); connect(key_editor, SIGNAL(activated(int)), SLOT(returnPressed())); connect(view, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), SLOT(select(QTreeWidgetItem*, QTreeWidgetItem*))); connect(view, SIGNAL(itemPressed(QTreeWidgetItem*, int)), SLOT(itemPressed(QTreeWidgetItem*, int))); connect(view, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), SLOT(itemDoubleClicked(QTreeWidgetItem*))); - connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); - connect(this, SIGNAL(seekTo(int)), song, SLOT(seekTo(int))); + connect(MusEGlobal::song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); + connect(this, SIGNAL(seekTo(int)), MusEGlobal::song, SLOT(seekTo(int))); connect(tempoButton, SIGNAL(clicked()), SLOT(tempoButtonClicked())); connect(timeSigButton, SIGNAL(clicked()), SLOT(timeSigButtonClicked())); connect(keyButton, SIGNAL(clicked()), SLOT(insertKey())); @@ -300,12 +305,12 @@ void LMaster::insertSig(const AL::SigEvent* ev) // insertTempo //--------------------------------------------------------- -void LMaster::insertTempo(const TEvent* ev) +void LMaster::insertTempo(const MusECore::TEvent* ev) { new LMasterTempoItem(view, ev); } -void LMaster::insertKey(const KeyEvent& ev) +void LMaster::insertKey(const MusECore::KeyEvent& ev) { new LMasterKeyEventItem(view, ev); } @@ -325,13 +330,13 @@ void LMaster::updateList() } view->clear(); - const TempoList* t = &tempomap; + const MusECore::TempoList* t = &MusEGlobal::tempomap; const AL::SigList* s = &AL::sigmap; - const KeyList* k = &keymap; + const MusECore::KeyList* k = &MusEGlobal::keymap; - criTEvent it = t->rbegin(); + MusECore::criTEvent it = t->rbegin(); AL::criSigEvent is = s->rbegin(); - criKeyEvent ik = k->rbegin(); + MusECore::criKeyEvent ik = k->rbegin(); // three lists that should be added to the view. // question if it would not be easier to merge the lists and use a sorting algorithm? @@ -402,21 +407,21 @@ void LMaster::updateList() // readStatus //--------------------------------------------------------- -void LMaster::readStatus(Xml& xml) +void LMaster::readStatus(MusECore::Xml& xml) { for (;;) { - Xml::Token token = xml.parse(); + MusECore::Xml::Token token = xml.parse(); const QString& tag = xml.s1(); - if (token == Xml::Error || token == Xml::End) + if (token == MusECore::Xml::Error || token == MusECore::Xml::End) break; switch (token) { - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "midieditor") MidiEditor::readStatus(xml); else xml.unknown("LMaster"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "lmaster") return; default: @@ -429,7 +434,7 @@ void LMaster::readStatus(Xml& xml) // writeStatus //--------------------------------------------------------- -void LMaster::writeStatus(int level, Xml& xml) const +void LMaster::writeStatus(int level, MusECore::Xml& xml) const { xml.tag(level++, "lmaster"); MidiEditor::writeStatus(level, xml); @@ -440,22 +445,22 @@ void LMaster::writeStatus(int level, Xml& xml) const // readConfiguration //--------------------------------------------------------- -void LMaster::readConfiguration(Xml& xml) +void LMaster::readConfiguration(MusECore::Xml& xml) { for (;;) { - Xml::Token token = xml.parse(); + MusECore::Xml::Token token = xml.parse(); const QString& tag = xml.s1(); switch (token) { - case Xml::Error: - case Xml::End: + case MusECore::Xml::Error: + case MusECore::Xml::End: return; - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "topwin") TopWin::readConfiguration(LMASTER, xml); else xml.unknown("LMaster"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "lmaster") return; default: @@ -468,7 +473,7 @@ void LMaster::readConfiguration(Xml& xml) // writeConfiguration //--------------------------------------------------------- -void LMaster::writeConfiguration(int level, Xml& xml) +void LMaster::writeConfiguration(int level, MusECore::Xml& xml) { xml.tag(level++, "lmaster"); TopWin::writeConfiguration(LMASTER, level, xml); @@ -506,20 +511,20 @@ void LMaster::cmd(int cmd) case LMASTER_TEMPO: { LMasterTempoItem* t = (LMasterTempoItem*) l; - audio->msgDeleteTempo(t->tick(), t->tempo(), true); + MusEGlobal::audio->msgDeleteTempo(t->tick(), t->tempo(), true); break; } case LMASTER_SIGEVENT: { LMasterSigEventItem* s = (LMasterSigEventItem*) l; - audio->msgRemoveSig(s->tick(), s->z(), s->n()); + MusEGlobal::audio->msgRemoveSig(s->tick(), s->z(), s->n()); break; } case LMASTER_KEYEVENT: { LMasterKeyEventItem* k = (LMasterKeyEventItem*) l; //keymap.delKey(l->tick()); - audio->msgRemoveKey(k->tick(), k->key()); + MusEGlobal::audio->msgRemoveKey(k->tick(), k->key()); break; } default: @@ -657,7 +662,7 @@ void LMaster::returnPressed() tempo_editor->hide(); repaint(); LMasterTempoItem* e = (LMasterTempoItem*) editedItem; - const TEvent* t = e->getEvent(); + const MusECore::TEvent* t = e->getEvent(); unsigned tick = t->tick; bool conversionOK; double dbl_input = input.toDouble(&conversionOK); @@ -665,16 +670,16 @@ void LMaster::returnPressed() int tempo = (int) ((1000000.0 * 60.0)/dbl_input); if (!editingNewItem) { - song->startUndo(); - audio->msgDeleteTempo(tick, e->tempo(), false); - audio->msgAddTempo(tick, tempo, false); - song->endUndo(SC_TEMPO); + MusEGlobal::song->startUndo(); + MusEGlobal::audio->msgDeleteTempo(tick, e->tempo(), false); + MusEGlobal::audio->msgAddTempo(tick, tempo, false); + MusEGlobal::song->endUndo(SC_TEMPO); } // // New item edited: // else { - audio->msgAddTempo(tick, tempo, true); + MusEGlobal::audio->msgAddTempo(tick, tempo, true); } } else { @@ -700,10 +705,10 @@ void LMaster::returnPressed() if (editedItem->getType() == LMASTER_TEMPO) { LMasterTempoItem* t = (LMasterTempoItem*) editedItem; int tempo = t->tempo(); - song->startUndo(); - audio->msgDeleteTempo(oldtick, tempo, false); - audio->msgAddTempo(newtick, tempo, false); - song->endUndo(SC_TEMPO); + MusEGlobal::song->startUndo(); + MusEGlobal::audio->msgDeleteTempo(oldtick, tempo, false); + MusEGlobal::audio->msgAddTempo(newtick, tempo, false); + MusEGlobal::song->endUndo(SC_TEMPO); // Select the item: QTreeWidgetItem* newSelected = (QTreeWidgetItem*) getItemAtPos(newtick, LMASTER_TEMPO); if (newSelected) { @@ -716,15 +721,15 @@ void LMaster::returnPressed() int z = t->z(); int n = t->n(); if (!editingNewItem) { - song->startUndo(); - audio->msgRemoveSig(oldtick, z, n, false); //Delete first, in order to get sane tick-value + MusEGlobal::song->startUndo(); + MusEGlobal::audio->msgRemoveSig(oldtick, z, n, false); //Delete first, in order to get sane tick-value newtick = pos_editor->pos().tick(); - audio->msgAddSig(newtick, z, n, false); - song->endUndo(SC_SIG); + MusEGlobal::audio->msgAddSig(newtick, z, n, false); + MusEGlobal::song->endUndo(SC_SIG); } else - audio->msgAddSig(newtick, z, n, false); - //audio->msgAddSig(newtick, z, n, true); + MusEGlobal::audio->msgAddSig(newtick, z, n, false); + //MusEGlobal::audio->msgAddSig(newtick, z, n, true); // Select the item: QTreeWidgetItem* newSelected = (QTreeWidgetItem*) getItemAtPos(newtick, LMASTER_SIGEVENT); @@ -735,11 +740,11 @@ void LMaster::returnPressed() } else if (editedItem->getType() == LMASTER_KEYEVENT) { LMasterKeyEventItem* k = (LMasterKeyEventItem*) editedItem; - key_enum key = k->key(); - song->startUndo(); - audio->msgRemoveKey(oldtick, key, false); - audio->msgAddKey(newtick, key, false); - song->endUndo(SC_KEY); + MusECore::key_enum key = k->key(); + MusEGlobal::song->startUndo(); + MusEGlobal::audio->msgRemoveKey(oldtick, key, false); + MusEGlobal::audio->msgAddKey(newtick, key, false); + MusEGlobal::song->endUndo(SC_KEY); // Select the item: QTreeWidgetItem* newSelected = (QTreeWidgetItem*) getItemAtPos(newtick, LMASTER_KEYEVENT); @@ -773,13 +778,13 @@ void LMaster::returnPressed() //printf("adding sig %d %d\n", e->z(),e->n()); int tick = e->tick(); if (!editingNewItem) { - song->startUndo(); - audio->msgRemoveSig(tick, e->z(), e->n(), false); - audio->msgAddSig(tick, newSig.z, newSig.n, false); - song->endUndo(SC_SIG); + MusEGlobal::song->startUndo(); + MusEGlobal::audio->msgRemoveSig(tick, e->z(), e->n(), false); + MusEGlobal::audio->msgAddSig(tick, newSig.z, newSig.n, false); + MusEGlobal::song->endUndo(SC_SIG); } else - audio->msgAddSig(tick, newSig.z, newSig.n, true); + MusEGlobal::audio->msgAddSig(tick, newSig.z, newSig.n, true); } else { printf("Signature is not valid!\n"); @@ -791,21 +796,21 @@ void LMaster::returnPressed() key_editor->hide(); repaint(); LMasterKeyEventItem* e = (LMasterKeyEventItem*) editedItem; - const KeyEvent& t = e->getEvent(); + const MusECore::KeyEvent& t = e->getEvent(); unsigned tick = t.tick; - key_enum key = stringToKey(input); + MusECore::key_enum key = MusECore::stringToKey(input); if (!editingNewItem) { - song->startUndo(); - audio->msgRemoveKey(tick, e->key(), false); - audio->msgAddKey(tick, key, false); - song->endUndo(SC_KEY); + MusEGlobal::song->startUndo(); + MusEGlobal::audio->msgRemoveKey(tick, e->key(), false); + MusEGlobal::audio->msgAddKey(tick, key, false); + MusEGlobal::song->endUndo(SC_KEY); } // // New item edited: // else { - audio->msgAddKey(tick, key, true); + MusEGlobal::audio->msgAddKey(tick, key, true); } } updateList(); @@ -849,7 +854,7 @@ QString LMasterLViewItem::text(int column) const // LMasterKeyEventItem //! Initializes a LMasterKeyEventItem with a KeyEvent //--------------------------------------------------------- -LMasterKeyEventItem::LMasterKeyEventItem(QTreeWidget* parent, const KeyEvent& ev) +LMasterKeyEventItem::LMasterKeyEventItem(QTreeWidget* parent, const MusECore::KeyEvent& ev) : LMasterLViewItem(parent) { keyEvent = ev; @@ -859,7 +864,7 @@ LMasterKeyEventItem::LMasterKeyEventItem(QTreeWidget* parent, const KeyEvent& ev AL::sigmap.tickValues(t, &bar, &beat, &tick); c1.sprintf("%04d.%02d.%03d", bar+1, beat+1, tick); - double time = double(tempomap.tick2frame(t)) / double(MusEGlobal::sampleRate); + double time = double(MusEGlobal::tempomap.tick2frame(t)) / double(MusEGlobal::sampleRate); int min = int(time) / 60; int sec = int(time) % 60; int msec = int((time - (min*60 + sec)) * 1000.0); @@ -879,7 +884,7 @@ LMasterKeyEventItem::LMasterKeyEventItem(QTreeWidget* parent, const KeyEvent& ev // LMasterTempoItem //! Initializes a LMasterTempoItem with a TEvent //--------------------------------------------------------- -LMasterTempoItem::LMasterTempoItem(QTreeWidget* parent, const TEvent* ev) +LMasterTempoItem::LMasterTempoItem(QTreeWidget* parent, const MusECore::TEvent* ev) : LMasterLViewItem(parent) { tempoEvent = ev; @@ -890,7 +895,7 @@ LMasterTempoItem::LMasterTempoItem(QTreeWidget* parent, const TEvent* ev) AL::sigmap.tickValues(t, &bar, &beat, &tick); c1.sprintf("%04d.%02d.%03d", bar+1, beat+1, tick); - double time = double(tempomap.tick2frame(t) /*ev->frame*/) / double(MusEGlobal::sampleRate); + double time = double(MusEGlobal::tempomap.tick2frame(t) /*ev->frame*/) / double(MusEGlobal::sampleRate); int min = int(time) / 60; int sec = int(time) % 60; int msec = int((time - (min*60 + sec)) * 1000.0); @@ -918,7 +923,7 @@ LMasterSigEventItem::LMasterSigEventItem(QTreeWidget* parent, const AL::SigEvent AL::sigmap.tickValues(t, &bar, &beat, &tick); c1.sprintf("%04d.%02d.%03d", bar+1, beat+1, tick); - double time = double(tempomap.tick2frame(t)) / double (MusEGlobal::sampleRate); + double time = double(MusEGlobal::tempomap.tick2frame(t)) / double (MusEGlobal::sampleRate); int min = int(time) / 60; int sec = int(time) % 60; int msec = int((time - (min*60 + sec)) * 1000.0); @@ -944,8 +949,8 @@ void LMaster::tempoButtonClicked() // p.mbt(&m, &b, &t); // m++; //Next bar // int newTick = AL::sigmap.bar2tick(m, b, t); - int newTick = song->cpos(); - TEvent* ev = new TEvent(lastTempo->tempo(), newTick); + int newTick = MusEGlobal::song->cpos(); + MusECore::TEvent* ev = new MusECore::TEvent(lastTempo->tempo(), newTick); new LMasterTempoItem(view, ev); QTreeWidgetItem* newTempoItem = view->topLevelItem(0); //LMasterTempoItem* newTempoItem = new LMasterTempoItem(view, ev); @@ -971,7 +976,7 @@ void LMaster::timeSigButtonClicked() // p.mbt(&m, &b, &t); // m++; // int newTick = AL::sigmap.bar2tick(m, b, t); - int newTick = song->cpos(); + int newTick = MusEGlobal::song->cpos(); AL::SigEvent* ev = new AL::SigEvent(AL::TimeSignature(lastSig->z(), lastSig->n()), newTick); new LMasterSigEventItem(view, ev); QTreeWidgetItem* newSigItem = view->topLevelItem(0); @@ -999,8 +1004,8 @@ void LMaster::insertKey() //m++; //Next bar //int newTick = AL::sigmap.bar2tick(m, b, t); - int newTick = song->cpos(); - new LMasterKeyEventItem(view, KeyEvent(lastKey->key(), newTick)); + int newTick = MusEGlobal::song->cpos(); + new LMasterKeyEventItem(view, MusECore::KeyEvent(lastKey->key(), newTick)); QTreeWidgetItem* newKeyItem = view->topLevelItem(0); editingNewItem = true; // State @@ -1063,5 +1068,20 @@ void LMaster::initShortcuts() void LMaster::comboboxTimerSlot() { - key_editor->showPopup(); + key_editor->showPopup(); } + +//void LMaster::keyPressEvent(QKeyEvent*ev) +//{ +// switch (ev->key()) { +// case Qt::Key_Return: +// // add return as a valid action for editing values too +// cmd (CMD_EDIT_VALUE); +// break; +// default: +// break; +// } +// MidiEditor::keyPressEvent(ev); +//} + +} // namespace MusEGui diff --git a/muse2/muse/master/lmaster.h b/muse2/muse/master/lmaster.h index 4d2c03e9..6bc90019 100644 --- a/muse2/muse/master/lmaster.h +++ b/muse2/muse/master/lmaster.h @@ -43,6 +43,8 @@ using Awl::SigEdit; class QLineEdit; class QComboBox; +namespace MusEGui { + enum LMASTER_LVTYPE { LMASTER_TEMPO = 0, @@ -74,12 +76,12 @@ class LMasterLViewItem : public QTreeWidgetItem { class LMasterTempoItem : public LMasterLViewItem { private: - const TEvent* tempoEvent; + const MusECore::TEvent* tempoEvent; public: - LMasterTempoItem(QTreeWidget* parent, const TEvent* t); + LMasterTempoItem(QTreeWidget* parent, const MusECore::TEvent* t); virtual LMASTER_LVTYPE getType() { return LMASTER_TEMPO; } - const TEvent* getEvent() { return tempoEvent; } + const MusECore::TEvent* getEvent() { return tempoEvent; } virtual unsigned tick() { return tempoEvent->tick; } int tempo() { return tempoEvent->tempo; } }; @@ -91,14 +93,14 @@ class LMasterTempoItem : public LMasterLViewItem { class LMasterKeyEventItem : public LMasterLViewItem { private: - KeyEvent keyEvent; + MusECore::KeyEvent keyEvent; public: - LMasterKeyEventItem(QTreeWidget* parent, const KeyEvent& t); + LMasterKeyEventItem(QTreeWidget* parent, const MusECore::KeyEvent& t); virtual LMASTER_LVTYPE getType() { return LMASTER_KEYEVENT; } - const KeyEvent& getEvent() { return keyEvent; } + const MusECore::KeyEvent& getEvent() { return keyEvent; } virtual unsigned tick() { return keyEvent.tick; } - key_enum key() { return keyEvent.key; } + MusECore::key_enum key() { return keyEvent.key; } }; //--------------------------------------------------------- // LMasterTempoItem @@ -136,9 +138,9 @@ class LMaster : public MidiEditor { virtual void closeEvent(QCloseEvent*); void updateList(); - void insertTempo(const TEvent*); + void insertTempo(const MusECore::TEvent*); void insertSig(const AL::SigEvent*); - void insertKey(const KeyEvent&); + void insertKey(const MusECore::KeyEvent&); LMasterLViewItem* getItemAtPos(unsigned tick, LMASTER_LVTYPE t); void initShortcuts(); QLineEdit* tempo_editor; @@ -152,6 +154,9 @@ class LMaster : public MidiEditor { QAction *tempoAction, *signAction, *posAction, *valAction, *delAction, *keyAction; +// protected: +// virtual void keyPressEvent(QKeyEvent*); + private slots: void select(QTreeWidgetItem*, QTreeWidgetItem*); void itemDoubleClicked(QTreeWidgetItem* item); @@ -168,19 +173,20 @@ class LMaster : public MidiEditor { void configChanged(); signals: - void deleted(TopWin*); + void deleted(MusEGui::TopWin*); void seekTo(int tick); public: LMaster(); ~LMaster(); - virtual void readStatus(Xml&); - virtual void writeStatus(int, Xml&) const; - static void readConfiguration(Xml&); - static void writeConfiguration(int, Xml&); + virtual void readStatus(MusECore::Xml&); + virtual void writeStatus(int, MusECore::Xml&) const; + static void readConfiguration(MusECore::Xml&); + static void writeConfiguration(int, MusECore::Xml&); LMasterLViewItem* getLastOfType(LMASTER_LVTYPE t); }; +} // namespace MusEGui #endif diff --git a/muse2/muse/master/master.cpp b/muse2/muse/master/master.cpp index e9212be9..50c3f518 100644 --- a/muse2/muse/master/master.cpp +++ b/muse2/muse/master/master.cpp @@ -37,6 +37,8 @@ #include "icons.h" #include "audio.h" +namespace MusEGui { + //--------------------------------------------------------- // Master //--------------------------------------------------------- @@ -52,8 +54,8 @@ Master::Master(MidiEditor* e, QWidget* parent, int xmag, int ymag) pos[2] = 0; setFocusPolicy(Qt::StrongFocus); // Tim. setMouseTracking(true); - connect(song, SIGNAL(posChanged(int, unsigned, bool)), this, SLOT(setPos(int, unsigned, bool))); - connect(song, SIGNAL(songChanged(int)), this, SLOT(redraw())); + connect(MusEGlobal::song, SIGNAL(posChanged(int, unsigned, bool)), this, SLOT(setPos(int, unsigned, bool))); + connect(MusEGlobal::song, SIGNAL(songChanged(int)), this, SLOT(redraw())); } //--------------------------------------------------------- @@ -69,10 +71,10 @@ void Master::setPos(int idx, unsigned val, bool adjustScrollbar) int npos = mapx(val); if (adjustScrollbar && idx == 0) { - switch (song->follow()) { - case Song::NO: + switch (MusEGlobal::song->follow()) { + case MusECore::Song::NO: break; - case Song::JUMP: + case MusECore::Song::JUMP: if (npos >= width()) { int ppos = val - rmapxDev(width()/8); if (ppos < 0) @@ -90,7 +92,7 @@ void Master::setPos(int idx, unsigned val, bool adjustScrollbar) npos = mapx(val); } break; - case Song::CONTINUOUS: + case MusECore::Song::CONTINUOUS: if (npos > (width()/2)) { int ppos = pos[idx] - rmapxDev(width()/2); if (ppos < 0) @@ -154,9 +156,9 @@ void Master::pdraw(QPainter& p, const QRect& rect) // draw Canvas Items //--------------------------------------------------- - const TempoList* tl = &tempomap; - for (ciTEvent i = tl->begin(); i != tl->end(); ++i) { - TEvent* e = i->second; + const MusECore::TempoList* tl = &MusEGlobal::tempomap; + for (MusECore::ciTEvent i = tl->begin(); i != tl->end(); ++i) { + MusECore::TEvent* e = i->second; int etick = mapx(i->first); int stick = mapx(i->second->tick); int tempo = mapy(280000 - int(60000000000.0/(e->tempo))); @@ -206,23 +208,23 @@ void Master::draw(QPainter& p, const QRect& rect) void Master::viewMousePressEvent(QMouseEvent* event) { start = event->pos(); - MusEWidget::Tool activeTool = tool; + MusEGui::Tool activeTool = tool; // bool shift = event->state() & ShiftButton; switch (activeTool) { - case MusEWidget::PointerTool: + case MusEGui::PointerTool: drag = DRAG_LASSO_START; break; - case MusEWidget::PencilTool: + case MusEGui::PencilTool: drag = DRAG_NEW; - song->startUndo(); + MusEGlobal::song->startUndo(); newVal(start.x(), start.x(), start.y()); break; - case MusEWidget::RubberTool: + case MusEGui::RubberTool: drag = DRAG_DELETE; - song->startUndo(); + MusEGlobal::song->startUndo(); deleteVal(start.x(), start.x()); break; @@ -272,7 +274,7 @@ void Master::viewMouseReleaseEvent(QMouseEvent*) case DRAG_RESIZE: case DRAG_NEW: case DRAG_DELETE: - song->endUndo(SC_TEMPO); + MusEGlobal::song->endUndo(SC_TEMPO); break; default: break; @@ -288,17 +290,17 @@ bool Master::deleteVal1(unsigned int x1, unsigned int x2) { bool songChanged = false; - TempoList* tl = &tempomap; - for (iTEvent i = tl->begin(); i != tl->end(); ++i) { + MusECore::TempoList* tl = &MusEGlobal::tempomap; + for (MusECore::iTEvent i = tl->begin(); i != tl->end(); ++i) { if (i->first < x1) continue; if (i->first >= x2) break; - iTEvent ii = i; + MusECore::iTEvent ii = i; ++ii; if (ii != tl->end()) { int tempo = ii->second->tempo; - audio->msgDeleteTempo(i->first, tempo, false); + MusEGlobal::audio->msgDeleteTempo(i->first, tempo, false); songChanged = true; } } @@ -317,11 +319,11 @@ void Master::deleteVal(int x1, int x2) void Master::setTool(int t) { - if (tool == MusEWidget::Tool(t)) + if (tool == MusEGui::Tool(t)) return; - tool = MusEWidget::Tool(t); + tool = MusEGui::Tool(t); switch(tool) { - case MusEWidget::PencilTool: + case MusEGui::PencilTool: setCursor(QCursor(*pencilIcon, 4, 15)); break; default: @@ -345,6 +347,8 @@ void Master::newVal(int x1, int x2, int y) xx1 = tmp; } deleteVal1(xx1, xx2); - audio->msgAddTempo(xx1, int(60000000000.0/(280000 - y)), false); + MusEGlobal::audio->msgAddTempo(xx1, int(60000000000.0/(280000 - y)), false); redraw(); } + +} // namespace MusEGui diff --git a/muse2/muse/master/master.h b/muse2/muse/master/master.h index 4f181755..098df9f0 100644 --- a/muse2/muse/master/master.h +++ b/muse2/muse/master/master.h @@ -33,6 +33,8 @@ class QPoint; class QRect; class QToolBar; +namespace MusEGui { + class MidiEditor; class ScrollScale; @@ -40,7 +42,7 @@ class ScrollScale; // Master //--------------------------------------------------------- -class Master : public MusEWidget::View { +class Master : public MusEGui::View { Q_OBJECT enum DragMode { DRAG_OFF, DRAG_NEW, DRAG_MOVE_START, DRAG_MOVE, DRAG_DELETE, DRAG_COPY_START, DRAG_COPY, @@ -49,7 +51,7 @@ class Master : public MusEWidget::View { ScrollScale* vscroll; unsigned pos[3]; QPoint start; - MusEWidget::Tool tool; + MusEGui::Tool tool; DragMode drag; MidiEditor* editor; @@ -80,5 +82,7 @@ class Master : public MusEWidget::View { Master(MidiEditor*, QWidget* parent, int xmag, int ymag); }; +} // namespace MusEGui + #endif diff --git a/muse2/muse/master/masteredit.cpp b/muse2/muse/master/masteredit.cpp index c3fde313..e9d669e1 100644 --- a/muse2/muse/master/masteredit.cpp +++ b/muse2/muse/master/masteredit.cpp @@ -49,6 +49,8 @@ #include <QMenuBar> #include <QMenu> +namespace MusEGui { + int MasterEdit::_rasterInit = 0; //--------------------------------------------------------- @@ -68,7 +70,7 @@ void MasterEdit::closeEvent(QCloseEvent* e) void MasterEdit::songChanged(int type) { if (type & SC_TEMPO) { - int tempo = tempomap.tempo(song->cpos()); + int tempo = MusEGlobal::tempomap.tempo(MusEGlobal::song->cpos()); curTempo->blockSignals(true); curTempo->setValue(double(60000000.0/tempo)); @@ -76,7 +78,7 @@ void MasterEdit::songChanged(int type) } if (type & SC_SIG) { int z, n; - AL::sigmap.timesig(song->cpos(), z, n); + AL::sigmap.timesig(MusEGlobal::song->cpos(), z, n); curSig->blockSignals(true); curSig->setValue(AL::TimeSignature(z, n)); curSig->blockSignals(false); @@ -84,7 +86,7 @@ void MasterEdit::songChanged(int type) } if (type & SC_MASTER) { enableButton->blockSignals(true); - enableButton->setChecked(song->masterFlag()); + enableButton->setChecked(MusEGlobal::song->masterFlag()); enableButton->blockSignals(false); } } @@ -122,7 +124,7 @@ MasterEdit::MasterEdit() transport_toolbar->setObjectName("transport"); transport_toolbar->addActions(MusEGlobal::transportAction->actions()); - MusEWidget::EditToolBar* tools2 = new MusEWidget::EditToolBar(this, MusEWidget::PointerTool | MusEWidget::PencilTool | MusEWidget::RubberTool); + MusEGui::EditToolBar* tools2 = new MusEGui::EditToolBar(this, MusEGui::PointerTool | MusEGui::PencilTool | MusEGui::RubberTool); addToolBar(tools2); QToolBar* enableMaster = addToolBar(tr("Enable master")); @@ -131,9 +133,9 @@ MasterEdit::MasterEdit() enableButton->setCheckable(true); enableButton->setText(tr("Enable")); enableButton->setToolTip(tr("Enable usage of master track")); - enableButton->setChecked(song->masterFlag()); + enableButton->setChecked(MusEGlobal::song->masterFlag()); enableMaster->addWidget(enableButton); - connect(enableButton, SIGNAL(toggled(bool)), song, SLOT(setMasterFlag(bool))); + connect(enableButton, SIGNAL(toggled(bool)), MusEGlobal::song, SLOT(setMasterFlag(bool))); QToolBar* info = addToolBar(tr("Info")); info->setObjectName("Info"); @@ -142,11 +144,11 @@ MasterEdit::MasterEdit() label->setIndent(3); info->addWidget(label); - cursorPos = new MusEWidget::PosLabel(0); + cursorPos = new MusEGui::PosLabel(0); cursorPos->setFixedHeight(22); cursorPos->setToolTip(tr("time at cursor position")); info->addWidget(cursorPos); - tempo = new MusEWidget::TempoLabel(0); + tempo = new MusEGui::TempoLabel(0); tempo->setFixedHeight(22); tempo->setToolTip(tr("tempo at cursor position")); info->addWidget(tempo); @@ -154,7 +156,7 @@ MasterEdit::MasterEdit() const char* rastval[] = { QT_TRANSLATE_NOOP("@default", "Off"), "Bar", "1/2", "1/4", "1/8", "1/16" }; - rasterLabel = new MusEWidget::LabelCombo(tr("Snap"), 0); + rasterLabel = new MusEGui::LabelCombo(tr("Snap"), 0); rasterLabel->setFocusPolicy(Qt::NoFocus); for (int i = 0; i < 6; i++) rasterLabel->insertItem(i, tr(rastval[i])); @@ -164,7 +166,7 @@ MasterEdit::MasterEdit() //---------values for current position--------------- info->addWidget(new QLabel(tr("CurPos "))); - curTempo = new MusEWidget::TempoEdit(0); + curTempo = new MusEGui::TempoEdit(0); curSig = new SigEdit(0); curSig->setValue(AL::TimeSignature(4, 4)); curTempo->setToolTip(tr("tempo at current position")); @@ -172,10 +174,10 @@ MasterEdit::MasterEdit() info->addWidget(curTempo); info->addWidget(curSig); ///connect(curSig, SIGNAL(valueChanged(int,int)), song, SLOT(setSig(int,int))); - connect(curSig, SIGNAL(valueChanged(const AL::TimeSignature&)), song, SLOT(setSig(const AL::TimeSignature&))); + connect(curSig, SIGNAL(valueChanged(const AL::TimeSignature&)), MusEGlobal::song, SLOT(setSig(const AL::TimeSignature&))); ///connect(curTempo, SIGNAL(valueChanged(double)), song, SLOT(setTempo(double))); - connect(curTempo, SIGNAL(tempoChanged(double)), song, SLOT(setTempo(double))); + connect(curTempo, SIGNAL(tempoChanged(double)), MusEGlobal::song, SLOT(setTempo(double))); //--------------------------------------------------- // master @@ -183,17 +185,17 @@ MasterEdit::MasterEdit() int xscale = -20; int yscale = -500; - hscroll = new MusEWidget::ScrollScale(-100, -2, xscale, song->len(), Qt::Horizontal, mainw); - vscroll = new MusEWidget::ScrollScale(-1000, -100, yscale, 120000, Qt::Vertical, mainw); + hscroll = new MusEGui::ScrollScale(-100, -2, xscale, MusEGlobal::song->len(), Qt::Horizontal, mainw); + vscroll = new MusEGui::ScrollScale(-1000, -100, yscale, 120000, Qt::Vertical, mainw); vscroll->setRange(30000, 250000); - time1 = new MusEWidget::MTScale(&_raster, mainw, xscale); - sign = new MusEWidget::SigScale(&_raster, mainw, xscale); -// thits = new MusEWidget::HitScale(&_raster, mainw, xscale); + time1 = new MusEGui::MTScale(&_raster, mainw, xscale); + sign = new MusEGui::SigScale(&_raster, mainw, xscale); +// thits = new MusEGui::HitScale(&_raster, mainw, xscale); canvas = new Master(this, mainw, xscale, yscale); -// zhits = new MusEWidget::HitScale(&_raster, mainw, xscale); - time2 = new MusEWidget::MTScale(&_raster, mainw, xscale); +// zhits = new MusEGui::HitScale(&_raster, mainw, xscale); + time2 = new MusEGui::MTScale(&_raster, mainw, xscale); tscale = new TScale(mainw, yscale); time2->setBarLocator(true); @@ -206,18 +208,18 @@ MasterEdit::MasterEdit() mainGrid->setRowStretch(5, 100); mainGrid->setColumnStretch(1, 100); - mainGrid->addWidget(MusEUtil::hLine(mainw), 0, 1); + mainGrid->addWidget(MusECore::hLine(mainw), 0, 1); mainGrid->addWidget(time1, 1, 1); - mainGrid->addWidget(MusEUtil::hLine(mainw), 2, 1); + mainGrid->addWidget(MusECore::hLine(mainw), 2, 1); mainGrid->addWidget(sign, 3, 1); - mainGrid->addWidget(MusEUtil::hLine(mainw), 4, 1); + mainGrid->addWidget(MusECore::hLine(mainw), 4, 1); // mainGrid->addWidget(thits, 5, 1); -// mainGrid->addWidget(MusEUtil::hLine(mainw), 6, 1); +// mainGrid->addWidget(MusECore::hLine(mainw), 6, 1); mainGrid->addWidget(canvas, 5, 1); mainGrid->addWidget(tscale, 5, 0); - mainGrid->addWidget(MusEUtil::hLine(mainw), 6, 1); + mainGrid->addWidget(MusECore::hLine(mainw), 6, 1); // mainGrid->addWidget(zhits, 9, 1); -// mainGrid->addWidget(MusEUtil::hLine(mainw), 7, 1); +// mainGrid->addWidget(MusECore::hLine(mainw), 7, 1); mainGrid->addWidget(time2, 7, 1); mainGrid->addWidget(hscroll, 8, 1); mainGrid->addWidget(vscroll, 0, 2, 10, 1); @@ -255,8 +257,8 @@ MasterEdit::MasterEdit() connect(tscale, SIGNAL(tempoChanged(int)), SLOT(setTempo(int))); connect(canvas, SIGNAL(tempoChanged(int)), SLOT(setTempo(int))); - connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); - connect(song, SIGNAL(posChanged(int,unsigned,bool)), SLOT(posChanged(int,unsigned,bool))); + connect(MusEGlobal::song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); + connect(MusEGlobal::song, SIGNAL(posChanged(int,unsigned,bool)), SLOT(posChanged(int,unsigned,bool))); connect(canvas, SIGNAL(followEvent(int)), hscroll, SLOT(setOffset(int))); connect(canvas, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned))); @@ -277,16 +279,16 @@ MasterEdit::~MasterEdit() // readStatus //--------------------------------------------------------- -void MasterEdit::readStatus(Xml& xml) +void MasterEdit::readStatus(MusECore::Xml& xml) { for (;;) { - Xml::Token token = xml.parse(); + MusECore::Xml::Token token = xml.parse(); const QString& tag = xml.s1(); switch (token) { - case Xml::Error: - case Xml::End: + case MusECore::Xml::Error: + case MusECore::Xml::End: return; - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "midieditor") MidiEditor::readStatus(xml); else if (tag == "ypos") @@ -299,7 +301,7 @@ void MasterEdit::readStatus(Xml& xml) else xml.unknown("MasterEdit"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "master") { // raster setzen int item = 0; @@ -325,7 +327,7 @@ void MasterEdit::readStatus(Xml& xml) // writeStatus //--------------------------------------------------------- -void MasterEdit::writeStatus(int level, Xml& xml) const +void MasterEdit::writeStatus(int level, MusECore::Xml& xml) const { xml.tag(level++, "master"); xml.intTag(level, "ypos", vscroll->pos()); @@ -338,16 +340,16 @@ void MasterEdit::writeStatus(int level, Xml& xml) const // readConfiguration //--------------------------------------------------------- -void MasterEdit::readConfiguration(Xml& xml) +void MasterEdit::readConfiguration(MusECore::Xml& xml) { for (;;) { - Xml::Token token = xml.parse(); + MusECore::Xml::Token token = xml.parse(); const QString& tag = xml.s1(); switch (token) { - case Xml::Error: - case Xml::End: + case MusECore::Xml::Error: + case MusECore::Xml::End: return; - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "raster") _rasterInit = xml.parseInt(); else if (tag == "topwin") @@ -355,7 +357,7 @@ void MasterEdit::readConfiguration(Xml& xml) else xml.unknown("MasterEdit"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "masteredit") return; default: @@ -368,7 +370,7 @@ void MasterEdit::readConfiguration(Xml& xml) // writeConfiguration //--------------------------------------------------------- -void MasterEdit::writeConfiguration(int level, Xml& xml) +void MasterEdit::writeConfiguration(int level, MusECore::Xml& xml) { xml.tag(level++, "masteredit"); xml.intTag(level, "raster", _rasterInit); @@ -397,7 +399,7 @@ void MasterEdit::posChanged(int idx, unsigned val, bool) { if (idx == 0) { int z, n; - int tempo = tempomap.tempo(val); + int tempo = MusEGlobal::tempomap.tempo(val); AL::sigmap.timesig(val, z, n); curTempo->blockSignals(true); curSig->blockSignals(true); @@ -440,4 +442,4 @@ void MasterEdit::setTempo(int val) } } - +} // namespace MusEGui diff --git a/muse2/muse/master/masteredit.h b/muse2/muse/master/masteredit.h index 4f188813..fdf8dd71 100644 --- a/muse2/muse/master/masteredit.h +++ b/muse2/muse/master/masteredit.h @@ -39,19 +39,17 @@ class QCloseEvent; class QToolBar; class QToolButton; -class Master; -class TScale; - -namespace MusEWidget { +namespace MusEGui { class HitScale; class LabelCombo; +class Master; class MTScale; class PosLabel; class ScrollScale; class SigScale; class TempoEdit; class TempoLabel; -} +class TScale; //--------------------------------------------------------- // MasterEdit @@ -61,21 +59,21 @@ class MasterEdit : public MidiEditor { Q_OBJECT Master* canvas; - MusEWidget::ScrollScale* hscroll; - MusEWidget::ScrollScale* vscroll; - MusEWidget::MTScale* time1; - MusEWidget::MTScale* time2; - MusEWidget::SigScale* sign; - MusEWidget::HitScale* thits; - MusEWidget::HitScale* zhits; + MusEGui::ScrollScale* hscroll; + MusEGui::ScrollScale* vscroll; + MusEGui::MTScale* time1; + MusEGui::MTScale* time2; + MusEGui::SigScale* sign; + MusEGui::HitScale* thits; + MusEGui::HitScale* zhits; TScale* tscale; - MusEWidget::TempoEdit* curTempo; + MusEGui::TempoEdit* curTempo; SigEdit* curSig; - MusEWidget::LabelCombo* rasterLabel; + MusEGui::LabelCombo* rasterLabel; QToolBar* tools; - MusEWidget::PosLabel* cursorPos; - MusEWidget::TempoLabel* tempo; + MusEGui::PosLabel* cursorPos; + MusEGui::TempoLabel* tempo; QToolButton* enableButton; static int _rasterInit; @@ -93,16 +91,18 @@ class MasterEdit : public MidiEditor { // void tempoChanged(double); signals: - void deleted(TopWin*); + void deleted(MusEGui::TopWin*); public: MasterEdit(); ~MasterEdit(); - virtual void readStatus(Xml&); - virtual void writeStatus(int, Xml&) const; - static void readConfiguration(Xml&); - static void writeConfiguration(int, Xml&); + virtual void readStatus(MusECore::Xml&); + virtual void writeStatus(int, MusECore::Xml&) const; + static void readConfiguration(MusECore::Xml&); + static void writeConfiguration(int, MusECore::Xml&); }; +} // namespace MusEGui + #endif diff --git a/muse2/muse/master/tscale.cpp b/muse2/muse/master/tscale.cpp index e25c3454..23e7337b 100644 --- a/muse2/muse/master/tscale.cpp +++ b/muse2/muse/master/tscale.cpp @@ -28,6 +28,8 @@ #include <QMouseEvent> #include <QPainter> +namespace MusEGui { + //--------------------------------------------------------- // TScale //--------------------------------------------------------- @@ -35,8 +37,8 @@ TScale::TScale(QWidget* parent, int ymag) : View(parent, 1, ymag) { - setFont(MusEConfig::config.fonts[4]); - //int w = 4 * QFontMetrics(MusEConfig::config.fonts[4]).width('0'); + setFont(MusEGlobal::config.fonts[4]); + //int w = 4 * QFontMetrics(MusEGlobal::config.fonts[4]).width('0'); int w = 4 * fontMetrics().width('0'); setFixedWidth(w); setMouseTracking(true); @@ -50,7 +52,7 @@ void TScale::pdraw(QPainter& p, const QRect& r) { int y = r.y(); int h = r.height(); - //p.setFont(MusEConfig::config.fonts[4]); + //p.setFont(MusEGlobal::config.fonts[4]); QString s; for (int i = 30000; i <= 250000; i += 10000) { int yy = mapy(280000 - i); @@ -60,7 +62,7 @@ void TScale::pdraw(QPainter& p, const QRect& r) continue; p.drawLine(0, yy, width(), yy); s.setNum(i/1000); - //QFontMetrics fm(MusEConfig::config.fonts[4]); + //QFontMetrics fm(MusEGlobal::config.fonts[4]); //p.drawText(width() - fm.width(s) - 1, yy-2, s); p.drawText(width() - fontMetrics().width(s) - 1, yy-2, s); // Use the window font. Tim p4.0.31 } @@ -76,3 +78,4 @@ void TScale::leaveEvent(QEvent*) emit tempoChanged(-1); } +} // namespace MusEGui diff --git a/muse2/muse/master/tscale.h b/muse2/muse/master/tscale.h index 2c03839f..9f811c53 100644 --- a/muse2/muse/master/tscale.h +++ b/muse2/muse/master/tscale.h @@ -25,11 +25,13 @@ #include "view.h" +namespace MusEGui { + //--------------------------------------------------------- // Tscale //--------------------------------------------------------- -class TScale : public MusEWidget::View { +class TScale : public View { Q_OBJECT double curTempo; @@ -47,5 +49,7 @@ class TScale : public MusEWidget::View { TScale(QWidget*, int); }; +} // namespace MusEGui + #endif diff --git a/muse2/muse/midi.cpp b/muse2/muse/midi.cpp index 5d7fe560..e927674f 100644 --- a/muse2/muse/midi.cpp +++ b/muse2/muse/midi.cpp @@ -47,8 +47,11 @@ #include "gconfig.h" #include "ticksynth.h" +namespace MusECore { + extern void dump(const unsigned char* p, int n); + const unsigned char gmOnMsg[] = { 0x7e, 0x7f, 0x09, 0x01 }; const unsigned char gsOnMsg[] = { 0x41, 0x10, 0x42, 0x12, 0x40, 0x00, 0x7f, 0x00, 0x41 }; const unsigned char gsOnMsg2[] = { 0x41, 0x10, 0x42, 0x12, 0x40, 0x01, 0x33, 0x50, 0x3c }; @@ -68,7 +71,7 @@ const unsigned int mmcDeferredPlayMsgLen = sizeof(mmcDeferredPlayMsg); const unsigned int mmcStopMsgLen = sizeof(mmcStopMsg); const unsigned int mmcLocateMsgLen = sizeof(mmcLocateMsg); -#define CALC_TICK(the_tick) lrintf((float(the_tick) * float(MusEConfig::config.division) + float(div/2)) / float(div)); +#define CALC_TICK(the_tick) lrintf((float(the_tick) * float(MusEGlobal::config.division) + float(div/2)) / float(div)); /*--------------------------------------------------------- * midi_meta_name *---------------------------------------------------------*/ @@ -220,11 +223,11 @@ void buildMidiEventList(EventList* del, const MPEventList* el, MidiTrack* track, if(doLoops) { - if(tick >= song->lPos().tick() && tick < song->rPos().tick()) + if(tick >= MusEGlobal::song->lPos().tick() && tick < MusEGlobal::song->rPos().tick()) { int loopn = ev.loopNum(); - int loopc = audio->loopCount(); - int cmode = song->cycleMode(); // CYCLE_NORMAL, CYCLE_MIX, CYCLE_REPLACE + int loopc = MusEGlobal::audio->loopCount(); + int cmode = MusEGlobal::song->cycleMode(); // CYCLE_NORMAL, CYCLE_MIX, CYCLE_REPLACE // If we want REPLACE and the event was recorded in a previous loop, // just ignore it. This will effectively ignore ALL previous loop events inside // the left and right markers, regardless of where recording was started or stopped. @@ -241,7 +244,7 @@ void buildMidiEventList(EventList* del, const MPEventList* el, MidiTrack* track, if(cmode == Song::CYCLE_NORMAL) { // Not sure of accuracy here. Adjust? Adjusted when used elsewhere? - unsigned endRec = audio->getEndRecordPos().tick(); + unsigned endRec = MusEGlobal::audio->getEndRecordPos().tick(); if((tick < endRec && loopn < loopc) || (tick >= endRec && loopn < (loopc - 1))) continue; } @@ -255,7 +258,7 @@ void buildMidiEventList(EventList* del, const MPEventList* el, MidiTrack* track, e.setType(Note); if (track->type() == Track::DRUM) { //FINDMICHJETZT - int instr = drumInmap[ev.dataA()]; + int instr = MusEGlobal::drumInmap[ev.dataA()]; e.setPitch(instr); } else @@ -269,7 +272,7 @@ void buildMidiEventList(EventList* del, const MPEventList* el, MidiTrack* track, case ME_NOTEOFF: e.setType(Note); if (track->type() == Track::DRUM) { //FINDMICHJETZT - int instr = drumInmap[ev.dataA()]; + int instr = MusEGlobal::drumInmap[ev.dataA()]; e.setPitch(instr); } else @@ -373,10 +376,10 @@ void buildMidiEventList(EventList* del, const MPEventList* el, MidiTrack* track, if(track->type() == Track::DRUM) //FINDMICHJETZT drum controller? { // Is it a drum controller event, according to the track port's instrument? - MidiController *mc = midiPorts[track->outPort()].drumController(ctl); + MidiController *mc = MusEGlobal::midiPorts[track->outPort()].drumController(ctl); if(mc) // Store an index into the drum map. - e.setA((ctl & ~0xff) | drumInmap[ctl & 0x7f]); + e.setA((ctl & ~0xff) | MusEGlobal::drumInmap[ctl & 0x7f]); } e.setB(val); @@ -422,8 +425,8 @@ void buildMidiEventList(EventList* del, const MPEventList* el, MidiTrack* track, break; case 0x6: // Marker { - unsigned ltick = CALC_TICK(tick);//(tick * MusEConfig::config.division + div/2) / div; - song->addMarker(QString((const char*)(data)), ltick, false); + unsigned ltick = CALC_TICK(tick);//(tick * MusEGlobal::config.division + div/2) / div; + MusEGlobal::song->addMarker(QString((const char*)(data)), ltick, false); } break; case 0x5: // Lyrics @@ -438,9 +441,9 @@ void buildMidiEventList(EventList* del, const MPEventList* el, MidiTrack* track, case 0x51: // Tempo { unsigned tempo = data[2] + (data[1] << 8) + (data[0] <<16); - unsigned ltick = CALC_TICK(tick);// (unsigned(tick) * unsigned(MusEConfig::config.division) + unsigned(div/2)) / unsigned(div); + unsigned ltick = CALC_TICK(tick);// (unsigned(tick) * unsigned(MusEGlobal::config.division) + unsigned(div/2)) / unsigned(div); // After ca 10 mins 32 bits will not be enough... This expression has to be changed/factorized or so in some "sane" way... - tempomap.addTempo(ltick, tempo); + MusEGlobal::tempomap.addTempo(ltick, tempo); } break; case 0x58: // Time Signature @@ -450,7 +453,7 @@ void buildMidiEventList(EventList* del, const MPEventList* el, MidiTrack* track, int timesig_n = 1; for (int i = 0; i < n; i++) timesig_n *= 2; - int ltick = CALC_TICK(tick);//(tick * MusEConfig::config.division + div/2) / div; + int ltick = CALC_TICK(tick);//(tick * MusEGlobal::config.division + div/2) / div; ///sigmap.add(ltick, timesig_z, timesig_n); AL::sigmap.add(ltick, AL::TimeSignature(timesig_z, timesig_n)); } @@ -509,7 +512,7 @@ void buildMidiEventList(EventList* del, const MPEventList* el, MidiTrack* track, // // switch off at end of measure // - int endTick = song->roundUpBar(ev.tick()+1); + int endTick = MusEGlobal::song->roundUpBar(ev.tick()+1); ev.setLenTick(endTick-ev.tick()); } else { @@ -534,9 +537,9 @@ void buildMidiEventList(EventList* del, const MPEventList* el, MidiTrack* track, i->first, ev.pitch(), ev.velo()); continue; } - int tick = CALC_TICK(ev.tick()); //(ev.tick() * MusEConfig::config.division + div/2) / div; + int tick = CALC_TICK(ev.tick()); //(ev.tick() * MusEGlobal::config.division + div/2) / div; if (ev.isNote()) { - int lenTick = CALC_TICK(ev.lenTick()); //(ev.lenTick() * MusEConfig::config.division + div/2) / div; + int lenTick = CALC_TICK(ev.lenTick()); //(ev.lenTick() * MusEGlobal::config.division + div/2) / div; ev.setLenTick(lenTick); } ev.setTick(tick); @@ -544,6 +547,10 @@ void buildMidiEventList(EventList* del, const MPEventList* el, MidiTrack* track, } } +} // namespace MusECore + +namespace MusECore { + //--------------------------------------------------------- // midiPortsChanged //--------------------------------------------------------- @@ -561,7 +568,7 @@ void Audio::sendLocalOff() { for (int k = 0; k < MIDI_PORTS; ++k) { for (int i = 0; i < MIDI_CHANNELS; ++i) - midiPorts[k].sendEvent(MidiPlayEvent(0, k, i, ME_CONTROLLER, CTRL_LOCAL_OFF, 0)); + MusEGlobal::midiPorts[k].sendEvent(MusECore::MidiPlayEvent(0, k, i, MusECore::ME_CONTROLLER, MusECore::CTRL_LOCAL_OFF, 0)); } } @@ -572,14 +579,14 @@ void Audio::sendLocalOff() void Audio::panic() { for (int i = 0; i < MIDI_PORTS; ++i) { - MidiPort* port = &midiPorts[i]; + MusECore::MidiPort* port = &MusEGlobal::midiPorts[i]; if (port == 0) // ?? continue; for (int chan = 0; chan < MIDI_CHANNELS; ++chan) { if (MusEGlobal::debugMsg) printf("send all sound of to midi port %d channel %d\n", i, chan); - port->sendEvent(MidiPlayEvent(0, i, chan, ME_CONTROLLER, CTRL_ALL_SOUNDS_OFF, 0), true); - port->sendEvent(MidiPlayEvent(0, i, chan, ME_CONTROLLER, CTRL_RESET_ALL_CTRL, 0), true); + port->sendEvent(MusECore::MidiPlayEvent(0, i, chan, MusECore::ME_CONTROLLER, MusECore::CTRL_ALL_SOUNDS_OFF, 0), true); + port->sendEvent(MusECore::MidiPlayEvent(0, i, chan, MusECore::ME_CONTROLLER, MusECore::CTRL_RESET_ALL_CTRL, 0), true); } } } @@ -599,12 +606,12 @@ void Audio::initDevices() for (int i = 0; i < MIDI_PORTS; ++i) activePorts[i] = false; - MidiTrackList* tracks = song->midis(); - for (iMidiTrack it = tracks->begin(); it != tracks->end(); ++it) { - MidiTrack* track = *it; + MusECore::MidiTrackList* tracks = MusEGlobal::song->midis(); + for (MusECore::iMidiTrack it = tracks->begin(); it != tracks->end(); ++it) { + MusECore::MidiTrack* track = *it; activePorts[track->outPort()] = true; } - if (song->click()) + if (MusEGlobal::song->click()) activePorts[MusEGlobal::clickPort] = true; // @@ -615,8 +622,8 @@ void Audio::initDevices() if (!activePorts[i]) continue; - MidiPort* port = &midiPorts[i]; - MidiInstrument* instr = port->instrument(); + MusECore::MidiPort* port = &MusEGlobal::midiPorts[i]; + MusECore::MidiInstrument* instr = port->instrument(); MidiDevice* md = port->device(); if (instr && md) { @@ -624,7 +631,7 @@ void Audio::initDevices() if (events->empty()) continue; for (iEvent ie = events->begin(); ie != events->end(); ++ie) { - MidiPlayEvent ev(0, i, 0, ie->second); + MusECore::MidiPlayEvent ev(0, i, 0, ie->second); md->putEvent(ev); } activePorts[i] = false; // no standard initialization @@ -641,8 +648,8 @@ void Audio::initDevices() for (int i = 0; i < MIDI_PORTS; ++i) { if (!activePorts[i]) continue; - MidiPort* port = &midiPorts[i]; - switch(song->mtype()) { + MusECore::MidiPort* port = &MusEGlobal::midiPorts[i]; + switch(MusEGlobal::song->mtype()) { case MT_GS: case MT_UNKNOWN: break; @@ -655,8 +662,8 @@ void Audio::initDevices() for (int i = 0; i < MIDI_PORTS; ++i) { if (!activePorts[i]) continue; - MidiPort* port = &midiPorts[i]; - switch(song->mtype()) { + MusECore::MidiPort* port = &MusEGlobal::midiPorts[i]; + switch(MusEGlobal::song->mtype()) { case MT_UNKNOWN: break; case MT_GM: @@ -679,17 +686,17 @@ void Audio::initDevices() // collect events for next audio segment //--------------------------------------------------------- -void Audio::collectEvents(MidiTrack* track, unsigned int cts, unsigned int nts) +void Audio::collectEvents(MusECore::MidiTrack* track, unsigned int cts, unsigned int nts) { int port = track->outPort(); int channel = track->outChannel(); int defaultPort = port; - MidiDevice* md = midiPorts[port].device(); + MidiDevice* md = MusEGlobal::midiPorts[port].device(); PartList* pl = track->parts(); for (iPart p = pl->begin(); p != pl->end(); ++p) { - MidiPart* part = (MidiPart*)(p->second); + MusECore::MidiPart* part = (MusECore::MidiPart*)(p->second); // dont play muted parts if (part->mute()) continue; @@ -726,11 +733,11 @@ void Audio::collectEvents(MidiTrack* track, unsigned int cts, unsigned int nts) if (track->type() == Track::DRUM) { //FINDMICHJETZT ignore muted int instr = ev.pitch(); // ignore muted drums - if (ev.isNote() && drumMap[instr].mute) + if (ev.isNote() && MusEGlobal::drumMap[instr].mute) continue; } unsigned tick = ev.tick() + offset; - unsigned frame = tempomap.tick2frame(tick) + frameOffset; + unsigned frame = MusEGlobal::tempomap.tick2frame(tick) + frameOffset; switch (ev.type()) { case Note: { @@ -742,16 +749,16 @@ void Audio::collectEvents(MidiTrack* track, unsigned int cts, unsigned int nts) // Map drum-notes to the drum-map values // int instr = ev.pitch(); - pitch = drumMap[instr].anote; - port = drumMap[instr].port; //This changes to non-default port - channel = drumMap[instr].channel; - velo = int(double(velo) * (double(drumMap[instr].vol) / 100.0)) ; + pitch = MusEGlobal::drumMap[instr].anote; + port = MusEGlobal::drumMap[instr].port; //This changes to non-default port + channel = MusEGlobal::drumMap[instr].channel; + velo = int(double(velo) * (double(MusEGlobal::drumMap[instr].vol) / 100.0)) ; } else { //FINDMICHJETZT don't transpose for new style drum tracks // // transpose non drum notes // - pitch += (track->transposition + song->globalPitchShift()); + pitch += (track->transposition + MusEGlobal::song->globalPitchShift()); } if (pitch > 127) @@ -772,24 +779,24 @@ void Audio::collectEvents(MidiTrack* track, unsigned int cts, unsigned int nts) if (port == defaultPort) { // If syncing to external midi sync, we cannot use the tempo map. // Therefore we cannot get sub-tick resolution. Just use ticks instead of frames. p3.3.25 - if(extSyncFlag.value()) - md->addScheduledEvent(MidiPlayEvent(tick, port, channel, ME_NOTEON, pitch, velo)); + if(MusEGlobal::extSyncFlag.value()) + md->addScheduledEvent(MusECore::MidiPlayEvent(tick, port, channel, MusECore::ME_NOTEON, pitch, velo)); else - md->addScheduledEvent(MidiPlayEvent(frame, port, channel, ME_NOTEON, pitch, velo)); + md->addScheduledEvent(MusECore::MidiPlayEvent(frame, port, channel, MusECore::ME_NOTEON, pitch, velo)); - md->addStuckNote(MidiPlayEvent(tick + len, port, channel, - veloOff ? ME_NOTEOFF : ME_NOTEON, pitch, veloOff)); + md->addStuckNote(MusECore::MidiPlayEvent(tick + len, port, channel, + veloOff ? MusECore::ME_NOTEOFF : MusECore::ME_NOTEON, pitch, veloOff)); } else { //Handle events to different port than standard. - MidiDevice* mdAlt = midiPorts[port].device(); + MidiDevice* mdAlt = MusEGlobal::midiPorts[port].device(); if (mdAlt) { - if(extSyncFlag.value()) // p3.3.25 - mdAlt->addScheduledEvent(MidiPlayEvent(tick, port, channel, ME_NOTEON, pitch, velo)); + if(MusEGlobal::extSyncFlag.value()) // p3.3.25 + mdAlt->addScheduledEvent(MusECore::MidiPlayEvent(tick, port, channel, MusECore::ME_NOTEON, pitch, velo)); else - mdAlt->addScheduledEvent(MidiPlayEvent(frame, port, channel, ME_NOTEON, pitch, velo)); + mdAlt->addScheduledEvent(MusECore::MidiPlayEvent(frame, port, channel, MusECore::ME_NOTEON, pitch, velo)); - mdAlt->addStuckNote(MidiPlayEvent(tick + len, port, channel, - veloOff ? ME_NOTEOFF : ME_NOTEON, pitch, veloOff)); + mdAlt->addStuckNote(MusECore::MidiPlayEvent(tick + len, port, channel, + veloOff ? MusECore::ME_NOTEOFF : MusECore::ME_NOTEON, pitch, veloOff)); } } @@ -804,41 +811,41 @@ void Audio::collectEvents(MidiTrack* track, unsigned int cts, unsigned int nts) { int ctl = ev.dataA(); // Is it a drum controller event, according to the track port's instrument? - MidiController *mc = midiPorts[defaultPort].drumController(ctl); + MusECore::MidiController *mc = MusEGlobal::midiPorts[defaultPort].drumController(ctl); if(mc) { int instr = ctl & 0x7f; ctl &= ~0xff; - int pitch = drumMap[instr].anote & 0x7f; - port = drumMap[instr].port; //This changes to non-default port - channel = drumMap[instr].channel; - MidiDevice* mdAlt = midiPorts[port].device(); + int pitch = MusEGlobal::drumMap[instr].anote & 0x7f; + port = MusEGlobal::drumMap[instr].port; //This changes to non-default port + channel = MusEGlobal::drumMap[instr].channel; + MidiDevice* mdAlt = MusEGlobal::midiPorts[port].device(); if(mdAlt) { // If syncing to external midi sync, we cannot use the tempo map. // Therefore we cannot get sub-tick resolution. Just use ticks instead of frames. p3.3.25 - if(extSyncFlag.value()) - mdAlt->addScheduledEvent(MidiPlayEvent(tick, port, channel, - ME_CONTROLLER, ctl | pitch, ev.dataB())); + if(MusEGlobal::extSyncFlag.value()) + mdAlt->addScheduledEvent(MusECore::MidiPlayEvent(tick, port, channel, + MusECore::ME_CONTROLLER, ctl | pitch, ev.dataB())); else - mdAlt->addScheduledEvent(MidiPlayEvent(frame, port, channel, - ME_CONTROLLER, ctl | pitch, ev.dataB())); + mdAlt->addScheduledEvent(MusECore::MidiPlayEvent(frame, port, channel, + MusECore::ME_CONTROLLER, ctl | pitch, ev.dataB())); } break; } } - if(extSyncFlag.value()) // p3.3.25 - md->addScheduledEvent(MidiPlayEvent(tick, port, channel, ev)); + if(MusEGlobal::extSyncFlag.value()) // p3.3.25 + md->addScheduledEvent(MusECore::MidiPlayEvent(tick, port, channel, ev)); else - md->addScheduledEvent(MidiPlayEvent(frame, port, channel, ev)); + md->addScheduledEvent(MusECore::MidiPlayEvent(frame, port, channel, ev)); } break; default: - if(extSyncFlag.value()) // p3.3.25 - md->addScheduledEvent(MidiPlayEvent(tick, port, channel, ev)); + if(MusEGlobal::extSyncFlag.value()) // p3.3.25 + md->addScheduledEvent(MusECore::MidiPlayEvent(tick, port, channel, ev)); else - md->addScheduledEvent(MidiPlayEvent(frame, port, channel, ev)); + md->addScheduledEvent(MusECore::MidiPlayEvent(frame, port, channel, ev)); break; } @@ -857,11 +864,11 @@ void Audio::collectEvents(MidiTrack* track, unsigned int cts, unsigned int nts) void Audio::processMidi() { - midiBusy=true; + MusEGlobal::midiBusy=true; // // TODO: syntis should directly write into recordEventList // - for (iMidiDevice id = midiDevices.begin(); id != midiDevices.end(); ++id) { + for (iMidiDevice id = MusEGlobal::midiDevices.begin(); id != MusEGlobal::midiDevices.end(); ++id) { MidiDevice* md = *id; // klumsy hack for synti devices: @@ -870,7 +877,7 @@ void Audio::processMidi() SynthI* s = (SynthI*)md; while (s->eventsPending()) { - MidiRecordEvent ev = s->receiveEvent(); + MusECore::MidiRecordEvent ev = s->receiveEvent(); md->recordEvent(ev); } } @@ -882,12 +889,12 @@ void Audio::processMidi() md->beforeProcess(); } - bool extsync = extSyncFlag.value(); - for (iMidiTrack t = song->midis()->begin(); t != song->midis()->end(); ++t) + bool extsync = MusEGlobal::extSyncFlag.value(); + for (MusECore::iMidiTrack t = MusEGlobal::song->midis()->begin(); t != MusEGlobal::song->midis()->end(); ++t) { - MidiTrack* track = *t; + MusECore::MidiTrack* track = *t; int port = track->outPort(); - MidiDevice* md = midiPorts[port].device(); + MidiDevice* md = MusEGlobal::midiPorts[port].device(); if(md) { // only add track events if the track is unmuted @@ -903,8 +910,8 @@ void Audio::processMidi() // if (track->recordFlag()) { - MPEventList* rl = track->mpevents(); - MidiPort* tport = &midiPorts[port]; + MusECore::MPEventList* rl = track->mpevents(); + MusECore::MidiPort* tport = &MusEGlobal::midiPorts[port]; RouteList* irl = track->inRoutes(); for(ciRoute r = irl->begin(); r != irl->end(); ++r) { @@ -913,7 +920,7 @@ void Audio::processMidi() int devport = r->midiPort; // if (devport == -1) continue; - MidiDevice* dev = midiPorts[devport].device(); // + MidiDevice* dev = MusEGlobal::midiPorts[devport].device(); // if(!dev) continue; int channelMask = r->channel; @@ -926,13 +933,13 @@ void Audio::processMidi() if(!dev->sysexFIFOProcessed()) { // Set to the sysex fifo at first. - MidiRecFifo& rf = dev->recordEvents(MIDI_CHANNELS); + MusECore::MidiRecFifo& rf = dev->recordEvents(MIDI_CHANNELS); // Get the frozen snapshot of the size. int count = dev->tmpRecordCount(MIDI_CHANNELS); for(int i = 0; i < count; ++i) { - MidiPlayEvent event(rf.peek(i)); + MusECore::MidiPlayEvent event(rf.peek(i)); event.setPort(port); // dont't echo controller changes back to software // synthesizer: @@ -940,21 +947,21 @@ void Audio::processMidi() md->addScheduledEvent(event); // If syncing externally the event time is already in units of ticks, set above. p3.3.25 if(!extsync) - event.setTime(tempomap.frame2tick(event.time())); // set tick time + event.setTime(MusEGlobal::tempomap.frame2tick(event.time())); // set tick time if(recording) rl->add(event); } dev->setSysexFIFOProcessed(true); } - MidiRecFifo& rf = dev->recordEvents(channel); + MusECore::MidiRecFifo& rf = dev->recordEvents(channel); int count = dev->tmpRecordCount(channel); for(int i = 0; i < count; ++i) { - MidiPlayEvent event(rf.peek(i)); + MusECore::MidiPlayEvent event(rf.peek(i)); int defaultPort = devport; int drumRecPitch=0; //prevent compiler warning: variable used without initialization - MidiController *mc = 0; + MusECore::MidiController *mc = 0; int ctl = 0; //Hmmm, hehhh... @@ -975,12 +982,12 @@ void Audio::processMidi() if (track->type() == Track::DRUM) //FINDMICHJETZT schwierig... { int pitch = event.dataA(); - //Map note that is played according to drumInmap - drumRecPitch = drumMap[(unsigned int)drumInmap[pitch]].enote; - devport = drumMap[(unsigned int)drumInmap[pitch]].port; + //Map note that is played according to MusEGlobal::drumInmap + drumRecPitch = MusEGlobal::drumMap[(unsigned int)MusEGlobal::drumInmap[pitch]].enote; + devport = MusEGlobal::drumMap[(unsigned int)MusEGlobal::drumInmap[pitch]].port; event.setPort(devport); - channel = drumMap[(unsigned int)drumInmap[pitch]].channel; - event.setA(drumMap[(unsigned int)drumInmap[pitch]].anote); + channel = MusEGlobal::drumMap[(unsigned int)MusEGlobal::drumInmap[pitch]].channel; + event.setA(MusEGlobal::drumMap[(unsigned int)MusEGlobal::drumInmap[pitch]].anote); event.setChannel(channel); } else @@ -1007,7 +1014,7 @@ void Audio::processMidi() } } else - if(event.type() == ME_CONTROLLER) + if(event.type() == MusECore::ME_CONTROLLER) { if(track->type() == Track::DRUM) //FINDMICHJETZT was ist das? { @@ -1019,13 +1026,13 @@ void Audio::processMidi() { int pitch = ctl & 0x7f; ctl &= ~0xff; - int dmindex = drumInmap[pitch] & 0x7f; - //Map note that is played according to drumInmap - drumRecPitch = drumMap[dmindex].enote; - devport = drumMap[dmindex].port; + int dmindex = MusEGlobal::drumInmap[pitch] & 0x7f; + //Map note that is played according to MusEGlobal::drumInmap + drumRecPitch = MusEGlobal::drumMap[dmindex].enote; + devport = MusEGlobal::drumMap[dmindex].port; event.setPort(devport); - channel = drumMap[dmindex].channel; - event.setA(ctl | drumMap[dmindex].anote); + channel = MusEGlobal::drumMap[dmindex].channel; + event.setA(ctl | MusEGlobal::drumMap[dmindex].anote); event.setChannel(channel); } } @@ -1051,7 +1058,7 @@ void Audio::processMidi() } else { // Hmm, this appears to work, but... Will this induce trouble with md->setNextPlayEvent?? - MidiDevice* mdAlt = midiPorts[devport].device(); + MidiDevice* mdAlt = MusEGlobal::midiPorts[devport].device(); if(mdAlt && track->recEcho()) //mdAlt->playEvents()->add(event); mdAlt->addScheduledEvent(event); @@ -1063,7 +1070,7 @@ void Audio::processMidi() // If syncing externally the event time is already in units of ticks, set above. p3.3.25 if(!extsync) - event.setTime(tempomap.frame2tick(event.time())); // set tick time + event.setTime(MusEGlobal::tempomap.frame2tick(event.time())); // set tick time // Special handling of events stored in rec-lists. a bit hACKish. TODO: Clean up (after 0.7)! :-/ (ml) if (recording) @@ -1077,7 +1084,7 @@ void Audio::processMidi() // Is it a drum controller event? if(mc) { - MidiPlayEvent drumRecEvent = event; + MusECore::MidiPlayEvent drumRecEvent = event; drumRecEvent.setA(ctl | drumRecPitch); // In this case, preVelo is simply the controller value. drumRecEvent.setB(preVelo); @@ -1087,7 +1094,7 @@ void Audio::processMidi() } else { - MidiPlayEvent drumRecEvent = event; + MusECore::MidiPlayEvent drumRecEvent = event; drumRecEvent.setA(drumRecPitch); drumRecEvent.setB(preVelo); // Tested: Events were not being recorded for a drum map entry pointing to a @@ -1102,7 +1109,7 @@ void Audio::processMidi() else { // Restore record-pitch to non-transposed value since we don't want the note transposed twice next - MidiPlayEvent recEvent = event; + MusECore::MidiPlayEvent recEvent = event; if (prePitch) recEvent.setA(prePitch); if (preVelo) @@ -1125,8 +1132,8 @@ void Audio::processMidi() MidiDevice* md = 0; if (MusEGlobal::midiClickFlag) - md = midiPorts[MusEGlobal::clickPort].device(); - if (song->click() && (isPlaying() || state == PRECOUNT)) { + md = MusEGlobal::midiPorts[MusEGlobal::clickPort].device(); + if (MusEGlobal::song->click() && (isPlaying() || state == PRECOUNT)) { int bar, beat; unsigned tick; bool isMeasure = false; @@ -1138,12 +1145,12 @@ void Audio::processMidi() else if (state == PRECOUNT) { isMeasure = (clickno % clicksMeasure) == 0; } - //int frame = tempomap.tick2frame(midiClick) + frameOffset; - int evtime = extsync ? midiClick : tempomap.tick2frame(midiClick) + frameOffset; // p3.3.25 + //int frame = MusEGlobal::tempomap.tick2frame(midiClick) + frameOffset; + int evtime = extsync ? midiClick : MusEGlobal::tempomap.tick2frame(midiClick) + frameOffset; // p3.3.25 if (md) { - //MidiPlayEvent ev(frame, MusEGlobal::clickPort, MusEGlobal::clickChan, ME_NOTEON, - MidiPlayEvent ev(evtime, MusEGlobal::clickPort, MusEGlobal::clickChan, ME_NOTEON, + //MusECore::MidiPlayEvent ev(frame, MusEGlobal::clickPort, MusEGlobal::clickChan, MusECore::ME_NOTEON, + MusECore::MidiPlayEvent ev(evtime, MusEGlobal::clickPort, MusEGlobal::clickChan, MusECore::ME_NOTEON, MusEGlobal::beatClickNote, MusEGlobal::beatClickVelo); if (isMeasure) { @@ -1157,8 +1164,8 @@ void Audio::processMidi() md->addStuckNote(ev); } if (MusEGlobal::audioClickFlag) { - //MidiPlayEvent ev1(frame, 0, 0, ME_NOTEON, 0, 0); - MidiPlayEvent ev(evtime, 0, 0, ME_NOTEON, 0, 0); + //MusECore::MidiPlayEvent ev1(frame, 0, 0, MusECore::ME_NOTEON, 0, 0); + MusECore::MidiPlayEvent ev(evtime, 0, 0, MusECore::ME_NOTEON, 0, 0); ev.setA(isMeasure ? 0 : 1); metronome->addScheduledEvent(ev); // Built-in metronome synth does not use stuck notes... @@ -1178,7 +1185,7 @@ void Audio::processMidi() // // Play all midi events up to curFrame. // - for(iMidiDevice id = midiDevices.begin(); id != midiDevices.end(); ++id) + for(iMidiDevice id = MusEGlobal::midiDevices.begin(); id != MusEGlobal::midiDevices.end(); ++id) { // We are done with the 'frozen' recording fifos, remove the events. (*id)->afterProcess(); // p4.0.34 @@ -1188,6 +1195,7 @@ void Audio::processMidi() //if((*id)->deviceType() == MidiDevice::JACK_MIDI) (*id)->processMidi(); } - midiBusy=false; + MusEGlobal::midiBusy=false; } +} // namespace MusECore diff --git a/muse2/muse/midi.h b/muse2/muse/midi.h index f137d7e5..0d83b7ae 100644 --- a/muse2/muse/midi.h +++ b/muse2/muse/midi.h @@ -31,6 +31,10 @@ class QString; +namespace MusECore { + +class EventList; + enum { ME_NOTEOFF = 0x80, ME_NOTEON = 0x90, @@ -84,11 +88,12 @@ QString midiMetaName(int); // A special MusE soft synth sysex manufacturer ID. #define MUSE_SYNTH_SYSEX_MFG_ID 0x7c -class EventList; class MPEventList; class MidiTrack; extern void buildMidiEventList(EventList* mel, const MPEventList* el, MidiTrack* track, int division, bool /*addSysexMeta*/, bool /*doLoops*/); // extern bool checkSysex(MidiTrack* track, unsigned int len, unsigned char* buf); +} // namespace MusECore + #endif diff --git a/muse2/muse/midictrl.cpp b/muse2/muse/midictrl.cpp index d7cf1230..11849ce7 100644 --- a/muse2/muse/midictrl.cpp +++ b/muse2/muse/midictrl.cpp @@ -28,6 +28,8 @@ #include "xml.h" #include "globals.h" +namespace MusECore { + static const char* ctrlName[] = { "BankSelMSB", "Modulation", "BreathCtrl", "Control 3", "Foot Ctrl", "Porta Time", "DataEntMSB", "MainVolume", "Balance", "Control 9", @@ -863,3 +865,5 @@ MidiControllerList::MidiControllerList(const MidiControllerList& mcl) : std::map // copy(mcl); // return *this; //} + +} // namespace MusECore diff --git a/muse2/muse/midictrl.h b/muse2/muse/midictrl.h index 8f3c9d16..8a0a3c6d 100644 --- a/muse2/muse/midictrl.h +++ b/muse2/muse/midictrl.h @@ -29,6 +29,11 @@ #include <QString> +namespace MusECore { + +class Xml; +class Part; + const int CTRL_HBANK = 0x00; const int CTRL_LBANK = 0x20; @@ -94,9 +99,6 @@ const int CTRL_RPN14_OFFSET = 0x50000; const int CTRL_NRPN14_OFFSET = 0x60000; const int CTRL_NONE_OFFSET = 0x70000; -class Xml; -class Part; - //--------------------------------------------------------- // MidiController //--------------------------------------------------------- @@ -267,6 +269,7 @@ typedef std::map<int, int, std::less<int> > MidiCtl2LadspaPortMap; typedef MidiCtl2LadspaPortMap::iterator iMidiCtl2LadspaPort; typedef MidiCtl2LadspaPortMap::const_iterator ciMidiCtl2LadspaPort; +} // namespace MusECore #endif diff --git a/muse2/muse/mididev.cpp b/muse2/muse/mididev.cpp index 1c5280f0..3bec7716 100644 --- a/muse2/muse/mididev.cpp +++ b/muse2/muse/mididev.cpp @@ -44,16 +44,21 @@ #include "part.h" //#include "mpevent.h" +namespace MusEGlobal { +MusECore::MidiDeviceList midiDevices; +extern unsigned int volatile lastExtMidiSyncTick; +} + +namespace MusECore { + #ifdef MIDI_DRIVER_MIDI_SERIAL extern void initMidiSerial(); #endif extern bool initMidiAlsa(); extern bool initMidiJack(); -MidiDeviceList midiDevices; extern void processMidiInputTransformPlugins(MEvent&); -extern unsigned int volatile lastExtMidiSyncTick; //--------------------------------------------------------- // initMidiDevices @@ -230,15 +235,15 @@ void MidiDevice::recordEvent(MidiRecordEvent& event) { // p3.3.35 // TODO: Tested, but record resolution not so good. Switch to wall clock based separate list in MidiDevice. And revert this line. - //event.setTime(audio->timestamp()); - event.setTime(extSyncFlag.value() ? lastExtMidiSyncTick : audio->timestamp()); + //event.setTime(MusEGlobal::audio->timestamp()); + event.setTime(MusEGlobal::extSyncFlag.value() ? MusEGlobal::lastExtMidiSyncTick : MusEGlobal::audio->timestamp()); //printf("MidiDevice::recordEvent event time:%d\n", event.time()); // By T356. Set the loop number which the event came in at. - //if(audio->isRecording()) - if(audio->isPlaying()) - event.setLoopNum(audio->loopCount()); + //if(MusEGlobal::audio->isRecording()) + if(MusEGlobal::audio->isPlaying()) + event.setLoopNum(MusEGlobal::audio->loopCount()); if (MusEGlobal::midiInputTrace) { printf("MidiInput: "); @@ -249,7 +254,7 @@ void MidiDevice::recordEvent(MidiRecordEvent& event) if(_port != -1) { - int idin = midiPorts[_port].syncInfo().idIn(); + int idin = MusEGlobal::midiPorts[_port].syncInfo().idIn(); // p3.3.26 1/23/10 Section was disabled, enabled by Tim. //#if 0 @@ -267,25 +272,25 @@ void MidiDevice::recordEvent(MidiRecordEvent& event) && ((p[1] == 0x7f) || (idin == 0x7f) || (p[1] == idin))) { if (p[2] == 0x06) { //mmcInput(p, n); - midiSeq->mmcInput(_port, p, n); + MusEGlobal::midiSeq->mmcInput(_port, p, n); return; } if (p[2] == 0x01) { //mtcInputFull(p, n); - midiSeq->mtcInputFull(_port, p, n); + MusEGlobal::midiSeq->mtcInputFull(_port, p, n); return; } } else if (p[0] == 0x7e) { //nonRealtimeSystemSysex(p, n); - midiSeq->nonRealtimeSystemSysex(_port, p, n); + MusEGlobal::midiSeq->nonRealtimeSystemSysex(_port, p, n); return; } } } else // Trigger general activity indicator detector. Sysex has no channel, don't trigger. - midiPorts[_port].syncInfo().trigActDetect(event.channel()); + MusEGlobal::midiPorts[_port].syncInfo().trigActDetect(event.channel()); //#endif @@ -313,11 +318,11 @@ void MidiDevice::recordEvent(MidiRecordEvent& event) // if (typ == ME_NOTEON) { int pv = ((event.dataA() & 0xff)<<8) + (event.dataB() & 0xff); - song->putEvent(pv); + MusEGlobal::song->putEvent(pv); } else if (typ == ME_NOTEOFF) { int pv = ((event.dataA() & 0xff)<<8) + (0x00); //send an event with velo=0 - song->putEvent(pv); + MusEGlobal::song->putEvent(pv); } // Do not bother recording if it is NOT actually being used by a port. @@ -401,7 +406,7 @@ bool MidiDevice::sendNullRPNParams(int chn, bool nrpn) if(_port == -1) return false; - int nv = midiPorts[_port].nullSendValue(); + int nv = MusEGlobal::midiPorts[_port].nullSendValue(); if(nv == -1) return false; @@ -470,7 +475,7 @@ bool MidiDevice::putEvent(const MidiPlayEvent& ev) } if (a == CTRL_PROGRAM) { // don't output program changes for GM drum channel - if (!(song->mtype() == MT_GM && chn == 9)) { + if (!(MusEGlobal::song->mtype() == MT_GM && chn == 9)) { int hb = (b >> 16) & 0xff; int lb = (b >> 8) & 0xff; int pr = b & 0x7f; @@ -554,12 +559,12 @@ bool MidiDevice::putEvent(const MidiPlayEvent& ev) void MidiDevice::processStuckNotes() { // Must be playing for valid nextTickPos, right? But wasn't checked in Audio::processMidi(). - // audio->isPlaying() might not be true during seek right now. - //if(audio->isPlaying()) + // MusEGlobal::audio->isPlaying() might not be true during seek right now. + //if(MusEGlobal::audio->isPlaying()) { - bool extsync = extSyncFlag.value(); - int frameOffset = audio->getFrameOffset(); - unsigned nextTick = audio->nextTick(); + bool extsync = MusEGlobal::extSyncFlag.value(); + int frameOffset = MusEGlobal::audio->getFrameOffset(); + unsigned nextTick = MusEGlobal::audio->nextTick(); iMPEvent k; for (k = _stuckNotes.begin(); k != _stuckNotes.end(); ++k) { if (k->time() >= nextTick) @@ -568,7 +573,7 @@ void MidiDevice::processStuckNotes() if(extsync) // p3.3.25 ev.setTime(k->time()); else - ev.setTime(tempomap.tick2frame(k->time()) + frameOffset); + ev.setTime(MusEGlobal::tempomap.tick2frame(k->time()) + frameOffset); _playEvents.add(ev); } _stuckNotes.erase(_stuckNotes.begin(), k); @@ -603,7 +608,7 @@ void MidiDevice::handleStop() // reset sustain //--------------------------------------------------- - MidiPort* mp = &midiPorts[_port]; + MidiPort* mp = &MusEGlobal::midiPorts[_port]; for(int ch = 0; ch < MIDI_CHANNELS; ++ch) { if(mp->hwCtrlState(ch, CTRL_SUSTAIN) == 127) @@ -619,7 +624,7 @@ void MidiDevice::handleStop() //--------------------------------------------------- // Don't send if external sync is on. The master, and our sync routing system will take care of that. - if(!extSyncFlag.value()) + if(!MusEGlobal::extSyncFlag.value()) { // Shall we check open flags? //if(!(dev->rwFlags() & 0x1) || !(dev->openFlags() & 1)) @@ -641,7 +646,7 @@ void MidiDevice::handleStop() // (Could try now that this is in MidiDevice. p4.0.22 ) /* if(!si.sendContNotStart()) - mp->sendSongpos(audio->tickPos() * 4 / MusEConfig::config.division); + mp->sendSongpos(MusEGlobal::audio->tickPos() * 4 / MusEGlobal::config.division); */ } } @@ -661,7 +666,7 @@ void MidiDevice::handleSeek() // If playing, clear all notes and handle stuck notes //--------------------------------------------------- - if(audio->isPlaying()) + if(MusEGlobal::audio->isPlaying()) { _playEvents.clear(); for(iMPEvent i = _stuckNotes.begin(); i != _stuckNotes.end(); ++i) @@ -673,9 +678,9 @@ void MidiDevice::handleSeek() _stuckNotes.clear(); } - MidiPort* mp = &midiPorts[_port]; + MidiPort* mp = &MusEGlobal::midiPorts[_port]; MidiCtrlValListList* cll = mp->controller(); - int pos = audio->tickPos(); + int pos = MusEGlobal::audio->tickPos(); //--------------------------------------------------- // Send new contoller values @@ -700,7 +705,7 @@ void MidiDevice::handleSeek() //--------------------------------------------------- // Don't send if external sync is on. The master, and our sync routing system will take care of that. - if(!extSyncFlag.value()) + if(!MusEGlobal::extSyncFlag.value()) { if(mp->syncInfo().MRTOut()) { @@ -711,12 +716,12 @@ void MidiDevice::handleSeek() //if(!(openFlags() & 1)) // continue; - int beat = (pos * 4) / MusEConfig::config.division; + int beat = (pos * 4) / MusEGlobal::config.division; //bool isPlaying = false; //if(state == PLAY) // isPlaying = true; - bool isPlaying = audio->isPlaying(); // Check this it includes LOOP1 and LOOP2 besides PLAY. p4.0.22 + bool isPlaying = MusEGlobal::audio->isPlaying(); // Check this it includes LOOP1 and LOOP2 besides PLAY. p4.0.22 mp->sendStop(); mp->sendSongpos(beat); @@ -726,4 +731,5 @@ void MidiDevice::handleSeek() } } +} // namespace MusECore diff --git a/muse2/muse/mididev.h b/muse2/muse/mididev.h index c9d2c1ef..e2eab0b1 100644 --- a/muse2/muse/mididev.h +++ b/muse2/muse/mididev.h @@ -34,6 +34,9 @@ #include <QString> + +namespace MusECore { + //class RouteList; class Xml; @@ -159,9 +162,14 @@ class MidiDeviceList : public std::list<MidiDevice*> iMidiDevice find(const MidiDevice* dev); }; -extern MidiDeviceList midiDevices; extern void initMidiDevices(); extern bool filterEvent(const MEvent& event, int type, bool thru); +} // namespace MusECore + +namespace MusEGlobal { +extern MusECore::MidiDeviceList midiDevices; +} + #endif diff --git a/muse2/muse/midiedit/dcanvas.cpp b/muse2/muse/midiedit/dcanvas.cpp index c6b39e76..22db70d0 100644 --- a/muse2/muse/midiedit/dcanvas.cpp +++ b/muse2/muse/midiedit/dcanvas.cpp @@ -58,11 +58,13 @@ using MusEGlobal::debugMsg; using MusEGlobal::heavyDebugMsg; +namespace MusEGui { + //--------------------------------------------------------- // DEvent //--------------------------------------------------------- -DEvent::DEvent(Event e, Part* p, int instr) +DEvent::DEvent(MusECore::Event e, MusECore::Part* p, int instr) : CItem(e, p) { int y = instr * TH + TH/2; @@ -75,7 +77,7 @@ DEvent::DEvent(Event e, Part* p, int instr) // addItem //--------------------------------------------------------- -void DrumCanvas::addItem(Part* part, Event& event) +void DrumCanvas::addItem(MusECore::Part* part, MusECore::Event& event) { if (signed(event.tick())<0) { printf("ERROR: trying to add event before current part!\n"); @@ -95,9 +97,9 @@ void DrumCanvas::addItem(Part* part, Event& event) int diff = event.endTick()-part->lenTick(); if (diff > 0) {// too short part? extend it //printf("addItem - this code should not be run!\n"); - //Part* newPart = part->clone(); + //MusECore::Part* newPart = part->clone(); //newPart->setLenTick(newPart->lenTick()+diff); - //audio->msgChangePart(part, newPart,false); + //MusEGlobal::audio->msgChangePart(part, newPart,false); //part = newPart; part->setLenTick(part->lenTick()+diff); } @@ -118,11 +120,11 @@ DrumCanvas::DrumCanvas(MidiEditor* pr, QWidget* parent, int sx, if (old_style_drummap_mode) { if (debugMsg) printf("DrumCanvas in old style drummap mode\n"); - ourDrumMap = drumMap; + ourDrumMap = MusEGlobal::drumMap; must_delete_our_drum_map=false; instrument_number_mapping_t temp; - for (ciPart it=drumEditor->parts()->begin(); it!=drumEditor->parts()->end(); it++) + for (MusECore::ciPart it=drumEditor->parts()->begin(); it!=drumEditor->parts()->end(); it++) temp.tracks.insert(it->second->track()); for (int i=0;i<DRUM_MAPSIZE;i++) @@ -144,10 +146,10 @@ DrumCanvas::DrumCanvas(MidiEditor* pr, QWidget* parent, int sx, cursorPos= QPoint(0,0); _stepSize=1; - steprec=new StepRec(NULL); + steprec=new MusECore::StepRec(NULL); songChanged(SC_TRACK_INSERTED); - connect(song, SIGNAL(midiNote(int, int)), SLOT(midiNote(int,int))); + connect(MusEGlobal::song, SIGNAL(midiNote(int, int)), SLOT(midiNote(int,int))); } DrumCanvas::~DrumCanvas() @@ -163,24 +165,24 @@ DrumCanvas::~DrumCanvas() // moveCanvasItems //--------------------------------------------------------- -Undo DrumCanvas::moveCanvasItems(MusEWidget::CItemList& items, int dp, int dx, DragType dtype) +MusECore::Undo DrumCanvas::moveCanvasItems(CItemList& items, int dp, int dx, DragType dtype) { if(editor->parts()->empty()) - return Undo(); //return empty list + return MusECore::Undo(); //return empty list - PartsToChangeMap parts2change; - Undo operations; + MusECore::PartsToChangeMap parts2change; + MusECore::Undo operations; - for(iPart ip = editor->parts()->begin(); ip != editor->parts()->end(); ++ip) + for(MusECore::iPart ip = editor->parts()->begin(); ip != editor->parts()->end(); ++ip) { - Part* part = ip->second; + MusECore::Part* part = ip->second; if(!part) continue; int npartoffset = 0; - for(MusEWidget::iCItem ici = items.begin(); ici != items.end(); ++ici) + for(iCItem ici = items.begin(); ici != items.end(); ++ici) { - MusEWidget::CItem* ci = ici->second; + CItem* ci = ici->second; if(ci->part() != part) continue; @@ -190,7 +192,7 @@ Undo DrumCanvas::moveCanvasItems(MusEWidget::CItemList& items, int dp, int dx, D // Test moving the item... DEvent* nevent = (DEvent*) ci; - Event event = nevent->event(); + MusECore::Event event = nevent->event(); x = newpos.x(); if(x < 0) x = 0; @@ -206,11 +208,11 @@ Undo DrumCanvas::moveCanvasItems(MusEWidget::CItemList& items, int dp, int dx, D if(npartoffset > 0) { - iPartToChange ip2c = parts2change.find(part); + MusECore::iPartToChange ip2c = parts2change.find(part); if(ip2c == parts2change.end()) { - PartToChange p2c = {0, npartoffset}; - parts2change.insert(std::pair<Part*, PartToChange> (part, p2c)); + MusECore::PartToChange p2c = {0, npartoffset}; + parts2change.insert(std::pair<MusECore::Part*, MusECore::PartToChange> (part, p2c)); } else ip2c->second.xdiff = npartoffset; @@ -218,9 +220,9 @@ Undo DrumCanvas::moveCanvasItems(MusEWidget::CItemList& items, int dp, int dx, D } bool forbidden=false; - for(iPartToChange ip2c = parts2change.begin(); ip2c != parts2change.end(); ++ip2c) + for(MusECore::iPartToChange ip2c = parts2change.begin(); ip2c != parts2change.end(); ++ip2c) { - Part* opart = ip2c->first; + MusECore::Part* opart = ip2c->first; if (opart->hasHiddenEvents()) { forbidden=true; @@ -231,12 +233,12 @@ Undo DrumCanvas::moveCanvasItems(MusEWidget::CItemList& items, int dp, int dx, D if (!forbidden) { - std::vector< MusEWidget::CItem* > doneList; - typedef std::vector< MusEWidget::CItem* >::iterator iDoneList; + std::vector< CItem* > doneList; + typedef std::vector< CItem* >::iterator iDoneList; - for(MusEWidget::iCItem ici = items.begin(); ici != items.end(); ++ici) + for(iCItem ici = items.begin(); ici != items.end(); ++ici) { - MusEWidget::CItem* ci = ici->second; + CItem* ci = ici->second; int x = ci->pos().x(); int y = ci->pos().y(); @@ -266,9 +268,9 @@ Undo DrumCanvas::moveCanvasItems(MusEWidget::CItemList& items, int dp, int dx, D selectItem(ci, false); } - for(iPartToChange ip2c = parts2change.begin(); ip2c != parts2change.end(); ++ip2c) + for(MusECore::iPartToChange ip2c = parts2change.begin(); ip2c != parts2change.end(); ++ip2c) { - Part* opart = ip2c->first; + MusECore::Part* opart = ip2c->first; int diff = ip2c->second.xdiff; schedule_resize_all_same_len_clone_parts(opart, opart->lenTick() + diff, operations); @@ -278,7 +280,7 @@ Undo DrumCanvas::moveCanvasItems(MusEWidget::CItemList& items, int dp, int dx, D } else { - return Undo(); //return empty list + return MusECore::Undo(); //return empty list } } @@ -286,13 +288,13 @@ Undo DrumCanvas::moveCanvasItems(MusEWidget::CItemList& items, int dp, int dx, D // moveItem //--------------------------------------------------------- -UndoOp DrumCanvas::moveItem(MusEWidget::CItem* item, const QPoint& pos, DragType dtype) +MusECore::UndoOp DrumCanvas::moveItem(CItem* item, const QPoint& pos, DragType dtype) { DEvent* nevent = (DEvent*) item; - MidiPart* part = (MidiPart*)nevent->part(); + MusECore::MidiPart* part = (MusECore::MidiPart*)nevent->part(); - Event event = nevent->event(); + MusECore::Event event = nevent->event(); int x = pos.x(); if (x < 0) x = 0; @@ -300,14 +302,14 @@ UndoOp DrumCanvas::moveItem(MusEWidget::CItem* item, const QPoint& pos, DragType if (ntick < 0) ntick = 0; int nheight = y2pitch(pos.y()); - Event newEvent = event.clone(); + MusECore::Event newEvent = event.clone(); - Track* dest_track = part->track(); + MusECore::Track* dest_track = part->track(); if (!instrument_map[nheight].tracks.contains(dest_track)) { printf ("TODO FIXME: tried to move an event into a different track. this is not supported yet, but will be soon. ignoring this one...\n"); //FINDMICH - return UndoOp(); + return MusECore::UndoOp(); } int ev_pitch = instrument_map[nheight].pitch; @@ -321,18 +323,18 @@ UndoOp DrumCanvas::moveItem(MusEWidget::CItem* item, const QPoint& pos, DragType // printf("DrumCanvas::moveItem Error! New event end:%d exceeds length:%d of part:%s\n", newEvent.endTick(), part->lenTick(), part->name().toLatin1().constData()); if (dtype == MOVE_COPY || dtype == MOVE_CLONE) - return UndoOp(UndoOp::AddEvent, newEvent, part, false, false); + return MusECore::UndoOp(MusECore::UndoOp::AddEvent, newEvent, part, false, false); else - return UndoOp(UndoOp::ModifyEvent, newEvent, event, part, false, false); + return MusECore::UndoOp(MusECore::UndoOp::ModifyEvent, newEvent, event, part, false, false); } //--------------------------------------------------------- // newItem //--------------------------------------------------------- -MusEWidget::CItem* DrumCanvas::newItem(const QPoint& p, int state) +CItem* DrumCanvas::newItem(const QPoint& p, int state) { - int instr = y2pitch(p.y()); //drumInmap[y2pitch(p.y())]; + int instr = y2pitch(p.y()); //MusEGlobal::drumInmap[y2pitch(p.y())]; int velo = ourDrumMap[instr].lv4; if (state == Qt::ShiftModifier) velo = ourDrumMap[instr].lv3; @@ -348,7 +350,7 @@ MusEWidget::CItem* DrumCanvas::newItem(const QPoint& p, int state) // newItem //--------------------------------------------------------- -MusEWidget::CItem* DrumCanvas::newItem(int tick, int instrument, int velocity) +CItem* DrumCanvas::newItem(int tick, int instrument, int velocity) { if (!old_style_drummap_mode && !instrument_map[instrument].tracks.contains(curPart->track())) { @@ -358,7 +360,7 @@ MusEWidget::CItem* DrumCanvas::newItem(int tick, int instrument, int velocity) else { tick -= curPart->tick(); - Event e(Note); + MusECore::Event e(MusECore::Note); e.setTick(tick); e.setPitch(instrument_map[instrument].pitch); e.setVelo(velocity); @@ -372,27 +374,27 @@ MusEWidget::CItem* DrumCanvas::newItem(int tick, int instrument, int velocity) // resizeItem //--------------------------------------------------------- -void DrumCanvas::resizeItem(MusEWidget::CItem* item, bool, bool) +void DrumCanvas::resizeItem(CItem* item, bool, bool) { DEvent* nevent = (DEvent*) item; - Event ev = nevent->event(); + MusECore::Event ev = nevent->event(); // Indicate do undo, and do not do port controller values and clone parts. - audio->msgDeleteEvent(ev, nevent->part(), true, false, false); + MusEGlobal::audio->msgDeleteEvent(ev, nevent->part(), true, false, false); } //--------------------------------------------------------- // newItem //--------------------------------------------------------- -void DrumCanvas::newItem(MusEWidget::CItem* item, bool noSnap) { +void DrumCanvas::newItem(CItem* item, bool noSnap) { newItem(item, noSnap,false); } -void DrumCanvas::newItem(MusEWidget::CItem* item, bool noSnap, bool replace) +void DrumCanvas::newItem(CItem* item, bool noSnap, bool replace) { if (item) { DEvent* nevent = (DEvent*) item; - Event event = nevent->event(); + MusECore::Event event = nevent->event(); int x = item->x(); if (!noSnap) x = editor->rasterVal(x); @@ -404,19 +406,19 @@ void DrumCanvas::newItem(MusEWidget::CItem* item, bool noSnap, bool replace) // check for existing event // if found change command semantic from insert to delete // - EventList* el = nevent->part()->events(); - iEvent lower = el->lower_bound(event.tick()); - iEvent upper = el->upper_bound(event.tick()); + MusECore::EventList* el = nevent->part()->events(); + MusECore::iEvent lower = el->lower_bound(event.tick()); + MusECore::iEvent upper = el->upper_bound(event.tick()); - for (iEvent i = lower; i != upper; ++i) { - Event ev = i->second; + for (MusECore::iEvent i = lower; i != upper; ++i) { + MusECore::Event ev = i->second; // Added by T356. Only do notes. if(!ev.isNote()) continue; if (ev.pitch() == npitch) { // Indicate do undo, and do not do port controller values and clone parts. - audio->msgDeleteEvent(ev, nevent->part(), true, false, false); + MusEGlobal::audio->msgDeleteEvent(ev, nevent->part(), true, false, false); if (replace) break; else @@ -426,13 +428,13 @@ void DrumCanvas::newItem(MusEWidget::CItem* item, bool noSnap, bool replace) } // Added by T356. - Part* part = nevent->part(); - Undo operations; + MusECore::Part* part = nevent->part(); + MusECore::Undo operations; int diff = event.endTick()-part->lenTick(); if (! ((diff > 0) && part->hasHiddenEvents()) ) //operation is allowed { - operations.push_back(UndoOp(UndoOp::AddEvent,event, part, false, false)); + operations.push_back(MusECore::UndoOp(MusECore::UndoOp::AddEvent,event, part, false, false)); if (diff > 0) // part must be extended? { @@ -441,7 +443,7 @@ void DrumCanvas::newItem(MusEWidget::CItem* item, bool noSnap, bool replace) } } //else forbid action by not applying it - song->applyOperationGroup(operations); + MusEGlobal::song->applyOperationGroup(operations); songChanged(SC_EVENT_INSERTED); //this forces an update of the itemlist, which is neccessary //to remove "forbidden" events from the list again } @@ -453,11 +455,11 @@ void DrumCanvas::newItem(MusEWidget::CItem* item, bool noSnap, bool replace) // deleteItem //--------------------------------------------------------- -bool DrumCanvas::deleteItem(MusEWidget::CItem* item) +bool DrumCanvas::deleteItem(CItem* item) { - Event ev = ((DEvent*)item)->event(); + MusECore::Event ev = ((DEvent*)item)->event(); // Indicate do undo, and do not do port controller values and clone parts. - audio->msgDeleteEvent(ev, ((DEvent*)item)->part(), true, false, false); + MusEGlobal::audio->msgDeleteEvent(ev, ((DEvent*)item)->part(), true, false, false); return false; } @@ -465,7 +467,7 @@ bool DrumCanvas::deleteItem(MusEWidget::CItem* item) // drawItem //--------------------------------------------------------- -void DrumCanvas::drawItem(QPainter&p, const MusEWidget::CItem*item, const QRect& rect) +void DrumCanvas::drawItem(QPainter&p, const CItem*item, const QRect& rect) { DEvent* e = (DEvent*) item; int x = 0, y = 0; @@ -502,7 +504,7 @@ void DrumCanvas::drawItem(QPainter&p, const MusEWidget::CItem*item, const QRect& else { int velo = e->event().velo(); - DrumMap* dm = &ourDrumMap[y2pitch(y)]; //Get the drum item + MusECore::DrumMap* dm = &ourDrumMap[y2pitch(y)]; //Get the drum item QColor color; if (velo < dm->lv1) color.setRgb(240, 240, 255); @@ -523,7 +525,7 @@ void DrumCanvas::drawItem(QPainter&p, const MusEWidget::CItem*item, const QRect& // draws moving items //--------------------------------------------------------- -void DrumCanvas::drawMoving(QPainter& p, const MusEWidget::CItem* item, const QRect& rect) +void DrumCanvas::drawMoving(QPainter& p, const CItem* item, const QRect& rect) { QPolygon pa(4); QPoint pt = map(item->mp()); @@ -576,7 +578,7 @@ void DrumCanvas::drawCanvas(QPainter& p, const QRect& rect) void DrumCanvas::drawTopItem(QPainter& p, const QRect&) { // draw cursor - if (_tool == MusEWidget::CursorTool) { + if (_tool == CursorTool) { p.setPen(Qt::black); int y = mapy(TH * cursorPos.y()); @@ -615,7 +617,7 @@ void DrumCanvas::cmd(int cmd) { switch (cmd) { case CMD_SELECT_ALL: // select all - for (MusEWidget::iCItem k = items.begin(); k != items.end(); ++k) { + for (iCItem k = items.begin(); k != items.end(); ++k) { if (!k->second->isSelected()) selectItem(k->second, true); } @@ -624,29 +626,29 @@ void DrumCanvas::cmd(int cmd) deselectAll(); break; case CMD_SELECT_INVERT: // invert selection - for (MusEWidget::iCItem k = items.begin(); k != items.end(); ++k) { + for (iCItem k = items.begin(); k != items.end(); ++k) { selectItem(k->second, !k->second->isSelected()); } break; case CMD_SELECT_ILOOP: // select inside loop - for (MusEWidget::iCItem k = items.begin(); k != items.end(); ++k) { + for (iCItem k = items.begin(); k != items.end(); ++k) { DEvent* nevent =(DEvent*)(k->second); - Part* part = nevent->part(); - Event event = nevent->event(); + MusECore::Part* part = nevent->part(); + MusECore::Event event = nevent->event(); unsigned tick = event.tick() + part->tick(); - if (tick < song->lpos() || tick >= song->rpos()) + if (tick < MusEGlobal::song->lpos() || tick >= MusEGlobal::song->rpos()) selectItem(k->second, false); else selectItem(k->second, true); } break; case CMD_SELECT_OLOOP: // select outside loop - for (MusEWidget::iCItem k = items.begin(); k != items.end(); ++k) { + for (iCItem k = items.begin(); k != items.end(); ++k) { DEvent* nevent = (DEvent*)(k->second); - Part* part = nevent->part(); - Event event = nevent->event(); + MusECore::Part* part = nevent->part(); + MusECore::Event event = nevent->event(); unsigned tick = event.tick() + part->tick(); - if (tick < song->lpos() || tick >= song->rpos()) + if (tick < MusEGlobal::song->lpos() || tick >= MusEGlobal::song->rpos()) selectItem(k->second, true); else selectItem(k->second, false); @@ -654,10 +656,10 @@ void DrumCanvas::cmd(int cmd) break; case CMD_SELECT_PREV_PART: // select previous part { - Part* pt = editor->curCanvasPart(); - Part* newpt = pt; - PartList* pl = editor->parts(); - for(iPart ip = pl->begin(); ip != pl->end(); ++ip) + MusECore::Part* pt = editor->curCanvasPart(); + MusECore::Part* newpt = pt; + MusECore::PartList* pl = editor->parts(); + for(MusECore::iPart ip = pl->begin(); ip != pl->end(); ++ip) if(ip->second == pt) { if(ip == pl->begin()) @@ -672,10 +674,10 @@ void DrumCanvas::cmd(int cmd) break; case CMD_SELECT_NEXT_PART: // select next part { - Part* pt = editor->curCanvasPart(); - Part* newpt = pt; - PartList* pl = editor->parts(); - for(iPart ip = pl->begin(); ip != pl->end(); ++ip) + MusECore::Part* pt = editor->curCanvasPart(); + MusECore::Part* newpt = pt; + MusECore::PartList* pl = editor->parts(); + for(MusECore::iPart ip = pl->begin(); ip != pl->end(); ++ip) if(ip->second == pt) { ++ip; @@ -697,19 +699,19 @@ void DrumCanvas::cmd(int cmd) case CMD_FIXED_LEN: //Set notes to the length specified in the drummap if (!selectionSize()) break; - song->startUndo(); - for (MusEWidget::iCItem k = items.begin(); k != items.end(); ++k) { + MusEGlobal::song->startUndo(); + for (iCItem k = items.begin(); k != items.end(); ++k) { if (k->second->isSelected()) { DEvent* devent = (DEvent*)(k->second); - Event event = devent->event(); - Event newEvent = event.clone(); + MusECore::Event event = devent->event(); + MusECore::Event newEvent = event.clone(); // newEvent.setLenTick(drumMap[event.pitch()].len); newEvent.setLenTick(ourDrumMap[y2pitch(devent->y())].len); // Indicate no undo, and do not do port controller values and clone parts. - audio->msgChangeEvent(event, newEvent, devent->part(), false, false, false); + MusEGlobal::audio->msgChangeEvent(event, newEvent, devent->part(), false, false, false); } } - song->endUndo(SC_EVENT_MODIFIED); + MusEGlobal::song->endUndo(SC_EVENT_MODIFIED); break; case CMD_LEFT: { @@ -721,15 +723,15 @@ void DrumCanvas::cmd(int cmd) } 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); } break; case CMD_RIGHT: { int spos = AL::sigmap.raster2(pos[0] + 1, editor->rasterStep(pos[0])); // Nudge by +1, then snap up with raster2. - Pos p(spos,true); - song->setPos(0, p, true, true, true); + MusECore::Pos p(spos,true); + MusEGlobal::song->setPos(0, p, true, true, true); } break; case CMD_LEFT_NOSNAP: @@ -738,14 +740,14 @@ void DrumCanvas::cmd(int cmd) int spos = pos[0] - editor->rasterStep(pos[0]); if (spos < 0) spos = 0; - Pos p(spos,true); - song->setPos(0, p, true, true, true); //CDW + MusECore::Pos p(spos,true); + MusEGlobal::song->setPos(0, p, true, true, true); //CDW } break; case CMD_RIGHT_NOSNAP: { - Pos p(pos[0] + editor->rasterStep(pos[0]), true); - song->setPos(0, p, true, true, true); //CDW + MusECore::Pos p(pos[0] + editor->rasterStep(pos[0]), true); + MusEGlobal::song->setPos(0, p, true, true, true); //CDW } break; } @@ -758,7 +760,7 @@ void DrumCanvas::cmd(int cmd) // startDrag //--------------------------------------------------------- -void DrumCanvas::startDrag(MusEWidget::CItem* /* item*/, bool copymode) +void DrumCanvas::startDrag(CItem* /* item*/, bool copymode) { QMimeData* md = selected_events_to_mime(partlist_to_set(editor->parts()), 1); @@ -814,8 +816,8 @@ void DrumCanvas::keyPressed(int index, int velocity) //FINDMICH later int pitch = ourDrumMap[index].anote; // play note: - MidiPlayEvent e(0, port, channel, 0x90, pitch, velocity); - audio->msgPlayMidiEvent(&e); + MusECore::MidiPlayEvent e(0, port, channel, 0x90, pitch, velocity); + MusEGlobal::audio->msgPlayMidiEvent(&e); if (_steprec && pos[0] >= start_tick /* && pos[0] < end_tick [removed by flo93: this is handled in steprec->record] */ && curPart) steprec->record(curPart,index,ourDrumMap[index].len,editor->raster(),velocity,MusEGlobal::globalKeyState&Qt::ControlModifier,MusEGlobal::globalKeyState&Qt::ShiftModifier); @@ -834,8 +836,8 @@ void DrumCanvas::keyReleased(int index, bool) //FINDMICH later int pitch = ourDrumMap[index].anote; // release note: - MidiPlayEvent e(0, port, channel, 0x90, pitch, 0); - audio->msgPlayMidiEvent(&e); + MusECore::MidiPlayEvent e(0, port, channel, 0x90, pitch, 0); + MusEGlobal::audio->msgPlayMidiEvent(&e); } //--------------------------------------------------------- @@ -849,89 +851,92 @@ void DrumCanvas::mapChanged(int spitch, int dpitch) if (old_style_drummap_mode) { - Undo operations; - std::vector< std::pair<Part*, Event*> > delete_events; - std::vector< std::pair<Part*, Event> > add_events; + MusECore::Undo operations; + std::vector< std::pair<MusECore::Part*, MusECore::Event*> > delete_events; + std::vector< std::pair<MusECore::Part*, MusECore::Event> > add_events; - typedef std::vector< std::pair<Part*, Event*> >::iterator idel_ev; - typedef std::vector< std::pair<Part*, Event> >::iterator iadd_ev; + typedef std::vector< std::pair<MusECore::Part*, MusECore::Event*> >::iterator idel_ev; + typedef std::vector< std::pair<MusECore::Part*, MusECore::Event> >::iterator iadd_ev; - MidiTrackList* tracks = song->midis(); - for (ciMidiTrack t = tracks->begin(); t != tracks->end(); t++) { - MidiTrack* curTrack = *t; - if (curTrack->type() != Track::DRUM) + MusECore::MidiTrackList* tracks = MusEGlobal::song->midis(); + for (MusECore::ciMidiTrack t = tracks->begin(); t != tracks->end(); t++) { + MusECore::MidiTrack* curTrack = *t; + if (curTrack->type() != MusECore::Track::DRUM) continue; - MidiPort* mp = &midiPorts[curTrack->outPort()]; - PartList* parts= curTrack->parts(); - for (iPart part = parts->begin(); part != parts->end(); ++part) { - EventList* events = part->second->events(); - Part* thePart = part->second; - for (iEvent i = events->begin(); i != events->end(); ++i) { - Event event = i->second; - if(event.type() != Controller && event.type() != Note) + MusECore::MidiPort* mp = &MusEGlobal::midiPorts[curTrack->outPort()]; + MusECore::PartList* parts= curTrack->parts(); + for (MusECore::iPart part = parts->begin(); part != parts->end(); ++part) { + MusECore::EventList* events = part->second->events(); + MusECore::Part* thePart = part->second; + for (MusECore::iEvent i = events->begin(); i != events->end(); ++i) { + MusECore::Event event = i->second; + if(event.type() != MusECore::Controller && event.type() != MusECore::Note) continue; int pitch = event.pitch(); bool drc = false; // Is it a drum controller event, according to the track port's instrument? - if(event.type() == Controller && mp->drumController(event.dataA())) + if(event.type() == MusECore::Controller && mp->drumController(event.dataA())) { drc = true; pitch = event.dataA() & 0x7f; } if (pitch == spitch) { - Event* spitch_event = &(i->second); - delete_events.push_back(std::pair<Part*, Event*>(thePart, spitch_event)); - Event newEvent = spitch_event->clone(); + MusECore::Event* spitch_event = &(i->second); + delete_events.push_back(std::pair<MusECore::Part*, MusECore::Event*>(thePart, spitch_event)); + MusECore::Event newEvent = spitch_event->clone(); if(drc) newEvent.setA((newEvent.dataA() & ~0xff) | dpitch); else newEvent.setPitch(dpitch); - add_events.push_back(std::pair<Part*, Event>(thePart, newEvent)); + add_events.push_back(std::pair<MusECore::Part*, MusECore::Event>(thePart, newEvent)); } else if (pitch == dpitch) { - Event* dpitch_event = &(i->second); - delete_events.push_back(std::pair<Part*, Event*>(thePart, dpitch_event)); - Event newEvent = dpitch_event->clone(); + MusECore::Event* dpitch_event = &(i->second); + delete_events.push_back(std::pair<MusECore::Part*, MusECore::Event*>(thePart, dpitch_event)); + MusECore::Event newEvent = dpitch_event->clone(); if(drc) newEvent.setA((newEvent.dataA() & ~0xff) | spitch); else newEvent.setPitch(spitch); - add_events.push_back(std::pair<Part*, Event>(thePart, newEvent)); + add_events.push_back(std::pair<MusECore::Part*, MusECore::Event>(thePart, newEvent)); } } } } for (idel_ev i = delete_events.begin(); i != delete_events.end(); i++) { - Part* thePart = (*i).first; - Event* theEvent = (*i).second; - operations.push_back(UndoOp(UndoOp::DeleteEvent, *theEvent, thePart, true, false)); + MusECore::Part* thePart = (*i).first; + MusECore::Event* theEvent = (*i).second; + operations.push_back(MusECore::UndoOp(MusECore::UndoOp::DeleteEvent, *theEvent, thePart, true, false)); } - DrumMap dm = drumMap[spitch]; - drumMap[spitch] = drumMap[dpitch]; - drumMap[dpitch] = dm; - drumInmap[int(drumMap[spitch].enote)] = spitch; - drumOutmap[int(drumMap[int(spitch)].anote)] = spitch; - drumInmap[int(drumMap[int(dpitch)].enote)] = dpitch; - drumOutmap[int(drumMap[int(dpitch)].anote)] = dpitch; + MusECore::DrumMap dm = MusEGlobal::drumMap[spitch]; + MusEGlobal::drumMap[spitch] = MusEGlobal::drumMap[dpitch]; + MusEGlobal::drumMap[dpitch] = dm; + MusEGlobal::drumInmap[int(MusEGlobal::drumMap[spitch].enote)] = spitch; + MusEGlobal::drumOutmap[int(MusEGlobal::drumMap[int(spitch)].anote)] = spitch; + MusEGlobal::drumInmap[int(MusEGlobal::drumMap[int(dpitch)].enote)] = dpitch; + MusEGlobal::drumOutmap[int(MusEGlobal::drumMap[int(dpitch)].anote)] = dpitch; for (iadd_ev i = add_events.begin(); i != add_events.end(); i++) { - Part* thePart = (*i).first; - Event& theEvent = (*i).second; - operations.push_back(UndoOp(UndoOp::AddEvent, theEvent, thePart, true, false)); + MusECore::Part* thePart = (*i).first; + MusECore::Event& theEvent = (*i).second; + operations.push_back(MusECore::UndoOp(MusECore::UndoOp::AddEvent, theEvent, thePart, true, false)); } - song->applyOperationGroup(operations, false); // do not indicate undo - song->update(SC_DRUMMAP); //this update is neccessary, as it's not handled by applyOperationGroup() + MusEGlobal::song->applyOperationGroup(operations, false); // do not indicate undo + MusEGlobal::song->update(SC_DRUMMAP); //this update is neccessary, as it's not handled by applyOperationGroup() } else // if (!old_style_drummap_mode) { if (dpitch!=spitch) { - DrumMap dm_temp = ourDrumMap[spitch]; + using MusEGlobal::global_drum_ordering_t; + using MusEGlobal::global_drum_ordering; + + MusECore::DrumMap dm_temp = ourDrumMap[spitch]; instrument_number_mapping_t im_temp = instrument_map[spitch]; global_drum_ordering_t order_temp; @@ -986,9 +991,9 @@ void DrumCanvas::mapChanged(int spitch, int dpitch) } - song->update(SC_DRUMMAP); // this causes a complete rebuild of ourDrumMap - // which also handles the changed order in all - // other drum editors + MusEGlobal::song->update(SC_DRUMMAP); // this causes a complete rebuild of ourDrumMap + // which also handles the changed order in all + // other drum editors } } @@ -1008,23 +1013,23 @@ void DrumCanvas::resizeEvent(QResizeEvent* ev) // modifySelected //--------------------------------------------------------- -void DrumCanvas::modifySelected(MusEWidget::NoteInfo::ValType type, int delta) +void DrumCanvas::modifySelected(NoteInfo::ValType type, int delta) { - audio->msgIdle(true); - song->startUndo(); - for (MusEWidget::iCItem i = items.begin(); i != items.end(); ++i) { + MusEGlobal::audio->msgIdle(true); + MusEGlobal::song->startUndo(); + for (iCItem i = items.begin(); i != items.end(); ++i) { if (!(i->second->isSelected())) continue; DEvent* e = (DEvent*)(i->second); - Event event = e->event(); - if (event.type() != Note) + MusECore::Event event = e->event(); + if (event.type() != MusECore::Note) continue; - MidiPart* part = (MidiPart*)(e->part()); - Event newEvent = event.clone(); + MusECore::MidiPart* part = (MusECore::MidiPart*)(e->part()); + MusECore::Event newEvent = event.clone(); switch (type) { - case MusEWidget::NoteInfo::VAL_TIME: + case NoteInfo::VAL_TIME: { int newTime = event.tick() + delta; if (newTime < 0) @@ -1032,16 +1037,16 @@ void DrumCanvas::modifySelected(MusEWidget::NoteInfo::ValType type, int delta) newEvent.setTick(newTime); } break; - case MusEWidget::NoteInfo::VAL_LEN: - printf("DrumCanvas::modifySelected - MusEWidget::NoteInfo::VAL_LEN not implemented\n"); + case NoteInfo::VAL_LEN: + printf("DrumCanvas::modifySelected - NoteInfo::VAL_LEN not implemented\n"); break; - case MusEWidget::NoteInfo::VAL_VELON: - printf("DrumCanvas::modifySelected - MusEWidget::NoteInfo::VAL_VELON not implemented\n"); + case NoteInfo::VAL_VELON: + printf("DrumCanvas::modifySelected - NoteInfo::VAL_VELON not implemented\n"); break; - case MusEWidget::NoteInfo::VAL_VELOFF: - printf("DrumCanvas::modifySelected - MusEWidget::NoteInfo::VAL_VELOFF not implemented\n"); + case NoteInfo::VAL_VELOFF: + printf("DrumCanvas::modifySelected - NoteInfo::VAL_VELOFF not implemented\n"); break; - case MusEWidget::NoteInfo::VAL_PITCH: + case NoteInfo::VAL_PITCH: if (old_style_drummap_mode) { int pitch = event.pitch() - delta; // Reversing order since the drumlist is displayed in increasing order @@ -1055,12 +1060,12 @@ void DrumCanvas::modifySelected(MusEWidget::NoteInfo::ValType type, int delta) printf("DrumCanvas::modifySelected - MusEWidget::NoteInfo::VAL_PITCH not implemented for new style drum editors\n"); break; } - song->changeEvent(event, newEvent, part); + MusEGlobal::song->changeEvent(event, newEvent, part); // Indicate do not do port controller values and clone parts. - song->addUndo(UndoOp(UndoOp::ModifyEvent, newEvent, event, part, false, false)); + MusEGlobal::song->addUndo(MusECore::UndoOp(MusECore::UndoOp::ModifyEvent, newEvent, event, part, false, false)); } - song->endUndo(SC_EVENT_MODIFIED); - audio->msgIdle(false); + MusEGlobal::song->endUndo(SC_EVENT_MODIFIED); + MusEGlobal::audio->msgIdle(false); } //--------------------------------------------------------- @@ -1100,7 +1105,7 @@ int DrumCanvas::getNextStep(unsigned int pos, int basicStep, int stepSize) //--------------------------------------------------------- void DrumCanvas::keyPress(QKeyEvent* event) { - if (_tool == MusEWidget::CursorTool) { + if (_tool == CursorTool) { int key = event->key(); if (((QInputEvent*)event)->modifiers() & Qt::ShiftModifier) @@ -1179,7 +1184,7 @@ void DrumCanvas::keyPress(QKeyEvent* event) //--------------------------------------------------------- void DrumCanvas::setTool2(int) { - if (_tool == MusEWidget::CursorTool) + if (_tool == CursorTool) deselectAll(); if (unsigned(cursorPos.x()) < curPart->tick()) cursorPos.setX(curPart->tick()); @@ -1205,18 +1210,18 @@ void DrumCanvas::setStep(int v) //--------------------------------------------------------- // getEventAtCursorPos //--------------------------------------------------------- -Event *DrumCanvas::getEventAtCursorPos() +MusECore::Event *DrumCanvas::getEventAtCursorPos() { - if (_tool != MusEWidget::CursorTool) + if (_tool != CursorTool) return 0; if (instrument_map[cursorPos.y()].tracks.contains(curPart->track())) { - EventList* el = curPart->events(); - iEvent lower = el->lower_bound(cursorPos.x()-curPart->tick()); - iEvent upper = el->upper_bound(cursorPos.x()-curPart->tick()); + MusECore::EventList* el = curPart->events(); + MusECore::iEvent lower = el->lower_bound(cursorPos.x()-curPart->tick()); + MusECore::iEvent upper = el->upper_bound(cursorPos.x()-curPart->tick()); int curPitch = instrument_map[cursorPos.y()].pitch; - for (iEvent i = lower; i != upper; ++i) { - Event &ev = i->second; + for (MusECore::iEvent i = lower; i != upper; ++i) { + MusECore::Event &ev = i->second; if (ev.isNote() && ev.pitch() == curPitch) return &ev; } @@ -1227,11 +1232,11 @@ Event *DrumCanvas::getEventAtCursorPos() //--------------------------------------------------------- // selectCursorEvent //--------------------------------------------------------- -void DrumCanvas::selectCursorEvent(Event *ev) +void DrumCanvas::selectCursorEvent(MusECore::Event *ev) { - for (MusEWidget::iCItem i = items.begin(); i != items.end(); ++i) + for (iCItem i = items.begin(); i != items.end(); ++i) { - Event e = i->second->event(); + MusECore::Event e = i->second->event(); if (ev && ev->tick() == e.tick() && ev->pitch() == e.pitch() && e.isNote()) i->second->setSelected(true); @@ -1252,11 +1257,11 @@ void DrumCanvas::moveAwayUnused() } QSet<int> used; - for (MusEWidget::iCItem it=items.begin(); it!=items.end(); it++) + for (iCItem it=items.begin(); it!=items.end(); it++) { - const Event& ev=it->second->event(); + const MusECore::Event& ev=it->second->event(); - if (ev.type()==Note) + if (ev.type()==MusECore::Note) used.insert(ev.pitch()); } @@ -1283,15 +1288,15 @@ void DrumCanvas::midiNote(int pitch, int velo) //FINDMICH later. if (debugMsg) printf("DrumCanvas::midiNote: pitch=%i, velo=%i\n", pitch, velo); if (_midiin && _steprec && curPart - && !audio->isPlaying() && velo && pos[0] >= start_tick + && !MusEGlobal::audio->isPlaying() && velo && pos[0] >= start_tick /* && pos[0] < end_tick [removed by flo93: this is handled in steprec->record()] */ && !(MusEGlobal::globalKeyState & Qt::AltModifier)) { - steprec->record(curPart,drumInmap[pitch],ourDrumMap[(int)drumInmap[pitch]].len,editor->raster(),velo,MusEGlobal::globalKeyState&Qt::ControlModifier,MusEGlobal::globalKeyState&Qt::ShiftModifier); + steprec->record(curPart,MusEGlobal::drumInmap[pitch],ourDrumMap[(int)MusEGlobal::drumInmap[pitch]].len,editor->raster(),velo,MusEGlobal::globalKeyState&Qt::ControlModifier,MusEGlobal::globalKeyState&Qt::ShiftModifier); } } -int DrumCanvas::pitch_and_track_to_instrument(int pitch, Track* track) +int DrumCanvas::pitch_and_track_to_instrument(int pitch, MusECore::Track* track) { for (int i=0; i<instrument_map.size(); i++) if (instrument_map[i].tracks.contains(track) && instrument_map[i].pitch==pitch) @@ -1303,23 +1308,32 @@ int DrumCanvas::pitch_and_track_to_instrument(int pitch, Track* track) void DrumCanvas::propagate_drummap_change(int instr) { - const QSet<Track*>& tracks=instrument_map[instr].tracks; + const QSet<MusECore::Track*>& tracks=instrument_map[instr].tracks; int index=instrument_map[instr].pitch; - for (QSet<Track*>::const_iterator it = tracks.begin(); it != tracks.end(); it++) - dynamic_cast<MidiTrack*>(*it)->drummap()[index] = ourDrumMap[instr]; + for (QSet<MusECore::Track*>::const_iterator it = tracks.begin(); it != tracks.end(); it++) + dynamic_cast<MusECore::MidiTrack*>(*it)->drummap()[index] = ourDrumMap[instr]; } void DrumCanvas::rebuildOurDrumMap() { - using MusEUtil::drummaps_almost_equal; + using MusECore::drummaps_almost_equal; + using MusECore::Track; + using MusECore::MidiTrack; + using MusECore::TrackList; + using MusECore::ciTrack; + using MusECore::ciPart; + using MusECore::DrumMap; + using MusEGlobal::global_drum_ordering_t; + using MusEGlobal::global_drum_ordering; + if (!old_style_drummap_mode) { bool need_update = false; - TrackList* tl=song->tracks(); + TrackList* tl=MusEGlobal::song->tracks(); QList< QSet<Track*> > track_groups; QVector<instrument_number_mapping_t> old_instrument_map = instrument_map; @@ -1459,8 +1473,10 @@ void DrumCanvas::rebuildOurDrumMap() emit ourDrumMapChanged(false); if (need_update) - song->update(SC_DRUMMAP, true); // i know, this causes a recursion, which possibly - // isn't the most elegant solution here. but it will - // never be an infinite recursion + MusEGlobal::song->update(SC_DRUMMAP, true); // i know, this causes a recursion, which possibly + // isn't the most elegant solution here. but it will + // never be an infinite recursion } } + +} // namespace MusEGui diff --git a/muse2/muse/midiedit/dcanvas.h b/muse2/muse/midiedit/dcanvas.h index 8ecbdac9..581de9d7 100644 --- a/muse2/muse/midiedit/dcanvas.h +++ b/muse2/muse/midiedit/dcanvas.h @@ -40,6 +40,8 @@ class QDragMoveEvent; class QDragLeaveEvent; class DrumMap; +namespace MusEGui { + class MidiEditor; class DrumEdit; @@ -48,18 +50,15 @@ class DrumEdit; // ''visual'' Drum Event //--------------------------------------------------------- -class DEvent : public MusEWidget::CItem { +class DEvent : public CItem { public: - DEvent(Event e, Part* p, int instr); + DEvent(MusECore::Event e, MusECore::Part* p, int instr); }; -class ScrollScale; -class PianoRoll; - -struct instrument_number_mapping_t +struct instrument_number_mapping_t //FINDMICH TODO move into a suitable namespace! { - QSet<Track*> tracks; + QSet<MusECore::Track*> tracks; int pitch; instrument_number_mapping_t() @@ -68,7 +67,7 @@ struct instrument_number_mapping_t tracks.clear(); } - instrument_number_mapping_t(const QSet<Track*>& tr, int p) + instrument_number_mapping_t(const QSet<MusECore::Track*>& tr, int p) { tracks=tr; pitch=p; @@ -83,7 +82,6 @@ struct instrument_number_mapping_t { return !operator==(that); } - }; //--------------------------------------------------------- @@ -94,13 +92,13 @@ class DrumCanvas : public EventCanvas { Q_OBJECT bool old_style_drummap_mode; - DrumMap* ourDrumMap; + MusECore::DrumMap* ourDrumMap; bool must_delete_our_drum_map; //FINDMICH really delete it! QVector<instrument_number_mapping_t> instrument_map; DrumEdit* drumEditor; - StepRec* steprec; + MusECore::StepRec* steprec; // Cursor tool position QPoint cursorPos; @@ -108,25 +106,25 @@ class DrumCanvas : public EventCanvas { virtual void drawCanvas(QPainter&, const QRect&); - virtual void drawItem(QPainter&, const MusEWidget::CItem*, const QRect&); + virtual void drawItem(QPainter&, const CItem*, const QRect&); void drawTopItem(QPainter& p, const QRect& rect); - virtual void drawMoving(QPainter&, const MusEWidget::CItem*, const QRect&); - virtual Undo moveCanvasItems(MusEWidget::CItemList&, int, int, DragType); - virtual UndoOp moveItem(MusEWidget::CItem*, const QPoint&, DragType); - virtual MusEWidget::CItem* newItem(const QPoint&, int); - virtual void resizeItem(MusEWidget::CItem*, bool, bool); - virtual void newItem(MusEWidget::CItem*, bool); - virtual void newItem(MusEWidget::CItem*, bool, bool replace ); - virtual bool deleteItem(MusEWidget::CItem*); - MusEWidget::CItem* newItem(int tick, int instrument, int velocity); + virtual void drawMoving(QPainter&, const CItem*, const QRect&); + virtual MusECore::Undo moveCanvasItems(CItemList&, int, int, DragType); + virtual MusECore::UndoOp moveItem(CItem*, const QPoint&, DragType); + virtual CItem* newItem(const QPoint&, int); + virtual void resizeItem(CItem*, bool, bool); + virtual void newItem(CItem*, bool); + virtual void newItem(CItem*, bool, bool replace ); + virtual bool deleteItem(CItem*); + CItem* newItem(int tick, int instrument, int velocity); int y2pitch(int y) const; int pitch2y(int pitch) const; - void startDrag(MusEWidget::CItem*, bool copymode); + void startDrag(CItem*, bool copymode); void dragEnterEvent(QDragEnterEvent* event); void dragMoveEvent(QDragMoveEvent*); void dragLeaveEvent(QDragLeaveEvent*); - virtual void addItem(Part*, Event&); + virtual void addItem(MusECore::Part*, MusECore::Event&); virtual void resizeEvent(QResizeEvent*); virtual void curPartChanged(); int getNextStep(unsigned int pos, int basicStep, int stepSize=1); @@ -160,16 +158,19 @@ class DrumCanvas : public EventCanvas { const char* name = 0); virtual ~DrumCanvas(); void cmd(int); - virtual void modifySelected(MusEWidget::NoteInfo::ValType type, int delta); + virtual void modifySelected(NoteInfo::ValType type, int delta); virtual void keyPress(QKeyEvent* event); - Event *getEventAtCursorPos(); - void selectCursorEvent(Event *ev); - int pitch_and_track_to_instrument(int pitch, Track* track); - DrumMap* getOurDrumMap() { return ourDrumMap; } //FINDMICH UGLY + MusECore::Event *getEventAtCursorPos(); + void selectCursorEvent(MusECore::Event *ev); + int pitch_and_track_to_instrument(int pitch, MusECore::Track* track); + MusECore::DrumMap* getOurDrumMap() { return ourDrumMap; } //FINDMICH UGLY int getOurDrumMapSize() { return instrument_map.size(); } //FINDMICH UGLY QVector<instrument_number_mapping_t>& get_instrument_map() { return instrument_map; } //FINDMICH UGLY void propagate_drummap_change(int instrument); //FINDMICH move to drumedit void rebuildOurDrumMap(); }; + +} // namespace MusEGui + #endif diff --git a/muse2/muse/midiedit/dlist.cpp b/muse2/muse/midiedit/dlist.cpp index c5379a15..1ffae02e 100644 --- a/muse2/muse/midiedit/dlist.cpp +++ b/muse2/muse/midiedit/dlist.cpp @@ -40,6 +40,8 @@ #include "song.h" #include "dcanvas.h" +namespace MusEGui { + //--------------------------------------------------------- // draw //--------------------------------------------------------- @@ -63,7 +65,7 @@ void DList::draw(QPainter& p, const QRect& rect) continue; if (yy > y + h) break; - DrumMap* dm = &ourDrumMap[instrument]; + MusECore::DrumMap* dm = &ourDrumMap[instrument]; if (dm == currentlySelected) p.fillRect(x, yy, w, TH, Qt::yellow); // else @@ -96,10 +98,10 @@ void DList::draw(QPainter& p, const QRect& rect) s.setNum(dm->len); break; case COL_NOTE: - s = MusEUtil::pitch2string(dm->anote); + s = MusECore::pitch2string(dm->anote); break; case COL_INPUTTRIGGER: - s = MusEUtil::pitch2string(dm->enote); + s = MusECore::pitch2string(dm->enote); break; case COL_LEVEL1: s.setNum(dm->lv1); @@ -117,11 +119,11 @@ void DList::draw(QPainter& p, const QRect& rect) { bool hidden=false; bool shown=false; - QSet<Track*>* group = &dcanvas->get_instrument_map()[instrument].tracks; + QSet<MusECore::Track*>* group = &dcanvas->get_instrument_map()[instrument].tracks; int pitch = dcanvas->get_instrument_map()[instrument].pitch; - for (QSet<Track*>::iterator track=group->begin(); track!=group->end() && !(hidden&&shown); track++) - if (dynamic_cast<MidiTrack*>(*track)->drummap_hidden()[pitch]) + for (QSet<MusECore::Track*>::iterator track=group->begin(); track!=group->end() && !(hidden&&shown); track++) + if (dynamic_cast<MusECore::MidiTrack*>(*track)->drummap_hidden()[pitch]) hidden=true; else shown=true; @@ -171,7 +173,7 @@ void DList::draw(QPainter& p, const QRect& rect) s.setNum(dm->channel+1); break; case COL_OUTPORT: - s.sprintf("%d:%s", dm->port+1, midiPorts[dm->port].portname().toLatin1().constData()); + s.sprintf("%d:%s", dm->port+1, MusEGlobal::midiPorts[dm->port].portname().toLatin1().constData()); align = Qt::AlignVCenter | Qt::AlignLeft; break; } @@ -220,7 +222,7 @@ void DList::draw(QPainter& p, const QRect& rect) // devicesPopupMenu //--------------------------------------------------------- -void DList::devicesPopupMenu(DrumMap* t, int x, int y, bool changeAll) +void DList::devicesPopupMenu(MusECore::DrumMap* t, int x, int y, bool changeAll) { if (!old_style_drummap_mode) { @@ -228,7 +230,7 @@ void DList::devicesPopupMenu(DrumMap* t, int x, int y, bool changeAll) return; } - QMenu* p = midiPortsPopup(); + QMenu* p = MusECore::midiPortsPopup(); QAction* act = p->exec(mapToGlobal(QPoint(x, y)), 0); bool doemit = false; if (act) { @@ -237,24 +239,24 @@ void DList::devicesPopupMenu(DrumMap* t, int x, int y, bool changeAll) { if(n != t->port) { - audio->msgIdle(true); - song->remapPortDrumCtrlEvents(getSelectedInstrument(), -1, -1, n); - audio->msgIdle(false); + MusEGlobal::audio->msgIdle(true); + MusEGlobal::song->remapPortDrumCtrlEvents(getSelectedInstrument(), -1, -1, n); + MusEGlobal::audio->msgIdle(false); t->port = n; doemit = true; } } else { - audio->msgIdle(true); + MusEGlobal::audio->msgIdle(true); // Delete all port controller events. - song->changeAllPortDrumCtrlEvents(false); + MusEGlobal::song->changeAllPortDrumCtrlEvents(false); for (int i = 0; i < ourDrumMapSize; i++) ourDrumMap[i].port = n; // Add all port controller events. - song->changeAllPortDrumCtrlEvents(true); + MusEGlobal::song->changeAllPortDrumCtrlEvents(true); - audio->msgIdle(false); + MusEGlobal::audio->msgIdle(false); doemit = true; } } @@ -264,7 +266,7 @@ void DList::devicesPopupMenu(DrumMap* t, int x, int y, bool changeAll) int instr = getSelectedInstrument(); if(instr != -1) //emit curDrumInstrumentChanged(instr); - song->update(SC_DRUMMAP); + MusEGlobal::song->update(SC_DRUMMAP); } } @@ -278,8 +280,8 @@ void DList::viewMousePressEvent(QMouseEvent* ev) int y = ev->y(); int button = ev->button(); unsigned instrument = y / TH; - DrumMap* dm = &ourDrumMap[instrument]; - DrumMap dm_old = *dm; + MusECore::DrumMap* dm = &ourDrumMap[instrument]; + MusECore::DrumMap dm_old = *dm; setCurDrumInstrument(instrument); @@ -313,18 +315,18 @@ void DList::viewMousePressEvent(QMouseEvent* ev) if (button == Qt::LeftButton) { bool hidden=true; - QSet<Track*>* group = &dcanvas->get_instrument_map()[instrument].tracks; + QSet<MusECore::Track*>* group = &dcanvas->get_instrument_map()[instrument].tracks; int pitch = dcanvas->get_instrument_map()[instrument].pitch; - for (QSet<Track*>::iterator track=group->begin(); track!=group->end(); track++) - if (dynamic_cast<MidiTrack*>(*track)->drummap_hidden()[pitch] == false) + for (QSet<MusECore::Track*>::iterator track=group->begin(); track!=group->end(); track++) + if (dynamic_cast<MusECore::MidiTrack*>(*track)->drummap_hidden()[pitch] == false) { hidden=false; break; } - for (QSet<Track*>::iterator track=group->begin(); track!=group->end(); track++) - dynamic_cast<MidiTrack*>(*track)->drummap_hidden()[pitch] = !hidden; + for (QSet<MusECore::Track*>::iterator track=group->begin(); track!=group->end(); track++) + dynamic_cast<MusECore::MidiTrack*>(*track)->drummap_hidden()[pitch] = !hidden; } break; case COL_MUTE: @@ -362,13 +364,13 @@ void DList::viewMousePressEvent(QMouseEvent* ev) //If so, switch the inmap between the instruments for (int i=0; i<ourDrumMapSize; i++) { if (ourDrumMap[i].enote == val && &ourDrumMap[i] != dm) { - drumInmap[int(dm->enote)] = i; + MusEGlobal::drumInmap[int(dm->enote)] = i; ourDrumMap[i].enote = dm->enote; break; } } //TODO: Set all the notes on the track with instrument=dm->enote to instrument=val - drumInmap[val] = instrument; + MusEGlobal::drumInmap[val] = instrument; } dm->enote = val; break; @@ -388,11 +390,11 @@ void DList::viewMousePressEvent(QMouseEvent* ev) val = 127; if(val != dm->anote) { - audio->msgIdle(true); - song->remapPortDrumCtrlEvents(instrument, val, -1, -1); - audio->msgIdle(false); + MusEGlobal::audio->msgIdle(true); + MusEGlobal::song->remapPortDrumCtrlEvents(instrument, val, -1, -1); + MusEGlobal::audio->msgIdle(false); dm->anote = val; - song->update(SC_DRUMMAP); + MusEGlobal::song->update(SC_DRUMMAP); } } @@ -409,26 +411,26 @@ void DList::viewMousePressEvent(QMouseEvent* ev) val = 127; if (ev->modifiers() & Qt::ControlModifier) { - audio->msgIdle(true); + MusEGlobal::audio->msgIdle(true); // Delete all port controller events. - song->changeAllPortDrumCtrlEvents(false, true); + MusEGlobal::song->changeAllPortDrumCtrlEvents(false, true); for (int i = 0; i < ourDrumMapSize; i++) ourDrumMap[i].channel = val; // Add all port controller events. - song->changeAllPortDrumCtrlEvents(true, true); - audio->msgIdle(false); - song->update(SC_DRUMMAP); + MusEGlobal::song->changeAllPortDrumCtrlEvents(true, true); + MusEGlobal::audio->msgIdle(false); + MusEGlobal::song->update(SC_DRUMMAP); } else { if(val != dm->channel) { - audio->msgIdle(true); - song->remapPortDrumCtrlEvents(instrument, -1, val, -1); - audio->msgIdle(false); + MusEGlobal::audio->msgIdle(true); + MusEGlobal::song->remapPortDrumCtrlEvents(instrument, -1, val, -1); + MusEGlobal::audio->msgIdle(false); dm->channel = val; - song->update(SC_DRUMMAP); + MusEGlobal::song->update(SC_DRUMMAP); } } break; @@ -469,20 +471,20 @@ void DList::viewMousePressEvent(QMouseEvent* ev) emit keyPressed(instrument, 100); //Mapping done on other side, send index else if (button == Qt::MidButton) // hide that instrument { - QSet<Track*>* group = &dcanvas->get_instrument_map()[instrument].tracks; + QSet<MusECore::Track*>* group = &dcanvas->get_instrument_map()[instrument].tracks; int pitch = dcanvas->get_instrument_map()[instrument].pitch; - for (QSet<Track*>::iterator track=group->begin(); track!=group->end(); track++) - dynamic_cast<MidiTrack*>(*track)->drummap_hidden()[pitch] = true; + for (QSet<MusECore::Track*>::iterator track=group->begin(); track!=group->end(); track++) + dynamic_cast<MusECore::MidiTrack*>(*track)->drummap_hidden()[pitch] = true; } else if (button == Qt::RightButton) { bool hidden=false; bool shown=false; - QSet<Track*>* group = &dcanvas->get_instrument_map()[instrument].tracks; + QSet<MusECore::Track*>* group = &dcanvas->get_instrument_map()[instrument].tracks; int pitch = dcanvas->get_instrument_map()[instrument].pitch; - for (QSet<Track*>::iterator track=group->begin(); track!=group->end() && !(hidden&&shown); track++) - if (dynamic_cast<MidiTrack*>(*track)->drummap_hidden()[pitch]) + for (QSet<MusECore::Track*>::iterator track=group->begin(); track!=group->end() && !(hidden&&shown); track++) + if (dynamic_cast<MusECore::MidiTrack*>(*track)->drummap_hidden()[pitch]) hidden=true; else shown=true; @@ -499,11 +501,11 @@ void DList::viewMousePressEvent(QMouseEvent* ev) QAction* result = popup->exec(ev->globalPos()); if (result==hideAction) - for (QSet<Track*>::iterator track=group->begin(); track!=group->end(); track++) - dynamic_cast<MidiTrack*>(*track)->drummap_hidden()[pitch] = true; + for (QSet<MusECore::Track*>::iterator track=group->begin(); track!=group->end(); track++) + dynamic_cast<MusECore::MidiTrack*>(*track)->drummap_hidden()[pitch] = true; else if (result==showAction) - for (QSet<Track*>::iterator track=group->begin(); track!=group->end(); track++) - dynamic_cast<MidiTrack*>(*track)->drummap_hidden()[pitch] = false; + for (QSet<MusECore::Track*>::iterator track=group->begin(); track!=group->end(); track++) + dynamic_cast<MusECore::MidiTrack*>(*track)->drummap_hidden()[pitch] = false; delete popup; } @@ -516,7 +518,7 @@ void DList::viewMousePressEvent(QMouseEvent* ev) if (!old_style_drummap_mode && dm_old != *dm) //something changed and we're in new style mode? dcanvas->propagate_drummap_change(dm-ourDrumMap); - song->update(SC_DRUMMAP); + MusEGlobal::song->update(SC_DRUMMAP); //redraw(); //this is done by the songChanged slot } @@ -551,7 +553,7 @@ void DList::viewMouseDoubleClickEvent(QMouseEvent* ev) //--------------------------------------------------------- void DList::lineEdit(int line, int section) { - DrumMap* dm = &ourDrumMap[line]; + MusECore::DrumMap* dm = &ourDrumMap[line]; editEntry = dm; if (editor == 0) { editor = new DLineEdit(this); @@ -619,7 +621,7 @@ void DList::lineEdit(int line, int section) //--------------------------------------------------------- void DList::pitchEdit(int line, int section) { - DrumMap* dm = &ourDrumMap[line]; + MusECore::DrumMap* dm = &ourDrumMap[line]; editEntry = dm; if (pitch_editor == 0) { pitch_editor = new DPitchEdit(this); @@ -675,11 +677,11 @@ void DList::setCurDrumInstrument(int instr) { if (instr < 0 || instr >= ourDrumMapSize -1) return; // illegal instrument - DrumMap* dm = &ourDrumMap[instr]; + MusECore::DrumMap* dm = &ourDrumMap[instr]; if (currentlySelected != dm) { currentlySelected = dm; emit curDrumInstrumentChanged(instr); - song->update(SC_DRUMMAP); + MusEGlobal::song->update(SC_DRUMMAP); } } @@ -740,7 +742,7 @@ void DList::returnPressed() } } - DrumMap editEntryOld = *editEntry; + MusECore::DrumMap editEntryOld = *editEntry; switch(selectedColumn) { case COL_NAME: editEntry->name = editor->text(); @@ -790,7 +792,7 @@ void DList::returnPressed() editor->hide(); editEntry = 0; setFocus(); - song->update(SC_DRUMMAP); + MusEGlobal::song->update(SC_DRUMMAP); //redraw(); //this is done by the songChanged slot } @@ -809,18 +811,18 @@ void DList::pitchEdited() int val=pitch_editor->value(); int instrument=(editEntry-ourDrumMap); - DrumMap editEntryOld=*editEntry; + MusECore::DrumMap editEntryOld=*editEntry; switch(selectedColumn) { case COL_NOTE: if (old_style_drummap_mode) //should actually be always true, but to be sure... { if(val != editEntry->anote) { - audio->msgIdle(true); - song->remapPortDrumCtrlEvents(instrument, val, -1, -1); - audio->msgIdle(false); + MusEGlobal::audio->msgIdle(true); + MusEGlobal::song->remapPortDrumCtrlEvents(instrument, val, -1, -1); + MusEGlobal::audio->msgIdle(false); editEntry->anote = val; - song->update(SC_DRUMMAP); + MusEGlobal::song->update(SC_DRUMMAP); } } else @@ -830,20 +832,21 @@ void DList::pitchEdited() case COL_INPUTTRIGGER: if (old_style_drummap_mode) { - //Check if there is any other drumMap with the same inmap value (there should be one (and only one):-) + //Check if there is any other MusEGlobal::drumMap with the same inmap value (there should be one (and only one):-) //If so, switch the inmap between the instruments for (int i=0; i<ourDrumMapSize; i++) { if (ourDrumMap[i].enote == val && &ourDrumMap[i] != editEntry) { - drumInmap[int(editEntry->enote)] = i; + MusEGlobal::drumInmap[int(editEntry->enote)] = i; ourDrumMap[i].enote = editEntry->enote; break; } } //TODO: Set all the notes on the track with instrument=dm->enote to instrument=val - drumInmap[val] = instrument; + MusEGlobal::drumInmap[val] = instrument; } editEntry->enote = val; break; + default: printf("ERROR: THIS SHOULD NEVER HAPPEN: Value changed in unknown column\n"); break; @@ -856,7 +859,7 @@ void DList::pitchEdited() pitch_editor->hide(); editEntry = 0; setFocus(); - song->update(SC_DRUMMAP); + MusEGlobal::song->update(SC_DRUMMAP); //redraw(); //this is done by the songChanged slot } @@ -893,7 +896,7 @@ void DList::songChanged(int flags) //--------------------------------------------------------- DList::DList(QHeaderView* h, QWidget* parent, int ymag, DrumCanvas* dcanvas_, bool oldstyle) - : MusEWidget::View(parent, 1, ymag) + : MusEGui::View(parent, 1, ymag) { setBg(Qt::white); @@ -1009,7 +1012,7 @@ int DList::getSelectedInstrument() { if (currentlySelected == 0) return -1; - return drumInmap[int(currentlySelected->enote)]; + return MusEGlobal::drumInmap[int(currentlySelected->enote)]; } @@ -1028,3 +1031,5 @@ void DList::ourDrumMapChanged(bool instrMapChanged) redraw(); } + +} // namespace MusEGui diff --git a/muse2/muse/midiedit/dlist.h b/muse2/muse/midiedit/dlist.h index cc3f3edc..35a67023 100644 --- a/muse2/muse/midiedit/dlist.h +++ b/muse2/muse/midiedit/dlist.h @@ -32,12 +32,19 @@ #define TH 18 // normal Track-hight class QHeaderView; +class QLineEdit; class QMouseEvent; class QPainter; - class Device; class QLineEdit; + +namespace MusECore { class DrumMap; +} + +namespace MusEGui { + +class ScrollScale; class DrumCanvas; //--------------------------------------------------------- @@ -83,19 +90,19 @@ class DPitchEdit: public Awl::PitchEdit // DList //--------------------------------------------------------- -class DList : public MusEWidget::View { +class DList : public View { Q_OBJECT - DrumCanvas* dcanvas; - DrumMap* ourDrumMap; + MusEGui::DrumCanvas* dcanvas; + MusECore::DrumMap* ourDrumMap; int ourDrumMapSize; bool old_style_drummap_mode; QHeaderView* header; QLineEdit* editor; DPitchEdit* pitch_editor; - DrumMap* editEntry; - DrumMap* currentlySelected; + MusECore::DrumMap* editEntry; + MusECore::DrumMap* currentlySelected; int selectedColumn; @@ -111,7 +118,7 @@ class DList : public MusEWidget::View { virtual void viewMouseMoveEvent(QMouseEvent*); int x2col(int x) const; - void devicesPopupMenu(DrumMap* t, int x, int y, bool changeAll); + void devicesPopupMenu(MusECore::DrumMap* t, int x, int y, bool changeAll); //void setCurDrumInstrument(int n); @@ -137,11 +144,13 @@ class DList : public MusEWidget::View { void lineEdit(int line, int section); void pitchEdit(int line, int section); void setCurDrumInstrument(int n); - DList(QHeaderView*, QWidget* parent, int ymag, DrumCanvas* dcanvas, bool oldstyle); + DList(QHeaderView*, QWidget* parent, int ymag, MusEGui::DrumCanvas* dcanvas, bool oldstyle); ~DList(); int getSelectedInstrument(); }; +} // namespace MusEGui + #endif // __DLIST_H_ diff --git a/muse2/muse/midiedit/drumedit.cpp b/muse2/muse/midiedit/drumedit.cpp index c98d0632..3a75e32d 100644 --- a/muse2/muse/midiedit/drumedit.cpp +++ b/muse2/muse/midiedit/drumedit.cpp @@ -62,6 +62,8 @@ #include "helper.h" #include "widgets/function_dialogs/quantize.h" +namespace MusEGui { + /* static const char* map_file_pattern[] = { "Presets (*.map *.map.gz *.map.bz2)", @@ -84,7 +86,7 @@ bool DrumEdit::_ignore_hide_init = false; static const int xscale = -10; static const int yscale = 1; -static const int drumeditTools = MusEWidget::PointerTool | MusEWidget::PencilTool | MusEWidget::RubberTool | MusEWidget::CursorTool | MusEWidget::DrawTool; +static const int drumeditTools = MusEGui::PointerTool | MusEGui::PencilTool | MusEGui::RubberTool | MusEGui::CursorTool | MusEGui::DrawTool; //--------------------------------------------------------- @@ -155,7 +157,7 @@ void DrumEdit::closeEvent(QCloseEvent* e) // DrumEdit //--------------------------------------------------------- -DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned initPos) +DrumEdit::DrumEdit(MusECore::PartList* pl, QWidget* parent, const char* name, unsigned initPos) : MidiEditor(TopWin::DRUM, _rasterInit, pl, parent, name) { setFocusPolicy(Qt::StrongFocus); @@ -278,7 +280,7 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini QMenu* menuScriptPlugins = menuBar()->addMenu(tr("&Plugins")); - song->populateScriptMenu(menuScriptPlugins, this); + MusEGlobal::song->populateScriptMenu(menuScriptPlugins, this); QMenu* settingsMenu = menuBar()->addMenu(tr("Window &Config")); if (!old_style_drummap_mode()) @@ -357,7 +359,7 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini tools->addWidget(midiin); - tools2 = new MusEWidget::EditToolBar(this, drumeditTools); + tools2 = new MusEGui::EditToolBar(this, drumeditTools); addToolBar(tools2); QToolBar* cursorToolbar = addToolBar(tr("cursor tools")); @@ -389,24 +391,24 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini addToolBarBreak(); // don't show pitch value in toolbar - toolbar = new MusEWidget::Toolbar1(this, _rasterInit, false); + toolbar = new MusEGui::Toolbar1(this, _rasterInit, false); addToolBar(toolbar); addToolBarBreak(); - info = new MusEWidget::NoteInfo(this); + info = new MusEGui::NoteInfo(this); addToolBar(info); //--------------------------------------------------- // split //--------------------------------------------------- - split1 = new MusEWidget::Splitter(Qt::Vertical, mainw, "split1"); + split1 = new MusEGui::Splitter(Qt::Vertical, mainw, "split1"); QPushButton* ctrl = new QPushButton(tr("ctrl"), mainw); ctrl->setObjectName("Ctrl"); - ctrl->setFont(MusEConfig::config.fonts[3]); - //hscroll = new MusEWidget::ScrollScale(-25, -2, xscale, 20000, Qt::Horizontal, mainw); + ctrl->setFont(MusEGlobal::config.fonts[3]); + //hscroll = new MusEGui::ScrollScale(-25, -2, xscale, 20000, Qt::Horizontal, mainw); // Increased scale to -1. To resolve/select/edit 1-tick-wide (controller graph) events. p4.0.18 Tim. - hscroll = new MusEWidget::ScrollScale(-25, -1, xscale, 20000, Qt::Horizontal, mainw); + hscroll = new MusEGui::ScrollScale(-25, -1, xscale, 20000, Qt::Horizontal, mainw); ctrl->setFixedSize(40, hscroll->sizeHint().height()); ctrl->setToolTip(tr("Add Controller View")); @@ -423,7 +425,7 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini // mainGrid->addRowSpacing(1, hscroll->sizeHint().height()); // mainGrid->addItem(new QSpacerItem(0, hscroll->sizeHint().height()), 1, 0); - split2 = new MusEWidget::Splitter(Qt::Horizontal, split1, "split2"); + split2 = new MusEGui::Splitter(Qt::Horizontal, split1, "split2"); split1w1 = new QWidget(split2); QWidget* split1w2 = new QWidget(split2); QGridLayout* gridS1 = new QGridLayout(split1w1); @@ -432,10 +434,10 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini gridS1->setSpacing(0); gridS2->setContentsMargins(0, 0, 0, 0); gridS2->setSpacing(0); - time = new MusEWidget::MTScale(&_raster, split1w2, xscale); + time = new MusEGui::MTScale(&_raster, split1w2, xscale); canvas = new DrumCanvas(this, split1w2, xscale, yscale); - vscroll = new MusEWidget::ScrollScale(-4, 1, yscale, dynamic_cast<DrumCanvas*>(canvas)->getOurDrumMapSize()*TH, Qt::Vertical, split1w2); - int offset = -(MusEConfig::config.division/4); + vscroll = new MusEGui::ScrollScale(-4, 1, yscale, dynamic_cast<DrumCanvas*>(canvas)->getOurDrumMapSize()*TH, Qt::Vertical, split1w2); + int offset = -(MusEGlobal::config.division/4); canvas->setOrigin(offset, 0); canvas->setCanvasTools(drumeditTools); canvas->setFocus(); @@ -457,14 +459,14 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini gridS2->setColumnStretch(0, 100); gridS2->addWidget(time, 0, 0, 1, 2); - gridS2->addWidget(MusEUtil::hLine(split1w2), 1, 0, 1, 2); + gridS2->addWidget(MusECore::hLine(split1w2), 1, 0, 1, 2); gridS2->addWidget(canvas, 2, 0); gridS2->addWidget(vscroll, 2, 1); // // Reihenfolge in dlist.c festgeschrieben ("Dcols") // - header = new MusEWidget::Header(split1w1, "header"); + header = new MusEGui::Header(split1w1, "header"); header->setFixedHeight(31); header->setColumnLabel(tr("H"), COL_HIDE, 20); header->setColumnLabel(tr("M"), COL_MUTE, 20); @@ -512,8 +514,8 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini connect(canvas, SIGNAL(verticalScroll(unsigned)), vscroll, SLOT(setPos(unsigned))); connect(canvas, SIGNAL(horizontalScroll(unsigned)),hscroll, SLOT(setPos(unsigned))); connect(canvas, SIGNAL(horizontalScrollNoLimit(unsigned)),hscroll, SLOT(setPosNoLimit(unsigned))); - connect(song, SIGNAL(songChanged(int)), SLOT(songChanged1(int))); - connect(song, SIGNAL(songChanged(int)), dlist, SLOT(songChanged(int))); + connect(MusEGlobal::song, SIGNAL(songChanged(int)), SLOT(songChanged1(int))); + connect(MusEGlobal::song, SIGNAL(songChanged(int)), dlist, SLOT(songChanged(int))); connect(vscroll, SIGNAL(scrollChanged(int)), canvas, SLOT(setYPos(int))); connect(vscroll, SIGNAL(scaleChanged(int)), canvas, SLOT(setYMag(int))); connect(vscroll, SIGNAL(scaleChanged(int)), dlist, SLOT(setYMag(int))); @@ -529,8 +531,8 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini connect(tools2, SIGNAL(toolChanged(int)), canvas, SLOT(setTool(int))); // in Canvas connect(tools2, SIGNAL(toolChanged(int)), canvas, SLOT(setTool2(int))); // in DrumCanvas - connect(canvas, SIGNAL(selectionChanged(int, Event&, Part*)), this, - SLOT(setSelection(int, Event&, Part*))); + connect(canvas, SIGNAL(selectionChanged(int, MusECore::Event&, MusECore::Part*)), this, + SLOT(setSelection(int, MusECore::Event&, MusECore::Part*))); connect(canvas, SIGNAL(followEvent(int)), SLOT(follow(int))); connect(hscroll, SIGNAL(scaleChanged(int)), SLOT(updateHScrollRange())); @@ -543,7 +545,7 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini connect(time, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned))); connect(toolbar, SIGNAL(rasterChanged(int)), SLOT(setRaster(int))); connect(toolbar, SIGNAL(soloChanged(bool)), SLOT(soloChanged(bool))); - connect(info, SIGNAL(valueChanged(MusEWidget::NoteInfo::ValType, int)), SLOT(noteinfoChanged(MusEWidget::NoteInfo::ValType, int))); + connect(info, SIGNAL(valueChanged(MusEGui::NoteInfo::ValType, int)), SLOT(noteinfoChanged(MusEGui::NoteInfo::ValType, int))); connect(ctrl, SIGNAL(clicked()), SLOT(addCtrl())); @@ -554,14 +556,14 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini selectionChanged(); // enable/disable "Copy" & "Paste" initShortcuts(); - const Pos cpos=song->cPos(); + const MusECore::Pos cpos=MusEGlobal::song->cPos(); canvas->setPos(0, cpos.tick(), true); canvas->selectAtTick(cpos.tick()); //canvas->selectFirst(); unsigned pos=0; if(initPos >= MAXINT) - pos = song->cpos(); + pos = MusEGlobal::song->cpos(); if(pos > MAXINT) pos = MAXINT; if (pos) @@ -652,10 +654,10 @@ DrumEdit::~DrumEdit() // update Info Line //--------------------------------------------------------- -void DrumEdit::setSelection(int tick, Event& e, Part* p) +void DrumEdit::setSelection(int tick, MusECore::Event& e, MusECore::Part* p) { selEvent = e; - selPart = (MidiPart*)p; + selPart = (MusECore::MidiPart*)p; selTick = tick; info->setEnabled(!e.empty()); if (!e.empty()) { @@ -674,8 +676,8 @@ void DrumEdit::setSelection(int tick, Event& e, Part* p) void DrumEdit::soloChanged(bool flag) { - audio->msgSetSolo(canvas->track(), flag); - song->update(SC_SOLO); + MusEGlobal::audio->msgSetSolo(canvas->track(), flag); + MusEGlobal::song->update(SC_SOLO); } //--------------------------------------------------------- @@ -693,40 +695,40 @@ void DrumEdit::setRaster(int val) // edit currently selected Event //--------------------------------------------------------- -void DrumEdit::noteinfoChanged(MusEWidget::NoteInfo::ValType type, int val) +void DrumEdit::noteinfoChanged(MusEGui::NoteInfo::ValType type, int val) { if (selEvent.empty()) { printf("noteinfoChanged while note is zero %d\n", type); return; } - Event event = selEvent.clone(); + MusECore::Event event = selEvent.clone(); switch (type) { - case MusEWidget::NoteInfo::VAL_TIME: + case MusEGui::NoteInfo::VAL_TIME: event.setTick(val - selPart->tick()); break; - case MusEWidget::NoteInfo::VAL_LEN: + case MusEGui::NoteInfo::VAL_LEN: event.setLenTick(val); break; - case MusEWidget::NoteInfo::VAL_VELON: + case MusEGui::NoteInfo::VAL_VELON: event.setVelo(val); break; - case MusEWidget::NoteInfo::VAL_VELOFF: + case MusEGui::NoteInfo::VAL_VELOFF: event.setVeloOff(val); break; - case MusEWidget::NoteInfo::VAL_PITCH: + case MusEGui::NoteInfo::VAL_PITCH: event.setPitch(val); break; } // Indicate do undo, and do not do port controller values and clone parts. - //audio->msgChangeEvent(selEvent, event, selPart); - audio->msgChangeEvent(selEvent, event, selPart, true, false, false); + //MusEGlobal::audio->msgChangeEvent(selEvent, event, selPart); + MusEGlobal::audio->msgChangeEvent(selEvent, event, selPart, true, false, false); } //--------------------------------------------------------- // writeStatus //--------------------------------------------------------- -void DrumEdit::writeStatus(int level, Xml& xml) const +void DrumEdit::writeStatus(int level, MusECore::Xml& xml) const { writePartList(level, xml); xml.tag(level++, "drumedit"); @@ -755,16 +757,16 @@ void DrumEdit::writeStatus(int level, Xml& xml) const // readStatus //--------------------------------------------------------- -void DrumEdit::readStatus(Xml& xml) +void DrumEdit::readStatus(MusECore::Xml& xml) { for (;;) { - Xml::Token token = xml.parse(); + MusECore::Xml::Token token = xml.parse(); const QString& tag = xml.s1(); switch (token) { - case Xml::Error: - case Xml::End: + case MusECore::Xml::Error: + case MusECore::Xml::End: return; - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "steprec") { int val = xml.parseInt(); canvas->setSteprec(val); @@ -800,7 +802,7 @@ void DrumEdit::readStatus(Xml& xml) else xml.unknown("DrumEdit"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "drumedit") { _rasterInit = _raster; toolbar->setRaster(_raster); @@ -817,16 +819,16 @@ void DrumEdit::readStatus(Xml& xml) // readConfiguration //--------------------------------------------------------- -void DrumEdit::readConfiguration(Xml& xml) +void DrumEdit::readConfiguration(MusECore::Xml& xml) { for (;;) { - Xml::Token token = xml.parse(); + MusECore::Xml::Token token = xml.parse(); const QString& tag = xml.s1(); switch (token) { - case Xml::Error: - case Xml::End: + case MusECore::Xml::Error: + case MusECore::Xml::End: return; - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "raster") _rasterInit = xml.parseInt(); else if (tag == "dcanvaswidth") @@ -840,7 +842,7 @@ void DrumEdit::readConfiguration(Xml& xml) else xml.unknown("DrumEdit"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "drumedit") { return; } @@ -854,7 +856,7 @@ void DrumEdit::readConfiguration(Xml& xml) // writeConfiguration //--------------------------------------------------------- -void DrumEdit::writeConfiguration(int level, Xml& xml) +void DrumEdit::writeConfiguration(int level, MusECore::Xml& xml) { xml.tag(level++, "drumedit"); xml.intTag(level, "raster", _rasterInit); @@ -871,26 +873,26 @@ void DrumEdit::writeConfiguration(int level, Xml& xml) void DrumEdit::load() { - //QString fn = MusEWidget::getOpenFileName("drummaps", map_file_pattern, - QString fn = MusEWidget::getOpenFileName("drummaps", MusEGlobal::drum_map_file_pattern, + //QString fn = MusEGui::getOpenFileName("drummaps", map_file_pattern, + QString fn = MusEGui::getOpenFileName("drummaps", MusEGlobal::drum_map_file_pattern, this, tr("Muse: Load Drum Map"), 0); if (fn.isEmpty()) return; bool popenFlag; - FILE* f = MusEWidget::fileOpen(this, fn, QString(".map"), "r", popenFlag, true); + FILE* f = MusEGui::fileOpen(this, fn, QString(".map"), "r", popenFlag, true); if (f == 0) return; - Xml xml(f); + MusECore::Xml xml(f); int mode = 0; for (;;) { - Xml::Token token = xml.parse(); + MusECore::Xml::Token token = xml.parse(); const QString& tag = xml.s1(); switch (token) { - case Xml::Error: - case Xml::End: + case MusECore::Xml::Error: + case MusECore::Xml::End: return; - case Xml::TagStart: + case MusECore::Xml::TagStart: if (mode == 0 && tag == "muse") mode = 1; else if (mode == 1 && tag == "drummap") { @@ -900,9 +902,9 @@ void DrumEdit::load() else xml.unknown("DrumEdit"); break; - case Xml::Attribut: + case MusECore::Xml::Attribut: break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (!mode && tag == "muse") goto ende; default: @@ -924,16 +926,16 @@ ende: void DrumEdit::save() { - //QString fn = MusEWidget::getSaveFileName(QString("drummaps"), map_file_pattern, - QString fn = MusEWidget::getSaveFileName(QString("drummaps"), MusEGlobal::drum_map_file_save_pattern, + //QString fn = MusEGui::getSaveFileName(QString("drummaps"), map_file_pattern, + QString fn = MusEGui::getSaveFileName(QString("drummaps"), MusEGlobal::drum_map_file_save_pattern, this, tr("MusE: Store Drum Map")); if (fn.isEmpty()) return; bool popenFlag; - FILE* f = MusEWidget::fileOpen(this, fn, QString(".map"), "w", popenFlag, false, true); + FILE* f = MusEGui::fileOpen(this, fn, QString(".map"), "w", popenFlag, false, true); if (f == 0) return; - Xml xml(f); + MusECore::Xml xml(f); xml.header(); xml.tag(0, "muse version=\"1.0\""); writeDrumMap(1, xml, true); @@ -955,7 +957,7 @@ void DrumEdit::reset() tr("Reset the drum map with GM defaults?"), QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Ok) == QMessageBox::Ok) { - resetGMDrumMap(); + MusECore::resetGMDrumMap(); dlist->redraw(); canvas->redraw(); } @@ -974,14 +976,14 @@ void DrumEdit::cmd(int cmd) erase_notes(partlist_to_set(parts()), 1); break; case DrumCanvas::CMD_COPY: copy_notes(partlist_to_set(parts()), 1); break; - case DrumCanvas::CMD_COPY_RANGE: copy_notes(partlist_to_set(parts()), MusEUtil::any_event_selected(partlist_to_set(parts())) ? 3 : 2); break; + case DrumCanvas::CMD_COPY_RANGE: copy_notes(partlist_to_set(parts()), MusECore::any_event_selected(partlist_to_set(parts())) ? 3 : 2); break; case DrumCanvas::CMD_PASTE: ((DrumCanvas*)canvas)->cmd(DrumCanvas::CMD_SELECT_NONE); - paste_notes(3072); + MusECore::paste_notes(3072); break; case DrumCanvas::CMD_PASTE_DIALOG: ((DrumCanvas*)canvas)->cmd(DrumCanvas::CMD_SELECT_NONE); - paste_notes((canvas->part())); + MusECore::paste_notes((canvas->part())); break; case DrumCanvas::CMD_LOAD: load(); break; case DrumCanvas::CMD_SAVE: save(); break; @@ -991,7 +993,7 @@ void DrumEdit::cmd(int cmd) case DrumCanvas::CMD_QUANTIZE: if (quantize_dialog->exec()) quantize_notes(partlist_to_set(parts()), quantize_dialog->range, - (MusEConfig::config.division*4)/(1<<quantize_dialog->raster_power2), + (MusEGlobal::config.division*4)/(1<<quantize_dialog->raster_power2), /* quant_len= */false, quantize_dialog->strength, quantize_dialog->swing, quantize_dialog->threshold); break; @@ -1216,28 +1218,28 @@ void DrumEdit::keyPressEvent(QKeyEvent* event) } else if (key == shortcuts[SHRT_TOOL_POINTER].key) { - tools2->set(MusEWidget::PointerTool); + tools2->set(MusEGui::PointerTool); return; } else if (key == shortcuts[SHRT_TOOL_PENCIL].key) { - tools2->set(MusEWidget::PencilTool); + tools2->set(MusEGui::PencilTool); return; } else if (key == shortcuts[SHRT_TOOL_RUBBER].key) { - tools2->set(MusEWidget::RubberTool); + tools2->set(MusEGui::RubberTool); return; } else if (key == shortcuts[SHRT_TOOL_CURSOR].key) { - tools2->set(MusEWidget::CursorTool); + tools2->set(MusEGui::CursorTool); return; } else if (key == shortcuts[SHRT_ZOOM_IN].key) { int mag = hscroll->mag(); - int zoomlvl = MusEWidget::ScrollScale::getQuickZoomLevel(mag); + int zoomlvl = MusEGui::ScrollScale::getQuickZoomLevel(mag); if (zoomlvl < 23) zoomlvl++; - int newmag = MusEWidget::ScrollScale::convertQuickZoomLevelToMag(zoomlvl); + int newmag = MusEGui::ScrollScale::convertQuickZoomLevelToMag(zoomlvl); hscroll->setMag(newmag); //printf("mag = %d zoomlvl = %d newmag = %d\n", mag, zoomlvl, newmag); @@ -1245,24 +1247,24 @@ void DrumEdit::keyPressEvent(QKeyEvent* event) } else if (key == shortcuts[SHRT_ZOOM_OUT].key) { int mag = hscroll->mag(); - int zoomlvl = MusEWidget::ScrollScale::getQuickZoomLevel(mag); + int zoomlvl = MusEGui::ScrollScale::getQuickZoomLevel(mag); if (zoomlvl > 1) zoomlvl--; - int newmag = MusEWidget::ScrollScale::convertQuickZoomLevelToMag(zoomlvl); + int newmag = MusEGui::ScrollScale::convertQuickZoomLevelToMag(zoomlvl); hscroll->setMag(newmag); //printf("mag = %d zoomlvl = %d newmag = %d\n", mag, zoomlvl, newmag); return; } else if (key == shortcuts[SHRT_SCROLL_LEFT].key) { - int pos = hscroll->pos() - MusEConfig::config.division; + int pos = hscroll->pos() - MusEGlobal::config.division; if (pos < 0) pos = 0; hscroll->setPos(pos); return; } else if (key == shortcuts[SHRT_SCROLL_RIGHT].key) { - int pos = hscroll->pos() + MusEConfig::config.division; + int pos = hscroll->pos() + MusEGlobal::config.division; hscroll->setPos(pos); return; } @@ -1358,8 +1360,8 @@ void DrumEdit::initShortcuts() void DrumEdit::execDeliveredScript(int id) { //QString scriptfile = QString(INSTPREFIX) + SCRIPTSSUFFIX + deliveredScriptNames[id]; - QString scriptfile = song->getScriptPath(id, true); - song->executeScript(scriptfile.toLatin1().constData(), parts(), raster(), true); + QString scriptfile = MusEGlobal::song->getScriptPath(id, true); + MusEGlobal::song->executeScript(scriptfile.toLatin1().constData(), parts(), raster(), true); } //--------------------------------------------------------- @@ -1367,8 +1369,8 @@ void DrumEdit::execDeliveredScript(int id) //--------------------------------------------------------- void DrumEdit::execUserScript(int id) { - QString scriptfile = song->getScriptPath(id, false); - song->executeScript(scriptfile.toLatin1().constData(), parts(), raster(), true); + QString scriptfile = MusEGlobal::song->getScriptPath(id, false); + MusEGlobal::song->executeScript(scriptfile.toLatin1().constData(), parts(), raster(), true); } void DrumEdit::setStep(QString v) @@ -1380,8 +1382,8 @@ void DrumEdit::setStep(QString v) bool DrumEdit::old_style_drummap_mode() { - for (ciPart p = parts()->begin(); p != parts()->end(); ++p) - if (p->second->track()->type()==Track::DRUM) + for (MusECore::ciPart p = parts()->begin(); p != parts()->end(); ++p) + if (p->second->track()->type()==MusECore::Track::DRUM) return true; return false; @@ -1424,3 +1426,5 @@ void DrumEdit::set_ignore_hide(bool val) ((DrumCanvas*)(canvas))->rebuildOurDrumMap(); } + +} // namespace MusEGui diff --git a/muse2/muse/midiedit/drumedit.h b/muse2/muse/midiedit/drumedit.h index 4b0a39b8..5603e449 100644 --- a/muse2/muse/midiedit/drumedit.h +++ b/muse2/muse/midiedit/drumedit.h @@ -43,23 +43,26 @@ class QToolButton; class QWidget; class QComboBox; + +namespace MusECore { class MidiPart; -class DrumCanvas; -class ScrollScale; -class ScoreConfig; -class PartList; -class CtrlCanvas; -class Xml; -class DList; -class CtrlEdit; class Part; +class PartList; class SNode; +class Xml; +} + +namespace MusEGui { -namespace MusEWidget { +class CtrlCanvas; +class CtrlEdit; +class DList; +class DrumCanvas; class Header; +class ScoreConfig; +class ScrollScale; class Splitter; class Toolbar1; -} enum DrumColumn { COL_HIDE = 0, @@ -93,22 +96,22 @@ class DrumEdit : public MidiEditor { group_mode_t _group_mode; bool _ignore_hide; - Event selEvent; - MidiPart* selPart; + MusECore::Event selEvent; + MusECore::MidiPart* selPart; int selTick; QMenu* menuEdit, *menuFunctions, *menuFile, *menuSelect; - MusEWidget::NoteInfo* info; + MusEGui::NoteInfo* info; QToolButton* srec; QToolButton* midiin; - MusEWidget::EditToolBar* tools2; + MusEGui::EditToolBar* tools2; - MusEWidget::Toolbar1* toolbar; - MusEWidget::Splitter* split1; - MusEWidget::Splitter* split2; + MusEGui::Toolbar1* toolbar; + MusEGui::Splitter* split1; + MusEGui::Splitter* split2; QWidget* split1w1; DList* dlist; - MusEWidget::Header* header; + MusEGui::Header* header; QToolBar* tools; QComboBox *stepLenWidget; @@ -134,7 +137,7 @@ class DrumEdit : public MidiEditor { private slots: void setRaster(int); - void noteinfoChanged(MusEWidget::NoteInfo::ValType type, int val); + void noteinfoChanged(MusEGui::NoteInfo::ValType type, int val); //CtrlEdit* addCtrl(); void removeCtrl(CtrlEdit* ctrl); void cmd(int); @@ -153,7 +156,7 @@ class DrumEdit : public MidiEditor { void set_ignore_hide(bool); public slots: - void setSelection(int, Event&, Part*); + void setSelection(int, MusECore::Event&, MusECore::Part*); void soloChanged(bool); // called by Solo button void execDeliveredScript(int); void execUserScript(int); @@ -162,19 +165,21 @@ class DrumEdit : public MidiEditor { virtual void updateHScrollRange(); signals: - void deleted(TopWin*); + void deleted(MusEGui::TopWin*); public: - DrumEdit(PartList*, QWidget* parent = 0, const char* name = 0, unsigned initPos = MAXINT); + DrumEdit(MusECore::PartList*, QWidget* parent = 0, const char* name = 0, unsigned initPos = MAXINT); virtual ~DrumEdit(); - virtual void readStatus(Xml&); - virtual void writeStatus(int, Xml&) const; - static void readConfiguration(Xml& xml); - static void writeConfiguration(int, Xml&); + virtual void readStatus(MusECore::Xml&); + virtual void writeStatus(int, MusECore::Xml&) const; + static void readConfiguration(MusECore::Xml& xml); + static void writeConfiguration(int, MusECore::Xml&); bool old_style_drummap_mode(); group_mode_t group_mode() { return _group_mode; } bool ignore_hide() { return _ignore_hide; } }; +} // namespace MusEGui + #endif diff --git a/muse2/muse/midiedit/drummap.cpp b/muse2/muse/midiedit/drummap.cpp index 8f49afc0..9d4b23c2 100644 --- a/muse2/muse/midiedit/drummap.cpp +++ b/muse2/muse/midiedit/drummap.cpp @@ -26,12 +26,15 @@ #include "xml.h" #include "song.h" -global_drum_ordering_t global_drum_ordering; +namespace MusEGlobal { char drumOutmap[DRUM_MAPSIZE]; char drumInmap[128]; +MusECore::DrumMap drumMap[DRUM_MAPSIZE]; +global_drum_ordering_t global_drum_ordering; +} -DrumMap drumMap[DRUM_MAPSIZE]; +namespace MusECore { //--------------------------------------------------------- // GM default drum map @@ -257,18 +260,18 @@ const DrumMap idrumMap[DRUM_MAPSIZE] = { void initDrumMap() { for (int i = 0; i < DRUM_MAPSIZE; ++i) { - DrumMap d = drumMap[i]; + DrumMap d = MusEGlobal::drumMap[i]; //Make sure we're not overwriting any values loaded //On init, all these values are zero. If so, just set the drummap entry to the initial drummap entry. if (!(d.vol || d.len || d.channel || d.port || d.lv1 || d.lv2 || d.lv3 || d.lv4 || d.enote || d.anote || d.mute)) - drumMap[i] = idrumMap[i]; + MusEGlobal::drumMap[i] = idrumMap[i]; } //Finally, setup the inMap, outMap-values - memset(drumInmap, 0, sizeof(drumInmap)); - memset(drumOutmap, 0, sizeof(drumOutmap)); + memset(MusEGlobal::drumInmap, 0, sizeof(MusEGlobal::drumInmap)); + memset(MusEGlobal::drumOutmap, 0, sizeof(MusEGlobal::drumOutmap)); for (int i = 0; i < DRUM_MAPSIZE; ++i) { - drumInmap[(unsigned int)(drumMap[i].enote)] = i; - drumOutmap[(unsigned int)(drumMap[i].anote)] = i; + MusEGlobal::drumInmap[(unsigned int)(MusEGlobal::drumMap[i].enote)] = i; + MusEGlobal::drumOutmap[(unsigned int)(MusEGlobal::drumMap[i].anote)] = i; } } @@ -278,23 +281,23 @@ void initDrumMap() void resetGMDrumMap() { - audio->msgIdle(true); + MusEGlobal::audio->msgIdle(true); // Delete all port controller events. - //audio->msgChangeAllPortDrumCtrlEvents(false); - song->changeAllPortDrumCtrlEvents(false); + //MusEGlobal::audio->msgChangeAllPortDrumCtrlEvents(false); + MusEGlobal::song->changeAllPortDrumCtrlEvents(false); for(int i = 0; i < DRUM_MAPSIZE; ++i) - drumMap[i] = idrumMap[i]; - memset(drumInmap, 0, sizeof(drumInmap)); - memset(drumOutmap, 0, sizeof(drumOutmap)); + MusEGlobal::drumMap[i] = idrumMap[i]; + memset(MusEGlobal::drumInmap, 0, sizeof(MusEGlobal::drumInmap)); + memset(MusEGlobal::drumOutmap, 0, sizeof(MusEGlobal::drumOutmap)); for (int i = 0; i < DRUM_MAPSIZE; ++i) { - drumInmap[(unsigned int)(drumMap[i].enote)] = i; - drumOutmap[(unsigned int)(drumMap[i].anote)] = i; + MusEGlobal::drumInmap[(unsigned int)(MusEGlobal::drumMap[i].enote)] = i; + MusEGlobal::drumOutmap[(unsigned int)(MusEGlobal::drumMap[i].anote)] = i; } // Add all port controller events. - //audio->msgChangeAllPortDrumCtrlEvents(true); - song->changeAllPortDrumCtrlEvents(true); - audio->msgIdle(false); + //MusEGlobal::audio->msgChangeAllPortDrumCtrlEvents(true); + MusEGlobal::song->changeAllPortDrumCtrlEvents(true); + MusEGlobal::audio->msgIdle(false); } //--------------------------------------------------------- @@ -328,7 +331,7 @@ void writeDrumMap(int level, Xml& xml, bool external) { xml.tag(level++, "drummap"); for (int i = 0; i < DRUM_MAPSIZE; ++i) { - DrumMap* dm = &drumMap[i]; + DrumMap* dm = &MusEGlobal::drumMap[i]; const DrumMap* idm = &idrumMap[i]; if (external) { @@ -433,7 +436,7 @@ static void readDrummapEntry(Xml& xml, DrumMap* dm) case Xml::Attribut: if (tag == "idx") { int idx = xml.s2().toInt() & 0x7f; - dm = &drumMap[idx]; + dm = &MusEGlobal::drumMap[idx]; } break; @@ -454,18 +457,18 @@ static void readDrummapEntry(Xml& xml, DrumMap* dm) void readDrumMap(Xml& xml, bool external) { - audio->msgIdle(true); + MusEGlobal::audio->msgIdle(true); // Delete all port controller events. - //audio->msgChangeAllPortDrumCtrlEvents(false); - song->changeAllPortDrumCtrlEvents(false); + //MusEGlobal::audio->msgChangeAllPortDrumCtrlEvents(false); + MusEGlobal::song->changeAllPortDrumCtrlEvents(false); if (external) { for (int i = 0; i < DRUM_MAPSIZE; ++i) - drumMap[i] = blankdm; + MusEGlobal::drumMap[i] = blankdm; } else { for (int i = 0; i < DRUM_MAPSIZE; ++i) - drumMap[i] = idrumMap[i]; + MusEGlobal::drumMap[i] = idrumMap[i]; } int i = 0; for (;;) { @@ -474,16 +477,16 @@ void readDrumMap(Xml& xml, bool external) switch (token) { case Xml::Error: case Xml::End: - audio->msgIdle(false); + MusEGlobal::audio->msgIdle(false); return; case Xml::TagStart: if (tag == "entry") { if(i >= DRUM_MAPSIZE) { - audio->msgIdle(false); + MusEGlobal::audio->msgIdle(false); return; } - readDrummapEntry(xml, external ? &drumMap[i] : 0); + readDrummapEntry(xml, external ? &MusEGlobal::drumMap[i] : 0); ++i; } else if (tag == "comment") @@ -495,17 +498,17 @@ void readDrumMap(Xml& xml, bool external) break; case Xml::TagEnd: if (tag == "drummap") { - memset(drumInmap, 0, sizeof(drumInmap)); - memset(drumOutmap, 0, sizeof(drumOutmap)); + memset(MusEGlobal::drumInmap, 0, sizeof(MusEGlobal::drumInmap)); + memset(MusEGlobal::drumOutmap, 0, sizeof(MusEGlobal::drumOutmap)); for (int i = 0; i < DRUM_MAPSIZE; ++i) { - drumInmap[(unsigned int)(drumMap[i].enote)] = i; - drumOutmap[(unsigned int)(drumMap[i].anote)] = i; + MusEGlobal::drumInmap[(unsigned int)(MusEGlobal::drumMap[i].enote)] = i; + MusEGlobal::drumOutmap[(unsigned int)(MusEGlobal::drumMap[i].anote)] = i; } // Add all port controller events. - //audio->msgChangeAllPortDrumCtrlEvents(true); - song->changeAllPortDrumCtrlEvents(true); + //MusEGlobal::audio->msgChangeAllPortDrumCtrlEvents(true); + MusEGlobal::song->changeAllPortDrumCtrlEvents(true); - audio->msgIdle(false); + MusEGlobal::audio->msgIdle(false); return; } default: @@ -513,8 +516,9 @@ void readDrumMap(Xml& xml, bool external) } } // Add all port controller events. - //audio->msgChangeAllPortDrumCtrlEvents(true); - song->changeAllPortDrumCtrlEvents(true); - audio->msgIdle(false); + //MusEGlobal::audio->msgChangeAllPortDrumCtrlEvents(true); + MusEGlobal::song->changeAllPortDrumCtrlEvents(true); + MusEGlobal::audio->msgIdle(false); } +} // namespace MusECore diff --git a/muse2/muse/midiedit/drummap.h b/muse2/muse/midiedit/drummap.h index db512103..2dbaae42 100644 --- a/muse2/muse/midiedit/drummap.h +++ b/muse2/muse/midiedit/drummap.h @@ -27,6 +27,8 @@ #include <QString> #include <QList> +namespace MusECore { + class Xml; //--------------------------------------------------------- @@ -51,9 +53,6 @@ struct DrumMap { #define DRUM_MAPSIZE 128 -extern char drumOutmap[DRUM_MAPSIZE]; -extern char drumInmap[DRUM_MAPSIZE]; -extern DrumMap drumMap[DRUM_MAPSIZE]; extern const DrumMap idrumMap[DRUM_MAPSIZE]; //FINDMICH dummy! extern void initDrumMap(); extern void writeDrumMap(int level, Xml& xml, bool external); @@ -61,8 +60,16 @@ extern void readDrumMap(Xml& xml, bool external); extern void resetGMDrumMap(); class MidiTrack; -typedef QList< std::pair<MidiTrack*,int> > global_drum_ordering_t; +} // namespace MusECore + +namespace MusEGlobal { +extern char drumOutmap[DRUM_MAPSIZE]; +extern char drumInmap[DRUM_MAPSIZE]; +extern MusECore::DrumMap drumMap[DRUM_MAPSIZE]; +typedef QList< std::pair<MusECore::MidiTrack*,int> > global_drum_ordering_t; extern global_drum_ordering_t global_drum_ordering; +} + #endif diff --git a/muse2/muse/midiedit/ecanvas.cpp b/muse2/muse/midiedit/ecanvas.cpp index b30574f1..61891b2e 100644 --- a/muse2/muse/midiedit/ecanvas.cpp +++ b/muse2/muse/midiedit/ecanvas.cpp @@ -42,6 +42,8 @@ #include "audio.h" #include "functions.h" +namespace MusEGui { + //--------------------------------------------------------- // EventCanvas //--------------------------------------------------------- @@ -61,7 +63,7 @@ EventCanvas::EventCanvas(MidiEditor* pr, QWidget* parent, int sx, setFocusPolicy(Qt::StrongFocus); setMouseTracking(true); - curPart = (MidiPart*)(editor->parts()->begin()->second); + curPart = (MusECore::MidiPart*)(editor->parts()->begin()->second); curPartId = curPart->sn(); } @@ -133,7 +135,7 @@ void EventCanvas::mouseMove(QMouseEvent* event) void EventCanvas::updateSelection() { - song->update(SC_SELECTION); + MusEGlobal::song->update(SC_SELECTION); } //--------------------------------------------------------- @@ -152,8 +154,8 @@ void EventCanvas::songChanged(int flags) start_tick = MAXINT; end_tick = 0; curPart = 0; - for (iPart p = editor->parts()->begin(); p != editor->parts()->end(); ++p) { - MidiPart* part = (MidiPart*)(p->second); + for (MusECore::iPart p = editor->parts()->begin(); p != editor->parts()->end(); ++p) { + MusECore::MidiPart* part = (MusECore::MidiPart*)(p->second); if (part->sn() == curPartId) curPart = part; unsigned stick = part->tick(); @@ -164,9 +166,9 @@ void EventCanvas::songChanged(int flags) if (etick > end_tick) end_tick = etick; - EventList* el = part->events(); - for (iEvent i = el->begin(); i != el->end(); ++i) { - Event e = i->second; + MusECore::EventList* el = part->events(); + for (MusECore::iEvent i = el->begin(); i != el->end(); ++i) { + MusECore::Event e = i->second; // Added by T356. Do not add events which are either past, or extend past the end of the part. // Reverted to just events which are past. p4.0.24 if(e.tick() > len) @@ -180,32 +182,32 @@ void EventCanvas::songChanged(int flags) } } - Event event; - MidiPart* part = 0; + MusECore::Event event; + MusECore::MidiPart* part = 0; int x = 0; - MusEWidget::CItem* nevent = 0; + CItem* nevent = 0; int n = 0; // count selections - for (MusEWidget::iCItem k = items.begin(); k != items.end(); ++k) { - Event ev = k->second->event(); + for (iCItem k = items.begin(); k != items.end(); ++k) { + MusECore::Event ev = k->second->event(); bool selected = ev.selected(); if (selected) { k->second->setSelected(true); ++n; if (!nevent) { nevent = k->second; - Event mi = nevent->event(); + MusECore::Event mi = nevent->event(); curVelo = mi.velo(); } } } - start_tick = song->roundDownBar(start_tick); - end_tick = song->roundUpBar(end_tick); + start_tick = MusEGlobal::song->roundDownBar(start_tick); + end_tick = MusEGlobal::song->roundUpBar(end_tick); if (n == 1) { x = nevent->x(); event = nevent->event(); - part = (MidiPart*)nevent->part(); + part = (MusECore::MidiPart*)nevent->part(); if (curPart != part) { curPart = part; curPartId = curPart->sn(); @@ -214,7 +216,7 @@ void EventCanvas::songChanged(int flags) } emit selectionChanged(x, event, part); if (curPart == 0) - curPart = (MidiPart*)(editor->parts()->begin()->second); + curPart = (MusECore::MidiPart*)(editor->parts()->begin()->second); redraw(); } @@ -225,11 +227,11 @@ void EventCanvas::selectAtTick(unsigned int tick) { //Select note nearest tick, if none selected and there are any if (!items.empty() && selectionSize() == 0) { - MusEWidget::iCItem i = items.begin(); - MusEWidget::CItem* nearest = i->second; + iCItem i = items.begin(); + CItem* nearest = i->second; while (i != items.end()) { - MusEWidget::CItem* cur=i->second; + CItem* cur=i->second; unsigned int curtk=abs(cur->x() + cur->part()->tick() - tick); unsigned int neartk=abs(nearest->x() + nearest->part()->tick() - tick); @@ -251,9 +253,9 @@ void EventCanvas::selectAtTick(unsigned int tick) // track //--------------------------------------------------------- -MidiTrack* EventCanvas::track() const +MusECore::MidiTrack* EventCanvas::track() const { - return ((MidiPart*)curPart)->track(); + return ((MusECore::MidiPart*)curPart)->track(); } @@ -283,7 +285,7 @@ void EventCanvas::keyPress(QKeyEvent* event) int tick_min = INT_MAX; bool found = false; - for (MusEWidget::iCItem i= items.begin(); i != items.end(); i++) { + for (iCItem i= items.begin(); i != items.end(); i++) { if (!i->second->isSelected()) continue; @@ -296,16 +298,16 @@ void EventCanvas::keyPress(QKeyEvent* event) tick_min = tick; } if (found) { - Pos p1(tick_min, true); - Pos p2(tick_max, true); - song->setPos(1, p1); - song->setPos(2, p2); + MusECore::Pos p1(tick_min, true); + MusECore::Pos p2(tick_max, true); + MusEGlobal::song->setPos(1, p1); + MusEGlobal::song->setPos(2, p2); } } // Select items by key (PianoRoll & DrumEditor) else if (key == shortcuts[SHRT_SEL_RIGHT].key || key == shortcuts[SHRT_SEL_RIGHT_ADD].key) { - MusEWidget::iCItem i, iRightmost; - MusEWidget::CItem* rightmost = NULL; + iCItem i, iRightmost; + CItem* rightmost = NULL; //Get the rightmost selected note (if any) for (i = items.begin(); i != items.end(); ++i) { if (i->second->isSelected()) { @@ -313,7 +315,7 @@ void EventCanvas::keyPress(QKeyEvent* event) } } if (rightmost) { - MusEWidget::iCItem temp = iRightmost; temp++; + iCItem temp = iRightmost; temp++; //If so, deselect current note and select the one to the right if (temp != items.end()) { if (key != shortcuts[SHRT_SEL_RIGHT_ADD].key) @@ -330,8 +332,8 @@ void EventCanvas::keyPress(QKeyEvent* event) } //Select items by key: (PianoRoll & DrumEditor) else if (key == shortcuts[SHRT_SEL_LEFT].key || key == shortcuts[SHRT_SEL_LEFT_ADD].key) { - MusEWidget::iCItem i, iLeftmost; - MusEWidget::CItem* leftmost = NULL; + iCItem i, iLeftmost; + CItem* leftmost = NULL; if (items.size() > 0 ) { for (i = items.end(), i--; i != items.begin(); i--) { if (i->second->isSelected()) { @@ -354,27 +356,27 @@ void EventCanvas::keyPress(QKeyEvent* event) } } else if (key == shortcuts[SHRT_INC_PITCH].key) { - modifySelected(MusEWidget::NoteInfo::VAL_PITCH, 1); + modifySelected(NoteInfo::VAL_PITCH, 1); } else if (key == shortcuts[SHRT_DEC_PITCH].key) { - modifySelected(MusEWidget::NoteInfo::VAL_PITCH, -1); + modifySelected(NoteInfo::VAL_PITCH, -1); } else if (key == shortcuts[SHRT_INC_POS].key) { // TODO: Check boundaries - modifySelected(MusEWidget::NoteInfo::VAL_TIME, editor->raster()); + modifySelected(NoteInfo::VAL_TIME, editor->raster()); } else if (key == shortcuts[SHRT_DEC_POS].key) { // TODO: Check boundaries - modifySelected(MusEWidget::NoteInfo::VAL_TIME, 0 - editor->raster()); + modifySelected(NoteInfo::VAL_TIME, 0 - editor->raster()); } else if (key == shortcuts[SHRT_INCREASE_LEN].key) { // TODO: Check boundaries - modifySelected(MusEWidget::NoteInfo::VAL_LEN, editor->raster()); + modifySelected(NoteInfo::VAL_LEN, editor->raster()); } else if (key == shortcuts[SHRT_DECREASE_LEN].key) { // TODO: Check boundaries - modifySelected(MusEWidget::NoteInfo::VAL_LEN, 0 - editor->raster()); + modifySelected(NoteInfo::VAL_LEN, 0 - editor->raster()); } else @@ -431,15 +433,17 @@ void EventCanvas::endMoveItems(const QPoint& pos, DragType dragtype, int dir) - Undo operations = moveCanvasItems(moving, dp, dx, dragtype); + MusECore::Undo operations = moveCanvasItems(moving, dp, dx, dragtype); if (operations.empty()) songChanged(SC_EVENT_MODIFIED); //this is a hack to force the canvas to repopulate //itself. otherwise, if a moving operation was forbidden, //the canvas would still show the movement else - song->applyOperationGroup(operations); + MusEGlobal::song->applyOperationGroup(operations); moving.clear(); updateSelection(); redraw(); } + +} // namespace MusEGui diff --git a/muse2/muse/midiedit/ecanvas.h b/muse2/muse/midiedit/ecanvas.h index f31b5f6b..1c66e9b4 100644 --- a/muse2/muse/midiedit/ecanvas.h +++ b/muse2/muse/midiedit/ecanvas.h @@ -28,15 +28,16 @@ #include <QEvent> #include <QKeyEvent> -class MidiPart; -class MidiTrack; -class MidiEditor; -class Part; class QMimeData; class QDrag; class QString; class QDropEvent; +namespace MusECore { +class MidiPart; +class MidiTrack; +class Part; + struct PartToChange { Part* npart; @@ -45,11 +46,16 @@ struct PartToChange typedef std::map<Part*, PartToChange> PartsToChangeMap; typedef std::map<Part*, PartToChange>::iterator iPartToChange; +} + +namespace MusEGui { + +class MidiEditor; //--------------------------------------------------------- // EventCanvas //--------------------------------------------------------- -class EventCanvas : public MusEWidget::Canvas { +class EventCanvas : public Canvas { Q_OBJECT virtual void leaveEvent(QEvent*e); virtual void enterEvent(QEvent*e); @@ -65,11 +71,11 @@ class EventCanvas : public MusEWidget::Canvas { bool _midiin; void updateSelection(); - virtual void addItem(Part*, Event&) = 0; + virtual void addItem(MusECore::Part*, MusECore::Event&) = 0; // Added by T356. virtual QPoint raster(const QPoint&) const; - virtual Undo moveCanvasItems(MusEWidget::CItemList&, int, int, DragType) = 0; - virtual UndoOp moveItem(MusEWidget::CItem*, const QPoint&, DragType) = 0; + virtual MusECore::Undo moveCanvasItems(CItemList&, int, int, DragType) = 0; + virtual MusECore::UndoOp moveItem(CItem*, const QPoint&, DragType) = 0; virtual void endMoveItems(const QPoint&, DragType, int dir); public slots: @@ -80,12 +86,12 @@ class EventCanvas : public MusEWidget::Canvas { signals: void pitchChanged(int); // current cursor position void timeChanged(unsigned); - void selectionChanged(int, Event&, Part*); + void selectionChanged(int, MusECore::Event&, MusECore::Part*); void enterCanvas(); public: EventCanvas(MidiEditor*, QWidget*, int, int, const char* name = 0); - MidiTrack* track() const; + MusECore::MidiTrack* track() const; unsigned start() const { return start_tick; } unsigned end() const { return end_tick; } bool midiin() const { return _midiin; } @@ -96,9 +102,11 @@ class EventCanvas : public MusEWidget::Canvas { void playEvents(bool flag) { _playEvents = flag; } void selectAtTick(unsigned int tick); void viewDropEvent(QDropEvent* event); - virtual void modifySelected(MusEWidget::NoteInfo::ValType, int) {} + virtual void modifySelected(NoteInfo::ValType, int) {} virtual void keyPress(QKeyEvent*); }; +} // namespace MusEGui + #endif diff --git a/muse2/muse/midiedit/piano.cpp b/muse2/muse/midiedit/piano.cpp index d347b10a..abd360df 100644 --- a/muse2/muse/midiedit/piano.cpp +++ b/muse2/muse/midiedit/piano.cpp @@ -367,7 +367,7 @@ static const char *mk4_xpm[] = { //--------------------------------------------------------- Piano::Piano(QWidget* parent, int ymag) - : MusEWidget::View(parent, 1, ymag) + : MusEGui::View(parent, 1, ymag) { setMouseTracking(true); curPitch = -1; diff --git a/muse2/muse/midiedit/piano.h b/muse2/muse/midiedit/piano.h index 133295ab..ea032189 100644 --- a/muse2/muse/midiedit/piano.h +++ b/muse2/muse/midiedit/piano.h @@ -36,7 +36,7 @@ class QPixmap; // Piano //--------------------------------------------------------- -class Piano : public MusEWidget::View +class Piano : public MusEGui::View { Q_OBJECT diff --git a/muse2/muse/midiedit/pianoroll.cpp b/muse2/muse/midiedit/pianoroll.cpp index 178b5c46..82a75f7f 100644 --- a/muse2/muse/midiedit/pianoroll.cpp +++ b/muse2/muse/midiedit/pianoroll.cpp @@ -68,20 +68,22 @@ #include "mtrackinfo.h" +namespace MusEGui { + int PianoRoll::_rasterInit = 96; int PianoRoll::colorModeInit = 0; static const int xscale = -10; static const int yscale = 1; static const int pianoWidth = 40; -static int pianorollTools = MusEWidget::PointerTool | MusEWidget::PencilTool | MusEWidget::RubberTool | MusEWidget::DrawTool; +static int pianorollTools = MusEGui::PointerTool | MusEGui::PencilTool | MusEGui::RubberTool | MusEGui::DrawTool; //--------------------------------------------------------- // PianoRoll //--------------------------------------------------------- -PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned initPos) +PianoRoll::PianoRoll(MusECore::PartList* pl, QWidget* parent, const char* name, unsigned initPos) : MidiEditor(TopWin::PIANO_ROLL, _rasterInit, pl, parent, name) { deltaMode = false; @@ -214,7 +216,7 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i menuPlugins = menuBar()->addMenu(tr("&Plugins")); - song->populateScriptMenu(menuPlugins, this); + MusEGlobal::song->populateScriptMenu(menuPlugins, this); connect(mapper, SIGNAL(mapped(int)), this, SLOT(cmd(int))); @@ -282,7 +284,7 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i speaker->setCheckable(true); tools->addWidget(speaker); - tools2 = new MusEWidget::EditToolBar(this, pianorollTools); + tools2 = new MusEGui::EditToolBar(this, pianorollTools); addToolBar(tools2); QToolBar* panicToolbar = addToolBar(tr("panic")); @@ -296,32 +298,32 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i transport->addActions(MusEGlobal::transportAction->actions()); addToolBarBreak(); - toolbar = new MusEWidget::Toolbar1(this, _rasterInit); + toolbar = new MusEGui::Toolbar1(this, _rasterInit); addToolBar(toolbar); addToolBarBreak(); - info = new MusEWidget::NoteInfo(this); + info = new MusEGui::NoteInfo(this); addToolBar(info); //--------------------------------------------------- // split //--------------------------------------------------- - splitter = new MusEWidget::Splitter(Qt::Vertical, mainw, "splitter"); + splitter = new MusEGui::Splitter(Qt::Vertical, mainw, "splitter"); splitter->setHandleWidth(2); - hsplitter = new MusEWidget::Splitter(Qt::Horizontal, mainw, "hsplitter"); + hsplitter = new MusEGui::Splitter(Qt::Horizontal, mainw, "hsplitter"); hsplitter->setChildrenCollapsible(true); hsplitter->setHandleWidth(2); QPushButton* ctrl = new QPushButton(tr("ctrl"), mainw); //QPushButton* ctrl = new QPushButton(tr("C"), mainw); // Tim. ctrl->setObjectName("Ctrl"); - ctrl->setFont(MusEConfig::config.fonts[3]); + ctrl->setFont(MusEGlobal::config.fonts[3]); ctrl->setToolTip(tr("Add Controller View")); - //hscroll = new MusEWidget::ScrollScale(-25, -2, xscale, 20000, Qt::Horizontal, mainw); + //hscroll = new MusEGui::ScrollScale(-25, -2, xscale, 20000, Qt::Horizontal, mainw); // Increased scale to -1. To resolve/select/edit 1-tick-wide (controller graph) events. p4.0.18 Tim. - hscroll = new MusEWidget::ScrollScale(-25, -1, xscale, 20000, Qt::Horizontal, mainw); + hscroll = new MusEGui::ScrollScale(-25, -1, xscale, 20000, Qt::Horizontal, mainw); ctrl->setFixedSize(pianoWidth, hscroll->sizeHint().height()); //ctrl->setFixedSize(pianoWidth / 2, hscroll->sizeHint().height()); // Tim. @@ -329,14 +331,14 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i /* QPushButton* trackInfoButton = new QPushButton(tr("T"), mainw); trackInfoButton->setObjectName("TrackInfo"); - trackInfoButton->setFont(MusEConfig::config.fonts[3]); + trackInfoButton->setFont(MusEGlobal::config.fonts[3]); trackInfoButton->setToolTip(tr("Show track info")); trackInfoButton->setFixedSize(pianoWidth / 2, hscroll->sizeHint().height()); */ QSizeGrip* corner = new QSizeGrip(mainw); - midiTrackInfo = new MusEWidget::MidiTrackInfo(mainw); + midiTrackInfo = new MusEGui::MidiTrackInfo(mainw); int mtiw = midiTrackInfo->width(); // Save this. midiTrackInfo->setMinimumWidth(100); //midiTrackInfo->setMaximumWidth(150); @@ -389,14 +391,14 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i gridS1->setSpacing(0); //Defined and configure your program change bar here. //This may well be a copy of MTScale extended for our needs - time = new MusEWidget::MTScale(&_raster, split1, xscale); + time = new MusEGui::MTScale(&_raster, split1, xscale); Piano* piano = new Piano(split1, yscale); canvas = new PianoCanvas(this, split1, xscale, yscale); - vscroll = new MusEWidget::ScrollScale(-3, 7, yscale, KH * 75, Qt::Vertical, split1); + vscroll = new MusEGui::ScrollScale(-3, 7, yscale, KH * 75, Qt::Vertical, split1); //setFocusProxy(canvas); // Tim. - int offset = -(MusEConfig::config.division/4); + int offset = -(MusEGlobal::config.division/4); canvas->setOrigin(offset, 0); canvas->setCanvasTools(pianorollTools); canvas->setFocus(); @@ -410,7 +412,7 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i //gridS1->setColumnStretch(2, 100); // Tim. gridS1->addWidget(time, 0, 1, 1, 2); - gridS1->addWidget(MusEUtil::hLine(split1), 1, 0, 1, 3); + gridS1->addWidget(MusECore::hLine(split1), 1, 0, 1, 3); gridS1->addWidget(piano, 2, 0); gridS1->addWidget(canvas, 2, 1); gridS1->addWidget(vscroll, 2, 2); @@ -418,7 +420,7 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i // Tim. /* gridS1->addWidget(time, 0, 2, 1, 3); - gridS1->addWidget(MusEUtil::hLine(split1), 1, 1, 1, 4); + gridS1->addWidget(MusECore::hLine(split1), 1, 1, 1, 4); //gridS1->addWidget(infoScroll, 2, 0); gridS1->addWidget(infoScroll, 0, 0, 3, 1); gridS1->addWidget(piano, 2, 1); @@ -426,7 +428,7 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i gridS1->addWidget(vscroll, 2, 3); */ - ctrlLane = new MusEWidget::Splitter(Qt::Vertical, splitter, "ctrllane"); + ctrlLane = new MusEGui::Splitter(Qt::Vertical, splitter, "ctrllane"); QWidget* split2 = new QWidget(splitter); split2->setMaximumHeight(hscroll->sizeHint().height()); split2->setMinimumHeight(hscroll->sizeHint().height()); @@ -452,7 +454,7 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i connect(ctrl, SIGNAL(clicked()), SLOT(addCtrl())); //connect(trackInfoButton, SIGNAL(clicked()), SLOT(toggleTrackInfo())); Tim. - connect(info, SIGNAL(valueChanged(MusEWidget::NoteInfo::ValType, int)), SLOT(noteinfoChanged(MusEWidget::NoteInfo::ValType, int))); + connect(info, SIGNAL(valueChanged(MusEGui::NoteInfo::ValType, int)), SLOT(noteinfoChanged(MusEGui::NoteInfo::ValType, int))); connect(vscroll, SIGNAL(scrollChanged(int)), piano, SLOT(setYPos(int))); connect(vscroll, SIGNAL(scrollChanged(int)), canvas, SLOT(setYPos(int))); connect(vscroll, SIGNAL(scaleChanged(int)), canvas, SLOT(setYMag(int))); @@ -469,8 +471,8 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i connect(canvas, SIGNAL(verticalScroll(unsigned)), vscroll, SLOT(setPos(unsigned))); connect(canvas, SIGNAL(horizontalScroll(unsigned)),hscroll, SLOT(setPos(unsigned))); connect(canvas, SIGNAL(horizontalScrollNoLimit(unsigned)),hscroll, SLOT(setPosNoLimit(unsigned))); - connect(canvas, SIGNAL(selectionChanged(int, Event&, Part*)), this, - SLOT(setSelection(int, Event&, Part*))); + connect(canvas, SIGNAL(selectionChanged(int, MusECore::Event&, MusECore::Part*)), this, + SLOT(setSelection(int, MusECore::Event&, MusECore::Part*))); connect(piano, SIGNAL(keyPressed(int, int, bool)), canvas, SLOT(pianoPressed(int, int, bool))); connect(piano, SIGNAL(keyReleased(int, bool)), canvas, SLOT(pianoReleased(int, bool))); @@ -486,7 +488,7 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i //setSelection(0, 0, 0); //Really necessary? Causes segfault when only 1 item selected, replaced by the following: info->setEnabled(false); - connect(song, SIGNAL(songChanged(int)), SLOT(songChanged1(int))); + connect(MusEGlobal::song, SIGNAL(songChanged(int)), SLOT(songChanged1(int))); setWindowTitle(canvas->getCaption()); @@ -510,14 +512,14 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i selectionChanged(); // enable/disable "Copy" & "Paste" initShortcuts(); // initialize shortcuts - const Pos cpos=song->cPos(); + const MusECore::Pos cpos=MusEGlobal::song->cPos(); canvas->setPos(0, cpos.tick(), true); canvas->selectAtTick(cpos.tick()); //canvas->selectFirst();// unsigned pos=0; if(initPos >= MAXINT) - pos = song->cpos(); + pos = MusEGlobal::song->cpos(); if(pos > MAXINT) pos = MAXINT; if (pos) @@ -638,14 +640,14 @@ void PianoRoll::cmd(int cmd) erase_notes(partlist_to_set(parts()), 1); break; case PianoCanvas::CMD_COPY: copy_notes(partlist_to_set(parts()), 1); break; - case PianoCanvas::CMD_COPY_RANGE: copy_notes(partlist_to_set(parts()), MusEUtil::any_event_selected(partlist_to_set(parts())) ? 3 : 2); break; + case PianoCanvas::CMD_COPY_RANGE: copy_notes(partlist_to_set(parts()), MusECore::any_event_selected(partlist_to_set(parts())) ? 3 : 2); break; case PianoCanvas::CMD_PASTE: ((PianoCanvas*)canvas)->cmd(PianoCanvas::CMD_SELECT_NONE); - paste_notes(3072); + MusECore::paste_notes(3072); break; case PianoCanvas::CMD_PASTE_DIALOG: ((PianoCanvas*)canvas)->cmd(PianoCanvas::CMD_SELECT_NONE); - paste_notes((canvas->part())); + MusECore::paste_notes((canvas->part())); break; case PianoCanvas::CMD_MODIFY_GATE_TIME: modify_notelen(partlist_to_set(parts())); break; case PianoCanvas::CMD_MODIFY_VELOCITY: modify_velocity(partlist_to_set(parts())); break; @@ -668,12 +670,12 @@ void PianoRoll::cmd(int cmd) // update Info Line //--------------------------------------------------------- -void PianoRoll::setSelection(int tick, Event& e, Part* p) +void PianoRoll::setSelection(int tick, MusECore::Event& e, MusECore::Part* p) { int selections = canvas->selectionSize(); selEvent = e; - selPart = (MidiPart*)p; + selPart = (MusECore::MidiPart*)p; selTick = tick; if (selections > 1) { @@ -710,7 +712,7 @@ void PianoRoll::setSelection(int tick, Event& e, Part* p) // edit currently selected Event //--------------------------------------------------------- -void PianoRoll::noteinfoChanged(MusEWidget::NoteInfo::ValType type, int val) +void PianoRoll::noteinfoChanged(MusEGui::NoteInfo::ValType type, int val) { int selections = canvas->selectionSize(); @@ -718,27 +720,27 @@ void PianoRoll::noteinfoChanged(MusEWidget::NoteInfo::ValType type, int val) printf("noteinfoChanged while nothing selected\n"); } else if (selections == 1) { - Event event = selEvent.clone(); + MusECore::Event event = selEvent.clone(); switch(type) { - case MusEWidget::NoteInfo::VAL_TIME: + case MusEGui::NoteInfo::VAL_TIME: event.setTick(val - selPart->tick()); break; - case MusEWidget::NoteInfo::VAL_LEN: + case MusEGui::NoteInfo::VAL_LEN: event.setLenTick(val); break; - case MusEWidget::NoteInfo::VAL_VELON: + case MusEGui::NoteInfo::VAL_VELON: event.setVelo(val); break; - case MusEWidget::NoteInfo::VAL_VELOFF: + case MusEGui::NoteInfo::VAL_VELOFF: event.setVeloOff(val); break; - case MusEWidget::NoteInfo::VAL_PITCH: + case MusEGui::NoteInfo::VAL_PITCH: event.setPitch(val); break; } // Indicate do undo, and do not do port controller values and clone parts. - //audio->msgChangeEvent(selEvent, event, selPart); - audio->msgChangeEvent(selEvent, event, selPart, true, false, false); + //MusEGlobal::audio->msgChangeEvent(selEvent, event, selPart); + MusEGlobal::audio->msgChangeEvent(selEvent, event, selPart, true, false, false); } else { // multiple events are selected; treat noteinfo values @@ -746,23 +748,23 @@ void PianoRoll::noteinfoChanged(MusEWidget::NoteInfo::ValType type, int val) int delta = 0; switch (type) { - case MusEWidget::NoteInfo::VAL_TIME: + case MusEGui::NoteInfo::VAL_TIME: delta = val - tickOffset; tickOffset = val; break; - case MusEWidget::NoteInfo::VAL_LEN: + case MusEGui::NoteInfo::VAL_LEN: delta = val - lenOffset; lenOffset = val; break; - case MusEWidget::NoteInfo::VAL_VELON: + case MusEGui::NoteInfo::VAL_VELON: delta = val - veloOnOffset; veloOnOffset = val; break; - case MusEWidget::NoteInfo::VAL_VELOFF: + case MusEGui::NoteInfo::VAL_VELOFF: delta = val - veloOffOffset; veloOffOffset = val; break; - case MusEWidget::NoteInfo::VAL_PITCH: + case MusEGui::NoteInfo::VAL_PITCH: delta = val - pitchOffset; pitchOffset = val; break; @@ -829,15 +831,15 @@ void PianoRoll::closeEvent(QCloseEvent* e) // readConfiguration //--------------------------------------------------------- -void PianoRoll::readConfiguration(Xml& xml) +void PianoRoll::readConfiguration(MusECore::Xml& xml) { for (;;) { - Xml::Token token = xml.parse(); - if (token == Xml::Error || token == Xml::End) + MusECore::Xml::Token token = xml.parse(); + if (token == MusECore::Xml::Error || token == MusECore::Xml::End) break; const QString& tag = xml.s1(); switch (token) { - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "raster") _rasterInit = xml.parseInt(); else if (tag == "colormode") @@ -847,7 +849,7 @@ void PianoRoll::readConfiguration(Xml& xml) else xml.unknown("PianoRoll"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "pianoroll") return; default: @@ -860,7 +862,7 @@ void PianoRoll::readConfiguration(Xml& xml) // writeConfiguration //--------------------------------------------------------- -void PianoRoll::writeConfiguration(int level, Xml& xml) +void PianoRoll::writeConfiguration(int level, MusECore::Xml& xml) { xml.tag(level++, "pianoroll"); xml.intTag(level, "raster", _rasterInit); @@ -876,8 +878,8 @@ void PianoRoll::writeConfiguration(int level, Xml& xml) void PianoRoll::soloChanged(bool flag) { - audio->msgSetSolo(canvas->track(), flag); - song->update(SC_SOLO); + MusEGlobal::audio->msgSetSolo(canvas->track(), flag); + MusEGlobal::song->update(SC_SOLO); } //--------------------------------------------------------- @@ -896,7 +898,7 @@ void PianoRoll::setRaster(int val) // writeStatus //--------------------------------------------------------- -void PianoRoll::writeStatus(int level, Xml& xml) const +void PianoRoll::writeStatus(int level, MusECore::Xml& xml) const { writePartList(level, xml); xml.tag(level++, "pianoroll"); @@ -924,15 +926,15 @@ void PianoRoll::writeStatus(int level, Xml& xml) const // readStatus //--------------------------------------------------------- -void PianoRoll::readStatus(Xml& xml) +void PianoRoll::readStatus(MusECore::Xml& xml) { for (;;) { - Xml::Token token = xml.parse(); - if (token == Xml::Error || token == Xml::End) + MusECore::Xml::Token token = xml.parse(); + if (token == MusECore::Xml::Error || token == MusECore::Xml::End) break; const QString& tag = xml.s1(); switch (token) { - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "steprec") { int val = xml.parseInt(); canvas->setSteprec(val); @@ -974,7 +976,7 @@ void PianoRoll::readStatus(Xml& xml) else xml.unknown("PianoRoll"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "pianoroll") { _rasterInit = _raster; toolbar->setRaster(_raster); @@ -1034,19 +1036,19 @@ void PianoRoll::keyPressEvent(QKeyEvent* event) return; } else if (key == shortcuts[SHRT_TOOL_POINTER].key) { - tools2->set(MusEWidget::PointerTool); + tools2->set(MusEGui::PointerTool); return; } else if (key == shortcuts[SHRT_TOOL_PENCIL].key) { - tools2->set(MusEWidget::PencilTool); + tools2->set(MusEGui::PencilTool); return; } else if (key == shortcuts[SHRT_TOOL_RUBBER].key) { - tools2->set(MusEWidget::RubberTool); + tools2->set(MusEGui::RubberTool); return; } else if (key == shortcuts[SHRT_TOOL_LINEDRAW].key) { - tools2->set(MusEWidget::DrawTool); + tools2->set(MusEGui::DrawTool); return; } else if (key == shortcuts[SHRT_POS_INC].key) { @@ -1075,41 +1077,41 @@ void PianoRoll::keyPressEvent(QKeyEvent* event) } else if (key == shortcuts[SHRT_ZOOM_IN].key) { int mag = hscroll->mag(); - int zoomlvl = MusEWidget::ScrollScale::getQuickZoomLevel(mag); + int zoomlvl = MusEGui::ScrollScale::getQuickZoomLevel(mag); if (zoomlvl < 23) zoomlvl++; - int newmag = MusEWidget::ScrollScale::convertQuickZoomLevelToMag(zoomlvl); + int newmag = MusEGui::ScrollScale::convertQuickZoomLevelToMag(zoomlvl); hscroll->setMag(newmag); //printf("mag = %d zoomlvl = %d newmag = %d\n", mag, zoomlvl, newmag); return; } else if (key == shortcuts[SHRT_ZOOM_OUT].key) { int mag = hscroll->mag(); - int zoomlvl = MusEWidget::ScrollScale::getQuickZoomLevel(mag); + int zoomlvl = MusEGui::ScrollScale::getQuickZoomLevel(mag); if (zoomlvl > 1) zoomlvl--; - int newmag = MusEWidget::ScrollScale::convertQuickZoomLevelToMag(zoomlvl); + int newmag = MusEGui::ScrollScale::convertQuickZoomLevelToMag(zoomlvl); hscroll->setMag(newmag); //printf("mag = %d zoomlvl = %d newmag = %d\n", mag, zoomlvl, newmag); return; } else if (key == shortcuts[SHRT_GOTO_CPOS].key) { - PartList* p = this->parts(); - Part* first = p->begin()->second; - hscroll->setPos(song->cpos() - first->tick() ); + MusECore::PartList* p = this->parts(); + MusECore::Part* first = p->begin()->second; + hscroll->setPos(MusEGlobal::song->cpos() - first->tick() ); return; } else if (key == shortcuts[SHRT_SCROLL_LEFT].key) { - int pos = hscroll->pos() - MusEConfig::config.division; + int pos = hscroll->pos() - MusEGlobal::config.division; if (pos < 0) pos = 0; hscroll->setPos(pos); return; } else if (key == shortcuts[SHRT_SCROLL_RIGHT].key) { - int pos = hscroll->pos() + MusEConfig::config.division; + int pos = hscroll->pos() + MusEGlobal::config.division; hscroll->setPos(pos); return; } @@ -1292,8 +1294,8 @@ void PianoRoll::initShortcuts() void PianoRoll::execDeliveredScript(int id) { //QString scriptfile = QString(INSTPREFIX) + SCRIPTSSUFFIX + deliveredScriptNames[id]; - QString scriptfile = song->getScriptPath(id, true); - song->executeScript(scriptfile.toAscii().data(), parts(), raster(), true); + QString scriptfile = MusEGlobal::song->getScriptPath(id, true); + MusEGlobal::song->executeScript(scriptfile.toAscii().data(), parts(), raster(), true); } //--------------------------------------------------------- @@ -1301,8 +1303,8 @@ void PianoRoll::execDeliveredScript(int id) //--------------------------------------------------------- void PianoRoll::execUserScript(int id) { - QString scriptfile = song->getScriptPath(id, false); - song->executeScript(scriptfile.toAscii().data(), parts(), raster(), true); + QString scriptfile = MusEGlobal::song->getScriptPath(id, false); + MusEGlobal::song->executeScript(scriptfile.toAscii().data(), parts(), raster(), true); } //--------------------------------------------------------- @@ -1337,3 +1339,5 @@ void PianoRoll::toggleTrackInfo() infoScroll->setVisible(!vis); infoScroll->setEnabled(!vis); } + +} // namespace MusEGui diff --git a/muse2/muse/midiedit/pianoroll.h b/muse2/muse/midiedit/pianoroll.h index 1a87d407..0b90b1e6 100644 --- a/muse2/muse/midiedit/pianoroll.h +++ b/muse2/muse/midiedit/pianoroll.h @@ -35,33 +35,35 @@ #include "tools.h" #include "event.h" -class MidiPart; -class TimeLabel; -class PitchLabel; +class QAction; class QLabel; -class PianoCanvas; -class MTScale; -class Track; -class QToolButton; -class QToolBar; +class QMenu; class QPushButton; -class CtrlEdit; +class QScrollArea; +class QScrollBar; +class QToolBar; +class QToolButton; +class QWidget; + +namespace MusECore { +class MidiPart; +class Part; class PartList; +class Track; class Xml; -class ScrollScale; -class Part; -class SNode; -class QMenu; -class QAction; -class QWidget; -class QScrollBar; -class QScrollArea; +} -namespace MusEWidget { + +namespace MusEGui { +class CtrlEdit; class MidiTrackInfo; +class PianoCanvas; +class PitchLabel; +class SNode; +class ScrollScale; class Splitter; +class TimeLabel; class Toolbar1; -} //--------------------------------------------------------- // PianoRoll @@ -70,8 +72,8 @@ class Toolbar1; class PianoRoll : public MidiEditor { Q_OBJECT - Event selEvent; - MidiPart* selPart; + MusECore::Event selEvent; + MusECore::MidiPart* selPart; int selTick; //enum { CMD_EVENT_COLOR, CMD_CONFIG_QUANT, CMD_LAST }; @@ -80,8 +82,8 @@ class PianoRoll : public MidiEditor { QMenu *menuEdit, *menuFunctions, *menuSelect, *menuConfig, *eventColor, *menuPlugins; - MusEWidget::MidiTrackInfo *midiTrackInfo; - Track* selected; + MusEGui::MidiTrackInfo *midiTrackInfo; + MusECore::Track* selected; QAction* editCutAction; QAction* editCopyAction; @@ -120,18 +122,18 @@ class PianoRoll : public MidiEditor { int veloOffOffset; bool deltaMode; - MusEWidget::NoteInfo* info; + MusEGui::NoteInfo* info; QToolButton* srec; QToolButton* midiin; - MusEWidget::Toolbar1* toolbar; - MusEWidget::Splitter* splitter; - MusEWidget::Splitter* hsplitter; - MusEWidget::Splitter* ctrlLane; + MusEGui::Toolbar1* toolbar; + MusEGui::Splitter* splitter; + MusEGui::Splitter* hsplitter; + MusEGui::Splitter* ctrlLane; QToolButton* speaker; QToolBar* tools; - MusEWidget::EditToolBar* tools2; + MusEGui::EditToolBar* tools2; int colorMode; @@ -152,8 +154,8 @@ class PianoRoll : public MidiEditor { virtual void keyPressEvent(QKeyEvent*); private slots: - void setSelection(int, Event&, Part*); - void noteinfoChanged(MusEWidget::NoteInfo::ValType, int); + void setSelection(int, MusECore::Event&, MusECore::Part*); + void noteinfoChanged(MusEGui::NoteInfo::ValType, int); //CtrlEdit* addCtrl(); void removeCtrl(CtrlEdit* ctrl); void soloChanged(bool flag); @@ -174,7 +176,7 @@ class PianoRoll : public MidiEditor { void updateTrackInfo(); signals: - void deleted(TopWin*); + void deleted(MusEGui::TopWin*); public slots: virtual void updateHScrollRange(); @@ -183,13 +185,15 @@ class PianoRoll : public MidiEditor { CtrlEdit* addCtrl(); public: - PianoRoll(PartList*, QWidget* parent = 0, const char* name = 0, unsigned initPos = MAXINT); + PianoRoll(MusECore::PartList*, QWidget* parent = 0, const char* name = 0, unsigned initPos = MAXINT); ~PianoRoll(); - virtual void readStatus(Xml&); - virtual void writeStatus(int, Xml&) const; - static void readConfiguration(Xml&); - static void writeConfiguration(int, Xml&); + virtual void readStatus(MusECore::Xml&); + virtual void writeStatus(int, MusECore::Xml&) const; + static void readConfiguration(MusECore::Xml&); + static void writeConfiguration(int, MusECore::Xml&); }; +} // namespace MusEGui + #endif diff --git a/muse2/muse/midiedit/prcanvas.cpp b/muse2/muse/midiedit/prcanvas.cpp index b9b4794f..9acaf186 100644 --- a/muse2/muse/midiedit/prcanvas.cpp +++ b/muse2/muse/midiedit/prcanvas.cpp @@ -56,11 +56,13 @@ #define CHORD_TIMEOUT 75 +namespace MusEGui { + //--------------------------------------------------------- // NEvent //--------------------------------------------------------- -NEvent::NEvent(Event& e, Part* p, int y) : MusEWidget::CItem(e, p) +NEvent::NEvent(MusECore::Event& e, MusECore::Part* p, int y) : MusEGui::CItem(e, p) { y = y - KH/4; unsigned tick = e.tick() + p->tick(); @@ -72,7 +74,7 @@ NEvent::NEvent(Event& e, Part* p, int y) : MusEWidget::CItem(e, p) // addItem //--------------------------------------------------------- -void PianoCanvas::addItem(Part* part, Event& event) +void PianoCanvas::addItem(MusECore::Part* part, MusECore::Event& event) { if (signed(event.tick())<0) { printf("ERROR: trying to add event before current part!\n"); @@ -85,9 +87,9 @@ void PianoCanvas::addItem(Part* part, Event& event) int diff = event.tick()-part->lenTick(); if (diff > 0) {// too short part? extend it //printf("addItem - this code should not be run!\n"); - //Part* newPart = part->clone(); + //MusECore::Part* newPart = part->clone(); //newPart->setLenTick(newPart->lenTick()+diff); - //audio->msgChangePart(part, newPart,false); + //MusEGlobal::audio->msgChangePart(part, newPart,false); //part = newPart; part->setLenTick(part->lenTick()+diff); } @@ -104,10 +106,10 @@ PianoCanvas::PianoCanvas(MidiEditor* pr, QWidget* parent, int sx, int sy) playedPitch = -1; for (int i=0;i<128;i++) noteHeldDown[i]=false; - steprec=new StepRec(noteHeldDown); + steprec=new MusECore::StepRec(noteHeldDown); songChanged(SC_TRACK_INSERTED); - connect(song, SIGNAL(midiNote(int, int)), SLOT(midiNote(int,int))); + connect(MusEGlobal::song, SIGNAL(midiNote(int, int)), SLOT(midiNote(int,int))); } PianoCanvas::~PianoCanvas() @@ -160,7 +162,7 @@ int PianoCanvas::y2pitch(int y) const // draws a note //--------------------------------------------------------- -void PianoCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, +void PianoCanvas::drawItem(QPainter& p, const MusEGui::CItem* item, const QRect& rect) { QRect r = item->bbox(); @@ -205,7 +207,7 @@ void PianoCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, QColor color; NEvent* nevent = (NEvent*) item; - Event event = nevent->event(); + MusECore::Event event = nevent->event(); if (nevent->part() != curPart){ if(item->isMoving()) color = Qt::gray; @@ -265,7 +267,7 @@ void PianoCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, //int mfh = mh; //if(mfh == meh) mfh -= 1; //if(mfy == mey) mfh -= 1; - color.setAlpha(MusEConfig::config.globalAlphaBlend); + color.setAlpha(MusEGlobal::config.globalAlphaBlend); //QLinearGradient gradient(mex + 1, mey + 1, mex + 1, mey + meh - 2); // Inside the border //gradient.setColorAt(0, color); //gradient.setColorAt(1, color.darker()); @@ -299,7 +301,7 @@ void PianoCanvas::drawTopItem(QPainter& , const QRect&) // draws moving items //--------------------------------------------------------- -void PianoCanvas::drawMoving(QPainter& p, const MusEWidget::CItem* item, const QRect& rect) +void PianoCanvas::drawMoving(QPainter& p, const MusEGui::CItem* item, const QRect& rect) { //if(((NEvent*)item)->part() != curPart) // return; @@ -320,7 +322,7 @@ void PianoCanvas::drawMoving(QPainter& p, const MusEWidget::CItem* item, const Q void PianoCanvas::viewMouseDoubleClickEvent(QMouseEvent* event) { - if ((_tool != MusEWidget::PointerTool) && (event->button() != Qt::LeftButton)) { + if ((_tool != MusEGui::PointerTool) && (event->button() != Qt::LeftButton)) { mousePress(event); return; } @@ -330,24 +332,24 @@ void PianoCanvas::viewMouseDoubleClickEvent(QMouseEvent* event) // moveCanvasItems //--------------------------------------------------------- -Undo PianoCanvas::moveCanvasItems(MusEWidget::CItemList& items, int dp, int dx, DragType dtype) +MusECore::Undo PianoCanvas::moveCanvasItems(MusEGui::CItemList& items, int dp, int dx, DragType dtype) { if(editor->parts()->empty()) - return Undo(); //return empty list + return MusECore::Undo(); //return empty list - PartsToChangeMap parts2change; - Undo operations; + MusECore::PartsToChangeMap parts2change; + MusECore::Undo operations; - for(iPart ip = editor->parts()->begin(); ip != editor->parts()->end(); ++ip) + for(MusECore::iPart ip = editor->parts()->begin(); ip != editor->parts()->end(); ++ip) { - Part* part = ip->second; + MusECore::Part* part = ip->second; if(!part) continue; int npartoffset = 0; - for(MusEWidget::iCItem ici = items.begin(); ici != items.end(); ++ici) + for(MusEGui::iCItem ici = items.begin(); ici != items.end(); ++ici) { - MusEWidget::CItem* ci = ici->second; + MusEGui::CItem* ci = ici->second; if(ci->part() != part) continue; @@ -357,7 +359,7 @@ Undo PianoCanvas::moveCanvasItems(MusEWidget::CItemList& items, int dp, int dx, // Test moving the item... NEvent* nevent = (NEvent*) ci; - Event event = nevent->event(); + MusECore::Event event = nevent->event(); x = newpos.x(); if(x < 0) x = 0; @@ -373,11 +375,11 @@ Undo PianoCanvas::moveCanvasItems(MusEWidget::CItemList& items, int dp, int dx, if(npartoffset > 0) { - iPartToChange ip2c = parts2change.find(part); + MusECore::iPartToChange ip2c = parts2change.find(part); if(ip2c == parts2change.end()) { - PartToChange p2c = {0, npartoffset}; - parts2change.insert(std::pair<Part*, PartToChange> (part, p2c)); + MusECore::PartToChange p2c = {0, npartoffset}; + parts2change.insert(std::pair<MusECore::Part*, MusECore::PartToChange> (part, p2c)); } else ip2c->second.xdiff = npartoffset; @@ -385,9 +387,9 @@ Undo PianoCanvas::moveCanvasItems(MusEWidget::CItemList& items, int dp, int dx, } bool forbidden=false; - for(iPartToChange ip2c = parts2change.begin(); ip2c != parts2change.end(); ++ip2c) + for(MusECore::iPartToChange ip2c = parts2change.begin(); ip2c != parts2change.end(); ++ip2c) { - Part* opart = ip2c->first; + MusECore::Part* opart = ip2c->first; if (opart->hasHiddenEvents()) { forbidden=true; @@ -398,12 +400,12 @@ Undo PianoCanvas::moveCanvasItems(MusEWidget::CItemList& items, int dp, int dx, if (!forbidden) { - std::vector< MusEWidget::CItem* > doneList; - typedef std::vector< MusEWidget::CItem* >::iterator iDoneList; + std::vector< MusEGui::CItem* > doneList; + typedef std::vector< MusEGui::CItem* >::iterator iDoneList; - for(MusEWidget::iCItem ici = items.begin(); ici != items.end(); ++ici) + for(MusEGui::iCItem ici = items.begin(); ici != items.end(); ++ici) { - MusEWidget::CItem* ci = ici->second; + MusEGui::CItem* ci = ici->second; int x = ci->pos().x(); int y = ci->pos().y(); @@ -433,9 +435,9 @@ Undo PianoCanvas::moveCanvasItems(MusEWidget::CItemList& items, int dp, int dx, selectItem(ci, false); } - for(iPartToChange ip2c = parts2change.begin(); ip2c != parts2change.end(); ++ip2c) + for(MusECore::iPartToChange ip2c = parts2change.begin(); ip2c != parts2change.end(); ++ip2c) { - Part* opart = ip2c->first; + MusECore::Part* opart = ip2c->first; int diff = ip2c->second.xdiff; schedule_resize_all_same_len_clone_parts(opart, opart->lenTick() + diff, operations); @@ -445,7 +447,7 @@ Undo PianoCanvas::moveCanvasItems(MusEWidget::CItemList& items, int dp, int dx, } else { - return Undo(); //return empty list + return MusECore::Undo(); //return empty list } } @@ -454,12 +456,12 @@ Undo PianoCanvas::moveCanvasItems(MusEWidget::CItemList& items, int dp, int dx, // called after moving an object //--------------------------------------------------------- -UndoOp PianoCanvas::moveItem(MusEWidget::CItem* item, const QPoint& pos, DragType dtype) +MusECore::UndoOp PianoCanvas::moveItem(MusEGui::CItem* item, const QPoint& pos, DragType dtype) { NEvent* nevent = (NEvent*) item; - Event event = nevent->event(); + MusECore::Event event = nevent->event(); int npitch = y2pitch(pos.y()); - Event newEvent = event.clone(); + MusECore::Event newEvent = event.clone(); int x = pos.x(); if (x < 0) x = 0; @@ -467,15 +469,15 @@ UndoOp PianoCanvas::moveItem(MusEWidget::CItem* item, const QPoint& pos, DragTyp int port = track()->outPort(); int channel = track()->outChannel(); // release note: - MidiPlayEvent ev1(0, port, channel, 0x90, event.pitch() + track()->transposition, 0); - audio->msgPlayMidiEvent(&ev1); - MidiPlayEvent ev2(0, port, channel, 0x90, npitch + track()->transposition, event.velo()); - audio->msgPlayMidiEvent(&ev2); + MusECore::MidiPlayEvent ev1(0, port, channel, 0x90, event.pitch() + track()->transposition, 0); + MusEGlobal::audio->msgPlayMidiEvent(&ev1); + MusECore::MidiPlayEvent ev2(0, port, channel, 0x90, npitch + track()->transposition, event.velo()); + MusEGlobal::audio->msgPlayMidiEvent(&ev2); } // Changed by T356. - Part* part = nevent->part(); // - //Part* part = Canvas::part(); // part can be dynamically recreated, ask the authority + MusECore::Part* part = nevent->part(); // + //MusECore::Part* part = Canvas::part(); // part can be dynamically recreated, ask the authority newEvent.setPitch(npitch); int ntick = editor->rasterVal(x) - part->tick(); @@ -490,16 +492,16 @@ UndoOp PianoCanvas::moveItem(MusEWidget::CItem* item, const QPoint& pos, DragTyp // printf("PianoCanvas::moveItem Error! New event end:%d exceeds length:%d of part:%s\n", newEvent.endTick(), part->lenTick(), part->name().toLatin1().constData()); if (dtype == MOVE_COPY || dtype == MOVE_CLONE) - return UndoOp(UndoOp::AddEvent, newEvent, part, false, false); + return MusECore::UndoOp(MusECore::UndoOp::AddEvent, newEvent, part, false, false); else - return UndoOp(UndoOp::ModifyEvent, newEvent, event, part, false, false); + return MusECore::UndoOp(MusECore::UndoOp::ModifyEvent, newEvent, event, part, false, false); } //--------------------------------------------------------- // newItem(p, state) //--------------------------------------------------------- -MusEWidget::CItem* PianoCanvas::newItem(const QPoint& p, int) +MusEGui::CItem* PianoCanvas::newItem(const QPoint& p, int) { //printf("newItem point\n"); int pitch = y2pitch(p.y()); @@ -508,7 +510,7 @@ MusEWidget::CItem* PianoCanvas::newItem(const QPoint& p, int) tick -= curPart->tick(); if (tick < 0) tick=0; - Event e = Event(Note); + MusECore::Event e = MusECore::Event(MusECore::Note); e.setTick(tick); e.setPitch(pitch); e.setVelo(curVelo); @@ -516,11 +518,11 @@ MusEWidget::CItem* PianoCanvas::newItem(const QPoint& p, int) return new NEvent(e, curPart, pitch2y(pitch)); } -void PianoCanvas::newItem(MusEWidget::CItem* item, bool noSnap) +void PianoCanvas::newItem(MusEGui::CItem* item, bool noSnap) { //printf("newItem citem\n"); NEvent* nevent = (NEvent*) item; - Event event = nevent->event(); + MusECore::Event event = nevent->event(); int x = item->x(); if (x<0) x=0; @@ -532,17 +534,17 @@ void PianoCanvas::newItem(MusEWidget::CItem* item, bool noSnap) if (w == 0) w = editor->raster(); } - Part* part = nevent->part(); + MusECore::Part* part = nevent->part(); event.setTick(x - part->tick()); event.setLenTick(w); event.setPitch(y2pitch(item->y())); - Undo operations; + MusECore::Undo operations; int diff = event.endTick()-part->lenTick(); if (! ((diff > 0) && part->hasHiddenEvents()) ) //operation is allowed { - operations.push_back(UndoOp(UndoOp::AddEvent,event, part, false, false)); + operations.push_back(MusECore::UndoOp(MusECore::UndoOp::AddEvent,event, part, false, false)); if (diff > 0)// part must be extended? { @@ -550,7 +552,7 @@ void PianoCanvas::newItem(MusEWidget::CItem* item, bool noSnap) printf("newItem: extending\n"); } - song->applyOperationGroup(operations); + MusEGlobal::song->applyOperationGroup(operations); } //else forbid action by not applying it else @@ -562,33 +564,33 @@ void PianoCanvas::newItem(MusEWidget::CItem* item, bool noSnap) // resizeItem //--------------------------------------------------------- -void PianoCanvas::resizeItem(MusEWidget::CItem* item, bool noSnap, bool) // experimental changes to try dynamically extending parts +void PianoCanvas::resizeItem(MusEGui::CItem* item, bool noSnap, bool) // experimental changes to try dynamically extending parts { //printf("resizeItem!\n"); NEvent* nevent = (NEvent*) item; - Event event = nevent->event(); - Event newEvent = event.clone(); + MusECore::Event event = nevent->event(); + MusECore::Event newEvent = event.clone(); int len; - Part* part = nevent->part(); + MusECore::Part* part = nevent->part(); if (noSnap) len = nevent->width(); else { - //Part* part = nevent->part(); + //MusECore::Part* part = nevent->part(); unsigned tick = event.tick() + part->tick(); len = editor->rasterVal(tick + nevent->width()) - tick; if (len <= 0) len = editor->raster(); } - Undo operations; + MusECore::Undo operations; int diff = event.tick()+len-part->lenTick(); if (! ((diff > 0) && part->hasHiddenEvents()) ) //operation is allowed { newEvent.setLenTick(len); - operations.push_back(UndoOp(UndoOp::ModifyEvent,newEvent, event, nevent->part(), false, false)); + operations.push_back(MusECore::UndoOp(MusECore::UndoOp::ModifyEvent,newEvent, event, nevent->part(), false, false)); if (diff > 0)// part must be extended? { @@ -597,7 +599,7 @@ void PianoCanvas::resizeItem(MusEWidget::CItem* item, bool noSnap, bool) } } //else forbid action by not performing it - song->applyOperationGroup(operations); + MusEGlobal::song->applyOperationGroup(operations); songChanged(SC_EVENT_MODIFIED); //this forces an update of the itemlist, which is neccessary //to remove "forbidden" events from the list again } @@ -606,13 +608,13 @@ void PianoCanvas::resizeItem(MusEWidget::CItem* item, bool noSnap, bool) // deleteItem //--------------------------------------------------------- -bool PianoCanvas::deleteItem(MusEWidget::CItem* item) +bool PianoCanvas::deleteItem(MusEGui::CItem* item) { NEvent* nevent = (NEvent*) item; if (nevent->part() == curPart) { - Event ev = nevent->event(); + MusECore::Event ev = nevent->event(); // Indicate do undo, and do not do port controller values and clone parts. - audio->msgDeleteEvent(ev, curPart, true, false, false); + MusEGlobal::audio->msgDeleteEvent(ev, curPart, true, false, false); return true; } return false; @@ -635,15 +637,15 @@ void PianoCanvas::pianoCmd(int cmd) } 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); } break; case CMD_RIGHT: { int spos = AL::sigmap.raster2(pos[0] + 1, editor->rasterStep(pos[0])); // Nudge by +1, then snap up with raster2. - Pos p(spos,true); - song->setPos(0, p, true, true, true); + MusECore::Pos p(spos,true); + MusEGlobal::song->setPos(0, p, true, true, true); } break; case CMD_LEFT_NOSNAP: @@ -651,68 +653,68 @@ void PianoCanvas::pianoCmd(int cmd) int spos = pos[0] - editor->rasterStep(pos[0]); if (spos < 0) spos = 0; - Pos p(spos,true); - song->setPos(0, p, true, true, true); //CDW + MusECore::Pos p(spos,true); + MusEGlobal::song->setPos(0, p, true, true, true); //CDW } break; case CMD_RIGHT_NOSNAP: { - Pos p(pos[0] + editor->rasterStep(pos[0]), true); - song->setPos(0, p, true, true, true); //CDW + MusECore::Pos p(pos[0] + editor->rasterStep(pos[0]), true); + MusEGlobal::song->setPos(0, p, true, true, true); //CDW } break; case CMD_INSERT: { if (pos[0] < start() || pos[0] >= end()) break; - MidiPart* part = (MidiPart*)curPart; + MusECore::MidiPart* part = (MusECore::MidiPart*)curPart; if (part == 0) break; - EventList* el = part->events(); - Undo operations; + MusECore::EventList* el = part->events(); + MusECore::Undo operations; - std::list <Event> elist; - for (iEvent e = el->lower_bound(pos[0] - part->tick()); e != el->end(); ++e) - elist.push_back((Event)e->second); - for (std::list<Event>::iterator i = elist.begin(); i != elist.end(); ++i) { - Event event = *i; - Event newEvent = event.clone(); + std::list <MusECore::Event> elist; + for (MusECore::iEvent e = el->lower_bound(pos[0] - part->tick()); e != el->end(); ++e) + elist.push_back((MusECore::Event)e->second); + for (std::list<MusECore::Event>::iterator i = elist.begin(); i != elist.end(); ++i) { + MusECore::Event event = *i; + MusECore::Event newEvent = event.clone(); newEvent.setTick(event.tick() + editor->raster());// - part->tick()); // Do not do port controller values and clone parts. - operations.push_back(UndoOp(UndoOp::ModifyEvent, newEvent, event, part, false, false)); + operations.push_back(MusECore::UndoOp(MusECore::UndoOp::ModifyEvent, newEvent, event, part, false, false)); } - song->applyOperationGroup(operations); + MusEGlobal::song->applyOperationGroup(operations); - Pos p(editor->rasterVal(pos[0] + editor->rasterStep(pos[0])), true); - song->setPos(0, p, true, false, true); + MusECore::Pos p(editor->rasterVal(pos[0] + editor->rasterStep(pos[0])), true); + MusEGlobal::song->setPos(0, p, true, false, true); } return; case CMD_BACKSPACE: if (pos[0] < start() || pos[0] >= end()) break; { - MidiPart* part = (MidiPart*)curPart; + MusECore::MidiPart* part = (MusECore::MidiPart*)curPart; if (part == 0) break; - Undo operations; - EventList* el = part->events(); - - std::list<Event> elist; - for (iEvent e = el->lower_bound(pos[0]); e != el->end(); ++e) - elist.push_back((Event)e->second); - for (std::list<Event>::iterator i = elist.begin(); i != elist.end(); ++i) { - Event event = *i; - Event newEvent = event.clone(); + MusECore::Undo operations; + MusECore::EventList* el = part->events(); + + std::list<MusECore::Event> elist; + for (MusECore::iEvent e = el->lower_bound(pos[0]); e != el->end(); ++e) + elist.push_back((MusECore::Event)e->second); + for (std::list<MusECore::Event>::iterator i = elist.begin(); i != elist.end(); ++i) { + MusECore::Event event = *i; + MusECore::Event newEvent = event.clone(); newEvent.setTick(event.tick() - editor->raster() - part->tick()); // Do not do port controller values and clone parts. - operations.push_back(UndoOp(UndoOp::ModifyEvent, newEvent, event, part, false, false)); + operations.push_back(MusECore::UndoOp(MusECore::UndoOp::ModifyEvent, newEvent, event, part, false, false)); } - song->applyOperationGroup(operations); - Pos p(editor->rasterVal(pos[0] - editor->rasterStep(pos[0])), true); - song->setPos(0, p, true, false, true); + MusEGlobal::song->applyOperationGroup(operations); + MusECore::Pos p(editor->rasterVal(pos[0] - editor->rasterStep(pos[0])), true); + MusEGlobal::song->setPos(0, p, true, false, true); } break; } @@ -729,8 +731,8 @@ void PianoCanvas::pianoPressed(int pitch, int velocity, bool shift) pitch += track()->transposition; // play note: - MidiPlayEvent e(0, port, channel, 0x90, pitch, velocity); - audio->msgPlayMidiEvent(&e); + MusECore::MidiPlayEvent e(0, port, channel, 0x90, pitch, velocity); + MusEGlobal::audio->msgPlayMidiEvent(&e); if (_steprec && pos[0] >= start_tick /* && pos[0] < end_tick [removed by flo93: this is handled in steprec->record] */ && curPart) steprec->record(curPart,pitch,editor->raster(),editor->raster(),velocity,MusEGlobal::globalKeyState&Qt::ControlModifier,shift); @@ -747,8 +749,8 @@ void PianoCanvas::pianoReleased(int pitch, bool) pitch += track()->transposition; // release key: - MidiPlayEvent e(0, port, channel, 0x90, pitch, 0); - audio->msgPlayMidiEvent(&e); + MusECore::MidiPlayEvent e(0, port, channel, 0x90, pitch, 0); + MusEGlobal::audio->msgPlayMidiEvent(&e); } //--------------------------------------------------------- @@ -830,7 +832,7 @@ void PianoCanvas::cmd(int cmd) { switch (cmd) { case CMD_SELECT_ALL: // select all - for (MusEWidget::iCItem k = items.begin(); k != items.end(); ++k) { + for (MusEGui::iCItem k = items.begin(); k != items.end(); ++k) { if (!k->second->isSelected()) selectItem(k->second, true); } @@ -839,29 +841,29 @@ void PianoCanvas::cmd(int cmd) deselectAll(); break; case CMD_SELECT_INVERT: // invert selection - for (MusEWidget::iCItem k = items.begin(); k != items.end(); ++k) { + for (MusEGui::iCItem k = items.begin(); k != items.end(); ++k) { selectItem(k->second, !k->second->isSelected()); } break; case CMD_SELECT_ILOOP: // select inside loop - for (MusEWidget::iCItem k = items.begin(); k != items.end(); ++k) { + for (MusEGui::iCItem k = items.begin(); k != items.end(); ++k) { NEvent* nevent = (NEvent*)(k->second); - Part* part = nevent->part(); - Event event = nevent->event(); + MusECore::Part* part = nevent->part(); + MusECore::Event event = nevent->event(); unsigned tick = event.tick() + part->tick(); - if (tick < song->lpos() || tick >= song->rpos()) + if (tick < MusEGlobal::song->lpos() || tick >= MusEGlobal::song->rpos()) selectItem(k->second, false); else selectItem(k->second, true); } break; case CMD_SELECT_OLOOP: // select outside loop - for (MusEWidget::iCItem k = items.begin(); k != items.end(); ++k) { + for (MusEGui::iCItem k = items.begin(); k != items.end(); ++k) { NEvent* nevent = (NEvent*)(k->second); - Part* part = nevent->part(); - Event event = nevent->event(); + MusECore::Part* part = nevent->part(); + MusECore::Event event = nevent->event(); unsigned tick = event.tick() + part->tick(); - if (tick < song->lpos() || tick >= song->rpos()) + if (tick < MusEGlobal::song->lpos() || tick >= MusEGlobal::song->rpos()) selectItem(k->second, true); else selectItem(k->second, false); @@ -869,10 +871,10 @@ void PianoCanvas::cmd(int cmd) break; case CMD_SELECT_PREV_PART: // select previous part { - Part* pt = editor->curCanvasPart(); - Part* newpt = pt; - PartList* pl = editor->parts(); - for(iPart ip = pl->begin(); ip != pl->end(); ++ip) + MusECore::Part* pt = editor->curCanvasPart(); + MusECore::Part* newpt = pt; + MusECore::PartList* pl = editor->parts(); + for(MusECore::iPart ip = pl->begin(); ip != pl->end(); ++ip) if(ip->second == pt) { if(ip == pl->begin()) @@ -887,10 +889,10 @@ void PianoCanvas::cmd(int cmd) break; case CMD_SELECT_NEXT_PART: // select next part { - Part* pt = editor->curCanvasPart(); - Part* newpt = pt; - PartList* pl = editor->parts(); - for(iPart ip = pl->begin(); ip != pl->end(); ++ip) + MusECore::Part* pt = editor->curCanvasPart(); + MusECore::Part* newpt = pt; + MusECore::PartList* pl = editor->parts(); + for(MusECore::iPart ip = pl->begin(); ip != pl->end(); ++ip) if(ip->second == pt) { ++ip; @@ -946,7 +948,7 @@ void PianoCanvas::midiNote(int pitch, int velo) } if (_midiin && _steprec && curPart - && !audio->isPlaying() && velo && pos[0] >= start_tick + && !MusEGlobal::audio->isPlaying() && velo && pos[0] >= start_tick /* && pos[0] < end_tick [removed by flo93: this is handled in steprec->record] */ && !(MusEGlobal::globalKeyState & Qt::AltModifier)) { steprec->record(curPart,pitch,editor->raster(),editor->raster(),velo,MusEGlobal::globalKeyState&Qt::ControlModifier,MusEGlobal::globalKeyState&Qt::ShiftModifier); @@ -958,7 +960,7 @@ void PianoCanvas::midiNote(int pitch, int velo) // startDrag //--------------------------------------------------------- -void PianoCanvas::startDrag(MusEWidget::CItem* /* item*/, bool copymode) +void PianoCanvas::startDrag(MusEGui::CItem* /* item*/, bool copymode) { QMimeData* md = selected_events_to_mime(partlist_to_set(editor->parts()), 1); @@ -1010,7 +1012,7 @@ void PianoCanvas::dragLeaveEvent(QDragLeaveEvent*) // itemPressed //--------------------------------------------------------- -void PianoCanvas::itemPressed(const MusEWidget::CItem* item) +void PianoCanvas::itemPressed(const MusEGui::CItem* item) { if (!_playEvents) return; @@ -1018,20 +1020,20 @@ void PianoCanvas::itemPressed(const MusEWidget::CItem* item) int port = track()->outPort(); int channel = track()->outChannel(); NEvent* nevent = (NEvent*) item; - Event event = nevent->event(); + MusECore::Event event = nevent->event(); playedPitch = event.pitch() + track()->transposition; int velo = event.velo(); // play note: - MidiPlayEvent e(0, port, channel, 0x90, playedPitch, velo); - audio->msgPlayMidiEvent(&e); + MusECore::MidiPlayEvent e(0, port, channel, 0x90, playedPitch, velo); + MusEGlobal::audio->msgPlayMidiEvent(&e); } //--------------------------------------------------------- // itemReleased //--------------------------------------------------------- -void PianoCanvas::itemReleased(const MusEWidget::CItem*, const QPoint&) +void PianoCanvas::itemReleased(const MusEGui::CItem*, const QPoint&) { if (!_playEvents) return; @@ -1039,8 +1041,8 @@ void PianoCanvas::itemReleased(const MusEWidget::CItem*, const QPoint&) int channel = track()->outChannel(); // release note: - MidiPlayEvent ev(0, port, channel, 0x90, playedPitch, 0); - audio->msgPlayMidiEvent(&ev); + MusECore::MidiPlayEvent ev(0, port, channel, 0x90, playedPitch, 0); + MusEGlobal::audio->msgPlayMidiEvent(&ev); playedPitch = -1; } @@ -1048,21 +1050,21 @@ void PianoCanvas::itemReleased(const MusEWidget::CItem*, const QPoint&) // itemMoved //--------------------------------------------------------- -void PianoCanvas::itemMoved(const MusEWidget::CItem* item, const QPoint& pos) +void PianoCanvas::itemMoved(const MusEGui::CItem* item, const QPoint& pos) { int npitch = y2pitch(pos.y()); if ((playedPitch != -1) && (playedPitch != npitch)) { int port = track()->outPort(); int channel = track()->outChannel(); NEvent* nevent = (NEvent*) item; - Event event = nevent->event(); + MusECore::Event event = nevent->event(); // release note: - MidiPlayEvent ev1(0, port, channel, 0x90, playedPitch, 0); - audio->msgPlayMidiEvent(&ev1); + MusECore::MidiPlayEvent ev1(0, port, channel, 0x90, playedPitch, 0); + MusEGlobal::audio->msgPlayMidiEvent(&ev1); // play note: - MidiPlayEvent e2(0, port, channel, 0x90, npitch + track()->transposition, event.velo()); - audio->msgPlayMidiEvent(&e2); + MusECore::MidiPlayEvent e2(0, port, channel, 0x90, npitch + track()->transposition, event.velo()); + MusEGlobal::audio->msgPlayMidiEvent(&e2); playedPitch = npitch + track()->transposition; } } @@ -1080,23 +1082,23 @@ void PianoCanvas::curPartChanged() // modifySelected //--------------------------------------------------------- -void PianoCanvas::modifySelected(MusEWidget::NoteInfo::ValType type, int delta) +void PianoCanvas::modifySelected(MusEGui::NoteInfo::ValType type, int delta) { - audio->msgIdle(true); - song->startUndo(); - for (MusEWidget::iCItem i = items.begin(); i != items.end(); ++i) { + MusEGlobal::audio->msgIdle(true); + MusEGlobal::song->startUndo(); + for (MusEGui::iCItem i = items.begin(); i != items.end(); ++i) { if (!(i->second->isSelected())) continue; NEvent* e = (NEvent*)(i->second); - Event event = e->event(); - if (event.type() != Note) + MusECore::Event event = e->event(); + if (event.type() != MusECore::Note) continue; - MidiPart* part = (MidiPart*)(e->part()); - Event newEvent = event.clone(); + MusECore::MidiPart* part = (MusECore::MidiPart*)(e->part()); + MusECore::Event newEvent = event.clone(); switch (type) { - case MusEWidget::NoteInfo::VAL_TIME: + case MusEGui::NoteInfo::VAL_TIME: { int newTime = event.tick() + delta; if (newTime < 0) @@ -1104,7 +1106,7 @@ void PianoCanvas::modifySelected(MusEWidget::NoteInfo::ValType type, int delta) newEvent.setTick(newTime); } break; - case MusEWidget::NoteInfo::VAL_LEN: + case MusEGui::NoteInfo::VAL_LEN: { int len = event.lenTick() + delta; if (len < 1) @@ -1112,7 +1114,7 @@ void PianoCanvas::modifySelected(MusEWidget::NoteInfo::ValType type, int delta) newEvent.setLenTick(len); } break; - case MusEWidget::NoteInfo::VAL_VELON: + case MusEGui::NoteInfo::VAL_VELON: { int velo = event.velo() + delta; if (velo > 127) @@ -1122,7 +1124,7 @@ void PianoCanvas::modifySelected(MusEWidget::NoteInfo::ValType type, int delta) newEvent.setVelo(velo); } break; - case MusEWidget::NoteInfo::VAL_VELOFF: + case MusEGui::NoteInfo::VAL_VELOFF: { int velo = event.veloOff() + delta; if (velo > 127) @@ -1132,7 +1134,7 @@ void PianoCanvas::modifySelected(MusEWidget::NoteInfo::ValType type, int delta) newEvent.setVeloOff(velo); } break; - case MusEWidget::NoteInfo::VAL_PITCH: + case MusEGui::NoteInfo::VAL_PITCH: { int pitch = event.pitch() + delta; if (pitch > 127) @@ -1143,13 +1145,13 @@ void PianoCanvas::modifySelected(MusEWidget::NoteInfo::ValType type, int delta) } break; } - song->changeEvent(event, newEvent, part); + MusEGlobal::song->changeEvent(event, newEvent, part); // Indicate do not do port controller values and clone parts. - //song->addUndo(UndoOp(UndoOp::ModifyEvent, newEvent, event, part)); - song->addUndo(UndoOp(UndoOp::ModifyEvent, newEvent, event, part, false, false)); + //MusEGlobal::song->addUndo(MusECore::UndoOp(MusECore::UndoOp::ModifyEvent, newEvent, event, part)); + MusEGlobal::song->addUndo(MusECore::UndoOp(MusECore::UndoOp::ModifyEvent, newEvent, event, part, false, false)); } - song->endUndo(SC_EVENT_MODIFIED); - audio->msgIdle(false); + MusEGlobal::song->endUndo(SC_EVENT_MODIFIED); + MusEGlobal::audio->msgIdle(false); } //--------------------------------------------------------- @@ -1163,3 +1165,4 @@ void PianoCanvas::resizeEvent(QResizeEvent* ev) EventCanvas::resizeEvent(ev); } +} // namespace MusEGui diff --git a/muse2/muse/midiedit/prcanvas.h b/muse2/muse/midiedit/prcanvas.h index b3a8a288..18d4f130 100644 --- a/muse2/muse/midiedit/prcanvas.h +++ b/muse2/muse/midiedit/prcanvas.h @@ -36,19 +36,22 @@ #define KH 13 +class QRect; + +namespace MusEGui { + //--------------------------------------------------------- // NEvent // ''visual'' Note Event //--------------------------------------------------------- -class NEvent : public MusEWidget::CItem { +class NEvent : public CItem { public: - NEvent(Event& e, Part* p, int y); + NEvent(MusECore::Event& e, MusECore::Part* p, int y); }; class ScrollScale; class PianoRoll; -class QRect; //--------------------------------------------------------- // PianoCanvas @@ -62,31 +65,31 @@ class PianoCanvas : public EventCanvas { bool noteHeldDown[128]; - StepRec* steprec; + MusECore::StepRec* steprec; virtual void viewMouseDoubleClickEvent(QMouseEvent*); - virtual void drawItem(QPainter&, const MusEWidget::CItem*, const QRect&); + virtual void drawItem(QPainter&, const CItem*, const QRect&); void drawTopItem(QPainter &p, const QRect &rect); - virtual void drawMoving(QPainter&, const MusEWidget::CItem*, const QRect&); - virtual Undo moveCanvasItems(MusEWidget::CItemList&, int, int, DragType); - virtual UndoOp moveItem(MusEWidget::CItem*, const QPoint&, DragType); - virtual MusEWidget::CItem* newItem(const QPoint&, int); - virtual void resizeItem(MusEWidget::CItem*, bool noSnap, bool); - virtual void newItem(MusEWidget::CItem*, bool noSnap); - virtual bool deleteItem(MusEWidget::CItem*); - virtual void startDrag(MusEWidget::CItem* item, bool copymode); + virtual void drawMoving(QPainter&, const CItem*, const QRect&); + virtual MusECore::Undo moveCanvasItems(CItemList&, int, int, DragType); + virtual MusECore::UndoOp moveItem(CItem*, const QPoint&, DragType); + virtual CItem* newItem(const QPoint&, int); + virtual void resizeItem(CItem*, bool noSnap, bool); + virtual void newItem(CItem*, bool noSnap); + virtual bool deleteItem(CItem*); + virtual void startDrag(CItem* item, bool copymode); virtual void dragEnterEvent(QDragEnterEvent* event); virtual void dragMoveEvent(QDragMoveEvent*); virtual void dragLeaveEvent(QDragLeaveEvent*); - virtual void addItem(Part*, Event&); + virtual void addItem(MusECore::Part*, MusECore::Event&); int y2pitch(int) const; int pitch2y(int) const; virtual void drawCanvas(QPainter&, const QRect&); - virtual void itemPressed(const MusEWidget::CItem*); - virtual void itemReleased(const MusEWidget::CItem*, const QPoint&); - virtual void itemMoved(const MusEWidget::CItem*, const QPoint&); + virtual void itemPressed(const CItem*); + virtual void itemReleased(const CItem*, const QPoint&); + virtual void itemMoved(const CItem*, const QPoint&); virtual void curPartChanged(); virtual void resizeEvent(QResizeEvent*); @@ -123,7 +126,10 @@ class PianoCanvas : public EventCanvas { colorMode = mode; redraw(); } - virtual void modifySelected(MusEWidget::NoteInfo::ValType type, int delta); + virtual void modifySelected(NoteInfo::ValType type, int delta); }; + +} // namespace MusEGui + #endif diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index a06d2a8c..d09ebc34 100644 --- a/muse2/muse/midiedit/scoreedit.cpp +++ b/muse2/muse/midiedit/scoreedit.cpp @@ -78,6 +78,7 @@ using namespace std; using MusEGlobal::debugMsg; using MusEGlobal::heavyDebugMsg; +namespace MusEGui { string IntToStr(int i); QString IntToQStr(int i); @@ -196,7 +197,7 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos) score_canvas=new ScoreCanvas(this, mainw); xscroll = new QScrollBar(Qt::Horizontal, mainw); yscroll = new QScrollBar(Qt::Vertical, mainw); - time_bar = new MusEWidget::MTScaleFlo(score_canvas, mainw); + time_bar = new MusEGui::MTScaleFlo(score_canvas, mainw); connect(xscroll, SIGNAL(valueChanged(int)), score_canvas, SLOT(x_scroll_event(int))); connect(score_canvas, SIGNAL(xscroll_changed(int)), xscroll, SLOT(setValue(int))); @@ -209,7 +210,7 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos) connect(score_canvas, SIGNAL(canvas_height_changed(int)), SLOT(canvas_height_changed(int))); connect(score_canvas, SIGNAL(viewport_height_changed(int)), SLOT(viewport_height_changed(int))); - connect(song, SIGNAL(songChanged(int)), score_canvas, SLOT(song_changed(int))); + connect(MusEGlobal::song, SIGNAL(songChanged(int)), score_canvas, SLOT(song_changed(int))); connect(xscroll, SIGNAL(valueChanged(int)), time_bar, SLOT(set_xpos(int))); connect(score_canvas, SIGNAL(pos_add_changed()), time_bar, SLOT(pos_add_changed())); @@ -244,10 +245,10 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos) connect(srec, SIGNAL(toggled(bool)), score_canvas, SLOT(set_steprec(bool))); - edit_tools = new MusEWidget::EditToolBar(this, MusEWidget::PointerTool | MusEWidget::PencilTool | MusEWidget::RubberTool); + edit_tools = new MusEGui::EditToolBar(this, MusEGui::PointerTool | MusEGui::PencilTool | MusEGui::RubberTool); addToolBar(edit_tools); - edit_tools->set(MusEWidget::PointerTool); - score_canvas->set_tool(MusEWidget::PointerTool); + edit_tools->set(MusEGui::PointerTool); + score_canvas->set_tool(MusEGui::PointerTool); connect(edit_tools, SIGNAL(toolChanged(int)), score_canvas, SLOT(set_tool(int))); QToolBar* panic_toolbar = addToolBar(tr("panic")); @@ -489,8 +490,8 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos) clipboard_changed(); selection_changed(); - connect(song, SIGNAL(songChanged(int)), SLOT(song_changed(int))); - connect(song, SIGNAL(newPartsCreated(const std::map< Part*, std::set<Part*> >&)), score_canvas, SLOT(add_new_parts(const std::map< Part*, std::set<Part*> >&))); + connect(MusEGlobal::song, SIGNAL(songChanged(int)), SLOT(song_changed(int))); + connect(MusEGlobal::song, SIGNAL(newPartsCreated(const std::map< MusECore::Part*, std::set<MusECore::Part*> >&)), score_canvas, SLOT(add_new_parts(const std::map< MusECore::Part*, std::set<MusECore::Part*> >&))); score_canvas->fully_recalculate(); score_canvas->goto_tick(initPos,true); @@ -534,7 +535,7 @@ void ScoreEdit::init_shortcuts() } -void ScoreEdit::add_parts(PartList* pl, bool all_in_one) +void ScoreEdit::add_parts(MusECore::PartList* pl, bool all_in_one) { score_canvas->add_staves(pl, all_in_one); } @@ -605,7 +606,7 @@ void ScoreEdit::song_changed(int flags) { if (flags & (SC_SELECTION | SC_EVENT_MODIFIED | SC_EVENT_REMOVED)) { - map<Event*, Part*> selection=get_events(score_canvas->get_all_parts(),1); + map<MusECore::Event*, MusECore::Part*> selection=get_events(score_canvas->get_all_parts(),1); if (selection.empty()) { apply_velo_to_label->setText(APPLY_TO_NEW_STRING); @@ -616,8 +617,8 @@ void ScoreEdit::song_changed(int flags) int velo=-1; int velo_off=-1; - for (map<Event*, Part*>::iterator it=selection.begin(); it!=selection.end(); it++) - if (it->first->type()==Note) + for (map<MusECore::Event*, MusECore::Part*>::iterator it=selection.begin(); it!=selection.end(); it++) + if (it->first->type()==MusECore::Note) { if (velo==-1) velo=it->first->velo(); else if ((velo>=0) && (velo!=it->first->velo())) velo=-2; @@ -708,14 +709,14 @@ void ScoreEdit::menu_command(int cmd) erase_notes(score_canvas->get_all_parts(), 1); break; case CMD_COPY: copy_notes(score_canvas->get_all_parts(), 1); break; - case CMD_COPY_RANGE: copy_notes(score_canvas->get_all_parts(), MusEUtil::any_event_selected(score_canvas->get_all_parts()) ? 3 : 2); break; + case CMD_COPY_RANGE: copy_notes(score_canvas->get_all_parts(), MusECore::any_event_selected(score_canvas->get_all_parts()) ? 3 : 2); break; case CMD_PASTE: menu_command(CMD_SELECT_NONE); - paste_notes(3072); + MusECore::paste_notes(3072); break; case CMD_PASTE_DIALOG: menu_command(CMD_SELECT_NONE); - paste_notes(score_canvas->get_selected_part()); + MusECore::paste_notes(score_canvas->get_selected_part()); break; case CMD_QUANTIZE: quantize_notes(score_canvas->get_all_parts()); break; case CMD_VELOCITY: modify_velocity(score_canvas->get_all_parts()); break; @@ -751,22 +752,22 @@ void ScoreEdit::selection_changed() //duplicated from songfile.cpp's MusE::readPart(); the only differences: //"none" is supported and tag_name is settable -Part* read_part(Xml& xml, QString tag_name="part") +MusECore::Part* read_part(MusECore::Xml& xml, QString tag_name="part") { - Part* part = 0; + MusECore::Part* part = 0; for (;;) { - Xml::Token token = xml.parse(); + MusECore::Xml::Token token = xml.parse(); const QString& tag = xml.s1(); switch (token) { - case Xml::Error: - case Xml::End: + case MusECore::Xml::Error: + case MusECore::Xml::End: return part; - case Xml::Text: + case MusECore::Xml::Text: { int trackIdx, partIdx; if (tag=="none") @@ -775,7 +776,7 @@ Part* read_part(Xml& xml, QString tag_name="part") { sscanf(tag.toLatin1().constData(), "%d:%d", &trackIdx, &partIdx); if (debugMsg) cout << "read_part: trackIdx="<<trackIdx<<", partIdx="<<partIdx; - Track* track = song->tracks()->index(trackIdx); + MusECore::Track* track = MusEGlobal::song->tracks()->index(trackIdx); if (track) part = track->parts()->find(partIdx); if (debugMsg) cout << ", track="<<track<<", part="<<part<<endl; @@ -783,11 +784,11 @@ Part* read_part(Xml& xml, QString tag_name="part") } break; - case Xml::TagStart: + case MusECore::Xml::TagStart: xml.unknown("read_part"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == tag_name) return part; @@ -799,24 +800,24 @@ Part* read_part(Xml& xml, QString tag_name="part") -void staff_t::read_status(Xml& xml) +void staff_t::read_status(MusECore::Xml& xml) { for (;;) { - Xml::Token token = xml.parse(); - if (token == Xml::Error || token == Xml::End) + MusECore::Xml::Token token = xml.parse(); + if (token == MusECore::Xml::Error || token == MusECore::Xml::End) break; const QString& tag = xml.s1(); switch (token) { - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "type") type = staff_type_t(xml.parseInt()); else if (tag == "clef") clef = clef_t(xml.parseInt()); else if (tag == "part") { - Part* part=read_part(xml); + MusECore::Part* part=read_part(xml); if (part) parts.insert(part); else @@ -826,7 +827,7 @@ void staff_t::read_status(Xml& xml) xml.unknown("staff"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "staff") goto staff_readstatus_end; @@ -840,15 +841,15 @@ void staff_t::read_status(Xml& xml) } -void staff_t::write_status(int level, Xml& xml) const +void staff_t::write_status(int level, MusECore::Xml& xml) const { xml.tag(level++, "staff"); xml.intTag(level, "type", type); xml.intTag(level, "clef", clef); - for (set<Part*>::iterator part=parts.begin(); part!=parts.end(); part++) + for (set<MusECore::Part*>::iterator part=parts.begin(); part!=parts.end(); part++) { - Track* track = (*part)->track(); - int trkIdx = song->tracks()->index(track); + MusECore::Track* track = (*part)->track(); + int trkIdx = MusEGlobal::song->tracks()->index(track); int partIdx = track->parts()->index(*part); if((trkIdx == -1) || (partIdx == -1)) @@ -863,7 +864,7 @@ void staff_t::write_status(int level, Xml& xml) const // writeStatus //--------------------------------------------------------- -void ScoreEdit::writeStatus(int level, Xml& xml) const +void ScoreEdit::writeStatus(int level, MusECore::Xml& xml) const { xml.tag(level++, "scoreedit"); TopWin::writeStatus(level, xml); @@ -910,15 +911,15 @@ void ScoreEdit::writeStatus(int level, Xml& xml) const xml.intTag(level, "preambleContainsKeysig", preamble_keysig_action->isChecked()); xml.intTag(level, "preambleContainsTimesig", preamble_timesig_action->isChecked()); - Part* selected_part=score_canvas->get_selected_part(); + MusECore::Part* selected_part=score_canvas->get_selected_part(); if (selected_part==NULL) { xml.put(level, "<selectedPart>none</selectedPart>"); } else { - Track* track = selected_part->track(); - int trkIdx = song->tracks()->index(track); + MusECore::Track* track = selected_part->track(); + int trkIdx = MusEGlobal::song->tracks()->index(track); int partIdx = track->parts()->index(selected_part); if((trkIdx == -1) || (partIdx == -1)) @@ -933,7 +934,7 @@ void ScoreEdit::writeStatus(int level, Xml& xml) const xml.tag(level, "/scoreedit"); } -void ScoreCanvas::write_staves(int level, Xml& xml) const +void ScoreCanvas::write_staves(int level, MusECore::Xml& xml) const { for (list<staff_t>::const_iterator staff=staves.begin(); staff!=staves.end(); staff++) staff->write_status(level, xml); @@ -944,21 +945,21 @@ void ScoreCanvas::write_staves(int level, Xml& xml) const // readStatus //--------------------------------------------------------- -void ScoreEdit::readStatus(Xml& xml) +void ScoreEdit::readStatus(MusECore::Xml& xml) { bool apply_velo_temp=apply_velo; apply_velo=false; for (;;) { - Xml::Token token = xml.parse(); - if (token == Xml::Error || token == Xml::End) + MusECore::Xml::Token token = xml.parse(); + if (token == MusECore::Xml::Error || token == MusECore::Xml::End) break; const QString& tag = xml.s1(); switch (token) { - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "name") set_name(xml.parse1()); else if (tag == "tool") @@ -1031,7 +1032,7 @@ void ScoreEdit::readStatus(Xml& xml) xml.unknown("ScoreEdit"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "scoreedit") return; @@ -1042,25 +1043,25 @@ void ScoreEdit::readStatus(Xml& xml) apply_velo=apply_velo_temp; } -void ScoreEdit::read_configuration(Xml& xml) +void ScoreEdit::read_configuration(MusECore::Xml& xml) { for (;;) { - Xml::Token token = xml.parse(); - if (token == Xml::Error || token == Xml::End) + MusECore::Xml::Token token = xml.parse(); + if (token == MusECore::Xml::Error || token == MusECore::Xml::End) break; const QString& tag = xml.s1(); switch (token) { - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "topwin") TopWin::readConfiguration(SCORE, xml); else xml.unknown("ScoreEdit"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "scoreedit") return; @@ -1071,7 +1072,7 @@ void ScoreEdit::read_configuration(Xml& xml) } -void ScoreEdit::write_configuration(int level, Xml& xml) +void ScoreEdit::write_configuration(int level, MusECore::Xml& xml) { xml.tag(level++, "scoreedit"); TopWin::writeConfiguration(SCORE, level, xml); @@ -1081,7 +1082,7 @@ void ScoreEdit::write_configuration(int level, Xml& xml) -void ScoreCanvas::add_staves(PartList* pl, bool all_in_one) +void ScoreCanvas::add_staves(MusECore::PartList* pl, bool all_in_one) { if (!pl->empty()) { @@ -1089,12 +1090,12 @@ void ScoreCanvas::add_staves(PartList* pl, bool all_in_one) if (all_in_one) { - clefTypes clef=((MidiTrack*)pl->begin()->second->track())->getClef(); + clefTypes clef=((MusECore::MidiTrack*)pl->begin()->second->track())->getClef(); staff.parts.clear(); - for (ciPart part_it=pl->begin(); part_it!=pl->end(); part_it++) + for (MusECore::ciPart part_it=pl->begin(); part_it!=pl->end(); part_it++) { - if (((MidiTrack*)part_it->second->track())->getClef() != clef) + if (((MusECore::MidiTrack*)part_it->second->track())->getClef() != clef) clef=grandStaff; staff.parts.insert(part_it->second); @@ -1129,25 +1130,25 @@ void ScoreCanvas::add_staves(PartList* pl, bool all_in_one) } else { - set<Track*> tracks; - for (ciPart it=pl->begin(); it!=pl->end(); it++) + set<MusECore::Track*> tracks; + for (MusECore::ciPart it=pl->begin(); it!=pl->end(); it++) tracks.insert(it->second->track()); - TrackList* tracklist = song->tracks(); + MusECore::TrackList* tracklist = MusEGlobal::song->tracks(); // this loop is used for inserting track-staves in the // correct order. simply iterating through tracks's contents // would sort after the pointer values, i.e. randomly - for (ciTrack track_it=tracklist->begin(); track_it!=tracklist->end(); track_it++) + for (MusECore::ciTrack track_it=tracklist->begin(); track_it!=tracklist->end(); track_it++) if (tracks.find(*track_it)!=tracks.end()) { staff.parts.clear(); - for (ciPart part_it=pl->begin(); part_it!=pl->end(); part_it++) + for (MusECore::ciPart part_it=pl->begin(); part_it!=pl->end(); part_it++) if (part_it->second->track() == *track_it) staff.parts.insert(part_it->second); staff.cleanup_parts(); staff.update_part_indices(); - switch (((MidiTrack*)(*track_it))->getClef()) + switch (((MusECore::MidiTrack*)(*track_it))->getClef()) { case trebleClef: staff.type=NORMAL; @@ -1193,8 +1194,8 @@ ScoreCanvas::ScoreCanvas(ScoreEdit* pr, QWidget* parent_widget) : View(parent_wi srec=false; for (int i=0;i<128;i++) held_notes[i]=false; - steprec=new StepRec(held_notes); - connect(song, SIGNAL(midiNote(int, int)), SLOT(midi_note(int,int))); + steprec=new MusECore::StepRec(held_notes); + connect(MusEGlobal::song, SIGNAL(midiNote(int, int)), SLOT(midi_note(int,int))); x_pos=0; x_left=0; @@ -1235,8 +1236,8 @@ ScoreCanvas::ScoreCanvas(ScoreEdit* pr, QWidget* parent_widget) : View(parent_wi y_scroll_pos=0; connect (MusEGlobal::heartBeatTimer, SIGNAL(timeout()), SLOT(heartbeat_timer_event())); - connect(song, SIGNAL(posChanged(int, unsigned, bool)), SLOT(pos_changed(int,unsigned,bool))); - connect(song, SIGNAL(playChanged(bool)), SLOT(play_changed(bool))); + connect(MusEGlobal::song, SIGNAL(posChanged(int, unsigned, bool)), SLOT(pos_changed(int,unsigned,bool))); + connect(MusEGlobal::song, SIGNAL(playChanged(bool)), SLOT(play_changed(bool))); connect(MusEGlobal::muse, SIGNAL(configChanged()), SLOT(config_changed())); @@ -1436,9 +1437,9 @@ void ScoreCanvas::move_staff_below(list<staff_t>::iterator dest, list<staff_t>:: move_staff_above(dest, src); } -set<Part*> ScoreCanvas::get_all_parts() +set<MusECore::Part*> ScoreCanvas::get_all_parts() { - set<Part*> result; + set<MusECore::Part*> result; for (list<staff_t>::iterator it=staves.begin(); it!=staves.end(); it++) result.insert(it->parts.begin(), it->parts.end()); @@ -1567,7 +1568,7 @@ void ScoreCanvas::init_pixmaps() mycolors[0]=Qt::black; for (int i=1;i<NUM_PARTCOLORS;i++) - mycolors[i]=MusEConfig::config.partColors[i]; + mycolors[i]=MusEGlobal::config.partColors[i]; mycolors[BLACK_PIXMAP]=Qt::black; mycolors[HIGHLIGHTED_PIXMAP]=Qt::red; mycolors[SELECTED_PIXMAP]=QColor(255,160,0); @@ -1697,14 +1698,14 @@ void staff_t::create_appropriate_eventlist() // phase one: fill the list ----------------------------------------- //insert note on events - for (set<Part*>::const_iterator part_it=parts.begin(); part_it!=parts.end(); part_it++) + for (set<MusECore::Part*>::const_iterator part_it=parts.begin(); part_it!=parts.end(); part_it++) { - Part* part=*part_it; - EventList* el=part->events(); + MusECore::Part* part=*part_it; + MusECore::EventList* el=part->events(); - for (iEvent it=el->begin(); it!=el->end(); it++) + for (MusECore::iEvent it=el->begin(); it!=el->end(); it++) { - Event& event=it->second; + MusECore::Event& event=it->second; if ( ( event.isNote() && !event.isNoteOff() && // (event.endTick() <= part->lenTick()) ) && @@ -1746,7 +1747,7 @@ void staff_t::create_appropriate_eventlist() } //insert key changes - for (iKeyEvent it=keymap.begin(); it!=keymap.end(); it++) + for (MusECore::iKeyEvent it=MusEGlobal::keymap.begin(); it!=MusEGlobal::keymap.end(); it++) eventlist.insert(pair<unsigned, FloEvent>(it->second.tick, FloEvent(it->second.tick,FloEvent::KEY_CHANGE, it->second.key ) ) ); @@ -1776,28 +1777,28 @@ void staff_t::create_appropriate_eventlist() } -bool is_sharp_key(key_enum t) +bool is_sharp_key(MusECore::key_enum t) { - return ((t>=KEY_SHARP_BEGIN) && (t<=KEY_SHARP_END)); + return ((t>=MusECore::KEY_SHARP_BEGIN) && (t<=MusECore::KEY_SHARP_END)); } -bool is_b_key(key_enum t) +bool is_b_key(MusECore::key_enum t) { - return ((t>=KEY_B_BEGIN) && (t<=KEY_B_END)); + return ((t>=MusECore::KEY_B_BEGIN) && (t<=MusECore::KEY_B_END)); } -int n_accidentials(key_enum t) +int n_accidentials(MusECore::key_enum t) { if (is_sharp_key(t)) - return t-KEY_SHARP_BEGIN-1; + return t-MusECore::KEY_SHARP_BEGIN-1; else - return t-KEY_B_BEGIN-1; + return t-MusECore::KEY_B_BEGIN-1; } //note needs to be 0..11 //always assumes violin clef //only for internal use -note_pos_t note_pos_(int note, key_enum key) +note_pos_t note_pos_(int note, MusECore::key_enum key) { note_pos_t result; //C CIS D DIS E F FIS G GIS A AIS H @@ -1826,7 +1827,7 @@ note_pos_t note_pos_(int note, key_enum key) } // Special cases for GES / FIS keys - if (key==KEY_GES) + if (key==MusECore::KEY_GES) { // convert a H to a Ces if (note==11) @@ -1835,7 +1836,7 @@ note_pos_t note_pos_(int note, key_enum key) result.vorzeichen=B; } } - else if (key==KEY_FIS) + else if (key==MusECore::KEY_FIS) { // convert a F to an Eis if (note==5) @@ -1864,7 +1865,7 @@ note_pos_t note_pos_(int note, key_enum key) // in violin clef, line 2 is E4 // in bass clef, line 2 is G2 -note_pos_t note_pos (unsigned note, key_enum key, clef_t clef) +note_pos_t note_pos (unsigned note, MusECore::key_enum key, clef_t clef) { int octave=(note/12)-1; //integer division. note is unsigned note=note%12; @@ -2170,7 +2171,7 @@ void ScoreCanvas::draw_accidentials(QPainter& p, int x, int y_offset, const list void staff_t::create_itemlist() { - key_enum tmp_key=KEY_C; + MusECore::key_enum tmp_key=MusECore::KEY_C; int lastevent=0; int next_measure=-1; int last_measure=-1; @@ -2802,7 +2803,7 @@ void ScoreCanvas::draw_note_lines(QPainter& p, int y, bool reserve_akkolade_spac void staff_t::calc_item_pos() { - key_enum curr_key=KEY_C; //this has to be KEY_C or KEY_C_B and nothing else, + MusECore::key_enum curr_key=MusECore::KEY_C; //this has to be KEY_C or KEY_C_B and nothing else, //because only with these two keys the next (initial) //key signature is properly drawn. int pos_add=0; @@ -2884,7 +2885,7 @@ void staff_t::calc_item_pos() } else if (it->type==FloItem::KEY_CHANGE) { - key_enum new_key=it->key; + MusECore::key_enum new_key=it->key; list<int> aufloes_list=calc_accidentials(curr_key, clef, new_key); list<int> new_acc_list=calc_accidentials(new_key, clef); @@ -2915,12 +2916,12 @@ void ScoreCanvas::calc_pos_add_list() //process key changes - key_enum curr_key=KEY_C; //this has to be KEY_C or KEY_C_B and nothing else, + MusECore::key_enum curr_key=MusECore::KEY_C; //this has to be KEY_C or KEY_C_B and nothing else, //because only with these two keys the next (initial) //key signature is properly calculated. - for (iKeyEvent it=keymap.begin(); it!=keymap.end(); it++) + for (MusECore::iKeyEvent it=MusEGlobal::keymap.begin(); it!=MusEGlobal::keymap.end(); it++) { - key_enum new_key=it->second.key; + MusECore::key_enum new_key=it->second.key; list<int> aufloes_list=calc_accidentials(curr_key, VIOLIN, new_key); //clef argument is unneccessary list<int> new_acc_list=calc_accidentials(new_key, VIOLIN); //in this case int n_acc_drawn=aufloes_list.size() + new_acc_list.size(); @@ -2974,7 +2975,7 @@ void ScoreCanvas::draw_items(QPainter& p, int y_offset, staff_t& staff, ScoreIte // init accidentials properly vorzeichen_t curr_accidential[7]; vorzeichen_t default_accidential[7]; - key_enum curr_key; + MusECore::key_enum curr_key; curr_key=key_at_tick(from_it->first); list<int> new_acc_list=calc_accidentials(curr_key, staff.clef); @@ -3064,8 +3065,8 @@ void ScoreCanvas::draw_items(QPainter& p, int y_offset, staff_t& staff, ScoreIte p.drawLine(it->x-it->pix->width()*AUX_LINE_LEN/2 -x_pos+x_left,y_offset + 2*YLEN - (i-2)*YLEN/2,it->x+it->pix->width()*AUX_LINE_LEN/2-x_pos+x_left,y_offset + 2*YLEN - (i-2)*YLEN/2); } - it->is_active= ( (song->cpos() >= it->source_event->tick() + it->source_part->tick()) && - (song->cpos() < it->source_event->endTick() + it->source_part->tick()) ); + it->is_active= ( (MusEGlobal::song->cpos() >= it->source_event->tick() + it->source_part->tick()) && + (MusEGlobal::song->cpos() < it->source_event->endTick() + it->source_part->tick()) ); int color_index; @@ -3087,7 +3088,7 @@ void ScoreCanvas::draw_items(QPainter& p, int y_offset, staff_t& staff, ScoreIte if (it->source_event->selected()) color_index=SELECTED_PIXMAP; - if (audio->isPlaying() && it->is_active) + if (MusEGlobal::audio->isPlaying() && it->is_active) color_index=HIGHLIGHTED_PIXMAP; @@ -3187,7 +3188,7 @@ void ScoreCanvas::draw_items(QPainter& p, int y_offset, staff_t& staff, ScoreIte } else if (it->type==FloItem::KEY_CHANGE) { - key_enum new_key=it->key; + MusECore::key_enum new_key=it->key; if (heavyDebugMsg) cout << "\tKEY CHANGE: from "<<curr_key<<" to "<<new_key<<endl; list<int> aufloes_list=calc_accidentials(curr_key, staff.clef, new_key); @@ -3268,15 +3269,15 @@ bool ScoreCanvas::need_redraw_for_hilighting(ScoreItemList& itemlist, int x1, in bool ScoreCanvas::need_redraw_for_hilighting(ScoreItemList::iterator from_it, ScoreItemList::iterator to_it) { //if we aren't playing, there will never be a need for redrawing due to highlighting things - if (audio->isPlaying()==false) + if (MusEGlobal::audio->isPlaying()==false) return false; for (ScoreItemList::iterator it2=from_it; it2!=to_it; it2++) for (set<FloItem, floComp>::iterator it=it2->second.begin(); it!=it2->second.end();it++) if (it->type==FloItem::NOTE) { - bool is_active= ( (song->cpos() >= it->source_event->tick() + it->source_part->tick()) && - (song->cpos() < it->source_event->endTick() + it->source_part->tick()) ); + bool is_active= ( (MusEGlobal::song->cpos() >= it->source_event->tick() + it->source_part->tick()) && + (MusEGlobal::song->cpos() < it->source_event->endTick() + it->source_part->tick()) ); if (it->is_active != is_active) return true; } @@ -3335,7 +3336,7 @@ void ScoreCanvas::draw_preamble(QPainter& p, int y_offset, clef_t clef, bool res { x_left+=KEYCHANGE_ACC_LEFTDIST; - key_enum key=key_at_tick(tick); + MusECore::key_enum key=key_at_tick(tick); QPixmap* pix_acc=is_sharp_key(key) ? &pix_sharp[BLACK_PIXMAP] : &pix_b[BLACK_PIXMAP]; list<int> acclist=calc_accidentials(key,clef); @@ -3446,7 +3447,7 @@ void ScoreCanvas::draw(QPainter& p, const QRect&) } -list<int> calc_accidentials(key_enum key, clef_t clef, key_enum next_key) +list<int> calc_accidentials(MusECore::key_enum key, clef_t clef, MusECore::key_enum next_key) { list<int> result; @@ -3524,11 +3525,11 @@ int ScoreCanvas::x_to_tick(int x) return t > min_t ? t : min_t; } -key_enum ScoreCanvas::key_at_tick(int t_) +MusECore::key_enum ScoreCanvas::key_at_tick(int t_) { unsigned int t= (t_>=0) ? t_ : 0; - return keymap.keyAtTick(t); + return MusEGlobal::keymap.keyAtTick(t); } timesig_t ScoreCanvas::timesig_at_tick(int t_) @@ -3555,7 +3556,7 @@ int ScoreCanvas::height_to_pitch(int h, clef_t clef) } } -int ScoreCanvas::height_to_pitch(int h, clef_t clef, key_enum key) +int ScoreCanvas::height_to_pitch(int h, clef_t clef, MusECore::key_enum key) { int add=0; @@ -3697,7 +3698,7 @@ void ScoreCanvas::mousePressEvent (QMouseEvent* event) if ((mouse_erases_notes) || (event->button()==Qt::MidButton)) //erase? { - audio->msgDeleteEvent(dragged_event, dragged_event_part, true, false, false); + MusEGlobal::audio->msgDeleteEvent(dragged_event, dragged_event_part, true, false, false); } else if (event->button()==Qt::LeftButton) //edit? { @@ -3711,8 +3712,8 @@ void ScoreCanvas::mousePressEvent (QMouseEvent* event) { if (mouse_inserts_notes) { - Part* curr_part = NULL; - set<Part*> possible_dests=staff_it->parts_at_tick(tick); + MusECore::Part* curr_part = NULL; + set<MusECore::Part*> possible_dests=staff_it->parts_at_tick(tick); if (!possible_dests.empty()) { @@ -3738,7 +3739,7 @@ void ScoreCanvas::mousePressEvent (QMouseEvent* event) if (!ctrl) deselect_all(); - Event newevent(Note); + MusECore::Event newevent(MusECore::Note); newevent.setPitch(y_to_pitch(y,tick, staff_it->clef)); newevent.setVelo(note_velo); newevent.setVeloOff(note_velo_off); @@ -3759,7 +3760,7 @@ void ScoreCanvas::mousePressEvent (QMouseEvent* event) newevent.setLenTick(curr_part->lenTick() - newevent.tick()); } - audio->msgAddEvent(newevent, curr_part, true, false, false); + MusEGlobal::audio->msgAddEvent(newevent, curr_part, true, false, false); dragged_event_part=curr_part; dragged_event=newevent; @@ -3777,7 +3778,7 @@ void ScoreCanvas::mousePressEvent (QMouseEvent* event) drag_cursor_changed=true; setCursor(Qt::SizeAllCursor); - song->update(SC_SELECTION); + MusEGlobal::song->update(SC_SELECTION); } } else // !mouse_inserts_notes. open a lasso @@ -3805,8 +3806,8 @@ void ScoreCanvas::mouseReleaseEvent (QMouseEvent* event) if (flo_quantize(dragged_event.lenTick(), quant_ticks()) <= 0) { if (debugMsg) cout << "new length <= 0, erasing item" << endl; - if (undo_started) song->undo(); - audio->msgDeleteEvent(dragged_event, dragged_event_part, true, false, false); + if (undo_started) MusEGlobal::song->undo(); + MusEGlobal::audio->msgDeleteEvent(dragged_event, dragged_event_part, true, false, false); } else { @@ -3823,7 +3824,7 @@ void ScoreCanvas::mouseReleaseEvent (QMouseEvent* event) clicked_event_ptr->setSelected(!clicked_event_ptr->selected()); - song->update(SC_SELECTION); + MusEGlobal::song->update(SC_SELECTION); } setMouseTracking(false); @@ -3864,12 +3865,12 @@ void ScoreCanvas::mouseReleaseEvent (QMouseEvent* event) if (!ctrl) deselect_all(); - set<Event*> already_processed; + set<MusECore::Event*> already_processed; for (list<staff_t>::iterator it=staves.begin(); it!=staves.end(); it++) it->apply_lasso(lasso.translated(x_pos-x_left, y_pos - it->y_draw), already_processed); - song->update(SC_SELECTION); + MusEGlobal::song->update(SC_SELECTION); have_lasso=false; redraw(); @@ -3924,7 +3925,7 @@ void ScoreCanvas::mouseMoveEvent (QMouseEvent* event) clicked_event_ptr->setSelected(true); - song->update(SC_SELECTION); + MusEGlobal::song->update(SC_SELECTION); } old_pitch=-1; @@ -3950,7 +3951,7 @@ void ScoreCanvas::mouseMoveEvent (QMouseEvent* event) if (new_pitch != old_pitch) { if (debugMsg) cout << "changing pitch, delta="<<new_pitch-original_dragged_event.pitch()<<endl; - if (undo_started) song->undo(); + if (undo_started) MusEGlobal::song->undo(); undo_started=transpose_notes(part_to_set(dragged_event_part),1, new_pitch-original_dragged_event.pitch()); old_pitch=new_pitch; } @@ -3972,7 +3973,7 @@ void ScoreCanvas::mouseMoveEvent (QMouseEvent* event) if (dest_tick != old_dest_tick) { - if (undo_started) song->undo(); //FINDMICH EXTEND + if (undo_started) MusEGlobal::song->undo(); //FINDMICH EXTEND undo_started=move_notes(part_to_set(dragged_event_part),1, (signed)dest_tick-original_dragged_event.tick()); old_dest_tick=dest_tick; } @@ -3984,7 +3985,7 @@ void ScoreCanvas::mouseMoveEvent (QMouseEvent* event) tick+=quant_ticks(); if (dragged_event.tick()+old_len + dragged_event_part->tick() != unsigned(tick)) { - Event tmp=dragged_event.clone(); + MusECore::Event tmp=dragged_event.clone(); signed relative_tick=tick-signed(dragged_event_part->tick()); signed new_len=relative_tick-dragged_event.tick(); @@ -4011,12 +4012,12 @@ void ScoreCanvas::mouseMoveEvent (QMouseEvent* event) } } - if (undo_started) song->undo(); - Undo operations; - operations.push_back(UndoOp(UndoOp::ModifyEvent, tmp, dragged_event, dragged_event_part, false, false)); + if (undo_started) MusEGlobal::song->undo(); + MusECore::Undo operations; + operations.push_back(MusECore::UndoOp(MusECore::UndoOp::ModifyEvent, tmp, dragged_event, dragged_event_part, false, false)); if (newpartlen != dragged_event_part->lenTick()) schedule_resize_all_same_len_clone_parts(dragged_event_part, newpartlen, operations); - undo_started=song->applyOperationGroup(operations); + undo_started=MusEGlobal::song->applyOperationGroup(operations); old_len=new_len; } @@ -4180,11 +4181,11 @@ void ScoreCanvas::pos_changed(int index, unsigned tick, bool scroll) { if (scroll) //potential need to scroll? { - switch (song->follow()) + switch (MusEGlobal::song->follow()) { - case Song::NO: break; - case Song::JUMP: goto_tick(tick,false); break; - case Song::CONTINUOUS: goto_tick(tick,true); break; + case MusECore::Song::NO: break; + case MusECore::Song::JUMP: goto_tick(tick,false); break; + case MusECore::Song::CONTINUOUS: goto_tick(tick,true); break; } } @@ -4264,9 +4265,9 @@ void ScoreCanvas::set_tool(int tool) { switch (tool) { - case MusEWidget::PointerTool: mouse_erases_notes=false; mouse_inserts_notes=false; break; - case MusEWidget::RubberTool: mouse_erases_notes=true; mouse_inserts_notes=false; break; - case MusEWidget::PencilTool: mouse_erases_notes=false; mouse_inserts_notes=true; break; + case MusEGui::PointerTool: mouse_erases_notes=false; mouse_inserts_notes=false; break; + case MusEGui::RubberTool: mouse_erases_notes=true; mouse_inserts_notes=false; break; + case MusEGui::PencilTool: mouse_erases_notes=false; mouse_inserts_notes=true; break; default: cerr << "ERROR: THIS SHOULD NEVER HAPPEN: set_tool called with unknown tool ("<<tool<<")"<<endl; } @@ -4394,28 +4395,28 @@ void ScoreCanvas::set_velo_off(int velo) void ScoreCanvas::deselect_all() { - set<Part*> all_parts=get_all_parts(); + set<MusECore::Part*> all_parts=get_all_parts(); - for (set<Part*>::iterator part=all_parts.begin(); part!=all_parts.end(); part++) - for (iEvent event=(*part)->events()->begin(); event!=(*part)->events()->end(); event++) + for (set<MusECore::Part*>::iterator part=all_parts.begin(); part!=all_parts.end(); part++) + for (MusECore::iEvent event=(*part)->events()->begin(); event!=(*part)->events()->end(); event++) event->second.setSelected(false); - song->update(SC_SELECTION); + MusEGlobal::song->update(SC_SELECTION); } bool staff_t::cleanup_parts() { bool did_something=false; - for (set<Part*>::iterator it=parts.begin(); it!=parts.end();) + for (set<MusECore::Part*>::iterator it=parts.begin(); it!=parts.end();) { bool valid=false; - for (iTrack track=song->tracks()->begin(); track!=song->tracks()->end(); track++) - if ((*track)->type() == Track::MIDI) + for (MusECore::iTrack track=MusEGlobal::song->tracks()->begin(); track!=MusEGlobal::song->tracks()->end(); track++) + if ((*track)->type() == MusECore::Track::MIDI) { - PartList* pl=(*track)->parts(); - for (iPart part=pl->begin(); part!=pl->end(); part++) + MusECore::PartList* pl=(*track)->parts(); + for (MusECore::iPart part=pl->begin(); part!=pl->end(); part++) if (*it == part->second) { valid=true; @@ -4438,18 +4439,18 @@ bool staff_t::cleanup_parts() return did_something; } -set<Part*> staff_t::parts_at_tick(unsigned tick) +set<MusECore::Part*> staff_t::parts_at_tick(unsigned tick) { - set<Part*> result; + set<MusECore::Part*> result; - for (set<Part*>::iterator it=parts.begin(); it!=parts.end(); it++) + for (set<MusECore::Part*>::iterator it=parts.begin(); it!=parts.end(); it++) if ((tick >= (*it)->tick()) && (tick<=(*it)->endTick())) result.insert(*it); return result; } -void staff_t::apply_lasso(QRect rect, set<Event*>& already_processed) +void staff_t::apply_lasso(QRect rect, set<MusECore::Event*>& already_processed) { for (ScoreItemList::iterator it=itemlist.begin(); it!=itemlist.end(); it++) for (set<FloItem>::iterator it2=it->second.begin(); it2!=it->second.end(); it2++) @@ -4476,7 +4477,7 @@ void ScoreCanvas::midi_note(int pitch, int velo) else held_notes[pitch]=false; - if ( srec && selected_part && !audio->isPlaying() && velo ) + if ( srec && selected_part && !MusEGlobal::audio->isPlaying() && velo ) steprec->record(selected_part,pitch,quant_ticks(),quant_ticks(),velo,MusEGlobal::globalKeyState&Qt::ControlModifier,MusEGlobal::globalKeyState&Qt::ShiftModifier); } @@ -4485,10 +4486,10 @@ void ScoreCanvas::midi_note(int pitch, int velo) void ScoreCanvas::update_parts() { if (selected_part!=NULL) //if it's null, let it be null - selected_part=MusEUtil::partFromSerialNumber(selected_part_index); + selected_part=MusECore::partFromSerialNumber(selected_part_index); if (dragged_event_part!=NULL) //same thing here - dragged_event_part=MusEUtil::partFromSerialNumber(dragged_event_part_index); + dragged_event_part=MusECore::partFromSerialNumber(dragged_event_part_index); for (list<staff_t>::iterator it=staves.begin(); it!=staves.end(); it++) it->update_parts(); @@ -4499,14 +4500,14 @@ void staff_t::update_parts() parts.clear(); for (set<int>::iterator it=part_indices.begin(); it!=part_indices.end(); it++) - parts.insert(MusEUtil::partFromSerialNumber(*it)); + parts.insert(MusECore::partFromSerialNumber(*it)); } void staff_t::update_part_indices() { part_indices.clear(); - for (set<Part*>::iterator it=parts.begin(); it!=parts.end(); it++) + for (set<MusECore::Part*>::iterator it=parts.begin(); it!=parts.end(); it++) part_indices.insert((*it)->sn()); } @@ -4522,17 +4523,17 @@ void ScoreEdit::keyPressEvent(QKeyEvent* event) } else if (key == shortcuts[SHRT_TOOL_POINTER].key) { - edit_tools->set(MusEWidget::PointerTool); + edit_tools->set(MusEGui::PointerTool); return; } else if (key == shortcuts[SHRT_TOOL_PENCIL].key) { - edit_tools->set(MusEWidget::PencilTool); + edit_tools->set(MusEGui::PencilTool); return; } else if (key == shortcuts[SHRT_TOOL_RUBBER].key) { - edit_tools->set(MusEWidget::RubberTool); + edit_tools->set(MusEGui::RubberTool); return; } else //Default: @@ -4543,11 +4544,11 @@ void ScoreEdit::keyPressEvent(QKeyEvent* event) } -void ScoreCanvas::add_new_parts(const std::map< Part*, std::set<Part*> >& param) +void ScoreCanvas::add_new_parts(const std::map< MusECore::Part*, std::set<MusECore::Part*> >& param) { for (list<staff_t>::iterator staff=staves.begin(); staff!=staves.end(); staff++) { - for (std::map< Part*, set<Part*> >::const_iterator it = param.begin(); it!=param.end(); it++) + for (std::map< MusECore::Part*, set<MusECore::Part*> >::const_iterator it = param.begin(); it!=param.end(); it++) if (staff->parts.find(it->first)!=staff->parts.end()) staff->parts.insert(it->second.begin(), it->second.end()); @@ -4559,6 +4560,8 @@ void ScoreCanvas::add_new_parts(const std::map< Part*, std::set<Part*> >& param) fully_recalculate(); } +} // namespace MusEGui + //the following assertions are made: // pix_quarter.width() == pix_half.width() diff --git a/muse2/muse/midiedit/scoreedit.h b/muse2/muse/midiedit/scoreedit.h index 8f21e76b..0d1432b8 100644 --- a/muse2/muse/midiedit/scoreedit.h +++ b/muse2/muse/midiedit/scoreedit.h @@ -67,8 +67,8 @@ using std::string; -#define TICKS_PER_WHOLE (MusEConfig::config.division*4) -#define SONG_LENGTH (song->len()) +#define TICKS_PER_WHOLE (MusEGlobal::config.division*4) +#define SONG_LENGTH (MusEGlobal::song->len()) @@ -84,11 +84,11 @@ enum {CMD_COLOR_BLACK, CMD_COLOR_VELO, CMD_COLOR_PART, CMD_SELECT_ILOOP, CMD_SELECT_OLOOP}; -class ScoreCanvas; -namespace MusEWidget { +namespace MusEGui { class EditToolBar; -} +class ScoreCanvas; + //--------------------------------------------------------- // ScoreEdit @@ -105,7 +105,7 @@ class ScoreEdit : public TopWin QGridLayout* mainGrid; QWidget* mainw; - MusEWidget::EditToolBar* edit_tools; + MusEGui::EditToolBar* edit_tools; QSpinBox* velo_spinbox; QSpinBox* velo_off_spinbox; @@ -160,7 +160,7 @@ class ScoreEdit : public TopWin QScrollBar* xscroll; QScrollBar* yscroll; ScoreCanvas* score_canvas; - MusEWidget::MTScaleFlo* time_bar; + MusEGui::MTScaleFlo* time_bar; QLabel* apply_velo_to_label; bool apply_velo; @@ -184,7 +184,7 @@ class ScoreEdit : public TopWin void clipboard_changed(); signals: - void deleted(TopWin*); + void deleted(MusEGui::TopWin*); void name_changed(); void velo_changed(int); void velo_off_changed(int); @@ -200,12 +200,12 @@ class ScoreEdit : public TopWin ScoreEdit(QWidget* parent = 0, const char* name = 0, unsigned initPos = MAXINT); ~ScoreEdit(); - void writeStatus(int level, Xml& xml) const; - void readStatus(Xml& xml); - static void read_configuration(Xml&); - static void write_configuration(int, Xml&); + void writeStatus(int level, MusECore::Xml& xml) const; + void readStatus(MusECore::Xml& xml); + static void read_configuration(MusECore::Xml&); + static void write_configuration(int, MusECore::Xml&); - void add_parts(PartList* pl, bool all_in_one=false); + void add_parts(MusECore::PartList* pl, bool all_in_one=false); QString get_name() { return name; } bool get_apply_velo() { return apply_velo; } }; @@ -253,8 +253,8 @@ class FloEvent enum typeEnum { NOTE_ON = 30, NOTE_OFF = 10, BAR = 20, KEY_CHANGE=23, TIME_SIG=26 }; //the order matters! typeEnum type; unsigned tick; - Part* source_part; - Event* source_event; + MusECore::Part* source_part; + MusECore::Event* source_event; int pitch; mutable int vel; @@ -263,10 +263,10 @@ class FloEvent int num; int denom; - key_enum key; + MusECore::key_enum key; - FloEvent(unsigned ti, int p,int v,int l,typeEnum t, Part* part=NULL, Event* event=NULL) + FloEvent(unsigned ti, int p,int v,int l,typeEnum t, MusECore::Part* part=NULL, MusECore::Event* event=NULL) { pitch=p; vel=v; @@ -285,7 +285,7 @@ class FloEvent source_event=NULL; source_part=NULL; } - FloEvent(unsigned ti, typeEnum t, key_enum k) + FloEvent(unsigned ti, typeEnum t, MusECore::key_enum k) { type=t; key=k; @@ -300,8 +300,8 @@ class FloItem enum typeEnum { NOTE=21, REST=22, NOTE_END=01, REST_END=02, BAR =10, KEY_CHANGE=13, TIME_SIG=16}; //the order matters! typeEnum type; unsigned begin_tick; - Event* source_event; - Part* source_part; + MusECore::Event* source_event; + MusECore::Part* source_part; note_pos_t pos; int len; @@ -312,7 +312,7 @@ class FloItem int num; int denom; - key_enum key; + MusECore::key_enum key; mutable stem_t stem; mutable int shift; @@ -331,7 +331,7 @@ class FloItem - FloItem(typeEnum t, note_pos_t p, int l=0,int d=0, bool ti=false, unsigned beg=0, Part* part=NULL, Event* event=NULL) + FloItem(typeEnum t, note_pos_t p, int l=0,int d=0, bool ti=false, unsigned beg=0, MusECore::Part* part=NULL, MusECore::Event* event=NULL) { pos=p; dots=d; @@ -357,7 +357,7 @@ class FloItem source_part=NULL; } - FloItem(typeEnum t, key_enum k) + FloItem(typeEnum t, MusECore::key_enum k) { type=t; key=k; @@ -533,7 +533,7 @@ enum staff_mode_t struct staff_t { - set<Part*> parts; + set<MusECore::Part*> parts; set<int> part_indices; ScoreEventList eventlist; ScoreItemList itemlist; @@ -555,7 +555,7 @@ struct staff_t void process_itemlist(); void calc_item_pos(); - void apply_lasso(QRect rect, set<Event*>& already_processed); + void apply_lasso(QRect rect, set<MusECore::Event*>& already_processed); void recalculate() { @@ -572,7 +572,7 @@ struct staff_t parent=parent_; } - staff_t (ScoreCanvas* parent_, staff_type_t type_, clef_t clef_, set<Part*> parts_) + staff_t (ScoreCanvas* parent_, staff_type_t type_, clef_t clef_, set<MusECore::Part*> parts_) { type=type_; clef=clef_; @@ -583,18 +583,18 @@ struct staff_t bool cleanup_parts(); - set<Part*> parts_at_tick(unsigned tick); + set<MusECore::Part*> parts_at_tick(unsigned tick); - void read_status(Xml& xml); - void write_status(int level, Xml& xml) const; + void read_status(MusECore::Xml& xml); + void write_status(int level, MusECore::Xml& xml) const; - void update_parts(); //re-populates the set<Part*> from the set<int> - void update_part_indices(); //re-populates the set<int> from the set<Part*> + void update_parts(); //re-populates the set<MusECore::Part*> from the set<int> + void update_part_indices(); //re-populates the set<int> from the set<MusECore::Part*> }; -list<int> calc_accidentials(key_enum key, clef_t clef, key_enum next_key=KEY_C); -note_pos_t note_pos_(int note, key_enum key); -note_pos_t note_pos (unsigned note, key_enum key, clef_t clef); +list<int> calc_accidentials(MusECore::key_enum key, clef_t clef, MusECore::key_enum next_key=MusECore::KEY_C); +note_pos_t note_pos_(int note, MusECore::key_enum key); +note_pos_t note_pos (unsigned note, MusECore::key_enum key, clef_t clef); int calc_len(int l, int d); list<note_len_t> parse_note_len(int len_ticks, int begin_tick, vector<int>& foo, bool allow_dots=true, bool allow_normal=true); @@ -606,7 +606,7 @@ int calc_timesig_width(int num, int denom); int calc_number_width(int n); -class ScoreCanvas : public MusEWidget::View +class ScoreCanvas : public MusEGui::View { Q_OBJECT private: @@ -625,7 +625,7 @@ class ScoreCanvas : public MusEWidget::View - static int height_to_pitch(int h, clef_t clef, key_enum key); + static int height_to_pitch(int h, clef_t clef, MusECore::key_enum key); static int height_to_pitch(int h, clef_t clef); static int y_to_height(int y); int y_to_pitch(int y, int t, clef_t clef); @@ -671,7 +671,7 @@ class ScoreCanvas : public MusEWidget::View list<staff_t> staves; - StepRec* steprec; + MusECore::StepRec* steprec; // the drawing area is split into a "preamble" containing clef, // key and time signature, and the "item's area" containing the @@ -693,7 +693,7 @@ class ScoreCanvas : public MusEWidget::View float y_scroll_speed; float y_scroll_pos; - Part* selected_part; + MusECore::Part* selected_part; int selected_part_index; int last_len; @@ -717,11 +717,11 @@ class ScoreCanvas : public MusEWidget::View bool inserting; bool dragging; bool drag_cursor_changed; - Part* dragged_event_part; + MusECore::Part* dragged_event_part; int dragged_event_part_index; - Event dragged_event; - Event original_dragged_event; - Event* clicked_event_ptr; + MusECore::Event dragged_event; + MusECore::Event original_dragged_event; + MusECore::Event* clicked_event_ptr; int old_pitch; unsigned old_dest_tick; @@ -765,7 +765,7 @@ class ScoreCanvas : public MusEWidget::View void deselect_all(); void midi_note(int pitch, int velo); - void add_new_parts(const std::map< Part*, std::set<Part*> >&); + void add_new_parts(const std::map< MusECore::Part*, std::set<MusECore::Part*> >&); public slots: void x_scroll_event(int); @@ -788,7 +788,7 @@ class ScoreCanvas : public MusEWidget::View void set_steprec(bool); - void update_parts(); //re-populates the set<Part*>s from the set<int>s + void update_parts(); //re-populates the set<MusECore::Part*>s from the set<int>s signals: void xscroll_changed(int); void yscroll_changed(int); @@ -813,7 +813,7 @@ class ScoreCanvas : public MusEWidget::View ScoreCanvas(ScoreEdit*, QWidget*); ~ScoreCanvas(); - void add_staves(PartList* pl, bool all_in_one); + void add_staves(MusECore::PartList* pl, bool all_in_one); void push_back_staff(staff_t& staff) { staves.push_back(staff); } //FINDMICH dirty. very dirty. int canvas_width(); @@ -830,17 +830,17 @@ class ScoreCanvas : public MusEWidget::View int get_last_len() {return last_len;} void set_last_len(int l) {last_len=l;} - Part* get_selected_part() {return selected_part;} - void set_selected_part(Part* p) {selected_part=p; if (selected_part) selected_part_index=selected_part->sn();} - Part* get_dragged_event_part() {return dragged_event_part;} - void set_dragged_event_part(Part* p) {dragged_event_part=p; if (dragged_event_part) dragged_event_part_index=dragged_event_part->sn();} + MusECore::Part* get_selected_part() {return selected_part;} + void set_selected_part(MusECore::Part* p) {selected_part=p; if (selected_part) selected_part_index=selected_part->sn();} + MusECore::Part* get_dragged_event_part() {return dragged_event_part;} + void set_dragged_event_part(MusECore::Part* p) {dragged_event_part=p; if (dragged_event_part) dragged_event_part_index=dragged_event_part->sn();} - set<Part*> get_all_parts(); + set<MusECore::Part*> get_all_parts(); - void write_staves(int level, Xml& xml) const; + void write_staves(int level, MusECore::Xml& xml) const; timesig_t timesig_at_tick(int t); - key_enum key_at_tick(int t); + MusECore::key_enum key_at_tick(int t); int tick_to_x(int t); int delta_tick_to_delta_x(int t); int x_to_tick(int x); @@ -851,6 +851,6 @@ int calc_measure_len(const list<int>& nums, int denom); vector<int> create_emphasize_list(const list<int>& nums, int denom); vector<int> create_emphasize_list(int num, int denom); - +} // namespace MusEGui #endif diff --git a/muse2/muse/midieditor.cpp b/muse2/muse/midieditor.cpp index d4a16eda..6f6ca713 100644 --- a/muse2/muse/midieditor.cpp +++ b/muse2/muse/midieditor.cpp @@ -34,17 +34,19 @@ #include <QColor> #include <QGridLayout> +namespace MusEGui { + //--------------------------------------------------------- // MidiEditor //--------------------------------------------------------- -MidiEditor::MidiEditor(ToplevelType t, int r, PartList* pl, +MidiEditor::MidiEditor(ToplevelType t, int r, MusECore::PartList* pl, QWidget* parent, const char* name) : TopWin(t, parent, name) { setAttribute(Qt::WA_DeleteOnClose); _pl = pl; if (_pl) - for (iPart i = _pl->begin(); i != _pl->end(); ++i) + for (MusECore::iPart i = _pl->begin(); i != _pl->end(); ++i) _parts.insert(i->second->sn()); _raster = r; canvas = 0; @@ -60,7 +62,7 @@ MidiEditor::MidiEditor(ToplevelType t, int r, PartList* pl, mainGrid->setSpacing(0); setCentralWidget(mainw); - connect(song, SIGNAL(newPartsCreated(const std::map< Part*, std::set<Part*> >&)), SLOT(addNewParts(const std::map< Part*, std::set<Part*> >&))); + connect(MusEGlobal::song, SIGNAL(newPartsCreated(const std::map< MusECore::Part*, std::set<MusECore::Part*> >&)), SLOT(addNewParts(const std::map< MusECore::Part*, std::set<MusECore::Part*> >&))); } //--------------------------------------------------------- @@ -71,10 +73,10 @@ void MidiEditor::genPartlist() { _pl->clear(); for (std::set<int>::iterator i = _parts.begin(); i != _parts.end(); ++i) { - TrackList* tl = song->tracks(); - for (iTrack it = tl->begin(); it != tl->end(); ++it) { - PartList* pl = (*it)->parts(); - iPart ip; + MusECore::TrackList* tl = MusEGlobal::song->tracks(); + for (MusECore::iTrack it = tl->begin(); it != tl->end(); ++it) { + MusECore::PartList* pl = (*it)->parts(); + MusECore::iPart ip; for (ip = pl->begin(); ip != pl->end(); ++ip) { if (ip->second->sn() == *i) { _pl->add(ip->second); @@ -91,7 +93,7 @@ void MidiEditor::genPartlist() // addPart //--------------------------------------------------------- -void MidiEditor::addPart(Part* p) +void MidiEditor::addPart(MusECore::Part* p) { _pl->add(p); _parts.insert(p->sn()); @@ -113,19 +115,19 @@ MidiEditor::~MidiEditor() // readStatus //--------------------------------------------------------- -void MidiEditor::readStatus(Xml& xml) +void MidiEditor::readStatus(MusECore::Xml& xml) { if (_pl == 0) - _pl = new PartList; + _pl = new MusECore::PartList; for (;;) { - Xml::Token token = xml.parse(); + MusECore::Xml::Token token = xml.parse(); QString tag = xml.s1(); switch (token) { - case Xml::Error: - case Xml::End: + case MusECore::Xml::Error: + case MusECore::Xml::End: return; - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "raster") _raster = xml.parseInt(); else if (tag == "topwin") @@ -133,7 +135,7 @@ void MidiEditor::readStatus(Xml& xml) else xml.unknown("MidiEditor"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "midieditor") return; default: @@ -146,12 +148,12 @@ void MidiEditor::readStatus(Xml& xml) // writePartList //--------------------------------------------------------- -void MidiEditor::writePartList(int level, Xml& xml) const +void MidiEditor::writePartList(int level, MusECore::Xml& xml) const { - for (ciPart p = _pl->begin(); p != _pl->end(); ++p) { - Part* part = p->second; - Track* track = part->track(); - int trkIdx = song->tracks()->index(track); + for (MusECore::ciPart p = _pl->begin(); p != _pl->end(); ++p) { + MusECore::Part* part = p->second; + MusECore::Track* track = part->track(); + int trkIdx = MusEGlobal::song->tracks()->index(track); int partIdx = track->parts()->index(part); if((trkIdx == -1) || (partIdx == -1)) @@ -165,7 +167,7 @@ void MidiEditor::writePartList(int level, Xml& xml) const // writeStatus //--------------------------------------------------------- -void MidiEditor::writeStatus(int level, Xml& xml) const +void MidiEditor::writeStatus(int level, MusECore::Xml& xml) const { xml.tag(level++, "midieditor"); TopWin::writeStatus(level, xml); @@ -224,7 +226,7 @@ void MidiEditor::setCurDrumInstrument(int instr) // curCanvasPart //--------------------------------------------------------- -Part* MidiEditor::curCanvasPart() +MusECore::Part* MidiEditor::curCanvasPart() { if(canvas) return canvas->part(); @@ -236,7 +238,7 @@ Part* MidiEditor::curCanvasPart() // curWavePart //--------------------------------------------------------- -WavePart* MidiEditor::curWavePart() +MusECore::WavePart* MidiEditor::curWavePart() { if(wview) return wview->part(); @@ -248,7 +250,7 @@ WavePart* MidiEditor::curWavePart() // setCurCanvasPart //--------------------------------------------------------- -void MidiEditor::setCurCanvasPart(Part* part) +void MidiEditor::setCurCanvasPart(MusECore::Part* part) { if(canvas) canvas->setCurrentPart(part); @@ -257,11 +259,11 @@ void MidiEditor::setCurCanvasPart(Part* part) void MidiEditor::horizontalZoomIn() { int mag = hscroll->mag(); - int zoomlvl = MusEWidget::ScrollScale::getQuickZoomLevel(mag); + int zoomlvl = MusEGui::ScrollScale::getQuickZoomLevel(mag); if (zoomlvl < 23) zoomlvl++; - int newmag = MusEWidget::ScrollScale::convertQuickZoomLevelToMag(zoomlvl); + int newmag = MusEGui::ScrollScale::convertQuickZoomLevelToMag(zoomlvl); hscroll->setMag(newmag); @@ -270,23 +272,25 @@ void MidiEditor::horizontalZoomIn() void MidiEditor::horizontalZoomOut() { int mag = hscroll->mag(); - int zoomlvl = MusEWidget::ScrollScale::getQuickZoomLevel(mag); + int zoomlvl = MusEGui::ScrollScale::getQuickZoomLevel(mag); if (zoomlvl > 1) zoomlvl--; - int newmag = MusEWidget::ScrollScale::convertQuickZoomLevelToMag(zoomlvl); + int newmag = MusEGui::ScrollScale::convertQuickZoomLevelToMag(zoomlvl); hscroll->setMag(newmag); } -void MidiEditor::addNewParts(const std::map< Part*, std::set<Part*> >& param) +void MidiEditor::addNewParts(const std::map< MusECore::Part*, std::set<MusECore::Part*> >& param) { using std::map; using std::set; - for (map< Part*, set<Part*> >::const_iterator it = param.begin(); it!=param.end(); it++) + for (map< MusECore::Part*, set<MusECore::Part*> >::const_iterator it = param.begin(); it!=param.end(); it++) if (_pl->index(it->first) != -1) - for (set<Part*>::const_iterator it2=it->second.begin(); it2!=it->second.end(); it2++) + for (set<MusECore::Part*>::const_iterator it2=it->second.begin(); it2!=it->second.end(); it2++) addPart(*it2); } + +} // namespace MusEGui diff --git a/muse2/muse/midieditor.h b/muse2/muse/midieditor.h index 84597cd3..fa59c9cc 100644 --- a/muse2/muse/midieditor.h +++ b/muse2/muse/midieditor.h @@ -33,18 +33,20 @@ class QGridLayout; class QWidget; -class PartList; -class Xml; -class EventCanvas; -class CtrlEdit; -class WaveView; + +namespace MusECore { class Part; +class PartList; class WavePart; +class Xml; +} -namespace MusEWidget { +namespace MusEGui { +class CtrlEdit; +class EventCanvas; class MTScale; class ScrollScale; -} +class WaveView; //--------------------------------------------------------- // MidiEditor @@ -53,14 +55,14 @@ class ScrollScale; class MidiEditor : public TopWin { Q_OBJECT - PartList* _pl; + MusECore::PartList* _pl; std::set<int> _parts; int _curDrumInstrument; // currently selected instrument if drum // editor protected: - MusEWidget::ScrollScale* hscroll; - MusEWidget::ScrollScale* vscroll; - MusEWidget::MTScale* time; + MusEGui::ScrollScale* hscroll; + MusEGui::ScrollScale* vscroll; + MusEGui::MTScale* time; EventCanvas* canvas; WaveView* wview; @@ -68,13 +70,13 @@ class MidiEditor : public TopWin { int _raster; QGridLayout* mainGrid; QWidget* mainw; - virtual void readStatus(Xml&); - virtual void writeStatus(int, Xml&) const; - void writePartList(int, Xml&) const; + virtual void readStatus(MusECore::Xml&); + virtual void writeStatus(int, MusECore::Xml&) const; + void writePartList(int, MusECore::Xml&) const; void genPartlist(); private slots: - void addNewParts(const std::map< Part*, std::set<Part*> >&); + void addNewParts(const std::map< MusECore::Part*, std::set<MusECore::Part*> >&); public slots: void songChanged(int type); @@ -87,7 +89,7 @@ class MidiEditor : public TopWin { void curDrumInstrumentChanged(int); public: - MidiEditor(ToplevelType t, int, PartList*, + MidiEditor(ToplevelType t, int, MusECore::PartList*, QWidget* parent = 0, const char* name = 0); ~MidiEditor(); @@ -101,13 +103,15 @@ class MidiEditor : public TopWin { unsigned rasterVal2(unsigned v) const { return AL::sigmap.raster2(v, _raster); } int raster() const { return _raster; } void setRaster(int val) { _raster = val; } - PartList* parts() { return _pl; } + MusECore::PartList* parts() { return _pl; } int curDrumInstrument() const { return _curDrumInstrument; } - Part* curCanvasPart(); - WavePart* curWavePart(); - void setCurCanvasPart(Part*); - void addPart(Part*); + MusECore::Part* curCanvasPart(); + MusECore::WavePart* curWavePart(); + void setCurCanvasPart(MusECore::Part*); + void addPart(MusECore::Part*); }; +} // namespace MusEGui + #endif diff --git a/muse2/muse/midievent.cpp b/muse2/muse/midievent.cpp index c92322cb..97f2359a 100644 --- a/muse2/muse/midievent.cpp +++ b/muse2/muse/midievent.cpp @@ -27,6 +27,8 @@ #include "mpevent.h" #include "midictrl.h" +namespace MusECore { + //--------------------------------------------------------- // MidiEventBase //--------------------------------------------------------- @@ -189,3 +191,4 @@ void MidiEventBase::read(Xml& xml) } } +} // namespace MusECore diff --git a/muse2/muse/midievent.h b/muse2/muse/midievent.h index ab0ad6b6..2c832cdf 100644 --- a/muse2/muse/midievent.h +++ b/muse2/muse/midievent.h @@ -26,6 +26,8 @@ #include "eventbase.h" +namespace MusECore { + //--------------------------------------------------------- // MidiEventBase //--------------------------------------------------------- @@ -73,5 +75,7 @@ class MidiEventBase : public EventBase { virtual EventBase* mid(unsigned, unsigned); }; +} // namespace MusECore + #endif diff --git a/muse2/muse/midifile.cpp b/muse2/muse/midifile.cpp index 3abf34b6..a94644ff 100644 --- a/muse2/muse/midifile.cpp +++ b/muse2/muse/midifile.cpp @@ -38,6 +38,8 @@ #include "mpevent.h" #include "gconfig.h" +namespace MusECore { + const char* errString[] = { "no Error", "unexpected EOF", @@ -535,7 +537,7 @@ bool MidiFile::writeTrack(const MidiFileTrack* t) printf("MidiFile::writeTrack: ntick %d < tick %d\n", ntick, tick); ntick = tick; } - putvl(((ntick - tick) * MusEConfig::config.midiDivision + MusEConfig::config.division/2)/MusEConfig::config.division); + putvl(((ntick - tick) * MusEGlobal::config.midiDivision + MusEGlobal::config.division/2)/MusEGlobal::config.division); tick = ntick; writeEvent(&(*i)); } @@ -567,7 +569,7 @@ void MidiFile::writeEvent(const MidiPlayEvent* event) // we dont save meta data into smf type 0 files: - if (MusEConfig::config.smfFormat == 0 && nstat == ME_META) + if (MusEGlobal::config.smfFormat == 0 && nstat == ME_META) return; nstat |= c; @@ -617,8 +619,8 @@ bool MidiFile::write() { write("MThd", 4); writeLong(6); // header len - writeShort(MusEConfig::config.smfFormat); - if (MusEConfig::config.smfFormat == 0) { + writeShort(MusEGlobal::config.smfFormat); + if (MusEGlobal::config.smfFormat == 0) { writeShort(1); MidiFileTrack dst; for (iMidiFileTrack i = _tracks->begin(); i != _tracks->end(); ++i) { @@ -691,3 +693,4 @@ bool MidiFile::read() return false; } +} // namespace MusECore diff --git a/muse2/muse/midifile.h b/muse2/muse/midifile.h index 5f4c6231..9ef169e0 100644 --- a/muse2/muse/midifile.h +++ b/muse2/muse/midifile.h @@ -30,6 +30,8 @@ #include "globaldefs.h" #include "mpevent.h" +namespace MusECore { + struct MPEventList; class MidiPlayEvent; @@ -102,6 +104,8 @@ class MidiFile { MType mtype() const { return _mtype; } }; +} // namespace MusECore + #define XCHG_SHORT(x) ((((x)&0xFF)<<8) | (((x)>>8)&0xFF)) #ifdef __i486__ #define XCHG_LONG(x) \ diff --git a/muse2/muse/midiport.cpp b/muse2/muse/midiport.cpp index a2e23cee..a8a248cb 100644 --- a/muse2/muse/midiport.cpp +++ b/muse2/muse/midiport.cpp @@ -42,7 +42,11 @@ //#include "dssihost.h" //#endif -MidiPort midiPorts[MIDI_PORTS]; +namespace MusEGlobal { +MusECore::MidiPort midiPorts[MIDI_PORTS]; +} + +namespace MusECore { //--------------------------------------------------------- // initMidiPorts @@ -51,7 +55,7 @@ MidiPort midiPorts[MIDI_PORTS]; void initMidiPorts() { for (int i = 0; i < MIDI_PORTS; ++i) { - MidiPort* port = &midiPorts[i]; + MidiPort* port = &MusEGlobal::midiPorts[i]; ///port->setInstrument(genericMidiInstrument); port->setInstrument(registerMidiInstrument("GM")); // Changed by Tim. port->syncInfo().setPort(i); @@ -147,7 +151,7 @@ void MidiPort::setMidiDevice(MidiDevice* dev) } if (dev) { for (int i = 0; i < MIDI_PORTS; ++i) { - MidiPort* mp = &midiPorts[i]; + MidiPort* mp = &MusEGlobal::midiPorts[i]; if (mp->device() == dev) { if(dev->isSynti()) mp->setInstrument(genericMidiInstrument); @@ -302,7 +306,7 @@ void MidiPort::clearDevice() int MidiPort::portno() const { for (int i = 0; i < MIDI_PORTS; ++i) { - if (&midiPorts[i] == this) + if (&MusEGlobal::midiPorts[i] == this) return i; } return -1; @@ -317,7 +321,7 @@ QMenu* midiPortsPopup(QWidget* parent, int checkPort) { QMenu* p = new QMenu(parent); for (int i = 0; i < MIDI_PORTS; ++i) { - MidiPort* port = &midiPorts[i]; + MidiPort* port = &MusEGlobal::midiPorts[i]; QString name; name.sprintf("%d:%s", port->portno()+1, port->portname().toLatin1().constData()); QAction *act = p->addAction(name); @@ -786,7 +790,7 @@ bool MidiPort::sendEvent(const MidiPlayEvent& ev, bool forceSend) { DrumMap* dm = &drumMap[da & 0x7f]; int port = dm->port; - MidiPort* mp = &midiPorts[port]; + MidiPort* mp = &MusEGlobal::midiPorts[port]; // Is it NOT for this MidiPort? if(mp && (mp != this)) { @@ -1161,10 +1165,11 @@ void setPortExclusiveDefOutChan(int port, int c) { if(port < 0 || port >= MIDI_PORTS) return; - midiPorts[port].setDefaultOutChannels(c); + MusEGlobal::midiPorts[port].setDefaultOutChannels(c); for(int i = 0; i < MIDI_PORTS; ++i) if(i != port) - midiPorts[i].setDefaultOutChannels(0); + MusEGlobal::midiPorts[i].setDefaultOutChannels(0); } #endif +} // namespace MusECore diff --git a/muse2/muse/midiport.h b/muse2/muse/midiport.h index 25b11696..8c12e2c6 100644 --- a/muse2/muse/midiport.h +++ b/muse2/muse/midiport.h @@ -28,14 +28,19 @@ #include "sync.h" #include "route.h" +class QMenu; +class QWidget; + +namespace MusECore { + class MidiDevice; -class MidiInstrument; -class MidiCtrlValListList; -class MidiPlayEvent; -class MidiController; -class MidiCtrlValList; class Part; //class MidiSyncInfo; +class MidiController; +class MidiCtrlValListList; +class MidiCtrlValList; +class MidiInstrument; +class MidiPlayEvent; //--------------------------------------------------------- // MidiPort @@ -141,7 +146,6 @@ class MidiPort { MidiSyncInfo& syncInfo() { return _syncInfo; } }; -extern MidiPort midiPorts[MIDI_PORTS]; extern void initMidiPorts(); // p4.0.17 Turn off if and when multiple output routes supported. @@ -149,9 +153,14 @@ extern void initMidiPorts(); extern void setPortExclusiveDefOutChan(int /*port*/, int /*chan*/); #endif -class QMenu; -class QWidget; //extern QPopupMenu* midiPortsPopup(QWidget*); extern QMenu* midiPortsPopup(QWidget* parent = 0, int checkPort = -1); + +} // namespace MusECore + +namespace MusEGlobal { +extern MusECore::MidiPort midiPorts[MIDI_PORTS]; +} + #endif diff --git a/muse2/muse/midiseq.cpp b/muse2/muse/midiseq.cpp index 2f1174cd..e31db7c7 100644 --- a/muse2/muse/midiseq.cpp +++ b/muse2/muse/midiseq.cpp @@ -45,10 +45,14 @@ #include "song.h" #include "gconfig.h" -MidiSeq* midiSeq; -int MidiSeq::ticker = 0; +namespace MusEGlobal { +MusECore::MidiSeq* midiSeq; volatile bool midiBusy=false; +} +namespace MusECore { + +int MidiSeq::ticker = 0; //--------------------------------------------------------- // readMsg @@ -67,78 +71,78 @@ static void readMsg(void* p, void*) void MidiSeq::processMsg(const ThreadMsg* m) { - AudioMsg* msg = (AudioMsg*)m; + MusECore::AudioMsg* msg = (MusECore::AudioMsg*)m; switch(msg->id) { // This does not appear to be used anymore. Was sent in Audio::process1, // now Audio::processMidi is called directly. p4.0.15 Tim. - //case MS_PROCESS: + //case MusECore::MS_PROCESS: // audio->processMidi(); // break; // Removed p4.0.34 - //case SEQM_SEEK: + //case MusECore::SEQM_SEEK: // processSeek(); // break; - //case MS_STOP: + //case MusECore::MS_STOP: // processStop(); // break; - case MS_SET_RTC: + case MusECore::MS_SET_RTC: MusEGlobal::doSetuid(); setRtcTicks(); MusEGlobal::undoSetuid(); break; - case MS_UPDATE_POLL_FD: + case MusECore::MS_UPDATE_POLL_FD: updatePollFd(); break; // Moved into Song::processMsg p4.0.34 /* - case SEQM_ADD_TRACK: - song->insertTrack2(msg->track, msg->ival); + case MusECore::SEQM_ADD_TRACK: + MusEGlobal::song->insertTrack2(msg->track, msg->ival); updatePollFd(); break; - case SEQM_REMOVE_TRACK: - song->cmdRemoveTrack(msg->track); + case MusECore::SEQM_REMOVE_TRACK: + MusEGlobal::song->cmdRemoveTrack(msg->track); updatePollFd(); break; - case SEQM_CHANGE_TRACK: - song->changeTrack((Track*)(msg->p1), (Track*)(msg->p2)); + case MusECore::SEQM_CHANGE_TRACK: + MusEGlobal::song->changeTrack((Track*)(msg->p1), (Track*)(msg->p2)); updatePollFd(); break; - case SEQM_ADD_PART: - song->cmdAddPart((Part*)msg->p1); + case MusECore::SEQM_ADD_PART: + MusEGlobal::song->cmdAddPart((Part*)msg->p1); break; - case SEQM_REMOVE_PART: - song->cmdRemovePart((Part*)msg->p1); + case MusECore::SEQM_REMOVE_PART: + MusEGlobal::song->cmdRemovePart((Part*)msg->p1); break; - case SEQM_CHANGE_PART: - //song->cmdChangePart((Part*)msg->p1, (Part*)msg->p2); - song->cmdChangePart((Part*)msg->p1, (Part*)msg->p2, msg->a, msg->b); + case MusECore::SEQM_CHANGE_PART: + //MusEGlobal::song->cmdChangePart((Part*)msg->p1, (Part*)msg->p2); + MusEGlobal::song->cmdChangePart((Part*)msg->p1, (Part*)msg->p2, msg->a, msg->b); break; */ - case SEQM_SET_TRACK_OUT_CHAN: + case MusECore::SEQM_SET_TRACK_OUT_CHAN: { MidiTrack* track = (MidiTrack*)(msg->p1); track->setOutChanAndUpdate(msg->a); } break; - case SEQM_SET_TRACK_OUT_PORT: + case MusECore::SEQM_SET_TRACK_OUT_PORT: { MidiTrack* track = (MidiTrack*)(msg->p1); track->setOutPortAndUpdate(msg->a); } break; - case SEQM_REMAP_PORT_DRUM_CTL_EVS: - song->remapPortDrumCtrlEvents(msg->ival, msg->a, msg->b, msg->c); + case MusECore::SEQM_REMAP_PORT_DRUM_CTL_EVS: + MusEGlobal::song->remapPortDrumCtrlEvents(msg->ival, msg->a, msg->b, msg->c); break; - case SEQM_CHANGE_ALL_PORT_DRUM_CTL_EVS: - song->changeAllPortDrumCtrlEvents((bool)msg->a, (bool)msg->b); + case MusECore::SEQM_CHANGE_ALL_PORT_DRUM_CTL_EVS: + MusEGlobal::song->changeAllPortDrumCtrlEvents((bool)msg->a, (bool)msg->b); break; - case SEQM_SET_MIDI_DEVICE: + case MusECore::SEQM_SET_MIDI_DEVICE: ((MidiPort*)(msg->p1))->setMidiDevice((MidiDevice*)(msg->p2)); updatePollFd(); break; - case SEQM_IDLE: + case MusECore::SEQM_IDLE: idle = msg->a; break; default: @@ -163,7 +167,7 @@ void MidiSeq::processStop() // clear Alsa midi device notes and stop stuck notes // Jack midi devices are handled in Audio::stopRolling() // - for(iMidiDevice id = midiDevices.begin(); id != midiDevices.end(); ++id) + for(iMidiDevice id = MusEGlobal::midiDevices.begin(); id != MusEGlobal::midiDevices.end(); ++id) { //MidiDevice* md = *id; // Only ALSA devices are handled by this thread. @@ -196,16 +200,16 @@ void MidiSeq::processStop() void MidiSeq::processSeek() { - //int pos = audio->tickPos(); - // TODO Try to move this into audio::seek(). p4.0.22 Done p4.0.34 - //if (pos == 0 && !song->record()) - // audio->initDevices(); + //int pos = MusEGlobal::audio->tickPos(); + // TODO Try to move this into MusEGlobal::audio::seek(). p4.0.22 Done p4.0.34 + //if (pos == 0 && !MusEGlobal::song->record()) + // MusEGlobal::audio->initDevices(); //--------------------------------------------------- // set all controller //--------------------------------------------------- - for (iMidiDevice i = midiDevices.begin(); i != midiDevices.end(); ++i) + for (iMidiDevice i = MusEGlobal::midiDevices.begin(); i != MusEGlobal::midiDevices.end(); ++i) { //MidiDevice* md = *i; // Only ALSA devices are handled by this thread. @@ -215,12 +219,12 @@ void MidiSeq::processSeek() int port = md->midiPort(); if (port == -1) continue; - MidiPort* mp = &midiPorts[port]; + MidiPort* mp = &MusEGlobal::midiPorts[port]; MidiCtrlValListList* cll = mp->controller(); MPEventList* el = md->playEvents(); - if (audio->isPlaying()) + if (MusEGlobal::audio->isPlaying()) { // stop all notes el->clear(); @@ -426,39 +430,39 @@ void MidiSeq::updatePollFd() exit(-1); } - addPollFd(toThreadFdr, POLLIN, ::readMsg, this, 0); + addPollFd(toThreadFdr, POLLIN, MusECore::readMsg, this, 0); //--------------------------------------------------- // midi ports //--------------------------------------------------- - for (iMidiDevice imd = midiDevices.begin(); imd != midiDevices.end(); ++imd) { + for (iMidiDevice imd = MusEGlobal::midiDevices.begin(); imd != MusEGlobal::midiDevices.end(); ++imd) { MidiDevice* dev = *imd; int port = dev->midiPort(); //const QString name = dev->name(); if (port == -1) continue; - if ((dev->rwFlags() & 0x2) || (extSyncFlag.value() + if ((dev->rwFlags() & 0x2) || (MusEGlobal::extSyncFlag.value() //&& (rxSyncPort == port || rxSyncPort == -1))) { //&& (dev->syncInfo().MCIn()))) { - && (midiPorts[port].syncInfo().MCIn()))) { + && (MusEGlobal::midiPorts[port].syncInfo().MCIn()))) { if(dev->selectRfd() < 0){ //fprintf(stderr, "WARNING: read-file-descriptor for {%s} is negative\n", name.toLatin1()); } - addPollFd(dev->selectRfd(), POLLIN, ::midiRead, this, dev); + addPollFd(dev->selectRfd(), POLLIN, MusECore::midiRead, this, dev); } if (dev->bytesToWrite()){ if(dev->selectWfd() < 0){ //fprintf(stderr, "WARNING: write-file-descriptor for {%s} is negative\n", name.toLatin1()); } - addPollFd(dev->selectWfd(), POLLOUT, ::midiWrite, this, dev); + addPollFd(dev->selectWfd(), POLLOUT, MusECore::midiWrite, this, dev); } } // special handling for alsa midi: // (one fd for all devices) // this allows for processing of some alsa events // even if no alsa driver is active (assigned to a port) - addPollFd(alsaSelectRfd(), POLLIN, ::alsaMidiRead, this, 0); + addPollFd(alsaSelectRfd(), POLLIN, MusECore::alsaMidiRead, this, 0); } //--------------------------------------------------------- @@ -480,11 +484,11 @@ void MidiSeq::threadStop() bool MidiSeq::setRtcTicks() { - //timer.setTimerFreq(MusEConfig::config.rtcTicks); + //timer.setTimerFreq(MusEGlobal::config.rtcTicks); //timer.startTimer(); - timer->setTimerFreq(MusEConfig::config.rtcTicks); + timer->setTimerFreq(MusEGlobal::config.rtcTicks); timer->startTimer(); - realRtcTicks = MusEConfig::config.rtcTicks; + realRtcTicks = MusEGlobal::config.rtcTicks; return true; } @@ -520,7 +524,7 @@ void MidiSeq::start(int priority) void MidiSeq::processMidiClock() { // if (genMCSync) { -// midiPorts[txSyncPort].sendClock(); +// MusEGlobal::midiPorts[txSyncPort].sendClock(); // } /* if (state == START_PLAY) { @@ -533,7 +537,7 @@ void MidiSeq::processMidiClock() sigmap.tickValues(_midiTick, &bar, &beat, &tick); midiClick = sigmap.bar2tick(bar, beat+1, 0); - double cpos = tempomap.tick2time(playTickPos); + double cpos = MusEGlobal::tempomap.tick2time(playTickPos); samplePosStart = samplePos - lrint(cpos * MusEGlobal::sampleRate); rtcTickStart = rtcTick - lrint(cpos * realRtcTicks); @@ -541,12 +545,12 @@ void MidiSeq::processMidiClock() recTick = playTickPos; lastTickPos = playTickPos; - tempoSN = tempomap.tempoSN(); + tempoSN = MusEGlobal::tempomap.tempoSN(); startRecordPos.setPosTick(playTickPos); } */ -// midiClock += MusEConfig::config.division/24; +// midiClock += MusEGlobal::config.division/24; } //--------------------------------------------------------- @@ -593,13 +597,13 @@ void MidiSeq::processTimerTick() // printf("IDLE\n"); return; } - if (midiBusy) { - // we hit audio: midiSeq->msgProcess (actually this has been audio->processMidi for some time now - Tim) + if (MusEGlobal::midiBusy) { + // we hit MusEGlobal::audio: MusEGlobal::midiSeq->msgProcess (actually this has been MusEGlobal::audio->processMidi for some time now - Tim) // miss this timer tick return; } - unsigned curFrame = audio->curFrame(); + unsigned curFrame = MusEGlobal::audio->curFrame(); // Keep the sync detectors running... // No, done in Song::beat(), (at the much slower heartbeat rate). @@ -607,19 +611,19 @@ void MidiSeq::processTimerTick() //for(int port = 0; port < MIDI_PORTS; ++port) //{ // Must keep them running even if there's no device... - //if(midiPorts[port].device()) - // midiPorts[port].syncInfo().setCurFrame(curFrame); + //if(MusEGlobal::midiPorts[port].device()) + // MusEGlobal::midiPorts[port].syncInfo().setCurFrame(curFrame); //} - //for(iMidiDevice imd = midiDevices.begin(); imd != midiDevices.end(); ++imd) + //for(iMidiDevice imd = MusEGlobal::midiDevices.begin(); imd != MusEGlobal::midiDevices.end(); ++imd) // (*imd)->syncInfo().setCurFrame(curFrame); - if (!extSyncFlag.value()) { - //int curTick = tempomap.frame2tick(curFrame); + if (!MusEGlobal::extSyncFlag.value()) { + //int curTick = MusEGlobal::tempomap.frame2tick(curFrame); // Copied from Tempomap. - //int curTick = lrint((double(curFrame)/double(MusEGlobal::sampleRate)) * tempomap.globalTempo() * MusEConfig::config.division * 10000.0 / double(tempomap.tempo(song->cpos()))); - //int curTick = lrint((double(curFrame)/double(MusEGlobal::sampleRate)) * tempomap.globalTempo() * 240000.0 / double(tempomap.tempo(song->cpos()))); - int curTick = lrint((double(curFrame)/double(MusEGlobal::sampleRate)) * double(tempomap.globalTempo()) * double(MusEConfig::config.division) * 10000.0 / double(tempomap.tempo(song->cpos()))); - //int curTick = int((double(curFrame)/double(MusEGlobal::sampleRate)) * double(tempomap.globalTempo()) * double(MusEConfig::config.division * 10000.0) / double(tempomap.tempo(song->cpos()))); + //int curTick = lrint((double(curFrame)/double(MusEGlobal::sampleRate)) * MusEGlobal::tempomap.globalTempo() * MusEGlobal::config.division * 10000.0 / double(MusEGlobal::tempomap.tempo(MusEGlobal::song->cpos()))); + //int curTick = lrint((double(curFrame)/double(MusEGlobal::sampleRate)) * MusEGlobal::tempomap.globalTempo() * 240000.0 / double(MusEGlobal::tempomap.tempo(MusEGlobal::song->cpos()))); + int curTick = lrint((double(curFrame)/double(MusEGlobal::sampleRate)) * double(MusEGlobal::tempomap.globalTempo()) * double(MusEGlobal::config.division) * 10000.0 / double(MusEGlobal::tempomap.tempo(MusEGlobal::song->cpos()))); + //int curTick = int((double(curFrame)/double(MusEGlobal::sampleRate)) * double(MusEGlobal::tempomap.globalTempo()) * double(MusEGlobal::config.division * 10000.0) / double(MusEGlobal::tempomap.tempo(MusEGlobal::song->cpos()))); /* if ( midiClock > curTick + 100) // reinitialize { @@ -633,7 +637,7 @@ void MidiSeq::processTimerTick() if(midiClock > curTick) midiClock = curTick; - int div = MusEConfig::config.division/24; + int div = MusEGlobal::config.division/24; if(curTick >= midiClock + div) { //if(curTick >= midiClock) { //processMidiClock(); @@ -644,10 +648,10 @@ void MidiSeq::processTimerTick() //if(genMCSync) //{ - //midiPorts[txSyncPort].sendClock(); + //MusEGlobal::midiPorts[txSyncPort].sendClock(); for(int port = 0; port < MIDI_PORTS; ++port) { - MidiPort* mp = &midiPorts[port]; + MidiPort* mp = &MusEGlobal::midiPorts[port]; // No device? Clock out not turned on? //MidiDevice* dev = mp->device(); @@ -666,7 +670,7 @@ void MidiSeq::processTimerTick() } /* - for(iMidiDevice imd = midiDevices.begin(); imd != midiDevices.end(); ++imd) + for(iMidiDevice imd = MusEGlobal::midiDevices.begin(); imd != MusEGlobal::midiDevices.end(); ++imd) { MidiDevice* dev = *imd; @@ -693,7 +697,7 @@ void MidiSeq::processTimerTick() } else // Go through the port... - midiPorts[port].sendClock(); + MusEGlobal::midiPorts[port].sendClock(); } */ @@ -733,12 +737,12 @@ void MidiSeq::processTimerTick() // } // p3.3.25 - //int tickpos = audio->tickPos(); - //bool extsync = extSyncFlag.value(); + //int tickpos = MusEGlobal::audio->tickPos(); + //bool extsync = MusEGlobal::extSyncFlag.value(); // // play all events upto curFrame // - for (iMidiDevice id = midiDevices.begin(); id != midiDevices.end(); ++id) { + for (iMidiDevice id = MusEGlobal::midiDevices.begin(); id != MusEGlobal::midiDevices.end(); ++id) { //MidiDevice* md = *id; // Is it a Jack midi device? They are iterated in Audio::processMidi. p3.3.36 //MidiJackDevice* mjd = dynamic_cast<MidiJackDevice*>(md); @@ -754,7 +758,7 @@ void MidiSeq::processTimerTick() // Moved into MidiAlsaDevice. p4.0.34 /* int port = md->midiPort(); - MidiPort* mp = port != -1 ? &midiPorts[port] : 0; + MidiPort* mp = port != -1 ? &MusEGlobal::midiPorts[port] : 0; MPEventList* el = md->playEvents(); if (el->empty()) continue; @@ -801,7 +805,7 @@ void MidiSeq::processTimerTick() void MidiSeq::msgMsg(int id) { - AudioMsg msg; + MusECore::AudioMsg msg; msg.id = id; Thread::sendMsg(&msg); } @@ -815,22 +819,23 @@ void MidiSeq::msgMsg(int id) void MidiSeq::msgSetMidiDevice(MidiPort* port, MidiDevice* device) { - AudioMsg msg; - msg.id = SEQM_IDLE; + MusECore::AudioMsg msg; + msg.id = MusECore::SEQM_IDLE; msg.a = true; Thread::sendMsg(&msg); port->setMidiDevice(device); - msg.id = SEQM_IDLE; + msg.id = MusECore::SEQM_IDLE; msg.a = false; Thread::sendMsg(&msg); } // This does not appear to be used anymore. Was called in Audio::process1, now Audio::processMidi is called directly. p4.0.15 Tim. -//void MidiSeq::msgProcess() { msgMsg(MS_PROCESS); } -//void MidiSeq::msgSeek() { msgMsg(SEQM_SEEK); } // Removed p4.0.34 -//void MidiSeq::msgStop() { msgMsg(MS_STOP); } // -void MidiSeq::msgSetRtc() { msgMsg(MS_SET_RTC); } -void MidiSeq::msgUpdatePollFd() { msgMsg(MS_UPDATE_POLL_FD); } +//void MidiSeq::msgProcess() { msgMsg(MusECore::MS_PROCESS); } +//void MidiSeq::msgSeek() { msgMsg(MusECore::SEQM_SEEK); } // Removed p4.0.34 +//void MidiSeq::msgStop() { msgMsg(MusECore::MS_STOP); } // +void MidiSeq::msgSetRtc() { msgMsg(MusECore::MS_SET_RTC); } +void MidiSeq::msgUpdatePollFd() { msgMsg(MusECore::MS_UPDATE_POLL_FD); } +} // namespace MusECore diff --git a/muse2/muse/midiseq.h b/muse2/muse/midiseq.h index 1e6ebf2a..3c3813ef 100644 --- a/muse2/muse/midiseq.h +++ b/muse2/muse/midiseq.h @@ -29,11 +29,13 @@ #include "driver/alsatimer.h" #include "driver/rtctimer.h" +namespace MusECore { + +class MidiDevice; +class MidiPort; class MPEventList; -class SynthI; class MTC; -class MidiPort; -class MidiDevice; +class SynthI; //--------------------------------------------------------- // MidiSeq @@ -113,7 +115,12 @@ class MidiSeq : public Thread { void msgSetMidiDevice(MidiPort*, MidiDevice*); }; -extern MidiSeq* midiSeq; +} //namespace MusECore + +namespace MusEGlobal { +extern MusECore::MidiSeq* midiSeq; extern volatile bool midiBusy; +} // namespace MusEGlobal + #endif diff --git a/muse2/muse/miditransform.cpp b/muse2/muse/miditransform.cpp index 8d25fdfc..ffc67f53 100644 --- a/muse2/muse/miditransform.cpp +++ b/muse2/muse/miditransform.cpp @@ -42,6 +42,8 @@ #include "gconfig.h" #include "midictrl.h" +namespace MusECore { + // // Order of events: // Note, Poly Pressure, Control, AfterTouch, Pitch Bend, NRPN, RPN @@ -72,7 +74,7 @@ class MidiTransformation { QString comment; ValOp selEventOp; - EventType selType; + MusECore::EventType selType; ValOp selVal1; int selVal1a, selVal1b; @@ -84,7 +86,7 @@ class MidiTransformation { int selRangeA, selRangeB; TransformOperator procEvent; - EventType eventType; + MusECore::EventType eventType; TransformOperator procVal1; int procVal1a, procVal1b; TransformOperator procVal2; @@ -128,7 +130,7 @@ class MidiTransformation { procPos = Keep; procPosA = 0; funcOp = Select; - quantVal = MusEConfig::config.division; + quantVal = MusEGlobal::config.division; selectedTracks = false; insideLoop = false; } @@ -145,131 +147,7 @@ typedef std::list<MidiTransformation* > MidiTransformationList; typedef std::list<MidiTransformation* >::iterator iMidiTransformation; typedef std::list<MidiTransformation* >::const_iterator ciMidiTransformation; -static MidiTransformationList mtlist; - -//--------------------------------------------------------- -// MidiTransformDialog -// Widgets: -// presetList nameEntry commentEntry -// selEventOp selType -// selVal1Op selVal1a selVal1b -// selVal2Op selVal2a selVal2b -// selLenOp selLenA selLenB -// selRangeOp selBarA selBarB -// -// procEventOp procType -// procVal1Op procVal1a procVal1b -// procVal2Op procVal2a procVal2b -// procLenOp procLenA -// procPosOp procPosA -// funcOp funcQuantVal -// processAll selectedTracks insideLoop -// buttonNew buttonDelete buttonApply buttonOk -//--------------------------------------------------------- - -MidiTransformerDialog::MidiTransformerDialog(QDialog* parent, Qt::WFlags fl) - : QDialog(parent, fl) - { - setupUi(this); - data = new MidiTransformPrivate; - data->cmt = 0; - data->cindex = -1; - connect(buttonApply, SIGNAL(clicked()), SLOT(apply())); - connect(buttonNew, SIGNAL(clicked()), SLOT(presetNew())); - connect(buttonDelete, SIGNAL(clicked()), SLOT(presetDelete())); - connect(selEventOp, SIGNAL(activated(int)), SLOT(selEventOpSel(int))); - connect(selType, SIGNAL(activated(int)), SLOT(selTypeSel(int))); - connect(selVal1Op, SIGNAL(activated(int)), SLOT(selVal1OpSel(int))); - connect(selVal2Op, SIGNAL(activated(int)), SLOT(selVal2OpSel(int))); - connect(selLenOp, SIGNAL(activated(int)), SLOT(selLenOpSel(int))); - connect(selRangeOp, SIGNAL(activated(int)), SLOT(selRangeOpSel(int))); - connect(procEventOp, SIGNAL(activated(int)), SLOT(procEventOpSel(int))); - connect(procType, SIGNAL(activated(int)), SLOT(procEventTypeSel(int))); - connect(procVal1Op, SIGNAL(activated(int)), SLOT(procVal1OpSel(int))); - connect(procVal2Op, SIGNAL(activated(int)), SLOT(procVal2OpSel(int))); - connect(procLenOp, SIGNAL(activated(int)), SLOT(procLenOpSel(int))); - connect(procPosOp, SIGNAL(activated(int)), SLOT(procPosOpSel(int))); - connect(funcOp, SIGNAL(activated(int)), SLOT(funcOpSel(int))); - connect(funcQuantVal, SIGNAL(valueChanged(int)), SLOT(funcQuantValSel(int))); - connect(presetList, SIGNAL(itemClicked(QListWidgetItem*)), - SLOT(presetChanged(QListWidgetItem*))); - connect(nameEntry, SIGNAL(textChanged(const QString&)), - SLOT(nameChanged(const QString&))); - connect(commentEntry, SIGNAL(textChanged()), SLOT(commentChanged())); - - connect(selVal1a, SIGNAL(valueChanged(int)), SLOT(selVal1aChanged(int))); - connect(selVal1b, SIGNAL(valueChanged(int)), SLOT(selVal1bChanged(int))); - connect(selVal2a, SIGNAL(valueChanged(int)), SLOT(selVal2aChanged(int))); - connect(selVal2b, SIGNAL(valueChanged(int)), SLOT(selVal2bChanged(int))); - connect(selLenA, SIGNAL(valueChanged(int)), SLOT(selLenAChanged(int))); - connect(selLenB, SIGNAL(valueChanged(int)), SLOT(selLenBChanged(int))); - connect(selBarA, SIGNAL(valueChanged(int)), SLOT(selBarAChanged(int))); - connect(selBarB, SIGNAL(valueChanged(int)), SLOT(selBarBChanged(int))); - connect(procVal1a, SIGNAL(valueChanged(int)), SLOT(procVal1aChanged(int))); - connect(procVal1b, SIGNAL(valueChanged(int)), SLOT(procVal1bChanged(int))); - connect(procVal2a, SIGNAL(valueChanged(int)), SLOT(procVal2aChanged(int))); - connect(procVal2b, SIGNAL(valueChanged(int)), SLOT(procVal2bChanged(int))); - connect(procLenA, SIGNAL(valueChanged(int)), SLOT(procLenAChanged(int))); - connect(procPosA, SIGNAL(valueChanged(int)), SLOT(procPosAChanged(int))); - - connect(processAll, SIGNAL(toggled(bool)), SLOT(processAllChanged(bool))); - connect(selectedTracks, SIGNAL(toggled(bool)), SLOT(selectedTracksChanged(bool))); - connect(insideLoop, SIGNAL(toggled(bool)), SLOT(insideLoopChanged(bool))); - - //--------------------------------------------------- - // populate preset list - //--------------------------------------------------- - - updatePresetList(); - connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); - } - -//--------------------------------------------------------- -// ~MidiTransformDialog -//--------------------------------------------------------- - -MidiTransformerDialog::~MidiTransformerDialog() - { - delete data; - } - -//--------------------------------------------------------- -// songChanged -//--------------------------------------------------------- - -void MidiTransformerDialog::songChanged(int flags) -{ - // Whenever a song is loaded, flags is -1. Since transforms are part of configuration, - // use SC_CONFIG here, to filter unwanted song change events. - if(flags & SC_CONFIG) - updatePresetList(); -} - -//--------------------------------------------------------- -// updatePresetList -//--------------------------------------------------------- - -void MidiTransformerDialog::updatePresetList() -{ - data->cmt = 0; - data->cindex = 0; - presetList->clear(); - for (iMidiTransformation i = mtlist.begin(); i != mtlist.end(); ++i) { - presetList->addItem((*i)->name); - if (data->cmt == 0) - data->cmt = *i; - } - if (data->cmt == 0) { - data->cmt = new MidiTransformation(tr("New")); - mtlist.push_back(data->cmt); - presetList->addItem(tr("New")); - presetList->setCurrentItem(0); - } - - //data->cindex = 0; - //presetList->setCurrentItem(0); - -} +static MusECore::MidiTransformationList mtlist; //--------------------------------------------------------- // writeMidiTransforms @@ -466,6 +344,134 @@ void clearMidiTransforms() mtlist.clear(); } +} // namespace MusECore + +namespace MusEGui { + +//--------------------------------------------------------- +// MidiTransformDialog +// Widgets: +// presetList nameEntry commentEntry +// selEventOp selType +// selVal1Op selVal1a selVal1b +// selVal2Op selVal2a selVal2b +// selLenOp selLenA selLenB +// selRangeOp selBarA selBarB +// +// procEventOp procType +// procVal1Op procVal1a procVal1b +// procVal2Op procVal2a procVal2b +// procLenOp procLenA +// procPosOp procPosA +// funcOp funcQuantVal +// processAll selectedTracks insideLoop +// buttonNew buttonDelete buttonApply buttonOk +//--------------------------------------------------------- + +MidiTransformerDialog::MidiTransformerDialog(QDialog* parent, Qt::WFlags fl) + : QDialog(parent, fl) + { + setupUi(this); + data = new MusECore::MidiTransformPrivate; + data->cmt = 0; + data->cindex = -1; + connect(buttonApply, SIGNAL(clicked()), SLOT(apply())); + connect(buttonNew, SIGNAL(clicked()), SLOT(presetNew())); + connect(buttonDelete, SIGNAL(clicked()), SLOT(presetDelete())); + connect(selEventOp, SIGNAL(activated(int)), SLOT(selEventOpSel(int))); + connect(selType, SIGNAL(activated(int)), SLOT(selTypeSel(int))); + connect(selVal1Op, SIGNAL(activated(int)), SLOT(selVal1OpSel(int))); + connect(selVal2Op, SIGNAL(activated(int)), SLOT(selVal2OpSel(int))); + connect(selLenOp, SIGNAL(activated(int)), SLOT(selLenOpSel(int))); + connect(selRangeOp, SIGNAL(activated(int)), SLOT(selRangeOpSel(int))); + connect(procEventOp, SIGNAL(activated(int)), SLOT(procEventOpSel(int))); + connect(procType, SIGNAL(activated(int)), SLOT(procEventTypeSel(int))); + connect(procVal1Op, SIGNAL(activated(int)), SLOT(procVal1OpSel(int))); + connect(procVal2Op, SIGNAL(activated(int)), SLOT(procVal2OpSel(int))); + connect(procLenOp, SIGNAL(activated(int)), SLOT(procLenOpSel(int))); + connect(procPosOp, SIGNAL(activated(int)), SLOT(procPosOpSel(int))); + connect(funcOp, SIGNAL(activated(int)), SLOT(funcOpSel(int))); + connect(funcQuantVal, SIGNAL(valueChanged(int)), SLOT(funcQuantValSel(int))); + connect(presetList, SIGNAL(itemClicked(QListWidgetItem*)), + SLOT(presetChanged(QListWidgetItem*))); + connect(nameEntry, SIGNAL(textChanged(const QString&)), + SLOT(nameChanged(const QString&))); + connect(commentEntry, SIGNAL(textChanged()), SLOT(commentChanged())); + + connect(selVal1a, SIGNAL(valueChanged(int)), SLOT(selVal1aChanged(int))); + connect(selVal1b, SIGNAL(valueChanged(int)), SLOT(selVal1bChanged(int))); + connect(selVal2a, SIGNAL(valueChanged(int)), SLOT(selVal2aChanged(int))); + connect(selVal2b, SIGNAL(valueChanged(int)), SLOT(selVal2bChanged(int))); + connect(selLenA, SIGNAL(valueChanged(int)), SLOT(selLenAChanged(int))); + connect(selLenB, SIGNAL(valueChanged(int)), SLOT(selLenBChanged(int))); + connect(selBarA, SIGNAL(valueChanged(int)), SLOT(selBarAChanged(int))); + connect(selBarB, SIGNAL(valueChanged(int)), SLOT(selBarBChanged(int))); + connect(procVal1a, SIGNAL(valueChanged(int)), SLOT(procVal1aChanged(int))); + connect(procVal1b, SIGNAL(valueChanged(int)), SLOT(procVal1bChanged(int))); + connect(procVal2a, SIGNAL(valueChanged(int)), SLOT(procVal2aChanged(int))); + connect(procVal2b, SIGNAL(valueChanged(int)), SLOT(procVal2bChanged(int))); + connect(procLenA, SIGNAL(valueChanged(int)), SLOT(procLenAChanged(int))); + connect(procPosA, SIGNAL(valueChanged(int)), SLOT(procPosAChanged(int))); + + connect(processAll, SIGNAL(toggled(bool)), SLOT(processAllChanged(bool))); + connect(selectedTracks, SIGNAL(toggled(bool)), SLOT(selectedTracksChanged(bool))); + connect(insideLoop, SIGNAL(toggled(bool)), SLOT(insideLoopChanged(bool))); + + //--------------------------------------------------- + // populate preset list + //--------------------------------------------------- + + updatePresetList(); + connect(MusEGlobal::song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); + } + +//--------------------------------------------------------- +// ~MidiTransformDialog +//--------------------------------------------------------- + +MidiTransformerDialog::~MidiTransformerDialog() + { + delete data; + } + +//--------------------------------------------------------- +// songChanged +//--------------------------------------------------------- + +void MidiTransformerDialog::songChanged(int flags) +{ + // Whenever a song is loaded, flags is -1. Since transforms are part of configuration, + // use SC_CONFIG here, to filter unwanted song change events. + if(flags & SC_CONFIG) + updatePresetList(); +} + +//--------------------------------------------------------- +// updatePresetList +//--------------------------------------------------------- + +void MidiTransformerDialog::updatePresetList() +{ + data->cmt = 0; + data->cindex = 0; + presetList->clear(); + for (MusECore::iMidiTransformation i = MusECore::mtlist.begin(); i != MusECore::mtlist.end(); ++i) { + presetList->addItem((*i)->name); + if (data->cmt == 0) + data->cmt = *i; + } + if (data->cmt == 0) { + data->cmt = new MusECore::MidiTransformation(tr("New")); + MusECore::mtlist.push_back(data->cmt); + presetList->addItem(tr("New")); + presetList->setCurrentItem(0); + } + + //data->cindex = 0; + //presetList->setCurrentItem(0); + +} + //--------------------------------------------------------- // accept //--------------------------------------------------------- @@ -481,13 +487,13 @@ void MidiTransformerDialog::accept() // subfunction of processEvent() //--------------------------------------------------------- -void MidiTransformerDialog::transformEvent(Event& event, MidiPart* part, - MidiPart* newPart) +void MidiTransformerDialog::transformEvent(MusECore::Event& event, MusECore::MidiPart* part, + MusECore::MidiPart* newPart) { - MidiTransformation* cmt = data->cmt; - Event newEvent = event.clone(); + MusECore::MidiTransformation* cmt = data->cmt; + MusECore::Event newEvent = event.clone(); - if (cmt->procEvent != Keep) + if (cmt->procEvent != MusECore::Keep) newEvent.setType(cmt->eventType); //--------------------------------------------------- @@ -496,41 +502,41 @@ void MidiTransformerDialog::transformEvent(Event& event, MidiPart* part, int val = newEvent.dataA(); switch (cmt->procVal1) { - case Keep: + case MusECore::Keep: break; - case Plus: + case MusECore::Plus: val += cmt->procVal1a; break; - case Minus: + case MusECore::Minus: val -= cmt->procVal1a; break; - case Multiply: + case MusECore::Multiply: val = int(val * (cmt->procVal1a/100.0) + .5); break; - case Divide: + case MusECore::Divide: val = int(val / (cmt->procVal1a/100.0) + .5); break; - case Fix: + case MusECore::Fix: val = cmt->procVal1a; break; - case Value: + case MusECore::Value: val = cmt->procVal2a; break; - case Invert: + case MusECore::Invert: val = 128 - val; break; - case ScaleMap: + case MusECore::ScaleMap: printf("scale map not implemented\n"); break; - case Flip: + case MusECore::Flip: val = cmt->procVal1a - val; break; - case Dynamic: // "crescendo" + case MusECore::Dynamic: // "crescendo" val = (((cmt->procVal2b-cmt->procVal2a) - * (newEvent.tick() - song->lpos())) - / (song->rpos() - song->lpos())) + cmt->procVal2a; + * (newEvent.tick() - MusEGlobal::song->lpos())) + / (MusEGlobal::song->rpos() - MusEGlobal::song->lpos())) + cmt->procVal2a; break; - case Random: + case MusECore::Random: { int range = cmt->procVal1b - cmt->procVal1a; if (range > 0) @@ -554,33 +560,33 @@ void MidiTransformerDialog::transformEvent(Event& event, MidiPart* part, val = newEvent.dataB(); switch (cmt->procVal2) { - case Plus: + case MusECore::Plus: val += cmt->procVal2a; break; - case Minus: + case MusECore::Minus: val -= cmt->procVal2a; break; - case Multiply: + case MusECore::Multiply: val = int(val * (cmt->procVal2a/100.0) + .5); break; - case Divide: + case MusECore::Divide: val = int(val / (cmt->procVal2a/100.0) + .5); break; - case Fix: + case MusECore::Fix: val = cmt->procVal2a; break; - case Value: + case MusECore::Value: val = cmt->procVal1a; break; - case Invert: + case MusECore::Invert: val = 128 - val; break; - case Dynamic: + case MusECore::Dynamic: val = (((cmt->procVal2b-cmt->procVal2a) - * (newEvent.tick() - song->lpos())) - / (song->rpos() - song->lpos())) + cmt->procVal2a; + * (newEvent.tick() - MusEGlobal::song->lpos())) + / (MusEGlobal::song->rpos() - MusEGlobal::song->lpos())) + cmt->procVal2a; break; - case Random: + case MusECore::Random: { int range = cmt->procVal2b - cmt->procVal2a; if (range > 0) @@ -591,9 +597,9 @@ void MidiTransformerDialog::transformEvent(Event& event, MidiPart* part, val = cmt->procVal1a; } break; - case ScaleMap: - case Keep: - case Flip: + case MusECore::ScaleMap: + case MusECore::Keep: + case MusECore::Flip: break; } if (val < 0) @@ -608,28 +614,28 @@ void MidiTransformerDialog::transformEvent(Event& event, MidiPart* part, int len = newEvent.lenTick(); switch (cmt->procLen) { - case Plus: + case MusECore::Plus: len += cmt->procLenA; break; - case Minus: + case MusECore::Minus: len -= cmt->procLenA; break; - case Multiply: + case MusECore::Multiply: len = int(val * (cmt->procLenA/100.0) + .5); break; - case Divide: + case MusECore::Divide: len = int(val / (cmt->procLenA/100.0) + .5); break; - case Fix: + case MusECore::Fix: len = cmt->procLenA; break; - case Invert: - case ScaleMap: - case Dynamic: - case Random: - case Keep: - case Flip: - case Value: + case MusECore::Invert: + case MusECore::ScaleMap: + case MusECore::Dynamic: + case MusECore::Random: + case MusECore::Keep: + case MusECore::Flip: + case MusECore::Value: break; } if (len < 0) @@ -642,63 +648,63 @@ void MidiTransformerDialog::transformEvent(Event& event, MidiPart* part, int pos = newEvent.tick(); switch (cmt->procPos) { - case Plus: + case MusECore::Plus: pos += cmt->procPosA; break; - case Minus: + case MusECore::Minus: pos -= cmt->procPosA; break; - case Multiply: + case MusECore::Multiply: pos = int(val * (cmt->procPosA/100.0) + .5); break; - case Divide: + case MusECore::Divide: pos = int(val / (cmt->procPosA/100.0) + .5); break; - case Fix: - case Invert: - case ScaleMap: - case Dynamic: - case Random: - case Keep: - case Flip: - case Value: + case MusECore::Fix: + case MusECore::Invert: + case MusECore::ScaleMap: + case MusECore::Dynamic: + case MusECore::Random: + case MusECore::Keep: + case MusECore::Flip: + case MusECore::Value: break; } if (pos < 0) pos = 0; newEvent.setTick(pos); - Event dummy; + MusECore::Event dummy; switch(data->cmt->funcOp) { - case Transform: + case MusECore::Transform: // Indicate do clone parts. removePortCtrlEvents(event, part, true); - song->changeEvent(event, newEvent, part); + MusEGlobal::song->changeEvent(event, newEvent, part); // Indicate do clone parts. addPortCtrlEvents(newEvent, part, true); // Indicate do port controller values and clone parts. - //song->addUndo(UndoOp(UndoOp::ModifyEvent, newEvent, event, part)); - song->addUndo(UndoOp(UndoOp::ModifyEvent, newEvent, event, part, true, true)); - song->addUpdateFlags(SC_EVENT_MODIFIED); + //MusEGlobal::song->addUndo(MusECore::UndoOp(MusECore::UndoOp::ModifyEvent, newEvent, event, part)); + MusEGlobal::song->addUndo(MusECore::UndoOp(MusECore::UndoOp::ModifyEvent, newEvent, event, part, true, true)); + MusEGlobal::song->addUpdateFlags(SC_EVENT_MODIFIED); break; - case Insert: + case MusECore::Insert: // Indicate do port controller values and clone parts. - //song->addUndo(UndoOp(UndoOp::AddEvent, dummy, newEvent, part)); - song->addUndo(UndoOp(UndoOp::AddEvent, dummy, newEvent, part, true, true)); - song->addEvent(newEvent, part); + //MusEGlobal::song->addUndo(MusECore::UndoOp(MusECore::UndoOp::AddEvent, dummy, newEvent, part)); + MusEGlobal::song->addUndo(MusECore::UndoOp(MusECore::UndoOp::AddEvent, dummy, newEvent, part, true, true)); + MusEGlobal::song->addEvent(newEvent, part); // Indicate do clone parts. addPortCtrlEvents(newEvent, part, true); - song->addUpdateFlags(SC_EVENT_INSERTED); + MusEGlobal::song->addUpdateFlags(SC_EVENT_INSERTED); break; - case Extract: + case MusECore::Extract: // Indicate do port controller values and clone parts. - //song->addUndo(UndoOp(UndoOp::DeleteEvent, dummy, event, part)); - song->addUndo(UndoOp(UndoOp::DeleteEvent, dummy, event, part, true, true)); + //MusEGlobal::song->addUndo(MusECore::UndoOp(MusECore::UndoOp::DeleteEvent, dummy, event, part)); + MusEGlobal::song->addUndo(MusECore::UndoOp(MusECore::UndoOp::DeleteEvent, dummy, event, part, true, true)); // Indicate do clone parts. removePortCtrlEvents(event, part, true); - song->deleteEvent(event, part); - song->addUpdateFlags(SC_EVENT_REMOVED); - case Copy: + MusEGlobal::song->deleteEvent(event, part); + MusEGlobal::song->addUpdateFlags(SC_EVENT_REMOVED); + case MusECore::Copy: newPart->addEvent(newEvent); break; default: @@ -710,46 +716,46 @@ void MidiTransformerDialog::transformEvent(Event& event, MidiPart* part, // processEvent //--------------------------------------------------------- -void MidiTransformerDialog::processEvent(Event& event, MidiPart* part, MidiPart* newPart) +void MidiTransformerDialog::processEvent(MusECore::Event& event, MusECore::MidiPart* part, MusECore::MidiPart* newPart) { switch(data->cmt->funcOp) { - case Select: + case MusECore::Select: break; - case Quantize: + case MusECore::Quantize: { int tick = event.tick(); int rt = AL::sigmap.raster(tick, data->cmt->quantVal) - tick; if (tick != rt) { // Indicate do clone parts. removePortCtrlEvents(event, part, true); - Event newEvent = event.clone(); + MusECore::Event newEvent = event.clone(); newEvent.setTick(rt); - song->changeEvent(event, newEvent, part); + MusEGlobal::song->changeEvent(event, newEvent, part); // Indicate do clone parts. addPortCtrlEvents(newEvent, part, true); // Indicate do port controller values and clone parts. - //song->addUndo(UndoOp(UndoOp::ModifyEvent, newEvent, event, part)); - song->addUndo(UndoOp(UndoOp::ModifyEvent, newEvent, event, part, true, true)); - song->addUpdateFlags(SC_EVENT_MODIFIED); + //MusEGlobal::song->addUndo(MusECore::UndoOp(MusECore::UndoOp::ModifyEvent, newEvent, event, part)); + MusEGlobal::song->addUndo(MusECore::UndoOp(MusECore::UndoOp::ModifyEvent, newEvent, event, part, true, true)); + MusEGlobal::song->addUpdateFlags(SC_EVENT_MODIFIED); } } break; - case Delete: + case MusECore::Delete: { - Event ev; + MusECore::Event ev; // Indicate do port controller values and clone parts. - //song->addUndo(UndoOp(UndoOp::DeleteEvent, ev, event, part, true, true)); - song->addUndo(UndoOp(UndoOp::DeleteEvent, ev, event, part, true, true)); + //MusEGlobal::song->addUndo(MusECore::UndoOp(MusECore::UndoOp::DeleteEvent, ev, event, part, true, true)); + MusEGlobal::song->addUndo(MusECore::UndoOp(MusECore::UndoOp::DeleteEvent, ev, event, part, true, true)); // Indicate do clone parts. removePortCtrlEvents(event, part, true); - song->deleteEvent(event, part); - song->addUpdateFlags(SC_EVENT_REMOVED); + MusEGlobal::song->deleteEvent(event, part); + MusEGlobal::song->addUpdateFlags(SC_EVENT_REMOVED); } break; - case Transform: - case Insert: - case Copy: - case Extract: + case MusECore::Transform: + case MusECore::Insert: + case MusECore::Copy: + case MusECore::Extract: transformEvent(event, part, newPart); break; } @@ -761,17 +767,17 @@ void MidiTransformerDialog::processEvent(Event& event, MidiPart* part, MidiPart* // return true if event is selected //--------------------------------------------------------- -bool MidiTransformerDialog::isSelected(Event& event, MidiPart*) +bool MidiTransformerDialog::isSelected(MusECore::Event& event, MusECore::MidiPart*) { - MidiTransformation* cmt = data->cmt; + MusECore::MidiTransformation* cmt = data->cmt; switch (cmt->selEventOp) { - case Equal: + case MusECore::Equal: if (!typesMatch(event, cmt->selType)) { return false; } break; - case Unequal: + case MusECore::Unequal: if (typesMatch(event, cmt->selType)) return false; break; @@ -779,60 +785,60 @@ bool MidiTransformerDialog::isSelected(Event& event, MidiPart*) break; } switch (cmt->selVal1) { - case Ignore: + case MusECore::Ignore: break; - case Equal: + case MusECore::Equal: if (event.dataA() != cmt->selVal1a) return false; break; - case Unequal: + case MusECore::Unequal: if (event.dataA() == cmt->selVal1a) return false; break; - case Higher: + case MusECore::Higher: if (event.dataA() <= cmt->selVal1a) return false; break; - case Lower: + case MusECore::Lower: if (event.dataA() >= cmt->selVal1a) return false; break; - case Inside: + case MusECore::Inside: if ((event.dataA() < cmt->selVal1a) || (event.dataA() >= cmt->selVal1b)) return false; break; - case Outside: + case MusECore::Outside: if ((event.dataA() >= cmt->selVal1a) && (event.dataA() < cmt->selVal1b)) return false; break; } switch (cmt->selVal2) { - case Ignore: + case MusECore::Ignore: break; - case Equal: + case MusECore::Equal: if (event.dataB() != cmt->selVal2a) return false; break; - case Unequal: + case MusECore::Unequal: if (event.dataB() == cmt->selVal2a) return false; break; - case Higher: + case MusECore::Higher: if (event.dataB() <= cmt->selVal2a) return false; break; - case Lower: + case MusECore::Lower: if (event.dataB() >= cmt->selVal2a) return false; break; - case Inside: + case MusECore::Inside: if ((event.dataB() < cmt->selVal2a) || (event.dataB() >= cmt->selVal2b)) return false; break; - case Outside: + case MusECore::Outside: if ((event.dataB() >= cmt->selVal2a) && (event.dataB() < cmt->selVal2b)) return false; @@ -840,29 +846,29 @@ bool MidiTransformerDialog::isSelected(Event& event, MidiPart*) } int len = event.lenTick(); switch (cmt->selLen) { - case Ignore: + case MusECore::Ignore: break; - case Equal: + case MusECore::Equal: if (len != cmt->selLenA) return false; break; - case Unequal: + case MusECore::Unequal: if (len == cmt->selLenA) return false; break; - case Higher: + case MusECore::Higher: if (len <= cmt->selLenA) return false; break; - case Lower: + case MusECore::Lower: if (len >= cmt->selLenA) return false; break; - case Inside: + case MusECore::Inside: if ((len < cmt->selLenA) || (len >= cmt->selLenB)) return false; break; - case Outside: + case MusECore::Outside: if ((len >= cmt->selLenA) && (len < cmt->selLenB)) return false; break; @@ -875,29 +881,29 @@ bool MidiTransformerDialog::isSelected(Event& event, MidiPart*) int beat2 = cmt->selRangeB / 1000; unsigned tick2 = cmt->selRangeB % 1000; switch (cmt->selRange) { - case Ignore: + case MusECore::Ignore: break; - case Equal: + case MusECore::Equal: if (beat != beat1 || tick != tick1) return false; break; - case Unequal: + case MusECore::Unequal: if (beat == beat1 && tick == tick1) return false; break; - case Higher: + case MusECore::Higher: if (beat <= beat1) return false; if (beat == beat1 && tick <= tick1) return false; break; - case Lower: + case MusECore::Lower: if (beat >= beat1) return false; if (beat == beat1 && tick >= tick1) return false; break; - case Inside: + case MusECore::Inside: if ((beat < beat1) || (beat >= beat2)) return false; if (beat == beat1 && tick < tick1) @@ -905,7 +911,7 @@ bool MidiTransformerDialog::isSelected(Event& event, MidiPart*) if (beat == beat2 && tick >= tick2) return false; break; - case Outside: + case MusECore::Outside: if ((beat >= beat1) || (beat < beat2)) return false; if (beat == beat1 && tick >= tick1) @@ -924,27 +930,27 @@ bool MidiTransformerDialog::isSelected(Event& event, MidiPart*) void MidiTransformerDialog::apply() { int flags = 0; - song->startUndo(); - audio->msgIdle(true); - bool copyExtract = (data->cmt->funcOp == Copy) - || (data->cmt->funcOp == Extract); + MusEGlobal::song->startUndo(); + MusEGlobal::audio->msgIdle(true); + bool copyExtract = (data->cmt->funcOp == MusECore::Copy) + || (data->cmt->funcOp == MusECore::Extract); - std::vector< EventList* > doneList; - typedef std::vector< EventList* >::iterator iDoneList; + std::vector< MusECore::EventList* > doneList; + typedef std::vector< MusECore::EventList* >::iterator iDoneList; iDoneList idl; - MidiTrackList* tracks = song->midis(); - MidiTrackList tl; - for (iMidiTrack t = tracks->begin(); t != tracks->end(); ++t) { + MusECore::MidiTrackList* tracks = MusEGlobal::song->midis(); + MusECore::MidiTrackList tl; + for (MusECore::iMidiTrack t = tracks->begin(); t != tracks->end(); ++t) { if (data->cmt->selectedTracks && !(*t)->selected()) continue; - MidiTrack* newTrack = 0; - PartList *pl = (*t)->parts(); + MusECore::MidiTrack* newTrack = 0; + MusECore::PartList *pl = (*t)->parts(); if (copyExtract) { // check wether we must generate a new track - for (iPart p = pl->begin(); p != pl->end(); ++p) { - MidiPart* part = (MidiPart *) p->second; - EventList* el = part->events(); + for (MusECore::iPart p = pl->begin(); p != pl->end(); ++p) { + MusECore::MidiPart* part = (MusECore::MidiPart *) p->second; + MusECore::EventList* el = part->events(); // Check if the event list has already been done. Skip repeated clones. for(idl = doneList.begin(); idl != doneList.end(); ++idl) if(*idl == el) @@ -953,13 +959,13 @@ void MidiTransformerDialog::apply() break; doneList.push_back(el); - for (iEvent i = el->begin(); i != el->end(); ++i) { - Event event = i->second; + for (MusECore::iEvent i = el->begin(); i != el->end(); ++i) { + MusECore::Event event = i->second; unsigned tick = event.tick(); - if (data->cmt->insideLoop && (tick < song->lpos() || tick >= song->rpos())) + if (data->cmt->insideLoop && (tick < MusEGlobal::song->lpos() || tick >= MusEGlobal::song->rpos())) continue; if (isSelected(event, part)) { - newTrack = new MidiTrack(); + newTrack = new MusECore::MidiTrack(); tl.push_back(newTrack); break; } @@ -969,10 +975,10 @@ void MidiTransformerDialog::apply() } } - for (iPart p = pl->begin(); p != pl->end(); ++p) { - MidiPart* part = (MidiPart *) p->second; - MidiPart* newPart = 0; - EventList* el = part->events(); + for (MusECore::iPart p = pl->begin(); p != pl->end(); ++p) { + MusECore::MidiPart* part = (MusECore::MidiPart *) p->second; + MusECore::MidiPart* newPart = 0; + MusECore::EventList* el = part->events(); // Check if the event list has already been done. Skip repeated clones. for(idl = doneList.begin(); idl != doneList.end(); ++idl) if(*idl == el) @@ -983,93 +989,93 @@ void MidiTransformerDialog::apply() if (copyExtract) { // check wether we must generate a new part - for (iEvent i = el->begin(); i != el->end(); ++i) { - Event event = i->second; + for (MusECore::iEvent i = el->begin(); i != el->end(); ++i) { + MusECore::Event event = i->second; unsigned tick = event.tick(); - if (data->cmt->insideLoop && (tick < song->lpos() || tick >= song->rpos())) + if (data->cmt->insideLoop && (tick < MusEGlobal::song->lpos() || tick >= MusEGlobal::song->rpos())) continue; if (isSelected(event, part)) { - newPart = new MidiPart(newTrack); + newPart = new MusECore::MidiPart(newTrack); newPart->setName(part->name()); newPart->setColorIndex(part->colorIndex()); newPart->setTick(part->tick()); newPart->setLenTick(part->lenTick()); - song->addPart(newPart); + MusEGlobal::song->addPart(newPart); flags |= SC_PART_INSERTED; break; } } } - EventList pel; - for (iEvent i = el->begin(); i != el->end(); ++i) { - Event event = i->second; + MusECore::EventList pel; + for (MusECore::iEvent i = el->begin(); i != el->end(); ++i) { + MusECore::Event event = i->second; unsigned tick = event.tick(); - if (data->cmt->insideLoop && (tick < song->lpos() || tick >= song->rpos())) + if (data->cmt->insideLoop && (tick < MusEGlobal::song->lpos() || tick >= MusEGlobal::song->rpos())) continue; int flag = isSelected(event, part); - if (data->cmt->funcOp == Select) + if (data->cmt->funcOp == MusECore::Select) event.setSelected(flag); else if (flag) pel.add(event); } - for (iEvent i = pel.begin(); i != pel.end(); ++i) { - Event event = i->second; + for (MusECore::iEvent i = pel.begin(); i != pel.end(); ++i) { + MusECore::Event event = i->second; processEvent(event, part, newPart); } } } if (!tl.empty()) { flags |= SC_TRACK_INSERTED; - for (iTrack t = tl.begin(); t != tl.end(); ++t) { - song->insertTrack0(*t, -1); + for (MusECore::iTrack t = tl.begin(); t != tl.end(); ++t) { + MusEGlobal::song->insertTrack0(*t, -1); } } switch(data->cmt->funcOp) { - case Select: + case MusECore::Select: flags |= SC_SELECTION; break; - case Quantize: + case MusECore::Quantize: flags |= SC_EVENT_MODIFIED; break; - case Delete: + case MusECore::Delete: flags |= SC_EVENT_REMOVED; break; - case Transform: + case MusECore::Transform: flags |= SC_EVENT_MODIFIED; break; - case Insert: + case MusECore::Insert: flags |= SC_EVENT_INSERTED; break; - case Copy: + case MusECore::Copy: flags |= SC_EVENT_INSERTED; - case Extract: + case MusECore::Extract: break; } - audio->msgIdle(false); - song->endUndo(flags); + MusEGlobal::audio->msgIdle(false); + MusEGlobal::song->endUndo(flags); } //--------------------------------------------------------- // setValOp //--------------------------------------------------------- -void MidiTransformerDialog::setValOp(QWidget* a, QWidget* b, ValOp op) +void MidiTransformerDialog::setValOp(QWidget* a, QWidget* b, MusECore::ValOp op) { switch (op) { - case Ignore: + case MusECore::Ignore: a->setEnabled(false); b->setEnabled(false); break; - case Equal: - case Unequal: - case Higher: - case Lower: + case MusECore::Equal: + case MusECore::Unequal: + case MusECore::Higher: + case MusECore::Lower: a->setEnabled(true); b->setEnabled(false); break; - case Inside: - case Outside: + case MusECore::Inside: + case MusECore::Outside: a->setEnabled(true); b->setEnabled(true); break; @@ -1082,8 +1088,8 @@ void MidiTransformerDialog::setValOp(QWidget* a, QWidget* b, ValOp op) void MidiTransformerDialog::selEventOpSel(int val) { - selType->setEnabled(val != All); - data->cmt->selEventOp = ValOp(val); + selType->setEnabled(val != MusECore::All); + data->cmt->selEventOp = MusECore::ValOp(val); selVal1aChanged(data->cmt->selVal1a); selVal1bChanged(data->cmt->selVal1b); } @@ -1094,7 +1100,7 @@ void MidiTransformerDialog::selEventOpSel(int val) void MidiTransformerDialog::selTypeSel(int val) { - data->cmt->selType = EventType(eventTypeTable[val]); + data->cmt->selType = MusECore::EventType(MusECore::eventTypeTable[val]); selVal1aChanged(data->cmt->selVal1a); selVal1bChanged(data->cmt->selVal1b); } @@ -1105,8 +1111,8 @@ void MidiTransformerDialog::selTypeSel(int val) void MidiTransformerDialog::selVal1OpSel(int val) { - setValOp(selVal1a, selVal1b, ValOp(val)); - data->cmt->selVal1 = ValOp(val); + setValOp(selVal1a, selVal1b, MusECore::ValOp(val)); + data->cmt->selVal1 = MusECore::ValOp(val); } //--------------------------------------------------------- @@ -1115,8 +1121,8 @@ void MidiTransformerDialog::selVal1OpSel(int val) void MidiTransformerDialog::selVal2OpSel(int val) { - setValOp(selVal2a, selVal2b, ValOp(val)); - data->cmt->selVal2 = ValOp(val); + setValOp(selVal2a, selVal2b, MusECore::ValOp(val)); + data->cmt->selVal2 = MusECore::ValOp(val); } //--------------------------------------------------------- @@ -1125,8 +1131,8 @@ void MidiTransformerDialog::selVal2OpSel(int val) void MidiTransformerDialog::selLenOpSel(int val) { - setValOp(selLenA, selLenB, ValOp(val)); - data->cmt->selLen = ValOp(val); + setValOp(selLenA, selLenB, MusECore::ValOp(val)); + data->cmt->selLen = MusECore::ValOp(val); } //--------------------------------------------------------- @@ -1135,8 +1141,8 @@ void MidiTransformerDialog::selLenOpSel(int val) void MidiTransformerDialog::selRangeOpSel(int val) { - setValOp(selBarA, selBarB, ValOp(val)); - data->cmt->selRange = ValOp(val); + setValOp(selBarA, selBarB, MusECore::ValOp(val)); + data->cmt->selRange = MusECore::ValOp(val); } //--------------------------------------------------------- @@ -1145,8 +1151,8 @@ void MidiTransformerDialog::selRangeOpSel(int val) void MidiTransformerDialog::procEventOpSel(int val) { - TransformOperator op = val == 0 ? Keep : Fix; - procType->setEnabled(op == Fix); + MusECore::TransformOperator op = val == 0 ? MusECore::Keep : MusECore::Fix; + procType->setEnabled(op == MusECore::Fix); data->cmt->procEvent = op; procVal1aChanged(data->cmt->procVal1a); @@ -1159,7 +1165,7 @@ void MidiTransformerDialog::procEventOpSel(int val) void MidiTransformerDialog::procEventTypeSel(int val) { - data->cmt->eventType = EventType(eventTypeTable[val]); + data->cmt->eventType = MusECore::EventType(MusECore::eventTypeTable[val]); procVal1aChanged(data->cmt->procVal1a); procVal1bChanged(data->cmt->procVal1b); } @@ -1170,31 +1176,31 @@ void MidiTransformerDialog::procEventTypeSel(int val) void MidiTransformerDialog::procVal1OpSel(int val) { - data->cmt->procVal1 = TransformOperator(val); - switch(TransformOperator(val)) { - case Keep: - case Invert: + data->cmt->procVal1 = MusECore::TransformOperator(val); + switch(MusECore::TransformOperator(val)) { + case MusECore::Keep: + case MusECore::Invert: procVal1a->setEnabled(false); procVal1b->setEnabled(false); break; - case Multiply: - case Divide: + case MusECore::Multiply: + case MusECore::Divide: procVal1a->setEnabled(true); procVal1a->setDecimals(2); procVal1b->setEnabled(false); break; - case Plus: - case Minus: - case Fix: - case Value: - case Flip: + case MusECore::Plus: + case MusECore::Minus: + case MusECore::Fix: + case MusECore::Value: + case MusECore::Flip: procVal1a->setDecimals(0); procVal1a->setEnabled(true); procVal1b->setEnabled(false); break; - case Random: - case ScaleMap: - case Dynamic: + case MusECore::Random: + case MusECore::ScaleMap: + case MusECore::Dynamic: procVal1a->setDecimals(0); procVal1a->setEnabled(true); procVal1b->setEnabled(true); @@ -1210,31 +1216,31 @@ void MidiTransformerDialog::procVal1OpSel(int val) void MidiTransformerDialog::procVal2OpSel(int val) { - TransformOperator op = TransformOperator(procVal2Map[val]); + MusECore::TransformOperator op = MusECore::TransformOperator(MusECore::procVal2Map[val]); data->cmt->procVal2 = op; switch (op) { - case Keep: - case Invert: + case MusECore::Keep: + case MusECore::Invert: procVal2a->setEnabled(false); procVal2b->setEnabled(false); break; - case Multiply: - case Divide: + case MusECore::Multiply: + case MusECore::Divide: procVal2a->setEnabled(true); procVal2a->setDecimals(2); procVal2b->setEnabled(false); break; - case Plus: - case Minus: - case Fix: - case Value: + case MusECore::Plus: + case MusECore::Minus: + case MusECore::Fix: + case MusECore::Value: procVal2a->setDecimals(0); procVal2a->setEnabled(true); procVal2b->setEnabled(false); break; - case Random: - case Dynamic: + case MusECore::Random: + case MusECore::Dynamic: procVal2a->setDecimals(0); procVal2a->setEnabled(true); procVal2b->setEnabled(true); @@ -1250,22 +1256,22 @@ void MidiTransformerDialog::procVal2OpSel(int val) void MidiTransformerDialog::procLenOpSel(int val) { - TransformOperator op = TransformOperator(val); + MusECore::TransformOperator op = MusECore::TransformOperator(val); data->cmt->procLen = op; switch (op) { - case Keep: - case Invert: + case MusECore::Keep: + case MusECore::Invert: procLenA->setEnabled(false); break; - case Plus: - case Minus: - case Fix: + case MusECore::Plus: + case MusECore::Minus: + case MusECore::Fix: procLenA->setDecimals(0); procLenA->setEnabled(true); break; - case Multiply: - case Divide: + case MusECore::Multiply: + case MusECore::Divide: procLenA->setDecimals(2); procLenA->setEnabled(true); break; @@ -1280,21 +1286,21 @@ void MidiTransformerDialog::procLenOpSel(int val) void MidiTransformerDialog::procPosOpSel(int val) { - TransformOperator op = TransformOperator(val); + MusECore::TransformOperator op = MusECore::TransformOperator(val); data->cmt->procPos = op; switch (op) { - case Keep: - case Invert: + case MusECore::Keep: + case MusECore::Invert: procPosA->setEnabled(false); break; - case Multiply: - case Divide: + case MusECore::Multiply: + case MusECore::Divide: procPosA->setDecimals(2); procPosA->setEnabled(true); break; - case Plus: - case Minus: + case MusECore::Plus: + case MusECore::Minus: procPosA->setDecimals(0); procPosA->setEnabled(true); break; @@ -1309,8 +1315,8 @@ void MidiTransformerDialog::procPosOpSel(int val) void MidiTransformerDialog::funcOpSel(int val) { - funcQuantVal->setEnabled(val == Quantize); - bool isFuncOp = val == Transform || val == Insert; + funcQuantVal->setEnabled(val == MusECore::Quantize); + bool isFuncOp = val == MusECore::Transform || val == MusECore::Insert; procEventOp->setEnabled(isFuncOp); procType->setEnabled(isFuncOp); @@ -1331,7 +1337,7 @@ void MidiTransformerDialog::funcOpSel(int val) procLenOpSel(data->cmt->procLen); procPosOpSel(data->cmt->procPos); } - data->cmt->funcOp = TransformFunction(val); + data->cmt->funcOp = MusECore::TransformFunction(val); } //--------------------------------------------------------- @@ -1343,18 +1349,18 @@ void MidiTransformerDialog::presetNew() QString name; for (int i = 0;; ++i) { name.sprintf("New-%d", i); - iMidiTransformation imt; - for (imt = mtlist.begin(); imt != mtlist.end(); ++imt) { + MusECore::iMidiTransformation imt; + for (imt = MusECore::mtlist.begin(); imt != MusECore::mtlist.end(); ++imt) { if (name == (*imt)->name) break; } - if (imt == mtlist.end()) + if (imt == MusECore::mtlist.end()) break; } - MidiTransformation* mt = new MidiTransformation(name); + MusECore::MidiTransformation* mt = new MusECore::MidiTransformation(name); QListWidgetItem* lbi = new QListWidgetItem(name); presetList->addItem(lbi); - mtlist.push_back(mt); + MusECore::mtlist.push_back(mt); presetList->setCurrentItem(lbi); presetChanged(lbi); } @@ -1366,9 +1372,9 @@ void MidiTransformerDialog::presetNew() void MidiTransformerDialog::presetDelete() { if (data->cindex != -1) { - iMidiTransformation mt = mtlist.begin(); + MusECore::iMidiTransformation mt = MusECore::mtlist.begin(); for (int i = 0; i < data->cindex; ++i, ++mt) { - mtlist.erase(mt); + MusECore::mtlist.erase(mt); presetList->setCurrentItem(presetList->item(data->cindex - 1)); presetList->takeItem(data->cindex); presetChanged(presetList->item(data->cindex - 1)); @@ -1384,14 +1390,14 @@ void MidiTransformerDialog::presetDelete() void MidiTransformerDialog::presetChanged(QListWidgetItem* item) { data->cindex = presetList->row(item); - iMidiTransformation i; - for (i = mtlist.begin(); i != mtlist.end(); ++i) { + MusECore::iMidiTransformation i; + for (i = MusECore::mtlist.begin(); i != MusECore::mtlist.end(); ++i) { if (item->text() == (*i)->name) { data->cmt = *i; break; } } - if (i == mtlist.end()) { + if (i == MusECore::mtlist.end()) { printf("MidiTransformerDialog::presetChanged: not found\n"); return; } @@ -1401,8 +1407,8 @@ void MidiTransformerDialog::presetChanged(QListWidgetItem* item) selEventOp->setCurrentIndex(data->cmt->selEventOp); selEventOpSel(data->cmt->selEventOp); - for (unsigned i = 0; i < sizeof(eventTypeTable)/sizeof(*eventTypeTable); ++i) { - if (eventTypeTable[i] == data->cmt->selType) { + for (unsigned i = 0; i < sizeof(MusECore::eventTypeTable)/sizeof(*MusECore::eventTypeTable); ++i) { + if (MusECore::eventTypeTable[i] == data->cmt->selType) { selType->setCurrentIndex(i); break; } @@ -1423,16 +1429,16 @@ void MidiTransformerDialog::presetChanged(QListWidgetItem* item) funcOp->setCurrentIndex(data->cmt->funcOp); funcOpSel(data->cmt->funcOp); - // TransformOperator procEvent: Keep, Fix - procEventOp->setCurrentIndex(data->cmt->procEvent == Fix); + // MusECore::TransformOperator procEvent: MusECore::Keep, MusECore::Fix + procEventOp->setCurrentIndex(data->cmt->procEvent == MusECore::Fix); procEventOpSel(data->cmt->procEvent); procVal1Op->setCurrentIndex(data->cmt->procVal1); procVal1OpSel(data->cmt->procVal1); - for (unsigned i = 0; i < sizeof(procVal2Map)/sizeof(*procVal2Map); ++i) { - if (procVal2Map[i] == data->cmt->procVal2) { + for (unsigned i = 0; i < sizeof(MusECore::procVal2Map)/sizeof(*MusECore::procVal2Map); ++i) { + if (MusECore::procVal2Map[i] == data->cmt->procVal2) { procVal2Op->setCurrentIndex(i); break; } @@ -1500,9 +1506,9 @@ void MidiTransformerDialog::commentChanged() void MidiTransformerDialog::selVal1aChanged(int val) { data->cmt->selVal1a = val; - if ((data->cmt->selEventOp != All) - && (data->cmt->selType == Note)) { - selVal1a->setSuffix(" - " + MusEUtil::pitch2string(val)); + if ((data->cmt->selEventOp != MusECore::All) + && (data->cmt->selType == MusECore::Note)) { + selVal1a->setSuffix(" - " + MusECore::pitch2string(val)); } else { @@ -1518,9 +1524,9 @@ void MidiTransformerDialog::selVal1aChanged(int val) void MidiTransformerDialog::selVal1bChanged(int val) { data->cmt->selVal1b = val; - if ((data->cmt->selEventOp != All) - && (data->cmt->selType == Note)) { - selVal1b->setSuffix(" - " + MusEUtil::pitch2string(val)); + if ((data->cmt->selEventOp != MusECore::All) + && (data->cmt->selType == MusECore::Note)) { + selVal1b->setSuffix(" - " + MusECore::pitch2string(val)); } else { @@ -1591,11 +1597,11 @@ void MidiTransformerDialog::procVal1aChanged(int val) { data->cmt->procVal1a = val; - if((data->cmt->procEvent == Keep && data->cmt->selType == MIDITRANSFORM_NOTE) && - (data->cmt->procVal1 == Fix || data->cmt->procVal1 == ScaleMap || data->cmt->procVal1 == Dynamic || - data->cmt->procVal1 == Random || data->cmt->procVal1 == Flip)) + if((data->cmt->procEvent == MusECore::Keep && data->cmt->selType == MIDITRANSFORM_NOTE) && + (data->cmt->procVal1 == MusECore::Fix || data->cmt->procVal1 == MusECore::ScaleMap || data->cmt->procVal1 == MusECore::Dynamic || + data->cmt->procVal1 == MusECore::Random || data->cmt->procVal1 == MusECore::Flip)) { - procVal1a->setSuffix(" - " + MusEUtil::pitch2string(val)); + procVal1a->setSuffix(" - " + MusECore::pitch2string(val)); } else { @@ -1613,11 +1619,11 @@ void MidiTransformerDialog::procVal1bChanged(int val) { data->cmt->procVal1b = val; - if((data->cmt->procEvent == Keep && data->cmt->selType == MIDITRANSFORM_NOTE) && - (data->cmt->procVal1 == Fix || data->cmt->procVal1 == ScaleMap || data->cmt->procVal1 == Dynamic || - data->cmt->procVal1 == Random || data->cmt->procVal1 == Flip)) + if((data->cmt->procEvent == MusECore::Keep && data->cmt->selType == MIDITRANSFORM_NOTE) && + (data->cmt->procVal1 == MusECore::Fix || data->cmt->procVal1 == MusECore::ScaleMap || data->cmt->procVal1 == MusECore::Dynamic || + data->cmt->procVal1 == MusECore::Random || data->cmt->procVal1 == MusECore::Flip)) { - procVal1b->setSuffix(" - " + MusEUtil::pitch2string(val)); + procVal1b->setSuffix(" - " + MusECore::pitch2string(val)); } else { @@ -1708,45 +1714,45 @@ void MidiTransformerDialog::insideLoopChanged(bool val) /*! - \fn MidiTransformerDialog::typesMatch(MidiEvent e, unsigned t) + \fn MidiTransformerDialog::typesMatch(MusECore::MidiEvent e, unsigned t) */ -bool MidiTransformerDialog::typesMatch(Event& e, unsigned selType) +bool MidiTransformerDialog::typesMatch(MusECore::Event& e, unsigned selType) { bool matched = false; switch (selType) { case MIDITRANSFORM_NOTE: - matched = (e.type() == Note); + matched = (e.type() == MusECore::Note); break; case MIDITRANSFORM_POLY: - matched = (e.type() == PAfter); + matched = (e.type() == MusECore::PAfter); break; case MIDITRANSFORM_CTRL: - matched = (e.type() == Controller); + matched = (e.type() == MusECore::Controller); break; case MIDITRANSFORM_ATOUCH: - matched = (e.type() == CAfter); + matched = (e.type() == MusECore::CAfter); break; case MIDITRANSFORM_PITCHBEND: { - if (e.type() == Controller) { - MidiController::ControllerType c = midiControllerType(e.dataA()); - matched = (c == MidiController::Pitch); + if (e.type() == MusECore::Controller) { + MusECore::MidiController::ControllerType c = MusECore::midiControllerType(e.dataA()); + matched = (c == MusECore::MidiController::Pitch); } break; } case MIDITRANSFORM_NRPN: { - if (e.type() == Controller) { - MidiController::ControllerType c = midiControllerType(e.dataA()); - matched = (c == MidiController::NRPN); + if (e.type() == MusECore::Controller) { + MusECore::MidiController::ControllerType c = MusECore::midiControllerType(e.dataA()); + matched = (c == MusECore::MidiController::NRPN); } } case MIDITRANSFORM_RPN: { - if (e.type() == Controller) { - MidiController::ControllerType c = midiControllerType(e.dataA()); - matched = (c == MidiController::RPN); + if (e.type() == MusECore::Controller) { + MusECore::MidiController::ControllerType c = MusECore::midiControllerType(e.dataA()); + matched = (c == MusECore::MidiController::RPN); } } default: @@ -1756,3 +1762,5 @@ bool MidiTransformerDialog::typesMatch(Event& e, unsigned selType) //printf("Event type=%d, selType =%d matched=%d\n", e.type(), selType, matched); return matched; } + +} // namespace MusEGui diff --git a/muse2/muse/miditransform.h b/muse2/muse/miditransform.h index c0d69fe3..38b0211a 100644 --- a/muse2/muse/miditransform.h +++ b/muse2/muse/miditransform.h @@ -28,10 +28,13 @@ class QListWidgetItem; class QDialog; -class MidiTransformation; -class MidiTransformPrivate; + +namespace MusECore { + class Event; class MidiPart; +class MidiTransformation; +class MidiTransformPrivate; class Xml; enum ValOp { @@ -48,21 +51,29 @@ enum TransformOperator { ScaleMap, Flip, Dynamic, Random }; +extern void writeMidiTransforms(int level, Xml& xml); +extern void readMidiTransform(Xml&); +extern void clearMidiTransforms(); + +} // namespace MusECore + +namespace MusEGui { + //--------------------------------------------------------- // MidiTransformDialog //--------------------------------------------------------- class MidiTransformerDialog : public QDialog, public Ui::MidiTransformDialogBase { Q_OBJECT - MidiTransformPrivate* data; + MusECore::MidiTransformPrivate* data; virtual void accept(); // virtual void reject(); - void setValOp(QWidget* a, QWidget* b, ValOp op); - void processEvent(Event&, MidiPart*, MidiPart*); - bool isSelected(Event&, MidiPart*); - void transformEvent(Event&, MidiPart*, MidiPart*); - bool typesMatch(Event& e, unsigned selType); + void setValOp(QWidget* a, QWidget* b, MusECore::ValOp op); + void processEvent(MusECore::Event&, MusECore::MidiPart*, MusECore::MidiPart*); + bool isSelected(MusECore::Event&, MusECore::MidiPart*); + void transformEvent(MusECore::Event&, MusECore::MidiPart*, MusECore::MidiPart*); + bool typesMatch(MusECore::Event& e, unsigned selType); void updatePresetList(); @@ -114,7 +125,6 @@ class MidiTransformerDialog : public QDialog, public Ui::MidiTransformDialogBase ~MidiTransformerDialog(); }; -extern void writeMidiTransforms(int level, Xml& xml); -extern void readMidiTransform(Xml&); -extern void clearMidiTransforms(); +} // namespace MusEGui + #endif diff --git a/muse2/muse/mixer/amixer.cpp b/muse2/muse/mixer/amixer.cpp index 082b9461..64ebda11 100644 --- a/muse2/muse/mixer/amixer.cpp +++ b/muse2/muse/mixer/amixer.cpp @@ -51,7 +51,7 @@ //typedef std::list<Strip*> StripList; //static StripList stripList; -namespace MusEMixer { +namespace MusEGui { /* Nov 16, 2010: After making the strips variable width, we need a way to @@ -158,7 +158,7 @@ bool ScrollArea::viewportEvent(QEvent* event) // inputs | synthis | tracks | groups | master //--------------------------------------------------------- -AudioMixerApp::AudioMixerApp(QWidget* parent, MusEConfig::MixerConfig* c) +AudioMixerApp::AudioMixerApp(QWidget* parent, MixerConfig* c) : QMainWindow(parent) { cfg = c; @@ -169,8 +169,8 @@ AudioMixerApp::AudioMixerApp(QWidget* parent, MusEConfig::MixerConfig* c) setWindowIcon(*museIcon); QMenu* menuConfig = menuBar()->addMenu(tr("&Create")); - MusEUtil::populateAddTrack(menuConfig); - connect(menuConfig, SIGNAL(triggered(QAction *)), song, SLOT(addNewTrack(QAction *))); + MusEGui::populateAddTrack(menuConfig); + connect(menuConfig, SIGNAL(triggered(QAction *)), MusEGlobal::song, SLOT(addNewTrack(QAction *))); QMenu* menuView = menuBar()->addMenu(tr("&View")); routingId = menuView->addAction(tr("Routing"), this, SLOT(toggleRouteDialog())); @@ -237,9 +237,9 @@ AudioMixerApp::AudioMixerApp(QWidget* parent, MusEConfig::MixerConfig* c) connect(view, SIGNAL(layoutRequest()), SLOT(setSizing())); ///connect(this, SIGNAL(layoutRequest()), SLOT(setSizing())); - connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); + connect(MusEGlobal::song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); connect(MusEGlobal::muse, SIGNAL(configChanged()), SLOT(configChanged())); - song->update(); // calls update mixer + MusEGlobal::song->update(); // calls update mixer } /* @@ -259,8 +259,8 @@ bool AudioMixerApp::event(QEvent* event) //void AudioMixerApp::addNewTrack(QAction* action) //{ - //song->addNewTrack(action, MusEGlobal::muse->arranger()->curTrack()); // Insert at current selected track. -// song->addNewTrack(action); // Add at end. + //MusEGlobal::song->addNewTrack(action, MusEGlobal::muse->arranger()->curTrack()); // Insert at current selected track. +// MusEGlobal::song->addNewTrack(action); // Add at end. //} void AudioMixerApp::setSizing() @@ -292,7 +292,7 @@ void AudioMixerApp::setSizing() // addStrip //--------------------------------------------------------- -void AudioMixerApp::addStrip(Track* t, int idx) +void AudioMixerApp::addStrip(MusECore::Track* t, int idx) { StripList::iterator si = stripList.begin(); for (int i = 0; i < idx; ++i) { @@ -314,9 +314,9 @@ void AudioMixerApp::addStrip(Track* t, int idx) else { Strip* strip; if (t->isMidiTrack()) - strip = new MidiStrip(central, (MidiTrack*)t); + strip = new MidiStrip(central, (MusECore::MidiTrack*)t); else - strip = new AudioStrip(central, (AudioTrack*)t); + strip = new AudioStrip(central, (MusECore::AudioTrack*)t); layout->insertWidget(idx, strip); stripList.insert(si, strip); strip->show(); @@ -360,7 +360,7 @@ void AudioMixerApp::updateMixer(UpdateAction action) showAuxTracksId->setChecked(cfg->showAuxTracks); showSyntiTracksId->setChecked(cfg->showSyntiTracks); - int auxsSize = song->auxs()->size(); + int auxsSize = MusEGlobal::song->auxs()->size(); if ((action == UPDATE_ALL) || (auxsSize != oldAuxsSize)) { clear(); oldAuxsSize = auxsSize; @@ -369,9 +369,9 @@ void AudioMixerApp::updateMixer(UpdateAction action) { StripList::iterator si = stripList.begin(); for (; si != stripList.end();) { - Track* track = (*si)->getTrack(); - TrackList* tl = song->tracks(); - iTrack it; + MusECore::Track* track = (*si)->getTrack(); + MusECore::TrackList* tl = MusEGlobal::song->tracks(); + MusECore::iTrack it; for (it = tl->begin(); it != tl->end(); ++it) { if (*it == track) break; @@ -404,7 +404,7 @@ void AudioMixerApp::updateMixer(UpdateAction action) StripList::iterator si = stripList.begin(); for (; si != stripList.end(); ++i) { - Track* track = (*si)->getTrack(); + MusECore::Track* track = (*si)->getTrack(); if(!track->isMidiTrack()) { ++si; @@ -428,11 +428,11 @@ void AudioMixerApp::updateMixer(UpdateAction action) // generate Midi channel/port Strips //--------------------------------------------------- - MidiTrackList* mtl = song->midis(); - for (iMidiTrack i = mtl->begin(); i != mtl->end(); ++i) + MusECore::MidiTrackList* mtl = MusEGlobal::song->midis(); + for (MusECore::iMidiTrack i = mtl->begin(); i != mtl->end(); ++i) { - MidiTrack* mt = *i; - if((mt->type() == Track::MIDI && cfg->showMidiTracks) || (mt->type() == Track::DRUM && cfg->showDrumTracks) || (mt->type() == Track::NEW_DRUM && cfg->showNewDrumTracks)) + MusECore::MidiTrack* mt = *i; + if((mt->type() == MusECore::Track::MIDI && cfg->showMidiTracks) || (mt->type() == MusECore::Track::DRUM && cfg->showDrumTracks) || (mt->type() == MusECore::Track::NEW_DRUM && cfg->showNewDrumTracks)) addStrip(*i, idx++); } @@ -454,8 +454,8 @@ void AudioMixerApp::updateMixer(UpdateAction action) if(cfg->showInputTracks) { - InputList* itl = song->inputs(); - for (iAudioInput i = itl->begin(); i != itl->end(); ++i) + MusECore::InputList* itl = MusEGlobal::song->inputs(); + for (MusECore::iAudioInput i = itl->begin(); i != itl->end(); ++i) addStrip(*i, idx++); } @@ -465,8 +465,8 @@ void AudioMixerApp::updateMixer(UpdateAction action) if(cfg->showSyntiTracks) { - SynthIList* sl = song->syntis(); - for (iSynthI i = sl->begin(); i != sl->end(); ++i) + MusECore::SynthIList* sl = MusEGlobal::song->syntis(); + for (MusECore::iSynthI i = sl->begin(); i != sl->end(); ++i) addStrip(*i, idx++); } @@ -476,8 +476,8 @@ void AudioMixerApp::updateMixer(UpdateAction action) if(cfg->showWaveTracks) { - WaveTrackList* wtl = song->waves(); - for (iWaveTrack i = wtl->begin(); i != wtl->end(); ++i) + MusECore::WaveTrackList* wtl = MusEGlobal::song->waves(); + for (MusECore::iWaveTrack i = wtl->begin(); i != wtl->end(); ++i) addStrip(*i, idx++); } @@ -485,11 +485,11 @@ void AudioMixerApp::updateMixer(UpdateAction action) // generate Midi channel/port Strips //--------------------------------------------------- - MidiTrackList* mtl = song->midis(); - for (iMidiTrack i = mtl->begin(); i != mtl->end(); ++i) + MusECore::MidiTrackList* mtl = MusEGlobal::song->midis(); + for (MusECore::iMidiTrack i = mtl->begin(); i != mtl->end(); ++i) { - MidiTrack* mt = *i; - if((mt->type() == Track::MIDI && cfg->showMidiTracks) || (mt->type() == Track::DRUM && cfg->showDrumTracks) || (mt->type() == Track::NEW_DRUM && cfg->showNewDrumTracks)) + MusECore::MidiTrack* mt = *i; + if((mt->type() == MusECore::Track::MIDI && cfg->showMidiTracks) || (mt->type() == MusECore::Track::DRUM && cfg->showDrumTracks) || (mt->type() == MusECore::Track::NEW_DRUM && cfg->showNewDrumTracks)) addStrip(*i, idx++); } @@ -499,8 +499,8 @@ void AudioMixerApp::updateMixer(UpdateAction action) if(cfg->showGroupTracks) { - GroupList* gtl = song->groups(); - for (iAudioGroup i = gtl->begin(); i != gtl->end(); ++i) + MusECore::GroupList* gtl = MusEGlobal::song->groups(); + for (MusECore::iAudioGroup i = gtl->begin(); i != gtl->end(); ++i) addStrip(*i, idx++); } @@ -510,8 +510,8 @@ void AudioMixerApp::updateMixer(UpdateAction action) if(cfg->showAuxTracks) { - AuxList* al = song->auxs(); - for (iAudioAux i = al->begin(); i != al->end(); ++i) + MusECore::AuxList* al = MusEGlobal::song->auxs(); + for (MusECore::iAudioAux i = al->begin(); i != al->end(); ++i) addStrip(*i, idx++); } @@ -521,8 +521,8 @@ void AudioMixerApp::updateMixer(UpdateAction action) if(cfg->showOutputTracks) { - OutputList* otl = song->outputs(); - for (iAudioOutput i = otl->begin(); i != otl->end(); ++i) + MusECore::OutputList* otl = MusEGlobal::song->outputs(); + for (MusECore::iAudioOutput i = otl->begin(); i != otl->end(); ++i) addStrip(*i, idx++); } @@ -601,7 +601,7 @@ void AudioMixerApp::toggleRouteDialog() void AudioMixerApp::showRouteDialog(bool on) { if (on && routingDialog == 0) { - routingDialog = new MusEDialog::RouteDialog(this); + routingDialog = new MusEGui::RouteDialog(this); connect(routingDialog, SIGNAL(closed()), SLOT(routingDialogClosed())); } if (routingDialog) @@ -707,9 +707,9 @@ void AudioMixerApp::showSyntiTracksChanged(bool v) // write //--------------------------------------------------------- -//void AudioMixerApp::write(Xml& xml, const char* name) -void AudioMixerApp::write(int level, Xml& xml) -//void AudioMixerApp::write(int level, Xml& xml, const char* name) +//void AudioMixerApp::write(MusECore::Xml& xml, const char* name) +void AudioMixerApp::write(int level, MusECore::Xml& xml) +//void AudioMixerApp::write(int level, MusECore::Xml& xml, const char* name) { //xml.stag(QString(name)); //xml.tag(level++, name.toLatin1()); @@ -735,4 +735,4 @@ void AudioMixerApp::write(int level, Xml& xml) xml.etag(level, "Mixer"); } -} // namespace MusEMixer +} // namespace MusEGui diff --git a/muse2/muse/mixer/amixer.h b/muse2/muse/mixer/amixer.h index 60a77f12..1f29c693 100644 --- a/muse2/muse/mixer/amixer.h +++ b/muse2/muse/mixer/amixer.h @@ -31,34 +31,29 @@ #include "node.h" #include "routedialog.h" +#define EFX_HEIGHT 16 + class QHBoxLayout; class QLabel; class QMenu; class QToolButton; class QWidget; +namespace MusECore { class Xml; class AudioTrack; class Meter; class Track; -class Slider; -class Knob; -class DoubleLabel; -class ComboBox; - -namespace MusEConfig { -struct MixerConfig; } -namespace MusEDialog { +namespace MusEGui { +class ComboBox; +class DoubleLabel; +class Knob; class RouteDialog; -} - -#define EFX_HEIGHT 16 - -namespace MusEMixer { - +class Slider; class Strip; +struct MixerConfig; typedef std::list<Strip*> StripList; //--------------------------------------------------------- @@ -87,7 +82,7 @@ class AudioMixerApp : public QMainWindow { Q_OBJECT //QString name; - MusEConfig::MixerConfig* cfg; + MixerConfig* cfg; StripList stripList; QScrollArea* view; QWidget* central; @@ -95,7 +90,7 @@ class AudioMixerApp : public QMainWindow { //Strip* master; QHBoxLayout* layout; QMenu* menuView; - MusEDialog::RouteDialog* routingDialog; + MusEGui::RouteDialog* routingDialog; QAction* routingId; int oldAuxsSize; @@ -112,7 +107,7 @@ class AudioMixerApp : public QMainWindow { virtual void closeEvent(QCloseEvent*); - void addStrip(Track*, int); + void addStrip(MusECore::Track*, int); void showRouteDialog(bool); enum UpdateAction { @@ -148,14 +143,14 @@ class AudioMixerApp : public QMainWindow { public: //AudioMixerApp(QWidget* parent); - AudioMixerApp(QWidget* parent, MusEConfig::MixerConfig* c); + AudioMixerApp(QWidget* parent, MixerConfig* c); //void write(Xml&, const char* name); //void write(int level, Xml& xml, const char* name); - void write(int level, Xml& xml); + void write(int level, MusECore::Xml& xml); void clear(); }; -} // namespace MusEMixer +} // namespace MusEGui #endif diff --git a/muse2/muse/mixer/astrip.cpp b/muse2/muse/mixer/astrip.cpp index bf31d820..10f281fb 100644 --- a/muse2/muse/mixer/astrip.cpp +++ b/muse2/muse/mixer/astrip.cpp @@ -68,7 +68,7 @@ //#include "popupmenu.h" #include "routepopup.h" -namespace MusEMixer { +namespace MusEGui { /* //--------------------------------------------------------- @@ -133,9 +133,9 @@ void AudioStrip::songChanged(int val) if (val == SC_MIDI_CONTROLLER) return; - AudioTrack* src = (AudioTrack*)track; + MusECore::AudioTrack* src = (MusECore::AudioTrack*)track; - // Do channels before MusEConfig::config... + // Do channels before MusEGlobal::config... if (val & SC_CHANNELS) updateChannels(); @@ -145,12 +145,12 @@ void AudioStrip::songChanged(int val) // Added by Tim. p3.3.9 // Set the strip label's font. - //label->setFont(MusEConfig::config.fonts[1]); + //label->setFont(MusEGlobal::config.fonts[1]); setLabelFont(); // Adjust minimum volume slider and label values. - slider->setRange(MusEConfig::config.minSlider-0.1, 10.0); - sl->setRange(MusEConfig::config.minSlider, 10.0); + slider->setRange(MusEGlobal::config.minSlider-0.1, 10.0); + sl->setRange(MusEGlobal::config.minSlider, 10.0); // Adjust minimum aux knob and label values. int n = auxKnob.size(); @@ -158,15 +158,15 @@ void AudioStrip::songChanged(int val) { auxKnob[idx]->blockSignals(true); auxLabel[idx]->blockSignals(true); - auxKnob[idx]->setRange(MusEConfig::config.minSlider-0.1, 10.0); - auxLabel[idx]->setRange(MusEConfig::config.minSlider, 10.1); + auxKnob[idx]->setRange(MusEGlobal::config.minSlider-0.1, 10.0); + auxLabel[idx]->setRange(MusEGlobal::config.minSlider, 10.1); auxKnob[idx]->blockSignals(false); auxLabel[idx]->blockSignals(false); } // Adjust minimum meter values. for(int c = 0; c < channel; ++c) - meter[c]->setRange(MusEConfig::config.minMeter, 10.0); + meter[c]->setRange(MusEGlobal::config.minMeter, 10.0); } if (mute && (val & SC_MUTE)) { // mute && off @@ -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); @@ -271,14 +271,14 @@ void AudioStrip::songChanged(int val) void AudioStrip::updateVolume() { - double vol = ((AudioTrack*)track)->volume(); + double vol = ((MusECore::AudioTrack*)track)->volume(); if (vol != volume) { //printf("AudioStrip::updateVolume setting slider and label\n"); 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); @@ -293,7 +293,7 @@ void AudioStrip::updateVolume() void AudioStrip::updatePan() { - double v = ((AudioTrack*)track)->pan(); + double v = ((MusECore::AudioTrack*)track)->pan(); if (v != panVal) { //printf("AudioStrip::updatePan setting slider and label\n"); @@ -315,7 +315,7 @@ void AudioStrip::updatePan() void AudioStrip::offToggled(bool val) { track->setOff(val); - song->update(SC_MUTE); + MusEGlobal::song->update(SC_MUTE); } //--------------------------------------------------------- @@ -329,7 +329,7 @@ void AudioStrip::updateOffState() sl->setEnabled(val); pan->setEnabled(val); panl->setEnabled(val); - if (track->type() != Track::AUDIO_SOFTSYNTH) + if (track->type() != MusECore::Track::AUDIO_SOFTSYNTH) stereo->setEnabled(val); label->setEnabled(val); @@ -369,9 +369,9 @@ void AudioStrip::updateOffState() void AudioStrip::preToggled(bool val) { - audio->msgSetPrefader((AudioTrack*)track, val); + MusEGlobal::audio->msgSetPrefader((MusECore::AudioTrack*)track, val); resetPeaks(); - song->update(SC_ROUTE); + MusEGlobal::song->update(SC_ROUTE); } //--------------------------------------------------------- @@ -385,8 +385,8 @@ void AudioStrip::stereoToggled(bool val) // stereo->setIcon(nc == 2 ? *stereoIcon : *monoIcon); if (oc == nc) return; - audio->msgSetChannels((AudioTrack*)track, nc); - song->update(SC_CHANNELS); + MusEGlobal::audio->msgSetChannels((MusECore::AudioTrack*)track, nc); + MusEGlobal::song->update(SC_CHANNELS); } //--------------------------------------------------------- @@ -396,14 +396,14 @@ void AudioStrip::stereoToggled(bool val) void AudioStrip::auxChanged(double val, int idx) { double vol; - if (val <= MusEConfig::config.minSlider) { + if (val <= MusEGlobal::config.minSlider) { vol = 0.0; val -= 1.0; // display special value "off" } else vol = pow(10.0, val/20.0); - audio->msgSetAux((AudioTrack*)track, idx, vol); - song->update(SC_AUX); + MusEGlobal::audio->msgSetAux((MusECore::AudioTrack*)track, idx, vol); + MusEGlobal::song->update(SC_AUX); } //--------------------------------------------------------- @@ -423,27 +423,27 @@ void AudioStrip::auxLabelChanged(double val, unsigned int idx) void AudioStrip::volumeChanged(double val) { - AutomationType at = ((AudioTrack*)track)->automationType(); - if(at == AUTO_WRITE || (audio->isPlaying() && at == AUTO_TOUCH)) + AutomationType at = ((MusECore::AudioTrack*)track)->automationType(); + if(at == AUTO_WRITE || (MusEGlobal::audio->isPlaying() && at == AUTO_TOUCH)) track->enableVolumeController(false); double vol; - if (val <= MusEConfig::config.minSlider) { + if (val <= MusEGlobal::config.minSlider) { vol = 0.0; val -= 1.0; // display special value "off" } else vol = pow(10.0, val/20.0); volume = vol; - //audio->msgSetVolume((AudioTrack*)track, vol); - // p4.0.21 audio->msgXXX waits. Do we really need to? - ((AudioTrack*)track)->setVolume(vol); - song->controllerChange(track); + //MusEGlobal::audio->msgSetVolume((MusECore::AudioTrack*)track, vol); + // p4.0.21 MusEGlobal::audio->msgXXX waits. Do we really need to? + ((MusECore::AudioTrack*)track)->setVolume(vol); + MusEGlobal::song->controllerChange(track); - ((AudioTrack*)track)->recordAutomation(AC_VOLUME, vol); + ((MusECore::AudioTrack*)track)->recordAutomation(MusECore::AC_VOLUME, vol); - //song->update(SC_TRACK_MODIFIED); // for graphical automation update - //song->controllerChange(track); + //MusEGlobal::song->update(SC_TRACK_MODIFIED); // for graphical automation update + //MusEGlobal::song->controllerChange(track); } //--------------------------------------------------------- @@ -452,25 +452,25 @@ void AudioStrip::volumeChanged(double val) void AudioStrip::volumePressed() { - AutomationType at = ((AudioTrack*)track)->automationType(); + AutomationType at = ((MusECore::AudioTrack*)track)->automationType(); if(at == AUTO_WRITE || (at == AUTO_READ || at == AUTO_TOUCH)) track->enableVolumeController(false); double val = slider->value(); double vol; - if (val <= MusEConfig::config.minSlider) { + if (val <= MusEGlobal::config.minSlider) { vol = 0.0; //val -= 1.0; // display special value "off" } else vol = pow(10.0, val/20.0); volume = vol; - //audio->msgSetVolume((AudioTrack*)track, volume); - // p4.0.21 audio->msgXXX waits. Do we really need to? - ((AudioTrack*)track)->setVolume(volume); - song->controllerChange(track); + //MusEGlobal::audio->msgSetVolume((MusECore::AudioTrack*)track, volume); + // p4.0.21 MusEGlobal::audio->msgXXX waits. Do we really need to? + ((MusECore::AudioTrack*)track)->setVolume(volume); + MusEGlobal::song->controllerChange(track); - ((AudioTrack*)track)->startAutoRecord(AC_VOLUME, volume); + ((MusECore::AudioTrack*)track)->startAutoRecord(MusECore::AC_VOLUME, volume); } //--------------------------------------------------------- @@ -482,7 +482,7 @@ void AudioStrip::volumeReleased() if(track->automationType() != AUTO_WRITE) track->enableVolumeController(true); - ((AudioTrack*)track)->stopAutoRecord(AC_VOLUME, volume); + ((MusECore::AudioTrack*)track)->stopAutoRecord(MusECore::AC_VOLUME, volume); } //--------------------------------------------------------- @@ -490,7 +490,7 @@ void AudioStrip::volumeReleased() //--------------------------------------------------------- void AudioStrip::volumeRightClicked(const QPoint &p) { - song->execAutomationCtlPopup((AudioTrack*)track, p, AC_VOLUME); + MusEGlobal::song->execAutomationCtlPopup((MusECore::AudioTrack*)track, p, MusECore::AC_VOLUME); } //--------------------------------------------------------- @@ -499,12 +499,12 @@ void AudioStrip::volumeRightClicked(const QPoint &p) void AudioStrip::volLabelChanged(double val) { - AutomationType at = ((AudioTrack*)track)->automationType(); - if(at == AUTO_WRITE || (audio->isPlaying() && at == AUTO_TOUCH)) + AutomationType at = ((MusECore::AudioTrack*)track)->automationType(); + if(at == AUTO_WRITE || (MusEGlobal::audio->isPlaying() && at == AUTO_TOUCH)) track->enableVolumeController(false); double vol; - if (val <= MusEConfig::config.minSlider) { + if (val <= MusEGlobal::config.minSlider) { vol = 0.0; val -= 1.0; // display special value "off" } @@ -512,12 +512,12 @@ void AudioStrip::volLabelChanged(double val) vol = pow(10.0, val/20.0); volume = vol; slider->setValue(val); - //audio->msgSetVolume((AudioTrack*)track, vol); + //audio->msgSetVolume((MusECore::AudioTrack*)track, vol); // p4.0.21 audio->msgXXX waits. Do we really need to? - ((AudioTrack*)track)->setVolume(vol); - song->controllerChange(track); + ((MusECore::AudioTrack*)track)->setVolume(vol); + MusEGlobal::song->controllerChange(track); - ((AudioTrack*)track)->startAutoRecord(AC_VOLUME, vol); + ((MusECore::AudioTrack*)track)->startAutoRecord(MusECore::AC_VOLUME, vol); } //--------------------------------------------------------- @@ -526,17 +526,17 @@ void AudioStrip::volLabelChanged(double val) void AudioStrip::panChanged(double val) { - AutomationType at = ((AudioTrack*)track)->automationType(); - if(at == AUTO_WRITE || (audio->isPlaying() && at == AUTO_TOUCH)) + AutomationType at = ((MusECore::AudioTrack*)track)->automationType(); + if(at == AUTO_WRITE || (MusEGlobal::audio->isPlaying() && at == AUTO_TOUCH)) track->enablePanController(false); panVal = val; - //audio->msgSetPan(((AudioTrack*)track), val); - // p4.0.21 audio->msgXXX waits. Do we really need to? - ((AudioTrack*)track)->setPan(val); - song->controllerChange(track); + //MusEGlobal::audio->msgSetPan(((MusECore::AudioTrack*)track), val); + // p4.0.21 MusEGlobal::audio->msgXXX waits. Do we really need to? + ((MusECore::AudioTrack*)track)->setPan(val); + MusEGlobal::song->controllerChange(track); - ((AudioTrack*)track)->recordAutomation(AC_PAN, val); + ((MusECore::AudioTrack*)track)->recordAutomation(MusECore::AC_PAN, val); } //--------------------------------------------------------- @@ -545,17 +545,17 @@ void AudioStrip::panChanged(double val) void AudioStrip::panPressed() { - AutomationType at = ((AudioTrack*)track)->automationType(); + AutomationType at = ((MusECore::AudioTrack*)track)->automationType(); if(at == AUTO_WRITE || (at == AUTO_READ || at == AUTO_TOUCH)) track->enablePanController(false); panVal = pan->value(); - //audio->msgSetPan(((AudioTrack*)track), panVal); - // p4.0.21 audio->msgXXX waits. Do we really need to? - ((AudioTrack*)track)->setPan(panVal); - song->controllerChange(track); + //MusEGlobal::audio->msgSetPan(((MusECore::AudioTrack*)track), panVal); + // p4.0.21 MusEGlobal::audio->msgXXX waits. Do we really need to? + ((MusECore::AudioTrack*)track)->setPan(panVal); + MusEGlobal::song->controllerChange(track); - ((AudioTrack*)track)->startAutoRecord(AC_PAN, panVal); + ((MusECore::AudioTrack*)track)->startAutoRecord(MusECore::AC_PAN, panVal); } //--------------------------------------------------------- @@ -566,7 +566,7 @@ void AudioStrip::panReleased() { if(track->automationType() != AUTO_WRITE) track->enablePanController(true); - ((AudioTrack*)track)->stopAutoRecord(AC_PAN, panVal); + ((MusECore::AudioTrack*)track)->stopAutoRecord(MusECore::AC_PAN, panVal); } //--------------------------------------------------------- @@ -574,7 +574,7 @@ void AudioStrip::panReleased() //--------------------------------------------------------- void AudioStrip::panRightClicked(const QPoint &p) { - song->execAutomationCtlPopup((AudioTrack*)track, p, AC_PAN); + MusEGlobal::song->execAutomationCtlPopup((MusECore::AudioTrack*)track, p, MusECore::AC_PAN); } //--------------------------------------------------------- @@ -583,18 +583,18 @@ void AudioStrip::panRightClicked(const QPoint &p) void AudioStrip::panLabelChanged(double val) { - AutomationType at = ((AudioTrack*)track)->automationType(); - if(at == AUTO_WRITE || (audio->isPlaying() && at == AUTO_TOUCH)) + AutomationType at = ((MusECore::AudioTrack*)track)->automationType(); + if(at == AUTO_WRITE || (MusEGlobal::audio->isPlaying() && at == AUTO_TOUCH)) track->enablePanController(false); panVal = val; pan->setValue(val); - //audio->msgSetPan((AudioTrack*)track, val); - // p4.0.21 audio->msgXXX waits. Do we really need to? - ((AudioTrack*)track)->setPan(val); - song->controllerChange(track); + //MusEGlobal::audio->msgSetPan((MusECore::AudioTrack*)track, val); + // p4.0.21 MusEGlobal::audio->msgXXX waits. Do we really need to? + ((MusECore::AudioTrack*)track)->setPan(val); + MusEGlobal::song->controllerChange(track); - ((AudioTrack*)track)->startAutoRecord(AC_PAN, val); + ((MusECore::AudioTrack*)track)->startAutoRecord(MusECore::AC_PAN, val); } //--------------------------------------------------------- @@ -603,15 +603,15 @@ void AudioStrip::panLabelChanged(double val) void AudioStrip::updateChannels() { - AudioTrack* t = (AudioTrack*)track; + MusECore::AudioTrack* t = (MusECore::AudioTrack*)track; int c = t->channels(); //printf("AudioStrip::updateChannels track channels:%d current channels:%d\n", c, channel); if (c > channel) { for (int cc = channel; cc < c; ++cc) { - meter[cc] = new MusEWidget::Meter(this); - //meter[cc]->setRange(MusEConfig::config.minSlider, 10.0); - meter[cc]->setRange(MusEConfig::config.minMeter, 10.0); + meter[cc] = new MusEGui::Meter(this); + //meter[cc]->setRange(MusEGlobal::config.minSlider, 10.0); + meter[cc]->setRange(MusEGlobal::config.minMeter, 10.0); meter[cc]->setFixedWidth(15); connect(meter[cc], SIGNAL(mousePress()), this, SLOT(resetPeaks())); sliderGrid->addWidget(meter[cc], 0, cc+1, Qt::AlignLeft); @@ -639,14 +639,14 @@ void AudioStrip::updateChannels() // 1 - aux send //--------------------------------------------------------- -MusEWidget::Knob* AudioStrip::addKnob(int type, int id, MusEWidget::DoubleLabel** dlabel) +MusEGui::Knob* AudioStrip::addKnob(int type, int id, MusEGui::DoubleLabel** dlabel) { - MusEWidget::Knob* knob = new MusEWidget::Knob(this); + MusEGui::Knob* knob = new MusEGui::Knob(this); knob->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); if (type == 0) knob->setRange(-1.0, +1.0); else - knob->setRange(MusEConfig::config.minSlider-0.1, 10.0); + knob->setRange(MusEGlobal::config.minSlider-0.1, 10.0); knob->setBackgroundRole(QPalette::Mid); if (type == 0) @@ -654,16 +654,16 @@ MusEWidget::Knob* AudioStrip::addKnob(int type, int id, MusEWidget::DoubleLabel* else knob->setToolTip(tr("aux send level")); - MusEWidget::DoubleLabel* pl; + MusEGui::DoubleLabel* pl; if (type == 0) - pl = new MusEWidget::DoubleLabel(0, -1.0, +1.0, this); + pl = new MusEGui::DoubleLabel(0, -1.0, +1.0, this); else - pl = new MusEWidget::DoubleLabel(0.0, MusEConfig::config.minSlider, 10.1, this); + pl = new MusEGui::DoubleLabel(0.0, MusEGlobal::config.minSlider, 10.1, this); if (dlabel) *dlabel = pl; pl->setSlider(knob); - pl->setFont(MusEConfig::config.fonts[1]); + pl->setFont(MusEGlobal::config.fonts[1]); pl->setBackgroundRole(QPalette::Mid); pl->setFrame(true); if (type == 0) @@ -680,7 +680,7 @@ MusEWidget::Knob* AudioStrip::addKnob(int type, int id, MusEWidget::DoubleLabel* label.sprintf("Aux%d", id+1); QLabel* plb = new QLabel(label, this); - plb->setFont(MusEConfig::config.fonts[1]); + plb->setFont(MusEGlobal::config.fonts[1]); plb->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); plb->setAlignment(Qt::AlignCenter); @@ -728,7 +728,7 @@ AudioStrip::~AudioStrip() // create mixer strip //--------------------------------------------------------- -AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at) +AudioStrip::AudioStrip(QWidget* parent, MusECore::AudioTrack* at) : Strip(parent, at) { volume = -1.0; @@ -737,13 +737,13 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at) record = 0; off = 0; - AudioTrack* t = (AudioTrack*)track; + MusECore::AudioTrack* t = (MusECore::AudioTrack*)track; channel = at->channels(); ///setMinimumWidth(STRIP_WIDTH); int ch = 0; for (; ch < channel; ++ch) - meter[ch] = new MusEWidget::Meter(this); + meter[ch] = new MusEGui::Meter(this); for (; ch < MAX_CHANNELS; ++ch) meter[ch] = 0; @@ -760,7 +760,7 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at) //--------------------------------------------------- stereo = new QToolButton(); - stereo->setFont(MusEConfig::config.fonts[1]); + stereo->setFont(MusEGlobal::config.fonts[1]); stereo->setCheckable(true); stereo->setToolTip(tr("1/2 channel")); stereo->setChecked(channel == 2); @@ -770,11 +770,11 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at) connect(stereo, SIGNAL(clicked(bool)), SLOT(stereoToggled(bool))); // disable mono/stereo for Synthesizer-Plugins - if (t->type() == Track::AUDIO_SOFTSYNTH) + if (t->type() == MusECore::Track::AUDIO_SOFTSYNTH) stereo->setEnabled(false); pre = new QToolButton(); - pre->setFont(MusEConfig::config.fonts[1]); + pre->setFont(MusEGlobal::config.fonts[1]); pre->setCheckable(true); pre->setText(tr("Pre")); pre->setToolTip(tr("pre fader - post fader")); @@ -789,14 +789,14 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at) // aux send //--------------------------------------------------- - int auxsSize = song->auxs()->size(); + int auxsSize = MusEGlobal::song->auxs()->size(); if (t->hasAuxSend()) { for (int idx = 0; idx < auxsSize; ++idx) { - MusEWidget::DoubleLabel* al; - MusEWidget::Knob* ak = addKnob(1, idx, &al); + MusEGui::DoubleLabel* al; + 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); } @@ -816,19 +816,19 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at) sliderGrid->setContentsMargins(0, 0, 0, 0); sliderGrid->setSpacing(0); - slider = new MusEWidget::Slider(this, "vol", Qt::Vertical, MusEWidget::Slider::None); + slider = new MusEGui::Slider(this, "vol", Qt::Vertical, MusEGui::Slider::None); slider->setCursorHoming(true); - slider->setRange(MusEConfig::config.minSlider-0.1, 10.0); + slider->setRange(MusEGlobal::config.minSlider-0.1, 10.0); slider->setFixedWidth(20); - slider->setFont(MusEConfig::config.fonts[1]); - slider->setValue(fast_log10(t->volume())*20.0); + slider->setFont(MusEGlobal::config.fonts[1]); + slider->setValue(MusECore::fast_log10(t->volume())*20.0); sliderGrid->addWidget(slider, 0, 0, Qt::AlignHCenter); for (int i = 0; i < channel; ++i) { - //meter[i]->setRange(MusEConfig::config.minSlider, 10.0); - meter[i]->setRange(MusEConfig::config.minMeter, 10.0); + //meter[i]->setRange(MusEGlobal::config.minSlider, 10.0); + meter[i]->setRange(MusEGlobal::config.minMeter, 10.0); meter[i]->setFixedWidth(15); connect(meter[i], SIGNAL(mousePress()), this, SLOT(resetPeaks())); sliderGrid->addWidget(meter[i], 0, i+1, Qt::AlignHCenter); @@ -837,15 +837,15 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at) sliderGrid->addItem(new QSpacerItem(2,0),0,3); grid->addLayout(sliderGrid, _curGridRow++, 0, 1, 2); - sl = new MusEWidget::DoubleLabel(0.0, MusEConfig::config.minSlider, 10.0, this); + sl = new MusEGui::DoubleLabel(0.0, MusEGlobal::config.minSlider, 10.0, this); sl->setSlider(slider); - sl->setFont(MusEConfig::config.fonts[1]); + sl->setFont(MusEGlobal::config.fonts[1]); sl->setBackgroundRole(QPalette::Mid); sl->setSuffix(tr("dB")); 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))); @@ -868,7 +868,7 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at) //--------------------------------------------------- if (track->canRecord()) { - record = new MusEWidget::TransparentToolButton(this); + record = new MusEGui::TransparentToolButton(this); record->setCheckable(true); record->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); record->setBackgroundRole(QPalette::Mid); @@ -879,7 +879,7 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at) connect(record, SIGNAL(clicked(bool)), SLOT(recordToggled(bool))); } - Track::TrackType type = t->type(); + MusECore::Track::TrackType type = t->type(); mute = new QToolButton(); mute->setCheckable(true); @@ -901,7 +901,7 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at) solo->setIconSize(soloIconOn->size()); solo->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); connect(solo, SIGNAL(clicked(bool)), SLOT(soloToggled(bool))); - if (type == Track::AUDIO_OUTPUT) { + if (type == MusECore::Track::AUDIO_OUTPUT) { record->setToolTip(tr("record downmix")); //solo->setToolTip(tr("solo mode (monitor)")); solo->setToolTip(tr("solo mode")); @@ -911,7 +911,7 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at) solo->setToolTip(tr("solo mode")); } - off = new MusEWidget::TransparentToolButton(this); + off = new MusEGui::TransparentToolButton(this); off->setBackgroundRole(QPalette::Mid); off->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); off->setCheckable(true); @@ -932,9 +932,9 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at) // routing //--------------------------------------------------- - if (type != Track::AUDIO_AUX) { + if (type != MusECore::Track::AUDIO_AUX) { iR = new QToolButton(); - iR->setFont(MusEConfig::config.fonts[1]); + iR->setFont(MusEGlobal::config.fonts[1]); iR->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); iR->setText(tr("iR")); iR->setCheckable(false); @@ -944,7 +944,7 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at) } oR = new QToolButton(); - oR->setFont(MusEConfig::config.fonts[1]); + oR->setFont(MusEGlobal::config.fonts[1]); oR->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); oR->setText(tr("oR")); oR->setCheckable(false); @@ -956,8 +956,8 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at) // automation type //--------------------------------------------------- - autoType = new MusEWidget::ComboBox(); - autoType->setFont(MusEConfig::config.fonts[1]); + autoType = new MusEGui::ComboBox(); + autoType->setFont(MusEGlobal::config.fonts[1]); autoType->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); //autoType->setAutoFillBackground(true); @@ -1025,7 +1025,7 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at) void AudioStrip::iRoutePressed() { - MusEWidget::RoutePopupMenu* pup = MusEGlobal::muse->getRoutingPopupMenu(); + MusEGui::RoutePopupMenu* pup = MusEGlobal::muse->getRoutingPopupMenu(); iR->setDown(false); pup->exec(QCursor::pos(), track, false); } @@ -1036,9 +1036,9 @@ void AudioStrip::iRoutePressed() void AudioStrip::oRoutePressed() { - MusEWidget::RoutePopupMenu* pup = MusEGlobal::muse->getRoutingPopupMenu(); + MusEGui::RoutePopupMenu* pup = MusEGlobal::muse->getRoutingPopupMenu(); oR->setDown(false); pup->exec(QCursor::pos(), track, true); } -} // namespace MusEMixer +} // namespace MusEGui diff --git a/muse2/muse/mixer/astrip.h b/muse2/muse/mixer/astrip.h index 3e2b6c1d..1ee40d97 100644 --- a/muse2/muse/mixer/astrip.h +++ b/muse2/muse/mixer/astrip.h @@ -30,24 +30,26 @@ #include "strip.h" //#include "route.h" -namespace MusEWidget { -class DoubleLabel; -class Slider; -class Knob; -class TransparentToolButton; -} - //class QDialog; class QToolButton; //class QAction; //class QPopupMenu; //class PopupMenu; class QButton; -class AudioTrack; -namespace MusEMixer { +namespace MusEGui { +} +namespace MusECore { +class AudioTrack; +} + +namespace MusEGui { +class DoubleLabel; class EffectRack; +class Knob; +class Slider; +class TransparentToolButton; //--------------------------------------------------------- // AudioStrip @@ -57,19 +59,19 @@ class AudioStrip : public Strip { Q_OBJECT int channel; - MusEWidget::Slider* slider; - MusEWidget::DoubleLabel* sl; + MusEGui::Slider* slider; + MusEGui::DoubleLabel* sl; EffectRack* rack; - MusEWidget::Knob* pan; - MusEWidget::DoubleLabel* panl; + MusEGui::Knob* pan; + MusEGui::DoubleLabel* panl; - std::vector<MusEWidget::Knob*> auxKnob; - std::vector<MusEWidget::DoubleLabel*> auxLabel; + std::vector<MusEGui::Knob*> auxKnob; + std::vector<MusEGui::DoubleLabel*> auxLabel; QToolButton* stereo; QToolButton* pre; - MusEWidget::TransparentToolButton* off; + MusEGui::TransparentToolButton* off; double volume; double panVal; @@ -77,7 +79,7 @@ class AudioStrip : public Strip { //QToolButton* iR; //QToolButton* oR; - MusEWidget::Knob* addKnob(int, int, MusEWidget::DoubleLabel**); + MusEGui::Knob* addKnob(int, int, MusEGui::DoubleLabel**); void updateOffState(); void updateVolume(); @@ -111,13 +113,13 @@ class AudioStrip : public Strip { virtual void songChanged(int); public: - AudioStrip(QWidget* parent, AudioTrack*); + AudioStrip(QWidget* parent, MusECore::AudioTrack*); ~AudioStrip(); ///virtual QSize minimumSizeHint () const; //virtual QSize sizeHint () const; }; -} // namespace MusEMixer +} // namespace MusEGui #endif diff --git a/muse2/muse/mixer/auxknob.cpp b/muse2/muse/mixer/auxknob.cpp index a9b9c4e2..5e00f9b8 100644 --- a/muse2/muse/mixer/auxknob.cpp +++ b/muse2/muse/mixer/auxknob.cpp @@ -25,17 +25,17 @@ #include "auxknob.h" #include "gconfig.h" -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // Aux //--------------------------------------------------------- AuxKnob::AuxKnob(QWidget* parent, int i) - : MusEWidget::Knob(parent, "aux") + : MusEGui::Knob(parent, "aux") { idx = i; - setRange(MusEConfig::config.minSlider-0.1, 10.0); + setRange(MusEGlobal::config.minSlider-0.1, 10.0); connect(this, SIGNAL(valueChanged(double,int)), SLOT(valueChanged(double))); } @@ -46,7 +46,7 @@ AuxKnob::AuxKnob(QWidget* parent, int i) void AuxKnob::valueChanged(double val) { double vol; - if (val <= MusEConfig::config.minSlider) { + if (val <= MusEGlobal::config.minSlider) { vol = 0.0; val -= 1.0; // display special value "off" } @@ -55,4 +55,4 @@ void AuxKnob::valueChanged(double val) emit auxChanged(idx, vol); } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/mixer/auxknob.h b/muse2/muse/mixer/auxknob.h index c8693698..6d22508c 100644 --- a/muse2/muse/mixer/auxknob.h +++ b/muse2/muse/mixer/auxknob.h @@ -26,7 +26,7 @@ #include "knob.h" -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // AuxKnob @@ -46,7 +46,7 @@ class AuxKnob : public Knob { AuxKnob(QWidget* parent, int idx); }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/mixer/mstrip.cpp b/muse2/muse/mixer/mstrip.cpp index c920d6c6..2e51feb9 100644 --- a/muse2/muse/mixer/mstrip.cpp +++ b/muse2/muse/mixer/mstrip.cpp @@ -62,7 +62,7 @@ //#include "popupmenu.h" #include "routepopup.h" -namespace MusEMixer { +namespace MusEGui { enum { KNOB_PAN, KNOB_VAR_SEND, KNOB_REV_SEND, KNOB_CHO_SEND }; @@ -73,29 +73,29 @@ enum { KNOB_PAN, KNOB_VAR_SEND, KNOB_REV_SEND, KNOB_CHO_SEND }; void MidiStrip::addKnob(int idx, const QString& tt, const QString& label, const char* slot, bool enabled) { - int ctl = CTRL_PANPOT, mn, mx, v; - int chan = ((MidiTrack*)track)->outChannel(); + int ctl = MusECore::CTRL_PANPOT, mn, mx, v; + int chan = ((MusECore::MidiTrack*)track)->outChannel(); switch(idx) { //case KNOB_PAN: - // ctl = CTRL_PANPOT; + // ctl = MusECore::CTRL_PANPOT; //break; case KNOB_VAR_SEND: - ctl = CTRL_VARIATION_SEND; + ctl = MusECore::CTRL_VARIATION_SEND; break; case KNOB_REV_SEND: - ctl = CTRL_REVERB_SEND; + ctl = MusECore::CTRL_REVERB_SEND; break; case KNOB_CHO_SEND: - ctl = CTRL_CHORUS_SEND; + ctl = MusECore::CTRL_CHORUS_SEND; break; } - MidiPort* mp = &midiPorts[((MidiTrack*)track)->outPort()]; - MidiController* mc = mp->midiController(ctl); + MusECore::MidiPort* mp = &MusEGlobal::midiPorts[((MusECore::MidiTrack*)track)->outPort()]; + MusECore::MidiController* mc = mp->midiController(ctl); mn = mc->minVal(); mx = mc->maxVal(); - MusEWidget::Knob* knob = new MusEWidget::Knob(this); + MusEGui::Knob* knob = new MusEGui::Knob(this); knob->setRange(double(mn), double(mx), 1.0); knob->setId(ctl); @@ -105,12 +105,12 @@ void MidiStrip::addKnob(int idx, const QString& tt, const QString& label, knob->setToolTip(tt); knob->setEnabled(enabled); - MusEWidget::DoubleLabel* dl = new MusEWidget::DoubleLabel(0.0, double(mn), double(mx), this); + MusEGui::DoubleLabel* dl = new MusEGui::DoubleLabel(0.0, double(mn), double(mx), this); dl->setId(idx); dl->setSpecialText(tr("off")); dl->setToolTip(tr("double click on/off")); controller[idx].dl = dl; - dl->setFont(MusEConfig::config.fonts[1]); + dl->setFont(MusEGlobal::config.fonts[1]); dl->setBackgroundRole(QPalette::Mid); dl->setFrame(true); dl->setPrecision(0); @@ -119,16 +119,16 @@ void MidiStrip::addKnob(int idx, const QString& tt, const QString& label, double dlv; v = mp->hwCtrlState(chan, ctl); - if(v == CTRL_VAL_UNKNOWN) + if(v == MusECore::CTRL_VAL_UNKNOWN) { //v = mc->initVal(); - //if(v == CTRL_VAL_UNKNOWN) + //if(v == MusECore::CTRL_VAL_UNKNOWN) // v = 0; // v = mn - 1; int lastv = mp->lastValidHWCtrlState(chan, ctl); - if(lastv == CTRL_VAL_UNKNOWN) + if(lastv == MusECore::CTRL_VAL_UNKNOWN) { - if(mc->initVal() == CTRL_VAL_UNKNOWN) + if(mc->initVal() == MusECore::CTRL_VAL_UNKNOWN) v = 0; else v = mc->initVal(); @@ -153,7 +153,7 @@ void MidiStrip::addKnob(int idx, const QString& tt, const QString& label, QLabel* lb = new QLabel(label, this); controller[idx].lb = lb; - lb->setFont(MusEConfig::config.fonts[1]); + lb->setFont(MusEGlobal::config.fonts[1]); lb->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); lb->setAlignment(Qt::AlignCenter); lb->setEnabled(enabled); @@ -173,7 +173,7 @@ void MidiStrip::addKnob(int idx, const QString& tt, const QString& label, // MidiStrip //--------------------------------------------------------- -MidiStrip::MidiStrip(QWidget* parent, MidiTrack* t) +MidiStrip::MidiStrip(QWidget* parent, MusECore::MidiTrack* t) : Strip(parent, t) { inHeartBeat = true; @@ -182,16 +182,16 @@ MidiStrip::MidiStrip(QWidget* parent, MidiTrack* t) t->setActivity(0); t->setLastActivity(0); - volume = CTRL_VAL_UNKNOWN; - pan = CTRL_VAL_UNKNOWN; - variSend = CTRL_VAL_UNKNOWN; - chorusSend = CTRL_VAL_UNKNOWN; - reverbSend = CTRL_VAL_UNKNOWN; + volume = MusECore::CTRL_VAL_UNKNOWN; + pan = MusECore::CTRL_VAL_UNKNOWN; + variSend = MusECore::CTRL_VAL_UNKNOWN; + chorusSend = MusECore::CTRL_VAL_UNKNOWN; + reverbSend = MusECore::CTRL_VAL_UNKNOWN; addKnob(KNOB_VAR_SEND, tr("VariationSend"), tr("Var"), SLOT(setVariSend(double)), false); addKnob(KNOB_REV_SEND, tr("ReverbSend"), tr("Rev"), SLOT(setReverbSend(double)), false); addKnob(KNOB_CHO_SEND, tr("ChorusSend"), tr("Cho"), SLOT(setChorusSend(double)), false); - ///int auxsSize = song->auxs()->size(); + ///int auxsSize = MusEGlobal::song->auxs()->size(); ///if (auxsSize) //layout->addSpacing((STRIP_WIDTH/2 + 1) * auxsSize); ///grid->addSpacing((STRIP_WIDTH/2 + 1) * auxsSize); // ?? @@ -200,21 +200,21 @@ MidiStrip::MidiStrip(QWidget* parent, MidiTrack* t) // slider, label, meter //--------------------------------------------------- - MidiPort* mp = &midiPorts[t->outPort()]; - MidiController* mc = mp->midiController(CTRL_VOLUME); + MusECore::MidiPort* mp = &MusEGlobal::midiPorts[t->outPort()]; + MusECore::MidiController* mc = mp->midiController(MusECore::CTRL_VOLUME); int chan = t->outChannel(); int mn = mc->minVal(); int mx = mc->maxVal(); - slider = new MusEWidget::Slider(this, "vol", Qt::Vertical, MusEWidget::Slider::None, + slider = new MusEGui::Slider(this, "vol", Qt::Vertical, MusEGui::Slider::None, QColor(100, 255, 100)); slider->setCursorHoming(true); slider->setRange(double(mn), double(mx), 1.0); slider->setFixedWidth(20); - slider->setFont(MusEConfig::config.fonts[1]); - slider->setId(CTRL_VOLUME); + slider->setFont(MusEGlobal::config.fonts[1]); + slider->setId(MusECore::CTRL_VOLUME); - meter[0] = new MusEWidget::Meter(this, MusEWidget::Meter::LinMeter); + meter[0] = new MusEGui::Meter(this, MusEGui::Meter::LinMeter); meter[0]->setRange(0, 127.0); meter[0]->setFixedWidth(15); connect(meter[0], SIGNAL(mousePress()), this, SLOT(resetPeaks())); @@ -225,8 +225,8 @@ MidiStrip::MidiStrip(QWidget* parent, MidiTrack* t) sliderGrid->addWidget(meter[0], 0, 1, Qt::AlignHCenter); grid->addLayout(sliderGrid, _curGridRow++, 0, 1, 2); - sl = new MusEWidget::DoubleLabel(0.0, -98.0, 0.0, this); - sl->setFont(MusEConfig::config.fonts[1]); + sl = new MusEGui::DoubleLabel(0.0, -98.0, 0.0, this); + sl->setFont(MusEGlobal::config.fonts[1]); sl->setBackgroundRole(QPalette::Mid); sl->setSpecialText(tr("off")); sl->setSuffix(tr("dB")); @@ -238,13 +238,13 @@ MidiStrip::MidiStrip(QWidget* parent, MidiTrack* t) sl->setSlider(slider); double dlv; - int v = mp->hwCtrlState(chan, CTRL_VOLUME); - if(v == CTRL_VAL_UNKNOWN) + int v = mp->hwCtrlState(chan, MusECore::CTRL_VOLUME); + if(v == MusECore::CTRL_VAL_UNKNOWN) { - int lastv = mp->lastValidHWCtrlState(chan, CTRL_VOLUME); - if(lastv == CTRL_VAL_UNKNOWN) + int lastv = mp->lastValidHWCtrlState(chan, MusECore::CTRL_VOLUME); + if(lastv == MusECore::CTRL_VAL_UNKNOWN) { - if(mc->initVal() == CTRL_VAL_UNKNOWN) + if(mc->initVal() == MusECore::CTRL_VAL_UNKNOWN) v = 0; else v = mc->initVal(); @@ -259,7 +259,7 @@ MidiStrip::MidiStrip(QWidget* parent, 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(); } @@ -293,7 +293,7 @@ MidiStrip::MidiStrip(QWidget* parent, MidiTrack* t) // record, mixdownfile //--------------------------------------------------- - record = new MusEWidget::TransparentToolButton(this); + record = new MusEGui::TransparentToolButton(this); record->setBackgroundRole(QPalette::Mid); record->setCheckable(true); record->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); @@ -335,7 +335,7 @@ MidiStrip::MidiStrip(QWidget* parent, MidiTrack* t) // Special here: Must make label same size as the 'exit' button would be IF this were an audio strip... // (The 'exit1' icon is BIGGER than the 'record on' icon.) - MusEWidget::TransparentToolButton* off = new MusEWidget::TransparentToolButton(this); + MusEGui::TransparentToolButton* off = new MusEGui::TransparentToolButton(this); QIcon iconOff; iconOff.addPixmap(*exit1Icon, QIcon::Normal, QIcon::On); iconOff.addPixmap(*exitIcon, QIcon::Normal, QIcon::Off); @@ -354,14 +354,14 @@ MidiStrip::MidiStrip(QWidget* parent, MidiTrack* t) dcs.sprintf("%d-%d", port + 1, channel + 1); dev_ch_label->setText(dcs); //dev_ch_label->setBackgroundColor(QColor(0, 160, 255)); // Med blue - //dev_ch_label->setFont(MusEConfig::config.fonts[6]); - dev_ch_label->setFont(MusEConfig::config.fonts[1]); + //dev_ch_label->setFont(MusEGlobal::config.fonts[6]); + dev_ch_label->setFont(MusEGlobal::config.fonts[1]); // Dealing with a horizontally constrained label. Ignore vertical. Use a minimum readable point size. - //autoAdjustFontSize(dev_ch_label, dev_ch_label->text(), false, true, MusEConfig::config.fonts[6].pointSize(), 5); + //autoAdjustFontSize(dev_ch_label, dev_ch_label->text(), false, true, MusEGlobal::config.fonts[6].pointSize(), 5); QToolTip::add(dev_ch_label, tr("output port and channel")); */ - off = new MusEWidget::TransparentToolButton(this); + off = new MusEGui::TransparentToolButton(this); off->setBackgroundRole(QPalette::Mid); off->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); off->setCheckable(true); @@ -381,7 +381,7 @@ MidiStrip::MidiStrip(QWidget* parent, MidiTrack* t) //--------------------------------------------------- iR = new QToolButton(); - iR->setFont(MusEConfig::config.fonts[1]); + iR->setFont(MusEGlobal::config.fonts[1]); iR->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); iR->setText(tr("iR")); iR->setCheckable(false); @@ -389,7 +389,7 @@ MidiStrip::MidiStrip(QWidget* parent, MidiTrack* t) grid->addWidget(iR, _curGridRow, 0); connect(iR, SIGNAL(pressed()), SLOT(iRoutePressed())); oR = new QToolButton(); - oR->setFont(MusEConfig::config.fonts[1]); + oR->setFont(MusEGlobal::config.fonts[1]); oR->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); oR->setText(tr("oR")); oR->setCheckable(false); @@ -404,8 +404,8 @@ MidiStrip::MidiStrip(QWidget* parent, MidiTrack* t) // automation mode //--------------------------------------------------- - autoType = new MusEWidget::ComboBox(); - autoType->setFont(MusEConfig::config.fonts[1]); + autoType = new MusEGui::ComboBox(); + autoType->setFont(MusEGlobal::config.fonts[1]); autoType->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); autoType->setEnabled(false); @@ -502,7 +502,7 @@ void MidiStrip::songChanged(int val) if (val & SC_CONFIG) { // Set the strip label's font. - //label->setFont(MusEConfig::config.fonts[1]); + //label->setFont(MusEGlobal::config.fonts[1]); setLabelFont(); } } @@ -513,7 +513,7 @@ void MidiStrip::songChanged(int val) void MidiStrip::controlRightClicked(const QPoint &p, int id) { - song->execMidiAutomationCtlPopup((MidiTrack*)track, 0, p, id); + MusEGlobal::song->execMidiAutomationCtlPopup((MusECore::MidiTrack*)track, 0, p, id); } //--------------------------------------------------------- @@ -523,40 +523,40 @@ void MidiStrip::controlRightClicked(const QPoint &p, int id) void MidiStrip::labelDoubleClicked(int idx) { //int mn, mx, v; - //int num = CTRL_VOLUME; + //int num = MusECore::CTRL_VOLUME; int num; switch(idx) { case KNOB_PAN: - num = CTRL_PANPOT; + num = MusECore::CTRL_PANPOT; break; case KNOB_VAR_SEND: - num = CTRL_VARIATION_SEND; + num = MusECore::CTRL_VARIATION_SEND; break; case KNOB_REV_SEND: - num = CTRL_REVERB_SEND; + num = MusECore::CTRL_REVERB_SEND; break; case KNOB_CHO_SEND: - num = CTRL_CHORUS_SEND; + num = MusECore::CTRL_CHORUS_SEND; break; //case -1: default: - num = CTRL_VOLUME; + num = MusECore::CTRL_VOLUME; break; } - int outport = ((MidiTrack*)track)->outPort(); - int chan = ((MidiTrack*)track)->outChannel(); - MidiPort* mp = &midiPorts[outport]; - MidiController* mc = mp->midiController(num); + int outport = ((MusECore::MidiTrack*)track)->outPort(); + int chan = ((MusECore::MidiTrack*)track)->outChannel(); + MusECore::MidiPort* mp = &MusEGlobal::midiPorts[outport]; + MusECore::MidiController* mc = mp->midiController(num); int lastv = mp->lastValidHWCtrlState(chan, num); int curv = mp->hwCtrlState(chan, num); - if(curv == CTRL_VAL_UNKNOWN) + if(curv == MusECore::CTRL_VAL_UNKNOWN) { // If no value has ever been set yet, use the current knob value // (or the controller's initial value?) to 'turn on' the controller. - if(lastv == CTRL_VAL_UNKNOWN) + if(lastv == MusECore::CTRL_VAL_UNKNOWN) { //int kiv = _ctrl->initVal()); int kiv; @@ -570,23 +570,23 @@ void MidiStrip::labelDoubleClicked(int idx) kiv = mc->maxVal(); kiv += mc->bias(); - //MidiPlayEvent ev(song->cpos(), outport, chan, ME_CONTROLLER, num, kiv); - MidiPlayEvent ev(0, outport, chan, ME_CONTROLLER, num, kiv); - audio->msgPlayMidiEvent(&ev); + //MusECore::MidiPlayEvent ev(MusEGlobal::song->cpos(), outport, chan, MusECore::ME_CONTROLLER, num, kiv); + MusECore::MidiPlayEvent ev(0, outport, chan, MusECore::ME_CONTROLLER, num, kiv); + MusEGlobal::audio->msgPlayMidiEvent(&ev); } else { - //MidiPlayEvent ev(song->cpos(), outport, chan, ME_CONTROLLER, num, lastv); - MidiPlayEvent ev(0, outport, chan, ME_CONTROLLER, num, lastv); - audio->msgPlayMidiEvent(&ev); + //MidiPlayEvent ev(MusEGlobal::song->cpos(), outport, chan, MusECore::ME_CONTROLLER, num, lastv); + MusECore::MidiPlayEvent ev(0, outport, chan, MusECore::ME_CONTROLLER, num, lastv); + MusEGlobal::audio->msgPlayMidiEvent(&ev); } } else { - if(mp->hwCtrlState(chan, num) != CTRL_VAL_UNKNOWN) - audio->msgSetHwCtrlState(mp, chan, num, CTRL_VAL_UNKNOWN); + if(mp->hwCtrlState(chan, num) != MusECore::CTRL_VAL_UNKNOWN) + MusEGlobal::audio->msgSetHwCtrlState(mp, chan, num, MusECore::CTRL_VAL_UNKNOWN); } - song->update(SC_MIDI_CONTROLLER); + MusEGlobal::song->update(SC_MIDI_CONTROLLER); } @@ -597,7 +597,7 @@ void MidiStrip::labelDoubleClicked(int idx) void MidiStrip::offToggled(bool val) { track->setOff(val); - song->update(SC_MUTE); + MusEGlobal::song->update(SC_MUTE); } /* @@ -645,25 +645,25 @@ void MidiStrip::heartBeat() void MidiStrip::updateControls() { bool en; - int channel = ((MidiTrack*)track)->outChannel(); - MidiPort* mp = &midiPorts[((MidiTrack*)track)->outPort()]; - MidiCtrlValListList* mc = mp->controller(); - ciMidiCtrlValList icl; + int channel = ((MusECore::MidiTrack*)track)->outChannel(); + MusECore::MidiPort* mp = &MusEGlobal::midiPorts[((MusECore::MidiTrack*)track)->outPort()]; + MusECore::MidiCtrlValListList* mc = mp->controller(); + MusECore::ciMidiCtrlValList icl; - MidiController* ctrl = mp->midiController(CTRL_VOLUME); - int nvolume = mp->hwCtrlState(channel, CTRL_VOLUME); - if(nvolume == CTRL_VAL_UNKNOWN) + MusECore::MidiController* ctrl = mp->midiController(MusECore::CTRL_VOLUME); + int nvolume = mp->hwCtrlState(channel, MusECore::CTRL_VOLUME); + if(nvolume == MusECore::CTRL_VAL_UNKNOWN) { //if(nvolume != volume) //{ - // MusEWidget::DoubleLabel ignores the value if already set... + // MusEGui::DoubleLabel ignores the value if already set... sl->setValue(sl->off() - 1.0); //volume = nvolume; //} - volume = CTRL_VAL_UNKNOWN; - nvolume = mp->lastValidHWCtrlState(channel, CTRL_VOLUME); + volume = MusECore::CTRL_VAL_UNKNOWN; + nvolume = mp->lastValidHWCtrlState(channel, MusECore::CTRL_VOLUME); //if(nvolume != volume) - if(nvolume != CTRL_VAL_UNKNOWN) + if(nvolume != MusECore::CTRL_VAL_UNKNOWN) { nvolume -= ctrl->bias(); //slider->blockSignals(true); @@ -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"); @@ -714,19 +714,19 @@ void MidiStrip::updateControls() KNOB* gcon = &controller[KNOB_PAN]; - ctrl = mp->midiController(CTRL_PANPOT); - int npan = mp->hwCtrlState(channel, CTRL_PANPOT); - if(npan == CTRL_VAL_UNKNOWN) + ctrl = mp->midiController(MusECore::CTRL_PANPOT); + int npan = mp->hwCtrlState(channel, MusECore::CTRL_PANPOT); + if(npan == MusECore::CTRL_VAL_UNKNOWN) { - // MusEWidget::DoubleLabel ignores the value if already set... + // MusEGui::DoubleLabel ignores the value if already set... //if(npan != pan) //{ gcon->dl->setValue(gcon->dl->off() - 1.0); //pan = npan; //} - pan = CTRL_VAL_UNKNOWN; - npan = mp->lastValidHWCtrlState(channel, CTRL_PANPOT); - if(npan != CTRL_VAL_UNKNOWN) + pan = MusECore::CTRL_VAL_UNKNOWN; + npan = mp->lastValidHWCtrlState(channel, MusECore::CTRL_PANPOT); + if(npan != MusECore::CTRL_VAL_UNKNOWN) { npan -= ctrl->bias(); if(double(npan) != gcon->knob->value()) @@ -753,7 +753,7 @@ void MidiStrip::updateControls() } - icl = mc->find(channel, CTRL_VARIATION_SEND); + icl = mc->find(channel, MusECore::CTRL_VARIATION_SEND); en = icl != mc->end(); gcon = &controller[KNOB_VAR_SEND]; @@ -766,19 +766,19 @@ void MidiStrip::updateControls() if(en) { - ctrl = mp->midiController(CTRL_VARIATION_SEND); + ctrl = mp->midiController(MusECore::CTRL_VARIATION_SEND); int nvariSend = icl->second->hwVal(); - if(nvariSend == CTRL_VAL_UNKNOWN) + if(nvariSend == MusECore::CTRL_VAL_UNKNOWN) { - // MusEWidget::DoubleLabel ignores the value if already set... + // MusEGui::DoubleLabel ignores the value if already set... //if(nvariSend != variSend) //{ gcon->dl->setValue(gcon->dl->off() - 1.0); //variSend = nvariSend; //} - variSend = CTRL_VAL_UNKNOWN; - nvariSend = mp->lastValidHWCtrlState(channel, CTRL_VARIATION_SEND); - if(nvariSend != CTRL_VAL_UNKNOWN) + variSend = MusECore::CTRL_VAL_UNKNOWN; + nvariSend = mp->lastValidHWCtrlState(channel, MusECore::CTRL_VARIATION_SEND); + if(nvariSend != MusECore::CTRL_VAL_UNKNOWN) { nvariSend -= ctrl->bias(); if(double(nvariSend) != gcon->knob->value()) @@ -801,7 +801,7 @@ void MidiStrip::updateControls() } } - icl = mc->find(channel, CTRL_REVERB_SEND); + icl = mc->find(channel, MusECore::CTRL_REVERB_SEND); en = icl != mc->end(); gcon = &controller[KNOB_REV_SEND]; @@ -814,19 +814,19 @@ void MidiStrip::updateControls() if(en) { - ctrl = mp->midiController(CTRL_REVERB_SEND); + ctrl = mp->midiController(MusECore::CTRL_REVERB_SEND); int nreverbSend = icl->second->hwVal(); - if(nreverbSend == CTRL_VAL_UNKNOWN) + if(nreverbSend == MusECore::CTRL_VAL_UNKNOWN) { - // MusEWidget::DoubleLabel ignores the value if already set... + // MusEGui::DoubleLabel ignores the value if already set... //if(nreverbSend != reverbSend) //{ gcon->dl->setValue(gcon->dl->off() - 1.0); //reverbSend = nreverbSend; //} - reverbSend = CTRL_VAL_UNKNOWN; - nreverbSend = mp->lastValidHWCtrlState(channel, CTRL_REVERB_SEND); - if(nreverbSend != CTRL_VAL_UNKNOWN) + reverbSend = MusECore::CTRL_VAL_UNKNOWN; + nreverbSend = mp->lastValidHWCtrlState(channel, MusECore::CTRL_REVERB_SEND); + if(nreverbSend != MusECore::CTRL_VAL_UNKNOWN) { nreverbSend -= ctrl->bias(); if(double(nreverbSend) != gcon->knob->value()) @@ -849,7 +849,7 @@ void MidiStrip::updateControls() } } - icl = mc->find(channel, CTRL_CHORUS_SEND); + icl = mc->find(channel, MusECore::CTRL_CHORUS_SEND); en = icl != mc->end(); gcon = &controller[KNOB_CHO_SEND]; @@ -862,19 +862,19 @@ void MidiStrip::updateControls() if(en) { - ctrl = mp->midiController(CTRL_CHORUS_SEND); + ctrl = mp->midiController(MusECore::CTRL_CHORUS_SEND); int nchorusSend = icl->second->hwVal(); - if(nchorusSend == CTRL_VAL_UNKNOWN) + if(nchorusSend == MusECore::CTRL_VAL_UNKNOWN) { - // MusEWidget::DoubleLabel ignores the value if already set... + // MusEGui::DoubleLabel ignores the value if already set... //if(nchorusSend != chorusSend) //{ gcon->dl->setValue(gcon->dl->off() - 1.0); //chorusSend = nchorusSend; //} - chorusSend = CTRL_VAL_UNKNOWN; - nchorusSend = mp->lastValidHWCtrlState(channel, CTRL_CHORUS_SEND); - if(nchorusSend != CTRL_VAL_UNKNOWN) + chorusSend = MusECore::CTRL_VAL_UNKNOWN; + nchorusSend = mp->lastValidHWCtrlState(channel, MusECore::CTRL_CHORUS_SEND); + if(nchorusSend != MusECore::CTRL_VAL_UNKNOWN) { nchorusSend -= ctrl->bias(); if(double(nchorusSend) != gcon->knob->value()) @@ -904,28 +904,28 @@ void MidiStrip::ctrlChanged(int num, int val) if (inHeartBeat) return; - MidiTrack* t = (MidiTrack*) track; + MusECore::MidiTrack* t = (MusECore::MidiTrack*) track; int port = t->outPort(); int chan = t->outChannel(); - MidiPort* mp = &midiPorts[port]; - MidiController* mctl = mp->midiController(num); + MusECore::MidiPort* mp = &MusEGlobal::midiPorts[port]; + MusECore::MidiController* mctl = mp->midiController(num); if((val < mctl->minVal()) || (val > mctl->maxVal())) { - if(mp->hwCtrlState(chan, num) != CTRL_VAL_UNKNOWN) - audio->msgSetHwCtrlState(mp, chan, num, CTRL_VAL_UNKNOWN); + if(mp->hwCtrlState(chan, num) != MusECore::CTRL_VAL_UNKNOWN) + MusEGlobal::audio->msgSetHwCtrlState(mp, chan, num, MusECore::CTRL_VAL_UNKNOWN); } else { val += mctl->bias(); - int tick = song->cpos(); + int tick = MusEGlobal::song->cpos(); - MidiPlayEvent ev(tick, port, chan, ME_CONTROLLER, num, val); + MusECore::MidiPlayEvent ev(tick, port, chan, MusECore::ME_CONTROLLER, num, val); - audio->msgPlayMidiEvent(&ev); + MusEGlobal::audio->msgPlayMidiEvent(&ev); } - song->update(SC_MIDI_CONTROLLER); + MusEGlobal::song->update(SC_MIDI_CONTROLLER); } //--------------------------------------------------------- @@ -936,7 +936,7 @@ void MidiStrip::volLabelChanged(double val) { val = sqrt( float(127*127) / pow(10.0, -val/20.0) ); - ctrlChanged(CTRL_VOLUME, lrint(val)); + ctrlChanged(MusECore::CTRL_VOLUME, lrint(val)); } @@ -948,7 +948,7 @@ void MidiStrip::setVolume(double val) { // printf("Vol %d\n", lrint(val)); - ctrlChanged(CTRL_VOLUME, lrint(val)); + ctrlChanged(MusECore::CTRL_VOLUME, lrint(val)); } //--------------------------------------------------------- @@ -958,7 +958,7 @@ void MidiStrip::setVolume(double val) void MidiStrip::setPan(double val) { - ctrlChanged(CTRL_PANPOT, lrint(val)); + ctrlChanged(MusECore::CTRL_PANPOT, lrint(val)); } //--------------------------------------------------------- @@ -967,7 +967,7 @@ void MidiStrip::setPan(double val) void MidiStrip::setVariSend(double val) { - ctrlChanged(CTRL_VARIATION_SEND, lrint(val)); + ctrlChanged(MusECore::CTRL_VARIATION_SEND, lrint(val)); } //--------------------------------------------------------- @@ -976,7 +976,7 @@ void MidiStrip::setVariSend(double val) void MidiStrip::setChorusSend(double val) { - ctrlChanged(CTRL_CHORUS_SEND, lrint(val)); + ctrlChanged(MusECore::CTRL_CHORUS_SEND, lrint(val)); } //--------------------------------------------------------- @@ -985,7 +985,7 @@ void MidiStrip::setChorusSend(double val) void MidiStrip::setReverbSend(double val) { - ctrlChanged(CTRL_REVERB_SEND, lrint(val)); + ctrlChanged(MusECore::CTRL_REVERB_SEND, lrint(val)); } //--------------------------------------------------------- @@ -994,7 +994,7 @@ void MidiStrip::setReverbSend(double val) void MidiStrip::iRoutePressed() { - MusEWidget::RoutePopupMenu* pup = MusEGlobal::muse->getRoutingPopupMenu(); + MusEGui::RoutePopupMenu* pup = MusEGlobal::muse->getRoutingPopupMenu(); iR->setDown(false); pup->exec(QCursor::pos(), track, false); } @@ -1005,9 +1005,9 @@ void MidiStrip::iRoutePressed() void MidiStrip::oRoutePressed() { - MusEWidget::RoutePopupMenu* pup = MusEGlobal::muse->getRoutingPopupMenu(); + MusEGui::RoutePopupMenu* pup = MusEGlobal::muse->getRoutingPopupMenu(); oR->setDown(false); pup->exec(QCursor::pos(), track, true); } -} // namespace MusEMixer +} // namespace MusEGui diff --git a/muse2/muse/mixer/mstrip.h b/muse2/muse/mixer/mstrip.h index 0535eaa8..bb095363 100644 --- a/muse2/muse/mixer/mstrip.h +++ b/muse2/muse/mixer/mstrip.h @@ -33,16 +33,15 @@ class QDialog; class QLabel; class QString; -namespace MusEWidget { +namespace MusECore { +class MidiTrack; +} + +namespace MusEGui { class DoubleLabel; class Knob; class Slider; class TransparentToolButton; -} - -class MidiTrack; - -namespace MusEMixer { //--------------------------------------------------------- // MidiStrip @@ -51,13 +50,13 @@ namespace MusEMixer { class MidiStrip : public Strip { Q_OBJECT - MusEWidget::Slider* slider; - MusEWidget::DoubleLabel* sl; - MusEWidget::TransparentToolButton* off; + MusEGui::Slider* slider; + MusEGui::DoubleLabel* sl; + MusEGui::TransparentToolButton* off; struct KNOB { - MusEWidget::Knob* knob; - MusEWidget::DoubleLabel* dl; + MusEGui::Knob* knob; + MusEGui::DoubleLabel* dl; QLabel* lb; } controller[4]; // pan variation reverb chorus @@ -93,10 +92,10 @@ class MidiStrip : public Strip { virtual void songChanged(int); public: - MidiStrip(QWidget* parent, MidiTrack*); + MidiStrip(QWidget* parent, MusECore::MidiTrack*); }; -} // namespace MusEMixer +} // namespace MusEGui #endif diff --git a/muse2/muse/mixer/panknob.cpp b/muse2/muse/mixer/panknob.cpp index 9a12d58f..dc2564a7 100644 --- a/muse2/muse/mixer/panknob.cpp +++ b/muse2/muse/mixer/panknob.cpp @@ -26,14 +26,14 @@ #include "panknob.h" #include "track.h" -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // PanKnob //--------------------------------------------------------- PanKnob::PanKnob(QWidget* parent, AudioTrack* s) - : MusEWidget::Knob(parent, "pan") + : MusEGui::Knob(parent, "pan") { src = s; connect(this, SIGNAL(valueChanged(double,int)), SLOT(valueChanged(double))); @@ -48,7 +48,7 @@ void PanKnob::valueChanged(double val) //audio->msgSetPan(src, val); // p4.0.21 audio->msgXXX waits. Do we really need to? src->setPan(val); - song->controllerChange(src); + MusEGlobal::song->controllerChange(src); } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/mixer/panknob.h b/muse2/muse/mixer/panknob.h index 7f0d3232..3e6ecb4c 100644 --- a/muse2/muse/mixer/panknob.h +++ b/muse2/muse/mixer/panknob.h @@ -28,7 +28,7 @@ class AudioTrack; -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // PanKnob @@ -45,7 +45,7 @@ class PanKnob : public Knob { PanKnob(QWidget* parent, AudioTrack*); }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/mixer/rack.cpp b/muse2/muse/mixer/rack.cpp index 7daf142d..0ba03beb 100644 --- a/muse2/muse/mixer/rack.cpp +++ b/muse2/muse/mixer/rack.cpp @@ -46,7 +46,7 @@ #include "plugin.h" #include "filedialog.h" -namespace MusEMixer { +namespace MusEGui { //--------------------------------------------------------- // class EffectRackDelegate @@ -55,16 +55,16 @@ namespace MusEMixer { class EffectRackDelegate : public QStyledItemDelegate { EffectRack* er; - AudioTrack* tr; + MusECore::AudioTrack* tr; public: void paint ( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const; - EffectRackDelegate(QObject * parent, AudioTrack* at ); + EffectRackDelegate(QObject * parent, MusECore::AudioTrack* at ); }; -EffectRackDelegate::EffectRackDelegate(QObject * parent, AudioTrack* at ) : QStyledItemDelegate(parent) { +EffectRackDelegate::EffectRackDelegate(QObject * parent, MusECore::AudioTrack* at ) : QStyledItemDelegate(parent) { er = (EffectRack*) parent; tr = at; } @@ -125,10 +125,10 @@ void EffectRackDelegate::paint ( QPainter * painter, const QStyleOptionViewItem class RackSlot : public QListWidgetItem { int idx; - AudioTrack* node; + MusECore::AudioTrack* node; public: - RackSlot(QListWidget* lb, AudioTrack* t, int i, int h); + RackSlot(QListWidget* lb, MusECore::AudioTrack* t, int i, int h); ~RackSlot(); void setBackgroundColor(const QBrush& brush) {setBackground(brush);}; }; @@ -142,7 +142,7 @@ RackSlot::~RackSlot() // RackSlot //--------------------------------------------------------- -RackSlot::RackSlot(QListWidget* b, AudioTrack* t, int i, int h) +RackSlot::RackSlot(QListWidget* b, MusECore::AudioTrack* t, int i, int h) : QListWidgetItem(b) { node = t; @@ -154,14 +154,14 @@ RackSlot::RackSlot(QListWidget* b, AudioTrack* t, int i, int h) // EffectRack //--------------------------------------------------------- -EffectRack::EffectRack(QWidget* parent, AudioTrack* t) +EffectRack::EffectRack(QWidget* parent, MusECore::AudioTrack* t) : QListWidget(parent) { setObjectName("Rack"); setAttribute(Qt::WA_DeleteOnClose); track = t; itemheight = 19; - setFont(MusEConfig::config.fonts[1]); + setFont(MusEGlobal::config.fonts[1]); activeColor = QColor(74, 165, 49); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); @@ -174,7 +174,7 @@ EffectRack::EffectRack(QWidget* parent, AudioTrack* t) connect(this, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(doubleClicked(QListWidgetItem*))); - connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); + connect(MusEGlobal::song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); EffectRackDelegate* er_delegate = new EffectRackDelegate(this, track); setItemDelegate(er_delegate); @@ -235,9 +235,9 @@ QSize EffectRack::sizeHint() const void EffectRack::choosePlugin(QListWidgetItem* it, bool replace) { - Plugin* plugin = PluginDialog::getPlugin(this); + MusECore::Plugin* plugin = PluginDialog::getPlugin(this); if (plugin) { - PluginI* plugi = new PluginI(); + MusECore::PluginI* plugi = new MusECore::PluginI(); if (plugi->initPluginInstance(plugin, track->channels())) { printf("cannot instantiate plugin <%s>\n", plugin->name().toLatin1().constData()); @@ -246,8 +246,8 @@ void EffectRack::choosePlugin(QListWidgetItem* it, bool replace) } int idx = row(it); if (replace) - audio->msgAddPlugin(track, idx, 0); - audio->msgAddPlugin(track, idx, plugi); + MusEGlobal::audio->msgAddPlugin(track, idx, 0); + MusEGlobal::audio->msgAddPlugin(track, idx, plugi); updateContents(); } } @@ -264,7 +264,7 @@ void EffectRack::menuRequested(QListWidgetItem* it) int idx = row(curitem); QString name; //bool mute; - Pipeline* pipe = track->efxPipe(); + MusECore::Pipeline* pipe = track->efxPipe(); if (pipe) { name = pipe->name(idx); //mute = pipe->isOn(idx); @@ -351,7 +351,7 @@ void EffectRack::menuRequested(QListWidgetItem* it) break; } case REMOVE: - audio->msgAddPlugin(track, idx, 0); + MusEGlobal::audio->msgAddPlugin(track, idx, 0); break; case BYPASS: { @@ -388,7 +388,7 @@ void EffectRack::menuRequested(QListWidgetItem* it) break; } updateContents(); - song->update(SC_RACK); + MusEGlobal::song->update(SC_RACK); } //--------------------------------------------------------- @@ -403,7 +403,7 @@ void EffectRack::doubleClicked(QListWidgetItem* it) RackSlot* item = (RackSlot*)it; int idx = row(item); - Pipeline* pipe = track->efxPipe(); + MusECore::Pipeline* pipe = track->efxPipe(); if (pipe->name(idx) == QString("empty")) { choosePlugin(it); @@ -417,8 +417,8 @@ void EffectRack::doubleClicked(QListWidgetItem* it) void EffectRack::savePreset(int idx) { - //QString name = MusEWidget::getSaveFileName(QString(""), plug_file_pattern, this, - QString name = MusEWidget::getSaveFileName(QString(""), MusEGlobal::preset_file_save_pattern, this, + //QString name = MusEGui::getSaveFileName(QString(""), plug_file_pattern, this, + QString name = MusEGui::getSaveFileName(QString(""), MusEGlobal::preset_file_save_pattern, this, tr("MusE: Save Preset")); if(name.isEmpty()) @@ -426,14 +426,14 @@ void EffectRack::savePreset(int idx) //FILE* presetFp = fopen(name.ascii(),"w+"); bool popenFlag; - FILE* presetFp = MusEWidget::fileOpen(this, name, QString(".pre"), "w", popenFlag, false, true); + FILE* presetFp = MusEGui::fileOpen(this, name, QString(".pre"), "w", popenFlag, false, true); if (presetFp == 0) { //fprintf(stderr, "EffectRack::savePreset() fopen failed: %s\n", // strerror(errno)); return; } - Xml xml(presetFp); - Pipeline* pipe = track->efxPipe(); + MusECore::Xml xml(presetFp); + MusECore::Pipeline* pipe = track->efxPipe(); if (pipe) { if ((*pipe)[idx] != NULL) { xml.header(); @@ -486,8 +486,8 @@ void EffectRack::startDrag(int idx) strerror(errno)); return; } - Xml xml(tmp); - Pipeline* pipe = track->efxPipe(); + MusECore::Xml xml(tmp); + MusECore::Pipeline* pipe = track->efxPipe(); if (pipe) { if ((*pipe)[idx] != NULL) { xml.header(); @@ -541,7 +541,7 @@ void EffectRack::dropEvent(QDropEvent *event) return; int idx = row(i); - Pipeline* pipe = track->efxPipe(); + MusECore::Pipeline* pipe = track->efxPipe(); if (pipe) { if ((*pipe)[idx] != NULL) { @@ -551,7 +551,7 @@ void EffectRack::dropEvent(QDropEvent *event) if(strcmp(sw->metaObject()->className(), "EffectRack") == 0) { EffectRack *ser = (EffectRack*)sw; - Pipeline* spipe = ser->getTrack()->efxPipe(); + MusECore::Pipeline* spipe = ser->getTrack()->efxPipe(); if(!spipe) return; @@ -565,8 +565,8 @@ void EffectRack::dropEvent(QDropEvent *event) if(QMessageBox::question(this, tr("Replace effect"),tr("Do you really want to replace the effect %1?").arg(pipe->name(idx)), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) == QMessageBox::Yes) { - audio->msgAddPlugin(track, idx, 0); - song->update(SC_RACK); + MusEGlobal::audio->msgAddPlugin(track, idx, 0); + MusEGlobal::song->update(SC_RACK); } else { return; @@ -577,7 +577,7 @@ void EffectRack::dropEvent(QDropEvent *event) { char *tmpStr = new char[event->mimeData()->data("text/x-muse-plugin").size()]; strcpy(tmpStr, event->mimeData()->data("text/x-muse-plugin").data()); - Xml xml(tmpStr); + MusECore::Xml xml(tmpStr); initPlugin(xml, idx); delete tmpStr; } @@ -593,10 +593,10 @@ void EffectRack::dropEvent(QDropEvent *event) { //bool popenFlag = false; bool popenFlag; - FILE* fp = MusEWidget::fileOpen(this, text, ".pre", "r", popenFlag, false, false); + FILE* fp = MusEGui::fileOpen(this, text, ".pre", "r", popenFlag, false, false); if (fp) { - Xml xml(fp); + MusECore::Xml xml(fp); initPlugin(xml, idx); // Added by T356. @@ -639,7 +639,7 @@ void EffectRack::mousePressEvent(QMouseEvent *event) void EffectRack::mouseMoveEvent(QMouseEvent *event) { if (event->buttons() & Qt::LeftButton) { - Pipeline* pipe = track->efxPipe(); + MusECore::Pipeline* pipe = track->efxPipe(); if(!pipe) return; @@ -661,18 +661,18 @@ void EffectRack::mouseMoveEvent(QMouseEvent *event) } -void EffectRack::initPlugin(Xml xml, int idx) +void EffectRack::initPlugin(MusECore::Xml xml, int idx) { for (;;) { - Xml::Token token = xml.parse(); + MusECore::Xml::Token token = xml.parse(); QString tag = xml.s1(); switch (token) { - case Xml::Error: - case Xml::End: + case MusECore::Xml::Error: + case MusECore::Xml::End: return; - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "plugin") { - PluginI* plugi = new PluginI(); + MusECore::PluginI* plugi = new MusECore::PluginI(); if (plugi->readConfiguration(xml, false)) { //QString d; //xml.dump(d); @@ -681,8 +681,8 @@ void EffectRack::initPlugin(Xml xml, int idx) } else { //printf("instantiated!\n"); - audio->msgAddPlugin(track, idx, plugi); - song->update(SC_RACK); + MusEGlobal::audio->msgAddPlugin(track, idx, plugi); + MusEGlobal::song->update(SC_RACK); return; } } @@ -691,9 +691,9 @@ void EffectRack::initPlugin(Xml xml, int idx) else xml.unknown("EffectRack"); break; - case Xml::Attribut: + case MusECore::Xml::Attribut: break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "muse") return; default: @@ -702,4 +702,4 @@ void EffectRack::initPlugin(Xml xml, int idx) } } -} // namespace MusEMixer +} // namespace MusEGui diff --git a/muse2/muse/mixer/rack.h b/muse2/muse/mixer/rack.h index 2ea053bf..49905f48 100644 --- a/muse2/muse/mixer/rack.h +++ b/muse2/muse/mixer/rack.h @@ -31,10 +31,12 @@ class QDragLeaveEvent; class QDropEvent; class QMouseEvent; +namespace MusECore { class AudioTrack; class Xml; +} -namespace MusEMixer { +namespace MusEGui { //--------------------------------------------------------- // EffectRack @@ -44,7 +46,7 @@ class EffectRack : public QListWidget { Q_OBJECT - AudioTrack* track; + MusECore::AudioTrack* track; int itemheight; QColor activeColor; @@ -52,7 +54,7 @@ class EffectRack : public QListWidget { virtual QSize sizeHint() const; void startDrag(int idx); - void initPlugin(Xml xml, int idx); + void initPlugin(MusECore::Xml xml, int idx); QPoint dragPos; void savePreset(int idx); void choosePlugin(QListWidgetItem* item, bool replace = false); @@ -73,16 +75,16 @@ class EffectRack : public QListWidget { Qt::DropActions supportedDropActions () const; public: - EffectRack(QWidget*, AudioTrack* t); + EffectRack(QWidget*, MusECore::AudioTrack* t); ~EffectRack(); - AudioTrack* getTrack() { return track; } + MusECore::AudioTrack* getTrack() { return track; } QPoint getDragPos() { return dragPos; } QColor getActiveColor() { return activeColor; } }; -} // namespace MusEMixer +} // namespace MusEGui #endif diff --git a/muse2/muse/mixer/routedialog.cpp b/muse2/muse/mixer/routedialog.cpp index a9441343..a0b00278 100644 --- a/muse2/muse/mixer/routedialog.cpp +++ b/muse2/muse/mixer/routedialog.cpp @@ -32,7 +32,7 @@ #include "audio.h" #include "driver/jackaudio.h" -namespace MusEDialog { +namespace MusEGui { //--------------------------------------------------------- // RouteDialog @@ -47,7 +47,7 @@ RouteDialog::RouteDialog(QWidget* parent) connect(newDstList, SIGNAL(itemSelectionChanged()), SLOT(dstSelectionChanged())); connect(removeButton, SIGNAL(clicked()), SLOT(removeRoute())); connect(connectButton, SIGNAL(clicked()), SLOT(addRoute())); - connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); + connect(MusEGlobal::song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); routingChanged(); } @@ -65,49 +65,49 @@ void RouteDialog::routingChanged() newSrcList->clear(); newDstList->clear(); - TrackList* tl = song->tracks(); - for (ciTrack i = tl->begin(); i != tl->end(); ++i) { + MusECore::TrackList* tl = MusEGlobal::song->tracks(); + for (MusECore::ciTrack i = tl->begin(); i != tl->end(); ++i) { if ((*i)->isMidiTrack()) continue; // p3.3.38 //WaveTrack* track = (WaveTrack*)(*i); - AudioTrack* track = (AudioTrack*)(*i); - if (track->type() == Track::AUDIO_INPUT) { + MusECore::AudioTrack* track = (MusECore::AudioTrack*)(*i); + if (track->type() == MusECore::Track::AUDIO_INPUT) { for (int channel = 0; channel < track->channels(); ++channel) - newDstList->addItem(Route(track, channel).name()); - const RouteList* rl = track->inRoutes(); - for (ciRoute r = rl->begin(); r != rl->end(); ++r) { - //Route dst(track->name(), true, r->channel); - Route dst(track->name(), true, r->channel, Route::TRACK_ROUTE); + newDstList->addItem(MusECore::Route(track, channel).name()); + const MusECore::RouteList* rl = track->inRoutes(); + for (MusECore::ciRoute r = rl->begin(); r != rl->end(); ++r) { + //MusECore::Route dst(track->name(), true, r->channel); + MusECore::Route dst(track->name(), true, r->channel, MusECore::Route::TRACK_ROUTE); new QTreeWidgetItem(routeList, QStringList() << r->name() << dst.name()); } } - else if (track->type() != Track::AUDIO_AUX) - newDstList->addItem(Route(track, -1).name()); - if (track->type() == Track::AUDIO_OUTPUT) { + else if (track->type() != MusECore::Track::AUDIO_AUX) + newDstList->addItem(MusECore::Route(track, -1).name()); + if (track->type() == MusECore::Track::AUDIO_OUTPUT) { for (int channel = 0; channel < track->channels(); ++channel) { - Route r(track, channel); + MusECore::Route r(track, channel); newSrcList->addItem(r.name()); } } else - newSrcList->addItem(Route(track, -1).name()); + newSrcList->addItem(MusECore::Route(track, -1).name()); - const RouteList* rl = track->outRoutes(); - for (ciRoute r = rl->begin(); r != rl->end(); ++r) { + const MusECore::RouteList* rl = track->outRoutes(); + for (MusECore::ciRoute r = rl->begin(); r != rl->end(); ++r) { QString src(track->name()); - if (track->type() == Track::AUDIO_OUTPUT) { - Route s(src, false, r->channel); + if (track->type() == MusECore::Track::AUDIO_OUTPUT) { + MusECore::Route s(src, false, r->channel); src = s.name(); } new QTreeWidgetItem(routeList, QStringList() << src << r->name()); } } if (!MusEGlobal::checkAudioDevice()) return; - std::list<QString> sl = audioDevice->outputPorts(); + std::list<QString> sl = MusEGlobal::audioDevice->outputPorts(); for (std::list<QString>::iterator i = sl.begin(); i != sl.end(); ++i) newSrcList->addItem(*i); - sl = audioDevice->inputPorts(); + sl = MusEGlobal::audioDevice->inputPorts(); for (std::list<QString>::iterator i = sl.begin(); i != sl.end(); ++i) newDstList->addItem(*i); routeSelectionChanged(); // init remove button @@ -144,9 +144,9 @@ void RouteDialog::removeRoute() QTreeWidgetItem* item = routeList->currentItem(); if (item == 0) return; - audio->msgRemoveRoute(Route(item->text(0), false, -1), Route(item->text(1), true, -1)); - audio->msgUpdateSoloStates(); - song->update(SC_SOLO); + MusEGlobal::audio->msgRemoveRoute(MusECore::Route(item->text(0), false, -1), MusECore::Route(item->text(1), true, -1)); + MusEGlobal::audio->msgUpdateSoloStates(); + MusEGlobal::song->update(SC_SOLO); delete item; } @@ -160,9 +160,9 @@ void RouteDialog::addRoute() QListWidgetItem* dstItem = newDstList->currentItem(); if (srcItem == 0 || dstItem == 0) return; - audio->msgAddRoute(Route(srcItem->text(), false, -1), Route(dstItem->text(), true, -1)); - audio->msgUpdateSoloStates(); - song->update(SC_SOLO); + MusEGlobal::audio->msgAddRoute(MusECore::Route(srcItem->text(), false, -1), MusECore::Route(dstItem->text(), true, -1)); + MusEGlobal::audio->msgUpdateSoloStates(); + MusEGlobal::song->update(SC_SOLO); new QTreeWidgetItem(routeList, QStringList() << srcItem->text() << dstItem->text()); } @@ -176,7 +176,7 @@ void RouteDialog::srcSelectionChanged() QListWidgetItem* dstItem = newDstList->currentItem(); connectButton->setEnabled((srcItem != 0) && (dstItem != 0) - && checkRoute(srcItem->text(), dstItem->text())); + && MusECore::checkRoute(srcItem->text(), dstItem->text())); } //--------------------------------------------------------- @@ -189,7 +189,7 @@ void RouteDialog::dstSelectionChanged() QListWidgetItem* srcItem = newSrcList->currentItem(); connectButton->setEnabled((srcItem != 0) && (dstItem != 0) - && checkRoute(srcItem->text(), dstItem->text())); + && MusECore::checkRoute(srcItem->text(), dstItem->text())); } //--------------------------------------------------------- @@ -202,4 +202,4 @@ void RouteDialog::closeEvent(QCloseEvent* e) e->accept(); } -} // namespace MusEDialog +} // namespace MusEGui diff --git a/muse2/muse/mixer/routedialog.h b/muse2/muse/mixer/routedialog.h index de5dfbc3..4d1856e5 100644 --- a/muse2/muse/mixer/routedialog.h +++ b/muse2/muse/mixer/routedialog.h @@ -29,7 +29,7 @@ class QCloseEvent; class QDialog; -namespace MusEDialog { +namespace MusEGui { //--------------------------------------------------------- // RouteDialog @@ -57,7 +57,7 @@ class RouteDialog : public QDialog, public Ui::RouteDialogBase { }; -} // namespace MusEDialog +} // namespace MusEGui #endif diff --git a/muse2/muse/mixer/strip.cpp b/muse2/muse/mixer/strip.cpp index 67594e3a..5f5e5e39 100644 --- a/muse2/muse/mixer/strip.cpp +++ b/muse2/muse/mixer/strip.cpp @@ -41,7 +41,7 @@ #include "utils.h" #include "icons.h" -namespace MusEMixer { +namespace MusEGui { //--------------------------------------------------------- // setRecordFlag @@ -73,12 +73,12 @@ void Strip::resetPeaks() void Strip::recordToggled(bool val) { - if (track->type() == Track::AUDIO_OUTPUT) { + if (track->type() == MusECore::Track::AUDIO_OUTPUT) { if (val && track->recordFlag() == false) { - MusEGlobal::muse->bounceToFile((AudioOutput*)track); + MusEGlobal::muse->bounceToFile((MusECore::AudioOutput*)track); } - audio->msgSetRecord((AudioOutput*)track, val); - if (!((AudioOutput*)track)->recFile()) + MusEGlobal::audio->msgSetRecord((MusECore::AudioOutput*)track, val); + if (!((MusECore::AudioOutput*)track)->recFile()) { record->setChecked(false); record->setIcon(QIcon(*record_off_Icon)); @@ -86,7 +86,7 @@ void Strip::recordToggled(bool val) } return; } - song->setRecordFlag(track, val); + MusEGlobal::song->setRecordFlag(track, val); } //--------------------------------------------------------- // heartBeat @@ -105,9 +105,9 @@ void Strip::setLabelFont() { // Use the new font #6 I created just for these labels (so far). // Set the label's font. - label->setFont(MusEConfig::config.fonts[6]); + label->setFont(MusEGlobal::config.fonts[6]); // Dealing with a horizontally constrained label. Ignore vertical. Use a minimum readable point size. - MusEUtil::autoAdjustFontSize(label, label->text(), false, true, MusEConfig::config.fonts[6].pointSize(), 5); + MusECore::autoAdjustFontSize(label, label->text(), false, true, MusEGlobal::config.fonts[6].pointSize(), 5); } //--------------------------------------------------------- @@ -118,41 +118,41 @@ void Strip::setLabelText() { QColor c; switch(track->type()) { - case Track::AUDIO_OUTPUT: + case MusECore::Track::AUDIO_OUTPUT: //c = Qt::green; - c = MusEConfig::config.outputTrackLabelBg; + c = MusEGlobal::config.outputTrackLabelBg; break; - case Track::AUDIO_GROUP: + case MusECore::Track::AUDIO_GROUP: //c = Qt::yellow; - c = MusEConfig::config.groupTrackLabelBg; + c = MusEGlobal::config.groupTrackLabelBg; break; - case Track::AUDIO_AUX: + case MusECore::Track::AUDIO_AUX: //c = QColor(120, 255, 255); // Light blue - c = MusEConfig::config.auxTrackLabelBg; + c = MusEGlobal::config.auxTrackLabelBg; break; - case Track::WAVE: + case MusECore::Track::WAVE: //c = Qt::magenta; - c = MusEConfig::config.waveTrackLabelBg; + c = MusEGlobal::config.waveTrackLabelBg; break; - case Track::AUDIO_INPUT: + case MusECore::Track::AUDIO_INPUT: //c = Qt::red; - c = MusEConfig::config.inputTrackLabelBg; + c = MusEGlobal::config.inputTrackLabelBg; break; - case Track::AUDIO_SOFTSYNTH: + case MusECore::Track::AUDIO_SOFTSYNTH: //c = QColor(255, 130, 0); // Med orange - c = MusEConfig::config.synthTrackLabelBg; + c = MusEGlobal::config.synthTrackLabelBg; break; - case Track::MIDI: + case MusECore::Track::MIDI: //c = QColor(0, 160, 255); // Med blue - c = MusEConfig::config.midiTrackLabelBg; + c = MusEGlobal::config.midiTrackLabelBg; break; - case Track::DRUM: + case MusECore::Track::DRUM: //c = QColor(0, 160, 255); // Med blue - c = MusEConfig::config.drumTrackLabelBg; + c = MusEGlobal::config.drumTrackLabelBg; break; - case Track::NEW_DRUM: + case MusECore::Track::NEW_DRUM: //c = QColor(0, 160, 255); // Med blue - c = MusEConfig::config.newDrumTrackLabelBg; + c = MusEGlobal::config.newDrumTrackLabelBg; break; default: return; @@ -182,7 +182,7 @@ void Strip::setLabelText() void Strip::muteToggled(bool val) { track->setMute(val); - song->update(SC_MUTE); + MusEGlobal::song->update(SC_MUTE); } //--------------------------------------------------------- @@ -191,8 +191,8 @@ void Strip::muteToggled(bool val) void Strip::soloToggled(bool val) { - audio->msgSetSolo(track, val); - song->update(SC_SOLO); + MusEGlobal::audio->msgSetSolo(track, val); + MusEGlobal::song->update(SC_SOLO); } //--------------------------------------------------------- @@ -200,7 +200,7 @@ void Strip::soloToggled(bool val) // create mixer strip //--------------------------------------------------------- -Strip::Strip(QWidget* parent, Track* t) +Strip::Strip(QWidget* parent, MusECore::Track* t) : QFrame(parent) { _curGridRow = 0; @@ -244,7 +244,7 @@ Strip::Strip(QWidget* parent, Track* t) // Moved by Tim. p3.3.9 //setLabelText(); - //label->setFont(MusEConfig::config.fonts[1]); + //label->setFont(MusEGlobal::config.fonts[1]); //printf("Strip::Strip w:%d frw:%d layoutmarg:%d lx:%d ly:%d lw:%d lh:%d\n", STRIP_WIDTH, frameWidth(), layout->margin(), label->x(), label->y(), label->width(), label->height()); @@ -297,7 +297,7 @@ Strip::~Strip() void Strip::setAutomationType(int t) { track->setAutomationType(AutomationType(t)); - song->update(SC_AUTOMATION); + MusEGlobal::song->update(SC_AUTOMATION); } void Strip::resizeEvent(QResizeEvent* ev) @@ -309,4 +309,4 @@ void Strip::resizeEvent(QResizeEvent* ev) } -} // namespace MusEMixer +} // namespace MusEGui diff --git a/muse2/muse/mixer/strip.h b/muse2/muse/mixer/strip.h index f5749177..5b3b541b 100644 --- a/muse2/muse/mixer/strip.h +++ b/muse2/muse/mixer/strip.h @@ -34,18 +34,18 @@ #include "globaldefs.h" //#include "route.h" -class Track; class QLabel; //class QVBoxLayout; class QToolButton; class QGridLayout; -namespace MusEWidget { -class ComboBox; -class Meter; +namespace MusECore { +class Track; } -namespace MusEMixer { +namespace MusEGui { +class ComboBox; +class Meter; static const int STRIP_WIDTH = 65; @@ -57,12 +57,12 @@ class Strip : public QFrame { Q_OBJECT protected: - Track* track; + MusECore::Track* track; QLabel* label; //QVBoxLayout* layout; QGridLayout* grid; int _curGridRow; - MusEWidget::Meter* meter[MAX_CHANNELS]; + MusEGui::Meter* meter[MAX_CHANNELS]; QToolButton* record; QToolButton* solo; @@ -70,7 +70,7 @@ class Strip : public QFrame { QToolButton* iR; // Input routing button QToolButton* oR; // Output routing button QGridLayout* sliderGrid; - MusEWidget::ComboBox* autoType; + MusEGui::ComboBox* autoType; void setLabelText(); virtual void resizeEvent(QResizeEvent*); @@ -88,14 +88,14 @@ class Strip : public QFrame { virtual void songChanged(int) = 0; public: - Strip(QWidget* parent, Track* t); + Strip(QWidget* parent, MusECore::Track* t); ~Strip(); void setRecordFlag(bool flag); - Track* getTrack() const { return track; } + MusECore::Track* getTrack() const { return track; } void setLabelFont(); }; -} // namespace MusEMixer +} // namespace MusEGui #endif diff --git a/muse2/muse/mpevent.cpp b/muse2/muse/mpevent.cpp index 67ba968c..f72af528 100644 --- a/muse2/muse/mpevent.cpp +++ b/muse2/muse/mpevent.cpp @@ -29,6 +29,8 @@ #include "midiport.h" #include "muse/midi.h" +namespace MusECore { + //--------------------------------------------------------- // MEvent //--------------------------------------------------------- @@ -88,7 +90,7 @@ void MEvent::dump() const { printf("time:%d port:%d chan:%d ", _time, _port, _channel+1); if (_type == 0x90) { // NoteOn - QString s = MusEUtil::pitch2string(_a); + QString s = pitch2string(_a); printf("NoteOn %s(0x%x) %d\n", s.toLatin1().constData(), _a, _b); } else if (_type == 0xf0) { @@ -223,4 +225,4 @@ void MidiRecFifo::remove() --size; } - +} // namespace MusECore diff --git a/muse2/muse/mpevent.h b/muse2/muse/mpevent.h index 4d957adf..fde7c588 100644 --- a/muse2/muse/mpevent.h +++ b/muse2/muse/mpevent.h @@ -38,6 +38,8 @@ //#define MIDI_REC_FIFO_SIZE 512 #define MIDI_REC_FIFO_SIZE 160 +namespace MusECore { + class Event; class EvData; @@ -111,8 +113,6 @@ class MEvent { // allocated and deleted in midiseq thread context //--------------------------------------------------------- -class MidiPlayEvent; - class MidiRecordEvent : public MEvent { public: MidiRecordEvent() : MEvent() {} @@ -224,5 +224,7 @@ class MidiRecFifo { int getSize() const { return size; } }; +} // namespace MusECore + #endif diff --git a/muse2/muse/mplugins/midifilter.ui b/muse2/muse/mplugins/midifilter.ui index 55263f2f..3ddb6477 100644 --- a/muse2/muse/mplugins/midifilter.ui +++ b/muse2/muse/mplugins/midifilter.ui @@ -269,16 +269,16 @@ <number>11</number> </property> <item> - <widget class="MusEWidget::CtrlComboBox" name="cb1" native="true"/> + <widget class="MusEGui::CtrlComboBox" name="cb1" native="true"/> </item> <item> - <widget class="MusEWidget::CtrlComboBox" name="cb2" native="true"/> + <widget class="MusEGui::CtrlComboBox" name="cb2" native="true"/> </item> <item> - <widget class="MusEWidget::CtrlComboBox" name="cb3" native="true"/> + <widget class="MusEGui::CtrlComboBox" name="cb3" native="true"/> </item> <item> - <widget class="MusEWidget::CtrlComboBox" name="cb4" native="true"/> + <widget class="MusEGui::CtrlComboBox" name="cb4" native="true"/> </item> </layout> </widget> @@ -685,7 +685,7 @@ <layoutdefault spacing="6" margin="11"/> <customwidgets> <customwidget> - <class>MusEWidget::CtrlComboBox</class> + <class>MusEGui::CtrlComboBox</class> <extends>QWidget</extends> <header location="global">ctrlcombo.h</header> </customwidget> diff --git a/muse2/muse/mplugins/midifilterimpl.cpp b/muse2/muse/mplugins/midifilterimpl.cpp index 50dcd601..d3316540 100644 --- a/muse2/muse/mplugins/midifilterimpl.cpp +++ b/muse2/muse/mplugins/midifilterimpl.cpp @@ -27,6 +27,8 @@ #include <QDialog> #include <QCloseEvent> +namespace MusEGui { + //--------------------------------------------------------- // setCtrl //--------------------------------------------------------- @@ -142,4 +144,5 @@ void MidiFilterConfig::closeEvent(QCloseEvent* ev) QWidget::closeEvent(ev); } +} // namespace MusEGui diff --git a/muse2/muse/mplugins/midifilterimpl.h b/muse2/muse/mplugins/midifilterimpl.h index de276f44..1261d4b5 100644 --- a/muse2/muse/mplugins/midifilterimpl.h +++ b/muse2/muse/mplugins/midifilterimpl.h @@ -29,6 +29,8 @@ class QCloseEvent; +namespace MusEGui { + //--------------------------------------------------------- // MidiFilterConfig //--------------------------------------------------------- @@ -102,6 +104,8 @@ class MidiFilterConfig : public QDialog, public Ui::MidiFilterConfigBase { MidiFilterConfig(QDialog* parent=0); }; +} // namespace MusEGui + #endif diff --git a/muse2/muse/mplugins/midiitransform.cpp b/muse2/muse/mplugins/midiitransform.cpp index b5b4d3c8..978e381e 100644 --- a/muse2/muse/mplugins/midiitransform.cpp +++ b/muse2/muse/mplugins/midiitransform.cpp @@ -52,6 +52,8 @@ #define MIDITRANSFORM_NRPN 5 #define MIDITRANSFORM_RPN 6 +namespace MusECore { + static int selTypeTable[] = { MIDITRANSFORM_NOTE, MIDITRANSFORM_POLY, MIDITRANSFORM_CTRL, MIDITRANSFORM_ATOUCH, MIDITRANSFORM_PITCHBEND, MIDITRANSFORM_NRPN, MIDITRANSFORM_RPN @@ -130,7 +132,7 @@ class MidiInputTransformation { procVal2a = 0; procVal2b = 0; funcOp = Transform; - quantVal = MusEConfig::config.division; + quantVal = MusEGlobal::config.division; selPort = Ignore; selChannel = Ignore; selChannela = 0; @@ -585,160 +587,6 @@ bool MidiInputTransformation::typesMatch(MidiRecordEvent& e, int selType) const } //--------------------------------------------------------- -// MidiInputTransformDialog -// Widgets: -// presetList nameEntry commentEntry -// selEventOp selType -// selVal1Op selVal1a selVal1b -// selVal2Op selVal2a selVal2b -// -// procEventOp procType -// procVal1Op procVal1a procVal1b -// procVal2Op procVal2a procVal2b -// funcOp funcQuantVal -// buttonNew buttonDelete -// -// modulGroup -// modul1select modul1enable -// modul2select modul2enable -// modul3select modul3enable -// modul4select modul4enable -// -// selPortOp selPortVala selPortValb -// selChannelOp selChannelVala selChannelValb -// -// procPortOp procPortVala procPortValb -// procChannelOp procChannelVala procChannelValb -//--------------------------------------------------------- - -MidiInputTransformDialog::MidiInputTransformDialog(QDialog* parent, Qt::WFlags fl) - : QDialog(parent, fl) - { - setupUi(this); - cindex = 0; - cmodul = 0; - cmt = 0; - - modulGroup = new QButtonGroup; - modulGroup->addButton(modul1select,0); - modulGroup->addButton(modul2select,1); - modulGroup->addButton(modul3select,2); - modulGroup->addButton(modul4select,3); - - for (unsigned i = 0; i < sizeof(oplist)/sizeof(*oplist); ++i) - funcOp->insertItem(i, oplist[i].text); - - connect(buttonNew, SIGNAL(clicked()), SLOT(presetNew())); - connect(buttonDelete, SIGNAL(clicked()), SLOT(presetDelete())); - connect(selEventOp, SIGNAL(activated(int)), SLOT(selEventOpSel(int))); - connect(selType, SIGNAL(activated(int)), SLOT(selTypeSel(int))); - connect(selVal1Op, SIGNAL(activated(int)), SLOT(selVal1OpSel(int))); - connect(selVal2Op, SIGNAL(activated(int)), SLOT(selVal2OpSel(int))); - connect(procEventOp, SIGNAL(activated(int)), SLOT(procEventOpSel(int))); - connect(procType, SIGNAL(activated(int)), SLOT(procEventTypeSel(int))); - connect(procVal1Op, SIGNAL(activated(int)), SLOT(procVal1OpSel(int))); - connect(procVal2Op, SIGNAL(activated(int)), SLOT(procVal2OpSel(int))); - connect(funcOp, SIGNAL(activated(int)), SLOT(funcOpSel(int))); - connect(presetList, SIGNAL(itemActivated(QListWidgetItem*)), - SLOT(presetChanged(QListWidgetItem*))); - connect(nameEntry, SIGNAL(textChanged(const QString&)), - SLOT(nameChanged(const QString&))); - connect(commentEntry, SIGNAL(textChanged()), SLOT(commentChanged())); - - connect(selVal1a, SIGNAL(valueChanged(int)), SLOT(selVal1aChanged(int))); - connect(selVal1b, SIGNAL(valueChanged(int)), SLOT(selVal1bChanged(int))); - connect(selVal2a, SIGNAL(valueChanged(int)), SLOT(selVal2aChanged(int))); - connect(selVal2b, SIGNAL(valueChanged(int)), SLOT(selVal2bChanged(int))); - connect(procVal1a, SIGNAL(valueChanged(int)), SLOT(procVal1aChanged(int))); - connect(procVal1b, SIGNAL(valueChanged(int)), SLOT(procVal1bChanged(int))); - connect(procVal2a, SIGNAL(valueChanged(int)), SLOT(procVal2aChanged(int))); - connect(procVal2b, SIGNAL(valueChanged(int)), SLOT(procVal2bChanged(int))); - - connect(modul1enable, SIGNAL(toggled(bool)), SLOT(modul1enableChanged(bool))); - connect(modul2enable, SIGNAL(toggled(bool)), SLOT(modul2enableChanged(bool))); - connect(modul3enable, SIGNAL(toggled(bool)), SLOT(modul3enableChanged(bool))); - connect(modul4enable, SIGNAL(toggled(bool)), SLOT(modul4enableChanged(bool))); - connect(modulGroup, SIGNAL(buttonClicked(int)), SLOT(changeModul(int))); - - connect(selPortOp, SIGNAL(activated(int)), SLOT(selPortOpSel(int))); - connect(selPortVala, SIGNAL(valueChanged(int)), SLOT(selPortValaChanged(int))); - connect(selPortValb, SIGNAL(valueChanged(int)), SLOT(selPortValbChanged(int))); - - connect(selChannelOp, SIGNAL(activated(int)), SLOT(selChannelOpSel(int))); - connect(selChannelVala, SIGNAL(valueChanged(int)), SLOT(selChannelValaChanged(int))); - connect(selChannelValb, SIGNAL(valueChanged(int)), SLOT(selChannelValbChanged(int))); - - connect(procPortOp, SIGNAL(activated(int)), SLOT(procPortOpSel(int))); - connect(procPortVala, SIGNAL(valueChanged(int)), SLOT(procPortValaChanged(int))); - connect(procPortValb, SIGNAL(valueChanged(int)), SLOT(procPortValbChanged(int))); - - connect(procChannelOp, SIGNAL(activated(int)), SLOT(procChannelOpSel(int))); - connect(procChannelVala, SIGNAL(valueChanged(int)), SLOT(procChannelValaChanged(int))); - connect(procChannelValb, SIGNAL(valueChanged(int)), SLOT(procChannelValbChanged(int))); - - //--------------------------------------------------- - // populate preset list - //--------------------------------------------------- - - updatePresetList(); - presetList->setCurrentItem(presetList->item(0)); - presetChanged(presetList->item(0)); - connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); - } - -//--------------------------------------------------------- -// songChanged -//--------------------------------------------------------- - -void MidiInputTransformDialog::songChanged(int flags) -{ - // Whenever a song is loaded, flags is -1. Since transforms are part of configuration, - // use SC_CONFIG here, to filter unwanted song change events. - if(flags & SC_CONFIG) - updatePresetList(); -} - -//--------------------------------------------------------- -// updatePresetList -//--------------------------------------------------------- - -void MidiInputTransformDialog::updatePresetList() -{ - cmt = 0; - presetList->clear(); - - modul1select->setChecked(true); - for (iMidiInputTransformation i = mtlist.begin(); i != mtlist.end(); ++i) { - presetList->addItem((*i)->name); - if (cmt == 0) - cmt = *i; - } - if (cmt == 0) { - // create default "New" preset - cmt = new MidiInputTransformation(tr("New")); - mtlist.push_back(cmt); - presetList->addItem(tr("New")); - presetList->setCurrentItem(0); - } - changeModul(0); - - modul1enable->setChecked(modules[0].valid); - modul2enable->setChecked(modules[1].valid); - modul3enable->setChecked(modules[2].valid); - modul4enable->setChecked(modules[3].valid); -} - -//--------------------------------------------------------- -// closeEvent -//--------------------------------------------------------- - -void MidiInputTransformDialog::closeEvent(QCloseEvent* ev) - { - emit hideWindow(); - QWidget::closeEvent(ev); - } - -//--------------------------------------------------------- // writeMidiTransforms //--------------------------------------------------------- @@ -967,6 +815,164 @@ void clearMidiInputTransforms() mtlist.clear(); } +} // namespace MusECore + +namespace MusEGui { + +//--------------------------------------------------------- +// MidiInputTransformDialog +// Widgets: +// presetList nameEntry commentEntry +// selEventOp selType +// selVal1Op selVal1a selVal1b +// selVal2Op selVal2a selVal2b +// +// procEventOp procType +// procVal1Op procVal1a procVal1b +// procVal2Op procVal2a procVal2b +// funcOp funcQuantVal +// buttonNew buttonDelete +// +// modulGroup +// modul1select modul1enable +// modul2select modul2enable +// modul3select modul3enable +// modul4select modul4enable +// +// selPortOp selPortVala selPortValb +// selChannelOp selChannelVala selChannelValb +// +// procPortOp procPortVala procPortValb +// procChannelOp procChannelVala procChannelValb +//--------------------------------------------------------- + +MidiInputTransformDialog::MidiInputTransformDialog(QDialog* parent, Qt::WFlags fl) + : QDialog(parent, fl) + { + setupUi(this); + cindex = 0; + cmodul = 0; + cmt = 0; + + modulGroup = new QButtonGroup; + modulGroup->addButton(modul1select,0); + modulGroup->addButton(modul2select,1); + modulGroup->addButton(modul3select,2); + modulGroup->addButton(modul4select,3); + + for (unsigned i = 0; i < sizeof(MusECore::oplist)/sizeof(*MusECore::oplist); ++i) + funcOp->insertItem(i, MusECore::oplist[i].text); + + connect(buttonNew, SIGNAL(clicked()), SLOT(presetNew())); + connect(buttonDelete, SIGNAL(clicked()), SLOT(presetDelete())); + connect(selEventOp, SIGNAL(activated(int)), SLOT(selEventOpSel(int))); + connect(selType, SIGNAL(activated(int)), SLOT(selTypeSel(int))); + connect(selVal1Op, SIGNAL(activated(int)), SLOT(selVal1OpSel(int))); + connect(selVal2Op, SIGNAL(activated(int)), SLOT(selVal2OpSel(int))); + connect(procEventOp, SIGNAL(activated(int)), SLOT(procEventOpSel(int))); + connect(procType, SIGNAL(activated(int)), SLOT(procEventTypeSel(int))); + connect(procVal1Op, SIGNAL(activated(int)), SLOT(procVal1OpSel(int))); + connect(procVal2Op, SIGNAL(activated(int)), SLOT(procVal2OpSel(int))); + connect(funcOp, SIGNAL(activated(int)), SLOT(funcOpSel(int))); + connect(presetList, SIGNAL(itemActivated(QListWidgetItem*)), + SLOT(presetChanged(QListWidgetItem*))); + connect(nameEntry, SIGNAL(textChanged(const QString&)), + SLOT(nameChanged(const QString&))); + connect(commentEntry, SIGNAL(textChanged()), SLOT(commentChanged())); + + connect(selVal1a, SIGNAL(valueChanged(int)), SLOT(selVal1aChanged(int))); + connect(selVal1b, SIGNAL(valueChanged(int)), SLOT(selVal1bChanged(int))); + connect(selVal2a, SIGNAL(valueChanged(int)), SLOT(selVal2aChanged(int))); + connect(selVal2b, SIGNAL(valueChanged(int)), SLOT(selVal2bChanged(int))); + connect(procVal1a, SIGNAL(valueChanged(int)), SLOT(procVal1aChanged(int))); + connect(procVal1b, SIGNAL(valueChanged(int)), SLOT(procVal1bChanged(int))); + connect(procVal2a, SIGNAL(valueChanged(int)), SLOT(procVal2aChanged(int))); + connect(procVal2b, SIGNAL(valueChanged(int)), SLOT(procVal2bChanged(int))); + + connect(modul1enable, SIGNAL(toggled(bool)), SLOT(modul1enableChanged(bool))); + connect(modul2enable, SIGNAL(toggled(bool)), SLOT(modul2enableChanged(bool))); + connect(modul3enable, SIGNAL(toggled(bool)), SLOT(modul3enableChanged(bool))); + connect(modul4enable, SIGNAL(toggled(bool)), SLOT(modul4enableChanged(bool))); + connect(modulGroup, SIGNAL(buttonClicked(int)), SLOT(changeModul(int))); + + connect(selPortOp, SIGNAL(activated(int)), SLOT(selPortOpSel(int))); + connect(selPortVala, SIGNAL(valueChanged(int)), SLOT(selPortValaChanged(int))); + connect(selPortValb, SIGNAL(valueChanged(int)), SLOT(selPortValbChanged(int))); + + connect(selChannelOp, SIGNAL(activated(int)), SLOT(selChannelOpSel(int))); + connect(selChannelVala, SIGNAL(valueChanged(int)), SLOT(selChannelValaChanged(int))); + connect(selChannelValb, SIGNAL(valueChanged(int)), SLOT(selChannelValbChanged(int))); + + connect(procPortOp, SIGNAL(activated(int)), SLOT(procPortOpSel(int))); + connect(procPortVala, SIGNAL(valueChanged(int)), SLOT(procPortValaChanged(int))); + connect(procPortValb, SIGNAL(valueChanged(int)), SLOT(procPortValbChanged(int))); + + connect(procChannelOp, SIGNAL(activated(int)), SLOT(procChannelOpSel(int))); + connect(procChannelVala, SIGNAL(valueChanged(int)), SLOT(procChannelValaChanged(int))); + connect(procChannelValb, SIGNAL(valueChanged(int)), SLOT(procChannelValbChanged(int))); + + //--------------------------------------------------- + // populate preset list + //--------------------------------------------------- + + updatePresetList(); + presetList->setCurrentItem(presetList->item(0)); + presetChanged(presetList->item(0)); + connect(MusEGlobal::song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); + } + +//--------------------------------------------------------- +// songChanged +//--------------------------------------------------------- + +void MidiInputTransformDialog::songChanged(int flags) +{ + // Whenever a song is loaded, flags is -1. Since transforms are part of configuration, + // use SC_CONFIG here, to filter unwanted song change events. + if(flags & SC_CONFIG) + updatePresetList(); +} + +//--------------------------------------------------------- +// updatePresetList +//--------------------------------------------------------- + +void MidiInputTransformDialog::updatePresetList() +{ + cmt = 0; + presetList->clear(); + + modul1select->setChecked(true); + for (MusECore::iMidiInputTransformation i = MusECore::mtlist.begin(); i != MusECore::mtlist.end(); ++i) { + presetList->addItem((*i)->name); + if (cmt == 0) + cmt = *i; + } + if (cmt == 0) { + // create default "New" preset + cmt = new MusECore::MidiInputTransformation(tr("New")); + MusECore::mtlist.push_back(cmt); + presetList->addItem(tr("New")); + presetList->setCurrentItem(0); + } + changeModul(0); + + modul1enable->setChecked(MusECore::modules[0].valid); + modul2enable->setChecked(MusECore::modules[1].valid); + modul3enable->setChecked(MusECore::modules[2].valid); + modul4enable->setChecked(MusECore::modules[3].valid); +} + +//--------------------------------------------------------- +// closeEvent +//--------------------------------------------------------- + +void MidiInputTransformDialog::closeEvent(QCloseEvent* ev) + { + emit hideWindow(); + QWidget::closeEvent(ev); + } + //--------------------------------------------------------- // accept //--------------------------------------------------------- @@ -989,22 +995,22 @@ void MidiInputTransformDialog::reject() // setValOp //--------------------------------------------------------- -void MidiInputTransformDialog::setValOp(QWidget* a, QWidget* b, ValOp op) +void MidiInputTransformDialog::setValOp(QWidget* a, QWidget* b, MusECore::ValOp op) { switch (op) { - case Ignore: + case MusECore::Ignore: a->setEnabled(false); b->setEnabled(false); break; - case Equal: - case Unequal: - case Higher: - case Lower: + case MusECore::Equal: + case MusECore::Unequal: + case MusECore::Higher: + case MusECore::Lower: a->setEnabled(true); b->setEnabled(false); break; - case Inside: - case Outside: + case MusECore::Inside: + case MusECore::Outside: a->setEnabled(true); b->setEnabled(true); break; @@ -1017,8 +1023,8 @@ void MidiInputTransformDialog::setValOp(QWidget* a, QWidget* b, ValOp op) void MidiInputTransformDialog::selEventOpSel(int val) { - selType->setEnabled(val != All); - cmt->selEventOp = ValOp(val); + selType->setEnabled(val != MusECore::All); + cmt->selEventOp = MusECore::ValOp(val); selVal1aChanged(cmt->selVal1a); selVal1bChanged(cmt->selVal1b); } @@ -1029,7 +1035,7 @@ void MidiInputTransformDialog::selEventOpSel(int val) void MidiInputTransformDialog::selTypeSel(int val) { - cmt->selType = selTypeTable[val]; + cmt->selType = MusECore::selTypeTable[val]; selVal1aChanged(cmt->selVal1a); selVal1bChanged(cmt->selVal1b); } @@ -1040,8 +1046,8 @@ void MidiInputTransformDialog::selTypeSel(int val) void MidiInputTransformDialog::selVal1OpSel(int val) { - setValOp(selVal1a, selVal1b, ValOp(val)); - cmt->selVal1 = ValOp(val); + setValOp(selVal1a, selVal1b, MusECore::ValOp(val)); + cmt->selVal1 = MusECore::ValOp(val); } //--------------------------------------------------------- @@ -1050,8 +1056,8 @@ void MidiInputTransformDialog::selVal1OpSel(int val) void MidiInputTransformDialog::selVal2OpSel(int val) { - setValOp(selVal2a, selVal2b, ValOp(val)); - cmt->selVal2 = ValOp(val); + setValOp(selVal2a, selVal2b, MusECore::ValOp(val)); + cmt->selVal2 = MusECore::ValOp(val); } //--------------------------------------------------------- @@ -1060,8 +1066,8 @@ void MidiInputTransformDialog::selVal2OpSel(int val) void MidiInputTransformDialog::procEventOpSel(int val) { - InputTransformProcEventOp op = val == 0 ? KeepType : FixType; - procType->setEnabled(op == FixType); + MusECore::InputTransformProcEventOp op = val == 0 ? MusECore::KeepType : MusECore::FixType; + procType->setEnabled(op == MusECore::FixType); cmt->procEvent = op; procVal1aChanged(cmt->procVal1a); @@ -1074,7 +1080,7 @@ void MidiInputTransformDialog::procEventOpSel(int val) void MidiInputTransformDialog::procEventTypeSel(int val) { - cmt->eventType = procTypeTable[val]; + cmt->eventType = MusECore::procTypeTable[val]; procVal1aChanged(cmt->procVal1a); procVal1bChanged(cmt->procVal1b); } @@ -1085,31 +1091,31 @@ void MidiInputTransformDialog::procEventTypeSel(int val) void MidiInputTransformDialog::procVal1OpSel(int val) { - cmt->procVal1 = TransformOperator(val); - switch(TransformOperator(val)) { - case Keep: - case Invert: + cmt->procVal1 = MusECore::TransformOperator(val); + switch(MusECore::TransformOperator(val)) { + case MusECore::Keep: + case MusECore::Invert: procVal1a->setEnabled(false); procVal1b->setEnabled(false); break; - case Multiply: - case Divide: + case MusECore::Multiply: + case MusECore::Divide: procVal1a->setEnabled(true); procVal1a->setDecimals(2); procVal1b->setEnabled(false); break; - case Plus: - case Minus: - case Fix: - case Value: - case Flip: + case MusECore::Plus: + case MusECore::Minus: + case MusECore::Fix: + case MusECore::Value: + case MusECore::Flip: procVal1a->setDecimals(0); procVal1a->setEnabled(true); procVal1b->setEnabled(false); break; - case Random: - case ScaleMap: - case Dynamic: + case MusECore::Random: + case MusECore::ScaleMap: + case MusECore::Dynamic: procVal1a->setDecimals(0); procVal1a->setEnabled(true); procVal1b->setEnabled(true); @@ -1125,31 +1131,31 @@ void MidiInputTransformDialog::procVal1OpSel(int val) void MidiInputTransformDialog::procVal2OpSel(int val) { - TransformOperator op = TransformOperator(procVal2Map[val]); + MusECore::TransformOperator op = MusECore::TransformOperator(MusECore::procVal2Map[val]); cmt->procVal2 = op; switch (op) { - case Keep: - case Invert: + case MusECore::Keep: + case MusECore::Invert: procVal2a->setEnabled(false); procVal2b->setEnabled(false); break; - case Multiply: - case Divide: + case MusECore::Multiply: + case MusECore::Divide: procVal2a->setEnabled(true); procVal2a->setDecimals(2); procVal2b->setEnabled(false); break; - case Plus: - case Minus: - case Fix: - case Value: + case MusECore::Plus: + case MusECore::Minus: + case MusECore::Fix: + case MusECore::Value: procVal2a->setDecimals(0); procVal2a->setEnabled(true); procVal2b->setEnabled(false); break; - case Random: - case Dynamic: + case MusECore::Random: + case MusECore::Dynamic: procVal2a->setDecimals(0); procVal2a->setEnabled(true); procVal2b->setEnabled(true); @@ -1165,9 +1171,9 @@ void MidiInputTransformDialog::procVal2OpSel(int val) void MidiInputTransformDialog::funcOpSel(int val) { - TransformFunction op = oplist[val].id; + MusECore::TransformFunction op = MusECore::oplist[val].id; - bool isFuncOp(op == Transform); + bool isFuncOp(op == MusECore::Transform); procEventOp->setEnabled(isFuncOp); procType->setEnabled(isFuncOp); @@ -1202,18 +1208,18 @@ void MidiInputTransformDialog::presetNew() QString name; for (int i = 0;; ++i) { name.sprintf("New-%d", i); - iMidiInputTransformation imt; - for (imt = mtlist.begin(); imt != mtlist.end(); ++imt) { + MusECore::iMidiInputTransformation imt; + for (imt = MusECore::mtlist.begin(); imt != MusECore::mtlist.end(); ++imt) { if (name == (*imt)->name) break; } - if (imt == mtlist.end()) + if (imt == MusECore::mtlist.end()) break; } - MidiInputTransformation* mt = new MidiInputTransformation(name); + MusECore::MidiInputTransformation* mt = new MusECore::MidiInputTransformation(name); QListWidgetItem* lbi = new QListWidgetItem(name); presetList->addItem(lbi); - mtlist.push_back(mt); + MusECore::mtlist.push_back(mt); presetList->setCurrentItem(lbi); presetChanged(lbi); } @@ -1225,9 +1231,9 @@ void MidiInputTransformDialog::presetNew() void MidiInputTransformDialog::presetDelete() { if (cindex != -1) { - iMidiInputTransformation mt = mtlist.begin(); + MusECore::iMidiInputTransformation mt = MusECore::mtlist.begin(); for (int i = 0; i < cindex; ++i, ++mt) { - mtlist.erase(mt); + MusECore::mtlist.erase(mt); presetList->setCurrentItem(presetList->item(cindex - 1)); presetList->takeItem(cindex); presetChanged(presetList->item(cindex - 1)); @@ -1271,9 +1277,9 @@ void MidiInputTransformDialog::commentChanged() void MidiInputTransformDialog::selVal1aChanged(int val) { cmt->selVal1a = val; - if ((cmt->selEventOp != All) + if ((cmt->selEventOp != MusECore::All) && (cmt->selType == MIDITRANSFORM_NOTE)) { - selVal1a->setSuffix(" - " + MusEUtil::pitch2string(val)); + selVal1a->setSuffix(" - " + MusECore::pitch2string(val)); } else { @@ -1289,9 +1295,9 @@ void MidiInputTransformDialog::selVal1aChanged(int val) void MidiInputTransformDialog::selVal1bChanged(int val) { cmt->selVal1b = val; - if ((cmt->selEventOp != All) + if ((cmt->selEventOp != MusECore::All) && (cmt->selType == MIDITRANSFORM_NOTE)) { - selVal1b->setSuffix(" - " + MusEUtil::pitch2string(val)); + selVal1b->setSuffix(" - " + MusECore::pitch2string(val)); } else { @@ -1326,11 +1332,11 @@ void MidiInputTransformDialog::procVal1aChanged(int val) { cmt->procVal1a = val; - if((cmt->procEvent == KeepType && cmt->selType == MIDITRANSFORM_NOTE) && - (cmt->procVal1 == Fix || cmt->procVal1 == ScaleMap || cmt->procVal1 == Dynamic || - cmt->procVal1 == Random || cmt->procVal1 == Flip)) + if((cmt->procEvent == MusECore::KeepType && cmt->selType == MIDITRANSFORM_NOTE) && + (cmt->procVal1 == MusECore::Fix || cmt->procVal1 == MusECore::ScaleMap || cmt->procVal1 == MusECore::Dynamic || + cmt->procVal1 == MusECore::Random || cmt->procVal1 == MusECore::Flip)) { - procVal1a->setSuffix(" - " + MusEUtil::pitch2string(val)); + procVal1a->setSuffix(" - " + MusECore::pitch2string(val)); } else { @@ -1347,11 +1353,11 @@ void MidiInputTransformDialog::procVal1bChanged(int val) { cmt->procVal1b = val; - if((cmt->procEvent == KeepType && cmt->selType == MIDITRANSFORM_NOTE) && - (cmt->procVal1 == Fix || cmt->procVal1 == ScaleMap || cmt->procVal1 == Dynamic || - cmt->procVal1 == Random || cmt->procVal1 == Flip)) + if((cmt->procEvent == MusECore::KeepType && cmt->selType == MIDITRANSFORM_NOTE) && + (cmt->procVal1 == MusECore::Fix || cmt->procVal1 == MusECore::ScaleMap || cmt->procVal1 == MusECore::Dynamic || + cmt->procVal1 == MusECore::Random || cmt->procVal1 == MusECore::Flip)) { - procVal1b->setSuffix(" - " + MusEUtil::pitch2string(val)); + procVal1b->setSuffix(" - " + MusECore::pitch2string(val)); } else { @@ -1384,7 +1390,7 @@ void MidiInputTransformDialog::procVal2bChanged(int val) void MidiInputTransformDialog::modul1enableChanged(bool val) { - modules[0].valid = val; + MusECore::modules[0].valid = val; } //--------------------------------------------------------- @@ -1393,7 +1399,7 @@ void MidiInputTransformDialog::modul1enableChanged(bool val) void MidiInputTransformDialog::modul2enableChanged(bool val) { - modules[1].valid = val; + MusECore::modules[1].valid = val; } //--------------------------------------------------------- @@ -1402,7 +1408,7 @@ void MidiInputTransformDialog::modul2enableChanged(bool val) void MidiInputTransformDialog::modul3enableChanged(bool val) { - modules[2].valid = val; + MusECore::modules[2].valid = val; } //--------------------------------------------------------- @@ -1411,7 +1417,7 @@ void MidiInputTransformDialog::modul3enableChanged(bool val) void MidiInputTransformDialog::modul4enableChanged(bool val) { - modules[3].valid = val; + MusECore::modules[3].valid = val; } //--------------------------------------------------------- @@ -1420,8 +1426,8 @@ void MidiInputTransformDialog::modul4enableChanged(bool val) void MidiInputTransformDialog::selPortOpSel(int val) { - setValOp(selPortVala, selPortValb, ValOp(val)); - cmt->selPort = ValOp(val); + setValOp(selPortVala, selPortValb, MusECore::ValOp(val)); + cmt->selPort = MusECore::ValOp(val); } //--------------------------------------------------------- @@ -1448,8 +1454,8 @@ void MidiInputTransformDialog::selPortValbChanged(int val) void MidiInputTransformDialog::selChannelOpSel(int val) { - setValOp(selChannelVala, selChannelValb, ValOp(val)); - cmt->selChannel = ValOp(val); + setValOp(selChannelVala, selChannelValb, MusECore::ValOp(val)); + cmt->selChannel = MusECore::ValOp(val); } //--------------------------------------------------------- @@ -1476,31 +1482,31 @@ void MidiInputTransformDialog::selChannelValbChanged(int val) void MidiInputTransformDialog::procPortOpSel(int val) { - cmt->procPort = TransformOperator(val); - switch(TransformOperator(val)) { - case Keep: - case Invert: + cmt->procPort = MusECore::TransformOperator(val); + switch(MusECore::TransformOperator(val)) { + case MusECore::Keep: + case MusECore::Invert: procPortVala->setEnabled(false); procPortValb->setEnabled(false); break; - case Multiply: - case Divide: + case MusECore::Multiply: + case MusECore::Divide: procPortVala->setEnabled(true); procPortVala->setDecimals(2); procPortValb->setEnabled(false); break; - case Plus: - case Minus: - case Fix: - case Value: - case Flip: + case MusECore::Plus: + case MusECore::Minus: + case MusECore::Fix: + case MusECore::Value: + case MusECore::Flip: procPortVala->setDecimals(0); procPortVala->setEnabled(true); procPortValb->setEnabled(false); break; - case Random: - case ScaleMap: - case Dynamic: + case MusECore::Random: + case MusECore::ScaleMap: + case MusECore::Dynamic: procPortVala->setDecimals(0); procPortVala->setEnabled(true); procPortValb->setEnabled(true); @@ -1532,31 +1538,31 @@ void MidiInputTransformDialog::procPortValbChanged(int val) void MidiInputTransformDialog::procChannelOpSel(int val) { - cmt->procChannel = TransformOperator(val); - switch(TransformOperator(val)) { - case Keep: - case Invert: + cmt->procChannel = MusECore::TransformOperator(val); + switch(MusECore::TransformOperator(val)) { + case MusECore::Keep: + case MusECore::Invert: procChannelVala->setEnabled(false); procChannelValb->setEnabled(false); break; - case Multiply: - case Divide: + case MusECore::Multiply: + case MusECore::Divide: procChannelVala->setEnabled(true); procChannelVala->setDecimals(2); procChannelValb->setEnabled(false); break; - case Plus: - case Minus: - case Fix: - case Value: - case Flip: + case MusECore::Plus: + case MusECore::Minus: + case MusECore::Fix: + case MusECore::Value: + case MusECore::Flip: procChannelVala->setDecimals(0); procChannelVala->setEnabled(true); procChannelValb->setEnabled(false); break; - case Random: - case ScaleMap: - case Dynamic: + case MusECore::Random: + case MusECore::ScaleMap: + case MusECore::Dynamic: procChannelVala->setDecimals(0); procChannelVala->setEnabled(true); procChannelValb->setEnabled(true); @@ -1592,9 +1598,9 @@ void MidiInputTransformDialog::changeModul(int k) cmodul = k; // current modul - if (modules[k].transform == 0) { + if (MusECore::modules[k].transform == 0) { //printf("transform %d ist null\n", k); - modules[k].transform = cmt; + MusECore::modules[k].transform = cmt; } else { //--------------------------------------------- @@ -1602,14 +1608,14 @@ void MidiInputTransformDialog::changeModul(int k) //--------------------------------------------- int idx = 0; - iMidiInputTransformation i; - for (i = mtlist.begin(); i != mtlist.end(); ++i, ++idx) { - if (*i == modules[k].transform) { + MusECore::iMidiInputTransformation i; + for (i = MusECore::mtlist.begin(); i != MusECore::mtlist.end(); ++i, ++idx) { + if (*i == MusECore::modules[k].transform) { presetList->setCurrentItem(presetList->item(idx)); break; } } - if (i == mtlist.end()) + if (i == MusECore::mtlist.end()) printf("change to unknown transformation!\n"); } } @@ -1627,19 +1633,19 @@ void MidiInputTransformDialog::presetChanged(QListWidgetItem* item) // cmt //--------------------------------------------------- - iMidiInputTransformation i; - for (i = mtlist.begin(); i != mtlist.end(); ++i) { + MusECore::iMidiInputTransformation i; + for (i = MusECore::mtlist.begin(); i != MusECore::mtlist.end(); ++i) { if (item->text() == (*i)->name) { if(MusEGlobal::debugMsg) printf("found %s\n", (*i)->name.toLatin1().constData()); cmt = *i; if (cmodul != -1) { - modules[cmodul].transform = *i; + MusECore::modules[cmodul].transform = *i; } break; } } - if (i == mtlist.end()) { + if (i == MusECore::mtlist.end()) { printf("MidiInputTransformDialog::presetChanged: not found\n"); return; } @@ -1649,8 +1655,8 @@ void MidiInputTransformDialog::presetChanged(QListWidgetItem* item) selEventOp->setCurrentIndex(cmt->selEventOp); selEventOpSel(cmt->selEventOp); - for (unsigned i = 0; i < sizeof(selTypeTable)/sizeof(*selTypeTable); ++i) { - if (selTypeTable[i] == cmt->selType) { + for (unsigned i = 0; i < sizeof(MusECore::selTypeTable)/sizeof(*MusECore::selTypeTable); ++i) { + if (MusECore::selTypeTable[i] == cmt->selType) { selType->setCurrentIndex(i); break; } @@ -1670,19 +1676,19 @@ void MidiInputTransformDialog::presetChanged(QListWidgetItem* item) { unsigned i; - for (i = 0; i < sizeof(oplist)/sizeof(*oplist); ++i) { - if (oplist[i].id == cmt->funcOp) { + for (i = 0; i < sizeof(MusECore::oplist)/sizeof(*MusECore::oplist); ++i) { + if (MusECore::oplist[i].id == cmt->funcOp) { funcOp->setCurrentIndex(i); break; } } - if (i == sizeof(oplist)/sizeof(*oplist)) + if (i == sizeof(MusECore::oplist)/sizeof(*MusECore::oplist)) printf("internal error: bad OpCode\n"); funcOpSel(i); } - for (unsigned i = 0; i < sizeof(procTypeTable)/sizeof(*procTypeTable); ++i) { - if (procTypeTable[i] == cmt->eventType) { + for (unsigned i = 0; i < sizeof(MusECore::procTypeTable)/sizeof(*MusECore::procTypeTable); ++i) { + if (MusECore::procTypeTable[i] == cmt->eventType) { procType->setCurrentIndex(i); break; } @@ -1694,8 +1700,8 @@ void MidiInputTransformDialog::presetChanged(QListWidgetItem* item) procVal1Op->setCurrentIndex(cmt->procVal1); procVal1OpSel(cmt->procVal1); - for (unsigned i = 0; i < sizeof(procVal2Map)/sizeof(*procVal2Map); ++i) { - if (procVal2Map[i] == cmt->procVal2) { + for (unsigned i = 0; i < sizeof(MusECore::procVal2Map)/sizeof(*MusECore::procVal2Map); ++i) { + if (MusECore::procVal2Map[i] == cmt->procVal2) { procVal2Op->setCurrentIndex(i); break; } @@ -1735,3 +1741,4 @@ void MidiInputTransformDialog::presetChanged(QListWidgetItem* item) } +} // namespace MusEGui diff --git a/muse2/muse/mplugins/midiitransform.h b/muse2/muse/mplugins/midiitransform.h index 74a7be7e..8c21e068 100644 --- a/muse2/muse/mplugins/midiitransform.h +++ b/muse2/muse/mplugins/midiitransform.h @@ -29,29 +29,39 @@ #include <QCloseEvent> class QButtonGroup; -class MidiTransformation; -class MidiInputTransformation; -class MidiRecordEvent; -class MidiPart; class Xml; #include "miditransform.h" +namespace MusECore { +class MidiInputTransformation; +class MidiPart; +class MidiRecordEvent; +class MidiTransformation; + enum InputTransformProcEventOp { KeepType, FixType }; +extern void writeMidiInputTransforms(int level, Xml& xml); +extern void readMidiInputTransform(Xml&); +extern bool applyMidiInputTransformation(MidiRecordEvent& event); +extern void clearMidiInputTransforms(); +} + +namespace MusEGui { + //--------------------------------------------------------- // MidiInputTransform //--------------------------------------------------------- class MidiInputTransformDialog : public QDialog, public Ui::MidiInputTransformDialogBase { Q_OBJECT - MidiInputTransformation* cmt; + MusECore::MidiInputTransformation* cmt; int cindex; // current index in preset list int cmodul; // current index in modules list virtual void accept(); virtual void reject(); - void setValOp(QWidget* a, QWidget* b, ValOp op); + void setValOp(QWidget* a, QWidget* b, MusECore::ValOp op); virtual void closeEvent(QCloseEvent*); void updatePresetList(); @@ -110,8 +120,6 @@ class MidiInputTransformDialog : public QDialog, public Ui::MidiInputTransformDi MidiInputTransformDialog(QDialog* parent = 0, Qt::WFlags fl = 0); }; -extern void writeMidiInputTransforms(int level, Xml& xml); -extern void readMidiInputTransform(Xml&); -extern bool applyMidiInputTransformation(MidiRecordEvent& event); -extern void clearMidiInputTransforms(); +} // namespace MusEGui + #endif diff --git a/muse2/muse/mplugins/mitplugin.cpp b/muse2/muse/mplugins/mitplugin.cpp index b60e47e8..48e30bb6 100644 --- a/muse2/muse/mplugins/mitplugin.cpp +++ b/muse2/muse/mplugins/mitplugin.cpp @@ -35,9 +35,7 @@ #include "rhythm.h" #endif -MITPluginList mitPlugins; - -namespace MusEApp { +namespace MusEGui { //--------------------------------------------------------- // startMidiInputPlugin @@ -49,18 +47,18 @@ void MusE::startMidiInputPlugin(int id) QWidget* w = 0; QAction* act; if (id == 0) { - if (!mitPluginTranspose) { - mitPluginTranspose = new MITPluginTranspose(); - mitPlugins.push_back(mitPluginTranspose); - connect(mitPluginTranspose, SIGNAL(hideWindow()), + if (!MusEGlobal::mitPluginTranspose) { + MusEGlobal::mitPluginTranspose = new MusEGui::MITPluginTranspose(); + MusECore::mitPlugins.push_back(MusEGlobal::mitPluginTranspose); + connect(MusEGlobal::mitPluginTranspose, SIGNAL(hideWindow()), SLOT(hideMitPluginTranspose())); } - w = mitPluginTranspose; + w = MusEGlobal::mitPluginTranspose; act = midiTrpAction; } else if (id == 1) { if (!midiInputTransform) { - midiInputTransform = new MidiInputTransformDialog(); + midiInputTransform = new MusEGui::MidiInputTransformDialog(); connect(midiInputTransform, SIGNAL(hideWindow()), SLOT(hideMidiInputTransform())); } @@ -69,7 +67,7 @@ void MusE::startMidiInputPlugin(int id) } else if (id == 2) { if (!midiFilterConfig) { - midiFilterConfig = new MidiFilterConfig(); + midiFilterConfig = new MusEGui::MidiFilterConfig(); connect(midiFilterConfig, SIGNAL(hideWindow()), SLOT(hideMidiFilterConfig())); } @@ -78,7 +76,7 @@ void MusE::startMidiInputPlugin(int id) } else if (id == 3) { if (!midiRemoteConfig) { - midiRemoteConfig = new MRConfig(); + midiRemoteConfig = new MusEGui::MRConfig(); connect(midiRemoteConfig, SIGNAL(hideWindow()), SLOT(hideMidiRemoteConfig())); } @@ -136,11 +134,15 @@ void MusE::hideMidiRhythmGenerator() void MusE::startMidiTransformer() { if (midiTransformerDialog == 0) - midiTransformerDialog = new MidiTransformerDialog; + midiTransformerDialog = new MusEGui::MidiTransformerDialog; midiTransformerDialog->show(); } -} // namespace MusEApp +} // namespace MusEGui + +namespace MusECore { + +MITPluginList mitPlugins; //--------------------------------------------------------- // processMidiInputTransformPlugins @@ -173,3 +175,4 @@ void readStatusMidiInputTransformPlugin(Xml&) { } +} // namespace MusECore diff --git a/muse2/muse/mplugins/mitplugin.h b/muse2/muse/mplugins/mitplugin.h index 058515a3..bdb35875 100644 --- a/muse2/muse/mplugins/mitplugin.h +++ b/muse2/muse/mplugins/mitplugin.h @@ -26,6 +26,8 @@ #include <list> +namespace MusECore { + class MEvent; class Xml; @@ -50,5 +52,7 @@ extern void processMidiInputTransformPlugins(MEvent&); extern void writeStatusMidiInputTransformPlugins(int, Xml&); extern void readStatusMidiInputTransformPlugin(Xml&); +} // namespace MusECore + #endif diff --git a/muse2/muse/mplugins/mittranspose.cpp b/muse2/muse/mplugins/mittranspose.cpp index feefccad..ae71c725 100644 --- a/muse2/muse/mplugins/mittranspose.cpp +++ b/muse2/muse/mplugins/mittranspose.cpp @@ -31,7 +31,11 @@ #include "xml.h" #include "globals.h" -MITPluginTranspose* mitPluginTranspose; +namespace MusEGlobal { +MusEGui::MITPluginTranspose* mitPluginTranspose; +} + +namespace MusEGui { //--------------------------------------------------------- // MITPluginTranspose @@ -120,7 +124,7 @@ void MITPluginTranspose::onToggled(bool f) // process //--------------------------------------------------------- -void MITPluginTranspose::process(MEvent& ev) +void MITPluginTranspose::process(MusECore::MEvent& ev) { if (!on || (ev.type() != 0x90)) return; @@ -134,7 +138,7 @@ void MITPluginTranspose::process(MEvent& ev) } if (ev.dataB() == 0) { // Note Off - for (iKeyOn i = keyOnList.begin(); i != keyOnList.end(); ++i) { + for (MusECore::iKeyOn i = keyOnList.begin(); i != keyOnList.end(); ++i) { if (i->pitch == pitch && i->channel == ev.channel() && i->port == ev.port()) { pitch += i->transpose; @@ -145,7 +149,7 @@ void MITPluginTranspose::process(MEvent& ev) } else { // Note On - keyOnList.push_back(KeyOn(pitch, ev.channel(), ev.port(), transpose)); + keyOnList.push_back(MusECore::KeyOn(pitch, ev.channel(), ev.port(), transpose)); pitch += transpose; } ev.setA(pitch); @@ -155,16 +159,16 @@ void MITPluginTranspose::process(MEvent& ev) // readStatus //--------------------------------------------------------- -void MITPluginTranspose::readStatus(Xml& xml) +void MITPluginTranspose::readStatus(MusECore::Xml& xml) { for (;;) { - Xml::Token token = xml.parse(); + MusECore::Xml::Token token = xml.parse(); const QString& tag = xml.s1(); switch (token) { - case Xml::Error: - case Xml::End: + case MusECore::Xml::Error: + case MusECore::Xml::End: return; - case Xml::Text: + case MusECore::Xml::Text: if (tag == "on") on = xml.parseInt(); else if (tag == "trigger") @@ -172,7 +176,7 @@ void MITPluginTranspose::readStatus(Xml& xml) else xml.unknown("TransposePlugin"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (xml.s1() == "mplugin") return; default: @@ -185,9 +189,10 @@ void MITPluginTranspose::readStatus(Xml& xml) // writeStatus //--------------------------------------------------------- -void MITPluginTranspose::writeStatus(int level, Xml& xml) const +void MITPluginTranspose::writeStatus(int level, MusECore::Xml& xml) const { xml.intTag(level, "on", on); xml.intTag(level, "trigger", trigger); } +} // namespace MusEGui diff --git a/muse2/muse/mplugins/mittranspose.h b/muse2/muse/mplugins/mittranspose.h index 2fc4d378..41d65928 100644 --- a/muse2/muse/mplugins/mittranspose.h +++ b/muse2/muse/mplugins/mittranspose.h @@ -30,6 +30,10 @@ class QCloseEvent; +namespace MusECore { + +class Xml; + struct KeyOn { unsigned char pitch; unsigned char channel; @@ -46,16 +50,18 @@ struct KeyOn { typedef std::list<KeyOn > KeyOnList; typedef KeyOnList::iterator iKeyOn; -class Xml; +} // namespace MusECore + +namespace MusEGui { //--------------------------------------------------------- // MITPluginTranspose //--------------------------------------------------------- -class MITPluginTranspose : public QWidget, public Ui::MITTransposeBase, public MITPlugin { +class MITPluginTranspose : public QWidget, public Ui::MITTransposeBase, public MusECore::MITPlugin { Q_OBJECT - KeyOnList keyOnList; + MusECore::KeyOnList keyOnList; int transpose; // current pitch offset int trigger; bool on; @@ -74,12 +80,16 @@ class MITPluginTranspose : public QWidget, public Ui::MITTransposeBase, public M public: MITPluginTranspose(QWidget* parent = 0, Qt::WFlags fl = 0); - virtual void process(MEvent&); - virtual void readStatus(Xml&); - virtual void writeStatus(int, Xml&) const; + virtual void process(MusECore::MEvent&); + virtual void readStatus(MusECore::Xml&); + virtual void writeStatus(int, MusECore::Xml&) const; }; -extern MITPluginTranspose* mitPluginTranspose; +} // namespace MusEGui + +namespace MusEGlobal { +extern MusEGui::MITPluginTranspose* mitPluginTranspose; +} #endif diff --git a/muse2/muse/mplugins/mrconfig.cpp b/muse2/muse/mplugins/mrconfig.cpp index 26788389..d7a8471b 100644 --- a/muse2/muse/mplugins/mrconfig.cpp +++ b/muse2/muse/mplugins/mrconfig.cpp @@ -27,6 +27,8 @@ #include <QCloseEvent> +namespace MusEGui { + //--------------------------------------------------------- // MRConfig // Midi Remote Control Config @@ -91,3 +93,4 @@ void MRConfig::setRcSteprecNote(int val) MusEGlobal::rcSteprecNote = val; } +} // namespace MusEGui diff --git a/muse2/muse/mplugins/mrconfig.h b/muse2/muse/mplugins/mrconfig.h index 60e6c119..3dcda10f 100644 --- a/muse2/muse/mplugins/mrconfig.h +++ b/muse2/muse/mplugins/mrconfig.h @@ -29,6 +29,8 @@ class QCloseEvent; class QWidget; +namespace MusEGui { + //--------------------------------------------------------- // MRConfig //--------------------------------------------------------- @@ -53,5 +55,7 @@ class MRConfig : public QWidget, public Ui::MRConfigBase { MRConfig(QWidget* parent=0, Qt::WFlags fl = 0); }; +} // namespace MusEGui + #endif diff --git a/muse2/muse/mtc.cpp b/muse2/muse/mtc.cpp index cf404a90..ef6fcd3d 100644 --- a/muse2/muse/mtc.cpp +++ b/muse2/muse/mtc.cpp @@ -24,7 +24,11 @@ #include "mtc.h" #include <stdio.h> +namespace MusEGlobal { extern int mtcType; +} + +namespace MusECore { //--------------------------------------------------------- // MTC::time @@ -37,7 +41,7 @@ double MTC::time(int type) const double time = _h * 3600 + _m * 60 + _s; double ft = 0.0; if(type == -1) - type = mtcType; + type = MusEGlobal::mtcType; switch (type) { case 0: // 24 frames sec ft = 1.0/24.0; @@ -68,7 +72,7 @@ MTC::MTC(double t, int type) t -= _s; double ft = 1.0/24.0; if(type == -1) - type = mtcType; + type = MusEGlobal::mtcType; switch (type) { case 0: // 24 frames sec ft = 1.0/24.0; @@ -97,7 +101,7 @@ void MTC::incQuarter(int type) { int frames = 24; if(type == -1) - type = mtcType; + type = MusEGlobal::mtcType; switch (type) { case 0: frames = 24; @@ -143,3 +147,4 @@ void MTC::print() const } +} // namespace MusECore diff --git a/muse2/muse/mtc.h b/muse2/muse/mtc.h index 1c5130ae..97232642 100644 --- a/muse2/muse/mtc.h +++ b/muse2/muse/mtc.h @@ -24,6 +24,8 @@ #ifndef __MTC_H__ #define __MTC_H__ +namespace MusECore { + //--------------------------------------------------------- // MTC //--------------------------------------------------------- @@ -66,6 +68,7 @@ class MTC { void print() const; }; +} // namespace MusECore #endif diff --git a/muse2/muse/node.cpp b/muse2/muse/node.cpp index 8b9e44d8..db11b7bd 100644 --- a/muse2/muse/node.cpp +++ b/muse2/muse/node.cpp @@ -48,6 +48,8 @@ // Added by Tim. p3.3.18 //#define METRONOME_DEBUG +namespace MusECore { + //--------------------------------------------------------- // isMute //--------------------------------------------------------- @@ -74,6 +76,7 @@ bool AudioTrack::isMute() const return _mute; } + //--------------------------------------------------------- // setSolo //--------------------------------------------------------- @@ -99,6 +102,7 @@ void AudioTrack::setSolo(bool val) resetMeter(); } + //--------------------------------------------------------- // setInternalSolo //--------------------------------------------------------- @@ -165,6 +169,7 @@ void MidiTrack::updateInternalSoloStates() Track::updateInternalSoloStates(); } + //--------------------------------------------------------- // updateInternalSoloStates //--------------------------------------------------------- @@ -180,10 +185,10 @@ void AudioTrack::updateInternalSoloStates() { if(type() == AUDIO_SOFTSYNTH) { - const MidiTrackList* ml = song->midis(); - for(ciMidiTrack im = ml->begin(); im != ml->end(); ++im) + const MusECore::MidiTrackList* ml = MusEGlobal::song->midis(); + for(MusECore::ciMidiTrack im = ml->begin(); im != ml->end(); ++im) { - MidiTrack* mt = *im; + MusECore::MidiTrack* mt = *im; if(mt->outPort() >= 0 && mt->outPort() == ((SynthI*)this)->midiPort()) mt->updateInternalSoloStates(); } @@ -207,6 +212,7 @@ void AudioTrack::updateInternalSoloStates() } } + //--------------------------------------------------------- // updateSoloStates //--------------------------------------------------------- @@ -223,7 +229,7 @@ void MidiTrack::updateSoloStates(bool noDec) if(outPort() >= 0) { - MidiPort* mp = &midiPorts[outPort()]; + MidiPort* mp = &MusEGlobal::midiPorts[outPort()]; MidiDevice *md = mp->device(); if(md && md->isSynti()) ((SynthI*)md)->updateInternalSoloStates(); @@ -241,6 +247,7 @@ void MidiTrack::updateSoloStates(bool noDec) } } + //--------------------------------------------------------- // updateSoloStates //--------------------------------------------------------- @@ -257,7 +264,7 @@ void AudioTrack::updateSoloStates(bool noDec) _tmpSoloChainDoIns = true; if(type() == AUDIO_SOFTSYNTH) { - const MidiTrackList* ml = song->midis(); + const MidiTrackList* ml = MusEGlobal::song->midis(); for(ciMidiTrack im = ml->begin(); im != ml->end(); ++im) { MidiTrack* mt = *im; @@ -276,7 +283,7 @@ void AudioTrack::updateSoloStates(bool noDec) // Support Midi Port -> Audio Input solo chains. p4.0.14 Tim. if(ir->type == Route::MIDI_PORT_ROUTE) { - const MidiTrackList* ml = song->midis(); + const MidiTrackList* ml = MusEGlobal::song->midis(); for(ciMidiTrack im = ml->begin(); im != ml->end(); ++im) { MidiTrack* mt = *im; @@ -297,6 +304,7 @@ void AudioTrack::updateSoloStates(bool noDec) } } + //--------------------------------------------------------- // setMute //--------------------------------------------------------- @@ -315,6 +323,7 @@ void Track::setOff(bool val) _off = val; } + //--------------------------------------------------------- // copyData //--------------------------------------------------------- @@ -390,7 +399,7 @@ void AudioTrack::copyData(unsigned pos, int dstChannels, int srcStartChan, int s // No data was available from a previous call during this process cycle. Zero the supplied buffers and just return. for(i = 0; i < dstChannels; ++i) { - if(MusEConfig::config.useDenormalBias) + if(MusEGlobal::config.useDenormalBias) { for(unsigned int q = 0; q < nframes; ++q) dstBuffer[i][q] = MusEGlobal::denormalBias; @@ -431,7 +440,7 @@ void AudioTrack::copyData(unsigned pos, int dstChannels, int srcStartChan, int s unsigned int q; for(i = 0; i < dstChannels; ++i) { - if(MusEConfig::config.useDenormalBias) + if(MusEGlobal::config.useDenormalBias) { for(q = 0; q < nframes; ++q) dstBuffer[i][q] = MusEGlobal::denormalBias; @@ -448,7 +457,7 @@ void AudioTrack::copyData(unsigned pos, int dstChannels, int srcStartChan, int s /* if(!usedirectbuf) { - if(MusEConfig::config.useDenormalBias) + if(MusEGlobal::config.useDenormalBias) { for(q = 0; q < nframes; ++q) outBuffers[i][q] = MusEGlobal::denormalBias; @@ -478,7 +487,7 @@ void AudioTrack::copyData(unsigned pos, int dstChannels, int srcStartChan, int s if(hasAuxSend() && !isMute()) { - AuxList* al = song->auxs(); + AuxList* al = MusEGlobal::song->auxs(); unsigned naux = al->size(); for(unsigned k = 0; k < naux; ++k) { @@ -540,7 +549,7 @@ void AudioTrack::copyData(unsigned pos, int dstChannels, int srcStartChan, int s unsigned int q; for(i = 0; i < dstChannels; ++i) { - if(MusEConfig::config.useDenormalBias) + if(MusEGlobal::config.useDenormalBias) { for(q = 0; q < nframes; q++) dstBuffer[i][q] = MusEGlobal::denormalBias; @@ -554,7 +563,7 @@ void AudioTrack::copyData(unsigned pos, int dstChannels, int srcStartChan, int s { for(i = 0; i < srcChannels; ++i) { - if(MusEConfig::config.useDenormalBias) + if(MusEGlobal::config.useDenormalBias) { for(q = 0; q < nframes; ++q) outBuffers[i][q] = MusEGlobal::denormalBias; @@ -590,7 +599,7 @@ void AudioTrack::copyData(unsigned pos, int dstChannels, int srcStartChan, int s unsigned int q; for(i = 0; i < dstChannels; ++i) { - if(MusEConfig::config.useDenormalBias) + if(MusEGlobal::config.useDenormalBias) { for(q = 0; q < nframes; q++) dstBuffer[i][q] = MusEGlobal::denormalBias; @@ -838,7 +847,7 @@ void AudioTrack::addData(unsigned pos, int dstChannels, int srcStartChan, int sr /* if(!usedirectbuf) { - if(MusEConfig::config.useDenormalBias) + if(MusEGlobal::config.useDenormalBias) { for(unsigned int q = 0; q < nframes; ++q) outBuffers[i][q] = MusEGlobal::denormalBias; @@ -862,7 +871,7 @@ void AudioTrack::addData(unsigned pos, int dstChannels, int srcStartChan, int sr unsigned int q; for(i = 0; i < srcChans; ++i) { - if(MusEConfig::config.useDenormalBias) + if(MusEGlobal::config.useDenormalBias) { for(q = 0; q < nframes; ++q) { @@ -893,7 +902,7 @@ void AudioTrack::addData(unsigned pos, int dstChannels, int srcStartChan, int sr if(hasAuxSend() && !isMute()) { - AuxList* al = song->auxs(); + AuxList* al = MusEGlobal::song->auxs(); unsigned naux = al->size(); for(unsigned k = 0; k < naux; ++k) { @@ -958,7 +967,7 @@ void AudioTrack::addData(unsigned pos, int dstChannels, int srcStartChan, int sr { for(i = 0; i < srcChannels; ++i) { - if(MusEConfig::config.useDenormalBias) + if(MusEGlobal::config.useDenormalBias) { for(unsigned int q = 0; q < nframes; ++q) outBuffers[i][q] = MusEGlobal::denormalBias; @@ -994,7 +1003,7 @@ void AudioTrack::addData(unsigned pos, int dstChannels, int srcStartChan, int sr unsigned int q; for(i = 0; i < dstChannels; ++i) { - if(MusEConfig::config.useDenormalBias) + if(MusEGlobal::config.useDenormalBias) { for(q = 0; q < nframes; q++) dstBuffer[i][q] = MusEGlobal::denormalBias; @@ -1220,6 +1229,7 @@ void AudioTrack::readRecfile(Xml& xml) } */ + //--------------------------------------------------------- // setChannels //--------------------------------------------------------- @@ -1238,6 +1248,7 @@ void Track::setChannels(int n) } } + void AudioInput::setChannels(int n) { if (n == _channels) @@ -1259,7 +1270,7 @@ void AudioOutput::setChannels(int n) void AudioTrack::putFifo(int channels, unsigned long n, float** bp) { - if (fifo.put(channels, n, bp, audio->pos().frame())) { + if (fifo.put(channels, n, bp, MusEGlobal::audio->pos().frame())) { printf(" overrun ???\n"); } } @@ -1336,9 +1347,9 @@ bool AudioInput::getData(unsigned, int channels, unsigned nframes, float** buffe //if (jackPort) { // p3.3.41 Do not get buffers of unconnected client ports. Causes repeating leftover data, can be loud, or DC ! - if (jackPort && audioDevice->connections(jackPort)) + if (jackPort && MusEGlobal::audioDevice->connections(jackPort)) { - //buffer[ch] = audioDevice->getBuffer(jackPort, nframes); + //buffer[ch] = MusEGlobal::audioDevice->getBuffer(jackPort, nframes); // p3.3.41 If the client port buffer is also used by another channel (connected to the same jack port), // don't directly set pointer, copy the data instead. // Otherwise the next channel will interfere - it will overwrite the buffer ! @@ -1348,11 +1359,11 @@ bool AudioInput::getData(unsigned, int channels, unsigned nframes, float** buffe // Solution: Rather than having to iterate all other channels, and all other Audio Input tracks and check // their channel port buffers (if that's even possible) in order to determine if the buffer is shared, // let's just copy always, for now shall we ? - float* jackbuf = audioDevice->getBuffer(jackPort, nframes); + float* jackbuf = MusEGlobal::audioDevice->getBuffer(jackPort, nframes); //memcpy(buffer[ch], jackbuf, nframes* sizeof(float)); AL::dsp->cpy(buffer[ch], jackbuf, nframes); - if (MusEConfig::config.useDenormalBias) + if (MusEGlobal::config.useDenormalBias) { for (unsigned int i=0; i < nframes; i++) buffer[ch][i] += MusEGlobal::denormalBias; @@ -1364,7 +1375,7 @@ bool AudioInput::getData(unsigned, int channels, unsigned nframes, float** buffe } else { - if (MusEConfig::config.useDenormalBias) + if (MusEGlobal::config.useDenormalBias) { for (unsigned int i=0; i < nframes; i++) buffer[ch][i] = MusEGlobal::denormalBias; @@ -1394,14 +1405,15 @@ void AudioInput::setName(const QString& s) char buffer[128]; snprintf(buffer, 128, "%s-%d", _name.toLatin1().constData(), i); if (jackPorts[i]) - audioDevice->setPortName(jackPorts[i], buffer); + MusEGlobal::audioDevice->setPortName(jackPorts[i], buffer); else { - //jackPorts[i] = audioDevice->registerInPort(buffer); - jackPorts[i] = audioDevice->registerInPort(buffer, false); + //jackPorts[i] = MusEGlobal::audioDevice->registerInPort(buffer); + jackPorts[i] = MusEGlobal::audioDevice->registerInPort(buffer, false); } } } + //--------------------------------------------------------- // resetMeter //--------------------------------------------------------- @@ -1431,11 +1443,12 @@ void Track::resetPeaks() void Track::resetAllMeter() { - TrackList* tl = song->tracks(); + TrackList* tl = MusEGlobal::song->tracks(); for (iTrack i = tl->begin(); i != tl->end(); ++i) (*i)->resetMeter(); } + //--------------------------------------------------------- // setRecordFlag2 // real time part (executed in audio thread) @@ -1483,15 +1496,17 @@ void AudioTrack::setPrefader(bool val) resetAllMeter(); } + //--------------------------------------------------------- // canEnableRecord //--------------------------------------------------------- bool WaveTrack::canEnableRecord() const { - return (!noInRoute() || (this == song->bounceTrack)); + return (!noInRoute() || (this == MusEGlobal::song->bounceTrack)); } + //--------------------------------------------------------- // record //--------------------------------------------------------- @@ -1545,20 +1560,20 @@ void AudioTrack::record() // Since it is possible to start loop recording before the left marker (with punchin off), we must // use startRecordPos or loopFrame or left marker, depending on punchin and whether we have looped yet. unsigned fr; - if(song->punchin() && (audio->loopCount() == 0)) - fr = song->lPos().frame(); + if(MusEGlobal::song->punchin() && (MusEGlobal::audio->loopCount() == 0)) + fr = MusEGlobal::song->lPos().frame(); else - if((audio->loopCount() > 0) && (audio->getStartRecordPos().frame() > audio->loopFrame())) - fr = audio->loopFrame(); + if((MusEGlobal::audio->loopCount() > 0) && (MusEGlobal::audio->getStartRecordPos().frame() > MusEGlobal::audio->loopFrame())) + fr = MusEGlobal::audio->loopFrame(); else - fr = audio->getStartRecordPos().frame(); + fr = MusEGlobal::audio->getStartRecordPos().frame(); // Now seek and write. If we are looping and punchout is on, don't let punchout point interfere with looping point. - if( (pos >= fr) && (!song->punchout() || (!song->loop() && pos < song->rPos().frame())) ) + if( (pos >= fr) && (!MusEGlobal::song->punchout() || (!MusEGlobal::song->loop() && pos < MusEGlobal::song->rPos().frame())) ) { pos -= fr; // Added by Tim. p3.3.8 //int position = _recFile->seek(0, SEEK_CUR); - //printf("AudioTrack::record loopcnt:%d lframe:%d newpos:%d curpos:%d start:%d end:%d\n", audio->loopCount(), audio->loopFrame(), pos, position, audio->getStartRecordPos().frame(), audio->getEndRecordPos().frame()); + //printf("AudioTrack::record loopcnt:%d lframe:%d newpos:%d curpos:%d start:%d end:%d\n", MusEGlobal::audio->loopCount(), MusEGlobal::audio->loopFrame(), pos, position, MusEGlobal::audio->getStartRecordPos().frame(), MusEGlobal::audio->getEndRecordPos().frame()); _recFile->seek(pos, 0); _recFile->write(_channels, buffer, MusEGlobal::segmentSize); @@ -1581,8 +1596,8 @@ void AudioOutput::processInit(unsigned nframes) if (!MusEGlobal::checkAudioDevice()) return; for (int i = 0; i < channels(); ++i) { if (jackPorts[i]) { - buffer[i] = audioDevice->getBuffer(jackPorts[i], nframes); - if (MusEConfig::config.useDenormalBias) { + buffer[i] = MusEGlobal::audioDevice->getBuffer(jackPorts[i], nframes); + if (MusEGlobal::config.useDenormalBias) { for (unsigned int j=0; j < nframes; j++) buffer[i][j] += MusEGlobal::denormalBias; } @@ -1622,7 +1637,7 @@ void AudioOutput::silence(unsigned n) { processInit(n); for (int i = 0; i < channels(); ++i) - if (MusEConfig::config.useDenormalBias) { + if (MusEGlobal::config.useDenormalBias) { for (unsigned int j=0; j < n; j++) buffer[i][j] = MusEGlobal::denormalBias; } else { @@ -1636,16 +1651,16 @@ void AudioOutput::silence(unsigned n) void AudioOutput::processWrite() { - if (audio->isRecording() && song->bounceOutput == this) { - if (audio->freewheel()) { - WaveTrack* track = song->bounceTrack; + if (MusEGlobal::audio->isRecording() && MusEGlobal::song->bounceOutput == this) { + if (MusEGlobal::audio->freewheel()) { + MusECore::WaveTrack* track = MusEGlobal::song->bounceTrack; if (track && track->recordFlag() && track->recFile()) track->recFile()->write(_channels, buffer, _nframes); if (recordFlag() && recFile()) _recFile->write(_channels, buffer, _nframes); } else { - WaveTrack* track = song->bounceTrack; + MusECore::WaveTrack* track = MusEGlobal::song->bounceTrack; if (track && track->recordFlag() && track->recFile()) track->putFifo(_channels, _nframes, buffer); if (recordFlag() && recFile()) @@ -1653,17 +1668,17 @@ void AudioOutput::processWrite() } } // Changed by Tim. p3.3.18 - //if (MusEGlobal::audioClickFlag && song->click()) { - if (sendMetronome() && MusEGlobal::audioClickFlag && song->click()) { + //if (MusEGlobal::audioClickFlag && MusEGlobal::song->click()) { + if (sendMetronome() && MusEGlobal::audioClickFlag && MusEGlobal::song->click()) { // Added by Tim. p3.3.18 #ifdef METRONOME_DEBUG - printf("MusE: AudioOutput::processWrite Calling metronome->addData frame:%u channels:%d frames:%lu\n", audio->pos().frame(), _channels, _nframes); + printf("MusE: AudioOutput::processWrite Calling metronome->addData frame:%u channels:%d frames:%lu\n", MusEGlobal::audio->pos().frame(), _channels, _nframes); #endif // p3.3.38 - //metronome->addData(audio->pos().frame(), _channels, _nframes, buffer); - metronome->addData(audio->pos().frame(), _channels, -1, -1, _nframes, buffer); + //metronome->addData(MusEGlobal::audio->pos().frame(), _channels, _nframes, buffer); + metronome->addData(MusEGlobal::audio->pos().frame(), _channels, -1, -1, _nframes, buffer); } } //--------------------------------------------------------- @@ -1678,15 +1693,16 @@ void AudioOutput::setName(const QString& s) char buffer[128]; snprintf(buffer, 128, "%s-%d", _name.toLatin1().constData(), i); if (jackPorts[i]) { - audioDevice->setPortName(jackPorts[i], buffer); + MusEGlobal::audioDevice->setPortName(jackPorts[i], buffer); } else { - //jackPorts[i] = audioDevice->registerOutPort(buffer); - jackPorts[i] = audioDevice->registerOutPort(buffer, false); + //jackPorts[i] = MusEGlobal::audioDevice->registerOutPort(buffer); + jackPorts[i] = MusEGlobal::audioDevice->registerOutPort(buffer, false); } } } + //--------------------------------------------------------- // Fifo //--------------------------------------------------------- @@ -1887,6 +1903,7 @@ void Fifo::add() muse_atomic_inc(&count); } + //--------------------------------------------------------- // setChannels //--------------------------------------------------------- @@ -1956,3 +1973,4 @@ void AudioTrack::setTotalInChannels(int num) _totalInChannels = num; } +} // namespace MusECore diff --git a/muse2/muse/node.h b/muse2/muse/node.h index 1b8d39ab..15b27d13 100644 --- a/muse2/muse/node.h +++ b/muse2/muse/node.h @@ -33,6 +33,8 @@ typedef struct { pthread_mutex_t lock; int counter; } muse_atomic_t; typedef struct { int counter; } muse_atomic_t; #endif +namespace MusECore { + static inline int muse_atomic_read(muse_atomic_t *v) { #ifndef i386 int ret; @@ -98,6 +100,7 @@ class Xml; class Pipeline; class SndFile; + // superceeded by dynamic allocation of fifoLength //const int FIFO_BUFFER = 4096;//64; @@ -142,5 +145,7 @@ class Fifo { int getCount(); }; +} // namespace MusECore + #endif diff --git a/muse2/muse/osc.cpp b/muse2/muse/osc.cpp index c0d936ec..bc64575a 100644 --- a/muse2/muse/osc.cpp +++ b/muse2/muse/osc.cpp @@ -61,6 +61,8 @@ #include "globals.h" #include "globaldefs.h" +namespace MusECore { + static lo_server_thread serverThread = 0; static char* url = 0; static bool oscServerRunning = false; @@ -138,7 +140,7 @@ int oscMessageHandler(const char* path, const char* types, lo_arg** argv, else return oscDebugHandler(path, types, argv, argc, data, user_data); - TrackList* tl = song->tracks(); + TrackList* tl = MusEGlobal::song->tracks(); #ifdef OSC_DEBUG @@ -164,7 +166,7 @@ int oscMessageHandler(const char* path, const char* types, lo_arg** argv, if(isSynth) { // Message is meant for a dssi synth. Check dssi synth instances... - SynthIList* sl = song->syntis(); + SynthIList* sl = MusEGlobal::song->syntis(); for(iSynthI si = sl->begin(); si != sl->end(); ++si) { SynthI* synti = *si; @@ -354,8 +356,6 @@ void initOSC() lo_server_thread_start(serverThread); } -namespace MusEApp { - //--------------------------------------------------------- // exitOSC //--------------------------------------------------------- @@ -396,8 +396,6 @@ void stopOSC() oscServerRunning = false; } -} // namespace MusEApp - //--------------------------------------------------------- // OscIF // Open Sound Control Interface @@ -552,13 +550,13 @@ int OscIF::oscUpdate(lo_arg **argv) // Send project directory. //lo_send(_uiOscTarget, _uiOscConfigurePath, "ss", - // DSSI_PROJECT_DIRECTORY_KEY, museProject.toLatin1().constData()); // song->projectPath() + // DSSI_PROJECT_DIRECTORY_KEY, museProject.toLatin1().constData()); // MusEGlobal::song->projectPath() // Done in sub-classes. /* #ifdef DSSI_SUPPORT //lo_send(_uiOscTarget, _uiOscConfigurePath, "ss", - //DSSI_PROJECT_DIRECTORY_KEY, song->projectPath().toAscii().data()); + //DSSI_PROJECT_DIRECTORY_KEY, MusEGlobal::song->projectPath().toAscii().data()); lo_send(_uiOscTarget, _uiOscConfigurePath, "ss", DSSI_PROJECT_DIRECTORY_KEY, museProject.toLatin1().constData()); @@ -999,7 +997,7 @@ int OscDssiIF::oscUpdate(lo_arg **argv) // Send project directory. No, done in DssiSynthIF. //lo_send(_uiOscTarget, _uiOscConfigurePath, "ss", - // DSSI_PROJECT_DIRECTORY_KEY, museProject.toLatin1().constData()); // song->projectPath() + // DSSI_PROJECT_DIRECTORY_KEY, museProject.toLatin1().constData()); // MusEGlobal::song->projectPath() if(_oscSynthIF) _oscSynthIF->oscUpdate(); @@ -1118,7 +1116,7 @@ int OscEffectIF::oscUpdate(lo_arg** argv) // Send project directory. No, done in PluginI. //lo_send(_uiOscTarget, _uiOscConfigurePath, "ss", - // DSSI_PROJECT_DIRECTORY_KEY, museProject.toLatin1().constData()); // song->projectPath() + // DSSI_PROJECT_DIRECTORY_KEY, museProject.toLatin1().constData()); // MusEGlobal::song->projectPath() if(_oscPluginI) _oscPluginI->oscUpdate(); @@ -1171,5 +1169,6 @@ bool OscEffectIF::oscInitGui() #else //OSC_SUPPORT void initOSC() {} void exitOSC() {} - #endif + +} // namespace MusECore diff --git a/muse2/muse/osc.h b/muse2/muse/osc.h index 8b6ba746..30df03cb 100644 --- a/muse2/muse/osc.h +++ b/muse2/muse/osc.h @@ -27,13 +27,15 @@ #include <lo/lo.h> #include "config.h" - + +class QProcess; +class QString; + +namespace MusECore { #ifdef DSSI_SUPPORT class DssiSynthIF; #endif -class QProcess; -class QString; class PluginI; class OscIF; @@ -120,4 +122,6 @@ class OscDssiIF : public OscIF extern void initOSC(); +} // namespace MusECore + #endif diff --git a/muse2/muse/part.cpp b/muse2/muse/part.cpp index 2d9111f7..3601ff57 100644 --- a/muse2/muse/part.cpp +++ b/muse2/muse/part.cpp @@ -37,6 +37,8 @@ #include "drummap.h" //#include "midiedit/drummap.h" // p4.0.2 +namespace MusECore { + int Part::snGen; //--------------------------------------------------------- @@ -94,7 +96,7 @@ void chainCloneInternal(Part* p) if(!t || (t && t->isMidiTrack())) { MidiTrack* mt = 0; - MidiTrackList* mtl = song->midis(); + MidiTrackList* mtl = MusEGlobal::song->midis(); for(ciMidiTrack imt = mtl->begin(); imt != mtl->end(); ++imt) { mt = *imt; @@ -116,9 +118,9 @@ void chainCloneInternal(Part* p) } if((!p1 && !t) || (t && t->type() == Track::WAVE)) { - WaveTrack* wt = 0; - WaveTrackList* wtl = song->waves(); - for(ciWaveTrack iwt = wtl->begin(); iwt != wtl->end(); ++iwt) + MusECore::WaveTrack* wt = 0; + MusECore::WaveTrackList* wtl = MusEGlobal::song->waves(); + for(MusECore::ciWaveTrack iwt = wtl->begin(); iwt != wtl->end(); ++iwt) { wt = *iwt; const PartList* pl = wt->cparts(); @@ -292,7 +294,7 @@ void chainTrackParts(Track* t, bool incRefCount) if(!t || (t && t->isMidiTrack())) { MidiTrack* mt = 0; - MidiTrackList* mtl = song->midis(); + MidiTrackList* mtl = MusEGlobal::song->midis(); for(ciMidiTrack imt = mtl->begin(); imt != mtl->end(); ++imt) { mt = *imt; @@ -314,9 +316,9 @@ void chainTrackParts(Track* t, bool incRefCount) } if((!p1 && !t) || (t && t->type() == Track::WAVE)) { - WaveTrack* wt = 0; - WaveTrackList* wtl = song->waves(); - for(ciWaveTrack iwt = wtl->begin(); iwt != wtl->end(); ++iwt) + MusECore::WaveTrack* wt = 0; + MusECore::WaveTrackList* wtl = MusEGlobal::song->waves(); + for(MusECore::ciWaveTrack iwt = wtl->begin(); iwt != wtl->end(); ++iwt) { wt = *iwt; const PartList* pl = wt->cparts(); @@ -398,7 +400,7 @@ void addPortCtrlEvents(Event& event, Part* part, bool doClones) int tck = event.tick() + p->tick(); int cntrl = event.dataA(); int val = event.dataB(); - MidiPort* mp = &midiPorts[port]; + MidiPort* mp = &MusEGlobal::midiPorts[port]; // Is it a drum controller event, according to the track port's instrument? if(mt->type() == Track::DRUM) //FINDMICHJETZT was ist das? @@ -408,9 +410,9 @@ void addPortCtrlEvents(Event& event, Part* part, bool doClones) { int note = cntrl & 0x7f; cntrl &= ~0xff; - ch = drumMap[note].channel; - mp = &midiPorts[drumMap[note].port]; - cntrl |= drumMap[note].anote; + ch = MusEGlobal::drumMap[note].channel; + mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[note].port]; + cntrl |= MusEGlobal::drumMap[note].anote; } } @@ -466,7 +468,7 @@ void addPortCtrlEvents(Part* part, bool doClones) int tck = ev.tick() + p->tick(); int cntrl = ev.dataA(); int val = ev.dataB(); - MidiPort* mp = &midiPorts[port]; + MidiPort* mp = &MusEGlobal::midiPorts[port]; // Is it a drum controller event, according to the track port's instrument? if(mt->type() == Track::DRUM) //FINDMICHJETZT was ist das? @@ -476,9 +478,9 @@ void addPortCtrlEvents(Part* part, bool doClones) { int note = cntrl & 0x7f; cntrl &= ~0xff; - ch = drumMap[note].channel; - mp = &midiPorts[drumMap[note].port]; - cntrl |= drumMap[note].anote; + ch = MusEGlobal::drumMap[note].channel; + mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[note].port]; + cntrl |= MusEGlobal::drumMap[note].anote; } } @@ -525,7 +527,7 @@ void removePortCtrlEvents(Event& event, Part* part, bool doClones) int ch = mt->outChannel(); int tck = event.tick() + p->tick(); int cntrl = event.dataA(); - MidiPort* mp = &midiPorts[port]; + MidiPort* mp = &MusEGlobal::midiPorts[port]; // Is it a drum controller event, according to the track port's instrument? if(mt->type() == Track::DRUM) //FINDMICHJETZT was ist das? @@ -535,9 +537,9 @@ void removePortCtrlEvents(Event& event, Part* part, bool doClones) { int note = cntrl & 0x7f; cntrl &= ~0xff; - ch = drumMap[note].channel; - mp = &midiPorts[drumMap[note].port]; - cntrl |= drumMap[note].anote; + ch = MusEGlobal::drumMap[note].channel; + mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[note].port]; + cntrl |= MusEGlobal::drumMap[note].anote; } } @@ -594,7 +596,7 @@ void removePortCtrlEvents(Part* part, bool doClones) int ch = mt->outChannel(); int tck = ev.tick() + p->tick(); int cntrl = ev.dataA(); - MidiPort* mp = &midiPorts[port]; + MidiPort* mp = &MusEGlobal::midiPorts[port]; // Is it a drum controller event, according to the track port's instrument? if(mt->type() == Track::DRUM) //FINDMICHJETZT was ist das? @@ -604,9 +606,9 @@ void removePortCtrlEvents(Part* part, bool doClones) { int note = cntrl & 0x7f; cntrl &= ~0xff; - ch = drumMap[note].channel; - mp = &midiPorts[drumMap[note].port]; - cntrl |= drumMap[note].anote; + ch = MusEGlobal::drumMap[note].channel; + mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[note].port]; + cntrl |= MusEGlobal::drumMap[note].anote; } } @@ -714,6 +716,7 @@ MidiPart::MidiPart(const MidiPart& p) : Part(p) _nextClone = this; } + //--------------------------------------------------------- // WavePart //--------------------------------------------------------- @@ -741,6 +744,7 @@ WavePart::WavePart(const WavePart& p) : Part(p) _nextClone = this; } + //--------------------------------------------------------- // Part //--------------------------------------------------------- @@ -842,9 +846,9 @@ void Song::cmdResizePart(Track* track, Part* oPart, unsigned int len, bool doClo switch(track->type()) { case Track::WAVE: { - WavePart* nPart = new WavePart(*(WavePart*)oPart); + MusECore::WavePart* nPart = new MusECore::WavePart(*(MusECore::WavePart*)oPart); EventList* el = nPart->events(); - unsigned new_partlength = tempomap.deltaTick2frame(oPart->tick(), oPart->tick() + len); + unsigned new_partlength = MusEGlobal::tempomap.deltaTick2frame(oPart->tick(), oPart->tick() + len); // If new nr of frames is less than previous what can happen is: // - 0 or more events are beginning after the new final position. Those are removed from the part @@ -874,7 +878,7 @@ void Song::cmdResizePart(Track* track, Part* oPart, unsigned int len, bool doClo // Do not do port controller values and clone parts. operations.push_back(UndoOp(UndoOp::ModifyPart, oPart, nPart, false, false)); - song->applyOperationGroup(operations); + MusEGlobal::song->applyOperationGroup(operations); } // If the part is expanded there can be no additional events beginning after the previous final position // since those are removed if the part has been shrunk at some time (see above) @@ -888,7 +892,7 @@ void Song::cmdResizePart(Track* track, Part* oPart, unsigned int len, bool doClo i--; Event last = i->second; unsigned last_start = last.frame(); - SndFileR file = last.sndFile(); + MusECore::SndFileR file = last.sndFile(); if (file.isNull()) return; @@ -907,7 +911,7 @@ void Song::cmdResizePart(Track* track, Part* oPart, unsigned int len, bool doClo nPart->setLenFrame(new_partlength); // Do not do port controller values and clone parts. operations.push_back(UndoOp(UndoOp::ModifyPart, oPart, nPart, false, false)); - song->applyOperationGroup(operations); + MusEGlobal::song->applyOperationGroup(operations); } } break; @@ -932,7 +936,7 @@ void Song::cmdResizePart(Track* track, Part* oPart, unsigned int len, bool doClo part_it=(MidiPart*)part_it->nextClone(); } while (doClones && (part_it != (MidiPart*)oPart)); - song->applyOperationGroup(operations); + MusEGlobal::song->applyOperationGroup(operations); break; } default: @@ -951,7 +955,7 @@ void Track::splitPart(Part* part, int tickpos, Part*& p1, Part*& p2) int l1 = 0; // len of first new part (ticks or samples) int l2 = 0; // len of second new part - int samplepos = tempomap.tick2frame(tickpos); + int samplepos = MusEGlobal::tempomap.tick2frame(tickpos); switch (type()) { case WAVE: @@ -1048,14 +1052,14 @@ void Song::cmdSplitPart(Track* track, Part* part, int tick) Part* p2; track->splitPart(part, tick, p1, p2); - //song->informAboutNewParts(part, p1); // is unneccessary because of ChangePart below - song->informAboutNewParts(part, p2); + //MusEGlobal::song->informAboutNewParts(part, p1); // is unneccessary because of ChangePart below + MusEGlobal::song->informAboutNewParts(part, p2); startUndo(); // Indicate no undo, and do port controller values but not clone parts. - //audio->msgChangePart(part, p1, false); - audio->msgChangePart(part, p1, false, true, false); - audio->msgAddPart(p2, false); + //MusEGlobal::audio->msgChangePart(part, p1, false); + MusEGlobal::audio->msgChangePart(part, p1, false, true, false); + MusEGlobal::audio->msgAddPart(p2, false); endUndo(SC_TRACK_MODIFIED | SC_PART_MODIFIED | SC_PART_INSERTED); } @@ -1141,9 +1145,9 @@ void Song::cmdGluePart(Track* track, Part* oPart) } startUndo(); - audio->msgRemovePart(nextPart, false); + MusEGlobal::audio->msgRemovePart(nextPart, false); // Indicate no undo, and do port controller values but not clone parts. - audio->msgChangePart(oPart, nPart, false, true, false); + MusEGlobal::audio->msgChangePart(oPart, nPart, false, true, false); endUndo(SC_PART_MODIFIED | SC_PART_REMOVED); } @@ -1161,6 +1165,7 @@ void Part::dump(int n) const PosLen::dump(); } + void WavePart::dump(int n) const { Part::dump(n); @@ -1169,6 +1174,7 @@ void WavePart::dump(int n) const printf("WavePart\n"); } + void MidiPart::dump(int n) const { Part::dump(n); @@ -1186,11 +1192,13 @@ MidiPart* MidiPart::clone() const return new MidiPart(*this); } + WavePart* WavePart::clone() const { return new WavePart(*this); } + /* bool Part::hasHiddenNotes() { @@ -1226,3 +1234,4 @@ int Part::hasHiddenEvents() return _hiddenEvents; } +} // namespace MusECore diff --git a/muse2/muse/part.h b/muse2/muse/part.h index 7042eedf..e47b9843 100644 --- a/muse2/muse/part.h +++ b/muse2/muse/part.h @@ -35,11 +35,13 @@ class QString; -class Track; +namespace MusECore { + class MidiTrack; -class WaveTrack; +class Track; class Xml; class Part; +class WaveTrack; struct ClonePart { const Part* cp; @@ -117,6 +119,7 @@ class Part : public PosLen { virtual void dump(int n = 0) const; }; + //--------------------------------------------------------- // MidiPart //--------------------------------------------------------- @@ -134,6 +137,7 @@ class MidiPart : public Part { virtual void dump(int n = 0) const; }; + //--------------------------------------------------------- // WavePart //--------------------------------------------------------- @@ -154,6 +158,7 @@ class WavePart : public Part { virtual void dump(int n = 0) const; }; + //--------------------------------------------------------- // PartList //--------------------------------------------------------- @@ -187,8 +192,13 @@ extern void addPortCtrlEvents(Part* part, bool doClones); extern void addPortCtrlEvents(Event& event, Part* part, bool doClones); extern void removePortCtrlEvents(Part* part, bool doClones); extern void removePortCtrlEvents(Event& event, Part* part, bool doClones); -extern CloneList cloneList; extern Part* readXmlPart(Xml&, Track*, bool doClone = false, bool toTrack = true); +} // namespace MusECore + +namespace MusEGlobal { +extern MusECore::CloneList cloneList; +} + #endif diff --git a/muse2/muse/plugin.cpp b/muse2/muse/plugin.cpp index 7205f482..63e65f2e 100644 --- a/muse2/muse/plugin.cpp +++ b/muse2/muse/plugin.cpp @@ -77,7 +77,9 @@ // Turn on debugging messages. //#define PLUGIN_DEBUGIN -PluginList plugins; +namespace MusEGlobal { +MusECore::PluginList plugins; +} /* static const char* MusEGlobal::preset_file_pattern[] = { @@ -95,9 +97,14 @@ static const char* MusEGlobal::preset_file_save_pattern[] = { }; */ +namespace MusEGui { int PluginDialog::selectedPlugType = 0; QStringList PluginDialog::sortItems = QStringList(); +} + +namespace MusECore { + //--------------------------------------------------------- // ladspa2MidiControlValues //--------------------------------------------------------- @@ -763,7 +770,7 @@ Plugin::Plugin(QFileInfo* f, const LADSPA_Descriptor* d, bool isDssi) // Hack: Special Flag required for example for control processing. _isDssiVst = fi.completeBaseName() == QString("dssi-vst"); // Hack: Blacklist vst plugins in-place, configurable for now. - if ((_inports != _outports) || (_isDssiVst && !MusEConfig::config.vstInPlace)) + if ((_inports != _outports) || (_isDssiVst && !MusEGlobal::config.vstInPlace)) _inPlaceCapable = false; } @@ -947,7 +954,7 @@ int Plugin::incReferences(int val) // Hack: Special flag required for example for control processing. _isDssiVst = fi.completeBaseName() == QString("dssi-vst"); // Hack: Blacklist vst plugins in-place, configurable for now. - if ((_inports != _outports) || (_isDssiVst && !MusEConfig::config.vstInPlace)) + if ((_inports != _outports) || (_isDssiVst && !MusEGlobal::config.vstInPlace)) _inPlaceCapable = false; } } @@ -1112,7 +1119,7 @@ static void loadPluginLib(QFileInfo* fi) !descr->run_multiple_synths_adding) { // Make sure it doesn't already exist. - if(plugins.find(fi->completeBaseName(), QString(descr->LADSPA_Plugin->Label)) != 0) + if(MusEGlobal::plugins.find(fi->completeBaseName(), QString(descr->LADSPA_Plugin->Label)) != 0) { //delete descr; continue; @@ -1123,11 +1130,11 @@ static void loadPluginLib(QFileInfo* fi) //LADSPA_Properties properties = descr->LADSPA_Plugin->Properties; //bool inPlaceBroken = LADSPA_IS_INPLACE_BROKEN(properties); - //plugins.add(fi, descr, !inPlaceBroken); + //MusEGlobal::plugins.add(fi, descr, !inPlaceBroken); if(MusEGlobal::debugMsg) fprintf(stderr, "loadPluginLib: adding dssi effect plugin:%s name:%s label:%s\n", fi->filePath().toLatin1().constData(), descr->LADSPA_Plugin->Name, descr->LADSPA_Plugin->Label); - plugins.add(fi, descr->LADSPA_Plugin, true); + MusEGlobal::plugins.add(fi, descr->LADSPA_Plugin, true); } //else // delete descr; @@ -1162,7 +1169,7 @@ static void loadPluginLib(QFileInfo* fi) break; // Make sure it doesn't already exist. - if(plugins.find(fi->completeBaseName(), QString(descr->Label)) != 0) + if(MusEGlobal::plugins.find(fi->completeBaseName(), QString(descr->Label)) != 0) { //delete descr; continue; @@ -1173,10 +1180,10 @@ static void loadPluginLib(QFileInfo* fi) //LADSPA_Properties properties = descr->Properties; //bool inPlaceBroken = LADSPA_IS_INPLACE_BROKEN(properties); - //plugins.add(fi, ladspa, descr, !inPlaceBroken); + //MusEGlobal::plugins.add(fi, ladspa, descr, !inPlaceBroken); if(MusEGlobal::debugMsg) fprintf(stderr, "loadPluginLib: adding ladspa plugin:%s name:%s label:%s\n", fi->filePath().toLatin1().constData(), descr->Name, descr->Label); - plugins.add(fi, descr); + MusEGlobal::plugins.add(fi, descr); } } @@ -1432,7 +1439,7 @@ void Pipeline::move(int idx, bool up) { p1->setID(idx - 1); if(p1->track()) - audio->msgSwapControllerIDX(p1->track(), idx, idx - 1); + MusEGlobal::audio->msgSwapControllerIDX(p1->track(), idx, idx - 1); } } else @@ -1448,7 +1455,7 @@ void Pipeline::move(int idx, bool up) { p1->setID(idx + 1); if(p1->track()) - audio->msgSwapControllerIDX(p1->track(), idx, idx + 1); + MusEGlobal::audio->msgSwapControllerIDX(p1->track(), idx, idx + 1); } } } @@ -1780,13 +1787,13 @@ void PluginI::updateControllers() //for(int i = 0; i < controlPorts; ++i) for(unsigned long i = 0; i < controlPorts; ++i) - //audio->msgSetPluginCtrlVal(this, genACnum(_id, i), controls[i].val); + //MusEGlobal::audio->msgSetPluginCtrlVal(this, genACnum(_id, i), controls[i].val); // p3.3.43 - //audio->msgSetPluginCtrlVal(_track, genACnum(_id, i), controls[i].val); - // p4.0.21 audio->msgXXX waits. Do we really need to? + //MusEGlobal::audio->msgSetPluginCtrlVal(_track, genACnum(_id, i), controls[i].val); + // p4.0.21 MusEGlobal::audio->msgXXX waits. Do we really need to? _track->setPluginCtrlVal(genACnum(_id, i), controls[i].val); // TODO A faster bulk message - song->controllerChange(_track); + MusEGlobal::song->controllerChange(_track); } //--------------------------------------------------------- @@ -1901,10 +1908,10 @@ void PluginI::setParam(unsigned long i, float val) // Time-stamp the event. This does a possibly slightly slow call to gettimeofday via timestamp(). // timestamp() is more or less an estimate of the current frame. (This is exactly how ALSA events // are treated when they arrive in our ALSA driver.) - //ce.frame = audio->timestamp(); + //ce.frame = MusEGlobal::audio->timestamp(); // p4.0.23 timestamp() is circular, which is making it impossible to deal with 'modulo' events which // slip in 'under the wire' before processing the ring buffers. So try this linear timestamp instead: - ce.frame = audio->curFrame(); + ce.frame = MusEGlobal::audio->curFrame(); if(_controlFifo.put(ce)) { @@ -2316,7 +2323,7 @@ bool PluginI::readConfiguration(Xml& xml, bool readPreset) return true; case Xml::TagStart: if (!readPreset && _plugin == 0) { - _plugin = plugins.find(file, label); + _plugin = MusEGlobal::plugins.find(file, label); //if (_plugin && initPluginInstance(_plugin, instances)) { // p3.3.41 @@ -2394,7 +2401,7 @@ bool PluginI::readConfiguration(Xml& xml, bool readPreset) case Xml::TagEnd: if (tag == "plugin") { if (!readPreset && _plugin == 0) { - _plugin = plugins.find(file, label); + _plugin = MusEGlobal::plugins.find(file, label); if (_plugin == 0) { printf("Warning: Plugin not found (%s, %s)\n", @@ -2512,7 +2519,7 @@ bool PluginI::nativeGuiVisible() //void PluginI::makeGui() void PluginIBase::makeGui() { - _gui = new PluginGui(this); + _gui = new MusEGui::PluginGui(this); } //--------------------------------------------------------- @@ -2600,9 +2607,9 @@ void PluginI::apply(unsigned long n) { // Since we are now in the audio thread context, there's no need to send a message, // just modify directly. - //audio->msgSetPluginCtrlVal(this, genACnum(_id, k), controls[k].val); + //MusEGlobal::audio->msgSetPluginCtrlVal(this, genACnum(_id, k), controls[k].val); // p3.3.43 - //audio->msgSetPluginCtrlVal(_track, genACnum(_id, k), controls[k].val); + //MusEGlobal::audio->msgSetPluginCtrlVal(_track, genACnum(_id, k), controls[k].val); _track->setPluginCtrlVal(genACnum(_id, k), v.value); // Record automation. @@ -2613,7 +2620,7 @@ void PluginI::apply(unsigned long n) // TODO: Taken from our native gui control handlers. // This may need modification or may cause problems - // we don't have the luxury of access to the dssi gui controls ! - //if(at == AUTO_WRITE || (audio->isPlaying() && at == AUTO_TOUCH)) + //if(at == AUTO_WRITE || (MusEGlobal::audio->isPlaying() && at == AUTO_TOUCH)) // enableController(k, false); //_track->recordAutomation(id, v.value); } @@ -2663,8 +2670,8 @@ void PluginI::apply(unsigned long n, unsigned long ports, float** bufIn, float** //const int cbsz = _controlFifo.getSize(); //unsigned endPos = pos + n; - //unsigned long frameOffset = audio->getFrameOffset(); - unsigned long syncFrame = audio->curSyncFrame(); + //unsigned long frameOffset = MusEGlobal::audio->getFrameOffset(); + unsigned long syncFrame = MusEGlobal::audio->curSyncFrame(); unsigned long sample = 0; int loopcount = 0; // REMOVE Tim. @@ -2684,7 +2691,7 @@ void PluginI::apply(unsigned long n, unsigned long ports, float** bufIn, float** if(fixedsize > n) fixedsize = n; - unsigned long min_per = MusEConfig::config.minControlProcessPeriod; + unsigned long min_per = MusEGlobal::config.minControlProcessPeriod; if(min_per > n) min_per = n; @@ -2768,9 +2775,9 @@ void PluginI::apply(unsigned long n, unsigned long ports, float** bufIn, float** { // Since we are now in the audio thread context, there's no need to send a message, // just modify directly. - //audio->msgSetPluginCtrlVal(this, genACnum(_id, k), controls[k].val); + //MusEGlobal::audio->msgSetPluginCtrlVal(this, genACnum(_id, k), controls[k].val); // p3.3.43 - //audio->msgSetPluginCtrlVal(_track, genACnum(_id, k), controls[k].val); + //MusEGlobal::audio->msgSetPluginCtrlVal(_track, genACnum(_id, k), controls[k].val); _track->setPluginCtrlVal(genACnum(_id, v.idx), v.value); // Record automation. @@ -2784,7 +2791,7 @@ void PluginI::apply(unsigned long n, unsigned long ports, float** bufIn, float** // TODO: Taken from our native gui control handlers. // This may need modification or may cause problems - // we don't have the luxury of access to the dssi gui controls ! - //if(at == AUTO_WRITE || (audio->isPlaying() && at == AUTO_TOUCH)) + //if(at == AUTO_WRITE || (MusEGlobal::audio->isPlaying() && at == AUTO_TOUCH)) // enableController(k, false); //_track->recordAutomation(id, v.value); } @@ -2931,7 +2938,7 @@ int PluginI::oscUpdate() { #ifdef DSSI_SUPPORT // Send project directory. - _oscif.oscSendConfigure(DSSI_PROJECT_DIRECTORY_KEY, MusEGlobal::museProject.toLatin1().constData()); // song->projectPath() + _oscif.oscSendConfigure(DSSI_PROJECT_DIRECTORY_KEY, MusEGlobal::museProject.toLatin1().constData()); // MusEGlobal::song->projectPath() /* // Send current string configuration parameters. @@ -3032,7 +3039,7 @@ int PluginI::oscControl(unsigned long port, float value) // Time-stamp the event. Looks like no choice but to use the (possibly slow) call to gettimeofday via timestamp(), // because these are asynchronous events arriving from OSC. timestamp() is more or less an estimate of the // current frame. (This is exactly how ALSA events are treated when they arrive in our ALSA driver.) p4.0.15 Tim. - cv.frame = audio->timestamp(); + cv.frame = MusEGlobal::audio->timestamp(); if(cfifo->put(cv)) { fprintf(stderr, "PluginI::oscControl: fifo overflow: in control number:%lu\n", cport); @@ -3047,10 +3054,10 @@ int PluginI::oscControl(unsigned long port, float value) // Time-stamp the event. This does a possibly slightly slow call to gettimeofday via timestamp(). // timestamp() is more or less an estimate of the current frame. (This is exactly how ALSA events // are treated when they arrive in our ALSA driver.) - //ce.frame = audio->timestamp(); + //ce.frame = MusEGlobal::audio->timestamp(); // p4.0.23 timestamp() is circular, which is making it impossible to deal with 'modulo' events which // slip in 'under the wire' before processing the ring buffers. So try this linear timestamp instead: - ce.frame = audio->curFrame(); + ce.frame = MusEGlobal::audio->curFrame(); if(_controlFifo.put(ce)) { fprintf(stderr, "PluginI::oscControl: fifo overflow: in control number:%lu\n", cport); @@ -3072,7 +3079,7 @@ int PluginI::oscControl(unsigned long port, float value) // TODO: Taken from our native gui control handlers. // This may need modification or may cause problems - // we don't have the luxury of access to the dssi gui controls ! - if(at == AUTO_WRITE || (audio->isPlaying() && at == AUTO_TOUCH)) + if(at == AUTO_WRITE || (MusEGlobal::audio->isPlaying() && at == AUTO_TOUCH)) enableController(cport, false); _track->recordAutomation(id, value); @@ -3119,6 +3126,9 @@ int PluginI::oscControl(unsigned long port, float value) #endif // OSC_SUPPORT +} // namespace MusECore + +namespace MusEGui { //--------------------------------------------------------- // PluginDialog @@ -3269,11 +3279,11 @@ void PluginDialog::enableOkB() // value //--------------------------------------------------------- -Plugin* PluginDialog::value() +MusECore::Plugin* PluginDialog::value() { QTreeWidgetItem* item = pList->currentItem(); if (item) - return plugins.find(item->text(0), item->text(1)); + return MusEGlobal::plugins.find(item->text(0), item->text(1)); printf("plugin not found\n"); return 0; } @@ -3314,7 +3324,7 @@ void PluginDialog::fillPlugs(QAbstractButton* ab) void PluginDialog::fillPlugs(int nbr) { pList->clear(); - for (iPlugin i = plugins.begin(); i != plugins.end(); ++i) { + for (MusECore::iPlugin i = MusEGlobal::plugins.begin(); i != MusEGlobal::plugins.end(); ++i) { //int ai = i->inports(); //int ao = i->outports(); //int ci = i->controlInPorts(); @@ -3366,7 +3376,7 @@ void PluginDialog::fillPlugs(int nbr) void PluginDialog::fillPlugs(const QString &sortValue) { pList->clear(); - for (iPlugin i = plugins.begin(); i != plugins.end(); ++i) { + for (MusECore::iPlugin i = MusEGlobal::plugins.begin(); i != MusEGlobal::plugins.end(); ++i) { //int ai = i->inports(); //int ao = i->outports(); //int ci = i->controlInPorts(); @@ -3404,7 +3414,7 @@ void PluginDialog::fillPlugs(const QString &sortValue) // getPlugin //--------------------------------------------------------- -Plugin* PluginDialog::getPlugin(QWidget* parent) +MusECore::Plugin* PluginDialog::getPlugin(QWidget* parent) { PluginDialog* dialog = new PluginDialog(parent); if (dialog->exec()) @@ -3427,7 +3437,7 @@ const char* presetBypassText = "Click this button to bypass effect unit"; //PluginGui::PluginGui(PluginI* p) // p3.3.43 -PluginGui::PluginGui(PluginIBase* p) +PluginGui::PluginGui(MusECore::PluginIBase* p) : QMainWindow(0) { gw = 0; @@ -3504,7 +3514,7 @@ PluginGui::PluginGui(PluginIBase* p) QSignalMapper* mapper = new QSignalMapper(this); // FIXME: There's no unsigned for gui params. We would need to limit nobj to MAXINT. // p4.0.21 - // FIXME: Our MusEWidget::Slider class uses doubles for values, giving some problems with float conversion. // p4.0.21 + // FIXME: Our MusEGui::Slider class uses doubles for values, giving some problems with float conversion. // p4.0.21 connect(mapper, SIGNAL(mapped(int)), SLOT(guiParamChanged(int))); @@ -3538,13 +3548,13 @@ PluginGui::PluginGui(PluginIBase* p) if (strcmp(obj->metaObject()->className(), "Slider") == 0) { gw[nobj].type = GuiWidgets::SLIDER; - ((MusEWidget::Slider*)obj)->setId(nobj); - ((MusEWidget::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) - ((MusEWidget::DoubleLabel*)gw[i].widget)->setSlider((MusEWidget::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))); @@ -3553,13 +3563,13 @@ PluginGui::PluginGui(PluginIBase* p) } else if (strcmp(obj->metaObject()->className(), "DoubleLabel") == 0) { gw[nobj].type = GuiWidgets::DOUBLE_LABEL; - ((MusEWidget::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) { - ((MusEWidget::DoubleLabel*)obj)->setSlider((MusEWidget::Slider*)gw[i].widget); + ((DoubleLabel*)obj)->setSlider((Slider*)gw[i].widget); break; } } @@ -3599,7 +3609,7 @@ PluginGui::PluginGui(PluginIBase* p) unsigned long n = plugin->parameters(); // p4.0.21 params = new GuiParam[n]; - //int style = MusEWidget::Slider::BgTrough | MusEWidget::Slider::BgSlot; + //int style = Slider::BgTrough | Slider::BgSlot; QFontMetrics fm = fontMetrics(); int h = fm.height() + 4; @@ -3619,7 +3629,7 @@ PluginGui::PluginGui(PluginIBase* p) if (LADSPA_IS_HINT_TOGGLED(range.HintDescriptor)) { params[i].type = GuiParam::GUI_SWITCH; - MusEWidget::CheckBox* cb = new MusEWidget::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); @@ -3629,7 +3639,7 @@ PluginGui::PluginGui(PluginIBase* p) else { label = new QLabel(QString(plugin->paramName(i)), 0); params[i].type = GuiParam::GUI_SLIDER; - params[i].label = new MusEWidget::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); @@ -3642,8 +3652,8 @@ PluginGui::PluginGui(PluginIBase* p) uint c3 = j * j * j * 43 % 256; QColor color(c1, c2, c3); - MusEWidget::Slider* s = new MusEWidget::Slider(0, "param", Qt::Horizontal, - MusEWidget::Slider::None, color); + Slider* s = new Slider(0, "param", Qt::Horizontal, + Slider::None, color); s->setCursorHoming(true); s->setId(i); @@ -3653,7 +3663,7 @@ PluginGui::PluginGui(PluginIBase* p) s->setStep(1.0); s->setValue(dval); params[i].actuator = s; - params[i].label->setSlider((MusEWidget::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)); @@ -3705,22 +3715,22 @@ PluginGui::PluginGui(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 MusEWidget::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); - MusEWidget::Meter::MeterType mType=MusEWidget::Meter::LinMeter; + Meter::MeterType mType=Meter::LinMeter; if(LADSPA_IS_HINT_INTEGER(range.HintDescriptor)) - mType=MusEWidget::Meter::DBMeter; - MusEWidget::VerticalMeter* m = new MusEWidget::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((MusEWidget::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)); @@ -3771,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; } } @@ -3794,7 +3804,7 @@ void PluginGui::heartBeat() void PluginGui::ctrlPressed(int param) { AutomationType at = AUTO_OFF; - AudioTrack* track = plugin->track(); + MusECore::AudioTrack* track = plugin->track(); if(track) at = track->automationType(); @@ -3806,48 +3816,48 @@ void PluginGui::ctrlPressed(int param) if(id == -1) return; - id = genACnum(id, param); + id = MusECore::genACnum(id, param); if(params[param].type == GuiParam::GUI_SLIDER) { - double val = ((MusEWidget::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); - ((MusEWidget::DoubleLabel*)params[param].label)->setValue(val); + ((DoubleLabel*)params[param].label)->setValue(val); // p3.3.43 - //audio->msgSetPluginCtrlVal(((PluginI*)plugin), id, val); + //MusEGlobal::audio->msgSetPluginCtrlVal(((PluginI*)plugin), id, val); if(track) { // p3.3.43 - //audio->msgSetPluginCtrlVal(track, id, val); - // p4.0.21 audio->msgXXX waits. Do we really need to? + //MusEGlobal::audio->msgSetPluginCtrlVal(track, id, val); + // p4.0.21 MusEGlobal::audio->msgXXX waits. Do we really need to? track->setPluginCtrlVal(id, val); - song->controllerChange(track); + MusEGlobal::song->controllerChange(track); track->startAutoRecord(id, val); } } else if(params[param].type == GuiParam::GUI_SWITCH) { - //double val = (double)((MusEWidget::CheckBox*)params[param].actuator)->isChecked(); - float val = (float)((MusEWidget::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 - //audio->msgSetPluginCtrlVal(((PluginI*)plugin), id, val); + //MusEGlobal::audio->msgSetPluginCtrlVal(((PluginI*)plugin), id, val); if(track) { // p3.3.43 - //audio->msgSetPluginCtrlVal(track, id, val); - // p4.0.21 audio->msgXXX waits. Do we really need to? + //MusEGlobal::audio->msgSetPluginCtrlVal(track, id, val); + // p4.0.21 MusEGlobal::audio->msgXXX waits. Do we really need to? track->setPluginCtrlVal(id, val); - song->controllerChange(track); + MusEGlobal::song->controllerChange(track); track->startAutoRecord(id, val); } @@ -3861,24 +3871,24 @@ void PluginGui::ctrlPressed(int param) void PluginGui::ctrlReleased(int param) { AutomationType at = AUTO_OFF; - AudioTrack* track = plugin->track(); + MusECore::AudioTrack* track = plugin->track(); if(track) at = track->automationType(); // Special for switch - don't enable controller until transport stopped. if(at != AUTO_WRITE && ((params[param].type != GuiParam::GUI_SWITCH - || !audio->isPlaying() - || at != AUTO_TOUCH) || (!audio->isPlaying() && at == AUTO_TOUCH)) ) + || !MusEGlobal::audio->isPlaying() + || at != AUTO_TOUCH) || (!MusEGlobal::audio->isPlaying() && at == AUTO_TOUCH)) ) plugin->enableController(param, true); int id = plugin->id(); if(!track || id == -1) return; - id = genACnum(id, param); + id = MusECore::genACnum(id, param); if(params[param].type == GuiParam::GUI_SLIDER) { - double val = ((MusEWidget::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)) @@ -3887,9 +3897,9 @@ void PluginGui::ctrlReleased(int param) } //else if(params[param].type == GuiParam::GUI_SWITCH) //{ - //double val = (double)((MusEWidget::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(genACnum(plugin->id(), param), val); + //plugin->track()->stopAutoRecord(MusECore::genACnum(plugin->id(), param), val); //} } @@ -3901,8 +3911,8 @@ void PluginGui::ctrlRightClicked(const QPoint &p, int param) { int id = plugin->id(); if(id != -1) - //song->execAutomationCtlPopup((AudioTrack*)plugin->track(), p, genACnum(id, param)); - song->execAutomationCtlPopup(plugin->track(), p, genACnum(id, param)); + //MusEGlobal::song->execAutomationCtlPopup((MusECore::AudioTrack*)plugin->track(), p, MusECore::genACnum(id, param)); + MusEGlobal::song->execAutomationCtlPopup(plugin->track(), p, MusECore::genACnum(id, param)); } //--------------------------------------------------------- @@ -3912,11 +3922,11 @@ void PluginGui::ctrlRightClicked(const QPoint &p, int param) void PluginGui::sliderChanged(double val, int param) { AutomationType at = AUTO_OFF; - AudioTrack* track = plugin->track(); + MusECore::AudioTrack* track = plugin->track(); if(track) at = track->automationType(); - if(at == AUTO_WRITE || (audio->isPlaying() && at == AUTO_TOUCH)) + if(at == AUTO_WRITE || (MusEGlobal::audio->isPlaying() && at == AUTO_TOUCH)) plugin->enableController(param, false); if (LADSPA_IS_HINT_LOGARITHMIC(params[param].hint)) @@ -3925,24 +3935,24 @@ void PluginGui::sliderChanged(double val, int param) val = rint(val); if (plugin->param(param) != val) { plugin->setParam(param, val); - ((MusEWidget::DoubleLabel*)params[param].label)->setValue(val); + ((DoubleLabel*)params[param].label)->setValue(val); } int id = plugin->id(); if(id == -1) return; - id = genACnum(id, param); + id = MusECore::genACnum(id, param); // p3.3.43 - //audio->msgSetPluginCtrlVal(((PluginI*)plugin), id, val); + //MusEGlobal::audio->msgSetPluginCtrlVal(((PluginI*)plugin), id, val); if(track) { // p3.3.43 - //audio->msgSetPluginCtrlVal(track, id, val); - // p4.0.21 audio->msgXXX waits. Do we really need to? + //MusEGlobal::audio->msgSetPluginCtrlVal(track, id, val); + // p4.0.21 MusEGlobal::audio->msgXXX waits. Do we really need to? track->setPluginCtrlVal(id, val); - song->controllerChange(track); + MusEGlobal::song->controllerChange(track); track->recordAutomation(id, val); } @@ -3955,39 +3965,39 @@ void PluginGui::sliderChanged(double val, int param) void PluginGui::labelChanged(double val, int param) { AutomationType at = AUTO_OFF; - AudioTrack* track = plugin->track(); + MusECore::AudioTrack* track = plugin->track(); if(track) at = track->automationType(); - if(at == AUTO_WRITE || (audio->isPlaying() && at == AUTO_TOUCH)) + if(at == AUTO_WRITE || (MusEGlobal::audio->isPlaying() && at == AUTO_TOUCH)) plugin->enableController(param, false); 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); - ((MusEWidget::Slider*)params[param].actuator)->setValue(dval); + ((Slider*)params[param].actuator)->setValue(dval); } int id = plugin->id(); if(id == -1) return; - id = genACnum(id, param); + id = MusECore::genACnum(id, param); // p3.3.43 - //audio->msgSetPluginCtrlVal(((PluginI*)plugin), id, val); + //MusEGlobal::audio->msgSetPluginCtrlVal(((PluginI*)plugin), id, val); if(track) { // p3.3.43 - //audio->msgSetPluginCtrlVal(track, id, val); - // p4.0.21 audio->msgXXX waits. Do we really need to? + //MusEGlobal::audio->msgSetPluginCtrlVal(track, id, val); + // p4.0.21 MusEGlobal::audio->msgXXX waits. Do we really need to? track->setPluginCtrlVal(id, val); - song->controllerChange(track); + MusEGlobal::song->controllerChange(track); track->startAutoRecord(id, val); } @@ -4004,25 +4014,25 @@ void PluginGui::load() s += plugin->pluginLabel(); s += "/"; - QString fn = MusEWidget::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 = MusEWidget::fileOpen(this, fn, QString(".pre"), "r", popenFlag, true); + FILE* f = fileOpen(this, fn, QString(".pre"), "r", popenFlag, true); if (f == 0) return; - Xml xml(f); + MusECore::Xml xml(f); int mode = 0; for (;;) { - Xml::Token token = xml.parse(); + MusECore::Xml::Token token = xml.parse(); QString tag = xml.s1(); switch (token) { - case Xml::Error: - case Xml::End: + case MusECore::Xml::Error: + case MusECore::Xml::End: return; - case Xml::TagStart: + case MusECore::Xml::TagStart: if (mode == 0 && tag == "muse") mode = 1; else if (mode == 1 && tag == "plugin") { @@ -4039,9 +4049,9 @@ void PluginGui::load() else xml.unknown("PluginGui"); break; - case Xml::Attribut: + case MusECore::Xml::Attribut: break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (!mode && tag == "muse") { plugin->updateControllers(); @@ -4069,16 +4079,16 @@ void PluginGui::save() s += plugin->pluginLabel(); s += "/"; - //QString fn = MusEWidget::getSaveFileName(s, MusEGlobal::preset_file_pattern, this, - QString fn = MusEWidget::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 = MusEWidget::fileOpen(this, fn, QString(".pre"), "w", popenFlag, false, true); + FILE* f = fileOpen(this, fn, QString(".pre"), "w", popenFlag, false, true); if (f == 0) return; - Xml xml(f); + MusECore::Xml xml(f); xml.header(); xml.tag(0, "muse version=\"1.0\""); plugin->writeConfiguration(1, xml); @@ -4097,7 +4107,7 @@ void PluginGui::save() void PluginGui::bypassToggled(bool val) { plugin->setOn(val); - song->update(SC_ROUTE); + MusEGlobal::song->update(SC_ROUTE); } //--------------------------------------------------------- @@ -4125,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); - ((MusEWidget::Slider*)(gp->actuator))->setValue(sv); + ((Slider*)(gp->actuator))->setValue(sv); } else if (gp->type == GuiParam::GUI_SWITCH) { - ((MusEWidget::CheckBox*)(gp->actuator))->setChecked(int(plugin->param(i))); + ((CheckBox*)(gp->actuator))->setChecked(int(plugin->param(i))); } } } @@ -4150,10 +4160,10 @@ void PluginGui::updateValues() float val = plugin->param(param); switch(type) { case GuiWidgets::SLIDER: - ((MusEWidget::Slider*)widget)->setValue(val); // Note conversion to double + ((Slider*)widget)->setValue(val); // Note conversion to double break; case GuiWidgets::DOUBLE_LABEL: - ((MusEWidget::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)); @@ -4184,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; } - ((MusEWidget::VerticalMeter*)(gp->actuator))->setVal(sv); + ((VerticalMeter*)(gp->actuator))->setVal(sv); gp->label->setValue(lv); } @@ -4210,25 +4220,25 @@ void PluginGui::updateControls() if (gp->type == GuiParam::GUI_SLIDER) { if( plugin->controllerEnabled(i) && plugin->controllerEnabled2(i) ) { - double lv = plugin->track()->pluginCtrlVal(genACnum(plugin->id(), i)); + 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(((MusEWidget::Slider*)(gp->actuator))->value() != sv) + if(((Slider*)(gp->actuator))->value() != sv) { //printf("PluginGui::updateControls slider\n"); gp->label->blockSignals(true); - ((MusEWidget::Slider*)(gp->actuator))->blockSignals(true); - ((MusEWidget::Slider*)(gp->actuator))->setValue(sv); + ((Slider*)(gp->actuator))->blockSignals(true); + ((Slider*)(gp->actuator))->setValue(sv); gp->label->setValue(lv); - ((MusEWidget::Slider*)(gp->actuator))->blockSignals(false); + ((Slider*)(gp->actuator))->blockSignals(false); gp->label->blockSignals(false); } } @@ -4237,14 +4247,14 @@ void PluginGui::updateControls() else if (gp->type == GuiParam::GUI_SWITCH) { if( plugin->controllerEnabled(i) && plugin->controllerEnabled2(i) ) { - bool v = (int)plugin->track()->pluginCtrlVal(genACnum(plugin->id(), i)); - if(((MusEWidget::CheckBox*)(gp->actuator))->isChecked() != v) + bool v = (int)plugin->track()->pluginCtrlVal(MusECore::genACnum(plugin->id(), i)); + if(((CheckBox*)(gp->actuator))->isChecked() != v) { //printf("PluginGui::updateControls switch\n"); - ((MusEWidget::CheckBox*)(gp->actuator))->blockSignals(true); - ((MusEWidget::CheckBox*)(gp->actuator))->setChecked(v); - ((MusEWidget::CheckBox*)(gp->actuator))->blockSignals(false); + ((CheckBox*)(gp->actuator))->blockSignals(true); + ((CheckBox*)(gp->actuator))->setChecked(v); + ((CheckBox*)(gp->actuator))->blockSignals(false); } } } @@ -4261,35 +4271,35 @@ void PluginGui::updateControls() case GuiWidgets::SLIDER: if( plugin->controllerEnabled(param) && plugin->controllerEnabled2(param) ) { - double v = plugin->track()->pluginCtrlVal(genACnum(plugin->id(), param)); - if(((MusEWidget::Slider*)widget)->value() != v) + double v = plugin->track()->pluginCtrlVal(MusECore::genACnum(plugin->id(), param)); + if(((Slider*)widget)->value() != v) { //printf("PluginGui::updateControls slider\n"); - ((MusEWidget::Slider*)widget)->blockSignals(true); - ((MusEWidget::Slider*)widget)->setValue(v); - ((MusEWidget::Slider*)widget)->blockSignals(false); + ((Slider*)widget)->blockSignals(true); + ((Slider*)widget)->setValue(v); + ((Slider*)widget)->blockSignals(false); } } break; case GuiWidgets::DOUBLE_LABEL: if( plugin->controllerEnabled(param) && plugin->controllerEnabled2(param) ) { - double v = plugin->track()->pluginCtrlVal(genACnum(plugin->id(), param)); - if(((MusEWidget::DoubleLabel*)widget)->value() != v) + double v = plugin->track()->pluginCtrlVal(MusECore::genACnum(plugin->id(), param)); + if(((DoubleLabel*)widget)->value() != v) { //printf("PluginGui::updateControls label\n"); - ((MusEWidget::DoubleLabel*)widget)->blockSignals(true); - ((MusEWidget::DoubleLabel*)widget)->setValue(v); - ((MusEWidget::DoubleLabel*)widget)->blockSignals(false); + ((DoubleLabel*)widget)->blockSignals(true); + ((DoubleLabel*)widget)->setValue(v); + ((DoubleLabel*)widget)->blockSignals(false); } } break; case GuiWidgets::QCHECKBOX: if( plugin->controllerEnabled(param) && plugin->controllerEnabled2(param) ) { - bool b = (bool) plugin->track()->pluginCtrlVal(genACnum(plugin->id(), param)); + bool b = (bool) plugin->track()->pluginCtrlVal(MusECore::genACnum(plugin->id(), param)); if(((QCheckBox*)widget)->isChecked() != b) { //printf("PluginGui::updateControls checkbox\n"); @@ -4303,7 +4313,7 @@ void PluginGui::updateControls() case GuiWidgets::QCOMBOBOX: if( plugin->controllerEnabled(param) && plugin->controllerEnabled2(param) ) { - int n = (int) plugin->track()->pluginCtrlVal(genACnum(plugin->id(), param)); + int n = (int) plugin->track()->pluginCtrlVal(MusECore::genACnum(plugin->id(), param)); if(((QComboBox*)widget)->currentIndex() != n) { //printf("PluginGui::updateControls combobox\n"); @@ -4331,20 +4341,20 @@ void PluginGui::guiParamChanged(int idx) int type = gw[idx].type; AutomationType at = AUTO_OFF; - AudioTrack* track = plugin->track(); + MusECore::AudioTrack* track = plugin->track(); if(track) at = track->automationType(); - if(at == AUTO_WRITE || (audio->isPlaying() && at == AUTO_TOUCH)) + if(at == AUTO_WRITE || (MusEGlobal::audio->isPlaying() && at == AUTO_TOUCH)) plugin->enableController(param, false); double val = 0.0; switch(type) { case GuiWidgets::SLIDER: - val = ((MusEWidget::Slider*)w)->value(); + val = ((Slider*)w)->value(); break; case GuiWidgets::DOUBLE_LABEL: - val = ((MusEWidget::DoubleLabel*)w)->value(); + val = ((DoubleLabel*)w)->value(); break; case GuiWidgets::QCHECKBOX: val = double(((QCheckBox*)w)->isChecked()); @@ -4362,10 +4372,10 @@ void PluginGui::guiParamChanged(int idx) int type = gw[i].type; switch(type) { case GuiWidgets::SLIDER: - ((MusEWidget::Slider*)widget)->setValue(val); + ((Slider*)widget)->setValue(val); break; case GuiWidgets::DOUBLE_LABEL: - ((MusEWidget::DoubleLabel*)widget)->setValue(val); + ((DoubleLabel*)widget)->setValue(val); break; case GuiWidgets::QCHECKBOX: ((QCheckBox*)widget)->setChecked(int(val)); @@ -4379,18 +4389,18 @@ void PluginGui::guiParamChanged(int idx) int id = plugin->id(); if(track && id != -1) { - id = genACnum(id, param); + id = MusECore::genACnum(id, param); // p3.3.43 - //audio->msgSetPluginCtrlVal(((PluginI*)plugin), id, val); + //MusEGlobal::audio->msgSetPluginCtrlVal(((PluginI*)plugin), id, val); //if(track) //{ // p3.3.43 - //audio->msgSetPluginCtrlVal(track, id, val); - // p4.0.21 audio->msgXXX waits. Do we really need to? + //MusEGlobal::audio->msgSetPluginCtrlVal(track, id, val); + // p4.0.21 MusEGlobal::audio->msgXXX waits. Do we really need to? track->setPluginCtrlVal(id, val); - song->controllerChange(track); + MusEGlobal::song->controllerChange(track); switch(type) { @@ -4417,7 +4427,7 @@ void PluginGui::guiParamPressed(int idx) unsigned long param = gw[idx].param; // p4.0.21 AutomationType at = AUTO_OFF; - AudioTrack* track = plugin->track(); + MusECore::AudioTrack* track = plugin->track(); if(track) at = track->automationType(); @@ -4428,16 +4438,16 @@ void PluginGui::guiParamPressed(int idx) if(!track || id == -1) return; - id = genACnum(id, param); + 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 MusEWidget::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)((MusEWidget::CheckBox*)w)->isChecked(); + double val = (double)((CheckBox*)w)->isChecked(); track->startAutoRecord(id, val); break; case GuiWidgets::QCOMBOBOX: @@ -4459,13 +4469,13 @@ void PluginGui::guiParamReleased(int idx) int type = gw[idx].type; AutomationType at = AUTO_OFF; - AudioTrack* track = plugin->track(); + MusECore::AudioTrack* track = plugin->track(); if(track) at = track->automationType(); // Special for switch - don't enable controller until transport stopped. if(at != AUTO_WRITE && (type != GuiWidgets::QCHECKBOX - || !audio->isPlaying() + || !MusEGlobal::audio->isPlaying() || at != AUTO_TOUCH)) plugin->enableController(param, true); @@ -4474,16 +4484,16 @@ void PluginGui::guiParamReleased(int idx) if(!track || id == -1) return; - id = genACnum(id, param); + 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 MusEWidget::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)((MusEWidget::CheckBox*)w)->isChecked(); + double val = (double)((CheckBox*)w)->isChecked(); track->stopAutoRecord(id, param); break; case GuiWidgets::QCOMBOBOX: @@ -4505,7 +4515,7 @@ void PluginGui::guiSliderPressed(int idx) QWidget *w = gw[idx].widget; AutomationType at = AUTO_OFF; - AudioTrack* track = plugin->track(); + MusECore::AudioTrack* track = plugin->track(); if(track) at = track->automationType(); @@ -4517,17 +4527,17 @@ void PluginGui::guiSliderPressed(int idx) if(!track || id == -1) return; - id = genACnum(id, param); + id = MusECore::genACnum(id, param); - double val = ((MusEWidget::Slider*)w)->value(); + double val = ((Slider*)w)->value(); plugin->setParam(param, val); - //audio->msgSetPluginCtrlVal(((PluginI*)plugin), id, val); + //MusEGlobal::audio->msgSetPluginCtrlVal(((PluginI*)plugin), id, val); // p3.3.43 - //audio->msgSetPluginCtrlVal(track, id, val); - // p4.0.21 audio->msgXXX waits. Do we really need to? + //MusEGlobal::audio->msgSetPluginCtrlVal(track, id, val); + // p4.0.21 MusEGlobal::audio->msgXXX waits. Do we really need to? track->setPluginCtrlVal(id, val); - song->controllerChange(track); + MusEGlobal::song->controllerChange(track); track->startAutoRecord(id, val); @@ -4540,10 +4550,10 @@ void PluginGui::guiSliderPressed(int idx) int type = gw[i].type; switch(type) { case GuiWidgets::SLIDER: - ((MusEWidget::Slider*)widget)->setValue(val); + ((Slider*)widget)->setValue(val); break; case GuiWidgets::DOUBLE_LABEL: - ((MusEWidget::DoubleLabel*)widget)->setValue(val); + ((DoubleLabel*)widget)->setValue(val); break; case GuiWidgets::QCHECKBOX: ((QCheckBox*)widget)->setChecked(int(val)); @@ -4565,11 +4575,11 @@ void PluginGui::guiSliderReleased(int idx) QWidget *w = gw[idx].widget; AutomationType at = AUTO_OFF; - AudioTrack* track = plugin->track(); + MusECore::AudioTrack* track = plugin->track(); if(track) at = track->automationType(); - if(at != AUTO_WRITE || (!audio->isPlaying() && at == AUTO_TOUCH)) + if(at != AUTO_WRITE || (!MusEGlobal::audio->isPlaying() && at == AUTO_TOUCH)) plugin->enableController(param, true); int id = plugin->id(); @@ -4577,9 +4587,9 @@ void PluginGui::guiSliderReleased(int idx) if(!track || id == -1) return; - id = genACnum(id, param); + id = MusECore::genACnum(id, param); - double val = ((MusEWidget::Slider*)w)->value(); + double val = ((Slider*)w)->value(); track->stopAutoRecord(id, val); } @@ -4592,8 +4602,8 @@ void PluginGui::guiSliderRightClicked(const QPoint &p, int idx) int param = gw[idx].param; int id = plugin->id(); if(id != -1) - //song->execAutomationCtlPopup((AudioTrack*)plugin->track(), p, genACnum(id, param)); - song->execAutomationCtlPopup(plugin->track(), p, genACnum(id, param)); + //MusEGlobal::song->execAutomationCtlPopup((MusECore::AudioTrack*)plugin->track(), p, MusECore::genACnum(id, param)); + MusEGlobal::song->execAutomationCtlPopup(plugin->track(), p, MusECore::genACnum(id, param)); } //--------------------------------------------------------- @@ -4602,9 +4612,11 @@ 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 MusEWidget::DoubleLabel(parent, name.toLatin1().constData()); + return new DoubleLabel(parent, name.toLatin1().constData()); if(className == QString("Slider")) - return new MusEWidget::Slider(parent, name.toLatin1().constData(), Qt::Horizontal); + return new Slider(parent, name.toLatin1().constData(), Qt::Horizontal); return QUiLoader::createWidget(className, parent, name); }; + +} // namespace MusEGui diff --git a/muse2/muse/plugin.h b/muse2/muse/plugin.h index 00144610..717f98b6 100644 --- a/muse2/muse/plugin.h +++ b/muse2/muse/plugin.h @@ -61,25 +61,16 @@ class QToolButton; class QToolButton; class QTreeWidget; -class Xml; - -namespace MusEWidget { -class DoubleLabel; +namespace MusEGui { +class PluginGui; } -class AudioTrack; -class MidiController; -//--------------------------------------------------------- -// PluginLoader -//--------------------------------------------------------- +namespace MusECore { +class AudioTrack; +class Xml; -class PluginLoader : public QUiLoader -{ - public: - virtual QWidget* createWidget(const QString & className, QWidget * parent = 0, const QString & name = QString()); - PluginLoader(QObject * parent = 0) : QUiLoader(parent) {} -}; +class MidiController; /* //--------------------------------------------------------- @@ -259,70 +250,6 @@ struct Port { }; //--------------------------------------------------------- -// GuiParam -//--------------------------------------------------------- - -struct GuiParam { - enum { - GUI_SLIDER, GUI_SWITCH, GUI_METER - }; - int type; - int hint; - - MusEWidget::DoubleLabel* label; - QWidget* actuator; // Slider or Toggle Button (SWITCH) - }; - -//--------------------------------------------------------- -// GuiWidgets -//--------------------------------------------------------- - -struct GuiWidgets { - enum { - SLIDER, DOUBLE_LABEL, QCHECKBOX, QCOMBOBOX - }; - QWidget* widget; - int type; - //int param; - unsigned long param; // p4.0.21 - }; - -class PluginI; -class PluginGui; - -/* -class PluginBase -{ - public: - bool on() const { return _on; } - void setOn(bool val) { _on = val; } - int pluginID() { return plugin()->id(); } - int id() { return _id; } - QString pluginLabel() const { return _plugin->label(); } - QString name() const { return _name; } - - AudioTrack* track() { return _track; } - - void enableController(int i, bool v = true) { controls[i].enCtrl = v; } - bool controllerEnabled(int i) const { return controls[i].enCtrl; } - bool controllerEnabled2(int i) const { return controls[i].en2Ctrl; } - void updateControllers(); - - void writeConfiguration(int level, Xml& xml); - bool readConfiguration(Xml& xml, bool readPreset=false); - - int parameters() const { return controlPorts; } - void setParam(int i, double val) { controls[i].tmpVal = val; } - double param(int i) const { return controls[i].val; } - const char* paramName(int i) { return _plugin->portName(controls[i].idx); } - LADSPA_PortRangeHint range(int i) - { - return _plugin->range(controls[i].idx); - } -}; -*/ - -//--------------------------------------------------------- // PluginIBase //--------------------------------------------------------- @@ -330,7 +257,7 @@ class PluginIBase { protected: ControlFifo _controlFifo; - PluginGui* _gui; + MusEGui::PluginGui* _gui; void makeGui(); @@ -382,60 +309,41 @@ class PluginIBase //virtual void showGui(bool) = 0; // p4.0.20 //virtual void showNativeGui(bool) = 0; // - PluginGui* gui() const { return _gui; } + MusEGui::PluginGui* gui() const { return _gui; } void deleteGui(); }; -//--------------------------------------------------------- -// PluginGui -//--------------------------------------------------------- - -class PluginGui : public QMainWindow { - Q_OBJECT - - //PluginI* plugin; // plugin instance - PluginIBase* plugin; // plugin instance - - GuiParam* params; - GuiParam* paramsOut; - //int nobj; - unsigned long nobj; // number of widgets in gw // p4.0.21 - GuiWidgets* gw; - - QAction* onOff; - QWidget* mw; // main widget - QScrollArea* view; - - void updateControls(); - void getPluginConvertedValues(LADSPA_PortRangeHint range, - double &lower, double &upper, double &dlower, double &dupper, double &dval); - private slots: - void load(); - void save(); - void bypassToggled(bool); - void sliderChanged(double, int); - void labelChanged(double, int); - void guiParamChanged(int); - void ctrlPressed(int); - void ctrlReleased(int); - void guiParamPressed(int); - void guiParamReleased(int); - void guiSliderPressed(int); - void guiSliderReleased(int); - void ctrlRightClicked(const QPoint &, int); - void guiSliderRightClicked(const QPoint &, int); - - protected slots: - void heartBeat(); - +/* +class PluginBase +{ public: - //PluginGui(PluginI*); - PluginGui(PluginIBase*); + bool on() const { return _on; } + void setOn(bool val) { _on = val; } + int pluginID() { return plugin()->id(); } + int id() { return _id; } + QString pluginLabel() const { return _plugin->label(); } + QString name() const { return _name; } - ~PluginGui(); - void setOn(bool); - void updateValues(); - }; + AudioTrack* track() { return _track; } + + void enableController(int i, bool v = true) { controls[i].enCtrl = v; } + bool controllerEnabled(int i) const { return controls[i].enCtrl; } + bool controllerEnabled2(int i) const { return controls[i].en2Ctrl; } + void updateControllers(); + + void writeConfiguration(int level, Xml& xml); + bool readConfiguration(Xml& xml, bool readPreset=false); + + int parameters() const { return controlPorts; } + void setParam(int i, double val) { controls[i].tmpVal = val; } + double param(int i) const { return controls[i].val; } + const char* paramName(int i) { return _plugin->portName(controls[i].idx); } + LADSPA_PortRangeHint range(int i) + { + return _plugin->range(controls[i].idx); + } +}; +*/ //--------------------------------------------------------- // PluginI @@ -627,6 +535,119 @@ class Pipeline : public std::vector<PluginI*> { typedef Pipeline::iterator iPluginI; typedef Pipeline::const_iterator ciPluginI; +extern void initPlugins(); + +//extern bool ladspaDefaultValue(const LADSPA_Descriptor* plugin, int port, float* val); +//extern void ladspaControlRange(const LADSPA_Descriptor* plugin, int i, float* min, float* max); +//extern bool ladspa2MidiControlValues(const LADSPA_Descriptor* plugin, int port, int ctlnum, int* min, int* max, int* def); +//extern float midi2LadspaValue(const LADSPA_Descriptor* plugin, int port, int ctlnum, int val); +// p4.0.21 +extern bool ladspaDefaultValue(const LADSPA_Descriptor* plugin, unsigned long port, float* val); +extern void ladspaControlRange(const LADSPA_Descriptor* plugin, unsigned long port, float* min, float* max); +extern bool ladspa2MidiControlValues(const LADSPA_Descriptor* plugin, unsigned long port, int ctlnum, int* min, int* max, int* def); +extern float midi2LadspaValue(const LADSPA_Descriptor* plugin, unsigned long port, int ctlnum, int val); +extern CtrlValueType ladspaCtrlValueType(const LADSPA_Descriptor* plugin, int port); +extern CtrlList::Mode ladspaCtrlMode(const LADSPA_Descriptor* plugin, int port); +//extern MidiController* ladspa2MidiController(const LADSPA_Descriptor* plugin, unsigned long port, int ctlnum); + +} // namespace MusECore + + +namespace MusEGui { +class DoubleLabel; +class PluginGui; + +//--------------------------------------------------------- +// PluginLoader +//--------------------------------------------------------- + +class PluginLoader : public QUiLoader +{ + public: + virtual QWidget* createWidget(const QString & className, QWidget * parent = 0, const QString & name = QString()); + PluginLoader(QObject * parent = 0) : QUiLoader(parent) {} +}; + +//--------------------------------------------------------- +// GuiParam +//--------------------------------------------------------- + +struct GuiParam { + enum { + GUI_SLIDER, GUI_SWITCH, GUI_METER + }; + int type; + int hint; + + MusEGui::DoubleLabel* label; + QWidget* actuator; // Slider or Toggle Button (SWITCH) + }; + +//--------------------------------------------------------- +// GuiWidgets +//--------------------------------------------------------- + +struct GuiWidgets { + enum { + SLIDER, DOUBLE_LABEL, QCHECKBOX, QCOMBOBOX + }; + QWidget* widget; + int type; + //int param; + unsigned long param; // p4.0.21 + }; + +//--------------------------------------------------------- +// PluginGui +//--------------------------------------------------------- + +class PluginGui : public QMainWindow { + Q_OBJECT + + //PluginI* plugin; // plugin instance + MusECore::PluginIBase* plugin; // plugin instance + + GuiParam* params; + GuiParam* paramsOut; + //int nobj; + unsigned long nobj; // number of widgets in gw // p4.0.21 + GuiWidgets* gw; + + QAction* onOff; + QWidget* mw; // main widget + QScrollArea* view; + + void updateControls(); + void getPluginConvertedValues(LADSPA_PortRangeHint range, + double &lower, double &upper, double &dlower, double &dupper, double &dval); + private slots: + void load(); + void save(); + void bypassToggled(bool); + void sliderChanged(double, int); + void labelChanged(double, int); + void guiParamChanged(int); + void ctrlPressed(int); + void ctrlReleased(int); + void guiParamPressed(int); + void guiParamReleased(int); + void guiSliderPressed(int); + void guiSliderReleased(int); + void ctrlRightClicked(const QPoint &, int); + void guiSliderRightClicked(const QPoint &, int); + + protected slots: + void heartBeat(); + + public: + //PluginGui(MusECore::PluginI*); + PluginGui(MusECore::PluginIBase*); + + ~PluginGui(); + void setOn(bool); + void updateValues(); + }; + //--------------------------------------------------------- // PluginDialog //--------------------------------------------------------- @@ -645,8 +666,8 @@ class PluginDialog : public QDialog { public: PluginDialog(QWidget* parent=0); - static Plugin* getPlugin(QWidget* parent); - Plugin* value(); + static MusECore::Plugin* getPlugin(QWidget* parent); + MusECore::Plugin* value(); void accept(); public slots: @@ -663,21 +684,11 @@ class PluginDialog : public QDialog { static QStringList sortItems; }; -extern void initPlugins(); -extern PluginList plugins; +} -//extern bool ladspaDefaultValue(const LADSPA_Descriptor* plugin, int port, float* val); -//extern void ladspaControlRange(const LADSPA_Descriptor* plugin, int i, float* min, float* max); -//extern bool ladspa2MidiControlValues(const LADSPA_Descriptor* plugin, int port, int ctlnum, int* min, int* max, int* def); -//extern float midi2LadspaValue(const LADSPA_Descriptor* plugin, int port, int ctlnum, int val); -// p4.0.21 -extern bool ladspaDefaultValue(const LADSPA_Descriptor* plugin, unsigned long port, float* val); -extern void ladspaControlRange(const LADSPA_Descriptor* plugin, unsigned long port, float* min, float* max); -extern bool ladspa2MidiControlValues(const LADSPA_Descriptor* plugin, unsigned long port, int ctlnum, int* min, int* max, int* def); -extern float midi2LadspaValue(const LADSPA_Descriptor* plugin, unsigned long port, int ctlnum, int val); -extern CtrlValueType ladspaCtrlValueType(const LADSPA_Descriptor* plugin, int port); -extern CtrlList::Mode ladspaCtrlMode(const LADSPA_Descriptor* plugin, int port); -//extern MidiController* ladspa2MidiController(const LADSPA_Descriptor* plugin, unsigned long port, int ctlnum); +namespace MusEGlobal { +extern MusECore::PluginList plugins; +} #endif diff --git a/muse2/muse/pos.cpp b/muse2/muse/pos.cpp index d731a5b1..70de99e1 100644 --- a/muse2/muse/pos.cpp +++ b/muse2/muse/pos.cpp @@ -30,7 +30,12 @@ ///#include "sig.h" #include "al/sig.h" +namespace MusEGlobal { extern int mtcType; +} + +namespace MusECore { + //--------------------------------------------------------- // Pos @@ -86,7 +91,7 @@ Pos::Pos(int min, int sec, int frame, int subframe) double time = min * 60.0 + sec; double f = frame + subframe/100.0; - switch(mtcType) { + switch(MusEGlobal::mtcType) { case 0: // 24 frames sec time += f * 1.0/24.0; break; @@ -116,11 +121,11 @@ void Pos::setType(TType t) if (_type == TICKS) { // convert from ticks to frames - _frame = tempomap.tick2frame(_tick, _frame, &sn); + _frame = MusEGlobal::tempomap.tick2frame(_tick, _frame, &sn); } else { // convert from frames to ticks - _tick = tempomap.frame2tick(_frame, _tick, &sn); + _tick = MusEGlobal::tempomap.frame2tick(_frame, _tick, &sn); } _type = t; } @@ -221,7 +226,7 @@ bool Pos::operator==(const Pos& s) const unsigned Pos::tick() const { if (_type == FRAMES) - _tick = tempomap.frame2tick(_frame, _tick, &sn); + _tick = MusEGlobal::tempomap.frame2tick(_frame, _tick, &sn); return _tick; } @@ -232,7 +237,7 @@ unsigned Pos::tick() const unsigned Pos::frame() const { if (_type == TICKS) - _frame = tempomap.tick2frame(_tick, _frame, &sn); + _frame = MusEGlobal::tempomap.tick2frame(_tick, _frame, &sn); return _frame; } @@ -245,7 +250,7 @@ void Pos::setTick(unsigned pos) _tick = pos; sn = -1; if (_type == FRAMES) - _frame = tempomap.tick2frame(pos, &sn); + _frame = MusEGlobal::tempomap.tick2frame(pos, &sn); } //--------------------------------------------------------- @@ -257,7 +262,7 @@ void Pos::setFrame(unsigned pos) _frame = pos; sn = -1; if (_type == TICKS) - _tick = tempomap.frame2tick(pos, &sn); + _tick = MusEGlobal::tempomap.frame2tick(pos, &sn); } //--------------------------------------------------------- @@ -454,7 +459,7 @@ void PosLen::setLenTick(unsigned len) _lenTick = len; sn = -1; // if (type() == FRAMES) - _lenFrame = tempomap.deltaTick2frame(tick(), tick() + len, &sn); + _lenFrame = MusEGlobal::tempomap.deltaTick2frame(tick(), tick() + len, &sn); } //--------------------------------------------------------- @@ -466,7 +471,7 @@ void PosLen::setLenFrame(unsigned len) _lenFrame = len; sn = -1; // if (type() == TICKS) - _lenTick = tempomap.deltaFrame2tick(frame(), frame() + len, &sn); + _lenTick = MusEGlobal::tempomap.deltaFrame2tick(frame(), frame() + len, &sn); } //--------------------------------------------------------- @@ -476,7 +481,7 @@ void PosLen::setLenFrame(unsigned len) unsigned PosLen::lenTick() const { if (type() == FRAMES) - _lenTick = tempomap.deltaFrame2tick(frame(), frame() + _lenFrame, &sn); + _lenTick = MusEGlobal::tempomap.deltaFrame2tick(frame(), frame() + _lenFrame, &sn); return _lenTick; } @@ -487,7 +492,7 @@ unsigned PosLen::lenTick() const unsigned PosLen::lenFrame() const { if (type() == TICKS) - _lenFrame = tempomap.deltaTick2frame(tick(), tick() + _lenTick, &sn); + _lenFrame = MusEGlobal::tempomap.deltaTick2frame(tick(), tick() + _lenTick, &sn); return _lenFrame; } @@ -545,7 +550,7 @@ void Pos::msf(int* min, int* sec, int* fr, int* subFrame) const *min = int(time) / 60; *sec = int(time) % 60; double rest = time - (*min * 60 + *sec); - switch(mtcType) { + switch(MusEGlobal::mtcType) { case 0: // 24 frames sec rest *= 24; break; @@ -581,3 +586,4 @@ bool Pos::isValid(int,int,int,int) return true; } +} // namespace MusECore diff --git a/muse2/muse/pos.h b/muse2/muse/pos.h index a6f8513d..78013dee 100644 --- a/muse2/muse/pos.h +++ b/muse2/muse/pos.h @@ -24,9 +24,12 @@ #ifndef __POS_H__ #define __POS_H__ -class Xml; class QString; +namespace MusECore { + +class Xml; + //--------------------------------------------------------- // Pos // depending on type _tick or _frame is a cached @@ -111,4 +114,6 @@ class PosLen : public Pos { void setPos(const Pos&); }; +} // namespace MusECore + #endif 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 ff88ca23..57b956ca 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; @@ -708,11 +710,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); @@ -735,7 +737,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; } @@ -749,7 +751,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; @@ -761,8 +763,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); } @@ -781,7 +783,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; @@ -791,7 +793,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; } @@ -806,16 +808,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); } //------------------------------------------------------------ @@ -824,7 +826,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; } @@ -834,7 +836,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; } @@ -844,7 +846,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; } @@ -854,7 +856,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; } //------------------------------------------------------------ @@ -863,7 +865,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; } //------------------------------------------------------------ @@ -878,7 +880,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; } //------------------------------------------------------------ @@ -892,7 +894,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); @@ -901,7 +903,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) @@ -1012,7 +1014,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! @@ -1079,10 +1081,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: { @@ -1105,7 +1107,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: { @@ -1129,7 +1131,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()); @@ -1143,7 +1145,7 @@ bool Song::event(QEvent* _e) if (t == NULL) return false; - audio->msgRemoveTrack(t); + MusEGlobal::audio->msgRemoveTrack(t); break; } default: @@ -1155,4 +1157,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 <QEvent> +namespace MusECore { + class QPybridgeEvent : public QEvent { public: @@ -51,5 +53,7 @@ private: bool initPythonBridge(); +} // namespace MusECore + #endif diff --git a/muse2/muse/route.cpp b/muse2/muse/route.cpp index fbf42436..f00c6d6c 100644 --- a/muse2/muse/route.cpp +++ b/muse2/muse/route.cpp @@ -38,6 +38,9 @@ //#define ROUTE_DEBUG //#define ROUTE_MIDIPORT_NAME_PREFIX "MusE MidiPort " + +namespace MusECore { + const QString ROUTE_MIDIPORT_NAME_PREFIX = "MusE MidiPort "; //--------------------------------------------------------- @@ -222,7 +225,7 @@ void addRoute(Route src, Route dst) if (dst.type == Route::MIDI_DEVICE_ROUTE) //if (dst.type == Route::MIDI_PORT_ROUTE) // p3.3.49 { - //MidiDevice *md = midiPorts[dst.midiPort].device(); + //MidiDevice *md = MusEGlobal::midiPorts[dst.midiPort].device(); //if(dst.device->deviceType() == MidiDevice::JACK_MIDI) //if(!md) //{ @@ -374,7 +377,7 @@ void addRoute(Route src, Route dst) return; } - MidiPort *mp = &midiPorts[src.midiPort]; + MidiPort *mp = &MusEGlobal::midiPorts[src.midiPort]; //src.channel = dst.channel = -1; RouteList* outRoutes = mp->outRoutes(); iRoute ir = outRoutes->begin(); @@ -416,7 +419,7 @@ void addRoute(Route src, Route dst) } */ - MidiPort *mp = &midiPorts[src.midiPort]; + MidiPort *mp = &MusEGlobal::midiPorts[src.midiPort]; // p4.0.17 Do not allow ports with synth midi devices to connect to audio ins! if(dst.track->type() == Track::AUDIO_INPUT && mp->device() && mp->device()->isSynti()) @@ -431,7 +434,7 @@ void addRoute(Route src, Route dst) return; } - //MidiDevice *md = midiPorts[src.midiPort].device(); + //MidiDevice *md = MusEGlobal::midiPorts[src.midiPort].device(); //if(!md) //{ // fprintf(stderr, "addRoute: source is midi port, but no destination port device\n"); @@ -493,7 +496,7 @@ void addRoute(Route src, Route dst) } - //MidiDevice *md = midiPorts[dst.midiPort].device(); + //MidiDevice *md = MusEGlobal::midiPorts[dst.midiPort].device(); //if(!md) //{ // fprintf(stderr, "addRoute: dst is midi port, but no destination port device\n"); @@ -523,7 +526,7 @@ void addRoute(Route src, Route dst) if(ir == outRoutes->end()) // p3.3.50 Only if route not found, add the route, with the requested channel bits as mask to start with. outRoutes->push_back(dst); - MidiPort *mp = &midiPorts[dst.midiPort]; + MidiPort *mp = &MusEGlobal::midiPorts[dst.midiPort]; #ifdef ROUTE_DEBUG fprintf(stderr, "addRoute: src track:%s dst midi port:%d pushing dst and src routes\n", src.track->name().toLatin1().constData(), dst.midiPort); @@ -822,7 +825,7 @@ void removeRoute(Route src, Route dst) if(src.isValid()) { - MidiPort *mp = &midiPorts[src.midiPort]; + MidiPort *mp = &MusEGlobal::midiPorts[src.midiPort]; RouteList* outRoutes = mp->outRoutes(); for (iRoute i = outRoutes->begin(); i != outRoutes->end(); ++i) { @@ -895,7 +898,7 @@ void removeRoute(Route src, Route dst) if(dst.isValid()) { - MidiPort *mp = &midiPorts[src.midiPort]; + MidiPort *mp = &MusEGlobal::midiPorts[src.midiPort]; RouteList* inRoutes = mp->inRoutes(); for (iRoute i = inRoutes->begin(); i != inRoutes->end(); ++i) { @@ -1068,7 +1071,7 @@ QString Route::name() const // Like this: device: "MyJackDevice1" -> inport: "MyJackDevice1_in" outport: "MyJackDevice1_out" /* if(device->deviceType() == MidiDevice::JACK_MIDI) - return audioDevice->portName(device->clientPort()); + return MusEGlobal::audioDevice->portName(device->clientPort()); else */ @@ -1081,8 +1084,8 @@ QString Route::name() const if(type == JACK_ROUTE) { if (!MusEGlobal::checkAudioDevice()) return ""; - //return s + audioDevice->portName(jackPort); - return audioDevice->portName(jackPort); + //return s + MusEGlobal::audioDevice->portName(jackPort); + return MusEGlobal::audioDevice->portName(jackPort); } else if(type == MIDI_PORT_ROUTE) // p3.3.49 @@ -1118,12 +1121,12 @@ Route name2route(const QString& rn, bool /*dst*/, int rtype) //{ if(MusEGlobal::checkAudioDevice()) { - void* p = audioDevice->findPort(s.toLatin1().constData()); + void* p = MusEGlobal::audioDevice->findPort(s.toLatin1().constData()); if(p) return Route(p, channel); } - TrackList* tl = song->tracks(); + TrackList* tl = MusEGlobal::song->tracks(); for(iTrack i = tl->begin(); i != tl->end(); ++i) { if((*i)->isMidiTrack()) @@ -1140,7 +1143,7 @@ Route name2route(const QString& rn, bool /*dst*/, int rtype) } } - for(iMidiDevice i = midiDevices.begin(); i != midiDevices.end(); ++i) + for(iMidiDevice i = MusEGlobal::midiDevices.begin(); i != MusEGlobal::midiDevices.end(); ++i) { if((*i)->name() == s) return Route(*i, channel); @@ -1161,7 +1164,7 @@ Route name2route(const QString& rn, bool /*dst*/, int rtype) //{ if(rtype == Route::TRACK_ROUTE) { - TrackList* tl = song->tracks(); + TrackList* tl = MusEGlobal::song->tracks(); for(iTrack i = tl->begin(); i != tl->end(); ++i) { if((*i)->isMidiTrack()) @@ -1185,7 +1188,7 @@ Route name2route(const QString& rn, bool /*dst*/, int rtype) // TODO Distinguish the device types if(rtype == Route::MIDI_DEVICE_ROUTE) { - for(iMidiDevice i = midiDevices.begin(); i != midiDevices.end(); ++i) + for(iMidiDevice i = MusEGlobal::midiDevices.begin(); i != MusEGlobal::midiDevices.end(); ++i) { if((*i)->name() == s) //if (jmd->name() == rn) @@ -1215,7 +1218,7 @@ Route name2route(const QString& rn, bool /*dst*/, int rtype) { if(MusEGlobal::checkAudioDevice()) { - void* p = audioDevice->findPort(s.toLatin1().constData()); + void* p = MusEGlobal::audioDevice->findPort(s.toLatin1().constData()); if(p) return Route(p, channel); } @@ -1328,7 +1331,7 @@ bool checkRoute(const QString& s, const QString& d) } else if (src.type == Route::MIDI_PORT_ROUTE) // p3.3.49 { - RouteList* outRoutes = midiPorts[src.midiPort].outRoutes(); + RouteList* outRoutes = MusEGlobal::midiPorts[src.midiPort].outRoutes(); for (ciRoute i = outRoutes->begin(); i != outRoutes->end(); ++i) { if (*i == dst) { // route already there @@ -1421,7 +1424,7 @@ void Route::read(Xml& xml) { if(rtype == TRACK_ROUTE) { - TrackList* tl = song->tracks(); + TrackList* tl = MusEGlobal::song->tracks(); iTrack i = tl->begin(); for ( ; i != tl->end(); ++i) { @@ -1440,8 +1443,8 @@ void Route::read(Xml& xml) if(rtype == JACK_ROUTE) { void* jport = 0; - if (audioDevice) // fix crash if jack is zombified at this point - jport=audioDevice->findPort(s.toLatin1().constData()); + if (MusEGlobal::audioDevice) // fix crash if jack is zombified at this point + jport=MusEGlobal::audioDevice->findPort(s.toLatin1().constData()); if(jport == 0) printf("Route::read(): jack port <%s> not found\n", s.toLatin1().constData()); else @@ -1453,8 +1456,8 @@ void Route::read(Xml& xml) else if(rtype == MIDI_DEVICE_ROUTE) { - iMidiDevice imd = midiDevices.begin(); - for( ; imd != midiDevices.end(); ++imd) + iMidiDevice imd = MusEGlobal::midiDevices.begin(); + for( ; imd != MusEGlobal::midiDevices.end(); ++imd) { MidiDevice* md = *imd; if(md->name() == s && md->deviceType() == dtype) @@ -1470,7 +1473,7 @@ void Route::read(Xml& xml) break; } } - if(imd == midiDevices.end()) + if(imd == MusEGlobal::midiDevices.end()) printf("Route::read(): midi device <%s> not found\n", s.toLatin1().constData()); } } @@ -1653,7 +1656,7 @@ void Route::dump() const if (type == JACK_ROUTE) { if(MusEGlobal::checkAudioDevice()) - printf("Route dump: jack audio port <%s> channel %d\n", audioDevice->portName(jackPort).toLatin1().constData(), channel); + printf("Route dump: jack audio port <%s> channel %d\n", MusEGlobal::audioDevice->portName(jackPort).toLatin1().constData(), channel); } else if (type == MIDI_PORT_ROUTE) // p3.3.49 @@ -1669,16 +1672,16 @@ void Route::dump() const if(device->deviceType() == MidiDevice::JACK_MIDI) { if(MusEGlobal::checkAudioDevice()) - //printf("jack midi port device <%s> ", audioDevice->portName(device->clientPort()).toLatin1().constData()); + //printf("jack midi port device <%s> ", MusEGlobal::audioDevice->portName(device->clientPort()).toLatin1().constData()); // p3.3.55 { printf("jack midi device <%s> ", device->name().toLatin1().constData()); if(device->inClientPort()) printf("input port <%s> ", - audioDevice->portName(device->inClientPort()).toLatin1().constData()); + MusEGlobal::audioDevice->portName(device->inClientPort()).toLatin1().constData()); if(device->outClientPort()) printf("output port <%s> ", - audioDevice->portName(device->outClientPort()).toLatin1().constData()); + MusEGlobal::audioDevice->portName(device->outClientPort()).toLatin1().constData()); } } else @@ -1726,7 +1729,7 @@ bool Route::operator==(const Route& a) const if (type == JACK_ROUTE) { //if (!MusEGlobal::checkAudioDevice()) return false; - //return audioDevice->portName(jackPort) == audioDevice->portName(a.jackPort); + //return MusEGlobal::audioDevice->portName(jackPort) == MusEGlobal::audioDevice->portName(a.jackPort); // p3.3.55 Simplified. return jackPort == a.jackPort; } @@ -1746,7 +1749,7 @@ bool Route::operator==(const Route& a) const if(device->deviceType() == MidiDevice::JACK_MIDI) { if (!MusEGlobal::checkAudioDevice()) return false; - return audioDevice->portName(device->clientPort()) == audioDevice->portName(a.device->clientPort()); + return MusEGlobal::audioDevice->portName(device->clientPort()) == MusEGlobal::audioDevice->portName(a.device->clientPort()); } else if(device->deviceType() == MidiDevice::ALSA_MIDI) @@ -1764,3 +1767,4 @@ bool Route::operator==(const Route& a) const return false; } +} // namespace MusECore diff --git a/muse2/muse/route.h b/muse2/muse/route.h index b93e5a0b..36b00d47 100644 --- a/muse2/muse/route.h +++ b/muse2/muse/route.h @@ -31,6 +31,9 @@ #include "globaldefs.h" class QString; + +namespace MusECore { + class Track; class MidiDevice; class Xml; @@ -87,9 +90,6 @@ struct Route { void dump() const; }; -// Allow Routes to be a QVariant -Q_DECLARE_METATYPE(Route) ; - //--------------------------------------------------------- // RouteList //--------------------------------------------------------- @@ -117,5 +117,10 @@ extern bool checkRoute(const QString&, const QString&); //typedef std::pair<int, Route> pRouteMenuMap; //typedef std::pair<iRouteMenuMap, bool > rpRouteMenuMap; +} // namespace MusECore + +// Allow Routes to be a QVariant +Q_DECLARE_METATYPE(MusECore::Route) ; + #endif diff --git a/muse2/muse/seqmsg.cpp b/muse2/muse/seqmsg.cpp index 3ef2464b..39dcc53c 100644 --- a/muse2/muse/seqmsg.cpp +++ b/muse2/muse/seqmsg.cpp @@ -40,6 +40,8 @@ #include "plugin.h" #include "driver/jackmidi.h" +namespace MusECore { + //--------------------------------------------------------- // sendMsg //--------------------------------------------------------- @@ -78,10 +80,10 @@ void Audio::sendMsg(AudioMsg* m) bool Audio::sendMessage(AudioMsg* m, bool doUndo) { if (doUndo) - song->startUndo(); + MusEGlobal::song->startUndo(); sendMsg(m); if (doUndo) - song->endUndo(0); // song->endMsgCmd(); + MusEGlobal::song->endUndo(0); // MusEGlobal::song->endMsgCmd(); return false; } @@ -105,8 +107,8 @@ void Audio::msgRemoveRoute(Route src, Route dst) if(dst.device) { if(dst.device->deviceType() == MidiDevice::JACK_MIDI) - //audioDevice->disconnect(src.jackPort, dst.device->clientPort()); - audioDevice->disconnect(src.jackPort, dst.device->inClientPort()); // p3.3.55 + //MusEGlobal::audioDevice->disconnect(src.jackPort, dst.device->clientPort()); + MusEGlobal::audioDevice->disconnect(src.jackPort, dst.device->inClientPort()); // p3.3.55 //else //{ // TODO... @@ -116,7 +118,7 @@ void Audio::msgRemoveRoute(Route src, Route dst) } } else - audioDevice->disconnect(src.jackPort, ((AudioInput*)dst.track)->jackPort(dst.channel)); + MusEGlobal::audioDevice->disconnect(src.jackPort, ((AudioInput*)dst.track)->jackPort(dst.channel)); } else if (dst.type == Route::JACK_ROUTE) { @@ -130,8 +132,8 @@ void Audio::msgRemoveRoute(Route src, Route dst) if(src.device) { if(src.device->deviceType() == MidiDevice::JACK_MIDI) - //audioDevice->disconnect(src.device->clientPort(), dst.jackPort); - audioDevice->disconnect(src.device->outClientPort(), dst.jackPort); // p3.3.55 + //MusEGlobal::audioDevice->disconnect(src.device->clientPort(), dst.jackPort); + MusEGlobal::audioDevice->disconnect(src.device->outClientPort(), dst.jackPort); // p3.3.55 //else //{ // TODO... @@ -141,7 +143,7 @@ void Audio::msgRemoveRoute(Route src, Route dst) } } else - audioDevice->disconnect(((AudioOutput*)src.track)->jackPort(src.channel), dst.jackPort); + MusEGlobal::audioDevice->disconnect(((AudioOutput*)src.track)->jackPort(src.channel), dst.jackPort); } } @@ -182,8 +184,8 @@ void Audio::msgRemoveRoutes(Route src, Route dst) if(dst.device) { if(dst.device->deviceType() == MidiDevice::JACK_MIDI) - //audioDevice->disconnect(src.jackPort, dst.device->clientPort()); - audioDevice->disconnect(src.jackPort, dst.device->inClientPort()); + //MusEGlobal::audioDevice->disconnect(src.jackPort, dst.device->clientPort()); + MusEGlobal::audioDevice->disconnect(src.jackPort, dst.device->inClientPort()); //else //{ // TODO... @@ -193,7 +195,7 @@ void Audio::msgRemoveRoutes(Route src, Route dst) } } else - audioDevice->disconnect(src.jackPort, ((AudioInput*)dst.track)->jackPort(dst.channel)); + MusEGlobal::audioDevice->disconnect(src.jackPort, ((AudioInput*)dst.track)->jackPort(dst.channel)); } else if (dst.type == Route::JACK_ROUTE) { @@ -207,8 +209,8 @@ void Audio::msgRemoveRoutes(Route src, Route dst) if(src.device) { if(src.device->deviceType() == MidiDevice::JACK_MIDI) - //audioDevice->disconnect(src.device->clientPort(), dst.jackPort); - audioDevice->disconnect(src.device->outClientPort(), dst.jackPort); + //MusEGlobal::audioDevice->disconnect(src.device->clientPort(), dst.jackPort); + MusEGlobal::audioDevice->disconnect(src.device->outClientPort(), dst.jackPort); //else //{ // TODO... @@ -218,7 +220,7 @@ void Audio::msgRemoveRoutes(Route src, Route dst) } } else - audioDevice->disconnect(((AudioOutput*)src.track)->jackPort(src.channel), dst.jackPort); + MusEGlobal::audioDevice->disconnect(((AudioOutput*)src.track)->jackPort(src.channel), dst.jackPort); } */ @@ -257,8 +259,8 @@ void Audio::msgAddRoute(Route src, Route dst) if(dst.device) { if(dst.device->deviceType() == MidiDevice::JACK_MIDI) - //audioDevice->connect(src.jackPort, dst.device->clientPort()); - audioDevice->connect(src.jackPort, dst.device->inClientPort()); // p3.3.55 + //MusEGlobal::audioDevice->connect(src.jackPort, dst.device->clientPort()); + MusEGlobal::audioDevice->connect(src.jackPort, dst.device->inClientPort()); // p3.3.55 //else //{ // TODO... @@ -268,13 +270,13 @@ void Audio::msgAddRoute(Route src, Route dst) } } else - audioDevice->connect(src.jackPort, ((AudioInput*)dst.track)->jackPort(dst.channel)); + MusEGlobal::audioDevice->connect(src.jackPort, ((AudioInput*)dst.track)->jackPort(dst.channel)); } } else if (dst.type == Route::JACK_ROUTE) { if (!MusEGlobal::checkAudioDevice()) return; - if (audio->isRunning()) + if (MusEGlobal::audio->isRunning()) { //if(src.type == Route::JACK_MIDI_ROUTE) if(src.type == Route::MIDI_DEVICE_ROUTE) @@ -284,8 +286,8 @@ void Audio::msgAddRoute(Route src, Route dst) if(src.device) { if(src.device->deviceType() == MidiDevice::JACK_MIDI) - //audioDevice->connect(src.device->clientPort(), dst.jackPort); - audioDevice->connect(src.device->outClientPort(), dst.jackPort); // p3.3.55 + //MusEGlobal::audioDevice->connect(src.device->clientPort(), dst.jackPort); + MusEGlobal::audioDevice->connect(src.device->outClientPort(), dst.jackPort); // p3.3.55 //else //{ // TODO... @@ -295,7 +297,7 @@ void Audio::msgAddRoute(Route src, Route dst) } } else - audioDevice->connect(((AudioOutput*)src.track)->jackPort(dst.channel), dst.jackPort); + MusEGlobal::audioDevice->connect(((AudioOutput*)src.track)->jackPort(dst.channel), dst.jackPort); } } msgAddRoute1(src, dst); @@ -354,7 +356,7 @@ void Audio::msgSetVolume(AudioTrack* src, double val) msg.dval = val; sendMsg(&msg); //muse->arranger->controllerChanged(src); - song->controllerChange(src); + MusEGlobal::song->controllerChange(src); } //--------------------------------------------------------- @@ -369,7 +371,7 @@ void Audio::msgSetPan(AudioTrack* node, double val) msg.dval = val; sendMsg(&msg); //muse->arranger->controllerChanged(node); - song->controllerChange(node); + MusEGlobal::song->controllerChange(node); } */ @@ -409,8 +411,8 @@ void Audio::msgSetChannels(AudioTrack* node, int n) { char buffer[128]; snprintf(buffer, 128, "%s-%d", name.toLatin1().constData(), i); - //ai->setJackPort(i, audioDevice->registerInPort(buffer)); - ai->setJackPort(i, audioDevice->registerInPort(buffer, false)); + //ai->setJackPort(i, MusEGlobal::audioDevice->registerInPort(buffer)); + ai->setJackPort(i, MusEGlobal::audioDevice->registerInPort(buffer, false)); } else if ((i >= n) && ai->jackPort(i)) { @@ -424,7 +426,7 @@ void Audio::msgSetChannels(AudioTrack* node, int n) break; } } - audioDevice->unregisterPort(ai->jackPort(i)); + MusEGlobal::audioDevice->unregisterPort(ai->jackPort(i)); ai->setJackPort(i, 0); } } @@ -440,8 +442,8 @@ void Audio::msgSetChannels(AudioTrack* node, int n) { char buffer[128]; snprintf(buffer, 128, "%s-%d", name.toLatin1().constData(), i); - //ao->setJackPort(i, audioDevice->registerOutPort(buffer)); - ao->setJackPort(i, audioDevice->registerOutPort(buffer, false)); + //ao->setJackPort(i, MusEGlobal::audioDevice->registerOutPort(buffer)); + ao->setJackPort(i, MusEGlobal::audioDevice->registerOutPort(buffer, false)); } else if (i >= n && jp) { @@ -455,7 +457,7 @@ void Audio::msgSetChannels(AudioTrack* node, int n) break; } } - audioDevice->unregisterPort(jp); + MusEGlobal::audioDevice->unregisterPort(jp); ao->setJackPort(i, 0); } } @@ -533,7 +535,7 @@ void Audio::msgSetPluginCtrlVal(AudioTrack* track, int param, double val) msg.snode = track; sendMsg(&msg); //muse->arranger->controllerChanged(track); - song->controllerChange(track); + MusEGlobal::song->controllerChange(track); } */ @@ -551,7 +553,7 @@ void Audio::msgSwapControllerIDX(AudioTrack* node, int idx1, int idx2) msg.b = idx2; sendMsg(&msg); //muse->arranger->controllerChanged(node); - song->controllerChange(node); + MusEGlobal::song->controllerChange(node); } //--------------------------------------------------------- @@ -567,7 +569,7 @@ void Audio::msgClearControllerEvents(AudioTrack* node, int acid) msg.ival = acid; sendMsg(&msg); //muse->arranger->controllerChanged(node); - song->controllerChange(node); + MusEGlobal::song->controllerChange(node); } //--------------------------------------------------------- @@ -612,7 +614,7 @@ void Audio::msgEraseACEvent(AudioTrack* node, int acid, int frame) msg.a = frame; sendMsg(&msg); //muse->arranger->controllerChanged(node); - song->controllerChange(node); + MusEGlobal::song->controllerChange(node); } //--------------------------------------------------------- @@ -630,7 +632,7 @@ void Audio::msgEraseRangeACEvents(AudioTrack* node, int acid, int frame1, int fr msg.b = frame2; sendMsg(&msg); //muse->arranger->controllerChanged(node); - song->controllerChange(node); + MusEGlobal::song->controllerChange(node); } //--------------------------------------------------------- @@ -648,7 +650,7 @@ void Audio::msgAddACEvent(AudioTrack* node, int acid, int frame, double val) msg.dval = val; sendMsg(&msg); //muse->arranger->controllerChanged(node); - song->controllerChange(node); + MusEGlobal::song->controllerChange(node); } //--------------------------------------------------------- @@ -667,7 +669,7 @@ void Audio::msgChangeACEvent(AudioTrack* node, int acid, int frame, int newFrame msg.dval = val; sendMsg(&msg); //muse->arranger->controllerChanged(node); - song->controllerChange(node); + MusEGlobal::song->controllerChange(node); } //--------------------------------------------------------- @@ -703,12 +705,12 @@ void Audio::msgSetSegSize(int bs, int sr) void Audio::msgSeek(const Pos& pos) { if (!MusEGlobal::checkAudioDevice()) return; - //audioDevice->seekTransport(pos.frame()); + //MusEGlobal::audioDevice->seekTransport(pos.frame()); // p3.3.23 - //printf("Audio::msgSeek before audioDevice->seekTransport frame:%d\n", pos.frame()); - audioDevice->seekTransport(pos); + //printf("Audio::msgSeek before MusEGlobal::audioDevice->seekTransport frame:%d\n", pos.frame()); + MusEGlobal::audioDevice->seekTransport(pos); // p3.3.23 - //printf("Audio::msgSeek after audioDevice->seekTransport frame:%d\n", pos.frame()); + //printf("Audio::msgSeek after MusEGlobal::audioDevice->seekTransport frame:%d\n", pos.frame()); } //--------------------------------------------------------- @@ -740,19 +742,19 @@ void Audio::msgRedo() void Audio::msgPlay(bool val) { if (val) { - if (audioDevice) + if (MusEGlobal::audioDevice) { - unsigned sfr = song->cPos().frame(); - unsigned dcfr = audioDevice->getCurFrame(); + unsigned sfr = MusEGlobal::song->cPos().frame(); + unsigned dcfr = MusEGlobal::audioDevice->getCurFrame(); if(dcfr != sfr) - //audioDevice->seekTransport(sfr); - audioDevice->seekTransport(song->cPos()); - audioDevice->startTransport(); + //MusEGlobal::audioDevice->seekTransport(sfr); + MusEGlobal::audioDevice->seekTransport(MusEGlobal::song->cPos()); + MusEGlobal::audioDevice->startTransport(); } }else { - if (audioDevice) - audioDevice->stopTransport(); + if (MusEGlobal::audioDevice) + MusEGlobal::audioDevice->stopTransport(); _bounce = false; } } @@ -800,10 +802,10 @@ void Song::msgInsertTrack(Track* track, int idx, bool doUndoFlag) msg.track = track; msg.ival = idx; if (doUndoFlag) { - song->startUndo(); + MusEGlobal::song->startUndo(); addUndo(UndoOp(UndoOp::AddTrack, idx, track)); } - audio->sendMsg(&msg); + MusEGlobal::audio->sendMsg(&msg); if (doUndoFlag) endUndo(SC_TRACK_INSERTED); } @@ -831,15 +833,15 @@ void Audio::msgRemoveTracks() do { loop = false; - TrackList* tl = song->tracks(); + TrackList* tl = MusEGlobal::song->tracks(); for (iTrack t = tl->begin(); t != tl->end(); ++t) { Track* tr = *t; if (tr->selected()) { - song->removeTrack1(tr); + MusEGlobal::song->removeTrack1(tr); msgRemoveTrack(tr, false); - song->removeTrack3(tr); + MusEGlobal::song->removeTrack3(tr); loop = true; break; } @@ -854,7 +856,7 @@ void Audio::msgRemoveTracks() // that is being erased." // Well that doesn't seem true here... - TrackList* tl = song->tracks(); + TrackList* tl = MusEGlobal::song->tracks(); for(ciTrack t = tl->begin(); t != tl->end() ; ) { if((*t)->selected()) @@ -864,9 +866,9 @@ void Audio::msgRemoveTracks() ++t; Track* tr = *tt; - song->removeTrack1(tr); + MusEGlobal::song->removeTrack1(tr); msgRemoveTrack(tr, false); - song->removeTrack3(tr); + MusEGlobal::song->removeTrack3(tr); } else @@ -901,7 +903,7 @@ void Audio::msgMoveTrack(int idx1, int idx2, bool doUndoFlag) { if (idx1 < 0 || idx2 < 0) // sanity check return; - int n = song->tracks()->size(); + int n = MusEGlobal::song->tracks()->size(); if (idx1 >= n || idx2 >= n) // sanity check return; AudioMsg msg; @@ -946,7 +948,7 @@ bool Song::msgRemoveParts() Undo operations; bool partSelected = false; - TrackList* tl = song->tracks(); + TrackList* tl = MusEGlobal::song->tracks(); for (iTrack it = tl->begin(); it != tl->end(); ++it) { PartList* pl = (*it)->parts(); @@ -958,7 +960,7 @@ bool Song::msgRemoveParts() } } - song->applyOperationGroup(operations); + MusEGlobal::song->applyOperationGroup(operations); return partSelected; } @@ -1334,8 +1336,8 @@ void Audio::msgBounce() { _bounce = true; if (!MusEGlobal::checkAudioDevice()) return; - //audioDevice->seekTransport(song->lPos().frame()); - audioDevice->seekTransport(song->lPos()); + //MusEGlobal::audioDevice->seekTransport(MusEGlobal::song->lPos().frame()); + MusEGlobal::audioDevice->seekTransport(MusEGlobal::song->lPos()); } //--------------------------------------------------------- @@ -1350,3 +1352,4 @@ void Audio::msgIdle(bool on) sendMessage(&msg, false); } +} // namespace MusECore diff --git a/muse2/muse/shortcuts.cpp b/muse2/muse/shortcuts.cpp index a8cd8062..7563fd93 100644 --- a/muse2/muse/shortcuts.cpp +++ b/muse2/muse/shortcuts.cpp @@ -36,6 +36,7 @@ #include <QTranslator> #include <QKeySequence> +namespace MusEGui { ShortCut shortcuts[SHRT_NUM_OF_ELEMENTS]; void defShrt(int shrt, int key, const char* descr, int type, const char* xml) @@ -349,7 +350,7 @@ int getShrtByTag(const char* xml) return -1; } -void writeShortCuts(int level, Xml& xml) +void writeShortCuts(int level, MusECore::Xml& xml) { xml.tag(level++, "shortcuts"); for (int i=0; i < SHRT_NUM_OF_ELEMENTS; i++) { @@ -359,16 +360,16 @@ void writeShortCuts(int level, Xml& xml) xml.etag(level, "shortcuts"); } -void readShortCuts(Xml& xml) +void readShortCuts(MusECore::Xml& xml) { for (;;) { - Xml::Token token = xml.parse(); - if (token == Xml::Error || token == Xml::End) + MusECore::Xml::Token token = xml.parse(); + if (token == MusECore::Xml::Error || token == MusECore::Xml::End) break; const QString& tag = xml.s1(); switch (token) { - case Xml::TagStart: { + case MusECore::Xml::TagStart: { if (tag.length()) { int index = getShrtByTag(tag.toAscii().constData()); if (index == -1) //No such tag found @@ -380,7 +381,7 @@ void readShortCuts(Xml& xml) } } } - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "shortcuts") return; default: @@ -388,3 +389,5 @@ void readShortCuts(Xml& xml) } } } + +} // namespace MusEGui diff --git a/muse2/muse/shortcuts.h b/muse2/muse/shortcuts.h index 37e8b507..dc2e6f22 100644 --- a/muse2/muse/shortcuts.h +++ b/muse2/muse/shortcuts.h @@ -56,6 +56,8 @@ #define SHRT_NUM_OF_CATEGORIES 7 //Number of shortcut categories +namespace MusEGui { + struct shortcut { int key; @@ -347,7 +349,10 @@ enum { extern ShortCut shortcuts[SHRT_NUM_OF_ELEMENTS]; //size of last entry extern void initShortCuts(); -extern void writeShortCuts(int level, Xml& xml); -extern void readShortCuts (Xml& xml); +extern void writeShortCuts(int level, MusECore::Xml& xml); +extern void readShortCuts (MusECore::Xml& xml); extern const shortcut_cg shortcut_category[SHRT_NUM_OF_CATEGORIES]; + +} // namespace MusEGui + #endif diff --git a/muse2/muse/sig.cpp b/muse2/muse/sig.cpp index 22acf6f8..0b62848c 100644 --- a/muse2/muse/sig.cpp +++ b/muse2/muse/sig.cpp @@ -27,7 +27,11 @@ #include "gconfig.h" #include "xml.h" -SigList sigmap; +namespace MusEGlobal { +MusECore::SigList sigmap; +} + +namespace MusECore { //--------------------------------------------------------- // SigList @@ -187,7 +191,7 @@ int SigList::ticksBeat(unsigned tick) const int SigList::ticks_beat(int n) const { - int m = MusEConfig::config.division; + int m = MusEGlobal::config.division; switch (n) { case 1: m <<= 2; break; // 1536 case 2: m <<= 1; break; // 768 @@ -451,4 +455,4 @@ int SigEvent::read(Xml& xml) return 0; } - +} // namespace MusECore diff --git a/muse2/muse/sig.h b/muse2/muse/sig.h index bec1951e..727ce79e 100644 --- a/muse2/muse/sig.h +++ b/muse2/muse/sig.h @@ -30,6 +30,8 @@ #define MAX_TICK (0x7fffffff/100) #endif +namespace MusECore { + class Xml; //--------------------------------------------------------- @@ -90,5 +92,10 @@ class SigList : public SIGLIST { int rasterStep(unsigned tick, int raster) const; }; -extern SigList sigmap; +} // namespace MusECore + +namespace MusEGlobal { +extern MusECore::SigList sigmap; +} + #endif diff --git a/muse2/muse/song.cpp b/muse2/muse/song.cpp index dca43681..c9efe288 100644 --- a/muse2/muse/song.cpp +++ b/muse2/muse/song.cpp @@ -63,9 +63,14 @@ #include <sys/wait.h> //#include "utils.h" +namespace MusEGlobal { +MusECore::Song* song = 0; +} + +namespace MusECore { + extern void clearMidiTransforms(); extern void clearMidiInputTransforms(); -Song* song = 0; /* //--------------------------------------------------------- @@ -138,7 +143,7 @@ void Song::putEvent(int pv) void Song::setTempo(int newTempo) { - audio->msgSetTempo(pos[0].tick(), newTempo, true); + MusEGlobal::audio->msgSetTempo(pos[0].tick(), newTempo, true); } //--------------------------------------------------------- @@ -149,14 +154,14 @@ void Song::setTempo(int newTempo) void Song::setSig(int z, int n) { if (_masterFlag) { - audio->msgAddSig(pos[0].tick(), z, n); + MusEGlobal::audio->msgAddSig(pos[0].tick(), z, n); } } void Song::setSig(const AL::TimeSignature& sig) { if (_masterFlag) { - audio->msgAddSig(pos[0].tick(), sig.z, sig.n); + MusEGlobal::audio->msgAddSig(pos[0].tick(), sig.z, sig.n); } } @@ -178,21 +183,21 @@ Track* Song::addNewTrack(QAction* action, Track* insertAt) if(n >= MENU_ADD_SYNTH_ID_BASE) { n -= MENU_ADD_SYNTH_ID_BASE; - if(n >= (int)synthis.size()) + if(n >= (int)MusEGlobal::synthis.size()) return 0; - SynthI* si = createSynthI(synthis[n]->baseName(), synthis[n]->name(), insertAt); + SynthI* si = createSynthI(MusEGlobal::synthis[n]->baseName(), MusEGlobal::synthis[n]->name(), insertAt); if(!si) return 0; // Add instance last in midi device list. for (int i = 0; i < MIDI_PORTS; ++i) { - MidiPort* port = &midiPorts[i]; + MidiPort* port = &MusEGlobal::midiPorts[i]; MidiDevice* dev = port->device(); if (dev==0) { - midiSeq->msgSetMidiDevice(port, si); + MusEGlobal::midiSeq->msgSetMidiDevice(port, si); MusEGlobal::muse->changeConfig(true); // save configuration file deselectTracks(); si->setSelected(true); @@ -249,7 +254,7 @@ Track* Song::addTrack(Track::TrackType type, Track* insertAt) ((MidiTrack*)track)->setOutChannel(9); break; case Track::WAVE: - track = new WaveTrack(); + track = new MusECore::WaveTrack(); ((AudioTrack*)track)->addAuxSend(lastAuxIdx); break; case Track::AUDIO_OUTPUT: @@ -290,14 +295,14 @@ Track* Song::addTrack(Track::TrackType type, Track* insertAt) bool defOutFound = false; /// TODO: Remove this if and when multiple output routes supported. for(int i = 0; i < MIDI_PORTS; ++i) { - MidiPort* mp = &midiPorts[i]; + MidiPort* mp = &MusEGlobal::midiPorts[i]; if(mp->device()) // Only if device is valid. p4.0.17 { c = mp->defaultInChannels(); if(c) { - audio->msgAddRoute(Route(i, c), Route(track, c)); + MusEGlobal::audio->msgAddRoute(Route(i, c), Route(track, c)); updateFlags |= SC_ROUTE; } } @@ -310,7 +315,7 @@ Track* Song::addTrack(Track::TrackType type, Track* insertAt) /// TODO: Switch if and when multiple output routes supported. #if 0 - audio->msgAddRoute(Route(track, c), Route(i, c)); + MusEGlobal::audio->msgAddRoute(Route(track, c), Route(i, c)); updateFlags |= SC_ROUTE; #else for(ch = 0; ch < MIDI_CHANNELS; ++ch) @@ -335,7 +340,7 @@ Track* Song::addTrack(Track::TrackType type, Track* insertAt) // // add default route to master // - OutputList* ol = song->outputs(); + OutputList* ol = MusEGlobal::song->outputs(); if (!ol->empty()) { AudioOutput* ao = ol->front(); switch(type) { @@ -351,19 +356,19 @@ Track* Song::addTrack(Track::TrackType type, Track* insertAt) //case Track::AUDIO_INPUT: // Removed by Tim. // p3.3.38 //case Track::AUDIO_SOFTSYNTH: - audio->msgAddRoute(Route((AudioTrack*)track, -1), Route(ao, -1)); + MusEGlobal::audio->msgAddRoute(Route((AudioTrack*)track, -1), Route(ao, -1)); updateFlags |= SC_ROUTE; break; // p3.3.38 It should actually never get here now, but just in case. case Track::AUDIO_SOFTSYNTH: - audio->msgAddRoute(Route((AudioTrack*)track, 0, ((AudioTrack*)track)->channels()), Route(ao, 0, ((AudioTrack*)track)->channels())); + MusEGlobal::audio->msgAddRoute(Route((AudioTrack*)track, 0, ((AudioTrack*)track)->channels()), Route(ao, 0, ((AudioTrack*)track)->channels())); updateFlags |= SC_ROUTE; break; default: break; } } - audio->msgUpdateSoloStates(); + MusEGlobal::audio->msgUpdateSoloStates(); return track; } @@ -438,7 +443,7 @@ bool Song::addEvent(Event& event, Part* part) int tick = event.tick() + part->tick(); int cntrl = event.dataA(); int val = event.dataB(); - MidiPort* mp = &midiPorts[track->outPort()]; + MidiPort* mp = &MusEGlobal::midiPorts[track->outPort()]; // Is it a drum controller event, according to the track port's instrument? if(track->type() == Track::DRUM) //FINDMICHJETZT was ist das? @@ -448,9 +453,9 @@ bool Song::addEvent(Event& event, Part* part) { int note = cntrl & 0x7f; cntrl &= ~0xff; - ch = drumMap[note].channel; - mp = &midiPorts[drumMap[note].port]; - cntrl |= drumMap[note].anote; + ch = MusEGlobal::drumMap[note].channel; + mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[note].port]; + cntrl |= MusEGlobal::drumMap[note].anote; } } @@ -512,7 +517,7 @@ void Song::changeEvent(Event& oldEvent, Event& newEvent, Part* part) int ch = track->outChannel(); int tick = oldEvent.tick() + part->tick(); int cntrl = oldEvent.dataA(); - MidiPort* mp = &midiPorts[track->outPort()]; + MidiPort* mp = &MusEGlobal::midiPorts[track->outPort()]; // Is it a drum controller event, according to the track port's instrument? if(track->type() == Track::DRUM) //FINDMICHJETZT was ist das? { @@ -521,9 +526,9 @@ void Song::changeEvent(Event& oldEvent, Event& newEvent, Part* part) { int note = cntrl & 0x7f; cntrl &= ~0xff; - ch = drumMap[note].channel; - mp = &midiPorts[drumMap[note].port]; - cntrl |= drumMap[note].anote; + ch = MusEGlobal::drumMap[note].channel; + mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[note].port]; + cntrl |= MusEGlobal::drumMap[note].anote; } } @@ -539,7 +544,7 @@ void Song::changeEvent(Event& oldEvent, Event& newEvent, Part* part) int tick = newEvent.tick() + part->tick(); int cntrl = newEvent.dataA(); int val = newEvent.dataB(); - MidiPort* mp = &midiPorts[track->outPort()]; + MidiPort* mp = &MusEGlobal::midiPorts[track->outPort()]; // Is it a drum controller event, according to the track port's instrument? if(track->type() == Track::DRUM) //FINDMICHJETZT was ist das? { @@ -548,9 +553,9 @@ void Song::changeEvent(Event& oldEvent, Event& newEvent, Part* part) { int note = cntrl & 0x7f; cntrl &= ~0xff; - ch = drumMap[note].channel; - mp = &midiPorts[drumMap[note].port]; - cntrl |= drumMap[note].anote; + ch = MusEGlobal::drumMap[note].channel; + mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[note].port]; + cntrl |= MusEGlobal::drumMap[note].anote; } } @@ -573,7 +578,7 @@ void Song::deleteEvent(Event& event, Part* part) int tick = event.tick() + part->tick(); int cntrl = event.dataA(); - MidiPort* mp = &midiPorts[track->outPort()]; + MidiPort* mp = &MusEGlobal::midiPorts[track->outPort()]; // Is it a drum controller event, according to the track port's instrument? if(track->type() == Track::DRUM) //FINDMICHJETZT was ist das? { @@ -582,9 +587,9 @@ void Song::deleteEvent(Event& event, Part* part) { int note = cntrl & 0x7f; cntrl &= ~0xff; - ch = drumMap[note].channel; - mp = &midiPorts[drumMap[note].port]; - cntrl |= drumMap[note].anote; + ch = MusEGlobal::drumMap[note].channel; + mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[note].port]; + cntrl |= MusEGlobal::drumMap[note].anote; } } @@ -619,7 +624,7 @@ void Song::remapPortDrumCtrlEvents(int mapidx, int newnote, int newchan, int new if(mt->type() != Track::DRUM) //FINDMICHJETZT was ist das? drumcontroller? continue; - MidiPort* trackmp = &midiPorts[mt->outPort()]; + MidiPort* trackmp = &MusEGlobal::midiPorts[mt->outPort()]; const PartList* pl = mt->cparts(); for(ciPart ip = pl->begin(); ip != pl->end(); ++ip) { @@ -649,22 +654,22 @@ void Song::remapPortDrumCtrlEvents(int mapidx, int newnote, int newchan, int new if(note == mapidx) { int tick = ev.tick() + part->tick(); - int ch = drumMap[note].channel; - int port = drumMap[note].port; - MidiPort* mp = &midiPorts[port]; - cntrl = (cntrl & ~0xff) | drumMap[note].anote; + int ch = MusEGlobal::drumMap[note].channel; + int port = MusEGlobal::drumMap[note].port; + MidiPort* mp = &MusEGlobal::midiPorts[port]; + cntrl = (cntrl & ~0xff) | MusEGlobal::drumMap[note].anote; // Remove the port controller value. mp->deleteController(ch, tick, cntrl, part); - if(newnote != -1 && newnote != drumMap[note].anote) + if(newnote != -1 && newnote != MusEGlobal::drumMap[note].anote) cntrl = (cntrl & ~0xff) | newnote; if(newchan != -1 && newchan != ch) ch = newchan; if(newport != -1 && newport != port) port = newport; - mp = &midiPorts[port]; + mp = &MusEGlobal::midiPorts[port]; // Add the port controller value. mp->setControllerVal(ch, tick, cntrl, ev.dataB(), part); @@ -690,7 +695,7 @@ void Song::changeAllPortDrumCtrlEvents(bool add, bool drumonly) if(mt->type() != Track::DRUM) //FINDMICHJETZT was ist das? drumcontroller continue; - trackmp = &midiPorts[mt->outPort()]; + trackmp = &MusEGlobal::midiPorts[mt->outPort()]; trackch = mt->outChannel(); const PartList* pl = mt->cparts(); for(ciPart ip = pl->begin(); ip != pl->end(); ++ip) @@ -716,9 +721,9 @@ void Song::changeAllPortDrumCtrlEvents(bool add, bool drumonly) if(trackmp->drumController(cntrl)) { int note = cntrl & 0x7f; - ch = drumMap[note].channel; - mp = &midiPorts[drumMap[note].port]; - cntrl = (cntrl & ~0xff) | drumMap[note].anote; + ch = MusEGlobal::drumMap[note].channel; + mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[note].port]; + cntrl = (cntrl & ~0xff) | MusEGlobal::drumMap[note].anote; } else { @@ -741,13 +746,13 @@ void Song::changeAllPortDrumCtrlEvents(bool add, bool drumonly) void Song::addACEvent(AudioTrack* t, int acid, int frame, double val) { - audio->msgAddACEvent(t, acid, frame, val); + MusEGlobal::audio->msgAddACEvent(t, acid, frame, val); emit controllerChanged(t); } void Song::changeACEvent(AudioTrack* t, int acid, int frame, int newFrame, double val) { - audio->msgChangeACEvent(t, acid, frame, newFrame, val); + MusEGlobal::audio->msgChangeACEvent(t, acid, frame, newFrame, val); emit controllerChanged(t); } @@ -775,7 +780,7 @@ void Song::cmdAddRecordedEvents(MidiTrack* mt, EventList* events, unsigned start // Changed by Tim. p3.3.8 //if (punchin()) - if((audio->loopCount() > 0 && startTick > lPos().tick()) || (punchin() && startTick < lPos().tick())) + if((MusEGlobal::audio->loopCount() > 0 && startTick > lPos().tick()) || (punchin() && startTick < lPos().tick())) { startTick = lpos(); s = events->lower_bound(startTick); @@ -805,7 +810,7 @@ void Song::cmdAddRecordedEvents(MidiTrack* mt, EventList* events, unsigned start } // e = events->end(); //} - if((audio->loopCount() > 0) || (punchout() && endTick > rPos().tick()) ) + if((MusEGlobal::audio->loopCount() > 0) || (punchout() && endTick > rPos().tick()) ) { endTick = rpos(); e = events->lower_bound(endTick); @@ -865,7 +870,7 @@ void Song::cmdAddRecordedEvents(MidiTrack* mt, EventList* events, unsigned start if(part->events()->find(event) == part->events()->end()) part->events()->add(event); } - audio->msgAddPart(part); + MusEGlobal::audio->msgAddPart(part); updateFlags |= SC_PART_INSERTED; return; } @@ -956,7 +961,7 @@ void Song::cmdAddRecordedEvents(MidiTrack* mt, EventList* events, unsigned start // int ch = track->outChannel(); // int tick = event.tick() + part->tick(); // int cntrl = event.dataA(); - // midiPorts[track->outPort()].deleteController(ch, tick, cntrl, part); + // MusEGlobal::midiPorts[track->outPort()].deleteController(ch, tick, cntrl, part); // } // Remove the event from the part's port controller values, and do all clone parts. @@ -1035,7 +1040,7 @@ void Song::cmdAddRecordedEvents(MidiTrack* mt, EventList* events, unsigned start int ch = track->outChannel(); int tick = event.tick() + part->tick(); int cntrl = event.dataA(); - midiPorts[track->outPort()].deleteController(ch, tick, cntrl, part); + MusEGlobal::midiPorts[track->outPort()].deleteController(ch, tick, cntrl, part); } */ // Remove the event from the part's port controller values, and do all clone parts. @@ -1126,7 +1131,7 @@ void Song::setRecord(bool f, bool autoRecEnable) if(MusEGlobal::debugMsg) printf("setRecord recordflag =%d f(record state)=%d autoRecEnable=%d\n", recordFlag, f, autoRecEnable); - if (f && MusEConfig::config.useProjectSaveDialog && MusEGlobal::museProject == MusEGlobal::museProjectInitPath ) { // check that there is a project stored before commencing + if (f && MusEGlobal::config.useProjectSaveDialog && MusEGlobal::museProject == MusEGlobal::museProjectInitPath ) { // check that there is a project stored before commencing // no project, we need to create one. if (!MusEGlobal::muse->saveAs()) return; // could not store project, won't enable record @@ -1137,8 +1142,8 @@ void Song::setRecord(bool f, bool autoRecEnable) Track *selectedTrack = 0; // loop through list and check if any track is rec enabled // if not then rec enable the selected track - WaveTrackList* wtl = waves(); - for (iWaveTrack i = wtl->begin(); i != wtl->end(); ++i) { + MusECore::WaveTrackList* wtl = waves(); + for (MusECore::iWaveTrack i = wtl->begin(); i != wtl->end(); ++i) { if((*i)->recordFlag()) { alreadyRecEnabled = true; @@ -1173,7 +1178,7 @@ void Song::setRecord(bool f, bool autoRecEnable) } } // prepare recording of wave files for all record enabled wave tracks - for (iWaveTrack i = wtl->begin(); i != wtl->end(); ++i) { + for (MusECore::iWaveTrack i = wtl->begin(); i != wtl->end(); ++i) { if((*i)->recordFlag() || (selectedTrack == (*i) && autoRecEnable)) // prepare if record flag or if it is set to recenable { // setRecordFlag may take too long time to complete // so we try this case specifically @@ -1185,7 +1190,7 @@ void Song::setRecord(bool f, bool autoRecEnable) // check for midi devices suitable for recording bool portFound = false; for (int i = 0; i < MIDI_PORTS; ++i) { - MidiDevice* dev = midiPorts[i].device(); + MidiDevice* dev = MusEGlobal::midiPorts[i].device(); if (dev && (dev->rwFlags() & 0x2)) portFound = true; } @@ -1199,7 +1204,7 @@ void Song::setRecord(bool f, bool autoRecEnable) else { bounceTrack = 0; } - if (audio->isPlaying() && f) + if (MusEGlobal::audio->isPlaying() && f) f = false; recordFlag = f; MusEGlobal::recordAction->setChecked(recordFlag); @@ -1266,13 +1271,13 @@ void Song::setQuantize(bool val) void Song::setMasterFlag(bool val) { _masterFlag = val; - if (tempomap.setMasterFlag(cpos(), val)) + if (MusEGlobal::tempomap.setMasterFlag(cpos(), val)) { - //audioDevice->setMaster(val); + //MusEGlobal::audioDevice->setMaster(val); emit songChanged(SC_MASTER); } // Removed. p3.3.26 - //audioDevice->setMaster(val); + //MusEGlobal::audioDevice->setMaster(val); } //--------------------------------------------------------- @@ -1282,7 +1287,7 @@ void Song::setMasterFlag(bool val) void Song::setPlay(bool f) { - if (extSyncFlag.value()) { + if (MusEGlobal::extSyncFlag.value()) { if (MusEGlobal::debugMsg) printf("not allowed while using external sync"); return; @@ -1291,12 +1296,12 @@ void Song::setPlay(bool f) if (!f) MusEGlobal::playAction->setChecked(true); else - audio->msgPlay(true); + MusEGlobal::audio->msgPlay(true); } void Song::setStop(bool f) { - if (extSyncFlag.value()) { + if (MusEGlobal::extSyncFlag.value()) { if (MusEGlobal::debugMsg) printf("not allowed while using external sync"); return; @@ -1305,7 +1310,7 @@ void Song::setStop(bool f) if (!f) MusEGlobal::stopAction->setChecked(true); else - audio->msgPlay(false); + MusEGlobal::audio->msgPlay(false); } void Song::setStopPlay(bool f) @@ -1340,14 +1345,14 @@ void Song::swapTracks(int i1, int i2) //--------------------------------------------------------- void Song::seekTo(int tick) { - if (!audio->isPlaying()) { + if (!MusEGlobal::audio->isPlaying()) { Pos p(tick, true); setPos(0, p); } } //--------------------------------------------------------- // setPos -// song->setPos(Song::CPOS, pos, true, true, true); +// MusEGlobal::song->setPos(Song::CPOS, pos, true, true, true); //--------------------------------------------------------- void Song::setPos(int idx, const Pos& val, bool sig, @@ -1357,27 +1362,27 @@ void Song::setPos(int idx, const Pos& val, bool sig, // idx, sig, isSeek, adjustScrollbar); // val.dump(0); // printf("\n"); - //printf("Song::setPos before audio->msgSeek idx:%d isSeek:%d frame:%d\n", idx, isSeek, val.frame()); + //printf("Song::setPos before MusEGlobal::audio->msgSeek idx:%d isSeek:%d frame:%d\n", idx, isSeek, val.frame()); // If seeking audio, ensure frame resolution CAN be kept throughout. This compares apples and oranges. Moved below. p4.0.33 //if (pos[idx] == val) // return; if (idx == CPOS) { _vcpos = val; - if (isSeek && !extSyncFlag.value()) { - if (val == audio->pos()) + if (isSeek && !MusEGlobal::extSyncFlag.value()) { + if (val == MusEGlobal::audio->pos()) { - //printf("Song::setPos seek audio->pos already == val tick:%d frame:%d\n", val.tick(), val.frame()); + //printf("Song::setPos seek MusEGlobal::audio->pos already == val tick:%d frame:%d\n", val.tick(), val.frame()); return; } - audio->msgSeek(val); - //printf("Song::setPos after audio->msgSeek idx:%d isSeek:%d frame:%d\n", idx, isSeek, val.frame()); + MusEGlobal::audio->msgSeek(val); + //printf("Song::setPos after MusEGlobal::audio->msgSeek idx:%d isSeek:%d frame:%d\n", idx, isSeek, val.frame()); return; } } if (val == pos[idx]) { - //printf("Song::setPos song->pos already == val tick:%d frame:%d\n", val.tick(), val.frame()); + //printf("Song::setPos MusEGlobal::song->pos already == val tick:%d frame:%d\n", val.tick(), val.frame()); return; } pos[idx] = val; @@ -1438,8 +1443,8 @@ void Song::setPos(int idx, const Pos& val, bool sig, void Song::forward() { - unsigned newPos = pos[0].tick() + MusEConfig::config.division; - audio->msgSeek(Pos(newPos, true)); + unsigned newPos = pos[0].tick() + MusEGlobal::config.division; + MusEGlobal::audio->msgSeek(Pos(newPos, true)); } //--------------------------------------------------------- @@ -1449,11 +1454,11 @@ void Song::forward() void Song::rewind() { unsigned newPos; - if (unsigned(MusEConfig::config.division) > pos[0].tick()) + if (unsigned(MusEGlobal::config.division) > pos[0].tick()) newPos = 0; else - newPos = pos[0].tick() - MusEConfig::config.division; - audio->msgSeek(Pos(newPos, true)); + newPos = pos[0].tick() - MusEGlobal::config.division; + MusEGlobal::audio->msgSeek(Pos(newPos, true)); } //--------------------------------------------------------- @@ -1463,12 +1468,12 @@ void Song::rewind() void Song::rewindStart() { // Added by T356 - //audio->msgIdle(true); + //MusEGlobal::audio->msgIdle(true); - audio->msgSeek(Pos(0, true)); + MusEGlobal::audio->msgSeek(Pos(0, true)); // Added by T356 - //audio->msgIdle(false); + //MusEGlobal::audio->msgIdle(false); } //--------------------------------------------------------- @@ -1593,7 +1598,7 @@ int Song::roundDownBar(int t) const void Song::dumpMaster() { - tempomap.dump(); + MusEGlobal::tempomap.dump(); AL::sigmap.dump(); } @@ -1668,7 +1673,7 @@ PartList* Song::getSelectedWaveParts() const // markierte Parts sammeln for (ciTrack t = _tracks.begin(); t != _tracks.end(); ++t) { - WaveTrack* track = dynamic_cast<WaveTrack*>(*t); + MusECore::WaveTrack* track = dynamic_cast<MusECore::WaveTrack*>(*t); if (track == 0) continue; PartList* pl = track->parts(); @@ -1684,7 +1689,7 @@ PartList* Song::getSelectedWaveParts() const if (parts->empty()) { for (ciTrack t = _tracks.begin(); t != _tracks.end(); ++t) { if ((*t)->selected()) { - WaveTrack* track = dynamic_cast<WaveTrack*>(*t); + MusECore::WaveTrack* track = dynamic_cast<MusECore::WaveTrack*>(*t); if (track == 0) continue; PartList* pl = track->parts(); @@ -1701,7 +1706,7 @@ void Song::setMType(MType t) { // printf("set MType %d\n", t); _mtype = t; - song->update(SC_SONG_TYPE); // p4.0.7 Tim. + MusEGlobal::song->update(SC_SONG_TYPE); // p4.0.7 Tim. } //--------------------------------------------------------- @@ -1729,17 +1734,17 @@ void Song::beat() for(int port = 0; port < MIDI_PORTS; ++port) { // Must keep them running even if there's no device... - //if(midiPorts[port].device()) - midiPorts[port].syncInfo().setTime(); + //if(MusEGlobal::midiPorts[port].device()) + MusEGlobal::midiPorts[port].syncInfo().setTime(); } - //int tick = audio->tickPos(); - if (audio->isPlaying()) + //int tick = MusEGlobal::audio->tickPos(); + if (MusEGlobal::audio->isPlaying()) { - //Pos tick(audio->tickPos()); + //Pos tick(MusEGlobal::audio->tickPos()); //setPos(0, tick, true, false, true); - setPos(0, audio->tickPos(), true, false, true); + setPos(0, MusEGlobal::audio->tickPos(), true, false, true); } // p3.3.40 Update synth native guis at the heartbeat rate. for(ciSynthI is = _synthIs.begin(); is != _synthIs.end(); ++is) @@ -1765,7 +1770,7 @@ void Song::beat() else if (pitch == MusEGlobal::rcPlayNote) setPlay(true); } - emit song->midiNote(pitch, velo); + emit MusEGlobal::song->midiNote(pitch, velo); --noteFifoSize; } } @@ -1866,10 +1871,10 @@ Marker* Song::setMarkerLock(Marker* m, bool f) void Song::setRecordFlag(Track* track, bool val) { if (track->type() == Track::WAVE) { - WaveTrack* audioTrack = (WaveTrack*)track; + MusECore::WaveTrack* audioTrack = (MusECore::WaveTrack*)track; if(!audioTrack->setRecordFlag1(val)) return; - audio->msgSetRecord(audioTrack, val); + MusEGlobal::audio->msgSetRecord(audioTrack, val); } else { track->setRecordFlag1(val); @@ -1912,13 +1917,13 @@ void Song::undo() updateFlags = 0; if (doUndo1()) return; - audio->msgUndo(); + MusEGlobal::audio->msgUndo(); doUndo3(); MusEGlobal::redoAction->setEnabled(true); MusEGlobal::undoAction->setEnabled(!undoList->empty()); if(updateFlags && (SC_TRACK_REMOVED | SC_TRACK_INSERTED)) - audio->msgUpdateSoloStates(); + MusEGlobal::audio->msgUpdateSoloStates(); emit songChanged(updateFlags); } @@ -1932,13 +1937,13 @@ void Song::redo() updateFlags = 0; if (doRedo1()) return; - audio->msgRedo(); + MusEGlobal::audio->msgRedo(); doRedo3(); MusEGlobal::undoAction->setEnabled(true); MusEGlobal::redoAction->setEnabled(!redoList->empty()); if(updateFlags && (SC_TRACK_REMOVED | SC_TRACK_INSERTED)) - audio->msgUpdateSoloStates(); + MusEGlobal::audio->msgUpdateSoloStates(); emit songChanged(updateFlags); } @@ -2034,25 +2039,25 @@ void Song::processMsg(AudioMsg* msg) case SEQM_ADD_TEMPO: //printf("processMsg (SEQM_ADD_TEMPO) UndoOp::AddTempo. adding tempo at: %d with tempo=%d\n", msg->a, msg->b); addUndo(UndoOp(UndoOp::AddTempo, msg->a, msg->b)); - tempomap.addTempo(msg->a, msg->b); + MusEGlobal::tempomap.addTempo(msg->a, msg->b); updateFlags = SC_TEMPO; break; case SEQM_SET_TEMPO: //printf("processMsg (SEQM_SET_TEMPO) UndoOp::AddTempo. adding tempo at: %d with tempo=%d\n", msg->a, msg->b); addUndo(UndoOp(UndoOp::AddTempo, msg->a, msg->b)); - tempomap.setTempo(msg->a, msg->b); + MusEGlobal::tempomap.setTempo(msg->a, msg->b); updateFlags = SC_TEMPO; break; case SEQM_SET_GLOBAL_TEMPO: - tempomap.setGlobalTempo(msg->a); + MusEGlobal::tempomap.setGlobalTempo(msg->a); break; case SEQM_REMOVE_TEMPO: //printf("processMsg (SEQM_REMOVE_TEMPO) UndoOp::DeleteTempo. adding tempo at: %d with tempo=%d\n", msg->a, msg->b); addUndo(UndoOp(UndoOp::DeleteTempo, msg->a, msg->b)); - tempomap.delTempo(msg->a); + MusEGlobal::tempomap.delTempo(msg->a); updateFlags = SC_TEMPO; break; @@ -2070,13 +2075,13 @@ void Song::processMsg(AudioMsg* msg) case SEQM_ADD_KEY: addUndo(UndoOp(UndoOp::AddKey, msg->a, msg->b)); - keymap.addKey(msg->a, (key_enum) msg->b); + MusEGlobal::keymap.addKey(msg->a, (key_enum) msg->b); updateFlags = SC_KEY; break; case SEQM_REMOVE_KEY: addUndo(UndoOp(UndoOp::DeleteKey, msg->a, msg->b)); - keymap.delKey(msg->a); + MusEGlobal::keymap.delKey(msg->a); updateFlags = SC_KEY; break; @@ -2153,7 +2158,7 @@ void Song::cmdChangePart(Part* oldPart, Part* newPart, bool doCtrls, bool doClon void Song::panic() { - audio->msgPanic(); + MusEGlobal::audio->msgPanic(); } //--------------------------------------------------------- @@ -2183,15 +2188,15 @@ void Song::clear(bool signal, bool /*clear_all*/) for(int i = 0; i < MIDI_PORTS; ++i) { // p3.3.50 Since midi ports are not deleted, clear all midi port in/out routes. They point to non-existant tracks now. - midiPorts[i].inRoutes()->clear(); - midiPorts[i].outRoutes()->clear(); + MusEGlobal::midiPorts[i].inRoutes()->clear(); + MusEGlobal::midiPorts[i].outRoutes()->clear(); // p3.3.50 Reset this. - midiPorts[i].setFoundInSongFile(false); + MusEGlobal::midiPorts[i].setFoundInSongFile(false); //if(clear_all) // Allow not touching devices. p4.0.17 TESTING: Maybe some problems... // This will also close the device. - midiPorts[i].setMidiDevice(0); + MusEGlobal::midiPorts[i].setMidiDevice(0); } _synthIs.clearDelete(); @@ -2203,7 +2208,7 @@ void Song::clear(bool signal, bool /*clear_all*/) do { loop = false; - for(iMidiDevice imd = midiDevices.begin(); imd != midiDevices.end(); ++imd) + for(iMidiDevice imd = MusEGlobal::midiDevices.begin(); imd != MusEGlobal::midiDevices.end(); ++imd) { //if((*imd)->deviceType() == MidiDevice::JACK_MIDI) if(dynamic_cast< MidiJackDevice* >(*imd)) @@ -2211,7 +2216,7 @@ void Song::clear(bool signal, bool /*clear_all*/) //if(clear_all) // Allow not touching devices. p4.0.17 TESTING: Maybe some problems... { // Remove the device from the list. - midiDevices.erase(imd); + MusEGlobal::midiDevices.erase(imd); // Since Jack midi devices are created dynamically, we must delete them. // The destructor unregisters the device from Jack, which also disconnects all device-to-jack routes. // This will also delete all midi-track-to-device routes, they point to non-existant midi tracks @@ -2234,9 +2239,9 @@ void Song::clear(bool signal, bool /*clear_all*/) } while (loop); - tempomap.clear(); + MusEGlobal::tempomap.clear(); AL::sigmap.clear(); - keymap.clear(); + MusEGlobal::keymap.clear(); undoList->clearDelete(); redoList->clear(); _markerList->clear(); @@ -2252,7 +2257,7 @@ void Song::clear(bool signal, bool /*clear_all*/) // Clear all midi port controller values. for(int i = 0; i < MIDI_PORTS; ++i) // Don't remove the controllers, just the values. - midiPorts[i].controller()->clearDelete(false); + MusEGlobal::midiPorts[i].controller()->clearDelete(false); _masterFlag = true; loopFlag = false; @@ -2321,9 +2326,9 @@ void Song::cleanupForQuit() printf("deleting _synthIs\n"); _synthIs.clearDelete(); // each ~SynthI() -> deactivate3() -> ~SynthIF() - tempomap.clear(); + MusEGlobal::tempomap.clear(); AL::sigmap.clear(); - keymap.clear(); + MusEGlobal::keymap.clear(); if(MusEGlobal::debugMsg) printf("deleting undoList, clearing redoList\n"); @@ -2342,13 +2347,13 @@ void Song::cleanupForQuit() // Clear all midi port controllers and values. for(int i = 0; i < MIDI_PORTS; ++i) // Remove the controllers and the values. - midiPorts[i].controller()->clearDelete(true); + MusEGlobal::midiPorts[i].controller()->clearDelete(true); // Can't do this here. Jack isn't running. Fixed. Test OK so far. #if 1 if(MusEGlobal::debugMsg) printf("deleting midi devices except synths\n"); - for(iMidiDevice imd = midiDevices.begin(); imd != midiDevices.end(); ++imd) + for(iMidiDevice imd = MusEGlobal::midiDevices.begin(); imd != MusEGlobal::midiDevices.end(); ++imd) { // Close the device. Handy to do all devices here, including synths. (*imd)->close(); @@ -2357,21 +2362,21 @@ void Song::cleanupForQuit() continue; delete (*imd); } - midiDevices.clear(); // midi devices + MusEGlobal::midiDevices.clear(); // midi devices #endif if(MusEGlobal::debugMsg) printf("deleting global available synths\n"); // Delete all synths. std::vector<Synth*>::iterator is; - for(is = synthis.begin(); is != synthis.end(); ++is) + for(is = MusEGlobal::synthis.begin(); is != MusEGlobal::synthis.end(); ++is) { Synth* s = *is; if(s) delete s; } - synthis.clear(); + MusEGlobal::synthis.clear(); if(MusEGlobal::debugMsg) printf("deleting midi instruments\n"); @@ -2433,7 +2438,7 @@ void Song::seqSignal(int fd) break; case 'G': clearRecAutomation(true); - setPos(0, audio->tickPos(), true, false, true); + setPos(0, MusEGlobal::audio->tickPos(), true, false, true); break; case 'S': // shutdown audio MusEGlobal::muse->seqStop(); @@ -2468,8 +2473,8 @@ void Song::seqSignal(int fd) printf("Song: seqSignal: case f: setFreewheel start\n"); // Enabled by Tim. p3.3.6 - if(MusEConfig::config.freewheelMode) - audioDevice->setFreewheel(true); + if(MusEGlobal::config.freewheelMode) + MusEGlobal::audioDevice->setFreewheel(true); break; @@ -2478,26 +2483,26 @@ void Song::seqSignal(int fd) printf("Song: seqSignal: case F: setFreewheel stop\n"); // Enabled by Tim. p3.3.6 - if(MusEConfig::config.freewheelMode) - audioDevice->setFreewheel(false); + if(MusEGlobal::config.freewheelMode) + MusEGlobal::audioDevice->setFreewheel(false); - audio->msgPlay(false); + MusEGlobal::audio->msgPlay(false); #if 0 if (record()) - audio->recordStop(); + MusEGlobal::audio->recordStop(); setStopPlay(false); #endif break; case 'C': // Graph changed - if (audioDevice) - audioDevice->graphChanged(); + if (MusEGlobal::audioDevice) + MusEGlobal::audioDevice->graphChanged(); break; // p3.3.37 case 'R': // Registration changed - if (audioDevice) - audioDevice->registrationChanged(); + if (MusEGlobal::audioDevice) + MusEGlobal::audioDevice->registrationChanged(); break; default: @@ -2543,7 +2548,7 @@ void Song::recordEvent(MidiTrack* mt, Event& event) part->setName(mt->name()); event.move(-startTick); part->events()->add(event); - audio->msgAddPart(part); + MusEGlobal::audio->msgAddPart(part); return; } part = (MidiPart*)(ip->second); @@ -2568,15 +2573,15 @@ void Song::recordEvent(MidiTrack* mt, Event& event) if(ev.dataB() == event.dataB()) return; // Indicate do undo, and do port controller values and clone parts. - audio->msgChangeEvent(ev, event, part, true, true, true); + MusEGlobal::audio->msgChangeEvent(ev, event, part, true, true, true); return; } } } // Indicate do undo, and do port controller values and clone parts. - //audio->msgAddEvent(event, part); - audio->msgAddEvent(event, part, true, true, true); + //MusEGlobal::audio->msgAddEvent(event, part); + MusEGlobal::audio->msgAddEvent(event, part, true, true, true); } //--------------------------------------------------------- @@ -2602,9 +2607,9 @@ int Song::execAutomationCtlPopup(AudioTrack* track, const QPoint& menupos, int a canAdd = true; //int frame = pos[0].frame(); - int frame = audio->pos().frame(); // Try this. p4.0.33 + int frame = MusEGlobal::audio->pos().frame(); // Try this. p4.0.33 - //printf("pos[0]:%d f:%d tickPos:%d f:%d\n", pos[0].tick(), pos[0].frame(), audio->tickPos(), Pos(audio->tickPos(), true).frame()); + //printf("pos[0]:%d f:%d tickPos:%d f:%d\n", pos[0].tick(), pos[0].frame(), MusEGlobal::audio->tickPos(), Pos(MusEGlobal::audio->tickPos(), true).frame()); //ctlval = cl->curVal(); //AutomationType at = track->MusEGlobal::automationType(); @@ -2635,7 +2640,7 @@ int Song::execAutomationCtlPopup(AudioTrack* track, const QPoint& menupos, int a //menu->setItemEnabled(HEADER, false); //MenuTitleItem* title = new MenuTitleItem(tr("Automation:")); ddskrjo //menu->insertItem(title, HEADER, HEADER); ddskrjo - menu->addAction(new MusEWidget::MenuTitleItem(tr("Automation:"), menu)); + menu->addAction(new MusEGui::MenuTitleItem(tr("Automation:"), menu)); //menu->insertSeparator(SEP1); @@ -2688,29 +2693,29 @@ int Song::execAutomationCtlPopup(AudioTrack* track, const QPoint& menupos, int a switch(sel) { case ADD_EVENT: - audio->msgAddACEvent(track, acid, pos[0].frame(), ctlval); + MusEGlobal::audio->msgAddACEvent(track, acid, pos[0].frame(), ctlval); break; case CLEAR_EVENT: - audio->msgEraseACEvent(track, acid, pos[0].frame()); + MusEGlobal::audio->msgEraseACEvent(track, acid, pos[0].frame()); break; case CLEAR_RANGE: - audio->msgEraseRangeACEvents(track, acid, pos[1].frame(), pos[2].frame()); + MusEGlobal::audio->msgEraseRangeACEvents(track, acid, pos[1].frame(), pos[2].frame()); break; case CLEAR_ALL_EVENTS: if(QMessageBox::question(MusEGlobal::muse, QString("Muse"), tr("Clear all controller events?"), tr("&Ok"), tr("&Cancel"), QString::null, 0, 1 ) == 0) - audio->msgClearControllerEvents(track, acid); + MusEGlobal::audio->msgClearControllerEvents(track, acid); break; case PREV_EVENT: - audio->msgSeekPrevACEvent(track, acid); + MusEGlobal::audio->msgSeekPrevACEvent(track, acid); break; case NEXT_EVENT: - audio->msgSeekNextACEvent(track, acid); + MusEGlobal::audio->msgSeekNextACEvent(track, acid); break; default: @@ -2747,7 +2752,7 @@ int Song::execMidiAutomationCtlPopup(MidiTrack* track, MidiPart* part, const QPo mt = (MidiTrack*)part->track(); int portno = mt->outPort(); int channel = mt->outChannel(); - MidiPort* mp = &midiPorts[portno]; + MidiPort* mp = &MusEGlobal::midiPorts[portno]; int dctl = ctlnum; // Is it a drum controller, according to the track port's instrument? @@ -2757,12 +2762,12 @@ int Song::execMidiAutomationCtlPopup(MidiTrack* track, MidiPart* part, const QPo // Change the controller event's index into the drum map to an instrument note. int note = ctlnum & 0x7f; dctl &= ~0xff; - channel = drumMap[note].channel; - mp = &midiPorts[drumMap[note].port]; - dctl |= drumMap[note].anote; + channel = MusEGlobal::drumMap[note].channel; + mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[note].port]; + dctl |= MusEGlobal::drumMap[note].anote; } - //printf("Song::execMidiAutomationCtlPopup ctlnum:%d dctl:%d anote:%d\n", ctlnum, dctl, drumMap[ctlnum & 0x7f].anote); + //printf("Song::execMidiAutomationCtlPopup ctlnum:%d dctl:%d anote:%d\n", ctlnum, dctl, MusEGlobal::drumMap[ctlnum & 0x7f].anote); unsigned tick = cpos(); @@ -2889,7 +2894,7 @@ int Song::execMidiAutomationCtlPopup(MidiTrack* track, MidiPart* part, const QPo e.setTick(tick - part->tick()); // Indicate do undo, and do port controller values and clone parts. - audio->msgChangeEvent(ev, e, part, true, true, true); + MusEGlobal::audio->msgChangeEvent(ev, e, part, true, true, true); } else { @@ -2898,7 +2903,7 @@ int Song::execMidiAutomationCtlPopup(MidiTrack* track, MidiPart* part, const QPo { e.setTick(tick - part->tick()); // Indicate do undo, and do port controller values and clone parts. - audio->msgAddEvent(e, part, true, true, true); + MusEGlobal::audio->msgAddEvent(e, part, true, true, true); } else { @@ -2912,33 +2917,33 @@ int Song::execMidiAutomationCtlPopup(MidiTrack* track, MidiPart* part, const QPo e.setTick(tick - startTick); part->events()->add(e); // Allow undo. - audio->msgAddPart(part); + MusEGlobal::audio->msgAddPart(part); } } } break; case CLEAR_EVENT: // Indicate do undo, and do port controller values and clone parts. - audio->msgDeleteEvent(ev, part, true, true, true); + MusEGlobal::audio->msgDeleteEvent(ev, part, true, true, true); break; //case CLEAR_RANGE: - //audio->msgEraseRangeACEvents(track, acid, pos[1].frame(), pos[2].frame()); + //MusEGlobal::audio->msgEraseRangeACEvents(track, acid, pos[1].frame(), pos[2].frame()); //break; //case CLEAR_ALL_EVENTS: //if(QMessageBox::question(MusEGlobal::muse, QString("Muse"), // tr("Clear all controller events?"), tr("&Ok"), tr("&Cancel"), // QString::null, 0, 1 ) == 0) - //audio->msgClearControllerEvents(track, acid); + //MusEGlobal::audio->msgClearControllerEvents(track, acid); //break; //case PREV_EVENT: - //audio->msgSeekPrevACEvent(track, acid); + //MusEGlobal::audio->msgSeekPrevACEvent(track, acid); //break; //case NEXT_EVENT: - //audio->msgSeekNextACEvent(track, acid); + //MusEGlobal::audio->msgSeekNextACEvent(track, acid); //break; default: @@ -3000,7 +3005,7 @@ void Song::processAutomationEvents() void Song::abortRolling() { if (record()) - audio->recordStop(); + MusEGlobal::audio->recordStop(); setStopPlay(false); } @@ -3029,7 +3034,7 @@ void Song::connectJackRoutes(AudioTrack* track, bool disconnect) if(!disconnect) ao->setName(ao->name()); // Now reconnect the output routes. - if(MusEGlobal::checkAudioDevice() && audio->isRunning()) + if(MusEGlobal::checkAudioDevice() && MusEGlobal::audio->isRunning()) { for(int ch = 0; ch < ao->channels(); ++ch) { @@ -3040,15 +3045,15 @@ void Song::connectJackRoutes(AudioTrack* track, bool disconnect) if ((r.type == Route::JACK_ROUTE) && (r.channel == ch)) { if(disconnect) - audioDevice->disconnect(ao->jackPort(ch), r.jackPort); + MusEGlobal::audioDevice->disconnect(ao->jackPort(ch), r.jackPort); else - audioDevice->connect(ao->jackPort(ch), r.jackPort); + MusEGlobal::audioDevice->connect(ao->jackPort(ch), r.jackPort); break; } } if(disconnect) { - audioDevice->unregisterPort(ao->jackPort(ch)); + MusEGlobal::audioDevice->unregisterPort(ao->jackPort(ch)); ao->setJackPort(ch, 0); } } @@ -3062,7 +3067,7 @@ void Song::connectJackRoutes(AudioTrack* track, bool disconnect) if(!disconnect) ai->setName(ai->name()); // Now reconnect the input routes. - if(MusEGlobal::checkAudioDevice() && audio->isRunning()) + if(MusEGlobal::checkAudioDevice() && MusEGlobal::audio->isRunning()) { for(int ch = 0; ch < ai->channels(); ++ch) { @@ -3073,15 +3078,15 @@ void Song::connectJackRoutes(AudioTrack* track, bool disconnect) if ((r.type == Route::JACK_ROUTE) && (r.channel == ch)) { if(disconnect) - audioDevice->disconnect(r.jackPort, ai->jackPort(ch)); + MusEGlobal::audioDevice->disconnect(r.jackPort, ai->jackPort(ch)); else - audioDevice->connect(r.jackPort, ai->jackPort(ch)); + MusEGlobal::audioDevice->connect(r.jackPort, ai->jackPort(ch)); break; } } if(disconnect) { - audioDevice->unregisterPort(ai->jackPort(ch)); + MusEGlobal::audioDevice->unregisterPort(ai->jackPort(ch)); ai->setJackPort(ch, 0); } } @@ -3133,13 +3138,13 @@ void Song::chooseMidiRoutes(QButton* parent, MidiTrack* track, bool dst) pup->clear(); gid = 0; - //MidiInPortList* tl = song->midiInPorts(); + //MidiInPortList* tl = MusEGlobal::song->midiInPorts(); //for(iMidiInPort i = tl->begin();i != tl->end(); ++i) for(int i = 0; i < MIDI_PORTS; ++i) { //MidiInPort* track = *i; // NOTE: Could possibly list all devices, bypassing ports, but no, let's stick wth ports. - MidiPort* mp = &midiPorts[i]; + MidiPort* mp = &MusEGlobal::midiPorts[i]; MidiDevice* md = mp->device(); if(!md) continue; @@ -3196,7 +3201,7 @@ void Song::chooseMidiRoutes(QButton* parent, MidiTrack* track, bool dst) // pup->insertItem(titel); // if (!MusEGlobal::checkAudioDevice()) return; -// std::list<QString> ol = audioDevice->outputPorts(); +// std::list<QString> ol = MusEGlobal::audioDevice->outputPorts(); // for (std::list<QString>::iterator ip = ol.begin(); ip != ol.end(); ++ip) { // int id = pup->insertItem(*ip, (gid * 16) + i); // Route dst(*ip, true, i); @@ -3229,7 +3234,7 @@ void Song::chooseMidiRoutes(QButton* parent, MidiTrack* track, bool dst) //if(MusEGlobal::debugMsg) //printf("Song::chooseMidiRoutes mdidx:%d ch:%d\n", mdidx, ch); - MidiPort* mp = &midiPorts[mdidx]; + MidiPort* mp = &MusEGlobal::midiPorts[mdidx]; MidiDevice* md = mp->device(); if(!md) { @@ -3268,12 +3273,12 @@ void Song::chooseMidiRoutes(QButton* parent, MidiTrack* track, bool dst) if(dst) { //printf("Song::chooseMidiRoutes removing route src track name: %s dst device name: %s\n", track->name().toLatin1().constData(), md->name().toLatin1().constData()); - audio->msgRemoveRoute(bRoute, aRoute); + MusEGlobal::audio->msgRemoveRoute(bRoute, aRoute); } else { //printf("Song::chooseMidiRoutes removing route src device name: %s dst track name: %s\n", md->name().toLatin1().constData(), track->name().toLatin1().constData()); - audio->msgRemoveRoute(aRoute, bRoute); + MusEGlobal::audio->msgRemoveRoute(aRoute, bRoute); } } else @@ -3282,19 +3287,19 @@ void Song::chooseMidiRoutes(QButton* parent, MidiTrack* track, bool dst) if(dst) { //printf("Song::chooseMidiRoutes adding route src track name: %s dst device name: %s\n", track->name().toLatin1().constData(), md->name().toLatin1().constData()); - audio->msgAddRoute(bRoute, aRoute); + MusEGlobal::audio->msgAddRoute(bRoute, aRoute); } else { //printf("Song::chooseMidiRoutes adding route src device name: %s dst track name: %s\n", md->name().toLatin1().constData(), track->name().toLatin1().constData()); - audio->msgAddRoute(aRoute, bRoute); + MusEGlobal::audio->msgAddRoute(aRoute, bRoute); } } //printf("Song::chooseMidiRoutes calling msgUpdateSoloStates\n"); - audio->msgUpdateSoloStates(); - //printf("Song::chooseMidiRoutes calling song->update\n"); - song->update(SC_ROUTE); + MusEGlobal::audio->msgUpdateSoloStates(); + //printf("Song::chooseMidiRoutes calling MusEGlobal::song->update\n"); + MusEGlobal::song->update(SC_ROUTE); // p3.3.46 ///goto _redisplay; @@ -3314,7 +3319,7 @@ void Song::chooseMidiRoutes(QButton* parent, MidiTrack* track, bool dst) void Song::insertTrack0(Track* track, int idx) { insertTrack1(track, idx); - insertTrack2(track, idx); // audio->msgInsertTrack(track, idx, false); + insertTrack2(track, idx); // MusEGlobal::audio->msgInsertTrack(track, idx, false); insertTrack3(track, idx); } @@ -3366,15 +3371,15 @@ void Song::insertTrack2(Track* track, int idx) break; case Track::WAVE: - _waves.push_back((WaveTrack*)track); + _waves.push_back((MusECore::WaveTrack*)track); break; case Track::AUDIO_OUTPUT: _outputs.push_back((AudioOutput*)track); // set default master & monitor if not defined - if (audio->audioMaster() == 0) - audio->setMaster((AudioOutput*)track); - if (audio->audioMonitor() == 0) - audio->setMonitor((AudioOutput*)track); + if (MusEGlobal::audio->audioMaster() == 0) + MusEGlobal::audio->setMaster((AudioOutput*)track); + if (MusEGlobal::audio->audioMonitor() == 0) + MusEGlobal::audio->setMonitor((AudioOutput*)track); break; case Track::AUDIO_GROUP: _groups.push_back((AudioGroup*)track); @@ -3388,7 +3393,7 @@ void Song::insertTrack2(Track* track, int idx) case Track::AUDIO_SOFTSYNTH: { SynthI* s = (SynthI*)track; - midiDevices.add(s); + MusEGlobal::midiDevices.add(s); midiInstruments.push_back(s); _synthIs.push_back(s); } @@ -3412,7 +3417,7 @@ void Song::insertTrack2(Track* track, int idx) for (iTrack i = _tracks.begin(); i != _tracks.end(); ++i) { if ((*i)->isMidiTrack()) continue; - WaveTrack* wt = (WaveTrack*)*i; + MusECore::WaveTrack* wt = (MusECore::WaveTrack*)*i; if (wt->hasAuxSend()) { wt->addAuxSend(n); } @@ -3486,14 +3491,14 @@ void Song::insertTrack2(Track* track, int idx) { //printf("Song::insertTrack2 %s in route port:%d\n", track->name().toLatin1().constData(), r->midiPort); // p3.3.50 Route src(track, r->channel); - midiPorts[r->midiPort].outRoutes()->push_back(src); + MusEGlobal::midiPorts[r->midiPort].outRoutes()->push_back(src); } rl = track->outRoutes(); for (ciRoute r = rl->begin(); r != rl->end(); ++r) { //printf("Song::insertTrack2 %s out route port:%d\n", track->name().toLatin1().constData(), r->midiPort); // p3.3.50 Route src(track, r->channel); - midiPorts[r->midiPort].inRoutes()->push_back(src); + MusEGlobal::midiPorts[r->midiPort].inRoutes()->push_back(src); } } else @@ -3550,7 +3555,7 @@ void Song::insertTrack3(Track* /*track*/, int /*idx*/)//prevent compiler warning void Song::removeTrack0(Track* track) { removeTrack1(track); - audio->msgRemoveTrack(track); + MusEGlobal::audio->msgRemoveTrack(track); removeTrack3(track); //delete track; update(SC_TRACK_REMOVED); @@ -3716,14 +3721,14 @@ void Song::removeTrack2(Track* track) { //printf("Song::removeTrack2 %s in route port:%d\n", track->name().toLatin1().constData(), r->midiPort); // p3.3.50 Route src(track, r->channel); - midiPorts[r->midiPort].outRoutes()->removeRoute(src); + MusEGlobal::midiPorts[r->midiPort].outRoutes()->removeRoute(src); } rl = track->outRoutes(); for (ciRoute r = rl->begin(); r != rl->end(); ++r) { //printf("Song::removeTrack2 %s out route port:%d\n", track->name().toLatin1().constData(), r->midiPort); // p3.3.50 Route src(track, r->channel); - midiPorts[r->midiPort].inRoutes()->removeRoute(src); + MusEGlobal::midiPorts[r->midiPort].inRoutes()->removeRoute(src); } } else @@ -3790,7 +3795,7 @@ void Song::executeScript(const char* scriptfile, PartList* parts, int quant, boo // NOTE <tick> <nr> <len in ticks> <velocity> // CONTROLLER <tick> <a> <b> <c> // - song->startUndo(); // undo this entire block + MusEGlobal::song->startUndo(); // undo this entire block for (iPart i = parts->begin(); i != parts->end(); i++) { //const char* tmp = tmpnam(NULL); char tmp[16] = "muse-tmp-XXXXXX"; @@ -3818,11 +3823,11 @@ void Song::executeScript(const char* scriptfile, PartList* parts, int quant, boo fprintf(fp,"NOTE %d %d %d %d\n", ev.tick(), ev.dataA(), ev.lenTick(), ev.dataB()); // Indicate no undo, and do not do port controller values and clone parts. - audio->msgDeleteEvent(ev, part, false, false, false); + MusEGlobal::audio->msgDeleteEvent(ev, part, false, false, false); } else if (ev.type()==Controller) { fprintf(fp,"CONTROLLER %d %d %d %d\n", ev.tick(), ev.dataA(), ev.dataB(), ev.dataC()); // Indicate no undo, and do not do port controller values and clone parts. - audio->msgDeleteEvent(ev, part, false, false, false); + MusEGlobal::audio->msgDeleteEvent(ev, part, false, false, false); } } fclose(fp); @@ -3864,7 +3869,7 @@ void Song::executeScript(const char* scriptfile, PartList* parts, int quant, boo e.setVelo(velo); e.setLenTick(len); // Indicate no undo, and do not do port controller values and clone parts. - audio->msgAddEvent(e, part, false, false, false); + MusEGlobal::audio->msgAddEvent(e, part, false, false, false); } if (line.startsWith("CONTROLLER")) { @@ -3879,7 +3884,7 @@ void Song::executeScript(const char* scriptfile, PartList* parts, int quant, boo e.setB(b); e.setB(c); // Indicate no undo, and do not do port controller values and clone parts. - audio->msgAddEvent(e, part, false, false, false); + MusEGlobal::audio->msgAddEvent(e, part, false, false, false); } } file.close(); @@ -3984,3 +3989,5 @@ void Song::informAboutNewParts(Part* orig, Part* p1, Part* p2, Part* p3, Part* p informAboutNewParts(temp); } + +} // namespace MusECore diff --git a/muse2/muse/song.h b/muse2/muse/song.h index ad77d723..d6d3628c 100644 --- a/muse2/muse/song.h +++ b/muse2/muse/song.h @@ -42,15 +42,15 @@ class QAction; class QFont; class QMenu; +namespace MusECore { + class SynthI; struct MidiMsg; -struct AudioMsg; class Event; class Xml; class Sequencer; class Track; class Part; -class MidiPart; class PartList; class MPEventList; class EventList; @@ -58,7 +58,11 @@ class MarkerList; class Marker; class SNode; +struct AudioMsg; + +class MidiPart; class MidiPort; + class MidiDevice; class AudioPort; class AudioDevice; @@ -426,11 +430,15 @@ class Song : public QObject { void markerChanged(int); void midiPortsChanged(); void midiNote(int pitch, int velo); - void controllerChanged(Track* t); - void newPartsCreated(const std::map< Part*, std::set<Part*> >&); + void controllerChanged(MusECore::Track* t); + void newPartsCreated(const std::map< MusECore::Part*, std::set<MusECore::Part*> >&); }; -extern Song* song; +} // namespace MusECore + +namespace MusEGlobal { +extern MusECore::Song* song; +} #endif diff --git a/muse2/muse/songfile.cpp b/muse2/muse/songfile.cpp index c430ed1e..9efc75bd 100644 --- a/muse2/muse/songfile.cpp +++ b/muse2/muse/songfile.cpp @@ -54,6 +54,15 @@ #include "driver/jackmidi.h" #include "keyevent.h" +namespace MusEGlobal { +//static CloneList cloneList; +//static CloneList copyCloneList; +MusECore::CloneList cloneList; +//CloneList copyCloneList; +} + +namespace MusECore { + //struct ClonePart { //const EventList* el; // const Part* cp; @@ -76,10 +85,6 @@ ClonePart::ClonePart(const Part* p, int i) uuid_generate(uuid); } -//static CloneList cloneList; -//static CloneList copyCloneList; -CloneList cloneList; -//CloneList copyCloneList; /* //--------------------------------------------------------- @@ -88,7 +93,7 @@ CloneList cloneList; void updateCloneList(Part* oPart, Part* nPart) { - for(iClone i = cloneList.begin(); i != cloneList.end(); ++i) + for(iClone i = MusEGlobal::cloneList.begin(); i != MusEGlobal::cloneList.end(); ++i) { if(i->cp == oPart) { @@ -102,7 +107,7 @@ void updateCloneList(PartList* oParts, PartList* nParts) { for(iPart ip = oParts->begin(); ip != oParts->end(); ++ip) { - for(iClone i = cloneList.begin(); i != cloneList.end(); ++i) + for(iClone i = MusEGlobal::cloneList.begin(); i != MusEGlobal::cloneList.end(); ++i) { if(i->cp == oPart) { @@ -120,7 +125,7 @@ void updateCloneList(PartList* oParts, PartList* nParts) void clearClipboardAndCloneList() { //QApplication::clipboard()->clear(QClipboard::Clipboard); - cloneList.clear(); + MusEGlobal::cloneList.clear(); } */ @@ -157,6 +162,7 @@ void NKey::read(Xml& xml) } } + //--------------------------------------------------------- // Scale::write //--------------------------------------------------------- @@ -219,7 +225,7 @@ Part* readXmlPart(Xml& xml, Track* track, bool doClone, bool toTrack) // If an id was found... if(id != -1) { - for(iClone i = cloneList.begin(); i != cloneList.end(); ++i) + for(iClone i = MusEGlobal::cloneList.begin(); i != MusEGlobal::cloneList.end(); ++i) { // Is a matching part found in the clone list? if(i->id == id) @@ -240,7 +246,7 @@ Part* readXmlPart(Xml& xml, Track* track, bool doClone, bool toTrack) // If a uuid was found... if(uuidvalid) { - for(iClone i = cloneList.begin(); i != cloneList.end(); ++i) + for(iClone i = MusEGlobal::cloneList.begin(); i != MusEGlobal::cloneList.end(); ++i) { // Is a matching part found in the clone list? if(uuid_compare(uuid, i->uuid) == 0) @@ -261,8 +267,8 @@ Part* readXmlPart(Xml& xml, Track* track, bool doClone, bool toTrack) // ...else we want to paste to the part's original track. { // Make sure the track exists (has not been deleted). - if((cpt->isMidiTrack() && song->midis()->find(cpt) != song->midis()->end()) || - (cpt->type() == Track::WAVE && song->waves()->find(cpt) != song->waves()->end())) + if((cpt->isMidiTrack() && MusEGlobal::song->midis()->find(cpt) != MusEGlobal::song->midis()->end()) || + (cpt->type() == Track::WAVE && MusEGlobal::song->waves()->find(cpt) != MusEGlobal::song->waves()->end())) track = cpt; else // Track was not found. Try pasting to the given track, as above... @@ -314,7 +320,7 @@ Part* readXmlPart(Xml& xml, Track* track, bool doClone, bool toTrack) if (track->isMidiTrack()) npart = new MidiPart((MidiTrack*)track); else if (track->type() == Track::WAVE) - npart = new WavePart((WaveTrack*)track); + npart = new MusECore::WavePart((MusECore::WaveTrack*)track); else { xml.skip("part"); @@ -331,7 +337,7 @@ Part* readXmlPart(Xml& xml, Track* track, bool doClone, bool toTrack) if(id != -1) { ClonePart ncp(npart, id); - cloneList.push_back(ncp); + MusEGlobal::cloneList.push_back(ncp); } else if(uuidvalid) @@ -339,7 +345,7 @@ Part* readXmlPart(Xml& xml, Track* track, bool doClone, bool toTrack) ClonePart ncp(npart); // New ClonePart creates its own uuid, but we need to replace it. uuid_copy(ncp.uuid, uuid); - cloneList.push_back(ncp); + MusEGlobal::cloneList.push_back(ncp); } } } @@ -417,7 +423,7 @@ Part* readXmlPart(Xml& xml, Track* track, bool doClone, bool toTrack) id = xml.s2().toInt(); //if(id != -1) //{ - // for(iClone i = cloneList.begin(); i != cloneList.end(); ++i) + // for(iClone i = MusEGlobal::cloneList.begin(); i != MusEGlobal::cloneList.end(); ++i) // { // Is a matching part found in the clone list? // if(i->id == id) @@ -442,7 +448,7 @@ Part* readXmlPart(Xml& xml, Track* track, bool doClone, bool toTrack) { uuidvalid = true; /* - for(iClone i = cloneList.begin(); i != cloneList.end(); ++i) + for(iClone i = MusEGlobal::cloneList.begin(); i != MusEGlobal::cloneList.end(); ++i) { // Is a matching part found in the clone list? if(uuid_compare(uuid, i->uuid) == 0) @@ -463,8 +469,8 @@ Part* readXmlPart(Xml& xml, Track* track, bool doClone, bool toTrack) // ...else we want to paste to the part's original track. { // Make sure the track exists (has not been deleted). - if((cpt->isMidiTrack() && song->midis()->find(cpt) != song->midis()->end()) || - (cpt->type() == Track::WAVE && song->waves()->find(cpt) != song->waves()->end())) + if((cpt->isMidiTrack() && MusEGlobal::song->midis()->find(cpt) != MusEGlobal::song->midis()->end()) || + (cpt->type() == Track::WAVE && MusEGlobal::song->waves()->find(cpt) != MusEGlobal::song->waves()->end())) track = cpt; else // Track was not found. Try pasting to the given track, as above... @@ -524,7 +530,7 @@ void Part::write(int level, Xml& xml, bool isCopy, bool forceWavePaths) const if(isCopy) { //for(iClone i = copyCloneList.begin(); i != copyCloneList.end(); ++i) - for(iClone i = cloneList.begin(); i != cloneList.end(); ++i) + for(iClone i = MusEGlobal::cloneList.begin(); i != MusEGlobal::cloneList.end(); ++i) { //if(i->el == el) { if(i->cp->cevents() == el) @@ -539,20 +545,20 @@ void Part::write(int level, Xml& xml, bool isCopy, bool forceWavePaths) const if(uuid_is_null(uuid)) { //id = copyCloneList.size(); - //id = cloneList.size(); + //id = MusEGlobal::cloneList.size(); //ClonePart cp(el, id); //ClonePart cp(this, id); ClonePart cp(this); uuid_copy(uuid, cp.uuid); //copyCloneList.push_back(cp); - cloneList.push_back(cp); + MusEGlobal::cloneList.push_back(cp); } } else { if (el->arefCount() > 1) { - for (iClone i = cloneList.begin(); i != cloneList.end(); ++i) + for (iClone i = MusEGlobal::cloneList.begin(); i != MusEGlobal::cloneList.end(); ++i) { //if (i->el == el) { if (i->cp->cevents() == el) @@ -566,11 +572,11 @@ void Part::write(int level, Xml& xml, bool isCopy, bool forceWavePaths) const if (id == -1) //if(uuid_is_null(id)) { - id = cloneList.size(); + id = MusEGlobal::cloneList.size(); //ClonePart cp(el, id); ClonePart cp(this, id); //ClonePart cp(this); - cloneList.push_back(cp); + MusEGlobal::cloneList.push_back(cp); } } } @@ -711,7 +717,7 @@ void Part::read(Xml& xml, int, bool toTrack) // int newPartOffset if (e.type() == Controller) { MidiTrack* mt = (MidiTrack*)_track; int channel = mt->outChannel(); - MidiPort* mp = &midiPorts[mt->outPort()]; + MidiPort* mp = &MusEGlobal::midiPorts[mt->outPort()]; // tick is relative to part, controller needs an absolute value hence // part offset is added. If newPartOffset was given we use that instead of // the recorded offset! @@ -728,7 +734,7 @@ void Part::read(Xml& xml, int, bool toTrack) // int newPartOffset int note = ctl & 0x7f; ctl &= ~0xff; channel = drumMap[note].channel; - mp = &midiPorts[drumMap[note].port]; + mp = &MusEGlobal::midiPorts[drumMap[note].port]; ctl |= drumMap[note].anote; } } @@ -773,16 +779,16 @@ void Part::read(Xml& xml, int, bool toTrack) // int newPartOffset // clone part if (containsEvents) { - // add to cloneList: + // add to MusEGlobal::cloneList: //ClonePart cp(_events, id); ClonePart cp(this, id); - cloneList.push_back(cp); + MusEGlobal::cloneList.push_back(cp); } else { // replace event list with clone event // list - for (iClone i = cloneList.begin(); - i != cloneList.end(); ++i) { + for (iClone i = MusEGlobal::cloneList.begin(); + i != MusEGlobal::cloneList.end(); ++i) { if (i->id == id) { delete _events; //_events = (EventList*)(i->el); @@ -809,7 +815,7 @@ void Part::read(Xml& xml, int, bool toTrack) // int newPartOffset // we should NOT look them up). Always back up the list, clear it, // read part(s), then restore the list so that paste works after. Part* cp = 0; - for(iClone i = cloneList.begin(); i != cloneList.end(); ++i) + for(iClone i = MusEGlobal::cloneList.begin(); i != MusEGlobal::cloneList.end(); ++i) { if(i->id == id) { @@ -836,7 +842,7 @@ void Part::read(Xml& xml, int, bool toTrack) // int newPartOffset // Add the part to the clone list so that subsequent parts // can look it up and clone from it... ClonePart ncp(this, id); - cloneList.push_back(ncp); + MusEGlobal::cloneList.push_back(ncp); } // Otherwise this part has no matching part in the clone list // and no events of its own. Nothing left to do, we now have @@ -851,7 +857,7 @@ void Part::read(Xml& xml, int, bool toTrack) // int newPartOffset if(uuidvalid) { Part* cp = 0; - for(iClone i = cloneList.begin(); i != cloneList.end(); ++i) + for(iClone i = MusEGlobal::cloneList.begin(); i != MusEGlobal::cloneList.end(); ++i) { if(uuid_compare(uuid, i->uuid) == 0) { @@ -863,8 +869,8 @@ void Part::read(Xml& xml, int, bool toTrack) // int newPartOffset if(cp && !toTrack) { // Make sure the track exists (has not been deleted). - if((cp->track()->isMidiTrack() && song->midis()->find(cp->track()) != song->midis()->end()) || - (cp->track()->type() == Track::WAVE && song->waves()->find(cp->track()) != song->waves()->end())) + if((cp->track()->isMidiTrack() && MusEGlobal::song->midis()->find(cp->track()) != MusEGlobal::song->midis()->end()) || + (cp->track()->type() == Track::WAVE && MusEGlobal::song->waves()->find(cp->track()) != MusEGlobal::song->waves()->end())) setTrack(cp->track()); } // Was a matching part found in the clone list, and was it @@ -893,7 +899,7 @@ void Part::read(Xml& xml, int, bool toTrack) // int newPartOffset ClonePart ncp(this); // New ClonePart creates its own uuid, but we need to replace it. uuid_copy(ncp.uuid, uuid); - cloneList.push_back(ncp); + MusEGlobal::cloneList.push_back(ncp); } } } @@ -959,35 +965,294 @@ QFont Song::readFont(Xml& xml, const char* name) return f; } -namespace MusEApp { +//--------------------------------------------------------- +// readMarker +//--------------------------------------------------------- + +void Song::readMarker(Xml& xml) + { + Marker m; + m.read(xml); + _markerList->add(m); + } //--------------------------------------------------------- -// readPart +// read //--------------------------------------------------------- -Part* MusE::readPart(Xml& xml) +void Song::read(Xml& xml, bool isTemplate) { - Part* part = 0; + MusEGlobal::cloneList.clear(); for (;;) { - Xml::Token token = xml.parse(); + if (MusEGlobal::muse->progress) + MusEGlobal::muse->progress->setValue(MusEGlobal::muse->progress->value()+1); + + Xml::Token token; + token = xml.parse(); const QString& tag = xml.s1(); switch (token) { case Xml::Error: case Xml::End: + return; + case Xml::TagStart: + if (tag == "master") + setMasterFlag(xml.parseInt()); + else if (tag == "info") + songInfoStr = xml.parse1(); + else if (tag == "showinfo") + showSongInfo = xml.parseInt(); + else if (tag == "loop") + setLoop(xml.parseInt()); + else if (tag == "punchin") + setPunchin(xml.parseInt()); + else if (tag == "punchout") + setPunchout(xml.parseInt()); + else if (tag == "record") + setRecord(xml.parseInt()); + else if (tag == "solo") + soloFlag = xml.parseInt(); + else if (tag == "type") + _mtype = MType(xml.parseInt()); + else if (tag == "recmode") + _recMode = xml.parseInt(); + else if (tag == "cycle") + _cycleMode = xml.parseInt(); + else if (tag == "click") + setClick(xml.parseInt()); + else if (tag == "quantize") + _quantize = xml.parseInt(); + else if (tag == "len") + _len = xml.parseInt(); + else if (tag == "follow") + _follow = FollowMode(xml.parseInt()); + else if (tag == "sampleRate") { + int sRate = xml.parseInt(); + if (!isTemplate && MusEGlobal::audioDevice->deviceType() != AudioDevice::DUMMY_AUDIO && sRate != MusEGlobal::sampleRate) + QMessageBox::warning(MusEGlobal::muse,"Wrong sample rate", "The sample rate in this project and the current system setting differs, the project may not work as intended!"); + } + else if (tag == "tempolist") { + MusEGlobal::tempomap.read(xml); + } + else if (tag == "siglist") + ///sigmap.read(xml); + AL::sigmap.read(xml); + else if (tag == "keylist") { + MusEGlobal::keymap.read(xml); + } + else if (tag == "miditrack") { + MidiTrack* track = new MidiTrack(); + track->read(xml); + insertTrack0(track, -1); + } + else if (tag == "drumtrack") { + MidiTrack* track = new MidiTrack(); + track->setType(Track::DRUM); + track->read(xml); + insertTrack0(track, -1); + } + else if (tag == "newdrumtrack") { + MidiTrack* track = new MidiTrack(); + track->setType(Track::NEW_DRUM); + track->read(xml); + insertTrack0(track, -1); + } + else if (tag == "wavetrack") { + MusECore::WaveTrack* track = new MusECore::WaveTrack(); + track->read(xml); + insertTrack0(track,-1); + // Now that the track has been added to the lists in insertTrack2(), + // OSC can find the track and its plugins, and start their native guis if required... + track->showPendingPluginNativeGuis(); + } + else if (tag == "AudioInput") { + AudioInput* track = new AudioInput(); + track->read(xml); + insertTrack0(track,-1); + track->showPendingPluginNativeGuis(); + } + else if (tag == "AudioOutput") { + AudioOutput* track = new AudioOutput(); + track->read(xml); + insertTrack0(track,-1); + track->showPendingPluginNativeGuis(); + } + else if (tag == "AudioGroup") { + AudioGroup* track = new AudioGroup(); + track->read(xml); + insertTrack0(track,-1); + track->showPendingPluginNativeGuis(); + } + else if (tag == "AudioAux") { + AudioAux* track = new AudioAux(); + track->read(xml); + insertTrack0(track,-1); + track->showPendingPluginNativeGuis(); + } + else if (tag == "SynthI") { + SynthI* track = new SynthI(); + track->read(xml); + // Done in SynthI::read() + // insertTrack(track,-1); + //track->showPendingPluginNativeGuis(); + } + else if (tag == "Route") { + readRoute(xml); + } + else if (tag == "marker") + readMarker(xml); + else if (tag == "globalPitchShift") + _globalPitchShift = xml.parseInt(); + else if (tag == "automation") + MusEGlobal::automation = xml.parseInt(); + else if (tag == "cpos") { + int pos = xml.parseInt(); + Pos p(pos, true); + setPos(Song::CPOS, p, false, false, false); + } + else if (tag == "lpos") { + int pos = xml.parseInt(); + Pos p(pos, true); + setPos(Song::LPOS, p, false, false, false); + } + else if (tag == "rpos") { + int pos = xml.parseInt(); + Pos p(pos, true); + setPos(Song::RPOS, p, false, false, false); + } + else if (tag == "drummap") + readDrumMap(xml, false); + else + xml.unknown("Song"); + break; + case Xml::Attribut: + break; + case Xml::TagEnd: + if (tag == "song") { + return; + } + default: + break; + } + } + dirty = false; + + // Since cloneList is also used for copy/paste operations, + // clear the copy clone list again. + MusEGlobal::cloneList.clear(); + } + +//--------------------------------------------------------- +// write +//--------------------------------------------------------- + +void Song::write(int level, Xml& xml) const + { + xml.tag(level++, "song"); + xml.strTag(level, "info", songInfoStr); + xml.intTag(level, "showinfo", showSongInfo); + xml.intTag(level, "automation", MusEGlobal::automation); + xml.intTag(level, "cpos", MusEGlobal::song->cpos()); + xml.intTag(level, "rpos", MusEGlobal::song->rpos()); + xml.intTag(level, "lpos", MusEGlobal::song->lpos()); + xml.intTag(level, "master", _masterFlag); + xml.intTag(level, "loop", loopFlag); + xml.intTag(level, "punchin", punchinFlag); + xml.intTag(level, "punchout", punchoutFlag); + xml.intTag(level, "record", recordFlag); + xml.intTag(level, "solo", soloFlag); + xml.intTag(level, "type", _mtype); + xml.intTag(level, "recmode", _recMode); + xml.intTag(level, "cycle", _cycleMode); + xml.intTag(level, "click", _click); + xml.intTag(level, "quantize", _quantize); + xml.intTag(level, "len", _len); + xml.intTag(level, "follow", _follow); + xml.intTag(level, "sampleRate", MusEGlobal::sampleRate); + if (_globalPitchShift) + xml.intTag(level, "globalPitchShift", _globalPitchShift); + + // Make a backup of the current clone list, to retain any 'copy' items, + // so that pasting works properly after. + CloneList copyCloneList = MusEGlobal::cloneList; + MusEGlobal::cloneList.clear(); + + // write tracks + for (ciTrack i = _tracks.begin(); i != _tracks.end(); ++i) + (*i)->write(level, xml); + + // write routing + for (ciTrack i = _tracks.begin(); i != _tracks.end(); ++i) { + + // p3.3.38 Changed + //if ((*i)->isMidiTrack()) + // continue; + //MusECore::WaveTrack* track = (MusECore::WaveTrack*)(*i); + //track->writeRouting(level, xml); + + (*i)->writeRouting(level, xml); + } + + // Write midi device routing. + for (iMidiDevice i = MusEGlobal::midiDevices.begin(); i != MusEGlobal::midiDevices.end(); ++i) { + //MidiJackDevice* mjd = dynamic_cast<MidiJackDevice*>(*i); + //if (!mjd) + // continue; + //mjd->writeRouting(level, xml); + (*i)->writeRouting(level, xml); + } + + // p3.3.49 Write midi port routing. + for (int i = 0; i < MIDI_PORTS; ++i) { + MusEGlobal::midiPorts[i].writeRouting(level, xml); + } + + MusEGlobal::tempomap.write(level, xml); + ///sigmap.write(level, xml); + AL::sigmap.write(level, xml); + MusEGlobal::keymap.write(level, xml); + _markerList->write(level, xml); + + writeDrumMap(level, xml, false); + xml.tag(level, "/song"); + + // Restore backup of the clone list, to retain any 'copy' items, + // so that pasting works properly after. + MusEGlobal::cloneList.clear(); + MusEGlobal::cloneList = copyCloneList; + } + + +} // namespace MusECore + +namespace MusEGui { + +//--------------------------------------------------------- +// readPart +//--------------------------------------------------------- + +MusECore::Part* MusE::readPart(MusECore::Xml& xml) + { + MusECore::Part* part = 0; + for (;;) { + MusECore::Xml::Token token = xml.parse(); + const QString& tag = xml.s1(); + switch (token) { + case MusECore::Xml::Error: + case MusECore::Xml::End: return part; - case Xml::Text: + case MusECore::Xml::Text: { int trackIdx, partIdx; sscanf(tag.toLatin1().constData(), "%d:%d", &trackIdx, &partIdx); - Track* track = song->tracks()->index(trackIdx); + MusECore::Track* track = MusEGlobal::song->tracks()->index(trackIdx); if (track) part = track->parts()->find(partIdx); } break; - case Xml::TagStart: + case MusECore::Xml::TagStart: xml.unknown("readPart"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "part") return part; default: @@ -1000,19 +1265,19 @@ Part* MusE::readPart(Xml& xml) // readToplevels //--------------------------------------------------------- -void MusE::readToplevels(Xml& xml) +void MusE::readToplevels(MusECore::Xml& xml) { - PartList* pl = new PartList; + MusECore::PartList* pl = new MusECore::PartList; for (;;) { - Xml::Token token = xml.parse(); + MusECore::Xml::Token token = xml.parse(); const QString& tag = xml.s1(); switch (token) { - case Xml::Error: - case Xml::End: + case MusECore::Xml::Error: + case MusECore::Xml::End: return; - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "part") { - Part* part = readPart(xml); + MusECore::Part* part = readPart(xml); if (part) pl->add(part); } @@ -1029,14 +1294,14 @@ void MusE::readToplevels(Xml& xml) { startPianoroll(pl); toplevels.back()->readStatus(xml); - pl = new PartList; + pl = new MusECore::PartList; } } else if (tag == "scoreedit") { - ScoreEdit* score = new ScoreEdit(this, 0, _arranger->cursorValue()); + MusEGui::ScoreEdit* score = new MusEGui::ScoreEdit(this, 0, _arranger->cursorValue()); score->show(); toplevels.push_back(score); - connect(score, SIGNAL(deleted(TopWin*)), SLOT(toplevelDeleted(TopWin*))); + connect(score, SIGNAL(deleted(MusEGui::TopWin*)), SLOT(toplevelDeleted(MusEGui::TopWin*))); connect(score, SIGNAL(name_changed()), SLOT(scoreNamingChanged())); score->readStatus(xml); } @@ -1045,7 +1310,7 @@ void MusE::readToplevels(Xml& xml) { startDrumEditor(pl); toplevels.back()->readStatus(xml); - pl = new PartList; + pl = new MusECore::PartList; } } else if (tag == "listeditor") { @@ -1053,7 +1318,7 @@ void MusE::readToplevels(Xml& xml) { startListEditor(pl); toplevels.back()->readStatus(xml); - pl = new PartList; + pl = new MusECore::PartList; } } else if (tag == "master") { @@ -1066,12 +1331,12 @@ void MusE::readToplevels(Xml& xml) } else if (tag == "marker") { showMarker(true); - if (toplevels.back()->type()==TopWin::MARKER) + if (toplevels.back()->type()==MusEGui::TopWin::MARKER) toplevels.back()->readStatus(xml); } else if (tag == "arrangerview") { showArranger(true); - if (toplevels.back()->type()==TopWin::ARRANGER) + if (toplevels.back()->type()==MusEGui::TopWin::ARRANGER) toplevels.back()->readStatus(xml); } else if (tag == "waveedit") { @@ -1079,20 +1344,20 @@ void MusE::readToplevels(Xml& xml) { startWaveEditor(pl); toplevels.back()->readStatus(xml); - pl = new PartList; + pl = new MusECore::PartList; } } else if (tag == "cliplist") { startClipList(true); - if (toplevels.back()->type()==TopWin::CLIPLIST) + if (toplevels.back()->type()==MusEGui::TopWin::CLIPLIST) toplevels.back()->readStatus(xml); } else xml.unknown("MusE"); break; - case Xml::Attribut: + case MusECore::Xml::Attribut: break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "toplevels") { delete pl; return; @@ -1107,30 +1372,30 @@ void MusE::readToplevels(Xml& xml) // readCtrl //--------------------------------------------------------- -void MusE::readCtrl(Xml&, int /*prt*/, int /*channel*/) +void MusE::readCtrl(MusECore::Xml&, int /*prt*/, int /*channel*/) { #if 0 - ChannelState* iState = midiPorts[prt].iState(channel); + ChannelState* iState = MusEGlobal::midiPorts[prt].iState(channel); int idx = 0; int val = -1; for (;;) { - Xml::Token token = xml.parse(); + MusECore::Xml::Token token = xml.parse(); switch (token) { - case Xml::Error: - case Xml::End: + case MusECore::Xml::Error: + case MusECore::Xml::End: return; - case Xml::TagStart: + case MusECore::Xml::TagStart: xml.unknown("readCtrl"); break; - case Xml::Attribut: + case MusECore::Xml::Attribut: if (xml.s1() == "idx") idx = xml.s2().toInt(); else if (xml.s1() == "val") val = xml.s2().toInt(); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (xml.s1() == "ctrl") { iState->controller[idx] = val; // printf("%d %d ctrl %d val %d\n", prt, channel, idx, val); @@ -1147,19 +1412,19 @@ void MusE::readCtrl(Xml&, int /*prt*/, int /*channel*/) // readMidichannel //--------------------------------------------------------- -void MusE::readMidichannel(Xml& xml, int prt) +void MusE::readMidichannel(MusECore::Xml& xml, int prt) { int channel = 0; -// MidiPort* port = &midiPorts[prt]; +// MidiPort* port = &MusEGlobal::midiPorts[prt]; for (;;) { - Xml::Token token = xml.parse(); + MusECore::Xml::Token token = xml.parse(); const QString& tag = xml.s1(); switch (token) { - case Xml::Error: - case Xml::End: + case MusECore::Xml::Error: + case MusECore::Xml::End: return; - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "pitch") { //TODO port->setCtrl(channel, 0, CTRL_PITCH, xml.parseInt()); } @@ -1172,12 +1437,12 @@ void MusE::readMidichannel(Xml& xml, int prt) xml.unknown("readMidichannel"); } break; - case Xml::Attribut: + case MusECore::Xml::Attribut: if (tag == "ch") { channel = xml.s2().toInt(); } break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "midichannel") return; default: @@ -1190,29 +1455,29 @@ void MusE::readMidichannel(Xml& xml, int prt) // readMidiport //--------------------------------------------------------- -void MusE::readMidiport(Xml& xml) +void MusE::readMidiport(MusECore::Xml& xml) { int port = 0; for (;;) { - Xml::Token token = xml.parse(); + MusECore::Xml::Token token = xml.parse(); const QString& tag = xml.s1(); switch (token) { - case Xml::Error: - case Xml::End: + case MusECore::Xml::Error: + case MusECore::Xml::End: return; - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "midichannel") readMidichannel(xml, port); else { xml.unknown("readMidiport"); } break; - case Xml::Attribut: + case MusECore::Xml::Attribut: if (tag == "port") { port = xml.s2().toInt(); } break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "midiport") { return; } @@ -1227,19 +1492,19 @@ void MusE::readMidiport(Xml& xml) // read song //--------------------------------------------------------- -void MusE::read(Xml& xml, bool skipConfig, bool isTemplate) +void MusE::read(MusECore::Xml& xml, bool skipConfig, bool isTemplate) { bool skipmode = true; for (;;) { if (progress) progress->setValue(progress->value()+1); - Xml::Token token = xml.parse(); + MusECore::Xml::Token token = xml.parse(); const QString& tag = xml.s1(); switch (token) { - case Xml::Error: - case Xml::End: + case MusECore::Xml::Error: + case MusECore::Xml::End: return; - case Xml::TagStart: + case MusECore::Xml::TagStart: if (skipmode && tag == "muse") skipmode = false; else if (skipmode) @@ -1252,13 +1517,13 @@ void MusE::read(Xml& xml, bool skipConfig, bool isTemplate) readConfiguration(xml, false, false /* do NOT read global settings */); else if (tag == "song") { - song->read(xml, isTemplate); - audio->msgUpdateSoloStates(); + MusEGlobal::song->read(xml, isTemplate); + MusEGlobal::audio->msgUpdateSoloStates(); } else if (tag == "midiport") readMidiport(xml); else if (tag == "Controller") { // obsolete - MidiController* ctrl = new MidiController; + MusECore::MidiController* ctrl = new MusECore::MidiController; ctrl->read(xml); delete ctrl; } @@ -1269,14 +1534,14 @@ void MusE::read(Xml& xml, bool skipConfig, bool isTemplate) else xml.unknown("muse"); break; - case Xml::Attribut: + case MusECore::Xml::Attribut: if (tag == "version") { int major = xml.s2().section('.', 0, 0).toInt(); int minor = xml.s2().section('.', 1, 1).toInt(); xml.setVersion(major, minor); } break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (!skipmode && tag == "muse") return; default: @@ -1291,7 +1556,7 @@ void MusE::read(Xml& xml, bool skipConfig, bool isTemplate) // write song //--------------------------------------------------------- -void MusE::write(Xml& xml) const +void MusE::write(MusECore::Xml& xml) const { xml.header(); @@ -1301,11 +1566,11 @@ void MusE::write(Xml& xml) const writeStatusMidiInputTransformPlugins(level, xml); - song->write(level, xml); + MusEGlobal::song->write(level, xml); if (!toplevels.empty()) { xml.tag(level++, "toplevels"); - for (ciToplevel i = toplevels.begin(); i != toplevels.end(); ++i) { + for (MusEGui::ciToplevel i = toplevels.begin(); i != toplevels.end(); ++i) { if ((*i)->isVisible()) (*i)->writeStatus(level, xml); } @@ -1315,262 +1580,5 @@ void MusE::write(Xml& xml) const xml.tag(level, "/muse"); } -} // namespace MusEApp - - -//--------------------------------------------------------- -// readMarker -//--------------------------------------------------------- - -void Song::readMarker(Xml& xml) - { - Marker m; - m.read(xml); - _markerList->add(m); - } - -//--------------------------------------------------------- -// read -//--------------------------------------------------------- - -void Song::read(Xml& xml, bool isTemplate) - { - cloneList.clear(); - for (;;) { - if (MusEGlobal::muse->progress) - MusEGlobal::muse->progress->setValue(MusEGlobal::muse->progress->value()+1); - - Xml::Token token; - token = xml.parse(); - const QString& tag = xml.s1(); - switch (token) { - case Xml::Error: - case Xml::End: - return; - case Xml::TagStart: - if (tag == "master") - setMasterFlag(xml.parseInt()); - else if (tag == "info") - songInfoStr = xml.parse1(); - else if (tag == "showinfo") - showSongInfo = xml.parseInt(); - else if (tag == "loop") - setLoop(xml.parseInt()); - else if (tag == "punchin") - setPunchin(xml.parseInt()); - else if (tag == "punchout") - setPunchout(xml.parseInt()); - else if (tag == "record") - setRecord(xml.parseInt()); - else if (tag == "solo") - soloFlag = xml.parseInt(); - else if (tag == "type") - _mtype = MType(xml.parseInt()); - else if (tag == "recmode") - _recMode = xml.parseInt(); - else if (tag == "cycle") - _cycleMode = xml.parseInt(); - else if (tag == "click") - setClick(xml.parseInt()); - else if (tag == "quantize") - _quantize = xml.parseInt(); - else if (tag == "len") - _len = xml.parseInt(); - else if (tag == "follow") - _follow = FollowMode(xml.parseInt()); - else if (tag == "sampleRate") { - int sRate = xml.parseInt(); - if (!isTemplate && audioDevice->deviceType() != AudioDevice::DUMMY_AUDIO && sRate != MusEGlobal::sampleRate) - QMessageBox::warning(MusEGlobal::muse,"Wrong sample rate", "The sample rate in this project and the current system setting differs, the project may not work as intended!"); - } - else if (tag == "tempolist") { - tempomap.read(xml); - } - else if (tag == "siglist") - ///sigmap.read(xml); - AL::sigmap.read(xml); - else if (tag == "keylist") { - keymap.read(xml); - } - else if (tag == "miditrack") { - MidiTrack* track = new MidiTrack(); - track->read(xml); - insertTrack0(track, -1); - } - else if (tag == "drumtrack") { - MidiTrack* track = new MidiTrack(); - track->setType(Track::DRUM); - track->read(xml); - insertTrack0(track, -1); - } - else if (tag == "newdrumtrack") { - MidiTrack* track = new MidiTrack(); - track->setType(Track::NEW_DRUM); - track->read(xml); - insertTrack0(track, -1); - } - else if (tag == "wavetrack") { - WaveTrack* track = new WaveTrack(); - track->read(xml); - insertTrack0(track,-1); - // Now that the track has been added to the lists in insertTrack2(), - // OSC can find the track and its plugins, and start their native guis if required... - track->showPendingPluginNativeGuis(); - } - else if (tag == "AudioInput") { - AudioInput* track = new AudioInput(); - track->read(xml); - insertTrack0(track,-1); - track->showPendingPluginNativeGuis(); - } - else if (tag == "AudioOutput") { - AudioOutput* track = new AudioOutput(); - track->read(xml); - insertTrack0(track,-1); - track->showPendingPluginNativeGuis(); - } - else if (tag == "AudioGroup") { - AudioGroup* track = new AudioGroup(); - track->read(xml); - insertTrack0(track,-1); - track->showPendingPluginNativeGuis(); - } - else if (tag == "AudioAux") { - AudioAux* track = new AudioAux(); - track->read(xml); - insertTrack0(track,-1); - track->showPendingPluginNativeGuis(); - } - else if (tag == "SynthI") { - SynthI* track = new SynthI(); - track->read(xml); - // Done in SynthI::read() - // insertTrack(track,-1); - //track->showPendingPluginNativeGuis(); - } - else if (tag == "Route") { - readRoute(xml); - } - else if (tag == "marker") - readMarker(xml); - else if (tag == "globalPitchShift") - _globalPitchShift = xml.parseInt(); - else if (tag == "automation") - MusEGlobal::automation = xml.parseInt(); - else if (tag == "cpos") { - int pos = xml.parseInt(); - Pos p(pos, true); - setPos(Song::CPOS, p, false, false, false); - } - else if (tag == "lpos") { - int pos = xml.parseInt(); - Pos p(pos, true); - setPos(Song::LPOS, p, false, false, false); - } - else if (tag == "rpos") { - int pos = xml.parseInt(); - Pos p(pos, true); - setPos(Song::RPOS, p, false, false, false); - } - else if (tag == "drummap") - readDrumMap(xml, false); - else - xml.unknown("Song"); - break; - case Xml::Attribut: - break; - case Xml::TagEnd: - if (tag == "song") { - return; - } - default: - break; - } - } - dirty = false; - - // Since cloneList is also used for copy/paste operations, - // clear the copy clone list again. - cloneList.clear(); - } - -//--------------------------------------------------------- -// write -//--------------------------------------------------------- - -void Song::write(int level, Xml& xml) const - { - xml.tag(level++, "song"); - xml.strTag(level, "info", songInfoStr); - xml.intTag(level, "showinfo", showSongInfo); - xml.intTag(level, "automation", MusEGlobal::automation); - xml.intTag(level, "cpos", song->cpos()); - xml.intTag(level, "rpos", song->rpos()); - xml.intTag(level, "lpos", song->lpos()); - xml.intTag(level, "master", _masterFlag); - xml.intTag(level, "loop", loopFlag); - xml.intTag(level, "punchin", punchinFlag); - xml.intTag(level, "punchout", punchoutFlag); - xml.intTag(level, "record", recordFlag); - xml.intTag(level, "solo", soloFlag); - xml.intTag(level, "type", _mtype); - xml.intTag(level, "recmode", _recMode); - xml.intTag(level, "cycle", _cycleMode); - xml.intTag(level, "click", _click); - xml.intTag(level, "quantize", _quantize); - xml.intTag(level, "len", _len); - xml.intTag(level, "follow", _follow); - xml.intTag(level, "sampleRate", MusEGlobal::sampleRate); - if (_globalPitchShift) - xml.intTag(level, "globalPitchShift", _globalPitchShift); - - // Make a backup of the current clone list, to retain any 'copy' items, - // so that pasting works properly after. - CloneList copyCloneList = cloneList; - cloneList.clear(); - - // write tracks - for (ciTrack i = _tracks.begin(); i != _tracks.end(); ++i) - (*i)->write(level, xml); - - // write routing - for (ciTrack i = _tracks.begin(); i != _tracks.end(); ++i) { - - // p3.3.38 Changed - //if ((*i)->isMidiTrack()) - // continue; - //WaveTrack* track = (WaveTrack*)(*i); - //track->writeRouting(level, xml); - - (*i)->writeRouting(level, xml); - } - - // Write midi device routing. - for (iMidiDevice i = midiDevices.begin(); i != midiDevices.end(); ++i) { - //MidiJackDevice* mjd = dynamic_cast<MidiJackDevice*>(*i); - //if (!mjd) - // continue; - //mjd->writeRouting(level, xml); - (*i)->writeRouting(level, xml); - } - - // p3.3.49 Write midi port routing. - for (int i = 0; i < MIDI_PORTS; ++i) { - midiPorts[i].writeRouting(level, xml); - } - - tempomap.write(level, xml); - ///sigmap.write(level, xml); - AL::sigmap.write(level, xml); - keymap.write(level, xml); - _markerList->write(level, xml); - - writeDrumMap(level, xml, false); - xml.tag(level, "/song"); - - // Restore backup of the clone list, to retain any 'copy' items, - // so that pasting works properly after. - cloneList.clear(); - cloneList = copyCloneList; - } +} // namespace MusEGui diff --git a/muse2/muse/steprec.cpp b/muse2/muse/steprec.cpp index a7a7546f..ea3feae7 100644 --- a/muse2/muse/steprec.cpp +++ b/muse2/muse/steprec.cpp @@ -33,6 +33,8 @@ #define CHORD_TIMEOUT 75 +namespace MusECore { + StepRec::StepRec(bool* note_held_down_array) { note_held_down=note_held_down_array; @@ -46,16 +48,16 @@ StepRec::StepRec(bool* note_held_down_array) void StepRec::timeout() { - if (chord_timer_set_to_tick != song->cpos()) + if (chord_timer_set_to_tick != MusEGlobal::song->cpos()) { Pos p(chord_timer_set_to_tick, true); - song->setPos(0, p, true, false, true); + MusEGlobal::song->setPos(0, p, true, false, true); } } void StepRec::record(Part* part, int pitch, int len, int step, int velo, bool ctrl, bool shift) { - unsigned tick = song->cpos(); + unsigned tick = MusEGlobal::song->cpos(); unsigned lasttick=0; Undo operations; @@ -100,7 +102,7 @@ void StepRec::record(Part* part, int pitch, int len, int step, int velo, bool ct Event ev = i->second; if (ev.isNote() && ev.pitch() == pitch) { - audio->msgDeleteEvent(ev, part, true, false, false); + MusEGlobal::audio->msgDeleteEvent(ev, part, true, false, false); if (!shift) { @@ -180,8 +182,8 @@ void StepRec::record(Part* part, int pitch, int len, int step, int velo, bool ct chord_timer->stop(); // simply proceed, inserting a rest - Pos p(song->cpos() + step, true); - song->setPos(0, p, true, false, true); + Pos p(MusEGlobal::song->cpos() + step, true); + MusEGlobal::song->setPos(0, p, true, false, true); return; } @@ -193,6 +195,8 @@ void StepRec::record(Part* part, int pitch, int len, int step, int velo, bool ct if (lasttick > part->lenTick()) // we have to expand the part? schedule_resize_all_same_len_clone_parts(part, lasttick, operations); - song->applyOperationGroup(operations); + MusEGlobal::song->applyOperationGroup(operations); } } + +} // namespace MusECore diff --git a/muse2/muse/steprec.h b/muse2/muse/steprec.h index 0f8e046f..ba42c49c 100644 --- a/muse2/muse/steprec.h +++ b/muse2/muse/steprec.h @@ -28,6 +28,7 @@ #include "part.h" +namespace MusECore { class StepRec : public QObject { @@ -47,4 +48,6 @@ class StepRec : public QObject bool* note_held_down; }; +} // namespace MusECore + #endif diff --git a/muse2/muse/stringparam.cpp b/muse2/muse/stringparam.cpp index 21889945..a85f61d0 100644 --- a/muse2/muse/stringparam.cpp +++ b/muse2/muse/stringparam.cpp @@ -23,6 +23,8 @@ #include "stringparam.h" #include "xml.h" + +namespace MusECore { //--------------------------------------------------------- // findKey @@ -112,3 +114,4 @@ void StringParamMap::write(int level, Xml& xml, const char* name) const xml.tag(level, "%s name=\"%s\" val=\"%s\"/", name, r->first.c_str(), r->second.c_str()); } +} // namespace MusECore diff --git a/muse2/muse/stringparam.h b/muse2/muse/stringparam.h index fb004d24..448c61b6 100644 --- a/muse2/muse/stringparam.h +++ b/muse2/muse/stringparam.h @@ -28,6 +28,9 @@ #include <map> class QString; + +namespace MusECore { + class Xml; //typedef std::pair<std::string, std::string > StringParamMapItem; @@ -47,5 +50,6 @@ class StringParamMap : public std::map<std::string, std::string > void write(int /*level*/, Xml& /*xml*/, const char* /*name*/) const; }; +} // namespace MusECore #endif //__STRINGPARAM_H__ diff --git a/muse2/muse/structure.cpp b/muse2/muse/structure.cpp index 6c9d25dd..90d02908 100644 --- a/muse2/muse/structure.cpp +++ b/muse2/muse/structure.cpp @@ -37,6 +37,8 @@ #include <set> using std::set; +namespace MusECore { + //--------------------------------------------------------- // adjustGlobalLists // helper that adjusts tempo, sig, key and marker @@ -46,9 +48,9 @@ using std::set; void adjustGlobalLists(Undo& operations, int startPos, int diff) { - const TempoList* t = &tempomap; + const TempoList* t = &MusEGlobal::tempomap; const AL::SigList* s = &AL::sigmap; - const KeyList* k = &keymap; + const KeyList* k = &MusEGlobal::keymap; criTEvent it = t->rbegin(); AL::criSigEvent is = s->rbegin(); @@ -106,7 +108,7 @@ void adjustGlobalLists(Undo& operations, int startPos, int diff) } } - MarkerList *markerlist = song->marker(); + MarkerList *markerlist = MusEGlobal::song->marker(); for(iMarker i = markerlist->begin(); i != markerlist->end(); ++i) { Marker* m = &i->second; @@ -137,13 +139,13 @@ void adjustGlobalLists(Undo& operations, int startPos, int diff) void globalCut() { - int lpos = song->lpos(); - int rpos = song->rpos(); + int lpos = MusEGlobal::song->lpos(); + int rpos = MusEGlobal::song->rpos(); if ((lpos - rpos) >= 0) return; Undo operations; - TrackList* tracks = song->tracks(); + TrackList* tracks = MusEGlobal::song->tracks(); bool at_least_one_selected=false; for (iTrack it = tracks->begin(); it != tracks->end(); ++it) @@ -234,7 +236,7 @@ void globalCut() int diff = lpos - rpos; adjustGlobalLists(operations, lpos, diff); - song->applyOperationGroup(operations); + MusEGlobal::song->applyOperationGroup(operations); } //--------------------------------------------------------- @@ -246,8 +248,8 @@ void globalCut() void globalInsert() { - Undo operations=movePartsTotheRight(song->lpos(), song->rpos()-song->lpos(), true); - song->applyOperationGroup(operations); + Undo operations=movePartsTotheRight(MusEGlobal::song->lpos(), MusEGlobal::song->rpos()-MusEGlobal::song->lpos(), true); + MusEGlobal::song->applyOperationGroup(operations); } @@ -257,7 +259,7 @@ Undo movePartsTotheRight(unsigned int startTicks, int moveTicks, bool only_selec return Undo(); Undo operations; - TrackList* tracks = song->tracks(); + TrackList* tracks = MusEGlobal::song->tracks(); bool at_least_one_selected=false; for (iTrack it = tracks->begin(); it != tracks->end(); ++it) @@ -317,9 +319,9 @@ Undo movePartsTotheRight(unsigned int startTicks, int moveTicks, bool only_selec void globalSplit() { - int pos = song->cpos(); + int pos = MusEGlobal::song->cpos(); Undo operations; - TrackList* tracks = song->tracks(); + TrackList* tracks = MusEGlobal::song->tracks(); bool at_least_one_selected=false; for (iTrack it = tracks->begin(); it != tracks->end(); ++it) @@ -344,17 +346,18 @@ void globalSplit() Part* p2; track->splitPart(part, pos, p1, p2); - p1->events()->incARef(-1); // the later song->applyOperationGroup() will increment it + p1->events()->incARef(-1); // the later MusEGlobal::song->applyOperationGroup() will increment it p2->events()->incARef(-1); // so we must decrement it first :/ - //song->informAboutNewParts(part, p1); // is unneccessary because of ModifyPart - song->informAboutNewParts(part, p2); + //MusEGlobal::song->informAboutNewParts(part, p1); // is unneccessary because of ModifyPart + MusEGlobal::song->informAboutNewParts(part, p2); operations.push_back(UndoOp(UndoOp::ModifyPart,part, p1, true, false)); operations.push_back(UndoOp(UndoOp::AddPart,p2)); break; } } } - song->applyOperationGroup(operations); + MusEGlobal::song->applyOperationGroup(operations); } +} // namespace MusECore diff --git a/muse2/muse/structure.h b/muse2/muse/structure.h index 38be034b..b92c4e14 100644 --- a/muse2/muse/structure.h +++ b/muse2/muse/structure.h @@ -26,9 +26,12 @@ #include "undo.h" #include <set> +namespace MusECore { Undo movePartsTotheRight(unsigned int startTick, int moveTick, bool only_selected=false, std::set<Track*>* tracklist=NULL); void adjustGlobalLists(Undo& operations, int startPos, int diff); void globalCut(); void globalInsert(); void globalSplit(); +} + #endif diff --git a/muse2/muse/sync.cpp b/muse2/muse/sync.cpp index 66055aab..5cdc9729 100644 --- a/muse2/muse/sync.cpp +++ b/muse2/muse/sync.cpp @@ -36,6 +36,8 @@ #include "xml.h" #include "midi.h" +namespace MusEGlobal { + //int rxSyncPort = -1; // receive from all ports //int txSyncPort = 1; //int rxDeviceId = 0x7f; // any device @@ -46,18 +48,18 @@ int volatile curMidiSyncInPort = -1; bool debugSync = false; int mtcType = 1; -MTC mtcOffset; -BValue extSyncFlag(0, "extSync"); // false - MASTER, true - SLAVE +MusECore::MTC mtcOffset; +MusECore::BValue extSyncFlag(0, "extSync"); // false - MASTER, true - SLAVE //bool genMTCSync = false; // output MTC Sync //bool genMCSync = false; // output MidiClock Sync //bool genMMC = false; // output Midi Machine Control //bool acceptMTC = false; //bool acceptMC = true; //bool acceptMMC = true; -BValue useJackTransport(0,"useJackTransport"); +MusECore::BValue useJackTransport(0,"useJackTransport"); bool volatile jackTransportMaster = true; -static MTC mtcCurTime; +static MusECore::MTC mtcCurTime; static int mtcState; // 0-7 next expected quarter message static bool mtcValid; static int mtcLost; @@ -83,6 +85,10 @@ double volatile lastExtMidiSyncTime = 0.0; ... So all shared global variables should be declared volatile */ unsigned int volatile midiExtSyncTicks = 0; +} // namespace MusEGlobal + +namespace MusECore { + //--------------------------------------------------------- // MidiSyncInfo //--------------------------------------------------------- @@ -195,7 +201,7 @@ void MidiSyncInfo::setTime() // Note: CurTime() makes a system call to gettimeofday(), // which apparently can be slow in some cases. So I avoid calling this function // too frequently by calling it (at the heartbeat rate) in Song::beat(). T356 - double t = MusEUtil::curTime(); + double t = curTime(); if(_clockTrig) { @@ -207,8 +213,8 @@ void MidiSyncInfo::setTime() { _clockDetect = false; // Give up the current midi sync in port number if we took it... - if(curMidiSyncInPort == _port) - curMidiSyncInPort = -1; + if(MusEGlobal::curMidiSyncInPort == _port) + MusEGlobal::curMidiSyncInPort = -1; } if(_tickTrig) @@ -230,8 +236,8 @@ void MidiSyncInfo::setTime() { _MRTDetect = false; // Give up the current midi sync in port number if we took it... - //if(curMidiSyncInPort == _port) - // curMidiSyncInPort = -1; + //if(MusEGlobal::curMidiSyncInPort == _port) + // MusEGlobal::curMidiSyncInPort = -1; } if(_MMCTrig) @@ -244,8 +250,8 @@ void MidiSyncInfo::setTime() { _MMCDetect = false; // Give up the current midi sync in port number if we took it... - //if(curMidiSyncInPort == _port) - // curMidiSyncInPort = -1; + //if(MusEGlobal::curMidiSyncInPort == _port) + // MusEGlobal::curMidiSyncInPort = -1; } if(_MTCTrig) @@ -258,8 +264,8 @@ void MidiSyncInfo::setTime() { _MTCDetect = false; // Give up the current midi sync in port number if we took it... - if(curMidiSyncInPort == _port) - curMidiSyncInPort = -1; + if(MusEGlobal::curMidiSyncInPort == _port) + MusEGlobal::curMidiSyncInPort = -1; } for(int i = 0; i < MIDI_CHANNELS; i++) @@ -287,8 +293,8 @@ void MidiSyncInfo::setMCIn(const bool v) { _recMC = v; // If sync receive was turned off, clear the current midi sync in port number so another port can grab it. - if(!_recMC && _port != -1 && curMidiSyncInPort == _port) - curMidiSyncInPort = -1; + if(!_recMC && _port != -1 && MusEGlobal::curMidiSyncInPort == _port) + MusEGlobal::curMidiSyncInPort = -1; } //--------------------------------------------------------- @@ -299,8 +305,8 @@ void MidiSyncInfo::setMRTIn(const bool v) { _recMRT = v; // If sync receive was turned off, clear the current midi sync in port number so another port can grab it. - //if(!_recMRT && _port != -1 && curMidiSyncInPort == _port) - // curMidiSyncInPort = -1; + //if(!_recMRT && _port != -1 && MusEGlobal::curMidiSyncInPort == _port) + // MusEGlobal::curMidiSyncInPort = -1; } //--------------------------------------------------------- @@ -311,8 +317,8 @@ void MidiSyncInfo::setMMCIn(const bool v) { _recMMC = v; // If sync receive was turned off, clear the current midi sync in port number so another port can grab it. - //if(!_recMMC && _port != -1 && curMidiSyncInPort == _port) - // curMidiSyncInPort = -1; + //if(!_recMMC && _port != -1 && MusEGlobal::curMidiSyncInPort == _port) + // MusEGlobal::curMidiSyncInPort = -1; } //--------------------------------------------------------- @@ -323,8 +329,8 @@ void MidiSyncInfo::setMTCIn(const bool v) { _recMTC = v; // If sync receive was turned off, clear the current midi sync in port number so another port can grab it. - if(!_recMTC && _port != -1 && curMidiSyncInPort == _port) - curMidiSyncInPort = -1; + if(!_recMTC && _port != -1 && MusEGlobal::curMidiSyncInPort == _port) + MusEGlobal::curMidiSyncInPort = -1; } //--------------------------------------------------------- @@ -336,8 +342,8 @@ void MidiSyncInfo::trigMCSyncDetect() _clockDetect = true; _clockTrig = true; // Set the current midi sync in port number if it's not taken... - if(_recMC && curMidiSyncInPort == -1) - curMidiSyncInPort = _port; + if(_recMC && MusEGlobal::curMidiSyncInPort == -1) + MusEGlobal::curMidiSyncInPort = _port; } //--------------------------------------------------------- @@ -359,8 +365,8 @@ void MidiSyncInfo::trigMRTDetect() _MRTDetect = true; _MRTTrig = true; // Set the current midi sync in port number if it's not taken... - //if(_recMRT && curMidiSyncInPort == -1) - // curMidiSyncInPort = _port; + //if(_recMRT && MusEGlobal::curMidiSyncInPort == -1) + // MusEGlobal::curMidiSyncInPort = _port; } //--------------------------------------------------------- @@ -372,8 +378,8 @@ void MidiSyncInfo::trigMMCDetect() _MMCDetect = true; _MMCTrig = true; // Set the current midi sync in port number if it's not taken... - //if(_recMMC && curMidiSyncInPort == -1) - // curMidiSyncInPort = _port; + //if(_recMMC && MusEGlobal::curMidiSyncInPort == -1) + // MusEGlobal::curMidiSyncInPort = _port; } //--------------------------------------------------------- @@ -385,8 +391,8 @@ void MidiSyncInfo::trigMTCDetect() _MTCDetect = true; _MTCTrig = true; // Set the current midi sync in port number if it's not taken... - if(_recMTC && curMidiSyncInPort == -1) - curMidiSyncInPort = _port; + if(_recMTC && MusEGlobal::curMidiSyncInPort == -1) + MusEGlobal::curMidiSyncInPort = _port; } //--------------------------------------------------------- @@ -538,11 +544,11 @@ void MidiSyncInfo::write(int level, Xml& xml) //void MidiSeq::mmcInput(const unsigned char* p, int n) void MidiSeq::mmcInput(int port, const unsigned char* p, int n) { - if (debugSync) + if (MusEGlobal::debugSync) printf("mmcInput: n:%d %02x %02x %02x %02x\n", n, p[2], p[3], p[4], p[5]); - MidiPort* mp = &midiPorts[port]; + MidiPort* mp = &MusEGlobal::midiPorts[port]; MidiSyncInfo& msync = mp->syncInfo(); // Trigger MMC detect in. msync.trigMMCDetect(); @@ -554,59 +560,59 @@ void MidiSeq::mmcInput(int port, const unsigned char* p, int n) if(!msync.MMCIn()) return; - //if (!(extSyncFlag.value() && acceptMMC)) - //if(!extSyncFlag.value()) + //if (!(MusEGlobal::extSyncFlag.value() && acceptMMC)) + //if(!MusEGlobal::extSyncFlag.value()) // return; switch(p[3]) { case 1: - if (debugSync) + if (MusEGlobal::debugSync) printf(" MMC: STOP\n"); - playPendingFirstClock = false; + MusEGlobal::playPendingFirstClock = false; //if ((state == PLAY || state == PRECOUNT)) - if (audio->isPlaying()) - audio->msgPlay(false); + if (MusEGlobal::audio->isPlaying()) + MusEGlobal::audio->msgPlay(false); playStateExt = false; alignAllTicks(); //stopPlay(); break; case 2: - if (debugSync) + if (MusEGlobal::debugSync) printf(" MMC: PLAY\n"); case 3: - if (debugSync) + if (MusEGlobal::debugSync) printf(" MMC: DEFERRED PLAY\n"); - mtcState = 0; - mtcValid = false; - mtcLost = 0; - mtcSync = false; + MusEGlobal::mtcState = 0; + MusEGlobal::mtcValid = false; + MusEGlobal::mtcLost = 0; + MusEGlobal::mtcSync = false; //startPlay(); alignAllTicks(); - audio->msgPlay(true); + MusEGlobal::audio->msgPlay(true); playStateExt = true; break; case 4: printf("MMC: FF not implemented\n"); - playPendingFirstClock = false; + MusEGlobal::playPendingFirstClock = false; break; case 5: printf("MMC: REWIND not implemented\n"); - playPendingFirstClock = false; + MusEGlobal::playPendingFirstClock = false; break; case 6: printf("MMC: REC STROBE not implemented\n"); - playPendingFirstClock = false; + MusEGlobal::playPendingFirstClock = false; break; case 7: printf("MMC: REC EXIT not implemented\n"); - playPendingFirstClock = false; + MusEGlobal::playPendingFirstClock = false; break; case 0xd: printf("MMC: RESET not implemented\n"); - playPendingFirstClock = false; + MusEGlobal::playPendingFirstClock = false; break; case 0x44: if (p[5] == 0) { @@ -617,17 +623,17 @@ void MidiSeq::mmcInput(int port, const unsigned char* p, int n) if (!MusEGlobal::checkAudioDevice()) return; MTC mtc(p[6] & 0x1f, p[7], p[8], p[9], p[10]); int type = (p[6] >> 5) & 3; - //int mmcPos = tempomap.frame2tick(lrint(mtc.time()*MusEGlobal::sampleRate)); + //int mmcPos = MusEGlobal::tempomap.frame2tick(lrint(mtc.time()*MusEGlobal::sampleRate)); //int mmcPos = lrint(mtc.time()*MusEGlobal::sampleRate); int mmcPos = lrint(mtc.time(type) * MusEGlobal::sampleRate); //Pos tp(mmcPos, true); Pos tp(mmcPos, false); - //audioDevice->seekTransport(tp.frame()); - audioDevice->seekTransport(tp); + //MusEGlobal::audioDevice->seekTransport(tp.frame()); + MusEGlobal::audioDevice->seekTransport(tp); alignAllTicks(); //seek(tp); - if (debugSync) { + if (MusEGlobal::debugSync) { //printf("MMC: %f %d seek ", mtc.time(), mmcPos); printf("MMC: LOCATE mtc type:%d time:%lf frame:%d mtc: ", type, mtc.time(), mmcPos); mtc.print(); @@ -658,9 +664,9 @@ void MidiSeq::mtcInputQuarter(int port, unsigned char c) int valH = valL << 4; int _state = (c & 0x70) >> 4; - if (mtcState != _state) - mtcLost += _state - mtcState; - mtcState = _state + 1; + if (MusEGlobal::mtcState != _state) + MusEGlobal::mtcLost += _state - MusEGlobal::mtcState; + MusEGlobal::mtcState = _state + 1; switch(_state) { case 7: @@ -694,36 +700,36 @@ void MidiSeq::mtcInputQuarter(int port, unsigned char c) int type = (hour >> 5) & 3; hour &= 0x1f; - if(mtcState == 8) + if(MusEGlobal::mtcState == 8) { - mtcValid = (mtcLost == 0); - mtcState = 0; - mtcLost = 0; - if(mtcValid) + MusEGlobal::mtcValid = (MusEGlobal::mtcLost == 0); + MusEGlobal::mtcState = 0; + MusEGlobal::mtcLost = 0; + if(MusEGlobal::mtcValid) { - mtcCurTime.set(hour, min, sec, frame); + MusEGlobal::mtcCurTime.set(hour, min, sec, frame); if(port != -1) { - MidiPort* mp = &midiPorts[port]; + MidiPort* mp = &MusEGlobal::midiPorts[port]; MidiSyncInfo& msync = mp->syncInfo(); msync.setRecMTCtype(type); msync.trigMTCDetect(); // Not for the current in port? External sync not turned on? MTC in not turned on? Forget it. - if(port == curMidiSyncInPort && extSyncFlag.value() && msync.MTCIn()) + if(port == MusEGlobal::curMidiSyncInPort && MusEGlobal::extSyncFlag.value() && msync.MTCIn()) { - if(debugSync) + if(MusEGlobal::debugSync) printf("MidiSeq::mtcInputQuarter hour byte:%hx\n", tmphour); - mtcSyncMsg(mtcCurTime, type, !mtcSync); + mtcSyncMsg(MusEGlobal::mtcCurTime, type, !MusEGlobal::mtcSync); } } - mtcSync = true; + MusEGlobal::mtcSync = true; } } - else if (mtcValid && (mtcLost == 0)) + else if (MusEGlobal::mtcValid && (MusEGlobal::mtcLost == 0)) { - //mtcCurTime.incQuarter(); - mtcCurTime.incQuarter(type); - //mtcSyncMsg(mtcCurTime, type, false); + //MusEGlobal::mtcCurTime.incQuarter(); + MusEGlobal::mtcCurTime.incQuarter(type); + //MusEGlobal::mtcSyncMsg(MusEGlobal::mtcCurTime, type, false); } } @@ -735,15 +741,15 @@ void MidiSeq::mtcInputQuarter(int port, unsigned char c) //void MidiSeq::mtcInputFull(const unsigned char* p, int n) void MidiSeq::mtcInputFull(int port, const unsigned char* p, int n) { - if (debugSync) + if (MusEGlobal::debugSync) printf("mtcInputFull\n"); - //if (!extSyncFlag.value()) + //if (!MusEGlobal::extSyncFlag.value()) // return; if (p[3] != 1) { if (p[3] != 2) { // silently ignore user bits printf("unknown mtc msg subtype 0x%02x\n", p[3]); - MusEUtil::dump(p, n); + dump(p, n); } return; } @@ -758,27 +764,27 @@ void MidiSeq::mtcInputFull(int port, const unsigned char* p, int n) int type = (hour >> 5) & 3; hour &= 0x1f; - mtcCurTime.set(hour, min, sec, frame); - mtcState = 0; - mtcValid = true; - mtcLost = 0; + MusEGlobal::mtcCurTime.set(hour, min, sec, frame); + MusEGlobal::mtcState = 0; + MusEGlobal::mtcValid = true; + MusEGlobal::mtcLost = 0; // Added by Tim. - if(debugSync) - printf("mtcInputFull: time:%lf stime:%lf hour byte (all bits):%hx\n", mtcCurTime.time(), mtcCurTime.time(type), p[4]); + if(MusEGlobal::debugSync) + printf("mtcInputFull: time:%lf stime:%lf hour byte (all bits):%hx\n", MusEGlobal::mtcCurTime.time(), MusEGlobal::mtcCurTime.time(type), p[4]); if(port != -1) { - MidiPort* mp = &midiPorts[port]; + MidiPort* mp = &MusEGlobal::midiPorts[port]; MidiSyncInfo& msync = mp->syncInfo(); msync.setRecMTCtype(type); msync.trigMTCDetect(); // MTC in not turned on? Forget it. - //if(extSyncFlag.value() && msync.MTCIn()) + //if(MusEGlobal::extSyncFlag.value() && msync.MTCIn()) if(msync.MTCIn()) { - //Pos tp(lrint(mtcCurTime.time() * MusEGlobal::sampleRate), false); - Pos tp(lrint(mtcCurTime.time(type) * MusEGlobal::sampleRate), false); - audioDevice->seekTransport(tp); + //Pos tp(lrint(MusEGlobal::mtcCurTime.time() * MusEGlobal::sampleRate), false); + Pos tp(lrint(MusEGlobal::mtcCurTime.time(type) * MusEGlobal::sampleRate), false); + MusEGlobal::audioDevice->seekTransport(tp); alignAllTicks(); } } @@ -798,7 +804,7 @@ void MidiSeq::nonRealtimeSystemSysex(int /*port*/, const unsigned char* p, int n break; default: printf("unknown NRT Msg 0x%02x\n", p[3]); - MusEUtil::dump(p, n); + dump(p, n); break; } } @@ -816,33 +822,33 @@ void MidiSeq::setSongPosition(int port, int midiBeat) if (MusEGlobal::midiInputTrace) printf("set song position port:%d %d\n", port, midiBeat); - //midiPorts[port].syncInfo().trigMCSyncDetect(); - midiPorts[port].syncInfo().trigMRTDetect(); + //MusEGlobal::midiPorts[port].syncInfo().trigMCSyncDetect(); + MusEGlobal::midiPorts[port].syncInfo().trigMRTDetect(); - //if (!extSyncFlag.value()) + //if (!MusEGlobal::extSyncFlag.value()) // External sync not on? Clock in not turned on? - //if(!extSyncFlag.value() || !midiPorts[port].syncInfo().MCIn()) - if(!extSyncFlag.value() || !midiPorts[port].syncInfo().MRTIn()) + //if(!MusEGlobal::extSyncFlag.value() || !MusEGlobal::midiPorts[port].syncInfo().MCIn()) + if(!MusEGlobal::extSyncFlag.value() || !MusEGlobal::midiPorts[port].syncInfo().MRTIn()) return; // Re-transmit song position to other devices if clock out turned on. for(int p = 0; p < MIDI_PORTS; ++p) - //if(p != port && midiPorts[p].syncInfo().MCOut()) - if(p != port && midiPorts[p].syncInfo().MRTOut()) - midiPorts[p].sendSongpos(midiBeat); + //if(p != port && MusEGlobal::midiPorts[p].syncInfo().MCOut()) + if(p != port && MusEGlobal::midiPorts[p].syncInfo().MRTOut()) + MusEGlobal::midiPorts[p].sendSongpos(midiBeat); - curExtMidiSyncTick = (MusEConfig::config.division * midiBeat) / 4; - lastExtMidiSyncTick = curExtMidiSyncTick; + MusEGlobal::curExtMidiSyncTick = (MusEGlobal::config.division * midiBeat) / 4; + MusEGlobal::lastExtMidiSyncTick = MusEGlobal::curExtMidiSyncTick; - //Pos pos((MusEConfig::config.division * midiBeat) / 4, true); - Pos pos(curExtMidiSyncTick, true); + //Pos pos((MusEGlobal::config.division * midiBeat) / 4, true); + Pos pos(MusEGlobal::curExtMidiSyncTick, true); if (!MusEGlobal::checkAudioDevice()) return; - //audioDevice->seekTransport(pos.frame()); - audioDevice->seekTransport(pos); + //MusEGlobal::audioDevice->seekTransport(pos.frame()); + MusEGlobal::audioDevice->seekTransport(pos); alignAllTicks(pos.frame()); - if (debugSync) + if (MusEGlobal::debugSync) printf("setSongPosition %d\n", pos.tick()); } @@ -854,14 +860,14 @@ void MidiSeq::setSongPosition(int port, int midiBeat) void MidiSeq::alignAllTicks(int frameOverride) { //printf("alignAllTicks audioDriver->framePos=%d, audio->pos().frame()=%d\n", - // audioDevice->framePos(), audio->pos().frame()); + // MusEGlobal::audioDevice->framePos(), audio->pos().frame()); unsigned curFrame; if (!frameOverride) - curFrame = audio->pos().frame(); + curFrame = MusEGlobal::audio->pos().frame(); else curFrame = frameOverride; - int tempo = tempomap.tempo(0); + int tempo = MusEGlobal::tempomap.tempo(0); // use the last old values to give start values for the tripple buffering int recTickSpan = recTick1 - recTick2; @@ -871,7 +877,7 @@ void MidiSeq::alignAllTicks(int frameOverride) mclock2=mclock1=0.0; // set all clock values to "in sync" recTick = (int) ((double(curFrame)/double(MusEGlobal::sampleRate)) * - double(MusEConfig::config.division * 1000000.0) / double(tempo) //prevent compiler warning: casting double to int + double(MusEGlobal::config.division * 1000000.0) / double(tempo) //prevent compiler warning: casting double to int ); songtick1 = recTick - songTickSpan; if (songtick1 < 0) @@ -885,7 +891,7 @@ void MidiSeq::alignAllTicks(int frameOverride) recTick2 = recTick1 - recTickSpan; if (recTick2 < 0) recTick2 = 0; - if (debugSync) + if (MusEGlobal::debugSync) printf("alignAllTicks curFrame=%d recTick=%d tempo=%.3f frameOverride=%d\n",curFrame,recTick,(float)((1000000.0 * 60.0)/tempo), frameOverride); } @@ -901,13 +907,13 @@ void MidiSeq::realtimeSystemInput(int port, int c) printf("realtimeSystemInput port:%d 0x%x\n", port+1, c); //if (MusEGlobal::midiInputTrace && (rxSyncPort != port) && rxSyncPort != -1) { - // if (debugSync) + // if (MusEGlobal::debugSync) // printf("rxSyncPort configured as %d; received sync from port %d\n", // rxSyncPort, port); // return; // } - MidiPort* mp = &midiPorts[port]; + MidiPort* mp = &MusEGlobal::midiPorts[port]; // Trigger on any tick, clock, or realtime command. if(c == ME_TICK) // Tick @@ -919,7 +925,7 @@ void MidiSeq::realtimeSystemInput(int port, int c) mp->syncInfo().trigMRTDetect(); // Other // External sync not on? Clock in not turned on? Otherwise realtime in not turned on? - if(!extSyncFlag.value()) + if(!MusEGlobal::extSyncFlag.value()) return; if(c == ME_CLOCK) { @@ -935,47 +941,47 @@ void MidiSeq::realtimeSystemInput(int port, int c) case ME_CLOCK: // midi clock (24 ticks / quarter note) { // Not for the current in port? Forget it. - if(port != curMidiSyncInPort) + if(port != MusEGlobal::curMidiSyncInPort) break; - //printf("midi clock:%f\n", MusEUtil::curTime()); + //printf("midi clock:%f\n", curTime()); // Re-transmit clock to other devices if clock out turned on. // Must be careful not to allow more than one clock input at a time. // Would re-transmit mixture of multiple clocks - confusing receivers. - // Solution: Added curMidiSyncInPort. + // Solution: Added MusEGlobal::curMidiSyncInPort. // Maybe in MidiSeq::processTimerTick(), call sendClock for the other devices, instead of here. for(int p = 0; p < MIDI_PORTS; ++p) - if(p != port && midiPorts[p].syncInfo().MCOut()) - midiPorts[p].sendClock(); + if(p != port && MusEGlobal::midiPorts[p].syncInfo().MCOut()) + MusEGlobal::midiPorts[p].sendClock(); // p3.3.28 - if(playPendingFirstClock) + if(MusEGlobal::playPendingFirstClock) { - playPendingFirstClock = false; + MusEGlobal::playPendingFirstClock = false; // Hopefully the transport will be ready by now, the seek upon start should mean the // audio prefetch has already finished or at least started... // Must comfirm that play does not force a complete prefetch again, but don't think so... - if(!audio->isPlaying()) - audioDevice->startTransport(); + if(!MusEGlobal::audio->isPlaying()) + MusEGlobal::audioDevice->startTransport(); } //else // This part will be run on the second and subsequent clocks, after start. // Can't check audio state, might not be playing yet, we might miss some increments. - //if(audio->isPlaying()) + //if(MusEGlobal::audio->isPlaying()) if(playStateExt) { - lastExtMidiSyncTime = curExtMidiSyncTime; - curExtMidiSyncTime = MusEUtil::curTime(); - int div = MusEConfig::config.division/24; - midiExtSyncTicks += div; - lastExtMidiSyncTick = curExtMidiSyncTick; - curExtMidiSyncTick += div; + MusEGlobal::lastExtMidiSyncTime = MusEGlobal::curExtMidiSyncTime; + MusEGlobal::curExtMidiSyncTime = curTime(); + int div = MusEGlobal::config.division/24; + MusEGlobal::midiExtSyncTicks += div; + MusEGlobal::lastExtMidiSyncTick = MusEGlobal::curExtMidiSyncTick; + MusEGlobal::curExtMidiSyncTick += div; } //BEGIN : Original code: /* - double mclock0 = MusEUtil::curTime(); + double mclock0 = curTime(); // Difference in time last 2 rounds: double tdiff0 = mclock0 - mclock1; double tdiff1 = mclock1 - mclock2; @@ -1000,24 +1006,24 @@ void MidiSeq::realtimeSystemInput(int port, int c) } // Compare w audio if playing: - if (playStateExt == true ) { //audio->isPlaying() state == PLAY + if (playStateExt == true ) { //MusEGlobal::audio->isPlaying() state == PLAY //BEGIN standard setup: - recTick += MusEConfig::config.division / 24; // The one we're syncing to - int tempo = tempomap.tempo(0); - unsigned curFrame = audio->pos().frame(); + recTick += MusEGlobal::config.division / 24; // The one we're syncing to + int tempo = MusEGlobal::tempomap.tempo(0); + unsigned curFrame = MusEGlobal::audio->pos().frame(); double songtick = (double(curFrame)/double(MusEGlobal::sampleRate)) * - double(MusEConfig::config.division * 1000000.0) / double(tempo); + double(MusEGlobal::config.division * 1000000.0) / double(tempo); double scale = double(tdiff0/averagetimediff); double tickdiff = songtick - ((double) recTick - 24 + scale*24.0); //END standard setup - if (debugSync) { + if (MusEGlobal::debugSync) { int m, b, t; - audio->pos().mbt(&m, &b, &t); + MusEGlobal::audio->pos().mbt(&m, &b, &t); int song_beat = b + m*4; // if the time-signature is different than 4/4, this will be wrong. - int sync_beat = recTick/MusEConfig::config.division; + int sync_beat = recTick/MusEGlobal::config.division; printf("pT=%.3f rT=%d diff=%.3f songB=%d syncB=%d scale=%.3f, curFrame=%d", songtick, recTick, tickdiff, song_beat, sync_beat, scale, curFrame); } @@ -1033,19 +1039,19 @@ void MidiSeq::realtimeSystemInput(int port, int c) tickdiff2/24.0; //5 mins 30 secs on 116BPM, -p 512 jackd if (newtickdiff != 0.0) { - int newTempo = tempomap.tempo(0); + int newTempo = MusEGlobal::tempomap.tempo(0); //newTempo += int(24.0 * newtickdiff * scale); newTempo += int(24.0 * newtickdiff); - if (debugSync) + if (MusEGlobal::debugSync) printf(" tdiff=%f ntd=%f lt=%d tmpo=%.3f", tdiff0, newtickdiff, lastTempo, (float)((1000000.0 * 60.0)/newTempo)); //syncTempo = newTempo; - tempomap.setTempo(0,newTempo); + MusEGlobal::tempomap.setTempo(0,newTempo); } - if (debugSync) + if (MusEGlobal::debugSync) printf("\n"); } - else if (debugSync) + else if (MusEGlobal::debugSync) printf("\n"); //BEGIN post calc @@ -1065,21 +1071,21 @@ void MidiSeq::realtimeSystemInput(int port, int c) // if (mclock1 == 0.0) { mp->device()->discardInput(); - if (debugSync) + if (MusEGlobal::debugSync) printf("Discarding input from port %d\n", port); } if ((mclock2 != 0.0) && (tdiff0 > 0.0)) { int tempo0 = int(24000000.0 * tdiff0 + .5); int tempo1 = int(24000000.0 * tdiff1 + .5); - int tempo = tempomap.tempo(0); + int tempo = MusEGlobal::tempomap.tempo(0); int diff0 = tempo0 - tempo; int diff1 = tempo1 - tempo0; if (diff0) { int newTempo = tempo + diff0/8 + diff1/16; - if (debugSync) + if (MusEGlobal::debugSync) printf("setting new tempo %d = %f\n", newTempo, (float)((1000000.0 * 60.0)/newTempo)); - tempomap.setTempo(0, newTempo); + MusEGlobal::tempomap.setTempo(0, newTempo); } } mclock2 = mclock1; @@ -1089,7 +1095,7 @@ void MidiSeq::realtimeSystemInput(int port, int c) //BEGIN : Using external tempo map: /* - double mclock0 = MusEUtil::curTime(); + double mclock0 = curTime(); // Difference in time last 2 rounds: double tdiff0 = mclock0 - mclock1; double tdiff1 = mclock1 - mclock2; @@ -1114,28 +1120,28 @@ void MidiSeq::realtimeSystemInput(int port, int c) } // Compare w audio if playing: - //if (playStateExt == true ) { //audio->isPlaying() state == PLAY + //if (playStateExt == true ) { //MusEGlobal::audio->isPlaying() state == PLAY if (0) { //BEGIN standard setup: - recTick += MusEConfig::config.division / 24; // The one we're syncing to - int tempo = tempomap.tempo(0); - //unsigned curFrame = audio->pos().frame(); + recTick += MusEGlobal::config.division / 24; // The one we're syncing to + int tempo = MusEGlobal::tempomap.tempo(0); + //unsigned curFrame = MusEGlobal::audio->pos().frame(); //double songtick = (double(curFrame)/double(MusEGlobal::sampleRate)) * - // double(MusEConfig::config.division * 1000000.0) / double(tempo); - double songtick = tempomap.curTickExt(mclock0); + // double(MusEGlobal::config.division * 1000000.0) / double(tempo); + double songtick = MusEGlobal::tempomap.curTickExt(mclock0); double scale = double(tdiff0/averagetimediff); double tickdiff = songtick - ((double) recTick - 24 + scale*24.0); //END standard setup - if (debugSync) { + if (MusEGlobal::debugSync) { int m, b, t; - audio->pos().mbt(&m, &b, &t); + MusEGlobal::audio->pos().mbt(&m, &b, &t); int song_beat = b + m*4; // if the time-signature is different than 4/4, this will be wrong. - int sync_beat = recTick/MusEConfig::config.division; + int sync_beat = recTick/MusEGlobal::config.division; printf("pT=%.3f rT=%d diff=%.3f songB=%d syncB=%d scale=%.3f, curFrame=%d averagetimediff:%.3lf", - songtick, recTick, tickdiff, song_beat, sync_beat, scale, audio->pos().frame(), averagetimediff); + songtick, recTick, tickdiff, song_beat, sync_beat, scale, MusEGlobal::audio->pos().frame(), averagetimediff); } //if ((mclock2 !=0.0) && (tdiff1 > 0.0) && fabs(tickdiff) > 0.5 && lastTempo != 0) { @@ -1150,23 +1156,23 @@ void MidiSeq::realtimeSystemInput(int port, int c) // tickdiff2/24.0; //5 mins 30 secs on 116BPM, -p 512 jackd if (newtickdiff != 0.0) { - //int newTempo = tempomap.tempo(0); + //int newTempo = MusEGlobal::tempomap.tempo(0); int newTempo = tempo; //newTempo += int(24.0 * newtickdiff * scale); newTempo += int(24.0 * newtickdiff); - if (debugSync) + if (MusEGlobal::debugSync) printf(" tdiff=%f ntd=%f lt=%d tmpo=%.3f", tdiff0, newtickdiff, lastTempo, (float)((1000000.0 * 60.0)/newTempo)); //syncTempo = newTempo; - //tempomap.setTempo(0,newTempo); + //MusEGlobal::tempomap.setTempo(0,newTempo); // Don't set the last stable tempo. - //tempomap.setTempo(0, newTempo, false); - tempomap.setExtTempo(newTempo); + //MusEGlobal::tempomap.setTempo(0, newTempo, false); + MusEGlobal::tempomap.setExtTempo(newTempo); } - if (debugSync) + if (MusEGlobal::debugSync) printf("\n"); } - else if (debugSync) + else if (MusEGlobal::debugSync) printf("\n"); //BEGIN post calc @@ -1186,34 +1192,34 @@ void MidiSeq::realtimeSystemInput(int port, int c) // if (mclock1 == 0.0) { mp->device()->discardInput(); - if (debugSync) + if (MusEGlobal::debugSync) printf("Discarding input from port %d\n", port); } if ((mclock2 != 0.0) && (tdiff0 > 0.0)) { //int tempo0 = int(24000000.0 * tdiff0 + .5); //int tempo1 = int(24000000.0 * tdiff1 + .5); - //int tempo = tempomap.tempo(0); + //int tempo = MusEGlobal::tempomap.tempo(0); //int diff0 = tempo0 - tempo; //int diff1 = tempo1 - tempo0; //if (diff0) { // int newTempo = tempo + diff0/8 + diff1/16; - // if (debugSync) + // if (MusEGlobal::debugSync) // printf("setting new tempo %d = %f\n", newTempo, (float)((1000000.0 * 60.0)/newTempo)); - //tempomap.setTempo(0, newTempo); + //MusEGlobal::tempomap.setTempo(0, newTempo); // Don't set the last stable tempo. - //tempomap.setTempo(0, newTempo, false); - // tempomap.setExtTempo(newTempo); + //MusEGlobal::tempomap.setTempo(0, newTempo, false); + // MusEGlobal::tempomap.setExtTempo(newTempo); // } //double tempo0 = 24000000.0 * tdiff0; //double tempo1 = 24000000.0 * tdiff1; //int newTempo = int((tempo0 + tempo1) / 2.0); int newTempo = int(averagetimediff * 24000000.0); - if(debugSync) + if(MusEGlobal::debugSync) printf("setting new tempo %d = %f\n", newTempo, (float)((1000000.0 * 60.0)/newTempo)); - tempomap.setExtTempo(newTempo); + MusEGlobal::tempomap.setExtTempo(newTempo); } mclock2 = mclock1; @@ -1234,81 +1240,81 @@ void MidiSeq::realtimeSystemInput(int port, int c) case ME_START: // start // Re-transmit start to other devices if clock out turned on. for(int p = 0; p < MIDI_PORTS; ++p) - //if(p != port && midiPorts[p].syncInfo().MCOut()) - if(p != port && midiPorts[p].syncInfo().MRTOut()) + //if(p != port && MusEGlobal::midiPorts[p].syncInfo().MCOut()) + if(p != port && MusEGlobal::midiPorts[p].syncInfo().MRTOut()) { // p3.3.31 // If we aren't rewinding on start, there's no point in re-sending start. // Re-send continue instead, for consistency. - if(midiPorts[port].syncInfo().recRewOnStart()) - midiPorts[p].sendStart(); + if(MusEGlobal::midiPorts[port].syncInfo().recRewOnStart()) + MusEGlobal::midiPorts[p].sendStart(); else - midiPorts[p].sendContinue(); + MusEGlobal::midiPorts[p].sendContinue(); } - if (debugSync) + if (MusEGlobal::debugSync) printf(" start\n"); - //printf("midi start:%f\n", MusEUtil::curTime()); + //printf("midi start:%f\n", curTime()); - if (1 /* !audio->isPlaying()*/ /*state == IDLE*/) { + if (1 /* !MusEGlobal::audio->isPlaying()*/ /*state == IDLE*/) { if (!MusEGlobal::checkAudioDevice()) return; // p3.3.31 // Rew on start option. - if(midiPorts[port].syncInfo().recRewOnStart()) + if(MusEGlobal::midiPorts[port].syncInfo().recRewOnStart()) { - curExtMidiSyncTick = 0; - lastExtMidiSyncTick = curExtMidiSyncTick; - //audioDevice->seekTransport(0); - audioDevice->seekTransport(Pos(0, false)); + MusEGlobal::curExtMidiSyncTick = 0; + MusEGlobal::lastExtMidiSyncTick = MusEGlobal::curExtMidiSyncTick; + //MusEGlobal::audioDevice->seekTransport(0); + MusEGlobal::audioDevice->seekTransport(Pos(0, false)); } - //unsigned curFrame = audio->curFrame(); - //if (debugSync) + //unsigned curFrame = MusEGlobal::audio->curFrame(); + //if (MusEGlobal::debugSync) // printf(" curFrame=%d\n", curFrame); alignAllTicks(); - //if (debugSync) - // printf(" curFrame: %d curTick: %d tempo: %d\n", curFrame, recTick, tempomap.tempo(0)); + //if (MusEGlobal::debugSync) + // printf(" curFrame: %d curTick: %d tempo: %d\n", curFrame, recTick, MusEGlobal::tempomap.tempo(0)); storedtimediffs = 0; for (int i=0; i<24; i++) timediff[i] = 0.0; // p3.3.26 1/23/10 - // Changed because msgPlay calls audioDevice->seekTransport(song->cPos()) + // Changed because msgPlay calls MusEGlobal::audioDevice->seekTransport(song->cPos()) // and song->cPos() may not be changed to 0 yet, causing tranport not to go to 0. - //audio->msgPlay(true); - //audioDevice->startTransport(); + //MusEGlobal::audio->msgPlay(true); + //MusEGlobal::audioDevice->startTransport(); // p3.3.28 - playPendingFirstClock = true; + MusEGlobal::playPendingFirstClock = true; - midiExtSyncTicks = 0; + MusEGlobal::midiExtSyncTicks = 0; playStateExt = true; } break; case ME_CONTINUE: // continue // Re-transmit continue to other devices if clock out turned on. for(int p = 0; p < MIDI_PORTS; ++p) - //if(p != port && midiPorts[p].syncInfo().MCOut()) - if(p != port && midiPorts[p].syncInfo().MRTOut()) - midiPorts[p].sendContinue(); + //if(p != port && MusEGlobal::midiPorts[p].syncInfo().MCOut()) + if(p != port && MusEGlobal::midiPorts[p].syncInfo().MRTOut()) + MusEGlobal::midiPorts[p].sendContinue(); - if (debugSync) + if (MusEGlobal::debugSync) printf("realtimeSystemInput continue\n"); - //printf("continue:%f\n", MusEUtil::curTime()); + //printf("continue:%f\n", curTime()); - if (1 /* !audio->isPlaying() */ /*state == IDLE */) { - //unsigned curFrame = audio->curFrame(); - //recTick = tempomap.frame2tick(curFrame); // don't think this will work... (ml) + if (1 /* !MusEGlobal::audio->isPlaying() */ /*state == IDLE */) { + //unsigned curFrame = MusEGlobal::audio->curFrame(); + //recTick = MusEGlobal::tempomap.frame2tick(curFrame); // don't think this will work... (ml) //alignAllTicks(); // p3.3.28 - //audio->msgPlay(true); + //MusEGlobal::audio->msgPlay(true); // p3.3.31 // Begin incrementing immediately upon first clock reception. - playPendingFirstClock = true; + MusEGlobal::playPendingFirstClock = true; playStateExt = true; } @@ -1317,38 +1323,38 @@ void MidiSeq::realtimeSystemInput(int port, int c) { // p3.3.35 // Stop the increment right away. - midiExtSyncTicks = 0; + MusEGlobal::midiExtSyncTicks = 0; playStateExt = false; - playPendingFirstClock = false; + MusEGlobal::playPendingFirstClock = false; // Re-transmit stop to other devices if clock out turned on. for(int p = 0; p < MIDI_PORTS; ++p) - //if(p != port && midiPorts[p].syncInfo().MCOut()) - if(p != port && midiPorts[p].syncInfo().MRTOut()) - midiPorts[p].sendStop(); + //if(p != port && MusEGlobal::midiPorts[p].syncInfo().MCOut()) + if(p != port && MusEGlobal::midiPorts[p].syncInfo().MRTOut()) + MusEGlobal::midiPorts[p].sendStop(); - //playPendingFirstClock = false; + //MusEGlobal::playPendingFirstClock = false; - //lastStoppedBeat = (audio->tickPos() * 4) / MusEConfig::config.division; - //curExtMidiSyncTick = (MusEConfig::config.division * lastStoppedBeat) / 4; + //lastStoppedBeat = (MusEGlobal::audio->tickPos() * 4) / MusEGlobal::config.division; + //MusEGlobal::curExtMidiSyncTick = (MusEGlobal::config.division * lastStoppedBeat) / 4; - //printf("stop:%f\n", MusEUtil::curTime()); + //printf("stop:%f\n", curTime()); - if (audio->isPlaying() /*state == PLAY*/) { - audio->msgPlay(false); + if (MusEGlobal::audio->isPlaying() /*state == PLAY*/) { + MusEGlobal::audio->msgPlay(false); //playStateExt = false; } - if (debugSync) + if (MusEGlobal::debugSync) printf("realtimeSystemInput stop\n"); // Just in case the process still runs a cycle or two and causes the // audio tick position to increment, reset the incrementer and force // the transport position to what the hardware thinks is the current position. - //midiExtSyncTicks = 0; - //Pos pos((MusEConfig::config.division * lastStoppedBeat) / 4, true); - //Pos pos(curExtMidiSyncTick, true); - //audioDevice->seekTransport(pos); + //MusEGlobal::midiExtSyncTicks = 0; + //Pos pos((MusEGlobal::config.division * lastStoppedBeat) / 4, true); + //Pos pos(MusEGlobal::curExtMidiSyncTick, true); + //MusEGlobal::audioDevice->seekTransport(pos); } break; @@ -1362,7 +1368,7 @@ void MidiSeq::realtimeSystemInput(int port, int c) } //--------------------------------------------------------- -// mtcSyncMsg +// MusEGlobal::mtcSyncMsg // process received mtc Sync // seekFlag - first complete mtc frame received after // start @@ -1372,34 +1378,34 @@ void MidiSeq::mtcSyncMsg(const MTC& mtc, int type, bool seekFlag) { double time = mtc.time(); double stime = mtc.time(type); - if (debugSync) - printf("MidiSeq::mtcSyncMsg time:%lf stime:%lf seekFlag:%d\n", time, stime, seekFlag); + if (MusEGlobal::debugSync) + printf("MidiSeq::MusEGlobal::mtcSyncMsg time:%lf stime:%lf seekFlag:%d\n", time, stime, seekFlag); - if (seekFlag && audio->isRunning() /*state == START_PLAY*/) { -// int tick = tempomap.time2tick(time); + if (seekFlag && MusEGlobal::audio->isRunning() /*state == START_PLAY*/) { +// int tick = MusEGlobal::tempomap.time2tick(time); //state = PLAY; //write(sigFd, "1", 1); // say PLAY to gui if (!MusEGlobal::checkAudioDevice()) return; - if (debugSync) - printf("MidiSeq::mtcSyncMsg starting transport.\n"); - audioDevice->startTransport(); + if (MusEGlobal::debugSync) + printf("MidiSeq::MusEGlobal::mtcSyncMsg starting transport.\n"); + MusEGlobal::audioDevice->startTransport(); return; } - /*if (tempoSN != tempomap.tempoSN()) { - double cpos = tempomap.tick2time(_midiTick, 0); + /*if (tempoSN != MusEGlobal::tempomap.tempoSN()) { + double cpos = MusEGlobal::tempomap.tick2time(_midiTick, 0); samplePosStart = samplePos - lrint(cpos * MusEGlobal::sampleRate); rtcTickStart = rtcTick - lrint(cpos * realRtcTicks); - tempoSN = tempomap.tempoSN(); + tempoSN = MusEGlobal::tempomap.tempoSN(); }*/ // // diff is the time in sec MusE is out of sync // /*double diff = time - (double(samplePosStart)/double(MusEGlobal::sampleRate)); - if (debugSync) - printf(" state %d diff %f\n", mtcState, diff); + if (MusEGlobal::debugSync) + printf(" state %d diff %f\n", MusEGlobal::mtcState, diff); */ } - +} // namespace MusECore diff --git a/muse2/muse/sync.h b/muse2/muse/sync.h index 5d949d5f..8aa1084d 100644 --- a/muse2/muse/sync.h +++ b/muse2/muse/sync.h @@ -28,6 +28,8 @@ #include "value.h" #include "globaldefs.h" +namespace MusECore { + class Xml; //class MidiDevice; @@ -141,6 +143,10 @@ class MidiSyncInfo void write(int level, Xml& xml); }; +} // namespace MusECore + +namespace MusEGlobal { + //extern MidiSync midiSyncPorts[MIDI_PORTS]; extern bool debugSync; @@ -151,8 +157,8 @@ extern bool debugSync; //extern int txDeviceId; extern int mtcType; -extern MTC mtcOffset; -extern BValue extSyncFlag; +extern MusECore::MTC mtcOffset; +extern MusECore::BValue extSyncFlag; //extern bool genMTCSync; // output MTC Sync //extern bool genMCSync; // output MidiClock Sync //extern bool genMMC; // output Midi Machine Control @@ -160,10 +166,11 @@ extern BValue extSyncFlag; //extern bool acceptMC; //extern bool acceptMMC; extern int volatile curMidiSyncInPort; -extern BValue useJackTransport; +extern MusECore::BValue useJackTransport; extern bool volatile jackTransportMaster; extern unsigned int syncSendFirstClockDelay; // In milliseconds. +} // namespace MusEGlobal #endif diff --git a/muse2/muse/synth.cpp b/muse2/muse/synth.cpp index 62da5e1d..fd526931 100644 --- a/muse2/muse/synth.cpp +++ b/muse2/muse/synth.cpp @@ -53,7 +53,11 @@ #include "popupmenu.h" #include "globaldefs.h" -std::vector<Synth*> synthis; // array of available synthis +namespace MusEGlobal { +std::vector<MusECore::Synth*> synthis; // array of available MusEGlobal::synthis +} + +namespace MusECore { extern void connectNodes(AudioTrack*, AudioTrack*); bool SynthI::_isVisible=true; @@ -144,8 +148,8 @@ void MessSynthIF::setNativeGeometry(int x, int y, int w, int h) //static Synth* findSynth(const QString& sclass) static Synth* findSynth(const QString& sclass, const QString& label) { - for (std::vector<Synth*>::iterator i = synthis.begin(); - i != synthis.end(); ++i) + for (std::vector<Synth*>::iterator i = MusEGlobal::synthis.begin(); + i != MusEGlobal::synthis.end(); ++i) { //if ((*i)->baseName() == sclass) //if ((*i)->name() == sclass) @@ -515,10 +519,10 @@ int MessSynthIF::getControllerInfo(int id, const char** name, int* ctrl, int* mi void SynthI::deactivate2() { removeMidiInstrument(this); - midiDevices.remove(this); + MusEGlobal::midiDevices.remove(this); if (midiPort() != -1) { // synthi is attached - midiPorts[midiPort()].setMidiDevice(0); + MusEGlobal::midiPorts[midiPort()].setMidiDevice(0); } } //--------------------------------------------------------- @@ -561,11 +565,10 @@ SynthI::~SynthI() deactivate3(); } -namespace MusEApp { //--------------------------------------------------------- // initMidiSynth -// search for software synthis and advertise +// search for software MusEGlobal::synthis and advertise //--------------------------------------------------------- void initMidiSynth() @@ -631,17 +634,16 @@ void initMidiSynth() - //synthis.push_back(new MessSynth(*fi)); - synthis.push_back(new MessSynth(*fi, QString(descr->name), QString(descr->description), QString(""), QString(descr->version))); + //MusEGlobal::synthis.push_back(new MessSynth(*fi)); + MusEGlobal::synthis.push_back(new MessSynth(*fi, QString(descr->name), QString(descr->description), QString(""), QString(descr->version))); dlclose(handle); ++it; } if (MusEGlobal::debugMsg) - printf("%zd soft synth found\n", synthis.size()); + printf("%zd soft synth found\n", MusEGlobal::synthis.size()); } } -} // namespace MusEApp //--------------------------------------------------------- @@ -673,17 +675,17 @@ SynthI* Song::createSynthI(const QString& sclass, const QString& label, Track* i //printf("Song::createSynthI after insertTrack3. Adding default routes...\n"); - OutputList* ol = song->outputs(); + OutputList* ol = MusEGlobal::song->outputs(); // add default route to master (first audio output) if (!ol->empty()) { AudioOutput* ao = ol->front(); // p3.3.38 - //audio->msgAddRoute(Route(si, -1), Route(ao, -1)); - //audio->msgAddRoute(Route((AudioTrack*)si, -1), Route(ao, -1)); + //MusEGlobal::audio->msgAddRoute(Route(si, -1), Route(ao, -1)); + //MusEGlobal::audio->msgAddRoute(Route((AudioTrack*)si, -1), Route(ao, -1)); // Make sure the route channel and channels are valid. - audio->msgAddRoute(Route((AudioTrack*)si, 0, ((AudioTrack*)si)->channels()), Route(ao, 0, ((AudioTrack*)si)->channels())); + MusEGlobal::audio->msgAddRoute(Route((AudioTrack*)si, 0, ((AudioTrack*)si)->channels()), Route(ao, 0, ((AudioTrack*)si)->channels())); - audio->msgUpdateSoloStates(); + MusEGlobal::audio->msgUpdateSoloStates(); } // Now that the track has been added to the lists in insertTrack2(), @@ -870,10 +872,10 @@ void SynthI::read(Xml& xml) return; if (initInstance(s, name())) return; - song->insertTrack0(this, -1); + MusEGlobal::song->insertTrack0(this, -1); if (port != -1 && port < MIDI_PORTS) - midiPorts[port].setMidiDevice(this); + MusEGlobal::midiPorts[port].setMidiDevice(this); // Now that the track has been added to the lists in insertTrack2(), // if it's a dssi synth, OSC can find the synth, and initialize (and show) its native gui. @@ -921,7 +923,7 @@ const char* MessSynthIF::getPatchName(int channel, int prog, MType type, bool dr // populatePatchPopup //--------------------------------------------------------- -void MessSynthIF::populatePatchPopup(MusEWidget::PopupMenu* menu, int ch, MType, bool) +void MessSynthIF::populatePatchPopup(MusEGui::PopupMenu* menu, int ch, MType, bool) { menu->clear(); const MidiPatch* mp = _mess->getPatchInfo(ch, 0); @@ -997,7 +999,7 @@ bool SynthI::getData(unsigned pos, int ports, unsigned n, float** buffer) memset(buffer[k], 0, n * sizeof(float)); int p = midiPort(); - MidiPort* mp = (p != -1) ? &midiPorts[p] : 0; + MidiPort* mp = (p != -1) ? &MusEGlobal::midiPorts[p] : 0; //MPEventList* el = playEvents(); ///iMPEvent ie = nextPlayEvent(); @@ -1028,7 +1030,7 @@ iMPEvent MessSynthIF::getData(MidiPort* mp, MPEventList* el, iMPEvent i, unsigne int curPos = pos; int endPos = pos + n; int off = pos; - int frameOffset = audio->getFrameOffset(); + int frameOffset = MusEGlobal::audio->getFrameOffset(); for (; i != el->end(); ++i) { int evTime = i->time(); @@ -1109,3 +1111,4 @@ int MessSynthIF::oldMidiStateHeader(const unsigned char** data) const return _mess ? _mess->oldMidiStateHeader(data) : 0; } +} // namespace MusECore diff --git a/muse2/muse/synth.h b/muse2/muse/synth.h index fc442027..c5b63424 100644 --- a/muse2/muse/synth.h +++ b/muse2/muse/synth.h @@ -41,14 +41,18 @@ #define SYNTH_MIDI_STATE_SAVE_VERSION 2 //class QMenu; -namespace MusEWidget { + +class Mess; +struct MESS; + +namespace MusEGui { class PopupMenu; } +namespace MusECore { + //class MidiEvent; -class MidiPlayEvent; -class Mess; -struct MESS; +//class MidiPlayEvent; class SynthI; class SynthIF; @@ -120,7 +124,6 @@ class MessSynth : public Synth { virtual SynthIF* createSIF(SynthI*); }; -class Mess; //--------------------------------------------------------- // SynthIF @@ -177,7 +180,7 @@ class SynthIF { virtual const char* getPatchName(int, int, int, bool) const = 0; virtual const char* getPatchName(int, int, MType, bool) = 0; //virtual void populatePatchPopup(QMenu*, int, MType, bool) = 0; - virtual void populatePatchPopup(MusEWidget::PopupMenu*, int, MType, bool) = 0; + virtual void populatePatchPopup(MusEGui::PopupMenu*, int, MType, bool) = 0; virtual void write(int level, Xml& xml) const = 0; virtual float getParameter(unsigned long idx) const = 0; virtual void setParameter(unsigned long idx, float value) = 0; @@ -262,7 +265,7 @@ class SynthI : public AudioTrack, public MidiDevice, } //virtual void populatePatchPopup(QMenu* m, int i, MType t, bool d) { - virtual void populatePatchPopup(MusEWidget::PopupMenu* m, int i, MType t, bool d) { + virtual void populatePatchPopup(MusEGui::PopupMenu* m, int i, MType t, bool d) { _sif->populatePatchPopup(m, i, t, d); } @@ -353,13 +356,18 @@ class MessSynthIF : public SynthIF { virtual const char* getPatchName(int, int, int, bool) const { return ""; } virtual const char* getPatchName(int, int, MType, bool); //virtual void populatePatchPopup(QMenu*, int, MType, bool); - virtual void populatePatchPopup(MusEWidget::PopupMenu*, int, MType, bool); + virtual void populatePatchPopup(MusEGui::PopupMenu*, int, MType, bool); virtual void write(int level, Xml& xml) const; virtual float getParameter(unsigned long) const { return 0.0; } virtual void setParameter(unsigned long, float) {} virtual int getControllerInfo(int id, const char** name, int* ctrl, int* min, int* max, int* initval); }; -extern std::vector<Synth*> synthis; // array of available synthis +} // namespace MusECore + +namespace MusEGlobal { +extern std::vector<MusECore::Synth*> synthis; // array of available synthis +} + #endif diff --git a/muse2/muse/tempo.cpp b/muse2/muse/tempo.cpp index e41e39c6..051fc7c5 100644 --- a/muse2/muse/tempo.cpp +++ b/muse2/muse/tempo.cpp @@ -30,7 +30,11 @@ #include "gconfig.h" #include "xml.h" -TempoList tempomap; +namespace MusEGlobal { +MusECore::TempoList tempomap; +} + +namespace MusECore { //--------------------------------------------------------- // TempoList @@ -83,7 +87,7 @@ void TempoList::normalize() for (iTEvent e = begin(); e != end(); ++e) { e->second->frame = frame; unsigned dtick = e->first - e->second->tick; - double dtime = double(dtick) / (MusEConfig::config.division * _globalTempo * 10000.0/e->second->tempo); + double dtime = double(dtick) / (MusEGlobal::config.division * _globalTempo * 10000.0/e->second->tempo); frame += lrint(dtime * MusEGlobal::sampleRate); } } @@ -270,12 +274,12 @@ unsigned TempoList::tick2frame(unsigned tick, int* sn) const return 0; } unsigned dtick = tick - i->second->tick; - double dtime = double(dtick) / (MusEConfig::config.division * _globalTempo * 10000.0/ i->second->tempo); + double dtime = double(dtick) / (MusEGlobal::config.division * _globalTempo * 10000.0/ i->second->tempo); unsigned dframe = lrint(dtime * MusEGlobal::sampleRate); f = i->second->frame + dframe; } else { - double t = (double(tick) * double(_tempo)) / (double(MusEConfig::config.division) * _globalTempo * 10000.0); + double t = (double(tick) * double(_tempo)) / (double(MusEGlobal::config.division) * _globalTempo * 10000.0); f = lrint(t * MusEGlobal::sampleRate); } if (sn) @@ -314,10 +318,10 @@ unsigned TempoList::frame2tick(unsigned frame, int* sn) const unsigned te = e->second->tempo; int dframe = frame - e->second->frame; double dtime = double(dframe) / double(MusEGlobal::sampleRate); - tick = e->second->tick + lrint(dtime * _globalTempo * MusEConfig::config.division * 10000.0 / te); + tick = e->second->tick + lrint(dtime * _globalTempo * MusEGlobal::config.division * 10000.0 / te); } else - tick = lrint((double(frame)/double(MusEGlobal::sampleRate)) * _globalTempo * MusEConfig::config.division * 10000.0 / double(_tempo)); + tick = lrint((double(frame)/double(MusEGlobal::sampleRate)) * _globalTempo * MusEGlobal::config.division * 10000.0 / double(_tempo)); if (sn) *sn = _tempoSN; return tick; @@ -338,7 +342,7 @@ unsigned TempoList::deltaTick2frame(unsigned tick1, unsigned tick2, int* sn) con return 0; } unsigned dtick = tick1 - i->second->tick; - double dtime = double(dtick) / (MusEConfig::config.division * _globalTempo * 10000.0/ i->second->tempo); + double dtime = double(dtick) / (MusEGlobal::config.division * _globalTempo * 10000.0/ i->second->tempo); unsigned dframe = lrint(dtime * MusEGlobal::sampleRate); f1 = i->second->frame + dframe; @@ -347,15 +351,15 @@ unsigned TempoList::deltaTick2frame(unsigned tick1, unsigned tick2, int* sn) con return 0; } dtick = tick2 - i->second->tick; - dtime = double(dtick) / (MusEConfig::config.division * _globalTempo * 10000.0/ i->second->tempo); + dtime = double(dtick) / (MusEGlobal::config.division * _globalTempo * 10000.0/ i->second->tempo); dframe = lrint(dtime * MusEGlobal::sampleRate); f2 = i->second->frame + dframe; } else { - double t = (double(tick1) * double(_tempo)) / (double(MusEConfig::config.division) * _globalTempo * 10000.0); + double t = (double(tick1) * double(_tempo)) / (double(MusEGlobal::config.division) * _globalTempo * 10000.0); f1 = lrint(t * MusEGlobal::sampleRate); - t = (double(tick2) * double(_tempo)) / (double(MusEConfig::config.division) * _globalTempo * 10000.0); + t = (double(tick2) * double(_tempo)) / (double(MusEGlobal::config.division) * _globalTempo * 10000.0); f2 = lrint(t * MusEGlobal::sampleRate); } if (sn) @@ -387,7 +391,7 @@ unsigned TempoList::deltaFrame2tick(unsigned frame1, unsigned frame2, int* sn) c unsigned te = e->second->tempo; int dframe = frame1 - e->second->frame; double dtime = double(dframe) / double(MusEGlobal::sampleRate); - tick1 = e->second->tick + lrint(dtime * _globalTempo * MusEConfig::config.division * 10000.0 / te); + tick1 = e->second->tick + lrint(dtime * _globalTempo * MusEGlobal::config.division * 10000.0 / te); for (e = begin(); e != end();) { ciTEvent ee = e; @@ -401,12 +405,12 @@ unsigned TempoList::deltaFrame2tick(unsigned frame1, unsigned frame2, int* sn) c te = e->second->tempo; dframe = frame2 - e->second->frame; dtime = double(dframe) / double(MusEGlobal::sampleRate); - tick2 = e->second->tick + lrint(dtime * _globalTempo * MusEConfig::config.division * 10000.0 / te); + tick2 = e->second->tick + lrint(dtime * _globalTempo * MusEGlobal::config.division * 10000.0 / te); } else { - tick1 = lrint((double(frame1)/double(MusEGlobal::sampleRate)) * _globalTempo * MusEConfig::config.division * 10000.0 / double(_tempo)); - tick2 = lrint((double(frame2)/double(MusEGlobal::sampleRate)) * _globalTempo * MusEConfig::config.division * 10000.0 / double(_tempo)); + tick1 = lrint((double(frame1)/double(MusEGlobal::sampleRate)) * _globalTempo * MusEGlobal::config.division * 10000.0 / double(_tempo)); + tick2 = lrint((double(frame2)/double(MusEGlobal::sampleRate)) * _globalTempo * MusEGlobal::config.division * 10000.0 / double(_tempo)); } if (sn) *sn = _tempoSN; @@ -521,4 +525,5 @@ int TEvent::read(Xml& xml) return 0; } +} // namespace MusECore diff --git a/muse2/muse/tempo.h b/muse2/muse/tempo.h index 3022705b..5c408630 100644 --- a/muse2/muse/tempo.h +++ b/muse2/muse/tempo.h @@ -30,6 +30,8 @@ #define MAX_TICK (0x7fffffff/100) #endif +namespace MusECore { + class Xml; //--------------------------------------------------------- @@ -101,5 +103,10 @@ class TempoList : public TEMPOLIST { void setGlobalTempo(int val); }; -extern TempoList tempomap; +} // namespace MusECore + +namespace MusEGlobal { +extern MusECore::TempoList tempomap; +} + #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 <pthread.h> #include <list> +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/ticksynth.cpp b/muse2/muse/ticksynth.cpp index 57ed6272..1edc0b12 100644 --- a/muse2/muse/ticksynth.cpp +++ b/muse2/muse/ticksynth.cpp @@ -32,6 +32,8 @@ //#define METRONOME_DEBUG +namespace MusECore { + MetronomeSynthI* metronome = 0; class MetronomeSynth; @@ -109,7 +111,7 @@ class MetronomeSynthIF : public SynthIF virtual const char* getPatchName(int, int, int, bool) const { return ""; } virtual const char* getPatchName(int, int, MType, bool) { return ""; } //virtual void populatePatchPopup(QMenu*, int, MType, bool) {}; - virtual void populatePatchPopup(MusEWidget::PopupMenu*, int, MType, bool) {}; + virtual void populatePatchPopup(MusEGui::PopupMenu*, int, MType, bool) {}; virtual void write(int, Xml&) const {} virtual float getParameter(unsigned long) const { return 0.0; } virtual void setParameter(unsigned long, float) {} @@ -131,7 +133,7 @@ iMPEvent MetronomeSynthIF::getData(MidiPort*, MPEventList* el, iMPEvent i, unsig unsigned int curPos = pos; //prevent compiler warning: comparison signed/unsigned unsigned int endPos = pos + n; //prevent compiler warning: comparison signed/unsigned unsigned int off = pos; //prevent compiler warning: comparison signed/unsigned - int frameOffset = audio->getFrameOffset(); + int frameOffset = MusEGlobal::audio->getFrameOffset(); for (; i != el->end(); ++i) { unsigned int frame = i->time() - frameOffset; //prevent compiler warning: comparison signed /unsigned @@ -238,3 +240,4 @@ void exitMetronome() metronomeSynth = 0; } +} // namespace MusECore diff --git a/muse2/muse/ticksynth.h b/muse2/muse/ticksynth.h index 395b6168..e6b77ed4 100644 --- a/muse2/muse/ticksynth.h +++ b/muse2/muse/ticksynth.h @@ -24,6 +24,9 @@ #define __TICKSYNTH_H__ #include "synth.h" + +namespace MusECore { + extern void initMetronome(); extern void exitMetronome(); class MetronomeSynthI : public SynthI @@ -33,5 +36,7 @@ class MetronomeSynthI : public SynthI }; extern MetronomeSynthI* metronome; +} // namespace MusECore + #endif diff --git a/muse2/muse/track.cpp b/muse2/muse/track.cpp index 58c53f63..e2149ddb 100644 --- a/muse2/muse/track.cpp +++ b/muse2/muse/track.cpp @@ -34,9 +34,9 @@ #include "route.h" #include "drummap.h" -bool MidiTrack::_isVisible=true; -//bool Track::_isVisible=true; +namespace MusECore { +//bool Track::_isVisible=true; unsigned int Track::_soloRefCnt = 0; Track* Track::_tmpSoloChainTrack = 0; bool Track::_tmpSoloChainDoIns = false; @@ -47,6 +47,9 @@ const char* Track::_cname[] = { "AudioOut", "AudioIn", "AudioGroup", "AudioAux", "AudioSynth" }; + +bool MidiTrack::_isVisible=true; + //--------------------------------------------------------- // addPortCtrlEvents //--------------------------------------------------------- @@ -73,7 +76,7 @@ void addPortCtrlEvents(MidiTrack* t) int val = ev.dataB(); int ch = t->outChannel(); - MidiPort* mp = &midiPorts[t->outPort()]; + MidiPort* mp = &MusEGlobal::midiPorts[t->outPort()]; // Is it a drum controller event, according to the track port's instrument? if(t->type() == Track::DRUM) //FINDMICHJETZT was soll das? drumcontroller -_- { @@ -82,9 +85,9 @@ void addPortCtrlEvents(MidiTrack* t) { int note = cntrl & 0x7f; cntrl &= ~0xff; - ch = drumMap[note].channel; - mp = &midiPorts[drumMap[note].port]; - cntrl |= drumMap[note].anote; + ch = MusEGlobal::drumMap[note].channel; + mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[note].port]; + cntrl |= MusEGlobal::drumMap[note].anote; } } @@ -121,7 +124,7 @@ void removePortCtrlEvents(MidiTrack* t) int cntrl = ev.dataA(); int ch = t->outChannel(); - MidiPort* mp = &midiPorts[t->outPort()]; + MidiPort* mp = &MusEGlobal::midiPorts[t->outPort()]; // Is it a drum controller event, according to the track port's instrument? if(t->type() == Track::DRUM) //FINDMICHJETZT was soll das? drumcontroller... { @@ -130,9 +133,9 @@ void removePortCtrlEvents(MidiTrack* t) { int note = cntrl & 0x7f; cntrl &= ~0xff; - ch = drumMap[note].channel; - mp = &midiPorts[drumMap[note].port]; - cntrl |= drumMap[note].anote; + ch = MusEGlobal::drumMap[note].channel; + mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[note].port]; + cntrl |= MusEGlobal::drumMap[note].anote; } } @@ -142,13 +145,15 @@ void removePortCtrlEvents(MidiTrack* t) } } + + //--------------------------------------------------------- // y //--------------------------------------------------------- int Track::y() const { - TrackList* tl = song->tracks(); + TrackList* tl = MusEGlobal::song->tracks(); int yy = 0; for (ciTrack it = tl->begin(); it != tl->end(); ++it) { if (this == *it) @@ -337,7 +342,7 @@ void Track::setDefaultName() QString n; n.setNum(i); QString s = base + n; - Track* track = song->findTrack(s); + Track* track = MusEGlobal::song->findTrack(s); if (track == 0) { setName(s); break; @@ -384,6 +389,7 @@ void Track::dump() const _name.toLatin1().constData(), _type, _parts.size(), _selected); } + //--------------------------------------------------------- // MidiTrack //--------------------------------------------------------- @@ -407,7 +413,7 @@ MidiTrack::MidiTrack() else _drummap[idx]=idrumMap[i]; - global_drum_ordering.push_back(std::pair<MidiTrack*,int>(this,idx)); + MusEGlobal::global_drum_ordering.push_back(std::pair<MidiTrack*,int>(this,idx)); } for (int i=0;i<128;i++) _drummap_hidden[i]=false; @@ -438,11 +444,11 @@ MidiTrack::MidiTrack(const MidiTrack& mt, bool cloneParts) memcpy(_drummap, mt._drummap, 128*sizeof(*_drummap)); memcpy(_drummap_hidden, mt._drummap_hidden, 128*sizeof(*_drummap_hidden)); - for (global_drum_ordering_t::iterator it=global_drum_ordering.begin(); it!=global_drum_ordering.end(); it++) + for (MusEGlobal::global_drum_ordering_t::iterator it=MusEGlobal::global_drum_ordering.begin(); it!=MusEGlobal::global_drum_ordering.end(); it++) if (it->first == &mt) { - it=global_drum_ordering.insert(it, *it); // duplicates the entry at it, set it to the first entry of both - it++; // make it point to the second entry + it=MusEGlobal::global_drum_ordering.insert(it, *it); // duplicates the entry at it, set it to the first entry of both + it++; // make it point to the second entry it->first=this; } } @@ -456,9 +462,9 @@ MidiTrack::~MidiTrack() // remove ourselves from the global_drum_ordering list // this is not really necessary, but cleaner - for (global_drum_ordering_t::iterator it=global_drum_ordering.begin(); it!=global_drum_ordering.end();) + for (MusEGlobal::global_drum_ordering_t::iterator it=MusEGlobal::global_drum_ordering.begin(); it!=MusEGlobal::global_drum_ordering.end();) if (it->first == this) - it=global_drum_ordering.erase(it); + it=MusEGlobal::global_drum_ordering.erase(it); else it++; @@ -562,14 +568,14 @@ void MidiTrack::setInPortAndChannelMask(unsigned int portmask, int chanmask) { // p3.3.50 If the port was not used in the song file to begin with, just ignore it. // This saves from having all of the first 32 ports' channels connected. - if(!midiPorts[port].foundInSongFile()) + if(!MusEGlobal::midiPorts[port].foundInSongFile()) continue; //if(!(portmask & (1 << port))) // continue; // p3.3.50 Removed. Allow to connect to port with no device so user can change device later. - //MidiPort* mp = &midiPorts[port]; + //MidiPort* mp = &MusEGlobal::midiPorts[port]; //MidiDevice* md = mp->device(); //if(!md) // continue; @@ -600,7 +606,7 @@ void MidiTrack::setInPortAndChannelMask(unsigned int portmask, int chanmask) // Route already exists? //if(iir != rl->end()) // continue; - audio->msgAddRoute(aRoute, bRoute); + MusEGlobal::audio->msgAddRoute(aRoute, bRoute); changed = true; } else @@ -608,7 +614,7 @@ void MidiTrack::setInPortAndChannelMask(unsigned int portmask, int chanmask) // Route does not exist? //if(iir == rl->end()) // continue; - audio->msgRemoveRoute(aRoute, bRoute); + MusEGlobal::audio->msgRemoveRoute(aRoute, bRoute); changed = true; } //} @@ -616,8 +622,8 @@ void MidiTrack::setInPortAndChannelMask(unsigned int portmask, int chanmask) if(changed) { - audio->msgUpdateSoloStates(); - song->update(SC_ROUTE); + MusEGlobal::audio->msgUpdateSoloStates(); + MusEGlobal::song->update(SC_ROUTE); } } @@ -643,7 +649,7 @@ void MidiTrack::addPortCtrlEvents() int val = ev.dataB(); int ch = _outChannel; - MidiPort* mp = &midiPorts[_outPort]; + MidiPort* mp = &MusEGlobal::midiPorts[_outPort]; // Is it a drum controller event, according to the track port's instrument? if(type() == DRUM) //FINDMICHJETZT commented out. was soll das? { @@ -652,9 +658,9 @@ void MidiTrack::addPortCtrlEvents() { int note = cntrl & 0x7f; cntrl &= ~0xff; - ch = drumMap[note].channel; - mp = &midiPorts[drumMap[note].port]; - cntrl |= drumMap[note].anote; + ch = MusEGlobal::drumMap[note].channel; + mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[note].port]; + cntrl |= MusEGlobal::drumMap[note].anote; } } @@ -684,7 +690,7 @@ void MidiTrack::removePortCtrlEvents() int cntrl = ev.dataA(); int ch = _outChannel; - MidiPort* mp = &midiPorts[_outPort]; + MidiPort* mp = &MusEGlobal::midiPorts[_outPort]; // Is it a drum controller event, according to the track port's instrument? if(type() == DRUM) //FINDMICHJETZT commented out: was soll das? { @@ -693,9 +699,9 @@ void MidiTrack::removePortCtrlEvents() { int note = cntrl & 0x7f; cntrl &= ~0xff; - ch = drumMap[note].channel; - mp = &midiPorts[drumMap[note].port]; - cntrl |= drumMap[note].anote; + ch = MusEGlobal::drumMap[note].channel; + mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[note].port]; + cntrl |= MusEGlobal::drumMap[note].anote; } } @@ -707,30 +713,6 @@ void MidiTrack::removePortCtrlEvents() */ //--------------------------------------------------------- -// addPart -//--------------------------------------------------------- - -iPart Track::addPart(Part* p) - { - p->setTrack(this); - return _parts.add(p); - } - -//--------------------------------------------------------- -// findPart -//--------------------------------------------------------- - -Part* Track::findPart(unsigned tick) - { - for (iPart i = _parts.begin(); i != _parts.end(); ++i) { - Part* part = i->second; - if (tick >= part->tick() && tick < (part->tick()+part->lenTick())) - return part; - } - return 0; - } - -//--------------------------------------------------------- // newPart //--------------------------------------------------------- @@ -758,7 +740,7 @@ Part* MidiTrack::newPart(Part*p, bool clone) AutomationType MidiTrack::automationType() const { - MidiPort* port = &midiPorts[outPort()]; + MidiPort* port = &MusEGlobal::midiPorts[outPort()]; return port->automationType(outChannel()); } @@ -768,11 +750,155 @@ AutomationType MidiTrack::automationType() const void MidiTrack::setAutomationType(AutomationType t) { - MidiPort* port = &midiPorts[outPort()]; + MidiPort* port = &MusEGlobal::midiPorts[outPort()]; port->setAutomationType(outChannel(), t); } //--------------------------------------------------------- +// MidiTrack::write +//--------------------------------------------------------- + +void MidiTrack::write(int level, Xml& xml) const + { + const char* tag; + + if (type() == DRUM) + tag = "drumtrack"; + else if (type() == MIDI) + tag = "miditrack"; + else if (type() == NEW_DRUM) + tag = "newdrumtrack"; + else + printf("THIS SHOULD NEVER HAPPEN: non-midi-type in MidiTrack::write()\n"); + + xml.tag(level++, tag); + Track::writeProperties(level, xml); + + xml.intTag(level, "device", outPort()); + xml.intTag(level, "channel", outChannel()); + //xml.intTag(level, "inportMap", inPortMask()); + ///xml.uintTag(level, "inportMap", inPortMask()); // Obsolete + ///xml.intTag(level, "inchannelMap", inChannelMask()); // Obsolete + xml.intTag(level, "locked", _locked); + xml.intTag(level, "echo", _recEcho); + + xml.intTag(level, "transposition", transposition); + xml.intTag(level, "velocity", velocity); + xml.intTag(level, "delay", delay); + xml.intTag(level, "len", len); + xml.intTag(level, "compression", compression); + xml.intTag(level, "automation", int(automationType())); + xml.intTag(level, "clef", int(clefType)); + + const PartList* pl = cparts(); + for (ciPart p = pl->begin(); p != pl->end(); ++p) + p->second->write(level, xml); + xml.etag(level, tag); + } + +//--------------------------------------------------------- +// MidiTrack::read +//--------------------------------------------------------- + +void MidiTrack::read(Xml& xml) + { + unsigned int portmask = 0; + int chanmask = 0; + + for (;;) { + Xml::Token token = xml.parse(); + const QString& tag = xml.s1(); + switch (token) { + case Xml::Error: + case Xml::End: + return; + case Xml::TagStart: + if (tag == "transposition") + transposition = xml.parseInt(); + else if (tag == "velocity") + velocity = xml.parseInt(); + else if (tag == "delay") + delay = xml.parseInt(); + else if (tag == "len") + len = xml.parseInt(); + else if (tag == "compression") + compression = xml.parseInt(); + else if (tag == "part") { + //Part* p = newPart(); + //p->read(xml); + Part* p = 0; + p = readXmlPart(xml, this); + if(p) + parts()->add(p); + } + else if (tag == "device") + setOutPort(xml.parseInt()); + else if (tag == "channel") + setOutChannel(xml.parseInt()); + else if (tag == "inportMap") + //setInPortMask(xml.parseInt()); + ///setInPortMask(xml.parseUInt()); + //xml.skip(tag); // Obsolete. + portmask = xml.parseUInt(); // p3.3.48: Support old files. + else if (tag == "inchannelMap") + ///setInChannelMask(xml.parseInt()); + //xml.skip(tag); // Obsolete. + chanmask = xml.parseInt(); // p3.3.48: Support old files. + else if (tag == "locked") + _locked = xml.parseInt(); + else if (tag == "echo") + _recEcho = xml.parseInt(); + else if (tag == "automation") + setAutomationType(AutomationType(xml.parseInt())); + else if (tag == "clef") + clefType = (clefTypes)xml.parseInt(); + else if (Track::readProperties(xml, tag)) { + // version 1.0 compatibility: + if (tag == "track" && xml.majorVersion() == 1 && xml.minorVersion() == 0) + break; + xml.unknown("MidiTrack"); + } + break; + case Xml::Attribut: + break; + case Xml::TagEnd: + if (tag == "miditrack" || tag == "drumtrack") + { + setInPortAndChannelMask(portmask, chanmask); // p3.3.48: Support old files. + return; + } + default: + break; + } + } + } + + +//--------------------------------------------------------- +// addPart +//--------------------------------------------------------- + +iPart Track::addPart(Part* p) + { + p->setTrack(this); + return _parts.add(p); + } + +//--------------------------------------------------------- +// findPart +//--------------------------------------------------------- + +Part* Track::findPart(unsigned tick) + { + for (iPart i = _parts.begin(); i != _parts.end(); ++i) { + Part* part = i->second; + if (tick >= part->tick() && tick < (part->tick()+part->lenTick())) + return part; + } + return 0; + } + +//--------------------------------------------------------- // Track::writeProperties //--------------------------------------------------------- @@ -932,123 +1058,5 @@ void Track::writeRouting(int level, Xml& xml) const } } } - -//--------------------------------------------------------- -// MidiTrack::write -//--------------------------------------------------------- - -void MidiTrack::write(int level, Xml& xml) const - { - const char* tag; - - if (type() == DRUM) - tag = "drumtrack"; - else if (type() == MIDI) - tag = "miditrack"; - else if (type() == NEW_DRUM) - tag = "newdrumtrack"; - else - printf("THIS SHOULD NEVER HAPPEN: non-midi-type in MidiTrack::write()\n"); - - xml.tag(level++, tag); - Track::writeProperties(level, xml); - - xml.intTag(level, "device", outPort()); - xml.intTag(level, "channel", outChannel()); - //xml.intTag(level, "inportMap", inPortMask()); - ///xml.uintTag(level, "inportMap", inPortMask()); // Obsolete - ///xml.intTag(level, "inchannelMap", inChannelMask()); // Obsolete - xml.intTag(level, "locked", _locked); - xml.intTag(level, "echo", _recEcho); - - xml.intTag(level, "transposition", transposition); - xml.intTag(level, "velocity", velocity); - xml.intTag(level, "delay", delay); - xml.intTag(level, "len", len); - xml.intTag(level, "compression", compression); - xml.intTag(level, "automation", int(automationType())); - xml.intTag(level, "clef", int(clefType)); - - const PartList* pl = cparts(); - for (ciPart p = pl->begin(); p != pl->end(); ++p) - p->second->write(level, xml); - xml.etag(level, tag); - } - -//--------------------------------------------------------- -// MidiTrack::read -//--------------------------------------------------------- - -void MidiTrack::read(Xml& xml) - { - unsigned int portmask = 0; - int chanmask = 0; - - for (;;) { - Xml::Token token = xml.parse(); - const QString& tag = xml.s1(); - switch (token) { - case Xml::Error: - case Xml::End: - return; - case Xml::TagStart: - if (tag == "transposition") - transposition = xml.parseInt(); - else if (tag == "velocity") - velocity = xml.parseInt(); - else if (tag == "delay") - delay = xml.parseInt(); - else if (tag == "len") - len = xml.parseInt(); - else if (tag == "compression") - compression = xml.parseInt(); - else if (tag == "part") { - //Part* p = newPart(); - //p->read(xml); - Part* p = 0; - p = readXmlPart(xml, this); - if(p) - parts()->add(p); - } - else if (tag == "device") - setOutPort(xml.parseInt()); - else if (tag == "channel") - setOutChannel(xml.parseInt()); - else if (tag == "inportMap") - //setInPortMask(xml.parseInt()); - ///setInPortMask(xml.parseUInt()); - //xml.skip(tag); // Obsolete. - portmask = xml.parseUInt(); // p3.3.48: Support old files. - else if (tag == "inchannelMap") - ///setInChannelMask(xml.parseInt()); - //xml.skip(tag); // Obsolete. - chanmask = xml.parseInt(); // p3.3.48: Support old files. - else if (tag == "locked") - _locked = xml.parseInt(); - else if (tag == "echo") - _recEcho = xml.parseInt(); - else if (tag == "automation") - setAutomationType(AutomationType(xml.parseInt())); - else if (tag == "clef") - clefType = (clefTypes)xml.parseInt(); - else if (Track::readProperties(xml, tag)) { - // version 1.0 compatibility: - if (tag == "track" && xml.majorVersion() == 1 && xml.minorVersion() == 0) - break; - xml.unknown("MidiTrack"); - } - break; - case Xml::Attribut: - break; - case Xml::TagEnd: - if (tag == "miditrack" || tag == "drumtrack") - { - setInPortAndChannelMask(portmask, chanmask); // p3.3.48: Support old files. - return; - } - default: - break; - } - } - } +} // namespace MusECore diff --git a/muse2/muse/track.h b/muse2/muse/track.h index 7ed30914..9d3db8af 100644 --- a/muse2/muse/track.h +++ b/muse2/muse/track.h @@ -37,14 +37,16 @@ #include "globaldefs.h" #include "cleftypes.h" +namespace MusECore { +class MPEventList; class Pipeline; -class Xml; +class PluginI; class SndFile; -class MPEventList; class SynthI; -class PluginI; +class Xml; class DrumMap; + //--------------------------------------------------------- // Track //--------------------------------------------------------- @@ -304,6 +306,10 @@ class MidiTrack : public Track { bool* drummap_hidden() { return _drummap_hidden; } }; +} // namespace MusECore + +namespace MusECore { + //--------------------------------------------------------- // AudioTrack // this track can hold audio automation data and can @@ -566,6 +572,7 @@ class AudioAux : public AudioTrack { static bool visible() { return _isVisible; } }; + //--------------------------------------------------------- // WaveTrack //--------------------------------------------------------- @@ -734,5 +741,7 @@ typedef tracklist<SynthI*> SynthIList; extern void addPortCtrlEvents(MidiTrack* t); extern void removePortCtrlEvents(MidiTrack* t); +} // namespace MusECore + #endif diff --git a/muse2/muse/transport.cpp b/muse2/muse/transport.cpp index 72415995..60494bc4 100644 --- a/muse2/muse/transport.cpp +++ b/muse2/muse/transport.cpp @@ -43,6 +43,8 @@ #include "gconfig.h" #include "app.h" +namespace MusEGui { + static const char* recordTransportText = QT_TRANSLATE_NOOP("@default", "Click this button to enable recording"); static const char* stopTransportText = QT_TRANSLATE_NOOP("@default", "Click this button to stop playback"); static const char* playTransportText = QT_TRANSLATE_NOOP("@default", "Click this button to start playback"); @@ -92,7 +94,7 @@ Handle::Handle(QWidget* r, QWidget* parent) setFixedWidth(20); setCursor(Qt::PointingHandCursor); QPalette palette; - palette.setColor(this->backgroundRole(), MusEConfig::config.transportHandleColor); + palette.setColor(this->backgroundRole(), MusEGlobal::config.transportHandleColor); this->setPalette(palette); setAutoFillBackground(true); } @@ -139,12 +141,12 @@ TempoSig::TempoSig(QWidget* parent) f->setLineWidth(1); // ORCAN get rid of l1 l2 last arguments (parent)? - l1 = new MusEWidget::DoubleLabel(120.0, 20.0, 400.0, 0); + l1 = new MusEGui::DoubleLabel(120.0, 20.0, 400.0, 0); l1->setFocusPolicy(Qt::NoFocus); l1->setSpecialText(QString("extern")); vb2->addWidget(l1); - l2 = new MusEWidget::SigLabel(4, 4, 0); + l2 = new MusEGui::SigLabel(4, 4, 0); l2->setFocusPolicy(Qt::NoFocus); vb2->addWidget(l2); @@ -152,7 +154,7 @@ TempoSig::TempoSig(QWidget* parent) vb1->addWidget(f); l3 = new QLabel(tr("Tempo/Sig")); - l3->setFont(MusEConfig::config.fonts[2]); + l3->setFont(MusEGlobal::config.fonts[2]); vb1->addWidget(l3); l1->setBackgroundRole(QPalette::Light); @@ -178,7 +180,7 @@ TempoSig::TempoSig(QWidget* parent) void TempoSig::configChanged() { - l3->setFont(MusEConfig::config.fonts[2]); + l3->setFont(MusEGlobal::config.fonts[2]); } //--------------------------------------------------------- @@ -256,29 +258,29 @@ Transport::Transport(QWidget* parent, const char* name) QVBoxLayout *box1 = new QVBoxLayout; recMode = new QComboBox; recMode->setFocusPolicy(Qt::NoFocus); - recMode->insertItem(Song::REC_OVERDUP, tr("Overdub")); - recMode->insertItem(Song::REC_REPLACE, tr("Replace")); - recMode->setCurrentIndex(song->recMode()); + recMode->insertItem(MusECore::Song::REC_OVERDUP, tr("Overdub")); + recMode->insertItem(MusECore::Song::REC_REPLACE, tr("Replace")); + recMode->setCurrentIndex(MusEGlobal::song->recMode()); box1->addWidget(recMode); l2 = new QLabel(tr("Rec Mode")); - l2->setFont(MusEConfig::config.fonts[2]); + l2->setFont(MusEGlobal::config.fonts[2]); l2->setAlignment(Qt::AlignCenter); connect(recMode, SIGNAL(activated(int)), SLOT(setRecMode(int))); box1->addWidget(l2); cycleMode = new QComboBox; cycleMode->setFocusPolicy(Qt::NoFocus); - cycleMode->insertItem(Song::CYCLE_NORMAL, tr("Normal")); - cycleMode->insertItem(Song::CYCLE_MIX, tr("Mix")); - cycleMode->insertItem(Song::CYCLE_REPLACE, tr("Replace")); - cycleMode->setCurrentIndex(song->cycleMode()); + cycleMode->insertItem(MusECore::Song::CYCLE_NORMAL, tr("Normal")); + cycleMode->insertItem(MusECore::Song::CYCLE_MIX, tr("Mix")); + cycleMode->insertItem(MusECore::Song::CYCLE_REPLACE, tr("Replace")); + cycleMode->setCurrentIndex(MusEGlobal::song->cycleMode()); box1->addWidget(cycleMode); l3 = new QLabel(tr("Cycle Rec")); - l3->setFont(MusEConfig::config.fonts[2]); + l3->setFont(MusEGlobal::config.fonts[2]); l3->setAlignment(Qt::AlignCenter); connect(cycleMode, SIGNAL(activated(int)), SLOT(setCycleMode(int))); box1->addWidget(l3); @@ -308,17 +310,17 @@ Transport::Transport(QWidget* parent, const char* name) b2->setWhatsThis(tr("Loop")); b3->setWhatsThis(tr("Punch Out")); - connect(b1, SIGNAL(toggled(bool)), song, SLOT(setPunchin(bool))); - connect(b2, SIGNAL(toggled(bool)), song, SLOT(setLoop(bool))); - connect(b3, SIGNAL(toggled(bool)), song, SLOT(setPunchout(bool))); + connect(b1, SIGNAL(toggled(bool)), MusEGlobal::song, SLOT(setPunchin(bool))); + connect(b2, SIGNAL(toggled(bool)), MusEGlobal::song, SLOT(setLoop(bool))); + connect(b3, SIGNAL(toggled(bool)), MusEGlobal::song, SLOT(setPunchout(bool))); - b1->setChecked(song->punchin()); - b2->setChecked(song->loop()); - b3->setChecked(song->punchout()); + b1->setChecked(MusEGlobal::song->punchin()); + b2->setChecked(MusEGlobal::song->loop()); + b3->setChecked(MusEGlobal::song->punchout()); - connect(song, SIGNAL(punchinChanged(bool)), b1, SLOT(setChecked(bool))); - connect(song, SIGNAL(punchoutChanged(bool)), b3, SLOT(setChecked(bool))); - connect(song, SIGNAL(loopChanged(bool)), b2, SLOT(setChecked(bool))); + connect(MusEGlobal::song, SIGNAL(punchinChanged(bool)), b1, SLOT(setChecked(bool))); + connect(MusEGlobal::song, SIGNAL(punchoutChanged(bool)), b3, SLOT(setChecked(bool))); + connect(MusEGlobal::song, SIGNAL(loopChanged(bool)), b2, SLOT(setChecked(bool))); hbox->addLayout(button2); @@ -340,7 +342,7 @@ Transport::Transport(QWidget* parent, const char* name) marken->addWidget(tl1); l5 = new QLabel(tr("Left Mark")); - l5->setFont(MusEConfig::config.fonts[2]); + l5->setFont(MusEGlobal::config.fonts[2]); l5->setAlignment(Qt::AlignCenter); marken->addWidget(l5); @@ -352,7 +354,7 @@ Transport::Transport(QWidget* parent, const char* name) tl2->setFocusPolicy(Qt::NoFocus); l6 = new QLabel(tr("Right Mark")); - l6->setFont(MusEConfig::config.fonts[2]); + l6->setFont(MusEGlobal::config.fonts[2]); l6->setAlignment(Qt::AlignCenter); marken->addWidget(l6); @@ -427,11 +429,11 @@ Transport::Transport(QWidget* parent, const char* name) connect(buttons[3], SIGNAL(toggled(bool)), SLOT(stopToggled(bool))); connect(buttons[4], SIGNAL(toggled(bool)), SLOT(playToggled(bool))); - connect(buttons[5], SIGNAL(toggled(bool)), song, SLOT(setRecord(bool))); - connect(song, SIGNAL(recordChanged(bool)), SLOT(setRecord(bool))); - connect(buttons[0], SIGNAL(clicked()), song, SLOT(rewindStart())); - connect(buttons[1], SIGNAL(clicked()), song, SLOT(rewind())); - connect(buttons[2], SIGNAL(clicked()), song, SLOT(forward())); + connect(buttons[5], SIGNAL(toggled(bool)), MusEGlobal::song, SLOT(setRecord(bool))); + connect(MusEGlobal::song, SIGNAL(recordChanged(bool)), SLOT(setRecord(bool))); + connect(buttons[0], SIGNAL(clicked()), MusEGlobal::song, SLOT(rewindStart())); + connect(buttons[1], SIGNAL(clicked()), MusEGlobal::song, SLOT(rewind())); + connect(buttons[2], SIGNAL(clicked()), MusEGlobal::song, SLOT(forward())); box4->addLayout(tb); hbox->addLayout(box4); @@ -453,10 +455,10 @@ Transport::Transport(QWidget* parent, const char* name) jackTransportButton = newButton(tr("Jack"), tr("Jack transport sync on/off"), true,19); - quantizeButton->setChecked(song->quantize()); - clickButton->setChecked(song->click()); - syncButton->setChecked(extSyncFlag.value()); - jackTransportButton->setChecked(useJackTransport.value()); + quantizeButton->setChecked(MusEGlobal::song->quantize()); + clickButton->setChecked(MusEGlobal::song->click()); + syncButton->setChecked(MusEGlobal::extSyncFlag.value()); + jackTransportButton->setChecked(MusEGlobal::useJackTransport.value()); quantizeButton->setFocusPolicy(Qt::NoFocus); clickButton->setFocusPolicy(Qt::NoFocus); syncButton->setFocusPolicy(Qt::NoFocus); @@ -467,16 +469,16 @@ Transport::Transport(QWidget* parent, const char* name) button1->addWidget(syncButton); button1->addWidget(jackTransportButton); - connect(quantizeButton, SIGNAL(toggled(bool)), song, SLOT(setQuantize(bool))); - connect(clickButton, SIGNAL(toggled(bool)), song, SLOT(setClick(bool))); + connect(quantizeButton, SIGNAL(toggled(bool)), MusEGlobal::song, SLOT(setQuantize(bool))); + connect(clickButton, SIGNAL(toggled(bool)), MusEGlobal::song, SLOT(setClick(bool))); - connect(syncButton, SIGNAL(toggled(bool)), &extSyncFlag, SLOT(setValue(bool))); - connect(jackTransportButton, SIGNAL(toggled(bool)),&useJackTransport, SLOT(setValue(bool))); - connect(&extSyncFlag, SIGNAL(valueChanged(bool)), SLOT(syncChanged(bool))); - connect(&useJackTransport, SIGNAL(valueChanged(bool)), SLOT(jackSyncChanged(bool))); + connect(syncButton, SIGNAL(toggled(bool)), &MusEGlobal::extSyncFlag, SLOT(setValue(bool))); + connect(jackTransportButton, SIGNAL(toggled(bool)),&MusEGlobal::useJackTransport, SLOT(setValue(bool))); + connect(&MusEGlobal::extSyncFlag, SIGNAL(valueChanged(bool)), SLOT(syncChanged(bool))); + connect(&MusEGlobal::useJackTransport, SIGNAL(valueChanged(bool)), SLOT(jackSyncChanged(bool))); - connect(song, SIGNAL(quantizeChanged(bool)), this, SLOT(setQuantizeFlag(bool))); - connect(song, SIGNAL(clickChanged(bool)), this, SLOT(setClickFlag(bool))); + connect(MusEGlobal::song, SIGNAL(quantizeChanged(bool)), this, SLOT(setQuantizeFlag(bool))); + connect(MusEGlobal::song, SIGNAL(clickChanged(bool)), this, SLOT(setClickFlag(bool))); hbox->addLayout(button1); @@ -499,24 +501,24 @@ Transport::Transport(QWidget* parent, const char* name) masterButton->setFocusPolicy(Qt::NoFocus); box5->addWidget(masterButton); - connect(masterButton, SIGNAL(toggled(bool)), song, SLOT(setMasterFlag(bool))); + connect(masterButton, SIGNAL(toggled(bool)), MusEGlobal::song, SLOT(setMasterFlag(bool))); hbox->addLayout(box5); //----------------------------------------------------- - connect(tl1, SIGNAL(valueChanged(const Pos&)), SLOT(lposChanged(const Pos&))); - connect(tl2, SIGNAL(valueChanged(const Pos&)), SLOT(rposChanged(const Pos&))); - connect(time1, SIGNAL(valueChanged(const Pos&)), SLOT(cposChanged(const Pos&))); - connect(time2, SIGNAL(valueChanged(const Pos&)), SLOT(cposChanged(const Pos&))); + connect(tl1, SIGNAL(valueChanged(const MusECore::Pos&)), SLOT(lposChanged(const MusECore::Pos&))); + connect(tl2, SIGNAL(valueChanged(const MusECore::Pos&)), SLOT(rposChanged(const MusECore::Pos&))); + connect(time1, SIGNAL(valueChanged(const MusECore::Pos&)), SLOT(cposChanged(const MusECore::Pos&))); + connect(time2, SIGNAL(valueChanged(const MusECore::Pos&)), SLOT(cposChanged(const MusECore::Pos&))); connect(slider,SIGNAL(valueChanged(int)), SLOT(cposChanged(int))); - connect(song, SIGNAL(posChanged(int, unsigned, bool)), SLOT(setPos(int, unsigned, bool))); - connect(tempo, SIGNAL(tempoChanged(int)), song, SLOT(setTempo(int))); - ///connect(tempo, SIGNAL(sigChanged(int, int)), song, SLOT(setSig(int, int))); - connect(tempo, SIGNAL(sigChanged(const AL::TimeSignature&)), song, SLOT(setSig(const AL::TimeSignature&))); - connect(song, SIGNAL(playChanged(bool)), SLOT(setPlay(bool))); - connect(song, SIGNAL(songChanged(int)), this, SLOT(songChanged(int))); + connect(MusEGlobal::song, SIGNAL(posChanged(int, unsigned, bool)), SLOT(setPos(int, unsigned, bool))); + connect(tempo, SIGNAL(tempoChanged(int)), MusEGlobal::song, SLOT(setTempo(int))); + ///connect(tempo, SIGNAL(sigChanged(int, int)), MusEGlobal::song, SLOT(setSig(int, int))); + connect(tempo, SIGNAL(sigChanged(const AL::TimeSignature&)), MusEGlobal::song, SLOT(setSig(const AL::TimeSignature&))); + connect(MusEGlobal::song, SIGNAL(playChanged(bool)), SLOT(setPlay(bool))); + connect(MusEGlobal::song, SIGNAL(songChanged(int)), this, SLOT(songChanged(int))); connect(MusEGlobal::muse, SIGNAL(configChanged()), SLOT(configChanged())); @@ -536,13 +538,13 @@ Transport::~Transport() void Transport::configChanged() { - l2->setFont(MusEConfig::config.fonts[2]); - l3->setFont(MusEConfig::config.fonts[2]); - l5->setFont(MusEConfig::config.fonts[2]); - l6->setFont(MusEConfig::config.fonts[2]); + l2->setFont(MusEGlobal::config.fonts[2]); + l3->setFont(MusEGlobal::config.fonts[2]); + l5->setFont(MusEGlobal::config.fonts[2]); + l6->setFont(MusEGlobal::config.fonts[2]); QPalette pal; - pal.setColor(lefthandle->backgroundRole(), MusEConfig::config.transportHandleColor); + pal.setColor(lefthandle->backgroundRole(), MusEGlobal::config.transportHandleColor); lefthandle->setPalette(pal); righthandle->setPalette(pal); } @@ -597,8 +599,8 @@ void Transport::setPos(int idx, unsigned v, bool) slider->setValue(v); slider->blockSignals(false); } - if (song->masterFlag()) - setTempo(tempomap.tempo(v)); + if (MusEGlobal::song->masterFlag()) + setTempo(MusEGlobal::tempomap.tempo(v)); { int z, n; ///sigmap.timesig(v, z, n); @@ -621,34 +623,34 @@ void Transport::setPos(int idx, unsigned v, bool) void Transport::cposChanged(int tick) { - song->setPos(0, tick); + MusEGlobal::song->setPos(0, tick); } //--------------------------------------------------------- // cposChanged //--------------------------------------------------------- -void Transport::cposChanged(const Pos& pos) +void Transport::cposChanged(const MusECore::Pos& pos) { - song->setPos(0, pos.tick()); + MusEGlobal::song->setPos(0, pos.tick()); } //--------------------------------------------------------- // lposChanged //--------------------------------------------------------- -void Transport::lposChanged(const Pos& pos) +void Transport::lposChanged(const MusECore::Pos& pos) { - song->setPos(1, pos.tick()); + MusEGlobal::song->setPos(1, pos.tick()); } //--------------------------------------------------------- // rposChanged //--------------------------------------------------------- -void Transport::rposChanged(const Pos& pos) +void Transport::rposChanged(const MusECore::Pos& pos) { - song->setPos(2, pos.tick()); + MusEGlobal::song->setPos(2, pos.tick()); } //--------------------------------------------------------- @@ -709,7 +711,7 @@ void Transport::setSyncFlag(bool f) void Transport::setRecMode(int id) { - song->setRecMode(id); + MusEGlobal::song->setRecMode(id); } //--------------------------------------------------------- @@ -718,7 +720,7 @@ void Transport::setRecMode(int id) void Transport::setCycleMode(int id) { - song->setCycleMode(id); + MusEGlobal::song->setCycleMode(id); } //--------------------------------------------------------- @@ -731,11 +733,11 @@ void Transport::songChanged(int flags) if(flags == SC_MIDI_CONTROLLER) return; - slider->setRange(0, song->len()); - int cpos = song->cpos(); - int t = tempomap.tempo(cpos); + slider->setRange(0, MusEGlobal::song->len()); + int cpos = MusEGlobal::song->cpos(); + int t = MusEGlobal::tempomap.tempo(cpos); if (flags & (SC_MASTER | SC_TEMPO)) { - if (extSyncFlag.value()) + if (MusEGlobal::extSyncFlag.value()) setTempo(0); else setTempo(t); @@ -747,7 +749,7 @@ void Transport::songChanged(int flags) setTimesig(z, n); } if (flags & SC_MASTER) - masterButton->setChecked(song->masterFlag()); + masterButton->setChecked(MusEGlobal::song->masterFlag()); } //--------------------------------------------------------- @@ -766,11 +768,11 @@ void Transport::syncChanged(bool flag) masterButton->setEnabled(!flag); if (flag) { masterButton->setChecked(false); - song->setMasterFlag(false); + MusEGlobal::song->setMasterFlag(false); tempo->setTempo(0); // slave mode: show "extern" } else - tempo->setTempo(tempomap.tempo(song->cpos())); + tempo->setTempo(MusEGlobal::tempomap.tempo(MusEGlobal::song->cpos())); MusEGlobal::playAction->setEnabled(!flag); MusEGlobal::startAction->setEnabled(!flag); MusEGlobal::stopAction->setEnabled(!flag); @@ -789,7 +791,7 @@ void Transport::jackSyncChanged(bool flag) void Transport::stopToggled(bool val) { if (val) - song->setStop(true); + MusEGlobal::song->setStop(true); else { buttons[3]->blockSignals(true); buttons[3]->setChecked(true); @@ -804,7 +806,7 @@ void Transport::stopToggled(bool val) void Transport::playToggled(bool val) { if (val) - song->setPlay(true); + MusEGlobal::song->setPlay(true); else { buttons[4]->blockSignals(true); buttons[4]->setChecked(true); @@ -812,3 +814,4 @@ void Transport::playToggled(bool val) } } +} // namespace MusEGui diff --git a/muse2/muse/transport.h b/muse2/muse/transport.h index abe1534f..9508b510 100644 --- a/muse2/muse/transport.h +++ b/muse2/muse/transport.h @@ -40,12 +40,13 @@ class QLabel; class QSlider; class QToolButton; -namespace MusEWidget { -class DoubleLabel; -class SigLabel; +namespace MusECore { +class Pos; } -class Pos; +namespace MusEGui { +class DoubleLabel; +class SigLabel; //--------------------------------------------------------- // TempoSig @@ -54,8 +55,8 @@ class Pos; class TempoSig : public QWidget { Q_OBJECT - MusEWidget::DoubleLabel* l1; - MusEWidget::SigLabel* l2; + DoubleLabel* l1; + SigLabel* l2; QLabel* l3; @@ -122,10 +123,10 @@ class Transport : public QWidget Handle *lefthandle, *righthandle; private slots: - void cposChanged(const Pos&); + void cposChanged(const MusECore::Pos&); void cposChanged(int); - void lposChanged(const Pos&); - void rposChanged(const Pos&); + void lposChanged(const MusECore::Pos&); + void rposChanged(const MusECore::Pos&); void setRecMode(int); void setCycleMode(int); void songChanged(int); @@ -152,5 +153,8 @@ class Transport : public QWidget ~Transport(); QColor getHandleColor() const { return lefthandle->palette().color(QPalette::Window); } }; + +} // namespace MusEGui + #endif diff --git a/muse2/muse/undo.cpp b/muse2/muse/undo.cpp index 63911fcf..5bbcfcd8 100644 --- a/muse2/muse/undo.cpp +++ b/muse2/muse/undo.cpp @@ -32,6 +32,8 @@ #include <QAction> #include <set> +namespace MusECore { + // iundo points to last Undo() in Undo-list static bool undoMode = false; // for debugging @@ -500,12 +502,12 @@ void Song::doUndo2() break; case UndoOp::AddTempo: //printf("doUndo2: UndoOp::AddTempo. deleting tempo at: %d\n", i->a); - tempomap.delTempo(i->a); + MusEGlobal::tempomap.delTempo(i->a); updateFlags |= SC_TEMPO; break; case UndoOp::DeleteTempo: //printf("doUndo2: UndoOp::DeleteTempo. adding tempo at: %d, tempo=%d\n", i->a, i->b); - tempomap.addTempo(i->a, i->b); + MusEGlobal::tempomap.addTempo(i->a, i->b); updateFlags |= SC_TEMPO; break; case UndoOp::AddSig: @@ -520,12 +522,12 @@ void Song::doUndo2() break; case UndoOp::AddKey: ///sigmap.del(i->a); - keymap.delKey(i->a); + MusEGlobal::keymap.delKey(i->a); updateFlags |= SC_KEY; break; case UndoOp::DeleteKey: ///sigmap.add(i->a, i->b, i->c); - keymap.addKey(i->a, (key_enum)i->b); + MusEGlobal::keymap.addKey(i->a, (key_enum)i->b); updateFlags |= SC_KEY; break; case UndoOp::ModifyClip: @@ -739,12 +741,12 @@ void Song::doRedo2() break; case UndoOp::AddTempo: //printf("doRedo2: UndoOp::AddTempo. adding tempo at: %d with tempo=%d\n", i->a, i->b); - tempomap.addTempo(i->a, i->b); + MusEGlobal::tempomap.addTempo(i->a, i->b); updateFlags |= SC_TEMPO; break; case UndoOp::DeleteTempo: //printf("doRedo2: UndoOp::DeleteTempo. deleting tempo at: %d with tempo=%d\n", i->a, i->b); - tempomap.delTempo(i->a); + MusEGlobal::tempomap.delTempo(i->a); updateFlags |= SC_TEMPO; break; case UndoOp::AddSig: @@ -758,11 +760,11 @@ void Song::doRedo2() updateFlags |= SC_SIG; break; case UndoOp::AddKey: - keymap.addKey(i->a, (key_enum)i->b); + MusEGlobal::keymap.addKey(i->a, (key_enum)i->b); updateFlags |= SC_KEY; break; case UndoOp::DeleteKey: - keymap.delKey(i->a); + MusEGlobal::keymap.delKey(i->a); updateFlags |= SC_KEY; break; case UndoOp::ModifyClip: @@ -931,7 +933,7 @@ bool Song::doUndo1() break; case UndoOp::ModifyClip: - SndFile::applyUndoFile(i->filename, i->tmpwavfile, i->startframe, i->endframe); + MusECore::SndFile::applyUndoFile(i->filename, i->tmpwavfile, i->startframe, i->endframe); break; default: @@ -1022,7 +1024,7 @@ bool Song::doRedo1() removeTrack1(i->oTrack); break; case UndoOp::ModifyClip: - SndFile::applyUndoFile(i->filename, i->tmpwavfile, i->startframe, i->endframe); + MusECore::SndFile::applyUndoFile(i->filename, i->tmpwavfile, i->startframe, i->endframe); break; default: break; @@ -1085,3 +1087,5 @@ bool Undo::empty() const return true; } + +} // namespace MusECore diff --git a/muse2/muse/undo.h b/muse2/muse/undo.h index f2a523cc..42a80763 100644 --- a/muse2/muse/undo.h +++ b/muse2/muse/undo.h @@ -31,6 +31,8 @@ class QString; +namespace MusECore { + class Track; class TEvent; class SigEvent; @@ -133,5 +135,6 @@ class UndoList : public std::list<Undo> { typedef UndoList::iterator iUndo; +} // namespace MusECore #endif // __UNDO_H__ diff --git a/muse2/muse/value.cpp b/muse2/muse/value.cpp index a7e59ea4..34d2856f 100644 --- a/muse2/muse/value.cpp +++ b/muse2/muse/value.cpp @@ -24,6 +24,7 @@ #include "value.h" #include "xml.h" +namespace MusECore { IValue::IValue(QObject* parent, const char* name) : QObject(parent) @@ -75,3 +76,4 @@ void IValue::setValue(int v) } } +} // namespace MusECore diff --git a/muse2/muse/value.h b/muse2/muse/value.h index 56efbf32..a0318665 100644 --- a/muse2/muse/value.h +++ b/muse2/muse/value.h @@ -26,6 +26,8 @@ #include <QObject> +namespace MusECore { + class Xml; //--------------------------------------------------------- @@ -74,5 +76,7 @@ class BValue : public QObject { void save(int level, Xml& xml); }; +} // namespace MusECore + #endif diff --git a/muse2/muse/vst.cpp b/muse2/muse/vst.cpp index e0c291e3..f72d426b 100644 --- a/muse2/muse/vst.cpp +++ b/muse2/muse/vst.cpp @@ -44,6 +44,8 @@ #include "midi.h" #include "xml.h" +namespace MusECore { + extern "C" void fst_error(const char *fmt, ...); extern long vstHostCallback (AEffect*, long, long, long, void*, float); @@ -642,7 +644,12 @@ bool VstSynthIF::putEvent(const MidiPlayEvent& ev) int rv = plugin->dispatcher(plugin, effProcessEvents, 0, 0, &events, 0.0f); return false; } + +} // namespace MusECore + #else +namespace MusECore { void initVST() {} +} // namespace MusECore #endif diff --git a/muse2/muse/vst.h b/muse2/muse/vst.h index 33303277..b57b598d 100644 --- a/muse2/muse/vst.h +++ b/muse2/muse/vst.h @@ -26,7 +26,12 @@ #include "synth.h" //class QMenu; + +namespace MusEGui { class PopupMenu; +} + +namespace MusECore { struct _FSTHandle; struct _FST; @@ -100,6 +105,7 @@ class VstSynthIF : public SynthIF virtual int getControllerInfo(int, const char**, int*, int*, int*, int*) { return 0; } }; +} // namespace MusECore #endif diff --git a/muse2/muse/wave.cpp b/muse2/muse/wave.cpp index e9fa64d2..06759441 100644 --- a/muse2/muse/wave.cpp +++ b/muse2/muse/wave.cpp @@ -46,6 +46,8 @@ //#define WAVE_DEBUG //#define WAVE_DEBUG_PRC +namespace MusECore { + /* const char* audioFilePattern[] = { "Wave/Binary (*.wav *.ogg *.bin)", @@ -747,7 +749,7 @@ void SndFile::applyUndoFile(const QString& original, const QString& tmpfile, uns } } - audio->msgIdle(true); + MusEGlobal::audio->msgIdle(true); tmp.setFormat(orig->format(), orig->channels(), orig->samplerate()); // Read data in original file to memory before applying tmpfile to original @@ -789,7 +791,7 @@ void SndFile::applyUndoFile(const QString& original, const QString& tmpfile, uns // Write the overwritten data to the tmpfile if (tmp.openWrite()) { printf("Cannot open tmpfile for writing - redo operation of this file won't be possible. Aborting.\n"); - audio->msgIdle(false); + MusEGlobal::audio->msgIdle(false); return; } tmp.seek(0, 0); @@ -804,89 +806,9 @@ void SndFile::applyUndoFile(const QString& original, const QString& tmpfile, uns orig->close(); orig->openRead(); orig->update(); - audio->msgIdle(false); - } - -namespace MusEApp { - -//--------------------------------------------------------- -// importAudio -//--------------------------------------------------------- - -void MusE::importWave() - { - Track* track = _arranger->curTrack(); - if (track == 0 || track->type() != Track::WAVE) { - QMessageBox::critical(this, QString("MusE"), - tr("to import an audio file you have first to select" - "a wave track")); - return; - } - //QString fn = MusEWidget::getOpenFileName(MusEGlobal::lastWavePath, audioFilePattern, this, - QString fn = MusEWidget::getOpenFileName(MusEGlobal::lastWavePath, MusEGlobal::audio_file_pattern, this, - tr("Import Wave File"), 0); - if (!fn.isEmpty()) { - MusEGlobal::lastWavePath = fn; - importWaveToTrack(fn); - } - } - -//--------------------------------------------------------- -// importWaveToTrack -//--------------------------------------------------------- - -bool MusE::importWaveToTrack(QString& name, unsigned tick, Track* track) - { - if (track==NULL) - track = (WaveTrack*)(_arranger->curTrack()); - - SndFile* f = getWave(name, true); - - if (f == 0) { - printf("import audio file failed\n"); - return true; - } - int samples = f->samples(); - if ((unsigned)MusEGlobal::sampleRate !=f->samplerate()) { - if(QMessageBox::question(this, tr("Import Wavefile"), - tr("This wave file has a samplerate of %1,\n" - "as opposed to current setting %2.\n" - "Do you still want to import it?").arg(f->samplerate()).arg(MusEGlobal::sampleRate), - tr("&Yes"), tr("&No"), - QString::null, 0, 1 )) - { - //printf("why won't muse let me delete the file object? %d\n", f->getRefCount()); - if (f->getRefCount() == 0) - delete f; - return true; - } - } - track->setChannels(f->channels()); - - WavePart* part = new WavePart((WaveTrack *)track); - if (tick) - part->setTick(tick); - else - part->setTick(song->cpos()); - part->setLenFrame(samples); - - Event event(Wave); - SndFileR sf(f); - event.setSndFile(sf); - event.setSpos(0); - event.setLenFrame(samples); - part->addEvent(event); - - part->setName(QFileInfo(name).completeBaseName()); - audio->msgAddPart(part); - unsigned endTick = part->tick() + part->lenTick(); - if (song->len() < endTick) - song->setLen(endTick); - return false; + MusEGlobal::audio->msgIdle(false); } -} // namespace MusEApp - #if 0 //--------------------------------------------------------- // Clip @@ -1061,13 +983,13 @@ int ClipList::idx(const Clip& clip) const // cmdAddRecordedWave //--------------------------------------------------------- -//void Song::cmdAddRecordedWave(WaveTrack* track, const Pos& s, const Pos& e) -void Song::cmdAddRecordedWave(WaveTrack* track, Pos s, Pos e) +//void Song::cmdAddRecordedWave(WaveTrack* track, const MusECore::Pos& s, const MusECore::Pos& e) +void Song::cmdAddRecordedWave(MusECore::WaveTrack* track, MusECore::Pos s, MusECore::Pos e) { if (MusEGlobal::debugMsg) - printf("cmdAddRecordedWave - loopCount = %d, punchin = %d", audio->loopCount(), punchin()); + printf("cmdAddRecordedWave - loopCount = %d, punchin = %d", MusEGlobal::audio->loopCount(), punchin()); - SndFile* f = track->recFile(); + MusECore::SndFile* f = track->recFile(); if (f == 0) { printf("cmdAddRecordedWave: no snd file for track <%s>\n", track->name().toLatin1().constData()); @@ -1080,13 +1002,13 @@ void Song::cmdAddRecordedWave(WaveTrack* track, Pos s, Pos e) // Added by Tim. p3.3.8 - if((audio->loopCount() > 0 && s.tick() > lPos().tick()) || (punchin() && s.tick() < lPos().tick())) + if((MusEGlobal::audio->loopCount() > 0 && s.tick() > lPos().tick()) || (punchin() && s.tick() < lPos().tick())) s.setTick(lPos().tick()); // If we are looping, just set the end to the right marker, since we don't know how many loops have occurred. // (Fixed: Added Audio::loopCount) // Otherwise if punchout is on, limit the end to the right marker. //if(loop() || (punchout() && e.tick() > rPos().tick()) ) - if((audio->loopCount() > 0) || (punchout() && e.tick() > rPos().tick()) ) + if((MusEGlobal::audio->loopCount() > 0) || (punchout() && e.tick() > rPos().tick()) ) e.setTick(rPos().tick()); // No part to be created? Delete the rec sound file. if(s.tick() >= e.tick()) @@ -1101,20 +1023,20 @@ void Song::cmdAddRecordedWave(WaveTrack* track, Pos s, Pos e) return; } // Round the start down using the Arranger part snap raster value. - unsigned startTick = AL::sigmap.raster1(s.tick(), song->arrangerRaster()); + unsigned startTick = AL::sigmap.raster1(s.tick(), MusEGlobal::song->arrangerRaster()); // Round the end up using the Arranger part snap raster value. - unsigned endTick = AL::sigmap.raster2(e.tick(), song->arrangerRaster()); + unsigned endTick = AL::sigmap.raster2(e.tick(), MusEGlobal::song->arrangerRaster()); f->update(); - WavePart* part = new WavePart(track); + MusECore::WavePart* part = new MusECore::WavePart(track); part->setTick(startTick); part->setLenTick(endTick - startTick); part->setName(track->name()); // create Event - Event event(Wave); - SndFileR sf(f); + MusECore::Event event(MusECore::Wave); + MusECore::SndFileR sf(f); event.setSndFile(sf); // We are done with the _recFile member. Set to zero. The function which // calls this function already does this immediately after. But do it here anyway. @@ -1131,10 +1053,10 @@ void Song::cmdAddRecordedWave(WaveTrack* track, Pos s, Pos e) event.setLenFrame(e.frame() - s.frame()); part->addEvent(event); - song->cmdAddPart(part); + MusEGlobal::song->cmdAddPart(part); - if (song->len() < endTick) - song->setLen(endTick); + if (MusEGlobal::song->len() < endTick) + MusEGlobal::song->setLen(endTick); } //--------------------------------------------------------- @@ -1147,7 +1069,7 @@ void Song::cmdChangeWave(QString original, QString tmpfile, unsigned sx, unsigne char* tmpfile_charstr = new char[tmpfile.length() + 1]; strcpy(original_charstr, original.toLatin1().constData()); strcpy(tmpfile_charstr, tmpfile.toLatin1().constData()); - song->undoOp(UndoOp::ModifyClip, original_charstr, tmpfile_charstr, sx, ex); + MusEGlobal::song->undoOp(UndoOp::ModifyClip, original_charstr, tmpfile_charstr, sx, ex); } //--------------------------------------------------------- @@ -1197,3 +1119,86 @@ SndFileR::~SndFileR() sf=NULL; } } + +} // namespace MusECore + +namespace MusEGui { + +//--------------------------------------------------------- +// importAudio +//--------------------------------------------------------- + +void MusE::importWave() + { + MusECore::Track* track = _arranger->curTrack(); + if (track == 0 || track->type() != MusECore::Track::WAVE) { + QMessageBox::critical(this, QString("MusE"), + tr("to import an audio file you have first to select" + "a wave track")); + return; + } + //QString fn = MusEGui::getOpenFileName(MusEGlobal::lastWavePath, audioFilePattern, this, + QString fn = MusEGui::getOpenFileName(MusEGlobal::lastWavePath, MusEGlobal::audio_file_pattern, this, + tr("Import Wave File"), 0); + if (!fn.isEmpty()) { + MusEGlobal::lastWavePath = fn; + importWaveToTrack(fn); + } + } + +//--------------------------------------------------------- +// importWaveToTrack +//--------------------------------------------------------- + +bool MusE::importWaveToTrack(QString& name, unsigned tick, MusECore::Track* track) + { + if (track==NULL) + track = (MusECore::WaveTrack*)(_arranger->curTrack()); + + MusECore::SndFile* f = MusECore::getWave(name, true); + + if (f == 0) { + printf("import audio file failed\n"); + return true; + } + int samples = f->samples(); + if ((unsigned)MusEGlobal::sampleRate !=f->samplerate()) { + if(QMessageBox::question(this, tr("Import Wavefile"), + tr("This wave file has a samplerate of %1,\n" + "as opposed to current setting %2.\n" + "Do you still want to import it?").arg(f->samplerate()).arg(MusEGlobal::sampleRate), + tr("&Yes"), tr("&No"), + QString::null, 0, 1 )) + { + //printf("why won't muse let me delete the file object? %d\n", f->getRefCount()); + if (f->getRefCount() == 0) + delete f; + return true; + } + } + track->setChannels(f->channels()); + + MusECore::WavePart* part = new MusECore::WavePart((MusECore::WaveTrack *)track); + if (tick) + part->setTick(tick); + else + part->setTick(MusEGlobal::song->cpos()); + part->setLenFrame(samples); + + MusECore::Event event(MusECore::Wave); + MusECore::SndFileR sf(f); + event.setSndFile(sf); + event.setSpos(0); + event.setLenFrame(samples); + part->addEvent(event); + + part->setName(QFileInfo(name).completeBaseName()); + MusEGlobal::audio->msgAddPart(part); + unsigned endTick = part->tick() + part->lenTick(); + if (MusEGlobal::song->len() < endTick) + MusEGlobal::song->setLen(endTick); + return false; + } + +} // namespace MusEGui + diff --git a/muse2/muse/wave.h b/muse2/muse/wave.h index 231ed7dc..58e0ab87 100644 --- a/muse2/muse/wave.h +++ b/muse2/muse/wave.h @@ -30,6 +30,9 @@ #include <QString> class QFileInfo; + +namespace MusECore { + class Xml; //--------------------------------------------------------- @@ -282,5 +285,8 @@ extern ClipBase* readClip(Xml& xml); #endif extern SndFile* getWave(const QString& name, bool readOnlyFlag); + +} // namespace MusECore + #endif diff --git a/muse2/muse/waveedit/editgain.cpp b/muse2/muse/waveedit/editgain.cpp index bcb19928..5738f21d 100644 --- a/muse2/muse/waveedit/editgain.cpp +++ b/muse2/muse/waveedit/editgain.cpp @@ -36,6 +36,8 @@ #include "editgain.h" +namespace MusEGui { + EditGain::EditGain(QWidget* parent, int initGainValue) : QDialog(parent) { @@ -111,3 +113,5 @@ int EditGain::getGain() { return gain; } + +} // namespace MusEGui diff --git a/muse2/muse/waveedit/editgain.h b/muse2/muse/waveedit/editgain.h index 5d41c7d4..86474cfc 100644 --- a/muse2/muse/waveedit/editgain.h +++ b/muse2/muse/waveedit/editgain.h @@ -39,6 +39,8 @@ class QDialog; +namespace MusEGui { + class EditGain : public QDialog, public Ui::EditGainBase { Q_OBJECT @@ -58,4 +60,6 @@ private slots: void gainChanged(int value); }; +} // namespace MusEGui + #endif diff --git a/muse2/muse/waveedit/waveedit.cpp b/muse2/muse/waveedit/waveedit.cpp index a2167a50..424f0688 100644 --- a/muse2/muse/waveedit/waveedit.cpp +++ b/muse2/muse/waveedit/waveedit.cpp @@ -52,8 +52,11 @@ #include "icons.h" #include "shortcuts.h" +namespace MusECore { +extern QColor readColor(MusECore::Xml& xml); +} -extern QColor readColor(Xml& xml); +namespace MusEGui { //--------------------------------------------------------- // closeEvent @@ -72,7 +75,7 @@ void WaveEdit::closeEvent(QCloseEvent* e) // WaveEdit //--------------------------------------------------------- -WaveEdit::WaveEdit(PartList* pl) +WaveEdit::WaveEdit(MusECore::PartList* pl) : MidiEditor(TopWin::WAVE, 1, pl) { setFocusPolicy(Qt::StrongFocus); @@ -202,10 +205,10 @@ WaveEdit::WaveEdit(PartList* pl) tb1->addWidget(label); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); label->setIndent(3); - pos1 = new MusEWidget::PosLabel(0); + pos1 = new PosLabel(0); pos1->setFixedHeight(22); tb1->addWidget(pos1); - pos2 = new MusEWidget::PosLabel(0); + pos2 = new PosLabel(0); pos2->setFixedHeight(22); pos2->setSmpte(true); tb1->addWidget(pos2); @@ -218,14 +221,14 @@ WaveEdit::WaveEdit(PartList* pl) int xscale; if (!parts()->empty()) { // Roughly match total size of part - Part* firstPart = parts()->begin()->second; + MusECore::Part* firstPart = parts()->begin()->second; xscale = 0 - firstPart->lenFrame()/_widthInit[_type]; } else { xscale = -8000; } - hscroll = new MusEWidget::ScrollScale(1, -32768, xscale, 10000, Qt::Horizontal, mainw, 0, true, 10000.0); + hscroll = new ScrollScale(1, -32768, xscale, 10000, Qt::Horizontal, mainw, 0, true, 10000.0); view = new WaveView(this, mainw, xscale, yscale); wview = view; // HACK! @@ -236,7 +239,7 @@ WaveEdit::WaveEdit(PartList* pl) ymag->setPageStep(256); ymag->setValue(yscale); - time = new MusEWidget::MTScale(&_raster, mainw, xscale, true); + time = new MTScale(&_raster, mainw, xscale, true); ymag->setFixedWidth(16); connect(view, SIGNAL(mouseWheelMoved(int)), this, SLOT(moveVerticalSlider(int))); connect(ymag, SIGNAL(valueChanged(int)), view, SLOT(setYScale(int))); @@ -249,7 +252,7 @@ WaveEdit::WaveEdit(PartList* pl) mainGrid->setColumnStretch(0, 100); mainGrid->addWidget(time, 0, 0, 1, 2); - mainGrid->addWidget(MusEUtil::hLine(mainw), 1, 0, 1, 2); + mainGrid->addWidget(MusECore::hLine(mainw), 1, 0, 1, 2); mainGrid->addWidget(view, 2, 0); mainGrid->addWidget(ymag, 2, 1); mainGrid->addWidget(hscroll, 3, 0); @@ -270,7 +273,7 @@ WaveEdit::WaveEdit(PartList* pl) connect(view, SIGNAL(horizontalScroll(unsigned)),hscroll, SLOT(setPos(unsigned))); connect(hscroll, SIGNAL(scaleChanged(int)), SLOT(updateHScrollRange())); - connect(song, SIGNAL(songChanged(int)), SLOT(songChanged1(int))); + connect(MusEGlobal::song, SIGNAL(songChanged(int)), SLOT(songChanged1(int))); initShortcuts(); @@ -279,7 +282,7 @@ WaveEdit::WaveEdit(PartList* pl) if(!parts()->empty()) { - WavePart* part = (WavePart*)(parts()->begin()->second); + MusECore::WavePart* part = (MusECore::WavePart*)(parts()->begin()->second); solo->setChecked(part->track()->solo()); } @@ -301,7 +304,7 @@ void WaveEdit::initShortcuts() void WaveEdit::configChanged() { - view->setBg(MusEConfig::config.waveEditBackgroundColor); + view->setBg(MusEGlobal::config.waveEditBackgroundColor); selectAllAction->setShortcut(shortcuts[SHRT_SELECT_ALL].key); selectNoneAction->setShortcut(shortcuts[SHRT_SELECT_NONE].key); } @@ -332,7 +335,7 @@ void WaveEdit::updateHScrollRange() void WaveEdit::setTime(unsigned samplepos) { // printf("setTime %d %x\n", samplepos, samplepos); - unsigned tick = tempomap.frame2tick(samplepos); + unsigned tick = MusEGlobal::tempomap.frame2tick(samplepos); pos1->setValue(tick); //pos2->setValue(tick); pos2->setValue(samplepos); @@ -361,27 +364,27 @@ void WaveEdit::cmd(int n) // loadConfiguration //--------------------------------------------------------- -void WaveEdit::readConfiguration(Xml& xml) +void WaveEdit::readConfiguration(MusECore::Xml& xml) { for (;;) { - Xml::Token token = xml.parse(); + MusECore::Xml::Token token = xml.parse(); const QString& tag = xml.s1(); switch (token) { - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "bgcolor") - MusEConfig::config.waveEditBackgroundColor = readColor(xml); + MusEGlobal::config.waveEditBackgroundColor = readColor(xml); else if (tag == "topwin") TopWin::readConfiguration(WAVE, xml); else xml.unknown("WaveEdit"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "waveedit") return; default: break; - case Xml::Error: - case Xml::End: + case MusECore::Xml::Error: + case MusECore::Xml::End: return; } } @@ -391,10 +394,10 @@ void WaveEdit::readConfiguration(Xml& xml) // saveConfiguration //--------------------------------------------------------- -void WaveEdit::writeConfiguration(int level, Xml& xml) +void WaveEdit::writeConfiguration(int level, MusECore::Xml& xml) { xml.tag(level++, "waveedit"); - xml.colorTag(level, "bgcolor", MusEConfig::config.waveEditBackgroundColor); + xml.colorTag(level, "bgcolor", MusEGlobal::config.waveEditBackgroundColor); TopWin::writeConfiguration(WAVE, level,xml); xml.tag(level, "/waveedit"); } @@ -403,7 +406,7 @@ void WaveEdit::writeConfiguration(int level, Xml& xml) // writeStatus //--------------------------------------------------------- -void WaveEdit::writeStatus(int level, Xml& xml) const +void WaveEdit::writeStatus(int level, MusECore::Xml& xml) const { writePartList(level, xml); xml.tag(level++, "waveedit"); @@ -418,15 +421,15 @@ void WaveEdit::writeStatus(int level, Xml& xml) const // readStatus //--------------------------------------------------------- -void WaveEdit::readStatus(Xml& xml) +void WaveEdit::readStatus(MusECore::Xml& xml) { for (;;) { - Xml::Token token = xml.parse(); - if (token == Xml::Error || token == Xml::End) + MusECore::Xml::Token token = xml.parse(); + if (token == MusECore::Xml::Error || token == MusECore::Xml::End) break; QString tag = xml.s1(); switch (token) { - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "midieditor") MidiEditor::readStatus(xml); else if (tag == "xmag") @@ -438,7 +441,7 @@ void WaveEdit::readStatus(Xml& xml) else xml.unknown("WaveEdit"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "waveedit") return; default: @@ -458,7 +461,7 @@ void WaveEdit::songChanged1(int bits) if (bits & SC_SOLO) { - WavePart* part = (WavePart*)(parts()->begin()->second); + MusECore::WavePart* part = (MusECore::WavePart*)(parts()->begin()->second); solo->blockSignals(true); solo->setChecked(part->track()->solo()); solo->blockSignals(false); @@ -475,9 +478,9 @@ void WaveEdit::songChanged1(int bits) void WaveEdit::soloChanged(bool flag) { - WavePart* part = (WavePart*)(parts()->begin()->second); - audio->msgSetSolo(part->track(), flag); - song->update(SC_SOLO); + MusECore::WavePart* part = (MusECore::WavePart*)(parts()->begin()->second); + MusEGlobal::audio->msgSetSolo(part->track(), flag); + MusEGlobal::song->update(SC_SOLO); } //--------------------------------------------------------- @@ -509,11 +512,11 @@ void WaveEdit::moveVerticalSlider(int val) void WaveEdit::horizontalZoomIn() { int mag = hscroll->mag(); - int zoomlvl = MusEWidget::ScrollScale::getQuickZoomLevel(mag); + int zoomlvl = ScrollScale::getQuickZoomLevel(mag); if (zoomlvl < 23) zoomlvl++; - int newmag = MusEWidget::ScrollScale::convertQuickZoomLevelToMag(zoomlvl); + int newmag = ScrollScale::convertQuickZoomLevelToMag(zoomlvl); hscroll->setMag(newmag); @@ -522,12 +525,14 @@ void WaveEdit::horizontalZoomIn() void WaveEdit::horizontalZoomOut() { int mag = hscroll->mag(); - int zoomlvl = MusEWidget::ScrollScale::getQuickZoomLevel(mag); + int zoomlvl = ScrollScale::getQuickZoomLevel(mag); if (zoomlvl > 1) zoomlvl--; - int newmag = MusEWidget::ScrollScale::convertQuickZoomLevelToMag(zoomlvl); + int newmag = ScrollScale::convertQuickZoomLevelToMag(zoomlvl); hscroll->setMag(newmag); } + +} // namespace MusEGui diff --git a/muse2/muse/waveedit/waveedit.h b/muse2/muse/waveedit/waveedit.h index 64929555..b40aa93a 100644 --- a/muse2/muse/waveedit/waveedit.h +++ b/muse2/muse/waveedit/waveedit.h @@ -33,18 +33,21 @@ #include "midieditor.h" +class QAction; +class QResizeEvent; +class QSlider; class QToolButton; + +namespace MusECore { class PartList; -class WaveView; -class ScrollScale; -class QSlider; -class QResizeEvent; -class SNode; -class QAction; +} + +namespace MusEGui { -namespace MusEWidget { class PosLabel; -} +class ScrollScale; +class SNode; +class WaveView; //--------------------------------------------------------- // WaveEdit @@ -58,8 +61,8 @@ class WaveEdit : public MidiEditor { QToolBar* tools; QToolBar* tb1; QToolButton* solo; - MusEWidget::PosLabel* pos1; - MusEWidget::PosLabel* pos2; + MusEGui::PosLabel* pos1; + MusEGui::PosLabel* pos2; QAction* selectAllAction; QAction* selectNoneAction; QAction* cutAction; @@ -91,15 +94,15 @@ class WaveEdit : public MidiEditor { signals: - void deleted(TopWin*); + void deleted(MusEGui::TopWin*); public: - WaveEdit(PartList*); + WaveEdit(MusECore::PartList*); ~WaveEdit(); - virtual void readStatus(Xml&); - virtual void writeStatus(int, Xml&) const; - static void readConfiguration(Xml&); - static void writeConfiguration(int, Xml&); + virtual void readStatus(MusECore::Xml&); + virtual void writeStatus(int, MusECore::Xml&) const; + static void readConfiguration(MusECore::Xml&); + static void writeConfiguration(int, MusECore::Xml&); enum { CMD_MUTE=0, CMD_NORMALIZE, CMD_FADE_IN, CMD_FADE_OUT, CMD_REVERSE, CMD_GAIN_FREE, CMD_GAIN_200, CMD_GAIN_150, CMD_GAIN_75, CMD_GAIN_50, CMD_GAIN_25, @@ -108,5 +111,7 @@ class WaveEdit : public MidiEditor { CMD_SELECT_ALL, CMD_SELECT_NONE }; }; +} // namespace MusEGui + #endif diff --git a/muse2/muse/waveedit/waveview.cpp b/muse2/muse/waveedit/waveview.cpp index 9b11feb8..04751428 100644 --- a/muse2/muse/waveedit/waveview.cpp +++ b/muse2/muse/waveedit/waveview.cpp @@ -42,19 +42,21 @@ #include "gconfig.h" #include "fastlog.h" +namespace MusEGui { + bool modifyWarnedYet = false; //--------------------------------------------------------- // WaveView //--------------------------------------------------------- WaveView::WaveView(MidiEditor* pr, QWidget* parent, int xscale, int yscale) - : MusEWidget::View(parent, xscale, 1) + : View(parent, xscale, 1) { editor = pr; setVirt(true); - pos[0] = tempomap.tick2frame(song->cpos()); - pos[1] = tempomap.tick2frame(song->lpos()); - pos[2] = tempomap.tick2frame(song->rpos()); + pos[0] = MusEGlobal::tempomap.tick2frame(MusEGlobal::song->cpos()); + pos[1] = MusEGlobal::tempomap.tick2frame(MusEGlobal::song->lpos()); + pos[2] = MusEGlobal::tempomap.tick2frame(MusEGlobal::song->rpos()); yScale = yscale; mode = NORMAL; selectionStart = 0; @@ -71,13 +73,13 @@ WaveView::WaveView(MidiEditor* pr, QWidget* parent, int xscale, int yscale) curPartId = -1; } else { - curPart = (WavePart*)(editor->parts()->begin()->second); + curPart = (MusECore::WavePart*)(editor->parts()->begin()->second); curPartId = curPart->sn(); } - connect(song, SIGNAL(posChanged(int,unsigned,bool)), SLOT(setPos(int,unsigned,bool))); - connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); + connect(MusEGlobal::song, SIGNAL(posChanged(int,unsigned,bool)), SLOT(setPos(int,unsigned,bool))); + connect(MusEGlobal::song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); songChanged(SC_SELECTION); } @@ -112,17 +114,17 @@ void WaveView::pdraw(QPainter& p, const QRect& rr) if (xScale < 0) xScale = -xScale; - for (iPart ip = editor->parts()->begin(); ip != editor->parts()->end(); ++ip) { - WavePart* wp = (WavePart*)(ip->second); + for (MusECore::iPart ip = editor->parts()->begin(); ip != editor->parts()->end(); ++ip) { + MusECore::WavePart* wp = (MusECore::WavePart*)(ip->second); int channels = wp->track()->channels(); int px = wp->frame(); - EventList* el = wp->events(); - for (iEvent e = el->begin(); e != el->end(); ++e) { - Event event = e->second; + MusECore::EventList* el = wp->events(); + for (MusECore::iEvent e = el->begin(); e != el->end(); ++e) { + MusECore::Event event = e->second; if (event.empty()) continue; - SndFileR f = event.sndFile(); + MusECore::SndFileR f = event.sndFile(); if (f.isNull()) continue; @@ -149,7 +151,7 @@ void WaveView::pdraw(QPainter& p, const QRect& rr) for (int i = sx; i < ex; i++) { y = rr.y() + h; - SampleV sa[f.channels()]; + MusECore::SampleV sa[f.channels()]; f.read(sa, xScale, pos); pos += xScale; if (pos < event.spos()) @@ -267,8 +269,8 @@ void WaveView::songChanged(int flags) startSample = MAXINT; endSample = 0; curPart = 0; - for (iPart p = editor->parts()->begin(); p != editor->parts()->end(); ++p) { - WavePart* part = (WavePart*)(p->second); + for (MusECore::iPart p = editor->parts()->begin(); p != editor->parts()->end(); ++p) { + MusECore::WavePart* part = (MusECore::WavePart*)(p->second); if (part->sn() == curPartId) curPart = part; int ssample = part->frame(); @@ -287,9 +289,9 @@ void WaveView::songChanged(int flags) redraw(); // Boring, but the only thing possible to do } if (flags & SC_TEMPO) { - setPos(0, song->cpos(), false); - setPos(1, song->lpos(), false); - setPos(2, song->rpos(), false); + setPos(0, MusEGlobal::song->cpos(), false); + setPos(1, MusEGlobal::song->lpos(), false); + setPos(2, MusEGlobal::song->rpos(), false); } redraw(); } @@ -303,17 +305,17 @@ void WaveView::songChanged(int flags) void WaveView::setPos(int idx, unsigned val, bool adjustScrollbar) { - val = tempomap.tick2frame(val); + val = MusEGlobal::tempomap.tick2frame(val); if (pos[idx] == val) return; int opos = mapx(pos[idx]); int npos = mapx(val); if (adjustScrollbar && idx == 0) { - switch (song->follow()) { - case Song::NO: + switch (MusEGlobal::song->follow()) { + case MusECore::Song::NO: break; - case Song::JUMP: + case MusECore::Song::JUMP: if (npos >= width()) { int ppos = val - xorg - rmapxDev(width()/4); if (ppos < 0) @@ -331,7 +333,7 @@ void WaveView::setPos(int idx, unsigned val, bool adjustScrollbar) npos = mapx(val); } break; - case Song::CONTINUOUS: + case MusECore::Song::CONTINUOUS: if (npos > (width()*5)/8) { int ppos = pos[idx] - xorg - rmapxDev(width()*5/8); if (ppos < 0) @@ -412,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) @@ -485,7 +487,7 @@ void WaveView::viewMouseMoveEvent(QMouseEvent* event) i = 1; break; case Qt::RightButton: - if ((MusEConfig::config.rangeMarkerWithoutMMB) && (event->modifiers() & Qt::ControlModifier)) + if ((MusEGlobal::config.rangeMarkerWithoutMMB) && (event->modifiers() & Qt::ControlModifier)) i = 1; else i = 2; @@ -493,8 +495,8 @@ void WaveView::viewMouseMoveEvent(QMouseEvent* event) default: return; } - Pos p(tempomap.frame2tick(x), true); - song->setPos(i, p); + MusECore::Pos p(MusEGlobal::tempomap.frame2tick(x), true); + MusEGlobal::song->setPos(i, p); } //--------------------------------------------------------- @@ -505,16 +507,16 @@ void WaveView::viewMouseMoveEvent(QMouseEvent* event) void WaveView::range(int* s, int *e) { - PartList* lst = editor->parts(); + MusECore::PartList* lst = editor->parts(); if(lst->empty()) { *s = 0; - *e = tempomap.tick2frame(song->len()); + *e = MusEGlobal::tempomap.tick2frame(MusEGlobal::song->len()); return; } - int ps = song->len(), pe = 0; + int ps = MusEGlobal::song->len(), pe = 0; int tps, tpe; - for(iPart ip = lst->begin(); ip != lst->end(); ++ip) + for(MusECore::iPart ip = lst->begin(); ip != lst->end(); ++ip) { tps = ip->second->tick(); if(tps < ps) @@ -523,8 +525,8 @@ void WaveView::range(int* s, int *e) if(tpe > pe) pe = tpe; } - *s = tempomap.tick2frame(ps); - *e = tempomap.tick2frame(pe); + *s = MusEGlobal::tempomap.tick2frame(ps); + *e = MusEGlobal::tempomap.tick2frame(pe); } //--------------------------------------------------------- @@ -538,11 +540,11 @@ void WaveView::cmd(int n) switch(n) { case WaveEdit::CMD_SELECT_ALL: if (!editor->parts()->empty()) { - iPart iBeg = editor->parts()->begin(); - iPart iEnd = editor->parts()->end(); + MusECore::iPart iBeg = editor->parts()->begin(); + MusECore::iPart iEnd = editor->parts()->end(); iEnd--; - WavePart* beg = (WavePart*) iBeg->second; - WavePart* end = (WavePart*) iEnd->second; + MusECore::WavePart* beg = (MusECore::WavePart*) iBeg->second; + MusECore::WavePart* end = (MusECore::WavePart*) iEnd->second; selectionStart = beg->frame(); selectionStop = end->frame() + end->lenFrame(); redraw(); @@ -655,22 +657,22 @@ void WaveView::cmd(int n) //--------------------------------------------------------- // getSelection //--------------------------------------------------------- -WaveSelectionList WaveView::getSelection(unsigned startpos, unsigned stoppos) +MusECore::WaveSelectionList WaveView::getSelection(unsigned startpos, unsigned stoppos) { - WaveSelectionList selection; + MusECore::WaveSelectionList selection; - for (iPart ip = editor->parts()->begin(); ip != editor->parts()->end(); ++ip) { - WavePart* wp = (WavePart*)(ip->second); + for (MusECore::iPart ip = editor->parts()->begin(); ip != editor->parts()->end(); ++ip) { + MusECore::WavePart* wp = (MusECore::WavePart*)(ip->second); unsigned part_offset = wp->frame(); - EventList* el = wp->events(); + MusECore::EventList* el = wp->events(); //printf("eventlist length=%d\n",el->size()); - for (iEvent e = el->begin(); e != el->end(); ++e) { - Event event = e->second; + for (MusECore::iEvent e = el->begin(); e != el->end(); ++e) { + MusECore::Event event = e->second; if (event.empty()) continue; - SndFileR file = event.sndFile(); + MusECore::SndFileR file = event.sndFile(); if (file.isNull()) continue; @@ -690,7 +692,7 @@ WaveSelectionList WaveView::getSelection(unsigned startpos, unsigned stoppos) tmp_ex > (int)event_length ? ex = event_length : ex = tmp_ex; //printf("Event data affected: %d->%d filename:%s\n", sx, ex, file.name().toLatin1().constData()); - WaveEventSelection s; + MusECore::WaveEventSelection s; s.file = file; s.startframe = sx; s.endframe = ex+1; @@ -708,13 +710,13 @@ WaveSelectionList WaveView::getSelection(unsigned startpos, unsigned stoppos) //--------------------------------------------------------- void WaveView::modifySelection(int operation, unsigned startpos, unsigned stoppos, double paramA) { - song->startUndo(); + MusEGlobal::song->startUndo(); if (operation == PASTE) { // we need to redefine startpos and stoppos if (copiedPart =="") return; - SndFile pasteFile(copiedPart); + MusECore::SndFile pasteFile(copiedPart); pasteFile.openRead(); startpos = pos[0]; stoppos = startpos+ pasteFile.samples(); // possibly this is wrong if there are tempo changes @@ -722,10 +724,10 @@ void WaveView::modifySelection(int operation, unsigned startpos, unsigned stoppo pos[0]=stoppos; } - WaveSelectionList selection = getSelection(startpos, stoppos); - for (iWaveSelection i = selection.begin(); i != selection.end(); i++) { - WaveEventSelection w = *i; - SndFileR& file = w.file; + MusECore::WaveSelectionList selection = getSelection(startpos, stoppos); + for (MusECore::iWaveSelection i = selection.begin(); i != selection.end(); i++) { + MusECore::WaveEventSelection w = *i; + MusECore::SndFileR& file = w.file; unsigned sx = w.startframe; unsigned ex = w.endframe; unsigned file_channels = file.channels(); @@ -735,11 +737,11 @@ void WaveView::modifySelection(int operation, unsigned startpos, unsigned stoppo break; } - audio->msgIdle(true); // Not good with playback during operations - SndFile tmpFile(tmpWavFile); + MusEGlobal::audio->msgIdle(true); // Not good with playback during operations + MusECore::SndFile tmpFile(tmpWavFile); tmpFile.setFormat(file.format(), file_channels, file.samplerate()); if (tmpFile.openWrite()) { - audio->msgIdle(false); + MusEGlobal::audio->msgIdle(false); printf("Could not open temporary file...\n"); break; } @@ -793,7 +795,7 @@ void WaveView::modifySelection(int operation, unsigned startpos, unsigned stoppo break; case PASTE: { - SndFile pasteFile(copiedPart); + MusECore::SndFile pasteFile(copiedPart); pasteFile.openRead(); pasteFile.seek(tmpdataoffset, 0); pasteFile.readWithHeap(file_channels, tmpdata, tmpdatalen); @@ -822,10 +824,10 @@ void WaveView::modifySelection(int operation, unsigned startpos, unsigned stoppo } // Undo handling - song->cmdChangeWave(file.dirPath() + "/" + file.name(), tmpWavFile, sx, ex); - audio->msgIdle(false); // Not good with playback during operations + MusEGlobal::song->cmdChangeWave(file.dirPath() + "/" + file.name(), tmpWavFile, sx, ex); + MusEGlobal::audio->msgIdle(false); // Not good with playback during operations } - song->endUndo(SC_CLIP_MODIFIED); + MusEGlobal::song->endUndo(SC_CLIP_MODIFIED); redraw(); } @@ -841,7 +843,7 @@ void WaveView::copySelection(unsigned file_channels, float** tmpdata, unsigned l return; } - SndFile tmpFile(copiedPart); + MusECore::SndFile tmpFile(copiedPart); tmpFile.setFormat(format, file_channels, sampleRate); tmpFile.openWrite(); tmpFile.write(file_channels, tmpdata, length); @@ -959,7 +961,7 @@ void WaveView::editExternal(unsigned file_format, unsigned file_samplerate, unsi return; } - SndFile exttmpFile(exttmpFileName); + MusECore::SndFile exttmpFile(exttmpFileName); exttmpFile.setFormat(file_format, file_channels, file_samplerate); if (exttmpFile.openWrite()) { printf("Could not open temporary file...\n"); @@ -972,7 +974,7 @@ void WaveView::editExternal(unsigned file_format, unsigned file_samplerate, unsi // Forkaborkabork int pid = fork(); if (pid == 0) { - if (execlp(MusEConfig::config.externalWavEditor.toLatin1().constData(), MusEConfig::config.externalWavEditor.toLatin1().constData(), exttmpFileName.toLatin1().constData(), NULL) == -1) { + if (execlp(MusEGlobal::config.externalWavEditor.toLatin1().constData(), MusEGlobal::config.externalWavEditor.toLatin1().constData(), exttmpFileName.toLatin1().constData(), NULL) == -1) { perror("Failed to launch external editor"); // Get out of here @@ -1020,4 +1022,4 @@ void WaveView::editExternal(unsigned file_format, unsigned file_samplerate, unsi } } - +} // namespace MusECore diff --git a/muse2/muse/waveedit/waveview.h b/muse2/muse/waveedit/waveview.h index 664fcb51..a3fcf9c5 100644 --- a/muse2/muse/waveedit/waveview.h +++ b/muse2/muse/waveedit/waveview.h @@ -28,12 +28,13 @@ #include <QMouseEvent> #include "wave.h" -class PartList; class QPainter; class QRect; -class WavePart; -class MidiEditor; + +namespace MusECore { +class PartList; class SndFileR; +class WavePart; struct WaveEventSelection { SndFileR file; @@ -44,11 +45,17 @@ struct WaveEventSelection { typedef std::list<WaveEventSelection> WaveSelectionList; typedef std::list<WaveEventSelection>::iterator iWaveSelection; +} // namespace MusECore + +namespace MusEGui { + +class MidiEditor; + //--------------------------------------------------------- // WaveView //--------------------------------------------------------- -class WaveView : public MusEWidget::View { +class WaveView : public View { Q_OBJECT MidiEditor* editor; @@ -58,7 +65,7 @@ class WaveView : public MusEWidget::View { int startSample; int endSample; - WavePart* curPart; + MusECore::WavePart* curPart; QString copiedPart; int curPartId; @@ -75,7 +82,7 @@ class WaveView : public MusEWidget::View { virtual void wheelEvent(QWheelEvent*); //bool getUniqueTmpfileName(QString& newFilename); //!< Generates unique filename for temporary SndFile - WaveSelectionList getSelection(unsigned startpos, unsigned stoppos); + MusECore::WaveSelectionList getSelection(unsigned startpos, unsigned stoppos); int lastGainvalue; //!< Stores the last used gainvalue when specifiying gain value in the editgain dialog void modifySelection(int operation, unsigned startpos, unsigned stoppos, double paramA); //!< Modifies selection @@ -113,8 +120,10 @@ class WaveView : public MusEWidget::View { QString getCaption() const; void range(int*, int*); void cmd(int n); - WavePart* part() { return curPart; } + MusECore::WavePart* part() { return curPart; } }; +} // namespace MusEGui + #endif diff --git a/muse2/muse/waveevent.cpp b/muse2/muse/waveevent.cpp index 759e8991..22041bd8 100644 --- a/muse2/muse/waveevent.cpp +++ b/muse2/muse/waveevent.cpp @@ -36,6 +36,8 @@ //#define WAVEEVENT_DEBUG //#define WAVEEVENT_DEBUG_PRC +namespace MusECore { + //--------------------------------------------------------- // WaveEvent //--------------------------------------------------------- @@ -466,3 +468,4 @@ void WaveEventBase::readAudio(WavePart* /*part*/, unsigned offset, float** buffe } +} // namespace MusECore diff --git a/muse2/muse/waveevent.h b/muse2/muse/waveevent.h index 850be707..278b0ad3 100644 --- a/muse2/muse/waveevent.h +++ b/muse2/muse/waveevent.h @@ -30,6 +30,9 @@ #include "eventbase.h" class AudioConverter; + +namespace MusECore { + class WavePart; //--------------------------------------------------------- @@ -75,5 +78,7 @@ class WaveEventBase : public EventBase { float** /*bpp*/, int /*channels*/, int /*nn*/, bool /*doSeek*/, bool /*overwrite*/); }; +} // namespace MusECore + #endif diff --git a/muse2/muse/wavetrack.cpp b/muse2/muse/wavetrack.cpp index efc0b274..9edeffb6 100644 --- a/muse2/muse/wavetrack.cpp +++ b/muse2/muse/wavetrack.cpp @@ -34,6 +34,8 @@ // Added by Tim. p3.3.18 //#define WAVETRACK_DEBUG +namespace MusECore { + //--------------------------------------------------------- // fetchData // called from prefetch thread @@ -116,7 +118,7 @@ void WaveTrack::fetchData(unsigned pos, unsigned samples, float** bp, bool doSee } } - if(MusEConfig::config.useDenormalBias) { + if(MusEGlobal::config.useDenormalBias) { // add denormal bias to outdata for (int i = 0; i < channels(); ++i) for (unsigned int j = 0; j < samples; ++j) @@ -222,7 +224,7 @@ bool WaveTrack::getData(unsigned framePos, int channels, unsigned nframe, float* //if(MusEGlobal::debugMsg) // printf("WaveTrack::getData framePos:%u channels:%d nframe:%u processed?:%d\n", framePos, channels, nframe, processed()); - if ((song->bounceTrack != this) && !noInRoute()) { + if ((MusEGlobal::song->bounceTrack != this) && !noInRoute()) { RouteList* irl = inRoutes(); ciRoute i = irl->begin(); if(i->track->isMidiTrack()) @@ -259,11 +261,11 @@ bool WaveTrack::getData(unsigned framePos, int channels, unsigned nframe, float* } if (recordFlag()) { - if (audio->isRecording() && recFile()) { - if (audio->freewheel()) { + if (MusEGlobal::audio->isRecording() && recFile()) { + if (MusEGlobal::audio->freewheel()) { } else { - if (fifo.put(channels, nframe, bp, audio->pos().frame())) + if (fifo.put(channels, nframe, bp, MusEGlobal::audio->pos().frame())) printf("WaveTrack::getData(%d, %d, %d): fifo overrun\n", framePos, channels, nframe); } @@ -271,7 +273,7 @@ bool WaveTrack::getData(unsigned framePos, int channels, unsigned nframe, float* return true; } } - if (!audio->isPlaying()) + if (!MusEGlobal::audio->isPlaying()) return false; // Removed by T356. Multiple out route cacheing now handled by AudioTrack::copyData and ::addData. @@ -282,7 +284,7 @@ bool WaveTrack::getData(unsigned framePos, int channels, unsigned nframe, float* printf("WaveTrack::getData bufferPos:%d != framePos\n", bufferPos); bufferPos = framePos; - if (audio->freewheel()) { + if (MusEGlobal::audio->freewheel()) { // when freewheeling, read data direct from file: fetchData(bufferPos, nframe, outBuffers); } @@ -318,7 +320,7 @@ bool WaveTrack::getData(unsigned framePos, int channels, unsigned nframe, float* //printf("WaveTrack::getData no out routes\n"); - if (audio->freewheel()) { + if (MusEGlobal::audio->freewheel()) { // when freewheeling, read data direct from file: // Indicate do not seek file before each read. @@ -373,3 +375,4 @@ void WaveTrack::setChannels(int n) } } +} // namespace MusECore diff --git a/muse2/muse/widgets/aboutbox_impl.cpp b/muse2/muse/widgets/aboutbox_impl.cpp index 36ba299e..b53e246f 100644 --- a/muse2/muse/widgets/aboutbox_impl.cpp +++ b/muse2/muse/widgets/aboutbox_impl.cpp @@ -24,7 +24,7 @@ #include "config.h" #include "icons.h" -namespace MusEWidget { +namespace MusEGui { AboutBoxImpl::AboutBoxImpl() { diff --git a/muse2/muse/widgets/aboutbox_impl.h b/muse2/muse/widgets/aboutbox_impl.h index 3ad3cd93..132bf83a 100644 --- a/muse2/muse/widgets/aboutbox_impl.h +++ b/muse2/muse/widgets/aboutbox_impl.h @@ -25,7 +25,7 @@ #include "ui_aboutbox.h" -namespace MusEWidget { +namespace MusEGui { class AboutBoxImpl : public QDialog, public Ui::AboutBox { diff --git a/muse2/muse/widgets/action.h b/muse2/muse/widgets/action.h index efc7c2ee..2a9f3849 100644 --- a/muse2/muse/widgets/action.h +++ b/muse2/muse/widgets/action.h @@ -25,7 +25,7 @@ #include <QAction> -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // Action diff --git a/muse2/muse/widgets/bigtime.cpp b/muse2/muse/widgets/bigtime.cpp index f4162041..af49cea1 100644 --- a/muse2/muse/widgets/bigtime.cpp +++ b/muse2/muse/widgets/bigtime.cpp @@ -33,9 +33,11 @@ #include "app.h" #include "gconfig.h" +namespace MusEGlobal { extern int mtcType; +} -namespace MusEWidget { +namespace MusEGui { // // the bigtime widget @@ -189,8 +191,8 @@ void BigTime::fmtButtonToggled(bool v) void BigTime::configChanged() { - setBgColor(MusEConfig::config.bigTimeBackgroundColor); - setFgColor(MusEConfig::config.bigTimeForegroundColor); + setBgColor(MusEGlobal::config.bigTimeBackgroundColor); + setFgColor(MusEGlobal::config.bigTimeForegroundColor); } //--------------------------------------------------------- @@ -228,7 +230,7 @@ bool BigTime::setString(unsigned v) return true; } - unsigned absFrame = tempomap.tick2frame(v); + unsigned absFrame = MusEGlobal::tempomap.tick2frame(v); int bar, beat; unsigned tick; AL::sigmap.tickValues(v, &bar, &beat, &tick); @@ -238,7 +240,7 @@ bool BigTime::setString(unsigned v) int min = int(time) / 60; int sec = int(time) % 60; double rest = time - (min * 60 + sec); - switch(mtcType) { + switch(MusEGlobal::mtcType) { case 0: // 24 frames sec rest *= 24; break; @@ -360,8 +362,8 @@ void BigTime::resizeEvent(QResizeEvent *ev) //dwin->setFont(f); QString fstr = QString("font-size:%1px; font-family:'Courier'; ").arg(fs); // Tim p4.0.8 dwin->setStyleSheet(fstr); - setBgColor(MusEConfig::config.bigTimeBackgroundColor); - setFgColor(MusEConfig::config.bigTimeForegroundColor); + setBgColor(MusEGlobal::config.bigTimeBackgroundColor); + setFgColor(MusEGlobal::config.bigTimeForegroundColor); int digitWidth = dwin->fontMetrics().width(QString("0")); int vspace = (ev->size().height() - (fs*2)) / 3; @@ -471,4 +473,4 @@ void BigTime::setBgColor(QColor c) setPalette(newpalette); } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/bigtime.h b/muse2/muse/widgets/bigtime.h index 636abfb3..3e3a2480 100644 --- a/muse2/muse/widgets/bigtime.h +++ b/muse2/muse/widgets/bigtime.h @@ -28,11 +28,9 @@ class QCheckBox; class QLabel; -namespace MusEApp { -class MusE; -} +namespace MusEGui { -namespace MusEWidget { +class MusE; //--------------------------------------------------------- // BigTime @@ -42,7 +40,7 @@ class BigTime : public QWidget { Q_OBJECT bool tickmode; - MusEApp::MusE* seq; + MusE* seq; bool setString(unsigned); @@ -78,6 +76,6 @@ class BigTime : public QWidget { BigTime(QWidget* parent); }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/canvas.cpp b/muse2/muse/widgets/canvas.cpp index 811561e3..41c5f4a4 100644 --- a/muse2/muse/widgets/canvas.cpp +++ b/muse2/muse/widgets/canvas.cpp @@ -46,7 +46,7 @@ #define ABS(x) ((x) < 0) ? -(x) : (x) -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // Canvas @@ -73,13 +73,13 @@ Canvas::Canvas(QWidget* parent, int sx, int sy, const char* name) drag = DRAG_OFF; _tool = PointerTool; - pos[0] = song->cpos(); - pos[1] = song->lpos(); - pos[2] = song->rpos(); + pos[0] = MusEGlobal::song->cpos(); + pos[1] = MusEGlobal::song->lpos(); + pos[2] = MusEGlobal::song->rpos(); curPart = NULL; curPartId = -1; curItem = NULL; - connect(song, SIGNAL(posChanged(int, unsigned, bool)), this, SLOT(setPos(int, unsigned, bool))); + connect(MusEGlobal::song, SIGNAL(posChanged(int, unsigned, bool)), this, SLOT(setPos(int, unsigned, bool))); } Canvas::~Canvas() @@ -103,10 +103,10 @@ void Canvas::setPos(int idx, unsigned val, bool adjustScrollbar) int npos = mapx(val); if (adjustScrollbar && idx == 0) { - switch (song->follow()) { - case Song::NO: + switch (MusEGlobal::song->follow()) { + case MusECore::Song::NO: break; - case Song::JUMP: + case MusECore::Song::JUMP: if (npos >= width()) { int ppos = val - xorg - rmapxDev(width()/8); if (ppos < 0) @@ -124,7 +124,7 @@ void Canvas::setPos(int idx, unsigned val, bool adjustScrollbar) npos = mapx(val); } break; - case Song::CONTINUOUS: + case MusECore::Song::CONTINUOUS: if (npos > (width()/2)) { int ppos = pos[idx] - xorg - rmapxDev(width()/2); if (ppos < 0) @@ -409,8 +409,8 @@ void Canvas::draw(QPainter& p, const QRect& rect) int my = mapy(y); //int y2 = y + h; int my2 = mapy(y + h); - MarkerList* marker = song->marker(); - for (iMarker m = marker->begin(); m != marker->end(); ++m) { + MusECore::MarkerList* marker = MusEGlobal::song->marker(); + for (MusECore::iMarker m = marker->begin(); m != marker->end(); ++m) { int xp = m->second.tick(); if (xp >= x && xp < x+w) { p.setPen(Qt::green); @@ -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; @@ -1539,7 +1539,7 @@ void Canvas::canvasPopup(int n) emit toolChanged(n); } -void Canvas::setCurrentPart(Part* part) +void Canvas::setCurrentPart(MusECore::Part* part) { curItem = NULL; deselectAll(); @@ -1548,4 +1548,4 @@ void Canvas::setCurrentPart(Part* part) curPartChanged(); } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/canvas.h b/muse2/muse/widgets/canvas.h index 954b865d..38024feb 100644 --- a/muse2/muse/widgets/canvas.h +++ b/muse2/muse/widgets/canvas.h @@ -35,7 +35,7 @@ class QMenu; -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // Canvas @@ -81,7 +81,7 @@ class Canvas : public View { CItemList items; CItemList moving; CItem* curItem; - Part* curPart; + MusECore::Part* curPart; int curPartId; DragMode drag; @@ -194,12 +194,12 @@ class Canvas : public View { bool isSingleSelection(); int selectionSize(); Tool tool() const { return _tool; } - Part* part() const { return curPart; } - void setCurrentPart(Part*); + MusECore::Part* part() const { return curPart; } + void setCurrentPart(MusECore::Part*); void setCanvasTools(int n) { canvasTools = n; } }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/checkbox.cpp b/muse2/muse/widgets/checkbox.cpp index def23730..66ef129b 100644 --- a/muse2/muse/widgets/checkbox.cpp +++ b/muse2/muse/widgets/checkbox.cpp @@ -24,7 +24,7 @@ #include <QMouseEvent> -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // CheckBox @@ -73,4 +73,4 @@ void CheckBox::mouseReleaseEvent(QMouseEvent *e) emit checkboxReleased(_id); } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/checkbox.h b/muse2/muse/widgets/checkbox.h index d50b31d3..f486f3b6 100644 --- a/muse2/muse/widgets/checkbox.h +++ b/muse2/muse/widgets/checkbox.h @@ -25,7 +25,7 @@ #include <QCheckBox> -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // CheckBox @@ -56,7 +56,7 @@ class CheckBox : public QCheckBox { void setId(int i) { _id = i; } }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/citem.cpp b/muse2/muse/widgets/citem.cpp index 1fe861a0..4c830223 100644 --- a/muse2/muse/widgets/citem.cpp +++ b/muse2/muse/widgets/citem.cpp @@ -24,7 +24,7 @@ #include "citem.h" #include <stdio.h> -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // CItem @@ -43,8 +43,8 @@ CItem::CItem(const QPoint&p, const QRect& r) } // Changed by Tim. p3.3.20 -//CItem::CItem(Event e, Part* p) -CItem::CItem(const Event& e, Part* p) +//CItem::CItem(MusECore::Event e, Part* p) +CItem::CItem(const MusECore::Event& e, MusECore::Part* p) { _event = e; _part = p; @@ -108,4 +108,4 @@ void CItemList::add(CItem* item) std::multimap<int, CItem*, std::less<int> >::insert(std::pair<const int, CItem*> (item->bbox().x(), item)); } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/citem.h b/muse2/muse/widgets/citem.h index e2ddd8a0..1777eb23 100644 --- a/muse2/muse/widgets/citem.h +++ b/muse2/muse/widgets/citem.h @@ -29,10 +29,11 @@ #include "event.h" -class Event; +namespace MusECore { class Part; +} -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // CItem @@ -41,8 +42,8 @@ namespace MusEWidget { class CItem { private: - Event _event; - Part* _part; + MusECore::Event _event; + MusECore::Part* _part; protected: bool _isMoving; @@ -54,8 +55,8 @@ class CItem { CItem(const QPoint& p, const QRect& r); CItem(); // Changed by Tim. p3.3.20 - //CItem(Event e, Part* p); - CItem(const Event& e, Part* p); + //CItem(MusECore::Event e, MusECore::Part* p); + CItem(const MusECore::Event& e, MusECore::Part* p); bool isMoving() const { return _isMoving; } void setMoving(bool f) { _isMoving = f; } @@ -82,10 +83,10 @@ class CItem { bool contains(const QPoint& p) const { return _bbox.contains(p); } bool intersects(const QRect& r) const { return r.intersects(_bbox); } - Event event() const { return _event; } - void setEvent(Event& e) { _event = e; } - Part* part() const { return _part; } - void setPart(Part* p) { _part = p; } + MusECore::Event event() const { return _event; } + void setEvent(MusECore::Event& e) { _event = e; } + MusECore::Part* part() const { return _part; } + void setPart(MusECore::Part* p) { _part = p; } }; typedef std::multimap<int, CItem*, std::less<int> >::iterator iCItem; @@ -108,7 +109,7 @@ class CItemList: public std::multimap<int, CItem*, std::less<int> > { } }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/comboQuant.cpp b/muse2/muse/widgets/comboQuant.cpp index c455851a..aee7ad5c 100644 --- a/muse2/muse/widgets/comboQuant.cpp +++ b/muse2/muse/widgets/comboQuant.cpp @@ -28,7 +28,7 @@ #include "comboQuant.h" -namespace MusEWidget { +namespace MusEGui { static int quantTable[] = { 1, 16, 32, 64, 128, 256, 512, 1024, @@ -109,4 +109,4 @@ void ComboQuant::setValue(int val) setCurrentIndex(0); } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/comboQuant.h b/muse2/muse/widgets/comboQuant.h index 8e1d80ea..e8d1b462 100644 --- a/muse2/muse/widgets/comboQuant.h +++ b/muse2/muse/widgets/comboQuant.h @@ -30,7 +30,7 @@ class QWidget; class QTableWidget; -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // ComboQuant diff --git a/muse2/muse/widgets/combobox.cpp b/muse2/muse/widgets/combobox.cpp index d32685d0..c85ca750 100644 --- a/muse2/muse/widgets/combobox.cpp +++ b/muse2/muse/widgets/combobox.cpp @@ -26,7 +26,7 @@ #include "combobox.h" -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // ComboBox @@ -105,4 +105,4 @@ void ComboBox::addAction(const QString& s, int id) itemlist << id; } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/combobox.h b/muse2/muse/widgets/combobox.h index 8de82989..6f57bd8d 100644 --- a/muse2/muse/widgets/combobox.h +++ b/muse2/muse/widgets/combobox.h @@ -28,7 +28,7 @@ class QMenu; class QSignalMapper; -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // ComboBox @@ -59,7 +59,7 @@ class ComboBox : public QToolButton { void addAction(const QString& s, int id = -1); }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/comment.cpp b/muse2/muse/widgets/comment.cpp index 99fd8487..f070cac0 100644 --- a/muse2/muse/widgets/comment.cpp +++ b/muse2/muse/widgets/comment.cpp @@ -26,7 +26,7 @@ #include <QWidget> -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // Comment @@ -51,13 +51,13 @@ void Comment::textChanged() // TrackComment //--------------------------------------------------------- -TrackComment::TrackComment(Track* t, QWidget* parent) +TrackComment::TrackComment(MusECore::Track* t, QWidget* parent) : Comment(parent) { setAttribute(Qt::WA_DeleteOnClose); setWindowTitle(tr("MusE: Track Comment")); track = t; - connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); + connect(MusEGlobal::song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); textentry->setText(track->comment()); textentry->moveCursor(QTextCursor::End); connect(textentry, SIGNAL(textChanged()), SLOT(textChanged())); @@ -75,8 +75,8 @@ void TrackComment::songChanged(int flags) return; // check if track still exists: - TrackList* tl = song->tracks(); - iTrack it; + MusECore::TrackList* tl = MusEGlobal::song->tracks(); + MusECore::iTrack it; for (it = tl->begin(); it != tl->end(); ++it) { if (track == *it) break; @@ -101,7 +101,7 @@ void TrackComment::songChanged(int flags) void TrackComment::setText(const QString& s) { track->setComment(s); - song->update(SC_TRACK_MODIFIED); + MusEGlobal::song->update(SC_TRACK_MODIFIED); } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/comment.h b/muse2/muse/widgets/comment.h index 4fc0bd33..f06757d2 100644 --- a/muse2/muse/widgets/comment.h +++ b/muse2/muse/widgets/comment.h @@ -25,11 +25,15 @@ #include "ui_commentbase.h" +class QWidget; + + +namespace MusECore { class Xml; class Track; -class QWidget; +} -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // Comment @@ -55,7 +59,7 @@ class Comment : public QWidget, public Ui::CommentBase { class TrackComment : public Comment { Q_OBJECT - Track* track; + MusECore::Track* track; private: @@ -65,10 +69,10 @@ class TrackComment : public Comment { void songChanged(int); public: - TrackComment(Track*, QWidget*); + TrackComment(MusECore::Track*, QWidget*); }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/ctrlcombo.cpp b/muse2/muse/widgets/ctrlcombo.cpp index 61a7e50f..c22bab4b 100644 --- a/muse2/muse/widgets/ctrlcombo.cpp +++ b/muse2/muse/widgets/ctrlcombo.cpp @@ -23,7 +23,7 @@ #include "ctrlcombo.h" -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // CtrlComboBox @@ -71,4 +71,4 @@ CtrlComboBox::CtrlComboBox(QWidget* parent) insertItem(i, QString(ctxt[i])); } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/ctrlcombo.h b/muse2/muse/widgets/ctrlcombo.h index dca3d91e..cbeb9a63 100644 --- a/muse2/muse/widgets/ctrlcombo.h +++ b/muse2/muse/widgets/ctrlcombo.h @@ -26,7 +26,7 @@ #include <QComboBox> -namespace MusEWidget { +namespace MusEGui { class CtrlComboBox : public QComboBox { Q_OBJECT @@ -34,7 +34,7 @@ class CtrlComboBox : public QComboBox { CtrlComboBox(QWidget* parent); }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/dentry.cpp b/muse2/muse/widgets/dentry.cpp index 7c7237f7..ddaa5ffd 100644 --- a/muse2/muse/widgets/dentry.cpp +++ b/muse2/muse/widgets/dentry.cpp @@ -36,7 +36,7 @@ #define TIMEC2 20 #define TIMER4 50 -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // Dentry @@ -173,7 +173,7 @@ void Dentry::repeat() switch (button) { case Qt::LeftButton: - if (!MusEConfig::config.leftMouseButtonCanDecrease) + if (!MusEGlobal::config.leftMouseButtonCanDecrease) return; // else fall through case Qt::MidButton: @@ -260,4 +260,4 @@ void Dentry::setValue(double v) val = v; } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/dentry.h b/muse2/muse/widgets/dentry.h index 1e429187..7ad62866 100644 --- a/muse2/muse/widgets/dentry.h +++ b/muse2/muse/widgets/dentry.h @@ -27,7 +27,7 @@ #include "sliderbase.h" -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // Dentry @@ -88,6 +88,6 @@ class Dentry : public QLineEdit { void setSlider(SliderBase* s) { _slider = s; } }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/didyouknow.h b/muse2/muse/widgets/didyouknow.h index 212e9254..b117b121 100644 --- a/muse2/muse/widgets/didyouknow.h +++ b/muse2/muse/widgets/didyouknow.h @@ -23,7 +23,7 @@ class QDialog; -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // DidYouKnowWidget @@ -38,4 +38,4 @@ class DidYouKnowWidget : public QDialog, public Ui::DidYouKnow DidYouKnowWidget(QDialog *parent = 0) : QDialog(parent) { setupUi(this); } }; -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/dimap.cpp b/muse2/muse/widgets/dimap.cpp index 7fff9115..5a3e540a 100644 --- a/muse2/muse/widgets/dimap.cpp +++ b/muse2/muse/widgets/dimap.cpp @@ -26,7 +26,7 @@ #include "dimap.h" #include "mmath.h" -namespace MusEWidget { +namespace MusEGui { const double DiMap::LogMin = 1.0e-150; const double DiMap::LogMax = 1.0e150; @@ -113,7 +113,7 @@ DiMap::~DiMap() bool DiMap::contains(double x) const { - return ( (x >= MusEUtil::qwtMin(d_x1, d_x1)) && (x <= MusEUtil::qwtMax(d_x1, d_x2))); + return ( (x >= MusECore::qwtMin(d_x1, d_x1)) && (x <= MusECore::qwtMax(d_x1, d_x2))); } //------------------------------------------------------------ @@ -130,7 +130,7 @@ bool DiMap::contains(double x) const bool DiMap::contains(int x) const { - return ( (x >= MusEUtil::qwtMin(d_y1, d_y1)) && (x <= MusEUtil::qwtMax(d_y1, d_y2))); + return ( (x >= MusECore::qwtMin(d_y1, d_y1)) && (x <= MusECore::qwtMax(d_y1, d_y2))); } //------------------------------------------------------------ @@ -269,10 +269,10 @@ double DiMap::invTransform(int y) const int DiMap::limTransform(double x) const { - if ( x > MusEUtil::qwtMax(d_x1, d_x2) ) - x = MusEUtil::qwtMax(d_x1, d_x2); - else if ( x < MusEUtil::qwtMin(d_x1, d_x2)) - x = MusEUtil::qwtMin(d_x1, d_x2); + if ( x > MusECore::qwtMax(d_x1, d_x2) ) + x = MusECore::qwtMax(d_x1, d_x2); + else if ( x < MusECore::qwtMin(d_x1, d_x2)) + x = MusECore::qwtMin(d_x1, d_x2); return transform(x); } @@ -320,4 +320,4 @@ void DiMap::newFactor() d_cnv = 0.0; } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/dimap.h b/muse2/muse/widgets/dimap.h index fc522b4e..42efbc64 100644 --- a/muse2/muse/widgets/dimap.h +++ b/muse2/muse/widgets/dimap.h @@ -27,7 +27,7 @@ #include <QtGlobal> -namespace MusEWidget { +namespace MusEGui { class DiMap { @@ -65,6 +65,6 @@ class DiMap bool logarithmic() const { return d_log;} }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/doublelabel.cpp b/muse2/muse/widgets/doublelabel.cpp index 00d9e2fa..dbf7e035 100644 --- a/muse2/muse/widgets/doublelabel.cpp +++ b/muse2/muse/widgets/doublelabel.cpp @@ -24,7 +24,7 @@ #include "doublelabel.h" -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // DoubleLabel @@ -209,4 +209,4 @@ QSize DoubleLabel::minimumSizeHint() const return sizeHint(); } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/doublelabel.h b/muse2/muse/widgets/doublelabel.h index d02546e6..bfec39c1 100644 --- a/muse2/muse/widgets/doublelabel.h +++ b/muse2/muse/widgets/doublelabel.h @@ -25,7 +25,7 @@ #include "dentry.h" -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // DoubleLabel @@ -75,6 +75,6 @@ class DoubleLabel : public Dentry { void setSuffix(const QString& s) { _suffix = s; } }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/drange.cpp b/muse2/muse/widgets/drange.cpp index 18868b2c..7669c18c 100644 --- a/muse2/muse/widgets/drange.cpp +++ b/muse2/muse/widgets/drange.cpp @@ -29,7 +29,7 @@ #include "mmath.h" #include "drange.h" -namespace MusEWidget { +namespace MusEGui { const double DoubleRange::MinRelStep = 1.0e-10; const double DoubleRange::DefaultRelStep = 1.0e-2; @@ -73,8 +73,8 @@ void DoubleRange::setNewValue(double x, bool align) { d_prevValue = d_value; - double vmin = MusEUtil::qwtMin(d_minValue, d_maxValue); - double vmax = MusEUtil::qwtMax(d_minValue, d_maxValue); + double vmin = MusECore::qwtMin(d_minValue, d_maxValue); + double vmax = MusECore::qwtMax(d_minValue, d_maxValue); // Range check @@ -106,11 +106,11 @@ void DoubleRange::setNewValue(double x, bool align) d_value = d_minValue; // correct rounding error at the border - if (fabs(d_value - d_maxValue) < MinEps * MusEUtil::qwtAbs(d_step)) + if (fabs(d_value - d_maxValue) < MinEps * MusECore::qwtAbs(d_step)) d_value = d_maxValue; // correct rounding error if value = 0 - if (fabs(d_value) < MinEps * MusEUtil::qwtAbs(d_step)) + if (fabs(d_value) < MinEps * MusECore::qwtAbs(d_step)) d_value = 0.0; } if (d_prevValue != d_value) @@ -179,7 +179,7 @@ void DoubleRange::setRange(double vmin, double vmax, double vstep, int pageSize) // // limit page size // - d_pageSize = MusEUtil::qwtLim(pageSize,0, int(MusEUtil::qwtAbs((d_maxValue - d_minValue) / d_step))); + d_pageSize = MusECore::qwtLim(pageSize,0, int(MusECore::qwtAbs((d_maxValue - d_minValue) / d_step))); // // If the value lies out of the range, it @@ -273,7 +273,7 @@ void DoubleRange::incPages(int nPages) double DoubleRange::step() const { - return MusEUtil::qwtAbs(d_step); + return MusECore::qwtAbs(d_step); } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/drange.h b/muse2/muse/widgets/drange.h index 938b70c6..76432f50 100644 --- a/muse2/muse/widgets/drange.h +++ b/muse2/muse/widgets/drange.h @@ -25,7 +25,7 @@ #ifndef __DOUBLE_RANGE_H__ #define __DOUBLE_RANGE_H__ -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // DoubleRange @@ -79,6 +79,6 @@ class DoubleRange double step() const; }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/editnotedialogbase.ui b/muse2/muse/widgets/editnotedialogbase.ui index 165bdf02..afc56f6d 100644 --- a/muse2/muse/widgets/editnotedialogbase.ui +++ b/muse2/muse/widgets/editnotedialogbase.ui @@ -156,7 +156,7 @@ </widget> </item> <item row="2" column="1"> - <widget class="MusEWidget::PitchEdit" name="pl" native="true"/> + <widget class="MusEGui::PitchEdit" name="pl" native="true"/> </item> </layout> </widget> @@ -169,7 +169,7 @@ <container>0</container> </customwidget> <customwidget> - <class>MusEWidget::PitchEdit</class> + <class>MusEGui::PitchEdit</class> <extends>QWidget</extends> <header>pitchedit.h</header> </customwidget> diff --git a/muse2/muse/widgets/filedialog.cpp b/muse2/muse/widgets/filedialog.cpp index 4e3c1fb2..df391b45 100644 --- a/muse2/muse/widgets/filedialog.cpp +++ b/muse2/muse/widgets/filedialog.cpp @@ -34,7 +34,7 @@ #include "../globals.h" #include "gconfig.h" -namespace MusEWidget { +namespace MusEGui { MFileDialog::ViewType MFileDialog::lastViewUsed = GLOBAL_VIEW; //QString MFileDialog::lastUserDir = ""; @@ -149,7 +149,7 @@ void MFileDialog::projectToggled(bool flag) // if project path is uninitialized, meaning it is still set to museProjectInitPath. // then project path is set to current pwd instead. //s = QString(getcwd(0,0)) + QString("/"); - s = MusEConfig::config.projectBaseFolder; + s = MusEGlobal::config.projectBaseFolder; } else s = MusEGlobal::museProject + QString("/"); // + baseDir; @@ -563,4 +563,4 @@ FILE* MFile::open(const char* mode, const QStringList& pattern, return f; } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/filedialog.h b/muse2/muse/widgets/filedialog.h index 74297210..e5687494 100644 --- a/muse2/muse/widgets/filedialog.h +++ b/muse2/muse/widgets/filedialog.h @@ -26,7 +26,7 @@ class QStringList; -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // FileDialogButtonsWidget @@ -125,4 +125,4 @@ class MFile { bool warnIfOverwrite, const QString& caption); }; -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/function_dialogs/crescendo.cpp b/muse2/muse/widgets/function_dialogs/crescendo.cpp index f8245b24..fa94f58e 100644 --- a/muse2/muse/widgets/function_dialogs/crescendo.cpp +++ b/muse2/muse/widgets/function_dialogs/crescendo.cpp @@ -24,7 +24,7 @@ #include "crescendo.h" #include "xml.h" -namespace MusEDialog { +namespace MusEGui { Crescendo::Crescendo(QWidget* parent) : QDialog(parent) @@ -66,18 +66,18 @@ int Crescendo::exec() return QDialog::exec(); } -void Crescendo::read_configuration(Xml& xml) +void Crescendo::read_configuration(MusECore::Xml& xml) { for (;;) { - Xml::Token token = xml.parse(); - if (token == Xml::Error || token == Xml::End) + MusECore::Xml::Token token = xml.parse(); + if (token == MusECore::Xml::Error || token == MusECore::Xml::End) break; const QString& tag = xml.s1(); switch (token) { - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "range") range=xml.parseInt(); else if (tag == "start") @@ -90,7 +90,7 @@ void Crescendo::read_configuration(Xml& xml) xml.unknown("Crescendo"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "crescendo") return; @@ -100,7 +100,7 @@ void Crescendo::read_configuration(Xml& xml) } } -void Crescendo::write_configuration(int level, Xml& xml) +void Crescendo::write_configuration(int level, MusECore::Xml& xml) { xml.tag(level++, "crescendo"); xml.intTag(level, "range", range); @@ -128,4 +128,4 @@ void Crescendo::absolute_changed(bool val) } } -} // namespace MusEDialog +} // namespace MusEGui diff --git a/muse2/muse/widgets/function_dialogs/crescendo.h b/muse2/muse/widgets/function_dialogs/crescendo.h index c0871ab8..ccd3030e 100644 --- a/muse2/muse/widgets/function_dialogs/crescendo.h +++ b/muse2/muse/widgets/function_dialogs/crescendo.h @@ -26,9 +26,12 @@ #include "ui_crescendobase.h" class QButtonGroup; + +namespace MusECore { class Xml; +} -namespace MusEDialog { +namespace MusEGui { class Crescendo : public QDialog, public Ui::CrescendoBase { @@ -49,8 +52,8 @@ class Crescendo : public QDialog, public Ui::CrescendoBase int end_val; bool absolute; - void read_configuration(Xml& xml); - void write_configuration(int level, Xml& xml); + void read_configuration(MusECore::Xml& xml); + void write_configuration(int level, MusECore::Xml& xml); public slots: @@ -60,7 +63,7 @@ class Crescendo : public QDialog, public Ui::CrescendoBase void absolute_changed(bool); }; -} // namespace MusEDialog +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/function_dialogs/deloverlaps.cpp b/muse2/muse/widgets/function_dialogs/deloverlaps.cpp index 0841b6e9..b6a0bf3f 100644 --- a/muse2/muse/widgets/function_dialogs/deloverlaps.cpp +++ b/muse2/muse/widgets/function_dialogs/deloverlaps.cpp @@ -24,7 +24,7 @@ #include "deloverlaps.h" #include "xml.h" -namespace MusEDialog { +namespace MusEGui { DelOverlaps::DelOverlaps(QWidget* parent) : QDialog(parent) @@ -59,25 +59,25 @@ int DelOverlaps::exec() return QDialog::exec(); } -void DelOverlaps::read_configuration(Xml& xml) +void DelOverlaps::read_configuration(MusECore::Xml& xml) { for (;;) { - Xml::Token token = xml.parse(); - if (token == Xml::Error || token == Xml::End) + MusECore::Xml::Token token = xml.parse(); + if (token == MusECore::Xml::Error || token == MusECore::Xml::End) break; const QString& tag = xml.s1(); switch (token) { - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "range") range=xml.parseInt(); else xml.unknown("DelOverlaps"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "del_overlaps") return; @@ -87,11 +87,11 @@ void DelOverlaps::read_configuration(Xml& xml) } } -void DelOverlaps::write_configuration(int level, Xml& xml) +void DelOverlaps::write_configuration(int level, MusECore::Xml& xml) { xml.tag(level++, "del_overlaps"); xml.intTag(level, "range", range); xml.tag(level, "/del_overlaps"); } -} // namespace MusEDialog +} // namespace MusEGui diff --git a/muse2/muse/widgets/function_dialogs/deloverlaps.h b/muse2/muse/widgets/function_dialogs/deloverlaps.h index 2fc470cd..0036a2d4 100644 --- a/muse2/muse/widgets/function_dialogs/deloverlaps.h +++ b/muse2/muse/widgets/function_dialogs/deloverlaps.h @@ -26,9 +26,12 @@ #include "ui_deloverlapsbase.h" class QButtonGroup; + +namespace MusECore { class Xml; +} -namespace MusEDialog { +namespace MusEGui { class DelOverlaps : public QDialog, public Ui::DelOverlapsBase { @@ -46,14 +49,14 @@ class DelOverlaps : public QDialog, public Ui::DelOverlapsBase int range; - void read_configuration(Xml& xml); - void write_configuration(int level, Xml& xml); + void read_configuration(MusECore::Xml& xml); + void write_configuration(int level, MusECore::Xml& xml); public slots: int exec(); }; -} // namespace MusEDialog +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/function_dialogs/gatetime.cpp b/muse2/muse/widgets/function_dialogs/gatetime.cpp index 537260ca..987e53a5 100644 --- a/muse2/muse/widgets/function_dialogs/gatetime.cpp +++ b/muse2/muse/widgets/function_dialogs/gatetime.cpp @@ -28,7 +28,7 @@ #include "xml.h" #include "song.h" -namespace MusEDialog { +namespace MusEGui { //--------------------------------------------------------- // GateTime @@ -83,18 +83,18 @@ int GateTime::exec() } -void GateTime::read_configuration(Xml& xml) +void GateTime::read_configuration(MusECore::Xml& xml) { for (;;) { - Xml::Token token = xml.parse(); - if (token == Xml::Error || token == Xml::End) + MusECore::Xml::Token token = xml.parse(); + if (token == MusECore::Xml::Error || token == MusECore::Xml::End) break; const QString& tag = xml.s1(); switch (token) { - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "range") range=xml.parseInt(); else if (tag == "rate") @@ -105,7 +105,7 @@ void GateTime::read_configuration(Xml& xml) xml.unknown("ModLen"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "mod_len") return; @@ -115,7 +115,7 @@ void GateTime::read_configuration(Xml& xml) } } -void GateTime::write_configuration(int level, Xml& xml) +void GateTime::write_configuration(int level, MusECore::Xml& xml) { xml.tag(level++, "mod_len"); xml.intTag(level, "range", range); @@ -124,4 +124,4 @@ void GateTime::write_configuration(int level, Xml& xml) xml.tag(level, "/mod_len"); } -} // namespace MusEDialog +} // namespace MusEGui diff --git a/muse2/muse/widgets/function_dialogs/gatetime.h b/muse2/muse/widgets/function_dialogs/gatetime.h index 20d28948..b0c3987b 100644 --- a/muse2/muse/widgets/function_dialogs/gatetime.h +++ b/muse2/muse/widgets/function_dialogs/gatetime.h @@ -26,9 +26,12 @@ #include "ui_gatetimebase.h" class QButtonGroup; + +namespace MusECore { class Xml; +} -namespace MusEDialog { +namespace MusEGui { //--------------------------------------------------------- // GateTime @@ -51,15 +54,15 @@ class GateTime : public QDialog, public Ui::GateTimeBase { int rateVal; int offsetVal; - void read_configuration(Xml& xml); - void write_configuration(int level, Xml& xml); + void read_configuration(MusECore::Xml& xml); + void write_configuration(int level, MusECore::Xml& xml); public slots: int exec(); }; -} // namespace MusEDialog +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/function_dialogs/legato.cpp b/muse2/muse/widgets/function_dialogs/legato.cpp index 5ca6e29b..0d31017c 100644 --- a/muse2/muse/widgets/function_dialogs/legato.cpp +++ b/muse2/muse/widgets/function_dialogs/legato.cpp @@ -24,7 +24,7 @@ #include "legato.h" #include "xml.h" -namespace MusEDialog { +namespace MusEGui { Legato::Legato(QWidget* parent) : QDialog(parent) @@ -63,18 +63,18 @@ int Legato::exec() return QDialog::exec(); } -void Legato::read_configuration(Xml& xml) +void Legato::read_configuration(MusECore::Xml& xml) { for (;;) { - Xml::Token token = xml.parse(); - if (token == Xml::Error || token == Xml::End) + MusECore::Xml::Token token = xml.parse(); + if (token == MusECore::Xml::Error || token == MusECore::Xml::End) break; const QString& tag = xml.s1(); switch (token) { - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "range") range=xml.parseInt(); else if (tag == "min_len") @@ -85,7 +85,7 @@ void Legato::read_configuration(Xml& xml) xml.unknown("Legato"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "legato") return; @@ -95,7 +95,7 @@ void Legato::read_configuration(Xml& xml) } } -void Legato::write_configuration(int level, Xml& xml) +void Legato::write_configuration(int level, MusECore::Xml& xml) { xml.tag(level++, "legato"); xml.intTag(level, "range", range); @@ -104,4 +104,4 @@ void Legato::write_configuration(int level, Xml& xml) xml.tag(level, "/legato"); } -} // namespace MusEDialog +} // namespace MusEGui diff --git a/muse2/muse/widgets/function_dialogs/legato.h b/muse2/muse/widgets/function_dialogs/legato.h index c2cbeabc..1c25fef1 100644 --- a/muse2/muse/widgets/function_dialogs/legato.h +++ b/muse2/muse/widgets/function_dialogs/legato.h @@ -26,9 +26,12 @@ #include "ui_legatobase.h" class QButtonGroup; + +namespace MusECore { class Xml; +} -namespace MusEDialog { +namespace MusEGui { class Legato : public QDialog, public Ui::LegatoBase { @@ -48,15 +51,15 @@ class Legato : public QDialog, public Ui::LegatoBase int min_len; bool allow_shortening; - void read_configuration(Xml& xml); - void write_configuration(int level, Xml& xml); + void read_configuration(MusECore::Xml& xml); + void write_configuration(int level, MusECore::Xml& xml); public slots: int exec(); }; -} // namespace MusEDialog +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/function_dialogs/move.cpp b/muse2/muse/widgets/function_dialogs/move.cpp index 2529cb68..e0a1fddf 100644 --- a/muse2/muse/widgets/function_dialogs/move.cpp +++ b/muse2/muse/widgets/function_dialogs/move.cpp @@ -24,7 +24,7 @@ #include "move.h" #include "xml.h" -namespace MusEDialog { +namespace MusEGui { Move::Move(QWidget* parent) : QDialog(parent) @@ -62,18 +62,18 @@ int Move::exec() } -void Move::read_configuration(Xml& xml) +void Move::read_configuration(MusECore::Xml& xml) { for (;;) { - Xml::Token token = xml.parse(); - if (token == Xml::Error || token == Xml::End) + MusECore::Xml::Token token = xml.parse(); + if (token == MusECore::Xml::Error || token == MusECore::Xml::End) break; const QString& tag = xml.s1(); switch (token) { - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "range") range=xml.parseInt(); else if (tag == "amount") @@ -82,7 +82,7 @@ void Move::read_configuration(Xml& xml) xml.unknown("Move"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "move") return; @@ -92,7 +92,7 @@ void Move::read_configuration(Xml& xml) } } -void Move::write_configuration(int level, Xml& xml) +void Move::write_configuration(int level, MusECore::Xml& xml) { xml.tag(level++, "move"); xml.intTag(level, "range", range); @@ -100,4 +100,4 @@ void Move::write_configuration(int level, Xml& xml) xml.tag(level, "/move"); } -} // namespace MusEDialog +} // namespace MusEGui diff --git a/muse2/muse/widgets/function_dialogs/move.h b/muse2/muse/widgets/function_dialogs/move.h index 39718134..c3c8b83c 100644 --- a/muse2/muse/widgets/function_dialogs/move.h +++ b/muse2/muse/widgets/function_dialogs/move.h @@ -26,9 +26,12 @@ #include "ui_movebase.h" class QButtonGroup; + +namespace MusECore { class Xml; +} -namespace MusEDialog { +namespace MusEGui { class Move : public QDialog, public Ui::MoveBase { @@ -47,15 +50,15 @@ class Move : public QDialog, public Ui::MoveBase int range; int amount; - void read_configuration(Xml& xml); - void write_configuration(int level, Xml& xml); + void read_configuration(MusECore::Xml& xml); + void write_configuration(int level, MusECore::Xml& xml); public slots: int exec(); }; -} // namespace MusEDialog +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/function_dialogs/quantize.cpp b/muse2/muse/widgets/function_dialogs/quantize.cpp index 0841e106..df7c0298 100644 --- a/muse2/muse/widgets/function_dialogs/quantize.cpp +++ b/muse2/muse/widgets/function_dialogs/quantize.cpp @@ -24,7 +24,7 @@ #include "quantize.h" #include "xml.h" -namespace MusEDialog { +namespace MusEGui { Quantize::Quantize(QWidget* parent) : QDialog(parent) @@ -69,18 +69,18 @@ int Quantize::exec() return QDialog::exec(); } -void Quantize::read_configuration(Xml& xml) +void Quantize::read_configuration(MusECore::Xml& xml) { for (;;) { - Xml::Token token = xml.parse(); - if (token == Xml::Error || token == Xml::End) + MusECore::Xml::Token token = xml.parse(); + if (token == MusECore::Xml::Error || token == MusECore::Xml::End) break; const QString& tag = xml.s1(); switch (token) { - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "range") range=xml.parseInt(); else if (tag == "strength") @@ -97,7 +97,7 @@ void Quantize::read_configuration(Xml& xml) xml.unknown("Quantize"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "quantize") return; @@ -107,7 +107,7 @@ void Quantize::read_configuration(Xml& xml) } } -void Quantize::write_configuration(int level, Xml& xml) +void Quantize::write_configuration(int level, MusECore::Xml& xml) { xml.tag(level++, "quantize"); xml.intTag(level, "range", range); @@ -119,5 +119,5 @@ void Quantize::write_configuration(int level, Xml& xml) xml.tag(level, "/quantize"); } -} // namespace MusEDialog +} // namespace MusEGui diff --git a/muse2/muse/widgets/function_dialogs/quantize.h b/muse2/muse/widgets/function_dialogs/quantize.h index 69498810..6ce74215 100644 --- a/muse2/muse/widgets/function_dialogs/quantize.h +++ b/muse2/muse/widgets/function_dialogs/quantize.h @@ -26,9 +26,12 @@ #include "ui_quantbase.h" class QButtonGroup; + +namespace MusECore { class Xml; +} -namespace MusEDialog { +namespace MusEGui { class Quantize : public QDialog, public Ui::QuantBase { @@ -51,15 +54,15 @@ class Quantize : public QDialog, public Ui::QuantBase int swing; bool quant_len; - void read_configuration(Xml& xml); - void write_configuration(int level, Xml& xml); + void read_configuration(MusECore::Xml& xml); + void write_configuration(int level, MusECore::Xml& xml); public slots: int exec(); }; -} // namespace MusEDialog +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/function_dialogs/remove.cpp b/muse2/muse/widgets/function_dialogs/remove.cpp index 69558fc3..c0b31ec4 100644 --- a/muse2/muse/widgets/function_dialogs/remove.cpp +++ b/muse2/muse/widgets/function_dialogs/remove.cpp @@ -24,7 +24,7 @@ #include "remove.h" #include "xml.h" -namespace MusEDialog { +namespace MusEGui { Remove::Remove(QWidget* parent) : QDialog(parent) @@ -67,18 +67,18 @@ int Remove::exec() return QDialog::exec(); } -void Remove::read_configuration(Xml& xml) +void Remove::read_configuration(MusECore::Xml& xml) { for (;;) { - Xml::Token token = xml.parse(); - if (token == Xml::Error || token == Xml::End) + MusECore::Xml::Token token = xml.parse(); + if (token == MusECore::Xml::Error || token == MusECore::Xml::End) break; const QString& tag = xml.s1(); switch (token) { - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "range") range=xml.parseInt(); else if (tag == "velo_threshold") @@ -93,7 +93,7 @@ void Remove::read_configuration(Xml& xml) xml.unknown("Erase"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "erase") return; @@ -103,7 +103,7 @@ void Remove::read_configuration(Xml& xml) } } -void Remove::write_configuration(int level, Xml& xml) +void Remove::write_configuration(int level, MusECore::Xml& xml) { xml.tag(level++, "erase"); xml.intTag(level, "range", range); @@ -114,5 +114,5 @@ void Remove::write_configuration(int level, Xml& xml) xml.tag(level, "/erase"); } -} // namespace MusEDialog +} // namespace MusEGui diff --git a/muse2/muse/widgets/function_dialogs/remove.h b/muse2/muse/widgets/function_dialogs/remove.h index aba05909..a572be62 100644 --- a/muse2/muse/widgets/function_dialogs/remove.h +++ b/muse2/muse/widgets/function_dialogs/remove.h @@ -26,9 +26,12 @@ #include "ui_removebase.h" class QButtonGroup; + +namespace MusECore { class Xml; +} -namespace MusEDialog { +namespace MusEGui { class Remove : public QDialog, public Ui::RemoveBase { @@ -50,15 +53,15 @@ class Remove : public QDialog, public Ui::RemoveBase int len_threshold; bool len_thres_used; - void read_configuration(Xml& xml); - void write_configuration(int level, Xml& xml); + void read_configuration(MusECore::Xml& xml); + void write_configuration(int level, MusECore::Xml& xml); public slots: int exec(); }; -} // namespace MusEDialog +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/function_dialogs/setlen.cpp b/muse2/muse/widgets/function_dialogs/setlen.cpp index 81a589ae..4154f8e5 100644 --- a/muse2/muse/widgets/function_dialogs/setlen.cpp +++ b/muse2/muse/widgets/function_dialogs/setlen.cpp @@ -24,7 +24,7 @@ #include "setlen.h" #include "xml.h" -namespace MusEDialog { +namespace MusEGui { Setlen::Setlen(QWidget* parent) : QDialog(parent) @@ -61,18 +61,18 @@ int Setlen::exec() return QDialog::exec(); } -void Setlen::read_configuration(Xml& xml) +void Setlen::read_configuration(MusECore::Xml& xml) { for (;;) { - Xml::Token token = xml.parse(); - if (token == Xml::Error || token == Xml::End) + MusECore::Xml::Token token = xml.parse(); + if (token == MusECore::Xml::Error || token == MusECore::Xml::End) break; const QString& tag = xml.s1(); switch (token) { - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "range") range=xml.parseInt(); else if (tag == "len") @@ -81,7 +81,7 @@ void Setlen::read_configuration(Xml& xml) xml.unknown("SetLen"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "setlen") return; @@ -91,7 +91,7 @@ void Setlen::read_configuration(Xml& xml) } } -void Setlen::write_configuration(int level, Xml& xml) +void Setlen::write_configuration(int level, MusECore::Xml& xml) { xml.tag(level++, "setlen"); xml.intTag(level, "range", range); @@ -99,4 +99,4 @@ void Setlen::write_configuration(int level, Xml& xml) xml.tag(level, "/setlen"); } -} // namespace MusEDialog +} // namespace MusEGui diff --git a/muse2/muse/widgets/function_dialogs/setlen.h b/muse2/muse/widgets/function_dialogs/setlen.h index fea6a5dd..dc577e6b 100644 --- a/muse2/muse/widgets/function_dialogs/setlen.h +++ b/muse2/muse/widgets/function_dialogs/setlen.h @@ -26,9 +26,12 @@ #include "ui_setlenbase.h" class QButtonGroup; + +namespace MusECore { class Xml; +} -namespace MusEDialog { +namespace MusEGui { class Setlen : public QDialog, public Ui::SetlenBase { @@ -47,15 +50,15 @@ class Setlen : public QDialog, public Ui::SetlenBase int range; int len; - void read_configuration(Xml& xml); - void write_configuration(int level, Xml& xml); + void read_configuration(MusECore::Xml& xml); + void write_configuration(int level, MusECore::Xml& xml); public slots: int exec(); }; -} // namespace MusEDialog +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/function_dialogs/transpose.cpp b/muse2/muse/widgets/function_dialogs/transpose.cpp index dd642050..c4088d99 100644 --- a/muse2/muse/widgets/function_dialogs/transpose.cpp +++ b/muse2/muse/widgets/function_dialogs/transpose.cpp @@ -24,7 +24,7 @@ #include "transpose.h" #include "xml.h" -namespace MusEDialog { +namespace MusEGui { Transpose::Transpose(QWidget* parent) : QDialog(parent) @@ -61,18 +61,18 @@ int Transpose::exec() return QDialog::exec(); } -void Transpose::read_configuration(Xml& xml) +void Transpose::read_configuration(MusECore::Xml& xml) { for (;;) { - Xml::Token token = xml.parse(); - if (token == Xml::Error || token == Xml::End) + MusECore::Xml::Token token = xml.parse(); + if (token == MusECore::Xml::Error || token == MusECore::Xml::End) break; const QString& tag = xml.s1(); switch (token) { - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "range") range=xml.parseInt(); else if (tag == "amount") @@ -81,7 +81,7 @@ void Transpose::read_configuration(Xml& xml) xml.unknown("Transpose"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "transpose") return; @@ -91,7 +91,7 @@ void Transpose::read_configuration(Xml& xml) } } -void Transpose::write_configuration(int level, Xml& xml) +void Transpose::write_configuration(int level, MusECore::Xml& xml) { xml.tag(level++, "transpose"); xml.intTag(level, "range", range); @@ -99,4 +99,4 @@ void Transpose::write_configuration(int level, Xml& xml) xml.tag(level, "/transpose"); } -} // namespace MusEDialog +} // namespace MusEGui diff --git a/muse2/muse/widgets/function_dialogs/transpose.h b/muse2/muse/widgets/function_dialogs/transpose.h index b6363ae5..5e0bd82f 100644 --- a/muse2/muse/widgets/function_dialogs/transpose.h +++ b/muse2/muse/widgets/function_dialogs/transpose.h @@ -26,9 +26,12 @@ #include "ui_transposebase.h" class QButtonGroup; + +namespace MusECore { class Xml; +} -namespace MusEDialog { +namespace MusEGui { class Transpose : public QDialog, public Ui::TransposeBase { @@ -45,15 +48,15 @@ class Transpose : public QDialog, public Ui::TransposeBase int range; int amount; - void read_configuration(Xml& xml); - void write_configuration(int level, Xml& xml); + void read_configuration(MusECore::Xml& xml); + void write_configuration(int level, MusECore::Xml& xml); public slots: int exec(); }; -} // namespace MusEDialog +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/function_dialogs/velocity.cpp b/muse2/muse/widgets/function_dialogs/velocity.cpp index 81655b5f..2db17b6d 100644 --- a/muse2/muse/widgets/function_dialogs/velocity.cpp +++ b/muse2/muse/widgets/function_dialogs/velocity.cpp @@ -24,7 +24,7 @@ #include "velocity.h" #include "xml.h" -namespace MusEDialog { +namespace MusEGui { //--------------------------------------------------------- // Velocity @@ -77,18 +77,18 @@ int Velocity::exec() return QDialog::exec(); } -void Velocity::read_configuration(Xml& xml) +void Velocity::read_configuration(MusECore::Xml& xml) { for (;;) { - Xml::Token token = xml.parse(); - if (token == Xml::Error || token == Xml::End) + MusECore::Xml::Token token = xml.parse(); + if (token == MusECore::Xml::Error || token == MusECore::Xml::End) break; const QString& tag = xml.s1(); switch (token) { - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "range") range=xml.parseInt(); else if (tag == "rate") @@ -99,7 +99,7 @@ void Velocity::read_configuration(Xml& xml) xml.unknown("ModVelo"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "mod_velo") return; @@ -109,7 +109,7 @@ void Velocity::read_configuration(Xml& xml) } } -void Velocity::write_configuration(int level, Xml& xml) +void Velocity::write_configuration(int level, MusECore::Xml& xml) { xml.tag(level++, "mod_velo"); xml.intTag(level, "range", range); @@ -118,4 +118,4 @@ void Velocity::write_configuration(int level, Xml& xml) xml.tag(level, "/mod_velo"); } -} // namespace MusEDialog +} // namespace MusEGui diff --git a/muse2/muse/widgets/function_dialogs/velocity.h b/muse2/muse/widgets/function_dialogs/velocity.h index 9ef6cd2a..e73b8207 100644 --- a/muse2/muse/widgets/function_dialogs/velocity.h +++ b/muse2/muse/widgets/function_dialogs/velocity.h @@ -26,9 +26,12 @@ #include "ui_velocitybase.h" class QButtonGroup; + +namespace MusECore { class Xml; +} -namespace MusEDialog { +namespace MusEGui { //--------------------------------------------------------- // Velocity @@ -51,15 +54,15 @@ class Velocity : public QDialog, public Ui::VelocityBase { int rateVal; int offsetVal; - void read_configuration(Xml& xml); - void write_configuration(int level, Xml& xml); + void read_configuration(MusECore::Xml& xml); + void write_configuration(int level, MusECore::Xml& xml); public slots: int exec(); }; -} // namespace MusEDialog +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/genset.cpp b/muse2/muse/widgets/genset.cpp index 1a317d0b..d7642b3b 100644 --- a/muse2/muse/widgets/genset.cpp +++ b/muse2/muse/widgets/genset.cpp @@ -34,7 +34,7 @@ #include "globals.h" #include "icons.h" -namespace MusEWidget { +namespace MusEGui { static int rtcResolutions[] = { 1024, 2048, 4096, 8192, 16384, 32768 @@ -62,51 +62,51 @@ GlobalSettingsConfig::GlobalSettingsConfig(QWidget* parent) startSongGroup->addButton(startEmptyButton, 1); startSongGroup->addButton(startSongButton, 2); for (unsigned i = 0; i < sizeof(rtcResolutions)/sizeof(*rtcResolutions); ++i) { - if (rtcResolutions[i] == MusEConfig::config.rtcTicks) { + if (rtcResolutions[i] == MusEGlobal::config.rtcTicks) { rtcResolutionSelect->setCurrentIndex(i); break; } } for (unsigned i = 0; i < sizeof(divisions)/sizeof(*divisions); ++i) { - if (divisions[i] == MusEConfig::config.division) { + if (divisions[i] == MusEGlobal::config.division) { midiDivisionSelect->setCurrentIndex(i); break; } } for (unsigned i = 0; i < sizeof(divisions)/sizeof(*divisions); ++i) { - if (divisions[i] == MusEConfig::config.guiDivision) { + if (divisions[i] == MusEGlobal::config.guiDivision) { guiDivisionSelect->setCurrentIndex(i); break; } } for (unsigned i = 0; i < sizeof(dummyAudioBufSizes)/sizeof(*dummyAudioBufSizes); ++i) { - if (dummyAudioBufSizes[i] == MusEConfig::config.dummyAudioBufSize) { + if (dummyAudioBufSizes[i] == MusEGlobal::config.dummyAudioBufSize) { dummyAudioSize->setCurrentIndex(i); break; } } for (unsigned i = 0; i < sizeof(minControlProcessPeriods)/sizeof(*minControlProcessPeriods); ++i) { - if (minControlProcessPeriods[i] == MusEConfig::config.minControlProcessPeriod) { + if (minControlProcessPeriods[i] == MusEGlobal::config.minControlProcessPeriod) { minControlProcessPeriodComboBox->setCurrentIndex(i); break; } } - userInstrumentsPath->setText(MusEConfig::config.userInstrumentsDir); + userInstrumentsPath->setText(MusEGlobal::config.userInstrumentsDir); selectInstrumentsDirButton->setIcon(*openIcon); defaultInstrumentsDirButton->setIcon(*undoIcon); connect(selectInstrumentsDirButton, SIGNAL(clicked()), SLOT(selectInstrumentsPath())); connect(defaultInstrumentsDirButton, SIGNAL(clicked()), SLOT(defaultInstrumentsPath())); - guiRefreshSelect->setValue(MusEConfig::config.guiRefresh); - minSliderSelect->setValue(int(MusEConfig::config.minSlider)); - minMeterSelect->setValue(MusEConfig::config.minMeter); - freewheelCheckBox->setChecked(MusEConfig::config.freewheelMode); - denormalCheckBox->setChecked(MusEConfig::config.useDenormalBias); - outputLimiterCheckBox->setChecked(MusEConfig::config.useOutputLimiter); - vstInPlaceCheckBox->setChecked(MusEConfig::config.vstInPlace); - dummyAudioRate->setValue(MusEConfig::config.dummyAudioSampleRate); + guiRefreshSelect->setValue(MusEGlobal::config.guiRefresh); + minSliderSelect->setValue(int(MusEGlobal::config.minSlider)); + minMeterSelect->setValue(MusEGlobal::config.minMeter); + freewheelCheckBox->setChecked(MusEGlobal::config.freewheelMode); + denormalCheckBox->setChecked(MusEGlobal::config.useDenormalBias); + outputLimiterCheckBox->setChecked(MusEGlobal::config.useOutputLimiter); + vstInPlaceCheckBox->setChecked(MusEGlobal::config.vstInPlace); + dummyAudioRate->setValue(MusEGlobal::config.dummyAudioSampleRate); //DummyAudioDevice* dad = dynamic_cast<DummyAudioDevice*>(audioDevice); //dummyAudioRealRate->setText(dad ? QString().setNum(sampleRate) : "---"); @@ -120,40 +120,40 @@ Period affects midi playback resolution. Shorter periods are desirable.</string> </property> */ - startSongEntry->setText(MusEConfig::config.startSong); - startSongGroup->button(MusEConfig::config.startMode)->setChecked(true); - - showTransport->setChecked(MusEConfig::config.transportVisible); - showBigtime->setChecked(MusEConfig::config.bigTimeVisible); - //showMixer->setChecked(MusEConfig::config.mixerVisible); - showMixer->setChecked(MusEConfig::config.mixer1Visible); - showMixer2->setChecked(MusEConfig::config.mixer2Visible); - - mainX->setValue(MusEConfig::config.geometryMain.x()); - mainY->setValue(MusEConfig::config.geometryMain.y()); - mainW->setValue(MusEConfig::config.geometryMain.width()); - mainH->setValue(MusEConfig::config.geometryMain.height()); - - transportX->setValue(MusEConfig::config.geometryTransport.x()); - transportY->setValue(MusEConfig::config.geometryTransport.y()); - - bigtimeX->setValue(MusEConfig::config.geometryBigTime.x()); - bigtimeY->setValue(MusEConfig::config.geometryBigTime.y()); - bigtimeW->setValue(MusEConfig::config.geometryBigTime.width()); - bigtimeH->setValue(MusEConfig::config.geometryBigTime.height()); - - //mixerX->setValue(MusEConfig::config.geometryMixer.x()); - //mixerY->setValue(MusEConfig::config.geometryMixer.y()); - //mixerW->setValue(MusEConfig::config.geometryMixer.width()); - //mixerH->setValue(MusEConfig::config.geometryMixer.height()); - mixerX->setValue(MusEConfig::config.mixer1.geometry.x()); - mixerY->setValue(MusEConfig::config.mixer1.geometry.y()); - mixerW->setValue(MusEConfig::config.mixer1.geometry.width()); - mixerH->setValue(MusEConfig::config.mixer1.geometry.height()); - mixer2X->setValue(MusEConfig::config.mixer2.geometry.x()); - mixer2Y->setValue(MusEConfig::config.mixer2.geometry.y()); - mixer2W->setValue(MusEConfig::config.mixer2.geometry.width()); - mixer2H->setValue(MusEConfig::config.mixer2.geometry.height()); + startSongEntry->setText(MusEGlobal::config.startSong); + startSongGroup->button(MusEGlobal::config.startMode)->setChecked(true); + + showTransport->setChecked(MusEGlobal::config.transportVisible); + showBigtime->setChecked(MusEGlobal::config.bigTimeVisible); + //showMixer->setChecked(MusEGlobal::config.mixerVisible); + showMixer->setChecked(MusEGlobal::config.mixer1Visible); + showMixer2->setChecked(MusEGlobal::config.mixer2Visible); + + mainX->setValue(MusEGlobal::config.geometryMain.x()); + mainY->setValue(MusEGlobal::config.geometryMain.y()); + mainW->setValue(MusEGlobal::config.geometryMain.width()); + mainH->setValue(MusEGlobal::config.geometryMain.height()); + + transportX->setValue(MusEGlobal::config.geometryTransport.x()); + transportY->setValue(MusEGlobal::config.geometryTransport.y()); + + bigtimeX->setValue(MusEGlobal::config.geometryBigTime.x()); + bigtimeY->setValue(MusEGlobal::config.geometryBigTime.y()); + bigtimeW->setValue(MusEGlobal::config.geometryBigTime.width()); + bigtimeH->setValue(MusEGlobal::config.geometryBigTime.height()); + + //mixerX->setValue(MusEGlobal::config.geometryMixer.x()); + //mixerY->setValue(MusEGlobal::config.geometryMixer.y()); + //mixerW->setValue(MusEGlobal::config.geometryMixer.width()); + //mixerH->setValue(MusEGlobal::config.geometryMixer.height()); + mixerX->setValue(MusEGlobal::config.mixer1.geometry.x()); + mixerY->setValue(MusEGlobal::config.mixer1.geometry.y()); + mixerW->setValue(MusEGlobal::config.mixer1.geometry.width()); + mixerH->setValue(MusEGlobal::config.mixer1.geometry.height()); + mixer2X->setValue(MusEGlobal::config.mixer2.geometry.x()); + mixer2Y->setValue(MusEGlobal::config.mixer2.geometry.y()); + mixer2W->setValue(MusEGlobal::config.mixer2.geometry.width()); + mixer2H->setValue(MusEGlobal::config.mixer2.geometry.height()); //setMixerCurrent->setEnabled(MusEGlobal::muse->mixerWindow()); setMixerCurrent->setEnabled(MusEGlobal::muse->mixer1Window()); @@ -162,15 +162,15 @@ Shorter periods are desirable.</string> setBigtimeCurrent->setEnabled(MusEGlobal::muse->bigtimeWindow()); setTransportCurrent->setEnabled(MusEGlobal::muse->transportWindow()); - showSplash->setChecked(MusEConfig::config.showSplashScreen); - showDidYouKnow->setChecked(MusEConfig::config.showDidYouKnow); - externalWavEditorSelect->setText(MusEConfig::config.externalWavEditor); - oldStyleStopCheckBox->setChecked(MusEConfig::config.useOldStyleStopShortCut); - moveArmedCheckBox->setChecked(MusEConfig::config.moveArmedCheckBox); - projectSaveCheckBox->setChecked(MusEConfig::config.useProjectSaveDialog); - popsDefStayOpenCheckBox->setChecked(MusEConfig::config.popupsDefaultStayOpen); - lmbDecreasesCheckBox->setChecked(MusEConfig::config.leftMouseButtonCanDecrease); - rangeMarkerWithoutMMBCheckBox->setChecked(MusEConfig::config.rangeMarkerWithoutMMB); + showSplash->setChecked(MusEGlobal::config.showSplashScreen); + showDidYouKnow->setChecked(MusEGlobal::config.showDidYouKnow); + externalWavEditorSelect->setText(MusEGlobal::config.externalWavEditor); + oldStyleStopCheckBox->setChecked(MusEGlobal::config.useOldStyleStopShortCut); + moveArmedCheckBox->setChecked(MusEGlobal::config.moveArmedCheckBox); + projectSaveCheckBox->setChecked(MusEGlobal::config.useProjectSaveDialog); + popsDefStayOpenCheckBox->setChecked(MusEGlobal::config.popupsDefaultStayOpen); + lmbDecreasesCheckBox->setChecked(MusEGlobal::config.leftMouseButtonCanDecrease); + rangeMarkerWithoutMMBCheckBox->setChecked(MusEGlobal::config.rangeMarkerWithoutMMB); //updateSettings(); // TESTING @@ -214,84 +214,84 @@ void GlobalSettingsConfig::addMdiSettings(TopWin::ToplevelType t) void GlobalSettingsConfig::updateSettings() { for (unsigned i = 0; i < sizeof(rtcResolutions)/sizeof(*rtcResolutions); ++i) { - if (rtcResolutions[i] == MusEConfig::config.rtcTicks) { + if (rtcResolutions[i] == MusEGlobal::config.rtcTicks) { rtcResolutionSelect->setCurrentIndex(i); break; } } for (unsigned i = 0; i < sizeof(divisions)/sizeof(*divisions); ++i) { - if (divisions[i] == MusEConfig::config.division) { + if (divisions[i] == MusEGlobal::config.division) { midiDivisionSelect->setCurrentIndex(i); break; } } for (unsigned i = 0; i < sizeof(divisions)/sizeof(*divisions); ++i) { - if (divisions[i] == MusEConfig::config.guiDivision) { + if (divisions[i] == MusEGlobal::config.guiDivision) { guiDivisionSelect->setCurrentIndex(i); break; } } for (unsigned i = 0; i < sizeof(dummyAudioBufSizes)/sizeof(*dummyAudioBufSizes); ++i) { - if (dummyAudioBufSizes[i] == MusEConfig::config.dummyAudioBufSize) { + if (dummyAudioBufSizes[i] == MusEGlobal::config.dummyAudioBufSize) { dummyAudioSize->setCurrentIndex(i); break; } } for (unsigned i = 0; i < sizeof(minControlProcessPeriods)/sizeof(*minControlProcessPeriods); ++i) { - if (minControlProcessPeriods[i] == MusEConfig::config.minControlProcessPeriod) { + if (minControlProcessPeriods[i] == MusEGlobal::config.minControlProcessPeriod) { minControlProcessPeriodComboBox->setCurrentIndex(i); break; } } - guiRefreshSelect->setValue(MusEConfig::config.guiRefresh); - minSliderSelect->setValue(int(MusEConfig::config.minSlider)); - minMeterSelect->setValue(MusEConfig::config.minMeter); - freewheelCheckBox->setChecked(MusEConfig::config.freewheelMode); - denormalCheckBox->setChecked(MusEConfig::config.useDenormalBias); - outputLimiterCheckBox->setChecked(MusEConfig::config.useOutputLimiter); - vstInPlaceCheckBox->setChecked(MusEConfig::config.vstInPlace); - dummyAudioRate->setValue(MusEConfig::config.dummyAudioSampleRate); + guiRefreshSelect->setValue(MusEGlobal::config.guiRefresh); + minSliderSelect->setValue(int(MusEGlobal::config.minSlider)); + minMeterSelect->setValue(MusEGlobal::config.minMeter); + freewheelCheckBox->setChecked(MusEGlobal::config.freewheelMode); + denormalCheckBox->setChecked(MusEGlobal::config.useDenormalBias); + outputLimiterCheckBox->setChecked(MusEGlobal::config.useOutputLimiter); + vstInPlaceCheckBox->setChecked(MusEGlobal::config.vstInPlace); + dummyAudioRate->setValue(MusEGlobal::config.dummyAudioSampleRate); //DummyAudioDevice* dad = dynamic_cast<DummyAudioDevice*>(audioDevice); //dummyAudioRealRate->setText(dad ? QString().setNum(sampleRate) : "---"); //dummyAudioRealRate->setText(QString().setNum(sampleRate)); // Not used any more. p4.0.20 - startSongEntry->setText(MusEConfig::config.startSong); - startSongGroup->button(MusEConfig::config.startMode)->setChecked(true); - - showTransport->setChecked(MusEConfig::config.transportVisible); - showBigtime->setChecked(MusEConfig::config.bigTimeVisible); - //showMixer->setChecked(MusEConfig::config.mixerVisible); - showMixer->setChecked(MusEConfig::config.mixer1Visible); - showMixer2->setChecked(MusEConfig::config.mixer2Visible); - - mainX->setValue(MusEConfig::config.geometryMain.x()); - mainY->setValue(MusEConfig::config.geometryMain.y()); - mainW->setValue(MusEConfig::config.geometryMain.width()); - mainH->setValue(MusEConfig::config.geometryMain.height()); - - transportX->setValue(MusEConfig::config.geometryTransport.x()); - transportY->setValue(MusEConfig::config.geometryTransport.y()); - - bigtimeX->setValue(MusEConfig::config.geometryBigTime.x()); - bigtimeY->setValue(MusEConfig::config.geometryBigTime.y()); - bigtimeW->setValue(MusEConfig::config.geometryBigTime.width()); - bigtimeH->setValue(MusEConfig::config.geometryBigTime.height()); - - //mixerX->setValue(MusEConfig::config.geometryMixer.x()); - //mixerY->setValue(MusEConfig::config.geometryMixer.y()); - //mixerW->setValue(MusEConfig::config.geometryMixer.width()); - //mixerH->setValue(MusEConfig::config.geometryMixer.height()); - mixerX->setValue(MusEConfig::config.mixer1.geometry.x()); - mixerY->setValue(MusEConfig::config.mixer1.geometry.y()); - mixerW->setValue(MusEConfig::config.mixer1.geometry.width()); - mixerH->setValue(MusEConfig::config.mixer1.geometry.height()); - mixer2X->setValue(MusEConfig::config.mixer2.geometry.x()); - mixer2Y->setValue(MusEConfig::config.mixer2.geometry.y()); - mixer2W->setValue(MusEConfig::config.mixer2.geometry.width()); - mixer2H->setValue(MusEConfig::config.mixer2.geometry.height()); + startSongEntry->setText(MusEGlobal::config.startSong); + startSongGroup->button(MusEGlobal::config.startMode)->setChecked(true); + + showTransport->setChecked(MusEGlobal::config.transportVisible); + showBigtime->setChecked(MusEGlobal::config.bigTimeVisible); + //showMixer->setChecked(MusEGlobal::config.mixerVisible); + showMixer->setChecked(MusEGlobal::config.mixer1Visible); + showMixer2->setChecked(MusEGlobal::config.mixer2Visible); + + mainX->setValue(MusEGlobal::config.geometryMain.x()); + mainY->setValue(MusEGlobal::config.geometryMain.y()); + mainW->setValue(MusEGlobal::config.geometryMain.width()); + mainH->setValue(MusEGlobal::config.geometryMain.height()); + + transportX->setValue(MusEGlobal::config.geometryTransport.x()); + transportY->setValue(MusEGlobal::config.geometryTransport.y()); + + bigtimeX->setValue(MusEGlobal::config.geometryBigTime.x()); + bigtimeY->setValue(MusEGlobal::config.geometryBigTime.y()); + bigtimeW->setValue(MusEGlobal::config.geometryBigTime.width()); + bigtimeH->setValue(MusEGlobal::config.geometryBigTime.height()); + + //mixerX->setValue(MusEGlobal::config.geometryMixer.x()); + //mixerY->setValue(MusEGlobal::config.geometryMixer.y()); + //mixerW->setValue(MusEGlobal::config.geometryMixer.width()); + //mixerH->setValue(MusEGlobal::config.geometryMixer.height()); + mixerX->setValue(MusEGlobal::config.mixer1.geometry.x()); + mixerY->setValue(MusEGlobal::config.mixer1.geometry.y()); + mixerW->setValue(MusEGlobal::config.mixer1.geometry.width()); + mixerH->setValue(MusEGlobal::config.mixer1.geometry.height()); + mixer2X->setValue(MusEGlobal::config.mixer2.geometry.x()); + mixer2Y->setValue(MusEGlobal::config.mixer2.geometry.y()); + mixer2W->setValue(MusEGlobal::config.mixer2.geometry.width()); + mixer2H->setValue(MusEGlobal::config.mixer2.geometry.height()); //setMixerCurrent->setEnabled(MusEGlobal::muse->mixerWindow()); setMixerCurrent->setEnabled(MusEGlobal::muse->mixer1Window()); @@ -300,15 +300,15 @@ void GlobalSettingsConfig::updateSettings() setBigtimeCurrent->setEnabled(MusEGlobal::muse->bigtimeWindow()); setTransportCurrent->setEnabled(MusEGlobal::muse->transportWindow()); - showSplash->setChecked(MusEConfig::config.showSplashScreen); - showDidYouKnow->setChecked(MusEConfig::config.showDidYouKnow); - externalWavEditorSelect->setText(MusEConfig::config.externalWavEditor); - oldStyleStopCheckBox->setChecked(MusEConfig::config.useOldStyleStopShortCut); - moveArmedCheckBox->setChecked(MusEConfig::config.moveArmedCheckBox); - projectSaveCheckBox->setChecked(MusEConfig::config.useProjectSaveDialog); - popsDefStayOpenCheckBox->setChecked(MusEConfig::config.popupsDefaultStayOpen); - lmbDecreasesCheckBox->setChecked(MusEConfig::config.leftMouseButtonCanDecrease); - rangeMarkerWithoutMMBCheckBox->setChecked(MusEConfig::config.rangeMarkerWithoutMMB); + showSplash->setChecked(MusEGlobal::config.showSplashScreen); + showDidYouKnow->setChecked(MusEGlobal::config.showDidYouKnow); + externalWavEditorSelect->setText(MusEGlobal::config.externalWavEditor); + oldStyleStopCheckBox->setChecked(MusEGlobal::config.useOldStyleStopShortCut); + moveArmedCheckBox->setChecked(MusEGlobal::config.moveArmedCheckBox); + projectSaveCheckBox->setChecked(MusEGlobal::config.useProjectSaveDialog); + popsDefStayOpenCheckBox->setChecked(MusEGlobal::config.popupsDefaultStayOpen); + lmbDecreasesCheckBox->setChecked(MusEGlobal::config.leftMouseButtonCanDecrease); + rangeMarkerWithoutMMBCheckBox->setChecked(MusEGlobal::config.rangeMarkerWithoutMMB); updateMdiSettings(); } @@ -342,110 +342,110 @@ void GlobalSettingsConfig::showEvent(QShowEvent* e) void GlobalSettingsConfig::apply() { int rtcticks = rtcResolutionSelect->currentIndex(); - MusEConfig::config.guiRefresh = guiRefreshSelect->value(); - MusEConfig::config.minSlider = minSliderSelect->value(); - MusEConfig::config.minMeter = minMeterSelect->value(); - MusEConfig::config.freewheelMode = freewheelCheckBox->isChecked(); - MusEConfig::config.useDenormalBias = denormalCheckBox->isChecked(); - MusEConfig::config.useOutputLimiter = outputLimiterCheckBox->isChecked(); - MusEConfig::config.vstInPlace = vstInPlaceCheckBox->isChecked(); - MusEConfig::config.rtcTicks = rtcResolutions[rtcticks]; - MusEConfig::config.userInstrumentsDir = userInstrumentsPath->text(); - MusEConfig::config.startSong = startSongEntry->text(); - MusEConfig::config.startMode = startSongGroup->checkedId(); + MusEGlobal::config.guiRefresh = guiRefreshSelect->value(); + MusEGlobal::config.minSlider = minSliderSelect->value(); + MusEGlobal::config.minMeter = minMeterSelect->value(); + MusEGlobal::config.freewheelMode = freewheelCheckBox->isChecked(); + MusEGlobal::config.useDenormalBias = denormalCheckBox->isChecked(); + MusEGlobal::config.useOutputLimiter = outputLimiterCheckBox->isChecked(); + MusEGlobal::config.vstInPlace = vstInPlaceCheckBox->isChecked(); + MusEGlobal::config.rtcTicks = rtcResolutions[rtcticks]; + MusEGlobal::config.userInstrumentsDir = userInstrumentsPath->text(); + MusEGlobal::config.startSong = startSongEntry->text(); + MusEGlobal::config.startMode = startSongGroup->checkedId(); int das = dummyAudioSize->currentIndex(); - MusEConfig::config.dummyAudioBufSize = dummyAudioBufSizes[das]; - MusEConfig::config.dummyAudioSampleRate = dummyAudioRate->value(); + MusEGlobal::config.dummyAudioBufSize = dummyAudioBufSizes[das]; + MusEGlobal::config.dummyAudioSampleRate = dummyAudioRate->value(); int mcp = minControlProcessPeriodComboBox->currentIndex(); - MusEConfig::config.minControlProcessPeriod = minControlProcessPeriods[mcp]; + MusEGlobal::config.minControlProcessPeriod = minControlProcessPeriods[mcp]; int div = midiDivisionSelect->currentIndex(); - MusEConfig::config.division = divisions[div]; + MusEGlobal::config.division = divisions[div]; div = guiDivisionSelect->currentIndex(); - MusEConfig::config.guiDivision = divisions[div]; + MusEGlobal::config.guiDivision = divisions[div]; - MusEConfig::config.transportVisible = showTransport->isChecked(); - MusEConfig::config.bigTimeVisible = showBigtime->isChecked(); - //MusEConfig::config.mixerVisible = showMixer->isChecked(); - MusEConfig::config.mixer1Visible = showMixer->isChecked(); - MusEConfig::config.mixer2Visible = showMixer2->isChecked(); - - MusEConfig::config.geometryMain.setX(mainX->value()); - MusEConfig::config.geometryMain.setY(mainY->value()); - MusEConfig::config.geometryMain.setWidth(mainW->value()); - MusEConfig::config.geometryMain.setHeight(mainH->value()); - - MusEConfig::config.geometryTransport.setX(transportX->value()); - MusEConfig::config.geometryTransport.setY(transportY->value()); - MusEConfig::config.geometryTransport.setWidth(0); - MusEConfig::config.geometryTransport.setHeight(0); - - MusEConfig::config.geometryBigTime.setX(bigtimeX->value()); - MusEConfig::config.geometryBigTime.setY(bigtimeY->value()); - MusEConfig::config.geometryBigTime.setWidth(bigtimeW->value()); - MusEConfig::config.geometryBigTime.setHeight(bigtimeH->value()); - - //MusEConfig::config.geometryMixer.setX(mixerX->value()); - //MusEConfig::config.geometryMixer.setY(mixerY->value()); - //MusEConfig::config.geometryMixer.setWidth(mixerW->value()); - //MusEConfig::config.geometryMixer.setHeight(mixerH->value()); - MusEConfig::config.mixer1.geometry.setX(mixerX->value()); - MusEConfig::config.mixer1.geometry.setY(mixerY->value()); - MusEConfig::config.mixer1.geometry.setWidth(mixerW->value()); - MusEConfig::config.mixer1.geometry.setHeight(mixerH->value()); - MusEConfig::config.mixer2.geometry.setX(mixer2X->value()); - MusEConfig::config.mixer2.geometry.setY(mixer2Y->value()); - MusEConfig::config.mixer2.geometry.setWidth(mixer2W->value()); - MusEConfig::config.mixer2.geometry.setHeight(mixer2H->value()); - - MusEConfig::config.showSplashScreen = showSplash->isChecked(); - MusEConfig::config.showDidYouKnow = showDidYouKnow->isChecked(); - MusEConfig::config.externalWavEditor = externalWavEditorSelect->text(); - MusEConfig::config.useOldStyleStopShortCut = oldStyleStopCheckBox->isChecked(); - MusEConfig::config.moveArmedCheckBox = moveArmedCheckBox->isChecked(); - MusEConfig::config.useProjectSaveDialog = projectSaveCheckBox->isChecked(); - MusEConfig::config.popupsDefaultStayOpen = popsDefStayOpenCheckBox->isChecked(); - MusEConfig::config.leftMouseButtonCanDecrease = lmbDecreasesCheckBox->isChecked(); - MusEConfig::config.rangeMarkerWithoutMMB = rangeMarkerWithoutMMBCheckBox->isChecked(); - - //MusEGlobal::muse->showMixer(MusEConfig::config.mixerVisible); - MusEGlobal::muse->showMixer1(MusEConfig::config.mixer1Visible); - MusEGlobal::muse->showMixer2(MusEConfig::config.mixer2Visible); + MusEGlobal::config.transportVisible = showTransport->isChecked(); + MusEGlobal::config.bigTimeVisible = showBigtime->isChecked(); + //MusEGlobal::config.mixerVisible = showMixer->isChecked(); + MusEGlobal::config.mixer1Visible = showMixer->isChecked(); + MusEGlobal::config.mixer2Visible = showMixer2->isChecked(); + + MusEGlobal::config.geometryMain.setX(mainX->value()); + MusEGlobal::config.geometryMain.setY(mainY->value()); + MusEGlobal::config.geometryMain.setWidth(mainW->value()); + MusEGlobal::config.geometryMain.setHeight(mainH->value()); + + MusEGlobal::config.geometryTransport.setX(transportX->value()); + MusEGlobal::config.geometryTransport.setY(transportY->value()); + MusEGlobal::config.geometryTransport.setWidth(0); + MusEGlobal::config.geometryTransport.setHeight(0); + + MusEGlobal::config.geometryBigTime.setX(bigtimeX->value()); + MusEGlobal::config.geometryBigTime.setY(bigtimeY->value()); + MusEGlobal::config.geometryBigTime.setWidth(bigtimeW->value()); + MusEGlobal::config.geometryBigTime.setHeight(bigtimeH->value()); + + //MusEGlobal::config.geometryMixer.setX(mixerX->value()); + //MusEGlobal::config.geometryMixer.setY(mixerY->value()); + //MusEGlobal::config.geometryMixer.setWidth(mixerW->value()); + //MusEGlobal::config.geometryMixer.setHeight(mixerH->value()); + MusEGlobal::config.mixer1.geometry.setX(mixerX->value()); + MusEGlobal::config.mixer1.geometry.setY(mixerY->value()); + MusEGlobal::config.mixer1.geometry.setWidth(mixerW->value()); + MusEGlobal::config.mixer1.geometry.setHeight(mixerH->value()); + MusEGlobal::config.mixer2.geometry.setX(mixer2X->value()); + MusEGlobal::config.mixer2.geometry.setY(mixer2Y->value()); + MusEGlobal::config.mixer2.geometry.setWidth(mixer2W->value()); + MusEGlobal::config.mixer2.geometry.setHeight(mixer2H->value()); + + MusEGlobal::config.showSplashScreen = showSplash->isChecked(); + MusEGlobal::config.showDidYouKnow = showDidYouKnow->isChecked(); + MusEGlobal::config.externalWavEditor = externalWavEditorSelect->text(); + MusEGlobal::config.useOldStyleStopShortCut = oldStyleStopCheckBox->isChecked(); + MusEGlobal::config.moveArmedCheckBox = moveArmedCheckBox->isChecked(); + MusEGlobal::config.useProjectSaveDialog = projectSaveCheckBox->isChecked(); + MusEGlobal::config.popupsDefaultStayOpen = popsDefStayOpenCheckBox->isChecked(); + MusEGlobal::config.leftMouseButtonCanDecrease = lmbDecreasesCheckBox->isChecked(); + MusEGlobal::config.rangeMarkerWithoutMMB = rangeMarkerWithoutMMBCheckBox->isChecked(); + + //MusEGlobal::muse->showMixer(MusEGlobal::config.mixerVisible); + MusEGlobal::muse->showMixer1(MusEGlobal::config.mixer1Visible); + MusEGlobal::muse->showMixer2(MusEGlobal::config.mixer2Visible); - MusEGlobal::muse->showBigtime(MusEConfig::config.bigTimeVisible); - MusEGlobal::muse->showTransport(MusEConfig::config.transportVisible); + MusEGlobal::muse->showBigtime(MusEGlobal::config.bigTimeVisible); + MusEGlobal::muse->showTransport(MusEGlobal::config.transportVisible); QWidget* w = MusEGlobal::muse->transportWindow(); if (w) { - w->resize(MusEConfig::config.geometryTransport.size()); - w->move(MusEConfig::config.geometryTransport.topLeft()); + w->resize(MusEGlobal::config.geometryTransport.size()); + w->move(MusEGlobal::config.geometryTransport.topLeft()); } //w = MusEGlobal::muse->mixerWindow(); //if (w) { - // w->resize(MusEConfig::config.geometryMixer.size()); - // w->move(MusEConfig::config.geometryMixer.topLeft()); + // w->resize(MusEGlobal::config.geometryMixer.size()); + // w->move(MusEGlobal::config.geometryMixer.topLeft()); // } w = MusEGlobal::muse->mixer1Window(); if (w) { - w->resize(MusEConfig::config.mixer1.geometry.size()); - w->move(MusEConfig::config.mixer1.geometry.topLeft()); + w->resize(MusEGlobal::config.mixer1.geometry.size()); + w->move(MusEGlobal::config.mixer1.geometry.topLeft()); } w = MusEGlobal::muse->mixer2Window(); if (w) { - w->resize(MusEConfig::config.mixer2.geometry.size()); - w->move(MusEConfig::config.mixer2.geometry.topLeft()); + w->resize(MusEGlobal::config.mixer2.geometry.size()); + w->move(MusEGlobal::config.mixer2.geometry.topLeft()); } w = MusEGlobal::muse->bigtimeWindow(); if (w) { - w->resize(MusEConfig::config.geometryBigTime.size()); - w->move(MusEConfig::config.geometryBigTime.topLeft()); + w->resize(MusEGlobal::config.geometryBigTime.size()); + w->move(MusEGlobal::config.geometryBigTime.topLeft()); } - MusEGlobal::muse->resize(MusEConfig::config.geometryMain.size()); - MusEGlobal::muse->move(MusEConfig::config.geometryMain.topLeft()); + MusEGlobal::muse->resize(MusEGlobal::config.geometryMain.size()); + MusEGlobal::muse->move(MusEGlobal::config.geometryMain.topLeft()); - MusEGlobal::museUserInstruments = MusEConfig::config.userInstrumentsDir; + MusEGlobal::museUserInstruments = MusEGlobal::config.userInstrumentsDir; MusEGlobal::muse->setHeartBeat(); // set guiRefresh - midiSeq->msgSetRtc(); // set midi tick rate + MusEGlobal::midiSeq->msgSetRtc(); // set midi tick rate applyMdiSettings(); @@ -550,7 +550,7 @@ void GlobalSettingsConfig::selectInstrumentsPath() { QString dir = QFileDialog::getExistingDirectory(this, tr("Selects instruments directory"), - MusEConfig::config.userInstrumentsDir); + MusEGlobal::config.userInstrumentsDir); userInstrumentsPath->setText(dir); } @@ -598,5 +598,5 @@ void GlobalSettingsConfig::borlandPreset() updateMdiSettings(); } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/genset.h b/muse2/muse/widgets/genset.h index 6068c429..0e1697ee 100644 --- a/muse2/muse/widgets/genset.h +++ b/muse2/muse/widgets/genset.h @@ -31,7 +31,7 @@ #include <QShowEvent> #include <list> -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // GlobalSettingsConfig @@ -68,6 +68,6 @@ class GlobalSettingsConfig : public QDialog, public Ui::GlobalSettingsDialogBase GlobalSettingsConfig(QWidget* parent=0); }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/header.cpp b/muse2/muse/widgets/header.cpp index 8e2efe21..2c1057c3 100644 --- a/muse2/muse/widgets/header.cpp +++ b/muse2/muse/widgets/header.cpp @@ -28,23 +28,23 @@ #include <QStandardItemModel> #include <QMouseEvent> -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // readStatus //--------------------------------------------------------- -void Header::readStatus(Xml& xml) +void Header::readStatus(MusECore::Xml& xml) { for (;;) { - Xml::Token token = xml.parse(); + MusECore::Xml::Token token = xml.parse(); const QString& tag = xml.s1(); switch (token) { - case Xml::Error: - case Xml::End: + case MusECore::Xml::Error: + case MusECore::Xml::End: return; - case Xml::Text: + case MusECore::Xml::Text: { QStringList l = tag.split(QString(" "), QString::SkipEmptyParts); int index = count() -1; @@ -76,10 +76,10 @@ void Header::readStatus(Xml& xml) } } break; - case Xml::TagStart: + case MusECore::Xml::TagStart: xml.unknown("Header"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag ==objectName()) return; default: @@ -92,10 +92,10 @@ void Header::readStatus(Xml& xml) // writeStatus //--------------------------------------------------------- -void Header::writeStatus(int level, Xml& xml) const +void Header::writeStatus(int level, MusECore::Xml& xml) const { //xml.nput(level, "<%s> ", name()); - xml.nput(level, "<%s> ", Xml::xmlString(objectName()).toLatin1().constData()); + xml.nput(level, "<%s> ", MusECore::Xml::xmlString(objectName()).toLatin1().constData()); int n = count(); for (int i = n; i >= 0; --i) { if (isSectionHidden(logicalIndex(i))) @@ -104,7 +104,7 @@ void Header::writeStatus(int level, Xml& xml) const xml.nput("%d ", logicalIndex(i)); } //xml.put("</%s>", name()); - xml.put("</%s>", Xml::xmlString(objectName()).toLatin1().constData()); + xml.put("</%s>", MusECore::Xml::xmlString(objectName()).toLatin1().constData()); } //--------------------------------------------------------- @@ -192,4 +192,4 @@ void Header::changeColumns(QAction *a) hideSection(section); } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/header.h b/muse2/muse/widgets/header.h index 47c79192..f88ba750 100644 --- a/muse2/muse/widgets/header.h +++ b/muse2/muse/widgets/header.h @@ -28,9 +28,11 @@ class QStandardItemModel; +namespace MusECore { class Xml; +} -namespace MusEWidget { +namespace MusEGui { class Header : public QHeaderView { Q_OBJECT @@ -39,8 +41,8 @@ class Header : public QHeaderView { public: Header(QWidget* parent=0, const char* name=0); - void writeStatus(int level, Xml&) const; - void readStatus(Xml&); + void writeStatus(int level, MusECore::Xml&) const; + void readStatus(MusECore::Xml&); void setColumnLabel( const QString & s, int col, int width = -1 ); void setToolTip(int col, const QString &text); void setWhatsThis(int col, const QString &text); @@ -49,7 +51,7 @@ class Header : public QHeaderView { void changeColumns(QAction* a); }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/hitscale.cpp b/muse2/muse/widgets/hitscale.cpp index 6db0172d..a24eff9c 100644 --- a/muse2/muse/widgets/hitscale.cpp +++ b/muse2/muse/widgets/hitscale.cpp @@ -29,7 +29,7 @@ #include "song.h" -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // HitScale @@ -39,12 +39,12 @@ HitScale::HitScale(int* r, QWidget* parent, int xs) : View(parent, xs, 1) { raster = r; - pos[0] = song->cpos(); - pos[1] = song->lpos(); - pos[2] = song->rpos(); + pos[0] = MusEGlobal::song->cpos(); + pos[1] = MusEGlobal::song->lpos(); + pos[2] = MusEGlobal::song->rpos(); button = Qt::NoButton; setMouseTracking(true); - connect(song, SIGNAL(posChanged(int, unsigned, bool)), this, SLOT(setPos(int, unsigned, bool))); + connect(MusEGlobal::song, SIGNAL(posChanged(int, unsigned, bool)), this, SLOT(setPos(int, unsigned, bool))); setFixedHeight(18); } @@ -98,7 +98,7 @@ void HitScale::viewMouseMoveEvent(QMouseEvent* event) i = 1; break; case Qt::RightButton: - if ((MusEConfig::config.rangeMarkerWithoutMMB) && (event->modifiers() & Qt::ControlModifier)) + if ((MusEGlobal::config.rangeMarkerWithoutMMB) && (event->modifiers() & Qt::ControlModifier)) i = 1; else i = 2; @@ -106,8 +106,8 @@ void HitScale::viewMouseMoveEvent(QMouseEvent* event) default: return; } - Pos p(x, true); - song->setPos(i, p); + MusECore::Pos p(x, true); + MusEGlobal::song->setPos(i, p); } //--------------------------------------------------------- diff --git a/muse2/muse/widgets/hitscale.h b/muse2/muse/widgets/hitscale.h index cf43ef4a..fdc8d810 100644 --- a/muse2/muse/widgets/hitscale.h +++ b/muse2/muse/widgets/hitscale.h @@ -27,7 +27,7 @@ class MidiEditor; -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // HitScale @@ -60,7 +60,7 @@ class HitScale : public View { HitScale(int* raster, QWidget* parent, int xscale); }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/intlabel.cpp b/muse2/muse/widgets/intlabel.cpp index 6884adfb..f71a5b50 100644 --- a/muse2/muse/widgets/intlabel.cpp +++ b/muse2/muse/widgets/intlabel.cpp @@ -25,7 +25,7 @@ #include "intlabel.h" #include "utils.h" -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // IntLabel @@ -41,7 +41,7 @@ IntLabel::IntLabel(int _val, int _min, int _max, QWidget* parent, val = _val+1; // dont optimize away off = _off; setValue(_val); - int len = MusEUtil::num2cols(min, max); + int len = MusECore::num2cols(min, max); setSize(len); } @@ -59,7 +59,7 @@ void IntLabel::setRange(int mn, int mx) { min = mn; max = mx; - setSize(MusEUtil::num2cols(min, max)); + setSize(MusECore::num2cols(min, max)); int v = val; if(val < mn) v = mn; @@ -155,4 +155,4 @@ void IntLabel::setOff(int v) setString(val); } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/intlabel.h b/muse2/muse/widgets/intlabel.h index 34c075d8..bcc3c6b2 100644 --- a/muse2/muse/widgets/intlabel.h +++ b/muse2/muse/widgets/intlabel.h @@ -28,7 +28,7 @@ class QString; -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // IntLabel @@ -60,6 +60,6 @@ class IntLabel : public Nentry { void setRange(int, int); }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/itransformbase.ui b/muse2/muse/widgets/itransformbase.ui index 2e9fb602..52c29a7e 100644 --- a/muse2/muse/widgets/itransformbase.ui +++ b/muse2/muse/widgets/itransformbase.ui @@ -533,7 +533,7 @@ </widget> </item> <item row="2" column="1"> - <widget class="MusEWidget::SpinBoxFP" name="procVal1a"> + <widget class="MusEGui::SpinBoxFP" name="procVal1a"> <property name="maximum" stdset="0"> <number>99999999</number> </property> @@ -736,21 +736,21 @@ </widget> </item> <item row="2" column="2"> - <widget class="MusEWidget::SpinBoxFP" name="procVal2a"> + <widget class="MusEGui::SpinBoxFP" name="procVal2a"> <property name="maximum" stdset="0"> <number>99999999</number> </property> </widget> </item> <item row="2" column="3"> - <widget class="MusEWidget::SpinBoxFP" name="procPortVala"> + <widget class="MusEGui::SpinBoxFP" name="procPortVala"> <property name="maximum" stdset="0"> <number>99999999</number> </property> </widget> </item> <item row="2" column="4"> - <widget class="MusEWidget::SpinBoxFP" name="procChannelVala"> + <widget class="MusEGui::SpinBoxFP" name="procChannelVala"> <property name="maximum" stdset="0"> <number>99999999</number> </property> @@ -1106,7 +1106,7 @@ <layoutdefault spacing="6" margin="11"/> <customwidgets> <customwidget> - <class>MusEWidget::SpinBoxFP</class> + <class>MusEGui::SpinBoxFP</class> <extends>QDoubleSpinBox</extends> <header>spinboxFP.h</header> </customwidget> diff --git a/muse2/muse/widgets/knob.cpp b/muse2/muse/widgets/knob.cpp index ac035065..920d2028 100644 --- a/muse2/muse/widgets/knob.cpp +++ b/muse2/muse/widgets/knob.cpp @@ -34,7 +34,7 @@ #include <QPaintEvent> #include <QResizeEvent> -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // The QwtKnob widget imitates look and behaviour of a volume knob on a radio. @@ -329,15 +329,15 @@ void Knob::rangeChange() void Knob::resizeEvent(QResizeEvent* ev) { - MusEWidget::SliderBase::resizeEvent(ev); + SliderBase::resizeEvent(ev); int width, width_2; const QRect& r = rect(); // printf("resize %d %d %d\n", r.height(), r.width(), d_knobWidth); -// width = MusEUtil::qwtMin(MusEUtil::qwtMin(r.height(), r.width()), d_knobWidth); - width = MusEUtil::qwtMin(r.height(), r.width()); +// width = MusECore::qwtMin(MusECore::qwtMin(r.height(), r.width()), d_knobWidth); + width = MusECore::qwtMin(r.height(), r.width()); width_2 = width / 2; int x = r.x() + r.width() / 2 - width_2; @@ -426,7 +426,7 @@ void Knob::drawMarker(QPainter *p, double arc, const QColor &c) p->setBrush(c); p->setPen(Qt::NoPen); - rb = double(MusEUtil::qwtMax(radius - 4 - d_dotWidth / 2, 0)); + rb = double(MusECore::qwtMax(radius - 4 - d_dotWidth / 2, 0)); p->drawEllipse(xm - int(rint(sa * rb)) - d_dotWidth / 2, ym - int(rint(ca * rb)) - d_dotWidth / 2, d_dotWidth, d_dotWidth); @@ -439,8 +439,8 @@ void Knob::drawMarker(QPainter *p, double arc, const QColor &c) pn.setWidth(2); p->setPen(pn); - rb = MusEUtil::qwtMax(double((radius - 1) / 3.0), 0.0); - re = MusEUtil::qwtMax(double(radius - 1), 0.0); + rb = MusECore::qwtMax(double((radius - 1) / 3.0), 0.0); + re = MusECore::qwtMax(double(radius - 1), 0.0); p->setRenderHint(QPainter::Antialiasing, true); p->drawLine( xm, @@ -471,7 +471,7 @@ void Knob::drawMarker(QPainter *p, double arc, const QColor &c) //------------------------------------------------------------ void Knob::setKnobWidth(int w) { - d_knobWidth = MusEUtil::qwtMax(w,5); + d_knobWidth = MusECore::qwtMax(w,5); resize(size()); repaint(); } @@ -490,7 +490,7 @@ void Knob::setKnobWidth(int w) //------------------------------------------------------------ void Knob::setBorderWidth(int bw) { - d_borderWidth = MusEUtil::qwtMax(bw, 0); + d_borderWidth = MusECore::qwtMax(bw, 0); resize(size()); repaint(); } @@ -574,4 +574,4 @@ void Knob::setMarkerColor(const QColor c) repaint(); } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/knob.h b/muse2/muse/widgets/knob.h index 257ff0c7..483fafa6 100644 --- a/muse2/muse/widgets/knob.h +++ b/muse2/muse/widgets/knob.h @@ -30,7 +30,7 @@ #include <QResizeEvent> #include <QPaintEvent> -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // Knob @@ -104,6 +104,6 @@ class Knob : public SliderBase, public ScaleIf void setMarkerColor(const QColor c); }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/lcombo.cpp b/muse2/muse/widgets/lcombo.cpp index ca17e5e3..06041df4 100644 --- a/muse2/muse/widgets/lcombo.cpp +++ b/muse2/muse/widgets/lcombo.cpp @@ -25,7 +25,7 @@ #include <QHBoxLayout> #include <QLabel> -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // LabelCombo @@ -66,4 +66,4 @@ void LabelCombo::setCurrentIndex(int i) box->setCurrentIndex(r); } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/lcombo.h b/muse2/muse/widgets/lcombo.h index f500dc60..5813877c 100644 --- a/muse2/muse/widgets/lcombo.h +++ b/muse2/muse/widgets/lcombo.h @@ -29,7 +29,7 @@ class QString; -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // LabelCombo @@ -57,6 +57,6 @@ class LabelCombo : public QWidget { void setFocusPolicy ( Qt::FocusPolicy fp ) { box->setFocusPolicy(fp); } }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/mdisettings.cpp b/muse2/muse/widgets/mdisettings.cpp index 24bf7c7c..257cd593 100644 --- a/muse2/muse/widgets/mdisettings.cpp +++ b/muse2/muse/widgets/mdisettings.cpp @@ -34,6 +34,8 @@ #include "globals.h" #include "icons.h" +namespace MusEGui { + MdiSettings::MdiSettings(TopWin::ToplevelType t, QWidget* parent) : QWidget(parent) { _type=t; @@ -57,3 +59,5 @@ void MdiSettings::apply_settings() TopWin::_sharesWhenSubwin[_type] = shareSubwinCheckbox->isChecked(); TopWin::_sharesWhenFree[_type] = shareFreeCheckbox->isChecked(); } + +} // namespace MusEGui diff --git a/muse2/muse/widgets/mdisettings.h b/muse2/muse/widgets/mdisettings.h index 482f9f49..80f6db57 100644 --- a/muse2/muse/widgets/mdisettings.h +++ b/muse2/muse/widgets/mdisettings.h @@ -28,6 +28,8 @@ #include "ui_mdisettings_base.h" #include "cobject.h" +namespace MusEGui { + //--------------------------------------------------------- // GlobalSettingsConfig //--------------------------------------------------------- @@ -46,4 +48,6 @@ class MdiSettings : public QWidget, private Ui::MdiSettingsBase TopWin::ToplevelType type() { return _type; } }; +} // namespace MusEGui + #endif diff --git a/muse2/muse/widgets/menutitleitem.cpp b/muse2/muse/widgets/menutitleitem.cpp index c15c8c64..5315651f 100644 --- a/muse2/muse/widgets/menutitleitem.cpp +++ b/muse2/muse/widgets/menutitleitem.cpp @@ -22,7 +22,7 @@ #include "menutitleitem.h" -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // MenuTitleItem @@ -50,4 +50,4 @@ QWidget* MenuTitleItem::createWidget(QWidget *parent) return l; } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/menutitleitem.h b/muse2/muse/widgets/menutitleitem.h index 98573c72..94d7b610 100644 --- a/muse2/muse/widgets/menutitleitem.h +++ b/muse2/muse/widgets/menutitleitem.h @@ -25,7 +25,7 @@ #include <QWidgetAction> -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // MenuTitleItem @@ -43,5 +43,5 @@ class MenuTitleItem : public QWidgetAction { QWidget* createWidget(QWidget* /*parent*/); }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/meter.cpp b/muse2/muse/widgets/meter.cpp index 590e7f65..5c79ffb2 100644 --- a/muse2/muse/widgets/meter.cpp +++ b/muse2/muse/widgets/meter.cpp @@ -38,7 +38,7 @@ // Just an experiment. Some undesirable effects, see below... //#define _USE_CLIPPER 1 -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // Meter @@ -63,7 +63,7 @@ Meter::Meter(QWidget* parent, MeterType type) last_ymax = 0; val = 0.0; maxVal = 0.0; - minScale = mtype == DBMeter ? MusEConfig::config.minMeter : 0.0; // min value in dB or int + minScale = mtype == DBMeter ? MusEGlobal::config.minMeter : 0.0; // min value in dB or int maxScale = mtype == DBMeter ? 10.0 : 127.0; yellowScale = -10; redScale = 0; @@ -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 { @@ -547,4 +547,4 @@ void Meter::mousePressEvent(QMouseEvent*) emit mousePress(); } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/meter.h b/muse2/muse/widgets/meter.h index 1de3841f..114dfa89 100644 --- a/muse2/muse/widgets/meter.h +++ b/muse2/muse/widgets/meter.h @@ -34,7 +34,7 @@ class QMouseEvent; class QPainter; class QPainterPath; -namespace MusEWidget { +namespace MusEGui { class Meter : public QFrame { Q_OBJECT @@ -103,7 +103,7 @@ class Meter : public QFrame { void setRange(double min, double max); }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/metronome.cpp b/muse2/muse/widgets/metronome.cpp index e639df81..e6b7bd91 100644 --- a/muse2/muse/widgets/metronome.cpp +++ b/muse2/muse/widgets/metronome.cpp @@ -30,7 +30,7 @@ #include "track.h" #include "audio.h" -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // MetronomeConfig @@ -75,15 +75,15 @@ MetronomeConfig::MetronomeConfig(QDialog* parent) void MetronomeConfig::audioBeepRoutesClicked() { - if(song->outputs()->size() == 0) + if(MusEGlobal::song->outputs()->size() == 0) return; QMenu* pup = new QMenu; - OutputList* ol = song->outputs(); + MusECore::OutputList* ol = MusEGlobal::song->outputs(); int nn = 0; - for(iAudioOutput iao = ol->begin(); iao != ol->end(); ++iao) + for(MusECore::iAudioOutput iao = ol->begin(); iao != ol->end(); ++iao) { QAction* action = pup->addAction(QT_TRANSLATE_NOOP("@default", (*iao)->name())); action->setCheckable(true); @@ -98,14 +98,14 @@ void MetronomeConfig::audioBeepRoutesClicked() { //QString s(pup->text(n)); nn = 0; - for(iAudioOutput iao = ol->begin(); iao != ol->end(); ++iao) + for(MusECore::iAudioOutput iao = ol->begin(); iao != ol->end(); ++iao) { //if(((*iao)->name() == s) && (n == nn)) if (nn == clickaction->data()) { //(*iao)->setSendMetronome(); - audio->msgSetSendMetronome(*iao, clickaction->isChecked()); - //song->update(SC_ROUTE); + MusEGlobal::audio->msgSetSendMetronome(*iao, clickaction->isChecked()); + //MusEGlobal::song->update(SC_ROUTE); break; } ++nn; @@ -199,5 +199,5 @@ void MetronomeConfig::beepVolumeChanged(int volume) MusEGlobal::audioClickVolume=volume/100.0; } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/metronome.h b/muse2/muse/widgets/metronome.h index 62edcdc5..f93da182 100644 --- a/muse2/muse/widgets/metronome.h +++ b/muse2/muse/widgets/metronome.h @@ -28,7 +28,7 @@ class QDialog; -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // MetronomeConfig @@ -51,6 +51,6 @@ class MetronomeConfig : public QDialog, public Ui::MetronomeConfigBase { MetronomeConfig(QDialog* parent=0); }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/midisyncimpl.cpp b/muse2/muse/widgets/midisyncimpl.cpp index 3829ca43..904e8759 100644 --- a/muse2/muse/widgets/midisyncimpl.cpp +++ b/muse2/muse/widgets/midisyncimpl.cpp @@ -41,13 +41,13 @@ #include "driver/audiodev.h" #include "audio.h" -namespace MusEWidget { +namespace MusEGui { enum { DEVCOL_NO = 0, DEVCOL_NAME, DEVCOL_IN, DEVCOL_TICKIN, DEVCOL_MRTIN, DEVCOL_MMCIN, DEVCOL_MTCIN, DEVCOL_MTCTYPE, DEVCOL_RID, DEVCOL_RCLK, DEVCOL_RMRT, DEVCOL_RMMC, DEVCOL_RMTC, DEVCOL_RREWSTART, DEVCOL_TID, DEVCOL_TCLK, DEVCOL_TMRT, DEVCOL_TMMC, DEVCOL_TMTC, /* DEVCOL_TREWSTART, */ }; -//MidiSyncInfo tmpMidiSyncPorts[MIDI_PORTS]; +//MusECore::MidiSyncInfo tmpMidiSyncPorts[MIDI_PORTS]; //--------------------------------------------------------- // MidiSyncConfig::setToolTips @@ -143,7 +143,7 @@ void MidiSyncConfig::addDevice(QTreeWidgetItem *item, QTreeWidget *tree) // setDevice //--------------------------------------------------------- -void MidiSyncLViewItem::setDevice(MidiDevice* d) +void MidiSyncLViewItem::setDevice(MusECore::MidiDevice* d) { _device = d; if(_device) @@ -162,8 +162,8 @@ void MidiSyncLViewItem::setPort(int port) if(_port < 0 || port > MIDI_PORTS) return; - //_syncInfo.copyParams(midiPorts[port].syncInfo()); - copyFromSyncInfo(midiPorts[port].syncInfo()); + //_syncInfo.copyParams(MusEGlobal::midiPorts[port].syncInfo()); + copyFromSyncInfo(MusEGlobal::midiPorts[port].syncInfo()); } //--------------------------------------------------------- @@ -171,7 +171,7 @@ void MidiSyncLViewItem::setPort(int port) // copyFromSyncInfo //--------------------------------------------------------- -void MidiSyncLViewItem::copyFromSyncInfo(const MidiSyncInfo &sp) +void MidiSyncLViewItem::copyFromSyncInfo(const MusECore::MidiSyncInfo &sp) { _idOut = sp.idOut(); _idIn = sp.idIn(); @@ -192,7 +192,7 @@ void MidiSyncLViewItem::copyFromSyncInfo(const MidiSyncInfo &sp) // copyToSyncInfo //--------------------------------------------------------- -void MidiSyncLViewItem::copyToSyncInfo(MidiSyncInfo &sp) +void MidiSyncLViewItem::copyToSyncInfo(MusECore::MidiSyncInfo &sp) { sp.setIdOut(_idOut); sp.setIdIn(_idIn); @@ -226,10 +226,10 @@ MidiSyncConfig::MidiSyncConfig(QWidget* parent) //for(int i = 0; i < MIDI_PORTS; ++i) // tmpMidiSyncPorts[i] = midiSyncPorts[i]; - //bool ext = extSyncFlag.value(); + //bool ext = MusEGlobal::extSyncFlag.value(); //syncMode->setButton(int(ext)); //syncChanged(ext); -// extSyncCheckbox->setChecked(extSyncFlag.value()); +// extSyncCheckbox->setChecked(MusEGlobal::extSyncFlag.value()); // dstDevId->setValue(txDeviceId); // srcDevId->setValue(rxDeviceId); @@ -245,13 +245,13 @@ MidiSyncConfig::MidiSyncConfig(QWidget* parent) // acceptMCCheckbox->setChecked(acceptMC); // acceptMMCCheckbox->setChecked(acceptMMC); -// mtcSyncType->setCurrentItem(mtcType); +// mtcSyncType->setCurrentItem(MusEGlobal::mtcType); -// mtcOffH->setValue(mtcOffset.h()); -// mtcOffM->setValue(mtcOffset.m()); -// mtcOffS->setValue(mtcOffset.s()); -// mtcOffF->setValue(mtcOffset.f()); -// mtcOffSf->setValue(mtcOffset.sf()); +// mtcOffH->setValue(MusEGlobal::mtcOffset.h()); +// mtcOffM->setValue(MusEGlobal::mtcOffset.m()); +// mtcOffS->setValue(MusEGlobal::mtcOffset.s()); +// mtcOffF->setValue(MusEGlobal::mtcOffset.f()); +// mtcOffSf->setValue(MusEGlobal::mtcOffset.sf()); @@ -308,11 +308,11 @@ MidiSyncConfig::MidiSyncConfig(QWidget* parent) connect(mtcSyncType, SIGNAL(activated(int)), SLOT(syncChanged())); connect(useJackTransportCheckbox, SIGNAL(clicked()), SLOT(syncChanged())); connect(jackTransportMasterCheckbox, SIGNAL(clicked()), SLOT(syncChanged())); - connect(&extSyncFlag, SIGNAL(valueChanged(bool)), SLOT(extSyncChanged(bool))); + connect(&MusEGlobal::extSyncFlag, SIGNAL(valueChanged(bool)), SLOT(extSyncChanged(bool))); connect(syncDelaySpinBox, SIGNAL(valueChanged(int)), SLOT(syncChanged())); // Done in show(). - //connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); + //connect(MusEGlobal::song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); //connect(MusEGlobal::heartBeatTimer, SIGNAL(timeout()), SLOT(heartBeat())); //inHeartBeat = false; @@ -347,28 +347,28 @@ void MidiSyncConfig::songChanged(int flags) useJackTransportCheckbox->blockSignals(true); jackTransportMasterCheckbox->blockSignals(true); syncDelaySpinBox->blockSignals(true); - extSyncCheckbox->setChecked(extSyncFlag.value()); - useJackTransportCheckbox->setChecked(useJackTransport.value()); - jackTransportMasterCheckbox->setChecked(jackTransportMaster); - //jackTransportMasterCheckbox->setEnabled(useJackTransport); - syncDelaySpinBox->setValue(syncSendFirstClockDelay); + extSyncCheckbox->setChecked(MusEGlobal::extSyncFlag.value()); + useJackTransportCheckbox->setChecked(MusEGlobal::useJackTransport.value()); + jackTransportMasterCheckbox->setChecked(MusEGlobal::jackTransportMaster); + //jackTransportMasterCheckbox->setEnabled(MusEGlobal::useJackTransport); + syncDelaySpinBox->setValue(MusEGlobal::syncSendFirstClockDelay); syncDelaySpinBox->blockSignals(false); jackTransportMasterCheckbox->blockSignals(false); useJackTransportCheckbox->blockSignals(false); extSyncCheckbox->blockSignals(false); - mtcSyncType->setCurrentIndex(mtcType); + mtcSyncType->setCurrentIndex(MusEGlobal::mtcType); mtcOffH->blockSignals(true); mtcOffM->blockSignals(true); mtcOffS->blockSignals(true); mtcOffF->blockSignals(true); mtcOffSf->blockSignals(true); - mtcOffH->setValue(mtcOffset.h()); - mtcOffM->setValue(mtcOffset.m()); - mtcOffS->setValue(mtcOffset.s()); - mtcOffF->setValue(mtcOffset.f()); - mtcOffSf->setValue(mtcOffset.sf()); + mtcOffH->setValue(MusEGlobal::mtcOffset.h()); + mtcOffM->setValue(MusEGlobal::mtcOffset.m()); + mtcOffS->setValue(MusEGlobal::mtcOffset.s()); + mtcOffF->setValue(MusEGlobal::mtcOffset.f()); + mtcOffSf->setValue(MusEGlobal::mtcOffset.sf()); mtcOffH->blockSignals(false); mtcOffM->blockSignals(false); mtcOffS->blockSignals(false); @@ -393,10 +393,10 @@ void MidiSyncConfig::heartBeat() int port = lvi->port(); if(port >= 0 && port < MIDI_PORTS) { - bool sdet = midiPorts[port].syncInfo().MCSyncDetect(); + bool sdet = MusEGlobal::midiPorts[port].syncInfo().MCSyncDetect(); if(sdet) { - if(port == curMidiSyncInPort) + if(port == MusEGlobal::curMidiSyncInPort) { if(!lvi->_curDet) { @@ -432,7 +432,7 @@ void MidiSyncConfig::heartBeat() } } - sdet = midiPorts[port].syncInfo().tickDetect(); + sdet = MusEGlobal::midiPorts[port].syncInfo().tickDetect(); if(sdet) { if(!lvi->_tickDet) @@ -456,7 +456,7 @@ void MidiSyncConfig::heartBeat() } } - sdet = midiPorts[port].syncInfo().MRTDetect(); + sdet = MusEGlobal::midiPorts[port].syncInfo().MRTDetect(); if(sdet) { if(!lvi->_MRTDet) @@ -480,9 +480,9 @@ void MidiSyncConfig::heartBeat() } } - int type = midiPorts[port].syncInfo().recMTCtype(); - sdet = midiPorts[port].syncInfo().MMCDetect(); - bool mtcdet = midiPorts[port].syncInfo().MTCDetect(); + int type = MusEGlobal::midiPorts[port].syncInfo().recMTCtype(); + sdet = MusEGlobal::midiPorts[port].syncInfo().MMCDetect(); + bool mtcdet = MusEGlobal::midiPorts[port].syncInfo().MTCDetect(); if(sdet) { if(!lvi->_MMCDet) @@ -531,7 +531,7 @@ void MidiSyncConfig::heartBeat() if(mtcdet) { - if(port == curMidiSyncInPort) + if(port == MusEGlobal::curMidiSyncInPort) { if(!lvi->_curMTCDet) { @@ -591,7 +591,7 @@ void MidiSyncConfig::heartBeat() } } - //MidiDevice* dev = lvi->device(); + //MusECore::MidiDevice* dev = lvi->device(); //bool sdet = dev->syncInfo().MCSyncDetect(); //if(lvi->pixmap(DEVCOL_IN) != (sdet ? *dotIcon : *dothIcon)) // lvi->setIcon(DEVCOL_IN, QIcon( sdet ? *dotIcon : *dothIcon)); @@ -611,7 +611,7 @@ void MidiSyncConfig::syncChanged() { setDirty(); - //jackTransportMasterCheckbox->setEnabled(useJackTransport); + //MusEGlobal::jackTransportMasterCheckbox->setEnabled(MusEGlobal::useJackTransport); //acceptMTCCheckbox->setEnabled(val); // acceptMTCCheckbox->setEnabled(false); @@ -628,7 +628,7 @@ void MidiSyncConfig::extSyncChanged(bool v) extSyncCheckbox->blockSignals(true); extSyncCheckbox->setChecked(v); // if(v) -// song->setMasterFlag(false); +// MusEGlobal::song->setMasterFlag(false); extSyncCheckbox->blockSignals(false); } @@ -662,7 +662,7 @@ void MidiSyncConfig::cancel() void MidiSyncConfig::show() { songChanged(-1); - connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); + connect(MusEGlobal::song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); connect(MusEGlobal::heartBeatTimer, SIGNAL(timeout()), SLOT(heartBeat())); QDialog::show(); } @@ -691,7 +691,7 @@ void MidiSyncConfig::closeEvent(QCloseEvent* e) } disconnect(MusEGlobal::heartBeatTimer, SIGNAL(timeout()), this, SLOT(heartBeat())); - disconnect(song, SIGNAL(songChanged(int)), this, SLOT(songChanged(int))); + disconnect(MusEGlobal::song, SIGNAL(songChanged(int)), this, SLOT(songChanged(int))); e->accept(); } @@ -711,29 +711,29 @@ void MidiSyncConfig::apply() // genMCSync = mcSync->isChecked(); // genMMC = midiMachineControl->isChecked(); - syncSendFirstClockDelay = syncDelaySpinBox->value(); + MusEGlobal::syncSendFirstClockDelay = syncDelaySpinBox->value(); - mtcType = mtcSyncType->currentIndex(); - //extSyncFlag.setValue(syncMode->id(syncMode->selected())); - //extSyncFlag.blockSignals(true); - extSyncFlag.setValue(extSyncCheckbox->isChecked()); -// if(extSyncFlag.value()) -// song->setMasterFlag(false); - //extSyncFlag.blockSignals(false); - useJackTransport.setValue(useJackTransportCheckbox->isChecked()); -// if(useJackTransport) - jackTransportMaster = jackTransportMasterCheckbox->isChecked(); + MusEGlobal::mtcType = mtcSyncType->currentIndex(); + //MusEGlobal::extSyncFlag.setValue(syncMode->id(syncMode->selected())); + //MusEGlobal::extSyncFlag.blockSignals(true); + MusEGlobal::extSyncFlag.setValue(extSyncCheckbox->isChecked()); +// if(MusEGlobal::extSyncFlag.value()) +// MusEGlobal::song->setMasterFlag(false); + //MusEGlobal::extSyncFlag.blockSignals(false); + MusEGlobal::useJackTransport.setValue(useJackTransportCheckbox->isChecked()); +// if(MusEGlobal::useJackTransport) + MusEGlobal::jackTransportMaster = jackTransportMasterCheckbox->isChecked(); // else -// jackTransportMaster = false; -// jackTransportMasterCheckbox->setEnabled(useJackTransport); - if(audioDevice) - audioDevice->setMaster(jackTransportMaster); +// MusEGlobal::jackTransportMaster = false; +// MusEGlobal::jackTransportMasterCheckbox->setEnabled(MusEGlobal::useJackTransport); + if(MusEGlobal::audioDevice) + MusEGlobal::audioDevice->setMaster(MusEGlobal::jackTransportMaster); - mtcOffset.setH(mtcOffH->value()); - mtcOffset.setM(mtcOffM->value()); - mtcOffset.setS(mtcOffS->value()); - mtcOffset.setF(mtcOffF->value()); - mtcOffset.setSf(mtcOffSf->value()); + MusEGlobal::mtcOffset.setH(mtcOffH->value()); + MusEGlobal::mtcOffset.setM(mtcOffM->value()); + MusEGlobal::mtcOffset.setS(mtcOffS->value()); + MusEGlobal::mtcOffset.setF(mtcOffF->value()); + MusEGlobal::mtcOffset.setSf(mtcOffSf->value()); // acceptMC = acceptMCCheckbox->isChecked(); // acceptMMC = acceptMMCCheckbox->isChecked(); @@ -745,14 +745,14 @@ void MidiSyncConfig::apply() for (int i = MIDI_PORTS-1; i >= 0; --i) { MidiSyncLViewItem* lvi = (MidiSyncLViewItem*)devicesListView->topLevelItem(i); - //MidiDevice* dev = lvi->device(); + //MusECore::MidiDevice* dev = lvi->device(); // Does the device really exist? //if(midiDevices.find(dev) != midiDevices.end()) // dev->syncInfo().copyParams(lvi->syncInfo()); int port = lvi->port(); if(port >= 0 && port < MIDI_PORTS) - //midiPorts[port].syncInfo().copyParams(lvi->syncInfo()); - lvi->copyToSyncInfo(midiPorts[port].syncInfo()); + //MusEGlobal::midiPorts[port].syncInfo().copyParams(lvi->syncInfo()); + lvi->copyToSyncInfo(MusEGlobal::midiPorts[port].syncInfo()); } @@ -775,8 +775,8 @@ void MidiSyncConfig::updateSyncInfoLV() devicesListView->clear(); for(int i = 0; i < MIDI_PORTS; ++i) { - MidiPort* port = &midiPorts[i]; - MidiDevice* dev = port->device(); + MusECore::MidiPort* port = &MusEGlobal::midiPorts[i]; + MusECore::MidiDevice* dev = port->device(); // p3.3.31 // Don't show if it is a synthesizer device. // Hmm, some synths might support transport commands or even sync? @@ -791,10 +791,10 @@ void MidiSyncConfig::updateSyncInfoLV() s.setNum(i+1); MidiSyncLViewItem* lvi = new MidiSyncLViewItem(devicesListView); lvi->setPort(i); // setPort will copy parameters. - //MidiSyncInfo& si = lvi->syncInfo(); + //MusECore::MidiSyncInfo& si = lvi->syncInfo(); //si.copyParams(port->syncInfo()); //lvi.copyFromSyncInfo(port->syncInfo()); - MidiSyncInfo& portsi = port->syncInfo(); + MusECore::MidiSyncInfo& portsi = port->syncInfo(); lvi->setText(DEVCOL_NO, s); @@ -805,7 +805,7 @@ void MidiSyncConfig::updateSyncInfoLV() if(portsi.MCSyncDetect()) { - if(i == curMidiSyncInPort) + if(i == MusEGlobal::curMidiSyncInPort) { lvi->_curDet = true; lvi->_inDet = false; @@ -882,7 +882,7 @@ void MidiSyncConfig::updateSyncInfoLV() if(portsi.MTCDetect()) { - if(i == curMidiSyncInPort) + if(i == MusEGlobal::curMidiSyncInPort) { lvi->_curMTCDet = true; lvi->_MTCDet = false; @@ -990,17 +990,17 @@ void MidiSyncConfig::updateSyncInfoLV() /* - for(iMidiDevice id = midiDevices.begin(); id != midiDevices.end(); ++id) + for(MusECore::iMidiDevice id = midiDevices.begin(); id != midiDevices.end(); ++id) { - MidiDevice* dev = *id; + MusECore::MidiDevice* dev = *id; - //MidiPort* port = &midiPorts[i]; - //MidiDevice* dev = port->device(); + //MusECore::MidiPort* port = &MusEGlobal::midiPorts[i]; + //MusECore::MidiDevice* dev = port->device(); MidiSyncLViewItem* lvi = new MidiSyncLViewItem(devicesListView); //lvi->setPort(i); // setDevice will copy parameters. lvi->setDevice(dev); - MidiSyncInfo& si = lvi->syncInfo(); + MusECore::MidiSyncInfo& si = lvi->syncInfo(); //si.copyParams(dev->syncInfo()); lvi->setText(DEVCOL_NAME, dev->name()); @@ -1037,18 +1037,18 @@ void MidiSyncConfig::dlvClicked(QTreeWidgetItem* item, int col) int no = lvi->port(); if (no < 0 || no >= MIDI_PORTS) return; - //MidiDevice* dev = lvi->device(); + //MusECore::MidiDevice* dev = lvi->device(); // Does the device really exist? //if(midiDevices.find(dev) == midiDevices.end()) // return; //int n; - //MidiPort* port = &midiPorts[no]; - //MidiDevice* dev = port->device(); + //MusECore::MidiPort* port = &MusEGlobal::midiPorts[no]; + //MusECore::MidiDevice* dev = port->device(); //int rwFlags = dev ? dev->rwFlags() : 0; //int openFlags = dev ? dev->openFlags() : 0; - //MidiSyncInfo& si = lvi->syncInfo(); - //MidiSyncInfo& portsi = midiPorts[no].syncInfo(); + //MusECore::MidiSyncInfo& si = lvi->syncInfo(); + //MusECore::MidiSyncInfo& portsi = MusEGlobal::midiPorts[no].syncInfo(); switch (col) { @@ -1060,18 +1060,18 @@ void MidiSyncConfig::dlvClicked(QTreeWidgetItem* item, int col) // If this is not the current midi sync in port, and sync in from this port is enabled, // and sync is in fact detected on this port, allow the user to force this port to now be the // current sync in port. - //if(no != curMidiSyncInPort && si.MCIn() && midiPorts[no].syncInfo().MCSyncDetect()) - //if(no != curMidiSyncInPort && lvi->_recMC && midiPorts[no].syncInfo().MCSyncDetect()) - if(no != curMidiSyncInPort) + //if(no != MusEGlobal::curMidiSyncInPort && si.MCIn() && MusEGlobal::midiPorts[no].syncInfo().MCSyncDetect()) + //if(no != MusEGlobal::curMidiSyncInPort && lvi->_recMC && MusEGlobal::midiPorts[no].syncInfo().MCSyncDetect()) + if(no != MusEGlobal::curMidiSyncInPort) { - if(lvi->_recMC && midiPorts[no].syncInfo().MCSyncDetect()) + if(lvi->_recMC && MusEGlobal::midiPorts[no].syncInfo().MCSyncDetect()) { - curMidiSyncInPort = no; + MusEGlobal::curMidiSyncInPort = no; lvi->setIcon(DEVCOL_IN, QIcon( *record1_Icon)); } - if(lvi->_recMTC && midiPorts[no].syncInfo().MTCDetect()) + if(lvi->_recMTC && MusEGlobal::midiPorts[no].syncInfo().MTCDetect()) { - curMidiSyncInPort = no; + MusEGlobal::curMidiSyncInPort = no; lvi->setIcon(DEVCOL_MTCIN, QIcon( *record1_Icon)); } } @@ -1084,18 +1084,18 @@ void MidiSyncConfig::dlvClicked(QTreeWidgetItem* item, int col) // If this is not the current midi sync in port, and sync in from this port is enabled, // and sync is in fact detected on this port, allow the user to force this port to now be the // current sync in port. - //if(no != curMidiSyncInPort && si.MTCIn() && midiPorts[no].syncInfo().MTCDetect()) - //if(no != curMidiSyncInPort && lvi->_recMTC && midiPorts[no].syncInfo().MTCDetect()) - if(no != curMidiSyncInPort) + //if(no != MusEGlobal::curMidiSyncInPort && si.MTCIn() && MusEGlobal::midiPorts[no].syncInfo().MTCDetect()) + //if(no != MusEGlobal::curMidiSyncInPort && lvi->_recMTC && MusEGlobal::midiPorts[no].syncInfo().MTCDetect()) + if(no != MusEGlobal::curMidiSyncInPort) { - if(lvi->_recMTC && midiPorts[no].syncInfo().MTCDetect()) + if(lvi->_recMTC && MusEGlobal::midiPorts[no].syncInfo().MTCDetect()) { - curMidiSyncInPort = no; + MusEGlobal::curMidiSyncInPort = no; lvi->setIcon(DEVCOL_MTCIN, QIcon( *record1_Icon)); } - if(lvi->_recMC && midiPorts[no].syncInfo().MCSyncDetect()) + if(lvi->_recMC && MusEGlobal::midiPorts[no].syncInfo().MCSyncDetect()) { - curMidiSyncInPort = no; + MusEGlobal::curMidiSyncInPort = no; lvi->setIcon(DEVCOL_IN, QIcon( *record1_Icon)); } } @@ -1266,4 +1266,4 @@ void MidiSyncConfig::setDirty() applyButton->setEnabled(true); } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/midisyncimpl.h b/muse2/muse/widgets/midisyncimpl.h index 50df186e..9c22b55f 100644 --- a/muse2/muse/widgets/midisyncimpl.h +++ b/muse2/muse/widgets/midisyncimpl.h @@ -31,7 +31,7 @@ class QCloseEvent; class QDialog; class QTreeWidgetItem; -namespace MusEWidget { +namespace MusEGui { //---------------------------------------------------------- // MidiSyncLViewItem @@ -39,7 +39,7 @@ namespace MusEWidget { class MidiSyncLViewItem : public QTreeWidgetItem { - //MidiSyncInfo _syncInfo; + //MusECore::MidiSyncInfo _syncInfo; //MidiDevice* _device; int _port; @@ -87,9 +87,9 @@ class MidiSyncLViewItem : public QTreeWidgetItem //MidiDevice* device() const { return _device; } //void setDevice(MidiDevice* d); - //MidiSyncInfo& syncInfo() { return _syncInfo; } - void copyFromSyncInfo(const MidiSyncInfo &sp); - void copyToSyncInfo(MidiSyncInfo &sp); + //MusECore::MidiSyncInfo& syncInfo() { return _syncInfo; } + void copyFromSyncInfo(const MusECore::MidiSyncInfo &sp); + void copyToSyncInfo(MusECore::MidiSyncInfo &sp); }; //--------------------------------------------------------- @@ -129,7 +129,7 @@ class MidiSyncConfig : public QDialog, public Ui::MidiSyncConfigBase { void setDirty(); }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/mittransposebase.ui b/muse2/muse/widgets/mittransposebase.ui index 06a18029..5115b0e7 100644 --- a/muse2/muse/widgets/mittransposebase.ui +++ b/muse2/muse/widgets/mittransposebase.ui @@ -44,7 +44,7 @@ </widget> </item> <item> - <widget class="MusEWidget::PitchEdit" name="triggerKeySpinBox" native="true"/> + <widget class="MusEGui::PitchEdit" name="triggerKeySpinBox" native="true"/> </item> <item> <widget class="QLabel" name="TextLabel2"> @@ -101,7 +101,7 @@ <layoutdefault spacing="6" margin="11"/> <customwidgets> <customwidget> - <class>MusEWidget::PitchEdit</class> + <class>MusEGui::PitchEdit</class> <extends>QWidget</extends> <header>pitchedit.h</header> </customwidget> diff --git a/muse2/muse/widgets/mixdowndialog.cpp b/muse2/muse/widgets/mixdowndialog.cpp index 01c1d049..b97d402d 100644 --- a/muse2/muse/widgets/mixdowndialog.cpp +++ b/muse2/muse/widgets/mixdowndialog.cpp @@ -26,6 +26,8 @@ #include "mixdowndialog.h" #include "wave.h" +namespace MusECore { + //--------------------------------------------------------- // sndFileOpen // sf - old soundfile, used to preset file parameters @@ -33,20 +35,22 @@ SndFile* getSndFile(const SndFile* sf, QWidget* parent) { - MusEWidget::MixdownFileDialog* dialog = new MusEWidget::MixdownFileDialog(sf, parent); + MusEGui::MixdownFileDialog* dialog = new MusEGui::MixdownFileDialog(sf, parent); dialog->exec(); - SndFile* sndFile = dialog->sndFile(); + MusECore::SndFile* sndFile = dialog->sndFile(); delete dialog; return sndFile; } -namespace MusEWidget { +} // namespace MusECore + +namespace MusEGui { //--------------------------------------------------------- // MixdownFileDialog //--------------------------------------------------------- -MixdownFileDialog::MixdownFileDialog(const SndFile* _sf, +MixdownFileDialog::MixdownFileDialog(const MusECore::SndFile* _sf, QWidget* parent, Qt::WFlags fl) : QDialog(parent, fl) { @@ -100,7 +104,7 @@ void MixdownFileDialog::accept() } if (path.right(4) != ".wav") path += ".wav"; - sf = new SndFile(path); + sf = new MusECore::SndFile(path); sf->setFormat(format, channel, MusEGlobal::sampleRate); done(1); } @@ -120,4 +124,4 @@ void MixdownFileDialog::fdialog() editPath->setText(path); } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/mixdowndialog.h b/muse2/muse/widgets/mixdowndialog.h index cca60178..c639e71e 100644 --- a/muse2/muse/widgets/mixdowndialog.h +++ b/muse2/muse/widgets/mixdowndialog.h @@ -27,11 +27,12 @@ class QWidget; +namespace MusECore { class SndFile; - extern SndFile* getSndFile(const SndFile* sf, QWidget* parent); +} -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // MixdownFileDialog @@ -39,16 +40,16 @@ namespace MusEWidget { class MixdownFileDialog : public QDialog, public Ui::MixdownFileDialogBase { Q_OBJECT - SndFile* sf; + MusECore::SndFile* sf; private slots: void fdialog(); virtual void accept(); public: - MixdownFileDialog(const SndFile* f, QWidget* parent = 0, + MixdownFileDialog(const MusECore::SndFile* f, QWidget* parent = 0, Qt::WFlags fl = 0); - SndFile* sndFile() { return sf; } + MusECore::SndFile* sndFile() { return sf; } }; } diff --git a/muse2/muse/widgets/mlabel.cpp b/muse2/muse/widgets/mlabel.cpp index 071427b6..3b7160cc 100644 --- a/muse2/muse/widgets/mlabel.cpp +++ b/muse2/muse/widgets/mlabel.cpp @@ -22,11 +22,11 @@ #include "mlabel.h" -namespace MusEWidget { +namespace MusEGui { void MLabel::mousePressEvent(QMouseEvent*) { emit mousePressed(); } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/mlabel.h b/muse2/muse/widgets/mlabel.h index 64a52220..bfdf4955 100644 --- a/muse2/muse/widgets/mlabel.h +++ b/muse2/muse/widgets/mlabel.h @@ -25,7 +25,7 @@ #include <QLabel> -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // MLabel @@ -51,7 +51,7 @@ class MLabel : public QLabel { : QLabel(parent) {setObjectName(name);}; }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/mmath.cpp b/muse2/muse/widgets/mmath.cpp index 52dffea2..00f66101 100644 --- a/muse2/muse/widgets/mmath.cpp +++ b/muse2/muse/widgets/mmath.cpp @@ -46,7 +46,7 @@ // qwtInt -- Return nearest integer // qwtLim -- Limit a values -namespace MusEUtil { +namespace MusECore { //------------------------------------------------------------ //.F qwtGetMin @@ -322,4 +322,4 @@ void qwtLogSpace(double *array, int size, double xmin, double xmax) } -} // namespace MusEUtil +} // namespace MusECore diff --git a/muse2/muse/widgets/mmath.h b/muse2/muse/widgets/mmath.h index 813aed93..dc066711 100644 --- a/muse2/muse/widgets/mmath.h +++ b/muse2/muse/widgets/mmath.h @@ -27,7 +27,7 @@ #define LOG_MIN 1.0e-100 #define LOG_MAX 1.0e100 -namespace MusEUtil { +namespace MusECore { double qwtCeil125(double x); double qwtFloor125(double x); diff --git a/muse2/muse/widgets/mtrackinfo.cpp b/muse2/muse/widgets/mtrackinfo.cpp index 57674395..33462d0c 100644 --- a/muse2/muse/widgets/mtrackinfo.cpp +++ b/muse2/muse/widgets/mtrackinfo.cpp @@ -47,13 +47,13 @@ #include "popupmenu.h" #include "routepopup.h" -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // setTrack //--------------------------------------------------------- -void MidiTrackInfo::setTrack(Track* t) +void MidiTrackInfo::setTrack(MusECore::Track* t) { if(!t) { @@ -68,11 +68,11 @@ void MidiTrackInfo::setTrack(Track* t) trackNameLabel->setObjectName(selected->cname()); /*QPalette pal; - if(selected->type() == Track::DRUM) { - pal.setColor(trackNameLabel->backgroundRole(), MusEConfig::config.drumTrackLabelBg); + if(selected->type() == MusECore::Track::DRUM) { + pal.setColor(trackNameLabel->backgroundRole(), MusEGlobal::config.drumTrackLabelBg); iOutputChannel->setEnabled(false); } else { - pal.setColor(trackNameLabel->backgroundRole(), MusEConfig::config.midiTrackLabelBg); + pal.setColor(trackNameLabel->backgroundRole(), MusEGlobal::config.midiTrackLabelBg); iOutputChannel->setEnabled(true); } trackNameLabel->setPalette(pal); */ @@ -85,7 +85,7 @@ void MidiTrackInfo::setTrack(Track* t) // midiTrackInfo //--------------------------------------------------------- -MidiTrackInfo::MidiTrackInfo(QWidget* parent, Track* sel_track) : QWidget(parent) +MidiTrackInfo::MidiTrackInfo(QWidget* parent, MusECore::Track* sel_track) : QWidget(parent) { setupUi(this); _midiDetect = false; @@ -95,16 +95,16 @@ MidiTrackInfo::MidiTrackInfo(QWidget* parent, Track* sel_track) : QWidget(parent // Since program covers 3 controls at once, it is in 'midi controller' units rather than 'gui control' units. //program = -1; - program = CTRL_VAL_UNKNOWN; + program = MusECore::CTRL_VAL_UNKNOWN; pan = -65; volume = -1; - setFont(MusEConfig::config.fonts[2]); + setFont(MusEGlobal::config.fonts[2]); //iChanDetectLabel->setPixmap(*darkgreendotIcon); iChanDetectLabel->setPixmap(*darkRedLedIcon); - recEchoButton->setIcon((selected && ((MidiTrack*)selected)->recEcho()) ? QIcon(*midiThruOnIcon) : QIcon(*midiThruOffIcon)); + recEchoButton->setIcon((selected && ((MusECore::MidiTrack*)selected)->recEcho()) ? QIcon(*midiThruOnIcon) : QIcon(*midiThruOffIcon)); recEchoButton->setIconSize(midiThruOnIcon->size()); // MusE-2: AlignCenter and WordBreak are set in the ui(3) file, but not supported by QLabel. Turn them on here. @@ -122,10 +122,10 @@ MidiTrackInfo::MidiTrackInfo(QWidget* parent, Track* sel_track) : QWidget(parent /*QPalette pal; QColor c; //pal.setColor(trackNameLabel->backgroundRole(), QColor(0, 160, 255)); // Med blue - if(selected->type() == Track::DRUM) - c = MusEConfig::config.drumTrackLabelBg; + if(selected->type() == MusECore::Track::DRUM) + c = MusEGlobal::config.drumTrackLabelBg; else - c = MusEConfig::config.midiTrackLabelBg; + c = MusEGlobal::config.midiTrackLabelBg; QLinearGradient gradient(trackNameLabel->geometry().topLeft(), trackNameLabel->geometry().bottomLeft()); //gradient.setColorAt(0, c.darker()); @@ -140,7 +140,7 @@ MidiTrackInfo::MidiTrackInfo(QWidget* parent, Track* sel_track) : QWidget(parent } //else //{ - // pal.setColor(trackNameLabel->backgroundRole(), MusEConfig::config.midiTrackLabelBg); + // pal.setColor(trackNameLabel->backgroundRole(), MusEGlobal::config.midiTrackLabelBg); // trackNameLabel->setPalette(pal); //} @@ -197,7 +197,7 @@ MidiTrackInfo::MidiTrackInfo(QWidget* parent, Track* sel_track) : QWidget(parent //oRButton->setVisible(false); connect(oRButton, SIGNAL(pressed()), SLOT(outRoutesPressed())); - connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); + connect(MusEGlobal::song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); connect(MusEGlobal::muse, SIGNAL(configChanged()), SLOT(configChanged())); connect(MusEGlobal::heartBeatTimer, SIGNAL(timeout()), SLOT(heartBeat())); @@ -214,11 +214,11 @@ void MidiTrackInfo::heartBeat() return; switch(selected->type()) { - case Track::MIDI: - case Track::DRUM: - case Track::NEW_DRUM: + case MusECore::Track::MIDI: + case MusECore::Track::DRUM: + case MusECore::Track::NEW_DRUM: { - MidiTrack* track = (MidiTrack*)selected; + MusECore::MidiTrack* track = (MusECore::MidiTrack*)selected; int outChannel = track->outChannel(); int outPort = track->outPort(); @@ -226,7 +226,7 @@ void MidiTrackInfo::heartBeat() //int iptMask = track->inPortMask(); ///unsigned int iptMask = track->inPortMask(); - MidiPort* mp = &midiPorts[outPort]; + MusECore::MidiPort* mp = &MusEGlobal::midiPorts[outPort]; // Set record echo. //if(recEchoButton->isChecked() != track->recEcho()) @@ -239,15 +239,15 @@ void MidiTrackInfo::heartBeat() // Check for detection of midi general activity on chosen channels... int mpt = 0; //int mch = 0; - RouteList* rl = track->inRoutes(); + MusECore::RouteList* rl = track->inRoutes(); - ciRoute r = rl->begin(); + MusECore::ciRoute r = rl->begin(); //for( ; mpt < MIDI_PORTS; ++mpt) for( ; r != rl->end(); ++r) { //if(!r->isValid() || ((r->type != Route::ALSA_MIDI_ROUTE) && (r->type != Route::JACK_MIDI_ROUTE))) //if(!r->isValid() || (r->type != Route::MIDI_DEVICE_ROUTE)) - if(!r->isValid() || (r->type != Route::MIDI_PORT_ROUTE)) // p3.3.49 + if(!r->isValid() || (r->type != MusECore::Route::MIDI_PORT_ROUTE)) // p3.3.49 continue; // NOTE: TODO: Code for channelless events like sysex, ** IF we end up using the 'special channel 17' method. @@ -263,10 +263,10 @@ void MidiTrackInfo::heartBeat() //for(; mch < MIDI_CHANNELS; ++mch) //{ - //if(midiPorts[mpt].syncInfo().actDetect(mch) && (iptMask & (1 << mpt)) && (ichMask & (1 << mch)) ) - //if((iptMask & bitShiftLU[mpt]) && (midiPorts[mpt].syncInfo().actDetectBits() & ichMask) ) - //if(midiPorts[mpt].syncInfo().actDetectBits() & bitShiftLU[r->channel]) - if(midiPorts[mpt].syncInfo().actDetectBits() & r->channel) // p3.3.50 Use new channel mask. + //if(MusEGlobal::midiPorts[mpt].syncInfo().actDetect(mch) && (iptMask & (1 << mpt)) && (ichMask & (1 << mch)) ) + //if((iptMask & bitShiftLU[mpt]) && (MusEGlobal::midiPorts[mpt].syncInfo().actDetectBits() & ichMask) ) + //if(MusEGlobal::midiPorts[mpt].syncInfo().actDetectBits() & bitShiftLU[r->channel]) + if(MusEGlobal::midiPorts[mpt].syncInfo().actDetectBits() & r->channel) // p3.3.50 Use new channel mask. { //if(iChanTextLabel->paletteBackgroundColor() != green) // iChanTextLabel->setPaletteBackgroundColor(green); @@ -301,14 +301,14 @@ void MidiTrackInfo::heartBeat() } } - int nprogram = mp->hwCtrlState(outChannel, CTRL_PROGRAM); - if(nprogram == CTRL_VAL_UNKNOWN) + int nprogram = mp->hwCtrlState(outChannel, MusECore::CTRL_PROGRAM); + if(nprogram == MusECore::CTRL_VAL_UNKNOWN) { - if(program != CTRL_VAL_UNKNOWN) + if(program != MusECore::CTRL_VAL_UNKNOWN) { //printf("Arranger::midiTrackInfoHeartBeat setting program to unknown\n"); - program = CTRL_VAL_UNKNOWN; + program = MusECore::CTRL_VAL_UNKNOWN; if(iHBank->value() != 0) { iHBank->blockSignals(true); @@ -329,8 +329,8 @@ void MidiTrackInfo::heartBeat() } } - nprogram = mp->lastValidHWCtrlState(outChannel, CTRL_PROGRAM); - if(nprogram == CTRL_VAL_UNKNOWN) + nprogram = mp->lastValidHWCtrlState(outChannel, MusECore::CTRL_PROGRAM); + if(nprogram == MusECore::CTRL_VAL_UNKNOWN) { //const char* n = "<unknown>"; const QString n(tr("<unknown>")); @@ -344,8 +344,8 @@ void MidiTrackInfo::heartBeat() } else { - MidiInstrument* instr = mp->instrument(); - QString name = instr->getPatchName(outChannel, nprogram, song->mtype(), track->type() == Track::DRUM); //FINDMICHJETZT was soll das? + MusECore::MidiInstrument* instr = mp->instrument(); + QString name = instr->getPatchName(outChannel, nprogram, MusEGlobal::song->mtype(), track->type() == MusECore::Track::DRUM); //FINDMICHJETZT was soll das? if(name.isEmpty()) { const QString n("???"); @@ -384,14 +384,14 @@ void MidiTrackInfo::heartBeat() program = nprogram; //int hb, lb, pr; - //if (program == CTRL_VAL_UNKNOWN) { + //if (program == MusECore::CTRL_VAL_UNKNOWN) { // hb = lb = pr = 0; // iPatch->setText("---"); // } //else //{ - MidiInstrument* instr = mp->instrument(); - QString name = instr->getPatchName(outChannel, program, song->mtype(), track->type() == Track::DRUM); //FINDMICHJETZT was soll das? + MusECore::MidiInstrument* instr = mp->instrument(); + QString name = instr->getPatchName(outChannel, program, MusEGlobal::song->mtype(), track->type() == MusECore::Track::DRUM); //FINDMICHJETZT was soll das? if(iPatch->text() != name) iPatch->setText(name); @@ -430,13 +430,13 @@ void MidiTrackInfo::heartBeat() } } - MidiController* mc = mp->midiController(CTRL_VOLUME); + MusECore::MidiController* mc = mp->midiController(MusECore::CTRL_VOLUME); int mn = mc->minVal(); - int v = mp->hwCtrlState(outChannel, CTRL_VOLUME); - if(v == CTRL_VAL_UNKNOWN) + int v = mp->hwCtrlState(outChannel, MusECore::CTRL_VOLUME); + if(v == MusECore::CTRL_VAL_UNKNOWN) //{ //v = mc->initVal(); - //if(v == CTRL_VAL_UNKNOWN) + //if(v == MusECore::CTRL_VAL_UNKNOWN) // v = 0; v = mn - 1; //} @@ -457,13 +457,13 @@ void MidiTrackInfo::heartBeat() } } - mc = mp->midiController(CTRL_PANPOT); + mc = mp->midiController(MusECore::CTRL_PANPOT); mn = mc->minVal(); - v = mp->hwCtrlState(outChannel, CTRL_PANPOT); - if(v == CTRL_VAL_UNKNOWN) + v = mp->hwCtrlState(outChannel, MusECore::CTRL_PANPOT); + if(v == MusECore::CTRL_VAL_UNKNOWN) //{ //v = mc->initVal(); - //if(v == CTRL_VAL_UNKNOWN) + //if(v == MusECore::CTRL_VAL_UNKNOWN) // v = 0; v = mn - 1; //} @@ -503,12 +503,12 @@ void MidiTrackInfo::heartBeat() } break; - case Track::WAVE: - case Track::AUDIO_OUTPUT: - case Track::AUDIO_INPUT: - case Track::AUDIO_GROUP: - case Track::AUDIO_AUX: - case Track::AUDIO_SOFTSYNTH: + case MusECore::Track::WAVE: + case MusECore::Track::AUDIO_OUTPUT: + case MusECore::Track::AUDIO_INPUT: + case MusECore::Track::AUDIO_GROUP: + case MusECore::Track::AUDIO_AUX: + case MusECore::Track::AUDIO_SOFTSYNTH: break; } } @@ -521,15 +521,15 @@ void MidiTrackInfo::configChanged() { //printf("MidiTrackInfo::configChanged\n"); - //if (MusEConfig::config.canvasBgPixmap.isEmpty()) { - // canvas->setBg(MusEConfig::config.partCanvasBg); + //if (MusEGlobal::config.canvasBgPixmap.isEmpty()) { + // canvas->setBg(MusEGlobal::config.partCanvasBg); // canvas->setBg(QPixmap()); //} //else { - // canvas->setBg(QPixmap(MusEConfig::config.canvasBgPixmap)); + // canvas->setBg(QPixmap(MusEGlobal::config.canvasBgPixmap)); //} - setFont(MusEConfig::config.fonts[2]); + setFont(MusEGlobal::config.fonts[2]); //updateTrackInfo(type); } @@ -555,7 +555,7 @@ void MidiTrackInfo::songChanged(int type) void MidiTrackInfo::setLabelText() { - MidiTrack* track = (MidiTrack*)selected; + MusECore::MidiTrack* track = (MusECore::MidiTrack*)selected; if(track) trackNameLabel->setText(track->name()); else @@ -566,12 +566,12 @@ void MidiTrackInfo::setLabelText() QPalette pal; QColor c; //pal.setColor(trackNameLabel->backgroundRole(), QColor(0, 160, 255)); // Med blue - if(track->type() == Track::DRUM) - c = MusEConfig::config.drumTrackLabelBg; - else if (track->type() == Track::MIDI) - c = MusEConfig::config.midiTrackLabelBg; - else if (track->type() == Track::NEW_DRUM) - c = MusEConfig::config.newDrumTrackLabelBg; + if(track->type() == MusECore::Track::DRUM) + c = MusEGlobal::config.drumTrackLabelBg; + else if (track->type() == MusECore::Track::MIDI) + c = MusEGlobal::config.midiTrackLabelBg; + else if (track->type() == MusECore::Track::NEW_DRUM) + c = MusEGlobal::config.newDrumTrackLabelBg; else printf("THIS SHOULD NEVER HAPPEN: track is not a MIDI track in MidiTrackInfo::setLabelText()!\n"); @@ -596,13 +596,13 @@ void MidiTrackInfo::setLabelFont() { //if(!selected) // return; - //MidiTrack* track = (MidiTrack*)selected; + //MusECore::MidiTrack* track = (MusECore::MidiTrack*)selected; // Use the new font #6 I created just for these labels (so far). // Set the label's font. - trackNameLabel->setFont(MusEConfig::config.fonts[6]); + trackNameLabel->setFont(MusEGlobal::config.fonts[6]); // Dealing with a horizontally constrained label. Ignore vertical. Use a minimum readable point size. - MusEUtil::autoAdjustFontSize(trackNameLabel, trackNameLabel->text(), false, true, MusEConfig::config.fonts[6].pointSize(), 5); + MusECore::autoAdjustFontSize(trackNameLabel, trackNameLabel->text(), false, true, MusEGlobal::config.fonts[6].pointSize(), 5); } //--------------------------------------------------------- @@ -614,21 +614,21 @@ void MidiTrackInfo::iOutputChannelChanged(int channel) --channel; if(!selected) return; - MidiTrack* track = (MidiTrack*)selected; + MusECore::MidiTrack* track = (MusECore::MidiTrack*)selected; if (channel != track->outChannel()) { // Changed by T356. //track->setOutChannel(channel); - audio->msgIdle(true); + MusEGlobal::audio->msgIdle(true); //audio->msgSetTrackOutChannel(track, channel); track->setOutChanAndUpdate(channel); - audio->msgIdle(false); + MusEGlobal::audio->msgIdle(false); // may result in adding/removing mixer strip: - //song->update(-1); - //song->update(SC_MIDI_TRACK_PROP); - audio->msgUpdateSoloStates(); // p4.0.14 - //song->update(SC_MIDI_TRACK_PROP | SC_ROUTE); // - song->update(SC_MIDI_TRACK_PROP); // + //MusEGlobal::song->update(-1); + //MusEGlobal::song->update(SC_MIDI_TRACK_PROP); + MusEGlobal::audio->msgUpdateSoloStates(); // p4.0.14 + //MusEGlobal::song->update(SC_MIDI_TRACK_PROP | SC_ROUTE); // + MusEGlobal::song->update(SC_MIDI_TRACK_PROP); // } } @@ -640,20 +640,20 @@ void MidiTrackInfo::iOutputPortChanged(int index) { if(!selected) return; - MidiTrack* track = (MidiTrack*)selected; + MusECore::MidiTrack* track = (MusECore::MidiTrack*)selected; if (index == track->outPort()) return; // Changed by T356. //track->setOutPort(index); - audio->msgIdle(true); + MusEGlobal::audio->msgIdle(true); //audio->msgSetTrackOutPort(track, index); track->setOutPortAndUpdate(index); - audio->msgIdle(false); + MusEGlobal::audio->msgIdle(false); - //song->update(SC_MIDI_TRACK_PROP); - audio->msgUpdateSoloStates(); // p4.0.14 - //song->update(SC_MIDI_TRACK_PROP | SC_ROUTE); // - song->update(SC_MIDI_TRACK_PROP); // + //MusEGlobal::song->update(SC_MIDI_TRACK_PROP); + MusEGlobal::audio->msgUpdateSoloStates(); // p4.0.14 + //MusEGlobal::song->update(SC_MIDI_TRACK_PROP | SC_ROUTE); // + MusEGlobal::song->update(SC_MIDI_TRACK_PROP); // } //--------------------------------------------------------- @@ -696,7 +696,7 @@ void MidiTrackInfo::iProgHBankChanged() { if(!selected) return; - MidiTrack* track = (MidiTrack*)selected; + MusECore::MidiTrack* track = (MusECore::MidiTrack*)selected; int channel = track->outChannel(); int port = track->outPort(); int hbank = iHBank->value(); @@ -716,20 +716,20 @@ void MidiTrackInfo::iProgHBankChanged() else prog = 0xff; - MidiPort* mp = &midiPorts[port]; + MusECore::MidiPort* mp = &MusEGlobal::midiPorts[port]; if(prog == 0xff && hbank == 0xff && lbank == 0xff) { - program = CTRL_VAL_UNKNOWN; - if(mp->hwCtrlState(channel, CTRL_PROGRAM) != CTRL_VAL_UNKNOWN) - audio->msgSetHwCtrlState(mp, channel, CTRL_PROGRAM, CTRL_VAL_UNKNOWN); + program = MusECore::CTRL_VAL_UNKNOWN; + if(mp->hwCtrlState(channel, MusECore::CTRL_PROGRAM) != MusECore::CTRL_VAL_UNKNOWN) + MusEGlobal::audio->msgSetHwCtrlState(mp, channel, MusECore::CTRL_PROGRAM, MusECore::CTRL_VAL_UNKNOWN); return; } - int np = mp->hwCtrlState(channel, CTRL_PROGRAM); - if(np == CTRL_VAL_UNKNOWN) + int np = mp->hwCtrlState(channel, MusECore::CTRL_PROGRAM); + if(np == MusECore::CTRL_VAL_UNKNOWN) { - np = mp->lastValidHWCtrlState(channel, CTRL_PROGRAM); - if(np != CTRL_VAL_UNKNOWN) + np = mp->lastValidHWCtrlState(channel, MusECore::CTRL_PROGRAM); + if(np != MusECore::CTRL_VAL_UNKNOWN) { lbank = (np & 0xff00) >> 8; prog = np & 0xff; @@ -758,11 +758,11 @@ void MidiTrackInfo::iProgHBankChanged() iProgram->blockSignals(false); } program = (hbank << 16) + (lbank << 8) + prog; - MidiPlayEvent ev(0, port, channel, ME_CONTROLLER, CTRL_PROGRAM, program); - audio->msgPlayMidiEvent(&ev); + MusECore::MidiPlayEvent ev(0, port, channel, MusECore::ME_CONTROLLER, MusECore::CTRL_PROGRAM, program); + MusEGlobal::audio->msgPlayMidiEvent(&ev); - MidiInstrument* instr = mp->instrument(); - iPatch->setText(instr->getPatchName(channel, program, song->mtype(), track->type() == Track::DRUM)); //FINDMICHJETZT was soll das? + MusECore::MidiInstrument* instr = mp->instrument(); + iPatch->setText(instr->getPatchName(channel, program, MusEGlobal::song->mtype(), track->type() == MusECore::Track::DRUM)); //FINDMICHJETZT was soll das? // updateTrackInfo(); } @@ -774,7 +774,7 @@ void MidiTrackInfo::iProgLBankChanged() { if(!selected) return; - MidiTrack* track = (MidiTrack*)selected; + MusECore::MidiTrack* track = (MusECore::MidiTrack*)selected; int channel = track->outChannel(); int port = track->outPort(); int hbank = iHBank->value(); @@ -794,20 +794,20 @@ void MidiTrackInfo::iProgLBankChanged() else prog = 0xff; - MidiPort* mp = &midiPorts[port]; + MusECore::MidiPort* mp = &MusEGlobal::midiPorts[port]; if(prog == 0xff && hbank == 0xff && lbank == 0xff) { - program = CTRL_VAL_UNKNOWN; - if(mp->hwCtrlState(channel, CTRL_PROGRAM) != CTRL_VAL_UNKNOWN) - audio->msgSetHwCtrlState(mp, channel, CTRL_PROGRAM, CTRL_VAL_UNKNOWN); + program = MusECore::CTRL_VAL_UNKNOWN; + if(mp->hwCtrlState(channel, MusECore::CTRL_PROGRAM) != MusECore::CTRL_VAL_UNKNOWN) + MusEGlobal::audio->msgSetHwCtrlState(mp, channel, MusECore::CTRL_PROGRAM, MusECore::CTRL_VAL_UNKNOWN); return; } - int np = mp->hwCtrlState(channel, CTRL_PROGRAM); - if(np == CTRL_VAL_UNKNOWN) + int np = mp->hwCtrlState(channel, MusECore::CTRL_PROGRAM); + if(np == MusECore::CTRL_VAL_UNKNOWN) { - np = mp->lastValidHWCtrlState(channel, CTRL_PROGRAM); - if(np != CTRL_VAL_UNKNOWN) + np = mp->lastValidHWCtrlState(channel, MusECore::CTRL_PROGRAM); + if(np != MusECore::CTRL_VAL_UNKNOWN) { hbank = (np & 0xff0000) >> 16; prog = np & 0xff; @@ -836,11 +836,11 @@ void MidiTrackInfo::iProgLBankChanged() iProgram->blockSignals(false); } program = (hbank << 16) + (lbank << 8) + prog; - MidiPlayEvent ev(0, port, channel, ME_CONTROLLER, CTRL_PROGRAM, program); - audio->msgPlayMidiEvent(&ev); + MusECore::MidiPlayEvent ev(0, port, channel, MusECore::ME_CONTROLLER, MusECore::CTRL_PROGRAM, program); + MusEGlobal::audio->msgPlayMidiEvent(&ev); - MidiInstrument* instr = mp->instrument(); - iPatch->setText(instr->getPatchName(channel, program, song->mtype(), track->type() == Track::DRUM)); //FINDMICHJETZT was soll das? + MusECore::MidiInstrument* instr = mp->instrument(); + iPatch->setText(instr->getPatchName(channel, program, MusEGlobal::song->mtype(), track->type() == MusECore::Track::DRUM)); //FINDMICHJETZT was soll das? // updateTrackInfo(); } @@ -852,7 +852,7 @@ void MidiTrackInfo::iProgramChanged() { if(!selected) return; - MidiTrack* track = (MidiTrack*)selected; + MusECore::MidiTrack* track = (MusECore::MidiTrack*)selected; int channel = track->outChannel(); int port = track->outPort(); int hbank = iHBank->value(); @@ -872,10 +872,10 @@ void MidiTrackInfo::iProgramChanged() else prog = 0xff; - MidiPort *mp = &midiPorts[port]; + MusECore::MidiPort *mp = &MusEGlobal::midiPorts[port]; if(prog == 0xff) { - program = CTRL_VAL_UNKNOWN; + program = MusECore::CTRL_VAL_UNKNOWN; iHBank->blockSignals(true); iLBank->blockSignals(true); iHBank->setValue(0); @@ -883,17 +883,17 @@ void MidiTrackInfo::iProgramChanged() iHBank->blockSignals(false); iLBank->blockSignals(false); - if(mp->hwCtrlState(channel, CTRL_PROGRAM) != CTRL_VAL_UNKNOWN) - audio->msgSetHwCtrlState(mp, channel, CTRL_PROGRAM, CTRL_VAL_UNKNOWN); + if(mp->hwCtrlState(channel, MusECore::CTRL_PROGRAM) != MusECore::CTRL_VAL_UNKNOWN) + MusEGlobal::audio->msgSetHwCtrlState(mp, channel, MusECore::CTRL_PROGRAM, MusECore::CTRL_VAL_UNKNOWN); return; } else { - int np = mp->hwCtrlState(channel, CTRL_PROGRAM); - if(np == CTRL_VAL_UNKNOWN) + int np = mp->hwCtrlState(channel, MusECore::CTRL_PROGRAM); + if(np == MusECore::CTRL_VAL_UNKNOWN) { - np = mp->lastValidHWCtrlState(channel, CTRL_PROGRAM); - if(np != CTRL_VAL_UNKNOWN) + np = mp->lastValidHWCtrlState(channel, MusECore::CTRL_PROGRAM); + if(np != MusECore::CTRL_VAL_UNKNOWN) { hbank = (np & 0xff0000) >> 16; lbank = (np & 0xff00) >> 8; @@ -914,11 +914,11 @@ void MidiTrackInfo::iProgramChanged() } } program = (hbank << 16) + (lbank << 8) + prog; - MidiPlayEvent ev(0, port, channel, ME_CONTROLLER, CTRL_PROGRAM, program); - audio->msgPlayMidiEvent(&ev); + MusECore::MidiPlayEvent ev(0, port, channel, MusECore::ME_CONTROLLER, MusECore::CTRL_PROGRAM, program); + MusEGlobal::audio->msgPlayMidiEvent(&ev); - MidiInstrument* instr = mp->instrument(); - iPatch->setText(instr->getPatchName(channel, program, song->mtype(), track->type() == Track::DRUM)); //FINDMICHJETZT was soll das? + MusECore::MidiInstrument* instr = mp->instrument(); + iPatch->setText(instr->getPatchName(channel, program, MusEGlobal::song->mtype(), track->type() == MusECore::Track::DRUM)); //FINDMICHJETZT was soll das? } // updateTrackInfo(); @@ -932,25 +932,25 @@ void MidiTrackInfo::iLautstChanged(int val) { if(!selected) return; - MidiTrack* track = (MidiTrack*)selected; + MusECore::MidiTrack* track = (MusECore::MidiTrack*)selected; int outPort = track->outPort(); int chan = track->outChannel(); - MidiPort* mp = &midiPorts[outPort]; - MidiController* mctl = mp->midiController(CTRL_VOLUME); + MusECore::MidiPort* mp = &MusEGlobal::midiPorts[outPort]; + MusECore::MidiController* mctl = mp->midiController(MusECore::CTRL_VOLUME); if((val < mctl->minVal()) || (val > mctl->maxVal())) { - if(mp->hwCtrlState(chan, CTRL_VOLUME) != CTRL_VAL_UNKNOWN) - audio->msgSetHwCtrlState(mp, chan, CTRL_VOLUME, CTRL_VAL_UNKNOWN); + if(mp->hwCtrlState(chan, MusECore::CTRL_VOLUME) != MusECore::CTRL_VAL_UNKNOWN) + MusEGlobal::audio->msgSetHwCtrlState(mp, chan, MusECore::CTRL_VOLUME, MusECore::CTRL_VAL_UNKNOWN); } else { val += mctl->bias(); - MidiPlayEvent ev(0, outPort, chan, - ME_CONTROLLER, CTRL_VOLUME, val); - audio->msgPlayMidiEvent(&ev); + MusECore::MidiPlayEvent ev(0, outPort, chan, + MusECore::ME_CONTROLLER, MusECore::CTRL_VOLUME, val); + MusEGlobal::audio->msgPlayMidiEvent(&ev); } - song->update(SC_MIDI_CONTROLLER); + MusEGlobal::song->update(SC_MIDI_CONTROLLER); } //--------------------------------------------------------- @@ -961,9 +961,9 @@ void MidiTrackInfo::iTranspChanged(int val) { if(!selected) return; - MidiTrack* track = (MidiTrack*)selected; + MusECore::MidiTrack* track = (MusECore::MidiTrack*)selected; track->transposition = val; - song->update(SC_MIDI_TRACK_PROP); + MusEGlobal::song->update(SC_MIDI_TRACK_PROP); } //--------------------------------------------------------- @@ -974,9 +974,9 @@ void MidiTrackInfo::iAnschlChanged(int val) { if(!selected) return; - MidiTrack* track = (MidiTrack*)selected; + MusECore::MidiTrack* track = (MusECore::MidiTrack*)selected; track->velocity = val; - song->update(SC_MIDI_TRACK_PROP); + MusEGlobal::song->update(SC_MIDI_TRACK_PROP); } //--------------------------------------------------------- @@ -987,9 +987,9 @@ void MidiTrackInfo::iVerzChanged(int val) { if(!selected) return; - MidiTrack* track = (MidiTrack*)selected; + MusECore::MidiTrack* track = (MusECore::MidiTrack*)selected; track->delay = val; - song->update(SC_MIDI_TRACK_PROP); + MusEGlobal::song->update(SC_MIDI_TRACK_PROP); } //--------------------------------------------------------- @@ -1000,9 +1000,9 @@ void MidiTrackInfo::iLenChanged(int val) { if(!selected) return; - MidiTrack* track = (MidiTrack*)selected; + MusECore::MidiTrack* track = (MusECore::MidiTrack*)selected; track->len = val; - song->update(SC_MIDI_TRACK_PROP); + MusEGlobal::song->update(SC_MIDI_TRACK_PROP); } //--------------------------------------------------------- @@ -1013,9 +1013,9 @@ void MidiTrackInfo::iKomprChanged(int val) { if(!selected) return; - MidiTrack* track = (MidiTrack*)selected; + MusECore::MidiTrack* track = (MusECore::MidiTrack*)selected; track->compression = val; - song->update(SC_MIDI_TRACK_PROP); + MusEGlobal::song->update(SC_MIDI_TRACK_PROP); } //--------------------------------------------------------- @@ -1026,26 +1026,26 @@ void MidiTrackInfo::iPanChanged(int val) { if(!selected) return; - MidiTrack* track = (MidiTrack*)selected; + MusECore::MidiTrack* track = (MusECore::MidiTrack*)selected; int port = track->outPort(); int chan = track->outChannel(); - MidiPort* mp = &midiPorts[port]; - MidiController* mctl = mp->midiController(CTRL_PANPOT); + MusECore::MidiPort* mp = &MusEGlobal::midiPorts[port]; + MusECore::MidiController* mctl = mp->midiController(MusECore::CTRL_PANPOT); if((val < mctl->minVal()) || (val > mctl->maxVal())) { - if(mp->hwCtrlState(chan, CTRL_PANPOT) != CTRL_VAL_UNKNOWN) - audio->msgSetHwCtrlState(mp, chan, CTRL_PANPOT, CTRL_VAL_UNKNOWN); + if(mp->hwCtrlState(chan, MusECore::CTRL_PANPOT) != MusECore::CTRL_VAL_UNKNOWN) + MusEGlobal::audio->msgSetHwCtrlState(mp, chan, MusECore::CTRL_PANPOT, MusECore::CTRL_VAL_UNKNOWN); } else { val += mctl->bias(); // Realtime Change: - MidiPlayEvent ev(0, port, chan, - ME_CONTROLLER, CTRL_PANPOT, val); - audio->msgPlayMidiEvent(&ev); + MusECore::MidiPlayEvent ev(0, port, chan, + MusECore::ME_CONTROLLER, MusECore::CTRL_PANPOT, val); + MusEGlobal::audio->msgPlayMidiEvent(&ev); } - song->update(SC_MIDI_CONTROLLER); + MusEGlobal::song->update(SC_MIDI_CONTROLLER); } //--------------------------------------------------------- @@ -1061,11 +1061,11 @@ void MidiTrackInfo::instrPopupActivated(QAction* act) int rv = act->data().toInt(); if(rv != -1) { - MidiTrack* track = (MidiTrack*)selected; + MusECore::MidiTrack* track = (MusECore::MidiTrack*)selected; int channel = track->outChannel(); int port = track->outPort(); - MidiPlayEvent ev(0, port, channel, ME_CONTROLLER, CTRL_PROGRAM, rv); - audio->msgPlayMidiEvent(&ev); + MusECore::MidiPlayEvent ev(0, port, channel, MusECore::ME_CONTROLLER, MusECore::CTRL_PROGRAM, rv); + MusEGlobal::audio->msgPlayMidiEvent(&ev); updateTrackInfo(-1); } } @@ -1079,15 +1079,15 @@ void MidiTrackInfo::instrPopup() { if(!selected) return; - MidiTrack* track = (MidiTrack*)selected; + MusECore::MidiTrack* track = (MusECore::MidiTrack*)selected; int channel = track->outChannel(); int port = track->outPort(); - MidiInstrument* instr = midiPorts[port].instrument(); + MusECore::MidiInstrument* instr = MusEGlobal::midiPorts[port].instrument(); //QMenu* pup = new QMenu; PopupMenu* pup = new PopupMenu(true); - //instr->populatePatchPopup(pop, channel, song->mtype(), track->type() == Track::DRUM); - instr->populatePatchPopup(pup, channel, song->mtype(), track->type() == Track::DRUM); //FINDMICHJETZT was soll das? + //instr->populatePatchPopup(pop, channel, MusEGlobal::song->mtype(), track->type() == MusECore::Track::DRUM); + populatePatchPopup(instr, pup, channel, MusEGlobal::song->mtype(), track->type() == MusECore::Track::DRUM); //FINDMICHJETZT was soll das? //if(pop->actions().count() == 0) // return; @@ -1107,8 +1107,8 @@ void MidiTrackInfo::instrPopup() int rv = act->data().toInt(); if(rv != -1) { - MidiPlayEvent ev(0, port, channel, ME_CONTROLLER, CTRL_PROGRAM, rv); - audio->msgPlayMidiEvent(&ev); + MusECore::MidiPlayEvent ev(0, port, channel, MusECore::ME_CONTROLLER, MusECore::CTRL_PROGRAM, rv); + MusEGlobal::audio->msgPlayMidiEvent(&ev); updateTrackInfo(-1); } } @@ -1124,9 +1124,9 @@ void MidiTrackInfo::recEchoToggled(bool v) { if(!selected) return; - MidiTrack* track = (MidiTrack*)selected; + MusECore::MidiTrack* track = (MusECore::MidiTrack*)selected; track->setRecEcho(v); - song->update(SC_MIDI_TRACK_PROP); + MusEGlobal::song->update(SC_MIDI_TRACK_PROP); } //--------------------------------------------------------- @@ -1137,27 +1137,27 @@ void MidiTrackInfo::iProgramDoubleClicked() { if(!selected) return; - MidiTrack* track = (MidiTrack*)selected; + MusECore::MidiTrack* track = (MusECore::MidiTrack*)selected; int port = track->outPort(); int chan = track->outChannel(); - MidiPort* mp = &midiPorts[port]; - MidiController* mctl = mp->midiController(CTRL_PROGRAM); + MusECore::MidiPort* mp = &MusEGlobal::midiPorts[port]; + MusECore::MidiController* mctl = mp->midiController(MusECore::CTRL_PROGRAM); if(!track || !mctl) return; - int lastv = mp->lastValidHWCtrlState(chan, CTRL_PROGRAM); - int curv = mp->hwCtrlState(chan, CTRL_PROGRAM); + int lastv = mp->lastValidHWCtrlState(chan, MusECore::CTRL_PROGRAM); + int curv = mp->hwCtrlState(chan, MusECore::CTRL_PROGRAM); - if(curv == CTRL_VAL_UNKNOWN) + if(curv == MusECore::CTRL_VAL_UNKNOWN) { // If no value has ever been set yet, use the current knob value // (or the controller's initial value?) to 'turn on' the controller. - if(lastv == CTRL_VAL_UNKNOWN) + if(lastv == MusECore::CTRL_VAL_UNKNOWN) { int kiv = mctl->initVal(); //int kiv = lrint(_knob->value()); - if(kiv == CTRL_VAL_UNKNOWN) + if(kiv == MusECore::CTRL_VAL_UNKNOWN) kiv = 0; //else //{ @@ -1168,23 +1168,23 @@ void MidiTrackInfo::iProgramDoubleClicked() //kiv += mctrl->bias(); //} - //MidiPlayEvent ev(0, port, chan, ME_CONTROLLER, num, kiv); - MidiPlayEvent ev(0, port, chan, ME_CONTROLLER, CTRL_PROGRAM, kiv); - audio->msgPlayMidiEvent(&ev); + //MusECore::MidiPlayEvent ev(0, port, chan, MusECore::ME_CONTROLLER, num, kiv); + MusECore::MidiPlayEvent ev(0, port, chan, MusECore::ME_CONTROLLER, MusECore::CTRL_PROGRAM, kiv); + MusEGlobal::audio->msgPlayMidiEvent(&ev); } else { - MidiPlayEvent ev(0, port, chan, ME_CONTROLLER, CTRL_PROGRAM, lastv); - audio->msgPlayMidiEvent(&ev); + MusECore::MidiPlayEvent ev(0, port, chan, MusECore::ME_CONTROLLER, MusECore::CTRL_PROGRAM, lastv); + MusEGlobal::audio->msgPlayMidiEvent(&ev); } } else { - if(mp->hwCtrlState(chan, CTRL_PROGRAM) != CTRL_VAL_UNKNOWN) - audio->msgSetHwCtrlState(mp, chan, CTRL_PROGRAM, CTRL_VAL_UNKNOWN); + if(mp->hwCtrlState(chan, MusECore::CTRL_PROGRAM) != MusECore::CTRL_VAL_UNKNOWN) + MusEGlobal::audio->msgSetHwCtrlState(mp, chan, MusECore::CTRL_PROGRAM, MusECore::CTRL_VAL_UNKNOWN); } - song->update(SC_MIDI_CONTROLLER); + MusEGlobal::song->update(SC_MIDI_CONTROLLER); } //--------------------------------------------------------- @@ -1195,27 +1195,27 @@ void MidiTrackInfo::iLautstDoubleClicked() { if(!selected) return; - MidiTrack* track = (MidiTrack*)selected; + MusECore::MidiTrack* track = (MusECore::MidiTrack*)selected; int port = track->outPort(); int chan = track->outChannel(); - MidiPort* mp = &midiPorts[port]; - MidiController* mctl = mp->midiController(CTRL_VOLUME); + MusECore::MidiPort* mp = &MusEGlobal::midiPorts[port]; + MusECore::MidiController* mctl = mp->midiController(MusECore::CTRL_VOLUME); if(!track || !mctl) return; - int lastv = mp->lastValidHWCtrlState(chan, CTRL_VOLUME); - int curv = mp->hwCtrlState(chan, CTRL_VOLUME); + int lastv = mp->lastValidHWCtrlState(chan, MusECore::CTRL_VOLUME); + int curv = mp->hwCtrlState(chan, MusECore::CTRL_VOLUME); - if(curv == CTRL_VAL_UNKNOWN) + if(curv == MusECore::CTRL_VAL_UNKNOWN) { // If no value has ever been set yet, use the current knob value // (or the controller's initial value?) to 'turn on' the controller. - if(lastv == CTRL_VAL_UNKNOWN) + if(lastv == MusECore::CTRL_VAL_UNKNOWN) { int kiv = mctl->initVal(); //int kiv = lrint(_knob->value()); - if(kiv == CTRL_VAL_UNKNOWN) + if(kiv == MusECore::CTRL_VAL_UNKNOWN) // Set volume to 78% of range, so that if range is 0 - 127, then value is 100. kiv = lround(double(mctl->maxVal() - mctl->minVal()) * 0.7874); else @@ -1227,22 +1227,22 @@ void MidiTrackInfo::iLautstDoubleClicked() kiv += mctl->bias(); } - MidiPlayEvent ev(0, port, chan, ME_CONTROLLER, CTRL_VOLUME, kiv); - audio->msgPlayMidiEvent(&ev); + MusECore::MidiPlayEvent ev(0, port, chan, MusECore::ME_CONTROLLER, MusECore::CTRL_VOLUME, kiv); + MusEGlobal::audio->msgPlayMidiEvent(&ev); } else { - MidiPlayEvent ev(0, port, chan, ME_CONTROLLER, CTRL_VOLUME, lastv); - audio->msgPlayMidiEvent(&ev); + MusECore::MidiPlayEvent ev(0, port, chan, MusECore::ME_CONTROLLER, MusECore::CTRL_VOLUME, lastv); + MusEGlobal::audio->msgPlayMidiEvent(&ev); } } else { - if(mp->hwCtrlState(chan, CTRL_VOLUME) != CTRL_VAL_UNKNOWN) - audio->msgSetHwCtrlState(mp, chan, CTRL_VOLUME, CTRL_VAL_UNKNOWN); + if(mp->hwCtrlState(chan, MusECore::CTRL_VOLUME) != MusECore::CTRL_VAL_UNKNOWN) + MusEGlobal::audio->msgSetHwCtrlState(mp, chan, MusECore::CTRL_VOLUME, MusECore::CTRL_VAL_UNKNOWN); } - song->update(SC_MIDI_CONTROLLER); + MusEGlobal::song->update(SC_MIDI_CONTROLLER); } //--------------------------------------------------------- @@ -1253,27 +1253,27 @@ void MidiTrackInfo::iPanDoubleClicked() { if(!selected) return; - MidiTrack* track = (MidiTrack*)selected; + MusECore::MidiTrack* track = (MusECore::MidiTrack*)selected; int port = track->outPort(); int chan = track->outChannel(); - MidiPort* mp = &midiPorts[port]; - MidiController* mctl = mp->midiController(CTRL_PANPOT); + MusECore::MidiPort* mp = &MusEGlobal::midiPorts[port]; + MusECore::MidiController* mctl = mp->midiController(MusECore::CTRL_PANPOT); if(!track || !mctl) return; - int lastv = mp->lastValidHWCtrlState(chan, CTRL_PANPOT); - int curv = mp->hwCtrlState(chan, CTRL_PANPOT); + int lastv = mp->lastValidHWCtrlState(chan, MusECore::CTRL_PANPOT); + int curv = mp->hwCtrlState(chan, MusECore::CTRL_PANPOT); - if(curv == CTRL_VAL_UNKNOWN) + if(curv == MusECore::CTRL_VAL_UNKNOWN) { // If no value has ever been set yet, use the current knob value // (or the controller's initial value?) to 'turn on' the controller. - if(lastv == CTRL_VAL_UNKNOWN) + if(lastv == MusECore::CTRL_VAL_UNKNOWN) { int kiv = mctl->initVal(); //int kiv = lrint(_knob->value()); - if(kiv == CTRL_VAL_UNKNOWN) + if(kiv == MusECore::CTRL_VAL_UNKNOWN) // Set volume to 50% of range, so that if range is 0 - 127, then value is 64. kiv = lround(double(mctl->maxVal() - mctl->minVal()) * 0.5); else @@ -1285,22 +1285,22 @@ void MidiTrackInfo::iPanDoubleClicked() kiv += mctl->bias(); } - MidiPlayEvent ev(0, port, chan, ME_CONTROLLER, CTRL_PANPOT, kiv); - audio->msgPlayMidiEvent(&ev); + MusECore::MidiPlayEvent ev(0, port, chan, MusECore::ME_CONTROLLER, MusECore::CTRL_PANPOT, kiv); + MusEGlobal::audio->msgPlayMidiEvent(&ev); } else { - MidiPlayEvent ev(0, port, chan, ME_CONTROLLER, CTRL_PANPOT, lastv); - audio->msgPlayMidiEvent(&ev); + MusECore::MidiPlayEvent ev(0, port, chan, MusECore::ME_CONTROLLER, MusECore::CTRL_PANPOT, lastv); + MusEGlobal::audio->msgPlayMidiEvent(&ev); } } else { - if(mp->hwCtrlState(chan, CTRL_PANPOT) != CTRL_VAL_UNKNOWN) - audio->msgSetHwCtrlState(mp, chan, CTRL_PANPOT, CTRL_VAL_UNKNOWN); + if(mp->hwCtrlState(chan, MusECore::CTRL_PANPOT) != MusECore::CTRL_VAL_UNKNOWN) + MusEGlobal::audio->msgSetHwCtrlState(mp, chan, MusECore::CTRL_PANPOT, MusECore::CTRL_VAL_UNKNOWN); } - song->update(SC_MIDI_CONTROLLER); + MusEGlobal::song->update(SC_MIDI_CONTROLLER); } @@ -1318,7 +1318,7 @@ void MidiTrackInfo::updateTrackInfo(int flags) if(!selected) return; - MidiTrack* track = (MidiTrack*)selected; + MusECore::MidiTrack* track = (MusECore::MidiTrack*)selected; setLabelText(); setLabelFont(); @@ -1353,7 +1353,7 @@ void MidiTrackInfo::updateTrackInfo(int flags) for (int i = 0; i < MIDI_PORTS; ++i) { QString name; - name.sprintf("%d:%s", i+1, midiPorts[i].portname().toLatin1().constData()); + name.sprintf("%d:%s", i+1, MusEGlobal::midiPorts[i].portname().toLatin1().constData()); iOutput->insertItem(i, name); if (i == outPort) iOutput->setCurrentIndex(i); @@ -1389,9 +1389,9 @@ void MidiTrackInfo::updateTrackInfo(int flags) int outChannel = track->outChannel(); int outPort = track->outPort(); - MidiPort* mp = &midiPorts[outPort]; - int nprogram = mp->hwCtrlState(outChannel, CTRL_PROGRAM); - if(nprogram == CTRL_VAL_UNKNOWN) + MusECore::MidiPort* mp = &MusEGlobal::midiPorts[outPort]; + int nprogram = mp->hwCtrlState(outChannel, MusECore::CTRL_PROGRAM); + if(nprogram == MusECore::CTRL_VAL_UNKNOWN) { iHBank->blockSignals(true); iLBank->blockSignals(true); @@ -1403,15 +1403,15 @@ void MidiTrackInfo::updateTrackInfo(int flags) iLBank->blockSignals(false); iProgram->blockSignals(false); - program = CTRL_VAL_UNKNOWN; - nprogram = mp->lastValidHWCtrlState(outChannel, CTRL_PROGRAM); - if(nprogram == CTRL_VAL_UNKNOWN) + program = MusECore::CTRL_VAL_UNKNOWN; + nprogram = mp->lastValidHWCtrlState(outChannel, MusECore::CTRL_PROGRAM); + if(nprogram == MusECore::CTRL_VAL_UNKNOWN) //iPatch->setText(QString("<unknown>")); iPatch->setText(tr("<unknown>")); else { - MidiInstrument* instr = mp->instrument(); - iPatch->setText(instr->getPatchName(outChannel, nprogram, song->mtype(), track->type() == Track::DRUM)); //FINDMICHJETZT was soll das? + MusECore::MidiInstrument* instr = mp->instrument(); + iPatch->setText(instr->getPatchName(outChannel, nprogram, MusEGlobal::song->mtype(), track->type() == MusECore::Track::DRUM)); //FINDMICHJETZT was soll das? } } else @@ -1420,14 +1420,14 @@ void MidiTrackInfo::updateTrackInfo(int flags) program = nprogram; //int hb, lb, pr; - //if (program == CTRL_VAL_UNKNOWN) { + //if (program == MusECore::CTRL_VAL_UNKNOWN) { // hb = lb = pr = 0; // iPatch->setText("---"); // } //else //{ - MidiInstrument* instr = mp->instrument(); - iPatch->setText(instr->getPatchName(outChannel, program, song->mtype(), track->type() == Track::DRUM)); //FINDMICHJETZT was soll das? + MusECore::MidiInstrument* instr = mp->instrument(); + iPatch->setText(instr->getPatchName(outChannel, program, MusEGlobal::song->mtype(), track->type() == MusECore::Track::DRUM)); //FINDMICHJETZT was soll das? int hb = ((program >> 16) & 0xff) + 1; if (hb == 0x100) @@ -1452,14 +1452,14 @@ void MidiTrackInfo::updateTrackInfo(int flags) iProgram->blockSignals(false); } - MidiController* mc = mp->midiController(CTRL_VOLUME); + MusECore::MidiController* mc = mp->midiController(MusECore::CTRL_VOLUME); int mn = mc->minVal(); - int v = mp->hwCtrlState(outChannel, CTRL_VOLUME); + int v = mp->hwCtrlState(outChannel, MusECore::CTRL_VOLUME); volume = v; - if(v == CTRL_VAL_UNKNOWN) + if(v == MusECore::CTRL_VAL_UNKNOWN) //{ //v = mc->initVal(); - //if(v == CTRL_VAL_UNKNOWN) + //if(v == MusECore::CTRL_VAL_UNKNOWN) // v = 0; v = mn - 1; //} @@ -1471,14 +1471,14 @@ void MidiTrackInfo::updateTrackInfo(int flags) iLautst->setValue(v); iLautst->blockSignals(false); - mc = mp->midiController(CTRL_PANPOT); + mc = mp->midiController(MusECore::CTRL_PANPOT); mn = mc->minVal(); - v = mp->hwCtrlState(outChannel, CTRL_PANPOT); + v = mp->hwCtrlState(outChannel, MusECore::CTRL_PANPOT); pan = v; - if(v == CTRL_VAL_UNKNOWN) + if(v == MusECore::CTRL_VAL_UNKNOWN) //{ //v = mc->initVal(); - //if(v == CTRL_VAL_UNKNOWN) + //if(v == MusECore::CTRL_VAL_UNKNOWN) // v = 0; v = mn - 1; //} @@ -1501,21 +1501,21 @@ void MidiTrackInfo::progRecClicked() { if(!selected) return; - MidiTrack* track = (MidiTrack*)selected; + MusECore::MidiTrack* track = (MusECore::MidiTrack*)selected; int portno = track->outPort(); int channel = track->outChannel(); - MidiPort* port = &midiPorts[portno]; - int program = port->hwCtrlState(channel, CTRL_PROGRAM); - if(program == CTRL_VAL_UNKNOWN || program == 0xffffff) + MusECore::MidiPort* port = &MusEGlobal::midiPorts[portno]; + int program = port->hwCtrlState(channel, MusECore::CTRL_PROGRAM); + if(program == MusECore::CTRL_VAL_UNKNOWN || program == 0xffffff) return; - unsigned tick = song->cpos(); - Event a(Controller); + unsigned tick = MusEGlobal::song->cpos(); + MusECore::Event a(MusECore::Controller); a.setTick(tick); - a.setA(CTRL_PROGRAM); + a.setA(MusECore::CTRL_PROGRAM); a.setB(program); - song->recordEvent(track, a); + MusEGlobal::song->recordEvent(track, a); } //--------------------------------------------------------- @@ -1526,21 +1526,21 @@ void MidiTrackInfo::volRecClicked() { if(!selected) return; - MidiTrack* track = (MidiTrack*)selected; + MusECore::MidiTrack* track = (MusECore::MidiTrack*)selected; int portno = track->outPort(); int channel = track->outChannel(); - MidiPort* port = &midiPorts[portno]; - int volume = port->hwCtrlState(channel, CTRL_VOLUME); - if(volume == CTRL_VAL_UNKNOWN) + MusECore::MidiPort* port = &MusEGlobal::midiPorts[portno]; + int volume = port->hwCtrlState(channel, MusECore::CTRL_VOLUME); + if(volume == MusECore::CTRL_VAL_UNKNOWN) return; - unsigned tick = song->cpos(); - Event a(Controller); + unsigned tick = MusEGlobal::song->cpos(); + MusECore::Event a(MusECore::Controller); a.setTick(tick); - a.setA(CTRL_VOLUME); + a.setA(MusECore::CTRL_VOLUME); a.setB(volume); - song->recordEvent(track, a); + MusEGlobal::song->recordEvent(track, a); } //--------------------------------------------------------- @@ -1551,21 +1551,21 @@ void MidiTrackInfo::panRecClicked() { if(!selected) return; - MidiTrack* track = (MidiTrack*)selected; + MusECore::MidiTrack* track = (MusECore::MidiTrack*)selected; int portno = track->outPort(); int channel = track->outChannel(); - MidiPort* port = &midiPorts[portno]; - int pan = port->hwCtrlState(channel, CTRL_PANPOT); - if(pan == CTRL_VAL_UNKNOWN) + MusECore::MidiPort* port = &MusEGlobal::midiPorts[portno]; + int pan = port->hwCtrlState(channel, MusECore::CTRL_PANPOT); + if(pan == MusECore::CTRL_VAL_UNKNOWN) return; - unsigned tick = song->cpos(); - Event a(Controller); + unsigned tick = MusEGlobal::song->cpos(); + MusECore::Event a(MusECore::Controller); a.setTick(tick); - a.setA(CTRL_PANPOT); + a.setA(MusECore::CTRL_PANPOT); a.setB(pan); - song->recordEvent(track, a); + MusEGlobal::song->recordEvent(track, a); } //--------------------------------------------------------- @@ -1576,38 +1576,38 @@ void MidiTrackInfo::recordClicked() { if(!selected) return; - MidiTrack* track = (MidiTrack*)selected; + MusECore::MidiTrack* track = (MusECore::MidiTrack*)selected; int portno = track->outPort(); int channel = track->outChannel(); - MidiPort* port = &midiPorts[portno]; - unsigned tick = song->cpos(); + MusECore::MidiPort* port = &MusEGlobal::midiPorts[portno]; + unsigned tick = MusEGlobal::song->cpos(); - int program = port->hwCtrlState(channel, CTRL_PROGRAM); - if(program != CTRL_VAL_UNKNOWN && program != 0xffffff) + int program = port->hwCtrlState(channel, MusECore::CTRL_PROGRAM); + if(program != MusECore::CTRL_VAL_UNKNOWN && program != 0xffffff) { - Event a(Controller); + MusECore::Event a(MusECore::Controller); a.setTick(tick); - a.setA(CTRL_PROGRAM); + a.setA(MusECore::CTRL_PROGRAM); a.setB(program); - song->recordEvent(track, a); + MusEGlobal::song->recordEvent(track, a); } - int volume = port->hwCtrlState(channel, CTRL_VOLUME); - if(volume != CTRL_VAL_UNKNOWN) + int volume = port->hwCtrlState(channel, MusECore::CTRL_VOLUME); + if(volume != MusECore::CTRL_VAL_UNKNOWN) { - Event a(Controller); + MusECore::Event a(MusECore::Controller); a.setTick(tick); - a.setA(CTRL_VOLUME); + a.setA(MusECore::CTRL_VOLUME); a.setB(volume); - song->recordEvent(track, a); + MusEGlobal::song->recordEvent(track, a); } - int pan = port->hwCtrlState(channel, CTRL_PANPOT); - if(pan != CTRL_VAL_UNKNOWN) + int pan = port->hwCtrlState(channel, MusECore::CTRL_PANPOT); + if(pan != MusECore::CTRL_VAL_UNKNOWN) { - Event a(Controller); + MusECore::Event a(MusECore::Controller); a.setTick(tick); - a.setA(CTRL_PANPOT); + a.setA(MusECore::CTRL_PANPOT); a.setB(pan); - song->recordEvent(track, a); + MusEGlobal::song->recordEvent(track, a); } } @@ -1619,4 +1619,4 @@ void MidiTrackInfo::resizeEvent(QResizeEvent* ev) setLabelFont(); } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/mtrackinfo.h b/muse2/muse/widgets/mtrackinfo.h index 42bcb2bf..b816f289 100644 --- a/muse2/muse/widgets/mtrackinfo.h +++ b/muse2/muse/widgets/mtrackinfo.h @@ -25,9 +25,11 @@ #include "ui_mtrackinfobase.h" +namespace MusECore { class Track; +} -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // MidiTrackInfo @@ -36,7 +38,7 @@ namespace MusEWidget { class MidiTrackInfo : public QWidget, public Ui::MidiTrackInfoBase { Q_OBJECT - Track* selected; + MusECore::Track* selected; bool _midiDetect; int program, pan, volume; int heartBeatCounter; @@ -74,19 +76,19 @@ class MidiTrackInfo : public QWidget, public Ui::MidiTrackInfoBase virtual void heartBeat(); public slots: - void setTrack(Track*); + void setTrack(MusECore::Track*); void configChanged(); void songChanged(int); public: - MidiTrackInfo(QWidget*, Track* = 0); - Track* track() const { return selected; } + MidiTrackInfo(QWidget*, MusECore::Track* = 0); + MusECore::Track* track() const { return selected; } void setLabelText(); void setLabelFont(); void updateTrackInfo(int); }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/mtrackinfobase.ui b/muse2/muse/widgets/mtrackinfobase.ui index 99c06ad0..4a4b9c37 100644 --- a/muse2/muse/widgets/mtrackinfobase.ui +++ b/muse2/muse/widgets/mtrackinfobase.ui @@ -86,7 +86,7 @@ </widget> </item> <item row="2" column="0"> - <widget class="MusEWidget::SpinBox" name="iOutputChannel"> + <widget class="MusEGui::SpinBox" name="iOutputChannel"> <property name="sizePolicy"> <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <horstretch>0</horstretch> @@ -247,7 +247,7 @@ </layout> </item> <item row="4" column="0"> - <widget class="MusEWidget::SpinBox" name="iTransp"> + <widget class="MusEGui::SpinBox" name="iTransp"> <property name="sizePolicy"> <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <horstretch>0</horstretch> @@ -291,7 +291,7 @@ </widget> </item> <item row="5" column="0"> - <widget class="MusEWidget::SpinBox" name="iVerz"> + <widget class="MusEGui::SpinBox" name="iVerz"> <property name="sizePolicy"> <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <horstretch>0</horstretch> @@ -332,7 +332,7 @@ </widget> </item> <item row="6" column="0"> - <widget class="MusEWidget::SpinBox" name="iLen"> + <widget class="MusEGui::SpinBox" name="iLen"> <property name="sizePolicy"> <sizepolicy hsizetype="Maximum" vsizetype="Fixed"> <horstretch>0</horstretch> @@ -376,7 +376,7 @@ </widget> </item> <item row="7" column="0"> - <widget class="MusEWidget::SpinBox" name="iAnschl"> + <widget class="MusEGui::SpinBox" name="iAnschl"> <property name="sizePolicy"> <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <horstretch>0</horstretch> @@ -423,7 +423,7 @@ </widget> </item> <item row="8" column="0"> - <widget class="MusEWidget::SpinBox" name="iKompr"> + <widget class="MusEGui::SpinBox" name="iKompr"> <property name="sizePolicy"> <sizepolicy hsizetype="Maximum" vsizetype="Fixed"> <horstretch>0</horstretch> @@ -575,7 +575,7 @@ </layout> </item> <item row="12" column="0"> - <widget class="MusEWidget::SpinBox" name="iHBank"> + <widget class="MusEGui::SpinBox" name="iHBank"> <property name="sizePolicy"> <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <horstretch>0</horstretch> @@ -628,7 +628,7 @@ </widget> </item> <item row="13" column="0"> - <widget class="MusEWidget::SpinBox" name="iLBank"> + <widget class="MusEGui::SpinBox" name="iLBank"> <property name="sizePolicy"> <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <horstretch>0</horstretch> @@ -681,7 +681,7 @@ </widget> </item> <item row="14" column="0"> - <widget class="MusEWidget::SpinBox" name="iProgram"> + <widget class="MusEGui::SpinBox" name="iProgram"> <property name="sizePolicy"> <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <horstretch>0</horstretch> @@ -748,7 +748,7 @@ </layout> </item> <item row="15" column="0"> - <widget class="MusEWidget::SpinBox" name="iLautst"> + <widget class="MusEGui::SpinBox" name="iLautst"> <property name="sizePolicy"> <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <horstretch>0</horstretch> @@ -815,7 +815,7 @@ </layout> </item> <item row="16" column="0"> - <widget class="MusEWidget::SpinBox" name="iPan"> + <widget class="MusEGui::SpinBox" name="iPan"> <property name="sizePolicy"> <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <horstretch>0</horstretch> @@ -905,7 +905,7 @@ <layoutdefault spacing="6" margin="11"/> <customwidgets> <customwidget> - <class>MusEWidget::SpinBox</class> + <class>MusEGui::SpinBox</class> <extends>QSpinBox</extends> <header location="global">spinbox.h</header> </customwidget> diff --git a/muse2/muse/widgets/mtscale.cpp b/muse2/muse/widgets/mtscale.cpp index 8f63c36b..6211574d 100644 --- a/muse2/muse/widgets/mtscale.cpp +++ b/muse2/muse/widgets/mtscale.cpp @@ -30,7 +30,7 @@ #include "icons.h" #include "gconfig.h" -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // MTScale @@ -45,21 +45,21 @@ MTScale::MTScale(int* r, QWidget* parent, int xs, bool _mode) barLocator = false; raster = r; if (waveMode) { - pos[0] = tempomap.tick2frame(song->cpos()); - pos[1] = tempomap.tick2frame(song->lpos()); - pos[2] = tempomap.tick2frame(song->rpos()); + pos[0] = MusEGlobal::tempomap.tick2frame(MusEGlobal::song->cpos()); + pos[1] = MusEGlobal::tempomap.tick2frame(MusEGlobal::song->lpos()); + pos[2] = MusEGlobal::tempomap.tick2frame(MusEGlobal::song->rpos()); } else { - pos[0] = song->cpos(); - pos[1] = song->lpos(); - pos[2] = song->rpos(); + pos[0] = MusEGlobal::song->cpos(); + pos[1] = MusEGlobal::song->lpos(); + pos[2] = MusEGlobal::song->rpos(); } pos[3] = MAXINT; // do not show button = Qt::NoButton; setMouseTracking(true); - connect(song, SIGNAL(posChanged(int, unsigned, bool)), SLOT(setPos(int, unsigned, bool))); - connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); - connect(song, SIGNAL(markerChanged(int)), SLOT(redraw())); + connect(MusEGlobal::song, SIGNAL(posChanged(int, unsigned, bool)), SLOT(setPos(int, unsigned, bool))); + connect(MusEGlobal::song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); + connect(MusEGlobal::song, SIGNAL(markerChanged(int)), SLOT(redraw())); setFixedHeight(28); setBg(QColor(0xe0, 0xe0, 0xe0)); @@ -73,9 +73,9 @@ void MTScale::songChanged(int type) { if (type & (SC_SIG|SC_TEMPO)) { if ((type & SC_TEMPO) && waveMode) { - pos[0] = tempomap.tick2frame(song->cpos()); - pos[1] = tempomap.tick2frame(song->lpos()); - pos[2] = tempomap.tick2frame(song->rpos()); + pos[0] = MusEGlobal::tempomap.tick2frame(MusEGlobal::song->cpos()); + pos[1] = MusEGlobal::tempomap.tick2frame(MusEGlobal::song->lpos()); + pos[2] = MusEGlobal::tempomap.tick2frame(MusEGlobal::song->rpos()); } redraw(); } @@ -95,7 +95,7 @@ void MTScale::setPos(int idx, unsigned val, bool) return; } if (waveMode) - val = tempomap.tick2frame(val); + val = MusEGlobal::tempomap.tick2frame(val); if (val == pos[idx]) return; //unsigned opos = mapx(pos[idx] == MAXINT ? val : pos[idx]); @@ -160,7 +160,7 @@ void MTScale::viewMouseMoveEvent(QMouseEvent* event) int x = event->x(); if (waveMode) - x = tempomap.frame2tick(x); + x = MusEGlobal::tempomap.frame2tick(x); x = AL::sigmap.raster(x, *raster); if (x < 0) x = 0; @@ -175,7 +175,7 @@ void MTScale::viewMouseMoveEvent(QMouseEvent* event) i = 1; break; case Qt::RightButton: - if ((MusEConfig::config.rangeMarkerWithoutMMB) && (event->modifiers() & Qt::ControlModifier)) + if ((MusEGlobal::config.rangeMarkerWithoutMMB) && (event->modifiers() & Qt::ControlModifier)) i = 1; else i = 2; @@ -183,26 +183,26 @@ void MTScale::viewMouseMoveEvent(QMouseEvent* event) default: return; // if no button is pressed the function returns here } - Pos p(x, true); + MusECore::Pos p(x, true); if(i== 0 && (event->modifiers() & Qt::ShiftModifier )) { // If shift +LMB we add a marker - Marker *alreadyExists = song->getMarkerAt(x); + MusECore::Marker *alreadyExists = MusEGlobal::song->getMarkerAt(x); if (!alreadyExists) { - song->addMarker(QString(""), x, false); + MusEGlobal::song->addMarker(QString(""), x, false); // Removed p3.3.43 // Song::addMarker() already emits a 'markerChanged'. //emit addMarker(x); } } else if (i== 2 && (event->modifiers() & Qt::ShiftModifier )) { // If shift +RMB we remove a marker - Marker *toRemove = song->getMarkerAt(x); + MusECore::Marker *toRemove = MusEGlobal::song->getMarkerAt(x); if (toRemove) - song->removeMarker(toRemove); + MusEGlobal::song->removeMarker(toRemove); else printf("No marker to remove\n"); } else - song->setPos(i, p); // all other cases: relocating one of the locators + MusEGlobal::song->setPos(i, p); // all other cases: relocating one of the locators } //--------------------------------------------------------- @@ -235,12 +235,12 @@ void MTScale::pdraw(QPainter& p, const QRect& r) int y = 12; p.setPen(Qt::black); - p.setFont(MusEConfig::config.fonts[4]); + p.setFont(MusEGlobal::config.fonts[4]); p.drawLine(r.x(), y+1, r.x() + r.width(), y+1); QRect tr(r); tr.setHeight(12); - MarkerList* marker = song->marker(); - for (iMarker m = marker->begin(); m != marker->end(); ++m) { + MusECore::MarkerList* marker = MusEGlobal::song->marker(); + for (MusECore::iMarker m = marker->begin(); m != marker->end(); ++m) { int xp; if(waveMode) @@ -250,12 +250,12 @@ void MTScale::pdraw(QPainter& p, const QRect& r) if (xp > x+w) break; int xe = r.x() + r.width(); - iMarker mm = m; + MusECore::iMarker mm = m; ++mm; if (mm != marker->end()) { if(waveMode) - xe = mapx(tempomap.tick2frame(mm->first)); + xe = mapx(MusEGlobal::tempomap.tick2frame(mm->first)); else xe = mapx(mm->first); } @@ -275,12 +275,12 @@ void MTScale::pdraw(QPainter& p, const QRect& r) } int x2; - //iMarker mm = m; + //MusECore::iMarker mm = m; //++mm; if (mm != marker->end()) { if(waveMode) - x2 = mapx(tempomap.tick2frame(mm->first)); + x2 = mapx(MusEGlobal::tempomap.tick2frame(mm->first)); else x2 = mapx(mm->first); } @@ -355,9 +355,9 @@ void MTScale::pdraw(QPainter& p, const QRect& r) unsigned tick; if (waveMode) { - ctick = tempomap.frame2tick(mapxDev(x)); + ctick = MusEGlobal::tempomap.frame2tick(mapxDev(x)); AL::sigmap.tickValues(ctick, &bar1, &beat, &tick); - AL::sigmap.tickValues(tempomap.frame2tick(mapxDev(x+w)), + AL::sigmap.tickValues(MusEGlobal::tempomap.frame2tick(mapxDev(x+w)), &bar2, &beat, &tick); } else { @@ -374,8 +374,8 @@ void MTScale::pdraw(QPainter& p, const QRect& r) ntick = AL::sigmap.bar2tick(bar+1, 0, 0); int tpix, a, b=0; if (waveMode) { - a = tempomap.tick2frame(ntick); - b = tempomap.tick2frame(stick); + a = MusEGlobal::tempomap.tick2frame(ntick); + b = MusEGlobal::tempomap.tick2frame(stick); tpix = rmapx(a - b); } else { @@ -396,7 +396,7 @@ void MTScale::pdraw(QPainter& p, const QRect& r) n = 32; if (bar % n) continue; - p.setFont(MusEConfig::config.fonts[3]); + p.setFont(MusEGlobal::config.fonts[3]); int x = mapx(waveMode ? b : stick); QString s; s.setNum(bar + 1); @@ -411,7 +411,7 @@ void MTScale::pdraw(QPainter& p, const QRect& r) for (int beat = 0; beat < z; beat++) { int xx = AL::sigmap.bar2tick(bar, beat, 0); if (waveMode) - xx = tempomap.tick2frame(xx); + xx = MusEGlobal::tempomap.tick2frame(xx); int xp = mapx(xx); QString s; QRect r(xp+2, y, 1000, h); @@ -420,12 +420,12 @@ void MTScale::pdraw(QPainter& p, const QRect& r) if (beat == 0) { num = bar + 1; y1 = y + 1; - p.setFont(MusEConfig::config.fonts[3]); + p.setFont(MusEGlobal::config.fonts[3]); } else { num = beat + 1; y1 = y + 7; - p.setFont(MusEConfig::config.fonts[1]); + p.setFont(MusEGlobal::config.fonts[1]); r.setY(y+3); } s.setNum(num); @@ -436,4 +436,4 @@ void MTScale::pdraw(QPainter& p, const QRect& r) } } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/mtscale.h b/muse2/muse/widgets/mtscale.h index 820e33c6..a505c832 100644 --- a/muse2/muse/widgets/mtscale.h +++ b/muse2/muse/widgets/mtscale.h @@ -26,7 +26,7 @@ #include "view.h" -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // MTScale diff --git a/muse2/muse/widgets/mtscale_flo.cpp b/muse2/muse/widgets/mtscale_flo.cpp index beb7eef3..df077102 100644 --- a/muse2/muse/widgets/mtscale_flo.cpp +++ b/muse2/muse/widgets/mtscale_flo.cpp @@ -31,7 +31,7 @@ #include "gconfig.h" #include "scoreedit.h" -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // MTScale @@ -42,14 +42,14 @@ MTScaleFlo::MTScaleFlo(ScoreCanvas* parent_editor, QWidget* parent_widget) : View(parent_widget, 1, 1) { setToolTip(tr("bar scale")); - pos[0] = song->cpos(); - pos[1] = song->lpos(); - pos[2] = song->rpos(); + pos[0] = MusEGlobal::song->cpos(); + pos[1] = MusEGlobal::song->lpos(); + pos[2] = MusEGlobal::song->rpos(); button = Qt::NoButton; setMouseTracking(true); - connect(song, SIGNAL(posChanged(int, unsigned, bool)), SLOT(setPos(int, unsigned, bool))); - connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); - connect(song, SIGNAL(markerChanged(int)), SLOT(redraw())); + connect(MusEGlobal::song, SIGNAL(posChanged(int, unsigned, bool)), SLOT(setPos(int, unsigned, bool))); + connect(MusEGlobal::song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); + connect(MusEGlobal::song, SIGNAL(markerChanged(int)), SLOT(redraw())); parent=parent_editor; @@ -145,7 +145,7 @@ void MTScaleFlo::mouseMoveEvent(QMouseEvent* event) i = 1; break; case Qt::RightButton: - if ((MusEConfig::config.rangeMarkerWithoutMMB) && (event->modifiers() & Qt::ControlModifier)) + if ((MusEGlobal::config.rangeMarkerWithoutMMB) && (event->modifiers() & Qt::ControlModifier)) i = 1; else i = 2; @@ -153,22 +153,22 @@ void MTScaleFlo::mouseMoveEvent(QMouseEvent* event) default: return; // if no button is pressed the function returns here } - Pos p(tick, true); + MusECore::Pos p(tick, true); if(i== 0 && (event->modifiers() & Qt::ShiftModifier )) { // If shift +LMB we add a marker - Marker *alreadyExists = song->getMarkerAt(tick); + MusECore::Marker *alreadyExists = MusEGlobal::song->getMarkerAt(tick); if (!alreadyExists) - song->addMarker(QString(""), tick, false); + MusEGlobal::song->addMarker(QString(""), tick, false); } else if (i== 2 && (event->modifiers() & Qt::ShiftModifier )) { // If shift +RMB we remove a marker - Marker *toRemove = song->getMarkerAt(tick); + MusECore::Marker *toRemove = MusEGlobal::song->getMarkerAt(tick); if (toRemove) - song->removeMarker(toRemove); + MusEGlobal::song->removeMarker(toRemove); else printf("No marker to remove\n"); } else - song->setPos(i, p); // all other cases: relocating one of the locators + MusEGlobal::song->setPos(i, p); // all other cases: relocating one of the locators } @@ -191,18 +191,18 @@ void MTScaleFlo::draw(QPainter& p, const QRect& r) int y = 12; p.setPen(Qt::black); - p.setFont(MusEConfig::config.fonts[4]); + p.setFont(MusEGlobal::config.fonts[4]); p.drawLine(r.x(), y+1, r.x() + r.width(), y+1); QRect tr(r); tr.setHeight(12); - MarkerList* marker = song->marker(); - for (iMarker m = marker->begin(); m != marker->end(); ++m) { + MusECore::MarkerList* marker = MusEGlobal::song->marker(); + for (MusECore::iMarker m = marker->begin(); m != marker->end(); ++m) { int xp = parent->tick_to_x(m->second.tick()) + xoffset - xpos; if (xp > x+w) break; int xe = r.x() + r.width(); - iMarker mm = m; + MusECore::iMarker mm = m; ++mm; if (mm != marker->end()) xe = parent->tick_to_x(mm->first) + xoffset - xpos; @@ -290,7 +290,7 @@ void MTScaleFlo::draw(QPainter& p, const QRect& r) n = 32; if (bar % n) continue; - p.setFont(MusEConfig::config.fonts[3]); + p.setFont(MusEGlobal::config.fonts[3]); int x = parent->tick_to_x(stick) + xoffset - xpos; QString s; s.setNum(bar + 1); @@ -311,12 +311,12 @@ void MTScaleFlo::draw(QPainter& p, const QRect& r) if (beat == 0) { num = bar + 1; y1 = y + 1; - p.setFont(MusEConfig::config.fonts[3]); + p.setFont(MusEGlobal::config.fonts[3]); } else { num = beat + 1; y1 = y + 7; - p.setFont(MusEConfig::config.fonts[1]); + p.setFont(MusEGlobal::config.fonts[1]); r.setY(y+3); } s.setNum(num); @@ -344,4 +344,4 @@ void MTScaleFlo::pos_add_changed() redraw(); } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/mtscale_flo.h b/muse2/muse/widgets/mtscale_flo.h index b7169ab6..9a0b414e 100644 --- a/muse2/muse/widgets/mtscale_flo.h +++ b/muse2/muse/widgets/mtscale_flo.h @@ -26,9 +26,9 @@ #include "view.h" -class ScoreCanvas; +namespace MusEGui { -namespace MusEWidget { +class ScoreCanvas; //--------------------------------------------------------- // MTScaleFlo @@ -65,7 +65,7 @@ class MTScaleFlo : public View { MTScaleFlo(ScoreCanvas* parent_editor, QWidget* parent_widget); }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/musewidgetsplug.cpp b/muse2/muse/widgets/musewidgetsplug.cpp index 01cc68b3..26a3054d 100644 --- a/muse2/muse/widgets/musewidgetsplug.cpp +++ b/muse2/muse/widgets/musewidgetsplug.cpp @@ -43,7 +43,7 @@ int sampleRate = 44100; // some dummy values to get things compiled/linked int division = 384; -int mtcType = 0; +int MusEGlobal::mtcType = 0; bool hIsB = false; static const char* vall[] = { diff --git a/muse2/muse/widgets/nentry.cpp b/muse2/muse/widgets/nentry.cpp index a70b1a54..e1ff4a1c 100644 --- a/muse2/muse/widgets/nentry.cpp +++ b/muse2/muse/widgets/nentry.cpp @@ -37,7 +37,7 @@ #define TIMEC2 20 #define TIMER4 50 -namespace MusEWidget { +namespace MusEGui { NentryFilter::NentryFilter(QObject* parent) : QObject(parent) @@ -255,7 +255,7 @@ void Nentry::repeat() switch (button) { case Qt::LeftButton: - if (!MusEConfig::config.leftMouseButtonCanDecrease) + if (!MusEGlobal::config.leftMouseButtonCanDecrease) return; // else fall through case Qt::MidButton: @@ -419,4 +419,4 @@ bool Nentry::keyPress(QKeyEvent* event) return true; } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/nentry.h b/muse2/muse/widgets/nentry.h index c0508c63..dab5278a 100644 --- a/muse2/muse/widgets/nentry.h +++ b/muse2/muse/widgets/nentry.h @@ -30,7 +30,7 @@ class QLabel; class QLineEdit; class QTimer; -namespace MusEWidget { +namespace MusEGui { class NentryFilter : public QObject { Q_OBJECT @@ -99,6 +99,6 @@ class Nentry : public QFrame { bool contextMenu(QContextMenuEvent*); }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/noteinfo.cpp b/muse2/muse/widgets/noteinfo.cpp index 2a262723..1411b7b5 100644 --- a/muse2/muse/widgets/noteinfo.cpp +++ b/muse2/muse/widgets/noteinfo.cpp @@ -31,7 +31,7 @@ ///#include "posedit.h" #include "pitchedit.h" -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------- // NoteInfo @@ -105,7 +105,7 @@ NoteInfo::NoteInfo(QWidget* parent) connect(selPitch, SIGNAL(valueChanged(int)), SLOT(pitchChanged(int))); connect(selVelOn, SIGNAL(valueChanged(int)), SLOT(velOnChanged(int))); connect(selVelOff, SIGNAL(valueChanged(int)), SLOT(velOffChanged(int))); - connect(selTime, SIGNAL(valueChanged(const Pos&)), SLOT(timeChanged(const Pos&))); + connect(selTime, SIGNAL(valueChanged(const MusECore::Pos&)), SLOT(timeChanged(const MusECore::Pos&))); } //--------------------------------------------------------- @@ -220,10 +220,10 @@ void NoteInfo::setValues(unsigned tick, int val2, int val3, int val4, // timeChanged //--------------------------------------------------------- -void NoteInfo::timeChanged(const Pos& pos) +void NoteInfo::timeChanged(const MusECore::Pos& pos) { if (!signalsBlocked()) emit valueChanged(VAL_TIME, pos.tick()); } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/noteinfo.h b/muse2/muse/widgets/noteinfo.h index 9d33db6b..078ba85c 100644 --- a/muse2/muse/widgets/noteinfo.h +++ b/muse2/muse/widgets/noteinfo.h @@ -32,9 +32,11 @@ namespace Awl { class QSpinBox; ///class PosEdit; +namespace MusECore { class Pos; +} -namespace MusEWidget { +namespace MusEGui { class PitchEdit; @@ -67,16 +69,16 @@ class NoteInfo : public QToolBar { void velOnChanged(int); void velOffChanged(int); void pitchChanged(int); - void timeChanged(const Pos&); + void timeChanged(const MusECore::Pos&); public slots: void setValue(ValType, int); signals: - void valueChanged(MusEWidget::NoteInfo::ValType, int); + void valueChanged(MusEGui::NoteInfo::ValType, int); }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/pastedialog.cpp b/muse2/muse/widgets/pastedialog.cpp index bc031b30..5b582f30 100644 --- a/muse2/muse/widgets/pastedialog.cpp +++ b/muse2/muse/widgets/pastedialog.cpp @@ -25,9 +25,9 @@ #include "xml.h" #include "gconfig.h" -using MusEConfig::config; +using MusEGlobal::config; -namespace MusEDialog { +namespace MusEGui { PasteDialog::PasteDialog(QWidget* parent) : QDialog(parent) @@ -103,18 +103,18 @@ void PasteDialog::number_changed(int n) } -void PasteDialog::read_configuration(Xml& xml) +void PasteDialog::read_configuration(MusECore::Xml& xml) { for (;;) { - Xml::Token token = xml.parse(); - if (token == Xml::Error || token == Xml::End) + MusECore::Xml::Token token = xml.parse(); + if (token == MusECore::Xml::Error || token == MusECore::Xml::End) break; const QString& tag = xml.s1(); switch (token) { - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "insert_method") insert_method=xml.parseInt(); else if (tag == "number") @@ -129,7 +129,7 @@ void PasteDialog::read_configuration(Xml& xml) xml.unknown("PasteDialog"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "pastedialog") return; @@ -139,7 +139,7 @@ void PasteDialog::read_configuration(Xml& xml) } } -void PasteDialog::write_configuration(int level, Xml& xml) +void PasteDialog::write_configuration(int level, MusECore::Xml& xml) { xml.tag(level++, "pastedialog"); xml.intTag(level, "insert_method", insert_method); @@ -150,4 +150,4 @@ void PasteDialog::write_configuration(int level, Xml& xml) xml.tag(level, "/pastedialog"); } -} // namespace MusEDialog +} // namespace MusEGui diff --git a/muse2/muse/widgets/pastedialog.h b/muse2/muse/widgets/pastedialog.h index 39121964..af28d3b1 100644 --- a/muse2/muse/widgets/pastedialog.h +++ b/muse2/muse/widgets/pastedialog.h @@ -26,9 +26,11 @@ #include "ui_pastedialogbase.h" #include <QString> +namespace MusECore { class Xml; +} -namespace MusEDialog { +namespace MusEGui { class PasteDialog : public QDialog, public Ui::PasteDialogBase { @@ -53,15 +55,15 @@ class PasteDialog : public QDialog, public Ui::PasteDialogBase bool all_in_one_track; bool clone; - void read_configuration(Xml& xml); - void write_configuration(int level, Xml& xml); + void read_configuration(MusECore::Xml& xml); + void write_configuration(int level, MusECore::Xml& xml); public slots: int exec(); }; -} // namespace MusEDialog +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/pasteeventsdialog.cpp b/muse2/muse/widgets/pasteeventsdialog.cpp index e8436711..48782e25 100644 --- a/muse2/muse/widgets/pasteeventsdialog.cpp +++ b/muse2/muse/widgets/pasteeventsdialog.cpp @@ -25,9 +25,9 @@ #include "xml.h" #include "gconfig.h" -using MusEConfig::config; +using MusEGlobal::config; -namespace MusEDialog { +namespace MusEGui { PasteEventsDialog::PasteEventsDialog(QWidget* parent) : QDialog(parent) @@ -122,18 +122,18 @@ void PasteEventsDialog::number_changed(int n) } -void PasteEventsDialog::read_configuration(Xml& xml) +void PasteEventsDialog::read_configuration(MusECore::Xml& xml) { for (;;) { - Xml::Token token = xml.parse(); - if (token == Xml::Error || token == Xml::End) + MusECore::Xml::Token token = xml.parse(); + if (token == MusECore::Xml::Error || token == MusECore::Xml::End) break; const QString& tag = xml.s1(); switch (token) { - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "number") number=xml.parseInt(); else if (tag == "raster") @@ -150,7 +150,7 @@ void PasteEventsDialog::read_configuration(Xml& xml) xml.unknown("PasteEventsDialog"); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "pasteeventsdialog") return; @@ -160,7 +160,7 @@ void PasteEventsDialog::read_configuration(Xml& xml) } } -void PasteEventsDialog::write_configuration(int level, Xml& xml) +void PasteEventsDialog::write_configuration(int level, MusECore::Xml& xml) { xml.tag(level++, "pasteeventsdialog"); xml.intTag(level, "number", number); @@ -172,4 +172,4 @@ void PasteEventsDialog::write_configuration(int level, Xml& xml) xml.tag(level, "/pasteeventsdialog"); } -} // namespace MusEDialog +} // namespace MusEGui diff --git a/muse2/muse/widgets/pasteeventsdialog.h b/muse2/muse/widgets/pasteeventsdialog.h index 59e6f52b..e22a3693 100644 --- a/muse2/muse/widgets/pasteeventsdialog.h +++ b/muse2/muse/widgets/pasteeventsdialog.h @@ -26,9 +26,11 @@ #include "ui_pasteeventsdialogbase.h" #include <QString> +namespace MusECore { class Xml; +} -namespace MusEDialog { +namespace MusEGui { class PasteEventsDialog : public QDialog, public Ui::PasteEventsDialogBase { @@ -55,15 +57,15 @@ class PasteEventsDialog : public QDialog, public Ui::PasteEventsDialogBase bool into_single_part; bool into_single_part_allowed; - void read_configuration(Xml& xml); - void write_configuration(int level, Xml& xml); + void read_configuration(MusECore::Xml& xml); + void write_configuration(int level, MusECore::Xml& xml); public slots: int exec(); }; -} // namespace MusEDialog +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/pitchedit.cpp b/muse2/muse/widgets/pitchedit.cpp index 4b937237..3cbe882e 100644 --- a/muse2/muse/widgets/pitchedit.cpp +++ b/muse2/muse/widgets/pitchedit.cpp @@ -24,7 +24,7 @@ #include "pitchedit.h" #include "helper.h" -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // PitchEdit @@ -51,7 +51,7 @@ QString PitchEdit::mapValueToText(int v) return s; } else - return MusEUtil::pitch2string(v); + return MusECore::pitch2string(v); } //--------------------------------------------------------- @@ -79,4 +79,4 @@ void PitchEdit::setDeltaMode(bool val) setRange(0, 127); } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/pitchedit.h b/muse2/muse/widgets/pitchedit.h index d5bb7654..bcd77100 100644 --- a/muse2/muse/widgets/pitchedit.h +++ b/muse2/muse/widgets/pitchedit.h @@ -25,7 +25,7 @@ #include <QSpinBox> -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // PitchEdit @@ -45,6 +45,6 @@ class PitchEdit : public QSpinBox { void setDeltaMode(bool); }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/pitchlabel.cpp b/muse2/muse/widgets/pitchlabel.cpp index b1b9c1f1..1ab5aa8e 100644 --- a/muse2/muse/widgets/pitchlabel.cpp +++ b/muse2/muse/widgets/pitchlabel.cpp @@ -27,7 +27,7 @@ #include "pitchlabel.h" #include "helper.h" -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // PitchLabel @@ -83,7 +83,7 @@ void PitchLabel::setValue(int val) _value = val; QString s; if (_pitchMode) - s = MusEUtil::pitch2string(_value); + s = MusECore::pitch2string(_value); else s.sprintf("%d", _value); setText(s); @@ -112,4 +112,4 @@ void PitchLabel::setPitch(int val) setValue(val); } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/pitchlabel.h b/muse2/muse/widgets/pitchlabel.h index 3fe2eb42..8300357a 100644 --- a/muse2/muse/widgets/pitchlabel.h +++ b/muse2/muse/widgets/pitchlabel.h @@ -25,7 +25,7 @@ #include <QLabel> -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // PitchLabel @@ -53,7 +53,7 @@ class PitchLabel : public QLabel { bool pitchMode() const { return _pitchMode; } }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/popupmenu.cpp b/muse2/muse/widgets/popupmenu.cpp index 2b0b6711..af546ec3 100644 --- a/muse2/muse/widgets/popupmenu.cpp +++ b/muse2/muse/widgets/popupmenu.cpp @@ -41,7 +41,7 @@ #include "route.h" -namespace MusEWidget { +namespace MusEGui { //====================== // PopupMenu @@ -152,9 +152,9 @@ QAction* PopupMenu::findActionFromData(const QVariant& v) const // are not called. Instead the values' addresses are compared." // // Take care of struct Route first. Insert other future custom structures here too ! - if(act->data().canConvert<Route>() && v.canConvert<Route>()) + if(act->data().canConvert<MusECore::Route>() && v.canConvert<MusECore::Route>()) { - if(act->data().value<Route>() == v.value<Route>()) + if(act->data().value<MusECore::Route>() == v.value<MusECore::Route>()) return act; } else @@ -174,7 +174,7 @@ bool PopupMenu::event(QEvent* event) case QEvent::MouseButtonDblClick: { if(_stayOpen) - //if(_stayOpen && MusEConfig::config.popupsDefaultStayOpen) + //if(_stayOpen && MusEGlobal::config.popupsDefaultStayOpen) { QMouseEvent* e = static_cast<QMouseEvent*>(event); if(e->modifiers() == Qt::NoModifier) @@ -193,7 +193,7 @@ bool PopupMenu::event(QEvent* event) case QEvent::KeyPress: { if(_stayOpen) - //if(_stayOpen && MusEConfig::config.popupsDefaultStayOpen) + //if(_stayOpen && MusEGlobal::config.popupsDefaultStayOpen) { QKeyEvent* e = static_cast<QKeyEvent*>(event); if(e->modifiers() == Qt::NoModifier && e->key() == Qt::Key_Space) @@ -347,7 +347,7 @@ void PopupMenu::mouseReleaseEvent(QMouseEvent *e) #else // Check for Ctrl to stay open. - if(!_stayOpen || (!MusEConfig::config.popupsDefaultStayOpen && (e->modifiers() & Qt::ControlModifier) == 0)) + if(!_stayOpen || (!MusEGlobal::config.popupsDefaultStayOpen && (e->modifiers() & Qt::ControlModifier) == 0)) { QMenu::mouseReleaseEvent(e); return; @@ -390,4 +390,4 @@ void PopupView::clear() } */ -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/popupmenu.h b/muse2/muse/widgets/popupmenu.h index b51cfd56..7fc07698 100644 --- a/muse2/muse/widgets/popupmenu.h +++ b/muse2/muse/widgets/popupmenu.h @@ -47,7 +47,7 @@ class QEvent; //class QTimer; //class QStandardItemModel; -namespace MusEWidget { +namespace MusEGui { class PopupMenu : public QMenu { @@ -101,7 +101,7 @@ class PopupView : public QColumnView }; */ -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/posedit.cpp b/muse2/muse/widgets/posedit.cpp index 772d434a..b1637da8 100644 --- a/muse2/muse/widgets/posedit.cpp +++ b/muse2/muse/widgets/posedit.cpp @@ -36,9 +36,9 @@ #include "sig.h" #include "spinbox.h" -extern int mtcType; +extern int MusEGlobal::mtcType; -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // QNumberSection @@ -644,7 +644,7 @@ void PosEdit::setSec(int secNo, int val) val = 59; break; case 2: - switch(mtcType) { + switch(MusEGlobal::mtcType) { case 0: // 24 frames sec if (val > 23) val = 23; @@ -719,7 +719,7 @@ bool PosEdit::outOfRange(int secNo, int val) const limit = 59; break; case 2: - switch(mtcType) { + switch(MusEGlobal::mtcType) { case 0: // 24 frames sec limit = 23; break; @@ -871,4 +871,4 @@ void PosEdit::setEnabled(bool v) updateButtons(); } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/posedit.h b/muse2/muse/widgets/posedit.h index 5f763f51..1b013a11 100644 --- a/muse2/muse/widgets/posedit.h +++ b/muse2/muse/widgets/posedit.h @@ -34,7 +34,7 @@ class QTimerEvent; class PosEditor; class SpinBox; -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // PosEdit @@ -118,6 +118,6 @@ class PosEdit : public QWidget void enterPressed(); }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/poslabel.cpp b/muse2/muse/widgets/poslabel.cpp index 98a7eba3..6cdcb27e 100644 --- a/muse2/muse/widgets/poslabel.cpp +++ b/muse2/muse/widgets/poslabel.cpp @@ -33,9 +33,11 @@ #include "tempo.h" #include "globals.h" +namespace MusEGlobal { extern int mtcType; +} -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // PosLabel @@ -87,7 +89,7 @@ void PosLabel::updateValue() int min = int(time) / 60; int sec = int(time) % 60; double rest = time - (min * 60 + sec); - switch(mtcType) { + switch(MusEGlobal::mtcType) { case 0: // 24 frames sec rest *= 24; break; @@ -165,10 +167,10 @@ void PosLabel::setSmpte(bool val) { _smpte = val; if (val) - _sampleValue = tempomap.tick2frame(_tickValue); + _sampleValue = MusEGlobal::tempomap.tick2frame(_tickValue); else - _tickValue = tempomap.frame2tick(_sampleValue); + _tickValue = MusEGlobal::tempomap.frame2tick(_sampleValue); updateValue(); } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/poslabel.h b/muse2/muse/widgets/poslabel.h index 38236ac7..3662c82e 100644 --- a/muse2/muse/widgets/poslabel.h +++ b/muse2/muse/widgets/poslabel.h @@ -25,7 +25,7 @@ #include <QLabel> -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // PosLabel @@ -58,7 +58,7 @@ class PosLabel : public QLabel { bool smpte() const { return _smpte; } }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/projectcreateimpl.cpp b/muse2/muse/widgets/projectcreateimpl.cpp index d6f918b3..31973101 100644 --- a/muse2/muse/widgets/projectcreateimpl.cpp +++ b/muse2/muse/widgets/projectcreateimpl.cpp @@ -28,14 +28,14 @@ #include "globals.h" #include "app.h" -namespace MusEWidget { +namespace MusEGui { ProjectCreateImpl::ProjectCreateImpl(QWidget *parent) : QDialog(parent) { setupUi(this); - createFolderCheckbox->setChecked(MusEConfig::config.projectStoreInFolder); + createFolderCheckbox->setChecked(MusEGlobal::config.projectStoreInFolder); connect(browseDirButton,SIGNAL(clicked()), this, SLOT(selectDirectory())); connect(projectNameEdit,SIGNAL(textChanged(QString)), this, SLOT(updateDirectoryPath())); connect(createFolderCheckbox,SIGNAL(clicked()), this, SLOT(updateDirectoryPath())); @@ -46,7 +46,7 @@ ProjectCreateImpl::ProjectCreateImpl(QWidget *parent) : // as of Qt-4.7.1 //commentEdit->setPlaceholderText("<Add information about project here>"); #endif - directoryPath = MusEConfig::config.projectBaseFolder; + directoryPath = MusEGlobal::config.projectBaseFolder; updateDirectoryPath(); show(); } @@ -88,10 +88,10 @@ QString ProjectCreateImpl::getSongInfo() } void ProjectCreateImpl::ok() { - MusEConfig::config.projectStoreInFolder = createFolderCheckbox->isChecked(); - MusEConfig::config.projectBaseFolder = directoryPath; + MusEGlobal::config.projectStoreInFolder = createFolderCheckbox->isChecked(); + MusEGlobal::config.projectBaseFolder = directoryPath; MusEGlobal::muse->changeConfig(true); emit accept(); } -} //namespace MusEWidget +} //namespace MusEGui diff --git a/muse2/muse/widgets/projectcreateimpl.h b/muse2/muse/widgets/projectcreateimpl.h index d6881840..258b0921 100644 --- a/muse2/muse/widgets/projectcreateimpl.h +++ b/muse2/muse/widgets/projectcreateimpl.h @@ -26,7 +26,7 @@ #include <QDialog> #include "ui_projectcreate.h" -namespace MusEWidget { +namespace MusEGui { class ProjectCreateImpl : public QDialog, Ui::ProjectCreate { @@ -47,6 +47,6 @@ public slots: }; -} // namespace MusEWidget +} // namespace MusEGui #endif // PROJECTCREATEIMPL_H diff --git a/muse2/muse/widgets/routepopup.cpp b/muse2/muse/widgets/routepopup.cpp index 0336f8ed..799d9079 100644 --- a/muse2/muse/widgets/routepopup.cpp +++ b/muse2/muse/widgets/routepopup.cpp @@ -34,16 +34,16 @@ #include "menutitleitem.h" #include "popupmenu.h" -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // addMenuItem //--------------------------------------------------------- -int RoutePopupMenu::addMenuItem(AudioTrack* track, Track* route_track, PopupMenu* lb, int id, int channel, int channels, bool isOutput) +int RoutePopupMenu::addMenuItem(MusECore::AudioTrack* track, MusECore::Track* route_track, PopupMenu* lb, int id, int channel, int channels, bool isOutput) { // totalInChannels is only used by syntis. - int toch = ((AudioTrack*)track)->totalOutChannels(); + int toch = ((MusECore::AudioTrack*)track)->totalOutChannels(); // If track channels = 1, it must be a mono synth. And synti channels cannot be changed by user. if(track->channels() == 1) toch = 1; @@ -52,7 +52,7 @@ int RoutePopupMenu::addMenuItem(AudioTrack* track, Track* route_track, PopupMenu //if(route_track->channels() > 1 && (channel+1 == chans)) // return id; - RouteList* rl = isOutput ? track->outRoutes() : track->inRoutes(); + MusECore::RouteList* rl = isOutput ? track->outRoutes() : track->inRoutes(); QAction* act; @@ -64,15 +64,15 @@ int RoutePopupMenu::addMenuItem(AudioTrack* track, Track* route_track, PopupMenu int ach = channel; int bch = -1; - Route r(route_track, isOutput ? ach : bch, channels); + MusECore::Route r(route_track, isOutput ? ach : bch, channels); r.remoteChannel = isOutput ? bch : ach; act->setData(qVariantFromValue(r)); - for(ciRoute ir = rl->begin(); ir != rl->end(); ++ir) + for(MusECore::ciRoute ir = rl->begin(); ir != rl->end(); ++ir) { - if(ir->type == Route::TRACK_ROUTE && ir->track == route_track && ir->remoteChannel == r.remoteChannel) + if(ir->type == MusECore::Route::TRACK_ROUTE && ir->track == route_track && ir->remoteChannel == r.remoteChannel) { int tcompch = r.channel; if(tcompch == -1) @@ -102,11 +102,11 @@ int RoutePopupMenu::addMenuItem(AudioTrack* track, Track* route_track, PopupMenu // addAuxPorts //--------------------------------------------------------- -int RoutePopupMenu::addAuxPorts(AudioTrack* t, PopupMenu* lb, int id, int channel, int channels, bool isOutput) +int RoutePopupMenu::addAuxPorts(MusECore::AudioTrack* t, PopupMenu* lb, int id, int channel, int channels, bool isOutput) { - AuxList* al = song->auxs(); - for (iAudioAux i = al->begin(); i != al->end(); ++i) { - Track* track = *i; + MusECore::AuxList* al = MusEGlobal::song->auxs(); + for (MusECore::iAudioAux i = al->begin(); i != al->end(); ++i) { + MusECore::Track* track = *i; if (t == track) continue; id = addMenuItem(t, track, lb, id, channel, channels, isOutput); @@ -118,11 +118,11 @@ int RoutePopupMenu::addAuxPorts(AudioTrack* t, PopupMenu* lb, int id, int channe // addInPorts //--------------------------------------------------------- -int RoutePopupMenu::addInPorts(AudioTrack* t, PopupMenu* lb, int id, int channel, int channels, bool isOutput) +int RoutePopupMenu::addInPorts(MusECore::AudioTrack* t, PopupMenu* lb, int id, int channel, int channels, bool isOutput) { - InputList* al = song->inputs(); - for (iAudioInput i = al->begin(); i != al->end(); ++i) { - Track* track = *i; + MusECore::InputList* al = MusEGlobal::song->inputs(); + for (MusECore::iAudioInput i = al->begin(); i != al->end(); ++i) { + MusECore::Track* track = *i; if (t == track) continue; id = addMenuItem(t, track, lb, id, channel, channels, isOutput); @@ -134,11 +134,11 @@ int RoutePopupMenu::addInPorts(AudioTrack* t, PopupMenu* lb, int id, int channel // addOutPorts //--------------------------------------------------------- -int RoutePopupMenu::addOutPorts(AudioTrack* t, PopupMenu* lb, int id, int channel, int channels, bool isOutput) +int RoutePopupMenu::addOutPorts(MusECore::AudioTrack* t, PopupMenu* lb, int id, int channel, int channels, bool isOutput) { - OutputList* al = song->outputs(); - for (iAudioOutput i = al->begin(); i != al->end(); ++i) { - Track* track = *i; + MusECore::OutputList* al = MusEGlobal::song->outputs(); + for (MusECore::iAudioOutput i = al->begin(); i != al->end(); ++i) { + MusECore::Track* track = *i; if (t == track) continue; id = addMenuItem(t, track, lb, id, channel, channels, isOutput); @@ -150,11 +150,11 @@ int RoutePopupMenu::addOutPorts(AudioTrack* t, PopupMenu* lb, int id, int channe // addGroupPorts //--------------------------------------------------------- -int RoutePopupMenu::addGroupPorts(AudioTrack* t, PopupMenu* lb, int id, int channel, int channels, bool isOutput) +int RoutePopupMenu::addGroupPorts(MusECore::AudioTrack* t, PopupMenu* lb, int id, int channel, int channels, bool isOutput) { - GroupList* al = song->groups(); - for (iAudioGroup i = al->begin(); i != al->end(); ++i) { - Track* track = *i; + MusECore::GroupList* al = MusEGlobal::song->groups(); + for (MusECore::iAudioGroup i = al->begin(); i != al->end(); ++i) { + MusECore::Track* track = *i; if (t == track) continue; id = addMenuItem(t, track, lb, id, channel, channels, isOutput); @@ -166,11 +166,11 @@ int RoutePopupMenu::addGroupPorts(AudioTrack* t, PopupMenu* lb, int id, int chan // addWavePorts //--------------------------------------------------------- -int RoutePopupMenu::addWavePorts(AudioTrack* t, PopupMenu* lb, int id, int channel, int channels, bool isOutput) +int RoutePopupMenu::addWavePorts(MusECore::AudioTrack* t, PopupMenu* lb, int id, int channel, int channels, bool isOutput) { - WaveTrackList* al = song->waves(); - for (iWaveTrack i = al->begin(); i != al->end(); ++i) { - Track* track = *i; + MusECore::WaveTrackList* al = MusEGlobal::song->waves(); + for (MusECore::iWaveTrack i = al->begin(); i != al->end(); ++i) { + MusECore::Track* track = *i; if (t == track) continue; id = addMenuItem(t, track, lb, id, channel, channels, isOutput); @@ -182,26 +182,26 @@ int RoutePopupMenu::addWavePorts(AudioTrack* t, PopupMenu* lb, int id, int chann // addSyntiPorts //--------------------------------------------------------- -int RoutePopupMenu::addSyntiPorts(AudioTrack* t, PopupMenu* lb, int id, +int RoutePopupMenu::addSyntiPorts(MusECore::AudioTrack* t, PopupMenu* lb, int id, int channel, int channels, bool isOutput) { - RouteList* rl = isOutput ? t->outRoutes() : t->inRoutes(); + MusECore::RouteList* rl = isOutput ? t->outRoutes() : t->inRoutes(); QAction* act; - SynthIList* al = song->syntis(); - for (iSynthI i = al->begin(); i != al->end(); ++i) + MusECore::SynthIList* al = MusEGlobal::song->syntis(); + for (MusECore::iSynthI i = al->begin(); i != al->end(); ++i) { - Track* track = *i; + MusECore::Track* track = *i; if (t == track) continue; - int toch = ((AudioTrack*)track)->totalOutChannels(); + int toch = ((MusECore::AudioTrack*)track)->totalOutChannels(); // If track channels = 1, it must be a mono synth. And synti channels cannot be changed by user. if(track->channels() == 1) toch = 1; // totalInChannels is only used by syntis. - int chans = (!isOutput || track->type() != Track::AUDIO_SOFTSYNTH) ? toch : ((AudioTrack*)track)->totalInChannels(); + int chans = (!isOutput || track->type() != MusECore::Track::AUDIO_SOFTSYNTH) ? toch : ((MusECore::AudioTrack*)track)->totalInChannels(); int tchans = (channels != -1) ? channels: t->channels(); if(tchans == 2) @@ -229,14 +229,14 @@ int RoutePopupMenu::addSyntiPorts(AudioTrack* t, PopupMenu* lb, int id, int ach = (channel == -1) ? ch : channel; int bch = (channel == -1) ? -1 : ch; - Route rt(track, (t->type() != Track::AUDIO_SOFTSYNTH || isOutput) ? ach : bch, tchans); - rt.remoteChannel = (t->type() != Track::AUDIO_SOFTSYNTH || isOutput) ? bch : ach; + MusECore::Route rt(track, (t->type() != MusECore::Track::AUDIO_SOFTSYNTH || isOutput) ? ach : bch, tchans); + rt.remoteChannel = (t->type() != MusECore::Track::AUDIO_SOFTSYNTH || isOutput) ? bch : ach; act->setData(qVariantFromValue(rt)); - for(ciRoute ir = rl->begin(); ir != rl->end(); ++ir) + for(MusECore::ciRoute ir = rl->begin(); ir != rl->end(); ++ir) { - if(ir->type == Route::TRACK_ROUTE && ir->track == track && ir->remoteChannel == rt.remoteChannel) + if(ir->type == MusECore::Route::TRACK_ROUTE && ir->track == track && ir->remoteChannel == rt.remoteChannel) { int tcompch = rt.channel; if(tcompch == -1) @@ -272,7 +272,7 @@ int RoutePopupMenu::addSyntiPorts(AudioTrack* t, PopupMenu* lb, int id, // addMultiChannelOutPorts //--------------------------------------------------------- -int RoutePopupMenu::addMultiChannelPorts(AudioTrack* t, PopupMenu* pup, int id, bool isOutput) +int RoutePopupMenu::addMultiChannelPorts(MusECore::AudioTrack* t, PopupMenu* pup, int id, bool isOutput) { int toch = t->totalOutChannels(); // If track channels = 1, it must be a mono synth. And synti channels cannot be changed by user. @@ -281,7 +281,7 @@ int RoutePopupMenu::addMultiChannelPorts(AudioTrack* t, PopupMenu* pup, int id, // Number of allocated buffers is always MAX_CHANNELS or more, even if _totalOutChannels is less. // totalInChannels is only used by syntis. - int chans = (isOutput || t->type() != Track::AUDIO_SOFTSYNTH) ? toch : t->totalInChannels(); + int chans = (isOutput || t->type() != MusECore::Track::AUDIO_SOFTSYNTH) ? toch : t->totalInChannels(); if(chans > 1) pup->addAction(new MenuTitleItem("<Mono>", pup)); @@ -303,11 +303,11 @@ int RoutePopupMenu::addMultiChannelPorts(AudioTrack* t, PopupMenu* pup, int id, switch(t->type()) { - case Track::AUDIO_INPUT: - case Track::WAVE: - case Track::AUDIO_GROUP: - case Track::AUDIO_SOFTSYNTH: - case Track::AUDIO_AUX: + case MusECore::Track::AUDIO_INPUT: + case MusECore::Track::WAVE: + case MusECore::Track::AUDIO_GROUP: + case MusECore::Track::AUDIO_SOFTSYNTH: + case MusECore::Track::AUDIO_AUX: id = addWavePorts(t, chpup, id, ch, 1, isOutput); id = addOutPorts(t, chpup, id, ch, 1, isOutput); id = addGroupPorts(t, chpup, id, ch, 1, isOutput); @@ -322,16 +322,16 @@ int RoutePopupMenu::addMultiChannelPorts(AudioTrack* t, PopupMenu* pup, int id, switch(t->type()) { - case Track::AUDIO_OUTPUT: + case MusECore::Track::AUDIO_OUTPUT: id = addWavePorts(t, chpup, id, ch, 1, isOutput); id = addInPorts(t, chpup, id, ch, 1, isOutput); id = addGroupPorts(t, chpup, id, ch, 1, isOutput); id = addAuxPorts(t, chpup, id, ch, 1, isOutput); id = addSyntiPorts(t, chpup, id, ch, 1, isOutput); break; - case Track::WAVE: - case Track::AUDIO_SOFTSYNTH: - case Track::AUDIO_GROUP: + case MusECore::Track::WAVE: + case MusECore::Track::AUDIO_SOFTSYNTH: + case MusECore::Track::AUDIO_GROUP: id = addWavePorts(t, chpup, id, ch, 1, isOutput); id = addInPorts(t, chpup, id, ch, 1, isOutput); id = addGroupPorts(t, chpup, id, ch, 1, isOutput); @@ -382,11 +382,11 @@ int RoutePopupMenu::addMultiChannelPorts(AudioTrack* t, PopupMenu* pup, int id, { switch(t->type()) { - case Track::AUDIO_INPUT: - case Track::WAVE: - case Track::AUDIO_GROUP: - case Track::AUDIO_SOFTSYNTH: - case Track::AUDIO_AUX: + case MusECore::Track::AUDIO_INPUT: + case MusECore::Track::WAVE: + case MusECore::Track::AUDIO_GROUP: + case MusECore::Track::AUDIO_SOFTSYNTH: + case MusECore::Track::AUDIO_AUX: id = addWavePorts(t, chpup, id, ch, 2, isOutput); id = addOutPorts(t, chpup, id, ch, 2, isOutput); id = addGroupPorts(t, chpup, id, ch, 2, isOutput); @@ -400,16 +400,16 @@ int RoutePopupMenu::addMultiChannelPorts(AudioTrack* t, PopupMenu* pup, int id, { switch(t->type()) { - case Track::AUDIO_OUTPUT: + case MusECore::Track::AUDIO_OUTPUT: id = addWavePorts(t, chpup, id, ch, 2, isOutput); id = addInPorts(t, chpup, id, ch, 2, isOutput); id = addGroupPorts(t, chpup, id, ch, 2, isOutput); id = addAuxPorts(t, chpup, id, ch, 2, isOutput); id = addSyntiPorts(t, chpup, id, ch, 2, isOutput); break; - case Track::WAVE: - case Track::AUDIO_SOFTSYNTH: - case Track::AUDIO_GROUP: + case MusECore::Track::WAVE: + case MusECore::Track::AUDIO_SOFTSYNTH: + case MusECore::Track::AUDIO_GROUP: id = addWavePorts(t, chpup, id, ch, 2, isOutput); id = addInPorts(t, chpup, id, ch, 2, isOutput); id = addGroupPorts(t, chpup, id, ch, 2, isOutput); @@ -439,25 +439,25 @@ int RoutePopupMenu::addMultiChannelPorts(AudioTrack* t, PopupMenu* pup, int id, // nonSyntiTrackAddSyntis //--------------------------------------------------------- -int RoutePopupMenu::nonSyntiTrackAddSyntis(AudioTrack* t, PopupMenu* lb, int id, bool isOutput) +int RoutePopupMenu::nonSyntiTrackAddSyntis(MusECore::AudioTrack* t, PopupMenu* lb, int id, bool isOutput) { - RouteList* rl = isOutput ? t->outRoutes() : t->inRoutes(); + MusECore::RouteList* rl = isOutput ? t->outRoutes() : t->inRoutes(); QAction* act; - SynthIList* al = song->syntis(); - for (iSynthI i = al->begin(); i != al->end(); ++i) + MusECore::SynthIList* al = MusEGlobal::song->syntis(); + for (MusECore::iSynthI i = al->begin(); i != al->end(); ++i) { - Track* track = *i; + MusECore::Track* track = *i; if (t == track) continue; - int toch = ((AudioTrack*)track)->totalOutChannels(); + int toch = ((MusECore::AudioTrack*)track)->totalOutChannels(); // If track channels = 1, it must be a mono synth. And synti channels cannot be changed by user. if(track->channels() == 1) toch = 1; // totalInChannels is only used by syntis. - int chans = (!isOutput || track->type() != Track::AUDIO_SOFTSYNTH) ? toch : ((AudioTrack*)track)->totalInChannels(); + int chans = (!isOutput || track->type() != MusECore::Track::AUDIO_SOFTSYNTH) ? toch : ((MusECore::AudioTrack*)track)->totalInChannels(); //int schans = synti->channels(); //if(schans < chans) @@ -489,15 +489,15 @@ int RoutePopupMenu::nonSyntiTrackAddSyntis(AudioTrack* t, PopupMenu* lb, int id, int ach = ch; int bch = -1; - Route rt(track, isOutput ? bch : ach, 1); + MusECore::Route rt(track, isOutput ? bch : ach, 1); rt.remoteChannel = isOutput ? ach : bch; act->setData(qVariantFromValue(rt)); - for(ciRoute ir = rl->begin(); ir != rl->end(); ++ir) + for(MusECore::ciRoute ir = rl->begin(); ir != rl->end(); ++ir) { - if(ir->type == Route::TRACK_ROUTE && ir->track == track && ir->remoteChannel == rt.remoteChannel) + if(ir->type == MusECore::Route::TRACK_ROUTE && ir->track == track && ir->remoteChannel == rt.remoteChannel) { int tcompch = rt.channel; if(tcompch == -1) @@ -542,15 +542,15 @@ int RoutePopupMenu::nonSyntiTrackAddSyntis(AudioTrack* t, PopupMenu* lb, int id, int ach = ch; int bch = -1; - Route rt(track, isOutput ? bch : ach, 2); + MusECore::Route rt(track, isOutput ? bch : ach, 2); rt.remoteChannel = isOutput ? ach : bch; act->setData(qVariantFromValue(rt)); - for(ciRoute ir = rl->begin(); ir != rl->end(); ++ir) + for(MusECore::ciRoute ir = rl->begin(); ir != rl->end(); ++ir) { - if(ir->type == Route::TRACK_ROUTE && ir->track == track && ir->remoteChannel == rt.remoteChannel) + if(ir->type == MusECore::Route::TRACK_ROUTE && ir->track == track && ir->remoteChannel == rt.remoteChannel) { int tcompch = rt.channel; if(tcompch == -1) @@ -587,13 +587,13 @@ int RoutePopupMenu::nonSyntiTrackAddSyntis(AudioTrack* t, PopupMenu* lb, int id, // addMidiPorts //--------------------------------------------------------- -int RoutePopupMenu::addMidiPorts(AudioTrack* t, PopupMenu* pup, int id, bool isOutput) +int RoutePopupMenu::addMidiPorts(MusECore::AudioTrack* t, PopupMenu* pup, int id, bool isOutput) { QAction* act; for(int i = 0; i < MIDI_PORTS; ++i) { - MidiPort* mp = &midiPorts[i]; - MidiDevice* md = mp->device(); + MusECore::MidiPort* mp = &MusEGlobal::midiPorts[i]; + MusECore::MidiDevice* md = mp->device(); // This is desirable, but could lead to 'hidden' routes unless we add more support // such as removing the existing routes when user changes flags. @@ -607,7 +607,7 @@ int RoutePopupMenu::addMidiPorts(AudioTrack* t, PopupMenu* pup, int id, bool isO if(md->isSynti()) continue; - RouteList* rl = isOutput ? t->outRoutes() : t->inRoutes(); + MusECore::RouteList* rl = isOutput ? t->outRoutes() : t->inRoutes(); PopupMenu* subp = new PopupMenu(pup, true); subp->setTitle(md->name()); @@ -615,9 +615,9 @@ int RoutePopupMenu::addMidiPorts(AudioTrack* t, PopupMenu* pup, int id, bool isO int chanmask = 0; // To reduce number of routes required, from one per channel to just one containing a channel mask. // Look for the first route to this midi port. There should always be only a single route for each midi port, now. - for(ciRoute ir = rl->begin(); ir != rl->end(); ++ir) + for(MusECore::ciRoute ir = rl->begin(); ir != rl->end(); ++ir) { - if(ir->type == Route::MIDI_PORT_ROUTE && ir->midiPort == i) + if(ir->type == MusECore::Route::MIDI_PORT_ROUTE && ir->midiPort == i) { // We have a route to the midi port. Grab the channel mask. chanmask = ir->channel; @@ -631,7 +631,7 @@ int RoutePopupMenu::addMidiPorts(AudioTrack* t, PopupMenu* pup, int id, bool isO act->setCheckable(true); int chbit = 1 << ch; - Route srcRoute(i, chbit); // In accordance with channel mask, use the bit position. + MusECore::Route srcRoute(i, chbit); // In accordance with channel mask, use the bit position. act->setData(qVariantFromValue(srcRoute)); @@ -644,7 +644,7 @@ int RoutePopupMenu::addMidiPorts(AudioTrack* t, PopupMenu* pup, int id, bool isO //gid = MIDI_PORTS * MIDI_CHANNELS + i; // Make sure each 'toggle' item gets a unique id. act = subp->addAction(QString("Toggle all")); //act->setCheckable(true); - Route togRoute(i, (1 << MIDI_CHANNELS) - 1); // Set all channel bits. + MusECore::Route togRoute(i, (1 << MIDI_CHANNELS) - 1); // Set all channel bits. act->setData(qVariantFromValue(togRoute)); ++id; @@ -658,14 +658,14 @@ int RoutePopupMenu::addMidiPorts(AudioTrack* t, PopupMenu* pup, int id, bool isO // RoutePopupMenu //====================== -RoutePopupMenu::RoutePopupMenu(QWidget* parent, Track* track, bool isOutput) +RoutePopupMenu::RoutePopupMenu(QWidget* parent, MusECore::Track* track, bool isOutput) : _track(track), _isOutMenu(isOutput) { _pup = new PopupMenu(parent, true); init(); } -RoutePopupMenu::RoutePopupMenu(const QString& title, QWidget* parent, Track* track, bool isOutput) +RoutePopupMenu::RoutePopupMenu(const QString& title, QWidget* parent, MusECore::Track* track, bool isOutput) : _track(track), _isOutMenu(isOutput) { _pup = new PopupMenu(title, parent, true); @@ -682,7 +682,7 @@ RoutePopupMenu::~RoutePopupMenu() void RoutePopupMenu::init() { - connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); + connect(MusEGlobal::song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); } void RoutePopupMenu::songChanged(int val) @@ -703,7 +703,7 @@ void RoutePopupMenu::updateRouteMenus() if(!_track || !_pup || _pup->actions().isEmpty() || !_pup->isVisible()) return; - RouteList* rl = _isOutMenu ? _track->outRoutes() : _track->inRoutes(); + MusECore::RouteList* rl = _isOutMenu ? _track->outRoutes() : _track->inRoutes(); // Clear all the action check marks. _pup->clearAllChecks(); @@ -711,22 +711,22 @@ void RoutePopupMenu::updateRouteMenus() // Take care of Midi Port to Audio Input routes first... if(_isOutMenu && _track->isMidiTrack()) { - int port = ((MidiTrack*)_track)->outPort(); + int port = ((MusECore::MidiTrack*)_track)->outPort(); if(port >= 0 && port < MIDI_PORTS) { - MidiPort* mp = &midiPorts[port]; - RouteList* mprl = mp->outRoutes(); - for (ciRoute ir = mprl->begin(); ir != mprl->end(); ++ir) + MusECore::MidiPort* mp = &MusEGlobal::midiPorts[port]; + MusECore::RouteList* mprl = mp->outRoutes(); + for (MusECore::ciRoute ir = mprl->begin(); ir != mprl->end(); ++ir) { - if(ir->type == Route::TRACK_ROUTE && ir->track && ir->track->type() == Track::AUDIO_INPUT) + if(ir->type == MusECore::Route::TRACK_ROUTE && ir->track && ir->track->type() == MusECore::Track::AUDIO_INPUT) { for(int ch = 0; ch < MIDI_CHANNELS; ++ch) { int chbits = 1 << ch; if(ir->channel & chbits) { - Route r(ir->track, chbits); - //printf("RoutePopupMenu::updateRouteMenus MidiPort to AudioInput chbits:%d\n", chbits); + MusECore::Route r(ir->track, chbits); + //printf("RoutePopupMenu::updateRouteMenus MusECore::MidiPort to AudioInput chbits:%d\n", chbits); QAction* act = _pup->findActionFromData(qVariantFromValue(r)); if(act) act->setChecked(true); @@ -738,10 +738,10 @@ void RoutePopupMenu::updateRouteMenus() } // Now check the ones that are found in the route list. - for(ciRoute irl = rl->begin(); irl != rl->end(); ++irl) + for(MusECore::ciRoute irl = rl->begin(); irl != rl->end(); ++irl) { // Do MidiTrack to MidiPort routes... - if(irl->type == Route::MIDI_PORT_ROUTE) + if(irl->type == MusECore::Route::MIDI_PORT_ROUTE) { //printf("RoutePopupMenu::updateRouteMenus MIDI_PORT_ROUTE\n"); for(int ch = 0; ch < MIDI_CHANNELS; ++ch) @@ -749,7 +749,7 @@ void RoutePopupMenu::updateRouteMenus() int chbits = 1 << ch; if(irl->channel & chbits) { - Route r(irl->midiPort, chbits); + MusECore::Route r(irl->midiPort, chbits); QAction* act = _pup->findActionFromData(qVariantFromValue(r)); if(act) act->setChecked(true); @@ -774,25 +774,25 @@ void RoutePopupMenu::popupActivated(QAction* action) if(_track->isMidiTrack()) { - RouteList* rl = _isOutMenu ? _track->outRoutes() : _track->inRoutes(); + MusECore::RouteList* rl = _isOutMenu ? _track->outRoutes() : _track->inRoutes(); // Take care of Route data items first... - if(qVariantCanConvert<Route>(action->data())) + if(qVariantCanConvert<MusECore::Route>(action->data())) { - Route aRoute = action->data().value<Route>(); + MusECore::Route aRoute = action->data().value<MusECore::Route>(); // Support Midi Port to Audio Input track routes. - if(aRoute.type == Route::TRACK_ROUTE && aRoute.track && aRoute.track->type() == Track::AUDIO_INPUT) + if(aRoute.type == MusECore::Route::TRACK_ROUTE && aRoute.track && aRoute.track->type() == MusECore::Track::AUDIO_INPUT) { //if(gIsOutRoutingPopupMenu) // Try to avoid splitting like this. { int chbit = aRoute.channel; - int port = ((MidiTrack*)_track)->outPort(); + int port = ((MusECore::MidiTrack*)_track)->outPort(); if(port < 0 || port >= MIDI_PORTS) return; - MidiPort* mp = &midiPorts[port]; - //MidiDevice* md = mp->device(); + MusECore::MidiPort* mp = &MusEGlobal::midiPorts[port]; + //MusECore::MidiDevice* md = mp->device(); // This is desirable, but could lead to 'hidden' routes unless we add more support // such as removing the existing routes when user changes flags. @@ -802,14 +802,14 @@ void RoutePopupMenu::popupActivated(QAction* action) //if(!(md->rwFlags() & (gIsOutRoutingPopupMenu ? 1 : 2))) // return; - Route bRoute(port, chbit); + MusECore::Route bRoute(port, chbit); int chmask = 0; - RouteList* mprl = _isOutMenu ? mp->outRoutes() : mp->inRoutes(); - ciRoute ir = mprl->begin(); + MusECore::RouteList* mprl = _isOutMenu ? mp->outRoutes() : mp->inRoutes(); + MusECore::ciRoute ir = mprl->begin(); for (; ir != mprl->end(); ++ir) { - if(ir->type == Route::TRACK_ROUTE && ir->track == aRoute.track) // Is there already a route to this port? + if(ir->type == MusECore::Route::TRACK_ROUTE && ir->track == aRoute.track) // Is there already a route to this port? { chmask = ir->channel; // Grab the channel mask. break; @@ -819,33 +819,33 @@ void RoutePopupMenu::popupActivated(QAction* action) { // disconnect if(_isOutMenu) - audio->msgRemoveRoute(bRoute, aRoute); + MusEGlobal::audio->msgRemoveRoute(bRoute, aRoute); else - audio->msgRemoveRoute(aRoute, bRoute); + MusEGlobal::audio->msgRemoveRoute(aRoute, bRoute); } else { // connect if(_isOutMenu) - audio->msgAddRoute(bRoute, aRoute); + MusEGlobal::audio->msgAddRoute(bRoute, aRoute); else - audio->msgAddRoute(aRoute, bRoute); + MusEGlobal::audio->msgAddRoute(aRoute, bRoute); } - audio->msgUpdateSoloStates(); - song->update(SC_ROUTE); + MusEGlobal::audio->msgUpdateSoloStates(); + MusEGlobal::song->update(SC_ROUTE); } return; } - else if(aRoute.type == Route::MIDI_PORT_ROUTE) + else if(aRoute.type == MusECore::Route::MIDI_PORT_ROUTE) { int chbit = aRoute.channel; - Route bRoute(_track, chbit); + MusECore::Route bRoute(_track, chbit); int mdidx = aRoute.midiPort; - MidiPort* mp = &midiPorts[mdidx]; - MidiDevice* md = mp->device(); + MusECore::MidiPort* mp = &MusEGlobal::midiPorts[mdidx]; + MusECore::MidiDevice* md = mp->device(); //if(!md) // Rem. Allow connections to ports with no device. // return; @@ -855,10 +855,10 @@ void RoutePopupMenu::popupActivated(QAction* action) return; int chmask = 0; - ciRoute iir = rl->begin(); + MusECore::ciRoute iir = rl->begin(); for (; iir != rl->end(); ++iir) { - if(iir->type == Route::MIDI_PORT_ROUTE && iir->midiPort == mdidx) // Is there already a route to this port? + if(iir->type == MusECore::Route::MIDI_PORT_ROUTE && iir->midiPort == mdidx) // Is there already a route to this port? { chmask = iir->channel; // Grab the channel mask. break; @@ -868,21 +868,21 @@ void RoutePopupMenu::popupActivated(QAction* action) { // disconnect if(_isOutMenu) - audio->msgRemoveRoute(bRoute, aRoute); + MusEGlobal::audio->msgRemoveRoute(bRoute, aRoute); else - audio->msgRemoveRoute(aRoute, bRoute); + MusEGlobal::audio->msgRemoveRoute(aRoute, bRoute); } else { // connect if(_isOutMenu) - audio->msgAddRoute(bRoute, aRoute); + MusEGlobal::audio->msgAddRoute(bRoute, aRoute); else - audio->msgAddRoute(aRoute, bRoute); + MusEGlobal::audio->msgAddRoute(aRoute, bRoute); } - audio->msgUpdateSoloStates(); - song->update(SC_ROUTE); + MusEGlobal::audio->msgUpdateSoloStates(); + MusEGlobal::song->update(SC_ROUTE); } } else @@ -897,50 +897,50 @@ void RoutePopupMenu::popupActivated(QAction* action) } else { - AudioTrack* t = (AudioTrack*)_track; - RouteList* rl = _isOutMenu ? t->outRoutes() : t->inRoutes(); + MusECore::AudioTrack* t = (MusECore::AudioTrack*)_track; + MusECore::RouteList* rl = _isOutMenu ? t->outRoutes() : t->inRoutes(); - if(!qVariantCanConvert<Route>(action->data())) + if(!qVariantCanConvert<MusECore::Route>(action->data())) return; if(_isOutMenu) { - Route dstRoute = action->data().value<Route>(); - Route srcRoute(t, dstRoute.channel, dstRoute.channels); + MusECore::Route dstRoute = action->data().value<MusECore::Route>(); + MusECore::Route srcRoute(t, dstRoute.channel, dstRoute.channels); srcRoute.remoteChannel = dstRoute.remoteChannel; // check if route src->dst exists: - ciRoute irl = rl->begin(); + MusECore::ciRoute irl = rl->begin(); for (; irl != rl->end(); ++irl) { if (*irl == dstRoute) break; } if (irl != rl->end()) { // disconnect if route exists - audio->msgRemoveRoute(srcRoute, dstRoute); + MusEGlobal::audio->msgRemoveRoute(srcRoute, dstRoute); } else { // connect if route does not exist - audio->msgAddRoute(srcRoute, dstRoute); + MusEGlobal::audio->msgAddRoute(srcRoute, dstRoute); } - audio->msgUpdateSoloStates(); - song->update(SC_ROUTE); + MusEGlobal::audio->msgUpdateSoloStates(); + MusEGlobal::song->update(SC_ROUTE); } else { - Route srcRoute = action->data().value<Route>(); + MusECore::Route srcRoute = action->data().value<MusECore::Route>(); // Support Midi Port to Audio Input routes. - if(_track->type() == Track::AUDIO_INPUT && srcRoute.type == Route::MIDI_PORT_ROUTE) + if(_track->type() == MusECore::Track::AUDIO_INPUT && srcRoute.type == MusECore::Route::MIDI_PORT_ROUTE) { int chbit = srcRoute.channel; - Route dstRoute(t, chbit); + MusECore::Route dstRoute(t, chbit); int mdidx = srcRoute.midiPort; int chmask = 0; - ciRoute iir = rl->begin(); + MusECore::ciRoute iir = rl->begin(); for (; iir != rl->end(); ++iir) { - if(iir->type == Route::MIDI_PORT_ROUTE && iir->midiPort == mdidx) // Is there already a route to this port? + if(iir->type == MusECore::Route::MIDI_PORT_ROUTE && iir->midiPort == mdidx) // Is there already a route to this port? { chmask = iir->channel; // Grab the channel mask. break; @@ -950,37 +950,37 @@ void RoutePopupMenu::popupActivated(QAction* action) if ((chmask & chbit) == chbit) // Is the channel's bit(s) set? { //printf("routingPopupMenuActivated: removing src route ch:%d dst route ch:%d\n", srcRoute.channel, dstRoute.channel); - audio->msgRemoveRoute(srcRoute, dstRoute); + MusEGlobal::audio->msgRemoveRoute(srcRoute, dstRoute); } else { //printf("routingPopupMenuActivated: adding src route ch:%d dst route ch:%d\n", srcRoute.channel, dstRoute.channel); - audio->msgAddRoute(srcRoute, dstRoute); + MusEGlobal::audio->msgAddRoute(srcRoute, dstRoute); } - audio->msgUpdateSoloStates(); - song->update(SC_ROUTE); + MusEGlobal::audio->msgUpdateSoloStates(); + MusEGlobal::song->update(SC_ROUTE); return; } - Route dstRoute(t, srcRoute.channel, srcRoute.channels); + MusECore::Route dstRoute(t, srcRoute.channel, srcRoute.channels); dstRoute.remoteChannel = srcRoute.remoteChannel; - ciRoute irl = rl->begin(); + MusECore::ciRoute irl = rl->begin(); for (; irl != rl->end(); ++irl) { if (*irl == srcRoute) break; } if (irl != rl->end()) { // disconnect - audio->msgRemoveRoute(srcRoute, dstRoute); + MusEGlobal::audio->msgRemoveRoute(srcRoute, dstRoute); } else { // connect - audio->msgAddRoute(srcRoute, dstRoute); + MusEGlobal::audio->msgAddRoute(srcRoute, dstRoute); } - audio->msgUpdateSoloStates(); - song->update(SC_ROUTE); + MusEGlobal::audio->msgUpdateSoloStates(); + MusEGlobal::song->update(SC_ROUTE); } @@ -1002,7 +1002,7 @@ void RoutePopupMenu::prepare() if(_track->isMidiTrack()) { - RouteList* rl = _isOutMenu ? _track->outRoutes() : _track->inRoutes(); + MusECore::RouteList* rl = _isOutMenu ? _track->outRoutes() : _track->inRoutes(); int gid = 0; QAction* act = 0; @@ -1010,10 +1010,10 @@ void RoutePopupMenu::prepare() if(_isOutMenu) { // Support Midi Port to Audio Input track routes. - int port = ((MidiTrack*)_track)->outPort(); + int port = ((MusECore::MidiTrack*)_track)->outPort(); if(port >= 0 && port < MIDI_PORTS) { - MidiPort* mp = &midiPorts[port]; + MusECore::MidiPort* mp = &MusEGlobal::midiPorts[port]; // Do not list synth devices! Requiring valid device is desirable, // but could lead to 'hidden' routes unless we add more support @@ -1021,9 +1021,9 @@ void RoutePopupMenu::prepare() // So for now, just list all valid ports whether read or write. if(mp->device() && !mp->device()->isSynti()) { - RouteList* mprl = mp->outRoutes(); - int chbits = 1 << ((MidiTrack*)_track)->outChannel(); - //MidiDevice* md = mp->device(); + MusECore::RouteList* mprl = mp->outRoutes(); + int chbits = 1 << ((MusECore::MidiTrack*)_track)->outChannel(); + //MusECore::MidiDevice* md = mp->device(); //if(!md) // continue; @@ -1033,18 +1033,18 @@ void RoutePopupMenu::prepare() subp->setTitle(tr("Audio returns")); _pup->addMenu(subp); - InputList* al = song->inputs(); - for (ciAudioInput i = al->begin(); i != al->end(); ++i) + MusECore::InputList* al = MusEGlobal::song->inputs(); + for (MusECore::ciAudioInput i = al->begin(); i != al->end(); ++i) { - Track* t = *i; + MusECore::Track* t = *i; QString s(t->name()); act = subp->addAction(s); act->setCheckable(true); - Route r(t, chbits); + MusECore::Route r(t, chbits); act->setData(qVariantFromValue(r)); - for(ciRoute ir = mprl->begin(); ir != mprl->end(); ++ir) + for(MusECore::ciRoute ir = mprl->begin(); ir != mprl->end(); ++ir) { - if(ir->type == Route::TRACK_ROUTE && ir->track == t && (ir->channel & chbits)) + if(ir->type == MusECore::Route::TRACK_ROUTE && ir->track == t && (ir->channel & chbits)) { act->setChecked(true); break; @@ -1061,7 +1061,7 @@ void RoutePopupMenu::prepare() int pi = 0; for( ; pi < MIDI_PORTS; ++pi) { - MidiDevice* md = midiPorts[pi].device(); + MusECore::MidiDevice* md = MusEGlobal::midiPorts[pi].device(); //if(md && !md->isSynti() && (md->rwFlags() & 2)) //if(md && (md->rwFlags() & 2)) // p4.0.27 if(md && (md->rwFlags() & 2 || md->isSynti()) ) // p4.0.27 @@ -1085,8 +1085,8 @@ void RoutePopupMenu::prepare() for(int i = 0; i < MIDI_PORTS; ++i) { // NOTE: Could possibly list all devices, bypassing ports, but no, let's stick with ports. - MidiPort* mp = &midiPorts[i]; - MidiDevice* md = mp->device(); + MusECore::MidiPort* mp = &MusEGlobal::midiPorts[i]; + MusECore::MidiDevice* md = mp->device(); //if(!md) // continue; @@ -1104,10 +1104,10 @@ void RoutePopupMenu::prepare() int chanmask = 0; // To reduce number of routes required, from one per channel to just one containing a channel mask. // Look for the first route to this midi port. There should always be only a single route for each midi port, now. - ciRoute ir = rl->begin(); + MusECore::ciRoute ir = rl->begin(); for( ; ir != rl->end(); ++ir) { - if(ir->type == Route::MIDI_PORT_ROUTE && ir->midiPort == i) + if(ir->type == MusECore::Route::MIDI_PORT_ROUTE && ir->midiPort == i) { // We have a route to the midi port. Grab the channel mask. chanmask = ir->channel; @@ -1126,7 +1126,7 @@ void RoutePopupMenu::prepare() act = subp->addAction(QString("Channel %1").arg(ch+1)); act->setCheckable(true); int chbit = 1 << ch; - Route srcRoute(i, chbit); // In accordance with channel mask, use the bit position. + MusECore::Route srcRoute(i, chbit); // In accordance with channel mask, use the bit position. act->setData(qVariantFromValue(srcRoute)); if(chanmask & chbit) // Is the channel already set? Show item check mark. act->setChecked(true); @@ -1135,7 +1135,7 @@ void RoutePopupMenu::prepare() //gid = MIDI_PORTS * MIDI_CHANNELS + i; // Make sure each 'toggle' item gets a unique id. act = subp->addAction(tr("Toggle all")); //act->setCheckable(true); - Route togRoute(i, (1 << MIDI_CHANNELS) - 1); // Set all channel bits. + MusECore::Route togRoute(i, (1 << MIDI_CHANNELS) - 1); // Set all channel bits. act->setData(qVariantFromValue(togRoute)); ++gid; _pup->addMenu(subp); @@ -1147,7 +1147,7 @@ void RoutePopupMenu::prepare() morep->setTitle(tr("More...")); for(int i = 0; i < MIDI_PORTS; ++i) { - MidiPort* mp = &midiPorts[i]; + MusECore::MidiPort* mp = &MusEGlobal::midiPorts[i]; if(mp->device()) continue; @@ -1161,7 +1161,7 @@ void RoutePopupMenu::prepare() iRoute ir = rl->begin(); for( ; ir != rl->end(); ++ir) { - if(ir->type == Route::MIDI_PORT_ROUTE && ir->midiPort == i) + if(ir->type == MusECore::Route::MIDI_PORT_ROUTE && ir->midiPort == i) break; } if(ir != rl->end()) @@ -1174,7 +1174,7 @@ void RoutePopupMenu::prepare() act->setData(gid); int chbit = 1 << ch; - Route srcRoute(i, chbit); // In accordance with new channel mask, use the bit position. + MusECore::Route srcRoute(i, chbit); // In accordance with new channel mask, use the bit position. gRoutingMenuMap.insert( pRouteMenuMap(gid, srcRoute) ); @@ -1187,7 +1187,7 @@ void RoutePopupMenu::prepare() act = subp->addAction(QString("Toggle all")); //act->setCheckable(true); act->setData(gid); - Route togRoute(i, (1 << MIDI_CHANNELS) - 1); // Set all channel bits. + MusECore::Route togRoute(i, (1 << MIDI_CHANNELS) - 1); // Set all channel bits. gRoutingMenuMap.insert( pRouteMenuMap(gid, togRoute) ); ++gid; morep->addMenu(subp); @@ -1200,11 +1200,11 @@ void RoutePopupMenu::prepare() } else { - AudioTrack* t = (AudioTrack*)_track; + MusECore::AudioTrack* t = (MusECore::AudioTrack*)_track; int channel = t->channels(); if(_isOutMenu) { - RouteList* orl = t->outRoutes(); + MusECore::RouteList* orl = t->outRoutes(); QAction* act = 0; int gid = 0; @@ -1212,7 +1212,7 @@ void RoutePopupMenu::prepare() switch(_track->type()) { - case Track::AUDIO_OUTPUT: + case MusECore::Track::AUDIO_OUTPUT: { for(int i = 0; i < channel; ++i) { @@ -1226,16 +1226,16 @@ void RoutePopupMenu::prepare() _pup->clear(); return; } - std::list<QString> ol = audioDevice->inputPorts(); + std::list<QString> ol = MusEGlobal::audioDevice->inputPorts(); for(std::list<QString>::iterator ip = ol.begin(); ip != ol.end(); ++ip) { act = _pup->addAction(*ip); act->setCheckable(true); - Route dst(*ip, true, i, Route::JACK_ROUTE); + MusECore::Route dst(*ip, true, i, MusECore::Route::JACK_ROUTE); act->setData(qVariantFromValue(dst)); ++gid; - for(ciRoute ir = orl->begin(); ir != orl->end(); ++ir) + for(MusECore::ciRoute ir = orl->begin(); ir != orl->end(); ++ir) { if(*ir == dst) { @@ -1266,14 +1266,14 @@ void RoutePopupMenu::prepare() //gid = addInPorts(t, _pup, gid, -1, -1, true); } break; - case Track::AUDIO_SOFTSYNTH: + case MusECore::Track::AUDIO_SOFTSYNTH: gid = addMultiChannelPorts(t, _pup, gid, true); break; - case Track::AUDIO_INPUT: - case Track::WAVE: - case Track::AUDIO_GROUP: - case Track::AUDIO_AUX: + case MusECore::Track::AUDIO_INPUT: + case MusECore::Track::WAVE: + case MusECore::Track::AUDIO_GROUP: + case MusECore::Track::AUDIO_AUX: gid = addWavePorts( t, _pup, gid, -1, -1, true); gid = addOutPorts( t, _pup, gid, -1, -1, true); gid = addGroupPorts( t, _pup, gid, -1, -1, true); @@ -1286,10 +1286,10 @@ void RoutePopupMenu::prepare() } else { - if(_track->type() == Track::AUDIO_AUX) + if(_track->type() == MusECore::Track::AUDIO_AUX) return; - RouteList* irl = t->inRoutes(); + MusECore::RouteList* irl = t->inRoutes(); QAction* act = 0; int gid = 0; @@ -1297,7 +1297,7 @@ void RoutePopupMenu::prepare() switch(_track->type()) { - case Track::AUDIO_INPUT: + case MusECore::Track::AUDIO_INPUT: { for(int i = 0; i < channel; ++i) { @@ -1311,16 +1311,16 @@ void RoutePopupMenu::prepare() _pup->clear(); return; } - std::list<QString> ol = audioDevice->outputPorts(); + std::list<QString> ol = MusEGlobal::audioDevice->outputPorts(); for(std::list<QString>::iterator ip = ol.begin(); ip != ol.end(); ++ip) { act = _pup->addAction(*ip); act->setCheckable(true); - Route dst(*ip, true, i, Route::JACK_ROUTE); + MusECore::Route dst(*ip, true, i, MusECore::Route::JACK_ROUTE); act->setData(qVariantFromValue(dst)); ++gid; - for(ciRoute ir = irl->begin(); ir != irl->end(); ++ir) + for(MusECore::ciRoute ir = irl->begin(); ir != irl->end(); ++ir) { if(*ir == dst) { @@ -1356,21 +1356,21 @@ void RoutePopupMenu::prepare() //addMidiPorts(t, _pup, gid, false); } break; - case Track::AUDIO_OUTPUT: + case MusECore::Track::AUDIO_OUTPUT: gid = addWavePorts( t, _pup, gid, -1, -1, false); gid = addInPorts( t, _pup, gid, -1, -1, false); gid = addGroupPorts(t, _pup, gid, -1, -1, false); gid = addAuxPorts( t, _pup, gid, -1, -1, false); gid = nonSyntiTrackAddSyntis(t, _pup, gid, false); break; - case Track::WAVE: + case MusECore::Track::WAVE: gid = addWavePorts( t, _pup, gid, -1, -1, false); gid = addInPorts( t, _pup, gid, -1, -1, false); gid = addGroupPorts(t, _pup, gid, -1, -1, false); gid = addAuxPorts( t, _pup, gid, -1, -1, false); gid = nonSyntiTrackAddSyntis(t, _pup, gid, false); break; - case Track::AUDIO_GROUP: + case MusECore::Track::AUDIO_GROUP: gid = addWavePorts( t, _pup, gid, -1, -1, false); gid = addInPorts( t, _pup, gid, -1, -1, false); gid = addGroupPorts(t, _pup, gid, -1, -1, false); @@ -1378,7 +1378,7 @@ void RoutePopupMenu::prepare() gid = nonSyntiTrackAddSyntis(t, _pup, gid, false); break; - case Track::AUDIO_SOFTSYNTH: + case MusECore::Track::AUDIO_SOFTSYNTH: gid = addMultiChannelPorts(t, _pup, gid, false); break; default: @@ -1389,7 +1389,7 @@ void RoutePopupMenu::prepare() } } -void RoutePopupMenu::exec(Track* track, bool isOutput) +void RoutePopupMenu::exec(MusECore::Track* track, bool isOutput) { if(track) { @@ -1400,7 +1400,7 @@ void RoutePopupMenu::exec(Track* track, bool isOutput) _pup->exec(); } -void RoutePopupMenu::exec(const QPoint& p, Track* track, bool isOutput) +void RoutePopupMenu::exec(const QPoint& p, MusECore::Track* track, bool isOutput) { if(track) { @@ -1411,7 +1411,7 @@ void RoutePopupMenu::exec(const QPoint& p, Track* track, bool isOutput) _pup->exec(p); } -void RoutePopupMenu::popup(const QPoint& p, Track* track, bool isOutput) +void RoutePopupMenu::popup(const QPoint& p, MusECore::Track* track, bool isOutput) { if(track) { @@ -1422,4 +1422,4 @@ void RoutePopupMenu::popup(const QPoint& p, Track* track, bool isOutput) _pup->popup(p); } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/routepopup.h b/muse2/muse/widgets/routepopup.h index 7f5a8820..842ba130 100644 --- a/muse2/muse/widgets/routepopup.h +++ b/muse2/muse/widgets/routepopup.h @@ -25,14 +25,17 @@ #include <QObject> -class Track; +namespace MusECore { class AudioTrack; +class Track; +} + class QWidget; class QString; class QAction; class QPoint; -namespace MusEWidget { +namespace MusEGui { class PopupMenu; @@ -41,38 +44,38 @@ class RoutePopupMenu : public QObject Q_OBJECT PopupMenu* _pup; - Track* _track; + MusECore::Track* _track; // Whether the route popup was shown by clicking the output routes button, or input routes button. bool _isOutMenu; void init(); void prepare(); - int addMenuItem(AudioTrack* track, Track* route_track, PopupMenu* lb, int id, int channel, + int addMenuItem(MusECore::AudioTrack* track, MusECore::Track* route_track, PopupMenu* lb, int id, int channel, int channels, bool isOutput); - int addAuxPorts(AudioTrack* t, PopupMenu* lb, int id, int channel, int channels, bool isOutput); - int addInPorts(AudioTrack* t, PopupMenu* lb, int id, int channel, int channels, bool isOutput); - int addOutPorts(AudioTrack* t, PopupMenu* lb, int id, int channel, int channels, bool isOutput); - int addGroupPorts(AudioTrack* t, PopupMenu* lb, int id, int channel, int channels, bool isOutput); - int addWavePorts(AudioTrack* t, PopupMenu* lb, int id, int channel, int channels, bool isOutput); - int addSyntiPorts(AudioTrack* t, PopupMenu* lb, int id, int channel, int channels, bool isOutput); - int addMultiChannelPorts(AudioTrack* t, PopupMenu* pup, int id, bool isOutput); - int nonSyntiTrackAddSyntis(AudioTrack* t, PopupMenu* lb, int id, bool isOutput); - int addMidiPorts(AudioTrack* t, PopupMenu* pup, int id, bool isOutput); + int addAuxPorts(MusECore::AudioTrack* t, PopupMenu* lb, int id, int channel, int channels, bool isOutput); + int addInPorts(MusECore::AudioTrack* t, PopupMenu* lb, int id, int channel, int channels, bool isOutput); + int addOutPorts(MusECore::AudioTrack* t, PopupMenu* lb, int id, int channel, int channels, bool isOutput); + int addGroupPorts(MusECore::AudioTrack* t, PopupMenu* lb, int id, int channel, int channels, bool isOutput); + int addWavePorts(MusECore::AudioTrack* t, PopupMenu* lb, int id, int channel, int channels, bool isOutput); + int addSyntiPorts(MusECore::AudioTrack* t, PopupMenu* lb, int id, int channel, int channels, bool isOutput); + int addMultiChannelPorts(MusECore::AudioTrack* t, PopupMenu* pup, int id, bool isOutput); + int nonSyntiTrackAddSyntis(MusECore::AudioTrack* t, PopupMenu* lb, int id, bool isOutput); + int addMidiPorts(MusECore::AudioTrack* t, PopupMenu* pup, int id, bool isOutput); private slots: void popupActivated(QAction*); void songChanged(int); public: - RoutePopupMenu(QWidget* parent = 0, Track* track = 0, bool isOutput = false); - RoutePopupMenu(const QString& title, QWidget* parent = 0, Track* track = 0, bool isOutput = false); + RoutePopupMenu(QWidget* parent = 0, MusECore::Track* track = 0, bool isOutput = false); + RoutePopupMenu(const QString& title, QWidget* parent = 0, MusECore::Track* track = 0, bool isOutput = false); ~RoutePopupMenu(); void updateRouteMenus(); - void exec(Track* track = 0, bool isOutput = false); - void exec(const QPoint& p, Track* track = 0, bool isOutput = false); - void popup(const QPoint& p, Track* track = 0, bool isOutput = false); + void exec(MusECore::Track* track = 0, bool isOutput = false); + void exec(const QPoint& p, MusECore::Track* track = 0, bool isOutput = false); + void popup(const QPoint& p, MusECore::Track* track = 0, bool isOutput = false); }; } diff --git a/muse2/muse/widgets/scldiv.cpp b/muse2/muse/widgets/scldiv.cpp index ba19f659..26fe9bce 100644 --- a/muse2/muse/widgets/scldiv.cpp +++ b/muse2/muse/widgets/scldiv.cpp @@ -26,7 +26,7 @@ #include "scldiv.h" #include "mmath.h" -namespace MusEWidget { +namespace MusEGui { // ScaleDiv - A class for building scale divisions // @@ -84,10 +84,10 @@ static bool limRange(double &val, double v1, double v2, double eps_rel = 0.0, { bool rv = TRUE; - double vmin = MusEUtil::qwtMin(v1, v2); - double vmax = MusEUtil::qwtMax(v1, v2); - double delta_min = MusEUtil::qwtMax(MusEUtil::qwtAbs(eps_rel * vmin), MusEUtil::qwtAbs(eps_abs)); - double delta_max = MusEUtil::qwtMax(MusEUtil::qwtAbs(eps_rel * vmax), MusEUtil::qwtAbs(eps_abs)); + double vmin = MusECore::qwtMin(v1, v2); + double vmax = MusECore::qwtMax(v1, v2); + double delta_min = MusECore::qwtMax(MusECore::qwtAbs(eps_rel * vmin), MusECore::qwtAbs(eps_abs)); + double delta_max = MusECore::qwtMax(MusECore::qwtAbs(eps_rel * vmax), MusECore::qwtAbs(eps_abs)); if (val < vmin) { @@ -233,8 +233,8 @@ bool ScaleDiv::rebuild(double x1, double x2, int maxMajSteps, int maxMinSteps, int rv; - d_lBound = MusEUtil::qwtMin(x1, x2); - d_hBound = MusEUtil::qwtMax(x1, x2); + d_lBound = MusECore::qwtMin(x1, x2); + d_hBound = MusECore::qwtMax(x1, x2); d_log = log; if (d_log) @@ -246,8 +246,8 @@ bool ScaleDiv::rebuild(double x1, double x2, int maxMajSteps, int maxMinSteps, { d_lBound = x1; d_hBound = x2; - MusEUtil::qwtTwistArray(d_majMarks.data(), d_majMarks.size()); - MusEUtil::qwtTwistArray(d_minMarks.data(), d_minMarks.size()); + MusECore::qwtTwistArray(d_majMarks.data(), d_majMarks.size()); + MusECore::qwtTwistArray(d_minMarks.data(), d_minMarks.size()); } return rv; @@ -293,9 +293,9 @@ bool ScaleDiv::buildLinDiv(int maxMajSteps, int maxMinSteps, double step) bool rv = TRUE; // parameter range check - maxMajSteps = MusEUtil::qwtMax(1, maxMajSteps); - maxMinSteps = MusEUtil::qwtMax(0, maxMinSteps); - step = MusEUtil::qwtAbs(step); + maxMajSteps = MusECore::qwtMax(1, maxMajSteps); + maxMinSteps = MusECore::qwtMax(0, maxMinSteps); + step = MusECore::qwtAbs(step); // reset vectors d_minMarks.resize(0); @@ -307,7 +307,7 @@ bool ScaleDiv::buildLinDiv(int maxMajSteps, int maxMinSteps, double step) // Set up major divisions // if (step == 0.0) - d_majStep = MusEUtil::qwtCeil125(MusEUtil::qwtAbs(d_hBound - d_lBound) * 0.999999 + d_majStep = MusECore::qwtCeil125(MusECore::qwtAbs(d_hBound - d_lBound) * 0.999999 / double(maxMajSteps)); else d_majStep = step; @@ -317,10 +317,10 @@ bool ScaleDiv::buildLinDiv(int maxMajSteps, int maxMinSteps, double step) firstTick = ceil( (d_lBound - step_eps * d_majStep) / d_majStep) * d_majStep; lastTick = floor( (d_hBound + step_eps * d_majStep) / d_majStep) * d_majStep; - nMaj = MusEUtil::qwtMin(10000, int(rint((lastTick - firstTick) / d_majStep)) + 1); + nMaj = MusECore::qwtMin(10000, int(rint((lastTick - firstTick) / d_majStep)) + 1); d_majMarks.resize(nMaj); - MusEUtil::qwtLinSpace(d_majMarks.data(), d_majMarks.size(), firstTick, lastTick); + MusECore::qwtLinSpace(d_majMarks.data(), d_majMarks.size(), firstTick, lastTick); // // Set up minor divisions @@ -328,14 +328,14 @@ bool ScaleDiv::buildLinDiv(int maxMajSteps, int maxMinSteps, double step) if (maxMinSteps < 1) // no minor divs return TRUE; - minStep = MusEUtil::qwtCeil125( d_majStep / double(maxMinSteps) ); + minStep = MusECore::qwtCeil125( d_majStep / double(maxMinSteps) ); if (minStep == 0.0) return TRUE; - nMin = MusEUtil::qwtAbs(int(rint(d_majStep / minStep))) - 1; // # minor steps per interval + nMin = MusECore::qwtAbs(int(rint(d_majStep / minStep))) - 1; // # minor steps per interval // Do the minor steps fit into the interval? - if ( MusEUtil::qwtAbs(double(nMin + 1) * minStep - d_majStep) > step_eps * d_majStep) + if ( MusECore::qwtAbs(double(nMin + 1) * minStep - d_majStep) > step_eps * d_majStep) { nMin = 1; minStep = d_majStep * 0.5; @@ -410,9 +410,9 @@ bool ScaleDiv::buildLogDiv(int maxMajSteps, int maxMinSteps, double majStep) // Parameter range check - maxMajSteps = MusEUtil::qwtMax(1, MusEUtil::qwtAbs(maxMajSteps)); - maxMinSteps = MusEUtil::qwtMax(0, MusEUtil::qwtAbs(maxMinSteps)); - majStep = MusEUtil::qwtAbs(majStep); + maxMajSteps = MusECore::qwtMax(1, MusECore::qwtAbs(maxMajSteps)); + maxMinSteps = MusECore::qwtMax(0, MusECore::qwtAbs(maxMinSteps)); + majStep = MusECore::qwtAbs(majStep); // boundary check limRange(d_hBound, LOG_MIN, LOG_MAX); @@ -442,12 +442,12 @@ bool ScaleDiv::buildLogDiv(int maxMajSteps, int maxMinSteps, double majStep) // Set up major scale divisions // if (majStep == 0.0) - d_majStep = MusEUtil::qwtCeil125( width * 0.999999 / double(maxMajSteps)); + d_majStep = MusECore::qwtCeil125( width * 0.999999 / double(maxMajSteps)); else d_majStep = majStep; // major step must be >= 1 decade - d_majStep = MusEUtil::qwtMax(d_majStep, 1.0); + d_majStep = MusECore::qwtMax(d_majStep, 1.0); lFirst = ceil((log10(d_lBound) - step_eps * d_majStep) / d_majStep) * d_majStep; @@ -456,10 +456,10 @@ bool ScaleDiv::buildLogDiv(int maxMajSteps, int maxMinSteps, double majStep) firstTick = pow(10.0, lFirst); lastTick = pow(10.0, lLast); - nMaj = MusEUtil::qwtMin(10000, int(rint(MusEUtil::qwtAbs(lLast - lFirst) / d_majStep)) + 1); + nMaj = MusECore::qwtMin(10000, int(rint(MusECore::qwtAbs(lLast - lFirst) / d_majStep)) + 1); d_majMarks.resize(nMaj); - MusEUtil::qwtLogSpace(d_majMarks.data(), d_majMarks.size(), firstTick, lastTick); + MusECore::qwtLogSpace(d_majMarks.data(), d_majMarks.size(), firstTick, lastTick); // @@ -538,15 +538,15 @@ bool ScaleDiv::buildLogDiv(int maxMajSteps, int maxMinSteps, double majStep) { // substep width in decades, at least one decade - minStep = MusEUtil::qwtCeil125( (d_majStep - step_eps * (d_majStep / double(maxMinSteps))) + minStep = MusECore::qwtCeil125( (d_majStep - step_eps * (d_majStep / double(maxMinSteps))) / double(maxMinSteps) ); - minStep = MusEUtil::qwtMax(1.0, minStep); + minStep = MusECore::qwtMax(1.0, minStep); // # subticks per interval nMin = int(rint(d_majStep / minStep)) - 1; // Do the minor steps fit into the interval? - if ( MusEUtil::qwtAbs( double(nMin + 1) * minStep - d_majStep) > step_eps * d_majStep) + if ( MusECore::qwtAbs( double(nMin + 1) * minStep - d_majStep) > step_eps * d_majStep) nMin = 0; if (nMin < 1) return TRUE; // no subticks @@ -555,7 +555,7 @@ bool ScaleDiv::buildLogDiv(int maxMajSteps, int maxMinSteps, double majStep) buffer.resize((d_majMarks.size() + 1) * nMin ); // substep factor = 10^substeps - minFactor = MusEUtil::qwtMax(pow(10,minStep), 10.0); + minFactor = MusECore::qwtMax(pow(10,minStep), 10.0); // Are there minor ticks below the first major tick? if ( d_lBound < firstTick ) @@ -659,7 +659,7 @@ void ScaleDiv::reset() d_log = FALSE; } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/scldiv.h b/muse2/muse/widgets/scldiv.h index 1f91c2db..e799f10a 100644 --- a/muse2/muse/widgets/scldiv.h +++ b/muse2/muse/widgets/scldiv.h @@ -27,7 +27,7 @@ #include <QVector> -namespace MusEWidget { +namespace MusEGui { class ScaleDiv { @@ -66,6 +66,6 @@ class ScaleDiv bool log, double step = 0.0, bool ascend = TRUE); }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/scldraw.cpp b/muse2/muse/widgets/scldraw.cpp index c35d04e0..38adff25 100644 --- a/muse2/muse/widgets/scldraw.cpp +++ b/muse2/muse/widgets/scldraw.cpp @@ -30,7 +30,7 @@ #include "scldraw.h" -namespace MusEWidget { +namespace MusEGui { int const ScaleDraw::minLen = 10; @@ -224,7 +224,7 @@ void ScaleDraw::draw(QPainter *p) const hval = majTick - 0.5 * d_scldiv.majStep(); } - if (MusEUtil::qwtAbs(val-hval) < step_eps * d_scldiv.majStep()) + if (MusECore::qwtAbs(val-hval) < step_eps * d_scldiv.majStep()) drawTick(p, val, d_medLen); else drawTick(p, val, d_minLen); @@ -277,10 +277,10 @@ void ScaleDraw::drawTick(QPainter *p, double val, int len) const if ((tval <= d_minAngle + 359 * 16) || (tval >= d_minAngle - 359 * 16)) { arc = double(tval) / 16.0 * M_PI / 180.0; - x1 = MusEUtil::qwtInt(d_xCenter + sin(arc) * d_radius); - x2 = MusEUtil::qwtInt(d_xCenter + sin(arc) * (d_radius + double(len))); - y1 = MusEUtil::qwtInt(d_yCenter - cos(arc) * d_radius); - y2 = MusEUtil::qwtInt(d_yCenter - cos(arc) * (d_radius + double(len))); + x1 = MusECore::qwtInt(d_xCenter + sin(arc) * d_radius); + x2 = MusECore::qwtInt(d_xCenter + sin(arc) * (d_radius + double(len))); + y1 = MusECore::qwtInt(d_yCenter - cos(arc) * d_radius); + y2 = MusECore::qwtInt(d_yCenter - cos(arc) * (d_radius + double(len))); p->drawLine(x1, y1, x2, y2); } break; @@ -324,7 +324,7 @@ void ScaleDraw::drawLabel(QPainter *p, double val) const tval = transform(val); // correct rounding errors if val = 0 - if ((!d_scldiv.logScale()) && (MusEUtil::qwtAbs(val) < MusEUtil::qwtAbs(step_eps * d_scldiv.majStep()))) + if ((!d_scldiv.logScale()) && (MusECore::qwtAbs(val) < MusECore::qwtAbs(step_eps * d_scldiv.majStep()))) val = 0.0; label.setNum(val, d_fmt, d_prec); @@ -355,12 +355,12 @@ void ScaleDraw::drawLabel(QPainter *p, double val) const if ((arc < -M_PI) || (arc > M_PI)) arc -= floor((arc + M_PI) / M_PI * 0.5) * 2.0 * M_PI; - xpos = 1 + MusEUtil::qwtInt(d_xCenter + (d_radius + double(d_majLen + d_vpad)) * sin(arc)); - ypos = MusEUtil::qwtInt(d_yCenter - (d_radius + double(d_majLen + d_vpad)) * cos(arc)); + xpos = 1 + MusECore::qwtInt(d_xCenter + (d_radius + double(d_majLen + d_vpad)) * sin(arc)); + ypos = MusECore::qwtInt(d_yCenter - (d_radius + double(d_majLen + d_vpad)) * cos(arc)); if (arc < -pi_75) { - p->drawText(xpos - MusEUtil::qwtInt(double(fm.width(label)) + p->drawText(xpos - MusECore::qwtInt(double(fm.width(label)) * (1.0 + (arc + pi_75) * M_2_PI) ), ypos + fm.ascent() - 1, label); @@ -370,13 +370,13 @@ void ScaleDraw::drawLabel(QPainter *p, double val) const p->drawText(xpos - fm.width(label), - ypos - MusEUtil::qwtInt(double(fm.ascent() - 1) + ypos - MusECore::qwtInt(double(fm.ascent() - 1) * (arc + M_PI_4) * M_2_PI), label); } else if (arc < pi_4) { - p->drawText(xpos + MusEUtil::qwtInt(double(fm.width(label)) + p->drawText(xpos + MusECore::qwtInt(double(fm.width(label)) * ( arc - M_PI_4 ) * M_2_PI ), ypos, label); @@ -384,13 +384,13 @@ void ScaleDraw::drawLabel(QPainter *p, double val) const else if (arc < pi_75) { p->drawText(xpos, - ypos + MusEUtil::qwtInt(double(fm.ascent() - 1) + ypos + MusECore::qwtInt(double(fm.ascent() - 1) * (arc - M_PI_4) * M_2_PI), label); } else { - p->drawText(xpos - MusEUtil::qwtInt(double(fm.width(label)) + p->drawText(xpos - MusECore::qwtInt(double(fm.width(label)) * ( arc - pi_75) * M_2_PI ), ypos + fm.ascent() - 1, label); @@ -433,8 +433,8 @@ void ScaleDraw::drawBackbone(QPainter *p) const break; case Round: - a1 = MusEUtil::qwtMin(i1(), i2()) - 90 * 16; - a2 = MusEUtil::qwtMax(i1(), i2()) - 90 * 16; + a1 = MusECore::qwtMin(i1(), i2()) - 90 * 16; + a2 = MusECore::qwtMax(i1(), i2()) - 90 * 16; p->drawArc(d_xorg, d_yorg, d_len, d_len, @@ -694,7 +694,7 @@ QRect ScaleDraw::maxBoundingRect(QPainter *p) const while (a > 2880) a -= 5760; while (a < - 2880) a += 5760; - ar = MusEUtil::qwtAbs(a); + ar = MusECore::qwtAbs(a); if (ar < amin) amin = ar; if (ar > amax) amax = ar; @@ -708,18 +708,18 @@ QRect ScaleDraw::maxBoundingRect(QPainter *p) const while (a > 2880) a -= 5760; while (a < - 2880) a += 5760; - ar = MusEUtil::qwtAbs(a); + ar = MusECore::qwtAbs(a); if (ar < amin) amin = ar; if (ar > amax) amax = ar; } arc = double(amin) / 16.0 * M_PI / 180.0; - r.setTop(MusEUtil::qwtInt(d_yCenter - (d_radius + double(d_majLen + d_vpad)) * cos(arc)) + r.setTop(MusECore::qwtInt(d_yCenter - (d_radius + double(d_majLen + d_vpad)) * cos(arc)) + fm.ascent() ); arc = double(amax) / 16.0 * M_PI / 180.0; - r.setBottom(MusEUtil::qwtInt(d_yCenter - (d_radius + double(d_majLen + d_vpad)) * cos(arc)) + r.setBottom(MusECore::qwtInt(d_yCenter - (d_radius + double(d_majLen + d_vpad)) * cos(arc)) + fm.height() ); wmax = d_len + d_majLen + d_hpad + wl; @@ -765,10 +765,10 @@ void ScaleDraw::setAngleRange(double angle1, double angle2) { int amin, amax; - angle1 = MusEUtil::qwtLim(angle1, -360.0, 360.0); - angle2 = MusEUtil::qwtLim(angle2, -360.0, 360.0); - amin = int(rint(MusEUtil::qwtMin(angle1, angle2) * 16.0)); - amax = int(rint(MusEUtil::qwtMax(angle1, angle2) * 16.0)); + angle1 = MusECore::qwtLim(angle1, -360.0, 360.0); + angle2 = MusECore::qwtLim(angle2, -360.0, 360.0); + amin = int(rint(MusECore::qwtMin(angle1, angle2) * 16.0)); + amax = int(rint(MusECore::qwtMax(angle1, angle2) * 16.0)); if (amin == amax) { @@ -844,10 +844,10 @@ int ScaleDraw::maxLabelWidth(QPainter *p, int worst) const { val = d_scldiv.majMark(i); // correct rounding errors if val = 0 - if ((!d_scldiv.logScale()) && (MusEUtil::qwtAbs(val) < step_eps * MusEUtil::qwtAbs(d_scldiv.majStep()))) + if ((!d_scldiv.logScale()) && (MusECore::qwtAbs(val) < step_eps * MusECore::qwtAbs(d_scldiv.majStep()))) val = 0.0; s.setNum(val, d_fmt, d_prec); - rv = MusEUtil::qwtMax(rv,fm.width(s)); + rv = MusECore::qwtMax(rv,fm.width(s)); } } @@ -882,7 +882,7 @@ int ScaleDraw::maxLabelWidth(QPainter *p, int worst) const // //------------------------------------------------------------ -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/scldraw.h b/muse2/muse/widgets/scldraw.h index 2c1543cd..be8cab1c 100644 --- a/muse2/muse/widgets/scldraw.h +++ b/muse2/muse/widgets/scldraw.h @@ -31,7 +31,7 @@ class QPainter; class QRect; -namespace MusEWidget { +namespace MusEGui { class ScaleDraw : public DiMap { public: @@ -87,7 +87,7 @@ class ScaleDraw : public DiMap { void draw(QPainter *p) const; }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/sclif.cpp b/muse2/muse/widgets/sclif.cpp index 93987999..d4e86774 100644 --- a/muse2/muse/widgets/sclif.cpp +++ b/muse2/muse/widgets/sclif.cpp @@ -24,7 +24,7 @@ #include "sclif.h" -namespace MusEWidget { +namespace MusEGui { // ScaleIf - An interface class for widgets containing a scale // @@ -216,4 +216,4 @@ void ScaleIf::setScaleMaxMinor(int ticks) } } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/sclif.h b/muse2/muse/widgets/sclif.h index e168dfc3..a7cde746 100644 --- a/muse2/muse/widgets/sclif.h +++ b/muse2/muse/widgets/sclif.h @@ -27,7 +27,7 @@ #include "scldraw.h" -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // ScaleIf @@ -59,7 +59,7 @@ class ScaleIf int scaleMaxMajor() const {return d_maxMinor;} }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/scrollscale.cpp b/muse2/muse/widgets/scrollscale.cpp index 572a1d86..4f3f4771 100644 --- a/muse2/muse/widgets/scrollscale.cpp +++ b/muse2/muse/widgets/scrollscale.cpp @@ -35,7 +35,7 @@ #include "scrollscale.h" #include "icons.h" -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // setScale @@ -528,4 +528,4 @@ int ScrollScale::convertQuickZoomLevelToMag(int zoomlevel) return vals[zoomlevel]; } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/scrollscale.h b/muse2/muse/widgets/scrollscale.h index 0fce5b56..2c7ea0ef 100644 --- a/muse2/muse/widgets/scrollscale.h +++ b/muse2/muse/widgets/scrollscale.h @@ -31,7 +31,7 @@ class QResizeEvent; class QScrollBar; class QToolButton; -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // ScrollScale @@ -99,7 +99,7 @@ class ScrollScale : public QWidget { static int convertQuickZoomLevelToMag(int zoomlvl); }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/section.h b/muse2/muse/widgets/section.h index 02b84355..afa5e510 100644 --- a/muse2/muse/widgets/section.h +++ b/muse2/muse/widgets/section.h @@ -23,7 +23,7 @@ #ifndef __SECTION_H__ #define __SECTION_H__ -namespace MusEWidget { +namespace MusEGui { struct Section { int offset; @@ -32,7 +32,7 @@ struct Section { int val; }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/shortcutcapturedialog.cpp b/muse2/muse/widgets/shortcutcapturedialog.cpp index 26526f1e..46a3e75d 100644 --- a/muse2/muse/widgets/shortcutcapturedialog.cpp +++ b/muse2/muse/widgets/shortcutcapturedialog.cpp @@ -40,7 +40,7 @@ #include <QInputEvent> #include <QChar> -namespace MusEWidget { +namespace MusEGui { ShortcutCaptureDialog::ShortcutCaptureDialog(QWidget* parent, int index) : QDialog(parent) @@ -125,4 +125,4 @@ void ShortcutCaptureDialog::apply() done(key); } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/shortcutcapturedialog.h b/muse2/muse/widgets/shortcutcapturedialog.h index 9af3f7c2..f0387768 100644 --- a/muse2/muse/widgets/shortcutcapturedialog.h +++ b/muse2/muse/widgets/shortcutcapturedialog.h @@ -38,7 +38,7 @@ class QKeyEvent; -namespace MusEWidget { +namespace MusEGui { class ShortcutCaptureDialog : public QDialog, public Ui::ShortcutCaptureDialogBase { @@ -57,4 +57,4 @@ class ShortcutCaptureDialog : public QDialog, public Ui::ShortcutCaptureDialogBa ~ShortcutCaptureDialog(); }; -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/shortcutconfig.cpp b/muse2/muse/widgets/shortcutconfig.cpp index 8e4d7b1a..fc08e7ce 100644 --- a/muse2/muse/widgets/shortcutconfig.cpp +++ b/muse2/muse/widgets/shortcutconfig.cpp @@ -41,7 +41,7 @@ #include "shortcutcapturedialog.h" #include "shortcuts.h" -namespace MusEWidget { +namespace MusEGui { ShortcutConfig::ShortcutConfig(QWidget* parent) : QDialog(parent) @@ -158,4 +158,4 @@ void ShortcutConfig::assignAll() done(_config_changed); } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/shortcutconfig.h b/muse2/muse/widgets/shortcutconfig.h index fe417c05..3faf2b5e 100644 --- a/muse2/muse/widgets/shortcutconfig.h +++ b/muse2/muse/widgets/shortcutconfig.h @@ -41,7 +41,7 @@ class QCloseEvent; #define SHRT_CATEGORY_COL 0 -namespace MusEWidget { +namespace MusEGui { enum { @@ -83,6 +83,6 @@ class ShortcutConfig : public QDialog, public Ui::ShortcutConfigBase { }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/sigedit.cpp b/muse2/muse/widgets/sigedit.cpp index a952cfef..2157b54a 100644 --- a/muse2/muse/widgets/sigedit.cpp +++ b/muse2/muse/widgets/sigedit.cpp @@ -40,9 +40,9 @@ #include "sigedit.h" #include "spinbox.h" -extern int mtcType; +extern int MusEGlobal::mtcType; -namespace MusEWidget { +namespace MusEGui { bool Sig::isValid() const { @@ -756,4 +756,4 @@ void SigEdit::enterPressed() emit returnPressed(); } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/sigedit.h b/muse2/muse/widgets/sigedit.h index 05684db1..51b4b13e 100644 --- a/muse2/muse/widgets/sigedit.h +++ b/muse2/muse/widgets/sigedit.h @@ -30,7 +30,7 @@ class QResizeEvent; class QTimerEvent; -namespace MusEWidget { +namespace MusEGui { class SigEditor; class SpinBox; @@ -102,6 +102,6 @@ class SigEdit : public QWidget void enterPressed(); }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/siglabel.cpp b/muse2/muse/widgets/siglabel.cpp index f571c2f1..2a21efe3 100644 --- a/muse2/muse/widgets/siglabel.cpp +++ b/muse2/muse/widgets/siglabel.cpp @@ -36,7 +36,7 @@ #include <QWheelEvent> #include <QLabel> -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // SigLabel @@ -71,7 +71,7 @@ void SigLabel::mousePressEvent(QMouseEvent* event) int zz = z, nn = n; switch (button) { case Qt::LeftButton: - if (!MusEConfig::config.leftMouseButtonCanDecrease) + if (!MusEGlobal::config.leftMouseButtonCanDecrease) return; // else fall through case Qt::MidButton: @@ -183,4 +183,4 @@ void SigLabel::setFrame(bool flag) setLineWidth(2); } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/siglabel.h b/muse2/muse/widgets/siglabel.h index 33248e53..f5afb41e 100644 --- a/muse2/muse/widgets/siglabel.h +++ b/muse2/muse/widgets/siglabel.h @@ -30,7 +30,7 @@ class QWheelEvent; class QMouseEvent; -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // SigLabel @@ -61,7 +61,7 @@ class SigLabel : public QLabel { void setFrame(bool); }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/sigscale.cpp b/muse2/muse/widgets/sigscale.cpp index 2a4350b3..e1fdf345 100644 --- a/muse2/muse/widgets/sigscale.cpp +++ b/muse2/muse/widgets/sigscale.cpp @@ -32,7 +32,7 @@ #include "song.h" #include "gconfig.h" -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // SigScale @@ -43,12 +43,12 @@ SigScale::SigScale(int* r, QWidget* parent, int xs) { setToolTip(tr("signature scale")); raster = r; - pos[0] = song->cpos(); - pos[1] = song->lpos(); - pos[2] = song->rpos(); + pos[0] = MusEGlobal::song->cpos(); + pos[1] = MusEGlobal::song->lpos(); + pos[2] = MusEGlobal::song->rpos(); button = Qt::NoButton; setMouseTracking(true); - connect(song, SIGNAL(posChanged(int, unsigned, bool)), this, SLOT(setPos(int, unsigned, bool))); + connect(MusEGlobal::song, SIGNAL(posChanged(int, unsigned, bool)), this, SLOT(setPos(int, unsigned, bool))); setFixedHeight(18); } @@ -102,7 +102,7 @@ void SigScale::viewMouseMoveEvent(QMouseEvent* event) i = 1; break; case Qt::RightButton: - if ((MusEConfig::config.rangeMarkerWithoutMMB) && (event->modifiers() & Qt::ControlModifier)) + if ((MusEGlobal::config.rangeMarkerWithoutMMB) && (event->modifiers() & Qt::ControlModifier)) i = 1; else i = 2; @@ -110,8 +110,8 @@ void SigScale::viewMouseMoveEvent(QMouseEvent* event) default: return; } - Pos p(x, true); - song->setPos(i, p); + MusECore::Pos p(x, true); + MusEGlobal::song->setPos(i, p); } //--------------------------------------------------------- @@ -135,7 +135,7 @@ void SigScale::pdraw(QPainter& p, const QRect& r) if (x < 0) x = 0; - p.setFont(MusEConfig::config.fonts[3]); + p.setFont(MusEGlobal::config.fonts[3]); ///for (ciSigEvent si = sigmap.begin(); si != sigmap.end(); ++si) { for (AL::ciSigEvent si = AL::sigmap.begin(); si != AL::sigmap.end(); ++si) { ///SigEvent* e = si->second; @@ -169,4 +169,4 @@ void SigScale::pdraw(QPainter& p, const QRect& r) p.drawLine(xp, 0, xp, h); } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/sigscale.h b/muse2/muse/widgets/sigscale.h index 9ecacfb1..7073f4e7 100644 --- a/muse2/muse/widgets/sigscale.h +++ b/muse2/muse/widgets/sigscale.h @@ -27,7 +27,7 @@ class MidiEditor; -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // SigScale @@ -60,7 +60,7 @@ class SigScale : public View { SigScale(int* raster, QWidget* parent, int xscale); }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/slider.cpp b/muse2/muse/widgets/slider.cpp index 863933d2..874566d4 100644 --- a/muse2/muse/widgets/slider.cpp +++ b/muse2/muse/widgets/slider.cpp @@ -30,7 +30,7 @@ #include "utils.h" #include "slider.h" -namespace MusEWidget { +namespace MusEGui { //------------------------------------------------------------- // Slider - The Slider Widget @@ -120,7 +120,7 @@ Slider::~Slider() //----------------------------------------------------- void Slider::setThumbLength(int l) { - d_thumbLength = MusEUtil::qwtMax(l,8); + d_thumbLength = MusECore::qwtMax(l,8); d_thumbHalf = d_thumbLength / 2; resize(size()); } @@ -139,7 +139,7 @@ void Slider::setThumbLength(int l) //------------------------------------------------------------ void Slider::setThumbWidth(int w) { - d_thumbWidth = MusEUtil::qwtMax(w,4); + d_thumbWidth = MusECore::qwtMax(w,4); resize(size()); } @@ -259,9 +259,9 @@ void Slider::drawSlider(QPainter *p, const QRect &r) // // Draw background // - QPainterPath bg_rect = MusEUtil::roundedPath(cr, + QPainterPath bg_rect = MusECore::roundedPath(cr, xrad, yrad, - (MusEUtil::Corner) (MusEUtil::UpperLeft | MusEUtil::UpperRight | MusEUtil::LowerLeft | MusEUtil::LowerRight) ); + (MusECore::Corner) (MusECore::UpperLeft | MusECore::UpperRight | MusECore::LowerLeft | MusECore::LowerRight) ); p->fillPath(bg_rect, d_fillColor); @@ -277,9 +277,9 @@ void Slider::drawSlider(QPainter *p, const QRect &r) e_mask.setStart(QPointF(0, cr.y())); e_mask.setFinalStop(QPointF(0, cr.y() + cr.height())); - QPainterPath e_rect = MusEUtil::roundedPath(ipos + d_thumbLength, cr.y(), + QPainterPath e_rect = MusECore::roundedPath(ipos + d_thumbLength, cr.y(), cr.width() - d_thumbLength - dist1, cr.height(), - xrad, yrad, (MusEUtil::Corner) (MusEUtil::UpperRight | MusEUtil::LowerRight) ); + xrad, yrad, (MusECore::Corner) (MusECore::UpperRight | MusECore::LowerRight) ); p->fillPath(e_rect, QBrush(e_mask)); @@ -291,10 +291,10 @@ void Slider::drawSlider(QPainter *p, const QRect &r) f_mask.setStart(QPointF(0, cr.y())); f_mask.setFinalStop(QPointF(0, cr.y() + cr.height())); - QPainterPath f_rect = MusEUtil::roundedPath(cr.x(), cr.y(), + QPainterPath f_rect = MusECore::roundedPath(cr.x(), cr.y(), ipos + 1, cr.height(), xrad, yrad, - (MusEUtil::Corner) (MusEUtil::LowerLeft | MusEUtil::UpperLeft) ); + (MusECore::Corner) (MusECore::LowerLeft | MusECore::UpperLeft) ); p->fillPath(f_rect, QBrush(f_mask)); @@ -303,10 +303,10 @@ void Slider::drawSlider(QPainter *p, const QRect &r) // Draw thumb // - QPainterPath thumb_rect = MusEUtil::roundedPath(ipos, r.y(), + QPainterPath thumb_rect = MusECore::roundedPath(ipos, r.y(), d_thumbLength, r.height(), 2, 2, - (MusEUtil::Corner) (MusEUtil::UpperLeft | MusEUtil::UpperRight | MusEUtil::LowerLeft | MusEUtil::LowerRight) ); + (MusECore::Corner) (MusECore::UpperLeft | MusECore::UpperRight | MusECore::LowerLeft | MusECore::LowerRight) ); thumbGrad.setStart(QPointF(0, cr.y())); thumbGrad.setFinalStop(QPointF(0, cr.y() + cr.height())); @@ -331,9 +331,9 @@ void Slider::drawSlider(QPainter *p, const QRect &r) // // Draw background // - QPainterPath bg_rect = MusEUtil::roundedPath(cr, + QPainterPath bg_rect = MusECore::roundedPath(cr, xrad, yrad, - (MusEUtil::Corner) (MusEUtil::UpperLeft | MusEUtil::UpperRight | MusEUtil::LowerLeft | MusEUtil::LowerRight) ); + (MusECore::Corner) (MusECore::UpperLeft | MusECore::UpperRight | MusECore::LowerLeft | MusECore::LowerRight) ); p->fillPath(bg_rect, d_fillColor); @@ -349,10 +349,10 @@ void Slider::drawSlider(QPainter *p, const QRect &r) e_mask.setStart(QPointF(cr.x(), 0)); e_mask.setFinalStop(QPointF(cr.x() + cr.width(), 0)); - QPainterPath e_rect = MusEUtil::roundedPath(cr.x(), cr.y(), + QPainterPath e_rect = MusECore::roundedPath(cr.x(), cr.y(), cr.width(), ipos + 1, xrad, yrad, - (MusEUtil::Corner) (MusEUtil::UpperLeft | MusEUtil::UpperRight) ); + (MusECore::Corner) (MusECore::UpperLeft | MusECore::UpperRight) ); p->fillPath(e_rect, QBrush(e_mask)); @@ -364,9 +364,9 @@ void Slider::drawSlider(QPainter *p, const QRect &r) f_mask.setStart(QPointF(cr.x(), 0)); f_mask.setFinalStop(QPointF(cr.x() + cr.width(), 0)); - QPainterPath f_rect = MusEUtil::roundedPath(cr.x(), ipos + d_thumbLength, + QPainterPath f_rect = MusECore::roundedPath(cr.x(), ipos + d_thumbLength, cr.width(), cr.height() - d_thumbLength - dist1, - xrad, yrad, (MusEUtil::Corner) (MusEUtil::LowerLeft | MusEUtil::LowerRight) ); + xrad, yrad, (MusECore::Corner) (MusECore::LowerLeft | MusECore::LowerRight) ); p->fillPath(f_rect, QBrush(f_mask)); @@ -375,10 +375,10 @@ void Slider::drawSlider(QPainter *p, const QRect &r) // Draw thumb // - QPainterPath thumb_rect = MusEUtil::roundedPath(r.x(), ipos, + QPainterPath thumb_rect = MusECore::roundedPath(r.x(), ipos, r.width(), d_thumbLength, 2, 2, - (MusEUtil::Corner) (MusEUtil::UpperLeft | MusEUtil::UpperRight | MusEUtil::LowerLeft | MusEUtil::LowerRight) ); + (MusECore::Corner) (MusECore::UpperLeft | MusECore::UpperRight | MusECore::LowerLeft | MusECore::LowerRight) ); thumbGrad.setStart(QPointF(cr.x(), 0)); thumbGrad.setFinalStop(QPointF(cr.x() + cr.width(), 0)); @@ -580,7 +580,7 @@ void Slider::paintEvent(QPaintEvent* /*ev*/) void Slider::resizeEvent(QResizeEvent *e) { - MusEWidget::SliderBase::resizeEvent(e); + SliderBase::resizeEvent(e); d_resized = TRUE; QSize s = e->size(); /* Scale is not supported @@ -712,8 +712,8 @@ void Slider::rangeChange() //------------------------------------------------------------ void Slider::setMargins(int hor, int vert) { - d_xMargin = MusEUtil::qwtMax(0, hor); - d_yMargin = MusEUtil::qwtMin(0, vert); + d_xMargin = MusECore::qwtMax(0, hor); + d_yMargin = MusECore::qwtMin(0, vert); resize(this->size()); } @@ -837,4 +837,4 @@ void Slider::setPageStep(double) { } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/slider.h b/muse2/muse/widgets/slider.h index b1281da0..0cc94c70 100644 --- a/muse2/muse/widgets/slider.h +++ b/muse2/muse/widgets/slider.h @@ -30,7 +30,7 @@ #include "sliderbase.h" #include "scldraw.h" -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // Slider @@ -110,6 +110,6 @@ class Slider : public SliderBase, public ScaleIf void setSizeHint(uint w, uint h); }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/sliderbase.cpp b/muse2/muse/widgets/sliderbase.cpp index 8b85878e..15497235 100644 --- a/muse2/muse/widgets/sliderbase.cpp +++ b/muse2/muse/widgets/sliderbase.cpp @@ -29,7 +29,7 @@ #include <QMouseEvent> #include <QTimerEvent> -namespace MusEWidget { +namespace MusEGui { // DESCRIPTION // SliderBase is a base class for @@ -184,7 +184,7 @@ void SliderBase::mousePressEvent(QMouseEvent *e) d_mouseOffset = 0; DoubleRange::incPages(d_direction); emit sliderMoved(value(), _id); - d_tmrID = startTimer(MusEUtil::qwtMax(250, 2 * d_updTime)); + d_tmrID = startTimer(MusECore::qwtMax(250, 2 * d_updTime)); break; case ScrMouse: @@ -729,7 +729,7 @@ void SliderBase::stepPages(int pages) // //------------------------------------------------------------ -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/sliderbase.h b/muse2/muse/widgets/sliderbase.h index 39860153..56c7a586 100644 --- a/muse2/muse/widgets/sliderbase.h +++ b/muse2/muse/widgets/sliderbase.h @@ -30,7 +30,7 @@ #include <QTime> #include <QWidget> -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // SliderBase @@ -111,6 +111,6 @@ class SliderBase : public QWidget, public DoubleRange void setId(int i) { _id = i; } }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/songinfo.h b/muse2/muse/widgets/songinfo.h index 8e576876..90e2fb00 100644 --- a/muse2/muse/widgets/songinfo.h +++ b/muse2/muse/widgets/songinfo.h @@ -25,7 +25,7 @@ class QDialog; -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // SongInfoWidget @@ -40,4 +40,4 @@ class SongInfoWidget : public QDialog, public Ui::SongInfo SongInfoWidget(QDialog *parent = 0) : QDialog(parent) { setupUi(this); } }; -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/spinbox.cpp b/muse2/muse/widgets/spinbox.cpp index 0111158d..f7afcf2a 100644 --- a/muse2/muse/widgets/spinbox.cpp +++ b/muse2/muse/widgets/spinbox.cpp @@ -24,7 +24,7 @@ #include <QEvent> #include "spinbox.h" -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // SpinBox @@ -99,4 +99,4 @@ void SpinBox::stepDown() _clearFocus = true; } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/spinbox.h b/muse2/muse/widgets/spinbox.h index 01cd6ad5..cee112d4 100644 --- a/muse2/muse/widgets/spinbox.h +++ b/muse2/muse/widgets/spinbox.h @@ -30,7 +30,7 @@ #include <QSpinBox> #include <QEvent> -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // SpinBox @@ -56,7 +56,7 @@ class SpinBox : public QSpinBox { SpinBox(int minValue, int maxValue, int step = 1, QWidget* parent=0); }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/spinboxFP.cpp b/muse2/muse/widgets/spinboxFP.cpp index 696e589f..89a41770 100644 --- a/muse2/muse/widgets/spinboxFP.cpp +++ b/muse2/muse/widgets/spinboxFP.cpp @@ -29,7 +29,7 @@ #include "spinboxFP.h" -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // SpinBoxFP @@ -188,4 +188,4 @@ int SpinBoxFP::valueFromText(const QString& text) const */ -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/spinboxFP.h b/muse2/muse/widgets/spinboxFP.h index 81fc4876..98b7e561 100644 --- a/muse2/muse/widgets/spinboxFP.h +++ b/muse2/muse/widgets/spinboxFP.h @@ -29,7 +29,7 @@ //class QValidator; //class QDoubleValidator; -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // SpinBoxFP @@ -66,7 +66,7 @@ class SpinBoxFP : public QDoubleSpinBox { //int decimals() const { return _decimals; } }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/splitter.cpp b/muse2/muse/widgets/splitter.cpp index 09220b24..a1f4a921 100644 --- a/muse2/muse/widgets/splitter.cpp +++ b/muse2/muse/widgets/splitter.cpp @@ -26,7 +26,7 @@ #include <QList> #include <QStringList> -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // Splitter @@ -43,38 +43,38 @@ Splitter::Splitter(Qt::Orientation o, QWidget* parent, const char* name) // saveConfiguration //--------------------------------------------------------- -void Splitter::writeStatus(int level, Xml& xml) +void Splitter::writeStatus(int level, MusECore::Xml& xml) { QList<int> vl = sizes(); //xml.nput(level++, "<%s>", name()); - xml.nput(level++, "<%s>", Xml::xmlString(objectName()).toLatin1().constData()); + xml.nput(level++, "<%s>", MusECore::Xml::xmlString(objectName()).toLatin1().constData()); QList<int>::iterator ivl = vl.begin(); for (; ivl != vl.end(); ++ivl) { xml.nput("%d ", *ivl); } //xml.nput("</%s>\n", name()); - xml.nput("</%s>\n", Xml::xmlString(objectName()).toLatin1().constData()); + xml.nput("</%s>\n", MusECore::Xml::xmlString(objectName()).toLatin1().constData()); } //--------------------------------------------------------- // loadConfiguration //--------------------------------------------------------- -void Splitter::readStatus(Xml& xml) +void Splitter::readStatus(MusECore::Xml& xml) { QList<int> vl; for (;;) { - Xml::Token token = xml.parse(); + MusECore::Xml::Token token = xml.parse(); const QString& tag = xml.s1(); switch (token) { - case Xml::Error: - case Xml::End: + case MusECore::Xml::Error: + case MusECore::Xml::End: return; - case Xml::TagStart: + case MusECore::Xml::TagStart: xml.unknown("Splitter"); break; - case Xml::Text: + case MusECore::Xml::Text: { //QStringList sl = QStringList::split(' ', tag); QStringList sl = tag.split(QString(" "), QString::SkipEmptyParts); @@ -84,7 +84,7 @@ void Splitter::readStatus(Xml& xml) } } break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == objectName()) { setSizes(vl); return; @@ -95,4 +95,4 @@ void Splitter::readStatus(Xml& xml) } } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/splitter.h b/muse2/muse/widgets/splitter.h index 3121fe87..d1bafd40 100644 --- a/muse2/muse/widgets/splitter.h +++ b/muse2/muse/widgets/splitter.h @@ -25,9 +25,11 @@ #include <QSplitter> +namespace MusECore { class Xml; +} -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // Splitter @@ -38,8 +40,8 @@ class Splitter : public QSplitter { public: Splitter(Qt::Orientation o, QWidget* parent, const char* name); - void writeStatus(int level, Xml&); - void readStatus(Xml&); + void writeStatus(int level, MusECore::Xml&); + void readStatus(MusECore::Xml&); }; } diff --git a/muse2/muse/widgets/swidget.cpp b/muse2/muse/widgets/swidget.cpp index 51796781..f082735b 100644 --- a/muse2/muse/widgets/swidget.cpp +++ b/muse2/muse/widgets/swidget.cpp @@ -24,7 +24,7 @@ #include <QResizeEvent> -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // resizeEvent @@ -36,4 +36,4 @@ void SWidget::resizeEvent(QResizeEvent* ev) emit heightChanged(ev->size().height()); } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/swidget.h b/muse2/muse/widgets/swidget.h index 0412ac41..c63642cf 100644 --- a/muse2/muse/widgets/swidget.h +++ b/muse2/muse/widgets/swidget.h @@ -25,7 +25,7 @@ #include <QWidget> -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // SWidget @@ -45,7 +45,7 @@ class SWidget : public QWidget { SWidget(QWidget* parent) : QWidget(parent) {} }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/tb1.cpp b/muse2/muse/widgets/tb1.cpp index 272359f0..3174260f 100644 --- a/muse2/muse/widgets/tb1.cpp +++ b/muse2/muse/widgets/tb1.cpp @@ -35,7 +35,7 @@ #include "poslabel.h" #include "pitchlabel.h" -namespace MusEWidget { +namespace MusEGui { static int rasterTable[] = { //------ 8 4 2 @@ -210,4 +210,4 @@ void Toolbar1::setPitchMode(bool /*flag*/) // pitch->setPitchMode(flag); } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/tb1.h b/muse2/muse/widgets/tb1.h index 93181c39..bbbb9904 100644 --- a/muse2/muse/widgets/tb1.h +++ b/muse2/muse/widgets/tb1.h @@ -31,7 +31,7 @@ class QTableWidget; class Track; class LabelCombo; -namespace MusEWidget { +namespace MusEGui { class PitchLabel; class PosLabel; @@ -71,6 +71,6 @@ class Toolbar1 : public QToolBar { void setPitchMode(bool flag); }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/tempolabel.cpp b/muse2/muse/widgets/tempolabel.cpp index cdbc029d..cc628f50 100644 --- a/muse2/muse/widgets/tempolabel.cpp +++ b/muse2/muse/widgets/tempolabel.cpp @@ -25,7 +25,7 @@ #include "tempolabel.h" -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // TempoLabel @@ -137,4 +137,4 @@ void TempoEdit::setValue(double val) // return lrint(60000000.0/value()); // } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/tempolabel.h b/muse2/muse/widgets/tempolabel.h index 682c1e37..50d70180 100644 --- a/muse2/muse/widgets/tempolabel.h +++ b/muse2/muse/widgets/tempolabel.h @@ -26,7 +26,7 @@ #include <QLabel> #include <QDoubleSpinBox> -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // TempoLabel @@ -76,7 +76,7 @@ class TempoEdit : public QDoubleSpinBox { //int tempo() const; }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/tools.cpp b/muse2/muse/widgets/tools.cpp index 113de6c4..162d2b97 100644 --- a/muse2/muse/widgets/tools.cpp +++ b/muse2/muse/widgets/tools.cpp @@ -28,7 +28,7 @@ #include "icons.h" #include "action.h" -namespace MusEWidget { +namespace MusEGui { const char* infoPointer = QT_TRANSLATE_NOOP("@default", "select Pointer Tool:\n" "with the pointer tool you can:\n" @@ -162,4 +162,4 @@ int EditToolBar::curTool() return -1; } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/tools.h b/muse2/muse/widgets/tools.h index 55c75c4a..71e63558 100644 --- a/muse2/muse/widgets/tools.h +++ b/muse2/muse/widgets/tools.h @@ -30,7 +30,7 @@ class QAction; class QPixmap; class QWidget; -namespace MusEWidget { +namespace MusEGui { class Action; @@ -84,7 +84,7 @@ class EditToolBar : public QToolBar { int curTool(); }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/transformbase.ui b/muse2/muse/widgets/transformbase.ui index ffa56338..845a2b8a 100644 --- a/muse2/muse/widgets/transformbase.ui +++ b/muse2/muse/widgets/transformbase.ui @@ -417,7 +417,7 @@ </widget> </item> <item row="2" column="1"> - <widget class="MusEWidget::SpinBoxFP" name="procVal1a"> + <widget class="MusEGui::SpinBoxFP" name="procVal1a"> <property name="maximum" stdset="0"> <number>99999999</number> </property> @@ -453,21 +453,21 @@ </widget> </item> <item row="2" column="2"> - <widget class="MusEWidget::SpinBoxFP" name="procVal2a"> + <widget class="MusEGui::SpinBoxFP" name="procVal2a"> <property name="maximum" stdset="0"> <number>99999999</number> </property> </widget> </item> <item row="2" column="3"> - <widget class="MusEWidget::SpinBoxFP" name="procLenA"> + <widget class="MusEGui::SpinBoxFP" name="procLenA"> <property name="maximum" stdset="0"> <number>99999999</number> </property> </widget> </item> <item row="2" column="4"> - <widget class="MusEWidget::SpinBoxFP" name="procPosA"> + <widget class="MusEGui::SpinBoxFP" name="procPosA"> <property name="maximum" stdset="0"> <number>99999999</number> </property> @@ -798,14 +798,14 @@ </widget> </item> <item row="3" column="4"> - <widget class="MusEWidget::SpinBoxFP" name="selBarB"> + <widget class="MusEGui::SpinBoxFP" name="selBarB"> <property name="decimals" stdset="0"> <number>3</number> </property> </widget> </item> <item row="2" column="4"> - <widget class="MusEWidget::SpinBoxFP" name="selBarA"> + <widget class="MusEGui::SpinBoxFP" name="selBarA"> <property name="minimum" stdset="0"> <number>1000</number> </property> @@ -974,7 +974,7 @@ </widget> </item> <item> - <widget class="MusEWidget::ComboQuant" name="funcQuantVal" native="true"/> + <widget class="MusEGui::ComboQuant" name="funcQuantVal" native="true"/> </item> </layout> </widget> @@ -986,12 +986,12 @@ <layoutdefault spacing="6" margin="11"/> <customwidgets> <customwidget> - <class>MusEWidget::SpinBoxFP</class> + <class>MusEGui::SpinBoxFP</class> <extends>QDoubleSpinBox</extends> <header>spinboxFP.h</header> </customwidget> <customwidget> - <class>MusEWidget::ComboQuant</class> + <class>MusEGui::ComboQuant</class> <extends>QComboBox</extends> <header>comboQuant.h</header> </customwidget> diff --git a/muse2/muse/widgets/ttoolbutton.cpp b/muse2/muse/widgets/ttoolbutton.cpp index 6bf43b1f..1bde3bf8 100644 --- a/muse2/muse/widgets/ttoolbutton.cpp +++ b/muse2/muse/widgets/ttoolbutton.cpp @@ -27,7 +27,7 @@ #include "gconfig.h" #include "icons.h" -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // drawButton @@ -43,4 +43,4 @@ void TransparentToolButton::drawButton(QPainter* p) p->drawPixmap(QPoint((w - pm.width())/2, (h - pm.height())/2), pm); } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/ttoolbutton.h b/muse2/muse/widgets/ttoolbutton.h index b61d2f7c..566a8cae 100644 --- a/muse2/muse/widgets/ttoolbutton.h +++ b/muse2/muse/widgets/ttoolbutton.h @@ -25,7 +25,7 @@ #include <QToolButton> -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // TransparentToolButton @@ -41,7 +41,7 @@ class TransparentToolButton : public QToolButton { : QToolButton(parent) {setObjectName(name);} }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/unusedwavefiles.cpp b/muse2/muse/widgets/unusedwavefiles.cpp index 07fcbf0c..a7f2c776 100644 --- a/muse2/muse/widgets/unusedwavefiles.cpp +++ b/muse2/muse/widgets/unusedwavefiles.cpp @@ -31,7 +31,7 @@ #include "globals.h" #include "app.h" -namespace MusEWidget { +namespace MusEGui { UnusedWaveFiles::UnusedWaveFiles(QWidget *parent) : QDialog(parent), @@ -120,4 +120,4 @@ void UnusedWaveFiles::accept() QDialog::accept(); } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/unusedwavefiles.h b/muse2/muse/widgets/unusedwavefiles.h index fba41212..11334ddb 100644 --- a/muse2/muse/widgets/unusedwavefiles.h +++ b/muse2/muse/widgets/unusedwavefiles.h @@ -26,10 +26,10 @@ #include <QDialog> namespace Ui { - class UnusedWaveFiles; +class UnusedWaveFiles; } -namespace MusEWidget { +namespace MusEGui { class UnusedWaveFiles : public QDialog { @@ -47,6 +47,6 @@ private: Ui::UnusedWaveFiles *ui; }; -} // namespace MusEWidget +} // namespace MusEGui #endif // UNUSEDWAVEFILES_H diff --git a/muse2/muse/widgets/utils.cpp b/muse2/muse/widgets/utils.cpp index 41c5a180..708bef07 100644 --- a/muse2/muse/widgets/utils.cpp +++ b/muse2/muse/widgets/utils.cpp @@ -41,7 +41,7 @@ #include "utils.h" #include "xml.h" -namespace MusEUtil { +namespace MusECore { //--------------------------------------------------------- // curTime @@ -553,4 +553,4 @@ int get_paste_len() return end_tick - begin_tick; } -} // namespace MusEUtils +} // namespace MusECore diff --git a/muse2/muse/widgets/utils.h b/muse2/muse/widgets/utils.h index 6e4c8758..95b9a133 100644 --- a/muse2/muse/widgets/utils.h +++ b/muse2/muse/widgets/utils.h @@ -32,7 +32,7 @@ class QPointF; class QColor; class QPainterPath; -namespace MusEUtil { +namespace MusECore { enum Corner { UpperLeft = 0x1, UpperRight = 0x2, LowerLeft = 0x4, LowerRight = 0x8 }; @@ -55,7 +55,7 @@ extern QPainterPath roundedPath(int x, int y, int w, int h, int xrad, int yrad, extern QIcon colorRect(const QColor& color, int width, int height); extern int get_paste_len(); -} // namespace MusEUtils +} // namespace MusECores #endif diff --git a/muse2/muse/widgets/verticalmeter.cpp b/muse2/muse/widgets/verticalmeter.cpp index 4553b156..b8524d33 100644 --- a/muse2/muse/widgets/verticalmeter.cpp +++ b/muse2/muse/widgets/verticalmeter.cpp @@ -34,7 +34,7 @@ #include "mmath.h" #include "utils.h" -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // VerticalMeter @@ -55,7 +55,7 @@ VerticalMeter::VerticalMeter(QWidget* parent, MeterType type) overflow = false; val = 0.0; maxVal = 0.0; - minScale = mtype == DBMeter ? MusEConfig::config.minMeter : 0.0; // min value in dB or int + minScale = mtype == DBMeter ? MusEGlobal::config.minMeter : 0.0; // min value in dB or int maxScale = mtype == DBMeter ? 10.0 : 127.0; yellowScale = -10; redScale = 0; @@ -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); @@ -177,7 +177,7 @@ void VerticalMeter::paintEvent(QPaintEvent* /*ev*/) // Draw the transparent layer on top of everything to give a 3d look QPainterPath round_path = roundedPath(0, 0, w, h, xrad, yrad, - (MusEUtil::Corner) (MusEUtil::UpperLeft | MusEUtil::UpperRight | MusEUtil::LowerLeft | MusEUtil::LowerRight ) ); + (MusECore::Corner) (MusECore::UpperLeft | MusECore::UpperRight | MusECore::LowerLeft | MusECore::LowerRight ) ); maskGrad.setStart(QPointF(0, 0)); maskGrad.setFinalStop(QPointF(0, h)); p.fillPath(round_path, QBrush(maskGrad)); @@ -211,18 +211,18 @@ void VerticalMeter::drawVU(QPainter& p, int w, int h, int xv) QPainterPath p_left = roundedPath(0, 0, x1, h, xrad, yrad, - (MusEUtil::Corner) (MusEUtil::UpperLeft | MusEUtil::LowerLeft ) ); + (MusECore::Corner) (MusECore::UpperLeft | MusECore::LowerLeft ) ); QPainterPath p_right = roundedPath(x2, 0, w-x2, h, xrad, yrad, - (MusEUtil::Corner) (MusEUtil::LowerRight | MusEUtil::UpperRight ) ); + (MusECore::Corner) (MusECore::LowerRight | MusECore::UpperRight ) ); if(xv < x1) { QPainterPath p_light_green = roundedPath(0, 0, xv, h, xrad, yrad, - (MusEUtil::Corner) (MusEUtil::UpperLeft | MusEUtil::LowerLeft ) ); + (MusECore::Corner) (MusECore::UpperLeft | MusECore::LowerLeft ) ); p_left = p_left.subtracted(p_light_green); @@ -254,7 +254,7 @@ void VerticalMeter::drawVU(QPainter& p, int w, int h, int xv) { QPainterPath p_dark_red = roundedPath(xv, 0, w-xv, h, xrad, yrad, - (MusEUtil::Corner) (MusEUtil::LowerRight | MusEUtil::UpperRight ) ); + (MusECore::Corner) (MusECore::LowerRight | MusECore::UpperRight ) ); p_right = p_right.subtracted(p_dark_red); @@ -288,18 +288,18 @@ void VerticalMeter::drawVU(QPainter& p, int w, int h, int xv) QPainterPath p_left = roundedPath(0, 0, cut, h, xrad, yrad, - (MusEUtil::Corner) (MusEUtil::UpperLeft | MusEUtil::LowerLeft ) ); + (MusECore::Corner) (MusECore::UpperLeft | MusECore::LowerLeft ) ); QPainterPath p_right = roundedPath(cut, 0, w-cut, h, xrad, yrad, - (MusEUtil::Corner) (MusEUtil::LowerRight | MusEUtil::UpperRight ) ); + (MusECore::Corner) (MusECore::LowerRight | MusECore::UpperRight ) ); if(xv < cut) { QPainterPath p_light = roundedPath(0, 0, xv, h, xrad, yrad, - (MusEUtil::Corner) (MusEUtil::UpperLeft | MusEUtil::LowerLeft ) ); + (MusECore::Corner) (MusECore::UpperLeft | MusECore::LowerLeft ) ); p_left = p_left.subtracted(p_light); @@ -314,7 +314,7 @@ void VerticalMeter::drawVU(QPainter& p, int w, int h, int xv) { QPainterPath p_dark = roundedPath(xv, 0, w-xv, h, xrad, yrad, - (MusEUtil::Corner) (MusEUtil::UpperRight | MusEUtil::LowerRight ) ); + (MusECore::Corner) (MusECore::UpperRight | MusECore::LowerRight ) ); p_right = p_right.subtracted(p_dark); // left section: @@ -335,7 +335,7 @@ void VerticalMeter::drawVU(QPainter& p, int w, int h, int xv) void VerticalMeter::resizeEvent(QResizeEvent* ev) { - MusEWidget::Meter::resizeEvent(ev); + Meter::resizeEvent(ev); } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/verticalmeter.h b/muse2/muse/widgets/verticalmeter.h index 024ecc10..58185266 100644 --- a/muse2/muse/widgets/verticalmeter.h +++ b/muse2/muse/widgets/verticalmeter.h @@ -31,7 +31,7 @@ class QResizeEvent; class QMouseEvent; class QPainter; -namespace MusEWidget { +namespace MusEGui { class VerticalMeter : public Meter { Q_OBJECT @@ -59,7 +59,7 @@ class VerticalMeter : public Meter { void setRange(double min, double max); }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/view.cpp b/muse2/muse/widgets/view.cpp index 8a9d82b4..fb53be46 100644 --- a/muse2/muse/widgets/view.cpp +++ b/muse2/muse/widgets/view.cpp @@ -42,7 +42,7 @@ // just ate up all the time no matter what I tried. //#defines VIEW_USE_DOUBLE_BUFFERING 1 -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // View::View @@ -981,4 +981,4 @@ QRect View::devToVirt(const QRect& r) } */ -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/view.h b/muse2/muse/widgets/view.h index e5f33657..30f234bb 100644 --- a/muse2/muse/widgets/view.h +++ b/muse2/muse/widgets/view.h @@ -34,7 +34,7 @@ class QPainter; class QPixmap; class QResizeEvent; -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // View @@ -128,7 +128,7 @@ class View : public QWidget { int rmapx(int x) const; }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/visibletracks.cpp b/muse2/muse/widgets/visibletracks.cpp index 7e56bb36..84e7dd42 100644 --- a/muse2/muse/widgets/visibletracks.cpp +++ b/muse2/muse/widgets/visibletracks.cpp @@ -30,7 +30,7 @@ #include "track.h" #include "synth.h" -namespace MusEWidget { +namespace MusEGui { const char* waveTrack = QT_TRANSLATE_NOOP("@default", "Show wave tracks"); const char* groupTrack = QT_TRANSLATE_NOOP("@default", "Show group tracks"); @@ -90,13 +90,13 @@ VisibleTracks::VisibleTracks(QWidget* parent, const char*) //--------------------------------------------------------- void VisibleTracks::updateVisibleTracksButtons() { - actions[0]->setChecked(WaveTrack::visible()); - actions[1]->setChecked(AudioGroup::visible()); - actions[2]->setChecked(AudioAux::visible()); - actions[3]->setChecked(AudioInput::visible()); - actions[4]->setChecked(AudioOutput::visible()); - actions[5]->setChecked(MidiTrack::visible()); - actions[6]->setChecked(SynthI::visible()); + actions[0]->setChecked(MusECore::WaveTrack::visible()); + actions[1]->setChecked(MusECore::AudioGroup::visible()); + actions[2]->setChecked(MusECore::AudioAux::visible()); + actions[3]->setChecked(MusECore::AudioInput::visible()); + actions[4]->setChecked(MusECore::AudioOutput::visible()); + actions[5]->setChecked(MusECore::MidiTrack::visible()); + actions[6]->setChecked(MusECore::SynthI::visible()); } //--------------------------------------------------------- // toolChanged @@ -107,25 +107,25 @@ void VisibleTracks::visibilityChanged(QAction* action) // printf("update visibility\n"); switch (((Action*)action)->id()) { case 0: - WaveTrack::setVisible(action->isChecked()); + MusECore::WaveTrack::setVisible(action->isChecked()); break; case 1: - AudioGroup::setVisible(action->isChecked()); + MusECore::AudioGroup::setVisible(action->isChecked()); break; case 2: - AudioAux::setVisible(action->isChecked()); + MusECore::AudioAux::setVisible(action->isChecked()); break; case 3: - AudioInput::setVisible(action->isChecked()); + MusECore::AudioInput::setVisible(action->isChecked()); break; case 4: - AudioOutput::setVisible(action->isChecked()); + MusECore::AudioOutput::setVisible(action->isChecked()); break; case 5: - MidiTrack::setVisible(action->isChecked()); + MusECore::MidiTrack::setVisible(action->isChecked()); break; case 6: - SynthI::setVisible(action->isChecked()); + MusECore::SynthI::setVisible(action->isChecked()); break; default: break; @@ -142,4 +142,4 @@ VisibleTracks::~VisibleTracks() delete [] actions; } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/visibletracks.h b/muse2/muse/widgets/visibletracks.h index b0e92d26..d56c9ce7 100644 --- a/muse2/muse/widgets/visibletracks.h +++ b/muse2/muse/widgets/visibletracks.h @@ -29,7 +29,7 @@ class QAction; class QPixmap; class QWidget; -namespace MusEWidget { +namespace MusEGui { class Action; @@ -62,6 +62,6 @@ class VisibleTracks : public QToolBar { ~VisibleTracks(); }; -} // namespace MusEWidget +} // namespace MusEGui #endif // VISIBLETRACKS_H diff --git a/muse2/muse/widgets/vscale.cpp b/muse2/muse/widgets/vscale.cpp index 22af7889..f47e1c41 100644 --- a/muse2/muse/widgets/vscale.cpp +++ b/muse2/muse/widgets/vscale.cpp @@ -25,7 +25,7 @@ #include <QPainter> #include <QPaintEvent> -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // paintEvent @@ -43,4 +43,4 @@ void VScale::paintEvent(QPaintEvent*) p.end(); } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/vscale.h b/muse2/muse/widgets/vscale.h index e926b3cb..62f1d553 100644 --- a/muse2/muse/widgets/vscale.h +++ b/muse2/muse/widgets/vscale.h @@ -27,7 +27,7 @@ class QPaintEvent; -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // VScale @@ -42,7 +42,7 @@ class VScale : public QWidget { VScale(QWidget* parent=0) : QWidget(parent) {setFixedWidth(18);} }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/widgets/wtscale.cpp b/muse2/muse/widgets/wtscale.cpp index 94bd058d..82ab0ca4 100644 --- a/muse2/muse/widgets/wtscale.cpp +++ b/muse2/muse/widgets/wtscale.cpp @@ -34,7 +34,7 @@ #include "../marker/marker.h" #include "icons.h" -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // WTScale @@ -47,15 +47,15 @@ WTScale::WTScale(int* r, QWidget* parent, int xs) QToolTip::add(this, tr("bar scale")); barLocator = false; raster = r; - pos[0] = int(song->tempomap()->tick2time(song->cpos()) * sampleRate); - pos[1] = int(song->tempomap()->tick2time(song->lpos()) * sampleRate); - pos[2] = int(song->tempomap()->tick2time(song->rpos()) * sampleRate); + pos[0] = int(MusEGlobal::song->tempomap()->tick2time(MusEGlobal::song->cpos()) * sampleRate); + pos[1] = int(MusEGlobal::song->tempomap()->tick2time(MusEGlobal::song->lpos()) * sampleRate); + pos[2] = int(MusEGlobal::song->tempomap()->tick2time(MusEGlobal::song->rpos()) * sampleRate); pos[3] = -1; // do not show button = Qt::NoButton; setMouseTracking(true); - connect(song, SIGNAL(posChanged(int, unsigned, bool)), SLOT(setPos(int, unsigned, bool))); - connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); - connect(song, SIGNAL(markerChanged(int)), SLOT(redraw())); + connect(MusEGlobal::song, SIGNAL(posChanged(int, unsigned, bool)), SLOT(setPos(int, unsigned, bool))); + connect(MusEGlobal::song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); + connect(MusEGlobal::song, SIGNAL(markerChanged(int)), SLOT(redraw())); setFixedHeight(28); setBg(QColor(0xe0, 0xe0, 0xe0)); } @@ -74,7 +74,7 @@ void WTScale::songChanged(int /*type*/) void WTScale::setPos(int idx, unsigned val, bool adjustScrollbar) { - val = int(song->tempomap()->tick2time(val) * sampleRate); + val = int(MusEGlobal::song->tempomap()->tick2time(val) * sampleRate); if (val == pos[idx]) return; int opos = mapx(pos[idx] == -1 ? val : pos[idx]); @@ -120,8 +120,8 @@ void WTScale::viewMouseReleaseEvent(QMouseEvent* event) void WTScale::viewMouseMoveEvent(QMouseEvent* event) { - int x= song->tempomap()->time2tick(double(event->x())/double(sampleRate)); - x = song->raster(x, *raster); + int x= MusEGlobal::song->tempomap()->time2tick(double(event->x())/double(sampleRate)); + x = MusEGlobal::song->raster(x, *raster); if (x < 0) x = 0; emit timeChanged(x); @@ -134,7 +134,7 @@ void WTScale::viewMouseMoveEvent(QMouseEvent* event) i = 1; break; case Qt::RightButton: - if ((MusEConfig::config.rangeMarkerWithoutMMB) && (event->modifiers() & Qt::ControlModifier)) + if ((MusEGlobal::config.rangeMarkerWithoutMMB) && (event->modifiers() & Qt::ControlModifier)) i = 1; else i = 2; @@ -142,7 +142,7 @@ void WTScale::viewMouseMoveEvent(QMouseEvent* event) default: return; } - song->setPos(i, x); + MusEGlobal::song->setPos(i, x); } //--------------------------------------------------------- @@ -175,7 +175,7 @@ void WTScale::pdraw(QPainter& p, const QRect& r) p.drawLine(r.x(), y+1, r.x() + r.width(), y+1); QRect tr(r); tr.setHeight(12); - MarkerList* marker = song->marker(); + MarkerList* marker = MusEGlobal::song->marker(); for (iMarker m = marker->begin(); m != marker->end(); ++m) { int xp = mapx(int(m->second.time() * sampleRate)); if (xp > x+w) @@ -239,19 +239,19 @@ void WTScale::pdraw(QPainter& p, const QRect& r) p.drawLine(xp, 0, xp, height()); } - int ctick = song->samples2tick(mapxDev(x)); + int ctick = MusEGlobal::song->samples2tick(mapxDev(x)); int bar1, bar2, beat, tick; - song->tickValues(ctick, &bar1, &beat, &tick); - song->tickValues(song->samples2tick(mapxDev(x+w)), &bar2, &beat, &tick); + MusEGlobal::song->tickValues(ctick, &bar1, &beat, &tick); + MusEGlobal::song->tickValues(MusEGlobal::song->samples2tick(mapxDev(x+w)), &bar2, &beat, &tick); //printf("bar %d %d-%d=%d\n", bar, ntick, stick, ntick-stick); - int stick = song->bar2tick(bar1, 0, 0); + int stick = MusEGlobal::song->bar2tick(bar1, 0, 0); int ntick; for (int bar = bar1; bar <= bar2; bar++, stick = ntick) { - ntick = song->bar2tick(bar+1, 0, 0); - int a = song->tick2samples(ntick); - int b = song->tick2samples(stick); + ntick = MusEGlobal::song->bar2tick(bar+1, 0, 0); + int a = MusEGlobal::song->tick2samples(ntick); + int b = MusEGlobal::song->tick2samples(stick); int tpix = rmapx(a - b); if (tpix < 64) { // don´t show beats if measure is this small @@ -278,9 +278,9 @@ void WTScale::pdraw(QPainter& p, const QRect& r) } else { int z, n; - song->timesig(stick, z, n); + MusEGlobal::song->timesig(stick, z, n); for (int beat = 0; beat < z; beat++) { - int xx = song->tick2samples(song->bar2tick(bar, beat, 0)); + int xx = MusEGlobal::song->tick2samples(MusEGlobal::song->bar2tick(bar, beat, 0)); int xp = mapx(xx); QString s; QRect r(xp+2, y, 0, h); @@ -305,5 +305,5 @@ void WTScale::pdraw(QPainter& p, const QRect& r) } } -} // namespace MusEWidget +} // namespace MusEGui diff --git a/muse2/muse/widgets/wtscale.h b/muse2/muse/widgets/wtscale.h index b25de627..1999a91f 100644 --- a/muse2/muse/widgets/wtscale.h +++ b/muse2/muse/widgets/wtscale.h @@ -25,7 +25,7 @@ #include "view.h" -namespace MusEWidget { +namespace MusEGui { //--------------------------------------------------------- // WTScale @@ -60,7 +60,7 @@ class WTScale : public View { void setBarLocator(bool f) { barLocator = f; } }; -} // namespace MusEWidget +} // namespace MusEGui #endif diff --git a/muse2/muse/xml.cpp b/muse2/muse/xml.cpp index 0487dda5..139437c1 100644 --- a/muse2/muse/xml.cpp +++ b/muse2/muse/xml.cpp @@ -31,6 +31,8 @@ #include "xml.h" +namespace MusECore { + //--------------------------------------------------------- // Note: // this code is a Q/D hack for reading/parsing and @@ -747,3 +749,5 @@ void Xml::dump(QString &dump) dump.append(lbuffer); fsetpos(f, &pos); } + +} // namespace MusECore diff --git a/muse2/muse/xml.h b/muse2/muse/xml.h index 2d2b2ee1..0c61bf08 100644 --- a/muse2/muse/xml.h +++ b/muse2/muse/xml.h @@ -32,6 +32,8 @@ class QColor; class QRect; class QWidget; +namespace MusECore { + //--------------------------------------------------------- // Xml // very simple XML-like parser @@ -107,5 +109,8 @@ class Xml { }; extern QRect readGeometry(Xml&, const QString&); + +} // namespace MusECore + #endif diff --git a/muse2/synti/deicsonze/deicsonze.cpp b/muse2/synti/deicsonze/deicsonze.cpp index 01608fcb..9048b727 100644 --- a/muse2/synti/deicsonze/deicsonze.cpp +++ b/muse2/synti/deicsonze/deicsonze.cpp @@ -143,15 +143,15 @@ DeicsOnze::DeicsOnze() : Mess(2) { _gui->setWindowTitle(QString("DeicsOnze")); //FX - Plugin* p; - p = plugins.find("freeverb", "freeverb1"); + MusECore::Plugin* p; + p = MusEGlobal::plugins.find("freeverb", "freeverb1"); _pluginIReverb = NULL; if(p) initPluginReverb(p); _pluginIChorus = NULL; - p = plugins.find("doublechorus", "doublechorus1"); + p = MusEGlobal::plugins.find("doublechorus", "doublechorus1"); if(p) initPluginChorus(p); _pluginIDelay = NULL; - p = plugins.find("pandelay", "pandelay"); + p = MusEGlobal::plugins.find("pandelay", "pandelay"); if(p) initPluginDelay(p); //Filter @@ -197,7 +197,7 @@ DeicsOnze::DeicsOnze() : Mess(2) { unsigned char dataMasterVol[2]; dataMasterVol[0]=SYSEX_MASTERVOL; dataMasterVol[1]=getMasterVol(); - MidiPlayEvent evSysexMasterVol(0, 0, ME_SYSEX, + MusECore::MidiPlayEvent evSysexMasterVol(0, 0, MusECore::ME_SYSEX, (const unsigned char*)dataMasterVol, 2); _gui->writeEvent(evSysexMasterVol); @@ -205,30 +205,30 @@ DeicsOnze::DeicsOnze() : Mess(2) { unsigned char *dataReverbRet = new unsigned char[2]; dataReverbRet[0]=SYSEX_REVERBRETURN; dataReverbRet[1]=(unsigned char)getReverbReturn(); - MidiPlayEvent evReverbRet(0, 0, ME_SYSEX,(const unsigned char*)dataReverbRet, 2); + MusECore::MidiPlayEvent evReverbRet(0, 0, MusECore::ME_SYSEX,(const unsigned char*)dataReverbRet, 2); _gui->writeEvent(evReverbRet); unsigned char *dataChorusRet = new unsigned char[2]; dataChorusRet[0]=SYSEX_CHORUSRETURN; dataChorusRet[1]=(unsigned char)getChorusReturn(); - MidiPlayEvent evChorusRet(0, 0, ME_SYSEX,(const unsigned char*)dataChorusRet, 2); + MusECore::MidiPlayEvent evChorusRet(0, 0, MusECore::ME_SYSEX,(const unsigned char*)dataChorusRet, 2); _gui->writeEvent(evChorusRet); unsigned char *dataDelayRet = new unsigned char[2]; dataDelayRet[0]=SYSEX_DELAYRETURN; dataDelayRet[1]=(unsigned char)getDelayReturn(); //printf("DELAY RET = %d, REVERB RET = %d\n", //getDelayReturn(), getReverbReturn()); - MidiPlayEvent evDelayRet(0, 0, ME_SYSEX,(const unsigned char*)dataDelayRet, 2); + MusECore::MidiPlayEvent evDelayRet(0, 0, MusECore::ME_SYSEX,(const unsigned char*)dataDelayRet, 2); _gui->writeEvent(evDelayRet); //update font size unsigned char *dataFontSize = new unsigned char[2]; dataFontSize[0]=SYSEX_FONTSIZE; dataFontSize[1]=(unsigned char)_global.fontSize; - MidiPlayEvent evFontSize(0, 0, ME_SYSEX, (const unsigned char*)dataFontSize, 2); + MusECore::MidiPlayEvent evFontSize(0, 0, MusECore::ME_SYSEX, (const unsigned char*)dataFontSize, 2); _gui->writeEvent(evFontSize); //display load preset unsigned char dataUpdateGuiSet[1]; dataUpdateGuiSet[0]=SYSEX_UPDATESETGUI; - MidiPlayEvent evSysexUpdateGuiSet(0, 0, ME_SYSEX, + MusECore::MidiPlayEvent evSysexUpdateGuiSet(0, 0, MusECore::ME_SYSEX, (const unsigned char*)dataUpdateGuiSet, 1); _gui->writeEvent(evSysexUpdateGuiSet); @@ -1271,7 +1271,7 @@ void DeicsOnze::loadSet(QString fileName) { //display load preset unsigned char dataUpdateGuiSet[1]; dataUpdateGuiSet[0]=SYSEX_UPDATESETGUI; - MidiPlayEvent evSysexUpdateGuiSet(0, 0, ME_SYSEX, + MusECore::MidiPlayEvent evSysexUpdateGuiSet(0, 0, MusECore::ME_SYSEX, (const unsigned char*)dataUpdateGuiSet, 1); _gui->writeEvent(evSysexUpdateGuiSet); @@ -2065,7 +2065,7 @@ void DeicsOnze::readConfiguration(QDomNode qdn) { /* if(qdEl.tagName()==NBRVOICESSTR) { setNbrVoices(qdEl.text().toInt()); - MidiPlayEvent evNbrVoices(0, 0, 0, ME_CONTROLLER, + MusECore::MidiPlayEvent evNbrVoices(0, 0, 0, MusECore::ME_CONTROLLER, CTRL_NBRVOICES, _global.nbrVoices); _gui->writeEvent(evNbrVoices); }*/ @@ -2076,8 +2076,8 @@ void DeicsOnze::readConfiguration(QDomNode qdn) { unsigned char *dataChannelNum = new unsigned char[2]; dataChannelNum[0]=SYSEX_CHANNELNUM; dataChannelNum[1]=(unsigned char)_global.channelNum; - MidiPlayEvent - evChannelNum(0, 0, ME_SYSEX, (const unsigned char*)dataChannelNum, 2); + MusECore::MidiPlayEvent + evChannelNum(0, 0, MusECore::ME_SYSEX, (const unsigned char*)dataChannelNum, 2); _gui->writeEvent(evChannelNum); }*/ //quality @@ -2089,7 +2089,7 @@ void DeicsOnze::readConfiguration(QDomNode qdn) { unsigned char *dataQuality = new unsigned char[2]; dataQuality[0]=SYSEX_QUALITY; dataQuality[1]=(unsigned char)_global.quality; - MidiPlayEvent evQuality(0, 0, ME_SYSEX, (const unsigned char*)dataQuality, 2); + MusECore::MidiPlayEvent evQuality(0, 0, MusECore::ME_SYSEX, (const unsigned char*)dataQuality, 2); _gui->writeEvent(evQuality); } //filter @@ -2098,7 +2098,7 @@ void DeicsOnze::readConfiguration(QDomNode qdn) { unsigned char *dataFilter = new unsigned char[2]; dataFilter[0]=SYSEX_FILTER; dataFilter[1]=(unsigned char)getFilter(); - MidiPlayEvent evFilter(0, 0, ME_SYSEX, (const unsigned char*)dataFilter, 2); + MusECore::MidiPlayEvent evFilter(0, 0, MusECore::ME_SYSEX, (const unsigned char*)dataFilter, 2); _gui->writeEvent(evFilter); } //font size @@ -2107,7 +2107,7 @@ void DeicsOnze::readConfiguration(QDomNode qdn) { unsigned char *dataFontSize = new unsigned char[2]; dataFontSize[0]=SYSEX_FONTSIZE; dataFontSize[1]=(unsigned char)_global.fontSize; - MidiPlayEvent evFontSize(0, 0, ME_SYSEX, (const unsigned char*)dataFontSize, 2); + MusECore::MidiPlayEvent evFontSize(0, 0, MusECore::ME_SYSEX, (const unsigned char*)dataFontSize, 2); _gui->writeEvent(evFontSize); } //saveConfig @@ -2116,8 +2116,8 @@ void DeicsOnze::readConfiguration(QDomNode qdn) { unsigned char *dataSaveConfig = new unsigned char[2]; dataSaveConfig[0]=SYSEX_SAVECONFIG; dataSaveConfig[1]=(unsigned char)_saveConfig; - MidiPlayEvent - evSaveConfig(0, 0, ME_SYSEX, (const unsigned char*)dataSaveConfig, 2); + MusECore::MidiPlayEvent + evSaveConfig(0, 0, MusECore::ME_SYSEX, (const unsigned char*)dataSaveConfig, 2); _gui->writeEvent(evSaveConfig); } //saveOnlyUsed @@ -2126,8 +2126,8 @@ void DeicsOnze::readConfiguration(QDomNode qdn) { unsigned char *dataSaveOnlyUsed = new unsigned char[2]; dataSaveOnlyUsed[0]=SYSEX_SAVEONLYUSED; dataSaveOnlyUsed[1]=(unsigned char)_saveOnlyUsed; - MidiPlayEvent - evSaveOnlyUsed(0, 0, ME_SYSEX, (const unsigned char*)dataSaveOnlyUsed, 2); + MusECore::MidiPlayEvent + evSaveOnlyUsed(0, 0, MusECore::ME_SYSEX, (const unsigned char*)dataSaveOnlyUsed, 2); _gui->writeEvent(evSaveOnlyUsed); } //colors @@ -2145,8 +2145,8 @@ void DeicsOnze::readConfiguration(QDomNode qdn) { unsigned char *dataIsInitSet = new unsigned char[2]; dataIsInitSet[0]=SYSEX_ISINITSET; dataIsInitSet[1]=(unsigned char)_isInitSet; - MidiPlayEvent - evIsInitSet(0, 0, ME_SYSEX, (const unsigned char*)dataIsInitSet, 2); + MusECore::MidiPlayEvent + evIsInitSet(0, 0, MusECore::ME_SYSEX, (const unsigned char*)dataIsInitSet, 2); _gui->writeEvent(evIsInitSet); } if(qdEl.tagName()==INITSETPATHSTR) { @@ -2156,8 +2156,8 @@ void DeicsOnze::readConfiguration(QDomNode qdn) { dataInitSetPath[0]=SYSEX_INITSETPATH; strncpy((char*)&dataInitSetPath[1], _initSetPath.toLatin1().constData(), MAXSTRLENGTHINITSETPATH); - MidiPlayEvent - evInitSetPath(0, 0, ME_SYSEX, (const unsigned char*)dataInitSetPath, + MusECore::MidiPlayEvent + evInitSetPath(0, 0, MusECore::ME_SYSEX, (const unsigned char*)dataInitSetPath, 1+MAXSTRLENGTHINITSETPATH); _gui->writeEvent(evInitSetPath); } @@ -2167,8 +2167,8 @@ void DeicsOnze::readConfiguration(QDomNode qdn) { unsigned char *dataIsBackgroundPix = new unsigned char[2]; dataIsBackgroundPix[0]=SYSEX_ISBACKGROUNDPIX; dataIsBackgroundPix[1]=(unsigned char)_isBackgroundPix; - MidiPlayEvent - evIsBackgroundPix(0, 0, ME_SYSEX, + MusECore::MidiPlayEvent + evIsBackgroundPix(0, 0, MusECore::ME_SYSEX, (const unsigned char*)dataIsBackgroundPix, 2); _gui->writeEvent(evIsBackgroundPix); } @@ -2180,8 +2180,8 @@ void DeicsOnze::readConfiguration(QDomNode qdn) { strncpy((char*)&dataBackgroundPixPath[1], _backgroundPixPath.toLatin1().constData(), MAXSTRLENGTHBACKGROUNDPIXPATH); - MidiPlayEvent - evBackgroundPixPath(0, 0, ME_SYSEX, + MusECore::MidiPlayEvent + evBackgroundPixPath(0, 0, MusECore::ME_SYSEX, (const unsigned char*)dataBackgroundPixPath, 1+MAXSTRLENGTHBACKGROUNDPIXPATH); _gui->writeEvent(evBackgroundPixPath); @@ -2203,7 +2203,7 @@ void DeicsOnze::readConfiguration(QDomNode qdn) { dataColorGui[10]=(unsigned char)editBackgroundColor.red(); dataColorGui[11]=(unsigned char)editBackgroundColor.green(); dataColorGui[12]=(unsigned char)editBackgroundColor.blue(); - MidiPlayEvent evSysexColor(0, 0, ME_SYSEX, (const unsigned char*)dataColorGui, + MusECore::MidiPlayEvent evSysexColor(0, 0, MusECore::ME_SYSEX, (const unsigned char*)dataColorGui, COLORSYSEXLENGTH+1); _gui->writeEvent(evSysexColor); } @@ -2465,84 +2465,84 @@ void DeicsOnze::parseInitData(int length, const unsigned char* data) { unsigned char *dataMasterVol = new unsigned char[2]; dataMasterVol[0]=SYSEX_MASTERVOL; dataMasterVol[1]=(unsigned char) getMasterVol(); - MidiPlayEvent - evMasterVol(0, 0, ME_SYSEX, (const unsigned char*)dataMasterVol, 2); + MusECore::MidiPlayEvent + evMasterVol(0, 0, MusECore::ME_SYSEX, (const unsigned char*)dataMasterVol, 2); _gui->writeEvent(evMasterVol); //channel configuration for(int c = 0; c < NBRCHANNELS; c++) { //isEnable setChannelEnable(c, data[NUM_CHANNEL_ENABLE + c]); - MidiPlayEvent - evChEnable(0, 0, c, ME_CONTROLLER, + MusECore::MidiPlayEvent + evChEnable(0, 0, c, MusECore::ME_CONTROLLER, CTRL_CHANNELENABLE, data[NUM_CHANNEL_ENABLE + c]); _gui->writeEvent(evChEnable); //nbrVoices setNbrVoices(c, data[NUM_NBRVOICES + c]); - MidiPlayEvent - evNbrVoices(0, 0, c,ME_CONTROLLER,CTRL_NBRVOICES, data[NUM_NBRVOICES + c]); + MusECore::MidiPlayEvent + evNbrVoices(0, 0, c,MusECore::ME_CONTROLLER,CTRL_NBRVOICES, data[NUM_NBRVOICES + c]); _gui->writeEvent(evNbrVoices); //channel volume setChannelVol(c, data[NUM_CHANNEL_VOL + c]); - MidiPlayEvent - evChVol(0, 0, c, ME_CONTROLLER, + MusECore::MidiPlayEvent + evChVol(0, 0, c, MusECore::ME_CONTROLLER, CTRL_CHANNELVOLUME, data[NUM_CHANNEL_VOL + c]); _gui->writeEvent(evChVol); //channel pan setChannelPan(c, data[NUM_CHANNEL_PAN + c]); - MidiPlayEvent - evChPan(0, 0, c, ME_CONTROLLER, CTRL_CHANNELPAN, + MusECore::MidiPlayEvent + evChPan(0, 0, c, MusECore::ME_CONTROLLER, CTRL_CHANNELPAN, data[NUM_CHANNEL_PAN + c]); _gui->writeEvent(evChPan); if(getChannelEnable(c)) applyChannelAmp(c); //channel detune setChannelDetune(c, data[NUM_CHANNEL_DETUNE + c]-MAXCHANNELDETUNE); - MidiPlayEvent - evChDetune(0, 0, c, ME_CONTROLLER, CTRL_CHANNELDETUNE, + MusECore::MidiPlayEvent + evChDetune(0, 0, c, MusECore::ME_CONTROLLER, CTRL_CHANNELDETUNE, data[NUM_CHANNEL_DETUNE + c]-MAXCHANNELDETUNE); _gui->writeEvent(evChDetune); //channel brightness setChannelBrightness(c, data[NUM_CHANNEL_BRIGHTNESS + 2*c] + data[NUM_CHANNEL_BRIGHTNESS + 2*c + 1] * 256); - MidiPlayEvent - evChBrightness(0, 0, c, ME_CONTROLLER, + MusECore::MidiPlayEvent + evChBrightness(0, 0, c, MusECore::ME_CONTROLLER, CTRL_FINEBRIGHTNESS, getChannelBrightness(c)); _gui->writeEvent(evChBrightness); //channel modulation setChannelModulation(c, data[NUM_CHANNEL_MODULATION + c]); - MidiPlayEvent - evChMod(0, 0, c, ME_CONTROLLER, - CTRL_MODULATION, data[NUM_CHANNEL_MODULATION + c]); + MusECore::MidiPlayEvent + evChMod(0, 0, c, MusECore::ME_CONTROLLER, + MusECore::CTRL_MODULATION, data[NUM_CHANNEL_MODULATION + c]); _gui->writeEvent(evChMod); //channel attack setChannelAttack(c, data[NUM_CHANNEL_ATTACK + c]); - MidiPlayEvent - evChAttack(0, 0, c, ME_CONTROLLER, - CTRL_ATTACK_TIME, data[NUM_CHANNEL_ATTACK + c]); + MusECore::MidiPlayEvent + evChAttack(0, 0, c, MusECore::ME_CONTROLLER, + MusECore::CTRL_ATTACK_TIME, data[NUM_CHANNEL_ATTACK + c]); _gui->writeEvent(evChAttack); //channel release setChannelRelease(c, data[NUM_CHANNEL_RELEASE + c]); - MidiPlayEvent - evChRelease(0, 0, c, ME_CONTROLLER, - CTRL_RELEASE_TIME, data[NUM_CHANNEL_RELEASE + c]); + MusECore::MidiPlayEvent + evChRelease(0, 0, c, MusECore::ME_CONTROLLER, + MusECore::CTRL_RELEASE_TIME, data[NUM_CHANNEL_RELEASE + c]); _gui->writeEvent(evChRelease); //channel reverb setChannelReverb(c, data[NUM_CHANNEL_REVERB + c]); - MidiPlayEvent - evChReverb(0, 0, c, ME_CONTROLLER, - CTRL_REVERB_SEND, data[NUM_CHANNEL_REVERB + c]); + MusECore::MidiPlayEvent + evChReverb(0, 0, c, MusECore::ME_CONTROLLER, + MusECore::CTRL_REVERB_SEND, data[NUM_CHANNEL_REVERB + c]); _gui->writeEvent(evChReverb); //channel chorus setChannelChorus(c, data[NUM_CHANNEL_CHORUS + c]); - MidiPlayEvent - evChChorus(0, 0, c, ME_CONTROLLER, - CTRL_CHORUS_SEND, data[NUM_CHANNEL_CHORUS + c]); + MusECore::MidiPlayEvent + evChChorus(0, 0, c, MusECore::ME_CONTROLLER, + MusECore::CTRL_CHORUS_SEND, data[NUM_CHANNEL_CHORUS + c]); _gui->writeEvent(evChChorus); //channel delay setChannelDelay(c, data[NUM_CHANNEL_DELAY + c]); - MidiPlayEvent - evChDelay(0, 0, c, ME_CONTROLLER, - CTRL_VARIATION_SEND, data[NUM_CHANNEL_DELAY + c]); + MusECore::MidiPlayEvent + evChDelay(0, 0, c, MusECore::ME_CONTROLLER, + MusECore::CTRL_VARIATION_SEND, data[NUM_CHANNEL_DELAY + c]); _gui->writeEvent(evChDelay); } //load configuration @@ -2550,8 +2550,8 @@ void DeicsOnze::parseInitData(int length, const unsigned char* data) { unsigned char *dataSaveConfig = new unsigned char[2]; dataSaveConfig[0]=SYSEX_SAVECONFIG; dataSaveConfig[1]=(unsigned char)_saveConfig; - MidiPlayEvent - evSaveConfig(0, 0, ME_SYSEX, (const unsigned char*)dataSaveConfig, 2); + MusECore::MidiPlayEvent + evSaveConfig(0, 0, MusECore::ME_SYSEX, (const unsigned char*)dataSaveConfig, 2); _gui->writeEvent(evSaveConfig); if(_saveConfig) { //saveOnlyUsed @@ -2559,15 +2559,15 @@ void DeicsOnze::parseInitData(int length, const unsigned char* data) { unsigned char *dataSaveOnlyUsed = new unsigned char[2]; dataSaveOnlyUsed[0]=SYSEX_SAVEONLYUSED; dataSaveOnlyUsed[1]=(unsigned char)_saveOnlyUsed; - MidiPlayEvent - evSaveOnlyUsed(0, 0, ME_SYSEX, (const unsigned char*)dataSaveOnlyUsed, 2); + MusECore::MidiPlayEvent + evSaveOnlyUsed(0, 0, MusECore::ME_SYSEX, (const unsigned char*)dataSaveOnlyUsed, 2); _gui->writeEvent(evSaveOnlyUsed); //colors unsigned char dataColorGui[COLORSYSEXLENGTH+1]; dataColorGui[0]=SYSEX_COLORGUI; for (int i=0; i<COLORSYSEXLENGTH; i++) dataColorGui[i+1]=data[NUM_RED_TEXT+i]; - MidiPlayEvent evSysexColor(0, 0, ME_SYSEX, (const unsigned char*)dataColorGui, + MusECore::MidiPlayEvent evSysexColor(0, 0, MusECore::ME_SYSEX, (const unsigned char*)dataColorGui, COLORSYSEXLENGTH+1); _gui->writeEvent(evSysexColor); //quality @@ -2575,47 +2575,47 @@ void DeicsOnze::parseInitData(int length, const unsigned char* data) { dataQuality[0]=SYSEX_QUALITY; dataQuality[1]=data[NUM_QUALITY]; setQuality((Quality)data[NUM_QUALITY]); - MidiPlayEvent evQuality(0, 0, ME_SYSEX, (const unsigned char*)dataQuality, 2); + MusECore::MidiPlayEvent evQuality(0, 0, MusECore::ME_SYSEX, (const unsigned char*)dataQuality, 2); _gui->writeEvent(evQuality); //filter unsigned char dataFilter[2]; dataFilter[0]=SYSEX_FILTER; dataFilter[1]=data[NUM_FILTER]; setFilter((bool)data[NUM_FILTER]); - MidiPlayEvent evFilter(0, 0, ME_SYSEX, (const unsigned char*)dataFilter, 2); + MusECore::MidiPlayEvent evFilter(0, 0, MusECore::ME_SYSEX, (const unsigned char*)dataFilter, 2); _gui->writeEvent(evFilter); //font size unsigned char dataFontSize[2]; dataFontSize[0]=SYSEX_FONTSIZE; dataFontSize[1]=data[NUM_FONTSIZE]; - MidiPlayEvent evFontSize(0, 0, ME_SYSEX, (const unsigned char*)dataFontSize, 2); + MusECore::MidiPlayEvent evFontSize(0, 0, MusECore::ME_SYSEX, (const unsigned char*)dataFontSize, 2); _gui->writeEvent(evFontSize); //load init set unsigned char dataIsInitSet[2]; dataIsInitSet[0]=SYSEX_ISINITSET; dataIsInitSet[1]=data[NUM_ISINITSET]; - MidiPlayEvent evIsInitSet(0, 0, ME_SYSEX, + MusECore::MidiPlayEvent evIsInitSet(0, 0, MusECore::ME_SYSEX, (const unsigned char*)dataIsInitSet, 2); _gui->writeEvent(evIsInitSet); unsigned char dataInitSetPath[1+MAXSTRLENGTHINITSETPATH]; dataInitSetPath[0]=SYSEX_INITSETPATH; for(int a = 0; a < MAXSTRLENGTHINITSETPATH; a++) dataInitSetPath[a+1] = data[a+NUM_INITSETPATH]; - MidiPlayEvent evInitSetPath(0, 0, ME_SYSEX,(const unsigned char*)dataInitSetPath, + MusECore::MidiPlayEvent evInitSetPath(0, 0, MusECore::ME_SYSEX,(const unsigned char*)dataInitSetPath, 1+MAXSTRLENGTHINITSETPATH); _gui->writeEvent(evInitSetPath); //load background pix unsigned char dataIsBackgroundPix[2]; dataIsBackgroundPix[0]=SYSEX_ISBACKGROUNDPIX; dataIsBackgroundPix[1]=data[NUM_ISBACKGROUNDPIX]; - MidiPlayEvent evIsBackgroundPix(0, 0, ME_SYSEX, + MusECore::MidiPlayEvent evIsBackgroundPix(0, 0, MusECore::ME_SYSEX, (const unsigned char*)dataIsBackgroundPix, 2); _gui->writeEvent(evIsBackgroundPix); unsigned char dataBackgroundPixPath[1+MAXSTRLENGTHBACKGROUNDPIXPATH]; dataBackgroundPixPath[0]=SYSEX_BACKGROUNDPIXPATH; for(int a = 0; a < MAXSTRLENGTHBACKGROUNDPIXPATH; a++) dataBackgroundPixPath[a+1] = data[a+NUM_BACKGROUNDPIXPATH]; - MidiPlayEvent evBackgroundPixPath(0, 0, ME_SYSEX, + MusECore::MidiPlayEvent evBackgroundPixPath(0, 0, MusECore::ME_SYSEX, (const unsigned char*)dataBackgroundPixPath, 1+MAXSTRLENGTHBACKGROUNDPIXPATH); _gui->writeEvent(evBackgroundPixPath); @@ -2627,16 +2627,16 @@ void DeicsOnze::parseInitData(int length, const unsigned char* data) { unsigned char *dataReverbAct = new unsigned char[2]; dataReverbAct[0]=SYSEX_REVERBACTIV; dataReverbAct[1]=(unsigned char)_global.isReverbActivated; - MidiPlayEvent evReverbAct(0, 0, ME_SYSEX,(const unsigned char*)dataReverbAct, 2); + MusECore::MidiPlayEvent evReverbAct(0, 0, MusECore::ME_SYSEX,(const unsigned char*)dataReverbAct, 2); _gui->writeEvent(evReverbAct); setReverbReturn((int)data[NUM_REVERB_RETURN]); unsigned char *dataReverbRet = new unsigned char[2]; dataReverbRet[0]=SYSEX_REVERBRETURN; dataReverbRet[1]=(unsigned char)getReverbReturn(); - MidiPlayEvent evReverbRet(0, 0, ME_SYSEX,(const unsigned char*)dataReverbRet, 2); + MusECore::MidiPlayEvent evReverbRet(0, 0, MusECore::ME_SYSEX,(const unsigned char*)dataReverbRet, 2); _gui->writeEvent(evReverbRet); - Plugin* p; - p = plugins.find((const char*)&data[NUM_REVERB_LIB], + MusECore::Plugin* p; + p = MusEGlobal::plugins.find((const char*)&data[NUM_REVERB_LIB], (const char*)&data[NUM_REVERB_LABEL]); if(p) { initPluginReverb(p); @@ -2648,7 +2648,7 @@ void DeicsOnze::parseInitData(int length, const unsigned char* data) { } char dataBuildRev; dataBuildRev = SYSEX_BUILDGUIREVERB; - MidiPlayEvent evSysexBuildRev(0, 0, ME_SYSEX, + MusECore::MidiPlayEvent evSysexBuildRev(0, 0, MusECore::ME_SYSEX, (const unsigned char*)&dataBuildRev, 1); _gui->writeEvent(evSysexBuildRev); } @@ -2658,15 +2658,15 @@ void DeicsOnze::parseInitData(int length, const unsigned char* data) { unsigned char *dataChorusAct = new unsigned char[2]; dataChorusAct[0]=SYSEX_CHORUSACTIV; dataChorusAct[1]=(unsigned char)_global.isChorusActivated; - MidiPlayEvent evChorusAct(0, 0, ME_SYSEX,(const unsigned char*)dataChorusAct, 2); + MusECore::MidiPlayEvent evChorusAct(0, 0, MusECore::ME_SYSEX,(const unsigned char*)dataChorusAct, 2); _gui->writeEvent(evChorusAct); setChorusReturn((int)data[NUM_CHORUS_RETURN]); unsigned char *dataChorusRet = new unsigned char[2]; dataChorusRet[0]=SYSEX_CHORUSRETURN; dataChorusRet[1]=(unsigned char)getChorusReturn(); - MidiPlayEvent evChorusRet(0, 0, ME_SYSEX,(const unsigned char*)dataChorusRet, 2); + MusECore::MidiPlayEvent evChorusRet(0, 0, MusECore::ME_SYSEX,(const unsigned char*)dataChorusRet, 2); _gui->writeEvent(evChorusRet); - p = plugins.find((const char*)&data[NUM_CHORUS_LIB], + p = MusEGlobal::plugins.find((const char*)&data[NUM_CHORUS_LIB], (const char*)&data[NUM_CHORUS_LABEL]); if(p) { initPluginChorus(p); @@ -2681,7 +2681,7 @@ void DeicsOnze::parseInitData(int length, const unsigned char* data) { } char dataBuildCho; dataBuildCho = SYSEX_BUILDGUICHORUS; - MidiPlayEvent evSysexBuildCho(0, 0, ME_SYSEX, + MusECore::MidiPlayEvent evSysexBuildCho(0, 0, MusECore::ME_SYSEX, (const unsigned char*)&dataBuildCho, 1); _gui->writeEvent(evSysexBuildCho); } @@ -2691,22 +2691,22 @@ void DeicsOnze::parseInitData(int length, const unsigned char* data) { unsigned char *dataDelayAct = new unsigned char[2]; dataDelayAct[0]=SYSEX_DELAYACTIV; dataDelayAct[1]=(unsigned char)_global.isDelayActivated; - MidiPlayEvent evDelayAct(0, 0, ME_SYSEX,(const unsigned char*)dataDelayAct, 2); + MusECore::MidiPlayEvent evDelayAct(0, 0, MusECore::ME_SYSEX,(const unsigned char*)dataDelayAct, 2); _gui->writeEvent(evDelayAct); setDelayReturn((int)data[NUM_DELAY_RETURN]); unsigned char *dataDelayRet = new unsigned char[2]; dataDelayRet[0]=SYSEX_DELAYRETURN; dataDelayRet[1]=(unsigned char)getDelayReturn(); - MidiPlayEvent evDelayRet(0, 0, ME_SYSEX,(const unsigned char*)dataDelayRet, 2); + MusECore::MidiPlayEvent evDelayRet(0, 0, MusECore::ME_SYSEX,(const unsigned char*)dataDelayRet, 2); _gui->writeEvent(evDelayRet); - //initPluginDelay(plugins.find("pandelay", "pandelay")); + //initPluginDelay(MusEGlobal::plugins.find("pandelay", "pandelay")); float delayfloat; memcpy(&delayfloat, &data[NUM_DELAY_BPM], sizeof(float)); setDelayBPM(delayfloat); char dataDelayBPM[sizeof(float)+1]; dataDelayBPM[0] = SYSEX_DELAYBPM; memcpy(&dataDelayBPM[1], &delayfloat, sizeof(float)); - MidiPlayEvent evSysexDelayBPM(0, 0, ME_SYSEX, + MusECore::MidiPlayEvent evSysexDelayBPM(0, 0, MusECore::ME_SYSEX, (const unsigned char*)dataDelayBPM, sizeof(float)+1); _gui->writeEvent(evSysexDelayBPM); @@ -2715,7 +2715,7 @@ void DeicsOnze::parseInitData(int length, const unsigned char* data) { char dataDelayBeatRatio[sizeof(float)+1]; dataDelayBeatRatio[0] = SYSEX_DELAYBEATRATIO; memcpy(&dataDelayBeatRatio[1], &delayfloat, sizeof(float)); - MidiPlayEvent evSysexDelayBeatRatio(0, 0, ME_SYSEX, + MusECore::MidiPlayEvent evSysexDelayBeatRatio(0, 0, MusECore::ME_SYSEX, (const unsigned char*)dataDelayBeatRatio, sizeof(float)+1); _gui->writeEvent(evSysexDelayBeatRatio); @@ -2724,7 +2724,7 @@ void DeicsOnze::parseInitData(int length, const unsigned char* data) { char dataDelayFeedback[sizeof(float)+1]; dataDelayFeedback[0] = SYSEX_DELAYFEEDBACK; memcpy(&dataDelayFeedback[1], &delayfloat, sizeof(float)); - MidiPlayEvent evSysexDelayFeedback(0, 0, ME_SYSEX, + MusECore::MidiPlayEvent evSysexDelayFeedback(0, 0, MusECore::ME_SYSEX, (const unsigned char*)dataDelayFeedback, sizeof(float)+1); _gui->writeEvent(evSysexDelayFeedback); @@ -2733,7 +2733,7 @@ void DeicsOnze::parseInitData(int length, const unsigned char* data) { char dataDelayLFOFreq[sizeof(float)+1]; dataDelayLFOFreq[0] = SYSEX_DELAYLFOFREQ; memcpy(&dataDelayLFOFreq[1], &delayfloat, sizeof(float)); - MidiPlayEvent evSysexDelayLFOFreq(0, 0, ME_SYSEX, + MusECore::MidiPlayEvent evSysexDelayLFOFreq(0, 0, MusECore::ME_SYSEX, (const unsigned char*)dataDelayLFOFreq, sizeof(float)+1); _gui->writeEvent(evSysexDelayLFOFreq); @@ -2742,7 +2742,7 @@ void DeicsOnze::parseInitData(int length, const unsigned char* data) { char dataDelayLFODepth[sizeof(float)+1]; dataDelayLFODepth[0] = SYSEX_DELAYLFODEPTH; memcpy(&dataDelayLFODepth[1], &delayfloat, sizeof(float)); - MidiPlayEvent evSysexDelayLFODepth(0, 0, ME_SYSEX, + MusECore::MidiPlayEvent evSysexDelayLFODepth(0, 0, MusECore::ME_SYSEX, (const unsigned char*)dataDelayLFODepth, sizeof(float)+1); _gui->writeEvent(evSysexDelayLFODepth); @@ -2804,7 +2804,7 @@ void DeicsOnze::parseInitData(int length, const unsigned char* data) { dataSend[0]=SYSEX_LOADSET; dataSend[1]=data[NUM_SAVEONLYUSED]; //for(int i=2; i<dL; i++) dataSend[i]=baUncop.at(i-2); - MidiPlayEvent evSysex(0, 0, ME_SYSEX,(const unsigned char*)dataSend, dL); + MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX,(const unsigned char*)dataSend, dL); _gui->writeEvent(evSysex); //select programs per channel @@ -2814,7 +2814,7 @@ void DeicsOnze::parseInitData(int length, const unsigned char* data) { int prog=(int)data[NUM_CURRENTPROG+c]; programSelect(c, hbank, lbank, prog); int val=prog+(lbank<<8)+(hbank<<16); - MidiPlayEvent evProgSel(0, 0, c, ME_CONTROLLER, CTRL_PROGRAM, val); + MusECore::MidiPlayEvent evProgSel(0, 0, c, MusECore::ME_CONTROLLER, MusECore::CTRL_PROGRAM, val); _gui->writeEvent(evProgSel); } @@ -2853,8 +2853,8 @@ bool DeicsOnze::sysex(int length, const unsigned char* data, bool fromGui) { ///setMasterVol((int)data[1]); setMasterVol((int)d[1]); if(!fromGui) { - ///MidiPlayEvent evSysex(0, 0, ME_SYSEX, data, length); - MidiPlayEvent evSysex(0, 0, ME_SYSEX, d, l); + ///MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, data, length); + MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, d, l); _gui->writeEvent(evSysex); } break; @@ -2862,8 +2862,8 @@ bool DeicsOnze::sysex(int length, const unsigned char* data, bool fromGui) { ///_global.channelNum = (char)data[1]; //_global.channelNum = (char)d[1]; //if(!fromGui) { - /// MidiPlayEvent evSysex(0, 0, ME_SYSEX, data, length); - // MidiPlayEvent evSysex(0, 0, ME_SYSEX, d, l); + /// MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, data, length); + // MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, d, l); // _gui->writeEvent(evSysex); //} //break; @@ -2871,8 +2871,8 @@ bool DeicsOnze::sysex(int length, const unsigned char* data, bool fromGui) { ///setQuality((Quality)data[1]); setQuality((Quality)d[1]); if(!fromGui) { - ///MidiPlayEvent evSysex(0, 0, ME_SYSEX, data, length); - MidiPlayEvent evSysex(0, 0, ME_SYSEX, d, l); + ///MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, data, length); + MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, d, l); _gui->writeEvent(evSysex); } break; @@ -2880,8 +2880,8 @@ bool DeicsOnze::sysex(int length, const unsigned char* data, bool fromGui) { ///setFilter((bool)data[1]); setFilter((bool)d[1]); if(!fromGui) { - ///MidiPlayEvent evSysex(0, 0, ME_SYSEX, data, length); - MidiPlayEvent evSysex(0, 0, ME_SYSEX, d, l); + ///MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, data, length); + MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, d, l); _gui->writeEvent(evSysex); } break; @@ -2889,8 +2889,8 @@ bool DeicsOnze::sysex(int length, const unsigned char* data, bool fromGui) { ///_global.fontSize = (int)data[1]; _global.fontSize = (int)d[1]; if(!fromGui) { - ///MidiPlayEvent evSysex(0, 0, ME_SYSEX, data, length); - MidiPlayEvent evSysex(0, 0, ME_SYSEX, d, l); + ///MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, data, length); + MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, d, l); _gui->writeEvent(evSysex); } break; @@ -2898,8 +2898,8 @@ bool DeicsOnze::sysex(int length, const unsigned char* data, bool fromGui) { ///_saveConfig = (bool)data[1]; _saveConfig = (bool)d[1]; if(!fromGui) { - ///MidiPlayEvent evSysex(0, 0, ME_SYSEX, data, length); - MidiPlayEvent evSysex(0, 0, ME_SYSEX, d, l); + ///MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, data, length); + MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, d, l); _gui->writeEvent(evSysex); } break; @@ -2907,8 +2907,8 @@ bool DeicsOnze::sysex(int length, const unsigned char* data, bool fromGui) { ///_saveOnlyUsed = (bool)data[1]; _saveOnlyUsed = (bool)d[1]; if(!fromGui) { - ///MidiPlayEvent evSysex(0, 0, ME_SYSEX, data, length); - MidiPlayEvent evSysex(0, 0, ME_SYSEX, d, l); + ///MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, data, length); + MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, d, l); _gui->writeEvent(evSysex); } break; @@ -2916,8 +2916,8 @@ bool DeicsOnze::sysex(int length, const unsigned char* data, bool fromGui) { ///_isInitSet = (bool)data[1]; _isInitSet = (bool)d[1]; if(!fromGui) { - ///MidiPlayEvent evSysex(0, 0, ME_SYSEX, data, length); - MidiPlayEvent evSysex(0, 0, ME_SYSEX, d, l); + ///MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, data, length); + MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, d, l); _gui->writeEvent(evSysex); } break; @@ -2925,8 +2925,8 @@ bool DeicsOnze::sysex(int length, const unsigned char* data, bool fromGui) { ///_initSetPath = (char*)&data[1]; _initSetPath = (char*)&d[1]; if(!fromGui) { - ///MidiPlayEvent evSysex(0, 0, ME_SYSEX, data, length); - MidiPlayEvent evSysex(0, 0, ME_SYSEX, d, l); + ///MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, data, length); + MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, d, l); _gui->writeEvent(evSysex); } break; @@ -2934,8 +2934,8 @@ bool DeicsOnze::sysex(int length, const unsigned char* data, bool fromGui) { ///_isBackgroundPix = (bool)data[1]; _isBackgroundPix = (bool)d[1]; if(!fromGui) { - ///MidiPlayEvent evSysex(0, 0, ME_SYSEX, data, length); - MidiPlayEvent evSysex(0, 0, ME_SYSEX, d, l); + ///MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, data, length); + MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, d, l); _gui->writeEvent(evSysex); } break; @@ -2943,8 +2943,8 @@ bool DeicsOnze::sysex(int length, const unsigned char* data, bool fromGui) { ///_backgroundPixPath = (char*)&data[1]; _backgroundPixPath = (char*)&d[1]; if(!fromGui) { - ///MidiPlayEvent evSysex(0, 0, ME_SYSEX, data, length); - MidiPlayEvent evSysex(0, 0, ME_SYSEX, d, l); + ///MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, data, length); + MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, d, l); _gui->writeEvent(evSysex); } break; @@ -2955,8 +2955,8 @@ bool DeicsOnze::sysex(int length, const unsigned char* data, bool fromGui) { ///_global.isChorusActivated = (bool)data[1]; _global.isChorusActivated = (bool)d[1]; if(!fromGui) { - ///MidiPlayEvent evSysex(0, 0, ME_SYSEX, data, length); - MidiPlayEvent evSysex(0, 0, ME_SYSEX, d, l); + ///MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, data, length); + MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, d, l); _gui->writeEvent(evSysex); } break; @@ -2967,8 +2967,8 @@ bool DeicsOnze::sysex(int length, const unsigned char* data, bool fromGui) { memcpy(&f, &d[2], sizeof(float)); setChorusParam(index, (double)f); if(!fromGui) { - ///MidiPlayEvent evSysex(0, 0, ME_SYSEX, data, length); - MidiPlayEvent evSysex(0, 0, ME_SYSEX, d, l); + ///MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, data, length); + MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, d, l); _gui->writeEvent(evSysex); } break; @@ -2976,8 +2976,8 @@ bool DeicsOnze::sysex(int length, const unsigned char* data, bool fromGui) { ///_global.isReverbActivated = (bool)data[1]; _global.isReverbActivated = (bool)d[1]; if(!fromGui) { - ///MidiPlayEvent evSysex(0, 0, ME_SYSEX, data, length); - MidiPlayEvent evSysex(0, 0, ME_SYSEX, d, l); + ///MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, data, length); + MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, d, l); _gui->writeEvent(evSysex); } break; @@ -2988,8 +2988,8 @@ bool DeicsOnze::sysex(int length, const unsigned char* data, bool fromGui) { memcpy(&f, &d[2], sizeof(float)); setReverbParam(index, (double)f); if(!fromGui) { - ///MidiPlayEvent evSysex(0, 0, ME_SYSEX, data, length); - MidiPlayEvent evSysex(0, 0, ME_SYSEX, d, l); + ///MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, data, length); + MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, d, l); _gui->writeEvent(evSysex); } break; @@ -2997,8 +2997,8 @@ bool DeicsOnze::sysex(int length, const unsigned char* data, bool fromGui) { ///_global.isDelayActivated = (bool)data[1]; _global.isDelayActivated = (bool)d[1]; if(!fromGui) { - ///MidiPlayEvent evSysex(0, 0, ME_SYSEX, data, length); - MidiPlayEvent evSysex(0, 0, ME_SYSEX, d, l); + ///MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, data, length); + MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, d, l); _gui->writeEvent(evSysex); } break; @@ -3006,8 +3006,8 @@ bool DeicsOnze::sysex(int length, const unsigned char* data, bool fromGui) { ///setChorusReturn((int)data[1]); setChorusReturn((int)d[1]); if(!fromGui) { - ///MidiPlayEvent evSysex(0, 0, ME_SYSEX, data, length); - MidiPlayEvent evSysex(0, 0, ME_SYSEX, d, l); + ///MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, data, length); + MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, d, l); _gui->writeEvent(evSysex); } break; @@ -3015,8 +3015,8 @@ bool DeicsOnze::sysex(int length, const unsigned char* data, bool fromGui) { ///setReverbReturn((int)data[1]); setReverbReturn((int)d[1]); if(!fromGui) { - ///MidiPlayEvent evSysex(0, 0, ME_SYSEX, data, length); - MidiPlayEvent evSysex(0, 0, ME_SYSEX, d, l); + ///MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, data, length); + MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, d, l); _gui->writeEvent(evSysex); } break; @@ -3024,21 +3024,21 @@ bool DeicsOnze::sysex(int length, const unsigned char* data, bool fromGui) { ///setDelayReturn((int)data[1]); setDelayReturn((int)d[1]); if(!fromGui) { - ///MidiPlayEvent evSysex(0, 0, ME_SYSEX, data, length); - MidiPlayEvent evSysex(0, 0, ME_SYSEX, d, l); + ///MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, data, length); + MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, d, l); _gui->writeEvent(evSysex); } break; case SYSEX_SELECTREVERB: - Plugin* pluginReverb; - ///memcpy(&pluginReverb, &data[1], sizeof(Plugin*)); - memcpy(&pluginReverb, &d[1], sizeof(Plugin*)); + MusECore::Plugin* pluginReverb; + ///memcpy(&pluginReverb, &data[1], sizeof(MusECore::Plugin*)); + memcpy(&pluginReverb, &d[1], sizeof(MusECore::Plugin*)); initPluginReverb(pluginReverb); break; case SYSEX_SELECTCHORUS: - Plugin* pluginChorus; - ///memcpy(&pluginChorus, &data[1], sizeof(Plugin*)); - memcpy(&pluginChorus, &d[1], sizeof(Plugin*)); + MusECore::Plugin* pluginChorus; + ///memcpy(&pluginChorus, &data[1], sizeof(MusECore::Plugin*)); + memcpy(&pluginChorus, &d[1], sizeof(MusECore::Plugin*)); initPluginChorus(pluginChorus); break; case SYSEX_DELAYBPM: @@ -3046,8 +3046,8 @@ bool DeicsOnze::sysex(int length, const unsigned char* data, bool fromGui) { memcpy(&f, &d[1], sizeof(float)); setDelayBPM(f); if(!fromGui) { - ///MidiPlayEvent evSysex(0, 0, ME_SYSEX, data, length); - MidiPlayEvent evSysex(0, 0, ME_SYSEX, d, l); + ///MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, data, length); + MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, d, l); _gui->writeEvent(evSysex); } break; @@ -3056,8 +3056,8 @@ bool DeicsOnze::sysex(int length, const unsigned char* data, bool fromGui) { memcpy(&f, &d[1], sizeof(float)); setDelayBeatRatio(f); if(!fromGui) { - ///MidiPlayEvent evSysex(0, 0, ME_SYSEX, data, length); - MidiPlayEvent evSysex(0, 0, ME_SYSEX, d, l); + ///MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, data, length); + MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, d, l); _gui->writeEvent(evSysex); } break; @@ -3066,8 +3066,8 @@ bool DeicsOnze::sysex(int length, const unsigned char* data, bool fromGui) { memcpy(&f, &d[1], sizeof(float)); setDelayFeedback(f); if(!fromGui) { - ///MidiPlayEvent evSysex(0, 0, ME_SYSEX, data, length); - MidiPlayEvent evSysex(0, 0, ME_SYSEX, d, l); + ///MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, data, length); + MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, d, l); _gui->writeEvent(evSysex); } break; @@ -3076,8 +3076,8 @@ bool DeicsOnze::sysex(int length, const unsigned char* data, bool fromGui) { memcpy(&f, &d[1], sizeof(float)); setDelayLFOFreq(f); if(!fromGui) { - ///MidiPlayEvent evSysex(0, 0, ME_SYSEX, data, length); - MidiPlayEvent evSysex(0, 0, ME_SYSEX, d, l); + ///MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, data, length); + MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, d, l); _gui->writeEvent(evSysex); } break; @@ -3086,8 +3086,8 @@ bool DeicsOnze::sysex(int length, const unsigned char* data, bool fromGui) { memcpy(&f, &d[1], sizeof(float)); setDelayLFODepth(f); if(!fromGui) { - ///MidiPlayEvent evSysex(0, 0, ME_SYSEX, data, length); - MidiPlayEvent evSysex(0, 0, ME_SYSEX, d, l); + ///MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, data, length); + MusECore::MidiPlayEvent evSysex(0, 0, MusECore::ME_SYSEX, d, l); _gui->writeEvent(evSysex); } break; @@ -3119,7 +3119,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->eg[k].ar=val; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_AR+k*DECAPAR1,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_AR+k*DECAPAR1,val); _gui->writeEvent(ev); } break; @@ -3127,7 +3127,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->eg[k].d1r=val; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_D1R+k*DECAPAR1,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_D1R+k*DECAPAR1,val); _gui->writeEvent(ev); } break; @@ -3135,7 +3135,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->eg[k].d2r=val; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_D2R+k*DECAPAR1,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_D2R+k*DECAPAR1,val); _gui->writeEvent(ev); } break; @@ -3143,7 +3143,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->eg[k].rr=val; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_RR+k*DECAPAR1,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_RR+k*DECAPAR1,val); _gui->writeEvent(ev); } break; @@ -3151,7 +3151,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->eg[k].d1l=val; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_D1L+k*DECAPAR1,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_D1L+k*DECAPAR1,val); _gui->writeEvent(ev); } break; @@ -3159,7 +3159,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->scaling.level[k]=val; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_LS+k*DECAPAR1,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_LS+k*DECAPAR1,val); _gui->writeEvent(ev); } break; @@ -3167,7 +3167,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->scaling.rate[k]=val; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_RS+k*DECAPAR1,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_RS+k*DECAPAR1,val); _gui->writeEvent(ev); } break; @@ -3175,7 +3175,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->sensitivity.egBias[k]=val; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_EBS+k*DECAPAR1,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_EBS+k*DECAPAR1,val); _gui->writeEvent(ev); } break; @@ -3183,7 +3183,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->sensitivity.ampOn[k]=val==1; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_AME+k*DECAPAR1,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_AME+k*DECAPAR1,val); _gui->writeEvent(ev); } break; @@ -3191,7 +3191,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->sensitivity.keyVelocity[k]=val; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_KVS+k*DECAPAR1,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_KVS+k*DECAPAR1,val); _gui->writeEvent(ev); } break; @@ -3200,7 +3200,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->outLevel[k]=val; setOutLevel(k); if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_OUT+k*DECAPAR1,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_OUT+k*DECAPAR1,val); _gui->writeEvent(ev); } break; @@ -3208,7 +3208,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->frequency[k].ratio=((double)val)/100.0; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER, + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER, CTRL_RATIO+k*DECAPAR1,val); _gui->writeEvent(ev); } @@ -3217,7 +3217,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->detune[k]=val; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_DET+k*DECAPAR1,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_DET+k*DECAPAR1,val); _gui->writeEvent(ev); } break; @@ -3225,7 +3225,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->algorithm=(Algorithm)val; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_ALG,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_ALG,val); _gui->writeEvent(ev); } break; @@ -3234,7 +3234,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->feedback=val; setFeedback(ch); if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_FEEDBACK,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_FEEDBACK,val); _gui->writeEvent(ev); } break; @@ -3243,7 +3243,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->lfo.speed=val; setLfo(ch); if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_SPEED,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_SPEED,val); _gui->writeEvent(ev); } break; @@ -3252,7 +3252,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->lfo.delay=val; setLfo(ch); if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_DELAY,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_DELAY,val); _gui->writeEvent(ev); } break; @@ -3261,7 +3261,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->lfo.pModDepth=val; setLfo(ch); if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_PMODDEPTH,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_PMODDEPTH,val); _gui->writeEvent(ev); } break; @@ -3270,7 +3270,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->lfo.aModDepth=val; setLfo(ch); if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_AMODDEPTH,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_AMODDEPTH,val); _gui->writeEvent(ev); } break; @@ -3279,7 +3279,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->lfo.sync=val==1; setLfo(ch); if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_SYNC,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_SYNC,val); _gui->writeEvent(ev); } break; @@ -3288,7 +3288,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->lfo.wave=(Wave)val; setLfo(ch); if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_WAVE,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_WAVE,val); _gui->writeEvent(ev); } break; @@ -3297,7 +3297,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->sensitivity.pitch=val; setLfo(ch); if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_PMODSENS,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_PMODSENS,val); _gui->writeEvent(ev); } break; @@ -3306,7 +3306,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->sensitivity.amplitude=val; setLfo(ch); if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_AMS,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_AMS,val); _gui->writeEvent(ev); } break; @@ -3314,7 +3314,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->function.transpose=val; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_TRANSPOSE,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_TRANSPOSE,val); _gui->writeEvent(ev); } break; @@ -3322,7 +3322,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->function.mode=(Mode)val; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_POLYMODE,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_POLYMODE,val); _gui->writeEvent(ev); } break; @@ -3330,7 +3330,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->function.pBendRange=val; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_PBENDRANGE,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_PBENDRANGE,val); _gui->writeEvent(ev); } break; @@ -3338,7 +3338,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->function.portamento=(Portamento)val; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_PORTAMODE,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_PORTAMODE,val); _gui->writeEvent(ev); } break; @@ -3346,7 +3346,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->function.portamentoTime=val; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_PORTATIME,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_PORTATIME,val); _gui->writeEvent(ev); } break; @@ -3354,7 +3354,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->function.fcVolume=val; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_FCVOLUME,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_FCVOLUME,val); _gui->writeEvent(ev); } break; @@ -3362,7 +3362,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->function.footSw=(FootSw)val; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_FSW,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_FSW,val); _gui->writeEvent(ev); } break; @@ -3370,7 +3370,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->function.mwPitch=val; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_MWPITCH,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_MWPITCH,val); _gui->writeEvent(ev); } break; @@ -3378,7 +3378,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->function.mwAmplitude=val; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_MWAMPLITUDE,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_MWAMPLITUDE,val); _gui->writeEvent(ev); } break; @@ -3386,7 +3386,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->function.bcPitch=val; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_BCPITCH,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_BCPITCH,val); _gui->writeEvent(ev); } break; @@ -3394,7 +3394,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->function.bcAmplitude=val; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_BCAMPLITUDE,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_BCAMPLITUDE,val); _gui->writeEvent(ev); } break; @@ -3402,7 +3402,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->function.bcPitchBias=val; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_BCPITCHBIAS,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_BCPITCHBIAS,val); _gui->writeEvent(ev); } break; @@ -3410,7 +3410,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->function.bcEgBias=val; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_BCEGBIAS,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_BCEGBIAS,val); _gui->writeEvent(ev); } break; @@ -3418,7 +3418,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->function.atPitch=val; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_ATPITCH,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_ATPITCH,val); _gui->writeEvent(ev); } break; @@ -3426,7 +3426,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->function.atAmplitude=val; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_ATAMPLITUDE,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_ATAMPLITUDE,val); _gui->writeEvent(ev); } break; @@ -3434,7 +3434,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->function.atPitchBias=val; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_ATPITCHBIAS,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_ATPITCHBIAS,val); _gui->writeEvent(ev); } break; @@ -3442,7 +3442,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->function.atEgBias=val; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_ATEGBIAS,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_ATEGBIAS,val); _gui->writeEvent(ev); } break; @@ -3450,7 +3450,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->pitchEg.pr1=val; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_PR1,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_PR1,val); _gui->writeEvent(ev); } break; @@ -3458,7 +3458,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->pitchEg.pr2=val; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_PR2,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_PR2,val); _gui->writeEvent(ev); } break; @@ -3466,7 +3466,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->pitchEg.pr3=val; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_PR3,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_PR3,val); _gui->writeEvent(ev); } break; @@ -3474,7 +3474,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->pitchEg.pl1=val; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_PL1,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_PL1,val); _gui->writeEvent(ev); } break; @@ -3482,7 +3482,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->pitchEg.pl2=val; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_PL2,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_PL2,val); _gui->writeEvent(ev); } break; @@ -3490,7 +3490,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->pitchEg.pl3=val; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_PL3,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_PL3,val); _gui->writeEvent(ev); } break; @@ -3498,7 +3498,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->frequency[k].isFix=val==1; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_FIX+k*DECAPAR2,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_FIX+k*DECAPAR2,val); _gui->writeEvent(ev); } break; @@ -3506,7 +3506,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->frequency[k].freq=((double)val)/100.0; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER, + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER, CTRL_FIXRANGE+k*DECAPAR2,val); _gui->writeEvent(ev); } @@ -3515,7 +3515,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->oscWave[k]=(OscWave)val; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_OSW+k*DECAPAR2,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_OSW+k*DECAPAR2,val); _gui->writeEvent(ev); } break; @@ -3523,7 +3523,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->eg[k].egShift=(egShiftValue)val; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_SHFT+k*DECAPAR2,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_SHFT+k*DECAPAR2,val); _gui->writeEvent(ev); } break; @@ -3531,7 +3531,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->function.reverbRate=val; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_REVERBRATE,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_REVERBRATE,val); _gui->writeEvent(ev); } break; @@ -3539,7 +3539,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->function.fcPitch=val; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_FCPITCH,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_FCPITCH,val); _gui->writeEvent(ev); } break; @@ -3547,14 +3547,14 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); _preset[ch]->function.fcAmplitude=val; if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_FCAMPLITUDE,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_FCAMPLITUDE,val); _gui->writeEvent(ev); } break; case CTRL_CHANNELENABLE: setChannelEnable(ch, (bool)val); if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_CHANNELENABLE,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_CHANNELENABLE,val); _gui->writeEvent(ev); } break; @@ -3562,7 +3562,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { _preset[ch]->setIsUsed(true); setChannelDetune(ch, val); if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_CHANNELDETUNE,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_CHANNELDETUNE,val); _gui->writeEvent(ev); } break; @@ -3570,18 +3570,18 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { setChannelVol(ch, val); applyChannelAmp(ch); if(!fromGui) { - MidiPlayEvent ev(0, 0, ch,ME_CONTROLLER,CTRL_CHANNELVOLUME,val); + MusECore::MidiPlayEvent ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_CHANNELVOLUME,val); _gui->writeEvent(ev); } break; case CTRL_NBRVOICES: setNbrVoices(ch, val); if(!fromGui) { - MidiPlayEvent ev(0, 0, ch, ME_CONTROLLER, CTRL_NBRVOICES, val); + MusECore::MidiPlayEvent ev(0, 0, ch, MusECore::ME_CONTROLLER, CTRL_NBRVOICES, val); _gui->writeEvent(ev); } break; - case CTRL_PROGRAM: { + case MusECore::CTRL_PROGRAM: { int hbank = (val & 0xff0000) >> 16; int lbank = (val & 0xff00) >> 8; int prog = val & 0x7f; @@ -3592,27 +3592,27 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { programSelect(ch, hbank, lbank, prog); _preset[ch]->setIsUsed(true);//TODO : not sure to put that if(!fromGui) { - MidiPlayEvent ev(0, 0, ch, ME_CONTROLLER, CTRL_PROGRAM, val); + MusECore::MidiPlayEvent ev(0, 0, ch, MusECore::ME_CONTROLLER, MusECore::CTRL_PROGRAM, val); _gui->writeEvent(ev); } } break; - case CTRL_MODULATION: + case MusECore::CTRL_MODULATION: setModulation(ch, val); if(!fromGui) { - MidiPlayEvent ev(0, 0, ch, ME_CONTROLLER, CTRL_MODULATION, val); + MusECore::MidiPlayEvent ev(0, 0, ch, MusECore::ME_CONTROLLER, MusECore::CTRL_MODULATION, val); _gui->writeEvent(ev); } break; - case CTRL_PITCH: + case MusECore::CTRL_PITCH: setPitchBendCoef(ch, val); break; - case CTRL_PANPOT: + case MusECore::CTRL_PANPOT: _preset[ch]->setIsUsed(true); deiPan = val*2*MAXCHANNELPAN/127-MAXCHANNELPAN; setChannelPan(ch, deiPan); applyChannelAmp(ch); if(!fromGui) { - MidiPlayEvent ev(0, 0, ch, ME_CONTROLLER, CTRL_CHANNELPAN, deiPan); + MusECore::MidiPlayEvent ev(0, 0, ch, MusECore::ME_CONTROLLER, CTRL_CHANNELPAN, deiPan); _gui->writeEvent(ev); } break; @@ -3621,7 +3621,7 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { setChannelPan(ch, val); applyChannelAmp(ch); if(!fromGui) { - MidiPlayEvent ev(0, 0, ch, ME_CONTROLLER, CTRL_CHANNELPAN, val); + MusECore::MidiPlayEvent ev(0, 0, ch, MusECore::ME_CONTROLLER, CTRL_CHANNELPAN, val); _gui->writeEvent(ev); } break; @@ -3630,72 +3630,72 @@ bool DeicsOnze::setController(int ch, int ctrl, int val, bool fromGui) { setChannelBrightness(ch, val); setOutLevel(ch); if(!fromGui) { - MidiPlayEvent ev(0, 0, ch, ME_CONTROLLER, CTRL_FINEBRIGHTNESS, val); + MusECore::MidiPlayEvent ev(0, 0, ch, MusECore::ME_CONTROLLER, CTRL_FINEBRIGHTNESS, val); _gui->writeEvent(ev); } break; - case CTRL_BRIGHTNESS: + case MusECore::CTRL_BRIGHTNESS: _preset[ch]->setIsUsed(true); setChannelBrightness(ch, val*(MIDFINEBRIGHTNESS/MIDBRIGHTNESS)); setOutLevel(ch); if(!fromGui) { - MidiPlayEvent - ev(0, 0, ch,ME_CONTROLLER,CTRL_FINEBRIGHTNESS,getChannelBrightness(ch)); + MusECore::MidiPlayEvent + ev(0, 0, ch,MusECore::ME_CONTROLLER,CTRL_FINEBRIGHTNESS,getChannelBrightness(ch)); _gui->writeEvent(ev); } break; - case CTRL_ATTACK_TIME: + case MusECore::CTRL_ATTACK_TIME: _preset[ch]->setIsUsed(true); setChannelAttack(ch, val); setEnvAttack(ch); if(!fromGui) { - MidiPlayEvent ev(0, 0, ch, ME_CONTROLLER, CTRL_ATTACK_TIME, val); + MusECore::MidiPlayEvent ev(0, 0, ch, MusECore::ME_CONTROLLER, MusECore::CTRL_ATTACK_TIME, val); _gui->writeEvent(ev); } break; - case CTRL_RELEASE_TIME: + case MusECore::CTRL_RELEASE_TIME: _preset[ch]->setIsUsed(true); setChannelRelease(ch, val); setEnvRelease(ch); if(!fromGui) { - MidiPlayEvent ev(0, 0, ch, ME_CONTROLLER, CTRL_RELEASE_TIME, val); + MusECore::MidiPlayEvent ev(0, 0, ch, MusECore::ME_CONTROLLER, MusECore::CTRL_RELEASE_TIME, val); _gui->writeEvent(ev); } break; - case CTRL_REVERB_SEND: + case MusECore::CTRL_REVERB_SEND: setChannelReverb(ch, val); if(!fromGui) { - MidiPlayEvent ev(0, 0, ch, ME_CONTROLLER, CTRL_REVERB_SEND, val); + MusECore::MidiPlayEvent ev(0, 0, ch, MusECore::ME_CONTROLLER, MusECore::CTRL_REVERB_SEND, val); _gui->writeEvent(ev); } break; - case CTRL_CHORUS_SEND: + case MusECore::CTRL_CHORUS_SEND: setChannelChorus(ch, val); if(!fromGui) { - MidiPlayEvent ev(0, 0, ch, ME_CONTROLLER, CTRL_CHORUS_SEND, val); + MusECore::MidiPlayEvent ev(0, 0, ch, MusECore::ME_CONTROLLER, MusECore::CTRL_CHORUS_SEND, val); _gui->writeEvent(ev); } break; - case CTRL_VARIATION_SEND: + case MusECore::CTRL_VARIATION_SEND: setChannelDelay(ch, val); if(!fromGui) { - MidiPlayEvent ev(0, 0, ch, ME_CONTROLLER, CTRL_VARIATION_SEND, val); + MusECore::MidiPlayEvent ev(0, 0, ch, MusECore::ME_CONTROLLER, MusECore::CTRL_VARIATION_SEND, val); _gui->writeEvent(ev); } break; - case CTRL_SUSTAIN: + case MusECore::CTRL_SUSTAIN: setSustain(ch, val); break; - case CTRL_VOLUME: + case MusECore::CTRL_VOLUME: setChannelVol(ch, val*(MAXCHANNELVOLUME/127)); applyChannelAmp(ch); if(!fromGui) { - MidiPlayEvent - ev(0, 0, ch, ME_CONTROLLER, CTRL_CHANNELVOLUME, getChannelVol(ch)); + MusECore::MidiPlayEvent + ev(0, 0, ch, MusECore::ME_CONTROLLER, CTRL_CHANNELVOLUME, getChannelVol(ch)); _gui->writeEvent(ev); } break; - case CTRL_ALL_SOUNDS_OFF: + case MusECore::CTRL_ALL_SOUNDS_OFF: resetVoices(); default: break; @@ -4090,12 +4090,12 @@ void DeicsOnze::processMessages() { //Process messages from the gui while (_gui->fifoSize()) { - MidiPlayEvent ev = _gui->readEvent(); - if (ev.type() == ME_SYSEX) { + MusECore::MidiPlayEvent ev = _gui->readEvent(); + if (ev.type() == MusECore::ME_SYSEX) { sysex(ev.len(), ev.data(), true); sendEvent(ev); } - else if (ev.type() == ME_CONTROLLER) { + else if (ev.type() == MusECore::ME_CONTROLLER) { setController(ev.channel(), ev.dataA(), ev.dataB(), true); sendEvent(ev); } @@ -4110,12 +4110,12 @@ void DeicsOnze::process(float** buffer, int offset, int n) { /* //Process messages from the gui while (_gui->fifoSize()) { - MidiPlayEvent ev = _gui->readEvent(); - if (ev.type() == ME_SYSEX) { + MusECore::MidiPlayEvent ev = _gui->readEvent(); + if (ev.type() == MusECore::ME_SYSEX) { sysex(ev.len(), ev.data(), true); sendEvent(ev); } - else if (ev.type() == ME_CONTROLLER) { + else if (ev.type() == MusECore::ME_CONTROLLER) { setController(ev.channel(), ev.dataA(), ev.dataB(), true); sendEvent(ev); } diff --git a/muse2/synti/deicsonze/deicsonze.h b/muse2/synti/deicsonze/deicsonze.h index 53a3afee..124c8d46 100644 --- a/muse2/synti/deicsonze/deicsonze.h +++ b/muse2/synti/deicsonze/deicsonze.h @@ -470,13 +470,13 @@ class DeicsOnze : public Mess { Preset* _initialPreset; //FX - PluginI* _pluginIReverb; - PluginI* _pluginIChorus; - PluginI* _pluginIDelay; + MusECore::PluginI* _pluginIReverb; + MusECore::PluginI* _pluginIChorus; + MusECore::PluginI* _pluginIDelay; - void initPluginReverb(Plugin*); - void initPluginChorus(Plugin*); - void initPluginDelay(Plugin*); + void initPluginReverb(MusECore::Plugin*); + void initPluginChorus(MusECore::Plugin*); + void initPluginDelay(MusECore::Plugin*); void setReverbParam(int i, double val); double getReverbParam(int i) const; diff --git a/muse2/synti/deicsonze/deicsonzegui.cpp b/muse2/synti/deicsonze/deicsonzegui.cpp index b88a47fc..b4965e7b 100644 --- a/muse2/synti/deicsonze/deicsonzegui.cpp +++ b/muse2/synti/deicsonze/deicsonzegui.cpp @@ -49,7 +49,9 @@ //#include "deicsonzegui.h" +namespace MusEGui { class PluginDialog; +} DeicsOnzeGui::DeicsOnzeGui(DeicsOnze* deicsOnze) : QDialog(0), @@ -503,10 +505,10 @@ void DeicsOnzeGui::setResCtrl() { sendController(_currentChannel, CTRL_FINEBRIGHTNESS, MIDFINEBRIGHTNESS); //Attack updateAttack(MIDATTACK); - sendController(_currentChannel, CTRL_ATTACK_TIME, MIDATTACK); + sendController(_currentChannel, MusECore::CTRL_ATTACK_TIME, MIDATTACK); //Release updateRelease(MIDRELEASE); - sendController(_currentChannel, CTRL_RELEASE_TIME, MIDRELEASE); + sendController(_currentChannel, MusECore::CTRL_RELEASE_TIME, MIDRELEASE); } //----------------------------------------------------------- @@ -1393,10 +1395,10 @@ void QFrameEnvelope::env2Points(int ar, int d1r, int d1l, int d2r, int rr) { //----------------------------------------------------------- // processEvent(const MidiEvent&); //----------------------------------------------------------- -void DeicsOnzeGui::processEvent(const MidiPlayEvent& ev) { +void DeicsOnzeGui::processEvent(const MusECore::MidiPlayEvent& ev) { //Controler - if (ev.type() == ME_CONTROLLER) { - //printf("ME_CONTROLLER\n"); + if (ev.type() == MusECore::ME_CONTROLLER) { + //printf("MusECore::ME_CONTROLLER\n"); int id=ev.dataA(); int ch=ev.channel(); int val=ev.dataB(); @@ -1511,13 +1513,13 @@ void DeicsOnzeGui::processEvent(const MidiPlayEvent& ev) { case CTRL_CHANNELVOLUME: updateChannelVolume(val); break; case CTRL_NBRVOICES: updateNbrVoices(val); break; case CTRL_FINEBRIGHTNESS: updateBrightness(val); break; - case CTRL_ATTACK_TIME: updateAttack(val); break; - case CTRL_RELEASE_TIME: updateRelease(val); break; - case CTRL_CHORUS_SEND: updateChannelChorus(val); break; - case CTRL_REVERB_SEND: updateChannelReverb(val); break; - case CTRL_VARIATION_SEND: updateChannelDelay(val); break; - case CTRL_MODULATION: updateModulation(val); break; - case CTRL_PROGRAM : + case MusECore::CTRL_ATTACK_TIME: updateAttack(val); break; + case MusECore::CTRL_RELEASE_TIME: updateRelease(val); break; + case MusECore::CTRL_CHORUS_SEND: updateChannelChorus(val); break; + case MusECore::CTRL_REVERB_SEND: updateChannelReverb(val); break; + case MusECore::CTRL_VARIATION_SEND: updateChannelDelay(val); break; + case MusECore::CTRL_MODULATION: updateModulation(val); break; + case MusECore::CTRL_PROGRAM : int hbank = (val & 0xff0000) >> 16; int lbank = (val & 0xff00) >> 8; if (hbank > 127) // map "dont care" to 0 @@ -1538,8 +1540,8 @@ void DeicsOnzeGui::processEvent(const MidiPlayEvent& ev) { } } // Sysexes - else if (ev.type() == ME_SYSEX) { - //printf("ME_SYSEX\n"); + else if (ev.type() == MusECore::ME_SYSEX) { + //printf("MusECore::ME_SYSEX\n"); unsigned char* data = ev.data(); int cmd = *data; @@ -2587,7 +2589,7 @@ void DeicsOnzeGui::setChorusActiv(bool a) { sendSysex(message, 4); } void DeicsOnzeGui::setChannelChorus(int c) { - sendController(_currentChannel, CTRL_CHORUS_SEND, c); + sendController(_currentChannel, MusECore::CTRL_CHORUS_SEND, c); } void DeicsOnzeGui::setChorusReturn(int val) { unsigned char message[4]; @@ -2598,14 +2600,14 @@ void DeicsOnzeGui::setChorusReturn(int val) { sendSysex(message, 4); } void DeicsOnzeGui::setSelectChorusPlugin() { - Plugin* pluginChorus = PluginDialog::getPlugin(this); + MusECore::Plugin* pluginChorus = MusEGui::PluginDialog::getPlugin(this); if(pluginChorus) { - unsigned char message[3+sizeof(Plugin*)]; + unsigned char message[3+sizeof(MusECore::Plugin*)]; message[0]=MUSE_SYNTH_SYSEX_MFG_ID; message[1]=DEICSONZE_UNIQUE_ID; message[2]=SYSEX_SELECTCHORUS; - memcpy(&message[3], &pluginChorus, sizeof(Plugin*)); - sendSysex(message, 3+sizeof(Plugin*)); + memcpy(&message[3], &pluginChorus, sizeof(MusECore::Plugin*)); + sendSysex(message, 3+sizeof(MusECore::Plugin*)); } } /*void DeicsOnzeGui::setPanChorus1(double i) { @@ -2665,7 +2667,7 @@ void DeicsOnzeGui::setReverbActiv(bool a) { sendSysex(message, 4); } void DeicsOnzeGui::setChannelReverb(int r) { - sendController(_currentChannel, CTRL_REVERB_SEND, r); + sendController(_currentChannel, MusECore::CTRL_REVERB_SEND, r); } void DeicsOnzeGui::setReverbReturn(int val) { unsigned char message[4]; @@ -2676,14 +2678,14 @@ void DeicsOnzeGui::setReverbReturn(int val) { sendSysex(message, 4); } void DeicsOnzeGui::setSelectReverbPlugin() { - Plugin* pluginReverb = PluginDialog::getPlugin(this); + MusECore::Plugin* pluginReverb = MusEGui::PluginDialog::getPlugin(this); if(pluginReverb) { - unsigned char message[3+sizeof(Plugin*)]; + unsigned char message[3+sizeof(MusECore::Plugin*)]; message[0]=MUSE_SYNTH_SYSEX_MFG_ID; message[1]=DEICSONZE_UNIQUE_ID; message[2]=SYSEX_SELECTREVERB; - memcpy(&message[3], &pluginReverb, sizeof(Plugin*)); - sendSysex(message, 3+sizeof(Plugin*)); + memcpy(&message[3], &pluginReverb, sizeof(MusECore::Plugin*)); + sendSysex(message, 3+sizeof(MusECore::Plugin*)); } } @@ -2699,7 +2701,7 @@ void DeicsOnzeGui::setBrightnessKnob(double val) { (int)(val*(double)MAXFINEBRIGHTNESS)); } void DeicsOnzeGui::setModulationKnob(double val) { - sendController(_currentChannel, CTRL_MODULATION, + sendController(_currentChannel, MusECore::CTRL_MODULATION, (int)(val*(double)MAXMODULATION)); } void DeicsOnzeGui::setDetuneKnob(double val) { @@ -2707,11 +2709,11 @@ void DeicsOnzeGui::setDetuneKnob(double val) { setChannelDetune((int)((2.0*val-1.0)*(double)MAXCHANNELDETUNE)); } void DeicsOnzeGui::setAttackKnob(double val) { - sendController(_currentChannel, CTRL_ATTACK_TIME, + sendController(_currentChannel, MusECore::CTRL_ATTACK_TIME, (int)(val*(double)MAXATTACK)); } void DeicsOnzeGui::setReleaseKnob(double val) { - sendController(_currentChannel, CTRL_RELEASE_TIME, (int)(val*(double)MAXRELEASE)); + sendController(_currentChannel, MusECore::CTRL_RELEASE_TIME, (int)(val*(double)MAXRELEASE)); } //----------------------------------------------------------- // Global control @@ -3119,7 +3121,7 @@ void DeicsOnzeGui::setDelayReturn(int r) { sendSysex(message, 4); } void DeicsOnzeGui::setChannelDelay(int d) { - sendController(_currentChannel, CTRL_VARIATION_SEND, (unsigned char)d); + sendController(_currentChannel, MusECore::CTRL_VARIATION_SEND, (unsigned char)d); } //void DeicsOnzeGui::setDelayTime(int t) { // unsigned char message[4]; @@ -3306,7 +3308,7 @@ void DeicsOnzeGui::setPreset(QTreeWidgetItem* pre) { int hbank = cpre->_preset->_subcategory->_category->_hbank; setEnabledPreset(true); updatePreset(cpre->_preset); - sendController(_currentChannel, CTRL_PROGRAM, (hbank<<16)+(lbank<<8)+prog); + sendController(_currentChannel, MusECore::CTRL_PROGRAM, (hbank<<16)+(lbank<<8)+prog); } } //-------------------------------------------------------------- diff --git a/muse2/synti/deicsonze/deicsonzegui.h b/muse2/synti/deicsonze/deicsonzegui.h index 7dec344f..33886062 100644 --- a/muse2/synti/deicsonze/deicsonzegui.h +++ b/muse2/synti/deicsonze/deicsonzegui.h @@ -359,7 +359,7 @@ class DeicsOnzeGui : public QDialog, public Ui::DeicsOnzeGuiBase, public MessGui void setSubcategory(QTreeWidgetItem*); void setPreset(QTreeWidgetItem*); public: - virtual void processEvent(const MidiPlayEvent&); + virtual void processEvent(const MusECore::MidiPlayEvent&); void updateSelectPreset(int hbank, int lbank, int prog); //update the gui void setEnabledPreset(bool b); diff --git a/muse2/synti/deicsonze/deicsonzeplugin.cpp b/muse2/synti/deicsonze/deicsonzeplugin.cpp index c8f5b086..442a61c5 100644 --- a/muse2/synti/deicsonze/deicsonzeplugin.cpp +++ b/muse2/synti/deicsonze/deicsonzeplugin.cpp @@ -43,11 +43,11 @@ using Awl::CheckBox; class PluginDialog; -void DeicsOnze::initPluginReverb(Plugin* pluginReverb) { +void DeicsOnze::initPluginReverb(MusECore::Plugin* pluginReverb) { //init plugin if(_pluginIReverb) delete(_pluginIReverb); - ///_pluginIReverb = new PluginI(NULL); - _pluginIReverb = new PluginI(); + ///_pluginIReverb = new MusECore::PluginI(NULL); + _pluginIReverb = new MusECore::PluginI(); _pluginIReverb->initPluginInstance(pluginReverb, 2); @@ -66,14 +66,14 @@ void DeicsOnze::initPluginReverb(Plugin* pluginReverb) { //send build gui to the gui char data; data = SYSEX_BUILDGUIREVERB; - MidiPlayEvent evSysex(0, 0,ME_SYSEX,(const unsigned char*)&data, 1); + MusECore::MidiPlayEvent evSysex(0, 0,MusECore::ME_SYSEX,(const unsigned char*)&data, 1); _gui->writeEvent(evSysex); } -void DeicsOnze::initPluginChorus(Plugin* pluginChorus) { +void DeicsOnze::initPluginChorus(MusECore::Plugin* pluginChorus) { if(_pluginIChorus) delete(_pluginIChorus); - ///_pluginIChorus = new PluginI(NULL); - _pluginIChorus = new PluginI(); + ///_pluginIChorus = new MusECore::PluginI(NULL); + _pluginIChorus = new MusECore::PluginI(); _pluginIChorus->initPluginInstance(pluginChorus, 2); @@ -93,14 +93,14 @@ void DeicsOnze::initPluginChorus(Plugin* pluginChorus) { //send build gui to the gui char data; data = SYSEX_BUILDGUICHORUS; - MidiPlayEvent evSysex(0, 0,ME_SYSEX,(const unsigned char*)&data, 1); + MusECore::MidiPlayEvent evSysex(0, 0,MusECore::ME_SYSEX,(const unsigned char*)&data, 1); _gui->writeEvent(evSysex); } -void DeicsOnze::initPluginDelay(Plugin* pluginDelay) { +void DeicsOnze::initPluginDelay(MusECore::Plugin* pluginDelay) { if(_pluginIDelay) delete(_pluginIDelay); - ///_pluginIDelay = new PluginI(NULL); - _pluginIDelay = new PluginI(); + ///_pluginIDelay = new MusECore::PluginI(NULL); + _pluginIDelay = new MusECore::PluginI(); _pluginIDelay->initPluginInstance(pluginDelay, 2); @@ -123,7 +123,7 @@ void DeicsOnze::initPluginDelay(Plugin* pluginDelay) { dataDelayBPM[0] = SYSEX_DELAYBPM; f = getDelayBPM(); memcpy(&dataDelayBPM[1], &f, sizeof(float)); - MidiPlayEvent evSysexDelayBPM(0, 0,ME_SYSEX, + MusECore::MidiPlayEvent evSysexDelayBPM(0, 0,MusECore::ME_SYSEX, (const unsigned char*)dataDelayBPM, sizeof(float)+1); _gui->writeEvent(evSysexDelayBPM); @@ -131,7 +131,7 @@ void DeicsOnze::initPluginDelay(Plugin* pluginDelay) { dataDelayBeatRatio[0] = SYSEX_DELAYBEATRATIO; f = getDelayBeatRatio(); memcpy(&dataDelayBeatRatio[1], &f, sizeof(float)); - MidiPlayEvent evSysexDelayBeatRatio(0, 0,ME_SYSEX, + MusECore::MidiPlayEvent evSysexDelayBeatRatio(0, 0,MusECore::ME_SYSEX, (const unsigned char*)dataDelayBeatRatio, sizeof(float)+1); _gui->writeEvent(evSysexDelayBeatRatio); @@ -139,7 +139,7 @@ void DeicsOnze::initPluginDelay(Plugin* pluginDelay) { dataDelayFeedback[0] = SYSEX_DELAYFEEDBACK; f = getDelayFeedback(); memcpy(&dataDelayFeedback[1], &f, sizeof(float)); - MidiPlayEvent evSysexDelayFeedback(0, 0,ME_SYSEX, + MusECore::MidiPlayEvent evSysexDelayFeedback(0, 0,MusECore::ME_SYSEX, (const unsigned char*)dataDelayFeedback, sizeof(float)+1); _gui->writeEvent(evSysexDelayFeedback); @@ -147,7 +147,7 @@ void DeicsOnze::initPluginDelay(Plugin* pluginDelay) { dataDelayLFOFreq[0] = SYSEX_DELAYLFOFREQ; f = getDelayLFOFreq(); memcpy(&dataDelayLFOFreq[1], &f, sizeof(float)); - MidiPlayEvent evSysexDelayLFOFreq(0, 0,ME_SYSEX, + MusECore::MidiPlayEvent evSysexDelayLFOFreq(0, 0,MusECore::ME_SYSEX, (const unsigned char*)dataDelayLFOFreq, sizeof(float)+1); _gui->writeEvent(evSysexDelayLFOFreq); @@ -155,7 +155,7 @@ void DeicsOnze::initPluginDelay(Plugin* pluginDelay) { dataDelayLFODepth[0] = SYSEX_DELAYLFODEPTH; f = getDelayLFODepth(); memcpy(&dataDelayLFODepth, &f, sizeof(float)+1); - MidiPlayEvent evSysexDelayLFODepth(0, 0,ME_SYSEX, + MusECore::MidiPlayEvent evSysexDelayLFODepth(0, 0,MusECore::ME_SYSEX, (const unsigned char*)dataDelayLFODepth, sizeof(float)+1); _gui->writeEvent(evSysexDelayLFODepth); @@ -275,7 +275,7 @@ void DeicsOnzeGui::addPluginSlider(int index, QString text, bool isLog, } void DeicsOnzeGui::buildGuiReverb() { - PluginI* plugI = _deicsOnze->_pluginIReverb; + MusECore::PluginI* plugI = _deicsOnze->_pluginIReverb; QString name = plugI->name(); name.resize(name.size()-2); updateLadspaReverbLineEdit(name); @@ -326,7 +326,7 @@ void DeicsOnzeGui::buildGuiReverb() { } void DeicsOnzeGui::buildGuiChorus() { - PluginI* plugI = _deicsOnze->_pluginIChorus; + MusECore::PluginI* plugI = _deicsOnze->_pluginIChorus; QString name = plugI->name(); name.resize(name.size()-2); updateLadspaChorusLineEdit(name); diff --git a/muse2/synti/fluid/fluid.cpp b/muse2/synti/fluid/fluid.cpp index 1431460f..48d68fb4 100644 --- a/muse2/synti/fluid/fluid.cpp +++ b/muse2/synti/fluid/fluid.cpp @@ -137,7 +137,7 @@ bool ISynth::setController(int ch, int ctrl, int val) return true; } switch(ctrl) { - case CTRL_PROGRAM: + case MusECore::CTRL_PROGRAM: { int hbank = (val & 0xff0000) >> 16; int lbank = (val & 0xff00) >> 8; @@ -153,7 +153,7 @@ bool ISynth::setController(int ch, int ctrl, int val) } break; - case CTRL_PITCH: + case MusECore::CTRL_PITCH: fluid_synth_pitch_bend (_fluidsynth, ch, val); break; @@ -374,23 +374,23 @@ void ISynth::process(float** ports, int offset, int n) // processEvent // All events from the sequencer go here //--------------------------------------------------------- -bool ISynth::processEvent(const MidiPlayEvent& ev) +bool ISynth::processEvent(const MusECore::MidiPlayEvent& ev) { switch(ev.type()) { - case ME_CONTROLLER: + case MusECore::ME_CONTROLLER: setController(ev.channel(), ev.dataA(), ev.dataB()); return true; - case ME_NOTEON: + case MusECore::ME_NOTEON: return playNote(ev.channel(), ev.dataA(), ev.dataB()); - case ME_NOTEOFF: + case MusECore::ME_NOTEOFF: return playNote(ev.channel(), ev.dataA(), 0); - case ME_SYSEX: + case MusECore::ME_SYSEX: return sysex(ev.len(), ev.data()); - case ME_PITCHBEND: - setController(ev.channel(), CTRL_PITCH, ev.dataA()); + case MusECore::ME_PITCHBEND: + setController(ev.channel(), MusECore::CTRL_PITCH, ev.dataA()); break; - case ME_PROGRAM: - setController(ev.channel(), CTRL_PROGRAM, ev.dataA()); + case MusECore::ME_PROGRAM: + setController(ev.channel(), MusECore::CTRL_PROGRAM, ev.dataA()); break; default: break; @@ -405,7 +405,7 @@ bool ISynth::processEvent(const MidiPlayEvent& ev) const char* ISynth::getPatchName(int /*ch*/, int val, int, bool /*drum*/) const { int prog = val & 0xff; - if(val == CTRL_VAL_UNKNOWN || prog == 0xff) + if(val == MusECore::CTRL_VAL_UNKNOWN || prog == 0xff) return "<unknown>"; prog &= 0x7f; @@ -593,7 +593,7 @@ void ISynth::noRTHelper() if(slen != 0) memcpy(d + 1, fontname, slen); d[1 + slen] = 0; - MidiPlayEvent ev(0,0, ME_SYSEX, d, n); + MusECore::MidiPlayEvent ev(0,0, MusECore::ME_SYSEX, d, n); gui->writeEvent(ev); #ifdef FS_DEBUG diff --git a/muse2/synti/fluid/fluid.h b/muse2/synti/fluid/fluid.h index cc5dfc26..658be687 100644 --- a/muse2/synti/fluid/fluid.h +++ b/muse2/synti/fluid/fluid.h @@ -75,7 +75,7 @@ class ISynth : public Mess { virtual bool setController(int, int, int); virtual bool sysex(int len, const unsigned char* p); - virtual bool processEvent(const MidiPlayEvent&); + virtual bool processEvent(const MusECore::MidiPlayEvent&); virtual const char* getPatchName (int, int, int, bool) const; virtual const MidiPatch* getPatchInfo(int, const MidiPatch *) const; virtual void getInitData(int*, const unsigned char**); diff --git a/muse2/synti/fluid/fluidgui.cpp b/muse2/synti/fluid/fluidgui.cpp index 9c13e81f..ec1c77b7 100644 --- a/muse2/synti/fluid/fluidgui.cpp +++ b/muse2/synti/fluid/fluidgui.cpp @@ -50,7 +50,7 @@ FLUIDGui::FLUIDGui() QSocketNotifier* s = new QSocketNotifier(readFd, QSocketNotifier::Read); connect(s, SIGNAL(activated(int)), SLOT(readMessage(int))); - fdialogButton->setIcon(QIcon(*openIcon)); + fdialogButton->setIcon(QIcon(*MusEGui::openIcon)); connect(fdialogButton, SIGNAL(clicked()), SLOT(soundFontFileDialog())); connect(loadButton, SIGNAL(clicked()), SLOT(loadFont())); @@ -102,10 +102,10 @@ void FLUIDGui::soundFontFileDialog() } } -void FLUIDGui::processEvent(const MidiPlayEvent& ev) +void FLUIDGui::processEvent(const MusECore::MidiPlayEvent& ev) { // p4.0.27 - if (ev.type() == ME_SYSEX) { + if (ev.type() == MusECore::ME_SYSEX) { const unsigned char* data = ev.data(); switch (*data) { case FS_SEND_SOUNDFONT_NAME: { diff --git a/muse2/synti/fluid/fluidgui.h b/muse2/synti/fluid/fluidgui.h index 87bc6b24..e3cec499 100644 --- a/muse2/synti/fluid/fluidgui.h +++ b/muse2/synti/fluid/fluidgui.h @@ -48,7 +48,7 @@ class FLUIDGui : public QDialog, public Ui::FLUIDGuiBase, public MessGui { public: FLUIDGui(); - virtual void processEvent(const MidiPlayEvent&); + virtual void processEvent(const MusECore::MidiPlayEvent&); }; #endif diff --git a/muse2/synti/fluidsynth/fluidsynthgui.cpp b/muse2/synti/fluidsynth/fluidsynthgui.cpp index 62d8e791..b6a3a4bd 100644 --- a/muse2/synti/fluidsynth/fluidsynthgui.cpp +++ b/muse2/synti/fluidsynth/fluidsynthgui.cpp @@ -66,8 +66,8 @@ FluidSynthGui::FluidSynthGui() fluidLabel->setPixmap(QIcon(":/fluidsynth1.png").pixmap(124, 45)); FluidGrid->addWidget(fluidLabel, 2, 1, Qt::AlignHCenter); - ChorusType->setItemIcon(0, QIcon(*sineIcon)); - ChorusType->setItemIcon(1, QIcon(*sawIcon)); + ChorusType->setItemIcon(0, QIcon(*MusEGui::sineIcon)); + ChorusType->setItemIcon(1, QIcon(*MusEGui::sawIcon)); //Connect socketnotifier to fifo QSocketNotifier* s = new QSocketNotifier(readFd, QSocketNotifier::Read); @@ -240,10 +240,10 @@ void FluidSynthGui::sendLoadFont(QString filename) // processEvent //--------------------------------------------------------- -void FluidSynthGui::processEvent(const MidiPlayEvent& ev) +void FluidSynthGui::processEvent(const MusECore::MidiPlayEvent& ev) { //Sysexes sent from the client - if (ev.type() == ME_SYSEX) { + if (ev.type() == MusECore::ME_SYSEX) { byte* data = ev.data(); switch (*data) { case FS_LASTDIR_CHANGE: @@ -308,7 +308,7 @@ void FluidSynthGui::processEvent(const MidiPlayEvent& ev) } //Controllers sent from the client: else - if(ev.type() == ME_CONTROLLER) { + if(ev.type() == MusECore::ME_CONTROLLER) { int id = ev.dataA(); int val = ev.dataB(); switch (id) { @@ -439,9 +439,9 @@ void FluidSynthGui::updateChannelListView() QTableWidgetItem* chan_ = new QTableWidgetItem(chanstr); channelListView->setItem(i, FS_CHANNEL_COL, chan_); - QTableWidgetItem* sfid_ = new QTableWidgetItem(QIcon(*buttondownIcon), sfidstr); + QTableWidgetItem* sfid_ = new QTableWidgetItem(QIcon(*MusEGui::buttondownIcon), sfidstr); channelListView->setItem(i, FS_SF_ID_COL, sfid_); - QTableWidgetItem* drum_ = new QTableWidgetItem(QIcon(*buttondownIcon), drumchanstr); + QTableWidgetItem* drum_ = new QTableWidgetItem(QIcon(*MusEGui::buttondownIcon), drumchanstr); channelListView->setItem(i, FS_DRUM_CHANNEL_COL, drum_); } channelListView->resizeColumnsToContents(); diff --git a/muse2/synti/fluidsynth/fluidsynthgui.h b/muse2/synti/fluidsynth/fluidsynthgui.h index d0709109..01df66cd 100644 --- a/muse2/synti/fluidsynth/fluidsynthgui.h +++ b/muse2/synti/fluidsynth/fluidsynthgui.h @@ -177,7 +177,7 @@ class FluidSynthGui : public QDialog, public Ui::FLUIDSynthGuiBase, public MessG { Q_OBJECT private: - virtual void processEvent(const MidiPlayEvent& ev); + virtual void processEvent(const MusECore::MidiPlayEvent& ev); void sendLastdir(QString); void sendLoadFont(QString); void sendChannelChange(byte font_id, byte channel); diff --git a/muse2/synti/fluidsynth/fluidsynti.cpp b/muse2/synti/fluidsynth/fluidsynti.cpp index cc5c496a..fded650d 100644 --- a/muse2/synti/fluidsynth/fluidsynti.cpp +++ b/muse2/synti/fluidsynth/fluidsynti.cpp @@ -39,14 +39,14 @@ #include "muse/midi.h" FluidCtrl FluidSynth::fluidCtrl[] = { - //{ "Expression", CTRL_EXPRESSION, 0, 127 }, - //{ "Sustain", CTRL_SUSTAIN, 0, 127 }, - //{ "Portamento", CTRL_PORTAMENTO, 0, 127 }, - //{ "Soft Pedal", CTRL_SOFT_PEDAL, 0, 127 }, - //{ "Variation", CTRL_VARIATION_SEND, 0, 127 }, - //{ "Channel reverb send", CTRL_REVERB_SEND, 0, 127 }, - //{ "Channel chorus send", CTRL_CHORUS_SEND, 0, 127 }, - //{ "Pitch", CTRL_PITCH, -8192, 8191 } + //{ "Expression", MusECore::CTRL_EXPRESSION, 0, 127 }, + //{ "Sustain", MusECore::CTRL_SUSTAIN, 0, 127 }, + //{ "Portamento", MusECore::CTRL_PORTAMENTO, 0, 127 }, + //{ "Soft Pedal", MusECore::CTRL_SOFT_PEDAL, 0, 127 }, + //{ "Variation", MusECore::CTRL_VARIATION_SEND, 0, 127 }, + //{ "Channel reverb send", MusECore::CTRL_REVERB_SEND, 0, 127 }, + //{ "Channel chorus send", MusECore::CTRL_CHORUS_SEND, 0, 127 }, + //{ "Pitch", MusECore::CTRL_PITCH, -8192, 8191 } // These controllers' initial values are set by the FS_PREDEF_ values, so just set them to zero here. { "Gain", FS_GAIN ,0, 127, 0}, @@ -62,19 +62,19 @@ FluidCtrl FluidSynth::fluidCtrl[] = { { "Master chorus depth", FS_CHORUS_DEPTH, 0, 16384, 0}, // [0,40] { "Master chorus level", FS_CHORUS_LEVEL, 0, 16384, 0}, // [0,1] - { "Program", CTRL_PROGRAM, 0, 0xffffff, 0}, - { "Modulation", CTRL_MODULATION, 0, 127, 0}, - { "Portamento time", CTRL_PORTAMENTO_TIME, 0, 127, 0}, - { "Volume", CTRL_VOLUME, 0, 127, 100}, - { "Pan", CTRL_PANPOT, -64, 63, 0}, - { "Expression", CTRL_EXPRESSION, 0, 127, 127}, - { "Sustain", CTRL_SUSTAIN, 0, 127, 0}, - { "Portamento", CTRL_PORTAMENTO, 0, 127, 0}, - { "Soft Pedal", CTRL_SOFT_PEDAL, 0, 127, 0}, - { "Variation", CTRL_VARIATION_SEND, 0, 127, 0}, - { "Channel reverb send", CTRL_REVERB_SEND, 0, 127, 40}, - { "Channel chorus send", CTRL_CHORUS_SEND, 0, 127, 0}, - { "Pitch", CTRL_PITCH, -8192, 8191, 0}, + { "Program", MusECore::CTRL_PROGRAM, 0, 0xffffff, 0}, + { "Modulation", MusECore::CTRL_MODULATION, 0, 127, 0}, + { "Portamento time", MusECore::CTRL_PORTAMENTO_TIME, 0, 127, 0}, + { "Volume", MusECore::CTRL_VOLUME, 0, 127, 100}, + { "Pan", MusECore::CTRL_PANPOT, -64, 63, 0}, + { "Expression", MusECore::CTRL_EXPRESSION, 0, 127, 127}, + { "Sustain", MusECore::CTRL_SUSTAIN, 0, 127, 0}, + { "Portamento", MusECore::CTRL_PORTAMENTO, 0, 127, 0}, + { "Soft Pedal", MusECore::CTRL_SOFT_PEDAL, 0, 127, 0}, + { "Variation", MusECore::CTRL_VARIATION_SEND, 0, 127, 0}, + { "Channel reverb send", MusECore::CTRL_REVERB_SEND, 0, 127, 40}, + { "Channel chorus send", MusECore::CTRL_CHORUS_SEND, 0, 127, 0}, + { "Pitch", MusECore::CTRL_PITCH, -8192, 8191, 0}, // Added by T356 { "Pitch bend sensitivity", FS_PITCHWHEELSENS, 0, 24, 2} }; @@ -192,13 +192,13 @@ void FluidSynth::processMessages() //Process messages from the gui while (gui->fifoSize()) { - MidiPlayEvent ev = gui->readEvent(); - if (ev.type() == ME_SYSEX) + MusECore::MidiPlayEvent ev = gui->readEvent(); + if (ev.type() == MusECore::ME_SYSEX) { sysex(ev.len(), ev.data()); sendEvent(ev); } - else if (ev.type() == ME_CONTROLLER) + else if (ev.type() == MusECore::ME_CONTROLLER) { setController(ev.channel(), ev.dataA(), ev.dataB(), true); sendEvent(ev); @@ -222,12 +222,12 @@ void FluidSynth::process(float** ports, int offset, int len) /* //Process messages from the gui while (gui->fifoSize()) { - MidiPlayEvent ev = gui->readEvent(); - if (ev.type() == ME_SYSEX) { + MusECore::MidiPlayEvent ev = gui->readEvent(); + if (ev.type() == MusECore::ME_SYSEX) { sysex(ev.len(), ev.data()); sendEvent(ev); } - else if (ev.type() == ME_CONTROLLER) { + else if (ev.type() == MusECore::ME_CONTROLLER) { setController(ev.channel(), ev.dataA(), ev.dataB(), true); sendEvent(ev); } @@ -478,10 +478,10 @@ void FluidSynth::parseInitData(int n, const byte* d) // All events from the sequencer goes here //--------------------------------------------------------- -bool FluidSynth::processEvent(const MidiPlayEvent& ev) +bool FluidSynth::processEvent(const MusECore::MidiPlayEvent& ev) { switch(ev.type()) { - case ME_CONTROLLER: + case MusECore::ME_CONTROLLER: if (FS_DEBUG_DATA) { printf("*** FluidSynth::process - Controller. Chan: %x dataA: %x dataB: %x\n", ev.channel(), ev.dataA(), ev.dataB()); for (int i=0; i< ev.len(); i++) @@ -489,11 +489,11 @@ bool FluidSynth::processEvent(const MidiPlayEvent& ev) } setController(ev.channel(), ev.dataA(), ev.dataB(), false); return true; - case ME_NOTEON: + case MusECore::ME_NOTEON: return playNote(ev.channel(), ev.dataA(), ev.dataB()); - case ME_NOTEOFF: + case MusECore::ME_NOTEOFF: return playNote(ev.channel(), ev.dataA(), 0); - case ME_SYSEX: + case MusECore::ME_SYSEX: //Debug print if (FS_DEBUG_DATA) { printf("*** FluidSynth::process - Sysex received\n"); @@ -502,12 +502,12 @@ bool FluidSynth::processEvent(const MidiPlayEvent& ev) printf("\n"); } return sysex(ev.len(), ev.data()); - case ME_PITCHBEND: - setController(ev.channel(), CTRL_PITCH, ev.dataA(), false); + case MusECore::ME_PITCHBEND: + setController(ev.channel(), MusECore::CTRL_PITCH, ev.dataA(), false); break; - case ME_PROGRAM: - setController(ev.channel(), CTRL_PROGRAM, ev.dataA(), false); + case MusECore::ME_PROGRAM: + setController(ev.channel(), MusECore::CTRL_PROGRAM, ev.dataA(), false); break; default: break; @@ -584,7 +584,7 @@ bool FluidSynth::sysex(int n, const unsigned char* d) //--------------------------------------------------------- void FluidSynth::sendSysex(int l, const unsigned char* d) { - MidiPlayEvent ev(0, 0, ME_SYSEX, d, l); + MusECore::MidiPlayEvent ev(0, 0, MusECore::ME_SYSEX, d, l); //printf("FluidSynth::sendSysex gui:%p\n", gui); gui->writeEvent(ev); } @@ -851,7 +851,7 @@ void FluidSynth::setController(int channel, int id, int val, bool fromGui) fluid_synth_set_gain(fluidsynth, (float) val/25); //gives val an interval of approximately[0,5] //Forward to gui if not from Gui if (!fromGui) { - MidiPlayEvent ev(0, 0, 0, ME_CONTROLLER, FS_GAIN, val); + MusECore::MidiPlayEvent ev(0, 0, 0, MusECore::ME_CONTROLLER, FS_GAIN, val); gui->writeEvent(ev); } break; @@ -862,7 +862,7 @@ void FluidSynth::setController(int channel, int id, int val, bool fromGui) //if (rev_on) // fluid_synth_set_reverb(fluidsynth, rev_size, rev_damping, rev_width, rev_level); if (!fromGui) { - MidiPlayEvent ev(0, 0, 0, ME_CONTROLLER, FS_REVERB_ON, val); + MusECore::MidiPlayEvent ev(0, 0, 0, MusECore::ME_CONTROLLER, FS_REVERB_ON, val); gui->writeEvent(ev); } break; @@ -873,7 +873,7 @@ void FluidSynth::setController(int channel, int id, int val, bool fromGui) //if (rev_on) fluid_synth_set_reverb(fluidsynth, rev_size, rev_damping, rev_width, rev_level); if (!fromGui) { - MidiPlayEvent ev(0, 0, 0, ME_CONTROLLER, FS_REVERB_LEVEL, val); + MusECore::MidiPlayEvent ev(0, 0, 0, MusECore::ME_CONTROLLER, FS_REVERB_LEVEL, val); gui->writeEvent(ev); } break; @@ -882,7 +882,7 @@ void FluidSynth::setController(int channel, int id, int val, bool fromGui) //if (rev_on) fluid_synth_set_reverb(fluidsynth, rev_size, rev_damping, rev_width, rev_level); if (!fromGui) { - MidiPlayEvent ev(0, 0, 0, ME_CONTROLLER, FS_REVERB_WIDTH, val); + MusECore::MidiPlayEvent ev(0, 0, 0, MusECore::ME_CONTROLLER, FS_REVERB_WIDTH, val); gui->writeEvent(ev); } break; @@ -891,7 +891,7 @@ void FluidSynth::setController(int channel, int id, int val, bool fromGui) //if (rev_on) fluid_synth_set_reverb(fluidsynth, rev_size, rev_damping, rev_width, rev_level); if (!fromGui) { - MidiPlayEvent ev(0, 0, 0, ME_CONTROLLER, FS_REVERB_DAMPING, val); + MusECore::MidiPlayEvent ev(0, 0, 0, MusECore::ME_CONTROLLER, FS_REVERB_DAMPING, val); gui->writeEvent(ev); } break; @@ -900,7 +900,7 @@ void FluidSynth::setController(int channel, int id, int val, bool fromGui) //if (rev_on) fluid_synth_set_reverb(fluidsynth, rev_size, rev_damping, rev_width, rev_level); if (!fromGui) { - MidiPlayEvent ev(0, 0, 0, ME_CONTROLLER, FS_REVERB_ROOMSIZE, val); + MusECore::MidiPlayEvent ev(0, 0, 0, MusECore::ME_CONTROLLER, FS_REVERB_ROOMSIZE, val); gui->writeEvent(ev); } break; @@ -908,7 +908,7 @@ void FluidSynth::setController(int channel, int id, int val, bool fromGui) cho_on = val; fluid_synth_set_chorus_on(fluidsynth, val); if (!fromGui) { - MidiPlayEvent ev(0, 0, 0, ME_CONTROLLER, FS_CHORUS_ON, val); + MusECore::MidiPlayEvent ev(0, 0, 0, MusECore::ME_CONTROLLER, FS_CHORUS_ON, val); gui->writeEvent(ev); } break; @@ -917,7 +917,7 @@ void FluidSynth::setController(int channel, int id, int val, bool fromGui) cho_num = val; fluid_synth_set_chorus(fluidsynth, cho_num, cho_level, cho_speed, cho_depth, cho_type); if (!fromGui) { - MidiPlayEvent ev(0, 0, 0, ME_CONTROLLER, FS_CHORUS_NUM, val); + MusECore::MidiPlayEvent ev(0, 0, 0, MusECore::ME_CONTROLLER, FS_CHORUS_NUM, val); gui->writeEvent(ev); } break; @@ -926,7 +926,7 @@ void FluidSynth::setController(int channel, int id, int val, bool fromGui) cho_type = val; fluid_synth_set_chorus(fluidsynth, cho_num, cho_level, cho_speed, cho_depth, cho_type); if (!fromGui) { - MidiPlayEvent ev(0, 0, 0, ME_CONTROLLER, FS_CHORUS_TYPE, val); + MusECore::MidiPlayEvent ev(0, 0, 0, MusECore::ME_CONTROLLER, FS_CHORUS_TYPE, val); gui->writeEvent(ev); } break; @@ -935,7 +935,7 @@ void FluidSynth::setController(int channel, int id, int val, bool fromGui) cho_speed = (double)(0.291 + (double)val/3479); fluid_synth_set_chorus(fluidsynth, cho_num, cho_level, cho_speed, cho_depth, cho_type); if (!fromGui) { - MidiPlayEvent ev(0, 0, 0, ME_CONTROLLER, FS_CHORUS_SPEED, val); + MusECore::MidiPlayEvent ev(0, 0, 0, MusECore::ME_CONTROLLER, FS_CHORUS_SPEED, val); gui->writeEvent(ev); } break; @@ -944,7 +944,7 @@ void FluidSynth::setController(int channel, int id, int val, bool fromGui) cho_depth = (double) val*40/16383; fluid_synth_set_chorus(fluidsynth, cho_num, cho_level, cho_speed, cho_depth, cho_type); if (!fromGui) { - MidiPlayEvent ev(0, 0, 0, ME_CONTROLLER, FS_CHORUS_DEPTH, val); + MusECore::MidiPlayEvent ev(0, 0, 0, MusECore::ME_CONTROLLER, FS_CHORUS_DEPTH, val); gui->writeEvent(ev); } break; @@ -953,7 +953,7 @@ void FluidSynth::setController(int channel, int id, int val, bool fromGui) cho_level = (double) val/16383; fluid_synth_set_chorus(fluidsynth, cho_num, cho_level, cho_speed, cho_depth, cho_type); if (!fromGui) { - MidiPlayEvent ev(0, 0, 0, ME_CONTROLLER, FS_CHORUS_LEVEL, val); + MusECore::MidiPlayEvent ev(0, 0, 0, MusECore::ME_CONTROLLER, FS_CHORUS_LEVEL, val); gui->writeEvent(ev); } break; @@ -961,7 +961,7 @@ void FluidSynth::setController(int channel, int id, int val, bool fromGui) // // Controllers that depend on channels // - case CTRL_PITCH: + case MusECore::CTRL_PITCH: // MusE's range is from -8192 to +8191, fluidsynth seems to be [0, 16384] val +=8192; err = fluid_synth_pitch_bend (fluidsynth, channel, val); @@ -972,7 +972,7 @@ void FluidSynth::setController(int channel, int id, int val, bool fromGui) err = fluid_synth_pitch_wheel_sens(fluidsynth, channel, val); break; - case CTRL_PROGRAM: { + case MusECore::CTRL_PROGRAM: { //Check if MusE is trying to set a preset on an unspecified font. If so, ignore. if (FS_DEBUG) printf("Program select : channel %d val %d\n",channel, val); @@ -1140,7 +1140,7 @@ void FluidSynth::sendLastdir(const char* lastdir) memcpy(d+1,lastdir, strlen(lastdir)+1); //memcpy(d+3,lastdir, strlen(lastdir)+1); - MidiPlayEvent ev(0,0, ME_SYSEX, d, n); + MusECore::MidiPlayEvent ev(0,0, MusECore::ME_SYSEX, d, n); gui->writeEvent(ev); } diff --git a/muse2/synti/fluidsynth/fluidsynti.h b/muse2/synti/fluidsynth/fluidsynti.h index 7a97904e..0628a385 100644 --- a/muse2/synti/fluidsynth/fluidsynti.h +++ b/muse2/synti/fluidsynth/fluidsynti.h @@ -64,20 +64,20 @@ struct FluidCtrl { }; // NRPN-controllers: -static const int FS_GAIN = 0 + CTRL_NRPN14_OFFSET; -static const int FS_REVERB_ON = 1 + CTRL_NRPN14_OFFSET; -static const int FS_REVERB_LEVEL = 2 + CTRL_NRPN14_OFFSET; -static const int FS_REVERB_ROOMSIZE = 3 + CTRL_NRPN14_OFFSET; -static const int FS_REVERB_DAMPING = 4 + CTRL_NRPN14_OFFSET; -static const int FS_REVERB_WIDTH = 5 + CTRL_NRPN14_OFFSET; -static const int FS_CHORUS_ON = 6 + CTRL_NRPN14_OFFSET; -static const int FS_CHORUS_NUM = 7 + CTRL_NRPN14_OFFSET; -static const int FS_CHORUS_TYPE = 8 + CTRL_NRPN14_OFFSET; -static const int FS_CHORUS_SPEED = 9 + CTRL_NRPN14_OFFSET; -static const int FS_CHORUS_DEPTH = 10 + CTRL_NRPN14_OFFSET; -static const int FS_CHORUS_LEVEL = 11 + CTRL_NRPN14_OFFSET; +static const int FS_GAIN = 0 + MusECore::CTRL_NRPN14_OFFSET; +static const int FS_REVERB_ON = 1 + MusECore::CTRL_NRPN14_OFFSET; +static const int FS_REVERB_LEVEL = 2 + MusECore::CTRL_NRPN14_OFFSET; +static const int FS_REVERB_ROOMSIZE = 3 + MusECore::CTRL_NRPN14_OFFSET; +static const int FS_REVERB_DAMPING = 4 + MusECore::CTRL_NRPN14_OFFSET; +static const int FS_REVERB_WIDTH = 5 + MusECore::CTRL_NRPN14_OFFSET; +static const int FS_CHORUS_ON = 6 + MusECore::CTRL_NRPN14_OFFSET; +static const int FS_CHORUS_NUM = 7 + MusECore::CTRL_NRPN14_OFFSET; +static const int FS_CHORUS_TYPE = 8 + MusECore::CTRL_NRPN14_OFFSET; +static const int FS_CHORUS_SPEED = 9 + MusECore::CTRL_NRPN14_OFFSET; +static const int FS_CHORUS_DEPTH = 10 + MusECore::CTRL_NRPN14_OFFSET; +static const int FS_CHORUS_LEVEL = 11 + MusECore::CTRL_NRPN14_OFFSET; // Added by T356 -static const int FS_PITCHWHEELSENS = 0 + CTRL_RPN_OFFSET; +static const int FS_PITCHWHEELSENS = 0 + MusECore::CTRL_RPN_OFFSET; // FluidChannel is used to map different soundfonts to different fluid-channels // This is to be able to select different presets from specific soundfonts, since @@ -141,7 +141,7 @@ public: virtual const char* getPatchName(int, int, int, bool) const; virtual const MidiPatch* getPatchInfo(int i, const MidiPatch* patch) const; virtual int getControllerInfo(int, const char**, int*, int*, int*, int*) const; - virtual bool processEvent(const MidiPlayEvent&); + virtual bool processEvent(const MusECore::MidiPlayEvent&); //virtual bool hasGui() const { return true; } //virtual bool guiVisible() const; diff --git a/muse2/synti/libsynti/gui.cpp b/muse2/synti/libsynti/gui.cpp index 194e186a..92935ae2 100644 --- a/muse2/synti/libsynti/gui.cpp +++ b/muse2/synti/libsynti/gui.cpp @@ -78,7 +78,7 @@ void MessGui::readMessage() // sendEvent //--------------------------------------------------------- -void MessGui::sendEvent(const MidiPlayEvent& ev) +void MessGui::sendEvent(const MusECore::MidiPlayEvent& ev) { if (wFifoSize == EVENT_FIFO_SIZE) { printf("event gui->synti fifo overflow\n"); @@ -95,10 +95,10 @@ void MessGui::sendEvent(const MidiPlayEvent& ev) void MessGui::sendController(int ch, int idx, int val) { -// MidiPlayEvent pe(0, 0, ch, ME_CONTROLLER, idx, val); +// MusECore::MidiPlayEvent pe(0, 0, ch, MusECore::ME_CONTROLLER, idx, val); // sendEvent(pe); - sendEvent(MidiPlayEvent(0, 0, ch, ME_CONTROLLER, idx, val)); + sendEvent(MusECore::MidiPlayEvent(0, 0, ch, MusECore::ME_CONTROLLER, idx, val)); } //--------------------------------------------------------- @@ -107,10 +107,10 @@ void MessGui::sendController(int ch, int idx, int val) void MessGui::sendSysex(unsigned char* p, int n) { -// MidiPlayEvent pe(0, 0, ME_SYSEX, p, n); +// MusECore::MidiPlayEvent pe(0, 0, MusECore::ME_SYSEX, p, n); // sendEvent(pe); - sendEvent(MidiPlayEvent(0, 0, ME_SYSEX, p, n)); + sendEvent(MusECore::MidiPlayEvent(0, 0, MusECore::ME_SYSEX, p, n)); } //--------------------------------------------------------- @@ -118,7 +118,7 @@ void MessGui::sendSysex(unsigned char* p, int n) // send an event to synti gui //--------------------------------------------------------- -void MessGui::writeEvent(const MidiPlayEvent& ev) +void MessGui::writeEvent(const MusECore::MidiPlayEvent& ev) { if (rFifoSize == EVENT_FIFO_SIZE) { printf("event synti->gui fifo overflow\n"); @@ -135,9 +135,9 @@ void MessGui::writeEvent(const MidiPlayEvent& ev) // read event from synti gui //--------------------------------------------------------- -MidiPlayEvent MessGui::readEvent() +MusECore::MidiPlayEvent MessGui::readEvent() { - MidiPlayEvent ev = wFifo[wFifoRindex]; + MusECore::MidiPlayEvent ev = wFifo[wFifoRindex]; wFifoRindex = (wFifoRindex + 1) % EVENT_FIFO_SIZE; --wFifoSize; return ev; diff --git a/muse2/synti/libsynti/gui.h b/muse2/synti/libsynti/gui.h index 96ac907f..1fda6c26 100644 --- a/muse2/synti/libsynti/gui.h +++ b/muse2/synti/libsynti/gui.h @@ -39,13 +39,13 @@ class MessGui { int writeFd; // Event Fifo synti -> GUI - MidiPlayEvent rFifo[EVENT_FIFO_SIZE]; + MusECore::MidiPlayEvent rFifo[EVENT_FIFO_SIZE]; volatile int rFifoSize; int rFifoWindex; int rFifoRindex; // Event Fifo GUI -> synti - MidiPlayEvent wFifo[EVENT_FIFO_SIZE]; + MusECore::MidiPlayEvent wFifo[EVENT_FIFO_SIZE]; volatile int wFifoSize; int wFifoWindex; int wFifoRindex; @@ -53,19 +53,19 @@ class MessGui { protected: int readFd; void readMessage(); - void sendEvent(const MidiPlayEvent& ev); + void sendEvent(const MusECore::MidiPlayEvent& ev); void sendController(int,int,int); void sendSysex(unsigned char*, int); - virtual void processEvent(const MidiPlayEvent&) {}; + virtual void processEvent(const MusECore::MidiPlayEvent&) {}; public: MessGui(); virtual ~MessGui(); - void writeEvent(const MidiPlayEvent&); + void writeEvent(const MusECore::MidiPlayEvent&); int fifoSize() const { return wFifoSize; } - MidiPlayEvent readEvent(); + MusECore::MidiPlayEvent readEvent(); }; //--------------------------------------------------------- diff --git a/muse2/synti/libsynti/mess.cpp b/muse2/synti/libsynti/mess.cpp index 62a281e1..027a30c1 100644 --- a/muse2/synti/libsynti/mess.cpp +++ b/muse2/synti/libsynti/mess.cpp @@ -32,7 +32,7 @@ static const int FIFO_SIZE = 32; struct MessP { // Event Fifo synti -> Host: - MidiPlayEvent fifo[FIFO_SIZE]; + MusECore::MidiPlayEvent fifo[FIFO_SIZE]; volatile int fifoSize; int fifoWindex; int fifoRindex; @@ -92,7 +92,7 @@ void Mess::getNativeGeometry(int* x, int* y, int* w, int* h) const // send Event synti -> host //--------------------------------------------------------- -void Mess::sendEvent(MidiPlayEvent ev) +void Mess::sendEvent(MusECore::MidiPlayEvent ev) { if (d->fifoSize == FIFO_SIZE) { printf("event synti->host fifo overflow\n"); @@ -108,9 +108,9 @@ void Mess::sendEvent(MidiPlayEvent ev) // called from host //--------------------------------------------------------- -MidiPlayEvent Mess::receiveEvent() +MusECore::MidiPlayEvent Mess::receiveEvent() { - MidiPlayEvent ev = d->fifo[d->fifoRindex]; + MusECore::MidiPlayEvent ev = d->fifo[d->fifoRindex]; d->fifoRindex = (d->fifoRindex + 1) % FIFO_SIZE; --(d->fifoSize); return ev; @@ -134,19 +134,19 @@ int Mess::eventsPending() const // return true if synti is busy //--------------------------------------------------------- -bool Mess::processEvent(const MidiPlayEvent& ev) +bool Mess::processEvent(const MusECore::MidiPlayEvent& ev) { switch(ev.type()) { - case ME_NOTEON: + case MusECore::ME_NOTEON: return playNote(ev.channel(), ev.dataA(), ev.dataB()); - case ME_NOTEOFF: + case MusECore::ME_NOTEOFF: return playNote(ev.channel(), ev.dataA(), 0); - case ME_SYSEX: + case MusECore::ME_SYSEX: return sysex(ev.len(), ev.data()); - case ME_CONTROLLER: + case MusECore::ME_CONTROLLER: return setController(ev.channel(), ev.dataA(), ev.dataB()); - case ME_PITCHBEND: // Tim. - return setController(ev.channel(), CTRL_PITCH, ev.dataA()); + case MusECore::ME_PITCHBEND: // Tim. + return setController(ev.channel(), MusECore::CTRL_PITCH, ev.dataA()); } return false; } diff --git a/muse2/synti/libsynti/mess.h b/muse2/synti/libsynti/mess.h index 65f30e26..f9853330 100644 --- a/muse2/synti/libsynti/mess.h +++ b/muse2/synti/libsynti/mess.h @@ -81,7 +81,7 @@ class Mess { // the synti has to (re-)implement processEvent() or provide // some of the next three functions: - virtual bool processEvent(const MidiPlayEvent&); + virtual bool processEvent(const MusECore::MidiPlayEvent&); virtual bool setController(int, int, int) { return false; } virtual bool playNote(int, int, int) { return false; } virtual bool sysex(int, const unsigned char*) { return false; } @@ -92,8 +92,8 @@ class Mess { virtual const MidiPatch* getPatchInfo(int, const MidiPatch*) const { return 0; } // synthesizer -> host communication - void sendEvent(MidiPlayEvent); // called from synti - MidiPlayEvent receiveEvent(); // called from host + void sendEvent(MusECore::MidiPlayEvent); // called from synti + MusECore::MidiPlayEvent receiveEvent(); // called from host int eventsPending() const; // GUI interface routines diff --git a/muse2/synti/libsynti/poly.cpp b/muse2/synti/libsynti/poly.cpp index 1dec00fd..e76dfc6b 100644 --- a/muse2/synti/libsynti/poly.cpp +++ b/muse2/synti/libsynti/poly.cpp @@ -41,8 +41,8 @@ bool MessPoly::playNote(int /*channel*/, int /*pitch*/, int /*velo*/) bool MessPoly::setController(int /*channel*/, int num, int /*val*/) { switch(num) { - case CTRL_VOLUME: - case CTRL_EXPRESSION: + case MusECore::CTRL_VOLUME: + case MusECore::CTRL_EXPRESSION: break; } return false; diff --git a/muse2/synti/organ/organ.cpp b/muse2/synti/organ/organ.cpp index d9613992..fdcd02aa 100644 --- a/muse2/synti/organ/organ.cpp +++ b/muse2/synti/organ/organ.cpp @@ -58,7 +58,7 @@ SynthCtrl Organ::synthCtrl[] = { { "reed", REED, 1 }, { "velocity", VELO, 0 }, // next controller not send as init data - { "volume", CTRL_VOLUME, 100 }, + { "volume", MusECore::CTRL_VOLUME, 100 }, }; static int NUM_CONTROLLER = sizeof(Organ::synthCtrl)/sizeof(*(Organ::synthCtrl)); @@ -209,8 +209,8 @@ void Organ::processMessages() // while (gui->fifoSize()) { - MidiPlayEvent ev = gui->readEvent(); - if (ev.type() == ME_CONTROLLER) + MusECore::MidiPlayEvent ev = gui->readEvent(); + if (ev.type() == MusECore::ME_CONTROLLER) { // process local? setController(ev.dataA(), ev.dataB()); @@ -238,8 +238,8 @@ void Organ::process(float** ports, int offset, int sampleCount) // synthesizer GUI // while (gui->fifoSize()) { - MidiPlayEvent ev = gui->readEvent(); - if (ev.type() == ME_CONTROLLER) { + MusECore::MidiPlayEvent ev = gui->readEvent(); + if (ev.type() == MusECore::ME_CONTROLLER) { // process local? setController(ev.dataA(), ev.dataB()); sendEvent(ev); @@ -537,15 +537,15 @@ void Organ::setController(int ctrl, int data) case VELO: velo = data; break; - case CTRL_VOLUME: + case MusECore::CTRL_VOLUME: data &= 0x7f; volume = data == 0 ? 0.0 : cb2amp(int(200 * log10((127.0 * 127)/(data*data)))); break; - case CTRL_ALL_SOUNDS_OFF: + case MusECore::CTRL_ALL_SOUNDS_OFF: for (int i = 0; i < VOICES; ++i) voices[i].isOn = false; break; - case CTRL_RESET_ALL_CTRL: + case MusECore::CTRL_RESET_ALL_CTRL: for (int i = 0; i < NUM_CONTROLLER; ++i) setController(0, synthCtrl[i].num, synthCtrl[i].val); break; @@ -591,7 +591,7 @@ bool Organ::setController(int channel, int ctrl, int data) case REED: case VELO: { - MidiPlayEvent ev(0, 0, channel, ME_CONTROLLER, ctrl, data); + MusECore::MidiPlayEvent ev(0, 0, channel, MusECore::ME_CONTROLLER, ctrl, data); #ifdef ORGAN_DEBUG fprintf(stderr, "OrganGui:setController before gui->writeEvent ctrl:%d data:%d\n", ctrl, data); #endif @@ -681,7 +681,7 @@ int Organ::getControllerInfo(int id, const char** name, int* controller, *name = synthCtrl[id].name; *initval = synthCtrl[id].val; - if(synthCtrl[id].num == CTRL_VOLUME) + if(synthCtrl[id].num == MusECore::CTRL_VOLUME) { *min = 0; *max = 127; diff --git a/muse2/synti/organ/organ.h b/muse2/synti/organ/organ.h index b85f9282..8a7de162 100644 --- a/muse2/synti/organ/organ.h +++ b/muse2/synti/organ/organ.h @@ -89,24 +89,24 @@ struct Envelope { } }; -static const int HARM0 = 0 + CTRL_RPN14_OFFSET; -static const int HARM1 = 1 + CTRL_RPN14_OFFSET; -static const int HARM2 = 2 + CTRL_RPN14_OFFSET; -static const int HARM3 = 3 + CTRL_RPN14_OFFSET; -static const int HARM4 = 4 + CTRL_RPN14_OFFSET; -static const int HARM5 = 5 + CTRL_RPN14_OFFSET; -static const int ATTACK_LO = 6 + CTRL_RPN14_OFFSET; -static const int DECAY_LO = 7 + CTRL_RPN14_OFFSET; -static const int SUSTAIN_LO = 8 + CTRL_RPN14_OFFSET; -static const int RELEASE_LO = 9 + CTRL_RPN14_OFFSET; -static const int ATTACK_HI = 10 + CTRL_RPN14_OFFSET; -static const int DECAY_HI = 11 + CTRL_RPN14_OFFSET; -static const int SUSTAIN_HI = 12 + CTRL_RPN14_OFFSET; -static const int RELEASE_HI = 13 + CTRL_RPN14_OFFSET; -static const int BRASS = 14 + CTRL_RPN14_OFFSET; -static const int FLUTE = 15 + CTRL_RPN14_OFFSET; -static const int REED = 16 + CTRL_RPN14_OFFSET; -static const int VELO = 17 + CTRL_RPN14_OFFSET; +static const int HARM0 = 0 + MusECore::CTRL_RPN14_OFFSET; +static const int HARM1 = 1 + MusECore::CTRL_RPN14_OFFSET; +static const int HARM2 = 2 + MusECore::CTRL_RPN14_OFFSET; +static const int HARM3 = 3 + MusECore::CTRL_RPN14_OFFSET; +static const int HARM4 = 4 + MusECore::CTRL_RPN14_OFFSET; +static const int HARM5 = 5 + MusECore::CTRL_RPN14_OFFSET; +static const int ATTACK_LO = 6 + MusECore::CTRL_RPN14_OFFSET; +static const int DECAY_LO = 7 + MusECore::CTRL_RPN14_OFFSET; +static const int SUSTAIN_LO = 8 + MusECore::CTRL_RPN14_OFFSET; +static const int RELEASE_LO = 9 + MusECore::CTRL_RPN14_OFFSET; +static const int ATTACK_HI = 10 + MusECore::CTRL_RPN14_OFFSET; +static const int DECAY_HI = 11 + MusECore::CTRL_RPN14_OFFSET; +static const int SUSTAIN_HI = 12 + MusECore::CTRL_RPN14_OFFSET; +static const int RELEASE_HI = 13 + MusECore::CTRL_RPN14_OFFSET; +static const int BRASS = 14 + MusECore::CTRL_RPN14_OFFSET; +static const int FLUTE = 15 + MusECore::CTRL_RPN14_OFFSET; +static const int REED = 16 + MusECore::CTRL_RPN14_OFFSET; +static const int VELO = 17 + MusECore::CTRL_RPN14_OFFSET; //--------------------------------------------------------- // SynthCtrl diff --git a/muse2/synti/organ/organgui.cpp b/muse2/synti/organ/organgui.cpp index e648a9e6..21f8e828 100644 --- a/muse2/synti/organ/organgui.cpp +++ b/muse2/synti/organ/organgui.cpp @@ -107,7 +107,7 @@ void OrganGui::ctrlChanged(int idx) else if (ctrl->type == SynthGuiCtrl::SWITCH) { val = ((QCheckBox*)(ctrl->editor))->isChecked(); } - sendController(0, idx + CTRL_RPN14_OFFSET, val); + sendController(0, idx + MusECore::CTRL_RPN14_OFFSET, val); } //--------------------------------------------------------- @@ -185,9 +185,9 @@ void OrganGui::setParam(int param, int val) // processEvent //--------------------------------------------------------- -void OrganGui::processEvent(const MidiPlayEvent& ev) +void OrganGui::processEvent(const MusECore::MidiPlayEvent& ev) { - if (ev.type() == ME_CONTROLLER) + if (ev.type() == MusECore::ME_CONTROLLER) setParam(ev.dataA(), ev.dataB()); else { diff --git a/muse2/synti/organ/organgui.h b/muse2/synti/organ/organgui.h index 826ecf09..2af6a959 100644 --- a/muse2/synti/organ/organgui.h +++ b/muse2/synti/organ/organgui.h @@ -51,7 +51,7 @@ class OrganGui : public QWidget, public Ui::OrganGuiBase, public MessGui { void readMessage(int); public: - virtual void processEvent(const MidiPlayEvent&); + virtual void processEvent(const MusECore::MidiPlayEvent&); int getControllerMinMax(int id, int* min, int* max) const; OrganGui(); }; diff --git a/muse2/synti/simpledrums2/common.h b/muse2/synti/simpledrums2/common.h index 827d68c0..e3046f0f 100644 --- a/muse2/synti/simpledrums2/common.h +++ b/muse2/synti/simpledrums2/common.h @@ -76,7 +76,7 @@ #define SS_NR_OF_PLUGIN_CONTROLLERS 2 #define SS_NR_OF_CONTROLLERS (SS_NR_OF_MASTER_CONTROLLERS + (SS_NR_OF_CHANNELS * SS_NR_OF_CHANNEL_CONTROLLERS) + (SS_NR_OF_PLUGIN_CONTROLLERS*SS_NR_OF_SENDEFFECTS)) -#define SS_FIRST_MASTER_CONTROLLER CTRL_NRPN14_OFFSET +#define SS_FIRST_MASTER_CONTROLLER MusECore::CTRL_NRPN14_OFFSET #define SS_FIRST_CHANNEL_CONTROLLER (SS_FIRST_MASTER_CONTROLLER + SS_NR_OF_MASTER_CONTROLLERS) #define SS_LAST_MASTER_CONTROLLER (SS_FIRST_CHANNEL_CONTROLLER - 1) #define SS_LAST_CHANNEL_CONTROLLER (SS_FIRST_CHANNEL_CONTROLLER -1 + (SS_NR_OF_CHANNEL_CONTROLLERS * SS_NR_OF_CHANNELS)) diff --git a/muse2/synti/simpledrums2/simpledrums.cpp b/muse2/synti/simpledrums2/simpledrums.cpp index 2321ec4b..c7c2c85f 100644 --- a/muse2/synti/simpledrums2/simpledrums.cpp +++ b/muse2/synti/simpledrums2/simpledrums.cpp @@ -142,7 +142,7 @@ SimpleSynth::SimpleSynth(int sr) //Build controller list: controllers[0].name = "Master volume"; - controllers[0].num = CTRL_NRPN14_OFFSET; + controllers[0].num = MusECore::CTRL_NRPN14_OFFSET; controllers[0].min = 0; controllers[0].max = 127; @@ -157,36 +157,36 @@ SimpleSynth::SimpleSynth(int sr) QString c7 = "Channel " + QString::number(ch + 1) + " fx send 3"; QString c8 = "Channel " + QString::number(ch + 1) + " fx send 4"; controllers[i].name = c1.toLatin1().constData(); - controllers[i].num = CTRL_NRPN14_OFFSET+i; + controllers[i].num = MusECore::CTRL_NRPN14_OFFSET+i; controllers[i].min = 0; controllers[i].max = 127; controllers[i+1].name = c2.toLatin1().constData(); - controllers[i+1].num = CTRL_NRPN14_OFFSET+i+1; + controllers[i+1].num = MusECore::CTRL_NRPN14_OFFSET+i+1; controllers[i+1].min = 0; controllers[i+1].max = 127; controllers[i+2].name = c3.toLatin1().constData(); - controllers[i+2].num = CTRL_NRPN14_OFFSET+i+2; + controllers[i+2].num = MusECore::CTRL_NRPN14_OFFSET+i+2; controllers[i+2].min = 0; controllers[i+2].max = 1; controllers[i+3].name = c4.toLatin1().constData(); - controllers[i+3].num = CTRL_NRPN14_OFFSET+i+3; + controllers[i+3].num = MusECore::CTRL_NRPN14_OFFSET+i+3; controllers[i+3].min = 0; controllers[i+3].max = 1; controllers[i+4].name = c5.toLatin1().constData(); - controllers[i+4].num = CTRL_NRPN14_OFFSET+i+4; + controllers[i+4].num = MusECore::CTRL_NRPN14_OFFSET+i+4; controllers[i+5].name = c6.toLatin1().constData(); - controllers[i+5].num = CTRL_NRPN14_OFFSET+i+5; + controllers[i+5].num = MusECore::CTRL_NRPN14_OFFSET+i+5; controllers[i+6].name = c7.toLatin1().constData(); - controllers[i+6].num = CTRL_NRPN14_OFFSET+i+6; + controllers[i+6].num = MusECore::CTRL_NRPN14_OFFSET+i+6; controllers[i+7].name = c8.toLatin1().constData(); - controllers[i+7].num = CTRL_NRPN14_OFFSET+i+7; + controllers[i+7].num = MusECore::CTRL_NRPN14_OFFSET+i+7; controllers[i+4].min = controllers[i+5].min = controllers[i+6].min = controllers[i+7].min = 0; controllers[i+4].max = controllers[i+5].max = controllers[i+6].max = controllers[i+7].max = 127; @@ -198,12 +198,12 @@ SimpleSynth::SimpleSynth(int sr) QString c1 = "Sendfx " + QString::number(sfx) + " ret gain"; QString c2 = "Sendfx " + QString::number(sfx) + " on/off"; controllers[i].name = c1.toLatin1().constData(); - controllers[i].num = CTRL_NRPN14_OFFSET+i; + controllers[i].num = MusECore::CTRL_NRPN14_OFFSET+i; controllers[i].min = 0; controllers[i].max = 127; controllers[i+1].name = c2.toLatin1().constData(); - controllers[i+1].num = CTRL_NRPN14_OFFSET+i+1; + controllers[i+1].num = MusECore::CTRL_NRPN14_OFFSET+i+1; controllers[i+1].min = 0; controllers[i+1].max = 1; i+=2; @@ -355,11 +355,11 @@ bool SimpleSynth::playNote(int /*channel*/, int pitch, int velo) \return false for ok, true for not ok */ //--------------------------------------------------------- -bool SimpleSynth::processEvent(const MidiPlayEvent& ev) +bool SimpleSynth::processEvent(const MusECore::MidiPlayEvent& ev) { SS_TRACE_IN switch(ev.type()) { - case ME_CONTROLLER: + case MusECore::ME_CONTROLLER: if (SS_DEBUG_MIDI) { printf("SimpleSynth::processEvent - Controller. Chan: %x dataA: %x dataB: %x\n", ev.channel(), ev.dataA(), ev.dataB()); for (int i=0; i< ev.len(); i++) @@ -367,11 +367,11 @@ bool SimpleSynth::processEvent(const MidiPlayEvent& ev) } setController(ev.channel(), ev.dataA(), ev.dataB(), false); return true; - case ME_NOTEON: + case MusECore::ME_NOTEON: return playNote(ev.channel(), ev.dataA(), ev.dataB()); - case ME_NOTEOFF: + case MusECore::ME_NOTEOFF: return playNote(ev.channel(), ev.dataA(), 0); - case ME_SYSEX: + case MusECore::ME_SYSEX: //Debug print if (SS_DEBUG_MIDI) { printf("SimpleSynth::processEvent - Sysex received\n"); @@ -471,7 +471,7 @@ bool SimpleSynth::setController(int channel, int id, int val) master_vol = (double) master_vol_ctrlval / SS_MASTER_VOLUME_QUOT; } // Emmm, this one should've been there in the beginning - else if (id == CTRL_VOLUME) { + else if (id == MusECore::CTRL_VOLUME) { if (SS_DEBUG_MIDI) { printf("Ctrl volume received: vol: %d\n", val); } @@ -620,8 +620,8 @@ bool SimpleSynth::sysex(int len, const unsigned char* d) ///delete[] tmp_initdata; ///tmp_initdata = NULL; - ///MidiPlayEvent ev(0, 0, ME_SYSEX, event_data, totlen); - MidiPlayEvent ev(0, 0, ME_SYSEX, tmp_initdata + 1, initdata_len - 1); // Strip MFG ID. + ///MusECore::MidiPlayEvent ev(0, 0, MusECore::ME_SYSEX, event_data, totlen); + MusECore::MidiPlayEvent ev(0, 0, MusECore::ME_SYSEX, tmp_initdata + 1, initdata_len - 1); // Strip MFG ID. gui->writeEvent(ev); ///delete[] event_data; @@ -715,12 +715,12 @@ void SimpleSynth::processMessages() { //Process messages from the gui while (gui->fifoSize()) { - MidiPlayEvent ev = gui->readEvent(); - if (ev.type() == ME_SYSEX) { + MusECore::MidiPlayEvent ev = gui->readEvent(); + if (ev.type() == MusECore::ME_SYSEX) { sysex(ev.len(), ev.data()); sendEvent(ev); } - else if (ev.type() == ME_CONTROLLER) { + else if (ev.type() == MusECore::ME_CONTROLLER) { setController(ev.channel(), ev.dataA(), ev.dataB(), true); sendEvent(ev); } @@ -746,12 +746,12 @@ void SimpleSynth::process(float** out, int offset, int len) /* //Process messages from the gui while (gui->fifoSize()) { - MidiPlayEvent ev = gui->readEvent(); - if (ev.type() == ME_SYSEX) { + MusECore::MidiPlayEvent ev = gui->readEvent(); + if (ev.type() == MusECore::ME_SYSEX) { sysex(ev.len(), ev.data()); sendEvent(ev); } - else if (ev.type() == ME_CONTROLLER) { + else if (ev.type() == MusECore::ME_CONTROLLER) { setController(ev.channel(), ev.dataA(), ev.dataB(), true); sendEvent(ev); } @@ -1284,7 +1284,7 @@ void SimpleSynth::parseInitData(const unsigned char* data) sendEffects[i].retgain_ctrlval = retgain; sendEffects[i].retgain = retgain; sendEffects[i].retgain = (double) retgain/ 75.0; - MidiPlayEvent ev(0, 0, 0, ME_CONTROLLER, SS_PLUGIN_RETURNLEVEL_CONTROLLER(i), retgain); + MusECore::MidiPlayEvent ev(0, 0, 0, MusECore::ME_CONTROLLER, SS_PLUGIN_RETURNLEVEL_CONTROLLER(i), retgain); gui->writeEvent(ev); // Jun 10 2011. This one was missing. p4.0.27 Tim. @@ -1293,7 +1293,7 @@ void SimpleSynth::parseInitData(const unsigned char* data) if (SS_DEBUG_INIT) printf("buffer[%ld] - sendeffect[%d] state=%d\n", long(ptr-data), i, *(ptr)); sendEffects[i].state = (SS_SendFXState) *(ptr); - MidiPlayEvent ev(0, 0, 0, ME_CONTROLLER, SS_PLUGIN_ONOFF_CONTROLLER(i), sendEffects[i].state); + MusECore::MidiPlayEvent ev(0, 0, 0, MusECore::ME_CONTROLLER, SS_PLUGIN_ONOFF_CONTROLLER(i), sendEffects[i].state); gui->writeEvent(ev); ptr++; } @@ -1547,7 +1547,7 @@ void SimpleSynth::updateVolume(int ch, int invol_ctrlval) void SimpleSynth::guiUpdateBalance(int ch, int bal) { SS_TRACE_IN - MidiPlayEvent ev(0, 0, ch, ME_CONTROLLER, SS_CHANNEL_PAN_CONTROLLER(ch), bal); + MusECore::MidiPlayEvent ev(0, 0, ch, MusECore::ME_CONTROLLER, SS_CHANNEL_PAN_CONTROLLER(ch), bal); gui->writeEvent(ev); SS_TRACE_OUT } @@ -1559,7 +1559,7 @@ void SimpleSynth::guiUpdateBalance(int ch, int bal) void SimpleSynth::guiUpdateVolume(int ch, int val) { SS_TRACE_IN - MidiPlayEvent ev(0, 0, 0, ME_CONTROLLER, SS_CHANNEL_VOLUME_CONTROLLER(ch), val); + MusECore::MidiPlayEvent ev(0, 0, 0, MusECore::ME_CONTROLLER, SS_CHANNEL_VOLUME_CONTROLLER(ch), val); gui->writeEvent(ev); SS_TRACE_OUT } @@ -1571,7 +1571,7 @@ void SimpleSynth::guiUpdateVolume(int ch, int val) void SimpleSynth::guiUpdateNoff(int ch, bool b) { SS_TRACE_IN - MidiPlayEvent ev(0, 0, 0, ME_CONTROLLER, SS_CHANNEL_NOFF_CONTROLLER(ch), b); + MusECore::MidiPlayEvent ev(0, 0, 0, MusECore::ME_CONTROLLER, SS_CHANNEL_NOFF_CONTROLLER(ch), b); gui->writeEvent(ev); SS_TRACE_OUT } @@ -1583,7 +1583,7 @@ void SimpleSynth::guiUpdateNoff(int ch, bool b) void SimpleSynth::guiUpdateChoff(int ch, bool b) { SS_TRACE_IN - MidiPlayEvent ev(0, 0, 0, ME_CONTROLLER, SS_CHANNEL_ONOFF_CONTROLLER(ch), b); + MusECore::MidiPlayEvent ev(0, 0, 0, MusECore::ME_CONTROLLER, SS_CHANNEL_ONOFF_CONTROLLER(ch), b); gui->writeEvent(ev); SS_TRACE_OUT } @@ -1595,7 +1595,7 @@ void SimpleSynth::guiUpdateChoff(int ch, bool b) void SimpleSynth::guiUpdateMasterVol(int val) { SS_TRACE_IN - MidiPlayEvent ev(0, 0, 0, ME_CONTROLLER, SS_MASTER_CTRL_VOLUME, val); + MusECore::MidiPlayEvent ev(0, 0, 0, MusECore::ME_CONTROLLER, SS_MASTER_CTRL_VOLUME, val); gui->writeEvent(ev); SS_TRACE_OUT } @@ -1606,7 +1606,7 @@ void SimpleSynth::guiUpdateMasterVol(int val) void SimpleSynth::guiUpdateSendFxLevel(int channel, int fxid, int level) { SS_TRACE_IN - MidiPlayEvent ev(0, 0, 0, ME_CONTROLLER, SS_CHANNEL_SENDFX_CONTROLLER(channel, fxid), level); + MusECore::MidiPlayEvent ev(0, 0, 0, MusECore::ME_CONTROLLER, SS_CHANNEL_SENDFX_CONTROLLER(channel, fxid), level); gui->writeEvent(ev); SS_TRACE_OUT } @@ -1636,7 +1636,7 @@ void SimpleSynth::guiSendSampleLoaded(bool success, int ch, const char* filename //out[3] = ch; memcpy(out+2, filename, strlen(filename)+1); //memcpy(out+4, filename, strlen(filename)+1); - MidiPlayEvent ev(0, 0, ME_SYSEX, out, len); + MusECore::MidiPlayEvent ev(0, 0, MusECore::ME_SYSEX, out, len); gui->writeEvent(ev); SS_TRACE_OUT } @@ -1758,7 +1758,7 @@ bool SimpleSynth::initSendEffect(int id, QString lib, QString name) ///out[2] = j; //out[4] = j; *((unsigned*)(out + 2)) = j; - MidiPlayEvent ev(0, 0, ME_SYSEX, out, len); + MusECore::MidiPlayEvent ev(0, 0, MusECore::ME_SYSEX, out, len); gui->writeEvent(ev); } } @@ -1804,8 +1804,8 @@ void SimpleSynth::cleanupPlugin(int id) //d[1] = SIMPLEDRUMS_UNIQUE_ID; //d[2] = SS_SYSEX_CLEAR_SENDEFFECT_OK; //d[3] = id; - MidiPlayEvent ev(0, 0, ME_SYSEX, d, 2); - //MidiPlayEvent ev(0, 0, ME_SYSEX, d, 4); + MusECore::MidiPlayEvent ev(0, 0, MusECore::ME_SYSEX, d, 2); + //MusECore::MidiPlayEvent ev(0, 0, MusECore::ME_SYSEX, d, 4); gui->writeEvent(ev); SS_TRACE_OUT } @@ -1870,8 +1870,8 @@ void SimpleSynth::guiUpdateFxParameter(int fxid, int param, float val) //d[3] = fxid; //d[4] = param; //d[5] = intval; - MidiPlayEvent ev(0, 0, ME_SYSEX, d, 4); - //MidiPlayEvent ev(0, 0, ME_SYSEX, d, 6); + MusECore::MidiPlayEvent ev(0, 0, MusECore::ME_SYSEX, d, 4); + //MusECore::MidiPlayEvent ev(0, 0, MusECore::ME_SYSEX, d, 6); gui->writeEvent(ev); SS_TRACE_OUT } @@ -1922,8 +1922,8 @@ void SimpleSynth::guiNotifySampleCleared(int ch) //d[1] = SIMPLEDRUMS_UNIQUE_ID; //d[2] = SS_SYSEX_CLEAR_SAMPLE_OK; //d[3] = (byte) ch; - MidiPlayEvent ev(0, 0, ME_SYSEX, d, 2); - //MidiPlayEvent ev(0, 0, ME_SYSEX, d, 4); + MusECore::MidiPlayEvent ev(0, 0, MusECore::ME_SYSEX, d, 2); + //MusECore::MidiPlayEvent ev(0, 0, MusECore::ME_SYSEX, d, 4); gui->writeEvent(ev); SS_TRACE_OUT } diff --git a/muse2/synti/simpledrums2/simpledrums.h b/muse2/synti/simpledrums2/simpledrums.h index a3df0092..f76a3237 100644 --- a/muse2/synti/simpledrums2/simpledrums.h +++ b/muse2/synti/simpledrums2/simpledrums.h @@ -134,7 +134,7 @@ class SimpleSynth : public Mess virtual bool nativeGuiVisible() const; virtual bool hasNativeGui() const; virtual bool playNote(int arg1, int arg2, int arg3); - virtual bool processEvent(const MidiPlayEvent& arg1); + virtual bool processEvent(const MusECore::MidiPlayEvent& arg1); virtual bool setController(int arg1, int arg2, int arg3); virtual bool sysex(int arg1, const unsigned char* arg2); virtual const char* getPatchName(int arg1, int arg2, int arg3) const; diff --git a/muse2/synti/simpledrums2/simpledrumsgui.cpp b/muse2/synti/simpledrums2/simpledrumsgui.cpp index d4271e1b..54063959 100644 --- a/muse2/synti/simpledrums2/simpledrumsgui.cpp +++ b/muse2/synti/simpledrums2/simpledrumsgui.cpp @@ -477,15 +477,15 @@ void SimpleSynthGui::readMessage(int) } /*! - \fn SimpleSynthGui::processEvent(const MidiPlayEvent& ev) + \fn SimpleSynthGui::processEvent(const MusECore::MidiPlayEvent& ev) */ -void SimpleSynthGui::processEvent(const MidiPlayEvent& ev) +void SimpleSynthGui::processEvent(const MusECore::MidiPlayEvent& ev) { SS_TRACE_IN if (SS_DEBUG_MIDI) { printf("GUI received midi event\n"); } - if (ev.type() == ME_CONTROLLER) { + if (ev.type() == MusECore::ME_CONTROLLER) { int id = ev.dataA(); int val = ev.dataB(); @@ -583,7 +583,7 @@ void SimpleSynthGui::processEvent(const MidiPlayEvent& ev) // // Sysexes: // - else if (ev.type() == ME_SYSEX) { + else if (ev.type() == MusECore::ME_SYSEX) { byte* data = ev.data(); //byte* data = d + 2; int cmd = *data; diff --git a/muse2/synti/simpledrums2/simpledrumsgui.h b/muse2/synti/simpledrums2/simpledrumsgui.h index 3cb11ba3..05c38cfd 100644 --- a/muse2/synti/simpledrums2/simpledrumsgui.h +++ b/muse2/synti/simpledrums2/simpledrumsgui.h @@ -172,7 +172,7 @@ class SimpleSynthGui : public QDialog, public Ui::SimpleDrumsGuiBase, public Mes Q_OBJECT private: // MESS interface: - virtual void processEvent(const MidiPlayEvent& ev); + virtual void processEvent(const MusECore::MidiPlayEvent& ev); void setChannelVolume(int channel, int volume); void displayPluginGui(); QGroupBox* channelButtonGroups[SS_NR_OF_CHANNELS]; diff --git a/muse2/synti/vam/vam.cpp b/muse2/synti/vam/vam.cpp index b473188f..7928aec2 100644 --- a/muse2/synti/vam/vam.cpp +++ b/muse2/synti/vam/vam.cpp @@ -450,8 +450,8 @@ void VAM::processMessages() // while (gui->fifoSize()) { - MidiPlayEvent ev = gui->readEvent(); - if (ev.type() == ME_CONTROLLER) + MusECore::MidiPlayEvent ev = gui->readEvent(); + if (ev.type() == MusECore::ME_CONTROLLER) { // process local? //setController(ev.dataA() & 0xfff, ev.dataB()); @@ -480,8 +480,8 @@ void VAM::process(float** ports, int offset, int sampleCount) // synthesizer GUI // while (gui->fifoSize()) { - MidiPlayEvent ev = gui->readEvent(); - if (ev.type() == ME_CONTROLLER) { + MusECore::MidiPlayEvent ev = gui->readEvent(); + if (ev.type() == MusECore::ME_CONTROLLER) { // process local? setController(ev.dataA() & 0xfff, ev.dataB()); sendEvent(ev); @@ -636,7 +636,7 @@ bool VAM::setController(int /*channel*/, int ctrl, int data) } setController(ctrl, data); - MidiPlayEvent ev(0, 0, channel, ME_CONTROLLER, ctrl, data); + MusECore::MidiPlayEvent ev(0, 0, channel, MusECore::ME_CONTROLLER, ctrl, data); gui->writeEvent(ev); return false; } diff --git a/muse2/synti/vam/vam.h b/muse2/synti/vam/vam.h index 54f0e465..0c628a99 100644 --- a/muse2/synti/vam/vam.h +++ b/muse2/synti/vam/vam.h @@ -25,7 +25,7 @@ enum { //DCO1_PITCHMOD, - DCO1_PITCHMOD = CTRL_RPN14_OFFSET, // p4.0.27 + DCO1_PITCHMOD = MusECore::CTRL_RPN14_OFFSET, // p4.0.27 DCO1_WAVEFORM, DCO1_FM, DCO1_PWM, DCO1_ATTACK, DCO1_DECAY, DCO1_SUSTAIN, DCO1_RELEASE, DCO2_PITCHMOD, DCO2_WAVEFORM, DCO2_FM, DCO2_PWM, diff --git a/muse2/synti/vam/vamgui.cpp b/muse2/synti/vam/vamgui.cpp index 0993087b..31efc389 100644 --- a/muse2/synti/vam/vamgui.cpp +++ b/muse2/synti/vam/vamgui.cpp @@ -68,9 +68,9 @@ const char *vam_ctrl_names[] = { struct Preset { QString name; int ctrl[NUM_CONTROLLER]; - void readConfiguration(Xml& xml); - void readControl(Xml& xml); - void writeConfiguration(Xml& xml, int level); + void readConfiguration(MusECore::Xml& xml); + void readControl(MusECore::Xml& xml); + void writeConfiguration(MusECore::Xml& xml, int level); }; std::list<Preset> presets; @@ -91,21 +91,21 @@ typedef std::list<Preset>::iterator iPreset; // readControl //--------------------------------------------------------- -void Preset::readControl(Xml& xml) +void Preset::readControl(MusECore::Xml& xml) { int idx = 0; int val = 0; for (;;) { - Xml::Token token(xml.parse()); + MusECore::Xml::Token token(xml.parse()); const QString& tag(xml.s1()); switch (token) { - case Xml::Error: - case Xml::End: + case MusECore::Xml::Error: + case MusECore::Xml::End: return; - case Xml::TagStart: + case MusECore::Xml::TagStart: xml.unknown("control"); break; - case Xml::Attribut: + case MusECore::Xml::Attribut: if (tag == "idx") { idx = xml.s2().toInt(); if (idx >= NUM_CONTROLLER) @@ -114,7 +114,7 @@ void Preset::readControl(Xml& xml) else if (tag == "val") val = xml.s2().toInt(); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "control") { ctrl[idx] = val; return; @@ -129,26 +129,26 @@ void Preset::readControl(Xml& xml) // readConfiguration //--------------------------------------------------------- -void Preset::readConfiguration(Xml& xml) +void Preset::readConfiguration(MusECore::Xml& xml) { for (;;) { - Xml::Token token(xml.parse()); + MusECore::Xml::Token token(xml.parse()); const QString& tag(xml.s1()); switch (token) { - case Xml::Error: - case Xml::End: + case MusECore::Xml::Error: + case MusECore::Xml::End: return; - case Xml::TagStart: + case MusECore::Xml::TagStart: if (tag == "control") readControl(xml); else xml.unknown("preset"); break; - case Xml::Attribut: + case MusECore::Xml::Attribut: if (tag == "name") name = xml.s2(); break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "preset") return; default: @@ -161,10 +161,10 @@ void Preset::readConfiguration(Xml& xml) // writeConfiguration //--------------------------------------------------------- -void Preset::writeConfiguration(Xml& xml, int level) +void Preset::writeConfiguration(MusECore::Xml& xml, int level) { //xml.tag(level++, "preset name=\"%s\"", name.ascii()); - xml.tag(level++, "preset name=\"%s\"", Xml::xmlString(name).toAscii().constData()); + xml.tag(level++, "preset name=\"%s\"", MusECore::Xml::xmlString(name).toAscii().constData()); for (int i = 0; i < NUM_CONTROLLER; ++i) { xml.tag(level, "control idx=\"%d\" val=\"%d\" /", i, ctrl[i]); } @@ -183,10 +183,10 @@ VAMGui::VAMGui() QSocketNotifier* s = new QSocketNotifier(readFd, QSocketNotifier::Read); connect(s, SIGNAL(activated(int)), SLOT(readMessage(int))); - loadPresets->setIcon(QIcon(*openIcon)); - savePresets->setIcon(QIcon(*saveIcon)); - savePresetsToFile->setIcon(QIcon(*saveasIcon)); - deletePreset->setIcon(QIcon(*deleteIcon)); + loadPresets->setIcon(QIcon(*MusEGui::openIcon)); + savePresets->setIcon(QIcon(*MusEGui::saveIcon)); + savePresetsToFile->setIcon(QIcon(*MusEGui::saveasIcon)); + deletePreset->setIcon(QIcon(*MusEGui::deleteIcon)); // p4.0.27 First ctrl offset. dctrl[DCO1_PITCHMOD - VAM_FIRST_CTRL] = SynthGuiCtrl(PitchModS, LCDNumber1, SynthGuiCtrl::SLIDER); @@ -277,7 +277,7 @@ void VAMGui::ctrlChanged(int idx) else if (ctrl->type == SynthGuiCtrl::SWITCH) { val = ((QCheckBox*)(ctrl->editor))->isChecked(); } - //sendController(0, idx + CTRL_RPN14_OFFSET, val); + //sendController(0, idx + MusECore::CTRL_RPN14_OFFSET, val); sendController(0, idx + VAM_FIRST_CTRL, val); // p4.0.27 } @@ -566,9 +566,9 @@ void VAMGui::sysexReceived(const unsigned char* /*data*/, int /*len*/) // processEvent //--------------------------------------------------------- -void VAMGui::processEvent(const MidiPlayEvent& ev) +void VAMGui::processEvent(const MusECore::MidiPlayEvent& ev) { - if (ev.type() == ME_CONTROLLER) + if (ev.type() == MusECore::ME_CONTROLLER) { //setParam(ev.dataA() & 0xfff, ev.dataB()); // p4.0.27 @@ -583,7 +583,7 @@ void VAMGui::processEvent(const MidiPlayEvent& ev) setParam(ctl - VAM_FIRST_CTRL, ev.dataB()); } - else if (ev.type() == ME_SYSEX) + else if (ev.type() == MusECore::ME_SYSEX) sysexReceived(ev.data(), ev.len()); else { @@ -619,16 +619,16 @@ void VAMGui::loadPresetsPressed() presets.clear(); presetList->clear(); - Xml xml(f); + MusECore::Xml xml(f); int mode = 0; for (;;) { - Xml::Token token = xml.parse(); + MusECore::Xml::Token token = xml.parse(); QString tag = xml.s1(); switch (token) { - case Xml::Error: - case Xml::End: + case MusECore::Xml::Error: + case MusECore::Xml::End: return; - case Xml::TagStart: + case MusECore::Xml::TagStart: if (mode == 0 && tag == "muse") mode = 1; // else if (mode == 1 && tag == "instrument") @@ -643,7 +643,7 @@ void VAMGui::loadPresetsPressed() else if(mode != 1) xml.unknown("SynthPreset"); break; - case Xml::Attribut: + case MusECore::Xml::Attribut: if(mode == 1 && tag == "iname") { // fprintf(stderr, "%s\n", xml.s2().toLatin1()); if(xml.s2() != "vam-1.0") @@ -651,7 +651,7 @@ void VAMGui::loadPresetsPressed() else mode = 2; } break; - case Xml::TagEnd: + case MusECore::Xml::TagEnd: if (tag == "muse") goto ende; default: @@ -692,7 +692,7 @@ void VAMGui::doSavePresets(const QString& fn, bool showWarning) FILE* f = fopen(fn.toAscii().constData(),"w");//fileOpen(this, fn, QString(".pre"), "w", popenFlag, false, showWarning); if (f == 0) return; - Xml xml(f); + MusECore::Xml xml(f); xml.header(); xml.tag(0, "muse version=\"1.0\""); xml.tag(0, "instrument iname=\"vam-1.0\" /"); diff --git a/muse2/synti/vam/vamgui.h b/muse2/synti/vam/vamgui.h index abee3c43..b73da2ca 100644 --- a/muse2/synti/vam/vamgui.h +++ b/muse2/synti/vam/vamgui.h @@ -56,7 +56,7 @@ class VAMGui : public QWidget, public Ui::VAMGuiBase, public MessGui { void addNewPreset(const QString&); void deleteNamedPreset(const QString&); void activatePreset(Preset* preset); - virtual void processEvent(const MidiPlayEvent&); + virtual void processEvent(const MusECore::MidiPlayEvent&); private slots: void ctrlChanged(int idx); |