Skip to content

Commit ac21043

Browse files
authored
Added support for ogg vorbis
1 parent 2f0bb63 commit ac21043

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1592
-424
lines changed

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -113,20 +113,20 @@ YUP brings a suite of powerful features, including:
113113

114114
## Supported Sound Formats
115115

116-
| | **Wav** | **Wav64** | **Mp3** | **OGG** | **Flac** | **Opus** | **AAC** | **WMF** |
117-
|-------------------|:------------------:|:------------------:|:------------------:|:--------------:|:------------------:|:------------------:|:------------------:|:--------------:|
118-
| **Windows** (enc) | :white_check_mark: | :white_check_mark: | :white_check_mark: | :construction: | :white_check_mark: | :white_check_mark: | :construction: | :construction: |
119-
| **Windows** (dec) | :white_check_mark: | :white_check_mark: | :construction: | :construction: | :white_check_mark: | :white_check_mark: | :construction: | :construction: |
120-
| **macOS** (enc) | :white_check_mark: | :white_check_mark: | :white_check_mark: | :construction: | :white_check_mark: | :white_check_mark: | :white_check_mark: | |
121-
| **macOS** (dec) | :white_check_mark: | :white_check_mark: | :white_check_mark: | :construction: | :white_check_mark: | :white_check_mark: | :white_check_mark: | |
122-
| **Linux** (enc) | :white_check_mark: | :white_check_mark: | :white_check_mark: | :construction: | :white_check_mark: | :white_check_mark: | | |
123-
| **Linux** (dec) | :white_check_mark: | :white_check_mark: | :construction: | :construction: | :white_check_mark: | :white_check_mark: | | |
124-
| **WASM** (enc) | :white_check_mark: | :white_check_mark: | :white_check_mark: | :construction: | :white_check_mark: | :white_check_mark: | | |
125-
| **WASM** (dec) | :white_check_mark: | :white_check_mark: | :construction: | :construction: | :white_check_mark: | :white_check_mark: | | |
126-
| **Android** (enc) | :white_check_mark: | :white_check_mark: | :white_check_mark: | :construction: | :white_check_mark: | :white_check_mark: | | |
127-
| **Android** (dec) | :white_check_mark: | :white_check_mark: | :construction: | :construction: | :white_check_mark: | :white_check_mark: | | |
128-
| **iOS** (enc) | :white_check_mark: | :white_check_mark: | :white_check_mark: | :construction: | :white_check_mark: | :white_check_mark: | :white_check_mark: | |
129-
| **iOS** (dec) | :white_check_mark: | :white_check_mark: | :white_check_mark: | :construction: | :white_check_mark: | :white_check_mark: | :white_check_mark: | |
116+
| | **Wav** | **Wav64** | **Mp3** | **OGG** | **Flac** | **Opus** | **AAC** | **WMF** |
117+
|-------------------|:------------------:|:------------------:|:------------------:|:------------------:|:------------------:|:------------------:|:------------------:|:------------------:|
118+
| **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: |
119+
| **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: |
120+
| **macOS** (enc) | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | |
121+
| **macOS** (dec) | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | |
122+
| **Linux** (enc) | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | |
123+
| **Linux** (dec) | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | |
124+
| **WASM** (enc) | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | |
125+
| **WASM** (dec) | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | |
126+
| **Android** (enc) | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :construction: | |
127+
| **Android** (dec) | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :construction: | |
128+
| **iOS** (enc) | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | |
129+
| **iOS** (dec) | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | |
130130

131131
## Prerequisites
132132
Before building, ensure you have a:

cmake/yup_modules.cmake

Lines changed: 35 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ function (_yup_module_fetch_upstream module_name module_path module_upstream mod
108108

109109
_yup_message (STATUS "Fetching upstream sources for ${module_name}")
110110

111+
set (upstream_target_dir "${CMAKE_BINARY_DIR}/externals/${module_name}")
112+
111113
if (module_upstream)
112114
set (download_dir "${CMAKE_BINARY_DIR}/_yup_upstream_downloads")
113115
file (MAKE_DIRECTORY "${download_dir}")
@@ -139,28 +141,26 @@ function (_yup_module_fetch_upstream module_name module_path module_upstream mod
139141
endif()
140142
endif()
141143

142-
set (upstream_target_dir "${CMAKE_BINARY_DIR}/externals/${module_name}/upstream")
143-
file (REMOVE_RECURSE "${upstream_target_dir}")
144-
file (MAKE_DIRECTORY "${upstream_target_dir}")
145144
file (GLOB extracted_items "${source_dir}/*")
146145
if (extracted_items)
146+
file (REMOVE_RECURSE "${upstream_target_dir}")
147+
file (MAKE_DIRECTORY "${upstream_target_dir}")
147148
file (COPY ${extracted_items} DESTINATION "${upstream_target_dir}")
148149
endif()
149150
else()
150151
if (NOT module_branch)
151152
set (module_branch "HEAD")
152153
endif()
153154

154-
set (upstream_target_dir "${CMAKE_BINARY_DIR}/externals/${module_name}/upstream")
155155
if (module_submodules)
156156
set (module_submodules_recurse ON)
157157
else()
158158
set (module_submodules_recurse OFF)
159159
endif()
160160

161-
file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/externals/${module_name}")
162-
163161
file (REMOVE_RECURSE "${upstream_target_dir}")
162+
file (MAKE_DIRECTORY "${upstream_target_dir}")
163+
164164
set (module_branch_value "${module_branch}")
165165
string (STRIP "${module_branch_value}" module_branch_value)
166166
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
208208
list (APPEND clone_args "${module_repository}" "${upstream_target_dir}")
209209
execute_process (
210210
COMMAND ${clone_args}
211-
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/externals/${module_name}"
211+
WORKING_DIRECTORY "${upstream_target_dir}"
212212
RESULT_VARIABLE clone_result)
213213
endif()
214214

@@ -707,26 +707,29 @@ function (yup_add_module module_path modules_definitions module_group)
707707

708708
# ==== Prepare include paths
709709
get_filename_component (module_include_path ${module_path} DIRECTORY)
710-
list (APPEND module_include_paths "${module_include_path}")
710+
list (APPEND module_include_paths "${module_include_path}" "${module_path}")
711711

712712
if (module_upstream OR module_repository)
713713
_yup_module_get_upstream_path ("${module_name}" "${module_path}" module_upstream_path)
714714
if (module_upstream_path)
715-
list (APPEND module_include_paths "${module_upstream_path}")
715+
get_filename_component (module_upstream_include_path ${module_upstream_path} DIRECTORY)
716+
list (APPEND module_include_paths "${module_upstream_path}" "${module_upstream_include_path}")
716717
else()
717-
list (APPEND module_include_paths "${CMAKE_BINARY_DIR}/externals/${module_name}/upstream")
718+
list (APPEND module_include_paths "${CMAKE_BINARY_DIR}/externals")
718719
endif()
719720
endif()
720721

721722
foreach (searchpath IN LISTS module_searchpaths)
722-
if (EXISTS "${searchpath}")
723-
list (APPEND module_include_paths "${searchpath}")
724-
elseif (EXISTS "${module_path}/${searchpath}")
725-
list (APPEND module_include_paths "${module_path}/${searchpath}")
726-
elseif (module_upstream_path AND EXISTS "${module_upstream_path}/${searchpath}")
723+
if (module_upstream_path AND EXISTS "${module_upstream_path}/${searchpath}")
727724
list (APPEND module_include_paths "${module_upstream_path}/${searchpath}")
728725
elseif (module_upstream OR module_repository)
729-
list (APPEND module_include_paths "${CMAKE_BINARY_DIR}/externals/${module_name}/upstream/${searchpath}")
726+
if (EXISTS "${CMAKE_BINARY_DIR}/externals/${module_name}/${searchpath}")
727+
list (APPEND module_include_paths "${CMAKE_BINARY_DIR}/externals/${module_name}/${searchpath}")
728+
endif()
729+
elseif (EXISTS "${module_path}/${searchpath}")
730+
list (APPEND module_include_paths "${module_path}/${searchpath}")
731+
elseif (EXISTS "${searchpath}")
732+
list (APPEND module_include_paths "${searchpath}")
730733
endif()
731734
endforeach()
732735

@@ -821,60 +824,25 @@ macro (yup_add_default_modules modules_path)
821824

822825
# ==== Thirdparty modules
823826
set (thirdparty_group "Thirdparty")
824-
yup_add_module (${modules_path}/thirdparty/zlib "${modules_definitions}" ${thirdparty_group})
825-
yup_add_module (${modules_path}/thirdparty/glad "${modules_definitions}" ${thirdparty_group})
826-
yup_add_module (${modules_path}/thirdparty/harfbuzz "${modules_definitions}" ${thirdparty_group})
827-
yup_add_module (${modules_path}/thirdparty/libpng "${modules_definitions}" ${thirdparty_group})
828-
yup_add_module (${modules_path}/thirdparty/libwebp "${modules_definitions}" ${thirdparty_group})
829-
yup_add_module (${modules_path}/thirdparty/sheenbidi "${modules_definitions}" ${thirdparty_group})
830-
yup_add_module (${modules_path}/thirdparty/yoga_library "${modules_definitions}" ${thirdparty_group})
831-
yup_add_module (${modules_path}/thirdparty/rive "${modules_definitions}" ${thirdparty_group})
832-
yup_add_module (${modules_path}/thirdparty/rive_decoders "${modules_definitions}" ${thirdparty_group})
833-
yup_add_module (${modules_path}/thirdparty/rive_renderer "${modules_definitions}" ${thirdparty_group})
834-
yup_add_module (${modules_path}/thirdparty/oboe_library "${modules_definitions}" ${thirdparty_group})
835-
yup_add_module (${modules_path}/thirdparty/pffft_library "${modules_definitions}" ${thirdparty_group})
836-
yup_add_module (${modules_path}/thirdparty/dr_libs "${modules_definitions}" ${thirdparty_group})
837-
yup_add_module (${modules_path}/thirdparty/opus_library "${modules_definitions}" ${thirdparty_group})
838-
yup_add_module (${modules_path}/thirdparty/flac_library "${modules_definitions}" ${thirdparty_group})
839-
yup_add_module (${modules_path}/thirdparty/hmp3_library "${modules_definitions}" ${thirdparty_group})
827+
file (GLOB thirdparty_module_dirs "${modules_path}/thirdparty/*")
828+
foreach (thirdparty_module_dir IN LISTS thirdparty_module_dirs)
829+
if (IS_DIRECTORY "${thirdparty_module_dir}")
830+
get_filename_component (module_dir_name "${thirdparty_module_dir}" NAME)
831+
yup_add_module (${modules_path}/thirdparty/${module_dir_name} "${modules_definitions}" ${thirdparty_group})
832+
endif()
833+
endforeach()
840834

841835
# ==== Yup modules
842836
set (modules_group "Modules")
843-
yup_add_module (${modules_path}/modules/yup_core "${modules_definitions}" ${modules_group})
844-
add_library (yup::yup_core ALIAS yup_core)
845-
846-
yup_add_module (${modules_path}/modules/yup_events "${modules_definitions}" ${modules_group})
847-
add_library (yup::yup_events ALIAS yup_events)
848-
849-
yup_add_module (${modules_path}/modules/yup_data_model "${modules_definitions}" ${modules_group})
850-
add_library (yup::yup_data_model ALIAS yup_data_model)
851-
852-
yup_add_module (${modules_path}/modules/yup_dsp "${modules_definitions}" ${modules_group})
853-
add_library (yup::yup_dsp ALIAS yup_dsp)
854-
855-
yup_add_module (${modules_path}/modules/yup_graphics "${modules_definitions}" ${modules_group})
856-
add_library (yup::yup_graphics ALIAS yup_graphics)
857-
858-
yup_add_module (${modules_path}/modules/yup_gui "${modules_definitions}" ${modules_group})
859-
add_library (yup::yup_gui ALIAS yup_gui)
860-
861-
yup_add_module (${modules_path}/modules/yup_audio_basics "${modules_definitions}" ${modules_group})
862-
add_library (yup::yup_audio_basics ALIAS yup_audio_basics)
863-
864-
yup_add_module (${modules_path}/modules/yup_audio_devices "${modules_definitions}" ${modules_group})
865-
add_library (yup::yup_audio_devices ALIAS yup_audio_devices)
866-
867-
yup_add_module (${modules_path}/modules/yup_audio_formats "${modules_definitions}" ${modules_group})
868-
add_library (yup::yup_audio_formats ALIAS yup_audio_formats)
869-
870-
yup_add_module (${modules_path}/modules/yup_audio_processors "${modules_definitions}" ${modules_group})
871-
add_library (yup::yup_audio_processors ALIAS yup_audio_processors)
872-
873-
yup_add_module (${modules_path}/modules/yup_audio_gui "${modules_definitions}" ${modules_group})
874-
add_library (yup::yup_audio_gui ALIAS yup_audio_gui)
875-
876-
yup_add_module (${modules_path}/modules/yup_audio_plugin_client "${modules_definitions}" ${modules_group})
877-
add_library (yup::yup_audio_plugin_client ALIAS yup_audio_plugin_client)
837+
file (GLOB yup_module_dirs "${modules_path}/modules/*")
838+
list (FILTER yup_module_dirs EXCLUDE REGEX ".*yup_python.*")
839+
foreach (yup_module_dir IN LISTS yup_module_dirs)
840+
if (IS_DIRECTORY "${yup_module_dir}")
841+
get_filename_component (module_dir_name "${yup_module_dir}" NAME)
842+
yup_add_module (${modules_path}/modules/${module_dir_name} "${modules_definitions}" ${modules_group})
843+
add_library (yup::${module_dir_name} ALIAS ${module_dir_name})
844+
endif()
845+
endforeach()
878846

879847
if (YUP_ARG_ENABLE_PYTHON)
880848
if (NOT YUP_BUILD_WHEEL)

cmake/yup_utilities.cmake

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -206,21 +206,17 @@ endfunction()
206206
#==============================================================================
207207

208208
function (_yup_collect_upstream_candidate_paths module_name module_path output_variable)
209-
set (candidate_paths "${module_path}/upstream")
209+
set (candidate_paths
210+
"${module_path}/upstream"
211+
"${CMAKE_SOURCE_DIR}/build/externals/${module_name}")
210212

211-
if (DEFINED YUP_UPSTREAM_ROOT AND NOT "${YUP_UPSTREAM_ROOT}" STREQUAL "")
212-
list (APPEND candidate_paths "${YUP_UPSTREAM_ROOT}/${module_name}/upstream")
213-
endif()
214-
215-
if (CMAKE_SOURCE_DIR)
216-
list (APPEND candidate_paths "${CMAKE_SOURCE_DIR}/build/externals/${module_name}/upstream")
217-
list (APPEND candidate_paths "${CMAKE_SOURCE_DIR}/../build/externals/${module_name}/upstream")
218-
endif()
213+
get_filename_component (parent_candidate_path "${CMAKE_SOURCE_DIR}/../build/externals/${module_name}" REALPATH)
214+
list (APPEND candidate_paths "${parent_candidate_path}")
219215

220216
set (candidate_root "${CMAKE_BINARY_DIR}")
221217
set (max_depth 10)
222218
while (max_depth GREATER 0)
223-
list (APPEND candidate_paths "${candidate_root}/externals/${module_name}/upstream")
219+
list (APPEND candidate_paths "${candidate_root}/externals/${module_name}")
224220

225221
get_filename_component (candidate_parent "${candidate_root}" DIRECTORY)
226222
if ("${candidate_parent}" STREQUAL "${candidate_root}")
@@ -234,6 +230,8 @@ function (_yup_collect_upstream_candidate_paths module_name module_path output_v
234230
set (${output_variable} "${candidate_paths}" PARENT_SCOPE)
235231
endfunction()
236232

233+
#==============================================================================
234+
237235
function (_yup_resolve_variable_paths input_list output_list)
238236
set (resolved_list "")
239237

@@ -293,16 +291,9 @@ function (_yup_convert_png_to_icns png_path icons_path output_variable)
293291
file (REMOVE_RECURSE "${temp_iconset_path}")
294292
file (MAKE_DIRECTORY "${temp_iconset_path}")
295293

296-
_yup_execute_process_or_fail (/usr/bin/sips -z 16 16 "${png_path}" --out "${temp_iconset_path}/icon_16x16.png")
297-
_yup_execute_process_or_fail (/usr/bin/sips -z 32 32 "${png_path}" --out "${temp_iconset_path}/icon_32x32.png")
298-
_yup_execute_process_or_fail (/usr/bin/sips -z 32 32 "${png_path}" --out "${temp_iconset_path}/[email protected]")
299-
_yup_execute_process_or_fail (/usr/bin/sips -z 64 64 "${png_path}" --out "${temp_iconset_path}/[email protected]")
300-
_yup_execute_process_or_fail (/usr/bin/sips -z 128 128 "${png_path}" --out "${temp_iconset_path}/icon_128x128.png")
301-
_yup_execute_process_or_fail (/usr/bin/sips -z 256 256 "${png_path}" --out "${temp_iconset_path}/[email protected]")
302-
_yup_execute_process_or_fail (/usr/bin/sips -z 256 256 "${png_path}" --out "${temp_iconset_path}/icon_256x256.png")
303-
_yup_execute_process_or_fail (/usr/bin/sips -z 512 512 "${png_path}" --out "${temp_iconset_path}/[email protected]")
304-
_yup_execute_process_or_fail (/usr/bin/sips -z 512 512 "${png_path}" --out "${temp_iconset_path}/icon_512x512.png")
305-
_yup_execute_process_or_fail (/usr/bin/sips -z 1024 1024 "${png_path}" --out "${temp_iconset_path}/[email protected]")
294+
foreach (size IN ITEMS 16 32 128 256 512)
295+
_yup_execute_process_or_fail (/usr/bin/sips -z ${size} ${size} "${png_path}" --out "${temp_iconset_path}/icon_${size}x${size}.png")
296+
endforeach()
306297
_yup_execute_process_or_fail (/usr/bin/iconutil -c icns -o "${output_iconset_path}" "${temp_iconset_path}")
307298

308299
file (REMOVE_RECURSE "${temp_iconset_path}")

examples/graphics/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ yup_standalone_app (
7878
flac_library
7979
hmp3_library
8080
dr_libs
81+
libvorbis
8182
libpng
8283
libwebp
8384
${additional_modules}

examples/graphics/source/examples/AudioFileDemo.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,9 @@ class AudioFileDemo : public yup::Component
335335
, saveButton ("Save As")
336336
, loopButton ("Loop")
337337
{
338-
formatManager.registerDefaultFormats();
338+
formatManager.registerDefaultFormats (
339+
yup::AudioFormatType::all & ~yup::AudioFormatType::coreAudio);
340+
339341
deviceManager.initialiseWithDefaultDevices (0, 2);
340342
deviceManager.addAudioCallback (&sourcePlayer);
341343
sourcePlayer.setSource (&transportSource);
@@ -608,7 +610,7 @@ class AudioFileDemo : public yup::Component
608610

609611
yup::String getAudioFileFilter() const
610612
{
611-
return "*.wav;*.aiff;*.aif;*.flac;*.mp3;*.opus;*.m4a;*.wma";
613+
return "*.wav;*.aiff;*.aif;*.flac;*.mp3;*.opus;*.m4a;*.wma;*.ogg";
612614
}
613615

614616
yup::AudioFormatManager formatManager;

0 commit comments

Comments
 (0)