From 19c2b0fe2bc3769c7f2c35535d40c7bb0c0fdcc1 Mon Sep 17 00:00:00 2001 From: Nana <469449812@qq.com> Date: Mon, 25 Mar 2024 06:17:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dmacos=E7=BC=96=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 3 +-- core/audio/misc/audio_buffer.cpp | 2 +- core/extern.h | 4 ++++ core/misc/lib_load.h | 2 +- core/misc/singleton/singleton_manager.cpp | 4 +++- third_party/mempool/extern.h | 4 ++++ third_party/mempool/mempool/unistd.h | 2 +- 7 files changed, 15 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 628f937..1a720d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,9 +57,8 @@ function(retrieve_files path out_files) endfunction() # setup rtaudio -set(RTAUDIO_API_ASIO ON CACHE BOOL "" FORCE) - if (WIN32) + set(RTAUDIO_API_ASIO ON CACHE BOOL "" FORCE) set(RTAUDIO_API_WASAPI ON CACHE BOOL "" FORCE) set(RTAUDIO_API_DS OFF CACHE BOOL "" FORCE) elseif(APPLE) diff --git a/core/audio/misc/audio_buffer.cpp b/core/audio/misc/audio_buffer.cpp index a68c3c3..b25e42f 100644 --- a/core/audio/misc/audio_buffer.cpp +++ b/core/audio/misc/audio_buffer.cpp @@ -13,7 +13,7 @@ void audio_buffer::resize(uint32_t channel_num, uint32_t block_size) { void audio_buffer::clear() { std::scoped_lock lock(lock_); for (auto& channel : buffer_) { - std::fill(channel.begin(), channel.end(), 0.f); + std::memset(channel.data(), 0, channel.size() * sizeof(float)); } } diff --git a/core/extern.h b/core/extern.h index 2e9ef2e..d1ca202 100644 --- a/core/extern.h +++ b/core/extern.h @@ -1,7 +1,11 @@ #pragma once +#ifdef WIN32 #ifdef core_EXPORTS #define CORE_API __declspec(dllexport) #else #define CORE_API __declspec(dllimport) #endif +#else +#define CORE_API +#endif \ No newline at end of file diff --git a/core/misc/lib_load.h b/core/misc/lib_load.h index c449848..a5797be 100644 --- a/core/misc/lib_load.h +++ b/core/misc/lib_load.h @@ -18,7 +18,7 @@ public: #ifdef _WIN32 hModule = LoadLibraryA(library_path.c_str()); #else - handle = dlopen(libraryPath.c_str(), RTLD_LAZY); + handle = dlopen(library_path.c_str(), RTLD_LAZY); #endif if (!get_handle()) { spdlog::error("Failed to load library: {}", library_path); diff --git a/core/misc/singleton/singleton_manager.cpp b/core/misc/singleton/singleton_manager.cpp index b1b60f7..2441514 100644 --- a/core/misc/singleton/singleton_manager.cpp +++ b/core/misc/singleton/singleton_manager.cpp @@ -1,7 +1,9 @@ #include "singleton_manager.h" #include - +#ifdef __APPLE__ +#include <__algorithm/ranges_find.h> +#endif #include "singleton.h" bool singleton_initliazer::has_init(singleton* s) { diff --git a/third_party/mempool/extern.h b/third_party/mempool/extern.h index b5718f3..0fd6f8b 100644 --- a/third_party/mempool/extern.h +++ b/third_party/mempool/extern.h @@ -1,7 +1,11 @@ #pragma once +#ifdef WIN32 #ifdef mempool_EXPORTS #define MEMPOOL_API __declspec(dllexport) #else #define MEMPOOL_API __declspec(dllimport) #endif +#else +#define MEMPOOL_API +#endif \ No newline at end of file diff --git a/third_party/mempool/mempool/unistd.h b/third_party/mempool/mempool/unistd.h index d8558ed..1cbfd7c 100644 --- a/third_party/mempool/mempool/unistd.h +++ b/third_party/mempool/mempool/unistd.h @@ -8,5 +8,5 @@ inline uintptr_t getpagesize() { return systemInfo.dwPageSize; } #else -#include +#include #endif \ No newline at end of file