Merge pull request #4000 from LMMS/fix/msvc

MSVC fixes
This commit is contained in:
Lukas W
2017-11-24 11:58:12 +01:00
committed by GitHub
75 changed files with 217 additions and 165 deletions

View File

@@ -10,7 +10,7 @@ SET(CMAKE_AUTOMOC ON)
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
# Enable C++11
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
SET(CMAKE_CXX_STANDARD 11)
IF(LMMS_BUILD_APPLE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
@@ -33,7 +33,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}"
@@ -125,7 +127,7 @@ ENDIF()
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${LMMS_RCC_OUT} ${LMMS_UI_OUT} lmmsconfig.h lmms.1.gz")
IF(LMMS_BUILD_WIN32)
SET(EXTRA_LIBRARIES "-lwinmm")
SET(EXTRA_LIBRARIES "winmm")
ENDIF()
IF(LMMS_BUILD_APPLE)

View File

@@ -34,6 +34,7 @@ set(LMMS_SRCS
core/MemoryHelper.cpp
core/MemoryManager.cpp
core/MeterModel.cpp
core/MicroTimer.cpp
core/Mixer.cpp
core/MixerProfiler.cpp
core/MixerWorkerThread.cpp

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,10 +25,12 @@
#include "LocklessAllocator.h"
#include <stdio.h>
#include <strings.h>
#include "lmmsconfig.h"
#ifndef LMMS_BUILD_WIN32
#include <strings.h>
#endif
static const size_t SIZEOF_SET = sizeof( int ) * 8;

27
src/core/MicroTimer.cpp Normal file
View File

@@ -0,0 +1,27 @@
#include "MicroTimer.h"
using namespace std;
using namespace std::chrono;
static_assert(ratio_less_equal<steady_clock::duration::period, micro>::value,
"MicroTimer: steady_clock doesn't support microsecond resolution");
MicroTimer::MicroTimer()
{
reset();
}
MicroTimer::~MicroTimer()
{
}
void MicroTimer::reset()
{
begin = steady_clock::now();
}
int MicroTimer::elapsed() const
{
auto now = steady_clock::now();
return std::chrono::duration_cast<std::chrono::duration<int, std::micro>>(now - begin).count();
}

View File

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

View File

@@ -34,8 +34,6 @@ MixerWorkerThread::JobQueue MixerWorkerThread::globalJobQueue;
QWaitCondition * MixerWorkerThread::queueReadyWaitCond = NULL;
QList<MixerWorkerThread *> MixerWorkerThread::workerThreads;
// implementation of internal JobQueue
void MixerWorkerThread::JobQueue::reset( OperationMode _opMode )
{
@@ -89,7 +87,7 @@ void MixerWorkerThread::JobQueue::wait()
while( (int) m_itemsDone < (int) m_queueSize )
{
#if defined(LMMS_HOST_X86) || defined(LMMS_HOST_X86_64)
asm( "pause" );
_mm_pause();
#endif
}
}

View File

@@ -129,7 +129,7 @@ void printVersion( char *executableName )
"License as published by the Free Software Foundation; either\n"
"version 2 of the License, or (at your option) any later version.\n\n"
"Try \"%s --help\" for more information.\n\n", LMMS_VERSION,
PLATFORM, MACHINE, QT_VERSION_STR, GCC_VERSION,
PLATFORM, MACHINE, QT_VERSION_STR, COMPILER_VERSION,
LMMS_PROJECT_COPYRIGHT, executableName );
}

View File

@@ -44,7 +44,7 @@ AboutDialog::AboutDialog(QWidget* parent) :
arg( PLATFORM ).
arg( MACHINE ).
arg( QT_VERSION_STR ).
arg( GCC_VERSION ) );
arg( COMPILER_VERSION ) );
versionLabel->setTextInteractionFlags(
versionLabel->textInteractionFlags() |
Qt::TextSelectableByMouse );

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;