diff --git a/README.md b/README.md index f260b1ff2..6c6b1c6e5 100644 --- a/README.md +++ b/README.md @@ -113,20 +113,20 @@ YUP brings a suite of powerful features, including: ## Supported Sound Formats -| | **Wav** | **Wav64** | **Mp3** | **OGG** | **Flac** | **Opus** | **AAC** | **WMF** | -|-------------------|:------------------:|:------------------:|:------------------:|:--------------:|:------------------:|:------------------:|:------------------:|:--------------:| -| **Windows** (enc) | :white_check_mark: | :white_check_mark: | :white_check_mark: | :construction: | :white_check_mark: | :white_check_mark: | :construction: | :construction: | -| **Windows** (dec) | :white_check_mark: | :white_check_mark: | :construction: | :construction: | :white_check_mark: | :white_check_mark: | :construction: | :construction: | -| **macOS** (enc) | :white_check_mark: | :white_check_mark: | :white_check_mark: | :construction: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | -| **macOS** (dec) | :white_check_mark: | :white_check_mark: | :white_check_mark: | :construction: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | -| **Linux** (enc) | :white_check_mark: | :white_check_mark: | :white_check_mark: | :construction: | :white_check_mark: | :white_check_mark: | | | -| **Linux** (dec) | :white_check_mark: | :white_check_mark: | :construction: | :construction: | :white_check_mark: | :white_check_mark: | | | -| **WASM** (enc) | :white_check_mark: | :white_check_mark: | :white_check_mark: | :construction: | :white_check_mark: | :white_check_mark: | | | -| **WASM** (dec) | :white_check_mark: | :white_check_mark: | :construction: | :construction: | :white_check_mark: | :white_check_mark: | | | -| **Android** (enc) | :white_check_mark: | :white_check_mark: | :white_check_mark: | :construction: | :white_check_mark: | :white_check_mark: | | | -| **Android** (dec) | :white_check_mark: | :white_check_mark: | :construction: | :construction: | :white_check_mark: | :white_check_mark: | | | -| **iOS** (enc) | :white_check_mark: | :white_check_mark: | :white_check_mark: | :construction: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | -| **iOS** (dec) | :white_check_mark: | :white_check_mark: | :white_check_mark: | :construction: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | +| | **Wav** | **Wav64** | **Mp3** | **OGG** | **Flac** | **Opus** | **AAC** | **WMF** | +|-------------------|:------------------:|:------------------:|:------------------:|:------------------:|:------------------:|:------------------:|:------------------:|:------------------:| +| **Windows** (enc) | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| **Windows** (dec) | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| **macOS** (enc) | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | +| **macOS** (dec) | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | +| **Linux** (enc) | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | | +| **Linux** (dec) | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | | +| **WASM** (enc) | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | | +| **WASM** (dec) | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | | +| **Android** (enc) | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :construction: | | +| **Android** (dec) | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :construction: | | +| **iOS** (enc) | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | +| **iOS** (dec) | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | ## Prerequisites Before building, ensure you have a: diff --git a/cmake/yup_modules.cmake b/cmake/yup_modules.cmake index bc8cb3a36..4c0eea401 100644 --- a/cmake/yup_modules.cmake +++ b/cmake/yup_modules.cmake @@ -108,6 +108,8 @@ function (_yup_module_fetch_upstream module_name module_path module_upstream mod _yup_message (STATUS "Fetching upstream sources for ${module_name}") + set (upstream_target_dir "${CMAKE_BINARY_DIR}/externals/${module_name}") + if (module_upstream) set (download_dir "${CMAKE_BINARY_DIR}/_yup_upstream_downloads") file (MAKE_DIRECTORY "${download_dir}") @@ -139,11 +141,10 @@ function (_yup_module_fetch_upstream module_name module_path module_upstream mod endif() endif() - set (upstream_target_dir "${CMAKE_BINARY_DIR}/externals/${module_name}/upstream") - file (REMOVE_RECURSE "${upstream_target_dir}") - file (MAKE_DIRECTORY "${upstream_target_dir}") file (GLOB extracted_items "${source_dir}/*") if (extracted_items) + file (REMOVE_RECURSE "${upstream_target_dir}") + file (MAKE_DIRECTORY "${upstream_target_dir}") file (COPY ${extracted_items} DESTINATION "${upstream_target_dir}") endif() else() @@ -151,16 +152,15 @@ function (_yup_module_fetch_upstream module_name module_path module_upstream mod set (module_branch "HEAD") endif() - set (upstream_target_dir "${CMAKE_BINARY_DIR}/externals/${module_name}/upstream") if (module_submodules) set (module_submodules_recurse ON) else() set (module_submodules_recurse OFF) endif() - file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/externals/${module_name}") - file (REMOVE_RECURSE "${upstream_target_dir}") + file (MAKE_DIRECTORY "${upstream_target_dir}") + set (module_branch_value "${module_branch}") string (STRIP "${module_branch_value}" module_branch_value) string (REGEX REPLACE "^\"(.*)\"$" "\\1" module_branch_value "${module_branch_value}") @@ -208,7 +208,7 @@ function (_yup_module_fetch_upstream module_name module_path module_upstream mod list (APPEND clone_args "${module_repository}" "${upstream_target_dir}") execute_process ( COMMAND ${clone_args} - WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/externals/${module_name}" + WORKING_DIRECTORY "${upstream_target_dir}" RESULT_VARIABLE clone_result) endif() @@ -707,26 +707,29 @@ function (yup_add_module module_path modules_definitions module_group) # ==== Prepare include paths get_filename_component (module_include_path ${module_path} DIRECTORY) - list (APPEND module_include_paths "${module_include_path}") + list (APPEND module_include_paths "${module_include_path}" "${module_path}") if (module_upstream OR module_repository) _yup_module_get_upstream_path ("${module_name}" "${module_path}" module_upstream_path) if (module_upstream_path) - list (APPEND module_include_paths "${module_upstream_path}") + get_filename_component (module_upstream_include_path ${module_upstream_path} DIRECTORY) + list (APPEND module_include_paths "${module_upstream_path}" "${module_upstream_include_path}") else() - list (APPEND module_include_paths "${CMAKE_BINARY_DIR}/externals/${module_name}/upstream") + list (APPEND module_include_paths "${CMAKE_BINARY_DIR}/externals") endif() endif() foreach (searchpath IN LISTS module_searchpaths) - if (EXISTS "${searchpath}") - list (APPEND module_include_paths "${searchpath}") - elseif (EXISTS "${module_path}/${searchpath}") - list (APPEND module_include_paths "${module_path}/${searchpath}") - elseif (module_upstream_path AND EXISTS "${module_upstream_path}/${searchpath}") + if (module_upstream_path AND EXISTS "${module_upstream_path}/${searchpath}") list (APPEND module_include_paths "${module_upstream_path}/${searchpath}") elseif (module_upstream OR module_repository) - list (APPEND module_include_paths "${CMAKE_BINARY_DIR}/externals/${module_name}/upstream/${searchpath}") + if (EXISTS "${CMAKE_BINARY_DIR}/externals/${module_name}/${searchpath}") + list (APPEND module_include_paths "${CMAKE_BINARY_DIR}/externals/${module_name}/${searchpath}") + endif() + elseif (EXISTS "${module_path}/${searchpath}") + list (APPEND module_include_paths "${module_path}/${searchpath}") + elseif (EXISTS "${searchpath}") + list (APPEND module_include_paths "${searchpath}") endif() endforeach() @@ -821,60 +824,25 @@ macro (yup_add_default_modules modules_path) # ==== Thirdparty modules set (thirdparty_group "Thirdparty") - yup_add_module (${modules_path}/thirdparty/zlib "${modules_definitions}" ${thirdparty_group}) - yup_add_module (${modules_path}/thirdparty/glad "${modules_definitions}" ${thirdparty_group}) - yup_add_module (${modules_path}/thirdparty/harfbuzz "${modules_definitions}" ${thirdparty_group}) - yup_add_module (${modules_path}/thirdparty/libpng "${modules_definitions}" ${thirdparty_group}) - yup_add_module (${modules_path}/thirdparty/libwebp "${modules_definitions}" ${thirdparty_group}) - yup_add_module (${modules_path}/thirdparty/sheenbidi "${modules_definitions}" ${thirdparty_group}) - yup_add_module (${modules_path}/thirdparty/yoga_library "${modules_definitions}" ${thirdparty_group}) - yup_add_module (${modules_path}/thirdparty/rive "${modules_definitions}" ${thirdparty_group}) - yup_add_module (${modules_path}/thirdparty/rive_decoders "${modules_definitions}" ${thirdparty_group}) - yup_add_module (${modules_path}/thirdparty/rive_renderer "${modules_definitions}" ${thirdparty_group}) - yup_add_module (${modules_path}/thirdparty/oboe_library "${modules_definitions}" ${thirdparty_group}) - yup_add_module (${modules_path}/thirdparty/pffft_library "${modules_definitions}" ${thirdparty_group}) - yup_add_module (${modules_path}/thirdparty/dr_libs "${modules_definitions}" ${thirdparty_group}) - yup_add_module (${modules_path}/thirdparty/opus_library "${modules_definitions}" ${thirdparty_group}) - yup_add_module (${modules_path}/thirdparty/flac_library "${modules_definitions}" ${thirdparty_group}) - yup_add_module (${modules_path}/thirdparty/hmp3_library "${modules_definitions}" ${thirdparty_group}) + file (GLOB thirdparty_module_dirs "${modules_path}/thirdparty/*") + foreach (thirdparty_module_dir IN LISTS thirdparty_module_dirs) + if (IS_DIRECTORY "${thirdparty_module_dir}") + get_filename_component (module_dir_name "${thirdparty_module_dir}" NAME) + yup_add_module (${modules_path}/thirdparty/${module_dir_name} "${modules_definitions}" ${thirdparty_group}) + endif() + endforeach() # ==== Yup modules set (modules_group "Modules") - yup_add_module (${modules_path}/modules/yup_core "${modules_definitions}" ${modules_group}) - add_library (yup::yup_core ALIAS yup_core) - - yup_add_module (${modules_path}/modules/yup_events "${modules_definitions}" ${modules_group}) - add_library (yup::yup_events ALIAS yup_events) - - yup_add_module (${modules_path}/modules/yup_data_model "${modules_definitions}" ${modules_group}) - add_library (yup::yup_data_model ALIAS yup_data_model) - - yup_add_module (${modules_path}/modules/yup_dsp "${modules_definitions}" ${modules_group}) - add_library (yup::yup_dsp ALIAS yup_dsp) - - yup_add_module (${modules_path}/modules/yup_graphics "${modules_definitions}" ${modules_group}) - add_library (yup::yup_graphics ALIAS yup_graphics) - - yup_add_module (${modules_path}/modules/yup_gui "${modules_definitions}" ${modules_group}) - add_library (yup::yup_gui ALIAS yup_gui) - - yup_add_module (${modules_path}/modules/yup_audio_basics "${modules_definitions}" ${modules_group}) - add_library (yup::yup_audio_basics ALIAS yup_audio_basics) - - yup_add_module (${modules_path}/modules/yup_audio_devices "${modules_definitions}" ${modules_group}) - add_library (yup::yup_audio_devices ALIAS yup_audio_devices) - - yup_add_module (${modules_path}/modules/yup_audio_formats "${modules_definitions}" ${modules_group}) - add_library (yup::yup_audio_formats ALIAS yup_audio_formats) - - yup_add_module (${modules_path}/modules/yup_audio_processors "${modules_definitions}" ${modules_group}) - add_library (yup::yup_audio_processors ALIAS yup_audio_processors) - - yup_add_module (${modules_path}/modules/yup_audio_gui "${modules_definitions}" ${modules_group}) - add_library (yup::yup_audio_gui ALIAS yup_audio_gui) - - yup_add_module (${modules_path}/modules/yup_audio_plugin_client "${modules_definitions}" ${modules_group}) - add_library (yup::yup_audio_plugin_client ALIAS yup_audio_plugin_client) + file (GLOB yup_module_dirs "${modules_path}/modules/*") + list (FILTER yup_module_dirs EXCLUDE REGEX ".*yup_python.*") + foreach (yup_module_dir IN LISTS yup_module_dirs) + if (IS_DIRECTORY "${yup_module_dir}") + get_filename_component (module_dir_name "${yup_module_dir}" NAME) + yup_add_module (${modules_path}/modules/${module_dir_name} "${modules_definitions}" ${modules_group}) + add_library (yup::${module_dir_name} ALIAS ${module_dir_name}) + endif() + endforeach() if (YUP_ARG_ENABLE_PYTHON) if (NOT YUP_BUILD_WHEEL) diff --git a/cmake/yup_utilities.cmake b/cmake/yup_utilities.cmake index b23d4d178..50056cddd 100644 --- a/cmake/yup_utilities.cmake +++ b/cmake/yup_utilities.cmake @@ -206,21 +206,17 @@ endfunction() #============================================================================== function (_yup_collect_upstream_candidate_paths module_name module_path output_variable) - set (candidate_paths "${module_path}/upstream") + set (candidate_paths + "${module_path}/upstream" + "${CMAKE_SOURCE_DIR}/build/externals/${module_name}") - if (DEFINED YUP_UPSTREAM_ROOT AND NOT "${YUP_UPSTREAM_ROOT}" STREQUAL "") - list (APPEND candidate_paths "${YUP_UPSTREAM_ROOT}/${module_name}/upstream") - endif() - - if (CMAKE_SOURCE_DIR) - list (APPEND candidate_paths "${CMAKE_SOURCE_DIR}/build/externals/${module_name}/upstream") - list (APPEND candidate_paths "${CMAKE_SOURCE_DIR}/../build/externals/${module_name}/upstream") - endif() + get_filename_component (parent_candidate_path "${CMAKE_SOURCE_DIR}/../build/externals/${module_name}" REALPATH) + list (APPEND candidate_paths "${parent_candidate_path}") set (candidate_root "${CMAKE_BINARY_DIR}") set (max_depth 10) while (max_depth GREATER 0) - list (APPEND candidate_paths "${candidate_root}/externals/${module_name}/upstream") + list (APPEND candidate_paths "${candidate_root}/externals/${module_name}") get_filename_component (candidate_parent "${candidate_root}" DIRECTORY) if ("${candidate_parent}" STREQUAL "${candidate_root}") @@ -234,6 +230,8 @@ function (_yup_collect_upstream_candidate_paths module_name module_path output_v set (${output_variable} "${candidate_paths}" PARENT_SCOPE) endfunction() +#============================================================================== + function (_yup_resolve_variable_paths input_list output_list) set (resolved_list "") @@ -293,16 +291,9 @@ function (_yup_convert_png_to_icns png_path icons_path output_variable) file (REMOVE_RECURSE "${temp_iconset_path}") file (MAKE_DIRECTORY "${temp_iconset_path}") - _yup_execute_process_or_fail (/usr/bin/sips -z 16 16 "${png_path}" --out "${temp_iconset_path}/icon_16x16.png") - _yup_execute_process_or_fail (/usr/bin/sips -z 32 32 "${png_path}" --out "${temp_iconset_path}/icon_32x32.png") - _yup_execute_process_or_fail (/usr/bin/sips -z 32 32 "${png_path}" --out "${temp_iconset_path}/icon_16x16@2x.png") - _yup_execute_process_or_fail (/usr/bin/sips -z 64 64 "${png_path}" --out "${temp_iconset_path}/icon_32x32@2x.png") - _yup_execute_process_or_fail (/usr/bin/sips -z 128 128 "${png_path}" --out "${temp_iconset_path}/icon_128x128.png") - _yup_execute_process_or_fail (/usr/bin/sips -z 256 256 "${png_path}" --out "${temp_iconset_path}/icon_128x128@2x.png") - _yup_execute_process_or_fail (/usr/bin/sips -z 256 256 "${png_path}" --out "${temp_iconset_path}/icon_256x256.png") - _yup_execute_process_or_fail (/usr/bin/sips -z 512 512 "${png_path}" --out "${temp_iconset_path}/icon_256x256@2x.png") - _yup_execute_process_or_fail (/usr/bin/sips -z 512 512 "${png_path}" --out "${temp_iconset_path}/icon_512x512.png") - _yup_execute_process_or_fail (/usr/bin/sips -z 1024 1024 "${png_path}" --out "${temp_iconset_path}/icon_512x512@2x.png") + foreach (size IN ITEMS 16 32 128 256 512) + _yup_execute_process_or_fail (/usr/bin/sips -z ${size} ${size} "${png_path}" --out "${temp_iconset_path}/icon_${size}x${size}.png") + endforeach() _yup_execute_process_or_fail (/usr/bin/iconutil -c icns -o "${output_iconset_path}" "${temp_iconset_path}") file (REMOVE_RECURSE "${temp_iconset_path}") diff --git a/examples/graphics/CMakeLists.txt b/examples/graphics/CMakeLists.txt index 730bdefe4..6992ff3d0 100644 --- a/examples/graphics/CMakeLists.txt +++ b/examples/graphics/CMakeLists.txt @@ -78,6 +78,7 @@ yup_standalone_app ( flac_library hmp3_library dr_libs + libvorbis libpng libwebp ${additional_modules} diff --git a/examples/graphics/source/examples/AudioFileDemo.h b/examples/graphics/source/examples/AudioFileDemo.h index 077b2ba38..91626d903 100644 --- a/examples/graphics/source/examples/AudioFileDemo.h +++ b/examples/graphics/source/examples/AudioFileDemo.h @@ -335,7 +335,9 @@ class AudioFileDemo : public yup::Component , saveButton ("Save As") , loopButton ("Loop") { - formatManager.registerDefaultFormats(); + formatManager.registerDefaultFormats ( + yup::AudioFormatType::all & ~yup::AudioFormatType::coreAudio); + deviceManager.initialiseWithDefaultDevices (0, 2); deviceManager.addAudioCallback (&sourcePlayer); sourcePlayer.setSource (&transportSource); @@ -608,7 +610,7 @@ class AudioFileDemo : public yup::Component yup::String getAudioFileFilter() const { - return "*.wav;*.aiff;*.aif;*.flac;*.mp3;*.opus;*.m4a;*.wma"; + return "*.wav;*.aiff;*.aif;*.flac;*.mp3;*.opus;*.m4a;*.wma;*.ogg"; } yup::AudioFormatManager formatManager; diff --git a/modules/yup_audio_formats/common/yup_AudioFormatManager.cpp b/modules/yup_audio_formats/common/yup_AudioFormatManager.cpp index e1be15258..239a080d0 100644 --- a/modules/yup_audio_formats/common/yup_AudioFormatManager.cpp +++ b/modules/yup_audio_formats/common/yup_AudioFormatManager.cpp @@ -26,34 +26,42 @@ AudioFormatManager::AudioFormatManager() { } -void AudioFormatManager::registerDefaultFormats() +void AudioFormatManager::registerDefaultFormats (AudioFormatType types) { #if YUP_AUDIO_FORMAT_COREAUDIO - registerFormat (std::make_unique()); + if (hasBitValueSet (types, AudioFormatType::coreAudio)) + registerFormat (std::make_unique()); #endif #if YUP_AUDIO_FORMAT_MEDIAFOUNDATION - registerFormat (std::make_unique()); + if (hasBitValueSet (types, AudioFormatType::windowsMedia)) + registerFormat (std::make_unique()); #endif #if YUP_AUDIO_FORMAT_WAVE - registerFormat (std::make_unique()); + if (hasBitValueSet (types, AudioFormatType::wav)) + registerFormat (std::make_unique()); #endif #if YUP_AUDIO_FORMAT_FLAC - registerFormat (std::make_unique()); + if (hasBitValueSet (types, AudioFormatType::flac)) + registerFormat (std::make_unique()); #endif #if YUP_AUDIO_FORMAT_MP3 - registerFormat (std::make_unique()); + if (hasBitValueSet (types, AudioFormatType::mp3)) + registerFormat (std::make_unique()); #endif -#if YUP_AUDIO_FORMAT_OPUS - registerFormat (std::make_unique()); +#if YUP_AUDIO_FORMAT_OGG + if (hasBitValueSet (types, AudioFormatType::ogg)) + registerFormat (std::make_unique()); #endif - // TODO: Add other formats like: - // registerFormat (std::make_unique()); +#if YUP_AUDIO_FORMAT_OPUS + if (hasBitValueSet (types, AudioFormatType::opus)) + registerFormat (std::make_unique()); +#endif } void AudioFormatManager::registerFormat (std::unique_ptr format) @@ -66,20 +74,21 @@ std::unique_ptr AudioFormatManager::createReaderFor (const Fi { // Try to open the file auto stream = file.createInputStream(); - if (stream == nullptr) return nullptr; // Try each format for (auto& format : formats) { - if (format->canHandleFile (file)) - { - stream->setPosition (0); + if (! format->canHandleFile (file, AudioFormat::forReading)) + continue; - if (auto reader = format->createReaderFor (stream.release())) - return reader; - } + stream->setPosition (0); + + if (auto reader = format->createReaderFor (stream.release())) + return reader; + else + stream = file.createInputStream(); } return nullptr; @@ -88,28 +97,33 @@ std::unique_ptr AudioFormatManager::createReaderFor (const Fi std::unique_ptr AudioFormatManager::createWriterFor (const File& file, int sampleRate, int numChannels, - int bitsPerSample) + int bitsPerSample, + const StringPairArray& metadataValues, + int qualityOptionIndex) { // Try to create the output file auto stream = file.createOutputStream(); - if (stream == nullptr) return nullptr; // Try each format for (auto& format : formats) { - if (format->canHandleFile (file)) + if (! format->canHandleFile (file, AudioFormat::forWriting)) + continue; + + if (auto writer = format->createWriterFor (stream.release(), + sampleRate, + numChannels, + bitsPerSample, + metadataValues, + qualityOptionIndex)) + { + return writer; + } + else { - StringPairArray metadataValues; - - if (auto writer = format->createWriterFor (stream.release(), - sampleRate, - numChannels, - bitsPerSample, - metadataValues, - 0)) - return writer; + stream = file.createOutputStream(); } } diff --git a/modules/yup_audio_formats/common/yup_AudioFormatManager.h b/modules/yup_audio_formats/common/yup_AudioFormatManager.h index acfecf030..d7f81aeaa 100644 --- a/modules/yup_audio_formats/common/yup_AudioFormatManager.h +++ b/modules/yup_audio_formats/common/yup_AudioFormatManager.h @@ -22,6 +22,23 @@ namespace yup { +//============================================================================== +/** Enumeration of supported audio format types. */ +enum class AudioFormatType +{ + wav = 1 << 0, + mp3 = 1 << 1, + flac = 1 << 2, + ogg = 1 << 3, + opus = 1 << 4, + coreAudio = 1 << 5, + windowsMedia = 1 << 6, + + all = ~0 +}; + +YUP_DECLARE_SCOPED_ENUM_BITWISE_OPERATORS (AudioFormatType) + //============================================================================== /** Central registry and factory for audio format handlers. @@ -82,7 +99,7 @@ class YUP_API AudioFormatManager The specific formats registered may depend on compile-time configuration and available dependencies. */ - void registerDefaultFormats(); + void registerDefaultFormats (AudioFormatType types = AudioFormatType::all); /** Registers a custom audio format implementation. @@ -102,8 +119,7 @@ class YUP_API AudioFormatManager should handle it, then attempts to create a reader for that format. The file is opened and its header is parsed to extract audio properties. - @param file The audio file to create a reader for. The file must exist and - be readable. + @param file The audio file to create a reader for. The file must exist and be readable. @returns A unique pointer to an AudioFormatReader if a compatible format was found and the file could be parsed successfully, nullptr otherwise. @@ -117,11 +133,12 @@ class YUP_API AudioFormatManager its extension, then creates a writer configured with the specified audio parameters. The format's capabilities are validated against the requested parameters. - @param file The destination file where audio data will be written. Parent - directories must exist and be writable. + @param file The destination file where audio data will be written. Parent directories must exist and be writable. @param sampleRate The sample rate for the output audio in Hz (e.g., 44100, 48000). @param numChannels The number of audio channels (1 for mono, 2 for stereo, etc.). @param bitsPerSample The bit depth for sample encoding (e.g., 16, 24, 32). + @param metadataValues The metadata values to write (if supported). + @param qualityOptionIndex The quality option index (if supported). @returns A unique pointer to an AudioFormatWriter if a compatible format was found and supports the specified parameters, nullptr if no suitable format is @@ -130,7 +147,9 @@ class YUP_API AudioFormatManager std::unique_ptr createWriterFor (const File& file, int sampleRate, int numChannels, - int bitsPerSample); + int bitsPerSample, + const StringPairArray& metadataValues = {}, + int qualityOptionIndex = 0); private: std::vector> formats; diff --git a/modules/yup_audio_formats/format/yup_AudioFormat.cpp b/modules/yup_audio_formats/format/yup_AudioFormat.cpp index b579199a6..276cda196 100644 --- a/modules/yup_audio_formats/format/yup_AudioFormat.cpp +++ b/modules/yup_audio_formats/format/yup_AudioFormat.cpp @@ -22,9 +22,9 @@ namespace yup { -bool AudioFormat::canHandleFile (const File& file) const +bool AudioFormat::canHandleFile (const File& file, Mode handleMode) const { - auto extensions = getFileExtensions(); + auto extensions = getFileExtensions (handleMode); auto fileExt = file.getFileExtension().toLowerCase(); for (auto& ext : extensions) @@ -36,4 +36,4 @@ bool AudioFormat::canHandleFile (const File& file) const return false; } -} // namespace yup \ No newline at end of file +} // namespace yup diff --git a/modules/yup_audio_formats/format/yup_AudioFormat.h b/modules/yup_audio_formats/format/yup_AudioFormat.h index f548758e8..d2ba447cf 100644 --- a/modules/yup_audio_formats/format/yup_AudioFormat.h +++ b/modules/yup_audio_formats/format/yup_AudioFormat.h @@ -53,6 +53,13 @@ class AudioFormatWriter; class YUP_API AudioFormat { public: + /** Mode of operation. */ + enum Mode + { + forReading, + forWriting + }; + /** Destructor. */ virtual ~AudioFormat() = default; @@ -64,10 +71,9 @@ class YUP_API AudioFormat /** Returns the file extensions associated with this format. - @returns An array of file extensions (including the dot) that this format can handle - (e.g., {".wav", ".wave"} for WAV format) + @returns An array of file extensions (including the dot) that this format can handle (e.g., {".wav", ".wave"} for WAV format) */ - virtual Array getFileExtensions() const = 0; + virtual Array getFileExtensions (Mode handleMode) const = 0; /** Tests whether this format can handle files with the given file extension. @@ -75,10 +81,11 @@ class YUP_API AudioFormat based on its extension, without needing to attempt to open the file. @param file The file to test for compatibility + @param handleMode The mode to check for compatibility @returns true if this format can potentially handle the file, false otherwise */ - virtual bool canHandleFile (const File& file) const; + virtual bool canHandleFile (const File& file, Mode handleMode) const; /** Creates a reader object capable of parsing audio data from the given stream. @@ -168,4 +175,4 @@ class YUP_API AudioFormat virtual StringArray getQualityOptions() const { return {}; } }; -} // namespace yup \ No newline at end of file +} // namespace yup diff --git a/modules/yup_audio_formats/formats/yup_AppleCoreAudioFormat.cpp b/modules/yup_audio_formats/formats/yup_AppleCoreAudioFormat.cpp index 78394cd17..e8cecf9c7 100644 --- a/modules/yup_audio_formats/formats/yup_AppleCoreAudioFormat.cpp +++ b/modules/yup_audio_formats/formats/yup_AppleCoreAudioFormat.cpp @@ -1053,20 +1053,27 @@ const String& AppleCoreAudioFormat::getFormatName() const return formatName; } -Array AppleCoreAudioFormat::getFileExtensions() const +Array AppleCoreAudioFormat::getFileExtensions (Mode handleMode) const { - if (streamKind != StreamKind::kNone) + if (handleMode == Mode::forReading) { - const auto extensions = findFileExtensionsForCoreAudioCodec (toAudioFileTypeID (streamKind)); + if (streamKind != StreamKind::kNone) + { + const auto extensions = findFileExtensionsForCoreAudioCodec (toAudioFileTypeID (streamKind)); + if (! extensions.isEmpty()) + return extensions; + } + + const auto extensions = findFileExtensionsForCoreAudioCodecs(); if (! extensions.isEmpty()) return extensions; - } - const auto extensions = findFileExtensionsForCoreAudioCodecs(); - if (! extensions.isEmpty()) - return extensions; - - return { ".wav", ".aiff", ".aif", ".aifc", ".wav", ".sd2", ".au", ".snd", ".mp4", ".mp3", ".mp2", ".mp1", ".ac3", ".aac", ".m4a", ".m4b", ".caf", ".3gp", ".3g2", ".amr" }; + return { ".wav", ".aiff", ".aif", ".aifc", ".wav", ".sd2", ".au", ".snd", ".mp4", ".mp3", ".mp2", ".mp1", ".ac3", ".aac", ".m4a", ".m4b", ".caf", ".3gp", ".3g2", ".amr" }; + } + else + { + return { ".aiff", ".aif", ".aifc", ".sd2", ".au", ".snd", ".mp4", ".mp2", ".mp1", ".ac3", ".aac", ".m4a", ".m4b", ".caf", ".3gp", ".3g2", ".amr" }; + } } std::unique_ptr AppleCoreAudioFormat::createReaderFor (InputStream* sourceStream) diff --git a/modules/yup_audio_formats/formats/yup_AppleCoreAudioFormat.h b/modules/yup_audio_formats/formats/yup_AppleCoreAudioFormat.h index a6b5c5ec7..8ef96febc 100644 --- a/modules/yup_audio_formats/formats/yup_AppleCoreAudioFormat.h +++ b/modules/yup_audio_formats/formats/yup_AppleCoreAudioFormat.h @@ -81,7 +81,7 @@ class YUP_API AppleCoreAudioFormat : public AudioFormat const String& getFormatName() const override; /** Returns the file extensions that this format can handle. */ - Array getFileExtensions() const override; + Array getFileExtensions (Mode handleMode) const override; /** Creates a reader for decoding CoreAudio-supported audio data. */ std::unique_ptr createReaderFor (InputStream* sourceStream) override; diff --git a/modules/yup_audio_formats/formats/yup_FlacAudioFormat.cpp b/modules/yup_audio_formats/formats/yup_FlacAudioFormat.cpp index 411ca80e6..1c09d00ce 100644 --- a/modules/yup_audio_formats/formats/yup_FlacAudioFormat.cpp +++ b/modules/yup_audio_formats/formats/yup_FlacAudioFormat.cpp @@ -529,7 +529,7 @@ const String& FlacAudioFormat::getFormatName() const return formatName; } -Array FlacAudioFormat::getFileExtensions() const +Array FlacAudioFormat::getFileExtensions ([[maybe_unused]] Mode handleMode) const { return { ".flac" }; } diff --git a/modules/yup_audio_formats/formats/yup_FlacAudioFormat.h b/modules/yup_audio_formats/formats/yup_FlacAudioFormat.h index f88c43501..cf9b7e40c 100644 --- a/modules/yup_audio_formats/formats/yup_FlacAudioFormat.h +++ b/modules/yup_audio_formats/formats/yup_FlacAudioFormat.h @@ -47,7 +47,7 @@ class YUP_API FlacAudioFormat : public AudioFormat const String& getFormatName() const override; /** Returns the file extensions that this format can handle. */ - Array getFileExtensions() const override; + Array getFileExtensions (Mode handleMode) const override; /** Creates a reader for decoding FLAC audio data from the provided stream. */ std::unique_ptr createReaderFor (InputStream* sourceStream) override; diff --git a/modules/yup_audio_formats/formats/yup_Mp3AudioFormat.cpp b/modules/yup_audio_formats/formats/yup_Mp3AudioFormat.cpp index 967a597d2..35fc9b01b 100644 --- a/modules/yup_audio_formats/formats/yup_Mp3AudioFormat.cpp +++ b/modules/yup_audio_formats/formats/yup_Mp3AudioFormat.cpp @@ -192,10 +192,27 @@ Mp3AudioFormatReader::Mp3AudioFormatReader (InputStream* sourceStream) { sampleRate = mp3.sampleRate; bitsPerSample = 16; // MP3 always outputs 16-bit samples - lengthInSamples = mp3.totalPCMFrameCount; numChannels = mp3.channels; usesFloatingPointData = false; // MP3 outputs 16-bit integer samples + const drmp3_uint64 unknownFrameCount = (drmp3_uint64) -1; + drmp3_uint64 totalFrames = mp3.totalPCMFrameCount; + + if (totalFrames == 0 || totalFrames == unknownFrameCount) + { + const auto scannedFrames = drmp3_get_pcm_frame_count (&mp3); + if (scannedFrames != 0 && scannedFrames != unknownFrameCount) + totalFrames = scannedFrames; + + drmp3_seek_to_pcm_frame (&mp3, 0); + currentPCMFrame = 0; + } + + if (totalFrames == 0 || totalFrames == unknownFrameCount || totalFrames > 0x7fffffffffffffffULL) + lengthInSamples = 0; + else + lengthInSamples = (int64) totalFrames; + // Allocate temp buffer for reading const auto bytesPerFrame = numChannels * (bitsPerSample / 8); tempBufferSize = bytesPerFrame * 4096; @@ -448,9 +465,15 @@ const String& Mp3AudioFormat::getFormatName() const return formatName; } -Array Mp3AudioFormat::getFileExtensions() const +Array Mp3AudioFormat::getFileExtensions ([[maybe_unused]] Mode handleMode) const { +#if YUP_MODULE_AVAILABLE_hmp3_library return { ".mp3" }; +#else + if (handleMode == Mode::forReading) + return { ".mp3" }; + return {}; +#endif } std::unique_ptr Mp3AudioFormat::createReaderFor (InputStream* sourceStream) diff --git a/modules/yup_audio_formats/formats/yup_Mp3AudioFormat.h b/modules/yup_audio_formats/formats/yup_Mp3AudioFormat.h index 1fd9d86f1..604ff6fea 100644 --- a/modules/yup_audio_formats/formats/yup_Mp3AudioFormat.h +++ b/modules/yup_audio_formats/formats/yup_Mp3AudioFormat.h @@ -84,7 +84,7 @@ class YUP_API Mp3AudioFormat : public AudioFormat @returns An array containing the supported extensions: ".mp3" */ - Array getFileExtensions() const override; + Array getFileExtensions (Mode handleMode) const override; /** Creates a reader for decoding MP3 audio data from the provided stream. diff --git a/modules/yup_audio_formats/formats/yup_OggVorbisAudioFormat.cpp b/modules/yup_audio_formats/formats/yup_OggVorbisAudioFormat.cpp new file mode 100644 index 000000000..eb908fce4 --- /dev/null +++ b/modules/yup_audio_formats/formats/yup_OggVorbisAudioFormat.cpp @@ -0,0 +1,571 @@ +/* + ============================================================================== + + This file is part of the YUP library. + Copyright (c) 2025 - kunitoki@gmail.com + + YUP is an open source library subject to open-source licensing. + + The code included in this file is provided under the terms of the ISC license + http://www.isc.org/downloads/software-support-policy/isc-license. Permission + to use, copy, modify, and/or distribute this software for any purpose with or + without fee is hereby granted provided that the above copyright notice and + this permission notice appear in all copies. + + YUP IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER + EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE + DISCLAIMED. + + ============================================================================== +*/ + +namespace yup +{ + +namespace +{ + +//============================================================================== + +class OggVorbisAudioFormatReader : public AudioFormatReader +{ +public: + OggVorbisAudioFormatReader (InputStream* sourceStream); + ~OggVorbisAudioFormatReader() override; + + bool readSamples (float* const* destChannels, + int numDestChannels, + int startOffsetInDestBuffer, + int64 startSampleInFile, + int numSamples) override; + +private: + static size_t readCallback (void* buffer, size_t size, size_t nmemb, void* datasource) + { + auto* reader = static_cast (datasource); + if (reader == nullptr || reader->input == nullptr || size == 0) + return 0; + + const size_t bytesToRead = size * nmemb; + const int bytesRead = reader->input->read (buffer, (int) bytesToRead); + if (bytesRead <= 0) + return 0; + + return (size_t) bytesRead / size; + } + + static int seekCallback (void* datasource, ogg_int64_t offset, int whence) + { + auto* reader = static_cast (datasource); + if (reader == nullptr || reader->input == nullptr) + return -1; + + int64 target = 0; + + switch (whence) + { + case SEEK_SET: + target = (int64) offset; + break; + case SEEK_CUR: + target = reader->input->getPosition() + (int64) offset; + break; + case SEEK_END: + { + const auto length = reader->input->getTotalLength(); + if (length < 0) + return -1; + target = length + (int64) offset; + break; + } + default: + return -1; + } + + return reader->input->setPosition (target) ? 0 : -1; + } + + static int closeCallback (void*) + { + return 0; + } + + static long tellCallback (void* datasource) + { + auto* reader = static_cast (datasource); + if (reader == nullptr || reader->input == nullptr) + return -1; + + return (long) reader->input->getPosition(); + } + + void readMetadata() + { + auto* comment = ov_comment (&vorbisFile, -1); + if (comment == nullptr || comment->comments <= 0) + return; + + for (int i = 0; i < comment->comments; ++i) + { + const char* entry = comment->user_comments[i]; + const auto length = comment->comment_lengths[i]; + if (entry == nullptr || length <= 0) + continue; + + const auto text = String::fromUTF8 (entry, length); + const auto separatorIndex = text.indexOfChar ('='); + if (separatorIndex <= 0) + continue; + + const auto key = text.substring (0, separatorIndex).toLowerCase(); + const auto value = text.substring (separatorIndex + 1); + if (key.isNotEmpty()) + metadataValues.set (key, value); + } + } + + OggVorbis_File vorbisFile = {}; + ogg_int64_t currentSample = 0; + bool isOpen = false; + + YUP_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (OggVorbisAudioFormatReader) +}; + +OggVorbisAudioFormatReader::OggVorbisAudioFormatReader (InputStream* sourceStream) + : AudioFormatReader (sourceStream, "Ogg Vorbis") +{ + if (input == nullptr) + return; + + input->setPosition (0); + + ov_callbacks callbacks; + callbacks.read_func = &readCallback; + callbacks.seek_func = &seekCallback; + callbacks.close_func = &closeCallback; + callbacks.tell_func = &tellCallback; + + if (ov_open_callbacks (this, &vorbisFile, nullptr, 0, callbacks) < 0) + return; + + const auto* info = ov_info (&vorbisFile, -1); + if (info == nullptr) + return; + + sampleRate = (double) info->rate; + numChannels = (int) info->channels; + bitsPerSample = 32; + usesFloatingPointData = true; + + const auto totalSamples = ov_pcm_total (&vorbisFile, -1); + if (totalSamples > 0) + lengthInSamples = (int64) totalSamples; + + readMetadata(); + + isOpen = (sampleRate > 0 && numChannels > 0); + currentSample = 0; +} + +OggVorbisAudioFormatReader::~OggVorbisAudioFormatReader() +{ + if (isOpen) + ov_clear (&vorbisFile); +} + +bool OggVorbisAudioFormatReader::readSamples (float* const* destChannels, + int numDestChannels, + int startOffsetInDestBuffer, + int64 startSampleInFile, + int numSamples) +{ + if (! isOpen) + return false; + + if (numSamples <= 0) + return true; + + if (startSampleInFile < 0) + return false; + + if (lengthInSamples > 0 && startSampleInFile >= lengthInSamples) + return false; + + if (startSampleInFile != currentSample) + { + if (ov_pcm_seek (&vorbisFile, (ogg_int64_t) startSampleInFile) != 0) + return false; + + currentSample = startSampleInFile; + } + + HeapBlock offsetDestChannels; + offsetDestChannels.malloc (numDestChannels); + + for (int ch = 0; ch < numDestChannels; ++ch) + offsetDestChannels[ch] = destChannels[ch] + startOffsetInDestBuffer; + + int samplesRemaining = numSamples; + int samplesReadTotal = 0; + + while (samplesRemaining > 0) + { + float** pcm = nullptr; + int currentSection = 0; + const long samplesRead = ov_read_float (&vorbisFile, &pcm, samplesRemaining, ¤tSection); + + if (samplesRead == 0) + break; + + if (samplesRead < 0) + return false; + + const auto numChannelsToCopy = jmin (numDestChannels, numChannels); + + for (int ch = 0; ch < numChannelsToCopy; ++ch) + { + if (offsetDestChannels[ch] != nullptr) + FloatVectorOperations::copy (offsetDestChannels[ch], pcm[ch], (int) samplesRead); + } + + for (int ch = numChannelsToCopy; ch < numDestChannels; ++ch) + { + if (offsetDestChannels[ch] != nullptr) + zeromem (offsetDestChannels[ch], sizeof (float) * (size_t) samplesRead); + } + + for (int ch = 0; ch < numDestChannels; ++ch) + { + if (offsetDestChannels[ch] != nullptr) + offsetDestChannels[ch] += samplesRead; + } + + samplesRemaining -= (int) samplesRead; + samplesReadTotal += (int) samplesRead; + currentSample += samplesRead; + } + + if (samplesReadTotal < numSamples) + { + const auto remaining = numSamples - samplesReadTotal; + for (int ch = 0; ch < numDestChannels; ++ch) + if (destChannels[ch] != nullptr) + zeromem (destChannels[ch] + startOffsetInDestBuffer + samplesReadTotal, + sizeof (float) * (size_t) remaining); + } + + return samplesReadTotal > 0; +} + +//============================================================================== + +class OggVorbisAudioFormatWriter : public AudioFormatWriter +{ +public: + OggVorbisAudioFormatWriter (OutputStream* destStream, + double sampleRate, + int numberOfChannels, + int bitsPerSample, + const StringPairArray& metadataValues, + int qualityOptionIndex); + ~OggVorbisAudioFormatWriter() override; + + bool write (const float* const* samplesToWrite, int numSamples) override; + bool flush() override; + + bool isValid() const { return isOpen; } + +private: + bool writePage (const ogg_page& page) + { + if (output == nullptr) + return false; + + if (! output->write (page.header, (size_t) page.header_len)) + return false; + + if (! output->write (page.body, (size_t) page.body_len)) + return false; + + return true; + } + + bool flushPages (bool force) + { + ogg_page page; + + while (true) + { + const int result = force ? ogg_stream_flush (&oggStream, &page) + : ogg_stream_pageout (&oggStream, &page); + + if (result == 0) + break; + + if (result < 0) + return false; + + if (! writePage (page)) + return false; + } + + return true; + } + + bool processBlocks (bool forceFlush) + { + while (vorbis_analysis_blockout (&dspState, &block) == 1) + { + vorbis_analysis (&block, nullptr); + vorbis_bitrate_addblock (&block); + + ogg_packet packet; + while (vorbis_bitrate_flushpacket (&dspState, &packet)) + { + ogg_stream_packetin (&oggStream, &packet); + if (! flushPages (forceFlush)) + return false; + } + } + + return true; + } + + bool finalizeEncoding() + { + if (finished) + return true; + + if (vorbis_analysis_wrote (&dspState, 0) != 0) + return false; + + if (! processBlocks (true)) + return false; + + finished = true; + return true; + } + + bool writeHeaders() + { + ogg_packet header = {}; + ogg_packet headerComment = {}; + ogg_packet headerCode = {}; + + if (vorbis_analysis_headerout (&dspState, &comment, &header, &headerComment, &headerCode) != 0) + return false; + + ogg_stream_packetin (&oggStream, &header); + ogg_stream_packetin (&oggStream, &headerComment); + ogg_stream_packetin (&oggStream, &headerCode); + + return flushPages (true); + } + + void clearState() + { + if (oggStreamInitialized) + ogg_stream_clear (&oggStream); + + if (blockInitialized) + vorbis_block_clear (&block); + + if (dspInitialized) + vorbis_dsp_clear (&dspState); + + if (commentInitialized) + vorbis_comment_clear (&comment); + + if (infoInitialized) + vorbis_info_clear (&info); + } + + vorbis_info info = {}; + vorbis_dsp_state dspState = {}; + vorbis_block block = {}; + vorbis_comment comment = {}; + ogg_stream_state oggStream = {}; + + bool infoInitialized = false; + bool commentInitialized = false; + bool dspInitialized = false; + bool blockInitialized = false; + bool oggStreamInitialized = false; + bool finished = false; + bool isOpen = false; + int channelCount = 0; + + YUP_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (OggVorbisAudioFormatWriter) +}; + +OggVorbisAudioFormatWriter::OggVorbisAudioFormatWriter (OutputStream* destStream, + double sampleRate, + int numberOfChannels, + int bitsPerSample, + const StringPairArray& metadataValues, + int qualityOptionIndex) + : AudioFormatWriter (destStream, "Ogg Vorbis", sampleRate, numberOfChannels, bitsPerSample) +{ + if (destStream == nullptr) + return; + + channelCount = numberOfChannels; + + const float quality = jlimit (0.0f, 1.0f, (float) qualityOptionIndex / 10.0f); + + vorbis_info_init (&info); + infoInitialized = true; + + if (vorbis_encode_init_vbr (&info, numberOfChannels, (long) sampleRate, quality) != 0) + return; + + vorbis_comment_init (&comment); + commentInitialized = true; + + for (const auto& pair : metadataValues) + { + const auto key = String (pair.key).trim().toUpperCase(); + const auto value = String (pair.value); + if (key.isNotEmpty() && value.isNotEmpty()) + vorbis_comment_add_tag (&comment, key.toRawUTF8(), value.toRawUTF8()); + } + + if (vorbis_analysis_init (&dspState, &info) != 0) + return; + + dspInitialized = true; + + if (vorbis_block_init (&dspState, &block) != 0) + return; + + blockInitialized = true; + + if (ogg_stream_init (&oggStream, (int) Random::getSystemRandom().nextInt()) != 0) + return; + + oggStreamInitialized = true; + + if (! writeHeaders()) + return; + + isOpen = true; +} + +OggVorbisAudioFormatWriter::~OggVorbisAudioFormatWriter() +{ + flush(); + clearState(); +} + +bool OggVorbisAudioFormatWriter::write (const float* const* samplesToWrite, int numSamples) +{ + if (! isOpen || numSamples <= 0) + return false; + + auto** buffer = vorbis_analysis_buffer (&dspState, numSamples); + if (buffer == nullptr) + return false; + + for (int ch = 0; ch < channelCount; ++ch) + { + auto* dest = buffer[ch]; + const auto* src = samplesToWrite[ch]; + if (src != nullptr) + FloatVectorOperations::copy (dest, src, numSamples); + else + zeromem (dest, sizeof (float) * (size_t) numSamples); + } + + if (vorbis_analysis_wrote (&dspState, numSamples) != 0) + return false; + + return processBlocks (false); +} + +bool OggVorbisAudioFormatWriter::flush() +{ + if (! isOpen) + return false; + + if (! finalizeEncoding()) + return false; + + output->flush(); + return true; +} + +} // namespace + +//============================================================================== + +OggVorbisAudioFormat::OggVorbisAudioFormat() + : formatName ("Ogg Vorbis") +{ +} + +OggVorbisAudioFormat::~OggVorbisAudioFormat() = default; + +const String& OggVorbisAudioFormat::getFormatName() const +{ + return formatName; +} + +Array OggVorbisAudioFormat::getFileExtensions ([[maybe_unused]] Mode handleMode) const +{ + return { ".ogg" }; +} + +std::unique_ptr OggVorbisAudioFormat::createReaderFor (InputStream* sourceStream) +{ + auto reader = std::make_unique (sourceStream); + + if (reader->sampleRate > 0 && reader->numChannels > 0) + return reader; + + return nullptr; +} + +std::unique_ptr OggVorbisAudioFormat::createWriterFor (OutputStream* streamToWriteTo, + double sampleRate, + int numberOfChannels, + int bitsPerSample, + const StringPairArray& metadataValues, + int qualityOptionIndex) +{ + if (streamToWriteTo == nullptr) + return nullptr; + + if (numberOfChannels < 1 || numberOfChannels > 8) + return nullptr; + + if (sampleRate <= 0 || sampleRate > 192000.0) + return nullptr; + + auto writer = std::make_unique (streamToWriteTo, + sampleRate, + numberOfChannels, + bitsPerSample, + metadataValues, + qualityOptionIndex); + if (writer->isValid()) + return writer; + + return nullptr; +} + +Array OggVorbisAudioFormat::getPossibleBitDepths() const +{ + return { 16 }; +} + +Array OggVorbisAudioFormat::getPossibleSampleRates() const +{ + return { 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000, 88200, 96000, 176400, 192000 }; +} + +StringArray OggVorbisAudioFormat::getQualityOptions() const +{ + return { "0 - Lowest", "1 - Very low", "2 - Low", "3 - Medium low", "4 - Medium", "5 - Medium high", "6 - High", "7 - Very high", "8 - Higher", "9 - Very high", "10 - Highest" }; +} + +} // namespace yup diff --git a/modules/yup_audio_formats/formats/yup_OggVorbisAudioFormat.h b/modules/yup_audio_formats/formats/yup_OggVorbisAudioFormat.h new file mode 100644 index 000000000..cb630a6f3 --- /dev/null +++ b/modules/yup_audio_formats/formats/yup_OggVorbisAudioFormat.h @@ -0,0 +1,85 @@ +/* + ============================================================================== + + This file is part of the YUP library. + Copyright (c) 2025 - kunitoki@gmail.com + + YUP is an open source library subject to open-source licensing. + + The code included in this file is provided under the terms of the ISC license + http://www.isc.org/downloads/software-support-policy/isc-license. Permission + to use, copy, modify, and/or distribute this software for any purpose with or + without fee is hereby granted provided that the above copyright notice and + this permission notice appear in all copies. + + YUP IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER + EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE + DISCLAIMED. + + ============================================================================== +*/ + +namespace yup +{ + +//============================================================================== +/** + AudioFormat implementation for Ogg Vorbis audio files. + + This format provides read and write support for .ogg files containing Vorbis + audio streams. Decoding and encoding are handled through libvorbis, with + samples exposed as floating point values. + + @see AudioFormat, AudioFormatReader, AudioFormatWriter + + @tags{Audio} +*/ +class YUP_API OggVorbisAudioFormat : public AudioFormat +{ +public: + /** Constructs a new OggVorbisAudioFormat instance. */ + OggVorbisAudioFormat(); + + /** Destructor. */ + ~OggVorbisAudioFormat() override; + + /** Returns the descriptive name of this format. */ + const String& getFormatName() const override; + + /** Returns the file extensions that this format can handle. */ + Array getFileExtensions (Mode handleMode) const override; + + /** Creates a reader for decoding Ogg Vorbis audio data from the provided stream. */ + std::unique_ptr createReaderFor (InputStream* sourceStream) override; + + /** Creates a writer for encoding audio data to Ogg Vorbis format. */ + std::unique_ptr createWriterFor (OutputStream* streamToWriteTo, + double sampleRate, + int numberOfChannels, + int bitsPerSample, + const StringPairArray& metadataValues, + int qualityOptionIndex) override; + + /** Returns the bit depths supported by this Ogg Vorbis format implementation. */ + Array getPossibleBitDepths() const override; + + /** Returns the sample rates supported by this Ogg Vorbis format implementation. */ + Array getPossibleSampleRates() const override; + + /** Indicates whether this format can handle mono audio. */ + bool canDoMono() const override { return true; } + + /** Indicates whether this format can handle stereo audio. */ + bool canDoStereo() const override { return true; } + + /** Indicates that this format is compressed. */ + bool isCompressed() const override { return true; } + + /** Returns the available quality options for Vorbis encoding. */ + StringArray getQualityOptions() const override; + +private: + String formatName; +}; + +} // namespace yup diff --git a/modules/yup_audio_formats/formats/yup_OpusAudioFormat.cpp b/modules/yup_audio_formats/formats/yup_OpusAudioFormat.cpp index 881abeb87..20e13c5da 100644 --- a/modules/yup_audio_formats/formats/yup_OpusAudioFormat.cpp +++ b/modules/yup_audio_formats/formats/yup_OpusAudioFormat.cpp @@ -825,7 +825,7 @@ const String& OpusAudioFormat::getFormatName() const return formatName; } -Array OpusAudioFormat::getFileExtensions() const +Array OpusAudioFormat::getFileExtensions ([[maybe_unused]] Mode handleMode) const { return { ".opus" }; } diff --git a/modules/yup_audio_formats/formats/yup_OpusAudioFormat.h b/modules/yup_audio_formats/formats/yup_OpusAudioFormat.h index 4d83b880c..fedbc1823 100644 --- a/modules/yup_audio_formats/formats/yup_OpusAudioFormat.h +++ b/modules/yup_audio_formats/formats/yup_OpusAudioFormat.h @@ -47,7 +47,7 @@ class YUP_API OpusAudioFormat : public AudioFormat const String& getFormatName() const override; /** Returns the file extensions that this format can handle. */ - Array getFileExtensions() const override; + Array getFileExtensions (Mode handleMode) const override; /** Creates a reader for decoding Opus audio data from the provided stream. */ std::unique_ptr createReaderFor (InputStream* sourceStream) override; diff --git a/modules/yup_audio_formats/formats/yup_WaveAudioFormat.cpp b/modules/yup_audio_formats/formats/yup_WaveAudioFormat.cpp index 4960c3e69..9bd8dd21d 100644 --- a/modules/yup_audio_formats/formats/yup_WaveAudioFormat.cpp +++ b/modules/yup_audio_formats/formats/yup_WaveAudioFormat.cpp @@ -483,9 +483,15 @@ const String& WaveAudioFormat::getFormatName() const return formatName; } -Array WaveAudioFormat::getFileExtensions() const +Array WaveAudioFormat::getFileExtensions (Mode handleMode) const { - return { ".wav", ".wave", ".bwf" }; + switch (handleMode) + { + case Mode::forReading: + return { ".wav", ".wave", ".bwf" }; + case Mode::forWriting: + return { ".wav" }; + } } std::unique_ptr WaveAudioFormat::createReaderFor (InputStream* sourceStream) diff --git a/modules/yup_audio_formats/formats/yup_WaveAudioFormat.h b/modules/yup_audio_formats/formats/yup_WaveAudioFormat.h index 455c2cfdb..d09193c3e 100644 --- a/modules/yup_audio_formats/formats/yup_WaveAudioFormat.h +++ b/modules/yup_audio_formats/formats/yup_WaveAudioFormat.h @@ -85,7 +85,7 @@ class YUP_API WaveAudioFormat : public AudioFormat @returns An array containing the supported extensions: ".wav", ".wave", and ".bwf" (Broadcast Wave Format) */ - Array getFileExtensions() const override; + Array getFileExtensions (Mode handleMode) const override; /** Creates a reader for decoding WAV audio data from the provided stream. @@ -162,4 +162,4 @@ class YUP_API WaveAudioFormat : public AudioFormat String formatName; }; -} // namespace yup \ No newline at end of file +} // namespace yup diff --git a/modules/yup_audio_formats/formats/yup_WindowsMediaAudioFormat.cpp b/modules/yup_audio_formats/formats/yup_WindowsMediaAudioFormat.cpp index 4131e0347..60b09e904 100644 --- a/modules/yup_audio_formats/formats/yup_WindowsMediaAudioFormat.cpp +++ b/modules/yup_audio_formats/formats/yup_WindowsMediaAudioFormat.cpp @@ -1266,7 +1266,7 @@ const String& WindowsMediaAudioFormat::getFormatName() const return formatName; } -Array WindowsMediaAudioFormat::getFileExtensions() const +Array WindowsMediaAudioFormat::getFileExtensions ([[maybe_unused]] Mode handleMode) const { return { ".m4a", ".mp4", ".aac", ".wma", ".wm", ".wmv", ".asf", ".mp3" }; } diff --git a/modules/yup_audio_formats/formats/yup_WindowsMediaAudioFormat.h b/modules/yup_audio_formats/formats/yup_WindowsMediaAudioFormat.h index 770caa86c..860405330 100644 --- a/modules/yup_audio_formats/formats/yup_WindowsMediaAudioFormat.h +++ b/modules/yup_audio_formats/formats/yup_WindowsMediaAudioFormat.h @@ -47,7 +47,7 @@ class YUP_API WindowsMediaAudioFormat : public AudioFormat const String& getFormatName() const override; /** Returns the file extensions that this format can handle. */ - Array getFileExtensions() const override; + Array getFileExtensions (Mode handleMode) const override; /** Creates a reader for decoding Media Foundation-supported audio data. */ std::unique_ptr createReaderFor (InputStream* sourceStream) override; diff --git a/modules/yup_audio_formats/yup_audio_formats.cpp b/modules/yup_audio_formats/yup_audio_formats.cpp index d94d0fc18..4ee94a055 100644 --- a/modules/yup_audio_formats/yup_audio_formats.cpp +++ b/modules/yup_audio_formats/yup_audio_formats.cpp @@ -40,6 +40,11 @@ #include #endif +#if YUP_AUDIO_FORMAT_OGG +#include +#include +#endif + #if YUP_AUDIO_FORMAT_OPUS #include #endif @@ -88,6 +93,10 @@ #include "formats/yup_Mp3AudioFormat.cpp" #endif +#if YUP_AUDIO_FORMAT_OGG +#include "formats/yup_OggVorbisAudioFormat.cpp" +#endif + #if YUP_AUDIO_FORMAT_OPUS #include "formats/yup_OpusAudioFormat.cpp" #endif diff --git a/modules/yup_audio_formats/yup_audio_formats.h b/modules/yup_audio_formats/yup_audio_formats.h index f5dd19095..952ab8546 100644 --- a/modules/yup_audio_formats/yup_audio_formats.h +++ b/modules/yup_audio_formats/yup_audio_formats.h @@ -67,6 +67,17 @@ #endif #endif +//============================================================================== +/** Config: YUP_AUDIO_FORMAT_OGG + + Enable Ogg Vorbis audio format support. +*/ +#ifndef YUP_AUDIO_FORMAT_OGG +#if YUP_MODULE_AVAILABLE_libvorbis && YUP_MODULE_AVAILABLE_libogg +#define YUP_AUDIO_FORMAT_OGG 1 +#endif +#endif + //============================================================================== /** Config: YUP_AUDIO_FORMAT_OPUS @@ -124,6 +135,11 @@ #define YUP_AUDIO_FORMAT_MP3 0 #endif +#if YUP_AUDIO_FORMAT_OGG && ! (YUP_MODULE_AVAILABLE_libvorbis && YUP_MODULE_AVAILABLE_libogg) +#undef YUP_AUDIO_FORMAT_OGG +#define YUP_AUDIO_FORMAT_OGG 0 +#endif + #if YUP_AUDIO_FORMAT_OPUS && ! YUP_MODULE_AVAILABLE_opus_library #undef YUP_AUDIO_FORMAT_OPUS #define YUP_AUDIO_FORMAT_OPUS 0 @@ -161,6 +177,10 @@ #include "formats/yup_Mp3AudioFormat.h" #endif +#if YUP_AUDIO_FORMAT_OGG +#include "formats/yup_OggVorbisAudioFormat.h" +#endif + #if YUP_AUDIO_FORMAT_OPUS #include "formats/yup_OpusAudioFormat.h" #endif diff --git a/tests/yup_audio_formats/yup_AppleCoreAudioFormat.cpp b/tests/yup_audio_formats/yup_AppleCoreAudioFormat.cpp index 84c646cbd..5538a93cb 100644 --- a/tests/yup_audio_formats/yup_AppleCoreAudioFormat.cpp +++ b/tests/yup_audio_formats/yup_AppleCoreAudioFormat.cpp @@ -74,7 +74,7 @@ TEST_F (AppleCoreAudioFormatTests, GetFormatNameReturnsCoreAudio) TEST_F (AppleCoreAudioFormatTests, GetFileExtensionsIncludesM4aOrAac) { - Array extensions = format->getFileExtensions(); + Array extensions = format->getFileExtensions (AudioFormat::forReading); EXPECT_FALSE (extensions.isEmpty()); bool foundExtension = false; diff --git a/tests/yup_audio_formats/yup_FlacAudioFormat.cpp b/tests/yup_audio_formats/yup_FlacAudioFormat.cpp index 6a266dcb6..46e6bef05 100644 --- a/tests/yup_audio_formats/yup_FlacAudioFormat.cpp +++ b/tests/yup_audio_formats/yup_FlacAudioFormat.cpp @@ -83,19 +83,37 @@ TEST_F (FlacAudioFormatTests, GetFormatNameReturnsFlac) TEST_F (FlacAudioFormatTests, GetFileExtensionsIncludesFlac) { - Array extensions = format->getFileExtensions(); - EXPECT_FALSE (extensions.isEmpty()); + { + Array extensions = format->getFileExtensions (AudioFormat::forReading); + EXPECT_FALSE (extensions.isEmpty()); + + bool foundFlac = false; + for (const auto& ext : extensions) + { + if (ext.equalsIgnoreCase (".flac") || ext.equalsIgnoreCase ("flac")) + { + foundFlac = true; + break; + } + } + EXPECT_TRUE (foundFlac); + } - bool foundFlac = false; - for (const auto& ext : extensions) { - if (ext.equalsIgnoreCase (".flac") || ext.equalsIgnoreCase ("flac")) + Array extensions = format->getFileExtensions (AudioFormat::forWriting); + EXPECT_FALSE (extensions.isEmpty()); + + bool foundFlac = false; + for (const auto& ext : extensions) { - foundFlac = true; - break; + if (ext.equalsIgnoreCase (".flac") || ext.equalsIgnoreCase ("flac")) + { + foundFlac = true; + break; + } } + EXPECT_TRUE (foundFlac); } - EXPECT_TRUE (foundFlac); } TEST_F (FlacAudioFormatTests, GetPossibleBitDepthsAndSampleRates) diff --git a/tests/yup_audio_formats/yup_Mp3AudioFormat.cpp b/tests/yup_audio_formats/yup_Mp3AudioFormat.cpp index 9afc9ff6c..48c5883a5 100644 --- a/tests/yup_audio_formats/yup_Mp3AudioFormat.cpp +++ b/tests/yup_audio_formats/yup_Mp3AudioFormat.cpp @@ -60,19 +60,37 @@ TEST_F (Mp3AudioFormatTests, GetFormatNameReturnsMp3) TEST_F (Mp3AudioFormatTests, GetFileExtensionsIncludesMp3) { - Array extensions = format->getFileExtensions(); - EXPECT_FALSE (extensions.isEmpty()); + { + Array extensions = format->getFileExtensions (AudioFormat::forReading); + EXPECT_FALSE (extensions.isEmpty()); + + bool foundMp3 = false; + for (const auto& ext : extensions) + { + if (ext.equalsIgnoreCase (".mp3") || ext.equalsIgnoreCase ("mp3")) + { + foundMp3 = true; + break; + } + } + EXPECT_TRUE (foundMp3); + } - bool foundMp3 = false; - for (const auto& ext : extensions) { - if (ext.equalsIgnoreCase (".mp3") || ext.equalsIgnoreCase ("mp3")) + Array extensions = format->getFileExtensions (AudioFormat::forWriting); + EXPECT_FALSE (extensions.isEmpty()); + + bool foundMp3 = false; + for (const auto& ext : extensions) { - foundMp3 = true; - break; + if (ext.equalsIgnoreCase (".mp3") || ext.equalsIgnoreCase ("mp3")) + { + foundMp3 = true; + break; + } } + EXPECT_TRUE (foundMp3); } - EXPECT_TRUE (foundMp3); } TEST_F (Mp3AudioFormatTests, GetPossibleBitDepthsAndSampleRates) diff --git a/tests/yup_audio_formats/yup_OpusAudioFormat.cpp b/tests/yup_audio_formats/yup_OpusAudioFormat.cpp index 41dc7c1cb..ccb51ecf1 100644 --- a/tests/yup_audio_formats/yup_OpusAudioFormat.cpp +++ b/tests/yup_audio_formats/yup_OpusAudioFormat.cpp @@ -65,19 +65,37 @@ TEST_F (OpusAudioFormatTests, GetFormatNameReturnsOpus) TEST_F (OpusAudioFormatTests, GetFileExtensionsIncludesOpus) { - Array extensions = format->getFileExtensions(); - EXPECT_FALSE (extensions.isEmpty()); + { + Array extensions = format->getFileExtensions (AudioFormat::forReading); + EXPECT_FALSE (extensions.isEmpty()); + + bool foundOpus = false; + for (const auto& ext : extensions) + { + if (ext.equalsIgnoreCase (".opus") || ext.equalsIgnoreCase ("opus")) + { + foundOpus = true; + break; + } + } + EXPECT_TRUE (foundOpus); + } - bool foundOpus = false; - for (const auto& ext : extensions) { - if (ext.equalsIgnoreCase (".opus") || ext.equalsIgnoreCase ("opus")) + Array extensions = format->getFileExtensions (AudioFormat::forWriting); + EXPECT_FALSE (extensions.isEmpty()); + + bool foundOpus = false; + for (const auto& ext : extensions) { - foundOpus = true; - break; + if (ext.equalsIgnoreCase (".opus") || ext.equalsIgnoreCase ("opus")) + { + foundOpus = true; + break; + } } + EXPECT_TRUE (foundOpus); } - EXPECT_TRUE (foundOpus); } TEST_F (OpusAudioFormatTests, GetPossibleBitDepthsAndSampleRates) diff --git a/tests/yup_audio_formats/yup_WaveAudioFormat.cpp b/tests/yup_audio_formats/yup_WaveAudioFormat.cpp index f95158c7f..991103863 100644 --- a/tests/yup_audio_formats/yup_WaveAudioFormat.cpp +++ b/tests/yup_audio_formats/yup_WaveAudioFormat.cpp @@ -81,19 +81,37 @@ TEST_F (WaveAudioFormatTests, GetFormatNameReturnsWave) TEST_F (WaveAudioFormatTests, GetFileExtensionsIncludesWav) { - Array extensions = format->getFileExtensions(); - EXPECT_FALSE (extensions.isEmpty()); + { + Array extensions = format->getFileExtensions (AudioFormat::forReading); + EXPECT_FALSE (extensions.isEmpty()); + + bool foundWav = false; + for (const auto& ext : extensions) + { + if (ext.equalsIgnoreCase (".wav") || ext.equalsIgnoreCase ("wav")) + { + foundWav = true; + break; + } + } + EXPECT_TRUE (foundWav); + } - bool foundWav = false; - for (const auto& ext : extensions) { - if (ext.equalsIgnoreCase (".wav") || ext.equalsIgnoreCase ("wav")) + Array extensions = format->getFileExtensions (AudioFormat::forWriting); + EXPECT_FALSE (extensions.isEmpty()); + + bool foundWav = false; + for (const auto& ext : extensions) { - foundWav = true; - break; + if (ext.equalsIgnoreCase (".wav") || ext.equalsIgnoreCase ("wav")) + { + foundWav = true; + break; + } } + EXPECT_TRUE (foundWav); } - EXPECT_TRUE (foundWav); } TEST_F (WaveAudioFormatTests, GetPossibleBitDepthsIsNotEmpty) diff --git a/thirdparty/dr_libs/dr_libs.cpp b/thirdparty/dr_libs/dr_libs.cpp index 5af46054c..1228a78ee 100644 --- a/thirdparty/dr_libs/dr_libs.cpp +++ b/thirdparty/dr_libs/dr_libs.cpp @@ -20,7 +20,7 @@ */ #define DR_MP3_IMPLEMENTATION -#include +#include #define DR_WAV_IMPLEMENTATION -#include +#include diff --git a/thirdparty/dr_libs/dr_libs.h b/thirdparty/dr_libs/dr_libs.h index f0b46e75a..fb23a4d02 100644 --- a/thirdparty/dr_libs/dr_libs.h +++ b/thirdparty/dr_libs/dr_libs.h @@ -43,7 +43,7 @@ #pragma once #define DR_MP3_NO_STDIO 1 -#include +#include #define DR_WAV_NO_STDIO 1 -#include +#include \ No newline at end of file diff --git a/thirdparty/flac_library/flac_library.h b/thirdparty/flac_library/flac_library.h index 7efda7d1c..394d70b99 100644 --- a/thirdparty/flac_library/flac_library.h +++ b/thirdparty/flac_library/flac_library.h @@ -33,9 +33,10 @@ upstream: https://ftp.osuosl.org/pub/xiph/releases/flac/flac-1.5.0.tar.xz license: BSD - defines: FLAC__NO_DLL=1 FLAC__HAS_OGG=0 + dependencies: libogg + defines: FLAC__NO_DLL=1 FLAC__HAS_OGG=1 HAVE_LROUND=1 macDefines: FLAC__SYS_DARWIN=1 - searchpaths: include src src/libFLAC src/libFLAC/include + searchpaths: include src/libFLAC src/libFLAC/include END_YUP_MODULE_DECLARATION diff --git a/thirdparty/flac_library/flac_library_1.c b/thirdparty/flac_library/flac_library_1.c index cfc268341..9ab504273 100644 --- a/thirdparty/flac_library/flac_library_1.c +++ b/thirdparty/flac_library/flac_library_1.c @@ -21,39 +21,32 @@ #include "flac_include_pre.h" -#include "bitmath.c" -#include "bitreader.c" -#include "bitwriter.c" -#include "cpu.c" -#include "crc.c" -#include "fixed_intrin_avx2.c" -#include "fixed_intrin_sse2.c" -#include "fixed_intrin_sse42.c" -#include "fixed_intrin_ssse3.c" +#include +#include +#include +#include +#include +#include +#include +#include +#include #if defined(CHECK_ORDER_IS_VALID) #undef CHECK_ORDER_IS_VALID #endif -#include "fixed.c" -#include "float.c" -#include "format.c" -#include "lpc.c" -#include "lpc_intrin_avx2.c" -#include "lpc_intrin_fma.c" -#include "lpc_intrin_neon.c" -#include "lpc_intrin_sse2.c" -#include "lpc_intrin_sse41.c" -#include "md5.c" -#include "memory.c" -#include "stream_decoder.c" -#include "window.c" - -//#include "metadata_iterators.c" -//#include "metadata_object.c" -//#include "ogg_decoder_aspect.c" -//#include "ogg_encoder_aspect.c" -//#include "ogg_helper.c" -//#include "ogg_mapping.c" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "flac_include_post.h" diff --git a/thirdparty/flac_library/flac_library_2.c b/thirdparty/flac_library/flac_library_2.c index 514981667..584ca891d 100644 --- a/thirdparty/flac_library/flac_library_2.c +++ b/thirdparty/flac_library/flac_library_2.c @@ -21,14 +21,14 @@ #include "flac_include_pre.h" -#include "stream_encoder_framing.c" -#include "stream_encoder_intrin_avx2.c" -#include "stream_encoder_intrin_sse2.c" -#include "stream_encoder_intrin_ssse3.c" -#include "stream_encoder.c" +#include "flac_library/src/libFLAC/stream_encoder_framing.c" +#include "flac_library/src/libFLAC/stream_encoder_intrin_avx2.c" +#include "flac_library/src/libFLAC/stream_encoder_intrin_sse2.c" +#include "flac_library/src/libFLAC/stream_encoder_intrin_ssse3.c" +#include "flac_library/src/libFLAC/stream_encoder.c" #if _MSC_VER -#include "share/win_utf8_io/win_utf8_io.c" +#include "flac_library/src/share/win_utf8_io/win_utf8_io.c" #endif #include "flac_include_post.h" diff --git a/thirdparty/flac_library/flac_library_3.c b/thirdparty/flac_library/flac_library_3.c new file mode 100644 index 000000000..ceec61d76 --- /dev/null +++ b/thirdparty/flac_library/flac_library_3.c @@ -0,0 +1,47 @@ +/* + ============================================================================== + + This file is part of the YUP library. + Copyright (c) 2025 - kunitoki@gmail.com + + YUP is an open source library subject to open-source licensing. + + The code included in this file is provided under the terms of the ISC license + http://www.isc.org/downloads/software-support-policy/isc-license. Permission + to use, copy, modify, and/or distribute this software for any purpose with or + without fee is hereby granted provided that the above copyright notice and + this permission notice appear in all copies. + + YUP IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER + EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE + DISCLAIMED. + + ============================================================================== +*/ + +#include "flac_include_pre.h" + +#if FLAC__HAS_OGG +#define write_callback_ write_callback_flac_ogg_x_ +#define metadata_callback_ metadata_callback_flac_ogg_x_ +#define error_callback_ error_callback_flac_ogg_x_ +#include +#undef write_callback_ +#undef metadata_callback_ +#undef error_callback_ + +#define write_callback_ write_callback_flac_ogg_y_ +#define metadata_callback_ metadata_callback_flac_ogg_y_ +#define error_callback_ error_callback_flac_ogg_y_ +#include +#undef write_callback_ +#undef metadata_callback_ +#undef error_callback_ + +#include +#include +#include +#include +#endif + +#include "flac_include_post.h" diff --git a/thirdparty/hmp3_library/hmp3_library.h b/thirdparty/hmp3_library/hmp3_library.h index 40bfd31f7..e8c66c1a6 100644 --- a/thirdparty/hmp3_library/hmp3_library.h +++ b/thirdparty/hmp3_library/hmp3_library.h @@ -34,7 +34,7 @@ license: RPSL defines: IEEE_FLOAT=1 _FILE_OFFSET_BITS=64 - searchpaths: hmp3/src/pub hmp3/src + searchpaths: hmp3/src/pub END_YUP_MODULE_DECLARATION diff --git a/thirdparty/hmp3_library/hmp3_library_1.c b/thirdparty/hmp3_library/hmp3_library_1.c index 40b7c9bc1..6b54ee588 100644 --- a/thirdparty/hmp3_library/hmp3_library_1.c +++ b/thirdparty/hmp3_library/hmp3_library_1.c @@ -28,18 +28,20 @@ #pragma clang diagnostic ignored "-Wincompatible-pointer-types" #endif -#include "cnt.c" -#include "emap.c" -#include "filter2.c" -#include "hwin.c" -#include "l3init.c" -#include "l3pack.c" -#include "pcmhpm.c" -#include "sbt.c" -#include "spdsmr.c" -#include "xhwin.c" -#include "xsbt.c" -#include "detect.c" +#define mdct_init hmp3_mdct_init +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#undef mdct_init #if defined(__clang__) #pragma clang diagnostic pop diff --git a/thirdparty/hmp3_library/hmp3_library_1.cpp b/thirdparty/hmp3_library/hmp3_library_1.cpp index 450190f37..d7e5d14e8 100644 --- a/thirdparty/hmp3_library/hmp3_library_1.cpp +++ b/thirdparty/hmp3_library/hmp3_library_1.cpp @@ -29,7 +29,9 @@ #pragma clang diagnostic ignored "-Wparentheses-equality" #endif -#include "bitallo3.cpp" +#define mdct_init hmp3_mdct_init +#include +#undef mdct_init #if defined(__clang__) #pragma clang diagnostic pop diff --git a/thirdparty/hmp3_library/hmp3_library_2.c b/thirdparty/hmp3_library/hmp3_library_2.c index dd699b65f..faec7fa49 100644 --- a/thirdparty/hmp3_library/hmp3_library_2.c +++ b/thirdparty/hmp3_library/hmp3_library_2.c @@ -28,9 +28,11 @@ #pragma clang diagnostic ignored "-Wincompatible-pointer-types" #endif -#include "amodini2.c" -#include "xhead.c" -#include "cnts.c" +#define mdct_init hmp3_mdct_init +#include +#include +#include +#undef mdct_init #if defined(__clang__) #pragma clang diagnostic pop diff --git a/thirdparty/hmp3_library/hmp3_library_2.cpp b/thirdparty/hmp3_library/hmp3_library_2.cpp index 9e36ec8e6..330465659 100644 --- a/thirdparty/hmp3_library/hmp3_library_2.cpp +++ b/thirdparty/hmp3_library/hmp3_library_2.cpp @@ -28,7 +28,9 @@ #pragma clang diagnostic ignored "-Wincompatible-pointer-types" #endif -#include "bitallosc.cpp" +#define mdct_init hmp3_mdct_init +#include +#undef mdct_init #if defined(__clang__) #pragma clang diagnostic pop diff --git a/thirdparty/hmp3_library/hmp3_library_3.c b/thirdparty/hmp3_library/hmp3_library_3.c index 804d70440..870630994 100644 --- a/thirdparty/hmp3_library/hmp3_library_3.c +++ b/thirdparty/hmp3_library/hmp3_library_3.c @@ -28,9 +28,11 @@ #pragma clang diagnostic ignored "-Wincompatible-pointer-types" #endif -#include "setup.c" -#include "l3math.c" -#include "pow34.c" +#define mdct_init hmp3_mdct_init +#include +#include +#include +#undef mdct_init #if defined(__clang__) #pragma clang diagnostic pop diff --git a/thirdparty/hmp3_library/hmp3_library_3.cpp b/thirdparty/hmp3_library/hmp3_library_3.cpp index 63fd7a6de..6b29eae68 100644 --- a/thirdparty/hmp3_library/hmp3_library_3.cpp +++ b/thirdparty/hmp3_library/hmp3_library_3.cpp @@ -29,13 +29,15 @@ #pragma clang diagnostic ignored "-Wparentheses-equality" #endif -#include "bitallo.cpp" -#include "bitallo1.cpp" -#include "bitalloc.cpp" -#include "bitallos.cpp" -#include "mp3enc.cpp" -#include "srcc.cpp" -#include "srccf.cpp" +#define mdct_init hmp3_mdct_init +#include +#include +#include +#include +#include +#include +#include +#undef mdct_init #if defined(__clang__) #pragma clang diagnostic pop diff --git a/thirdparty/hmp3_library/hmp3_library_4.c b/thirdparty/hmp3_library/hmp3_library_4.c index 91bc271df..139b03133 100644 --- a/thirdparty/hmp3_library/hmp3_library_4.c +++ b/thirdparty/hmp3_library/hmp3_library_4.c @@ -28,8 +28,10 @@ #pragma clang diagnostic ignored "-Wincompatible-pointer-types" #endif -#include "emdct.c" -#include "mhead.c" +#define mdct_init hmp3_mdct_init +#include +#include +#undef mdct_init #if defined(__clang__) #pragma clang diagnostic pop diff --git a/thirdparty/libogg/libogg.c b/thirdparty/libogg/libogg.c new file mode 100644 index 000000000..daa2ea5be --- /dev/null +++ b/thirdparty/libogg/libogg.c @@ -0,0 +1,40 @@ +/* + ============================================================================== + + This file is part of the YUP library. + Copyright (c) 2025 - kunitoki@gmail.com + + YUP is an open source library subject to open-source licensing. + + The code included in this file is provided under the terms of the ISC license + http://www.isc.org/downloads/software-support-policy/isc-license. Permission + to use, copy, modify, and/or distribute this software for any purpose with or + without fee is hereby granted provided that the above copyright notice and + this permission notice appear in all copies. + + YUP IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER + EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE + DISCLAIMED. + + ============================================================================== +*/ + +#include "libogg.h" + +#if defined(_MSC_VER) +#pragma warning (push) +#pragma warning (disable: 6308) +#else +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wshorten-64-to-32" +#endif + + +#include +#include + +#if defined(_MSC_VER) +#pragma warning (pop) +#else +#pragma clang diagnostic pop +#endif diff --git a/thirdparty/libogg/libogg.h b/thirdparty/libogg/libogg.h new file mode 100644 index 000000000..e9f9b3d6e --- /dev/null +++ b/thirdparty/libogg/libogg.h @@ -0,0 +1,45 @@ +/* + ============================================================================== + + This file is part of the YUP library. + Copyright (c) 2025 - kunitoki@gmail.com + + YUP is an open source library subject to open-source licensing. + + The code included in this file is provided under the terms of the ISC license + http://www.isc.org/downloads/software-support-policy/isc-license. Permission + to use, copy, modify, and/or distribute this software for any purpose with or + without fee is hereby granted provided that the above copyright notice and + this permission notice appear in all copies. + + YUP IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER + EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE + DISCLAIMED. + + ============================================================================== +*/ + +/* + ============================================================================== + + BEGIN_YUP_MODULE_DECLARATION + + ID: libogg + vendor: libogg + version: 1.3.6 + name: Libogg contains necessary functionality to create, decode, and work with Ogg bitstreams + description: Libogg contains necessary functionality to create, decode, and work with Ogg bitstreams. + website: https://xiph.org/ogg/doc/ + upstream: https://downloads.xiph.org/releases/ogg/libogg-1.3.6.tar.xz + license: MIT + + searchpaths: include + + END_YUP_MODULE_DECLARATION + + ============================================================================== +*/ + +#pragma once + +#include diff --git a/thirdparty/libogg/ogg/config_types.h b/thirdparty/libogg/ogg/config_types.h new file mode 100644 index 000000000..abc8be25a --- /dev/null +++ b/thirdparty/libogg/ogg/config_types.h @@ -0,0 +1,23 @@ +#ifndef __CONFIG_TYPES_H__ +#define __CONFIG_TYPES_H__ + +#if __has_include() +#include +#endif + +#if __has_include() +#include +#endif + +#if __has_include() +#include +#endif + +typedef int16_t ogg_int16_t; +typedef unsigned short ogg_uint16_t; +typedef int32_t ogg_int32_t; +typedef unsigned int ogg_uint32_t; +typedef int64_t ogg_int64_t; +typedef unsigned long long ogg_uint64_t; + +#endif \ No newline at end of file diff --git a/thirdparty/libvorbis/libvorbis.h b/thirdparty/libvorbis/libvorbis.h new file mode 100644 index 000000000..589ad000b --- /dev/null +++ b/thirdparty/libvorbis/libvorbis.h @@ -0,0 +1,47 @@ +/* + ============================================================================== + + This file is part of the YUP library. + Copyright (c) 2025 - kunitoki@gmail.com + + YUP is an open source library subject to open-source licensing. + + The code included in this file is provided under the terms of the ISC license + http://www.isc.org/downloads/software-support-policy/isc-license. Permission + to use, copy, modify, and/or distribute this software for any purpose with or + without fee is hereby granted provided that the above copyright notice and + this permission notice appear in all copies. + + YUP IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER + EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE + DISCLAIMED. + + ============================================================================== +*/ + +/* + ============================================================================== + + BEGIN_YUP_MODULE_DECLARATION + + ID: libvorbis + vendor: libvorbis + version: 1.3.6 + name: Vorbis is a general purpose perceptual audio CODEC intended to allow maximum encoder flexibility + description: Vorbis is a general purpose perceptual audio CODEC intended to allow maximum encoder flexibility. + website: https://xiph.org/ogg/doc/ + upstream: https://downloads.xiph.org/releases/vorbis/libvorbis-1.3.7.tar.xz + license: MIT + + dependencies: libogg + searchpaths: include lib + + END_YUP_MODULE_DECLARATION + + ============================================================================== +*/ + +#pragma once + +#include +#include diff --git a/thirdparty/libvorbis/libvorbis_1.c b/thirdparty/libvorbis/libvorbis_1.c new file mode 100644 index 000000000..2d7dcf464 --- /dev/null +++ b/thirdparty/libvorbis/libvorbis_1.c @@ -0,0 +1,50 @@ +/* + ============================================================================== + + This file is part of the YUP library. + Copyright (c) 2025 - kunitoki@gmail.com + + YUP is an open source library subject to open-source licensing. + + The code included in this file is provided under the terms of the ISC license + http://www.isc.org/downloads/software-support-policy/isc-license. Permission + to use, copy, modify, and/or distribute this software for any purpose with or + without fee is hereby granted provided that the above copyright notice and + this permission notice appear in all copies. + + YUP IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER + EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE + DISCLAIMED. + + ============================================================================== +*/ + +#include "libvorbis.h" + +#include "libvorbis_include_pre.h" + +#include +#include +#include +#include +#include +#define FLOOR1_fromdB_LOOKUP FLOOR1_fromdB_LOOKUP_floor1_c +#include +#undef FLOOR1_fromdB_LOOKUP +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libvorbis_include_post.h" diff --git a/thirdparty/libvorbis/libvorbis_2.c b/thirdparty/libvorbis/libvorbis_2.c new file mode 100644 index 000000000..de4af686b --- /dev/null +++ b/thirdparty/libvorbis/libvorbis_2.c @@ -0,0 +1,28 @@ +/* + ============================================================================== + + This file is part of the YUP library. + Copyright (c) 2025 - kunitoki@gmail.com + + YUP is an open source library subject to open-source licensing. + + The code included in this file is provided under the terms of the ISC license + http://www.isc.org/downloads/software-support-policy/isc-license. Permission + to use, copy, modify, and/or distribute this software for any purpose with or + without fee is hereby granted provided that the above copyright notice and + this permission notice appear in all copies. + + YUP IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER + EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE + DISCLAIMED. + + ============================================================================== +*/ + +#include "libvorbis.h" + +#include "libvorbis_include_pre.h" + +#include + +#include "libvorbis_include_post.h" diff --git a/thirdparty/libvorbis/libvorbis_include_post.h b/thirdparty/libvorbis/libvorbis_include_post.h new file mode 100644 index 000000000..317e9a221 --- /dev/null +++ b/thirdparty/libvorbis/libvorbis_include_post.h @@ -0,0 +1,26 @@ +/* + ============================================================================== + + This file is part of the YUP library. + Copyright (c) 2025 - kunitoki@gmail.com + + YUP is an open source library subject to open-source licensing. + + The code included in this file is provided under the terms of the ISC license + http://www.isc.org/downloads/software-support-policy/isc-license. Permission + to use, copy, modify, and/or distribute this software for any purpose with or + without fee is hereby granted provided that the above copyright notice and + this permission notice appear in all copies. + + YUP IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER + EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE + DISCLAIMED. + + ============================================================================== +*/ + +#if defined(_MSC_VER) +#pragma warning (pop) +#else +#pragma clang diagnostic pop +#endif diff --git a/thirdparty/libvorbis/libvorbis_include_pre.h b/thirdparty/libvorbis/libvorbis_include_pre.h new file mode 100644 index 000000000..c5640e0b5 --- /dev/null +++ b/thirdparty/libvorbis/libvorbis_include_pre.h @@ -0,0 +1,59 @@ +/* + ============================================================================== + + This file is part of the YUP library. + Copyright (c) 2025 - kunitoki@gmail.com + + YUP is an open source library subject to open-source licensing. + + The code included in this file is provided under the terms of the ISC license + http://www.isc.org/downloads/software-support-policy/isc-license. Permission + to use, copy, modify, and/or distribute this software for any purpose with or + without fee is hereby granted provided that the above copyright notice and + this permission notice appear in all copies. + + YUP IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER + EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE + DISCLAIMED. + + ============================================================================== +*/ + +#if defined(_MSC_VER) +#pragma warning (push) +#pragma warning (disable: 4267) +#pragma warning (disable: 4127) +#pragma warning (disable: 4244) +#pragma warning (disable: 4996) +#pragma warning (disable: 4100) +#pragma warning (disable: 4701) +#pragma warning (disable: 4702) +#pragma warning (disable: 4013) +#pragma warning (disable: 4133) +#pragma warning (disable: 4312) +#pragma warning (disable: 4505) +#pragma warning (disable: 4365) +#pragma warning (disable: 4005) +#pragma warning (disable: 4334) +#pragma warning (disable: 181) +#pragma warning (disable: 111) +#pragma warning (disable: 6340) +#pragma warning (disable: 6308) +#pragma warning (disable: 6297) +#pragma warning (disable: 6001) +#pragma warning (disable: 6320) +#else +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconversion" +#pragma clang diagnostic ignored "-Wdeprecated-register" +#pragma clang diagnostic ignored "-Wfloat-equal" +#pragma clang diagnostic ignored "-Wimplicit-fallthrough" +#pragma clang diagnostic ignored "-Wlanguage-extension-token" +#pragma clang diagnostic ignored "-Wredundant-decls" +#pragma clang diagnostic ignored "-Wshadow" +#pragma clang diagnostic ignored "-Wsign-conversion" +#pragma clang diagnostic ignored "-Wstatic-in-inline" +#pragma clang diagnostic ignored "-Wswitch-default" +#pragma clang diagnostic ignored "-Wswitch-enum" +#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" +#endif \ No newline at end of file diff --git a/thirdparty/opus_library/opus_library.c b/thirdparty/opus_library/opus_library.c index 677a937f4..cee5b6c7c 100644 --- a/thirdparty/opus_library/opus_library.c +++ b/thirdparty/opus_library/opus_library.c @@ -36,20 +36,20 @@ #pragma clang diagnostic ignored "-Wshorten-64-to-32" #endif -#include "src/opus.c" -#include "src/opus_decoder.c" -#include "src/opus_encoder.c" -#include "src/extensions.c" -#include "src/opus_multistream.c" -#include "src/opus_multistream_encoder.c" -#include "src/opus_multistream_decoder.c" -#include "src/repacketizer.c" -#include "src/opus_projection_encoder.c" -#include "src/opus_projection_decoder.c" -#include "src/mapping_matrix.c" -#include "src/analysis.c" -#include "src/mlp.c" -#include "src/mlp_data.c" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #if defined(__clang__) #pragma clang diagnostic pop diff --git a/thirdparty/opus_library/opus_library.h b/thirdparty/opus_library/opus_library.h index 007738fb5..a308ffc47 100644 --- a/thirdparty/opus_library/opus_library.h +++ b/thirdparty/opus_library/opus_library.h @@ -35,7 +35,7 @@ license: BSD defines: ENABLE_QEXT=1 - searchpaths: include celt silk silk/float silk/fixed dnn + searchpaths: include celt silk silk/float dnn END_YUP_MODULE_DECLARATION diff --git a/thirdparty/opus_library/opus_library_celt.c b/thirdparty/opus_library/opus_library_celt.c index 4b9f2ca37..09e4b8b63 100644 --- a/thirdparty/opus_library/opus_library_celt.c +++ b/thirdparty/opus_library/opus_library_celt.c @@ -32,32 +32,32 @@ #define CELT_ENCODER_C 1 #define CELT_DECODER_C 1 -#include "opus_custom.h" +#include #undef CELT_ENCODER_C #undef CELT_DECODER_C -#include "celt/bands.c" -#include "celt/celt.c" -#include "celt/celt_encoder.c" -#include "celt/celt_decoder.c" -#include "celt/cwrs.c" -#include "celt/entcode.c" -#include "celt/entdec.c" -#include "celt/entenc.c" -#include "celt/kiss_fft.c" -#include "celt/laplace.c" -#include "celt/mathops.c" -#include "celt/mdct.c" -#include "celt/modes.c" -#include "celt/pitch.c" -#include "celt/celt_lpc.c" -#include "celt/quant_bands.c" -#include "celt/rate.c" -#include "celt/vq.c" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #if defined(OPUS_ARM_PRESUME_NEON_INTR) -#include "celt/arm/pitch_neon_intr.c" -#include "celt/arm/celt_neon_intr.c" +#include +#include #endif #if defined(__clang__) diff --git a/thirdparty/opus_library/opus_library_silk.c b/thirdparty/opus_library/opus_library_silk.c index f51d3d485..f05150bfe 100644 --- a/thirdparty/opus_library/opus_library_silk.c +++ b/thirdparty/opus_library/opus_library_silk.c @@ -24,121 +24,121 @@ #include "opus_library.h" -#include "silk/CNG.c" -#include "silk/code_signs.c" -#include "silk/init_decoder.c" -#include "silk/decode_core.c" -#include "silk/decode_frame.c" -#include "silk/decode_parameters.c" -#include "silk/decode_indices.c" -#include "silk/decode_pulses.c" -#include "silk/decoder_set_fs.c" -#include "silk/dec_API.c" -#include "silk/enc_API.c" -#include "silk/encode_indices.c" -#include "silk/encode_pulses.c" -#include "silk/gain_quant.c" -#include "silk/interpolate.c" -#include "silk/LP_variable_cutoff.c" -#include "silk/NLSF_decode.c" -#include "silk/NSQ.c" -#include "silk/NSQ_del_dec.c" -#include "silk/PLC.c" -#include "silk/shell_coder.c" -#include "silk/tables_gain.c" -#include "silk/tables_LTP.c" -#include "silk/tables_NLSF_CB_NB_MB.c" -#include "silk/tables_NLSF_CB_WB.c" -#include "silk/tables_other.c" -#include "silk/tables_pitch_lag.c" -#include "silk/tables_pulses_per_block.c" -#include "silk/VAD.c" -#include "silk/control_audio_bandwidth.c" -#include "silk/quant_LTP_gains.c" -#include "silk/VQ_WMat_EC.c" -#include "silk/HP_variable_cutoff.c" -#include "silk/NLSF_encode.c" -#include "silk/NLSF_VQ.c" -#include "silk/NLSF_unpack.c" -#include "silk/NLSF_del_dec_quant.c" -#include "silk/process_NLSFs.c" -#include "silk/stereo_LR_to_MS.c" -#include "silk/stereo_MS_to_LR.c" -#include "silk/check_control_input.c" -#include "silk/control_SNR.c" -#include "silk/init_encoder.c" -#include "silk/control_codec.c" -#include "silk/A2NLSF.c" -#include "silk/ana_filt_bank_1.c" -#include "silk/biquad_alt.c" -#include "silk/bwexpander_32.c" -#include "silk/bwexpander.c" -#include "silk/debug.c" -#include "silk/decode_pitch.c" -#include "silk/inner_prod_aligned.c" -#include "silk/lin2log.c" -#include "silk/log2lin.c" -#include "silk/LPC_analysis_filter.c" -#include "silk/LPC_inv_pred_gain.c" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #undef QA -#include "silk/table_LSF_cos.c" -#include "silk/NLSF2A.c" +#include +#include #undef QA -#include "silk/NLSF_stabilize.c" -#include "silk/NLSF_VQ_weights_laroia.c" -#include "silk/pitch_est_tables.c" -#include "silk/resampler.c" -#include "silk/resampler_down2_3.c" -#include "silk/resampler_down2.c" -#include "silk/resampler_private_AR2.c" -#include "silk/resampler_private_down_FIR.c" -#include "silk/resampler_private_IIR_FIR.c" -#include "silk/resampler_private_up2_HQ.c" -#include "silk/resampler_rom.c" -#include "silk/sigm_Q15.c" -#include "silk/sort.c" -#include "silk/sum_sqr_shift.c" -#include "silk/stereo_decode_pred.c" -#include "silk/stereo_encode_pred.c" -#include "silk/stereo_find_predictor.c" -#include "silk/stereo_quant_pred.c" -#include "silk/LPC_fit.c" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #if defined(OPUS_ARM_PRESUME_NEON_INTR) -#include "silk/arm/biquad_alt_neon_intr.c" -#include "silk/arm/LPC_inv_pred_gain_neon_intr.c" -#include "silk/arm/NSQ_del_dec_neon_intr.c" -#include "silk/arm/NSQ_neon.c" +#include +#include +#include +#include #if defined(FIXED_POINT) -#include "silk/fixed/arm/warped_autocorrelation_FIX_neon_intr.c" +#include #endif #endif -#include "silk/float/apply_sine_window_FLP.c" -#include "silk/float/corrMatrix_FLP.c" -#include "silk/float/encode_frame_FLP.c" -#include "silk/float/find_LPC_FLP.c" -#include "silk/float/find_LTP_FLP.c" -#include "silk/float/find_pitch_lags_FLP.c" -#include "silk/float/find_pred_coefs_FLP.c" -#include "silk/float/LPC_analysis_filter_FLP.c" -#include "silk/float/LTP_analysis_filter_FLP.c" -#include "silk/float/LTP_scale_ctrl_FLP.c" -#include "silk/float/noise_shape_analysis_FLP.c" -#include "silk/float/process_gains_FLP.c" -#include "silk/float/regularize_correlations_FLP.c" -#include "silk/float/residual_energy_FLP.c" -#include "silk/float/warped_autocorrelation_FLP.c" -#include "silk/float/wrappers_FLP.c" -#include "silk/float/autocorrelation_FLP.c" -#include "silk/float/burg_modified_FLP.c" -#include "silk/float/bwexpander_FLP.c" -#include "silk/float/energy_FLP.c" -#include "silk/float/inner_product_FLP.c" -#include "silk/float/k2a_FLP.c" -#include "silk/float/LPC_inv_pred_gain_FLP.c" -#include "silk/float/pitch_analysis_core_FLP.c" -#include "silk/float/scale_copy_vector_FLP.c" -#include "silk/float/scale_vector_FLP.c" -#include "silk/float/schur_FLP.c" -#include "silk/float/sort_FLP.c" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include diff --git a/thirdparty/pffft_library/pffft_library.c b/thirdparty/pffft_library/pffft_library.c index b76e8551a..5406c7961 100644 --- a/thirdparty/pffft_library/pffft_library.c +++ b/thirdparty/pffft_library/pffft_library.c @@ -26,9 +26,9 @@ #pragma clang diagnostic ignored "-W#pragma-messages" #endif -#include -#include -#include +#include +#include +#include #if defined(__clang__) #pragma clang diagnostic pop diff --git a/thirdparty/pffft_library/pffft_library.h b/thirdparty/pffft_library/pffft_library.h index 2a268b5c6..cc54b6ee4 100644 --- a/thirdparty/pffft_library/pffft_library.h +++ b/thirdparty/pffft_library/pffft_library.h @@ -44,4 +44,4 @@ #pragma once -#include +#include diff --git a/thirdparty/pffft_library/pffft_library_double.c b/thirdparty/pffft_library/pffft_library_double.c index 3bcef4ec4..d0d2ab8ea 100644 --- a/thirdparty/pffft_library/pffft_library_double.c +++ b/thirdparty/pffft_library/pffft_library_double.c @@ -30,7 +30,7 @@ #undef _USE_MATH_DEFINES #endif -#include +#include #if defined(__clang__) #pragma clang diagnostic pop