WIP code update.

This commit is contained in:
redtide 2019-09-19 16:45:57 +02:00
parent 7193bba693
commit 960e2e5555
6 changed files with 12 additions and 10 deletions

View file

@ -131,9 +131,9 @@ void sfz::FilePool::loadingThread() noexcept
SndfileHandle sndFile(reinterpret_cast<const char*>(file.c_str())); SndfileHandle sndFile(reinterpret_cast<const char*>(file.c_str()));
std::lock_guard guard { fileHandleMutex }; std::lock_guard<std::mutex> guard { fileHandleMutex };
auto newHandle = fileHandles.emplace_back(readFromFile<float>(sndFile, fileToLoad.numFrames)); fileHandles.emplace_back(readFromFile<float>(sndFile, fileToLoad.numFrames));
fileToLoad.voice->setFileData(newHandle, fileToLoad.ticket); fileToLoad.voice->setFileData(fileHandles.back(), fileToLoad.ticket);
} }
} }
@ -143,7 +143,7 @@ void sfz::FilePool::garbageThread() noexcept
for (auto handle = fileHandles.begin(); handle < fileHandles.end();) { for (auto handle = fileHandles.begin(); handle < fileHandles.end();) {
if (handle->use_count() == 1) { if (handle->use_count() == 1) {
handle->reset(); handle->reset();
std::lock_guard guard { fileHandleMutex }; std::lock_guard<std::mutex> guard { fileHandleMutex };
std::iter_swap(handle, fileHandles.end() - 1); std::iter_swap(handle, fileHandles.end() - 1);
fileHandles.pop_back(); fileHandles.pop_back();
} else { } else {

View file

@ -24,7 +24,7 @@
#pragma once #pragma once
#include <atomic> #include <atomic>
#include "Debug.h" #include "Debug.h"
#include "compat/inline.h" #include "compat/utils.h"
template <class Owner> template <class Owner>
class LeakDetector { class LeakDetector {

View file

@ -22,7 +22,7 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#pragma once #pragma once
#include "compat/inline.h" #include "compat/utils.h"
#include <algorithm> #include <algorithm>
#include <cmath> #include <cmath>
#include <random> #include <random>

View file

@ -1,6 +1,6 @@
#include <chrono> #include <chrono>
#include <array> #include <array>
#include "compat/inline.h" #include "compat/utils.h"
namespace sfz namespace sfz
{ {
SFZ_INLINE std::array<std::chrono::steady_clock::time_point, 128> noteOnTimes { }; SFZ_INLINE std::array<std::chrono::steady_clock::time_point, 128> noteOnTimes { };

View file

@ -1,9 +1,9 @@
#pragma once #pragma once
#ifdef __cplusplus #ifdef __cplusplus
#if (__cplusplus >= 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) #if (__cplusplus >= 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
#include <filesystem> #include <filesystem>
#elif (__cplusplus >= 201402L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) #elif (__cplusplus >= 201402L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L)
#warning std::experimental::filesystem in use #warning std::experimental::filesystem in use
#include <experimental/filesystem> #include <experimental/filesystem>
namespace std { namespace std {

View file

@ -1,9 +1,11 @@
#pragma once #pragma once
#ifdef __cplusplus #ifdef __cplusplus
#if (__cplusplus >= 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) #if (__cplusplus >= 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
#define SFZ_HAVE_CXX17 1
#define SFZ_INLINE inline #define SFZ_INLINE inline
#else #else
#define SFZ_HAVE_CXX17 0
#define SFZ_INLINE #define SFZ_INLINE
#endif #endif
#else #else