Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ __pycache__/
notebooks/_tr808_ref/
notebooks/_tr808_ours/
notebooks/_swing_figs/

# mdBook output (book/ sources build into here; deployed by CI)
book/book/
26 changes: 25 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# TapTools kernel — the portable DSP library behind the TapTools Max package.
# Header-only, plain C++20: no Max SDK, no min-api, no Jamoma. The kernels live
# under include/taptools/, one self-contained header per object, in the `taptools` namespace.
# under include/taptools/, one self-contained header per object, in the `tap::tools` namespace.
#
# This is a complete standalone CMake project (the AmbiTap / AmbiTap-Max pattern): it lives in
# kernel/ of the TapTools monorepo and is designed to lift verbatim into its own repository. The
Expand Down Expand Up @@ -36,13 +36,37 @@ add_subdirectory(submodules/dsptap)

add_library(taptools INTERFACE)
add_library(TapTools::taptools ALIAS taptools)
# The family-wide alias, per the namespace convention in taphouse's README: one
# `tap::<library>` sub-namespace per repo, and the CMake alias matches it. The
# older spelling above stays so existing consumers keep working; prefer
# `tap::tools` in new code. Note this is a build-tree alias only -- the
# installed config package still exports under its own namespace.
add_library(tap::tools ALIAS taptools)
target_compile_features(taptools INTERFACE cxx_std_20)
target_include_directories(taptools INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
# tap::dsp brings the real-FFT header and links the Ooura static lib.
target_link_libraries(taptools INTERFACE tap::dsp)

# Warning flags for this project's own targets (tests, tools, benchmarks) --
# never exported to consumers of the INTERFACE library, and never applied to
# third-party code. Every sibling *Tap library carries this pair
# (AMBITAP_WERROR / TAP_DSP_WERROR / MUTAP_WERROR / TAP_RATIO_WERROR /
# SRT_WERROR); TapTools was the one library holding its own code to a lower
# standard than the rest of the family, so the flag set here is deliberately the
# same one they use.
option(TAPTOOLS_WERROR "Treat warnings as errors in TapTools' own targets" OFF)
add_library(taptools_warnings INTERFACE)
target_compile_options(taptools_warnings INTERFACE
$<$<CXX_COMPILER_ID:GNU,Clang,AppleClang>:-Wall -Wextra -Wpedantic -Wconversion -Wshadow>
$<$<CXX_COMPILER_ID:MSVC>:/W4 /permissive->)
if (TAPTOOLS_WERROR)
target_compile_options(taptools_warnings INTERFACE
$<$<CXX_COMPILER_ID:GNU,Clang,AppleClang>:-Werror>
$<$<CXX_COMPILER_ID:MSVC>:/WX>)
endif ()

if (TAPTOOLS_BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
Expand Down
6 changes: 5 additions & 1 deletion book/book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,8 @@ create-missing = false
[output.html]
default-theme = "rust"
git-repository-url = "https://github.com/tap/TapTools"
site-url = "/TapTools/book/"
# docs.yml uploads book/book as the Pages artifact root, so the book is served
# from /TapTools/, not /TapTools/book/. site-url feeds the absolute links in the
# generated 404.html; pointing it at a path the site does not have gave the 404
# page a broken "home" link.
site-url = "/TapTools/"
14 changes: 8 additions & 6 deletions include/taptools/vco.h
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ namespace tap::tools {

// Triangle: leaky integration of the BLEP square. Only ticked when the morph needs it.
// tri_pw skews the square's duty away from 0.5 (imperfect: asymmetry -> even harmonics).
double tri_tick(double p, double dt, double adt, double tri_pw) {
double tri_tick(double p, double adt, double tri_pw) {
const double sq = pulse_at(p, adt, tri_pw);
m_tri_state = 0.999 * m_tri_state + 4.0 * adt * sq;
return m_tri_state;
Expand All @@ -420,11 +420,11 @@ namespace tap::tools {
if (a <= 0.0) {
return s;
}
return (1.0 - a) * s + a * tri_tick(p, adt, adt, tri_pw);
return (1.0 - a) * s + a * tri_tick(p, adt, tri_pw);
}
if (shape <= 2.0) { // triangle -> saw
const double a = shape - 1.0;
const double t = tri_tick(p, adt, adt, tri_pw);
const double t = tri_tick(p, adt, tri_pw);
if (a <= 0.0) {
return t;
}
Expand Down Expand Up @@ -467,8 +467,8 @@ namespace tap::tools {
const double frac = m_sync_prev / (m_sync_prev - sync); // 0..1 within this sample
const double p_old = wrap01(m_phase + dt * frac);
const double p_new = (1.0 - frac) * dt;
const double d = waveform_out_peek(p_old, adt, shape, pw, bend)
- waveform_out_peek(wrap01(p_new), adt, shape, pw, bend);
const double d =
waveform_out_peek(p_old, shape, pw, bend) - waveform_out_peek(wrap01(p_new), shape, pw, bend);
// one-sided first-order correction of the reset step (minBLEP is the upgrade path)
const double x = 1.0 - frac;
correction += d * 0.5 * x * x;
Expand Down Expand Up @@ -501,7 +501,9 @@ namespace tap::tools {
}

// Waveform value without advancing the triangle integrator (for sync discontinuity sizing).
double waveform_out_peek(double p, double adt, double shape, double pw, double bend) const {
// No adt parameter: unlike waveform_out(), peek adds no BLEP correction (it reads the
// triangle integrator rather than ticking it), so it has no use for the window width.
double waveform_out_peek(double p, double shape, double pw, double bend) const {
if (shape <= 1.0) {
const double a = shape;
const double s = std::sin(2.0 * k_pi * bent(p, 0.5 * bend));
Expand Down
2 changes: 1 addition & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ add_executable(taptools_kernel_tests
vocoder_test.cpp
conv_engine_test.cpp
)
target_link_libraries(taptools_kernel_tests PRIVATE TapTools::taptools Catch2::Catch2WithMain)
target_link_libraries(taptools_kernel_tests PRIVATE tap::tools Catch2::Catch2WithMain taptools_warnings)
set_target_properties(taptools_kernel_tests PROPERTIES
CXX_STANDARD 20
CXX_STANDARD_REQUIRED ON
Expand Down
Loading