├── .clang-format ├── .github └── workflows │ ├── build.yml │ └── cmake.yml ├── .gitignore ├── .gitmodules ├── CMakeLists.txt ├── CODE_OF_CONDUCT.md ├── LICENSE ├── NOTICE ├── README.md ├── assets ├── data │ ├── background │ │ └── AMBForst_Forest_ID_0100_BSB.wav │ ├── footsteps │ │ ├── grass │ │ │ ├── a.mp3 │ │ │ ├── b.mp3 │ │ │ ├── c.mp3 │ │ │ ├── d.mp3 │ │ │ ├── e.mp3 │ │ │ ├── f.mp3 │ │ │ └── g.mp3 │ │ ├── metal │ │ │ ├── a.mp3 │ │ │ └── b.mp3 │ │ └── snow │ │ │ ├── a.mp3 │ │ │ └── b.mp3 │ ├── music │ │ └── symphony.ogg │ ├── sadie_h12.amir │ ├── tests │ │ ├── file_read_test.txt │ │ ├── test_sound_01.wav │ │ ├── test_sound_02.wav │ │ └── test_sound_03.wav │ ├── throw_01.ogg │ ├── throw_02.ogg │ ├── throw_03.ogg │ ├── throw_04.ogg │ ├── throw_05.ogg │ ├── throw_06.ogg │ ├── throw_07.ogg │ └── throw_08.ogg ├── test_data │ └── diskfile_read_test.txt └── textures │ ├── channel.bmp │ ├── instructions.bmp │ └── listener.bmp ├── cmake ├── CodeCoverage.cmake ├── DetectAmplitudeVersion.cmake ├── DetectCPUArchitecture.cmake ├── DetectPlatform.cmake └── FindAmplitudeAudioSDK.cmake ├── codecov.yml ├── include └── SparkyStudios │ └── Audio │ └── Amplitude │ ├── Amplitude.h │ ├── Core │ ├── Asset.h │ ├── AudioBuffer.h │ ├── Codec.h │ ├── Common.h │ ├── Common │ │ ├── Config.h │ │ ├── Constants.h │ │ ├── Platforms │ │ │ ├── Android │ │ │ │ ├── Config.h │ │ │ │ └── Types.h │ │ │ ├── Apple │ │ │ │ ├── Config.h │ │ │ │ └── Types.h │ │ │ ├── Linux │ │ │ │ ├── Config.h │ │ │ │ └── Types.h │ │ │ ├── UNIX │ │ │ │ ├── Config.h │ │ │ │ └── Types.h │ │ │ └── Windows │ │ │ │ ├── Config.h │ │ │ │ └── Types.h │ │ ├── SIMD.h │ │ └── Types.h │ ├── Device.h │ ├── Driver.h │ ├── Engine.h │ ├── Entity.h │ ├── Environment.h │ ├── Event.h │ ├── Listener.h │ ├── Memory.h │ ├── Playback │ │ ├── Bus.h │ │ ├── Channel.h │ │ └── ChannelEventListener.h │ ├── RefCounter.h │ ├── Room.h │ ├── Thread.h │ └── Version.h │ ├── DSP │ ├── AudioConverter.h │ ├── Convolver.h │ ├── FFT.h │ ├── Filter.h │ ├── Resampler.h │ └── SplitComplex.h │ ├── HRTF │ └── HRIRSphere.h │ ├── IO │ ├── Android │ │ ├── AssetManagerFile.h │ │ ├── AssetManagerFileSystem.h │ │ └── LogcatLogger.h │ ├── ConsoleLogger.h │ ├── DiskFile.h │ ├── DiskFileSystem.h │ ├── File.h │ ├── FileSystem.h │ ├── Log.h │ ├── MemoryFile.h │ ├── PackageFileSystem.h │ ├── PackageItemFile.h │ └── Resource.h │ ├── Math │ ├── BarycentricCoordinates.h │ ├── CartesianCoordinateSystem.h │ ├── Curve.h │ ├── Geometry.h │ ├── HandmadeMath.h │ ├── Orientation.h │ ├── Shape.h │ ├── SphericalPosition.h │ └── Utils.h │ ├── Mixer │ ├── Amplimix.h │ ├── Node.h │ └── Pipeline.h │ └── Sound │ ├── Attenuation.h │ ├── Collection.h │ ├── Effect.h │ ├── Fader.h │ ├── Rtpc.h │ ├── Sound.h │ ├── SoundBank.h │ ├── SoundObject.h │ ├── Switch.h │ └── SwitchContainer.h ├── sample_project ├── .amignore ├── .amproject ├── attenuators │ ├── impact.json │ ├── pipe.json │ └── room.json ├── collections │ ├── grass_footsteps.json │ ├── metal_footsteps.json │ ├── snow_footsteps.json │ ├── test_collection.json │ ├── throw_collection_1.json │ └── throw_collection_2.json ├── effects │ ├── bassboost.json │ ├── delay.json │ ├── equalizer.json │ ├── flanger.json │ ├── lpf.json │ └── robotize.json ├── events │ ├── mute_bg_bus.json │ ├── play_throw.json │ ├── player_footstep.json │ └── stop_throw.json ├── pc.buses.json ├── pc.config.json ├── pipelines │ ├── default.json │ ├── default.json.meta │ ├── stereo.json │ ├── stereo.json.meta │ ├── tests.double_consume.json │ ├── tests.invalid.invalid_consumer_node.json │ ├── tests.invalid.invalid_producers_count.json │ ├── tests.invalid.missing_input.json │ ├── tests.invalid.missing_output.json │ ├── tests.invalid.missing_producers.json │ ├── tests.invalid.multiple_input.json │ ├── tests.invalid.multiple_output.json │ ├── tests.invalid.self_consume.json │ └── tests.invalid.unknown_node.json ├── rtpc │ ├── rtpc_player_height.json │ └── wind_force.json ├── soundbanks │ ├── init.json │ ├── sample_01.json │ ├── sample_02.json │ └── tests.init.json ├── sounds │ ├── background │ │ └── AMBForst_Forest_ID_0100_BSB.wav.json │ ├── footsteps │ │ ├── grass │ │ │ ├── a.mp3.json │ │ │ ├── b.mp3.json │ │ │ ├── c.mp3.json │ │ │ ├── d.mp3.json │ │ │ ├── e.mp3.json │ │ │ ├── f.mp3.json │ │ │ └── g.mp3.json │ │ ├── metal │ │ │ ├── a.mp3.json │ │ │ └── b.mp3.json │ │ └── snow │ │ │ ├── a.mp3.json │ │ │ └── b.mp3.json │ ├── music │ │ └── symphony.ogg.json │ ├── tests │ │ ├── test_sound_01.json │ │ ├── test_sound_02.json │ │ └── test_sound_03.json │ ├── throw_01.ogg.json │ ├── throw_02.ogg.json │ ├── throw_03.ogg.json │ ├── throw_04.ogg.json │ ├── throw_05.ogg.json │ ├── throw_06.ogg.json │ ├── throw_07.ogg.json │ └── throw_08.ogg.json ├── switch_containers │ └── footsteps.json ├── switches │ ├── env.json │ └── surface_type.json ├── tests.config.json ├── tests.invalid.empty_pipeline.config.json ├── tests.invalid.failing_driver.config.json ├── tests.invalid.missing_child_bus.buses.json ├── tests.invalid.missing_child_bus.config.json ├── tests.invalid.missing_duck_bus.buses.json ├── tests.invalid.missing_duck_bus.config.json ├── tests.invalid.unknown_buses.config.json ├── tests.invalid.unknown_driver.config.json ├── tests.invalid.unset_driver.config.json ├── tests.invalid.wrong_master_bus.buses.json ├── tests.invalid.wrong_master_bus.config.json ├── tests.invalid.wrong_master_bus_id.buses.json ├── tests.invalid.wrong_master_bus_id.config.json ├── tests.invalid.wrong_master_bus_name.buses.json └── tests.invalid.wrong_master_bus_name.config.json ├── samples ├── CMakeLists.txt ├── sample_01 │ ├── CMakeLists.txt │ └── main.cpp └── sample_02 │ ├── CMakeLists.txt │ └── main.cpp ├── schemas ├── attenuation_definition.fbs ├── buses_definition.fbs ├── collection_definition.fbs ├── common.fbs ├── effect_definition.fbs ├── engine_config_definition.fbs ├── event_definition.fbs ├── pipeline_definition.fbs ├── rtpc_definition.fbs ├── sound_bank_definition.fbs ├── sound_definition.fbs ├── switch_container_definition.fbs └── switch_definition.fbs ├── scripts ├── build_project.py ├── build_schemas.py ├── clean_project.py └── common.py ├── src ├── Ambisonics │ ├── AmbisonicBinauralizer.cpp │ ├── AmbisonicBinauralizer.h │ ├── AmbisonicComponent.cpp │ ├── AmbisonicComponent.h │ ├── AmbisonicDecoder.cpp │ ├── AmbisonicDecoder.h │ ├── AmbisonicEntity.cpp │ ├── AmbisonicEntity.h │ ├── AmbisonicOrientationProcessor.cpp │ ├── AmbisonicOrientationProcessor.h │ ├── AmbisonicSource.cpp │ ├── AmbisonicSource.h │ ├── AmbisonicSpeaker.cpp │ ├── AmbisonicSpeaker.h │ ├── BFormat.cpp │ └── BFormat.h ├── Core │ ├── Asset.cpp │ ├── Asset.h │ ├── AudioBuffer.cpp │ ├── AudioBufferCrossFader.cpp │ ├── AudioBufferCrossFader.h │ ├── Codec.cpp │ ├── Codecs │ │ ├── AMS │ │ │ ├── Codec.cpp │ │ │ └── Codec.h │ │ ├── MP3 │ │ │ ├── Codec.cpp │ │ │ ├── Codec.h │ │ │ └── dr_mp3.h │ │ └── WAV │ │ │ ├── Codec.cpp │ │ │ ├── Codec.h │ │ │ └── dr_wav.h │ ├── Common.cpp │ ├── DefaultPlugins.h │ ├── Device.cpp │ ├── Driver.cpp │ ├── Drivers │ │ ├── MiniAudio │ │ │ ├── Driver.cpp │ │ │ └── Driver.h │ │ └── Null │ │ │ ├── Driver.cpp │ │ │ └── Driver.h │ ├── Engine.cpp │ ├── Engine.h │ ├── EngineInternalState.h │ ├── Entity.cpp │ ├── EntityInternalState.cpp │ ├── EntityInternalState.h │ ├── Environment.cpp │ ├── EnvironmentInternalState.cpp │ ├── EnvironmentInternalState.h │ ├── Event.cpp │ ├── Event.h │ ├── Listener.cpp │ ├── ListenerInternalState.cpp │ ├── ListenerInternalState.h │ ├── Memory.cpp │ ├── Playback │ │ ├── Bus.cpp │ │ ├── BusInternalState.cpp │ │ ├── BusInternalState.h │ │ ├── Channel.cpp │ │ ├── ChannelEventListener.cpp │ │ ├── ChannelInternalState.cpp │ │ └── ChannelInternalState.h │ ├── Room.cpp │ ├── RoomInternalState.cpp │ ├── RoomInternalState.h │ ├── Thread.cpp │ └── Version.cpp ├── DSP │ ├── AudioConverter.cpp │ ├── Convolver.cpp │ ├── Delay.cpp │ ├── Delay.h │ ├── FFT.cpp │ ├── Filter.cpp │ ├── Filters │ │ ├── BassBoostFilter.cpp │ │ ├── BassBoostFilter.h │ │ ├── BiquadResonantFilter.cpp │ │ ├── BiquadResonantFilter.h │ │ ├── DCRemovalFilter.cpp │ │ ├── DCRemovalFilter.h │ │ ├── DelayFilter.cpp │ │ ├── DelayFilter.h │ │ ├── EqualizerFilter.cpp │ │ ├── EqualizerFilter.h │ │ ├── FFTFilter.cpp │ │ ├── FFTFilter.h │ │ ├── FlangerFilter.cpp │ │ ├── FlangerFilter.h │ │ ├── LofiFilter.cpp │ │ ├── LofiFilter.h │ │ ├── MonoPoleFilter.cpp │ │ ├── MonoPoleFilter.h │ │ ├── RobotizeFilter.cpp │ │ ├── RobotizeFilter.h │ │ ├── WaveShaperFilter.cpp │ │ └── WaveShaperFilter.h │ ├── Gain.cpp │ ├── Gain.h │ ├── NearFieldProcessor.cpp │ ├── NearFieldProcessor.h │ ├── ReflectionsProcessor.cpp │ ├── ReflectionsProcessor.h │ ├── Resampler.cpp │ ├── Resamplers │ │ ├── DefaultResampler.cpp │ │ └── DefaultResampler.h │ └── SplitComplex.cpp ├── HRTF │ ├── HRIRSphere.cpp │ ├── HRIRSphere.h │ └── HRTFContext.h ├── IO │ ├── Android │ │ ├── AssetManagerFile.cpp │ │ ├── AssetManagerFileSystem.cpp │ │ └── LogcatLogger.cpp │ ├── ConsoleLogger.cpp │ ├── DiskFile.cpp │ ├── DiskFileSystem.cpp │ ├── File.cpp │ ├── Log.cpp │ ├── MemoryFile.cpp │ ├── PackageFileSystem.cpp │ ├── PackageItemFile.cpp │ └── Resource.h ├── Math │ ├── BarycentricCoordinates.cpp │ ├── CartesianCoordinateSystem.cpp │ ├── Curve.cpp │ ├── FaceBSPTree.cpp │ ├── FaceBSPTree.h │ ├── Geometry.cpp │ ├── Orientation.cpp │ ├── Shape.cpp │ └── SphericalPosition.cpp ├── Mixer │ ├── Amplimix.cpp │ ├── Amplimix.h │ ├── Node.cpp │ ├── Nodes │ │ ├── AmbisonicBinauralDecoderNode.cpp │ │ ├── AmbisonicBinauralDecoderNode.h │ │ ├── AmbisonicMixerNode.cpp │ │ ├── AmbisonicMixerNode.h │ │ ├── AmbisonicPanningNode.cpp │ │ ├── AmbisonicPanningNode.h │ │ ├── AmbisonicRotatorNode.cpp │ │ ├── AmbisonicRotatorNode.h │ │ ├── AttenuationNode.cpp │ │ ├── AttenuationNode.h │ │ ├── ClampNode.cpp │ │ ├── ClampNode.h │ │ ├── ClipNode.cpp │ │ ├── ClipNode.h │ │ ├── EnvironmentEffectNode.cpp │ │ ├── EnvironmentEffectNode.h │ │ ├── InputNode.cpp │ │ ├── InputNode.h │ │ ├── NearFieldEffectNode.cpp │ │ ├── NearFieldEffectNode.h │ │ ├── ObstructionNode.cpp │ │ ├── ObstructionNode.h │ │ ├── OcclusionNode.cpp │ │ ├── OcclusionNode.h │ │ ├── OutputNode.cpp │ │ ├── OutputNode.h │ │ ├── ReflectionsNode.cpp │ │ ├── ReflectionsNode.h │ │ ├── ReverbNode.cpp │ │ ├── ReverbNode.h │ │ ├── StereoMixerNode.cpp │ │ ├── StereoMixerNode.h │ │ ├── StereoPanningNode.cpp │ │ └── StereoPanningNode.h │ ├── Pipeline.cpp │ ├── Pipeline.h │ ├── RealChannel.cpp │ ├── RealChannel.h │ ├── SoundData.cpp │ └── SoundData.h ├── Sound │ ├── Attenuation.cpp │ ├── Attenuation.h │ ├── AttenuationShapes.cpp │ ├── AttenuationShapes.h │ ├── Collection.cpp │ ├── Collection.h │ ├── Effect.cpp │ ├── Effect.h │ ├── Fader.cpp │ ├── Faders │ │ ├── ConstantFader.h │ │ ├── EaseFader.h │ │ ├── EaseInFader.h │ │ ├── EaseInOutFader.h │ │ ├── EaseOutFader.h │ │ ├── ExponentialFader.h │ │ ├── LinearFader.h │ │ └── SCurveFader.h │ ├── RefCounter.cpp │ ├── Rtpc.cpp │ ├── Rtpc.h │ ├── Scheduler.h │ ├── Schedulers │ │ ├── RandomScheduler.cpp │ │ ├── RandomScheduler.h │ │ ├── SequenceScheduler.cpp │ │ └── SequenceScheduler.h │ ├── Sound.cpp │ ├── Sound.h │ ├── SoundBank.cpp │ ├── SoundObject.cpp │ ├── SoundObject.h │ ├── Switch.cpp │ ├── Switch.h │ ├── SwitchContainer.cpp │ └── SwitchContainer.h └── Utils │ ├── Audio │ ├── Compression │ │ └── ADPCM │ │ │ ├── ADPCM.cpp │ │ │ └── ADPCM.h │ └── FFT │ │ ├── AudioFFT.cpp │ │ └── AudioFFT.h │ ├── Freeverb │ ├── AllPass.cpp │ ├── AllPass.h │ ├── Comb.cpp │ ├── Comb.h │ ├── ReverbModel.cpp │ ├── ReverbModel.h │ ├── denormals.h │ └── tuning.h │ ├── SmMalloc │ ├── smmalloc.cpp │ ├── smmalloc.h │ ├── smmalloc_generic.cpp │ └── smmalloc_tls.cpp │ ├── Utils.cpp │ ├── Utils.h │ ├── intrusive_list.h │ ├── lebedev-quadrature │ ├── generator_point.hpp │ ├── generator_point.inl │ ├── lebedev_quadrature.hpp │ ├── preprocessor.hpp │ ├── quadrature_order.hpp │ ├── quadrature_order.inl │ ├── quadrature_points.hpp │ └── quadrature_points.inl │ ├── miniaudio │ ├── miniaudio.cpp │ └── miniaudio_utils.h │ └── pffft │ ├── pffft.cpp │ ├── pffft.h │ ├── pffft_common.cpp │ ├── pffft_double.cpp │ ├── pffft_double.h │ ├── pffft_priv_impl.h │ └── simd │ ├── pf_altivec_float.h │ ├── pf_avx_double.h │ ├── pf_double.h │ ├── pf_float.h │ ├── pf_neon_double.h │ ├── pf_neon_double_from_avx.h │ ├── pf_neon_float.h │ ├── pf_scalar_double.h │ ├── pf_scalar_float.h │ ├── pf_sse1_float.h │ └── pf_sse2_double.h ├── tests ├── CMakeLists.txt ├── assets.cpp ├── audio_buffer.cpp ├── common.cpp ├── engine.cpp ├── entity.cpp ├── environment.cpp ├── fader.cpp ├── filesystem.cpp ├── hrtf.cpp ├── listener.cpp ├── main.cpp ├── math.cpp ├── pipeline.cpp ├── room.cpp ├── shape.cpp ├── thread.cpp ├── version.cpp └── zone.cpp ├── tools ├── amac │ ├── CMakeLists.txt │ └── main.cpp ├── amir │ ├── CMakeLists.txt │ ├── convhull_3d.h │ └── main.cpp ├── ampk │ ├── CMakeLists.txt │ └── main.cpp └── ampm │ ├── CMakeLists.txt │ ├── main.cpp │ └── resources │ ├── default.buses.json │ ├── default.config.json │ ├── default.pipeline.json │ └── default.source.json └── vcpkg.json /.clang-format: -------------------------------------------------------------------------------- 1 | Language: Cpp 2 | 3 | AccessModifierOffset: -4 4 | AlignAfterOpenBracket: AlwaysBreak 5 | AlignConsecutiveAssignments: None 6 | AlignConsecutiveDeclarations: None 7 | AlignEscapedNewlines: Right 8 | AlignOperands: false 9 | AlignTrailingComments: false 10 | AllowAllArgumentsOnNextLine: true 11 | AllowAllParametersOfDeclarationOnNextLine: true 12 | AllowShortFunctionsOnASingleLine: None 13 | AllowShortLambdasOnASingleLine: None 14 | AlwaysBreakAfterReturnType: None 15 | AlwaysBreakTemplateDeclarations: Yes 16 | BinPackParameters: false 17 | BreakBeforeBraces: Custom 18 | BraceWrapping: 19 | AfterClass: true 20 | AfterControlStatement: true 21 | AfterEnum: true 22 | AfterFunction: true 23 | AfterNamespace: true 24 | BeforeLambdaBody: true 25 | AfterStruct: true 26 | BeforeElse: true 27 | SplitEmptyFunction: false 28 | BreakBeforeTernaryOperators: true 29 | BreakConstructorInitializers: BeforeComma 30 | BreakInheritanceList: BeforeComma 31 | ColumnLimit: 140 32 | ConstructorInitializerIndentWidth: 4 33 | ContinuationIndentWidth: 4 34 | Cpp11BracedListStyle: false 35 | FixNamespaceComments: true 36 | IncludeBlocks: Preserve 37 | IndentCaseBlocks: true 38 | IndentCaseLabels: false 39 | IndentPPDirectives: None 40 | IndentWidth: 4 41 | KeepEmptyLinesAtTheStartOfBlocks: false 42 | MaxEmptyLinesToKeep: 1 43 | NamespaceIndentation: All 44 | PenaltyReturnTypeOnItsOwnLine: 1000 45 | PointerAlignment: Left 46 | SortIncludes: CaseInsensitive 47 | SpaceAfterLogicalNot: false 48 | SpaceAfterTemplateKeyword: false 49 | SpaceBeforeAssignmentOperators: true 50 | SpaceBeforeCpp11BracedList: false 51 | SpaceBeforeCtorInitializerColon: true 52 | SpaceBeforeInheritanceColon: true 53 | SpaceBeforeParens: ControlStatements 54 | SpaceBeforeRangeBasedForLoopColon: true 55 | SpaceInEmptyParentheses: false 56 | SpacesInAngles: false 57 | SpacesInCStyleCastParentheses: false 58 | SpacesInParentheses: false 59 | Standard: c++17 60 | UseTab: Never 61 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Binary 2 | lib/ 3 | libs/ 4 | bin/ 5 | obj/ 6 | sdk/ 7 | tests/*_test 8 | schemas/*.bfbs 9 | 10 | *.ambank 11 | *.ambus 12 | *.amconfig 13 | *.amsound 14 | *.amcollection 15 | *.amevent 16 | *.amattenuation 17 | *.a 18 | 19 | # CMake files 20 | CMakeCache.txt 21 | CMakeFiles/ 22 | CMakeScripts/ 23 | cmake_install.cmake 24 | tests/Debug/ 25 | tests/Release/ 26 | tests/audio_engine_test.dir/ 27 | 28 | # Gnumake 29 | Makefile 30 | 31 | # Visual Studio files 32 | .vs/ 33 | .vscode/ 34 | [bB]uild/ 35 | *.sln 36 | *.user 37 | *.suo 38 | *.vcxproj 39 | *.vcxproj.filters 40 | [dD]ebug/ 41 | Win32/ 42 | 43 | # Jetbrains files 44 | .idea/ 45 | cmake-*/ 46 | 47 | # qt creator 48 | *.cbp 49 | 50 | # Misc generated files 51 | tags/ 52 | gen/ 53 | .DS_Store 54 | 55 | # CLangd cache 56 | .cache/ 57 | 58 | # VCPKG 59 | vcpkg_installed/ 60 | am_build/ 61 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmplitudeAudio/sdk/40d2ffc93bec0e24e5d26b6277122e51e8465777/.gitmodules -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Amplitude Audio SDK 2 | Copyright (c) 2021-present Sparky Studios. All rights reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | --- 17 | 18 | This software contains code derived from the Freeverb library by Jezar at Dreampoint (http://www.dreampoint.co.uk), 19 | June 2000, which was placed in public domain. 20 | 21 | This software includes the pffftd library, developed by Julien Pommier ( pommier@modartt.com ), based on original 22 | fortran 77 code from FFTPACKv4 from NETLIB, authored by Dr Paul Swarztrauber of NCAR, in 1985. The library uses 23 | the same license as the original, which is the BSD-3-Clause License. 24 | 25 | This software contains code based on ADPCM-XQ (https://github.com/dbry/adpcm-xq), Copyright (c) 2015 David Bryant, 26 | which was licensed under the BSD-3-Clause License. 27 | 28 | This software contains code derived from AudioFFT and FFTConvolution (https://github.com/HiFi-LoFi/AudioFFT), 29 | Copyright (c) 2017 HiFi-LoFi, which was licensed under the MIT License. 30 | 31 | This software includes implementations derived from the ambisonic-lib library (https://github.com/delikas/ambisonic-lib), 32 | Copyright (c) 2014 greekgoddj, and distributed under the MIT License. 33 | 34 | This software includes code of the lebedev-quadrature library (https://github.com/lucasmyers97/lebedev-quadrature). 35 | 36 | This software includes some implementations derived from the Resonance Audio library (https://github.com/resonance-audio/resonance-audio), 37 | Copyright 2018 Google Inc, and distributed under the Apache-2.0 License. 38 | 39 | The Amplimix code is heavily inspired by the atomix library (https://github.com/BareRose/atomix) licensed under 40 | the CC0-1.0 License. 41 | -------------------------------------------------------------------------------- /assets/data/background/AMBForst_Forest_ID_0100_BSB.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmplitudeAudio/sdk/40d2ffc93bec0e24e5d26b6277122e51e8465777/assets/data/background/AMBForst_Forest_ID_0100_BSB.wav -------------------------------------------------------------------------------- /assets/data/footsteps/grass/a.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmplitudeAudio/sdk/40d2ffc93bec0e24e5d26b6277122e51e8465777/assets/data/footsteps/grass/a.mp3 -------------------------------------------------------------------------------- /assets/data/footsteps/grass/b.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmplitudeAudio/sdk/40d2ffc93bec0e24e5d26b6277122e51e8465777/assets/data/footsteps/grass/b.mp3 -------------------------------------------------------------------------------- /assets/data/footsteps/grass/c.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmplitudeAudio/sdk/40d2ffc93bec0e24e5d26b6277122e51e8465777/assets/data/footsteps/grass/c.mp3 -------------------------------------------------------------------------------- /assets/data/footsteps/grass/d.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmplitudeAudio/sdk/40d2ffc93bec0e24e5d26b6277122e51e8465777/assets/data/footsteps/grass/d.mp3 -------------------------------------------------------------------------------- /assets/data/footsteps/grass/e.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmplitudeAudio/sdk/40d2ffc93bec0e24e5d26b6277122e51e8465777/assets/data/footsteps/grass/e.mp3 -------------------------------------------------------------------------------- /assets/data/footsteps/grass/f.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmplitudeAudio/sdk/40d2ffc93bec0e24e5d26b6277122e51e8465777/assets/data/footsteps/grass/f.mp3 -------------------------------------------------------------------------------- /assets/data/footsteps/grass/g.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmplitudeAudio/sdk/40d2ffc93bec0e24e5d26b6277122e51e8465777/assets/data/footsteps/grass/g.mp3 -------------------------------------------------------------------------------- /assets/data/footsteps/metal/a.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmplitudeAudio/sdk/40d2ffc93bec0e24e5d26b6277122e51e8465777/assets/data/footsteps/metal/a.mp3 -------------------------------------------------------------------------------- /assets/data/footsteps/metal/b.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmplitudeAudio/sdk/40d2ffc93bec0e24e5d26b6277122e51e8465777/assets/data/footsteps/metal/b.mp3 -------------------------------------------------------------------------------- /assets/data/footsteps/snow/a.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmplitudeAudio/sdk/40d2ffc93bec0e24e5d26b6277122e51e8465777/assets/data/footsteps/snow/a.mp3 -------------------------------------------------------------------------------- /assets/data/footsteps/snow/b.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmplitudeAudio/sdk/40d2ffc93bec0e24e5d26b6277122e51e8465777/assets/data/footsteps/snow/b.mp3 -------------------------------------------------------------------------------- /assets/data/music/symphony.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmplitudeAudio/sdk/40d2ffc93bec0e24e5d26b6277122e51e8465777/assets/data/music/symphony.ogg -------------------------------------------------------------------------------- /assets/data/sadie_h12.amir: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmplitudeAudio/sdk/40d2ffc93bec0e24e5d26b6277122e51e8465777/assets/data/sadie_h12.amir -------------------------------------------------------------------------------- /assets/data/tests/file_read_test.txt: -------------------------------------------------------------------------------- 1 | OK -------------------------------------------------------------------------------- /assets/data/tests/test_sound_01.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmplitudeAudio/sdk/40d2ffc93bec0e24e5d26b6277122e51e8465777/assets/data/tests/test_sound_01.wav -------------------------------------------------------------------------------- /assets/data/tests/test_sound_02.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmplitudeAudio/sdk/40d2ffc93bec0e24e5d26b6277122e51e8465777/assets/data/tests/test_sound_02.wav -------------------------------------------------------------------------------- /assets/data/tests/test_sound_03.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmplitudeAudio/sdk/40d2ffc93bec0e24e5d26b6277122e51e8465777/assets/data/tests/test_sound_03.wav -------------------------------------------------------------------------------- /assets/data/throw_01.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmplitudeAudio/sdk/40d2ffc93bec0e24e5d26b6277122e51e8465777/assets/data/throw_01.ogg -------------------------------------------------------------------------------- /assets/data/throw_02.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmplitudeAudio/sdk/40d2ffc93bec0e24e5d26b6277122e51e8465777/assets/data/throw_02.ogg -------------------------------------------------------------------------------- /assets/data/throw_03.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmplitudeAudio/sdk/40d2ffc93bec0e24e5d26b6277122e51e8465777/assets/data/throw_03.ogg -------------------------------------------------------------------------------- /assets/data/throw_04.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmplitudeAudio/sdk/40d2ffc93bec0e24e5d26b6277122e51e8465777/assets/data/throw_04.ogg -------------------------------------------------------------------------------- /assets/data/throw_05.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmplitudeAudio/sdk/40d2ffc93bec0e24e5d26b6277122e51e8465777/assets/data/throw_05.ogg -------------------------------------------------------------------------------- /assets/data/throw_06.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmplitudeAudio/sdk/40d2ffc93bec0e24e5d26b6277122e51e8465777/assets/data/throw_06.ogg -------------------------------------------------------------------------------- /assets/data/throw_07.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmplitudeAudio/sdk/40d2ffc93bec0e24e5d26b6277122e51e8465777/assets/data/throw_07.ogg -------------------------------------------------------------------------------- /assets/data/throw_08.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmplitudeAudio/sdk/40d2ffc93bec0e24e5d26b6277122e51e8465777/assets/data/throw_08.ogg -------------------------------------------------------------------------------- /assets/test_data/diskfile_read_test.txt: -------------------------------------------------------------------------------- 1 | OK -------------------------------------------------------------------------------- /assets/textures/channel.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmplitudeAudio/sdk/40d2ffc93bec0e24e5d26b6277122e51e8465777/assets/textures/channel.bmp -------------------------------------------------------------------------------- /assets/textures/instructions.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmplitudeAudio/sdk/40d2ffc93bec0e24e5d26b6277122e51e8465777/assets/textures/instructions.bmp -------------------------------------------------------------------------------- /assets/textures/listener.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmplitudeAudio/sdk/40d2ffc93bec0e24e5d26b6277122e51e8465777/assets/textures/listener.bmp -------------------------------------------------------------------------------- /cmake/DetectAmplitudeVersion.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | file(READ "${CMAKE_CURRENT_LIST_DIR}/../include/SparkyStudios/Audio/Amplitude/Core/Version.h" AM_VERSION_CPP_CONTENT) 16 | 17 | string(REGEX REPLACE ".*#define AM_VERSION_MAJOR ([0-9]+).*" "\\1" DETECTED_AM_VERSION_MAJOR "${AM_VERSION_CPP_CONTENT}") 18 | string(REGEX REPLACE ".*#define AM_VERSION_MINOR ([0-9]+).*" "\\1" DETECTED_AM_VERSION_MINOR "${AM_VERSION_CPP_CONTENT}") 19 | string(REGEX REPLACE ".*#define AM_VERSION_PATCH ([0-9]+).*" "\\1" DETECTED_AM_VERSION_PATCH "${AM_VERSION_CPP_CONTENT}") 20 | 21 | set(DETECTED_AM_VERSION "${DETECTED_AM_VERSION_MAJOR}.${DETECTED_AM_VERSION_MINOR}.${DETECTED_AM_VERSION_PATCH}") 22 | 23 | message(STATUS "Detected Amplitude Audio SDK Version - ${DETECTED_AM_VERSION}") 24 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | codecov: 2 | branch: develop 3 | 4 | coverage: 5 | round: up 6 | range: 0..10 7 | 8 | ignore: 9 | - src/Utils/ 10 | - samples/ 11 | - tools/ 12 | -------------------------------------------------------------------------------- /include/SparkyStudios/Audio/Amplitude/Core/Asset.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #ifndef _AM_CORE_ASSET_H 18 | #define _AM_CORE_ASSET_H 19 | 20 | #include 21 | 22 | namespace SparkyStudios::Audio::Amplitude 23 | { 24 | /** 25 | * @brief Amplitude Asset. 26 | * 27 | * This is the base class for all Amplitude assets. An Amplitude asset is a 28 | * `.json` file with a specific format (definition) specified by the corresponding 29 | * asset's flatbuffer schema. 30 | * 31 | * @tparam Id The type of the asset id. 32 | * 33 | * @ingroup assets 34 | */ 35 | template 36 | class AM_API_PUBLIC Asset 37 | { 38 | public: 39 | /** 40 | * @brief Destroys the asset and all related resources. 41 | */ 42 | virtual ~Asset() = default; 43 | 44 | /** 45 | * @brief Returns the unique ID of this asset. 46 | * 47 | * @return The asset unique ID. 48 | */ 49 | [[nodiscard]] virtual Id GetId() const = 0; 50 | 51 | /** 52 | * @brief Gets the name of this asset. 53 | * 54 | * @return The asset name. 55 | */ 56 | [[nodiscard]] virtual const AmString& GetName() const = 0; 57 | }; 58 | } // namespace SparkyStudios::Audio::Amplitude 59 | 60 | #endif // _AM_CORE_ASSET_H 61 | -------------------------------------------------------------------------------- /include/SparkyStudios/Audio/Amplitude/Core/Common/Platforms/Android/Config.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #ifndef _AM_CORE_COMMON_PLATFORMS_ANDROID_CONFIG_H 18 | #define _AM_CORE_COMMON_PLATFORMS_ANDROID_CONFIG_H 19 | 20 | // Spinlock isn't available on Android NDK 21 | #define AM_NO_PTHREAD_SPINLOCK 22 | 23 | #include 24 | 25 | // Amplitude doesn't support SIMD on non NEON64 Android platforms (armeabi-v7a) 26 | #if !defined(__aarch64__) 27 | #define AMPLITUDE_DISABLE_SIMD 28 | #endif 29 | 30 | #ifndef AM_ID_CHAR_FMT 31 | #if defined(__aarch64__) 32 | /// Defines the format used to print AmObjectId value 33 | #define AM_ID_CHAR_FMT "%lu" 34 | #else 35 | /// Defines the format used to print AmObjectId value 36 | #define AM_ID_CHAR_FMT "%llu" 37 | #endif 38 | #endif 39 | 40 | #endif // _AM_CORE_COMMON_PLATFORMS_ANDROID_CONFIG_H 41 | -------------------------------------------------------------------------------- /include/SparkyStudios/Audio/Amplitude/Core/Common/Platforms/Android/Types.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #ifndef _AM_CORE_COMMON_PLATFORMS_ANDROID_TYPES_H 18 | #define _AM_CORE_COMMON_PLATFORMS_ANDROID_TYPES_H 19 | 20 | #include 21 | 22 | #endif // _AM_CORE_COMMON_PLATFORMS_ANDROID_TYPES_H 23 | -------------------------------------------------------------------------------- /include/SparkyStudios/Audio/Amplitude/Core/Common/Platforms/Apple/Config.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #ifndef _AM_CORE_COMMON_PLATFORMS_APPLE_CONFIG_H 18 | #define _AM_CORE_COMMON_PLATFORMS_APPLE_CONFIG_H 19 | 20 | // Spinlock isn't available on Apple CLang 21 | #define AM_NO_PTHREAD_SPINLOCK 22 | 23 | #include 24 | 25 | #ifndef AM_ID_CHAR_FMT 26 | /// Defines the format used to print AmObjectId value 27 | #define AM_ID_CHAR_FMT "%llu" 28 | #endif 29 | 30 | #endif // _AM_CORE_COMMON_PLATFORMS_APPLE_CONFIG_H 31 | -------------------------------------------------------------------------------- /include/SparkyStudios/Audio/Amplitude/Core/Common/Platforms/Apple/Types.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #ifndef _AM_CORE_COMMON_PLATFORMS_APPLE_TYPES_H 18 | #define _AM_CORE_COMMON_PLATFORMS_APPLE_TYPES_H 19 | 20 | #include 21 | 22 | #endif // _AM_CORE_COMMON_PLATFORMS_APPLE_TYPES_H 23 | -------------------------------------------------------------------------------- /include/SparkyStudios/Audio/Amplitude/Core/Common/Platforms/Linux/Config.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #ifndef _AM_CORE_COMMON_PLATFORMS_LINUX_CONFIG_H 18 | #define _AM_CORE_COMMON_PLATFORMS_LINUX_CONFIG_H 19 | 20 | #include 21 | 22 | #ifndef AM_ID_CHAR_FMT 23 | /// Defines the format used to print AmObjectId value 24 | #define AM_ID_CHAR_FMT "%lu" 25 | #endif 26 | 27 | #endif // _AM_CORE_COMMON_PLATFORMS_LINUX_CONFIG_H 28 | -------------------------------------------------------------------------------- /include/SparkyStudios/Audio/Amplitude/Core/Common/Platforms/Linux/Types.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #ifndef _AM_CORE_COMMON_PLATFORMS_LINUX_TYPES_H 18 | #define _AM_CORE_COMMON_PLATFORMS_LINUX_TYPES_H 19 | 20 | #include 21 | 22 | #endif // _AM_CORE_COMMON_PLATFORMS_LINUX_TYPES_H 23 | -------------------------------------------------------------------------------- /include/SparkyStudios/Audio/Amplitude/Core/RefCounter.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #ifndef _AM_CORE_REF_COUNTER_H 18 | #define _AM_CORE_REF_COUNTER_H 19 | 20 | #include 21 | 22 | namespace SparkyStudios::Audio::Amplitude 23 | { 24 | /** 25 | * @brief Holds the number of references to an object. 26 | * 27 | * @ingroup core 28 | */ 29 | class AM_API_PUBLIC RefCounter 30 | { 31 | public: 32 | /** 33 | * @brief Constructs a new `RefCounter`. 34 | * 35 | * This initializes the internal counter to 0. 36 | */ 37 | RefCounter() 38 | : _count(0) 39 | {} 40 | 41 | /** 42 | * @brief Updates the counter by adding one reference. 43 | * 44 | * @return The number of references. 45 | */ 46 | AmInt32 Increment(); 47 | 48 | /** 49 | * @brief Updates the counter by removing one reference. 50 | * 51 | * @return The number of references. 52 | */ 53 | AmInt32 Decrement(); 54 | 55 | /** 56 | * @brief Gets the current number of references. 57 | * 58 | * @return The current number of references. 59 | */ 60 | [[nodiscard]] AM_INLINE AmInt32 GetCount() const 61 | { 62 | return _count; 63 | } 64 | 65 | private: 66 | std::atomic_int32_t _count; 67 | }; 68 | } // namespace SparkyStudios::Audio::Amplitude 69 | 70 | #endif // _AM_CORE_REF_COUNTER_H 71 | -------------------------------------------------------------------------------- /include/SparkyStudios/Audio/Amplitude/Core/Version.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #ifndef _AM_CORE_VERSION_H 18 | #define _AM_CORE_VERSION_H 19 | 20 | #include 21 | 22 | /** 23 | * @brief Gets the current Amplitude SDK version. 24 | * 25 | * @ingroup core 26 | */ 27 | #define amVersion SparkyStudios::Audio::Amplitude::GetVersion() 28 | 29 | #define AM_VERSION_MAJOR 1 30 | #define AM_VERSION_MINOR 0 31 | #define AM_VERSION_PATCH 0 32 | 33 | namespace SparkyStudios::Audio::Amplitude 34 | { 35 | /** 36 | * @brief A structure containing the version number of the library. 37 | * 38 | * @ingroup core 39 | */ 40 | struct AmVersion 41 | { 42 | /** 43 | * @brief Version number, updated only on major releases. 44 | */ 45 | AmUInt8 major; 46 | 47 | /** 48 | * @brief Version number, updated only on point releases. 49 | */ 50 | AmUInt8 minor; 51 | 52 | /** 53 | * @brief Version number, updated for tiny releases (ex: Bug fixes). 54 | */ 55 | AmUInt8 revision; 56 | 57 | /** 58 | * @brief Text string containing the name and version of the library. 59 | */ 60 | AmString text; 61 | }; 62 | 63 | /** 64 | * @brief Returns the version. 65 | * 66 | * @return The current SDK version. 67 | * 68 | * @ingroup core 69 | */ 70 | AM_API_PUBLIC const AmVersion& GetVersion(); 71 | } // namespace SparkyStudios::Audio::Amplitude 72 | 73 | #endif // _AM_CORE_VERSION_H 74 | -------------------------------------------------------------------------------- /include/SparkyStudios/Audio/Amplitude/IO/Android/LogcatLogger.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #if AM_PLATFORM_ANDROID 18 | 19 | #ifndef _AM_IO_ANDROID_LOGCAT_LOGGER_H 20 | #define _AM_IO_ANDROID_LOGCAT_LOGGER_H 21 | 22 | #include 23 | 24 | namespace SparkyStudios::Audio::Amplitude 25 | { 26 | /** 27 | * @brief A logger that writes to Android's logcat. 28 | * 29 | * This class logs output in the Android's logcat using a custom tag. 30 | * 31 | * @ingroup io 32 | */ 33 | class AM_API_PUBLIC LogcatLogger final : public Logger 34 | { 35 | public: 36 | /** 37 | * @brief Constructs a new logcat logger. 38 | * 39 | * @param[in] logTag A custom tag to use when logging in logcat. Defaults to @b AM. 40 | */ 41 | explicit LogcatLogger(const char* logTag = "AM"); 42 | 43 | /** 44 | * @brief Destructor. 45 | */ 46 | ~LogcatLogger() override = default; 47 | 48 | protected: 49 | /** 50 | * @inherit 51 | */ 52 | void Log(eLogMessageLevel level, const char* file, int line, const AmString& message) override; 53 | 54 | private: 55 | const char* m_logTag; 56 | }; 57 | } // namespace SparkyStudios::Audio::Amplitude 58 | 59 | #endif // _AM_IO_ANDROID_LOGCAT_LOGGER_H 60 | 61 | #endif // AM_PLATFORM_ANDROID -------------------------------------------------------------------------------- /include/SparkyStudios/Audio/Amplitude/IO/ConsoleLogger.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #ifndef _AM_IO_CONSOLE_LOGGER_H 18 | #define _AM_IO_CONSOLE_LOGGER_H 19 | 20 | #include 21 | 22 | namespace SparkyStudios::Audio::Amplitude 23 | { 24 | /** 25 | * @brief The console logger class. 26 | * 27 | * This class logs messages to the console or terminal. 28 | * 29 | * @ingroup io 30 | */ 31 | class AM_API_PUBLIC ConsoleLogger final : public Logger 32 | { 33 | public: 34 | /** 35 | * @brief Constructs a new console logger. 36 | * 37 | * @param[in] displayFileAndLine Whether to display the file and line number in the log messages. 38 | */ 39 | explicit ConsoleLogger(bool displayFileAndLine = true); 40 | 41 | /** 42 | * @brief Destructor. 43 | */ 44 | ~ConsoleLogger() override = default; 45 | 46 | protected: 47 | /** 48 | * @inherit 49 | */ 50 | void Log(eLogMessageLevel level, const char* file, int line, const AmString& message) override; 51 | 52 | private: 53 | bool m_displayFileAndLine = true; 54 | }; 55 | } // namespace SparkyStudios::Audio::Amplitude 56 | #endif // _AM_IO_CONSOLE_LOGGER_H 57 | -------------------------------------------------------------------------------- /include/SparkyStudios/Audio/Amplitude/IO/Resource.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #ifndef _AM_IO_RESOURCE_H 18 | #define _AM_IO_RESOURCE_H 19 | 20 | #include 21 | 22 | namespace SparkyStudios::Audio::Amplitude 23 | { 24 | 25 | /** 26 | * @brief An Amplitude resource in a `FileSystem`. 27 | * 28 | * This base class represents a resource (sound files, assets, etc.) in a `FileSystem`. 29 | * 30 | * @ingroup io 31 | */ 32 | class AM_API_PUBLIC Resource 33 | { 34 | public: 35 | /** 36 | * @brief Default destructor. 37 | */ 38 | virtual ~Resource() = default; 39 | 40 | /** 41 | * @brief Gets the path to the resource. 42 | */ 43 | [[nodiscard]] virtual const AmOsString& GetPath() const = 0; 44 | 45 | /** 46 | * @brief Loads the resource from the given FileSystem. 47 | */ 48 | virtual void Load(std::shared_ptr loader) = 0; 49 | }; 50 | } // namespace SparkyStudios::Audio::Amplitude 51 | 52 | #endif // _AM_IO_RESOURCE_H -------------------------------------------------------------------------------- /sample_project/.amignore: -------------------------------------------------------------------------------- 1 | # Test files 2 | **/tests.*.json 3 | -------------------------------------------------------------------------------- /sample_project/.amproject: -------------------------------------------------------------------------------- 1 | {"name": "sample_project", "default_configuration": "pc.config.amconfig", "sources_dir": "", "data_dir": "../assets/data", "build_dir": "../am_build"} -------------------------------------------------------------------------------- /sample_project/attenuators/impact.json: -------------------------------------------------------------------------------- 1 | {"id":1,"name":"impact","max_distance":1280,"shape":{"zone_type":"Sphere","zone":{"inner":{"radius":964},"outer":{"radius":1024}},"max_attenuation_factor":0.125},"gain_curve":{"parts":[{"start":{"x":0,"y":1},"end":{"x":50,"y":0},"fader":"Linear"}]},"air_absorption":{"enabled":false,"coefficients":[]}} -------------------------------------------------------------------------------- /sample_project/attenuators/pipe.json: -------------------------------------------------------------------------------- 1 | {"id":3,"name":"pipe","max_distance":20,"shape":{"zone_type":"Capsule","zone":{"inner":{"radius":5,"half_height":15},"outer":{"radius":10,"half_height":20}},"max_attenuation_factor":0.125},"gain_curve":{"parts":[{"start":{"x":0,"y":1},"end":{"x":20,"y":0},"fader":"Exponential"}]},"air_absorption":{"enabled":false,"coefficients":[]}} -------------------------------------------------------------------------------- /sample_project/attenuators/room.json: -------------------------------------------------------------------------------- 1 | {"id":2,"name":"room","max_distance":40,"shape":{"zone_type":"Box","zone":{"inner":{"half_width":15,"half_height":5,"half_depth":5},"outer":{"half_width":20,"half_height":35,"half_depth":10}},"max_attenuation_factor":0.125},"gain_curve":{"parts":[{"start":{"x":0,"y":1},"end":{"x":40,"y":0},"fader":"Exponential"}]},"air_absorption":{"enabled":false,"coefficients":[]}} -------------------------------------------------------------------------------- /sample_project/collections/grass_footsteps.json: -------------------------------------------------------------------------------- 1 | {"id":1003,"name":"grass_footsteps","effect":0,"gain":{"kind":"Static","value":0.0625},"pitch":{"kind":"Static","value":1},"bus":2,"priority":{"kind":"Static","value":1},"spatialization":1,"attenuation":1,"scope":1,"fader":"Linear","sounds_type":["Random","Random","Random","Random","Random","Random","Random"],"sounds":[{"sound":201,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"weight":1},{"sound":202,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"weight":1},{"sound":203,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"weight":1},{"sound":204,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"weight":1},{"sound":205,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"weight":1},{"sound":206,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"weight":1},{"sound":207,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"weight":1}],"play_mode":0,"scheduler":{"mode":0,"config_type":"Random","config":{"avoid_repeat":true,"repeat_count":4}}} -------------------------------------------------------------------------------- /sample_project/collections/metal_footsteps.json: -------------------------------------------------------------------------------- 1 | {"id":1005,"name":"metal_footsteps","effect":0,"gain":{"kind":"Static","value":0.0625},"pitch":{"kind":"Static","value":1},"bus":2,"priority":{"kind":"Static","value":1},"spatialization":1,"attenuation":1,"scope":1,"fader":"Linear","sounds_type":["Random","Random"],"sounds":[{"sound":210,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"weight":1},{"sound":211,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"weight":1}],"play_mode":0,"scheduler":{"mode":0,"config_type":"Random","config":{"avoid_repeat":true,"repeat_count":1}}} -------------------------------------------------------------------------------- /sample_project/collections/snow_footsteps.json: -------------------------------------------------------------------------------- 1 | {"id":1004,"name":"snow_footsteps","effect":0,"gain":{"kind":"Static","value":0.0625},"pitch":{"kind":"Static","value":1},"bus":2,"priority":{"kind":"Static","value":1},"spatialization":1,"attenuation":1,"scope":1,"fader":"Linear","sounds_type":["Random","Random"],"sounds":[{"sound":208,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"weight":1},{"sound":209,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"weight":1}],"play_mode":0,"scheduler":{"mode":0,"config_type":"Random","config":{"avoid_repeat":true,"repeat_count":1}}} -------------------------------------------------------------------------------- /sample_project/collections/test_collection.json: -------------------------------------------------------------------------------- 1 | {"id":1999,"name":"test_collection","effect":0,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"bus":2,"priority":{"kind":"Static","value":1},"spatialization":0,"attenuation":0,"scope":0,"fader":"Linear","sounds_type":["Random","Random","Random"],"sounds":[{"sound":9991,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"weight":1},{"sound":9992,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"weight":1},{"sound":9993,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"weight":1}],"play_mode":1,"scheduler":{"mode":1,"config_type":"Sequence","config":{"end_behavior":1}}} -------------------------------------------------------------------------------- /sample_project/collections/throw_collection_1.json: -------------------------------------------------------------------------------- 1 | {"id":1001,"name":"throw_collection_1","effect":0,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"bus":2,"priority":{"kind":"Static","value":1},"spatialization":1,"attenuation":1,"scope":0,"fader":"Linear","sounds_type":["Random","Random","Random","Random","Random","Random","Random","Random"],"sounds":[{"sound":1,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"weight":1},{"sound":2,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"weight":1},{"sound":3,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"weight":1},{"sound":4,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"weight":1},{"sound":5,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"weight":1},{"sound":6,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"weight":1},{"sound":7,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"weight":1},{"sound":8,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"weight":1}],"play_mode":1,"scheduler":{"mode":1,"config_type":"Sequence","config":{"end_behavior":1}}} -------------------------------------------------------------------------------- /sample_project/collections/throw_collection_2.json: -------------------------------------------------------------------------------- 1 | {"id":1002,"name":"throw_collection_2","effect":0,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"bus":2,"priority":{"kind":"Static","value":1},"spatialization":1,"attenuation":1,"scope":0,"fader":"Linear","sounds_type":["Random","Random","Random","Random","Random","Random","Random","Random"],"sounds":[{"sound":1,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"weight":1},{"sound":2,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"weight":1},{"sound":3,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"weight":1},{"sound":4,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"weight":1},{"sound":5,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"weight":1},{"sound":6,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"weight":1},{"sound":7,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"weight":1},{"sound":8,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"weight":1}],"play_mode":0,"scheduler":{"mode":0,"config_type":"Random","config":{"avoid_repeat":true,"repeat_count":5}}} -------------------------------------------------------------------------------- /sample_project/effects/bassboost.json: -------------------------------------------------------------------------------- 1 | {"id":5,"name":"bassboost","effect":"BassBoost","parameters":[{"kind":"Static","value":1},{"kind":"Static","value":11}]} -------------------------------------------------------------------------------- /sample_project/effects/delay.json: -------------------------------------------------------------------------------- 1 | {"id":7,"name":"delay","effect":"Delay","parameters":[{"kind":"Static","value":1},{"kind":"Static","value":5},{"kind":"Static","value":1},{"kind":"Static","value":0}]} -------------------------------------------------------------------------------- /sample_project/effects/equalizer.json: -------------------------------------------------------------------------------- 1 | {"id":8,"name":"equalizer","effect":"Equalizer","parameters":[{"kind":"Static","value":1},{"kind":"Static","value":3},{"kind":"Static","value":4},{"kind":"Static","value":0},{"kind":"Static","value":1},{"kind":"Static","value":0.5},{"kind":"Static","value":0},{"kind":"Static","value":2},{"kind":"Static","value":4}]} -------------------------------------------------------------------------------- /sample_project/effects/flanger.json: -------------------------------------------------------------------------------- 1 | {"id":2,"name":"flanger","effect":"Flanger","parameters":[{"kind":"Static","value":1},{"kind":"Static","value":0.05},{"kind":"Static","value":20}]} -------------------------------------------------------------------------------- /sample_project/effects/lpf.json: -------------------------------------------------------------------------------- 1 | {"id":6,"name":"lpf","effect":"BiquadResonant","parameters":[{"kind":"Static","value":1},{"kind":"Static","value":0},{"kind":"Static","value":2400},{"kind":"Static","value":1},{"kind":"Static","value":0}]} -------------------------------------------------------------------------------- /sample_project/effects/robotize.json: -------------------------------------------------------------------------------- 1 | {"id":3,"name":"robotize","effect":"Robotize","parameters":[{"kind":"Static","value":1},{"kind":"Static","value":80},{"kind":"Static","value":6}]} -------------------------------------------------------------------------------- /sample_project/events/mute_bg_bus.json: -------------------------------------------------------------------------------- 1 | {"id":5,"name":"mute_bg_bus","run_mode":0,"actions":[{"type":6,"active":true,"targets":[7678456242523],"scope":1}]} -------------------------------------------------------------------------------- /sample_project/events/play_throw.json: -------------------------------------------------------------------------------- 1 | {"id":123456787654,"name":"play_throw","run_mode":0,"actions":[{"type":1,"active":true,"targets":[1002],"scope":0}]} -------------------------------------------------------------------------------- /sample_project/events/player_footstep.json: -------------------------------------------------------------------------------- 1 | {"id":876,"name":"player_footstep","run_mode":0,"actions":[{"type":1,"active":true,"targets":[200],"scope":1}]} -------------------------------------------------------------------------------- /sample_project/events/stop_throw.json: -------------------------------------------------------------------------------- 1 | {"id":7807787654,"name":"stop_throw","run_mode":0,"actions":[{"type":4,"active":true,"targets":[1001],"scope":1}]} -------------------------------------------------------------------------------- /sample_project/pc.buses.json: -------------------------------------------------------------------------------- 1 | {"buses":[{"id":1,"name":"master","gain":1,"child_buses":[2,7678456242523],"duck_buses":[],"fader":"Linear"},{"id":2,"name":"effects","gain":1,"child_buses":[],"duck_buses":[{"id":7678456242523,"target_gain":0.5,"fade_in":{"duration":3,"fader":"SCurveSmooth"},"fade_out":{"duration":3,"fader":"Linear"}}],"fader":"Linear"},{"id":7678456242523,"name":"environment","gain":0.25,"child_buses":[],"duck_buses":[],"fader":"Linear"}]} -------------------------------------------------------------------------------- /sample_project/pc.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "driver": "miniaudio", 3 | "output": { 4 | "frequency": 48000, 5 | "buffer_size": 4096, 6 | "format": "Float32" 7 | }, 8 | "mixer": { 9 | "panning_mode": "BinauralHighQuality", 10 | "active_channels": 50, 11 | "virtual_channels": 100, 12 | "pipeline": "default.ampipeline" 13 | }, 14 | "hrtf": { 15 | "amir_file": "data/sadie_h12.amir", 16 | "hrir_sampling": "Bilinear" 17 | }, 18 | "game": { 19 | "listener_fetch_mode": "Nearest", 20 | "track_environments": true, 21 | "listeners": 100, 22 | "entities": 4096, 23 | "environments": 512, 24 | "rooms": 1024, 25 | "doppler_factor": 1.0, 26 | "sound_speed": 343, 27 | "obstruction": { 28 | "lpf_curve": { 29 | "parts": [ 30 | { 31 | "start": { 32 | "x": 0, 33 | "y": 0 34 | }, 35 | "end": { 36 | "x": 1, 37 | "y": 1 38 | }, 39 | "fader": "Linear" 40 | } 41 | ] 42 | }, 43 | "gain_curve": { 44 | "parts": [ 45 | { 46 | "start": { 47 | "x": 0, 48 | "y": 1 49 | }, 50 | "end": { 51 | "x": 1, 52 | "y": 1 53 | }, 54 | "fader": "Linear" 55 | } 56 | ] 57 | } 58 | }, 59 | "occlusion": { 60 | "lpf_curve": { 61 | "parts": [ 62 | { 63 | "start": { 64 | "x": 0, 65 | "y": 0 66 | }, 67 | "end": { 68 | "x": 1, 69 | "y": 1 70 | }, 71 | "fader": "Linear" 72 | } 73 | ] 74 | }, 75 | "gain_curve": { 76 | "parts": [ 77 | { 78 | "start": { 79 | "x": 0, 80 | "y": 1 81 | }, 82 | "end": { 83 | "x": 1, 84 | "y": 0 85 | }, 86 | "fader": "Linear" 87 | } 88 | ] 89 | } 90 | } 91 | }, 92 | "buses_file": "pc.buses.ambus" 93 | } -------------------------------------------------------------------------------- /sample_project/pipelines/default.json: -------------------------------------------------------------------------------- 1 | {"id":1,"name":"default","nodes":[{"id":1,"name":"Input","consume":[]},{"id":2,"name":"Attenuation","consume":[1]},{"id":3,"name":"Occlusion","consume":[2]},{"id":4,"name":"StereoPanning","consume":[17]},{"id":5,"name":"AmbisonicPanning","consume":[3]},{"id":6,"name":"NearFieldEffect","consume":[3]},{"id":7,"name":"AmbisonicMixer","consume":[18]},{"id":8,"name":"StereoMixer","consume":[4,6,10,12,14]},{"id":10,"name":"AmbisonicBinauralDecoder","consume":[7]},{"id":11,"name":"Reflections","consume":[1]},{"id":12,"name":"AmbisonicBinauralDecoder","consume":[11]},{"id":13,"name":"Clip","consume":[8]},{"id":14,"name":"Reverb","consume":[1]},{"id":15,"name":"Obstruction","consume":[3]},{"id":16,"name":"EnvironmentEffect","consume":[3]},{"id":17,"name":"StereoMixer","consume":[15,16]},{"id":18,"name":"AmbisonicRotator","consume":[5]},{"id":9,"name":"Output","consume":[13]}]} -------------------------------------------------------------------------------- /sample_project/pipelines/default.json.meta: -------------------------------------------------------------------------------- 1 | {"positions":[[9,0.015671,0.004593],[18,0.009171,0.00087],[17,0.008926,0.002213],[16,0.006287,0.00148],[15,0.006012,0.002228],[14,0.003128,0.003616],[13,0.015457,0.003815],[12,0.006622,0.004532],[11,0.003296,0.004532],[10,0.014481,0.001587],[8,0.013824,0.003784],[7,0.011536,0.001144],[6,0.006104,0.003006],[5,0.006302,0.000671],[4,0.01152,0.002563],[3,0.003326,0.001694],[2,0.001022,0.002335],[1,0.000824,0.004196]],"canvas_offset":[0,0]} -------------------------------------------------------------------------------- /sample_project/pipelines/stereo.json: -------------------------------------------------------------------------------- 1 | {"id":3,"name":"stereo","nodes":[{"id":1,"name":"Input","consume":[]},{"id":2,"name":"Attenuation","consume":[1]},{"id":3,"name":"Occlusion","consume":[2]},{"id":4,"name":"StereoPanning","consume":[3]},{"id":6,"name":"NearFieldEffect","consume":[3]},{"id":8,"name":"StereoMixer","consume":[4,6]},{"id":9,"name":"Output","consume":[8]}]} -------------------------------------------------------------------------------- /sample_project/pipelines/stereo.json.meta: -------------------------------------------------------------------------------- 1 | {"positions":[[9,0.015213,0.004471],[8,0.012604,0.003891],[6,0.009415,0.004471],[4,0.009293,0.00325],[3,0.006439,0.003922],[2,0.004028,0.003555],[1,0.001511,0.003143]],"canvas_offset":[0,0]} -------------------------------------------------------------------------------- /sample_project/pipelines/tests.double_consume.json: -------------------------------------------------------------------------------- 1 | {"id":98,"name":"tests.double_consume","nodes":[{"id":1,"name":"Input","consume":[]},{"id":8,"name":"StereoPanning","consume":[1]},{"id":2,"name":"StereoMixer","consume":[8,8]},{"id":9,"name":"Output","consume":[2]}]} -------------------------------------------------------------------------------- /sample_project/pipelines/tests.invalid.invalid_consumer_node.json: -------------------------------------------------------------------------------- 1 | {"id":99,"name":"tests.invalid_consumer_node","nodes":[{"id":1,"name":"Input","consume":[]},{"id":8,"name":"StereoPanning","consume":[3]},{"id":9,"name":"Output","consume":[8]},{"id":3,"name":"InvalidConsumerNode","consume":[1]}]} -------------------------------------------------------------------------------- /sample_project/pipelines/tests.invalid.invalid_producers_count.json: -------------------------------------------------------------------------------- 1 | {"id":93,"name":"tests.invalid_producers_count","nodes":[{"id":1,"name":"Input","consume":[]},{"id":2,"name":"Attenuation","consume":[1]},{"id":8,"name":"StereoPanning","consume":[1,2]},{"id":9,"name":"Output","consume":[8]}]} -------------------------------------------------------------------------------- /sample_project/pipelines/tests.invalid.missing_input.json: -------------------------------------------------------------------------------- 1 | {"id":90,"name":"tests.missing_input","nodes":[{"id":8,"name":"StereoPanning","consume":[]},{"id":9,"name":"Output","consume":[8]}]} -------------------------------------------------------------------------------- /sample_project/pipelines/tests.invalid.missing_output.json: -------------------------------------------------------------------------------- 1 | {"id":91,"name":"tests.missing_output","nodes":[{"id":1,"name":"Input","consume":[]},{"id":8,"name":"StereoPanning","consume":[1]}]} -------------------------------------------------------------------------------- /sample_project/pipelines/tests.invalid.missing_producers.json: -------------------------------------------------------------------------------- 1 | {"id":92,"name":"tests.missing_producers","nodes":[{"id":1,"name":"Input","consume":[]},{"id":8,"name":"StereoPanning","consume":[]},{"id":9,"name":"Output","consume":[8]}]} -------------------------------------------------------------------------------- /sample_project/pipelines/tests.invalid.multiple_input.json: -------------------------------------------------------------------------------- 1 | {"id":94,"name":"tests.multiple_input","nodes":[{"id":1,"name":"Input","consume":[]},{"id":2,"name":"Input","consume":[]},{"id":8,"name":"StereoPanning","consume":[1]},{"id":9,"name":"Output","consume":[2]}]} -------------------------------------------------------------------------------- /sample_project/pipelines/tests.invalid.multiple_output.json: -------------------------------------------------------------------------------- 1 | {"id":95,"name":"tests.multiple_output","nodes":[{"id":1,"name":"Input","consume":[]},{"id":8,"name":"StereoPanning","consume":[1]},{"id":9,"name":"Output","consume":[8]},{"id":3,"name":"Output","consume":[1]}]} -------------------------------------------------------------------------------- /sample_project/pipelines/tests.invalid.self_consume.json: -------------------------------------------------------------------------------- 1 | {"id":97,"name":"tests.self_consume","nodes":[{"id":1,"name":"Input","consume":[]},{"id":9,"name":"Output","consume":[9]}]} -------------------------------------------------------------------------------- /sample_project/pipelines/tests.invalid.unknown_node.json: -------------------------------------------------------------------------------- 1 | {"id":96,"name":"tests.unknown_node","nodes":[{"id":1,"name":"Input","consume":[]},{"id":8,"name":"StereoPanning","consume":[3]},{"id":9,"name":"Output","consume":[8]},{"id":3,"name":"DoSomethingWeird","consume":[1]}]} -------------------------------------------------------------------------------- /sample_project/rtpc/rtpc_player_height.json: -------------------------------------------------------------------------------- 1 | {"id":1,"name":"rtpc_player_height","min_value":0,"max_value":100,"default_value":0,"fade_settings":{"enabled":false,"fade_attack":{"duration":1,"fader":"Linear"},"fade_release":{"duration":1,"fader":"Linear"}}} -------------------------------------------------------------------------------- /sample_project/rtpc/wind_force.json: -------------------------------------------------------------------------------- 1 | {"id":2,"name":"wind_force","min_value":0,"max_value":343000,"default_value":0,"fade_settings":{"enabled":true,"fade_attack":{"duration":1000,"fader":"Linear"},"fade_release":{"duration":500,"fader":"Linear"}}} -------------------------------------------------------------------------------- /sample_project/soundbanks/init.json: -------------------------------------------------------------------------------- 1 | {"id":1,"name":"init","switch_containers":["footsteps.amswitchcontainer"],"collections":["grass_footsteps.amcollection","metal_footsteps.amcollection","snow_footsteps.amcollection","test_collection.amcollection","throw_collection_1.amcollection","throw_collection_2.amcollection"],"sounds":["background/AMBForst_Forest_ID_0100_BSB.wav.amsound","footsteps/grass/a.mp3.amsound","footsteps/grass/b.mp3.amsound","footsteps/grass/c.mp3.amsound","footsteps/grass/d.mp3.amsound","footsteps/grass/e.mp3.amsound","footsteps/grass/f.mp3.amsound","footsteps/grass/g.mp3.amsound","footsteps/metal/a.mp3.amsound","footsteps/metal/b.mp3.amsound","footsteps/snow/a.mp3.amsound","footsteps/snow/b.mp3.amsound","music/symphony.ogg.amsound","tests/test_sound_01.amsound","tests/test_sound_02.amsound","tests/test_sound_03.amsound","throw_01.ogg.amsound","throw_02.ogg.amsound","throw_03.ogg.amsound","throw_04.ogg.amsound","throw_05.ogg.amsound","throw_06.ogg.amsound","throw_07.ogg.amsound","throw_08.ogg.amsound"],"events":["mute_bg_bus.amevent","play_throw.amevent","player_footstep.amevent","stop_throw.amevent"],"attenuators":["impact.amattenuation","pipe.amattenuation","room.amattenuation"],"switches":["env.amswitch","surface_type.amswitch"],"rtpc":["rtpc_player_height.amrtpc","wind_force.amrtpc"],"effects":["bassboost.amfx","delay.amfx","equalizer.amfx","flanger.amfx","lpf.amfx","robotize.amfx"]} -------------------------------------------------------------------------------- /sample_project/soundbanks/sample_01.json: -------------------------------------------------------------------------------- 1 | {"id":5618439413396,"name":"sample_01","switch_containers":["footsteps.amswitchcontainer"],"collections":["grass_footsteps.amcollection","metal_footsteps.amcollection","snow_footsteps.amcollection","throw_collection_1.amcollection","throw_collection_2.amcollection"],"sounds":["background/AMBForst_Forest_ID_0100_BSB.wav.amsound","footsteps/snow/a.mp3.amsound","footsteps/snow/b.mp3.amsound","footsteps/metal/a.mp3.amsound","footsteps/metal/b.mp3.amsound","footsteps/grass/a.mp3.amsound","footsteps/grass/b.mp3.amsound","footsteps/grass/c.mp3.amsound","footsteps/grass/d.mp3.amsound","footsteps/grass/e.mp3.amsound","footsteps/grass/f.mp3.amsound","footsteps/grass/g.mp3.amsound","music/symphony.ogg.amsound","throw_01.ogg.amsound","throw_02.ogg.amsound","throw_03.ogg.amsound","throw_04.ogg.amsound","throw_05.ogg.amsound","throw_06.ogg.amsound","throw_07.ogg.amsound","throw_08.ogg.amsound"],"events":["play_throw.amevent","stop_throw.amevent"],"attenuators":["impact.amattenuation","room.amattenuation","pipe.amattenuation"],"switches":["surface_type.amswitch"],"rtpc":[],"effects":["flanger.amfx","robotize.amfx","lpf.amfx","bassboost.amfx","delay.amfx"]} -------------------------------------------------------------------------------- /sample_project/soundbanks/sample_02.json: -------------------------------------------------------------------------------- 1 | {"id":35069490657978,"name":"sample_02","switch_containers":[],"collections":["throw_collection_1.amcollection"],"sounds":["music/symphony.ogg.amsound","throw_01.ogg.amsound","throw_02.ogg.amsound","throw_03.ogg.amsound","throw_04.ogg.amsound","throw_05.ogg.amsound","throw_06.ogg.amsound","throw_07.ogg.amsound","throw_08.ogg.amsound"],"events":[],"attenuators":["impact.amattenuation"],"switches":[],"rtpc":[],"effects":["bassboost.amfx","equalizer.amfx","lpf.amfx","robotize.amfx","delay.amfx","flanger.amfx"]} -------------------------------------------------------------------------------- /sample_project/soundbanks/tests.init.json: -------------------------------------------------------------------------------- 1 | {"id":10,"name":"tests.init","switch_containers":["footsteps.amswitchcontainer"],"collections":["grass_footsteps.amcollection","metal_footsteps.amcollection","snow_footsteps.amcollection","test_collection.amcollection","throw_collection_1.amcollection","throw_collection_2.amcollection"],"sounds":["background/AMBForst_Forest_ID_0100_BSB.wav.amsound","footsteps/grass/a.mp3.amsound","footsteps/grass/b.mp3.amsound","footsteps/grass/c.mp3.amsound","footsteps/grass/d.mp3.amsound","footsteps/grass/e.mp3.amsound","footsteps/grass/f.mp3.amsound","footsteps/grass/g.mp3.amsound","footsteps/metal/a.mp3.amsound","footsteps/metal/b.mp3.amsound","footsteps/snow/a.mp3.amsound","footsteps/snow/b.mp3.amsound","music/symphony.ogg.amsound","tests/test_sound_01.amsound","tests/test_sound_02.amsound","tests/test_sound_03.amsound","throw_01.ogg.amsound","throw_02.ogg.amsound","throw_03.ogg.amsound","throw_04.ogg.amsound","throw_05.ogg.amsound","throw_06.ogg.amsound","throw_07.ogg.amsound","throw_08.ogg.amsound"],"events":["mute_bg_bus.amevent","play_throw.amevent","player_footstep.amevent","stop_throw.amevent"],"attenuators":["impact.amattenuation","pipe.amattenuation","room.amattenuation"],"switches":["env.amswitch","surface_type.amswitch"],"rtpc":["rtpc_player_height.amrtpc","wind_force.amrtpc"],"effects":["bassboost.amfx","delay.amfx","flanger.amfx","lpf.amfx","robotize.amfx"]} -------------------------------------------------------------------------------- /sample_project/sounds/background/AMBForst_Forest_ID_0100_BSB.wav.json: -------------------------------------------------------------------------------- 1 | {"id":100,"name":"AMB_Forest","effect":0,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"bus":7678456242523,"priority":{"kind":"Static","value":1},"spatialization":0,"attenuation":0,"scope":0,"fader":"SCurveSmooth","stream":false,"loop":{"enabled":true,"loop_count":0},"near_field_gain":{"kind":"Static","value":0},"path":"background/AMBForst_Forest_ID_0100_BSB.wav"} -------------------------------------------------------------------------------- /sample_project/sounds/footsteps/grass/a.mp3.json: -------------------------------------------------------------------------------- 1 | {"id":201,"name":"grass_a","effect":0,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"bus":2,"priority":{"kind":"Static","value":1},"spatialization":1,"attenuation":1,"scope":0,"fader":"Linear","stream":false,"loop":{"enabled":false,"loop_count":0},"near_field_gain":{"kind":"Static","value":0},"path":"footsteps/grass/a.mp3"} -------------------------------------------------------------------------------- /sample_project/sounds/footsteps/grass/b.mp3.json: -------------------------------------------------------------------------------- 1 | {"id":202,"name":"grass_b","effect":0,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"bus":2,"priority":{"kind":"Static","value":1},"spatialization":1,"attenuation":1,"scope":0,"fader":"Linear","stream":false,"loop":{"enabled":false,"loop_count":0},"near_field_gain":{"kind":"Static","value":0},"path":"footsteps/grass/b.mp3"} -------------------------------------------------------------------------------- /sample_project/sounds/footsteps/grass/c.mp3.json: -------------------------------------------------------------------------------- 1 | {"id":203,"name":"grass_c","effect":0,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"bus":2,"priority":{"kind":"Static","value":1},"spatialization":1,"attenuation":1,"scope":0,"fader":"Linear","stream":false,"loop":{"enabled":false,"loop_count":0},"near_field_gain":{"kind":"Static","value":0},"path":"footsteps/grass/c.mp3"} -------------------------------------------------------------------------------- /sample_project/sounds/footsteps/grass/d.mp3.json: -------------------------------------------------------------------------------- 1 | {"id":204,"name":"grass_d","effect":0,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"bus":2,"priority":{"kind":"Static","value":1},"spatialization":1,"attenuation":1,"scope":0,"fader":"Linear","stream":false,"loop":{"enabled":false,"loop_count":0},"near_field_gain":{"kind":"Static","value":0},"path":"footsteps/grass/d.mp3"} -------------------------------------------------------------------------------- /sample_project/sounds/footsteps/grass/e.mp3.json: -------------------------------------------------------------------------------- 1 | {"id":205,"name":"grass_e","effect":0,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"bus":2,"priority":{"kind":"Static","value":1},"spatialization":1,"attenuation":1,"scope":0,"fader":"Linear","stream":false,"loop":{"enabled":false,"loop_count":0},"near_field_gain":{"kind":"Static","value":0},"path":"footsteps/grass/e.mp3"} -------------------------------------------------------------------------------- /sample_project/sounds/footsteps/grass/f.mp3.json: -------------------------------------------------------------------------------- 1 | {"id":206,"name":"grass_f","effect":0,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"bus":2,"priority":{"kind":"Static","value":1},"spatialization":1,"attenuation":1,"scope":0,"fader":"Linear","stream":false,"loop":{"enabled":false,"loop_count":0},"near_field_gain":{"kind":"Static","value":0},"path":"footsteps/grass/f.mp3"} -------------------------------------------------------------------------------- /sample_project/sounds/footsteps/grass/g.mp3.json: -------------------------------------------------------------------------------- 1 | {"id":207,"name":"grass_g","effect":0,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"bus":2,"priority":{"kind":"Static","value":1},"spatialization":1,"attenuation":1,"scope":0,"fader":"Linear","stream":false,"loop":{"enabled":false,"loop_count":0},"near_field_gain":{"kind":"Static","value":0},"path":"footsteps/grass/a.mp3"} -------------------------------------------------------------------------------- /sample_project/sounds/footsteps/metal/a.mp3.json: -------------------------------------------------------------------------------- 1 | {"id":210,"name":"metal_a","effect":0,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"bus":2,"priority":{"kind":"Static","value":1},"spatialization":1,"attenuation":1,"scope":0,"fader":"Linear","stream":false,"loop":{"enabled":false,"loop_count":0},"near_field_gain":{"kind":"Static","value":0},"path":"footsteps/metal/a.mp3"} -------------------------------------------------------------------------------- /sample_project/sounds/footsteps/metal/b.mp3.json: -------------------------------------------------------------------------------- 1 | {"id":211,"name":"metal_b","effect":0,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"bus":2,"priority":{"kind":"Static","value":1},"spatialization":1,"attenuation":1,"scope":0,"fader":"Linear","stream":false,"loop":{"enabled":false,"loop_count":0},"near_field_gain":{"kind":"Static","value":0},"path":"footsteps/metal/b.mp3"} -------------------------------------------------------------------------------- /sample_project/sounds/footsteps/snow/a.mp3.json: -------------------------------------------------------------------------------- 1 | {"id":208,"name":"snow_a","effect":0,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"bus":2,"priority":{"kind":"Static","value":1},"spatialization":1,"attenuation":1,"scope":0,"fader":"Linear","stream":false,"loop":{"enabled":false,"loop_count":0},"near_field_gain":{"kind":"Static","value":0},"path":"footsteps/snow/a.mp3"} -------------------------------------------------------------------------------- /sample_project/sounds/footsteps/snow/b.mp3.json: -------------------------------------------------------------------------------- 1 | {"id":209,"name":"snow_b","effect":0,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"bus":2,"priority":{"kind":"Static","value":1},"spatialization":1,"attenuation":1,"scope":0,"fader":"Linear","stream":false,"loop":{"enabled":false,"loop_count":0},"near_field_gain":{"kind":"Static","value":0},"path":"footsteps/snow/b.mp3"} -------------------------------------------------------------------------------- /sample_project/sounds/music/symphony.ogg.json: -------------------------------------------------------------------------------- 1 | {"id":101,"name":"symphony","effect":0,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"bus":1,"priority":{"kind":"Static","value":1},"spatialization":0,"attenuation":0,"scope":0,"fader":"Linear","stream":false,"loop":{"enabled":true,"loop_count":0},"near_field_gain":{"kind":"Static","value":0},"path":"music/symphony.ogg"} -------------------------------------------------------------------------------- /sample_project/sounds/tests/test_sound_01.json: -------------------------------------------------------------------------------- 1 | {"id":9991,"name":"test_sound_01","effect":0,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"bus":1,"priority":{"kind":"Static","value":1},"spatialization":3,"attenuation":0,"scope":0,"fader":"Linear","stream":false,"loop":{"enabled":false,"loop_count":5},"near_field_gain":{"kind":"Static","value":0},"path":"tests/test_sound_01.wav"} -------------------------------------------------------------------------------- /sample_project/sounds/tests/test_sound_02.json: -------------------------------------------------------------------------------- 1 | {"id":9992,"name":"test_sound_02","effect":0,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"bus":1,"priority":{"kind":"Static","value":1},"spatialization":0,"attenuation":0,"scope":0,"fader":"Linear","stream":true,"loop":{"enabled":false,"loop_count":5},"near_field_gain":{"kind":"Static","value":0},"path":"tests/test_sound_02.wav"} -------------------------------------------------------------------------------- /sample_project/sounds/tests/test_sound_03.json: -------------------------------------------------------------------------------- 1 | {"id":9993,"name":"test_sound_03","effect":0,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"bus":1,"priority":{"kind":"Static","value":1},"spatialization":0,"attenuation":0,"scope":0,"fader":"Linear","stream":false,"loop":{"enabled":false,"loop_count":5},"near_field_gain":{"kind":"Static","value":0},"path":"tests/test_sound_03.wav"} -------------------------------------------------------------------------------- /sample_project/sounds/throw_01.ogg.json: -------------------------------------------------------------------------------- 1 | {"id":1,"name":"throw_01","effect":0,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"bus":2,"priority":{"kind":"Static","value":1},"spatialization":1,"attenuation":1,"scope":0,"fader":"Linear","stream":false,"loop":{"enabled":false,"loop_count":5},"near_field_gain":{"kind":"Static","value":0},"path":"throw_01.ogg"} -------------------------------------------------------------------------------- /sample_project/sounds/throw_02.ogg.json: -------------------------------------------------------------------------------- 1 | {"id":2,"name":"throw_02","effect":0,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"bus":2,"priority":{"kind":"Static","value":1},"spatialization":1,"attenuation":1,"scope":0,"fader":"Linear","stream":false,"loop":{"enabled":false,"loop_count":5},"near_field_gain":{"kind":"Static","value":0},"path":"throw_02.ogg"} -------------------------------------------------------------------------------- /sample_project/sounds/throw_03.ogg.json: -------------------------------------------------------------------------------- 1 | {"id":3,"name":"throw_03","effect":0,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"bus":2,"priority":{"kind":"Static","value":1},"spatialization":1,"attenuation":1,"scope":0,"fader":"Linear","stream":false,"loop":{"enabled":false,"loop_count":5},"near_field_gain":{"kind":"Static","value":0},"path":"throw_03.ogg"} -------------------------------------------------------------------------------- /sample_project/sounds/throw_04.ogg.json: -------------------------------------------------------------------------------- 1 | {"id":4,"name":"throw_04","effect":0,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"bus":2,"priority":{"kind":"Static","value":1},"spatialization":1,"attenuation":1,"scope":0,"fader":"Linear","stream":false,"loop":{"enabled":false,"loop_count":5},"near_field_gain":{"kind":"Static","value":0},"path":"throw_04.ogg"} -------------------------------------------------------------------------------- /sample_project/sounds/throw_05.ogg.json: -------------------------------------------------------------------------------- 1 | {"id":5,"name":"throw_05","effect":0,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"bus":2,"priority":{"kind":"Static","value":1},"spatialization":1,"attenuation":1,"scope":0,"fader":"Linear","stream":false,"loop":{"enabled":false,"loop_count":5},"near_field_gain":{"kind":"Static","value":0},"path":"throw_05.ogg"} -------------------------------------------------------------------------------- /sample_project/sounds/throw_06.ogg.json: -------------------------------------------------------------------------------- 1 | {"id":6,"name":"throw_06","effect":0,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"bus":2,"priority":{"kind":"Static","value":1},"spatialization":1,"attenuation":1,"scope":0,"fader":"Linear","stream":false,"loop":{"enabled":false,"loop_count":5},"near_field_gain":{"kind":"Static","value":0},"path":"throw_06.ogg"} -------------------------------------------------------------------------------- /sample_project/sounds/throw_07.ogg.json: -------------------------------------------------------------------------------- 1 | {"id":7,"name":"throw_07","effect":0,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"bus":2,"priority":{"kind":"Static","value":1},"spatialization":1,"attenuation":1,"scope":0,"fader":"Linear","stream":false,"loop":{"enabled":false,"loop_count":5},"near_field_gain":{"kind":"Static","value":0},"path":"throw_07.ogg"} -------------------------------------------------------------------------------- /sample_project/sounds/throw_08.ogg.json: -------------------------------------------------------------------------------- 1 | {"id":8,"name":"throw_08","effect":0,"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"bus":2,"priority":{"kind":"Static","value":1},"spatialization":1,"attenuation":1,"scope":0,"fader":"Linear","stream":false,"loop":{"enabled":false,"loop_count":5},"near_field_gain":{"kind":"Static","value":0},"path":"throw_08.ogg"} -------------------------------------------------------------------------------- /sample_project/switch_containers/footsteps.json: -------------------------------------------------------------------------------- 1 | {"id":200,"name":"footsteps","effect":0,"gain":{"kind":"Static","value":0.0625},"pitch":{"kind":"Static","value":1},"bus":2,"priority":{"kind":"Static","value":1},"spatialization":1,"attenuation":1,"scope":1,"fader":"Linear","update_behavior":1,"switch_group":1,"default_switch_state":4,"entries":[{"object":1003,"continue_between_states":false,"fade_in":{"duration":1,"fader":"Linear"},"fade_out":{"duration":1,"fader":"Linear"},"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"switch_states":[4]},{"object":1004,"continue_between_states":false,"fade_in":{"duration":1,"fader":"Linear"},"fade_out":{"duration":1,"fader":"Linear"},"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"switch_states":[5]},{"object":1005,"continue_between_states":false,"fade_in":{"duration":1,"fader":"Linear"},"fade_out":{"duration":1,"fader":"Linear"},"gain":{"kind":"Static","value":1},"pitch":{"kind":"Static","value":1},"switch_states":[3]}]} -------------------------------------------------------------------------------- /sample_project/switches/env.json: -------------------------------------------------------------------------------- 1 | {"id":2,"name":"env","states":[{"id":1,"name":"forest"},{"id":2,"name":"desert"}]} -------------------------------------------------------------------------------- /sample_project/switches/surface_type.json: -------------------------------------------------------------------------------- 1 | {"id":1,"name":"surface_type","states":[{"id":1,"name":"wood"},{"id":2,"name":"water"},{"id":3,"name":"metal"},{"id":4,"name":"grass"},{"id":5,"name":"snow"}]} -------------------------------------------------------------------------------- /sample_project/tests.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "driver": "null", 3 | "output": { 4 | "frequency": 48000, 5 | "buffer_size": 4096, 6 | "format": "Float32" 7 | }, 8 | "mixer": { 9 | "panning_mode": "BinauralHighQuality", 10 | "active_channels": 50, 11 | "virtual_channels": 100, 12 | "pipeline": "default.ampipeline" 13 | }, 14 | "hrtf": { 15 | "amir_file": "data/sadie_h12.amir", 16 | "hrir_sampling": "Bilinear" 17 | }, 18 | "game": { 19 | "listener_fetch_mode": "Nearest", 20 | "track_environments": false, 21 | "listeners": 100, 22 | "entities": 4096, 23 | "environments": 512, 24 | "rooms": 1024, 25 | "doppler_factor": 1.0, 26 | "sound_speed": 343, 27 | "obstruction": { 28 | "lpf_curve": { 29 | "parts": [ 30 | { 31 | "start": { 32 | "x": 0, 33 | "y": 0 34 | }, 35 | "end": { 36 | "x": 1, 37 | "y": 1 38 | }, 39 | "fader": "Linear" 40 | } 41 | ] 42 | }, 43 | "gain_curve": { 44 | "parts": [ 45 | { 46 | "start": { 47 | "x": 0, 48 | "y": 1 49 | }, 50 | "end": { 51 | "x": 1, 52 | "y": 1 53 | }, 54 | "fader": "Linear" 55 | } 56 | ] 57 | } 58 | }, 59 | "occlusion": { 60 | "lpf_curve": { 61 | "parts": [ 62 | { 63 | "start": { 64 | "x": 0, 65 | "y": 0 66 | }, 67 | "end": { 68 | "x": 1, 69 | "y": 1 70 | }, 71 | "fader": "Linear" 72 | } 73 | ] 74 | }, 75 | "gain_curve": { 76 | "parts": [ 77 | { 78 | "start": { 79 | "x": 0, 80 | "y": 1 81 | }, 82 | "end": { 83 | "x": 1, 84 | "y": 0 85 | }, 86 | "fader": "Linear" 87 | } 88 | ] 89 | } 90 | } 91 | }, 92 | "buses_file": "pc.buses.ambus" 93 | } -------------------------------------------------------------------------------- /sample_project/tests.invalid.empty_pipeline.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "driver": "null", 3 | "output": { 4 | "frequency": 48000, 5 | "buffer_size": 4096, 6 | "format": "Float32" 7 | }, 8 | "mixer": { 9 | "panning_mode": "BinauralHighQuality", 10 | "active_channels": 50, 11 | "virtual_channels": 100, 12 | "pipeline": "" 13 | }, 14 | "hrtf": { 15 | "amir_file": "data/sadie_h12.amir", 16 | "hrir_sampling": "Bilinear" 17 | }, 18 | "game": { 19 | "listener_fetch_mode": "Nearest", 20 | "track_environments": true, 21 | "listeners": 100, 22 | "entities": 4096, 23 | "environments": 512, 24 | "rooms": 1024, 25 | "doppler_factor": 1.0, 26 | "sound_speed": 343, 27 | "obstruction": { 28 | "lpf_curve": { 29 | "parts": [ 30 | { 31 | "start": { 32 | "x": 0, 33 | "y": 0 34 | }, 35 | "end": { 36 | "x": 1, 37 | "y": 1 38 | }, 39 | "fader": "Linear" 40 | } 41 | ] 42 | }, 43 | "gain_curve": { 44 | "parts": [ 45 | { 46 | "start": { 47 | "x": 0, 48 | "y": 1 49 | }, 50 | "end": { 51 | "x": 1, 52 | "y": 1 53 | }, 54 | "fader": "Linear" 55 | } 56 | ] 57 | } 58 | }, 59 | "occlusion": { 60 | "lpf_curve": { 61 | "parts": [ 62 | { 63 | "start": { 64 | "x": 0, 65 | "y": 0 66 | }, 67 | "end": { 68 | "x": 1, 69 | "y": 1 70 | }, 71 | "fader": "Linear" 72 | } 73 | ] 74 | }, 75 | "gain_curve": { 76 | "parts": [ 77 | { 78 | "start": { 79 | "x": 0, 80 | "y": 1 81 | }, 82 | "end": { 83 | "x": 1, 84 | "y": 0 85 | }, 86 | "fader": "Linear" 87 | } 88 | ] 89 | } 90 | } 91 | }, 92 | "buses_file": "pc.buses.ambus" 93 | } -------------------------------------------------------------------------------- /sample_project/tests.invalid.failing_driver.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "driver": "failing", 3 | "output": { 4 | "frequency": 48000, 5 | "buffer_size": 4096, 6 | "format": "Float32" 7 | }, 8 | "mixer": { 9 | "panning_mode": "BinauralHighQuality", 10 | "active_channels": 50, 11 | "virtual_channels": 100, 12 | "pipeline": "default.ampipeline" 13 | }, 14 | "hrtf": { 15 | "amir_file": "data/sadie_h12.amir", 16 | "hrir_sampling": "Bilinear" 17 | }, 18 | "game": { 19 | "listener_fetch_mode": "Nearest", 20 | "track_environments": true, 21 | "listeners": 100, 22 | "entities": 4096, 23 | "environments": 512, 24 | "rooms": 1024, 25 | "doppler_factor": 1.0, 26 | "sound_speed": 343, 27 | "obstruction": { 28 | "lpf_curve": { 29 | "parts": [ 30 | { 31 | "start": { 32 | "x": 0, 33 | "y": 0 34 | }, 35 | "end": { 36 | "x": 1, 37 | "y": 1 38 | }, 39 | "fader": "Linear" 40 | } 41 | ] 42 | }, 43 | "gain_curve": { 44 | "parts": [ 45 | { 46 | "start": { 47 | "x": 0, 48 | "y": 1 49 | }, 50 | "end": { 51 | "x": 1, 52 | "y": 1 53 | }, 54 | "fader": "Linear" 55 | } 56 | ] 57 | } 58 | }, 59 | "occlusion": { 60 | "lpf_curve": { 61 | "parts": [ 62 | { 63 | "start": { 64 | "x": 0, 65 | "y": 0 66 | }, 67 | "end": { 68 | "x": 1, 69 | "y": 1 70 | }, 71 | "fader": "Linear" 72 | } 73 | ] 74 | }, 75 | "gain_curve": { 76 | "parts": [ 77 | { 78 | "start": { 79 | "x": 0, 80 | "y": 1 81 | }, 82 | "end": { 83 | "x": 1, 84 | "y": 0 85 | }, 86 | "fader": "Linear" 87 | } 88 | ] 89 | } 90 | } 91 | }, 92 | "buses_file": "pc.buses.ambus" 93 | } -------------------------------------------------------------------------------- /sample_project/tests.invalid.missing_child_bus.buses.json: -------------------------------------------------------------------------------- 1 | { 2 | "buses": [ 3 | { 4 | "id": 1, 5 | "name": "master", 6 | "gain": 1.0, 7 | "child_buses": [ 8 | 2, 9 | 3, 10 | 4 11 | ], 12 | "fader": "Linear" 13 | }, 14 | { 15 | "id": 2, 16 | "name": "effects", 17 | "gain": 1, 18 | "duck_buses": [ 19 | { 20 | "id": 3, 21 | "target_gain": 0.5, 22 | "fade_in": { 23 | "duration": 3, 24 | "fader": "SCurveSmooth" 25 | }, 26 | "fade_out": { 27 | "duration": 3, 28 | "fader": "Linear" 29 | } 30 | } 31 | ], 32 | "fader": "Linear" 33 | }, 34 | { 35 | "id": 3, 36 | "name": "environment", 37 | "gain": 0.25, 38 | "fader": "Linear" 39 | } 40 | ] 41 | } -------------------------------------------------------------------------------- /sample_project/tests.invalid.missing_child_bus.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "driver": "null", 3 | "output": { 4 | "frequency": 48000, 5 | "buffer_size": 4096, 6 | "format": "Float32" 7 | }, 8 | "mixer": { 9 | "panning_mode": "BinauralHighQuality", 10 | "active_channels": 50, 11 | "virtual_channels": 100, 12 | "pipeline": "default.ampipeline" 13 | }, 14 | "hrtf": { 15 | "amir_file": "data/sadie_h12.amir", 16 | "hrir_sampling": "Bilinear" 17 | }, 18 | "game": { 19 | "listener_fetch_mode": "Nearest", 20 | "track_environments": true, 21 | "listeners": 100, 22 | "entities": 4096, 23 | "environments": 512, 24 | "rooms": 1024, 25 | "doppler_factor": 1.0, 26 | "sound_speed": 343, 27 | "obstruction": { 28 | "lpf_curve": { 29 | "parts": [ 30 | { 31 | "start": { 32 | "x": 0, 33 | "y": 0 34 | }, 35 | "end": { 36 | "x": 1, 37 | "y": 1 38 | }, 39 | "fader": "Linear" 40 | } 41 | ] 42 | }, 43 | "gain_curve": { 44 | "parts": [ 45 | { 46 | "start": { 47 | "x": 0, 48 | "y": 1 49 | }, 50 | "end": { 51 | "x": 1, 52 | "y": 1 53 | }, 54 | "fader": "Linear" 55 | } 56 | ] 57 | } 58 | }, 59 | "occlusion": { 60 | "lpf_curve": { 61 | "parts": [ 62 | { 63 | "start": { 64 | "x": 0, 65 | "y": 0 66 | }, 67 | "end": { 68 | "x": 1, 69 | "y": 1 70 | }, 71 | "fader": "Linear" 72 | } 73 | ] 74 | }, 75 | "gain_curve": { 76 | "parts": [ 77 | { 78 | "start": { 79 | "x": 0, 80 | "y": 1 81 | }, 82 | "end": { 83 | "x": 1, 84 | "y": 0 85 | }, 86 | "fader": "Linear" 87 | } 88 | ] 89 | } 90 | } 91 | }, 92 | "buses_file": "tests.invalid.missing_child_bus.buses.ambus" 93 | } -------------------------------------------------------------------------------- /sample_project/tests.invalid.missing_duck_bus.buses.json: -------------------------------------------------------------------------------- 1 | { 2 | "buses": [ 3 | { 4 | "id": 1, 5 | "name": "master", 6 | "gain": 1.0, 7 | "child_buses": [ 8 | 2, 9 | 3 10 | ], 11 | "fader": "Linear" 12 | }, 13 | { 14 | "id": 2, 15 | "name": "effects", 16 | "gain": 1, 17 | "duck_buses": [ 18 | { 19 | "id": 3, 20 | "target_gain": 0.5, 21 | "fade_in": { 22 | "duration": 3, 23 | "fader": "SCurveSmooth" 24 | }, 25 | "fade_out": { 26 | "duration": 3, 27 | "fader": "Linear" 28 | } 29 | }, 30 | { 31 | "id": 4, 32 | "target_gain": 0.5, 33 | "fade_in": { 34 | "duration": 3, 35 | "fader": "SCurveSmooth" 36 | }, 37 | "fade_out": { 38 | "duration": 3, 39 | "fader": "Linear" 40 | } 41 | } 42 | ], 43 | "fader": "Linear" 44 | }, 45 | { 46 | "id": 3, 47 | "name": "environment", 48 | "gain": 0.25, 49 | "fader": "Linear" 50 | } 51 | ] 52 | } -------------------------------------------------------------------------------- /sample_project/tests.invalid.missing_duck_bus.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "driver": "null", 3 | "output": { 4 | "frequency": 48000, 5 | "buffer_size": 4096, 6 | "format": "Float32" 7 | }, 8 | "mixer": { 9 | "panning_mode": "BinauralHighQuality", 10 | "active_channels": 50, 11 | "virtual_channels": 100, 12 | "pipeline": "default.ampipeline" 13 | }, 14 | "hrtf": { 15 | "amir_file": "data/sadie_h12.amir", 16 | "hrir_sampling": "Bilinear" 17 | }, 18 | "game": { 19 | "listener_fetch_mode": "Nearest", 20 | "track_environments": true, 21 | "listeners": 100, 22 | "entities": 4096, 23 | "environments": 512, 24 | "rooms": 1024, 25 | "doppler_factor": 1.0, 26 | "sound_speed": 343, 27 | "obstruction": { 28 | "lpf_curve": { 29 | "parts": [ 30 | { 31 | "start": { 32 | "x": 0, 33 | "y": 0 34 | }, 35 | "end": { 36 | "x": 1, 37 | "y": 1 38 | }, 39 | "fader": "Linear" 40 | } 41 | ] 42 | }, 43 | "gain_curve": { 44 | "parts": [ 45 | { 46 | "start": { 47 | "x": 0, 48 | "y": 1 49 | }, 50 | "end": { 51 | "x": 1, 52 | "y": 1 53 | }, 54 | "fader": "Linear" 55 | } 56 | ] 57 | } 58 | }, 59 | "occlusion": { 60 | "lpf_curve": { 61 | "parts": [ 62 | { 63 | "start": { 64 | "x": 0, 65 | "y": 0 66 | }, 67 | "end": { 68 | "x": 1, 69 | "y": 1 70 | }, 71 | "fader": "Linear" 72 | } 73 | ] 74 | }, 75 | "gain_curve": { 76 | "parts": [ 77 | { 78 | "start": { 79 | "x": 0, 80 | "y": 1 81 | }, 82 | "end": { 83 | "x": 1, 84 | "y": 0 85 | }, 86 | "fader": "Linear" 87 | } 88 | ] 89 | } 90 | } 91 | }, 92 | "buses_file": "tests.invalid.missing_duck_bus.buses.ambus" 93 | } -------------------------------------------------------------------------------- /sample_project/tests.invalid.unknown_buses.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "driver": "null", 3 | "output": { 4 | "frequency": 48000, 5 | "buffer_size": 4096, 6 | "format": "Float32" 7 | }, 8 | "mixer": { 9 | "panning_mode": "BinauralHighQuality", 10 | "active_channels": 50, 11 | "virtual_channels": 100, 12 | "pipeline": "default.ampipeline" 13 | }, 14 | "hrtf": { 15 | "amir_file": "data/sadie_h12.amir", 16 | "hrir_sampling": "Bilinear" 17 | }, 18 | "game": { 19 | "listener_fetch_mode": "Nearest", 20 | "track_environments": true, 21 | "listeners": 100, 22 | "entities": 4096, 23 | "environments": 512, 24 | "rooms": 1024, 25 | "doppler_factor": 1.0, 26 | "sound_speed": 343, 27 | "obstruction": { 28 | "lpf_curve": { 29 | "parts": [ 30 | { 31 | "start": { 32 | "x": 0, 33 | "y": 0 34 | }, 35 | "end": { 36 | "x": 1, 37 | "y": 1 38 | }, 39 | "fader": "Linear" 40 | } 41 | ] 42 | }, 43 | "gain_curve": { 44 | "parts": [ 45 | { 46 | "start": { 47 | "x": 0, 48 | "y": 1 49 | }, 50 | "end": { 51 | "x": 1, 52 | "y": 1 53 | }, 54 | "fader": "Linear" 55 | } 56 | ] 57 | } 58 | }, 59 | "occlusion": { 60 | "lpf_curve": { 61 | "parts": [ 62 | { 63 | "start": { 64 | "x": 0, 65 | "y": 0 66 | }, 67 | "end": { 68 | "x": 1, 69 | "y": 1 70 | }, 71 | "fader": "Linear" 72 | } 73 | ] 74 | }, 75 | "gain_curve": { 76 | "parts": [ 77 | { 78 | "start": { 79 | "x": 0, 80 | "y": 1 81 | }, 82 | "end": { 83 | "x": 1, 84 | "y": 0 85 | }, 86 | "fader": "Linear" 87 | } 88 | ] 89 | } 90 | } 91 | }, 92 | "buses_file": "unknown.ambus" 93 | } -------------------------------------------------------------------------------- /sample_project/tests.invalid.unknown_driver.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "driver": "unknown", 3 | "output": { 4 | "frequency": 48000, 5 | "buffer_size": 4096, 6 | "format": "Float32" 7 | }, 8 | "mixer": { 9 | "panning_mode": "BinauralHighQuality", 10 | "active_channels": 50, 11 | "virtual_channels": 100, 12 | "pipeline": "default.ampipeline" 13 | }, 14 | "hrtf": { 15 | "amir_file": "data/sadie_h12.amir", 16 | "hrir_sampling": "Bilinear" 17 | }, 18 | "game": { 19 | "listener_fetch_mode": "Nearest", 20 | "track_environments": true, 21 | "listeners": 100, 22 | "entities": 4096, 23 | "environments": 512, 24 | "rooms": 1024, 25 | "doppler_factor": 1.0, 26 | "sound_speed": 343, 27 | "obstruction": { 28 | "lpf_curve": { 29 | "parts": [ 30 | { 31 | "start": { 32 | "x": 0, 33 | "y": 0 34 | }, 35 | "end": { 36 | "x": 1, 37 | "y": 1 38 | }, 39 | "fader": "Linear" 40 | } 41 | ] 42 | }, 43 | "gain_curve": { 44 | "parts": [ 45 | { 46 | "start": { 47 | "x": 0, 48 | "y": 1 49 | }, 50 | "end": { 51 | "x": 1, 52 | "y": 1 53 | }, 54 | "fader": "Linear" 55 | } 56 | ] 57 | } 58 | }, 59 | "occlusion": { 60 | "lpf_curve": { 61 | "parts": [ 62 | { 63 | "start": { 64 | "x": 0, 65 | "y": 0 66 | }, 67 | "end": { 68 | "x": 1, 69 | "y": 1 70 | }, 71 | "fader": "Linear" 72 | } 73 | ] 74 | }, 75 | "gain_curve": { 76 | "parts": [ 77 | { 78 | "start": { 79 | "x": 0, 80 | "y": 1 81 | }, 82 | "end": { 83 | "x": 1, 84 | "y": 0 85 | }, 86 | "fader": "Linear" 87 | } 88 | ] 89 | } 90 | } 91 | }, 92 | "buses_file": "pc.buses.ambus" 93 | } -------------------------------------------------------------------------------- /sample_project/tests.invalid.unset_driver.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "output": { 3 | "frequency": 48000, 4 | "buffer_size": 4096, 5 | "format": "Float32" 6 | }, 7 | "mixer": { 8 | "panning_mode": "BinauralHighQuality", 9 | "active_channels": 50, 10 | "virtual_channels": 100, 11 | "pipeline": "default.ampipeline" 12 | }, 13 | "hrtf": { 14 | "amir_file": "data/sadie_h12.amir", 15 | "hrir_sampling": "Bilinear" 16 | }, 17 | "game": { 18 | "listener_fetch_mode": "Nearest", 19 | "track_environments": true, 20 | "listeners": 100, 21 | "entities": 4096, 22 | "environments": 512, 23 | "rooms": 1024, 24 | "doppler_factor": 1.0, 25 | "sound_speed": 343, 26 | "obstruction": { 27 | "lpf_curve": { 28 | "parts": [ 29 | { 30 | "start": { 31 | "x": 0, 32 | "y": 0 33 | }, 34 | "end": { 35 | "x": 1, 36 | "y": 1 37 | }, 38 | "fader": "Linear" 39 | } 40 | ] 41 | }, 42 | "gain_curve": { 43 | "parts": [ 44 | { 45 | "start": { 46 | "x": 0, 47 | "y": 1 48 | }, 49 | "end": { 50 | "x": 1, 51 | "y": 1 52 | }, 53 | "fader": "Linear" 54 | } 55 | ] 56 | } 57 | }, 58 | "occlusion": { 59 | "lpf_curve": { 60 | "parts": [ 61 | { 62 | "start": { 63 | "x": 0, 64 | "y": 0 65 | }, 66 | "end": { 67 | "x": 1, 68 | "y": 1 69 | }, 70 | "fader": "Linear" 71 | } 72 | ] 73 | }, 74 | "gain_curve": { 75 | "parts": [ 76 | { 77 | "start": { 78 | "x": 0, 79 | "y": 1 80 | }, 81 | "end": { 82 | "x": 1, 83 | "y": 0 84 | }, 85 | "fader": "Linear" 86 | } 87 | ] 88 | } 89 | } 90 | }, 91 | "buses_file": "pc.buses.ambus" 92 | } -------------------------------------------------------------------------------- /sample_project/tests.invalid.wrong_master_bus.buses.json: -------------------------------------------------------------------------------- 1 | { 2 | "buses": [ 3 | { 4 | "id": 123456789, 5 | "name": "main", 6 | "gain": 1.0, 7 | "child_buses": [ 8 | 2, 9 | 3 10 | ], 11 | "fader": "Linear" 12 | }, 13 | { 14 | "id": 2, 15 | "name": "effects", 16 | "gain": 1, 17 | "duck_buses": [ 18 | { 19 | "id": 3, 20 | "target_gain": 0.5, 21 | "fade_in": { 22 | "duration": 3, 23 | "fader": "SCurveSmooth" 24 | }, 25 | "fade_out": { 26 | "duration": 3, 27 | "fader": "Linear" 28 | } 29 | } 30 | ], 31 | "fader": "Linear" 32 | }, 33 | { 34 | "id": 3, 35 | "name": "environment", 36 | "gain": 0.25, 37 | "fader": "Linear" 38 | } 39 | ] 40 | } -------------------------------------------------------------------------------- /sample_project/tests.invalid.wrong_master_bus.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "driver": "null", 3 | "output": { 4 | "frequency": 48000, 5 | "buffer_size": 4096, 6 | "format": "Float32" 7 | }, 8 | "mixer": { 9 | "panning_mode": "BinauralHighQuality", 10 | "active_channels": 50, 11 | "virtual_channels": 100, 12 | "pipeline": "default.ampipeline" 13 | }, 14 | "hrtf": { 15 | "amir_file": "data/sadie_h12.amir", 16 | "hrir_sampling": "Bilinear" 17 | }, 18 | "game": { 19 | "listener_fetch_mode": "Nearest", 20 | "track_environments": true, 21 | "listeners": 100, 22 | "entities": 4096, 23 | "environments": 512, 24 | "rooms": 1024, 25 | "doppler_factor": 1.0, 26 | "sound_speed": 343, 27 | "obstruction": { 28 | "lpf_curve": { 29 | "parts": [ 30 | { 31 | "start": { 32 | "x": 0, 33 | "y": 0 34 | }, 35 | "end": { 36 | "x": 1, 37 | "y": 1 38 | }, 39 | "fader": "Linear" 40 | } 41 | ] 42 | }, 43 | "gain_curve": { 44 | "parts": [ 45 | { 46 | "start": { 47 | "x": 0, 48 | "y": 1 49 | }, 50 | "end": { 51 | "x": 1, 52 | "y": 1 53 | }, 54 | "fader": "Linear" 55 | } 56 | ] 57 | } 58 | }, 59 | "occlusion": { 60 | "lpf_curve": { 61 | "parts": [ 62 | { 63 | "start": { 64 | "x": 0, 65 | "y": 0 66 | }, 67 | "end": { 68 | "x": 1, 69 | "y": 1 70 | }, 71 | "fader": "Linear" 72 | } 73 | ] 74 | }, 75 | "gain_curve": { 76 | "parts": [ 77 | { 78 | "start": { 79 | "x": 0, 80 | "y": 1 81 | }, 82 | "end": { 83 | "x": 1, 84 | "y": 0 85 | }, 86 | "fader": "Linear" 87 | } 88 | ] 89 | } 90 | } 91 | }, 92 | "buses_file": "tests.invalid.wrong_master_bus.buses.ambus" 93 | } -------------------------------------------------------------------------------- /sample_project/tests.invalid.wrong_master_bus_id.buses.json: -------------------------------------------------------------------------------- 1 | { 2 | "buses": [ 3 | { 4 | "id": 123456789, 5 | "name": "master", 6 | "gain": 1.0, 7 | "child_buses": [ 8 | 2, 9 | 3 10 | ], 11 | "fader": "Linear" 12 | }, 13 | { 14 | "id": 2, 15 | "name": "effects", 16 | "gain": 1, 17 | "duck_buses": [ 18 | { 19 | "id": 3, 20 | "target_gain": 0.5, 21 | "fade_in": { 22 | "duration": 3, 23 | "fader": "SCurveSmooth" 24 | }, 25 | "fade_out": { 26 | "duration": 3, 27 | "fader": "Linear" 28 | } 29 | } 30 | ], 31 | "fader": "Linear" 32 | }, 33 | { 34 | "id": 3, 35 | "name": "environment", 36 | "gain": 0.25, 37 | "fader": "Linear" 38 | } 39 | ] 40 | } -------------------------------------------------------------------------------- /sample_project/tests.invalid.wrong_master_bus_id.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "driver": "null", 3 | "output": { 4 | "frequency": 48000, 5 | "buffer_size": 4096, 6 | "format": "Float32" 7 | }, 8 | "mixer": { 9 | "panning_mode": "BinauralHighQuality", 10 | "active_channels": 50, 11 | "virtual_channels": 100, 12 | "pipeline": "default.ampipeline" 13 | }, 14 | "hrtf": { 15 | "amir_file": "data/sadie_h12.amir", 16 | "hrir_sampling": "Bilinear" 17 | }, 18 | "game": { 19 | "listener_fetch_mode": "Nearest", 20 | "track_environments": true, 21 | "listeners": 100, 22 | "entities": 4096, 23 | "environments": 512, 24 | "rooms": 1024, 25 | "doppler_factor": 1.0, 26 | "sound_speed": 343, 27 | "obstruction": { 28 | "lpf_curve": { 29 | "parts": [ 30 | { 31 | "start": { 32 | "x": 0, 33 | "y": 0 34 | }, 35 | "end": { 36 | "x": 1, 37 | "y": 1 38 | }, 39 | "fader": "Linear" 40 | } 41 | ] 42 | }, 43 | "gain_curve": { 44 | "parts": [ 45 | { 46 | "start": { 47 | "x": 0, 48 | "y": 1 49 | }, 50 | "end": { 51 | "x": 1, 52 | "y": 1 53 | }, 54 | "fader": "Linear" 55 | } 56 | ] 57 | } 58 | }, 59 | "occlusion": { 60 | "lpf_curve": { 61 | "parts": [ 62 | { 63 | "start": { 64 | "x": 0, 65 | "y": 0 66 | }, 67 | "end": { 68 | "x": 1, 69 | "y": 1 70 | }, 71 | "fader": "Linear" 72 | } 73 | ] 74 | }, 75 | "gain_curve": { 76 | "parts": [ 77 | { 78 | "start": { 79 | "x": 0, 80 | "y": 1 81 | }, 82 | "end": { 83 | "x": 1, 84 | "y": 0 85 | }, 86 | "fader": "Linear" 87 | } 88 | ] 89 | } 90 | } 91 | }, 92 | "buses_file": "tests.invalid.wrong_master_bus_id.buses.ambus" 93 | } -------------------------------------------------------------------------------- /sample_project/tests.invalid.wrong_master_bus_name.buses.json: -------------------------------------------------------------------------------- 1 | { 2 | "buses": [ 3 | { 4 | "id": 1, 5 | "name": "main", 6 | "gain": 1.0, 7 | "child_buses": [ 8 | 2, 9 | 3 10 | ], 11 | "fader": "Linear" 12 | }, 13 | { 14 | "id": 2, 15 | "name": "effects", 16 | "gain": 1, 17 | "duck_buses": [ 18 | { 19 | "id": 3, 20 | "target_gain": 0.5, 21 | "fade_in": { 22 | "duration": 3, 23 | "fader": "SCurveSmooth" 24 | }, 25 | "fade_out": { 26 | "duration": 3, 27 | "fader": "Linear" 28 | } 29 | } 30 | ], 31 | "fader": "Linear" 32 | }, 33 | { 34 | "id": 3, 35 | "name": "environment", 36 | "gain": 0.25, 37 | "fader": "Linear" 38 | } 39 | ] 40 | } -------------------------------------------------------------------------------- /sample_project/tests.invalid.wrong_master_bus_name.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "driver": "null", 3 | "output": { 4 | "frequency": 48000, 5 | "buffer_size": 4096, 6 | "format": "Float32" 7 | }, 8 | "mixer": { 9 | "panning_mode": "BinauralHighQuality", 10 | "active_channels": 50, 11 | "virtual_channels": 100, 12 | "pipeline": "default.ampipeline" 13 | }, 14 | "hrtf": { 15 | "amir_file": "data/sadie_h12.amir", 16 | "hrir_sampling": "Bilinear" 17 | }, 18 | "game": { 19 | "listener_fetch_mode": "Nearest", 20 | "track_environments": true, 21 | "listeners": 100, 22 | "entities": 4096, 23 | "environments": 512, 24 | "rooms": 1024, 25 | "doppler_factor": 1.0, 26 | "sound_speed": 343, 27 | "obstruction": { 28 | "lpf_curve": { 29 | "parts": [ 30 | { 31 | "start": { 32 | "x": 0, 33 | "y": 0 34 | }, 35 | "end": { 36 | "x": 1, 37 | "y": 1 38 | }, 39 | "fader": "Linear" 40 | } 41 | ] 42 | }, 43 | "gain_curve": { 44 | "parts": [ 45 | { 46 | "start": { 47 | "x": 0, 48 | "y": 1 49 | }, 50 | "end": { 51 | "x": 1, 52 | "y": 1 53 | }, 54 | "fader": "Linear" 55 | } 56 | ] 57 | } 58 | }, 59 | "occlusion": { 60 | "lpf_curve": { 61 | "parts": [ 62 | { 63 | "start": { 64 | "x": 0, 65 | "y": 0 66 | }, 67 | "end": { 68 | "x": 1, 69 | "y": 1 70 | }, 71 | "fader": "Linear" 72 | } 73 | ] 74 | }, 75 | "gain_curve": { 76 | "parts": [ 77 | { 78 | "start": { 79 | "x": 0, 80 | "y": 1 81 | }, 82 | "end": { 83 | "x": 1, 84 | "y": 0 85 | }, 86 | "fader": "Linear" 87 | } 88 | ] 89 | } 90 | } 91 | }, 92 | "buses_file": "tests.invalid.wrong_master_bus_name.buses.ambus" 93 | } -------------------------------------------------------------------------------- /samples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | cmake_minimum_required(VERSION 3.10) 16 | 17 | set(PROJECT_NAME ss_amplitude_audio_samples) 18 | 19 | project(${PROJECT_NAME}) 20 | 21 | add_subdirectory(sample_01) 22 | add_subdirectory(sample_02) 23 | 24 | install( 25 | CODE "execute_process(COMMAND python3 ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/build_project.py -p ${CMAKE_SOURCE_DIR}/sample_project -b ${CMAKE_INSTALL_PREFIX}/${AM_BIN_DESTINATION}/samples/assets -f ${CMAKE_SOURCE_DIR}/bin/flatc WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})" 26 | ) 27 | 28 | install( 29 | TARGETS ss_amplitude_audio_sample_01 ss_amplitude_audio_sample_02 30 | RUNTIME DESTINATION ${AM_BIN_DESTINATION}/samples 31 | ) 32 | -------------------------------------------------------------------------------- /samples/sample_01/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | cmake_minimum_required(VERSION 3.10) 16 | 17 | set(PROJECT_NAME ss_amplitude_audio_sample_01) 18 | 19 | project(${PROJECT_NAME}) 20 | 21 | if(AM_PLATFORM_APPLE) 22 | set(CMAKE_MACOSX_RPATH 1) 23 | list(APPEND CMAKE_INSTALL_RPATH "@executable_path" "@executable_path/../../../lib/${RUNTIME_OUTPUT_DIRECTORY}/shared/") 24 | elseif(AM_PLATFORM_LINUX) 25 | if (AM_COMPILER_CLANG) 26 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,$ORIGIN/../../../lib/${RUNTIME_OUTPUT_DIRECTORY}/shared/") 27 | set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE) 28 | else() 29 | list(APPEND CMAKE_INSTALL_RPATH $ORIGIN $ORIGIN/../../../lib/${RUNTIME_OUTPUT_DIRECTORY}/shared/) 30 | set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE) 31 | endif() 32 | endif() 33 | 34 | set(ss_amplitude_audio_sample_01_SRCS 35 | main.cpp 36 | ) 37 | 38 | add_executable(${PROJECT_NAME} ${ss_amplitude_audio_sample_01_SRCS}) 39 | 40 | set_target_properties(${PROJECT_NAME} 41 | PROPERTIES 42 | OUTPUT_NAME sample_01 43 | RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/samples 44 | ) 45 | 46 | target_link_libraries(${PROJECT_NAME} 47 | PUBLIC Shared 48 | ) 49 | 50 | add_dependencies(${PROJECT_NAME} 51 | Shared 52 | ss_amplitude_audio_sample_project 53 | ) 54 | 55 | target_compile_definitions( 56 | ${PROJECT_NAME} 57 | PRIVATE 58 | AM_SDK_PLATFORM="${VCPKG_TARGET_TRIPLET}" 59 | AM_SDK_PATH="$ENV{AM_SDK_PATH}" 60 | ) 61 | -------------------------------------------------------------------------------- /schemas/effect_definition.fbs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | include "common.fbs"; 16 | 17 | namespace SparkyStudios.Audio.Amplitude; 18 | 19 | /// An effect to apply on the sound during playback. 20 | table EffectDefinition { 21 | /// The unique ID of the effect. 22 | id:uint64 = 0; 23 | 24 | /// The name of the effect. 25 | name:string; 26 | 27 | /// The effect to apply to the sound. This value has to be a valid registered 28 | /// instance through the Effect API. 29 | effect:string; 30 | 31 | /// The effect settings values. These values are ordered in the same 32 | /// parameters order in the selected effect. 33 | parameters:[RtpcCompatibleValue]; 34 | } 35 | 36 | root_type EffectDefinition; 37 | 38 | file_identifier "AMFX"; 39 | file_extension "amfx"; 40 | -------------------------------------------------------------------------------- /schemas/pipeline_definition.fbs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | include "common.fbs"; 16 | 17 | namespace SparkyStudios.Audio.Amplitude; 18 | 19 | table PipelineNodeDefinition { 20 | /// The node ID. This value should be unique across all nodes of the same pipeline. 21 | id:uint64 = 0; 22 | 23 | /// The name of the node to instantiate. Make sure that name is available in the pipeline 24 | /// nodes registry. 25 | name:string; 26 | 27 | /// The array of nodes this node will consume. Only Mixer nodes may consume more than one input. 28 | /// Consumer nodes can only consume one input, so there must be only one value in the array for these nodes. 29 | /// Producer nodes doesn't consume inputs, so the array must be empty for these nodes. 30 | consume:[uint]; 31 | } 32 | 33 | /// A pipeline tells Amplimix how to process audio data before to send it to the audio device. 34 | /// Pipeline nodes must be registered within the engine before to be used in a pipeline asset. 35 | table PipelineDefinition { 36 | /// The unique ID for this pipeline. 37 | id:uint64 = 0; 38 | 39 | /// The name of this pipeline. 40 | name:string; 41 | 42 | /// The list of nodes in this pipeline 43 | nodes:[PipelineNodeDefinition]; 44 | } 45 | 46 | root_type PipelineDefinition; 47 | 48 | file_identifier "AMPL"; 49 | file_extension "ampipeline"; 50 | -------------------------------------------------------------------------------- /schemas/rtpc_definition.fbs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | include "common.fbs"; 16 | 17 | namespace SparkyStudios.Audio.Amplitude; 18 | 19 | /// The settings used fo the RTPC value fading. 20 | table RtpcFadingSettings { 21 | /// Defines if the RTPC value should fade o go straight to the target value. 22 | enabled:bool = false; 23 | 24 | /// The fade transition settings when the RTPC value is increased. 25 | fade_attack:FadeTransitionSettings; 26 | 27 | /// The fade transition settings when the RTPC value is decreased. 28 | fade_release:FadeTransitionSettings; 29 | } 30 | 31 | /// A Real Time Parameter Control is a floating-point variable that is updated over time by the game logic. 32 | table RtpcDefinition { 33 | /// The unique ID of the RTPC. 34 | id:uint64; 35 | 36 | /// The name of the RTPC. 37 | name:string; 38 | 39 | /// The minimum value the RTPC should have. 40 | min_value:double; 41 | 42 | /// The maximum value the RTPC can have. 43 | max_value:double; 44 | 45 | /// The default value of the RTPC. 46 | default_value:double = 0; 47 | 48 | /// The fade transition settings of the RTPC. 49 | fade_settings:RtpcFadingSettings; 50 | } 51 | 52 | root_type RtpcDefinition; 53 | 54 | file_identifier "AMPC"; 55 | file_extension "amrtpc"; 56 | -------------------------------------------------------------------------------- /schemas/switch_definition.fbs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | include "common.fbs"; 16 | 17 | namespace SparkyStudios.Audio.Amplitude; 18 | 19 | table SwitchStateDefinition { 20 | /// The switch state unique ID. This ID is internal to the switch, and not shared outside. 21 | /// This means that many switch states from the different switches can have the same ID. 22 | id:uint64 = 0; 23 | 24 | /// The name of the switch state. 25 | name:string; 26 | } 27 | 28 | /// A switch is a collection of states which can change the sound played during the game. For example, 29 | /// you can have a switch named "SurfaceType" which have "wood", "grass", "metal" and "water" as states. 30 | table SwitchDefinition { 31 | /// The unique ID for this switch. 32 | id:uint64 = 0; 33 | 34 | /// The name of this switch. 35 | name:string; 36 | 37 | /// The list of states available for this switch. 38 | states:[SwitchStateDefinition]; 39 | } 40 | 41 | root_type SwitchDefinition; 42 | 43 | file_identifier "AMSW"; 44 | file_extension "amswitch"; 45 | -------------------------------------------------------------------------------- /scripts/build_project.py: -------------------------------------------------------------------------------- 1 | # coding:utf-8 2 | # !/usr/bin/python 3 | # 4 | # Copyright (c) 2021-present Sparky Studios. All rights reserved. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | """ 19 | Compile the Amplitude project and generate Amplitude binary assets. 20 | """ 21 | 22 | import common 23 | import sys 24 | 25 | 26 | def main(argv): 27 | """Builds the Amplitude project for the game. 28 | 29 | This script will build all the assets in the Amplitude project directory. 30 | 31 | Returns: 32 | Returns 0 on success. 33 | """ 34 | 35 | options = common.CommandOptions(argv, "build_project", "0.2.0") 36 | 37 | try: 38 | common.generate_flatbuffers_binaries(options) 39 | print("Amplitude binary assets compiled successfully.") 40 | except common.BuildError as error: 41 | common.handle_build_error(error) 42 | return 1 43 | 44 | return 0 45 | 46 | 47 | if __name__ == '__main__': 48 | main(sys.argv[1:]) 49 | -------------------------------------------------------------------------------- /scripts/clean_project.py: -------------------------------------------------------------------------------- 1 | # coding:utf-8 2 | # !/usr/bin/python 3 | # 4 | # Copyright (c) 2021-present Sparky Studios. All rights reserved. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | """ 19 | Clean generated Amplitude binary assets. 20 | """ 21 | 22 | import common 23 | import sys 24 | 25 | 26 | def main(argv): 27 | """Cleans the generated Amplitude binary assets. 28 | 29 | Returns: 30 | Returns 0 on success. 31 | """ 32 | 33 | options = common.CommandOptions(argv, "clean_project", "0.3.0") 34 | 35 | try: 36 | common.clean_flatbuffers_binaries(options) 37 | print("Amplitude binary assets cleaned successfully.") 38 | except common.BuildError as error: 39 | common.handle_build_error(error) 40 | return 1 41 | 42 | return 0 43 | 44 | 45 | if __name__ == '__main__': 46 | main(sys.argv[1:]) 47 | -------------------------------------------------------------------------------- /src/Ambisonics/AmbisonicBinauralizer.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #ifndef _AM_IMPLEMENTATION_AMBISONICS_AMBISONIC_BINAURALIZER_H 18 | #define _AM_IMPLEMENTATION_AMBISONICS_AMBISONIC_BINAURALIZER_H 19 | 20 | #include 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace SparkyStudios::Audio::Amplitude 27 | { 28 | class AmbisonicBinauralizer final : public AmbisonicComponent 29 | { 30 | public: 31 | AmbisonicBinauralizer(); 32 | 33 | bool Configure(AmUInt32 order, bool is3D, const HRIRSphere* hrirSphere); 34 | 35 | void Reset() override; 36 | 37 | void Refresh() override; 38 | 39 | /** 40 | * @brief Decodes the B-Format input audio samples and outputs the speaker feed. 41 | * 42 | * @param input The input audio samples in B-format. 43 | * @param samples The number of audio samples to process. 44 | * @param output The output speaker feed as audio samples. 45 | */ 46 | void Process(BFormat* input, AmUInt32 samples, AudioBuffer& output); 47 | 48 | private: 49 | void SetUpSpeakers(); 50 | 51 | AmbisonicDecoder _decoder; 52 | 53 | const HRIRSphere* _hrir; 54 | AudioBuffer _accumulatedHRIR[2]; 55 | 56 | Convolver _convL[16]; 57 | Convolver _convR[16]; 58 | }; 59 | } // namespace SparkyStudios::Audio::Amplitude 60 | 61 | #endif // _AM_IMPLEMENTATION_AMBISONICS_AMBISONIC_BINAURALIZER_H -------------------------------------------------------------------------------- /src/Ambisonics/AmbisonicComponent.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | #include 17 | 18 | namespace SparkyStudios::Audio::Amplitude 19 | { 20 | AmbisonicComponent::AmbisonicComponent() 21 | : m_order(0) 22 | , m_is3D(false) 23 | , m_channelCount(0) 24 | {} 25 | 26 | bool AmbisonicComponent::Configure(AmUInt32 order, bool is3D) 27 | { 28 | m_order = order; 29 | m_is3D = is3D; 30 | m_channelCount = OrderToComponents(order, is3D); 31 | 32 | return true; 33 | } 34 | } // namespace SparkyStudios::Audio::Amplitude 35 | -------------------------------------------------------------------------------- /src/Ambisonics/AmbisonicSpeaker.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | namespace SparkyStudios::Audio::Amplitude 20 | { 21 | AmbisonicSpeaker::AmbisonicSpeaker() 22 | { 23 | AmbisonicSpeaker::Configure(1, true); 24 | AmbisonicSpeaker::Refresh(); 25 | } 26 | 27 | AmbisonicSpeaker::~AmbisonicSpeaker() = default; 28 | 29 | bool AmbisonicSpeaker::Configure(AmUInt32 order, bool is3D) 30 | { 31 | if (!AmbisonicEntity::Configure(order, is3D)) 32 | return false; 33 | 34 | SetOrderWeight(0, std::sqrt(2.0f)); 35 | return true; 36 | } 37 | 38 | void AmbisonicSpeaker::Refresh() 39 | { 40 | AmbisonicEntity::Refresh(); 41 | } 42 | 43 | void AmbisonicSpeaker::Process(BFormat* input, AmUInt32 frameCount, AudioBufferChannel& output) 44 | { 45 | AMPLITUDE_ASSERT(output.size() == frameCount); 46 | output.clear(); 47 | 48 | for (AmUInt32 c = 0; c < m_channelCount; ++c) 49 | { 50 | auto& channel = input->GetBufferChannel(c); 51 | ScalarMultiplyAccumulate(channel.begin(), output.begin(), m_coefficients[c], frameCount); 52 | } 53 | } 54 | } // namespace SparkyStudios::Audio::Amplitude -------------------------------------------------------------------------------- /src/Core/AudioBufferCrossFader.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #ifndef _AM_CORE_AUDIO_BUFFER_CROSS_FADER_H 18 | #define _AM_CORE_AUDIO_BUFFER_CROSS_FADER_H 19 | 20 | #include 21 | 22 | namespace SparkyStudios::Audio::Amplitude 23 | { 24 | class AudioBufferCrossFader 25 | { 26 | public: 27 | explicit AudioBufferCrossFader(AmSize sampleCount); 28 | 29 | /** 30 | * @brief Performs a linear cross-fading between two audio buffers. 31 | * 32 | * @param bufferIn The first audio buffer to cross-fade from. 33 | * @param bufferOut The second audio buffer to cross-fade to. 34 | * @param outputBuffer The resulting cross-faded audio buffer. 35 | */ 36 | void CrossFade(const AudioBuffer& bufferIn, const AudioBuffer& bufferOut, AudioBuffer& outputBuffer) const; 37 | 38 | private: 39 | AudioBuffer _crossFadeBuffer; 40 | }; 41 | } // namespace SparkyStudios::Audio::Amplitude 42 | 43 | #endif // _AM_CORE_AUDIO_BUFFER_CROSS_FADER_H -------------------------------------------------------------------------------- /src/Core/Device.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | 17 | namespace SparkyStudios::Audio::Amplitude 18 | { 19 | static DeviceNotificationCallback gDeviceNotificationCallback = nullptr; 20 | 21 | void RegisterDeviceNotificationCallback(DeviceNotificationCallback callback) 22 | { 23 | gDeviceNotificationCallback = callback; 24 | } 25 | 26 | void UnregisterDeviceNotificationCallback() 27 | { 28 | gDeviceNotificationCallback = nullptr; 29 | } 30 | 31 | void CallDeviceNotificationCallback(DeviceNotification notification, const DeviceDescription& device, Driver* driver) 32 | { 33 | if (gDeviceNotificationCallback != nullptr) 34 | { 35 | gDeviceNotificationCallback(notification, device, driver); 36 | } 37 | } 38 | } // namespace SparkyStudios::Audio::Amplitude -------------------------------------------------------------------------------- /src/Core/Drivers/MiniAudio/Driver.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #ifndef _AM_IMPLEMENTATION_CORE_DRIVERS_MINIAUDIO_DRIVER_H 18 | #define _AM_IMPLEMENTATION_CORE_DRIVERS_MINIAUDIO_DRIVER_H 19 | 20 | #include 21 | 22 | #include 23 | 24 | namespace SparkyStudios::Audio::Amplitude 25 | { 26 | class MiniAudioDriver final : public Driver 27 | { 28 | public: 29 | MiniAudioDriver(); 30 | 31 | ~MiniAudioDriver() override; 32 | 33 | bool Open(const DeviceDescription& device) override; 34 | 35 | bool Close() override; 36 | 37 | bool EnumerateDevices(std::vector& devices) override; 38 | 39 | protected: 40 | friend void miniaudio_device_notification(const ma_device_notification* pNotification); 41 | 42 | private: 43 | bool _initialized; 44 | ma_device _device; 45 | 46 | ma_log_callback _logCallback; 47 | ma_log _log; 48 | 49 | ma_context _context; 50 | 51 | std::vector _devices; 52 | }; 53 | } // namespace SparkyStudios::Audio::Amplitude 54 | 55 | #endif // _AM_IMPLEMENTATION_CORE_DRIVERS_MINIAUDIO_DRIVER_H 56 | -------------------------------------------------------------------------------- /src/Core/Drivers/Null/Driver.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #ifndef _AM_IMPLEMENTATION_CORE_DRIVERS_NULL_DRIVER_H 18 | #define _AM_IMPLEMENTATION_CORE_DRIVERS_NULL_DRIVER_H 19 | 20 | #include 21 | 22 | namespace SparkyStudios::Audio::Amplitude 23 | { 24 | struct NullDriverDeviceData 25 | { 26 | AmUInt32 mOutputBufferSize; 27 | DeviceDescription mDeviceDescription; 28 | bool mRunning; 29 | }; 30 | 31 | class NullDriver final : public Driver 32 | { 33 | public: 34 | NullDriver(); 35 | 36 | ~NullDriver() override; 37 | 38 | bool Open(const DeviceDescription& device) override; 39 | 40 | bool Close() override; 41 | 42 | bool EnumerateDevices(std::vector& devices) override; 43 | 44 | private: 45 | bool _initialized; 46 | 47 | AmThreadHandle _thread; 48 | 49 | NullDriverDeviceData _deviceData; 50 | }; 51 | } // namespace SparkyStudios::Audio::Amplitude 52 | 53 | #endif // _AM_IMPLEMENTATION_CORE_DRIVERS_NULL_DRIVER_H 54 | -------------------------------------------------------------------------------- /src/Core/ListenerInternalState.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | 17 | namespace SparkyStudios::Audio::Amplitude 18 | { 19 | ListenerInternalState::ListenerInternalState() 20 | : _id(kAmInvalidObjectId) 21 | , _location() 22 | , _orientation(Orientation::Zero()) 23 | , _lastLocation() 24 | , _velocity() 25 | , _directivity(0.0f) 26 | , _directivitySharpness(1.0f) 27 | , _inverseMatrix(AM_M4D(1.0f)) 28 | , _playingSoundList(&ChannelInternalState::listener_node) 29 | {} 30 | 31 | void ListenerInternalState::SetLocation(const AmVec3& location) 32 | { 33 | _lastLocation = _location; 34 | _location = location; 35 | } 36 | 37 | void ListenerInternalState::SetDirectivity(AmReal32 directivity, AmReal32 sharpness) 38 | { 39 | _directivity = directivity; 40 | _directivitySharpness = sharpness; 41 | } 42 | 43 | void ListenerInternalState::Update() 44 | { 45 | _velocity = _location - _lastLocation; 46 | _inverseMatrix = _orientation.GetLookAtMatrix(_location); 47 | } 48 | } // namespace SparkyStudios::Audio::Amplitude 49 | -------------------------------------------------------------------------------- /src/Core/Playback/Bus.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | 17 | #include 18 | 19 | namespace SparkyStudios::Audio::Amplitude 20 | { 21 | Bus::Bus() 22 | : _state(nullptr) 23 | {} 24 | 25 | Bus::Bus(BusInternalState* state) 26 | : _state(state) 27 | {} 28 | 29 | void Bus::Clear() 30 | { 31 | _state = nullptr; 32 | } 33 | 34 | bool Bus::Valid() const 35 | { 36 | return _state != nullptr; 37 | } 38 | 39 | AmBusID Bus::GetId() const 40 | { 41 | return _state->GetId(); 42 | } 43 | 44 | const std::string& Bus::GetName() const 45 | { 46 | return _state->GetName(); 47 | } 48 | 49 | void Bus::SetGain(AmReal32 gain) const 50 | { 51 | return _state->SetUserGain(gain); 52 | } 53 | 54 | AmReal32 Bus::GetGain() const 55 | { 56 | return _state->GetUserGain(); 57 | } 58 | 59 | void Bus::FadeTo(AmReal32 gain, AmTime duration) const 60 | { 61 | _state->FadeTo(gain, duration); 62 | } 63 | 64 | AmReal32 Bus::GetFinalGain() const 65 | { 66 | return _state->GetGain(); 67 | } 68 | 69 | void Bus::SetMute(bool mute) const 70 | { 71 | _state->SetMute(mute); 72 | } 73 | 74 | bool Bus::IsMuted() const 75 | { 76 | return _state->IsMute(); 77 | } 78 | 79 | BusInternalState* Bus::GetState() const 80 | { 81 | return _state; 82 | } 83 | } // namespace SparkyStudios::Audio::Amplitude 84 | -------------------------------------------------------------------------------- /src/Core/Playback/ChannelEventListener.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | 17 | namespace SparkyStudios::Audio::Amplitude 18 | { 19 | ChannelEventInfo::ChannelEventInfo(ChannelInternalState* source) 20 | : m_source(source) 21 | , m_userData(nullptr) 22 | {} 23 | 24 | ChannelEventListener::ChannelEventListener() 25 | : _handlers() 26 | {} 27 | 28 | ChannelEventListener::~ChannelEventListener() 29 | { 30 | _handlers.clear(); 31 | } 32 | 33 | void ChannelEventListener::Add(const ChannelEventCallback& callback, void* userData) 34 | { 35 | AddInternal(callback, userData); 36 | } 37 | 38 | void ChannelEventListener::Call(ChannelInternalState* channel) 39 | { 40 | if (_handlers.empty()) 41 | return; 42 | 43 | ChannelEventInfo info(channel); 44 | 45 | for (auto& handler : _handlers) 46 | { 47 | info.m_userData = handler.m_userData; 48 | 49 | if (handler.m_callback) 50 | handler.m_callback(info); 51 | } 52 | } 53 | 54 | void ChannelEventListener::AddInternal(const ChannelEventCallback& callback, void* userData) 55 | { 56 | const HandlerInstance h = { callback, userData }; 57 | _handlers.push_back(h); 58 | } 59 | 60 | void ChannelEventListener::CleanLinks() 61 | { 62 | _handlers.clear(); 63 | } 64 | } // namespace SparkyStudios::Audio::Amplitude 65 | -------------------------------------------------------------------------------- /src/Core/Version.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | 17 | namespace SparkyStudios::Audio::Amplitude 18 | { 19 | /** 20 | * @brief String which identifies the current version of Amplitude. 21 | */ 22 | // clang-format off 23 | static const AmVersion kVersion = { 24 | AM_VERSION_MAJOR, 25 | AM_VERSION_MINOR, 26 | AM_VERSION_PATCH, 27 | "Amplitude Audio SDK " 28 | AM_TO_STRING(AM_VERSION_MAJOR) "." 29 | AM_TO_STRING(AM_VERSION_MINOR) "." 30 | AM_TO_STRING(AM_VERSION_PATCH) 31 | }; 32 | // clang-format on 33 | 34 | const AmVersion& GetVersion() 35 | { 36 | return kVersion; 37 | } 38 | } // namespace SparkyStudios::Audio::Amplitude -------------------------------------------------------------------------------- /src/DSP/FFT.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | #include 17 | 18 | #include 19 | 20 | using namespace SparkyStudios::Audio::Amplitude; 21 | 22 | namespace SparkyStudios::Audio::Amplitude 23 | { 24 | AmUInt64 FFT::GetOutputSize(const AmUInt64 inputSize) 25 | { 26 | return AudioFFT::ComplexSize(inputSize); 27 | } 28 | 29 | FFT::FFT() 30 | { 31 | _implementation = ampoolnew(eMemoryPoolKind_Filtering, AudioFFT); 32 | } 33 | 34 | FFT::~FFT() 35 | { 36 | ampooldelete(eMemoryPoolKind_Filtering, AudioFFT, (AudioFFT*)_implementation); 37 | } 38 | 39 | void FFT::Initialize(const AmSize size) const 40 | { 41 | static_cast(_implementation)->init(size); 42 | } 43 | 44 | void FFT::Forward(AmConstAudioSampleBuffer input, SplitComplex& splitComplex) const 45 | { 46 | splitComplex.Resize(GetOutputSize(static_cast(_implementation)->size())); 47 | static_cast(_implementation)->fft(input, splitComplex.re(), splitComplex.im()); 48 | } 49 | 50 | void FFT::Backward(AmAudioSampleBuffer output, SplitComplex& splitComplex) const 51 | { 52 | splitComplex.Resize(GetOutputSize(static_cast(_implementation)->size())); 53 | static_cast(_implementation)->ifft(output, splitComplex.re(), splitComplex.im()); 54 | } 55 | } // namespace SparkyStudios::Audio::Amplitude 56 | -------------------------------------------------------------------------------- /src/HRTF/HRTFContext.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #ifndef _AM_IMPLEMENTATION_HRTF_HRTF_CONTEXT_H 18 | #define _AM_IMPLEMENTATION_HRTF_HRTF_CONTEXT_H 19 | 20 | #include 21 | 22 | namespace SparkyStudios::Audio::Amplitude 23 | { 24 | struct HRTFContext 25 | { 26 | AmVec3 m_CurrentDirection = { 0.0f, 0.0f, 0.0f }; 27 | AmVec3 m_PreviousDirection = { 0.0f, 0.0f, 0.0f }; 28 | 29 | AmAlignedReal32Buffer m_PreviousSamplesL; 30 | AmAlignedReal32Buffer m_PreviousSamplesR; 31 | 32 | AmReal32 m_PreviousGain; 33 | AmReal32 m_CurrentGain; 34 | }; 35 | } // namespace SparkyStudios::Audio::Amplitude 36 | 37 | #endif // _AM_IMPLEMENTATION_HRTF_HRTF_CONTEXT_H -------------------------------------------------------------------------------- /src/IO/ConsoleLogger.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | 17 | #include 18 | 19 | namespace SparkyStudios::Audio::Amplitude 20 | { 21 | ConsoleLogger::ConsoleLogger(bool displayFileAndLine) 22 | : m_displayFileAndLine(displayFileAndLine) 23 | {} 24 | 25 | void ConsoleLogger::Log(eLogMessageLevel level, const char* file, int line, const AmString& message) 26 | { 27 | switch (level) 28 | { 29 | case eLogMessageLevel_Debug: 30 | std::cout << "[DEBUG] "; 31 | break; 32 | case eLogMessageLevel_Info: 33 | std::cout << "[INFO] "; 34 | break; 35 | case eLogMessageLevel_Warning: 36 | std::cout << "[WARNING] "; 37 | break; 38 | case eLogMessageLevel_Error: 39 | std::cout << "[ERROR] "; 40 | break; 41 | case eLogMessageLevel_Critical: 42 | std::cout << "[CRITICAL] "; 43 | break; 44 | case eLogMessageLevel_Success: 45 | std::cout << "[SUCCESS] "; 46 | break; 47 | } 48 | 49 | if (m_displayFileAndLine) 50 | std::cout << "(" << file << ":" << line << ") "; 51 | 52 | std::cout << message; 53 | 54 | if (message.back() != '\n') 55 | std::cout << std::endl; 56 | } 57 | } // namespace SparkyStudios::Audio::Amplitude -------------------------------------------------------------------------------- /src/IO/Log.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | 17 | namespace SparkyStudios::Audio::Amplitude 18 | { 19 | static Logger* gLogger = nullptr; 20 | 21 | void Logger::SetLogger(Logger* loggerInstance) 22 | { 23 | gLogger = loggerInstance; 24 | } 25 | 26 | Logger* Logger::GetLogger() 27 | { 28 | return gLogger; 29 | } 30 | 31 | void Logger::Debug(const char* file, int line, const AmString& message) 32 | { 33 | #ifdef AM_DEBUG 34 | Log(eLogMessageLevel_Debug, file, line, message); 35 | #endif 36 | } 37 | 38 | void Logger::Info(const char* file, int line, const AmString& message) 39 | { 40 | Log(eLogMessageLevel_Info, file, line, message); 41 | } 42 | 43 | void Logger::Warning(const char* file, int line, const AmString& message) 44 | { 45 | Log(eLogMessageLevel_Warning, file, line, message); 46 | } 47 | 48 | void Logger::Error(const char* file, int line, const AmString& message) 49 | { 50 | Log(eLogMessageLevel_Error, file, line, message); 51 | } 52 | 53 | void Logger::Critical(const char* file, int line, const AmString& message) 54 | { 55 | Log(eLogMessageLevel_Critical, file, line, message); 56 | } 57 | 58 | void Logger::Success(const char* file, int line, const AmString& message) 59 | { 60 | Log(eLogMessageLevel_Success, file, line, message); 61 | } 62 | } // namespace SparkyStudios::Audio::Amplitude 63 | -------------------------------------------------------------------------------- /src/IO/Resource.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #ifndef _AM_IMPLEMENTATION_IO_RESOURCE_H 18 | #define _AM_IMPLEMENTATION_IO_RESOURCE_H 19 | 20 | #include 21 | 22 | namespace SparkyStudios::Audio::Amplitude 23 | { 24 | class ResourceImpl : public Resource 25 | { 26 | public: 27 | /** 28 | * @copydoc Resource::GetPath 29 | */ 30 | [[nodiscard]] AM_INLINE const AmOsString& GetPath() const override 31 | { 32 | return m_filename; 33 | } 34 | 35 | protected: 36 | AmOsString m_filename; 37 | }; 38 | } // namespace SparkyStudios::Audio::Amplitude 39 | 40 | #endif // _AM_IMPLEMENTATION_IO_RESOURCE_H 41 | -------------------------------------------------------------------------------- /src/Math/Geometry.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | 17 | namespace SparkyStudios::Audio::Amplitude 18 | { 19 | bool Face::IsValid() const 20 | { 21 | return m_A != m_B && m_B != m_C && m_C != m_A; 22 | } 23 | 24 | bool Edge::operator<(const Edge& other) const 25 | { 26 | return m_E0 < other.m_E0 || (m_E0 == other.m_E0 && m_E1 < other.m_E1); 27 | } 28 | 29 | bool Edge::operator==(const Edge& other) const 30 | { 31 | return m_E0 == other.m_E0 && m_E1 == other.m_E1; 32 | } 33 | } -------------------------------------------------------------------------------- /src/Mixer/Nodes/AmbisonicMixerNode.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | 17 | namespace SparkyStudios::Audio::Amplitude 18 | { 19 | AmbisonicMixerNode::AmbisonicMixerNode() 20 | : Node("AmbisonicMixer") 21 | {} 22 | } // namespace SparkyStudios::Audio::Amplitude 23 | -------------------------------------------------------------------------------- /src/Mixer/Nodes/AmbisonicMixerNode.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #ifndef _AM_IMPLEMENTATION_MIXER_NODES_AMBISONIC_MIXER_NODE_H 18 | #define _AM_IMPLEMENTATION_MIXER_NODES_AMBISONIC_MIXER_NODE_H 19 | 20 | #include 21 | #include 22 | 23 | namespace SparkyStudios::Audio::Amplitude 24 | { 25 | class AmbisonicMixerNode final : public Node 26 | { 27 | public: 28 | AmbisonicMixerNode(); 29 | 30 | [[nodiscard]] AM_INLINE std::shared_ptr CreateInstance() const override 31 | { 32 | return AmSharedPtr::Make(); 33 | } 34 | 35 | [[nodiscard]] AM_INLINE bool CanConsume() const override 36 | { 37 | return true; 38 | } 39 | 40 | [[nodiscard]] AM_INLINE bool CanProduce() const override 41 | { 42 | return true; 43 | } 44 | 45 | [[nodiscard]] AM_INLINE AmSize GetMaxInputCount() const override 46 | { 47 | return -1; 48 | } 49 | 50 | [[nodiscard]] AM_INLINE AmSize GetMinInputCount() const override 51 | { 52 | return 1; 53 | } 54 | }; 55 | } // namespace SparkyStudios::Audio::Amplitude 56 | 57 | #endif // _AM_IMPLEMENTATION_MIXER_NODES_AMBISONIC_MIXER_NODE_H 58 | -------------------------------------------------------------------------------- /src/Mixer/Nodes/ClampNode.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | 17 | namespace SparkyStudios::Audio::Amplitude 18 | { 19 | ClampNodeInstance::ClampNodeInstance() 20 | : ProcessorNodeInstance(false) 21 | {} 22 | 23 | const AudioBuffer* ClampNodeInstance::Process(const AudioBuffer* input) 24 | { 25 | _output = *input; 26 | 27 | for (AmSize c = 0; c < _output.GetChannelCount(); c++) 28 | { 29 | const auto& inChannel = _output[c]; 30 | /* */ auto& outChannel = _output[c]; 31 | 32 | for (AmSize i = 0, l = _output.GetFrameCount(); i < l; i++) 33 | { 34 | const AmReal32& x = inChannel[i]; 35 | /* */ AmReal32& y = outChannel[i]; 36 | 37 | y = std::max(AM_AUDIO_SAMPLE_MIN, std::min(AM_AUDIO_SAMPLE_MAX, x)); 38 | } 39 | } 40 | 41 | return &_output; 42 | } 43 | 44 | ClampNode::ClampNode() 45 | : Node("Clamp") 46 | {} 47 | } // namespace SparkyStudios::Audio::Amplitude 48 | -------------------------------------------------------------------------------- /src/Mixer/Nodes/ClampNode.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #ifndef _AM_IMPLEMENTATION_MIXER_NODES_CLAMP_NODE_H 18 | #define _AM_IMPLEMENTATION_MIXER_NODES_CLAMP_NODE_H 19 | 20 | #include 21 | #include 22 | 23 | namespace SparkyStudios::Audio::Amplitude 24 | { 25 | class ClampNodeInstance final : public ProcessorNodeInstance 26 | { 27 | public: 28 | ClampNodeInstance(); 29 | 30 | const AudioBuffer* Process(const AudioBuffer* input) override; 31 | 32 | private: 33 | AudioBuffer _output; 34 | }; 35 | 36 | class ClampNode final : public Node 37 | { 38 | public: 39 | ClampNode(); 40 | 41 | [[nodiscard]] AM_INLINE std::shared_ptr CreateInstance() const override 42 | { 43 | return AmSharedPtr::Make(); 44 | } 45 | 46 | [[nodiscard]] AM_INLINE bool CanConsume() const override 47 | { 48 | return true; 49 | } 50 | 51 | [[nodiscard]] AM_INLINE bool CanProduce() const override 52 | { 53 | return true; 54 | } 55 | 56 | [[nodiscard]] AM_INLINE AmSize GetMaxInputCount() const override 57 | { 58 | return 1; 59 | } 60 | 61 | [[nodiscard]] AM_INLINE AmSize GetMinInputCount() const override 62 | { 63 | return 1; 64 | } 65 | }; 66 | } // namespace SparkyStudios::Audio::Amplitude 67 | 68 | #endif // _AM_IMPLEMENTATION_MIXER_NODES_CLAMP_NODE_H -------------------------------------------------------------------------------- /src/Mixer/Nodes/ClipNode.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | 17 | namespace SparkyStudios::Audio::Amplitude 18 | { 19 | ClipNodeInstance::ClipNodeInstance() 20 | : ProcessorNodeInstance(false) 21 | {} 22 | 23 | const AudioBuffer* ClipNodeInstance::Process(const AudioBuffer* input) 24 | { 25 | _output = *input; 26 | 27 | for (AmSize c = 0; c < _output.GetChannelCount(); c++) 28 | { 29 | const auto& inChannel = _output[c]; 30 | /* */ auto& outChannel = _output[c]; 31 | 32 | for (AmSize i = 0, l = _output.GetFrameCount(); i < l; i++) 33 | { 34 | const AmReal32& x = inChannel[i]; 35 | /* */ AmReal32& y = outChannel[i]; 36 | 37 | y = x <= -1.65f ? -0.9862875f : x >= 1.65f ? 0.9862875f : 0.87f * x - 0.1f * x * x * x; 38 | } 39 | } 40 | 41 | return &_output; 42 | } 43 | 44 | ClipNode::ClipNode() 45 | : Node("Clip") 46 | {} 47 | } // namespace SparkyStudios::Audio::Amplitude 48 | -------------------------------------------------------------------------------- /src/Mixer/Nodes/ClipNode.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #ifndef _AM_IMPLEMENTATION_MIXER_NODES_CLIP_NODE_H 18 | #define _AM_IMPLEMENTATION_MIXER_NODES_CLIP_NODE_H 19 | 20 | #include 21 | #include 22 | 23 | namespace SparkyStudios::Audio::Amplitude 24 | { 25 | class ClipNodeInstance final : public ProcessorNodeInstance 26 | { 27 | public: 28 | ClipNodeInstance(); 29 | 30 | const AudioBuffer* Process(const AudioBuffer* input) override; 31 | 32 | private: 33 | AudioBuffer _output; 34 | }; 35 | 36 | class ClipNode final : public Node 37 | { 38 | public: 39 | ClipNode(); 40 | 41 | [[nodiscard]] AM_INLINE std::shared_ptr CreateInstance() const override 42 | { 43 | return AmSharedPtr::Make(); 44 | } 45 | 46 | [[nodiscard]] AM_INLINE bool CanConsume() const override 47 | { 48 | return true; 49 | } 50 | 51 | [[nodiscard]] AM_INLINE bool CanProduce() const override 52 | { 53 | return true; 54 | } 55 | 56 | [[nodiscard]] AM_INLINE AmSize GetMaxInputCount() const override 57 | { 58 | return 1; 59 | } 60 | 61 | [[nodiscard]] AM_INLINE AmSize GetMinInputCount() const override 62 | { 63 | return 1; 64 | } 65 | }; 66 | } // namespace SparkyStudios::Audio::Amplitude 67 | 68 | #endif // _AM_IMPLEMENTATION_MIXER_NODES_CLIP_NODE_H -------------------------------------------------------------------------------- /src/Mixer/Nodes/InputNode.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | 17 | namespace SparkyStudios::Audio::Amplitude 18 | { 19 | InputNode::InputNode() 20 | : Node("Input") 21 | {} 22 | } // namespace SparkyStudios::Audio::Amplitude 23 | -------------------------------------------------------------------------------- /src/Mixer/Nodes/InputNode.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #ifndef _AM_IMPLEMENTATION_MIXER_NODES_INPUT_NODE_H 18 | #define _AM_IMPLEMENTATION_MIXER_NODES_INPUT_NODE_H 19 | 20 | #include 21 | #include 22 | 23 | namespace SparkyStudios::Audio::Amplitude 24 | { 25 | class InputNode final : public Node 26 | { 27 | public: 28 | InputNode(); 29 | 30 | [[nodiscard]] AM_INLINE std::shared_ptr CreateInstance() const override 31 | { 32 | return AmSharedPtr::Make(); 33 | } 34 | 35 | [[nodiscard]] AM_INLINE bool CanConsume() const override 36 | { 37 | return false; 38 | } 39 | 40 | [[nodiscard]] AM_INLINE bool CanProduce() const override 41 | { 42 | return true; 43 | } 44 | 45 | [[nodiscard]] AM_INLINE AmSize GetMaxInputCount() const override 46 | { 47 | return 0; 48 | } 49 | 50 | [[nodiscard]] AM_INLINE AmSize GetMinInputCount() const override 51 | { 52 | return 0; 53 | } 54 | }; 55 | } // namespace SparkyStudios::Audio::Amplitude 56 | 57 | #endif // _AM_IMPLEMENTATION_MIXER_NODES_INPUT_NODE_H 58 | -------------------------------------------------------------------------------- /src/Mixer/Nodes/OutputNode.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | 17 | namespace SparkyStudios::Audio::Amplitude 18 | { 19 | OutputNode::OutputNode() 20 | : Node("Output") 21 | {} 22 | } // namespace SparkyStudios::Audio::Amplitude 23 | -------------------------------------------------------------------------------- /src/Mixer/Nodes/OutputNode.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #ifndef _AM_IMPLEMENTATION_MIXER_NODES_OUTPUT_NODE_H 18 | #define _AM_IMPLEMENTATION_MIXER_NODES_OUTPUT_NODE_H 19 | 20 | #include 21 | #include 22 | 23 | namespace SparkyStudios::Audio::Amplitude 24 | { 25 | class OutputNode final : public Node 26 | { 27 | public: 28 | OutputNode(); 29 | 30 | [[nodiscard]] AM_INLINE std::shared_ptr CreateInstance() const override 31 | { 32 | return AmSharedPtr::Make(); 33 | } 34 | 35 | [[nodiscard]] AM_INLINE bool CanConsume() const override 36 | { 37 | return true; 38 | } 39 | 40 | [[nodiscard]] AM_INLINE bool CanProduce() const override 41 | { 42 | return false; 43 | } 44 | 45 | [[nodiscard]] AM_INLINE AmSize GetMaxInputCount() const override 46 | { 47 | return 1; 48 | } 49 | 50 | [[nodiscard]] AM_INLINE AmSize GetMinInputCount() const override 51 | { 52 | return 1; 53 | } 54 | }; 55 | } // namespace SparkyStudios::Audio::Amplitude 56 | 57 | #endif // _AM_IMPLEMENTATION_MIXER_NODES_OUTPUT_NODE_H 58 | -------------------------------------------------------------------------------- /src/Mixer/Nodes/StereoMixerNode.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | 17 | namespace SparkyStudios::Audio::Amplitude 18 | { 19 | StereoMixerNode::StereoMixerNode() 20 | : Node("StereoMixer") 21 | {} 22 | } // namespace SparkyStudios::Audio::Amplitude 23 | -------------------------------------------------------------------------------- /src/Mixer/Nodes/StereoMixerNode.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #ifndef _AM_IMPLEMENTATION_MIXER_NODES_STEREO_MIXER_NODE_H 18 | #define _AM_IMPLEMENTATION_MIXER_NODES_STEREO_MIXER_NODE_H 19 | 20 | #include 21 | #include 22 | 23 | namespace SparkyStudios::Audio::Amplitude 24 | { 25 | class StereoMixerNode final : public Node 26 | { 27 | public: 28 | StereoMixerNode(); 29 | 30 | [[nodiscard]] AM_INLINE std::shared_ptr CreateInstance() const override 31 | { 32 | return AmSharedPtr::Make(); 33 | } 34 | 35 | [[nodiscard]] AM_INLINE bool CanConsume() const override 36 | { 37 | return true; 38 | } 39 | 40 | [[nodiscard]] AM_INLINE bool CanProduce() const override 41 | { 42 | return true; 43 | } 44 | 45 | [[nodiscard]] AM_INLINE AmSize GetMaxInputCount() const override 46 | { 47 | return -1; 48 | } 49 | 50 | [[nodiscard]] AM_INLINE AmSize GetMinInputCount() const override 51 | { 52 | return 1; 53 | } 54 | }; 55 | } // namespace SparkyStudios::Audio::Amplitude 56 | 57 | #endif // _AM_IMPLEMENTATION_MIXER_NODES_STEREO_MIXER_NODE_H 58 | -------------------------------------------------------------------------------- /src/Mixer/Nodes/StereoPanningNode.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | namespace SparkyStudios::Audio::Amplitude 24 | { 25 | const AudioBuffer* StereoPanningNodeInstance::Process(const AudioBuffer* input) 26 | { 27 | const auto* layer = GetLayer(); 28 | 29 | const auto& listener = layer->GetListener(); 30 | if (!listener.Valid()) 31 | return nullptr; 32 | 33 | // Mono channels required for input 34 | AMPLITUDE_ASSERT(input->GetChannelCount() == 1); 35 | 36 | // Stereo channels for output 37 | _output = AudioBuffer(input->GetFrameCount(), 2); 38 | 39 | // Apply panning 40 | { 41 | constexpr AmReal32 kGain = 1.0f; 42 | const AmVec2 pannedGain = Gain::CalculateStereoPannedGain(kGain, layer->GetLocation(), listener.GetInverseMatrix()); 43 | 44 | Gain::ApplyReplaceConstantGain(pannedGain.Left, input->GetChannel(0), 0, _output[0], 0, _output.GetFrameCount()); 45 | Gain::ApplyReplaceConstantGain(pannedGain.Right, input->GetChannel(0), 0, _output[1], 0, _output.GetFrameCount()); 46 | } 47 | 48 | return &_output; 49 | } 50 | 51 | StereoPanningNode::StereoPanningNode() 52 | : Node("StereoPanning") 53 | {} 54 | } // namespace SparkyStudios::Audio::Amplitude 55 | -------------------------------------------------------------------------------- /src/Sound/Faders/ConstantFader.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #ifndef _AM_IMPLEMENTATION_SOUND_FADERS_CONSTANT_FADER_H 18 | #define _AM_IMPLEMENTATION_SOUND_FADERS_CONSTANT_FADER_H 19 | 20 | #include 21 | #include 22 | 23 | namespace SparkyStudios::Audio::Amplitude 24 | { 25 | constexpr BezierCurveControlPoints gConstantFaderCurveControlPoints = { 0.0f, 0.0f, 0.0f, 0.0f }; 26 | 27 | class ConstantFaderInstance final : public FaderInstance 28 | { 29 | public: 30 | ConstantFaderInstance() 31 | { 32 | m_curve = Transition(gConstantFaderCurveControlPoints); 33 | } 34 | }; 35 | 36 | class ConstantFader final : public Fader 37 | { 38 | public: 39 | ConstantFader() 40 | : Fader("Constant") 41 | {} 42 | 43 | std::shared_ptr CreateInstance() override 44 | { 45 | return AmSharedPtr::Make(); 46 | } 47 | 48 | void DestroyInstance(FaderInstance* instance) override 49 | { 50 | amdelete(ConstantFaderInstance, (ConstantFaderInstance*)instance); 51 | } 52 | 53 | [[nodiscard]] BezierCurveControlPoints GetControlPoints() const override 54 | { 55 | return gConstantFaderCurveControlPoints; 56 | } 57 | }; 58 | } // namespace SparkyStudios::Audio::Amplitude 59 | 60 | #endif // _AM_IMPLEMENTATION_SOUND_FADERS_CONSTANT_FADER_H 61 | -------------------------------------------------------------------------------- /src/Sound/Faders/EaseFader.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #ifndef _AM_IMPLEMENTATION_SOUND_FADERS_EASE_FADER_H 18 | #define _AM_IMPLEMENTATION_SOUND_FADERS_EASE_FADER_H 19 | 20 | #include 21 | #include 22 | 23 | namespace SparkyStudios::Audio::Amplitude 24 | { 25 | constexpr BezierCurveControlPoints gEaseFaderCurveControlPoints = { 0.25f, 0.1f, 0.25f, 1.0f }; 26 | 27 | class EaseFaderInstance final : public FaderInstance 28 | { 29 | public: 30 | EaseFaderInstance() 31 | { 32 | m_curve = Transition(gEaseFaderCurveControlPoints); 33 | } 34 | }; 35 | 36 | class EaseFader final : public Fader 37 | { 38 | public: 39 | EaseFader() 40 | : Fader("Ease") 41 | {} 42 | 43 | std::shared_ptr CreateInstance() override 44 | { 45 | return AmSharedPtr::Make(); 46 | } 47 | 48 | void DestroyInstance(FaderInstance* instance) override 49 | { 50 | amdelete(EaseFaderInstance, (EaseFaderInstance*)instance); 51 | } 52 | 53 | [[nodiscard]] BezierCurveControlPoints GetControlPoints() const override 54 | { 55 | return gEaseFaderCurveControlPoints; 56 | } 57 | }; 58 | } // namespace SparkyStudios::Audio::Amplitude 59 | 60 | #endif // _AM_IMPLEMENTATION_SOUND_FADERS_EASE_FADER_H 61 | -------------------------------------------------------------------------------- /src/Sound/Faders/EaseInFader.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #ifndef _AM_IMPLEMENTATION_SOUND_FADERS_EASE_IN_FADER_H 18 | #define _AM_IMPLEMENTATION_SOUND_FADERS_EASE_IN_FADER_H 19 | 20 | #include 21 | #include 22 | 23 | namespace SparkyStudios::Audio::Amplitude 24 | { 25 | constexpr BezierCurveControlPoints gEaseInFaderCurveControlPoints = { 0.42f, 0.0f, 1.0f, 1.0f }; 26 | 27 | class EaseInFaderInstance final : public FaderInstance 28 | { 29 | public: 30 | EaseInFaderInstance() 31 | { 32 | m_curve = Transition(gEaseInFaderCurveControlPoints); 33 | } 34 | }; 35 | 36 | class EaseInFader final : public Fader 37 | { 38 | public: 39 | EaseInFader() 40 | : Fader("EaseIn") 41 | {} 42 | 43 | std::shared_ptr CreateInstance() override 44 | { 45 | return AmSharedPtr::Make(); 46 | } 47 | 48 | void DestroyInstance(FaderInstance* instance) override 49 | { 50 | amdelete(EaseInFaderInstance, (EaseInFaderInstance*)instance); 51 | } 52 | 53 | [[nodiscard]] BezierCurveControlPoints GetControlPoints() const override 54 | { 55 | return gEaseInFaderCurveControlPoints; 56 | } 57 | }; 58 | } // namespace SparkyStudios::Audio::Amplitude 59 | 60 | #endif // _AM_IMPLEMENTATION_SOUND_FADERS_EASE_IN_FADER_H 61 | -------------------------------------------------------------------------------- /src/Sound/Faders/EaseInOutFader.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #ifndef _AM_IMPLEMENTATION_SOUND_FADERS_EASE_INOUT_FADER_H 18 | #define _AM_IMPLEMENTATION_SOUND_FADERS_EASE_INOUT_FADER_H 19 | 20 | #include 21 | #include 22 | 23 | namespace SparkyStudios::Audio::Amplitude 24 | { 25 | constexpr BezierCurveControlPoints gEaseInOutFaderCurveControlPoints = { 0.42f, 0.0f, 0.58f, 1.0f }; 26 | 27 | class EaseInOutFaderInstance final : public FaderInstance 28 | { 29 | public: 30 | EaseInOutFaderInstance() 31 | { 32 | m_curve = Transition(gEaseInOutFaderCurveControlPoints); 33 | } 34 | }; 35 | 36 | class EaseInOutFader final : public Fader 37 | { 38 | public: 39 | EaseInOutFader() 40 | : Fader("EaseInOut") 41 | {} 42 | 43 | std::shared_ptr CreateInstance() override 44 | { 45 | return AmSharedPtr::Make(); 46 | } 47 | 48 | void DestroyInstance(FaderInstance* instance) override 49 | { 50 | amdelete(EaseInOutFaderInstance, (EaseInOutFaderInstance*)instance); 51 | } 52 | 53 | [[nodiscard]] BezierCurveControlPoints GetControlPoints() const override 54 | { 55 | return gEaseInOutFaderCurveControlPoints; 56 | } 57 | }; 58 | } // namespace SparkyStudios::Audio::Amplitude 59 | 60 | #endif // _AM_IMPLEMENTATION_SOUND_FADERS_EASE_INOUT_FADER_H 61 | -------------------------------------------------------------------------------- /src/Sound/Faders/EaseOutFader.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #ifndef _AM_IMPLEMENTATION_SOUND_FADERS_EASE_OUT_FADER_H 18 | #define _AM_IMPLEMENTATION_SOUND_FADERS_EASE_OUT_FADER_H 19 | 20 | #include 21 | #include 22 | 23 | namespace SparkyStudios::Audio::Amplitude 24 | { 25 | constexpr BezierCurveControlPoints gEaseOutFaderCurveControlPoints = { 0.0f, 0.0f, 0.58f, 1.0f }; 26 | 27 | class EaseOutFaderInstance final : public FaderInstance 28 | { 29 | public: 30 | EaseOutFaderInstance() 31 | { 32 | m_curve = Transition(gEaseOutFaderCurveControlPoints); 33 | } 34 | }; 35 | 36 | class EaseOutFader final : public Fader 37 | { 38 | public: 39 | EaseOutFader() 40 | : Fader("EaseOut") 41 | {} 42 | 43 | std::shared_ptr CreateInstance() override 44 | { 45 | return AmSharedPtr::Make(); 46 | } 47 | 48 | void DestroyInstance(FaderInstance* instance) override 49 | { 50 | amdelete(EaseOutFaderInstance, (EaseOutFaderInstance*)instance); 51 | } 52 | 53 | [[nodiscard]] BezierCurveControlPoints GetControlPoints() const override 54 | { 55 | return gEaseOutFaderCurveControlPoints; 56 | } 57 | }; 58 | } // namespace SparkyStudios::Audio::Amplitude 59 | 60 | #endif // _AM_IMPLEMENTATION_SOUND_FADERS_EASE_OUT_FADER_H 61 | -------------------------------------------------------------------------------- /src/Sound/Faders/ExponentialFader.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #ifndef _AM_IMPLEMENTATION_SOUND_FADERS_EXPONENTIAL_FADER_H 18 | #define _AM_IMPLEMENTATION_SOUND_FADERS_EXPONENTIAL_FADER_H 19 | 20 | #include 21 | #include 22 | 23 | namespace SparkyStudios::Audio::Amplitude 24 | { 25 | constexpr BezierCurveControlPoints gExponentialFaderCurveControlPoints = { 1.0f, 0.0f, 1.0f, 1.0f }; 26 | 27 | class ExponentialFaderInstance final : public FaderInstance 28 | { 29 | public: 30 | ExponentialFaderInstance() 31 | { 32 | m_curve = Transition(gExponentialFaderCurveControlPoints); 33 | } 34 | }; 35 | 36 | class ExponentialFader final : public Fader 37 | { 38 | public: 39 | ExponentialFader() 40 | : Fader("Exponential") 41 | {} 42 | 43 | std::shared_ptr CreateInstance() override 44 | { 45 | return AmSharedPtr::Make(); 46 | } 47 | 48 | void DestroyInstance(FaderInstance* instance) override 49 | { 50 | amdelete(ExponentialFaderInstance, (ExponentialFaderInstance*)instance); 51 | } 52 | 53 | [[nodiscard]] BezierCurveControlPoints GetControlPoints() const override 54 | { 55 | return gExponentialFaderCurveControlPoints; 56 | } 57 | }; 58 | } // namespace SparkyStudios::Audio::Amplitude 59 | 60 | #endif // _AM_IMPLEMENTATION_SOUND_FADERS_EXPONENTIAL_FADER_H 61 | -------------------------------------------------------------------------------- /src/Sound/Faders/LinearFader.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #ifndef _AM_IMPLEMENTATION_SOUND_FADERS_LINEAR_FADER_H 18 | #define _AM_IMPLEMENTATION_SOUND_FADERS_LINEAR_FADER_H 19 | 20 | #include 21 | #include 22 | 23 | namespace SparkyStudios::Audio::Amplitude 24 | { 25 | constexpr BezierCurveControlPoints gLinearFaderCurveControlPoints = { 0.0f, 0.0f, 1.0f, 1.0f }; 26 | 27 | class LinearFaderInstance final : public FaderInstance 28 | { 29 | public: 30 | LinearFaderInstance() 31 | { 32 | m_curve = Transition(gLinearFaderCurveControlPoints); 33 | } 34 | }; 35 | 36 | class LinearFader final : public Fader 37 | { 38 | public: 39 | LinearFader() 40 | : Fader("Linear") 41 | {} 42 | 43 | std::shared_ptr CreateInstance() override 44 | { 45 | return AmSharedPtr::Make(); 46 | } 47 | 48 | void DestroyInstance(FaderInstance* instance) override 49 | { 50 | amdelete(LinearFaderInstance, (LinearFaderInstance*)instance); 51 | } 52 | 53 | [[nodiscard]] BezierCurveControlPoints GetControlPoints() const override 54 | { 55 | return gLinearFaderCurveControlPoints; 56 | } 57 | }; 58 | } // namespace SparkyStudios::Audio::Amplitude 59 | 60 | #endif // _AM_IMPLEMENTATION_SOUND_FADERS_LINEAR_FADER_H 61 | -------------------------------------------------------------------------------- /src/Sound/RefCounter.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | 17 | #include 18 | 19 | namespace SparkyStudios::Audio::Amplitude 20 | { 21 | AmInt32 RefCounter::Increment() 22 | { 23 | return ++_count; 24 | } 25 | 26 | AmInt32 RefCounter::Decrement() 27 | { 28 | return (_count >= 1) ? --_count : 0; 29 | } 30 | } // namespace SparkyStudios::Audio::Amplitude -------------------------------------------------------------------------------- /src/Sound/Schedulers/RandomScheduler.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #ifndef _AM_IMPLEMENTATION_SCHEDULERS_RANDOM_SCHEDULER_H 18 | #define _AM_IMPLEMENTATION_SCHEDULERS_RANDOM_SCHEDULER_H 19 | 20 | #include 21 | 22 | namespace SparkyStudios::Audio::Amplitude 23 | { 24 | struct RandomSoundSchedulerConfig; 25 | 26 | class RandomScheduler final : public Scheduler 27 | { 28 | public: 29 | RandomScheduler(); 30 | explicit RandomScheduler(const RandomSoundSchedulerConfig* config); 31 | 32 | [[nodiscard]] bool Valid() const override; 33 | void Init(const CollectionDefinition* definition) override; 34 | Sound* Select(const std::vector& toSkip) override; 35 | void Reset() override; 36 | 37 | private: 38 | AmReal32 _probabilitiesSum; 39 | const CollectionDefinition* _definition; 40 | const RandomSoundSchedulerConfig* _config; 41 | std::vector _avoidRepeatStack; 42 | std::vector _sounds; 43 | }; 44 | } // namespace SparkyStudios::Audio::Amplitude 45 | 46 | #endif // _AM_IMPLEMENTATION_SCHEDULERS_RANDOM_SCHEDULER_H 47 | -------------------------------------------------------------------------------- /src/Sound/Schedulers/SequenceScheduler.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #ifndef _AM_IMPLEMENTATION_SCHEDULERS_CONSECUTIVE_SCHEDULER_H 18 | #define _AM_IMPLEMENTATION_SCHEDULERS_CONSECUTIVE_SCHEDULER_H 19 | 20 | #include 21 | 22 | #include 23 | 24 | namespace SparkyStudios::Audio::Amplitude 25 | { 26 | struct SequenceSoundSchedulerConfig; 27 | 28 | class SequenceScheduler final : public Scheduler 29 | { 30 | public: 31 | SequenceScheduler(); 32 | explicit SequenceScheduler(const SequenceSoundSchedulerConfig* config); 33 | 34 | [[nodiscard]] bool Valid() const override; 35 | void Init(const CollectionDefinition* definition) override; 36 | Sound* Select(const std::vector& toSkip) override; 37 | void Reset() override; 38 | 39 | private: 40 | AmInt32 _nextIndex; 41 | AmInt32 _step; 42 | const CollectionDefinition* _definition; 43 | const SequenceSoundSchedulerConfig* _config; 44 | std::vector _sounds; 45 | }; 46 | } // namespace SparkyStudios::Audio::Amplitude 47 | 48 | #endif // _AM_IMPLEMENTATION_SCHEDULERS_CONSECUTIVE_SCHEDULER_H 49 | -------------------------------------------------------------------------------- /src/Sound/SoundObject.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | namespace SparkyStudios::Audio::Amplitude 20 | { 21 | const Effect* SoundObjectImpl::GetEffect() const 22 | { 23 | return m_effect; 24 | } 25 | 26 | const Attenuation* SoundObjectImpl::GetAttenuation() const 27 | { 28 | return m_attenuation; 29 | } 30 | } // namespace SparkyStudios::Audio::Amplitude 31 | -------------------------------------------------------------------------------- /src/Utils/Freeverb/AllPass.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | // Based on code written by Jezar at Dreampoint, June 2000 http://www.dreampoint.co.uk, 16 | // which was placed in public domain. 17 | 18 | #include "AllPass.h" 19 | 20 | namespace Freeverb 21 | { 22 | AllPass::AllPass() 23 | { 24 | _bufferIndex = 0; 25 | } 26 | 27 | void AllPass::SetBuffer(AmReal32Buffer buf, AmInt32 size) 28 | { 29 | _buffer = buf; 30 | _bufferSize = size; 31 | } 32 | 33 | void AllPass::Mute() 34 | { 35 | for (AmInt32 i = 0; i < _bufferSize; i++) 36 | _buffer[i] = 0; 37 | } 38 | 39 | void AllPass::SetFeedback(AmReal32 val) 40 | { 41 | _feedback = val; 42 | } 43 | 44 | AmReal32 AllPass::GetFeedback() 45 | { 46 | return _feedback; 47 | } 48 | } // namespace Freeverb 49 | -------------------------------------------------------------------------------- /src/Utils/Freeverb/AllPass.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | // Based on code written by Jezar at Dreampoint, June 2000 http://www.dreampoint.co.uk, 16 | // which was placed in public domain. 17 | 18 | #pragma once 19 | 20 | #ifndef SS_AMPLITUDE_AUDIO_ALLPASS_H 21 | #define SS_AMPLITUDE_AUDIO_ALLPASS_H 22 | 23 | #include 24 | 25 | #include "denormals.h" 26 | 27 | using namespace SparkyStudios::Audio::Amplitude; 28 | 29 | namespace Freeverb 30 | { 31 | class AllPass 32 | { 33 | public: 34 | AllPass(); 35 | 36 | void SetBuffer(AmReal32Buffer buffer, AmInt32 size); 37 | AM_INLINE AmReal32 Process(AmReal32 input); 38 | void Mute(); 39 | void SetFeedback(AmReal32 value); 40 | AmReal32 GetFeedback(); 41 | 42 | private: 43 | AmReal32 _feedback; 44 | AmReal32Buffer _buffer; 45 | AmInt32 _bufferSize; 46 | AmInt32 _bufferIndex; 47 | }; 48 | 49 | // Big to inline - but crucial for speed 50 | 51 | AM_INLINE AmReal32 AllPass::Process(AmReal32 input) 52 | { 53 | AmReal32 output; 54 | AmReal32 bufout; 55 | 56 | bufout = _buffer[_bufferIndex]; 57 | undenormalise(bufout); 58 | 59 | output = -input + bufout; 60 | _buffer[_bufferIndex] = input + (bufout * _feedback); 61 | 62 | if (++_bufferIndex >= _bufferSize) 63 | _bufferIndex = 0; 64 | 65 | return output; 66 | } 67 | } // namespace Freeverb 68 | 69 | #endif // SS_AMPLITUDE_AUDIO_ALLPASS_H 70 | -------------------------------------------------------------------------------- /src/Utils/Freeverb/Comb.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | // Based on code written by Jezar at Dreampoint, June 2000 http://www.dreampoint.co.uk, 16 | // which was placed in public domain. 17 | 18 | #include "Comb.h" 19 | 20 | namespace Freeverb 21 | { 22 | Comb::Comb() 23 | { 24 | _filterStore = 0; 25 | _bufferIndex = 0; 26 | } 27 | 28 | void Comb::SetBuffer(AmReal32Buffer buf, AmInt32 size) 29 | { 30 | _buffer = buf; 31 | _bufferSize = size; 32 | } 33 | 34 | void Comb::Mute() 35 | { 36 | for (AmInt32 i = 0; i < _bufferSize; i++) 37 | _buffer[i] = 0; 38 | } 39 | 40 | void Comb::SetDamp(AmReal32 val) 41 | { 42 | _damp1 = val; 43 | _damp2 = 1 - val; 44 | } 45 | 46 | AmReal32 Comb::GetDamp() 47 | { 48 | return _damp1; 49 | } 50 | 51 | void Comb::SetFeedback(AmReal32 val) 52 | { 53 | _feedback = val; 54 | } 55 | 56 | AmReal32 Comb::GetFeedback() 57 | { 58 | return _feedback; 59 | } 60 | } // namespace Freeverb -------------------------------------------------------------------------------- /src/Utils/Freeverb/denormals.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // 15 | // Based on code written by Jezar at Dreampoint, June 2000 http://www.dreampoint.co.uk, 16 | // which was placed in public domain. 17 | 18 | #pragma once 19 | 20 | #ifndef SS_AMPLITUDE_AUDIO_DENORMALS_H 21 | #define SS_AMPLITUDE_AUDIO_DENORMALS_H 22 | 23 | #define undenormalise(sample) \ 24 | if (((*(unsigned int*)&sample) & 0x7f800000) == 0) \ 25 | sample = 0.0f 26 | 27 | #endif // SS_AMPLITUDE_AUDIO_DENORMALS_H 28 | -------------------------------------------------------------------------------- /src/Utils/SmMalloc/smmalloc_tls.cpp: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2017-2023 Sergey Makeev 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | #include "smmalloc.h" 23 | 24 | thread_local sm::internal::TlsPoolBucket tlsCacheBuckets[SMM_MAX_BUCKET_COUNT]; 25 | // sm::internal::TlsPoolBucket tlsCacheBuckets[SMM_MAX_BUCKET_COUNT]; 26 | 27 | namespace sm 28 | { 29 | 30 | sm::internal::TlsPoolBucket* GetTlsBucket(size_t index) { return &tlsCacheBuckets[index]; } 31 | 32 | } // namespace sm 33 | -------------------------------------------------------------------------------- /src/Utils/lebedev-quadrature/lebedev_quadrature.hpp: -------------------------------------------------------------------------------- 1 | #ifndef LEBEDEV_QUADRATURE_HPP 2 | #define LEBEDEV_QUADRATURE_HPP 3 | 4 | #ifndef LEBEDEV_HEADER_ONLY 5 | #define LEBEDEV_HEADER_ONLY 1 6 | #endif 7 | 8 | #include "quadrature_points.hpp" 9 | #include "quadrature_order.hpp" 10 | #include "generator_point.hpp" 11 | 12 | #if LEBEDEV_HEADER_ONLY || LEBEDEV_IMPLEMENTATION 13 | 14 | #include "quadrature_points.inl" 15 | #include "quadrature_order.inl" 16 | #include "generator_point.inl" 17 | 18 | #endif 19 | 20 | #endif -------------------------------------------------------------------------------- /src/Utils/lebedev-quadrature/preprocessor.hpp: -------------------------------------------------------------------------------- 1 | #ifndef LEBEDEV_PREPROCESSOR_HPP 2 | #define LEBEDEV_PREPROCESSOR_HPP 3 | 4 | #if LEBEDEV_HEADER_ONLY 5 | #define LEBEDEV_EXTERNAL_LINKAGE inline 6 | #define LEBEDEV_INTERNAL_LINKAGE inline 7 | #else 8 | #define LEBEDEV_EXTERNAL_LINKAGE 9 | #define LEBEDEV_INTERNAL_LINKAGE static 10 | #endif 11 | 12 | #endif -------------------------------------------------------------------------------- /src/Utils/miniaudio/miniaudio.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | 17 | #define MA_IMPLEMENTATION 18 | 19 | #include "miniaudio_utils.h" 20 | 21 | ma_format ma_format_from_amplitude(SparkyStudios::Audio::Amplitude::PlaybackOutputFormat format) 22 | { 23 | switch (format) 24 | { 25 | default: 26 | return ma_format_unknown; 27 | case SparkyStudios::Audio::Amplitude::PlaybackOutputFormat::UInt8: 28 | return ma_format_u8; 29 | case SparkyStudios::Audio::Amplitude::PlaybackOutputFormat::Int16: 30 | return ma_format_s16; 31 | case SparkyStudios::Audio::Amplitude::PlaybackOutputFormat::Int24: 32 | return ma_format_s24; 33 | case SparkyStudios::Audio::Amplitude::PlaybackOutputFormat::Int32: 34 | return ma_format_s32; 35 | case SparkyStudios::Audio::Amplitude::PlaybackOutputFormat::Float32: 36 | return ma_format_f32; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Utils/miniaudio/miniaudio_utils.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #ifndef SS_AMPLITUDE_MINIAUDIO_UTILS_H 18 | #define SS_AMPLITUDE_MINIAUDIO_UTILS_H 19 | 20 | #include 21 | 22 | #define MA_NO_DECODING 23 | #define MA_NO_ENCODING 24 | #define MA_NO_RESOURCE_MANAGER 25 | #define MA_NO_NODE_GRAPH 26 | #define MA_NO_ENGINE 27 | #define MA_USE_STDINT 28 | 29 | #if !defined(NOMINMAX) 30 | #define NOMINMAX 31 | #endif 32 | 33 | #if defined(AM_SIMD_ARCH_AVX2) 34 | #define MA_SUPPORT_AVX2 35 | #define MA_PREFER_AVX2 36 | #elif defined(AM_SIMD_ARCH_AVX) 37 | #define MA_SUPPORT_AVX 38 | #define MA_PREFER_AVX 39 | #elif defined(AM_SIMD_ARCH_SSE2) 40 | #define MA_SUPPORT_SSE2 41 | #define MA_PREFER_SSE2 42 | #elif defined(AM_SIMD_ARCH_NEON) 43 | #define MA_SUPPORT_NEON 44 | #define MA_PREFER_NEON 45 | #endif 46 | 47 | #include 48 | 49 | ma_format ma_format_from_amplitude(SparkyStudios::Audio::Amplitude::PlaybackOutputFormat format); 50 | 51 | #endif /* SS_AMPLITUDE_MINIAUDIO_UTILS_H */ 52 | -------------------------------------------------------------------------------- /src/Utils/pffft/pffft_common.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "pffft.h" 3 | 4 | #include 5 | 6 | /* SSE and co like 16-bytes aligned pointers 7 | * with a 64-byte alignment, we are even aligned on L2 cache lines... */ 8 | #define MALLOC_V4SF_ALIGNMENT 64 9 | 10 | static void * Valigned_malloc(size_t nb_bytes) { 11 | void *p, *p0 = malloc(nb_bytes + MALLOC_V4SF_ALIGNMENT); 12 | if (!p0) return (void *) 0; 13 | p = (void *) (((size_t) p0 + MALLOC_V4SF_ALIGNMENT) & (~((size_t) (MALLOC_V4SF_ALIGNMENT-1)))); 14 | *((void **) p - 1) = p0; 15 | return p; 16 | } 17 | 18 | static void Valigned_free(void *p) { 19 | if (p) free(*((void **) p - 1)); 20 | } 21 | 22 | 23 | static int next_power_of_two(int N) { 24 | /* https://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2 */ 25 | /* compute the next highest power of 2 of 32-bit v */ 26 | unsigned v = N; 27 | v--; 28 | v |= v >> 1; 29 | v |= v >> 2; 30 | v |= v >> 4; 31 | v |= v >> 8; 32 | v |= v >> 16; 33 | v++; 34 | return v; 35 | } 36 | 37 | static int is_power_of_two(int N) { 38 | /* https://graphics.stanford.edu/~seander/bithacks.html#DetermineIfPowerOf2 */ 39 | int f = N && !(N & (N - 1)); 40 | return f; 41 | } 42 | 43 | 44 | extern "C" { 45 | void *pffft_aligned_malloc(size_t nb_bytes) { return Valigned_malloc(nb_bytes); } 46 | void pffft_aligned_free(void *p) { Valigned_free(p); } 47 | int pffft_next_power_of_two(int N) { return next_power_of_two(N); } 48 | int pffft_is_power_of_two(int N) { return is_power_of_two(N); } 49 | 50 | void *pffftd_aligned_malloc(size_t nb_bytes) { return Valigned_malloc(nb_bytes); } 51 | void pffftd_aligned_free(void *p) { Valigned_free(p); } 52 | int pffftd_next_power_of_two(int N) { return next_power_of_two(N); } 53 | int pffftd_is_power_of_two(int N) { return is_power_of_two(N); } 54 | } -------------------------------------------------------------------------------- /tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | cmake_minimum_required(VERSION 3.10) 16 | 17 | set(PROJECT_NAME ss_amplitude_audio_tests) 18 | 19 | project(${PROJECT_NAME}) 20 | 21 | find_package(Catch2 CONFIG REQUIRED) 22 | add_executable(${PROJECT_NAME} 23 | main.cpp 24 | version.cpp 25 | filesystem.cpp 26 | assets.cpp 27 | thread.cpp 28 | listener.cpp 29 | entity.cpp 30 | environment.cpp 31 | common.cpp 32 | math.cpp 33 | room.cpp 34 | shape.cpp 35 | zone.cpp 36 | audio_buffer.cpp 37 | pipeline.cpp 38 | fader.cpp 39 | hrtf.cpp 40 | engine.cpp 41 | ) 42 | target_link_libraries(${PROJECT_NAME} PRIVATE Catch2::Catch2 Static) 43 | 44 | add_custom_target(ss_amplitude_audio_test_package 45 | COMMAND $ -q -c 0 "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/samples/assets" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/samples/assets.ampk" 46 | WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} 47 | ) 48 | 49 | add_dependencies(ss_amplitude_audio_test_package 50 | ampk 51 | ss_amplitude_audio_sample_project 52 | ) 53 | 54 | add_dependencies(${PROJECT_NAME} 55 | Static 56 | ss_amplitude_audio_test_package 57 | ampk 58 | ) 59 | 60 | include(Catch) 61 | catch_discover_tests(${PROJECT_NAME} 62 | WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} 63 | ) 64 | 65 | target_compile_definitions( 66 | ${PROJECT_NAME} 67 | PRIVATE 68 | AM_SDK_PLATFORM="${VCPKG_TARGET_TRIPLET}" 69 | AM_SDK_PATH="$ENV{AM_SDK_PATH}" 70 | ) 71 | -------------------------------------------------------------------------------- /tests/assets.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | 17 | #include 18 | 19 | #include 20 | #include 21 | 22 | using namespace SparkyStudios::Audio::Amplitude; 23 | 24 | TEST_CASE("Attenuation Asset Tests", "[attenuation][assets][amplitude]") 25 | { 26 | DiskFileSystem fs; 27 | fs.SetBasePath(AM_OS_STRING("./samples/assets")); 28 | 29 | AttenuationImpl attenuation; 30 | attenuation.LoadDefinitionFromFile(fs.OpenFile(AM_OS_STRING("attenuators/impact.amattenuation"), eFileOpenMode_Read), nullptr); 31 | 32 | REQUIRE(attenuation.GetDefinition() != nullptr); 33 | REQUIRE(attenuation.GetId() == 1); 34 | REQUIRE(attenuation.GetName() == "impact"); 35 | REQUIRE(attenuation.GetMaxDistance() == 1280); 36 | REQUIRE_FALSE(attenuation.IsAirAbsorptionEnabled()); 37 | REQUIRE(dynamic_cast(attenuation.GetShape()) != nullptr); 38 | } -------------------------------------------------------------------------------- /tests/version.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | 17 | #include 18 | 19 | using namespace SparkyStudios::Audio::Amplitude; 20 | 21 | TEST_CASE("Version Tests", "[version][amplitude]") 22 | { 23 | const auto& version = amVersion; 24 | 25 | SECTION("have the correct major version number") 26 | { 27 | REQUIRE(version.major == AM_VERSION_MAJOR); 28 | } 29 | 30 | SECTION("have the correct minor version number") 31 | { 32 | REQUIRE(version.minor == AM_VERSION_MINOR); 33 | } 34 | 35 | SECTION("have the correct patch version number") 36 | { 37 | REQUIRE(version.revision == AM_VERSION_PATCH); 38 | } 39 | 40 | SECTION("have the correct version string") 41 | { 42 | REQUIRE(version.text == "Amplitude Audio SDK " AM_TO_STRING(AM_VERSION_MAJOR) "." AM_TO_STRING(AM_VERSION_MINOR) "." AM_TO_STRING(AM_VERSION_PATCH)); 43 | } 44 | } -------------------------------------------------------------------------------- /tools/amac/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | cmake_minimum_required(VERSION 3.20) 16 | 17 | project(amac) 18 | 19 | set(AMC_SRC 20 | main.cpp 21 | ) 22 | 23 | add_executable(amac ${AMC_SRC}) 24 | 25 | target_link_libraries(amac 26 | Static 27 | ) 28 | 29 | add_dependencies(amac 30 | Static 31 | ) 32 | 33 | install( 34 | TARGETS amac 35 | RUNTIME DESTINATION ${AM_BIN_DESTINATION} 36 | ) 37 | -------------------------------------------------------------------------------- /tools/amir/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2024-present Sparky Studios. All rights reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | cmake_minimum_required(VERSION 3.20) 16 | 17 | project(amir) 18 | 19 | find_package(mysofa CONFIG REQUIRED) 20 | 21 | add_executable(amir main.cpp convhull_3d.h) 22 | 23 | target_link_libraries(amir 24 | PRIVATE 25 | Static $,mysofa::mysofa-shared,mysofa::mysofa-static> 26 | ) 27 | 28 | add_dependencies(amir 29 | Static 30 | ) 31 | 32 | install( 33 | TARGETS amir 34 | RUNTIME DESTINATION ${AM_BIN_DESTINATION} 35 | ) 36 | -------------------------------------------------------------------------------- /tools/ampk/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2024-present Sparky Studios. All rights reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | cmake_minimum_required(VERSION 3.20) 16 | 17 | project(ampk) 18 | 19 | add_executable(ampk main.cpp) 20 | 21 | target_link_libraries(ampk 22 | Static 23 | ) 24 | 25 | add_dependencies(ampk 26 | Static 27 | ) 28 | 29 | install( 30 | TARGETS ampk 31 | RUNTIME DESTINATION ${AM_BIN_DESTINATION} 32 | ) 33 | -------------------------------------------------------------------------------- /tools/ampm/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021-present Sparky Studios. All rights reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | cmake_minimum_required(VERSION 3.20) 16 | 17 | project(ampm) 18 | 19 | find_package(CLI11 CONFIG REQUIRED) 20 | find_package(CMakeRC CONFIG REQUIRED) 21 | 22 | file(GLOB_RECURSE AMPM_RES 23 | "${CMAKE_CURRENT_SOURCE_DIR}/resources/*.*" 24 | ) 25 | 26 | cmrc_add_resource_library( 27 | ampm-resources 28 | 29 | ALIAS ampm::rc 30 | NAMESPACE ampm 31 | 32 | ${AMPM_RES} 33 | ) 34 | 35 | set(AMPM_SRC 36 | main.cpp 37 | ) 38 | 39 | add_executable(ampm ${AMPM_SRC}) 40 | 41 | target_link_libraries(ampm 42 | PUBLIC ampm::rc 43 | PRIVATE Static CLI11::CLI11 44 | ) 45 | 46 | add_dependencies(ampm 47 | Static 48 | ) 49 | 50 | install( 51 | TARGETS ampm 52 | RUNTIME DESTINATION ${AM_BIN_DESTINATION} 53 | ) 54 | -------------------------------------------------------------------------------- /tools/ampm/resources/default.buses.json: -------------------------------------------------------------------------------- 1 | { 2 | "buses": [ 3 | { 4 | "id": 1, 5 | "name": "master", 6 | "gain": 1.0, 7 | "child_buses": [ 8 | 2, 9 | 3 10 | ], 11 | "fader": "Linear" 12 | }, 13 | { 14 | "id": 2, 15 | "name": "voices", 16 | "gain": 1, 17 | "duck_buses": [ 18 | { 19 | "id": 3, 20 | "target_gain": 0.25, 21 | "fade_in": { 22 | "duration": 3, 23 | "fader": "SCurveSmooth" 24 | }, 25 | "fade_out": { 26 | "duration": 3, 27 | "fader": "Linear" 28 | } 29 | } 30 | ], 31 | "fader": "Linear" 32 | }, 33 | { 34 | "id": 3, 35 | "name": "environment", 36 | "gain": 0.75, 37 | "fader": "Linear" 38 | } 39 | ] 40 | } -------------------------------------------------------------------------------- /tools/ampm/resources/default.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "driver": "miniaudio", 3 | "output": { 4 | "frequency": 48000, 5 | "buffer_size": 4096, 6 | "format": "Float32" 7 | }, 8 | "mixer": { 9 | "panning_mode": "Stereo", 10 | "active_channels": 50, 11 | "virtual_channels": 100, 12 | "pipeline": "default.ampipeline" 13 | }, 14 | "game": { 15 | "listener_fetch_mode": "Default", 16 | "track_environments": true, 17 | "listeners": 100, 18 | "entities": 4096, 19 | "environments": 512, 20 | "rooms": 1024, 21 | "doppler_factor": 1.0, 22 | "sound_speed": 343, 23 | "obstruction": { 24 | "lpf_curve": { 25 | "parts": [ 26 | { 27 | "start": { 28 | "x": 0, 29 | "y": 0 30 | }, 31 | "end": { 32 | "x": 1, 33 | "y": 1 34 | }, 35 | "fader": "Linear" 36 | } 37 | ] 38 | }, 39 | "gain_curve": { 40 | "parts": [ 41 | { 42 | "start": { 43 | "x": 0, 44 | "y": 1 45 | }, 46 | "end": { 47 | "x": 1, 48 | "y": 1 49 | }, 50 | "fader": "Linear" 51 | } 52 | ] 53 | } 54 | }, 55 | "occlusion": { 56 | "lpf_curve": { 57 | "parts": [ 58 | { 59 | "start": { 60 | "x": 0, 61 | "y": 0 62 | }, 63 | "end": { 64 | "x": 1, 65 | "y": 1 66 | }, 67 | "fader": "Linear" 68 | } 69 | ] 70 | }, 71 | "gain_curve": { 72 | "parts": [ 73 | { 74 | "start": { 75 | "x": 0, 76 | "y": 1 77 | }, 78 | "end": { 79 | "x": 1, 80 | "y": 0 81 | }, 82 | "fader": "Linear" 83 | } 84 | ] 85 | } 86 | } 87 | }, 88 | "buses_file": "pc.buses.ambus" 89 | } -------------------------------------------------------------------------------- /tools/ampm/resources/default.pipeline.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 1, 3 | "name": "default", 4 | "nodes": [ 5 | { 6 | "id": 1, 7 | "name": "Input", 8 | "consume": [] 9 | }, 10 | { 11 | "id": 2, 12 | "name": "StereoPanning", 13 | "consume": [ 14 | 1 15 | ] 16 | }, 17 | { 18 | "id": 3, 19 | "name": "Output", 20 | "consume": [ 21 | 2 22 | ] 23 | } 24 | ] 25 | } -------------------------------------------------------------------------------- /tools/ampm/resources/default.source.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": %id%, 3 | "name": "%name%", 4 | "gain": { 5 | "kind": "Static", 6 | "value": %gain% 7 | }, 8 | "pitch": { 9 | "kind": "Static", 10 | "value": %pitch% 11 | }, 12 | "bus": %bus%, 13 | "priority": { 14 | "kind": "Static", 15 | "value": %priority% 16 | }, 17 | "stream": %stream%, 18 | "loop": { 19 | "enabled": true, 20 | "loop_count": 0 21 | }, 22 | "scope": "%scope%", 23 | "spatialization": "%spatialization%", 24 | "effect": %effect%, 25 | "attenuation": %attenuation%, 26 | "fader": "%fader%", 27 | "path": "%path%" 28 | } -------------------------------------------------------------------------------- /vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "builtin-baseline": "6784dd45fa9a97ce6232f57d755e029b4db3eb81", 3 | "name": "amplitude-audio-sdk", 4 | "description": "A powerful and cross-platform audio engine, optimized for games.", 5 | "version": "1.0", 6 | "license": "Apache-2.0", 7 | "homepage": "https://github.com/AmplitudeAudio/sdk", 8 | "features": { 9 | "samples": { 10 | "description": "Amplitude Audio SDK Samples", 11 | "dependencies": [ 12 | "sdl2" 13 | ] 14 | }, 15 | "tests": { 16 | "description": "Amplitude Audio SDK Unit Tests", 17 | "dependencies": [ 18 | "catch2" 19 | ] 20 | }, 21 | "tools": { 22 | "description": "Amplitude Audio SDK Tools", 23 | "dependencies": [ 24 | "cli11", 25 | "cmakerc", 26 | "libmysofa" 27 | ] 28 | } 29 | }, 30 | "dependencies": [ 31 | { 32 | "name": "flatbuffers", 33 | "version>=": "24.3.25" 34 | }, 35 | { 36 | "name": "dylib", 37 | "version>=": "2.2.1" 38 | }, 39 | { 40 | "name": "xsimd", 41 | "version>=": "13.0.0#1" 42 | }, 43 | { 44 | "name": "miniaudio", 45 | "version>=": "0.11.21" 46 | } 47 | ] 48 | } --------------------------------------------------------------------------------