Skip to content

Commit

Permalink
Fix WV test on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
paulfd committed Aug 6, 2023
1 parent 2cd98c5 commit e4bdf53
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
6 changes: 3 additions & 3 deletions cmake/BuildType.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
STRING "Choose the type of build." FORCE)
endif()

# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
"MinSizeRel" "RelWithDebInfo")
endif()
4 changes: 2 additions & 2 deletions cmake/SfizzConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ endif()

# Process sources as UTF-8
if(MSVC)
add_compile_options("/utf-8")
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/utf-8>)
endif()

# Define the math constants everywhere
Expand Down Expand Up @@ -104,7 +104,7 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
endif()
endif()
elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
add_compile_options(/Zc:__cplusplus)
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/Zc:__cplusplus>)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()

Expand Down
14 changes: 12 additions & 2 deletions external/st_audiofile/src/st_audiofile.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
#include "st_audiofile_libs.h"
#include <stdlib.h>

#ifdef _WIN32
#include <windows.h>
#endif
#define WAVPACK_MEMORY_ASSUMED_VERSION 5

struct st_audio_file {
Expand Down Expand Up @@ -179,10 +182,17 @@ static st_audio_file* st_generic_open_file(const void* filename, int widepath)

// Try WV
{
af->wv =
#if defined(_WIN32)
WavpackOpenFileInput((const char*)filename, NULL, OPEN_FILE_UTF8, 0);
// WavPack expects an UTF8 input and has no widechar api, so we convert the filename back...
unsigned wsize = wcslen(filename);
unsigned size = WideCharToMultiByte(CP_UTF8, 0, filename, wsize, NULL, 0, 0, NULL, NULL);
char *buffer = (char*)malloc((size+1) * sizeof(char));
WideCharToMultiByte(CP_UTF8, 0, filename, wsize, buffer, size, NULL, NULL);
buffer[size] = '\0';
af->wv =
WavpackOpenFileInput(buffer, NULL, OPEN_FILE_UTF8, 0);
#else
af->wv =
WavpackOpenFileInput((const char*)filename, NULL, 0, 0);
#endif
if (af->wv) {
Expand Down
2 changes: 1 addition & 1 deletion src/sfizz/FilePool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ void sfz::FilePool::loadingJob(const QueuedFileData& data) noexcept
AudioReaderPtr reader = createAudioReader(file, id->isReverse(), &readError);

if (readError) {
DBG("[sfizz] libsndfile errored for " << *id << " with message " << readError.message());
DBG("[sfizz] reading the file errored for " << *id << " with code " << readError << ": " << readError.message());
return;
}

Expand Down

0 comments on commit e4bdf53

Please sign in to comment.