Mercurial > hg > svcore
changeset 1221:a1b97df9962e 3.0-integration
Merge from branch msvc2015_64
author | Chris Cannam |
---|---|
date | Thu, 20 Oct 2016 11:16:22 +0100 |
parents | f50ded4b951c (current diff) a68d407f9752 (diff) |
children | 771a17925576 5261a7791f1c |
files | |
diffstat | 21 files changed, 70 insertions(+), 40 deletions(-) [+] |
line wrap: on
line diff
--- 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 {
--- 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 <ctime> -#include <sys/time.h> #include <map> #include "RealTime.h" @@ -41,6 +39,11 @@ #endif #endif +#ifndef NO_TIMING +#include <ctime> +#include <sys/time.h> +#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<clock_t, RealTime> TimePair; typedef std::pair<int, TimePair> ProfilePair; typedef std::map<const char *, ProfilePair> ProfileMap; @@ -70,6 +76,7 @@ ProfileMap m_profiles; LastCallMap m_lastCalls; WorstCallMap m_worstCalls; +#endif static Profiles* m_instance; };
--- 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 <sstream> #include "RealTime.h" -#include "sys/time.h" #include "Debug.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 <vamp-hostsdk/RealTime.h> -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
--- 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 <vector> #include <list> -#include <sys/time.h> #include <QMutex> #include <iostream>
--- 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 <iostream> #include <cassert> -#include <unistd.h> + #include <time.h> TempDirectory *
--- 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 <iostream> + +#ifdef _MSC_VER +#include <io.h> +#define _lseek lseek +#else #include <unistd.h> +#endif + #include <cstdio> //#define DEBUG_FILE_READ_THREAD 1
--- 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 <iostream> #include <cstdlib> -#include <unistd.h> - //#define DEBUG_FILE_SOURCE 1 int
--- 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 <iostream> #include <cstdlib> -#include <unistd.h> #ifdef HAVE_ID3TAG #include <id3tag.h> @@ -37,6 +36,11 @@ #include <QFileInfo> +#ifdef _MSC_VER +#include <io.h> +#define open _open +#endif + MP3FileReader::MP3FileReader(FileSource source, DecodeMode decodeMode, CacheMode mode, sv_samplerate_t targetRate, bool normalised,
--- 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 <unistd.h> +#include "system/System.h" MIDIInput::MIDIInput(QString name, FrameTimer *timer) : m_rtmidi(),
--- 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 ); } }
--- 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 <cassert> #include <deque> -#ifndef __GNUC__ -#include <alloca.h> -#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; }
--- 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 <QTextStream> #include <iostream> -#include <unistd.h> +//#include <unistd.h> #include <cmath> #include <sndfile.h> @@ -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);
--- 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 <iostream>
--- 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 <iostream> -#include <unistd.h> #define OSC_MESSAGE_QUEUE_SIZE 1023 #ifdef HAVE_LIBLO +#include <unistd.h> + void OSCQueue::oscError(int num, const char *msg, const char *path) {
--- 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;
--- 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;
--- 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;
--- 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
--- 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;
--- 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 <BaseTsd.h> +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 <dlfcn.h> #include <stdio.h> // for perror #include <cmath> +#include <unistd.h> // sleep + usleep primarily #define MLOCK(a,b) ::mlock((a),(b)) #define MUNLOCK(a,b) (::munlock((a),(b)) ? (::perror("munlock failed"), 0) : 0)