Skip to content

Commit 8ed3871

Browse files
authored
Initial introduction of the yup_dsp module
1 parent d88244e commit 8ed3871

File tree

201 files changed

+65985
-1013
lines changed

Some content is hidden

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

201 files changed

+65985
-1013
lines changed

.github/workflows/build_linux.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
- "**/cmake/**"
99
- "**/examples/**"
1010
- "**/modules/**"
11+
- "**/python/**"
1112
- "**/tests/**"
1213
- "**/thirdparty/**"
1314
- "!**/native/generated/**"

.github/workflows/build_macos.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
- "**/cmake/**"
99
- "**/examples/**"
1010
- "**/modules/**"
11+
- "**/python/**"
1112
- "**/tests/**"
1213
- "**/thirdparty/**"
1314
- "!**/native/generated/**"

.github/workflows/build_windows.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
- "**/cmake/**"
99
- "**/examples/**"
1010
- "**/modules/**"
11+
- "**/python/**"
1112
- "**/tests/**"
1213
- "**/thirdparty/**"
1314
- "!**/native/generated/**"
@@ -36,9 +37,11 @@ jobs:
3637
- run: cmake --build ${{ runner.workspace }}/build --config Debug --parallel 4 --target yup_tests
3738
- working-directory: ${{ runner.workspace }}/build/tests/Debug
3839
run: ./yup_tests.exe
40+
shell: bash
3941
- run: cmake --build ${{ runner.workspace }}/build --config Release --parallel 4 --target yup_tests
4042
- working-directory: ${{ runner.workspace }}/build/tests/Release
4143
run: ./yup_tests.exe
44+
shell: bash
4245

4346
build_console:
4447
runs-on: windows-latest

guidelines.md renamed to CLAUDE.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,8 @@ TEST (ClassNameTests, StaticMethodBehavesCorrectly)
296296
4. **Group related tests** in test fixtures
297297
5. **Keep tests independent** and deterministic
298298
6. **Never Use C or C++ macros (like M_PI)** use yup alternatives
299-
7. **ALWAYS and EXCLUSIVELY use `just test`** to compile and execute tests
299+
7. **EXCLUSIVELY use `just test`** to compile and execute tests
300+
8. **NEVER start compilation or tests** unless told explicitly
300301

301302
### When suggesting refactoring:
302303
1. **Maintain existing API contracts**
@@ -358,9 +359,12 @@ Before suggesting code, verify:
358359
- [ ] Allman-style braces throughout
359360
- [ ] Consistent naming conventions
360361
- [ ] Proper include order and guards
361-
- [ ] const-correctness where applicable
362+
- [ ] Const-correctness whenever applicable
363+
- [ ] Prefer flatter code and early exits over overly indented code
364+
- [ ] Aim at simplifying and removing duplicated code, prefer removing rather than adding
365+
- [ ] When changing implementation, don't copy it and change it, adapt the existing or remove the old one once the new is in place and working
362366
- [ ] Platform-specific code properly guarded
363-
- [ ] Tests cover the new functionality
367+
- [ ] Proper TDD and ensure tests cover new functionality
364368
- [ ] No memory leaks (prefer RAII/smart pointers)
365369
- [ ] Thread safety considerations if applicable
366370
- [ ] Documentation for public APIs
@@ -393,4 +397,11 @@ void processText (const yup::String& text);
393397
// Use std::string only when interfacing with non-YUP code
394398
```
395399

400+
## Differences with JUCE
401+
402+
- We use American english in YUP, so it's `center` and not `centred`, or `Color` and not `Colour`
403+
- Always check the available API in the Graphics class, don't assume we use JUCE Graphics classes
404+
- Graphics primitives have a template `.to<float>` method not `toFloat`
405+
- Fonts are obtained via ApplicationTheme, don't try to instantiate fonts inline
406+
396407
This document should be referenced for every code generation, review, and suggestion task in the YUP project.

README.md

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,26 @@
11
# YUP: Cross-Platform Application And Plugin Development Library
22

3-
<p float="left">
3+
<div style="display: flex; width: 100%; flex-wrap: nowrap;">
44
<a href="https://kunitoki.github.io/yup/demos/web_render_0/" title="UI courtesy from https://www.drywestdesign.com/">
5-
<img src="./docs/demos/web_render_0.png" width="99%" /></a>
6-
<p>
7-
8-
<p float="left">
9-
<a href="https://kunitoki.github.io/yup/demos/web_render_1/"><img src="./docs/demos/web_render_1.png" width="24%" /></a>
10-
<a href="https://kunitoki.github.io/yup/demos/web_render_2/"><img src="./docs/demos/web_render_2.png" width="24%" /></a>
11-
<a href="https://kunitoki.github.io/yup/demos/web_render_3/"><img src="./docs/demos/web_render_3.png" width="24%" /></a>
12-
<a href="https://kunitoki.github.io/yup/demos/web_render_4/"><img src="./docs/demos/web_render_4.png" width="23%" /></a>
5+
<img src="./docs/demos/web_render_0.png" style="width:100%" /></a>
6+
</div>
7+
8+
<div style="display: flex; width: 100%; flex-wrap: nowrap;">
9+
<a href="https://kunitoki.github.io/yup/demos/web_render_1/"><img src="./docs/demos/web_render_1.png" style="width:24.25%;" /></a>
10+
<a href="https://kunitoki.github.io/yup/demos/web_render_2/"><img src="./docs/demos/web_render_2.png" style="width:24.25%;" /></a>
11+
<a href="https://kunitoki.github.io/yup/demos/web_render_3/"><img src="./docs/demos/web_render_3.png" style="width:24.25%;" /></a>
12+
<a href="https://kunitoki.github.io/yup/demos/web_render_4/"><img src="./docs/demos/web_render_4.png" style="width:24.25%;" /></a>
13+
</div>
14+
15+
<div style="display: flex; width: 100%; flex-wrap: nowrap;">
16+
<a href="./examples/graphics/source/examples/FilterDemo.h"><img src="./docs/images/yup_dsp_filter_rbj.png" style="width:27%;" /></a>
17+
<a href="./examples/graphics/source/examples/FilterDemo.h"><img src="./docs/images/yup_dsp_filter_butter.png" style="width:27%;" /></a>
18+
<a href="./examples/graphics/source/examples/CrossoverDemo.h"><img src="./docs/images/yup_dsp_crossover.png" style="width:44%;" /></a>
19+
</div>
20+
21+
<div style="display: flex; width: 100%; flex-wrap: nowrap;">
22+
<a href="./examples/graphics/source/examples/SpectrumAnalyzer.h"><img src="./docs/images/yup_dsp_spectrum_fill.png" style="width:100%;" /></a>
23+
<a href="./examples/graphics/source/examples/SpectrumAnalyzer.h"><img src="./docs/images/yup_dsp_spectrum_line.png" style="width:100%;" /></a>
1324
</p>
1425

1526
Example Rive animation display ([source code](./examples/render/source/main.cpp)):
@@ -35,6 +46,10 @@ YUP is an open-source library dedicated to empowering developers with advanced t
3546
> The project is still in embryonic stage, use it at your own risk!
3647
3748

49+
> [!IMPORTANT]
50+
> We are looking for collaborators to bring forward the framework!
51+
52+
3853
## Features
3954
YUP brings a suite of powerful features, including:
4055
- **High-Performance Rendering:** From intricate visualizations to high-speed gaming graphics, YUP handles it all with ease and efficiency, relying on the open source [Rive](https://rive.app/) Renderer, backed by Metal, Direct3D, OpenGL, Vulkan and WebGPU.
@@ -320,9 +335,6 @@ For full documentation, including more detailed tutorials and comprehensive API
320335
Join our growing community and contribute to the YUP project. Connect with us and other YUP developers:
321336
- **GitHub:** [YUP Repository](https://github.com/kunitoki/yup)
322337

323-
> [!IMPORTANT]
324-
> We are looking for collaborators to bring forward the framework!
325-
326338

327339
## License
328340
YUP is distributed under the ISC License, supporting both personal and commercial use, modification, and distribution without restrictions.

cmake/yup_dependencies.cmake

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,26 @@ macro (_yup_fetch_python use_static_libs modules)
142142
find_package (Python REQUIRED COMPONENTS ${modules})
143143
endif()
144144
endmacro()
145+
146+
#==============================================================================
147+
148+
function (_yup_find_fftw3 target_name)
149+
if (TARGET PkgConfig::FFTW AND TARGET FFTW::Float)
150+
else()
151+
find_package (PkgConfig REQUIRED)
152+
pkg_check_modules (FFTW IMPORTED_TARGET REQUIRED fftw3)
153+
find_library (FFTWF_LIB NAMES "fftw3f" PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR})
154+
155+
if (FFTWF_LIB)
156+
add_library (FFTW::Float INTERFACE IMPORTED)
157+
set_target_properties (FFTW::Float
158+
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${FFTW_INCLUDE_DIRS}"
159+
INTERFACE_LINK_LIBRARIES "${FFTWF_LIB}")
160+
else()
161+
_yup_message (FATAL_ERROR "FFTW3 library not found")
162+
endif()
163+
endif()
164+
165+
target_include_directories (${target_name} PRIVATE PkgConfig::FFTW)
166+
target_link_libraries (${target_name} PRIVATE FFTW::Float)
167+
endfunction()

cmake/yup_modules.cmake

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ function (_yup_module_collect_sources folder output_variable)
6767
set (base_path "${folder}/${module_name}")
6868
set (all_module_sources "")
6969

70-
foreach (extension ${source_extensions})
70+
foreach (extension IN LISTS source_extensions)
7171
file (GLOB found_source_files "${base_path}*${extension}")
7272

7373
if (NOT YUP_PLATFORM_MSFT)
@@ -118,7 +118,7 @@ function (_yup_module_collect_sources folder output_variable)
118118
endforeach()
119119

120120
set (module_sources "")
121-
foreach (module_source ${all_module_sources})
121+
foreach (module_source IN LISTS all_module_sources)
122122
if (APPLE)
123123
if (module_source MATCHES "^.*\.(cc|cxx|cpp)$")
124124
get_filename_component (source_directory ${module_source} DIRECTORY)
@@ -146,11 +146,11 @@ endfunction()
146146

147147
function (_yup_module_prepare_frameworks frameworks weak_frameworks output_variable)
148148
set (temp_frameworks "")
149-
foreach (framework ${frameworks})
149+
foreach (framework IN LISTS frameworks)
150150
list (APPEND temp_frameworks "-framework ${framework}")
151151
endforeach()
152152

153-
foreach (framework ${weak_frameworks})
153+
foreach (framework IN LISTS weak_frameworks)
154154
list (APPEND temp_frameworks "-weak_framework ${framework}")
155155
endforeach()
156156

@@ -345,7 +345,7 @@ function (yup_add_module module_path modules_definitions module_group)
345345
set (platform_properties "^(.*)Deps$|^(.*)Defines$|^(.*)Libs$|^(.*)Frameworks$|^(.*)WeakFrameworks$|^(.*)Options$|^(.*)LinkOptions$|^(.*)Packages$|^(.*)Searchpaths$|^(.*)CppStandard$")
346346

347347
set (parsed_config "")
348-
foreach (module_config ${module_configs})
348+
foreach (module_config IN LISTS module_configs)
349349
string (REGEX REPLACE "^(.+):[ \t\r\n]+(.+)$" "\\1;\\2" parsed_config ${module_config})
350350
list (GET parsed_config 0 key)
351351
list (LENGTH parsed_config parsed_config_len)
@@ -452,7 +452,7 @@ function (yup_add_module module_path modules_definitions module_group)
452452
list (APPEND module_link_options ${module_linuxLinkOptions})
453453
_yup_resolve_variable_paths ("${module_linuxSearchpaths}" module_linuxSearchpaths)
454454
list (APPEND module_searchpaths ${module_linuxSearchpaths})
455-
foreach (package ${module_linuxPackages})
455+
foreach (package IN LISTS module_linuxPackages)
456456
_yup_get_package_config_libs ("${package}" package_libs)
457457
list (APPEND module_libs ${package_libs})
458458
endforeach()
@@ -505,15 +505,15 @@ function (yup_add_module module_path modules_definitions module_group)
505505
endif()
506506

507507
# ==== Add module definitions
508-
foreach (module_definition ${modules_definitions})
508+
foreach (module_definition IN LISTS modules_definitions)
509509
list (APPEND module_defines ${module_definition})
510510
endforeach()
511511

512512
# ==== Prepare include paths
513513
get_filename_component (module_include_path ${module_path} DIRECTORY)
514514
list (APPEND module_include_paths "${module_include_path}")
515515

516-
foreach (searchpath ${module_searchpaths})
516+
foreach (searchpath IN LISTS module_searchpaths)
517517
if (EXISTS "${searchpath}")
518518
list (APPEND module_include_paths "${searchpath}")
519519
elseif (EXISTS "${module_path}/${searchpath}")
@@ -619,30 +619,47 @@ macro (yup_add_default_modules modules_path)
619619
yup_add_module (${modules_path}/thirdparty/rive_decoders "${modules_definitions}" ${thirdparty_group})
620620
yup_add_module (${modules_path}/thirdparty/rive_renderer "${modules_definitions}" ${thirdparty_group})
621621
yup_add_module (${modules_path}/thirdparty/oboe_library "${modules_definitions}" ${thirdparty_group})
622+
yup_add_module (${modules_path}/thirdparty/pffft_library "${modules_definitions}" ${thirdparty_group})
623+
yup_add_module (${modules_path}/thirdparty/dr_libs "${modules_definitions}" ${thirdparty_group})
622624

623625
# ==== Yup modules
624626
set (modules_group "Modules")
625627
yup_add_module (${modules_path}/modules/yup_core "${modules_definitions}" ${modules_group})
626628
add_library (yup::yup_core ALIAS yup_core)
629+
627630
yup_add_module (${modules_path}/modules/yup_events "${modules_definitions}" ${modules_group})
628631
add_library (yup::yup_events ALIAS yup_events)
632+
629633
yup_add_module (${modules_path}/modules/yup_data_model "${modules_definitions}" ${modules_group})
630634
add_library (yup::yup_data_model ALIAS yup_data_model)
635+
636+
yup_add_module (${modules_path}/modules/yup_dsp "${modules_definitions}" ${modules_group})
637+
add_library (yup::yup_dsp ALIAS yup_dsp)
638+
639+
yup_add_module (${modules_path}/modules/yup_graphics "${modules_definitions}" ${modules_group})
640+
add_library (yup::yup_graphics ALIAS yup_graphics)
641+
642+
yup_add_module (${modules_path}/modules/yup_gui "${modules_definitions}" ${modules_group})
643+
add_library (yup::yup_gui ALIAS yup_gui)
644+
631645
yup_add_module (${modules_path}/modules/yup_audio_basics "${modules_definitions}" ${modules_group})
632646
add_library (yup::yup_audio_basics ALIAS yup_audio_basics)
647+
633648
yup_add_module (${modules_path}/modules/yup_audio_devices "${modules_definitions}" ${modules_group})
634649
add_library (yup::yup_audio_devices ALIAS yup_audio_devices)
650+
651+
yup_add_module (${modules_path}/modules/yup_audio_formats "${modules_definitions}" ${modules_group})
652+
add_library (yup::yup_audio_formats ALIAS yup_audio_formats)
653+
635654
yup_add_module (${modules_path}/modules/yup_audio_processors "${modules_definitions}" ${modules_group})
636655
add_library (yup::yup_audio_processors ALIAS yup_audio_processors)
637-
yup_add_module (${modules_path}/modules/yup_audio_plugin_client "${modules_definitions}" ${modules_group})
638-
add_library (yup::yup_audio_plugin_client ALIAS yup_audio_plugin_client)
639-
yup_add_module (${modules_path}/modules/yup_graphics "${modules_definitions}" ${modules_group})
640-
add_library (yup::yup_graphics ALIAS yup_graphics)
641-
yup_add_module (${modules_path}/modules/yup_gui "${modules_definitions}" ${modules_group})
642-
add_library (yup::yup_gui ALIAS yup_gui)
656+
643657
yup_add_module (${modules_path}/modules/yup_audio_gui "${modules_definitions}" ${modules_group})
644658
add_library (yup::yup_audio_gui ALIAS yup_audio_gui)
645659

660+
yup_add_module (${modules_path}/modules/yup_audio_plugin_client "${modules_definitions}" ${modules_group})
661+
add_library (yup::yup_audio_plugin_client ALIAS yup_audio_plugin_client)
662+
646663
if (YUP_ARG_ENABLE_PYTHON)
647664
if (NOT YUP_BUILD_WHEEL)
648665
set (python_modules "Interpreter;Development.Embed")

cmake/yup_python.cmake

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,34 @@ function (yup_prepare_python_stdlib target_name python_tools_path output_variabl
3535

3636
set (python_standard_library "${CMAKE_CURRENT_BINARY_DIR}/python${Python_VERSION_MAJOR}${Python_VERSION_MINOR}.zip")
3737

38+
if (YUP_PLATFORM_WINDOWS)
39+
set (python_version_string "${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}.${Python_VERSION_PATCH}")
40+
set (python_embeddable_url "https://www.python.org/ftp/python/${python_version_string}/python-${python_version_string}-embed-amd64.zip")
41+
FetchContent_Declare (python_embed_env URL ${python_embeddable_url})
42+
if (NOT python_embed_env_POPULATED)
43+
FetchContent_Populate(python_embed_env)
44+
endif()
45+
46+
get_filename_component (python_root_path "${python_embed_env_SOURCE_DIR}" REALPATH)
47+
else()
48+
get_filename_component (python_root_path "${Python_LIBRARY_DIRS}" REALPATH)
49+
endif()
50+
3851
_yup_message (STATUS "Executing python stdlib archive generator tool")
3952
_yup_message (STATUS " * CMAKE_CURRENT_BINARY_DIR: ${CMAKE_CURRENT_BINARY_DIR}")
4053
_yup_message (STATUS " * Python_EXECUTABLE: ${Python_EXECUTABLE}")
4154
_yup_message (STATUS " * Python_LIBRARY_DIRS: ${Python_LIBRARY_DIRS}")
4255
_yup_message (STATUS " * Python_VERSION_MAJOR: ${Python_VERSION_MAJOR}")
4356
_yup_message (STATUS " * Python_VERSION_MINOR: ${Python_VERSION_MINOR}")
57+
_yup_message (STATUS " * Python_VERSION_PATCH: ${Python_VERSION_PATCH}")
58+
_yup_message (STATUS " * python_root_path: ${python_root_path}")
4459
_yup_message (STATUS " * python_tools_path: ${python_tools_path}")
4560
_yup_message (STATUS " * ignored_library_patterns: ${ignored_library_patterns}")
4661

4762
execute_process (
4863
COMMAND
4964
"${Python_EXECUTABLE}" "${python_tools_path}/ArchivePythonStdlib.py"
50-
-l "${Python_LIBRARY_DIRS}" -o "${CMAKE_CURRENT_BINARY_DIR}" -M "${Python_VERSION_MAJOR}" -m "${Python_VERSION_MINOR}"
65+
-r "${python_root_path}" -o "${CMAKE_CURRENT_BINARY_DIR}" -M "${Python_VERSION_MAJOR}" -m "${Python_VERSION_MINOR}"
5166
-x "\"${ignored_library_patterns}\""
5267
COMMAND_ECHO STDOUT
5368
COMMAND_ERROR_IS_FATAL ANY)

docs/demos/web_render_1.png

-3.4 KB
Loading

docs/demos/web_render_2.png

-15.6 KB
Loading

0 commit comments

Comments
 (0)