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()));
std::lock_guard guard { fileHandleMutex };
auto newHandle = fileHandles.emplace_back(readFromFile<float>(sndFile, fileToLoad.numFrames));
fileToLoad.voice->setFileData(newHandle, fileToLoad.ticket);
std::lock_guard<std::mutex> guard { fileHandleMutex };
fileHandles.emplace_back(readFromFile<float>(sndFile, fileToLoad.numFrames));
fileToLoad.voice->setFileData(fileHandles.back(), fileToLoad.ticket);
}
}
@ -143,7 +143,7 @@ void sfz::FilePool::garbageThread() noexcept
for (auto handle = fileHandles.begin(); handle < fileHandles.end();) {
if (handle->use_count() == 1) {
handle->reset();
std::lock_guard guard { fileHandleMutex };
std::lock_guard<std::mutex> guard { fileHandleMutex };
std::iter_swap(handle, fileHandles.end() - 1);
fileHandles.pop_back();
} else {

View file

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

View file

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

View file

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

View file

@ -1,9 +1,9 @@
#pragma once
#ifdef __cplusplus
#if (__cplusplus >= 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L)
#if (__cplusplus >= 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
#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
#include <experimental/filesystem>
namespace std {

View file

@ -1,9 +1,11 @@
#pragma once
#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
#else
#define SFZ_HAVE_CXX17 0
#define SFZ_INLINE
#endif
#else