Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bramtayl committed Jun 19, 2024
1 parent ef154b9 commit 910c3f8
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 14 deletions.
52 changes: 45 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ project(Justly VERSION 0.3.11 LANGUAGES CXX)
# newer than version currently shipped by ubuntu
# install with qt instead

# download https://ftp.osuosl.org/pub/musescore/soundfont/MuseScore_General/MuseScore_General.sf2
# and put it into the share folder
# too big to commit to git

include(CheckCompilerFlag)
include(CheckLinkerFlag)
include(CPack)
Expand All @@ -26,6 +30,7 @@ set(CMAKE_BUILD_RPATH_USE_ORIGIN ON)
list(APPEND CMAKE_PREFIX_PATH C:/Users/brand/6.5.1/msvc2019_64)
list(APPEND CMAKE_PREFIX_PATH /home/brandon/6.5.1/gcc_64)

find_package(FLAC)
find_package(FluidSynth CONFIG REQUIRED)
find_package(nlohmann_json CONFIG REQUIRED)
find_package(nlohmann_json_schema_validator CONFIG REQUIRED)
Expand Down Expand Up @@ -64,6 +69,11 @@ else()
if (has_all_warnings)
add_compile_options(-Wall)
endif()

check_compiler_flag(CXX -Wextra has_all_warnings)
if (has_all_warnings)
add_compile_options(-Wextra)
endif()
endif()

if (TRACK_COVERAGE)
Expand All @@ -88,6 +98,13 @@ qt_add_library(JustlyLibrary SHARED ${Justly_sources})
# need C++ 17 for qt
target_compile_features(JustlyLibrary PUBLIC cxx_std_17)

# apple bundles have a different data folder
if (APPLE)
set(data_folder Resources)
else()
set(data_folder share)
endif()

# where to look for the soundfont file
target_compile_definitions(
JustlyLibrary PRIVATE
Expand All @@ -99,13 +116,6 @@ add_subdirectory(src)
# public headers
add_subdirectory(include)

# apple bundles have a different data folder
if (APPLE)
set(data_folder "Resources")
else()
set(data_folder "share")
endif()

# private include dir
target_include_directories(JustlyLibrary PRIVATE ${Justly_SOURCE_DIR})

Expand All @@ -131,6 +141,34 @@ install(TARGETS JustlyLibrary
FILE_SET justly_public_headers
)

install(RUNTIME_DEPENDENCY_SET RUNTIMES
PRE_INCLUDE_REGEXES
"FLAC"
"glib"
"iconv"
"intl"
"fluidsynth"
"mp3lame"
"mpg123"
"nlohmann_json_schema_validator"
"ogg"
"opus"
"pcre"
"sndfile"
"vorbis"
"vorbisenc"
PRE_EXCLUDE_REGEXES "."
# folders to look in for platforms without an rpath
DIRECTORIES
# vcpkg libraries
"${_VCPKG_INSTALLED_DIR}/{VCPKG_TARGET_TRIPLET}/lib"
)

if (WIN32)
# not getting picked up as a runtime dependency?
install(FILES "$<TARGET_FILE:FLAC::FLAC>" TYPE BIN)
endif()

# apple will deploy the library during the fixup bundle stage
if (NOT APPLE)
# qt deploy
Expand Down
16 changes: 9 additions & 7 deletions src/SongEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -811,14 +811,16 @@ auto SongEditor::beat_time() const -> double {
void SongEditor::start_real_time() {
fluid_settings_setint(settings_pointer, "synth.lock-memory", 1);

#ifdef __linux__
fluid_settings_setstr(settings_pointer, "audio.driver", "pulseaudio");
#else
char *default_driver = nullptr;
fluid_settings_getstr_default(settings_pointer, "audio.driver",
&default_driver);
fluid_settings_setstr(settings_pointer, "audio.driver", default_driver);
auto driver = "";
// choose driver based on platform
#if defined(__linux__)
driver = "pulseaudio";
#elif defined(_WIN32)
driver = "wasapi";
#elif defined(__APPLE__)
driver = "coreaudio";
#endif
fluid_settings_setstr(settings_pointer, "audio.driver", driver);

audio_driver_pointer =
new_fluid_audio_driver(settings_pointer, synth_pointer);
Expand Down

0 comments on commit 910c3f8

Please sign in to comment.