summaryrefslogtreecommitdiff
path: root/CMake
diff options
context:
space:
mode:
authorlouist103 <35883445+louist103@users.noreply.github.com>2025-03-03 04:30:05 +0000
committerGitHub <noreply@github.com>2025-03-02 23:30:05 -0500
commit2d0942a1b187938f55d34c71e0965e37a70b1094 (patch)
treebed03c65603d8315216fe4bc8a46062464f9b765 /CMake
parent38db4492fd88f21bec18dac8f8e6160ec7adeed6 (diff)
Custom Audio Support (#778)
* Implement custom sequences and the audio editor. * Fix implicit function declaration `AudioEditor_GetReplacementSeq` * Fix mac again. * String and header cleanup * Oops * WIP ZIP Sound fonts * The game opens and audio seems to play correctly. Needs extensive testing. * Name sequences * Cleanup the SF importer a little. * XML Sequences good * Fix mac * Destructor * Bump submodule * Thread safe queue * Add WAV decoder * sequenceMap->mSequenceMap and a string fix * Streamed sequence importer * Add s16 sample processing. * Fix drwave define * Fix STB * Reorder the loading to enable custom sound fonts * New streamed solution * Bump exporter * Generate 1 minute long looping sequence. * Very long sample support (113 minutes or so) * MP3 Decoding * Don't byteswap the crc from XML. * WIP OGG * add windows cmake stuff (broken) and fixes to OGG * Just throw more cores at the problem * Dynamically allocate fontMap * Re-add OOB read fix from old branch * FLAC decoder, threads for the other compressed formats * Remove thread from class * timings * cleanup conflicts * update submodules * update submodules * update submodules * loop or not to loop * named audio XML * Update submodules * format * format again cause git didnt see it for some reason * move drlib to submodule * Update apt-deps.txt * Fix for new cmake * fix game interactor * Update macports-deps.txt * PR fixes and fix OTRExporter for mac * format * format * ifdef intrin header * Docs * use macro for preview * Small fixes * format * fix 2nd day clock town * Update exporter * Fix duplicate global in stubs.c * restore editor to use cvars again sadge * Format * warn if more than 255 sequences * use main seq player to avoid an overflow * fix the wrong seq playing in the editor again * 16 bit seqIds * fix shop crash * format * cleanups * Delete audio collection * Add entry to modern menu * Cleanup the audio collection * fix clock town randomization * format * format again * some fixes for custom audio (#1) * how I would sort the sequences (#2) clang one more forgot to revert Co-authored-by: mckinlee <mckinlee@ymail.com> * Adjustments to ocarina song types * stereo * format * Loop point support * Part of a PR review * Remove drlib submodule * Clarify change * Format * Add tag * switch to find_package * bump ZAPDTR * Milk bar day/night fix * x86 SIMD for aMixImpl * format * NEON * format * remove | 0x900 causing a crash * Asan fixes * add missing define for MSVC * Clock town fixes Co-authored-by: mckinlee <mckinlee@ymail.com> * format * Fix underscore logic in audio collection * Use torch sample XML format * fix font map size and format * quick fix * Update exporter * Opus * actions packages * fix it again? * Fix a few missed 16 bit masks * Remove unused stubs * Revert "Fix a few missed 16 bit masks" This reverts commit 7143c4ff92d23157a79a10b4ee62e93e35acb23e. * Opus decoding * Fixes for linux and other things * free opus data * format * Update FindOpusFile.cmake * bria's fix? * Update BenMenuBar.cpp * Update BenMenuBar.cpp * Split ocarina tabs * better error handling * Remove unused vectors * move audio editor to enhancements * Fix mac again? * Final cleanups * Format * extern C * Allow custom fanfares to be used in songs * format * WIP sf editor support * Format * Jacks fixes * Bump submodule * Archez's fixes * Format --------- Co-authored-by: mckinlee <mckinlee@ymail.com> Co-authored-by: Archez <archez39@me.com>
Diffstat (limited to 'CMake')
-rw-r--r--CMake/FindOgg.cmake61
-rw-r--r--CMake/FindOpus.cmake44
-rw-r--r--CMake/FindOpusFile.cmake55
-rw-r--r--CMake/FindVorbis.cmake210
4 files changed, 370 insertions, 0 deletions
diff --git a/CMake/FindOgg.cmake b/CMake/FindOgg.cmake
new file mode 100644
index 000000000..9cf5ce430
--- /dev/null
+++ b/CMake/FindOgg.cmake
@@ -0,0 +1,61 @@
+# - Find ogg
+# Find the native ogg includes and libraries
+#
+# OGG_INCLUDE_DIRS - where to find ogg.h, etc.
+# OGG_LIBRARIES - List of libraries when using ogg.
+# OGG_FOUND - True if ogg found.
+
+if (OGG_INCLUDE_DIR)
+ # Already in cache, be silent
+ set(OGG_FIND_QUIETLY TRUE)
+endif ()
+
+find_package (PkgConfig QUIET)
+pkg_check_modules (PC_OGG QUIET ogg>=1.3.0)
+
+set (OGG_VERSION ${PC_OGG_VERSION})
+
+find_path (OGG_INCLUDE_DIR ogg/ogg.h
+ HINTS
+ ${PC_OGG_INCLUDEDIR}
+ ${PC_OGG_INCLUDE_DIRS}
+ ${OGG_ROOT}
+ )
+# MSVC built ogg may be named ogg_static.
+# The provided project files name the library with the lib prefix.
+find_library (OGG_LIBRARY
+ NAMES
+ ogg
+ ogg_static
+ libogg
+ libogg_static
+ HINTS
+ ${PC_OGG_LIBDIR}
+ ${PC_OGG_LIBRARY_DIRS}
+ ${OGG_ROOT}
+ )
+# Handle the QUIETLY and REQUIRED arguments and set OGG_FOUND
+# to TRUE if all listed variables are TRUE.
+include (FindPackageHandleStandardArgs)
+find_package_handle_standard_args (Ogg
+ REQUIRED_VARS
+ OGG_LIBRARY
+ OGG_INCLUDE_DIR
+ VERSION_VAR
+ OGG_VERSION
+ )
+
+if (OGG_FOUND)
+ set (OGG_LIBRARIES ${OGG_LIBRARY})
+ set (OGG_INCLUDE_DIRS ${OGG_INCLUDE_DIR})
+
+ if(NOT TARGET Ogg::ogg)
+ add_library(Ogg::ogg UNKNOWN IMPORTED)
+ set_target_properties(Ogg::ogg PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${OGG_INCLUDE_DIRS}"
+ IMPORTED_LOCATION "${OGG_LIBRARIES}"
+ )
+ endif ()
+endif ()
+
+mark_as_advanced (OGG_INCLUDE_DIR OGG_LIBRARY)
diff --git a/CMake/FindOpus.cmake b/CMake/FindOpus.cmake
new file mode 100644
index 000000000..1e6e30d68
--- /dev/null
+++ b/CMake/FindOpus.cmake
@@ -0,0 +1,44 @@
+# - FindOpus.cmake
+# Find the native opus includes and libraries
+#
+# OPUS_INCLUDE_DIRS - where to find opus/opus.h, etc.
+# OPUS_LIBRARIES - List of libraries when using libopus(file).
+# OPUS_FOUND - True if libopus found.
+
+if(OPUS_INCLUDE_DIR AND OPUS_LIBRARY AND OPUSFILE_LIBRARY)
+ # Already in cache, be silent
+ set(OPUS_FIND_QUIETLY TRUE)
+endif(OPUS_INCLUDE_DIR AND OPUS_LIBRARY AND OPUSFILE_LIBRARY)
+
+find_path(OPUS_INCLUDE_DIR
+ NAMES opusfile.h
+ PATH_SUFFIXES opus
+)
+
+# MSVC built opus may be named opus_static
+# The provided project files name the library with the lib prefix.
+find_library(OPUS_LIBRARY
+ NAMES opus opus_static libopus libopus_static
+)
+#find_library(OPUSFILE_LIBRARY
+# NAMES opusfile opusfile_static libopusfile libopusfile_static
+#)
+
+# Handle the QUIETLY and REQUIRED arguments and set OPUS_FOUND
+# to TRUE if all listed variables are TRUE.
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Opus DEFAULT_MSG
+ OPUS_LIBRARY OPUS_INCLUDE_DIR
+)
+
+if(OPUS_FOUND)
+ set(OPUS_LIBRARIES ${OPUS_LIBRARY})
+ set(OPUS_INCLUDE_DIRS ${OPUS_INCLUDE_DIR})
+ if(NOT TARGET Opus::opus)
+ add_library(Opus::opus UNKNOWN IMPORTED)
+ set_target_properties(Opus::opus PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${OPUS_INCLUDE_DIRS}"
+ IMPORTED_LOCATION "${OPUS_LIBRARIES}"
+ )
+ endif()
+endif(OPUS_FOUND)
diff --git a/CMake/FindOpusFile.cmake b/CMake/FindOpusFile.cmake
new file mode 100644
index 000000000..26344becb
--- /dev/null
+++ b/CMake/FindOpusFile.cmake
@@ -0,0 +1,55 @@
+# FindOpusFile.cmake
+# Locate the libopusfile library and its dependencies (libopus and libogg).
+# Defines the following variables on success:
+# OPUSFILE_FOUND - Indicates if opusfile was found
+# OPUSFILE_INCLUDE_DIR - Directory containing opusfile.h
+# OPUSFILE_LIBRARY - Path to the opusfile library
+# OPUSFILE_LIBRARIES - Full list of libraries to link (opusfile, opus, ogg)
+
+# Search for the OpusFile header
+find_path(OPUSFILE_INCLUDE_DIR
+ NAMES opusfile.h
+ PATHS /usr/include/opus /usr/local/include/opus /opt/local/include/opus
+ DOC "Directory where opusfile.h is located"
+)
+
+# Search for the OpusFile library
+find_library(OPUSFILE_LIBRARY
+ NAMES opusfile
+ DOC "Path to the libopusfile library"
+)
+
+# Search for the Opus library (dependency of OpusFile)
+find_library(OPUS_LIBRARY
+ NAMES opus
+ DOC "Path to the libopus library (dependency of libopusfile)"
+)
+
+# Search for the Ogg library (dependency of OpusFile)
+find_library(OGG_LIBRARY
+ NAMES ogg
+ DOC "Path to the libogg library (dependency of libopusfile)"
+)
+
+# Check if all required components are found
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(OpusFile
+ REQUIRED_VARS OPUSFILE_LIBRARY OPUSFILE_INCLUDE_DIR OPUS_LIBRARY OGG_LIBRARY
+ VERSION_VAR OPUSFILE_VERSION
+)
+
+# Define an imported target if everything is found
+if (OPUSFILE_FOUND)
+ add_library(Opusfile::Opusfile INTERFACE IMPORTED)
+
+ set_target_properties(Opusfile::Opusfile PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${OPUSFILE_INCLUDE_DIR}"
+ INTERFACE_LINK_LIBRARIES "${OPUSFILE_LIBRARY};${OPUS_LIBRARY};${OGG_LIBRARY}"
+ )
+
+ # Optionally expose the include and libraries separately
+ set(OPUSFILE_LIBRARIES ${OPUSFILE_LIBRARY} ${OPUS_LIBRARY} ${OGG_LIBRARY})
+ set(OPUSFILE_INCLUDE_DIRS ${OPUSFILE_INCLUDE_DIR})
+else()
+ set(OPUSFILE_FOUND FALSE)
+endif()
diff --git a/CMake/FindVorbis.cmake b/CMake/FindVorbis.cmake
new file mode 100644
index 000000000..57e60557f
--- /dev/null
+++ b/CMake/FindVorbis.cmake
@@ -0,0 +1,210 @@
+#[=======================================================================[.rst:
+FindVorbis
+----------
+
+Finds the native vorbis, vorbisenc amd vorbisfile includes and libraries.
+
+Imported Targets
+^^^^^^^^^^^^^^^^
+
+This module provides the following imported targets, if found:
+
+``Vorbis::vorbis``
+ The Vorbis library
+``Vorbis::vorbisenc``
+ The VorbisEnc library
+``Vorbis::vorbisfile``
+ The VorbisFile library
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+This will define the following variables:
+
+``Vorbis_Vorbis_INCLUDE_DIRS``
+ List of include directories when using vorbis.
+``Vorbis_Enc_INCLUDE_DIRS``
+ List of include directories when using vorbisenc.
+``Vorbis_File_INCLUDE_DIRS``
+ List of include directories when using vorbisfile.
+``Vorbis_Vorbis_LIBRARIES``
+ List of libraries when using vorbis.
+``Vorbis_Enc_LIBRARIES``
+ List of libraries when using vorbisenc.
+``Vorbis_File_LIBRARIES``
+ List of libraries when using vorbisfile.
+``Vorbis_FOUND``
+ True if vorbis and requested components found.
+``Vorbis_Vorbis_FOUND``
+ True if vorbis found.
+``Vorbis_Enc_FOUND``
+ True if vorbisenc found.
+``Vorbis_Enc_FOUND``
+ True if vorbisfile found.
+
+Cache variables
+^^^^^^^^^^^^^^^
+
+The following cache variables may also be set:
+
+``Vorbis_Vorbis_INCLUDE_DIR``
+ The directory containing ``vorbis/vorbis.h``.
+``Vorbis_Enc_INCLUDE_DIR``
+ The directory containing ``vorbis/vorbisenc.h``.
+``Vorbis_File_INCLUDE_DIR``
+ The directory containing ``vorbis/vorbisenc.h``.
+``Vorbis_Vorbis_LIBRARY``
+ The path to the vorbis library.
+``Vorbis_Enc_LIBRARY``
+ The path to the vorbisenc library.
+``Vorbis_File_LIBRARY``
+ The path to the vorbisfile library.
+
+Hints
+^^^^^
+
+A user may set ``Vorbis_ROOT`` to a vorbis installation root to tell this module where to look.
+
+#]=======================================================================]
+
+if (Vorbis_Vorbis_INCLUDE_DIR)
+ # Already in cache, be silent
+ set (Vorbis_FIND_QUIETLY TRUE)
+endif ()
+
+set (Vorbis_Vorbis_FIND_QUIETLY TRUE)
+set (Vorbis_Enc_FIND_QUIETLY TRUE)
+set (Vorbis_File_FIND_QUIETLY TRUE)
+
+find_package (Ogg QUIET)
+
+find_package (PkgConfig QUIET)
+pkg_check_modules (PC_Vorbis_Vorbis QUIET vorbis)
+pkg_check_modules (PC_Vorbis_Enc QUIET vorbisenc)
+pkg_check_modules (PC_Vorbis_File QUIET vorbisfile)
+
+set (Vorbis_VERSION ${PC_Vorbis_Vorbis_VERSION})
+
+find_path (Vorbis_Vorbis_INCLUDE_DIR vorbis/codec.h
+ HINTS
+ ${PC_Vorbis_Vorbis_INCLUDEDIR}
+ ${PC_Vorbis_Vorbis_INCLUDE_DIRS}
+ ${Vorbis_ROOT}
+ )
+
+find_path (Vorbis_Enc_INCLUDE_DIR vorbis/vorbisenc.h
+ HINTS
+ ${PC_Vorbis_Enc_INCLUDEDIR}
+ ${PC_Vorbis_Enc_INCLUDE_DIRS}
+ ${Vorbis_ROOT}
+ )
+
+find_path (Vorbis_File_INCLUDE_DIR vorbis/vorbisfile.h
+ HINTS
+ ${PC_Vorbis_File_INCLUDEDIR}
+ ${PC_Vorbis_File_INCLUDE_DIRS}
+ ${Vorbis_ROOT}
+ )
+
+find_library (Vorbis_Vorbis_LIBRARY
+ NAMES
+ vorbis
+ vorbis_static
+ libvorbis
+ libvorbis_static
+ HINTS
+ ${PC_Vorbis_Vorbis_LIBDIR}
+ ${PC_Vorbis_Vorbis_LIBRARY_DIRS}
+ ${Vorbis_ROOT}
+ )
+
+find_library (Vorbis_Enc_LIBRARY
+ NAMES
+ vorbisenc
+ vorbisenc_static
+ libvorbisenc
+ libvorbisenc_static
+ HINTS
+ ${PC_Vorbis_Enc_LIBDIR}
+ ${PC_Vorbis_Enc_LIBRARY_DIRS}
+ ${Vorbis_ROOT}
+ )
+
+find_library (Vorbis_File_LIBRARY
+ NAMES
+ vorbisfile
+ vorbisfile_static
+ libvorbisfile
+ libvorbisfile_static
+ HINTS
+ ${PC_Vorbis_File_LIBDIR}
+ ${PC_Vorbis_File_LIBRARY_DIRS}
+ ${Vorbis_ROOT}
+ )
+
+include (FindPackageHandleStandardArgs)
+
+if (Vorbis_Vorbis_LIBRARY AND Vorbis_Vorbis_INCLUDE_DIR AND Ogg_FOUND)
+ set (Vorbis_Vorbis_FOUND TRUE)
+endif ()
+
+if (Vorbis_Enc_LIBRARY AND Vorbis_Enc_INCLUDE_DIR AND Vorbis_Vorbis_FOUND)
+ set (Vorbis_Enc_FOUND TRUE)
+endif ()
+
+if (Vorbis_Vorbis_FOUND AND Vorbis_File_LIBRARY AND Vorbis_File_INCLUDE_DIR)
+ set (Vorbis_File_FOUND TRUE)
+endif ()
+
+find_package_handle_standard_args (Vorbis
+ REQUIRED_VARS
+ Vorbis_Vorbis_LIBRARY
+ Vorbis_Vorbis_INCLUDE_DIR
+ Ogg_FOUND
+ HANDLE_COMPONENTS
+ VERSION_VAR Vorbis_VERSION)
+
+
+if (Vorbis_Vorbis_FOUND)
+ set (Vorbis_Vorbis_INCLUDE_DIRS ${VORBIS_INCLUDE_DIR})
+ set (Vorbis_Vorbis_LIBRARIES ${VORBIS_LIBRARY} ${OGG_LIBRARIES})
+ if (NOT TARGET Vorbis::vorbis)
+ add_library (Vorbis::vorbis UNKNOWN IMPORTED)
+ set_target_properties (Vorbis::vorbis PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${Vorbis_Vorbis_INCLUDE_DIR}"
+ IMPORTED_LOCATION "${Vorbis_Vorbis_LIBRARY}"
+ INTERFACE_LINK_LIBRARIES Ogg::ogg
+ )
+ endif ()
+
+ if (Vorbis_Enc_FOUND)
+ set (Vorbis_Enc_INCLUDE_DIRS ${Vorbis_Enc_INCLUDE_DIR})
+ set (Vorbis_Enc_LIBRARIES ${Vorbis_Enc_LIBRARY} ${Vorbis_Enc_LIBRARIES})
+ if (NOT TARGET Vorbis::vorbisenc)
+ add_library (Vorbis::vorbisenc UNKNOWN IMPORTED)
+ set_target_properties (Vorbis::vorbisenc PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${Vorbis_Enc_INCLUDE_DIR}"
+ IMPORTED_LOCATION "${Vorbis_Enc_LIBRARY}"
+ INTERFACE_LINK_LIBRARIES Vorbis::vorbis
+ )
+ endif ()
+ endif ()
+
+ if (Vorbis_File_FOUND)
+ set (Vorbis_File_INCLUDE_DIRS ${Vorbis_File_INCLUDE_DIR})
+ set (Vorbis_File_LIBRARIES ${Vorbis_File_LIBRARY} ${Vorbis_File_LIBRARIES})
+ if (NOT TARGET Vorbis::vorbisfile)
+ add_library (Vorbis::vorbisfile UNKNOWN IMPORTED)
+ set_target_properties (Vorbis::vorbisfile PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${Vorbis_File_INCLUDE_DIR}"
+ IMPORTED_LOCATION "${Vorbis_File_LIBRARY}"
+ INTERFACE_LINK_LIBRARIES Vorbis::vorbis
+ )
+ endif ()
+ endif ()
+
+endif ()
+
+mark_as_advanced (Vorbis_Vorbis_INCLUDE_DIR Vorbis_Vorbis_LIBRARY)
+mark_as_advanced (Vorbis_Enc_INCLUDE_DIR Vorbis_Enc_LIBRARY)
+mark_as_advanced (Vorbis_File_INCLUDE_DIR Vorbis_File_LIBRARY)