MSVC compilation fixes

This commit is contained in:
Lukas W
2017-10-16 15:51:21 +02:00
parent c2af8ae554
commit 9ae1bdecda
11 changed files with 34 additions and 17 deletions

View File

@@ -218,7 +218,7 @@ private:
};
typedef OnePole<2> StereoOnePole;
template<ch_cnt_t CHANNELS>
template<ch_cnt_t CHANNELS=DEFAULT_CHANNELS>
class BasicFilters
{
MM_OPERATORS

View File

@@ -29,6 +29,7 @@
#include "MidiEvent.h"
#include "VstSyncData.h"
#include <atomic>
#include <vector>
#include <cstdio>
#include <cstdlib>
@@ -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

View File

@@ -174,6 +174,7 @@ private:
TrackContainerView* m_trackContainerView;
} ;
friend class TrackContainerView::scrollArea;
TrackContainer* m_tc;
typedef QList<TrackView *> trackViewList;

View File

@@ -31,7 +31,7 @@
#include "lmmsconfig.h"
#ifdef LMMS_HAVE_STDINT_H
#include <stdint.h>
#include <cstdint>
#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<typename T>
struct typeInfo

View File

@@ -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}"

View File

@@ -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;

View File

@@ -22,6 +22,7 @@
*
*/
#include <QtCore/QVarLengthArray>
#include <QDomElement>
#include "InstrumentSoundShaping.h"
@@ -153,8 +154,8 @@ void InstrumentSoundShaping::processAudioBuffer( sampleFrame* buffer,
if( m_filterEnabledModel.value() )
{
float cutBuffer [frames];
float resBuffer [frames];
QVarLengthArray<float> cutBuffer(frames);
QVarLengthArray<float> 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<float> volBuffer(frames);
m_envLfoParameters[Volume]->fillLevel( volBuffer.data(), envTotalFrames, envReleaseBegin, frames );
for( fpp_t frame = 0; frame < frames; ++frame )
{

View File

@@ -25,7 +25,6 @@
#include "LocklessAllocator.h"
#include <stdio.h>
#include <strings.h>
#include "lmmsconfig.h"

View File

@@ -63,7 +63,7 @@
typedef LocklessList<PlayHandle *>::Element LocklessListElement;
static __thread bool s_renderingThread;
static thread_local bool s_renderingThread;

View File

@@ -34,6 +34,11 @@ MixerWorkerThread::JobQueue MixerWorkerThread::globalJobQueue;
QWaitCondition * MixerWorkerThread::queueReadyWaitCond = NULL;
QList<MixerWorkerThread *> 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
}
}

View File

@@ -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;