From fb8fb5731a37e9a2f16d1a572f8fd048a0b1a5df Mon Sep 17 00:00:00 2001 From: AkiyukiOkayasu Date: Fri, 24 Jun 2022 10:29:20 +0900 Subject: [PATCH 01/15] build: Update doctest v2.4.9 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 03ae847..967b5fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,7 @@ if(MAIN_PROJECT) include(CTest) include(FetchContent) - FetchContent_Declare(doctest GIT_REPOSITORY https://github.com/onqtam/doctest GIT_TAG 2.4.5) + FetchContent_Declare(doctest GIT_REPOSITORY https://github.com/onqtam/doctest GIT_TAG v2.4.9) FetchContent_MakeAvailable(doctest) enable_testing() include(${doctest_SOURCE_DIR}/scripts/cmake/doctest.cmake) From f5b694ba031f44e8cc09b1b953a5664155b68c7f Mon Sep 17 00:00:00 2001 From: AkiyukiOkayasu Date: Fri, 24 Jun 2022 10:29:47 +0900 Subject: [PATCH 02/15] build: Update CMake to 3.16 --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 967b5fb..d4993b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,12 +1,13 @@ # Determine if doctest is built as a subproject (using add_subdirectory) or if it is the main project. set(MAIN_PROJECT OFF) + if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) set(MAIN_PROJECT ON) endif() if(MAIN_PROJECT) message(STATUS "AME Unit test settings begin") - cmake_minimum_required(VERSION 3.14) + cmake_minimum_required(VERSION 3.16) project(ame LANGUAGES CXX) set(CMAKE_CXX_STANDARD 20)#C++20 From 35e192c532cb85dac732c8847b414f759b28b4f6 Mon Sep 17 00:00:00 2001 From: AkiyukiOkayasu Date: Fri, 24 Jun 2022 10:31:06 +0900 Subject: [PATCH 03/15] chore: format --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d4993b1..e245bf1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,11 +5,11 @@ if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) set(MAIN_PROJECT ON) endif() -if(MAIN_PROJECT) +if(MAIN_PROJECT) message(STATUS "AME Unit test settings begin") cmake_minimum_required(VERSION 3.16) project(ame LANGUAGES CXX) - set(CMAKE_CXX_STANDARD 20)#C++20 + set(CMAKE_CXX_STANDARD 20) # C++20 include(CTest) include(FetchContent) @@ -32,7 +32,7 @@ if(MAIN_PROJECT) target_link_libraries(tests PRIVATE doctest::doctest) message(STATUS "AME Unit test settings end") else() - message(STATUS "AME - C++ header-only DSP library for Cortex-M") - add_library(ame INTERFACE) + message(STATUS "AME - C++ header-only DSP library for Cortex-M") + add_library(ame INTERFACE) target_include_directories(ame INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include) endif() \ No newline at end of file From 0c35e0dbc3c2319255277a4adb618ae9b2d3a04b Mon Sep 17 00:00:00 2001 From: AkiyukiOkayasu Date: Fri, 24 Jun 2022 10:31:23 +0900 Subject: [PATCH 04/15] docs: Update README --- README.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.adoc b/README.adoc index 21682ad..fdbb84c 100644 --- a/README.adoc +++ b/README.adoc @@ -2,7 +2,7 @@ image:https://github.com/AkiyukiOkayasu/ame/actions/workflows/cmake.yml/badge.svg[UnitTest] image:https://github.com/AkiyukiOkayasu/ame/actions/workflows/doxygen.yml/badge.svg[link=https://akiyukiokayasu.github.io/ame/] image:https://img.shields.io/github/v/release/AkiyukiOkayasu/ame[link=https://github.com/AkiyukiOkayasu/ame/releases/latest] image:https://img.shields.io/github/license/AkiyukiOkayasu/ame[link=LICENSE] -AME is a C++ header-only library focused on fast audio processing on Cortex-M, such as i.MXRT. + +AME is a C++ header-only library focused on fast audio processing on Cortex-M. + Specifically, AME provides a function that is missing from the CMSIS-DSP for audio processing. + If CMSIS-DSP is available, use it, but it is not required. This means that ame can run on non-Cortex-M environments. + @@ -16,7 +16,7 @@ Major changes may be added to this project. + * https://arm-software.github.io/CMSIS_5/DSP/html/index.html[ARM CMSIS-DSP] + -== Feautures +== Features * Audio buffer that can only be allocatable at compile time * Oscillator and noise generator * Filters From 72ec9520fbfd28bfd889618612784b505ba4eca4 Mon Sep 17 00:00:00 2001 From: AkiyukiOkayasu Date: Fri, 24 Jun 2022 10:32:15 +0900 Subject: [PATCH 05/15] docs: Add how to use custom linker (mold, lld, gold etc...) --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index e245bf1..3dc73f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,7 @@ if(MAIN_PROJECT) PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/test ) + # add_link_options("-fuse-ld=mold") # How to use custom linker (mold, lld, gold etc..) target_compile_options(tests PUBLIC -O2 -Wall -fconstexpr-depth=2147483647) target_compile_features(tests PUBLIC cxx_std_20) target_link_libraries(tests PRIVATE doctest::doctest) From 0833da5a4b44d8426133686f66faee69adea0c97 Mon Sep 17 00:00:00 2001 From: AkiyukiOkayasu Date: Fri, 24 Jun 2022 10:49:42 +0900 Subject: [PATCH 06/15] feat: Output to console whether CMSIS-DSP or cmath is used. --- include/ame_Math.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/ame_Math.hpp b/include/ame_Math.hpp index 26ebd00..83d86c3 100644 --- a/include/ame_Math.hpp +++ b/include/ame_Math.hpp @@ -20,11 +20,14 @@ extern "C" #ifdef __cplusplus } #endif + #ifndef USE_CMSIS_DSP #define USE_CMSIS_DSP + #pragma message("CMSIS-DSP is used.") #endif #else #include + #pragma message("CMSIS-DSP is NOT used. cmath is used instead.") #endif #include From a4cea066d42b0e81e6f6cefcbd782054e3ebe6b8 Mon Sep 17 00:00:00 2001 From: Akiyuki Okayasu Date: Wed, 7 Sep 2022 21:21:49 +0900 Subject: [PATCH 07/15] docs: fix typo --- include/ame_Oscillator.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ame_Oscillator.hpp b/include/ame_Oscillator.hpp index 1d69a6e..58b8642 100644 --- a/include/ame_Oscillator.hpp +++ b/include/ame_Oscillator.hpp @@ -131,7 +131,7 @@ class SineOscillator public: /** Create sine wave oscillator instance. - @param sampleRate The sample rate that will be used for calclate the oscillator phase increment. + @param sampleRate The sample rate that will be used for calculate the oscillator phase increment. @param frequency Initial frequency */ SineOscillator (FloatType sampleRate) noexcept From 610443ffe07c7d8af415e7b15db0847f0b39ee7b Mon Sep 17 00:00:00 2001 From: Akiyuki Okayasu Date: Wed, 7 Sep 2022 21:24:14 +0900 Subject: [PATCH 08/15] refactor: clang-tidy --- include/ame_Oscillator.hpp | 2 +- include/ame_Pcm.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/ame_Oscillator.hpp b/include/ame_Oscillator.hpp index 58b8642..046ff4f 100644 --- a/include/ame_Oscillator.hpp +++ b/include/ame_Oscillator.hpp @@ -102,7 +102,7 @@ class WavetableOscillator /** Generate single sample. @return generated latest sample */ - FloatType nextSample() noexcept + FloatTypeBase nextSample() noexcept { const uint32_t aIndex = std::floor (tableIndex.get()); const uint32_t bIndex = std::floor (tableIndex.get (1)); diff --git a/include/ame_Pcm.hpp b/include/ame_Pcm.hpp index e779929..b78140c 100644 --- a/include/ame_Pcm.hpp +++ b/include/ame_Pcm.hpp @@ -297,7 +297,7 @@ class WavPlayer template void process (AudioBlockView& block) { - if (playing.load() == false) + if (! playing.load()) { return; } From 9adf6ba9f00a648b11130835fb81dabd908a5125 Mon Sep 17 00:00:00 2001 From: Akiyuki Okayasu Date: Wed, 7 Sep 2022 21:24:55 +0900 Subject: [PATCH 09/15] build: update .clang-tidy --- .clang-tidy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.clang-tidy b/.clang-tidy index ddb56c3..d03dbb9 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,4 +1,4 @@ -Checks: '-*,bugprone-*,clang-analyzer-*,-cppcoreguidelines-*,performance-*,portability-*,readability-*,-readability-uppercase-literal-suffix,-readability-magic-numbers, -readability-else-after-return' +Checks: '-*,bugprone-*,clang-analyzer-*,-cppcoreguidelines-*,performance-*,portability-*,readability-*,-readability-uppercase-literal-suffix,-readability-magic-numbers, -readability-else-after-return, -readability-identifier-length, -readability-identifier-naming, -bugprone-easily-swappable-parameters' HeaderFilterRegex: '.*' CheckOptions: - key: readability-identifier-naming.ClassCase From dbe9f2234ecbcfdb830df49051c3469323209818 Mon Sep 17 00:00:00 2001 From: Akiyuki Okayasu Date: Wed, 7 Sep 2022 22:03:52 +0900 Subject: [PATCH 10/15] docs: Cleanup doxygen comments --- include/ame_Biquad.hpp | 4 ++-- include/ame_Conversion.hpp | 46 ++++++++++++++++++-------------------- include/ame_Random.hpp | 15 ++++++------- include/ame_RcLowPass.hpp | 2 +- include/ame_Reverb.hpp | 2 +- 5 files changed, 33 insertions(+), 36 deletions(-) diff --git a/include/ame_Biquad.hpp b/include/ame_Biquad.hpp index 7e6162d..9353b0f 100644 --- a/include/ame_Biquad.hpp +++ b/include/ame_Biquad.hpp @@ -74,7 +74,7 @@ class Biquad return coef; } - /// LowPass coefficients calculation from RBJ cookbook. + /// Low-pass coefficients calculation from RBJ cookbook. void makeLowPass (const FloatType cutOffFrequency, const FloatType Q) noexcept { const FloatType w0 = twoPi * cutOffFrequency / sampleRate; @@ -89,7 +89,7 @@ class Biquad normalizeCoefficientsByA0(); } - /// HighPass coefficients calculation from RBJ cookbook. + /// High-pass coefficients calculation from RBJ cookbook. void makeHighPass (const FloatType cutOffFrequency, const FloatType Q) noexcept { const FloatType w0 = twoPi * cutOffFrequency / sampleRate; diff --git a/include/ame_Conversion.hpp b/include/ame_Conversion.hpp index ff27d11..84da388 100644 --- a/include/ame_Conversion.hpp +++ b/include/ame_Conversion.hpp @@ -77,8 +77,7 @@ constexpr void q23ToFloat (const int32_t src[], float dest[], const uint32_t blo } } -/** - Split channel→Interleave convertion. +/** Split channel→Interleave conversion. @param source Split channel samples @param dest Interleave array @param numSamples @@ -99,8 +98,7 @@ constexpr void interleaveSamples (const float** source, float* dest, const uint_ } } -/** - Interleave→Split channel convertion. +/** Interleave→Split channel conversion. @param source Interleave samples @param dest Split channel array @param numSamples @@ -127,8 +125,8 @@ inline void deinterleaveSamples (const float* source, float** dest, const uint_f @param semitone @return frequency ratio @code - semitoneToRatio(12.0f)// 2.0f - semitoneToRatio(-12.0f)// 0.5f + semitoneToRatio(12.0f); // 2.0f + semitoneToRatio(-12.0f);// 0.5f @endcode */ inline float semitoneToRatio (const float semitone) @@ -149,19 +147,19 @@ constexpr float freqToPeriod (const float freq) noexcept { return 1.0f / freq; } constexpr float periodToFreq (const float period) noexcept { return 1.0f / period; } /** Convert frequency to MIDI note number. - @param frequency - @param A3Freq Frequency for A3 (MIDI note 69). 440Hz is default. - @return MIDI note - */ + @param frequency + @param A3Freq Frequency for A3 (MIDI note 69). 440Hz is default. + @return MIDI note +*/ inline float freqToMidi (const float freq, const float A3Freq = 440.0f) { return 12.0f * std::log2f (freq / A3Freq) + 69.0f; } /** Convert MIDI note number to frequency. - @param midiNote - @param A3Freq Frequency for A3 (MIDI note 69). 440Hz is default. - @return frequency in Hz + @param midiNote + @param A3Freq Frequency for A3 (MIDI note 69). 440Hz is default. + @return frequency in Hz */ inline float midiToFreq (const float midiNote, const float A3Freq = 440.0f) { @@ -199,7 +197,7 @@ inline std::pair poltocar (const float amplitude, const float angl //============================================================================== //time -/** Convert BPM to ms +/** Convert BPM to ms. @param bpm @return ms @code @@ -208,7 +206,7 @@ inline std::pair poltocar (const float amplitude, const float angl */ constexpr float bpmToMs (float bpm) { return 60000.0f / bpm; } -/** Convert ms to BPM +/** Convert ms to BPM. @param ms @return BPM @code @@ -240,8 +238,8 @@ constexpr float decibelsToGain (const float dB) noexcept @return dB decibels value @note Outputs Outputs -100dB if the input is less than 0.00001. @code - gainToDecibels (1.0f); // 0.0f - gainToDecibels (0.1f); // -20.0f + gainToDecibels (1.0f); // 0dB + gainToDecibels (0.1f); // -20.0dB @endcode */ constexpr float gainToDecibels (const float gain) noexcept @@ -253,9 +251,9 @@ constexpr float gainToDecibels (const float gain) noexcept //============================================================================== /** Degree to Radians. -@tparam FloatType float or double -@param degree -@return constexpr FloatType Radian + @tparam FloatType float or double + @param degree + @return constexpr FloatType Radian */ template constexpr FloatType deg2rad (FloatType degree) noexcept @@ -263,10 +261,10 @@ constexpr FloatType deg2rad (FloatType degree) noexcept return degree * (ame::pi / static_cast (180.0)); } -/** Radian to Degree -@tparam FloatType float or double -@param radian -@return constexpr FloatType degree +/** Radian to Degree. + @tparam FloatType float or double + @param radian + @return constexpr FloatType degree */ template constexpr FloatType rad2deg (FloatType radian) noexcept diff --git a/include/ame_Random.hpp b/include/ame_Random.hpp index 5a254cb..8967932 100644 --- a/include/ame_Random.hpp +++ b/include/ame_Random.hpp @@ -39,20 +39,19 @@ inline uint32_t next (void) namespace ame { -/** random. -@return float [0, 1] -@see ame::noise() -@note Adapted from David Blackman and Sebastiano Vigna's xoshiro128+ -https://prng.di.unimi.it/xoshiro128plus.c +/** Random. + @return float [0, 1] + @see ame::noise() + @note Adapted from David Blackman and Sebastiano Vigna's xoshiro128+ https://prng.di.unimi.it/xoshiro128plus.c */ inline float random() { return (next() >> 8) * FLOAT_UNIT; } -/** white noise. -@return float [-1, 1] -@see ame::random() +/** White noise. + @return float [-1, 1] + @see ame::random() */ inline float noise() { diff --git a/include/ame_RcLowPass.hpp b/include/ame_RcLowPass.hpp index a71daf1..730f11a 100644 --- a/include/ame_RcLowPass.hpp +++ b/include/ame_RcLowPass.hpp @@ -18,7 +18,7 @@ namespace ame::dsp { -/** RC lowpass filter for parameter smoothing. +/** RC low-pass filter for parameter smoothing. y[t] = x[t] * coef + (1-coef) * y[t-1] @tparam FloatType float or double diff --git a/include/ame_Reverb.hpp b/include/ame_Reverb.hpp index b94f466..d78ef8b 100644 --- a/include/ame_Reverb.hpp +++ b/include/ame_Reverb.hpp @@ -128,7 +128,7 @@ class Freeverb output += comb[ch][cmb].process (input, damping, feedback); } - for (int ap = 0; ap < numAllPasses; ++ap) // run the allpass filters in series + for (int ap = 0; ap < numAllPasses; ++ap) // run the all-pass filters in series { output = allPass[ch][ap].process (output); } From d2b843260273c12c552c5c93143e57ee34f13413 Mon Sep 17 00:00:00 2001 From: Akiyuki Okayasu Date: Wed, 7 Sep 2022 22:04:47 +0900 Subject: [PATCH 11/15] docs: Update README --- README.adoc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.adoc b/README.adoc index fdbb84c..7eb6228 100644 --- a/README.adoc +++ b/README.adoc @@ -30,6 +30,7 @@ Major changes may be added to this project. + ** Decibel and Amplitude ** Frequency and Period ** MIDI note and Frequency +** Radian and Degree == How to use @@ -41,7 +42,7 @@ If you are using CMake, you can install ame using https://cmake.org/cmake/help/l [source,cmake] ---- # CMakeLists.txt -cmake_minimum_required(VERSION 3.15) +cmake_minimum_required(VERSION 3.16) project(example_project) add_executable(example_project main.cpp) @@ -61,3 +62,8 @@ Be aware that the order of audio samples in ame is interleaved. + == Other document See the https://akiyukiokayasu.github.io/ame/[document] for details. + +== Contribution +Contributions are welcome. + +To keep your source code clean, remember to run clang-format before submitting your PR and check it with clang-tidy. The configuration files are located in the root of Project. + +Refer to the https://www.aes.org/par/guide/[Pro Audio Style Guide] for the technical terms used in doxygen comments. \ No newline at end of file From 7766f81d6f46c146af284a9eb8d775a055ecdb11 Mon Sep 17 00:00:00 2001 From: Akiyuki Okayasu Date: Wed, 7 Sep 2022 22:36:20 +0900 Subject: [PATCH 12/15] refactor: Add [[nodiscard]] --- include/ame_Util.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/ame_Util.hpp b/include/ame_Util.hpp index 80e3897..3b889d7 100644 --- a/include/ame_Util.hpp +++ b/include/ame_Util.hpp @@ -287,7 +287,7 @@ class Wrap @param offset @return int_fast32_t [0, length-1] */ - T get (T offset = 0) const noexcept + [[nodiscard]] T get (T offset = 0) const noexcept { auto n = num + offset; while (n >= length) @@ -310,7 +310,7 @@ class Wrap length = newLength; } - T getLength() const noexcept + [[nodiscard]] T getLength() const noexcept { return length; } From e650c0084dcaa16c51d7e25999d76bfc9cbac63e Mon Sep 17 00:00:00 2001 From: Akiyuki Okayasu Date: Thu, 8 Sep 2022 00:24:49 +0900 Subject: [PATCH 13/15] refactor: clang-tidy --- include/ame_AudioBuffer.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/ame_AudioBuffer.hpp b/include/ame_AudioBuffer.hpp index faf9ae8..ed2059e 100644 --- a/include/ame_AudioBuffer.hpp +++ b/include/ame_AudioBuffer.hpp @@ -39,9 +39,9 @@ class AudioBlockView */ AudioBlockView (std::span view, const uint_fast32_t numChannels) noexcept : view (view), - numChannels (numChannels) + numChannels (numChannels), + numSamplesPerChannel (view.size() / numChannels) { - numSamplesPerChannel = view.size() / numChannels; } ~AudioBlockView() = default; @@ -146,8 +146,8 @@ class AudioBlockView std::span view; private: - uint_fast32_t numSamplesPerChannel; uint_fast32_t numChannels; + uint_fast32_t numSamplesPerChannel; }; /** From f590a48aad94174006654e407ceb489adc033c6f Mon Sep 17 00:00:00 2001 From: AkiyukiOkayasu Date: Fri, 10 Mar 2023 15:17:39 +0900 Subject: [PATCH 14/15] Update doctest v2.4.10 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3dc73f7..51e3fa0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,7 @@ if(MAIN_PROJECT) include(CTest) include(FetchContent) - FetchContent_Declare(doctest GIT_REPOSITORY https://github.com/onqtam/doctest GIT_TAG v2.4.9) + FetchContent_Declare(doctest GIT_REPOSITORY https://github.com/onqtam/doctest GIT_TAG v2.4.10) FetchContent_MakeAvailable(doctest) enable_testing() include(${doctest_SOURCE_DIR}/scripts/cmake/doctest.cmake) From a4b2defa178b10d277246ce5262704f1b0e2cff2 Mon Sep 17 00:00:00 2001 From: AkiyukiOkayasu Date: Fri, 10 Mar 2023 15:18:08 +0900 Subject: [PATCH 15/15] Add diode modeling function --- include/ame.hpp | 1 + include/ame_Circuit.hpp | 28 ++++++++++++++++++++++++++++ test/test.cpp | 14 ++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 include/ame_Circuit.hpp diff --git a/include/ame.hpp b/include/ame.hpp index 16955f2..86a2efc 100644 --- a/include/ame.hpp +++ b/include/ame.hpp @@ -29,6 +29,7 @@ #include "ame_Ambisonics.hpp" #include "ame_AudioBuffer.hpp" #include "ame_Biquad.hpp" +#include "ame_Circuit.hpp" #include "ame_Conversion.hpp" #include "ame_DcBlock.hpp" #include "ame_Delay.hpp" diff --git a/include/ame_Circuit.hpp b/include/ame_Circuit.hpp new file mode 100644 index 0000000..84506ec --- /dev/null +++ b/include/ame_Circuit.hpp @@ -0,0 +1,28 @@ +/** + Analog circuit modelings + @file ame_Circuit.hpp + @author Akiyuki Okayasu (akiyuki.okayasu@gmail.com) + @copyright Copyright (c) 2021 - Akiyuki Okayasu + + AME is released under the MIT license. +*/ + +#pragma once + +#include + +namespace ame +{ +/** diode modeling. + https://jatinchowdhury18.medium.com/complex-nonlinearities-epsiode-2-harmonic-exciter-cd883d888a43 + + @param x + @return FloatType + @note When the input is 1.0, the output is larger than 1.0 +*/ +template +inline FloatType diode (FloatType x) +{ + return static_cast (0.2) * (std::exp (x * static_cast (0.05 / 0.0259)) - static_cast (1.0)); +} +} // namespace ame \ No newline at end of file diff --git a/test/test.cpp b/test/test.cpp index ece5e72..7c22ead 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -9,6 +9,20 @@ using doctest::Approx; +TEST_CASE ("Circuit modeling") +{ + SUBCASE ("Diode") + { + CHECK_GT (ame::diode (1.0f), 1.0); + CHECK_EQ (ame::diode (0.5f), Approx (0.325089f)); + CHECK_EQ (ame::diode (0.1f), Approx (0.042589f)); + CHECK_EQ (ame::diode (0.0f), Approx (0.0f)); + CHECK_EQ (ame::diode (-0.25f), Approx (-0.076568f)); + CHECK_EQ (ame::diode (-0.8f), Approx (-0.157312f)); + CHECK_GT (0.0f, ame::diode (-1.0f)); + } +} + TEST_CASE ("Radian / Degree") { CHECK_EQ (ame::rad2deg (0.0f), Approx (0.0f));