Skip to content

Commit

Permalink
Introduce sound data builder (#89)
Browse files Browse the repository at this point in the history
* Apply latest clang-format

* Replace different instances of SoundData with SoundDataBuilder

* Add documentation

* Use windows-2022 and start audiosrv

* enable developer command prompt

* printf debugging my pipeline

* Fix windows change in output path

* Try setting up a virtual soundcard

* ls to Copy to correct folder

* Execute from local directory to avoid path issues

* correctly execute executable?

* clone lfs files

* try to fix windows ci build for coverage

* try to fix windows ci build for coverage

* call executable from correct path

* call executable from correct path

* Use CMP instead of FetchContent for external libraries

* Add documentation

* Add missing test cases

* Try to trigger move assignment operator

* Fix include quotation marks
  • Loading branch information
Laguna1989 authored Dec 18, 2023
1 parent a0c4fd4 commit 5e7e812
Show file tree
Hide file tree
Showing 65 changed files with 591 additions and 677 deletions.
14 changes: 13 additions & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,22 @@ Language: Cpp
PointerAlignment: Left
SpaceBeforeParens: ControlStatements
SpacesInParentheses: 'false'
Standard: Cpp11
SeparateDefinitionBlocks: Always
Standard: c++14
UseTab: Never
ColumnLimit: 100
FixNamespaceComments: 'true'
NamespaceIndentation: 'None'
AlwaysBreakTemplateDeclarations: 'Yes'
QualifierAlignment: Right


SortIncludes: 'true'
IncludeCategories:
- Regex: '"*(.hpp)"'
Priority: 2
- Regex: '<*(.hpp)>'
Priority: 2
- Regex: '^((?!(.hpp)).)*$'
Priority: 4
...
28 changes: 17 additions & 11 deletions .github/workflows/code_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,20 @@ on:
branches: [ master ]
jobs:
run:
runs-on: windows-2019
runs-on: windows-2022
name: Code Coverage Report
steps:
- name: Set up cmake
uses: jwlawson/actions-setup-cmake@v1.11
with:
cmake-version: '3.19.x'

- uses: actions/checkout@v2
- name: Enable Developer Command Prompt
uses: ilammy/msvc-dev-cmd@v1.12.1

- uses: actions/checkout@v4
with:
lfs: true

- name: CMake
run: cmake -B ${{github.workspace}}/build . -DOALPP_STATIC_LIBRARY=ON -DOALPP_ENABLE_APPROVAL_TESTS=OFF -DOALPP_ENABLE_INTEGRATION_TESTS=OFF
Expand All @@ -23,25 +28,26 @@ jobs:
working-directory: ${{github.workspace}}/build
run: cmake --build .

- name: Install Scream
shell: powershell
run: |
Invoke-WebRequest https://github.com/duncanthrax/scream/releases/download/3.8/Scream3.8.zip -OutFile Scream3.8.zip
Expand-Archive -Path Scream3.8.zip -DestinationPath Scream
Import-Certificate -FilePath Scream\Install\driver\x64\Scream.cat -CertStoreLocation Cert:\LocalMachine\TrustedPublisher
Scream\Install\helpers\devcon-x64.exe install Scream\Install\driver\x64\Scream.inf *Scream
- run: net start audiosrv

- name: Setup virtual soundcard
uses: LABSN/sound-ci-helpers@v1.0.1


- name: Setup OpenCppCoverage and add to PATH
id: setup_opencppcoverage
run: |
choco install OpenCppCoverage -y
echo "C:\Program Files\OpenCppCoverage" >> $env:GITHUB_PATH
- name: Copy assets
run: cp -r assets ${{github.workspace}}/build/test/unit_tests/assets

- name: Generate Report
id: generate_test_report
working-directory: ${{github.workspace}}/build
working-directory: ${{github.workspace}}/build/test/unit_tests
shell: cmd
run: OpenCppCoverage.exe --export_type cobertura:OpenALppCoverage.xml --sources ${{github.workspace}}\impl --excluded_sources ${{github.workspace}}\build\test\ --excluded_sources ${{github.workspace}}\build\ext\* --excluded_sources ${{github.workspace}}\build ${{github.workspace}}\build\test\unit_tests\Debug\OpenALpp_UnitTests.exe
run: OpenCppCoverage.exe --export_type cobertura:${{github.workspace}}/build/OpenALppCoverage.xml --sources ${{github.workspace}}\impl --excluded_sources ${{github.workspace}}\build\test\ --excluded_sources ${{github.workspace}}\build\ext\* --excluded_sources ${{github.workspace}}\build ${{github.workspace}}\build\test\unit_tests\OpenALpp_UnitTests.exe

- name: Upload Report to Codecov
uses: codecov/codecov-action@v2
Expand Down
27 changes: 16 additions & 11 deletions .github/workflows/test_verification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,19 @@ jobs:
# working-directory: ${{github.workspace}}/build/test/approval_tests

Windows:
runs-on: windows-2019
runs-on: windows-2022
steps:
- name: Set up cmake
uses: jwlawson/actions-setup-cmake@v1.11
with:
cmake-version: '3.19.x'

- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
lfs: true

- name: Enable Developer Command Prompt
uses: ilammy/msvc-dev-cmd@v1.12.1

- name: CMake
run: cmake -B ${{github.workspace}}/build . -DOALPP_STATIC_LIBRARY=ON
Expand All @@ -123,17 +128,17 @@ jobs:
working-directory: ${{github.workspace}}/build
run: cmake --build .

- name: Install Scream
shell: powershell
run: |
Invoke-WebRequest https://github.com/duncanthrax/scream/releases/download/3.8/Scream3.8.zip -OutFile Scream3.8.zip
Expand-Archive -Path Scream3.8.zip -DestinationPath Scream
Import-Certificate -FilePath Scream\Install\driver\x64\Scream.cat -CertStoreLocation Cert:\LocalMachine\TrustedPublisher
Scream\Install\helpers\devcon-x64.exe install Scream\Install\driver\x64\Scream.inf *Scream
- name: Copy assets
run: cp -r assets ${{github.workspace}}/build/test/unit_tests/assets

- run: net start audiosrv

- name: Setup virtual soundcard
uses: LABSN/sound-ci-helpers@v1.0.1

- name: Test
working-directory: ${{github.workspace}}/build
run: test/unit_tests/Debug/OpenALpp_UnitTests.exe --order rand
working-directory: ${{github.workspace}}/build/test/unit_tests
run: ./OpenALpp_UnitTests.exe --order rand

Web:
runs-on: ubuntu-latest
Expand Down
47 changes: 43 additions & 4 deletions ext/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,53 @@
message(STATUS "Add CPM.cmake")
# download CPM.cmake
file(
DOWNLOAD
https://github.com/cpm-cmake/CPM.cmake/releases/download/v0.38.6/CPM.cmake
${CMAKE_BINARY_DIR}/cmake/CPM.cmake
EXPECTED_HASH SHA256=11c3fa5f1ba14f15d31c2fb63dbc8628ee133d81c8d764caad9a8db9e0bacb07
)
include(${CMAKE_BINARY_DIR}/cmake/CPM.cmake)

message(STATUS "Fetching external libraries started")


if (NOT EMSCRIPTEN)
add_subdirectory(openal-soft)
message(STATUS "Fetching openal-soft")
CPMAddPackage(
NAME openal-soft
GITHUB_REPOSITORY kcat/openal-soft
GIT_TAG 1.21.1
OPTIONS
"ALSOFT_UTILS OFF"
"ALSOFT_EXAMPLES OFF"
"ALSOFT_UPDATE_BUILD_VERSION OFF"
)
endif ()

add_subdirectory(libnyquist)
message(STATUS "Fetching libnyquist")
CPMAddPackage(
NAME libnyquist
GITHUB_REPOSITORY ddiakopoulos/libnyquist
GIT_TAG master
OPTIONS
"LIBNYQUIST_BUILD_EXAMPLE OFF"
)

if (OALPP_ENABLE_UNIT_TESTS)
add_subdirectory(catch2)
message(STATUS "Fetching catch2")
CPMAddPackage(
NAME catch2
GITHUB_REPOSITORY catchorg/Catch2
GIT_TAG v2.13.8
)
endif ()


if (OALPP_ENABLE_APPROVAL_TESTS)
add_subdirectory(approvaltestscpp)
message(STATUS "Fetching approvaltests")
CPMAddPackage(
NAME approvaltests
GITHUB_REPOSITORY approvals/ApprovalTests.cpp
GIT_TAG v.10.12.2
)
endif ()
9 changes: 0 additions & 9 deletions ext/approvaltestscpp/CMakeLists.txt

This file was deleted.

9 changes: 0 additions & 9 deletions ext/catch2/CMakeLists.txt

This file was deleted.

11 changes: 0 additions & 11 deletions ext/libnyquist/CMakeLists.txt

This file was deleted.

14 changes: 0 additions & 14 deletions ext/openal-soft/CMakeLists.txt

This file was deleted.

2 changes: 1 addition & 1 deletion impl/oalpp/effects/distortion/decimator.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef OPENALPP_EFFECTS_DISTORTION_DECIMATOR_HPP
#define OPENALPP_EFFECTS_DISTORTION_DECIMATOR_HPP

#include "oalpp/effects/mono_effect_interface.hpp"
#include <oalpp/effects/mono_effect_interface.hpp>

namespace oalpp {
namespace effects {
Expand Down
3 changes: 2 additions & 1 deletion impl/oalpp/effects/distortion/tanh_distortion.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#ifndef OPENALPP_EFFECTS_DISTORTION_TANH_DISTORTION_HPP
#define OPENALPP_EFFECTS_DISTORTION_TANH_DISTORTION_HPP

#include "oalpp/effects/mono_effect_interface.hpp"
#include <oalpp/effects/mono_effect_interface.hpp>

namespace oalpp {
namespace effects {
namespace distortion {
Expand Down
2 changes: 1 addition & 1 deletion impl/oalpp/effects/filter/butterworth_24db_lowpass.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef OPENALPP_EFFECTS_FILTER_BUTTERWORTH_24_D_B_HPP
#define OPENALPP_EFFECTS_FILTER_BUTTERWORTH_24_D_B_HPP

#include "oalpp/effects/mono_effect_interface.hpp"
#include <oalpp/effects/mono_effect_interface.hpp>

namespace oalpp {
namespace effects {
Expand Down
2 changes: 1 addition & 1 deletion impl/oalpp/effects/filter/moog_filter_stilson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ oalpp::effects::filter::MoogFilterStilson::MoogFilterStilson(
}

std::vector<float> oalpp::effects::filter::MoogFilterStilson::process(
const std::vector<float>& input)
std::vector<float> const& input)
{
std::vector<float> output;
output.resize(input.size());
Expand Down
4 changes: 2 additions & 2 deletions impl/oalpp/effects/filter/moog_filter_stilson.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// 6.14.2019 David Lowenfels stated "You're welcome to use the Moog~ code,
// license it free as in beer or whatever :)"

#include "oalpp/effects/mono_effect_interface.hpp"
#include <oalpp/effects/mono_effect_interface.hpp>
#include <array>

namespace oalpp {
Expand All @@ -16,7 +16,7 @@ class MoogFilterStilson : public MonoEffectInterface {
public:
MoogFilterStilson(float sampleRate, float cutoff, float resonance);

std::vector<float> process(const std::vector<float>& input) override;
std::vector<float> process(std::vector<float> const& input) override;

private:
float m_sampleRate { 0.0f };
Expand Down
2 changes: 1 addition & 1 deletion impl/oalpp/effects/filter/simple_highpass.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef OPENALPP_EFFECTS_FILTER_SIMPLE_HIGHPASS_HPP
#define OPENALPP_EFFECTS_FILTER_SIMPLE_HIGHPASS_HPP

#include "oalpp/effects/mono_effect_interface.hpp"
#include <oalpp/effects/mono_effect_interface.hpp>

namespace oalpp {
namespace effects {
Expand Down
2 changes: 1 addition & 1 deletion impl/oalpp/effects/filter/simple_lowpass.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef OPENALPP_EFFECTS_FILTER_SIMPLE_LOWPASS_HPP
#define OPENALPP_EFFECTS_FILTER_SIMPLE_LOWPASS_HPP

#include "oalpp/effects/mono_effect_interface.hpp"
#include <oalpp/effects/mono_effect_interface.hpp>

namespace oalpp {
namespace effects {
Expand Down
2 changes: 1 addition & 1 deletion impl/oalpp/effects/mono_effect_interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class MonoEffectInterface {
// avoid slicing via polymorphic copy or move
MonoEffectInterface(MonoEffectInterface const& /*other*/) = delete;
MonoEffectInterface(MonoEffectInterface&& /*other*/) = delete;
MonoEffectInterface& operator=(const MonoEffectInterface&) = delete;
MonoEffectInterface& operator=(MonoEffectInterface const&) = delete;
MonoEffectInterface& operator=(MonoEffectInterface&&) = delete;

protected:
Expand Down
2 changes: 1 addition & 1 deletion impl/oalpp/effects/utility/convolution.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "convolution.hpp"
#include "dj_fft.h"
#include <algorithm>
#include <cstddef>
#include <dj_fft.h>

namespace oalpp {
namespace effects {
Expand Down
2 changes: 1 addition & 1 deletion impl/oalpp/effects/utility/convolution.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef OPENALPP_CONVOLUTION_HPP
#define OPENALPP_CONVOLUTION_HPP

#include "oalpp/effects/mono_effect_interface.hpp"
#include <oalpp/effects/mono_effect_interface.hpp>
#include <complex>
#include <vector>

Expand Down
2 changes: 1 addition & 1 deletion impl/oalpp/effects/utility/effect_chain.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef OPENALPP_EFFECTS_UTILITY_EFFECT_CHAIN_HPP
#define OPENALPP_EFFECTS_UTILITY_EFFECT_CHAIN_HPP

#include "oalpp/effects/mono_effect_interface.hpp"
#include <oalpp/effects/mono_effect_interface.hpp>
#include <functional>
#include <vector>

Expand Down
2 changes: 1 addition & 1 deletion impl/oalpp/effects/utility/gain.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef OPENALPP_EFFECTS_UTILITY_GAIN_HPP
#define OPENALPP_EFFECTS_UTILITY_GAIN_HPP

#include "oalpp/effects/mono_effect_interface.hpp"
#include <oalpp/effects/mono_effect_interface.hpp>

namespace oalpp {
namespace effects {
Expand Down
4 changes: 3 additions & 1 deletion impl/oalpp/effects/utility/phase_flip.hpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
#ifndef OPENALPP_EFFECTS_UTILITY_PHASE_FLIP_HPP
#define OPENALPP_EFFECTS_UTILITY_PHASE_FLIP_HPP

#include "oalpp/effects/mono_effect_interface.hpp"
#include <oalpp/effects/mono_effect_interface.hpp>

namespace oalpp {
namespace effects {
namespace utility {

class PhaseFlip : public oalpp::effects::MonoEffectInterface {
public:
std::vector<float> process(std::vector<float> const& input) override;
};

} // namespace utility
} // namespace effects
} // namespace oalpp
Expand Down
2 changes: 1 addition & 1 deletion impl/oalpp/sound.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#ifndef OPENALPP_SOUND_INCLUDE_HPP
#define OPENALPP_SOUND_INCLUDE_HPP

#include "oalpp/sound/sound.hpp"
#include <oalpp/sound/sound.hpp>

#endif // OPENALPP_SOUND_INCLUDE_HPP
Loading

0 comments on commit 5e7e812

Please sign in to comment.