# HG changeset patch # User Chris Cannam # Date 1476958582 -3600 # Node ID a1b97df9962e0c39486748309bee4ad63a226157 # Parent f50ded4b951c9ba4938b881ccefa2d9fa8e82030# Parent a68d407f9752a59df67e57d25cca79c538ca9950 Merge from branch msvc2015_64 diff -r f50ded4b951c -r a1b97df9962e base/Profiler.cpp --- a/base/Profiler.cpp Tue Oct 18 14:03:35 2016 +0100 +++ b/base/Profiler.cpp Thu Oct 20 11:16:22 2016 +0100 @@ -47,15 +47,11 @@ dump(); } +#ifndef NO_TIMING void Profiles::accumulate( -#ifndef NO_TIMING const char* id, clock_t time, RealTime rt -#else - const char*, clock_t, RealTime -#endif ) { -#ifndef NO_TIMING ProfilePair &pair(m_profiles[id]); ++pair.first; pair.second.first += time; @@ -72,8 +68,8 @@ if (rt > worstPair.second) { worstPair.second = rt; } +} #endif -} void Profiles::dump() const { diff -r f50ded4b951c -r a1b97df9962e base/Profiler.h --- a/base/Profiler.h Tue Oct 18 14:03:35 2016 +0100 +++ b/base/Profiler.h Thu Oct 20 11:16:22 2016 +0100 @@ -25,8 +25,6 @@ #include "system/System.h" -#include -#include #include #include "RealTime.h" @@ -41,6 +39,11 @@ #endif #endif +#ifndef NO_TIMING +#include +#include +#endif + /** * Profiling classes */ @@ -56,12 +59,15 @@ static Profiles* getInstance(); ~Profiles(); +#ifndef NO_TIMING void accumulate(const char* id, clock_t time, RealTime rt); +#endif void dump() const; protected: Profiles(); +#ifndef NO_TIMING typedef std::pair TimePair; typedef std::pair ProfilePair; typedef std::map ProfileMap; @@ -70,6 +76,7 @@ ProfileMap m_profiles; LastCallMap m_lastCalls; WorstCallMap m_worstCalls; +#endif static Profiles* m_instance; }; diff -r f50ded4b951c -r a1b97df9962e base/RealTime.cpp --- a/base/RealTime.cpp Tue Oct 18 14:03:35 2016 +0100 +++ b/base/RealTime.cpp Thu Oct 20 11:16:22 2016 +0100 @@ -24,7 +24,6 @@ #include #include "RealTime.h" -#include "sys/time.h" #include "Debug.h" diff -r f50ded4b951c -r a1b97df9962e base/RealTime.h --- a/base/RealTime.h Tue Oct 18 14:03:35 2016 +0100 +++ b/base/RealTime.h Thu Oct 20 11:16:22 2016 +0100 @@ -28,7 +28,11 @@ #include -struct timeval; +#ifdef _MSC_VER +#include "winsock.h" // struct timeval is in here +#else +#include "sys/time.h" +#endif /** * RealTime represents time values to nanosecond precision diff -r f50ded4b951c -r a1b97df9962e base/Scavenger.h --- a/base/Scavenger.h Tue Oct 18 14:03:35 2016 +0100 +++ b/base/Scavenger.h Thu Oct 20 11:16:22 2016 +0100 @@ -26,7 +26,6 @@ #include #include -#include #include #include diff -r f50ded4b951c -r a1b97df9962e base/TempDirectory.cpp --- a/base/TempDirectory.cpp Tue Oct 18 14:03:35 2016 +0100 +++ b/base/TempDirectory.cpp Thu Oct 20 11:16:22 2016 +0100 @@ -25,7 +25,7 @@ #include #include -#include + #include TempDirectory * diff -r f50ded4b951c -r a1b97df9962e data/fileio/FileReadThread.cpp --- a/data/fileio/FileReadThread.cpp Tue Oct 18 14:03:35 2016 +0100 +++ b/data/fileio/FileReadThread.cpp Thu Oct 20 11:16:22 2016 +0100 @@ -19,7 +19,14 @@ #include "base/Thread.h" #include + +#ifdef _MSC_VER +#include +#define _lseek lseek +#else #include +#endif + #include //#define DEBUG_FILE_READ_THREAD 1 diff -r f50ded4b951c -r a1b97df9962e data/fileio/FileSource.cpp --- a/data/fileio/FileSource.cpp Tue Oct 18 14:03:35 2016 +0100 +++ b/data/fileio/FileSource.cpp Thu Oct 20 11:16:22 2016 +0100 @@ -30,8 +30,6 @@ #include #include -#include - //#define DEBUG_FILE_SOURCE 1 int diff -r f50ded4b951c -r a1b97df9962e data/fileio/MP3FileReader.cpp --- a/data/fileio/MP3FileReader.cpp Tue Oct 18 14:03:35 2016 +0100 +++ b/data/fileio/MP3FileReader.cpp Thu Oct 20 11:16:22 2016 +0100 @@ -27,7 +27,6 @@ #include #include -#include #ifdef HAVE_ID3TAG #include @@ -37,6 +36,11 @@ #include +#ifdef _MSC_VER +#include +#define open _open +#endif + MP3FileReader::MP3FileReader(FileSource source, DecodeMode decodeMode, CacheMode mode, sv_samplerate_t targetRate, bool normalised, diff -r f50ded4b951c -r a1b97df9962e data/midi/MIDIInput.cpp --- a/data/midi/MIDIInput.cpp Tue Oct 18 14:03:35 2016 +0100 +++ b/data/midi/MIDIInput.cpp Thu Oct 20 11:16:22 2016 +0100 @@ -17,7 +17,7 @@ #include "rtmidi/RtMidi.h" -#include +#include "system/System.h" MIDIInput::MIDIInput(QString name, FrameTimer *timer) : m_rtmidi(), diff -r f50ded4b951c -r a1b97df9962e data/midi/rtmidi/RtMidi.cpp --- a/data/midi/rtmidi/RtMidi.cpp Tue Oct 18 14:03:35 2016 +0100 +++ b/data/midi/rtmidi/RtMidi.cpp Thu Oct 20 11:16:22 2016 +0100 @@ -63,7 +63,7 @@ #endif } else { - cerr << '\n' << errorString_ << "\n\n"; + cerr << "\nRtMidi error: " << errorString_ << "\n\n"; throw RtError( errorString_, type ); } } diff -r f50ded4b951c -r a1b97df9962e data/model/FFTModel.cpp --- a/data/model/FFTModel.cpp Tue Oct 18 14:03:35 2016 +0100 +++ b/data/model/FFTModel.cpp Thu Oct 20 11:16:22 2016 +0100 @@ -24,10 +24,6 @@ #include #include -#ifndef __GNUC__ -#include -#endif - using namespace std; FFTModel::FFTModel(const DenseTimeValueModel *model, @@ -360,11 +356,7 @@ int maxbin = ymax; if (maxbin < getHeight() - 1) maxbin = maxbin + 1; const int n = maxbin - minbin + 1; -#ifdef __GNUC__ - float values[n]; -#else - float *values = (float *)alloca(n * sizeof(float)); -#endif + float *values = new float[n]; getMagnitudesAt(x, values, minbin, maxbin - minbin + 1); for (int bin = ymin; bin <= ymax; ++bin) { if (bin == minbin || bin == maxbin) continue; @@ -373,6 +365,7 @@ peaks.insert(bin); } } + delete[] values; return peaks; } diff -r f50ded4b951c -r a1b97df9962e data/model/ReadOnlyWaveFileModel.cpp --- a/data/model/ReadOnlyWaveFileModel.cpp Tue Oct 18 14:03:35 2016 +0100 +++ b/data/model/ReadOnlyWaveFileModel.cpp Thu Oct 20 11:16:22 2016 +0100 @@ -26,7 +26,7 @@ #include #include -#include +//#include #include #include @@ -614,7 +614,10 @@ cerr << "ReadOnlyWaveFileModel::fill inner loop: frame = " << frame << ", count = " << m_frameCount << ", blocksize " << readBlockSize << endl; #endif - if (updating && (frame + readBlockSize > m_frameCount)) break; + if (updating && (frame + readBlockSize > m_frameCount)) { + m_model.m_mutex.lock(); // must be locked on exiting loop + break; + } block = m_model.m_reader->getInterleavedFrames(frame, readBlockSize); diff -r f50ded4b951c -r a1b97df9962e data/model/SparseModel.h --- a/data/model/SparseModel.h Tue Oct 18 14:03:35 2016 +0100 +++ b/data/model/SparseModel.h Thu Oct 20 11:16:22 2016 +0100 @@ -20,6 +20,7 @@ #include "TabularModel.h" #include "base/Command.h" #include "base/RealTime.h" +#include "system/System.h" #include diff -r f50ded4b951c -r a1b97df9962e data/osc/OSCQueue.cpp --- a/data/osc/OSCQueue.cpp Tue Oct 18 14:03:35 2016 +0100 +++ b/data/osc/OSCQueue.cpp Thu Oct 20 11:16:22 2016 +0100 @@ -23,12 +23,13 @@ #include "base/Profiler.h" #include -#include #define OSC_MESSAGE_QUEUE_SIZE 1023 #ifdef HAVE_LIBLO +#include + void OSCQueue::oscError(int num, const char *msg, const char *path) { diff -r f50ded4b951c -r a1b97df9962e plugin/DSSIPluginFactory.cpp --- a/plugin/DSSIPluginFactory.cpp Tue Oct 18 14:03:35 2016 +0100 +++ b/plugin/DSSIPluginFactory.cpp Thu Oct 20 11:16:22 2016 +0100 @@ -225,7 +225,7 @@ } #ifdef _WIN32 - char *pfiles = getenv("ProgramFiles"); + const char *pfiles = getenv("ProgramFiles"); if (!pfiles) pfiles = "C:\\Program Files"; { std::string::size_type f; diff -r f50ded4b951c -r a1b97df9962e plugin/LADSPAPluginFactory.cpp --- a/plugin/LADSPAPluginFactory.cpp Tue Oct 18 14:03:35 2016 +0100 +++ b/plugin/LADSPAPluginFactory.cpp Thu Oct 20 11:16:22 2016 +0100 @@ -579,7 +579,7 @@ } #ifdef _WIN32 - char *pfiles = getenv("ProgramFiles"); + const char *pfiles = getenv("ProgramFiles"); if (!pfiles) pfiles = "C:\\Program Files"; { std::string::size_type f; diff -r f50ded4b951c -r a1b97df9962e plugin/api/alsa/seq_event.h --- a/plugin/api/alsa/seq_event.h Tue Oct 18 14:03:35 2016 +0100 +++ b/plugin/api/alsa/seq_event.h Thu Oct 20 11:16:22 2016 +0100 @@ -321,7 +321,11 @@ typedef struct snd_seq_ev_ext { unsigned int len; /**< length of data */ void *ptr; /**< pointer to data (note: can be 64-bit) */ -} __attribute__((packed)) snd_seq_ev_ext_t; +} +#ifdef __GNUC__ +__attribute__((packed)) +#endif +snd_seq_ev_ext_t; /** Instrument cluster type */ typedef unsigned int snd_seq_instr_cluster_t; diff -r f50ded4b951c -r a1b97df9962e svcore.pro --- a/svcore.pro Tue Oct 18 14:03:35 2016 +0100 +++ b/svcore.pro Thu Oct 20 11:16:22 2016 +0100 @@ -17,8 +17,10 @@ LIBS += -L../sv-dependency-builds/win32-mingw/lib } win32-msvc* { - INCLUDEPATH += ../sv-dependency-builds/win32-msvc/include - LIBS += -L../sv-dependency-builds/win32-msvc/lib + # We actually expect MSVC to be used only for 64-bit builds, + # though the qmake spec is still called win32-msvc* + INCLUDEPATH += ../sv-dependency-builds/win64-msvc/include + LIBS += -L../sv-dependency-builds/win64-msvc/lib } macx* { INCLUDEPATH += ../sv-dependency-builds/osx/include @@ -30,6 +32,10 @@ macx* { DEFINES += HAVE_COREAUDIO } + win32-msvc* { + DEFINES += NOMINMAX _USE_MATH_DEFINES + DEFINES -= HAVE_LIBLO + } } CONFIG += staticlib qt thread warn_on stl rtti exceptions c++11 diff -r f50ded4b951c -r a1b97df9962e system/System.cpp --- a/system/System.cpp Tue Oct 18 14:03:35 2016 +0100 +++ b/system/System.cpp Thu Oct 20 11:16:22 2016 +0100 @@ -56,12 +56,12 @@ extern "C" { -/* usleep is now in mingw +#ifdef _MSC_VER void usleep(unsigned long usec) { ::Sleep(usec / 1000); } -*/ +#endif int gettimeofday(struct timeval *tv, void *tz) { @@ -119,7 +119,7 @@ DWORDLONG ullAvailVirtual; DWORDLONG ullAvailExtendedVirtual; } lMEMORYSTATUSEX; -typedef WINBOOL (WINAPI *PFN_MS_EX) (lMEMORYSTATUSEX*); +typedef BOOL (WINAPI *PFN_MS_EX) (lMEMORYSTATUSEX*); #endif void @@ -277,7 +277,7 @@ #ifdef _WIN32 extern void SystemMemoryBarrier() { -#ifdef __MSVC__ +#ifdef _MSC_VER MemoryBarrier(); #else /* mingw */ LONG Barrier = 0; diff -r f50ded4b951c -r a1b97df9962e system/System.h --- a/system/System.h Tue Oct 18 14:03:35 2016 +0100 +++ b/system/System.h Thu Oct 20 11:16:22 2016 +0100 @@ -59,10 +59,17 @@ #define getpid _getpid +#if defined(_MSC_VER) +#include +typedef SSIZE_T ssize_t; +#endif + extern "C" { -/* usleep is now in mingw + +#ifdef _MSC_VER void usleep(unsigned long usec); -*/ +#endif + int gettimeofday(struct timeval *p, void *tz); } @@ -75,6 +82,7 @@ #include #include // for perror #include +#include // sleep + usleep primarily #define MLOCK(a,b) ::mlock((a),(b)) #define MUNLOCK(a,b) (::munlock((a),(b)) ? (::perror("munlock failed"), 0) : 0)