mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-22 00:06:59 +02:00
Merge branch 'dev' into dev-0.12
This commit is contained in:
+22
-12
@@ -69,7 +69,7 @@ option(MINIAUDIO_NO_NEON "Disable NEON optimizations"
|
|||||||
option(MINIAUDIO_NO_RUNTIME_LINKING "Disable runtime linking" OFF)
|
option(MINIAUDIO_NO_RUNTIME_LINKING "Disable runtime linking" OFF)
|
||||||
option(MINIAUDIO_USE_STDINT "Use <stdint.h> for sized types" OFF)
|
option(MINIAUDIO_USE_STDINT "Use <stdint.h> for sized types" OFF)
|
||||||
option(MINIAUDIO_DEBUG_OUTPUT "Enable stdout debug output" OFF)
|
option(MINIAUDIO_DEBUG_OUTPUT "Enable stdout debug output" OFF)
|
||||||
|
option(MINIAUDIO_INSTALL "Enable installation targets" ON)
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
@@ -519,7 +519,9 @@ add_library(miniaudio
|
|||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND LIBS_TO_INSTALL miniaudio)
|
list(APPEND LIBS_TO_INSTALL miniaudio)
|
||||||
install(FILES miniaudio.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/miniaudio)
|
if(MINIAUDIO_INSTALL)
|
||||||
|
install(FILES miniaudio.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/miniaudio)
|
||||||
|
endif()
|
||||||
|
|
||||||
target_include_directories(miniaudio PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
target_include_directories(miniaudio PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
target_compile_options (miniaudio PRIVATE ${COMPILE_OPTIONS})
|
target_compile_options (miniaudio PRIVATE ${COMPILE_OPTIONS})
|
||||||
@@ -563,7 +565,9 @@ if(HAS_LIBVORBIS)
|
|||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND LIBS_TO_INSTALL miniaudio_libvorbis)
|
list(APPEND LIBS_TO_INSTALL miniaudio_libvorbis)
|
||||||
install(FILES extras/decoders/libvorbis/miniaudio_libvorbis.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/miniaudio/extras/decoders/libvorbis)
|
if(MINIAUDIO_INSTALL)
|
||||||
|
install(FILES extras/decoders/libvorbis/miniaudio_libvorbis.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/miniaudio/extras/decoders/libvorbis)
|
||||||
|
endif()
|
||||||
|
|
||||||
target_compile_options (miniaudio_libvorbis PRIVATE ${COMPILE_OPTIONS})
|
target_compile_options (miniaudio_libvorbis PRIVATE ${COMPILE_OPTIONS})
|
||||||
target_compile_definitions(miniaudio_libvorbis PRIVATE ${COMPILE_DEFINES})
|
target_compile_definitions(miniaudio_libvorbis PRIVATE ${COMPILE_DEFINES})
|
||||||
@@ -590,7 +594,9 @@ if(HAS_LIBOPUS)
|
|||||||
|
|
||||||
|
|
||||||
list(APPEND LIBS_TO_INSTALL miniaudio_libopus)
|
list(APPEND LIBS_TO_INSTALL miniaudio_libopus)
|
||||||
install(FILES extras/decoders/libopus/miniaudio_libopus.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/miniaudio/extras/decoders/libopus)
|
if(MINIAUDIO_INSTALL)
|
||||||
|
install(FILES extras/decoders/libopus/miniaudio_libopus.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/miniaudio/extras/decoders/libopus)
|
||||||
|
endif()
|
||||||
|
|
||||||
target_compile_options (miniaudio_libopus PRIVATE ${COMPILE_OPTIONS})
|
target_compile_options (miniaudio_libopus PRIVATE ${COMPILE_OPTIONS})
|
||||||
target_compile_definitions(miniaudio_libopus PRIVATE ${COMPILE_DEFINES})
|
target_compile_definitions(miniaudio_libopus PRIVATE ${COMPILE_DEFINES})
|
||||||
@@ -609,7 +615,9 @@ if(NOT MINIAUDIO_NO_EXTRA_NODES)
|
|||||||
|
|
||||||
list(APPEND libs miniaudio_${name}_node)
|
list(APPEND libs miniaudio_${name}_node)
|
||||||
set(LIBS_TO_INSTALL "${libs}" PARENT_SCOPE) # without PARENT_SCOPE, any changes are lost
|
set(LIBS_TO_INSTALL "${libs}" PARENT_SCOPE) # without PARENT_SCOPE, any changes are lost
|
||||||
install(FILES extras/nodes/ma_${name}_node/ma_${name}_node.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/miniaudio/extras/nodes/ma_${name}_node)
|
if(MINIAUDIO_INSTALL)
|
||||||
|
install(FILES extras/nodes/ma_${name}_node/ma_${name}_node.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/miniaudio/extras/nodes/ma_${name}_node)
|
||||||
|
endif()
|
||||||
|
|
||||||
target_include_directories(miniaudio_${name}_node PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/extras/nodes/ma_${name}_node)
|
target_include_directories(miniaudio_${name}_node PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/extras/nodes/ma_${name}_node)
|
||||||
target_compile_options (miniaudio_${name}_node PRIVATE ${COMPILE_OPTIONS})
|
target_compile_options (miniaudio_${name}_node PRIVATE ${COMPILE_OPTIONS})
|
||||||
@@ -912,11 +920,13 @@ string(JOIN " " MINIAUDIO_PC_LIBS_PRIVATE ${COMMON_LINK_LIBRARIES})
|
|||||||
|
|
||||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/miniaudio.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/miniaudio.pc" @ONLY)
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/miniaudio.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/miniaudio.pc" @ONLY)
|
||||||
|
|
||||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/miniaudio.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
if(MINIAUDIO_INSTALL)
|
||||||
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/miniaudio.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
||||||
|
|
||||||
message(STATUS "Library list: ${LIBS_TO_INSTALL}")
|
message(STATUS "Library list: ${LIBS_TO_INSTALL}")
|
||||||
install(TARGETS ${LIBS_TO_INSTALL}
|
install(TARGETS ${LIBS_TO_INSTALL}
|
||||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
)
|
)
|
||||||
|
endif()
|
||||||
|
|||||||
+25
-26
@@ -3871,7 +3871,7 @@ typedef ma_uint16 wchar_t;
|
|||||||
|
|
||||||
|
|
||||||
/* Platform/backend detection. */
|
/* Platform/backend detection. */
|
||||||
#if defined(_WIN32) || defined(__COSMOPOLITAN__)
|
#if defined(_WIN32)
|
||||||
#define MA_WIN32
|
#define MA_WIN32
|
||||||
#if defined(MA_FORCE_UWP) || (defined(WINAPI_FAMILY) && ((defined(WINAPI_FAMILY_PC_APP) && WINAPI_FAMILY == WINAPI_FAMILY_PC_APP) || (defined(WINAPI_FAMILY_PHONE_APP) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)))
|
#if defined(MA_FORCE_UWP) || (defined(WINAPI_FAMILY) && ((defined(WINAPI_FAMILY_PC_APP) && WINAPI_FAMILY == WINAPI_FAMILY_PC_APP) || (defined(WINAPI_FAMILY_PHONE_APP) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)))
|
||||||
#define MA_WIN32_UWP
|
#define MA_WIN32_UWP
|
||||||
@@ -11380,7 +11380,7 @@ IMPLEMENTATION
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Intrinsics Support */
|
/* Intrinsics Support */
|
||||||
#if (defined(MA_X64) || defined(MA_X86)) && !defined(__COSMOPOLITAN__)
|
#if defined(MA_X64) || defined(MA_X86)
|
||||||
#if defined(_MSC_VER) && !defined(__clang__)
|
#if defined(_MSC_VER) && !defined(__clang__)
|
||||||
/* MSVC. */
|
/* MSVC. */
|
||||||
#if _MSC_VER >= 1400 && !defined(MA_NO_SSE2) /* 2005 */
|
#if _MSC_VER >= 1400 && !defined(MA_NO_SSE2) /* 2005 */
|
||||||
@@ -11817,7 +11817,7 @@ static MA_INLINE unsigned int ma_disable_denormals(void)
|
|||||||
}
|
}
|
||||||
#elif defined(MA_X86) || defined(MA_X64)
|
#elif defined(MA_X86) || defined(MA_X64)
|
||||||
{
|
{
|
||||||
#if defined(MA_SUPPORT_SSE2) && defined(__SSE2__) && !(defined(__TINYC__) || defined(__WATCOMC__) || defined(__COSMOPOLITAN__)) /* <-- Add compilers that lack support for _mm_getcsr() and _mm_setcsr() to this list. */
|
#if defined(MA_SUPPORT_SSE2) && defined(__SSE2__) && !(defined(__TINYC__) || defined(__WATCOMC__)) /* <-- Add compilers that lack support for _mm_getcsr() and _mm_setcsr() to this list. */
|
||||||
{
|
{
|
||||||
prevState = _mm_getcsr();
|
prevState = _mm_getcsr();
|
||||||
_mm_setcsr(prevState | MA_MM_DENORMALS_ZERO_MASK | MA_MM_FLUSH_ZERO_MASK);
|
_mm_setcsr(prevState | MA_MM_DENORMALS_ZERO_MASK | MA_MM_FLUSH_ZERO_MASK);
|
||||||
@@ -11857,7 +11857,7 @@ static MA_INLINE void ma_restore_denormals(unsigned int prevState)
|
|||||||
}
|
}
|
||||||
#elif defined(MA_X86) || defined(MA_X64)
|
#elif defined(MA_X86) || defined(MA_X64)
|
||||||
{
|
{
|
||||||
#if defined(MA_SUPPORT_SSE2) && defined(__SSE2__) && !(defined(__TINYC__) || defined(__WATCOMC__) || defined(__COSMOPOLITAN__)) /* <-- Add compilers that lack support for _mm_getcsr() and _mm_setcsr() to this list. */
|
#if defined(MA_SUPPORT_SSE2) && defined(__SSE2__) && !(defined(__TINYC__) || defined(__WATCOMC__)) /* <-- Add compilers that lack support for _mm_getcsr() and _mm_setcsr() to this list. */
|
||||||
{
|
{
|
||||||
_mm_setcsr(prevState);
|
_mm_setcsr(prevState);
|
||||||
}
|
}
|
||||||
@@ -17318,7 +17318,7 @@ static ma_result ma_thread_create__posix(ma_thread* pThread, ma_thread_priority
|
|||||||
int priorityStep = (priorityMax - priorityMin) / 7; /* 7 = number of priorities supported by miniaudio. */
|
int priorityStep = (priorityMax - priorityMin) / 7; /* 7 = number of priorities supported by miniaudio. */
|
||||||
|
|
||||||
struct sched_param sched;
|
struct sched_param sched;
|
||||||
if (pthread_attr_getschedparam(&attr, &sched) == 0) {
|
if (priorityMin != -1 && priorityMax != -1 && pthread_attr_getschedparam(&attr, &sched) == 0) {
|
||||||
if (priority == ma_thread_priority_idle) {
|
if (priority == ma_thread_priority_idle) {
|
||||||
sched.sched_priority = priorityMin;
|
sched.sched_priority = priorityMin;
|
||||||
} else if (priority == ma_thread_priority_realtime) {
|
} else if (priority == ma_thread_priority_realtime) {
|
||||||
@@ -19342,16 +19342,12 @@ BACKENDS
|
|||||||
#if defined(MA_WIN32_DESKTOP) /* DirectSound and WinMM backends are only supported on desktops. */
|
#if defined(MA_WIN32_DESKTOP) /* DirectSound and WinMM backends are only supported on desktops. */
|
||||||
#define MA_SUPPORT_DSOUND
|
#define MA_SUPPORT_DSOUND
|
||||||
#define MA_SUPPORT_WINMM
|
#define MA_SUPPORT_WINMM
|
||||||
|
#define MA_SUPPORT_JACK /* JACK is technically supported on Windows, but I don't know how many people use it in practice... */
|
||||||
/* Don't enable JACK here if compiling with Cosmopolitan. It'll be enabled in the Linux section below. */
|
|
||||||
#if !defined(__COSMOPOLITAN__)
|
|
||||||
#define MA_SUPPORT_JACK /* JACK is technically supported on Windows, but I don't know how many people use it in practice... */
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if defined(MA_UNIX) && !defined(MA_ORBIS) && !defined(MA_PROSPERO)
|
#if defined(MA_UNIX) && !defined(MA_ORBIS) && !defined(MA_PROSPERO)
|
||||||
#if defined(MA_LINUX)
|
#if defined(MA_LINUX)
|
||||||
#if !defined(MA_ANDROID) && !defined(__COSMOPOLITAN__) /* ALSA is not supported on Android. */
|
#if !defined(MA_ANDROID) && !defined(MA_EMSCRIPTEN) /* ALSA is not supported on Android. */
|
||||||
#define MA_SUPPORT_ALSA
|
#define MA_SUPPORT_ALSA
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@@ -63029,7 +63025,6 @@ static ma_result ma_default_vfs_info(ma_vfs* pVFS, ma_vfs_file file, ma_file_inf
|
|||||||
|
|
||||||
if (result == MA_NOT_IMPLEMENTED) {
|
if (result == MA_NOT_IMPLEMENTED) {
|
||||||
/* Not implemented. Fall back to seek/tell/seek. */
|
/* Not implemented. Fall back to seek/tell/seek. */
|
||||||
ma_result result;
|
|
||||||
ma_int64 cursor;
|
ma_int64 cursor;
|
||||||
ma_int64 sizeInBytes;
|
ma_int64 sizeInBytes;
|
||||||
|
|
||||||
@@ -73780,8 +73775,6 @@ static ma_result ma_job_process__resource_manager__free_data_buffer_node(ma_job*
|
|||||||
return ma_resource_manager_post_job(pResourceManager, pJob); /* Out of order. */
|
return ma_resource_manager_post_job(pResourceManager, pJob); /* Out of order. */
|
||||||
}
|
}
|
||||||
|
|
||||||
ma_resource_manager_data_buffer_node_free(pResourceManager, pDataBufferNode);
|
|
||||||
|
|
||||||
/* The event needs to be signalled last. */
|
/* The event needs to be signalled last. */
|
||||||
if (pJob->data.resourceManager.freeDataBufferNode.pDoneNotification != NULL) {
|
if (pJob->data.resourceManager.freeDataBufferNode.pDoneNotification != NULL) {
|
||||||
ma_async_notification_signal(pJob->data.resourceManager.freeDataBufferNode.pDoneNotification);
|
ma_async_notification_signal(pJob->data.resourceManager.freeDataBufferNode.pDoneNotification);
|
||||||
@@ -73792,6 +73785,9 @@ static ma_result ma_job_process__resource_manager__free_data_buffer_node(ma_job*
|
|||||||
}
|
}
|
||||||
|
|
||||||
ma_atomic_fetch_add_32(&pDataBufferNode->executionPointer, 1);
|
ma_atomic_fetch_add_32(&pDataBufferNode->executionPointer, 1);
|
||||||
|
|
||||||
|
ma_resource_manager_data_buffer_node_free(pResourceManager, pDataBufferNode);
|
||||||
|
|
||||||
return MA_SUCCESS;
|
return MA_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83344,7 +83340,7 @@ MA_PRIVATE ma_bool32 ma_dr_wav__on_seek_memory_write(void* pUserData, int offset
|
|||||||
newCursor = (ma_int64)pWav->memoryStreamWrite.dataSize;
|
newCursor = (ma_int64)pWav->memoryStreamWrite.dataSize;
|
||||||
} else {
|
} else {
|
||||||
MA_DR_WAV_ASSERT(!"Invalid seek origin");
|
MA_DR_WAV_ASSERT(!"Invalid seek origin");
|
||||||
return MA_INVALID_ARGS;
|
return MA_FALSE;
|
||||||
}
|
}
|
||||||
newCursor += offset;
|
newCursor += offset;
|
||||||
if (newCursor < 0) {
|
if (newCursor < 0) {
|
||||||
@@ -86643,7 +86639,7 @@ static MA_INLINE ma_uint32 ma_dr_flac__clz_lzcnt(ma_dr_flac_cache_t x)
|
|||||||
);
|
);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
#elif defined(MA_ARM) && (defined(__ARM_ARCH) && __ARM_ARCH >= 5) && !defined(__ARM_ARCH_6M__) && !defined(MA_64BIT)
|
#elif defined(MA_ARM) && (defined(__ARM_ARCH) && __ARM_ARCH >= 5) && !defined(__ARM_ARCH_6M__) && !(defined(__thumb__) && !defined(__thumb2__)) && !defined(MA_64BIT)
|
||||||
{
|
{
|
||||||
unsigned int r;
|
unsigned int r;
|
||||||
__asm__ __volatile__ (
|
__asm__ __volatile__ (
|
||||||
@@ -95530,19 +95526,22 @@ static ma_bool32 ma_dr_mp3_init_internal(ma_dr_mp3* pMP3, ma_dr_mp3_read_proc on
|
|||||||
((ma_uint32)ape[25] << 8) |
|
((ma_uint32)ape[25] << 8) |
|
||||||
((ma_uint32)ape[26] << 16) |
|
((ma_uint32)ape[26] << 16) |
|
||||||
((ma_uint32)ape[27] << 24);
|
((ma_uint32)ape[27] << 24);
|
||||||
streamEndOffset -= 32 + tagSize;
|
if (32 + tagSize < streamLen) {
|
||||||
streamLen -= 32 + tagSize;
|
streamEndOffset -= 32 + tagSize;
|
||||||
if (onMeta != NULL) {
|
streamLen -= 32 + tagSize;
|
||||||
if (onSeek(pUserData, streamEndOffset, MA_DR_MP3_SEEK_END)) {
|
if (onMeta != NULL) {
|
||||||
size_t apeTagSize = (size_t)tagSize + 32;
|
if (onSeek(pUserData, streamEndOffset, MA_DR_MP3_SEEK_END)) {
|
||||||
ma_uint8* pTagData = (ma_uint8*)ma_dr_mp3_malloc(apeTagSize, pAllocationCallbacks);
|
size_t apeTagSize = (size_t)tagSize + 32;
|
||||||
if (pTagData != NULL) {
|
ma_uint8* pTagData = (ma_uint8*)ma_dr_mp3_malloc(apeTagSize, pAllocationCallbacks);
|
||||||
if (onRead(pUserData, pTagData, apeTagSize) == apeTagSize) {
|
if (pTagData != NULL) {
|
||||||
ma_dr_mp3__on_meta(pMP3, MA_DR_MP3_METADATA_TYPE_APE, pTagData, apeTagSize);
|
if (onRead(pUserData, pTagData, apeTagSize) == apeTagSize) {
|
||||||
|
ma_dr_mp3__on_meta(pMP3, MA_DR_MP3_METADATA_TYPE_APE, pTagData, apeTagSize);
|
||||||
|
}
|
||||||
|
ma_dr_mp3_free(pTagData, pAllocationCallbacks);
|
||||||
}
|
}
|
||||||
ma_dr_mp3_free(pTagData, pAllocationCallbacks);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user