diff --git a/include/BasicFilters.h b/include/BasicFilters.h index a3753dd9b..a0a1fc85d 100644 --- a/include/BasicFilters.h +++ b/include/BasicFilters.h @@ -218,7 +218,7 @@ private: }; typedef OnePole<2> StereoOnePole; -template +template class BasicFilters { MM_OPERATORS diff --git a/include/RemotePlugin.h b/include/RemotePlugin.h index 2d8114875..bfba39de2 100644 --- a/include/RemotePlugin.h +++ b/include/RemotePlugin.h @@ -29,6 +29,7 @@ #include "MidiEvent.h" #include "VstSyncData.h" +#include #include #include #include @@ -234,7 +235,7 @@ public: // recursive lock inline void lock() { - if( !isInvalid() && __sync_add_and_fetch( &m_lockDepth, 1 ) == 1 ) + if( !isInvalid() && m_lockDepth.fetch_add( 1 ) == 0 ) { m_dataSem.acquire(); } @@ -243,7 +244,7 @@ public: // recursive unlock inline void unlock() { - if( __sync_sub_and_fetch( &m_lockDepth, 1) <= 0 ) + if( m_lockDepth.fetch_sub( 1 ) <= 1 ) { m_dataSem.release(); } @@ -404,7 +405,7 @@ private: shmData * m_data; QSystemSemaphore m_dataSem; QSystemSemaphore m_messageSem; - volatile int m_lockDepth; + std::atomic_int m_lockDepth; } ; #endif diff --git a/include/TrackContainerView.h b/include/TrackContainerView.h index 07e498df4..67575583b 100644 --- a/include/TrackContainerView.h +++ b/include/TrackContainerView.h @@ -174,6 +174,7 @@ private: TrackContainerView* m_trackContainerView; } ; + friend class TrackContainerView::scrollArea; TrackContainer* m_tc; typedef QList trackViewList; diff --git a/include/lmms_basics.h b/include/lmms_basics.h index 205d2efd2..9b4bd6d55 100644 --- a/include/lmms_basics.h +++ b/include/lmms_basics.h @@ -31,7 +31,7 @@ #include "lmmsconfig.h" #ifdef LMMS_HAVE_STDINT_H -#include +#include #endif @@ -59,6 +59,9 @@ typedef uint32_t jo_id_t; // (unique) ID of a journalling object #define likely(x) Q_LIKELY(x) #define unlikely(x) Q_UNLIKELY(x) +// windows headers define "min" and "max" macros, breaking the methods bwloe +#undef min +#undef max template struct typeInfo diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6b613d333..4dd7c6505 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -31,7 +31,9 @@ INCLUDE_DIRECTORIES( "${CMAKE_SOURCE_DIR}/include" ) -IF(WIN32) +IF(WIN32 AND MSVC) + SET(WINRC "${CMAKE_BINARY_DIR}/lmms.rc") +ELSEIF(WIN32) SET(WINRC "${CMAKE_BINARY_DIR}/lmmsrc.obj") ADD_CUSTOM_COMMAND(OUTPUT "${WINRC}" COMMAND "${WINDRES}" diff --git a/src/core/DrumSynth.cpp b/src/core/DrumSynth.cpp index fd0695557..3379f1aa7 100644 --- a/src/core/DrumSynth.cpp +++ b/src/core/DrumSynth.cpp @@ -35,6 +35,11 @@ #define powf pow #endif +#ifdef _MSC_VER +//not #if LMMS_BUILD_WIN32 because we have strncasecmp in mingw +#define strcasecmp _stricmp +#endif + using namespace std; diff --git a/src/core/InstrumentSoundShaping.cpp b/src/core/InstrumentSoundShaping.cpp index 22327ae8e..58bbec639 100644 --- a/src/core/InstrumentSoundShaping.cpp +++ b/src/core/InstrumentSoundShaping.cpp @@ -22,6 +22,7 @@ * */ +#include #include #include "InstrumentSoundShaping.h" @@ -153,8 +154,8 @@ void InstrumentSoundShaping::processAudioBuffer( sampleFrame* buffer, if( m_filterEnabledModel.value() ) { - float cutBuffer [frames]; - float resBuffer [frames]; + QVarLengthArray cutBuffer(frames); + QVarLengthArray resBuffer(frames); int old_filter_cut = 0; int old_filter_res = 0; @@ -167,11 +168,11 @@ void InstrumentSoundShaping::processAudioBuffer( sampleFrame* buffer, if( m_envLfoParameters[Cut]->isUsed() ) { - m_envLfoParameters[Cut]->fillLevel( cutBuffer, envTotalFrames, envReleaseBegin, frames ); + m_envLfoParameters[Cut]->fillLevel( cutBuffer.data(), envTotalFrames, envReleaseBegin, frames ); } if( m_envLfoParameters[Resonance]->isUsed() ) { - m_envLfoParameters[Resonance]->fillLevel( resBuffer, envTotalFrames, envReleaseBegin, frames ); + m_envLfoParameters[Resonance]->fillLevel( resBuffer.data(), envTotalFrames, envReleaseBegin, frames ); } const float fcv = m_filterCutModel.value(); @@ -246,8 +247,8 @@ void InstrumentSoundShaping::processAudioBuffer( sampleFrame* buffer, if( m_envLfoParameters[Volume]->isUsed() ) { - float volBuffer [frames]; - m_envLfoParameters[Volume]->fillLevel( volBuffer, envTotalFrames, envReleaseBegin, frames ); + QVarLengthArray volBuffer(frames); + m_envLfoParameters[Volume]->fillLevel( volBuffer.data(), envTotalFrames, envReleaseBegin, frames ); for( fpp_t frame = 0; frame < frames; ++frame ) { diff --git a/src/core/LocklessAllocator.cpp b/src/core/LocklessAllocator.cpp index 8a7a2fb54..3a582fc76 100644 --- a/src/core/LocklessAllocator.cpp +++ b/src/core/LocklessAllocator.cpp @@ -25,7 +25,6 @@ #include "LocklessAllocator.h" #include -#include #include "lmmsconfig.h" diff --git a/src/core/Mixer.cpp b/src/core/Mixer.cpp index 53cacbe63..8948810f0 100644 --- a/src/core/Mixer.cpp +++ b/src/core/Mixer.cpp @@ -63,7 +63,7 @@ typedef LocklessList::Element LocklessListElement; -static __thread bool s_renderingThread; +static thread_local bool s_renderingThread; diff --git a/src/core/MixerWorkerThread.cpp b/src/core/MixerWorkerThread.cpp index dfcc1ff6a..2f3b46959 100644 --- a/src/core/MixerWorkerThread.cpp +++ b/src/core/MixerWorkerThread.cpp @@ -34,6 +34,11 @@ MixerWorkerThread::JobQueue MixerWorkerThread::globalJobQueue; QWaitCondition * MixerWorkerThread::queueReadyWaitCond = NULL; QList MixerWorkerThread::workerThreads; +#ifdef _MSC_VER + #define ASM(x) __asm { x }; +#else + #define ASM(x) asm ( "x" ); +#endif // implementation of internal JobQueue @@ -88,8 +93,8 @@ void MixerWorkerThread::JobQueue::wait() { while( (int) m_itemsDone < (int) m_queueSize ) { -#if defined(LMMS_HOST_X86) || defined(LMMS_HOST_X86_64) - asm( "pause" ); +#if defined(LMMS_HOST_X86) || (defined(LMMS_HOST_X86_64) && ! defined(_MSC_VER) ) + ASM( "pause" ); #endif } } diff --git a/src/gui/dialogs/VersionedSaveDialog.cpp b/src/gui/dialogs/VersionedSaveDialog.cpp index e2720e5a1..e2acff590 100644 --- a/src/gui/dialogs/VersionedSaveDialog.cpp +++ b/src/gui/dialogs/VersionedSaveDialog.cpp @@ -98,7 +98,7 @@ bool VersionedSaveDialog::changeFileNameVersion(QString &fileName, bool incremen Q_ASSERT( ok ); // Can't decrement 0 - if ( !increment and version == 0 ) + if ( !increment && version == 0 ) return false; // Replace version number version = increment ? version + 1 : version - 1;