diff options
31 files changed, 278 insertions, 201 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 59f8de4e..11ee89bc 100644 --- a/muse2/ChangeLog +++ b/muse2/ChangeLog @@ -6,6 +6,7 @@ o MusECore: For non-gui classes o MusEGui: For gui classes One or two more namespaces will be added for the stuff outside the main tree (synti, al, etc) (Orcan) + - Fixed python control add-on building. Left it off by default. (Orcan) 05.09.2011: - SigEdit, up/down arrow in denominator only moves between powers of two, 2,4,8...128 (rj) 04.09.2011: diff --git a/muse2/muse/CMakeLists.txt b/muse2/muse/CMakeLists.txt index b26100f9..187bd41e 100644 --- a/muse2/muse/CMakeLists.txt +++ b/muse2/muse/CMakeLists.txt @@ -43,11 +43,11 @@ set (SubDirs widgets ) -if (ENABLE_PYTHON) - set ( PYREM_CPP_FLAGS "-DENABLE_PYTHON" ) - set ( PYLIBS ${PYTHON_LIB} remote) +if (PYTHON_SUPPORT) + set ( REM_CPP_FLAGS "-DENABLE_PYTHON" ) + set ( REM_LIB remote ) set ( SubDirs ${SubDirs} remote ) -endif (ENABLE_PYTHON) +endif (PYTHON_SUPPORT) subdirs (${SubDirs}) @@ -207,9 +207,9 @@ include_directories( ## set_target_properties( core # PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h" - # PROPERTIES COMPILE_FLAGS "-Imidiedit -Iarranger -Iliste -Iwidgets -Imixer -Idriver -Iwaveedit -Implugins -Iinstruments -Iremote ${PYREM_CPP_FLAGS} -include ${PROJECT_BINARY_DIR}/all.h " - # PROPERTIES COMPILE_FLAGS "${PYREM_CPP_FLAGS} -DINSTPREFIX='\"${CMAKE_INSTALL_PREFIX}\"' -DINSTLIBDIR='\"${LIBRARY_OUTPUT_DIRECTORY}\"' -include ${PROJECT_BINARY_DIR}/all.h " - PROPERTIES COMPILE_FLAGS "${PYREM_CPP_FLAGS} -include ${PROJECT_BINARY_DIR}/all.h" + # PROPERTIES COMPILE_FLAGS "-Imidiedit -Iarranger -Iliste -Iwidgets -Imixer -Idriver -Iwaveedit -Implugins -Iinstruments -Iremote ${REM_CPP_FLAGS} -include ${PROJECT_BINARY_DIR}/all.h " + # PROPERTIES COMPILE_FLAGS "${REM_CPP_FLAGS} -DINSTPREFIX='\"${CMAKE_INSTALL_PREFIX}\"' -DINSTLIBDIR='\"${LIBRARY_OUTPUT_DIRECTORY}\"' -include ${PROJECT_BINARY_DIR}/all.h " + PROPERTIES COMPILE_FLAGS "${REM_CPP_FLAGS} -include ${PROJECT_BINARY_DIR}/all.h" OUTPUT_NAME muse_core ) set_target_properties( muse @@ -246,7 +246,7 @@ target_link_libraries(core ${SNDFILE_LIBRARIES} ${SAMPLERATE_LIBRARIES} ${UUID_LIBRARIES} - ${PYLIBS} + ${REM_LIB} ${FST_LIB} dl ) diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp index 8d390468..677743b3 100644 --- a/muse2/muse/app.cpp +++ b/muse2/muse/app.cpp @@ -65,6 +65,7 @@ #include "mixdowndialog.h" #include "pianoroll.h" #include "scoreedit.h" +#include "remote/pyapi.h" #include "routepopup.h" #include "shortcutconfig.h" #include "songinfo.h" @@ -211,9 +212,9 @@ bool MusE::seqStart() // printf("MusE: WARNING: Midi realtime priority %d is the same as audio prefetch realtime priority %d. Try a different setting.\n", // midiprio, pfprio); - audioPrefetch->start(pfprio); + MusEGlobal::audioPrefetch->start(pfprio); - audioPrefetch->msgSeek(0, true); // force + MusEGlobal::audioPrefetch->msgSeek(0, true); // force //MusEGlobal::midiSeqRunning = !midiSeq->start(MusEGlobal::realTimeScheduling ? MusEGlobal::realTimePriority : 0); // Changed by Tim. p3.3.22 @@ -255,7 +256,7 @@ void MusE::seqStop() MusEGlobal::song->setStopPlay(false); MusEGlobal::midiSeq->stop(true); MusEGlobal::audio->stop(true); - audioPrefetch->stop(true); + MusEGlobal::audioPrefetch->stop(true); if (MusEGlobal::realTimeScheduling && watchdogThread) pthread_cancel(watchdogThread); } @@ -372,9 +373,9 @@ MusE::MusE(int argc, char** argv) : QMainWindow() // Python bridge //--------------------------------------------------- // Uncomment in order to enable MusE Python bridge: - if (usePythonBridge) { + if (MusEGlobal::usePythonBridge) { printf("Initializing python bridge!\n"); - if (initPythonBridge() == false) { + if (MusECore::initPythonBridge() == false) { printf("Could not initialize Python bridge\n"); exit(1); } @@ -736,8 +737,8 @@ MusE::MusE(int argc, char** argv) : QMainWindow() //MusEGlobal::midiSeq = new MusECore::MidiSeq(MusEGlobal::realTimeScheduling ? MusEGlobal::realTimePriority : 0, "Midi"); MusEGlobal::midiSeq = new MusECore::MidiSeq("Midi"); MusEGlobal::audio = new MusECore::Audio(); - //audioPrefetch = new AudioPrefetch(0, "Disc"); - audioPrefetch = new AudioPrefetch("Prefetch"); + //MusEGlobal::audioPrefetch = new MusECore::AudioPrefetch(0, "Disc"); + MusEGlobal::audioPrefetch = new MusECore::AudioPrefetch("Prefetch"); //--------------------------------------------------- // Popups @@ -1602,7 +1603,7 @@ void MusE::closeEvent(QCloseEvent* event) MusECore::exitOSC(); // p3.3.47 - delete audioPrefetch; + delete MusEGlobal::audioPrefetch; delete MusEGlobal::audio; delete MusEGlobal::midiSeq; delete MusEGlobal::song; diff --git a/muse2/muse/arranger/pcanvas.cpp b/muse2/muse/arranger/pcanvas.cpp index 1984f799..0f2f4629 100644 --- a/muse2/muse/arranger/pcanvas.cpp +++ b/muse2/muse/arranger/pcanvas.cpp @@ -3953,7 +3953,7 @@ void PartCanvas::processAutomationMovements(QPoint pos, bool addPoint) double PartCanvas::dbToVal(double inDb) { - return (20.0*fast_log10(inDb)+60.0) / 70.0; + return (20.0*MusECore::fast_log10(inDb)+60.0) / 70.0; } double PartCanvas::valToDb(double inV) { diff --git a/muse2/muse/audio.cpp b/muse2/muse/audio.cpp index 1f3dc6ad..fd90c2c2 100644 --- a/muse2/muse/audio.cpp +++ b/muse2/muse/audio.cpp @@ -260,7 +260,7 @@ bool Audio::sync(int jackState, unsigned frame) Pos p(frame, false); seek(p); if (!_freewheel) - done = audioPrefetch->seekDone(); + done = MusEGlobal::audioPrefetch->seekDone(); if (s == START_PLAY) state = START_PLAY; } @@ -269,7 +269,7 @@ bool Audio::sync(int jackState, unsigned frame) // seek during seek seek(Pos(frame, false)); } - done = audioPrefetch->seekDone(); + done = MusEGlobal::audioPrefetch->seekDone(); } } return done; @@ -399,7 +399,7 @@ void Audio::process(unsigned frames) if (isPlaying()) { if (!freewheel()) - audioPrefetch->msgTick(); + MusEGlobal::audioPrefetch->msgTick(); if (_bounce && _pos >= MusEGlobal::song->rPos()) { _bounce = false; @@ -759,11 +759,11 @@ void Audio::seek(const Pos& p) //loopPassed = true; // for record loop mode if (state != LOOP2 && !freewheel()) { - //audioPrefetch->msgSeek(_pos.frame()); + //MusEGlobal::audioPrefetch->msgSeek(_pos.frame()); // We need to force prefetch to update, to ensure the most recent data. // Things can happen to a part before play is pressed - such as part muting, // part moving etc. Without a force, the wrong data was being played. Tim 08/17/08 - audioPrefetch->msgSeek(_pos.frame(), true); + MusEGlobal::audioPrefetch->msgSeek(_pos.frame(), true); } write(sigFd, "G", 1); // signal seek to gui diff --git a/muse2/muse/audioprefetch.cpp b/muse2/muse/audioprefetch.cpp index e72b8a8c..9406911f 100644 --- a/muse2/muse/audioprefetch.cpp +++ b/muse2/muse/audioprefetch.cpp @@ -33,6 +33,12 @@ #include "audio.h" #include "sync.h" +namespace MusEGlobal { +MusECore::AudioPrefetch* audioPrefetch; +} + +namespace MusECore { + // Added by Tim. p3.3.20 //#define AUDIOPREFETCH_DEBUG @@ -47,8 +53,6 @@ struct PrefetchMsg : public ThreadMsg { int pos; }; -AudioPrefetch* audioPrefetch; - //--------------------------------------------------------- // AudioPrefetch //--------------------------------------------------------- @@ -82,7 +86,7 @@ static void readMsgP(void* p, void*) void AudioPrefetch::start(int priority) { clearPollFd(); - addPollFd(toThreadFdr, POLLIN, ::readMsgP, this, 0); + addPollFd(toThreadFdr, POLLIN, MusECore::readMsgP, this, 0); //Thread::start(); Thread::start(priority); } @@ -181,7 +185,7 @@ void AudioPrefetch::prefetch(bool doSeek) return; } if (MusEGlobal::song->loop() && !MusEGlobal::audio->bounce() && !MusEGlobal::extSyncFlag.value()) { - const MusECore::Pos& loop = MusEGlobal::song->rPos(); + const Pos& loop = MusEGlobal::song->rPos(); unsigned n = loop.frame() - writePos; if (n < MusEGlobal::segmentSize) { unsigned lpos = MusEGlobal::song->lPos().frame(); @@ -192,9 +196,9 @@ void AudioPrefetch::prefetch(bool doSeek) writePos = lpos - n; } } - MusECore::WaveTrackList* tl = MusEGlobal::song->waves(); - for (MusECore::iWaveTrack it = tl->begin(); it != tl->end(); ++it) { - MusECore::WaveTrack* track = *it; + WaveTrackList* tl = MusEGlobal::song->waves(); + for (iWaveTrack it = tl->begin(); it != tl->end(); ++it) { + WaveTrack* track = *it; // p3.3.29 // Save time. Don't bother if track is off. Track On/Off not designed for rapid repeated response (but mute is). if(track->off()) @@ -245,9 +249,9 @@ void AudioPrefetch::seek(unsigned seekTo) } writePos = seekTo; - MusECore::WaveTrackList* tl = MusEGlobal::song->waves(); - for (MusECore::iWaveTrack it = tl->begin(); it != tl->end(); ++it) { - MusECore::WaveTrack* track = *it; + WaveTrackList* tl = MusEGlobal::song->waves(); + for (iWaveTrack it = tl->begin(); it != tl->end(); ++it) { + WaveTrack* track = *it; track->clearPrefetchFifo(); } @@ -275,3 +279,5 @@ void AudioPrefetch::seek(unsigned seekTo) --seekCount; } +} // namespace MusECore + diff --git a/muse2/muse/audioprefetch.h b/muse2/muse/audioprefetch.h index e55251dc..5b34b2cc 100644 --- a/muse2/muse/audioprefetch.h +++ b/muse2/muse/audioprefetch.h @@ -26,6 +26,8 @@ #include "thread.h" +namespace MusECore { + //--------------------------------------------------------- // AudioPrefetch //--------------------------------------------------------- @@ -56,6 +58,10 @@ class AudioPrefetch : public Thread { bool seekDone() const { return seekCount == 0; } }; -extern AudioPrefetch* audioPrefetch; +} // namespace MusECore + +namespace MusEGlobal { +extern MusECore::AudioPrefetch* audioPrefetch; +} #endif diff --git a/muse2/muse/controlfifo.cpp b/muse2/muse/controlfifo.cpp index 741caad1..c9ff9ed6 100644 --- a/muse2/muse/controlfifo.cpp +++ b/muse2/muse/controlfifo.cpp @@ -21,6 +21,8 @@ #include "controlfifo.h" +namespace MusECore { + //--------------------------------------------------------- // ControlFifo // put @@ -73,5 +75,6 @@ void ControlFifo::remove() --size; } +} // namespace MusECore diff --git a/muse2/muse/controlfifo.h b/muse2/muse/controlfifo.h index 8a9578f1..6a35c8a5 100644 --- a/muse2/muse/controlfifo.h +++ b/muse2/muse/controlfifo.h @@ -24,6 +24,8 @@ #define CONTROL_FIFO_SIZE 8192 +namespace MusECore { + //--------------------------------------------------------- // ControlEvent // Item struct for ControlFifo. @@ -62,5 +64,6 @@ class ControlFifo int getSize() const { return size; } }; +} // namespace MusECore #endif diff --git a/muse2/muse/driver/alsamidi.h b/muse2/muse/driver/alsamidi.h index 832d86d7..2054a7d3 100644 --- a/muse2/muse/driver/alsamidi.h +++ b/muse2/muse/driver/alsamidi.h @@ -45,8 +45,8 @@ class MidiAlsaDevice : public MidiDevice { private: // Special for ALSA midi device: Play event list is processed in the ALSA midi sequencer thread. // Need this FIFO, to decouple from audio thread which adds events to the list. - MusECore::MidiFifo playEventFifo; - MusECore::MidiFifo stuckNotesFifo; + MidiFifo playEventFifo; + MidiFifo stuckNotesFifo; volatile bool stopPending; volatile bool seekPending; @@ -57,7 +57,7 @@ class MidiAlsaDevice : public MidiDevice { virtual int selectWfd(); bool putEvent(snd_seq_event_t*); - virtual bool putMidiEvent(const MusECore::MidiPlayEvent&); + virtual bool putMidiEvent(const MidiPlayEvent&); public: MidiAlsaDevice(const snd_seq_addr_t&, const QString& name); @@ -69,9 +69,9 @@ class MidiAlsaDevice : public MidiDevice { virtual void writeRouting(int, Xml&) const; virtual inline int deviceType() const { return ALSA_MIDI; } // Schedule an event for playback. Returns false if event cannot be delivered. - virtual bool addScheduledEvent(const MusECore::MidiPlayEvent& ev) { return !playEventFifo.put(ev); } + virtual bool addScheduledEvent(const MidiPlayEvent& ev) { return !playEventFifo.put(ev); } // Add a stuck note. Returns false if event cannot be delivered. - virtual bool addStuckNote(const MusECore::MidiPlayEvent& ev) { return !stuckNotesFifo.put(ev); } + virtual bool addStuckNote(const MidiPlayEvent& ev) { return !stuckNotesFifo.put(ev); } // Play all events up to current frame. virtual void processMidi(); virtual void handleStop(); diff --git a/muse2/muse/driver/alsatimer.cpp b/muse2/muse/driver/alsatimer.cpp index dee661fe..ee72d679 100644 --- a/muse2/muse/driver/alsatimer.cpp +++ b/muse2/muse/driver/alsatimer.cpp @@ -28,6 +28,8 @@ #include <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/jack.cpp b/muse2/muse/driver/jack.cpp index 542c68ba..733353d8 100644 --- a/muse2/muse/driver/jack.cpp +++ b/muse2/muse/driver/jack.cpp @@ -2234,8 +2234,8 @@ void exitJackAudio() { if (JACK_DEBUG) printf("exitJackAudio()\n"); - if (MusECore::jackAudio) - delete MusECore::jackAudio; + if (jackAudio) + delete jackAudio; if (JACK_DEBUG) printf("exitJackAudio() after delete jackAudio\n"); diff --git a/muse2/muse/driver/rtctimer.cpp b/muse2/muse/driver/rtctimer.cpp index fd0fe8ed..365b8501 100644 --- a/muse2/muse/driver/rtctimer.cpp +++ b/muse2/muse/driver/rtctimer.cpp @@ -41,6 +41,7 @@ #include "globals.h" #include "gconfig.h" +namespace MusECore { RtcTimer::RtcTimer() { @@ -168,3 +169,5 @@ unsigned int RtcTimer::getTimerTicks(bool /*printTicks*/)// prevent compiler war } return nn; } + +} // namespace MusECore diff --git a/muse2/muse/driver/rtctimer.h b/muse2/muse/driver/rtctimer.h index 5befdf22..425ea643 100644 --- a/muse2/muse/driver/rtctimer.h +++ b/muse2/muse/driver/rtctimer.h @@ -29,6 +29,7 @@ #include "timerdev.h" +namespace MusECore { //--------------------------------------------------------- // AlsaTimer @@ -56,4 +57,6 @@ class RtcTimer : public Timer{ }; +} // namespace MusECore + #endif //__ALSATIMER_H__ diff --git a/muse2/muse/driver/timerdev.h b/muse2/muse/driver/timerdev.h index 960cf2f4..56f9216e 100644 --- a/muse2/muse/driver/timerdev.h +++ b/muse2/muse/driver/timerdev.h @@ -31,6 +31,8 @@ #define TIMER_DEBUG 0 +namespace MusECore { + //--------------------------------------------------------- // AlsaTimer //--------------------------------------------------------- @@ -53,4 +55,6 @@ class Timer { }; +} // namespace MusECore + #endif //__ALSATIMER_H__ diff --git a/muse2/muse/fastlog.h b/muse2/muse/fastlog.h index b992bd49..bbcf18cc 100644 --- a/muse2/muse/fastlog.h +++ b/muse2/muse/fastlog.h @@ -28,6 +28,8 @@ #include <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/instruments/midictrledit.cpp b/muse2/muse/instruments/midictrledit.cpp index 71e52127..a9ca6383 100644 --- a/muse2/muse/instruments/midictrledit.cpp +++ b/muse2/muse/instruments/midictrledit.cpp @@ -34,6 +34,8 @@ #include "filedialog.h" #include "globals.h" +namespace MusEGui { + MidiControllerEditDialog* midiControllerEditDialog; static MidiController predefinedMidiController[] = { @@ -738,3 +740,5 @@ void configMidiController() midiControllerEditDialog->show(); } } + +} // namespace MusEGui diff --git a/muse2/muse/mixer/astrip.cpp b/muse2/muse/mixer/astrip.cpp index dd53dfc8..10f281fb 100644 --- a/muse2/muse/mixer/astrip.cpp +++ b/muse2/muse/mixer/astrip.cpp @@ -207,7 +207,7 @@ void AudioStrip::songChanged(int val) if (val & SC_AUX) { int n = auxKnob.size(); for (int idx = 0; idx < n; ++idx) { - double val = fast_log10(src->auxSend(idx)) * 20.0; + double val = MusECore::fast_log10(src->auxSend(idx)) * 20.0; auxKnob[idx]->blockSignals(true); auxLabel[idx]->blockSignals(true); auxKnob[idx]->setValue(val); @@ -278,7 +278,7 @@ void AudioStrip::updateVolume() slider->blockSignals(true); sl->blockSignals(true); - double val = fast_log10(vol) * 20.0; + double val = MusECore::fast_log10(vol) * 20.0; slider->setValue(val); sl->setValue(val); sl->blockSignals(false); @@ -796,7 +796,7 @@ AudioStrip::AudioStrip(QWidget* parent, MusECore::AudioTrack* at) MusEGui::Knob* ak = addKnob(1, idx, &al); auxKnob.push_back(ak); auxLabel.push_back(al); - double val = fast_log10(t->auxSend(idx))*20.0; + double val = MusECore::fast_log10(t->auxSend(idx))*20.0; ak->setValue(val); al->setValue(val); } @@ -822,7 +822,7 @@ AudioStrip::AudioStrip(QWidget* parent, MusECore::AudioTrack* at) slider->setRange(MusEGlobal::config.minSlider-0.1, 10.0); slider->setFixedWidth(20); slider->setFont(MusEGlobal::config.fonts[1]); - slider->setValue(fast_log10(t->volume())*20.0); + slider->setValue(MusECore::fast_log10(t->volume())*20.0); sliderGrid->addWidget(slider, 0, 0, Qt::AlignHCenter); @@ -845,7 +845,7 @@ AudioStrip::AudioStrip(QWidget* parent, MusECore::AudioTrack* at) sl->setFrame(true); sl->setPrecision(0); sl->setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum)); - sl->setValue(fast_log10(t->volume()) * 20.0); + sl->setValue(MusECore::fast_log10(t->volume()) * 20.0); connect(sl, SIGNAL(valueChanged(double,int)), SLOT(volLabelChanged(double))); //connect(sl, SIGNAL(valueChanged(double,int)), SLOT(volumeChanged(double))); diff --git a/muse2/muse/mixer/mstrip.cpp b/muse2/muse/mixer/mstrip.cpp index 2de0d981..2e51feb9 100644 --- a/muse2/muse/mixer/mstrip.cpp +++ b/muse2/muse/mixer/mstrip.cpp @@ -259,7 +259,7 @@ MidiStrip::MidiStrip(QWidget* parent, MusECore::MidiTrack* t) dlv = sl->minValue() - 0.5 * (sl->minValue() - sl->off()); else { - dlv = -fast_log10(float(127*127)/float(v*v))*20.0; + dlv = -MusECore::fast_log10(float(127*127)/float(v*v))*20.0; if(dlv > sl->maxValue()) dlv = sl->maxValue(); } @@ -693,7 +693,7 @@ void MidiStrip::updateControls() } else { - double v = -fast_log10(float(127*127)/float(ivol*ivol))*20.0; + double v = -MusECore::fast_log10(float(127*127)/float(ivol*ivol))*20.0; if(v > sl->maxValue()) { //printf("MidiStrip::updateControls setting volume slider label\n"); diff --git a/muse2/muse/plugin.cpp b/muse2/muse/plugin.cpp index 15e6c04c..63e65f2e 100644 --- a/muse2/muse/plugin.cpp +++ b/muse2/muse/plugin.cpp @@ -3548,13 +3548,13 @@ PluginGui::PluginGui(MusECore::PluginIBase* p) if (strcmp(obj->metaObject()->className(), "Slider") == 0) { gw[nobj].type = GuiWidgets::SLIDER; - ((MusEGui::Slider*)obj)->setId(nobj); - ((MusEGui::Slider*)obj)->setCursorHoming(true); + ((Slider*)obj)->setId(nobj); + ((Slider*)obj)->setCursorHoming(true); //for(int i = 0; i < nobj; i++) for(unsigned long i = 0; i < nobj; i++) // p4.0.21 { if(gw[i].type == GuiWidgets::DOUBLE_LABEL && gw[i].param == parameter) - ((MusEGui::DoubleLabel*)gw[i].widget)->setSlider((MusEGui::Slider*)obj); + ((DoubleLabel*)gw[i].widget)->setSlider((Slider*)obj); } connect(obj, SIGNAL(sliderMoved(double,int)), mapper, SLOT(map())); connect(obj, SIGNAL(sliderPressed(int)), SLOT(guiSliderPressed(int))); @@ -3563,13 +3563,13 @@ PluginGui::PluginGui(MusECore::PluginIBase* p) } else if (strcmp(obj->metaObject()->className(), "DoubleLabel") == 0) { gw[nobj].type = GuiWidgets::DOUBLE_LABEL; - ((MusEGui::DoubleLabel*)obj)->setId(nobj); + ((DoubleLabel*)obj)->setId(nobj); //for(int i = 0; i < nobj; i++) for(unsigned long i = 0; i < nobj; i++) { if(gw[i].type == GuiWidgets::SLIDER && gw[i].param == parameter) { - ((MusEGui::DoubleLabel*)obj)->setSlider((MusEGui::Slider*)gw[i].widget); + ((DoubleLabel*)obj)->setSlider((Slider*)gw[i].widget); break; } } @@ -3609,7 +3609,7 @@ PluginGui::PluginGui(MusECore::PluginIBase* p) unsigned long n = plugin->parameters(); // p4.0.21 params = new GuiParam[n]; - //int style = MusEGui::Slider::BgTrough | MusEGui::Slider::BgSlot; + //int style = Slider::BgTrough | Slider::BgSlot; QFontMetrics fm = fontMetrics(); int h = fm.height() + 4; @@ -3629,7 +3629,7 @@ PluginGui::PluginGui(MusECore::PluginIBase* p) if (LADSPA_IS_HINT_TOGGLED(range.HintDescriptor)) { params[i].type = GuiParam::GUI_SWITCH; - MusEGui::CheckBox* cb = new MusEGui::CheckBox(mw, i, "param"); + CheckBox* cb = new CheckBox(mw, i, "param"); cb->setId(i); cb->setText(QString(plugin->paramName(i))); cb->setChecked(plugin->param(i) != 0.0); @@ -3639,7 +3639,7 @@ PluginGui::PluginGui(MusECore::PluginIBase* p) else { label = new QLabel(QString(plugin->paramName(i)), 0); params[i].type = GuiParam::GUI_SLIDER; - params[i].label = new MusEGui::DoubleLabel(val, lower, upper, 0); + params[i].label = new DoubleLabel(val, lower, upper, 0); params[i].label->setFrame(true); params[i].label->setPrecision(2); params[i].label->setId(i); @@ -3652,8 +3652,8 @@ PluginGui::PluginGui(MusECore::PluginIBase* p) uint c3 = j * j * j * 43 % 256; QColor color(c1, c2, c3); - MusEGui::Slider* s = new MusEGui::Slider(0, "param", Qt::Horizontal, - MusEGui::Slider::None, color); + Slider* s = new Slider(0, "param", Qt::Horizontal, + Slider::None, color); s->setCursorHoming(true); s->setId(i); @@ -3663,7 +3663,7 @@ PluginGui::PluginGui(MusECore::PluginIBase* p) s->setStep(1.0); s->setValue(dval); params[i].actuator = s; - params[i].label->setSlider((MusEGui::Slider*)params[i].actuator); + params[i].label->setSlider((Slider*)params[i].actuator); } //params[i].actuator->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Maximum)); params[i].actuator->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed)); @@ -3715,22 +3715,22 @@ PluginGui::PluginGui(MusECore::PluginIBase* p) getPluginConvertedValues(range, lower, upper, dlower, dupper, dval); label = new QLabel(QString(plugin->paramOutName(i)), 0); paramsOut[i].type = GuiParam::GUI_METER; - paramsOut[i].label = new MusEGui::DoubleLabel(val, lower, upper, 0); + paramsOut[i].label = new DoubleLabel(val, lower, upper, 0); paramsOut[i].label->setFrame(true); paramsOut[i].label->setPrecision(2); paramsOut[i].label->setId(i); - MusEGui::Meter::MeterType mType=MusEGui::Meter::LinMeter; + Meter::MeterType mType=Meter::LinMeter; if(LADSPA_IS_HINT_INTEGER(range.HintDescriptor)) - mType=MusEGui::Meter::DBMeter; - MusEGui::VerticalMeter* m = new MusEGui::VerticalMeter(this, mType); + mType=Meter::DBMeter; + VerticalMeter* m = new VerticalMeter(this, mType); //printf("lower =%f upper=%f dlower=%f dupper=%f\n", lower, upper,dlower,dupper); m->setRange(dlower, dupper); m->setVal(dval); m->setFixedHeight(h); paramsOut[i].actuator = m; -// paramsOut[i].label->setSlider((MusEGui::Slider*)params[i].actuator); +// paramsOut[i].label->setSlider((Slider*)params[i].actuator); //paramsOut[i].actuator->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed)); label->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed)); paramsOut[i].label->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed)); @@ -3781,9 +3781,9 @@ void PluginGui::getPluginConvertedValues(LADSPA_PortRangeHint range, if (LADSPA_IS_HINT_LOGARITHMIC(range.HintDescriptor)) { if (lower == 0.0) lower = 0.001; - dlower = fast_log10(lower)*20.0; - dupper = fast_log10(upper)*20.0; - dval = fast_log10(dval) * 20.0; + dlower = MusECore::fast_log10(lower)*20.0; + dupper = MusECore::fast_log10(upper)*20.0; + dval = MusECore::fast_log10(dval) * 20.0; } } @@ -3820,13 +3820,13 @@ void PluginGui::ctrlPressed(int param) if(params[param].type == GuiParam::GUI_SLIDER) { - double val = ((MusEGui::Slider*)params[param].actuator)->value(); + double val = ((Slider*)params[param].actuator)->value(); if (LADSPA_IS_HINT_LOGARITHMIC(params[param].hint)) val = pow(10.0, val/20.0); else if (LADSPA_IS_HINT_INTEGER(params[param].hint)) val = rint(val); plugin->setParam(param, val); - ((MusEGui::DoubleLabel*)params[param].label)->setValue(val); + ((DoubleLabel*)params[param].label)->setValue(val); // p3.3.43 //MusEGlobal::audio->msgSetPluginCtrlVal(((PluginI*)plugin), id, val); @@ -3844,8 +3844,8 @@ void PluginGui::ctrlPressed(int param) } else if(params[param].type == GuiParam::GUI_SWITCH) { - //double val = (double)((MusEGui::CheckBox*)params[param].actuator)->isChecked(); - float val = (float)((MusEGui::CheckBox*)params[param].actuator)->isChecked(); // p4.0.21 + //double val = (double)((CheckBox*)params[param].actuator)->isChecked(); + float val = (float)((CheckBox*)params[param].actuator)->isChecked(); // p4.0.21 plugin->setParam(param, val); // p3.3.43 @@ -3888,7 +3888,7 @@ void PluginGui::ctrlReleased(int param) if(params[param].type == GuiParam::GUI_SLIDER) { - double val = ((MusEGui::Slider*)params[param].actuator)->value(); + double val = ((Slider*)params[param].actuator)->value(); if (LADSPA_IS_HINT_LOGARITHMIC(params[param].hint)) val = pow(10.0, val/20.0); else if (LADSPA_IS_HINT_INTEGER(params[param].hint)) @@ -3897,7 +3897,7 @@ void PluginGui::ctrlReleased(int param) } //else if(params[param].type == GuiParam::GUI_SWITCH) //{ - //double val = (double)((MusEGui::CheckBox*)params[param].actuator)->isChecked(); + //double val = (double)((CheckBox*)params[param].actuator)->isChecked(); // No concept of 'untouching' a checkbox. Remain 'touched' until stop. //plugin->track()->stopAutoRecord(MusECore::genACnum(plugin->id(), param), val); //} @@ -3935,7 +3935,7 @@ void PluginGui::sliderChanged(double val, int param) val = rint(val); if (plugin->param(param) != val) { plugin->setParam(param, val); - ((MusEGui::DoubleLabel*)params[param].label)->setValue(val); + ((DoubleLabel*)params[param].label)->setValue(val); } int id = plugin->id(); @@ -3974,12 +3974,12 @@ void PluginGui::labelChanged(double val, int param) double dval = val; if (LADSPA_IS_HINT_LOGARITHMIC(params[param].hint)) - dval = fast_log10(val) * 20.0; + dval = MusECore::fast_log10(val) * 20.0; else if (LADSPA_IS_HINT_INTEGER(params[param].hint)) dval = rint(val); if (plugin->param(param) != val) { plugin->setParam(param, val); - ((MusEGui::Slider*)params[param].actuator)->setValue(dval); + ((Slider*)params[param].actuator)->setValue(dval); } int id = plugin->id(); @@ -4014,12 +4014,12 @@ void PluginGui::load() s += plugin->pluginLabel(); s += "/"; - QString fn = MusEGui::getOpenFileName(s, MusEGlobal::preset_file_pattern, + QString fn = getOpenFileName(s, MusEGlobal::preset_file_pattern, this, tr("MusE: load preset"), 0); if (fn.isEmpty()) return; bool popenFlag; - FILE* f = MusEGui::fileOpen(this, fn, QString(".pre"), "r", popenFlag, true); + FILE* f = fileOpen(this, fn, QString(".pre"), "r", popenFlag, true); if (f == 0) return; @@ -4079,13 +4079,13 @@ void PluginGui::save() s += plugin->pluginLabel(); s += "/"; - //QString fn = MusEGui::getSaveFileName(s, MusEGlobal::preset_file_pattern, this, - QString fn = MusEGui::getSaveFileName(s, MusEGlobal::preset_file_save_pattern, this, + //QString fn = getSaveFileName(s, MusEGlobal::preset_file_pattern, this, + QString fn = getSaveFileName(s, MusEGlobal::preset_file_save_pattern, this, tr("MusE: save preset")); if (fn.isEmpty()) return; bool popenFlag; - FILE* f = MusEGui::fileOpen(this, fn, QString(".pre"), "w", popenFlag, false, true); + FILE* f = fileOpen(this, fn, QString(".pre"), "w", popenFlag, false, true); if (f == 0) return; MusECore::Xml xml(f); @@ -4135,17 +4135,17 @@ void PluginGui::updateValues() double lv = plugin->param(i); double sv = lv; if (LADSPA_IS_HINT_LOGARITHMIC(params[i].hint)) - sv = fast_log10(lv) * 20.0; + sv = MusECore::fast_log10(lv) * 20.0; else if (LADSPA_IS_HINT_INTEGER(params[i].hint)) { sv = rint(lv); lv = sv; } gp->label->setValue(lv); - ((MusEGui::Slider*)(gp->actuator))->setValue(sv); + ((Slider*)(gp->actuator))->setValue(sv); } else if (gp->type == GuiParam::GUI_SWITCH) { - ((MusEGui::CheckBox*)(gp->actuator))->setChecked(int(plugin->param(i))); + ((CheckBox*)(gp->actuator))->setChecked(int(plugin->param(i))); } } } @@ -4160,10 +4160,10 @@ void PluginGui::updateValues() float val = plugin->param(param); switch(type) { case GuiWidgets::SLIDER: - ((MusEGui::Slider*)widget)->setValue(val); // Note conversion to double + ((Slider*)widget)->setValue(val); // Note conversion to double break; case GuiWidgets::DOUBLE_LABEL: - ((MusEGui::DoubleLabel*)widget)->setValue(val); // Note conversion to double + ((DoubleLabel*)widget)->setValue(val); // Note conversion to double break; case GuiWidgets::QCHECKBOX: ((QCheckBox*)widget)->setChecked(int(val)); @@ -4194,13 +4194,13 @@ void PluginGui::updateControls() double lv = plugin->paramOut(i); double sv = lv; if (LADSPA_IS_HINT_LOGARITHMIC(params[i].hint)) - sv = fast_log10(lv) * 20.0; + sv = MusECore::fast_log10(lv) * 20.0; else if (LADSPA_IS_HINT_INTEGER(params[i].hint)) { sv = rint(lv); lv = sv; } - ((MusEGui::VerticalMeter*)(gp->actuator))->setVal(sv); + ((VerticalMeter*)(gp->actuator))->setVal(sv); gp->label->setValue(lv); } @@ -4223,22 +4223,22 @@ void PluginGui::updateControls() double lv = plugin->track()->pluginCtrlVal(MusECore::genACnum(plugin->id(), i)); double sv = lv; if (LADSPA_IS_HINT_LOGARITHMIC(params[i].hint)) - sv = fast_log10(lv) * 20.0; + sv = MusECore::fast_log10(lv) * 20.0; else if (LADSPA_IS_HINT_INTEGER(params[i].hint)) { sv = rint(lv); lv = sv; } - if(((MusEGui::Slider*)(gp->actuator))->value() != sv) + if(((Slider*)(gp->actuator))->value() != sv) { //printf("PluginGui::updateControls slider\n"); gp->label->blockSignals(true); - ((MusEGui::Slider*)(gp->actuator))->blockSignals(true); - ((MusEGui::Slider*)(gp->actuator))->setValue(sv); + ((Slider*)(gp->actuator))->blockSignals(true); + ((Slider*)(gp->actuator))->setValue(sv); gp->label->setValue(lv); - ((MusEGui::Slider*)(gp->actuator))->blockSignals(false); + ((Slider*)(gp->actuator))->blockSignals(false); gp->label->blockSignals(false); } } @@ -4248,13 +4248,13 @@ void PluginGui::updateControls() if( plugin->controllerEnabled(i) && plugin->controllerEnabled2(i) ) { bool v = (int)plugin->track()->pluginCtrlVal(MusECore::genACnum(plugin->id(), i)); - if(((MusEGui::CheckBox*)(gp->actuator))->isChecked() != v) + if(((CheckBox*)(gp->actuator))->isChecked() != v) { //printf("PluginGui::updateControls switch\n"); - ((MusEGui::CheckBox*)(gp->actuator))->blockSignals(true); - ((MusEGui::CheckBox*)(gp->actuator))->setChecked(v); - ((MusEGui::CheckBox*)(gp->actuator))->blockSignals(false); + ((CheckBox*)(gp->actuator))->blockSignals(true); + ((CheckBox*)(gp->actuator))->setChecked(v); + ((CheckBox*)(gp->actuator))->blockSignals(false); } } } @@ -4272,13 +4272,13 @@ void PluginGui::updateControls() if( plugin->controllerEnabled(param) && plugin->controllerEnabled2(param) ) { double v = plugin->track()->pluginCtrlVal(MusECore::genACnum(plugin->id(), param)); - if(((MusEGui::Slider*)widget)->value() != v) + if(((Slider*)widget)->value() != v) { //printf("PluginGui::updateControls slider\n"); - ((MusEGui::Slider*)widget)->blockSignals(true); - ((MusEGui::Slider*)widget)->setValue(v); - ((MusEGui::Slider*)widget)->blockSignals(false); + ((Slider*)widget)->blockSignals(true); + ((Slider*)widget)->setValue(v); + ((Slider*)widget)->blockSignals(false); } } break; @@ -4286,13 +4286,13 @@ void PluginGui::updateControls() if( plugin->controllerEnabled(param) && plugin->controllerEnabled2(param) ) { double v = plugin->track()->pluginCtrlVal(MusECore::genACnum(plugin->id(), param)); - if(((MusEGui::DoubleLabel*)widget)->value() != v) + if(((DoubleLabel*)widget)->value() != v) { //printf("PluginGui::updateControls label\n"); - ((MusEGui::DoubleLabel*)widget)->blockSignals(true); - ((MusEGui::DoubleLabel*)widget)->setValue(v); - ((MusEGui::DoubleLabel*)widget)->blockSignals(false); + ((DoubleLabel*)widget)->blockSignals(true); + ((DoubleLabel*)widget)->setValue(v); + ((DoubleLabel*)widget)->blockSignals(false); } } break; @@ -4351,10 +4351,10 @@ void PluginGui::guiParamChanged(int idx) double val = 0.0; switch(type) { case GuiWidgets::SLIDER: - val = ((MusEGui::Slider*)w)->value(); + val = ((Slider*)w)->value(); break; case GuiWidgets::DOUBLE_LABEL: - val = ((MusEGui::DoubleLabel*)w)->value(); + val = ((DoubleLabel*)w)->value(); break; case GuiWidgets::QCHECKBOX: val = double(((QCheckBox*)w)->isChecked()); @@ -4372,10 +4372,10 @@ void PluginGui::guiParamChanged(int idx) int type = gw[i].type; switch(type) { case GuiWidgets::SLIDER: - ((MusEGui::Slider*)widget)->setValue(val); + ((Slider*)widget)->setValue(val); break; case GuiWidgets::DOUBLE_LABEL: - ((MusEGui::DoubleLabel*)widget)->setValue(val); + ((DoubleLabel*)widget)->setValue(val); break; case GuiWidgets::QCHECKBOX: ((QCheckBox*)widget)->setChecked(int(val)); @@ -4441,13 +4441,13 @@ void PluginGui::guiParamPressed(int idx) id = MusECore::genACnum(id, param); // NOTE: For this to be of any use, the freeverb gui 2142.ui - // would have to be used, and changed to use MusEGui::CheckBox and ComboBox + // would have to be used, and changed to use CheckBox and ComboBox // instead of QCheckBox and QComboBox, since both of those would // need customization (Ex. QCheckBox doesn't check on click). /* switch(type) { case GuiWidgets::QCHECKBOX: - double val = (double)((MusEGui::CheckBox*)w)->isChecked(); + double val = (double)((CheckBox*)w)->isChecked(); track->startAutoRecord(id, val); break; case GuiWidgets::QCOMBOBOX: @@ -4487,13 +4487,13 @@ void PluginGui::guiParamReleased(int idx) id = MusECore::genACnum(id, param); // NOTE: For this to be of any use, the freeverb gui 2142.ui - // would have to be used, and changed to use MusEGui::CheckBox and ComboBox + // would have to be used, and changed to use CheckBox and ComboBox // instead of QCheckBox and QComboBox, since both of those would // need customization (Ex. QCheckBox doesn't check on click). /* switch(type) { case GuiWidgets::QCHECKBOX: - double val = (double)((MusEGui::CheckBox*)w)->isChecked(); + double val = (double)((CheckBox*)w)->isChecked(); track->stopAutoRecord(id, param); break; case GuiWidgets::QCOMBOBOX: @@ -4529,7 +4529,7 @@ void PluginGui::guiSliderPressed(int idx) id = MusECore::genACnum(id, param); - double val = ((MusEGui::Slider*)w)->value(); + double val = ((Slider*)w)->value(); plugin->setParam(param, val); //MusEGlobal::audio->msgSetPluginCtrlVal(((PluginI*)plugin), id, val); @@ -4550,10 +4550,10 @@ void PluginGui::guiSliderPressed(int idx) int type = gw[i].type; switch(type) { case GuiWidgets::SLIDER: - ((MusEGui::Slider*)widget)->setValue(val); + ((Slider*)widget)->setValue(val); break; case GuiWidgets::DOUBLE_LABEL: - ((MusEGui::DoubleLabel*)widget)->setValue(val); + ((DoubleLabel*)widget)->setValue(val); break; case GuiWidgets::QCHECKBOX: ((QCheckBox*)widget)->setChecked(int(val)); @@ -4589,7 +4589,7 @@ void PluginGui::guiSliderReleased(int idx) id = MusECore::genACnum(id, param); - double val = ((MusEGui::Slider*)w)->value(); + double val = ((Slider*)w)->value(); track->stopAutoRecord(id, val); } @@ -4612,9 +4612,9 @@ void PluginGui::guiSliderRightClicked(const QPoint &p, int idx) QWidget* PluginLoader::createWidget(const QString & className, QWidget * parent, const QString & name) { if(className == QString("DoubleLabel")) - return new MusEGui::DoubleLabel(parent, name.toLatin1().constData()); + return new DoubleLabel(parent, name.toLatin1().constData()); if(className == QString("Slider")) - return new MusEGui::Slider(parent, name.toLatin1().constData(), Qt::Horizontal); + return new Slider(parent, name.toLatin1().constData(), Qt::Horizontal); return QUiLoader::createWidget(className, parent, name); }; diff --git a/muse2/muse/remote/CMakeLists.txt b/muse2/muse/remote/CMakeLists.txt index 29ead183..b3dcb39d 100644 --- a/muse2/muse/remote/CMakeLists.txt +++ b/muse2/muse/remote/CMakeLists.txt @@ -33,7 +33,6 @@ file (GLOB remote_source_files ## add_library(remote ${MODULES_BUILD} ${remote_source_files} - ${PROJECT_BINARY_DIR}/all.h.pch ) ## @@ -48,9 +47,13 @@ set (FILES_TO_TRANSLATE ## ## Compilation flags and target name ## -set_source_files_properties( - pyapi.cpp - PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -include ${PYTHON_INCLUDES} -DENABLE_PYTHON" +set_target_properties( remote + PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -I${PYTHON_INCLUDE_DIRS} -DENABLE_PYTHON" + OUTPUT_NAME muse_remote + ) + +target_link_libraries(remote + ${PYTHON_LIBRARIES} ) ## diff --git a/muse2/muse/remote/pyapi.cpp b/muse2/muse/remote/pyapi.cpp index 27a44e49..645c639e 100644 --- a/muse2/muse/remote/pyapi.cpp +++ b/muse2/muse/remote/pyapi.cpp @@ -42,6 +42,8 @@ // Steals ref: PyList_SetItem, PyTuple_SetItem using namespace std; +namespace MusECore { + static pthread_t pyapiThread; //------------------------------------------------------------ QPybridgeEvent::QPybridgeEvent(QPybridgeEvent::EventType _type, int _p1, int _p2) @@ -56,30 +58,30 @@ QPybridgeEvent::QPybridgeEvent(QPybridgeEvent::EventType _type, int _p1, int _p2 //------------------------------------------------------------ PyObject* getCPos(PyObject*, PyObject*) { - return Py_BuildValue("i", song->cpos()); + return Py_BuildValue("i", MusEGlobal::song->cpos()); } //------------------------------------------------------------ // Get position of left locator //------------------------------------------------------------ PyObject* getLPos(PyObject*, PyObject*) { - return Py_BuildValue("i", song->lpos()); + return Py_BuildValue("i", MusEGlobal::song->lpos()); } //------------------------------------------------------------ // Get position of right locator //------------------------------------------------------------ PyObject* getRPos(PyObject*, PyObject*) { - return Py_BuildValue("i", song->rpos()); + return Py_BuildValue("i", MusEGlobal::song->rpos()); } //------------------------------------------------------------ // Start playing from current position //------------------------------------------------------------ PyObject* startPlay(PyObject*, PyObject*) { - //song->setPlay(true); + //MusEGlobal::song->setPlay(true); QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_SETPLAY); - QApplication::postEvent(song, pyevent); + QApplication::postEvent(MusEGlobal::song, pyevent); Py_INCREF(Py_None); return Py_None; } @@ -88,9 +90,9 @@ PyObject* startPlay(PyObject*, PyObject*) //------------------------------------------------------------ PyObject* stopPlay(PyObject*, PyObject*) { - //song->setStop(true); + //MusEGlobal::song->setStop(true); QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_SETSTOP); - QApplication::postEvent(song, pyevent); + QApplication::postEvent(MusEGlobal::song, pyevent); Py_INCREF(Py_None); return Py_None; } @@ -99,9 +101,9 @@ PyObject* stopPlay(PyObject*, PyObject*) //------------------------------------------------------------ PyObject* rewindStart(PyObject*, PyObject*) { - //song->rewindStart(); + //MusEGlobal::song->rewindStart(); QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_REWIND); - QApplication::postEvent(song, pyevent); + QApplication::postEvent(MusEGlobal::song, pyevent); Py_INCREF(Py_None); return Py_None; } @@ -115,7 +117,7 @@ PyObject* getTempo(PyObject*, PyObject* args) return Py_BuildValue("i", 1000); } - int tempovalue = tempomap.tempo(tick); + int tempovalue = MusEGlobal::tempomap.tempo(tick); return Py_BuildValue("i", tempovalue); } //------------------------------------------------------------ @@ -123,11 +125,11 @@ PyObject* getTempo(PyObject*, PyObject* args) //------------------------------------------------------------ PyObject* getTrackNames(PyObject*, PyObject*) { - TrackList* tracks = song->tracks(); + TrackList* tracks = MusEGlobal::song->tracks(); PyObject* res = Py_BuildValue("[]"); for (ciTrack t = tracks->begin(); t != tracks->end(); ++t) { Track* track = *t; - PyObject* ptrackname = Py_BuildValue("s", track->name().toLatin1()); + PyObject* ptrackname = Py_BuildValue("s", track->name().toLatin1().constData()); PyList_Append(res, ptrackname); Py_DECREF(ptrackname); } @@ -139,7 +141,7 @@ PyObject* getTrackNames(PyObject*, PyObject*) //------------------------------------------------------------ Part* findPartBySerial(int sn) { - TrackList* tracks = song->tracks(); + TrackList* tracks = MusEGlobal::song->tracks(); for (ciTrack t = tracks->begin(); t != tracks->end(); ++t) { Track* track = *t; PartList* parts = track->parts(); @@ -157,7 +159,7 @@ Part* findPartBySerial(int sn) //------------------------------------------------------------ PyObject* getParts(PyObject*, PyObject* args) { - TrackList* tracks = song->tracks(); + TrackList* tracks = MusEGlobal::song->tracks(); const char* trackname; if (!PyArg_ParseTuple(args, "s", &trackname)) { return NULL; @@ -351,7 +353,7 @@ PyObject* createPart(PyObject*, PyObject* args) } QString qtrackname(trackname); - MidiTrack* track = (MidiTrack*) song->findTrack(trackname); + MidiTrack* track = (MidiTrack*) MusEGlobal::song->findTrack(trackname); if (track == NULL) return NULL; @@ -360,9 +362,9 @@ PyObject* createPart(PyObject*, PyObject* args) npart->setLenTick(tickLen); addPyPartEventsToMusePart(npart, part); - song->addPart(npart); + MusEGlobal::song->addPart(npart); QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_UPDATE, SC_TRACK_MODIFIED); - QApplication::postEvent(song, pyevent); + QApplication::postEvent(MusEGlobal::song, pyevent); Py_INCREF(Py_None); return Py_None; @@ -379,7 +381,7 @@ PyObject* modifyPart(PyObject*, PyObject* part) Part* opart = NULL; // Verify a part with that id actually exists, then get it - TrackList* tracks = song->tracks(); + TrackList* tracks = MusEGlobal::song->tracks(); for (ciTrack t = tracks->begin(); t != tracks->end(); ++t) { Track* track = *t; for (ciPart p = track->parts()->begin(); p != track->parts()->end(); p++) { @@ -412,12 +414,12 @@ PyObject* modifyPart(PyObject*, PyObject* part) addPyPartEventsToMusePart(npart, part); - //song->startUndo(); - song->changePart(opart, npart); - //song->endUndo(SC_TRACK_MODIFIED | SC_PART_MODIFIED | SC_PART_INSERTED); // Crash! Probably since the call ends up in Qt GUI thread from this thread + //MusEGlobal::song->startUndo(); + MusEGlobal::song->changePart(opart, npart); + //MusEGlobal::song->endUndo(SC_TRACK_MODIFIED | SC_PART_MODIFIED | SC_PART_INSERTED); // Crash! Probably since the call ends up in Qt GUI thread from this thread QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_UPDATE, SC_TRACK_MODIFIED | SC_PART_MODIFIED | SC_PART_INSERTED); - QApplication::postEvent(song, pyevent); + QApplication::postEvent(MusEGlobal::song, pyevent); Py_INCREF(Py_None); @@ -438,9 +440,9 @@ PyObject* deletePart(PyObject*, PyObject* args) if (part == NULL) return NULL; - song->removePart(part); + MusEGlobal::song->removePart(part); QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_UPDATE, SC_TRACK_MODIFIED | SC_PART_REMOVED); - QApplication::postEvent(song, pyevent); + QApplication::postEvent(MusEGlobal::song, pyevent); Py_INCREF(Py_None); return Py_None; } @@ -456,9 +458,9 @@ PyObject* setPos(PyObject*, PyObject* args) return NULL; } - //song->setPos(index, ticks); + //MusEGlobal::song->setPos(index, ticks); QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_POSCHANGE, index, ticks); - QApplication::postEvent(song, pyevent); + QApplication::postEvent(MusEGlobal::song, pyevent); Py_INCREF(Py_None); return Py_None; @@ -475,9 +477,9 @@ PyObject* setSongLen(PyObject*, PyObject* args) if (!PyArg_ParseTuple(args, "i", &len)) { return NULL; } - //song->setLen(len);// Appears to not be ok to call from python thread, we do it with event instead + //MusEGlobal::song->setLen(len);// Appears to not be ok to call from python thread, we do it with event instead QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONGLEN_CHANGE, len); - QApplication::postEvent(song, pyevent); + QApplication::postEvent(MusEGlobal::song, pyevent); Py_INCREF(Py_None); return Py_None; } @@ -486,7 +488,7 @@ PyObject* setSongLen(PyObject*, PyObject* args) //------------------------------------------------------------ PyObject* getSongLen(PyObject*, PyObject*) { - PyObject* pylen = Py_BuildValue("i", song->len()); + PyObject* pylen = Py_BuildValue("i", MusEGlobal::song->len()); return pylen; } @@ -495,7 +497,7 @@ PyObject* getSongLen(PyObject*, PyObject*) //------------------------------------------------------------ PyObject* getDivision(PyObject*, PyObject*) { - return Py_BuildValue("i", config.division); + return Py_BuildValue("i", MusEGlobal::config.division); } //------------------------------------------------------------ // setTrackParameter @@ -508,7 +510,7 @@ PyObject* setMidiTrackParameter(PyObject*, PyObject* args) if(!PyArg_ParseTuple(args, "ssi", &trackname, ¶mname, &value)) return NULL; - Track* track = song->findTrack(QString(trackname)); + Track* track = MusEGlobal::song->findTrack(QString(trackname)); if (track == NULL) return NULL; @@ -535,7 +537,7 @@ PyObject* setMidiTrackParameter(PyObject*, PyObject* args) if (changed) { QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_UPDATE, SC_TRACK_MODIFIED); - QApplication::postEvent(song, pyevent); + QApplication::postEvent(MusEGlobal::song, pyevent); } return Py_BuildValue("b", changed); // true/false depending on whether anythin was changed @@ -549,7 +551,7 @@ PyObject* setLoop(PyObject*, PyObject* args) if(!PyArg_ParseTuple(args, "b", &loopFlag)) return NULL; - song->setLoop(loopFlag); + MusEGlobal::song->setLoop(loopFlag); Py_INCREF(Py_None); return Py_None; } @@ -558,7 +560,7 @@ PyObject* setLoop(PyObject*, PyObject* args) //------------------------------------------------------------ PyObject* getLoop(PyObject*, PyObject*) { - return Py_BuildValue("b", song->getLoop()); + return Py_BuildValue("b", MusEGlobal::song->getLoop()); } //------------------------------------------------------------ // getMute trackname @@ -570,7 +572,7 @@ PyObject* getMute(PyObject*, PyObject* args) return NULL; } - Track* track = song->findTrack(QString(trackname)); + Track* track = MusEGlobal::song->findTrack(QString(trackname)); if (track == NULL) return NULL; @@ -588,7 +590,7 @@ PyObject* setMute(PyObject*, PyObject* args) return NULL; } - Track* track = song->findTrack(QString(trackname)); + Track* track = MusEGlobal::song->findTrack(QString(trackname)); if (track == NULL) return NULL; @@ -598,7 +600,7 @@ PyObject* setMute(PyObject*, PyObject* args) QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_SETMUTE, mutedint); pyevent->setS1(trackname); - QApplication::postEvent(song, pyevent); + QApplication::postEvent(MusEGlobal::song, pyevent); Py_INCREF(Py_None); return Py_None; } @@ -609,7 +611,7 @@ void setController(const char* trackname, int ctrltype, int ctrlval) { QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_SETCTRL, ctrltype, ctrlval); pyevent->setS1(trackname); - QApplication::postEvent(song, pyevent); + QApplication::postEvent(MusEGlobal::song, pyevent); } //------------------------------------------------------------ @@ -642,7 +644,7 @@ PyObject* getMidiControllerValue(PyObject*, PyObject* args) return NULL; } - Track* t = song->findTrack(QString(trackname)); + Track* t = MusEGlobal::song->findTrack(QString(trackname)); if (t == NULL) return NULL; @@ -654,7 +656,7 @@ PyObject* getMidiControllerValue(PyObject*, PyObject* args) MidiTrack* track = (MidiTrack*) t; int channel = track->outChannel(); int outport = track->outPort(); - MidiPort* mp = &midiPorts[outport]; + MidiPort* mp = &MusEGlobal::midiPorts[outport]; if (mp == NULL) return Py_BuildValue("i", -1); @@ -676,7 +678,7 @@ PyObject* setAudioTrackVolume(PyObject*, PyObject* args) QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_SETAUDIOVOL); pyevent->setD1(volume); pyevent->setS1(trackname); - QApplication::postEvent(song, pyevent); + QApplication::postEvent(MusEGlobal::song, pyevent); Py_INCREF(Py_None); return Py_None; } @@ -691,7 +693,7 @@ PyObject* getAudioTrackVolume(PyObject*, PyObject* args) return NULL; } - Track* t = song->findTrack(QString(trackname)); + Track* t = MusEGlobal::song->findTrack(QString(trackname)); if (t == NULL) return NULL; @@ -707,11 +709,11 @@ PyObject* getAudioTrackVolume(PyObject*, PyObject* args) //------------------------------------------------------------ PyObject* getSelectedTrack(PyObject*, PyObject*) { - TrackList* tracks = song->tracks(); + TrackList* tracks = MusEGlobal::song->tracks(); for (ciTrack t = tracks->begin(); t != tracks->end(); ++t) { Track* track = *t; if (track->selected()) - return Py_BuildValue("s", track->name().toLatin1()); + return Py_BuildValue("s", track->name().toLatin1().constData()); } Py_INCREF(Py_None); @@ -734,7 +736,7 @@ PyObject* importPart(PyObject*, PyObject* args) QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_IMPORT_PART, tick); pyevent->setS1(trackname); pyevent->setS2(filename); - QApplication::postEvent(song, pyevent); + QApplication::postEvent(MusEGlobal::song, pyevent); Py_INCREF(Py_None); return Py_None; } @@ -748,7 +750,7 @@ PyObject* getTrackEffects(PyObject*, PyObject* args) return NULL; } - Track* t = song->findTrack(QString(trackname)); + Track* t = MusEGlobal::song->findTrack(QString(trackname)); if (t == NULL) return NULL; @@ -760,8 +762,8 @@ PyObject* getTrackEffects(PyObject*, PyObject* args) const Pipeline* pipeline = track->efxPipe(); for (int i = 0; i < PipelineDepth; i++) { QString name = pipeline->name(i); - printf("fx %d name: %s\n", i, name.toLatin1()); - PyObject* pyname = Py_BuildValue("s", name.toLatin1()); + printf("fx %d name: %s\n", i, name.toLatin1().constData()); + PyObject* pyname = Py_BuildValue("s", name.toLatin1().constData()); PyList_Append(pyfxnames, pyname); Py_DECREF(pyname); } @@ -780,7 +782,7 @@ PyObject* toggleTrackEffect(PyObject*, PyObject* args) if (!PyArg_ParseTuple(args, "sib", &trackname, &fxid, &onoff)) return NULL; - Track* t = song->findTrack(QString(trackname)); + Track* t = MusEGlobal::song->findTrack(QString(trackname)); if (t == NULL) return NULL; @@ -790,7 +792,7 @@ PyObject* toggleTrackEffect(PyObject*, PyObject* args) QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_TOGGLE_EFFECT, fxid, onoff); pyevent->setS1(trackname); - QApplication::postEvent(song, pyevent); + QApplication::postEvent(MusEGlobal::song, pyevent); Py_INCREF(Py_None); return Py_None; } @@ -805,16 +807,16 @@ PyObject* changeTrackName(PyObject*, PyObject* args) if (!PyArg_ParseTuple(args, "ss", &trackname, &newname)) return NULL; - Track* t = song->findTrack(QString(trackname)); + Track* t = MusEGlobal::song->findTrack(QString(trackname)); if (t == NULL) return Py_BuildValue("b", false); QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_CHANGE_TRACKNAME); pyevent->setS1(trackname); pyevent->setS2(newname); - QApplication::postEvent(song, pyevent); + QApplication::postEvent(MusEGlobal::song, pyevent); QPybridgeEvent* pyevent2 = new QPybridgeEvent(QPybridgeEvent::SONG_UPDATE, SC_TRACK_MODIFIED); - QApplication::postEvent(song, pyevent2); + QApplication::postEvent(MusEGlobal::song, pyevent2); return Py_BuildValue("b", true); } //------------------------------------------------------------ @@ -823,7 +825,7 @@ PyObject* changeTrackName(PyObject*, PyObject* args) PyObject* addMidiTrack(PyObject*, PyObject*) { QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_ADD_TRACK, Track::MIDI); - QApplication::postEvent(song, pyevent); + QApplication::postEvent(MusEGlobal::song, pyevent); Py_INCREF(Py_None); return Py_None; } @@ -833,7 +835,7 @@ PyObject* addMidiTrack(PyObject*, PyObject*) PyObject* addWaveTrack(PyObject*, PyObject*) { QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_ADD_TRACK, Track::WAVE); - QApplication::postEvent(song, pyevent); + QApplication::postEvent(MusEGlobal::song, pyevent); Py_INCREF(Py_None); return Py_None; } @@ -843,7 +845,7 @@ PyObject* addWaveTrack(PyObject*, PyObject*) PyObject* addInput(PyObject*, PyObject*) { QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_ADD_TRACK, Track::AUDIO_INPUT); - QApplication::postEvent(song, pyevent); + QApplication::postEvent(MusEGlobal::song, pyevent); Py_INCREF(Py_None); return Py_None; } @@ -853,7 +855,7 @@ PyObject* addInput(PyObject*, PyObject*) PyObject* addOutput(PyObject*, PyObject*) { QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_ADD_TRACK, Track::AUDIO_OUTPUT); - QApplication::postEvent(song, pyevent); + QApplication::postEvent(MusEGlobal::song, pyevent); return Py_None; } //------------------------------------------------------------ @@ -862,7 +864,7 @@ PyObject* addOutput(PyObject*, PyObject*) PyObject* addGroup(PyObject*, PyObject*) { QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_ADD_TRACK, Track::AUDIO_GROUP); - QApplication::postEvent(song, pyevent); + QApplication::postEvent(MusEGlobal::song, pyevent); return Py_None; } //------------------------------------------------------------ @@ -877,7 +879,7 @@ PyObject* deleteTrack(PyObject*, PyObject* args) QPybridgeEvent* pyevent = new QPybridgeEvent(QPybridgeEvent::SONG_DELETE_TRACK); pyevent->setS1(trackname); - QApplication::postEvent(song, pyevent); + QApplication::postEvent(MusEGlobal::song, pyevent); return Py_None; } //------------------------------------------------------------ @@ -891,7 +893,7 @@ PyObject* getOutputRoute(PyObject*, PyObject* args) if (!PyArg_ParseTuple(args, "s", &trackname)) return NULL; - Track* tt = song->findTrack(QString(trackname)); + Track* tt = MusEGlobal::song->findTrack(QString(trackname)); if (tt == NULL) return Py_BuildValue("b", false); @@ -900,7 +902,7 @@ PyObject* getOutputRoute(PyObject*, PyObject* args) AudioTrack* t = (AudioTrack*)tt; RouteList* r = t->outRoutes(); - OutputList* al = song->outputs(); + OutputList* al = MusEGlobal::song->outputs(); for (iAudioOutput i = al->begin(); i != al->end(); ++i) { Track* track = *i; if (t == track) @@ -1011,7 +1013,7 @@ static void* pyapithreadfunc(void*) */ bool initPythonBridge() { - if (pthread_create(&pyapiThread, NULL, ::pyapithreadfunc, 0)) { + if (pthread_create(&pyapiThread, NULL, MusECore::pyapithreadfunc, 0)) { return false; } return true; // TODO: Verify that things are up and running! @@ -1078,10 +1080,10 @@ bool Song::event(QEvent* _e) int num = e->getP1(); int val = e->getP2(); - int tick = song->cpos(); + int tick = MusEGlobal::song->cpos(); MidiPlayEvent ev(tick, track->outPort(), chan, ME_CONTROLLER, num, val); - audio->msgPlayMidiEvent(&ev); - song->update(SC_MIDI_CONTROLLER); + MusEGlobal::audio->msgPlayMidiEvent(&ev); + MusEGlobal::song->update(SC_MIDI_CONTROLLER); break; } case QPybridgeEvent::SONG_SETAUDIOVOL: { @@ -1103,7 +1105,7 @@ bool Song::event(QEvent* _e) if (track == NULL) return false; - muse->importPartToTrack(filename, tick, track); + MusEGlobal::muse->importPartToTrack(filename, tick, track); break; } case QPybridgeEvent::SONG_TOGGLE_EFFECT: { @@ -1127,7 +1129,7 @@ bool Song::event(QEvent* _e) break; } case QPybridgeEvent::SONG_ADD_TRACK: - song->addTrack((Track::TrackType)e->getP1()); // Add at end of list. + MusEGlobal::song->addTrack((Track::TrackType)e->getP1()); // Add at end of list. break; case QPybridgeEvent::SONG_CHANGE_TRACKNAME: { Track* t = this->findTrack(e->getS1()); @@ -1141,7 +1143,7 @@ bool Song::event(QEvent* _e) if (t == NULL) return false; - audio->msgRemoveTrack(t); + MusEGlobal::audio->msgRemoveTrack(t); break; } default: @@ -1153,4 +1155,5 @@ bool Song::event(QEvent* _e) return true; } +} // namespace MusECore diff --git a/muse2/muse/remote/pyapi.h b/muse2/muse/remote/pyapi.h index 6cc7fbdc..fecd2fda 100644 --- a/muse2/muse/remote/pyapi.h +++ b/muse2/muse/remote/pyapi.h @@ -23,6 +23,8 @@ #include <QEvent> +namespace MusECore { + class QPybridgeEvent : public QEvent { public: @@ -51,5 +53,7 @@ private: bool initPythonBridge(); +} // namespace MusECore + #endif diff --git a/muse2/muse/thread.cpp b/muse2/muse/thread.cpp index ce11fba6..8fe0cdb8 100644 --- a/muse2/muse/thread.cpp +++ b/muse2/muse/thread.cpp @@ -32,6 +32,8 @@ #include "globals.h" #include "errno.h" +namespace MusECore { + //--------------------------------------------------------- // Thread //--------------------------------------------------------- @@ -104,7 +106,7 @@ void Thread::start(int prio, void* ptr) /* - if (pthread_create(&thread, attributes, ::loop, this)) + if (pthread_create(&thread, attributes, MusECore::loop, this)) perror("creating thread failed:"); // else // { @@ -114,7 +116,7 @@ void Thread::start(int prio, void* ptr) */ - int rv = pthread_create(&thread, attributes, ::loop, this); + int rv = pthread_create(&thread, attributes, MusECore::loop, this); if(rv) { // p4.0.16: MusEGlobal::realTimeScheduling is unreliable. It is true even in some clearly non-RT cases. @@ -122,7 +124,7 @@ void Thread::start(int prio, void* ptr) // MusE was failing with a stock kernel because of PTHREAD_EXPLICIT_SCHED. // So we'll just have to try again without attributes. if (MusEGlobal::realTimeScheduling && _realTimePriority > 0) - rv = pthread_create(&thread, NULL, ::loop, this); + rv = pthread_create(&thread, NULL, MusECore::loop, this); } if(rv) @@ -481,3 +483,4 @@ void Thread::readMsg1(int size) processMsg1(buffer); } +} // namespace MusECore diff --git a/muse2/muse/thread.h b/muse2/muse/thread.h index 3650f0ab..755754f9 100644 --- a/muse2/muse/thread.h +++ b/muse2/muse/thread.h @@ -27,6 +27,10 @@ #include <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/waveedit/waveview.cpp b/muse2/muse/waveedit/waveview.cpp index f22f842b..04751428 100644 --- a/muse2/muse/waveedit/waveview.cpp +++ b/muse2/muse/waveedit/waveview.cpp @@ -414,7 +414,7 @@ void WaveView::wheelEvent(QWheelEvent* ev) if (shift) { // scroll vertically int delta = -ev->delta() / WHEEL_DELTA; - int xpixelscale = 5*fast_log10(rmapxDev(1)); + int xpixelscale = 5*MusECore::fast_log10(rmapxDev(1)); if (xpixelscale <= 0) diff --git a/muse2/muse/widgets/canvas.cpp b/muse2/muse/widgets/canvas.cpp index b0f0dba8..41c5f4a4 100644 --- a/muse2/muse/widgets/canvas.cpp +++ b/muse2/muse/widgets/canvas.cpp @@ -489,7 +489,7 @@ void Canvas::wheelEvent(QWheelEvent* ev) if (shift) { // scroll horizontally int delta = -ev->delta() / WHEEL_DELTA; - int xpixelscale = 5*fast_log10(rmapxDev(1)); + int xpixelscale = 5*MusECore::fast_log10(rmapxDev(1)); if (xpixelscale <= 0) xpixelscale = 1; diff --git a/muse2/muse/widgets/meter.cpp b/muse2/muse/widgets/meter.cpp index 6b41c320..5c79ffb2 100644 --- a/muse2/muse/widgets/meter.cpp +++ b/muse2/muse/widgets/meter.cpp @@ -164,7 +164,7 @@ void Meter::setVal(double v, double max, bool ovl) { maxVal = max; if(mtype == DBMeter) - cur_ymax = maxVal == 0 ? fw : int(((maxScale - (fast_log10(maxVal) * 20.0)) * h)/range); + cur_ymax = maxVal == 0 ? fw : int(((maxScale - (MusECore::fast_log10(maxVal) * 20.0)) * h)/range); else cur_ymax = maxVal == 0 ? fw : int(((maxScale - maxVal) * h)/range); if(cur_ymax > h) cur_ymax = h; @@ -179,7 +179,7 @@ void Meter::setVal(double v, double max, bool ovl) if(ud) { if(mtype == DBMeter) - cur_yv = val == 0 ? h : int(((maxScale - (fast_log10(val) * 20.0)) * h)/range); + cur_yv = val == 0 ? h : int(((maxScale - (MusECore::fast_log10(val) * 20.0)) * h)/range); else cur_yv = val == 0 ? h : int(((maxScale - val) * h)/range); if(cur_yv > h) cur_yv = h; @@ -247,8 +247,8 @@ void Meter::paintEvent(QPaintEvent* ev) { if(mtype == DBMeter) { - cur_yv = val == 0 ? h : int(((maxScale - (fast_log10(val) * 20.0)) * h)/range); - cur_ymax = maxVal == 0 ? fw : int(((maxScale - (fast_log10(maxVal) * 20.0)) * h)/range); + cur_yv = val == 0 ? h : int(((maxScale - (MusECore::fast_log10(val) * 20.0)) * h)/range); + cur_ymax = maxVal == 0 ? fw : int(((maxScale - (MusECore::fast_log10(maxVal) * 20.0)) * h)/range); } else { diff --git a/muse2/muse/widgets/verticalmeter.cpp b/muse2/muse/widgets/verticalmeter.cpp index be2714a8..b8524d33 100644 --- a/muse2/muse/widgets/verticalmeter.cpp +++ b/muse2/muse/widgets/verticalmeter.cpp @@ -152,7 +152,7 @@ void VerticalMeter::paintEvent(QPaintEvent* /*ev*/) if(mtype == DBMeter) - xv = int(((maxScale - (fast_log10(val) * 20.0)) * w)/range); + xv = int(((maxScale - (MusECore::fast_log10(val) * 20.0)) * w)/range); else { xv = int(((maxScale - val) * w)/range); } @@ -167,7 +167,7 @@ void VerticalMeter::paintEvent(QPaintEvent* /*ev*/) /* int xcenter; if(mtype == DBMeter) - xcenter = maxVal == 0 ? 0 : int(((maxScale - (fast_log10(0) * 20.0)) * w)/range); + xcenter = maxVal == 0 ? 0 : int(((maxScale - (MusECore::fast_log10(0) * 20.0)) * w)/range); else xcenter = maxVal == 0 ? 0 : int(((maxVal) * w)/range); p.setPen(peak_color); |