react-native-audio-api 0.12.0-nightly-0d1a19d-20260120 → 0.12.0-nightly-6993a06-20260122
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/java/com/swmansion/audioapi/AudioAPIModule.kt +16 -2
- package/android/src/main/java/com/swmansion/audioapi/system/AudioFocusListener.kt +7 -3
- package/android/src/main/java/com/swmansion/audioapi/system/MediaSessionManager.kt +6 -6
- package/common/cpp/audioapi/HostObjects/BaseAudioContextHostObject.cpp +52 -49
- package/common/cpp/audioapi/HostObjects/sources/AudioBufferQueueSourceNodeHostObject.cpp +18 -0
- package/common/cpp/audioapi/HostObjects/sources/AudioBufferQueueSourceNodeHostObject.h +4 -0
- package/common/cpp/audioapi/HostObjects/sources/StreamerNodeHostObject.cpp +6 -0
- package/common/cpp/audioapi/HostObjects/sources/StreamerNodeHostObject.h +1 -0
- package/common/cpp/audioapi/HostObjects/utils/NodeOptions.h +111 -0
- package/common/cpp/audioapi/HostObjects/utils/NodeOptionsParser.h +262 -0
- package/common/cpp/audioapi/core/AudioNode.cpp +13 -6
- package/common/cpp/audioapi/core/AudioNode.h +2 -0
- package/common/cpp/audioapi/core/BaseAudioContext.cpp +42 -44
- package/common/cpp/audioapi/core/BaseAudioContext.h +32 -21
- package/common/cpp/audioapi/core/analysis/AnalyserNode.cpp +8 -6
- package/common/cpp/audioapi/core/analysis/AnalyserNode.h +2 -1
- package/common/cpp/audioapi/core/effects/BiquadFilterNode.cpp +7 -8
- package/common/cpp/audioapi/core/effects/BiquadFilterNode.h +4 -1
- package/common/cpp/audioapi/core/effects/ConvolverNode.cpp +5 -9
- package/common/cpp/audioapi/core/effects/ConvolverNode.h +2 -2
- package/common/cpp/audioapi/core/effects/DelayNode.cpp +5 -4
- package/common/cpp/audioapi/core/effects/DelayNode.h +2 -1
- package/common/cpp/audioapi/core/effects/GainNode.cpp +4 -3
- package/common/cpp/audioapi/core/effects/GainNode.h +2 -1
- package/common/cpp/audioapi/core/effects/IIRFilterNode.cpp +6 -6
- package/common/cpp/audioapi/core/effects/IIRFilterNode.h +3 -2
- package/common/cpp/audioapi/core/effects/StereoPannerNode.cpp +3 -3
- package/common/cpp/audioapi/core/effects/StereoPannerNode.h +4 -1
- package/common/cpp/audioapi/core/effects/WaveShaperNode.cpp +4 -3
- package/common/cpp/audioapi/core/effects/WaveShaperNode.h +4 -1
- package/common/cpp/audioapi/core/sources/AudioBuffer.cpp +3 -2
- package/common/cpp/audioapi/core/sources/AudioBuffer.h +2 -1
- package/common/cpp/audioapi/core/sources/AudioBufferBaseSourceNode.cpp +16 -22
- package/common/cpp/audioapi/core/sources/AudioBufferBaseSourceNode.h +2 -1
- package/common/cpp/audioapi/core/sources/AudioBufferQueueSourceNode.cpp +38 -20
- package/common/cpp/audioapi/core/sources/AudioBufferQueueSourceNode.h +9 -1
- package/common/cpp/audioapi/core/sources/AudioBufferSourceNode.cpp +10 -8
- package/common/cpp/audioapi/core/sources/AudioBufferSourceNode.h +5 -2
- package/common/cpp/audioapi/core/sources/ConstantSourceNode.cpp +5 -8
- package/common/cpp/audioapi/core/sources/ConstantSourceNode.h +4 -1
- package/common/cpp/audioapi/core/sources/OscillatorNode.cpp +21 -16
- package/common/cpp/audioapi/core/sources/OscillatorNode.h +4 -1
- package/common/cpp/audioapi/core/sources/StreamerNode.cpp +4 -2
- package/common/cpp/audioapi/core/sources/StreamerNode.h +11 -1
- package/common/cpp/audioapi/events/AudioEventHandlerRegistry.h +8 -2
- package/common/cpp/test/src/ConstantSourceTest.cpp +3 -2
- package/common/cpp/test/src/DelayTest.cpp +12 -5
- package/common/cpp/test/src/GainTest.cpp +3 -2
- package/common/cpp/test/src/IIRFilterTest.cpp +3 -2
- package/common/cpp/test/src/OscillatorTest.cpp +2 -1
- package/common/cpp/test/src/StereoPannerTest.cpp +3 -2
- package/common/cpp/test/src/biquad/BiquadFilterTest.cpp +10 -9
- package/common/cpp/test/src/core/effects/WaveShaperNodeTest.cpp +4 -3
- package/ios/audioapi/ios/AudioAPIModule.h +2 -2
- package/ios/audioapi/ios/AudioAPIModule.mm +3 -3
- package/ios/audioapi/ios/system/AudioEngine.mm +3 -1
- package/ios/audioapi/ios/system/AudioSessionManager.h +1 -0
- package/ios/audioapi/ios/system/{NotificationManager.h → SystemNotificationManager.h} +1 -1
- package/ios/audioapi/ios/system/{NotificationManager.mm → SystemNotificationManager.mm} +9 -4
- package/lib/commonjs/api.js +11 -3
- package/lib/commonjs/api.js.map +1 -1
- package/lib/commonjs/api.web.js +4 -10
- package/lib/commonjs/api.web.js.map +1 -1
- package/lib/commonjs/core/AnalyserNode.js +11 -0
- package/lib/commonjs/core/AnalyserNode.js.map +1 -1
- package/lib/commonjs/core/AudioBuffer.js +20 -6
- package/lib/commonjs/core/AudioBuffer.js.map +1 -1
- package/lib/commonjs/core/AudioBufferQueueSourceNode.js +24 -0
- package/lib/commonjs/core/AudioBufferQueueSourceNode.js.map +1 -1
- package/lib/commonjs/core/AudioBufferSourceNode.js +9 -6
- package/lib/commonjs/core/AudioBufferSourceNode.js.map +1 -1
- package/lib/commonjs/core/AudioScheduledSourceNode.js.map +1 -1
- package/lib/commonjs/core/BaseAudioContext.js +52 -65
- package/lib/commonjs/core/BaseAudioContext.js.map +1 -1
- package/lib/commonjs/core/BiquadFilterNode.js +7 -1
- package/lib/commonjs/core/BiquadFilterNode.js.map +1 -1
- package/lib/commonjs/core/ConstantSourceNode.js +7 -1
- package/lib/commonjs/core/ConstantSourceNode.js.map +1 -1
- package/lib/commonjs/core/ConvolverNode.js +9 -3
- package/lib/commonjs/core/ConvolverNode.js.map +1 -1
- package/lib/commonjs/core/DelayNode.js +7 -1
- package/lib/commonjs/core/DelayNode.js.map +1 -1
- package/lib/commonjs/core/GainNode.js +9 -3
- package/lib/commonjs/core/GainNode.js.map +1 -1
- package/lib/commonjs/core/IIRFilterNode.js +9 -0
- package/lib/commonjs/core/IIRFilterNode.js.map +1 -1
- package/lib/commonjs/core/OscillatorNode.js +10 -7
- package/lib/commonjs/core/OscillatorNode.js.map +1 -1
- package/lib/commonjs/core/PeriodicWave.js +30 -2
- package/lib/commonjs/core/PeriodicWave.js.map +1 -1
- package/lib/commonjs/core/RecorderAdapterNode.js +3 -0
- package/lib/commonjs/core/RecorderAdapterNode.js.map +1 -1
- package/lib/commonjs/core/StereoPannerNode.js +7 -1
- package/lib/commonjs/core/StereoPannerNode.js.map +1 -1
- package/lib/commonjs/core/StreamerNode.js +25 -1
- package/lib/commonjs/core/StreamerNode.js.map +1 -1
- package/lib/commonjs/core/WaveShaperNode.js +12 -0
- package/lib/commonjs/core/WaveShaperNode.js.map +1 -1
- package/lib/commonjs/core/WorkletNode.js +13 -1
- package/lib/commonjs/core/WorkletNode.js.map +1 -1
- package/lib/commonjs/core/WorkletProcessingNode.js +14 -1
- package/lib/commonjs/core/WorkletProcessingNode.js.map +1 -1
- package/lib/commonjs/core/WorkletSourceNode.js +13 -1
- package/lib/commonjs/core/WorkletSourceNode.js.map +1 -1
- package/lib/commonjs/defaults.js +78 -0
- package/lib/commonjs/defaults.js.map +1 -0
- package/lib/commonjs/options-validators.js +40 -0
- package/lib/commonjs/options-validators.js.map +1 -0
- package/lib/commonjs/specs/NativeAudioAPIModule.js.map +1 -1
- package/lib/commonjs/specs/NativeAudioAPIModule.web.js.map +1 -1
- package/lib/commonjs/system/AudioManager.js +7 -2
- package/lib/commonjs/system/AudioManager.js.map +1 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/web-core/AnalyserNode.js +2 -1
- package/lib/commonjs/web-core/AnalyserNode.js.map +1 -1
- package/lib/commonjs/web-core/AudioBuffer.js +14 -6
- package/lib/commonjs/web-core/AudioBuffer.js.map +1 -1
- package/lib/commonjs/web-core/AudioBufferSourceNode.js +276 -89
- package/lib/commonjs/web-core/AudioBufferSourceNode.js.map +1 -1
- package/lib/commonjs/web-core/AudioContext.js +33 -32
- package/lib/commonjs/web-core/AudioContext.js.map +1 -1
- package/lib/commonjs/web-core/AudioNode.js +4 -0
- package/lib/commonjs/web-core/AudioNode.js.map +1 -1
- package/lib/commonjs/web-core/AudioScheduledSourceNode.js +4 -2
- package/lib/commonjs/web-core/AudioScheduledSourceNode.js.map +1 -1
- package/lib/commonjs/web-core/BiquadFilterNode.js +2 -1
- package/lib/commonjs/web-core/BiquadFilterNode.js.map +1 -1
- package/lib/commonjs/web-core/ConstantSourceNode.js +2 -1
- package/lib/commonjs/web-core/ConstantSourceNode.js.map +1 -1
- package/lib/commonjs/web-core/ConvolverNode.js +3 -5
- package/lib/commonjs/web-core/ConvolverNode.js.map +1 -1
- package/lib/commonjs/web-core/DelayNode.js +7 -1
- package/lib/commonjs/web-core/DelayNode.js.map +1 -1
- package/lib/commonjs/web-core/GainNode.js +2 -1
- package/lib/commonjs/web-core/GainNode.js.map +1 -1
- package/lib/commonjs/web-core/IIRFilterNode.js +12 -0
- package/lib/commonjs/web-core/IIRFilterNode.js.map +1 -1
- package/lib/commonjs/web-core/OfflineAudioContext.js +33 -32
- package/lib/commonjs/web-core/OfflineAudioContext.js.map +1 -1
- package/lib/commonjs/web-core/OscillatorNode.js +2 -1
- package/lib/commonjs/web-core/OscillatorNode.js.map +1 -1
- package/lib/commonjs/web-core/PeriodicWave.js +6 -1
- package/lib/commonjs/web-core/PeriodicWave.js.map +1 -1
- package/lib/commonjs/web-core/StereoPannerNode.js +2 -1
- package/lib/commonjs/web-core/StereoPannerNode.js.map +1 -1
- package/lib/module/api.js +2 -1
- package/lib/module/api.js.map +1 -1
- package/lib/module/api.web.js +2 -1
- package/lib/module/api.web.js.map +1 -1
- package/lib/module/core/AnalyserNode.js +11 -0
- package/lib/module/core/AnalyserNode.js.map +1 -1
- package/lib/module/core/AudioBuffer.js +19 -6
- package/lib/module/core/AudioBuffer.js.map +1 -1
- package/lib/module/core/AudioBufferQueueSourceNode.js +24 -0
- package/lib/module/core/AudioBufferQueueSourceNode.js.map +1 -1
- package/lib/module/core/AudioBufferSourceNode.js +9 -6
- package/lib/module/core/AudioBufferSourceNode.js.map +1 -1
- package/lib/module/core/AudioScheduledSourceNode.js.map +1 -1
- package/lib/module/core/BaseAudioContext.js +52 -65
- package/lib/module/core/BaseAudioContext.js.map +1 -1
- package/lib/module/core/BiquadFilterNode.js +7 -1
- package/lib/module/core/BiquadFilterNode.js.map +1 -1
- package/lib/module/core/ConstantSourceNode.js +7 -1
- package/lib/module/core/ConstantSourceNode.js.map +1 -1
- package/lib/module/core/ConvolverNode.js +9 -3
- package/lib/module/core/ConvolverNode.js.map +1 -1
- package/lib/module/core/DelayNode.js +7 -1
- package/lib/module/core/DelayNode.js.map +1 -1
- package/lib/module/core/GainNode.js +9 -3
- package/lib/module/core/GainNode.js.map +1 -1
- package/lib/module/core/IIRFilterNode.js +9 -0
- package/lib/module/core/IIRFilterNode.js.map +1 -1
- package/lib/module/core/OscillatorNode.js +10 -7
- package/lib/module/core/OscillatorNode.js.map +1 -1
- package/lib/module/core/PeriodicWave.js +29 -2
- package/lib/module/core/PeriodicWave.js.map +1 -1
- package/lib/module/core/RecorderAdapterNode.js +3 -0
- package/lib/module/core/RecorderAdapterNode.js.map +1 -1
- package/lib/module/core/StereoPannerNode.js +7 -1
- package/lib/module/core/StereoPannerNode.js.map +1 -1
- package/lib/module/core/StreamerNode.js +25 -1
- package/lib/module/core/StreamerNode.js.map +1 -1
- package/lib/module/core/WaveShaperNode.js +12 -0
- package/lib/module/core/WaveShaperNode.js.map +1 -1
- package/lib/module/core/WorkletNode.js +13 -1
- package/lib/module/core/WorkletNode.js.map +1 -1
- package/lib/module/core/WorkletProcessingNode.js +14 -1
- package/lib/module/core/WorkletProcessingNode.js.map +1 -1
- package/lib/module/core/WorkletSourceNode.js +13 -1
- package/lib/module/core/WorkletSourceNode.js.map +1 -1
- package/lib/module/defaults.js +74 -0
- package/lib/module/defaults.js.map +1 -0
- package/lib/module/options-validators.js +36 -0
- package/lib/module/options-validators.js.map +1 -0
- package/lib/module/specs/NativeAudioAPIModule.js.map +1 -1
- package/lib/module/specs/NativeAudioAPIModule.web.js.map +1 -1
- package/lib/module/system/AudioManager.js +7 -2
- package/lib/module/system/AudioManager.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/module/web-core/AnalyserNode.js +2 -1
- package/lib/module/web-core/AnalyserNode.js.map +1 -1
- package/lib/module/web-core/AudioBuffer.js +13 -6
- package/lib/module/web-core/AudioBuffer.js.map +1 -1
- package/lib/module/web-core/AudioBufferSourceNode.js +277 -90
- package/lib/module/web-core/AudioBufferSourceNode.js.map +1 -1
- package/lib/module/web-core/AudioContext.js +33 -32
- package/lib/module/web-core/AudioContext.js.map +1 -1
- package/lib/module/web-core/AudioNode.js +4 -0
- package/lib/module/web-core/AudioNode.js.map +1 -1
- package/lib/module/web-core/AudioScheduledSourceNode.js +4 -2
- package/lib/module/web-core/AudioScheduledSourceNode.js.map +1 -1
- package/lib/module/web-core/BiquadFilterNode.js +2 -1
- package/lib/module/web-core/BiquadFilterNode.js.map +1 -1
- package/lib/module/web-core/ConstantSourceNode.js +2 -1
- package/lib/module/web-core/ConstantSourceNode.js.map +1 -1
- package/lib/module/web-core/ConvolverNode.js +3 -5
- package/lib/module/web-core/ConvolverNode.js.map +1 -1
- package/lib/module/web-core/DelayNode.js +7 -1
- package/lib/module/web-core/DelayNode.js.map +1 -1
- package/lib/module/web-core/GainNode.js +2 -1
- package/lib/module/web-core/GainNode.js.map +1 -1
- package/lib/module/web-core/IIRFilterNode.js +12 -0
- package/lib/module/web-core/IIRFilterNode.js.map +1 -1
- package/lib/module/web-core/OfflineAudioContext.js +33 -32
- package/lib/module/web-core/OfflineAudioContext.js.map +1 -1
- package/lib/module/web-core/OscillatorNode.js +2 -1
- package/lib/module/web-core/OscillatorNode.js.map +1 -1
- package/lib/module/web-core/PeriodicWave.js +6 -1
- package/lib/module/web-core/PeriodicWave.js.map +1 -1
- package/lib/module/web-core/StereoPannerNode.js +2 -1
- package/lib/module/web-core/StereoPannerNode.js.map +1 -1
- package/lib/typescript/api.d.ts +2 -1
- package/lib/typescript/api.d.ts.map +1 -1
- package/lib/typescript/api.web.d.ts +2 -1
- package/lib/typescript/api.web.d.ts.map +1 -1
- package/lib/typescript/core/AnalyserNode.d.ts +3 -1
- package/lib/typescript/core/AnalyserNode.d.ts.map +1 -1
- package/lib/typescript/core/AudioBuffer.d.ts +3 -0
- package/lib/typescript/core/AudioBuffer.d.ts.map +1 -1
- package/lib/typescript/core/AudioBufferQueueSourceNode.d.ts +8 -0
- package/lib/typescript/core/AudioBufferQueueSourceNode.d.ts.map +1 -1
- package/lib/typescript/core/AudioBufferSourceNode.d.ts +3 -2
- package/lib/typescript/core/AudioBufferSourceNode.d.ts.map +1 -1
- package/lib/typescript/core/AudioScheduledSourceNode.d.ts +3 -3
- package/lib/typescript/core/AudioScheduledSourceNode.d.ts.map +1 -1
- package/lib/typescript/core/BaseAudioContext.d.ts +10 -6
- package/lib/typescript/core/BaseAudioContext.d.ts.map +1 -1
- package/lib/typescript/core/BiquadFilterNode.d.ts +2 -3
- package/lib/typescript/core/BiquadFilterNode.d.ts.map +1 -1
- package/lib/typescript/core/ConstantSourceNode.d.ts +2 -2
- package/lib/typescript/core/ConstantSourceNode.d.ts.map +1 -1
- package/lib/typescript/core/ConvolverNode.d.ts +2 -2
- package/lib/typescript/core/ConvolverNode.d.ts.map +1 -1
- package/lib/typescript/core/DelayNode.d.ts +2 -2
- package/lib/typescript/core/DelayNode.d.ts.map +1 -1
- package/lib/typescript/core/GainNode.d.ts +2 -2
- package/lib/typescript/core/GainNode.d.ts.map +1 -1
- package/lib/typescript/core/IIRFilterNode.d.ts +3 -0
- package/lib/typescript/core/IIRFilterNode.d.ts.map +1 -1
- package/lib/typescript/core/OscillatorNode.d.ts +2 -6
- package/lib/typescript/core/OscillatorNode.d.ts.map +1 -1
- package/lib/typescript/core/PeriodicWave.d.ts +4 -1
- package/lib/typescript/core/PeriodicWave.d.ts.map +1 -1
- package/lib/typescript/core/RecorderAdapterNode.d.ts +2 -0
- package/lib/typescript/core/RecorderAdapterNode.d.ts.map +1 -1
- package/lib/typescript/core/StereoPannerNode.d.ts +2 -2
- package/lib/typescript/core/StereoPannerNode.d.ts.map +1 -1
- package/lib/typescript/core/StreamerNode.d.ts +5 -0
- package/lib/typescript/core/StreamerNode.d.ts.map +1 -1
- package/lib/typescript/core/WaveShaperNode.d.ts +3 -0
- package/lib/typescript/core/WaveShaperNode.d.ts.map +1 -1
- package/lib/typescript/core/WorkletNode.d.ts +3 -0
- package/lib/typescript/core/WorkletNode.d.ts.map +1 -1
- package/lib/typescript/core/WorkletProcessingNode.d.ts +3 -0
- package/lib/typescript/core/WorkletProcessingNode.d.ts.map +1 -1
- package/lib/typescript/core/WorkletSourceNode.d.ts +3 -0
- package/lib/typescript/core/WorkletSourceNode.d.ts.map +1 -1
- package/lib/typescript/defaults.d.ts +16 -0
- package/lib/typescript/defaults.d.ts.map +1 -0
- package/lib/typescript/events/types.d.ts +6 -4
- package/lib/typescript/events/types.d.ts.map +1 -1
- package/lib/typescript/interfaces.d.ts +17 -15
- package/lib/typescript/interfaces.d.ts.map +1 -1
- package/lib/typescript/options-validators.d.ts +6 -0
- package/lib/typescript/options-validators.d.ts.map +1 -0
- package/lib/typescript/specs/NativeAudioAPIModule.d.ts +2 -1
- package/lib/typescript/specs/NativeAudioAPIModule.d.ts.map +1 -1
- package/lib/typescript/specs/NativeAudioAPIModule.web.d.ts +2 -2
- package/lib/typescript/specs/NativeAudioAPIModule.web.d.ts.map +1 -1
- package/lib/typescript/system/AudioManager.d.ts +2 -2
- package/lib/typescript/system/AudioManager.d.ts.map +1 -1
- package/lib/typescript/system/types.d.ts +2 -1
- package/lib/typescript/system/types.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +80 -11
- package/lib/typescript/types.d.ts.map +1 -1
- package/lib/typescript/web-core/AnalyserNode.d.ts +2 -2
- package/lib/typescript/web-core/AnalyserNode.d.ts.map +1 -1
- package/lib/typescript/web-core/AudioBuffer.d.ts +3 -0
- package/lib/typescript/web-core/AudioBuffer.d.ts.map +1 -1
- package/lib/typescript/web-core/AudioBufferSourceNode.d.ts +24 -15
- package/lib/typescript/web-core/AudioBufferSourceNode.d.ts.map +1 -1
- package/lib/typescript/web-core/AudioContext.d.ts +5 -6
- package/lib/typescript/web-core/AudioContext.d.ts.map +1 -1
- package/lib/typescript/web-core/AudioNode.d.ts +2 -2
- package/lib/typescript/web-core/AudioNode.d.ts.map +1 -1
- package/lib/typescript/web-core/AudioScheduledSourceNode.d.ts +2 -0
- package/lib/typescript/web-core/AudioScheduledSourceNode.d.ts.map +1 -1
- package/lib/typescript/web-core/BaseAudioContext.d.ts +3 -3
- package/lib/typescript/web-core/BaseAudioContext.d.ts.map +1 -1
- package/lib/typescript/web-core/BiquadFilterNode.d.ts +2 -2
- package/lib/typescript/web-core/BiquadFilterNode.d.ts.map +1 -1
- package/lib/typescript/web-core/ConstantSourceNode.d.ts +2 -1
- package/lib/typescript/web-core/ConstantSourceNode.d.ts.map +1 -1
- package/lib/typescript/web-core/ConvolverNode.d.ts +2 -1
- package/lib/typescript/web-core/ConvolverNode.d.ts.map +1 -1
- package/lib/typescript/web-core/DelayNode.d.ts +2 -1
- package/lib/typescript/web-core/DelayNode.d.ts.map +1 -1
- package/lib/typescript/web-core/GainNode.d.ts +2 -1
- package/lib/typescript/web-core/GainNode.d.ts.map +1 -1
- package/lib/typescript/web-core/IIRFilterNode.d.ts +3 -0
- package/lib/typescript/web-core/IIRFilterNode.d.ts.map +1 -1
- package/lib/typescript/web-core/OfflineAudioContext.d.ts +5 -6
- package/lib/typescript/web-core/OfflineAudioContext.d.ts.map +1 -1
- package/lib/typescript/web-core/OscillatorNode.d.ts +2 -2
- package/lib/typescript/web-core/OscillatorNode.d.ts.map +1 -1
- package/lib/typescript/web-core/PeriodicWave.d.ts +3 -1
- package/lib/typescript/web-core/PeriodicWave.d.ts.map +1 -1
- package/lib/typescript/web-core/StereoPannerNode.d.ts +2 -1
- package/lib/typescript/web-core/StereoPannerNode.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/api.ts +3 -1
- package/src/api.web.ts +1 -2
- package/src/core/AnalyserNode.ts +16 -1
- package/src/core/AudioBuffer.ts +26 -6
- package/src/core/AudioBufferQueueSourceNode.ts +46 -0
- package/src/core/AudioBufferSourceNode.ts +12 -10
- package/src/core/AudioScheduledSourceNode.ts +4 -4
- package/src/core/BaseAudioContext.ts +48 -151
- package/src/core/BiquadFilterNode.ts +9 -2
- package/src/core/ConstantSourceNode.ts +9 -1
- package/src/core/ConvolverNode.ts +11 -3
- package/src/core/DelayNode.ts +5 -2
- package/src/core/GainNode.ts +10 -3
- package/src/core/IIRFilterNode.ts +12 -0
- package/src/core/OscillatorNode.ts +13 -13
- package/src/core/PeriodicWave.ts +36 -2
- package/src/core/RecorderAdapterNode.ts +5 -0
- package/src/core/StereoPannerNode.ts +9 -1
- package/src/core/StreamerNode.ts +29 -1
- package/src/core/WaveShaperNode.ts +17 -0
- package/src/core/WorkletNode.ts +30 -1
- package/src/core/WorkletProcessingNode.ts +39 -1
- package/src/core/WorkletSourceNode.ts +36 -1
- package/src/defaults.ts +100 -0
- package/src/events/types.ts +6 -4
- package/src/interfaces.ts +40 -24
- package/src/options-validators.ts +66 -0
- package/src/specs/NativeAudioAPIModule.ts +6 -1
- package/src/specs/NativeAudioAPIModule.web.ts +6 -2
- package/src/system/AudioManager.ts +8 -2
- package/src/system/types.ts +7 -1
- package/src/types.ts +96 -12
- package/src/web-core/AnalyserNode.tsx +15 -6
- package/src/web-core/AudioBuffer.tsx +20 -6
- package/src/web-core/AudioBufferSourceNode.tsx +393 -148
- package/src/web-core/AudioContext.tsx +22 -72
- package/src/web-core/AudioNode.tsx +6 -2
- package/src/web-core/AudioScheduledSourceNode.tsx +6 -1
- package/src/web-core/BaseAudioContext.tsx +3 -7
- package/src/web-core/BiquadFilterNode.tsx +6 -2
- package/src/web-core/ConstantSourceNode.tsx +3 -1
- package/src/web-core/ConvolverNode.tsx +8 -8
- package/src/web-core/DelayNode.tsx +5 -1
- package/src/web-core/GainNode.tsx +3 -1
- package/src/web-core/IIRFilterNode.tsx +15 -0
- package/src/web-core/OfflineAudioContext.tsx +19 -67
- package/src/web-core/OscillatorNode.tsx +3 -2
- package/src/web-core/PeriodicWave.tsx +11 -1
- package/src/web-core/StereoPannerNode.tsx +9 -1
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <audioapi/jsi/RuntimeLifecycleMonitor.h>
|
|
4
|
+
#include <jsi/jsi.h>
|
|
5
|
+
#include <cstddef>
|
|
6
|
+
#include <memory>
|
|
7
|
+
#include <utility>
|
|
8
|
+
#include <vector>
|
|
9
|
+
|
|
10
|
+
#include <audioapi/HostObjects/effects/PeriodicWaveHostObject.h>
|
|
11
|
+
#include <audioapi/HostObjects/sources/AudioBufferHostObject.h>
|
|
12
|
+
#include <audioapi/HostObjects/utils/NodeOptions.h>
|
|
13
|
+
|
|
14
|
+
namespace audioapi::option_parser {
|
|
15
|
+
AudioNodeOptions parseAudioNodeOptions(jsi::Runtime &runtime, const jsi::Object &optionsObject) {
|
|
16
|
+
AudioNodeOptions options;
|
|
17
|
+
|
|
18
|
+
options.channelCount =
|
|
19
|
+
static_cast<int>(optionsObject.getProperty(runtime, "channelCount").getNumber());
|
|
20
|
+
|
|
21
|
+
auto channelCountModeStr =
|
|
22
|
+
optionsObject.getProperty(runtime, "channelCountMode").asString(runtime).utf8(runtime);
|
|
23
|
+
|
|
24
|
+
if (channelCountModeStr == "max") {
|
|
25
|
+
options.channelCountMode = ChannelCountMode::MAX;
|
|
26
|
+
} else if (channelCountModeStr == "clamped-max") {
|
|
27
|
+
options.channelCountMode = ChannelCountMode::CLAMPED_MAX;
|
|
28
|
+
} else if (channelCountModeStr == "explicit") {
|
|
29
|
+
options.channelCountMode = ChannelCountMode::EXPLICIT;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
auto channelInterpretationStr =
|
|
33
|
+
optionsObject.getProperty(runtime, "channelInterpretation").asString(runtime).utf8(runtime);
|
|
34
|
+
|
|
35
|
+
if (channelInterpretationStr == "speakers") {
|
|
36
|
+
options.channelInterpretation = ChannelInterpretation::SPEAKERS;
|
|
37
|
+
} else if (channelInterpretationStr == "discrete") {
|
|
38
|
+
options.channelInterpretation = ChannelInterpretation::DISCRETE;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return options;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
GainOptions parseGainOptions(jsi::Runtime &runtime, const jsi::Object &optionsObject) {
|
|
45
|
+
GainOptions options(parseAudioNodeOptions(runtime, optionsObject));
|
|
46
|
+
options.gain = static_cast<float>(optionsObject.getProperty(runtime, "gain").getNumber());
|
|
47
|
+
return options;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
StereoPannerOptions parseStereoPannerOptions(
|
|
51
|
+
jsi::Runtime &runtime,
|
|
52
|
+
const jsi::Object &optionsObject) {
|
|
53
|
+
StereoPannerOptions options(parseAudioNodeOptions(runtime, optionsObject));
|
|
54
|
+
options.pan = static_cast<float>(optionsObject.getProperty(runtime, "pan").getNumber());
|
|
55
|
+
return options;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
ConvolverOptions parseConvolverOptions(jsi::Runtime &runtime, const jsi::Object &optionsObject) {
|
|
59
|
+
ConvolverOptions options(parseAudioNodeOptions(runtime, optionsObject));
|
|
60
|
+
options.disableNormalization =
|
|
61
|
+
optionsObject.getProperty(runtime, "disableNormalization").getBool();
|
|
62
|
+
if (optionsObject.hasProperty(runtime, "buffer")) {
|
|
63
|
+
auto bufferHostObject = optionsObject.getProperty(runtime, "buffer")
|
|
64
|
+
.getObject(runtime)
|
|
65
|
+
.asHostObject<AudioBufferHostObject>(runtime);
|
|
66
|
+
options.bus = bufferHostObject->audioBuffer_;
|
|
67
|
+
}
|
|
68
|
+
return options;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
ConstantSourceOptions parseConstantSourceOptions(
|
|
72
|
+
jsi::Runtime &runtime,
|
|
73
|
+
const jsi::Object &optionsObject) {
|
|
74
|
+
ConstantSourceOptions options;
|
|
75
|
+
options.offset = static_cast<float>(optionsObject.getProperty(runtime, "offset").getNumber());
|
|
76
|
+
return options;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
AnalyserOptions parseAnalyserOptions(jsi::Runtime &runtime, const jsi::Object &optionsObject) {
|
|
80
|
+
AnalyserOptions options(parseAudioNodeOptions(runtime, optionsObject));
|
|
81
|
+
options.fftSize = static_cast<int>(optionsObject.getProperty(runtime, "fftSize").getNumber());
|
|
82
|
+
options.minDecibels =
|
|
83
|
+
static_cast<float>(optionsObject.getProperty(runtime, "minDecibels").getNumber());
|
|
84
|
+
options.maxDecibels =
|
|
85
|
+
static_cast<float>(optionsObject.getProperty(runtime, "maxDecibels").getNumber());
|
|
86
|
+
options.smoothingTimeConstant =
|
|
87
|
+
static_cast<float>(optionsObject.getProperty(runtime, "smoothingTimeConstant").getNumber());
|
|
88
|
+
return options;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
BiquadFilterOptions parseBiquadFilterOptions(
|
|
92
|
+
jsi::Runtime &runtime,
|
|
93
|
+
const jsi::Object &optionsObject) {
|
|
94
|
+
BiquadFilterOptions options(parseAudioNodeOptions(runtime, optionsObject));
|
|
95
|
+
|
|
96
|
+
auto typeStr = optionsObject.getProperty(runtime, "type").asString(runtime).utf8(runtime);
|
|
97
|
+
|
|
98
|
+
if (typeStr == "lowpass") {
|
|
99
|
+
options.type = BiquadFilterType::LOWPASS;
|
|
100
|
+
} else if (typeStr == "highpass") {
|
|
101
|
+
options.type = BiquadFilterType::HIGHPASS;
|
|
102
|
+
} else if (typeStr == "bandpass") {
|
|
103
|
+
options.type = BiquadFilterType::BANDPASS;
|
|
104
|
+
} else if (typeStr == "lowshelf") {
|
|
105
|
+
options.type = BiquadFilterType::LOWSHELF;
|
|
106
|
+
} else if (typeStr == "highshelf") {
|
|
107
|
+
options.type = BiquadFilterType::HIGHSHELF;
|
|
108
|
+
} else if (typeStr == "peaking") {
|
|
109
|
+
options.type = BiquadFilterType::PEAKING;
|
|
110
|
+
} else if (typeStr == "notch") {
|
|
111
|
+
options.type = BiquadFilterType::NOTCH;
|
|
112
|
+
} else if (typeStr == "allpass") {
|
|
113
|
+
options.type = BiquadFilterType::ALLPASS;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
options.frequency =
|
|
117
|
+
static_cast<float>(optionsObject.getProperty(runtime, "frequency").getNumber());
|
|
118
|
+
options.detune = static_cast<float>(optionsObject.getProperty(runtime, "detune").getNumber());
|
|
119
|
+
options.Q = static_cast<float>(optionsObject.getProperty(runtime, "Q").getNumber());
|
|
120
|
+
options.gain = static_cast<float>(optionsObject.getProperty(runtime, "gain").getNumber());
|
|
121
|
+
|
|
122
|
+
return options;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
OscillatorOptions parseOscillatorOptions(jsi::Runtime &runtime, const jsi::Object &optionsObject) {
|
|
126
|
+
OscillatorOptions options;
|
|
127
|
+
|
|
128
|
+
auto typeStr = optionsObject.getProperty(runtime, "type").asString(runtime).utf8(runtime);
|
|
129
|
+
|
|
130
|
+
if (typeStr == "sine") {
|
|
131
|
+
options.type = OscillatorType::SINE;
|
|
132
|
+
} else if (typeStr == "square") {
|
|
133
|
+
options.type = OscillatorType::SQUARE;
|
|
134
|
+
} else if (typeStr == "sawtooth") {
|
|
135
|
+
options.type = OscillatorType::SAWTOOTH;
|
|
136
|
+
} else if (typeStr == "triangle") {
|
|
137
|
+
options.type = OscillatorType::TRIANGLE;
|
|
138
|
+
} else if (typeStr == "custom") {
|
|
139
|
+
options.type = OscillatorType::CUSTOM;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
options.frequency =
|
|
143
|
+
static_cast<float>(optionsObject.getProperty(runtime, "frequency").getNumber());
|
|
144
|
+
options.detune = static_cast<float>(optionsObject.getProperty(runtime, "detune").getNumber());
|
|
145
|
+
|
|
146
|
+
if (optionsObject.hasProperty(runtime, "periodicWave")) {
|
|
147
|
+
auto periodicWaveHostObject = optionsObject.getProperty(runtime, "periodicWave")
|
|
148
|
+
.getObject(runtime)
|
|
149
|
+
.asHostObject<PeriodicWaveHostObject>(runtime);
|
|
150
|
+
options.periodicWave = periodicWaveHostObject->periodicWave_;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return options;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
BaseAudioBufferSourceOptions parseBaseAudioBufferSourceOptions(
|
|
157
|
+
jsi::Runtime &runtime,
|
|
158
|
+
const jsi::Object &optionsObject) {
|
|
159
|
+
BaseAudioBufferSourceOptions options;
|
|
160
|
+
options.detune = static_cast<float>(optionsObject.getProperty(runtime, "detune").getNumber());
|
|
161
|
+
options.playbackRate =
|
|
162
|
+
static_cast<float>(optionsObject.getProperty(runtime, "playbackRate").getNumber());
|
|
163
|
+
options.pitchCorrection =
|
|
164
|
+
static_cast<bool>(optionsObject.getProperty(runtime, "pitchCorrection").getBool());
|
|
165
|
+
return options;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
AudioBufferSourceOptions parseAudioBufferSourceOptions(
|
|
169
|
+
jsi::Runtime &runtime,
|
|
170
|
+
const jsi::Object &optionsObject) {
|
|
171
|
+
AudioBufferSourceOptions options(parseBaseAudioBufferSourceOptions(runtime, optionsObject));
|
|
172
|
+
if (optionsObject.hasProperty(runtime, "buffer")) {
|
|
173
|
+
auto bufferHostObject = optionsObject.getProperty(runtime, "buffer")
|
|
174
|
+
.getObject(runtime)
|
|
175
|
+
.asHostObject<AudioBufferHostObject>(runtime);
|
|
176
|
+
options.buffer = bufferHostObject->audioBuffer_;
|
|
177
|
+
}
|
|
178
|
+
options.loop = static_cast<bool>(optionsObject.getProperty(runtime, "loop").getBool());
|
|
179
|
+
options.loopStart =
|
|
180
|
+
static_cast<float>(optionsObject.getProperty(runtime, "loopStart").getNumber());
|
|
181
|
+
options.loopEnd = static_cast<float>(optionsObject.getProperty(runtime, "loopEnd").getNumber());
|
|
182
|
+
return options;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
StreamerOptions parseStreamerOptions(jsi::Runtime &runtime, const jsi::Object &optionsObject) {
|
|
186
|
+
auto options = StreamerOptions();
|
|
187
|
+
if (optionsObject.hasProperty(runtime, "streamPath")) {
|
|
188
|
+
options.streamPath =
|
|
189
|
+
optionsObject.getProperty(runtime, "streamPath").asString(runtime).utf8(runtime);
|
|
190
|
+
}
|
|
191
|
+
return options;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
AudioBufferOptions parseAudioBufferOptions(
|
|
195
|
+
jsi::Runtime &runtime,
|
|
196
|
+
const jsi::Object &optionsObject) {
|
|
197
|
+
AudioBufferOptions options;
|
|
198
|
+
options.numberOfChannels =
|
|
199
|
+
static_cast<int>(optionsObject.getProperty(runtime, "numberOfChannels").getNumber());
|
|
200
|
+
options.length = static_cast<size_t>(optionsObject.getProperty(runtime, "length").getNumber());
|
|
201
|
+
options.sampleRate =
|
|
202
|
+
static_cast<float>(optionsObject.getProperty(runtime, "sampleRate").getNumber());
|
|
203
|
+
return options;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
DelayOptions parseDelayOptions(jsi::Runtime &runtime, const jsi::Object &optionsObject) {
|
|
207
|
+
DelayOptions options(parseAudioNodeOptions(runtime, optionsObject));
|
|
208
|
+
options.maxDelayTime =
|
|
209
|
+
static_cast<float>(optionsObject.getProperty(runtime, "maxDelayTime").getNumber());
|
|
210
|
+
options.delayTime =
|
|
211
|
+
static_cast<float>(optionsObject.getProperty(runtime, "delayTime").getNumber());
|
|
212
|
+
return options;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
IIRFilterOptions parseIIRFilterOptions(jsi::Runtime &runtime, const jsi::Object &optionsObject) {
|
|
216
|
+
IIRFilterOptions options(parseAudioNodeOptions(runtime, optionsObject));
|
|
217
|
+
|
|
218
|
+
auto feedforwardArray =
|
|
219
|
+
optionsObject.getProperty(runtime, "feedforward").asObject(runtime).asArray(runtime);
|
|
220
|
+
size_t feedforwardLength = feedforwardArray.size(runtime);
|
|
221
|
+
options.feedforward.reserve(feedforwardLength);
|
|
222
|
+
for (size_t i = 0; i < feedforwardLength; ++i) {
|
|
223
|
+
options.feedforward.push_back(
|
|
224
|
+
static_cast<float>(feedforwardArray.getValueAtIndex(runtime, i).getNumber()));
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
auto feedbackArray =
|
|
228
|
+
optionsObject.getProperty(runtime, "feedback").asObject(runtime).asArray(runtime);
|
|
229
|
+
size_t feedbackLength = feedbackArray.size(runtime);
|
|
230
|
+
options.feedback.reserve(feedbackLength);
|
|
231
|
+
for (size_t i = 0; i < feedbackLength; ++i) {
|
|
232
|
+
options.feedback.push_back(
|
|
233
|
+
static_cast<float>(feedbackArray.getValueAtIndex(runtime, i).getNumber()));
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return options;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
WaveShaperOptions parseWaveShaperOptions(jsi::Runtime &runtime, const jsi::Object &optionsObject) {
|
|
240
|
+
WaveShaperOptions options(parseAudioNodeOptions(runtime, optionsObject));
|
|
241
|
+
|
|
242
|
+
auto oversampleStr =
|
|
243
|
+
optionsObject.getProperty(runtime, "oversample").asString(runtime).utf8(runtime);
|
|
244
|
+
|
|
245
|
+
if (oversampleStr == "none") {
|
|
246
|
+
options.oversample = OverSampleType::OVERSAMPLE_NONE;
|
|
247
|
+
} else if (oversampleStr == "2x") {
|
|
248
|
+
options.oversample = OverSampleType::OVERSAMPLE_2X;
|
|
249
|
+
} else if (oversampleStr == "4x") {
|
|
250
|
+
options.oversample = OverSampleType::OVERSAMPLE_4X;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
if (optionsObject.hasProperty(runtime, "buffer")) {
|
|
254
|
+
auto arrayBuffer = optionsObject.getPropertyAsObject(runtime, "buffer").getArrayBuffer(runtime);
|
|
255
|
+
|
|
256
|
+
options.curve = std::make_shared<AudioArray>(
|
|
257
|
+
reinterpret_cast<float *>(arrayBuffer.data(runtime)),
|
|
258
|
+
static_cast<size_t>(arrayBuffer.size(runtime) / sizeof(float)));
|
|
259
|
+
}
|
|
260
|
+
return options;
|
|
261
|
+
}
|
|
262
|
+
} // namespace audioapi::option_parser
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
#include <audioapi/HostObjects/utils/NodeOptions.h>
|
|
1
2
|
#include <audioapi/core/AudioNode.h>
|
|
2
3
|
#include <audioapi/core/AudioParam.h>
|
|
3
4
|
#include <audioapi/core/BaseAudioContext.h>
|
|
@@ -10,13 +11,19 @@
|
|
|
10
11
|
|
|
11
12
|
namespace audioapi {
|
|
12
13
|
|
|
13
|
-
AudioNode::AudioNode(std::shared_ptr<BaseAudioContext> context)
|
|
14
|
+
AudioNode::AudioNode(std::shared_ptr<BaseAudioContext> context) : context_(context) {
|
|
15
|
+
audioBus_ =
|
|
16
|
+
std::make_shared<AudioBus>(RENDER_QUANTUM_SIZE, channelCount_, context->getSampleRate());
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
AudioNode::AudioNode(std::shared_ptr<BaseAudioContext> context, const AudioNodeOptions &options)
|
|
14
20
|
: context_(context),
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
channelCount_(options.channelCount),
|
|
22
|
+
channelCountMode_(options.channelCountMode),
|
|
23
|
+
channelInterpretation_(options.channelInterpretation) {
|
|
24
|
+
audioBus_ =
|
|
25
|
+
std::make_shared<AudioBus>(RENDER_QUANTUM_SIZE, channelCount_, context->getSampleRate());
|
|
26
|
+
}
|
|
20
27
|
|
|
21
28
|
AudioNode::~AudioNode() {
|
|
22
29
|
if (isInitialized_) {
|
|
@@ -16,10 +16,12 @@ namespace audioapi {
|
|
|
16
16
|
class AudioBus;
|
|
17
17
|
class BaseAudioContext;
|
|
18
18
|
class AudioParam;
|
|
19
|
+
class AudioNodeOptions;
|
|
19
20
|
|
|
20
21
|
class AudioNode : public std::enable_shared_from_this<AudioNode> {
|
|
21
22
|
public:
|
|
22
23
|
explicit AudioNode(std::shared_ptr<BaseAudioContext> context);
|
|
24
|
+
explicit AudioNode(std::shared_ptr<BaseAudioContext> context, const AudioNodeOptions &options);
|
|
23
25
|
virtual ~AudioNode();
|
|
24
26
|
|
|
25
27
|
int getNumberOfInputs() const;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
#include <audioapi/HostObjects/utils/NodeOptions.h>
|
|
1
2
|
#include <audioapi/core/BaseAudioContext.h>
|
|
2
3
|
#include <audioapi/core/analysis/AnalyserNode.h>
|
|
3
4
|
#include <audioapi/core/destinations/AudioDestinationNode.h>
|
|
@@ -71,7 +72,7 @@ double BaseAudioContext::getCurrentTime() const {
|
|
|
71
72
|
return destination_->getCurrentTime();
|
|
72
73
|
}
|
|
73
74
|
|
|
74
|
-
std::shared_ptr<AudioDestinationNode> BaseAudioContext::getDestination() {
|
|
75
|
+
std::shared_ptr<AudioDestinationNode> BaseAudioContext::getDestination() const {
|
|
75
76
|
return destination_;
|
|
76
77
|
}
|
|
77
78
|
|
|
@@ -116,21 +117,22 @@ std::shared_ptr<RecorderAdapterNode> BaseAudioContext::createRecorderAdapter() {
|
|
|
116
117
|
return recorderAdapter;
|
|
117
118
|
}
|
|
118
119
|
|
|
119
|
-
std::shared_ptr<OscillatorNode> BaseAudioContext::createOscillator() {
|
|
120
|
-
auto oscillator = std::make_shared<OscillatorNode>(shared_from_this());
|
|
120
|
+
std::shared_ptr<OscillatorNode> BaseAudioContext::createOscillator(const OscillatorOptions &options) {
|
|
121
|
+
auto oscillator = std::make_shared<OscillatorNode>(shared_from_this(), options);
|
|
121
122
|
nodeManager_->addSourceNode(oscillator);
|
|
122
123
|
return oscillator;
|
|
123
124
|
}
|
|
124
125
|
|
|
125
|
-
std::shared_ptr<ConstantSourceNode> BaseAudioContext::createConstantSource(
|
|
126
|
-
|
|
126
|
+
std::shared_ptr<ConstantSourceNode> BaseAudioContext::createConstantSource(
|
|
127
|
+
const ConstantSourceOptions &options) {
|
|
128
|
+
auto constantSource = std::make_shared<ConstantSourceNode>(shared_from_this(), options);
|
|
127
129
|
nodeManager_->addSourceNode(constantSource);
|
|
128
130
|
return constantSource;
|
|
129
131
|
}
|
|
130
132
|
|
|
131
|
-
std::shared_ptr<StreamerNode> BaseAudioContext::createStreamer() {
|
|
133
|
+
std::shared_ptr<StreamerNode> BaseAudioContext::createStreamer(const StreamerOptions &options) {
|
|
132
134
|
#if !RN_AUDIO_API_FFMPEG_DISABLED
|
|
133
|
-
auto streamer = std::make_shared<StreamerNode>(shared_from_this());
|
|
135
|
+
auto streamer = std::make_shared<StreamerNode>(shared_from_this(), options);
|
|
134
136
|
nodeManager_->addSourceNode(streamer);
|
|
135
137
|
return streamer;
|
|
136
138
|
#else
|
|
@@ -138,55 +140,54 @@ std::shared_ptr<StreamerNode> BaseAudioContext::createStreamer() {
|
|
|
138
140
|
#endif // RN_AUDIO_API_FFMPEG_DISABLED
|
|
139
141
|
}
|
|
140
142
|
|
|
141
|
-
std::shared_ptr<GainNode> BaseAudioContext::createGain() {
|
|
142
|
-
auto gain = std::make_shared<GainNode>(shared_from_this());
|
|
143
|
+
std::shared_ptr<GainNode> BaseAudioContext::createGain(const GainOptions &options) {
|
|
144
|
+
auto gain = std::make_shared<GainNode>(shared_from_this(), options);
|
|
143
145
|
nodeManager_->addProcessingNode(gain);
|
|
144
146
|
return gain;
|
|
145
147
|
}
|
|
146
148
|
|
|
147
|
-
std::shared_ptr<
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
return delay;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
std::shared_ptr<StereoPannerNode> BaseAudioContext::createStereoPanner() {
|
|
154
|
-
auto stereoPanner = std::make_shared<StereoPannerNode>(shared_from_this());
|
|
149
|
+
std::shared_ptr<StereoPannerNode> BaseAudioContext::createStereoPanner(
|
|
150
|
+
const StereoPannerOptions &options) {
|
|
151
|
+
auto stereoPanner = std::make_shared<StereoPannerNode>(shared_from_this(), options);
|
|
155
152
|
nodeManager_->addProcessingNode(stereoPanner);
|
|
156
153
|
return stereoPanner;
|
|
157
154
|
}
|
|
158
155
|
|
|
159
|
-
std::shared_ptr<
|
|
160
|
-
auto
|
|
161
|
-
nodeManager_->addProcessingNode(
|
|
162
|
-
return
|
|
156
|
+
std::shared_ptr<DelayNode> BaseAudioContext::createDelay(const DelayOptions &options) {
|
|
157
|
+
auto delay = std::make_shared<DelayNode>(shared_from_this(), options);
|
|
158
|
+
nodeManager_->addProcessingNode(delay);
|
|
159
|
+
return delay;
|
|
163
160
|
}
|
|
164
161
|
|
|
165
|
-
std::shared_ptr<
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
return iirFilter;
|
|
162
|
+
std::shared_ptr<BiquadFilterNode> BaseAudioContext::createBiquadFilter(
|
|
163
|
+
const BiquadFilterOptions &options) {
|
|
164
|
+
auto biquadFilter = std::make_shared<BiquadFilterNode>(shared_from_this(), options);
|
|
165
|
+
nodeManager_->addProcessingNode(biquadFilter);
|
|
166
|
+
return biquadFilter;
|
|
171
167
|
}
|
|
172
168
|
|
|
173
|
-
std::shared_ptr<AudioBufferSourceNode> BaseAudioContext::createBufferSource(
|
|
174
|
-
|
|
169
|
+
std::shared_ptr<AudioBufferSourceNode> BaseAudioContext::createBufferSource(
|
|
170
|
+
const AudioBufferSourceOptions &options) {
|
|
171
|
+
auto bufferSource = std::make_shared<AudioBufferSourceNode>(shared_from_this(), options);
|
|
175
172
|
nodeManager_->addSourceNode(bufferSource);
|
|
176
173
|
return bufferSource;
|
|
177
174
|
}
|
|
178
175
|
|
|
176
|
+
std::shared_ptr<IIRFilterNode> BaseAudioContext::createIIRFilter(const IIRFilterOptions &options) {
|
|
177
|
+
auto iirFilter = std::make_shared<IIRFilterNode>(shared_from_this(), options);
|
|
178
|
+
nodeManager_->addProcessingNode(iirFilter);
|
|
179
|
+
return iirFilter;
|
|
180
|
+
}
|
|
181
|
+
|
|
179
182
|
std::shared_ptr<AudioBufferQueueSourceNode> BaseAudioContext::createBufferQueueSource(
|
|
180
|
-
|
|
181
|
-
auto bufferSource =
|
|
182
|
-
std::make_shared<AudioBufferQueueSourceNode>(shared_from_this(), pitchCorrection);
|
|
183
|
+
const BaseAudioBufferSourceOptions &options) {
|
|
184
|
+
auto bufferSource = std::make_shared<AudioBufferQueueSourceNode>(shared_from_this(), options);
|
|
183
185
|
nodeManager_->addSourceNode(bufferSource);
|
|
184
186
|
return bufferSource;
|
|
185
187
|
}
|
|
186
188
|
|
|
187
|
-
std::shared_ptr<AudioBuffer>
|
|
188
|
-
|
|
189
|
-
return std::make_shared<AudioBuffer>(numberOfChannels, length, sampleRate);
|
|
189
|
+
std::shared_ptr<AudioBuffer> BaseAudioContext::createBuffer(const AudioBufferOptions &options) {
|
|
190
|
+
return std::make_shared<AudioBuffer>(options);
|
|
190
191
|
}
|
|
191
192
|
|
|
192
193
|
std::shared_ptr<PeriodicWave> BaseAudioContext::createPeriodicWave(
|
|
@@ -196,23 +197,20 @@ std::shared_ptr<PeriodicWave> BaseAudioContext::createPeriodicWave(
|
|
|
196
197
|
return std::make_shared<PeriodicWave>(sampleRate_, complexData, length, disableNormalization);
|
|
197
198
|
}
|
|
198
199
|
|
|
199
|
-
std::shared_ptr<AnalyserNode> BaseAudioContext::createAnalyser() {
|
|
200
|
-
auto analyser = std::make_shared<AnalyserNode>(shared_from_this());
|
|
200
|
+
std::shared_ptr<AnalyserNode> BaseAudioContext::createAnalyser(const AnalyserOptions &options) {
|
|
201
|
+
auto analyser = std::make_shared<AnalyserNode>(shared_from_this(), options);
|
|
201
202
|
nodeManager_->addProcessingNode(analyser);
|
|
202
203
|
return analyser;
|
|
203
204
|
}
|
|
204
205
|
|
|
205
|
-
std::shared_ptr<ConvolverNode> BaseAudioContext::createConvolver(
|
|
206
|
-
|
|
207
|
-
bool disableNormalization) {
|
|
208
|
-
auto convolver =
|
|
209
|
-
std::make_shared<ConvolverNode>(shared_from_this(), buffer, disableNormalization);
|
|
206
|
+
std::shared_ptr<ConvolverNode> BaseAudioContext::createConvolver(const ConvolverOptions &options) {
|
|
207
|
+
auto convolver = std::make_shared<ConvolverNode>(shared_from_this(), options);
|
|
210
208
|
nodeManager_->addProcessingNode(convolver);
|
|
211
209
|
return convolver;
|
|
212
210
|
}
|
|
213
211
|
|
|
214
|
-
std::shared_ptr<WaveShaperNode> BaseAudioContext::createWaveShaper() {
|
|
215
|
-
auto waveShaper = std::make_shared<WaveShaperNode>(shared_from_this());
|
|
212
|
+
std::shared_ptr<WaveShaperNode> BaseAudioContext::createWaveShaper(const WaveShaperOptions &options) {
|
|
213
|
+
auto waveShaper = std::make_shared<WaveShaperNode>(shared_from_this(), options);
|
|
216
214
|
nodeManager_->addProcessingNode(waveShaper);
|
|
217
215
|
return waveShaper;
|
|
218
216
|
}
|
|
@@ -33,11 +33,25 @@ class AudioEventHandlerRegistry;
|
|
|
33
33
|
class ConvolverNode;
|
|
34
34
|
class IAudioEventHandlerRegistry;
|
|
35
35
|
class RecorderAdapterNode;
|
|
36
|
+
class WaveShaperNode;
|
|
36
37
|
class WorkletSourceNode;
|
|
37
38
|
class WorkletNode;
|
|
38
39
|
class WorkletProcessingNode;
|
|
39
40
|
class StreamerNode;
|
|
40
|
-
class
|
|
41
|
+
class GainOptions;
|
|
42
|
+
class StereoPannerOptions;
|
|
43
|
+
class ConvolverOptions;
|
|
44
|
+
class ConstantSourceOptions;
|
|
45
|
+
class AnalyserOptions;
|
|
46
|
+
class BiquadFilterOptions;
|
|
47
|
+
class OscillatorOptions;
|
|
48
|
+
class BaseAudioBufferSourceOptions;
|
|
49
|
+
class AudioBufferSourceOptions;
|
|
50
|
+
class StreamerOptions;
|
|
51
|
+
class AudioBufferOptions;
|
|
52
|
+
class DelayOptions;
|
|
53
|
+
class IIRFilterOptions;
|
|
54
|
+
class WaveShaperOptions;
|
|
41
55
|
|
|
42
56
|
class BaseAudioContext : public std::enable_shared_from_this<BaseAudioContext> {
|
|
43
57
|
public:
|
|
@@ -52,7 +66,7 @@ class BaseAudioContext : public std::enable_shared_from_this<BaseAudioContext> {
|
|
|
52
66
|
[[nodiscard]] float getSampleRate() const;
|
|
53
67
|
[[nodiscard]] double getCurrentTime() const;
|
|
54
68
|
[[nodiscard]] std::size_t getCurrentSampleFrame() const;
|
|
55
|
-
std::shared_ptr<AudioDestinationNode> getDestination();
|
|
69
|
+
std::shared_ptr<AudioDestinationNode> getDestination() const;
|
|
56
70
|
|
|
57
71
|
std::shared_ptr<RecorderAdapterNode> createRecorderAdapter();
|
|
58
72
|
std::shared_ptr<WorkletSourceNode> createWorkletSourceNode(
|
|
@@ -69,29 +83,26 @@ class BaseAudioContext : public std::enable_shared_from_this<BaseAudioContext> {
|
|
|
69
83
|
std::shared_ptr<worklets::SerializableWorklet> &shareableWorklet,
|
|
70
84
|
std::weak_ptr<worklets::WorkletRuntime> runtime,
|
|
71
85
|
bool shouldLockRuntime = true);
|
|
72
|
-
std::shared_ptr<
|
|
73
|
-
std::shared_ptr<
|
|
74
|
-
std::shared_ptr<
|
|
75
|
-
std::shared_ptr<
|
|
76
|
-
std::shared_ptr<
|
|
77
|
-
std::shared_ptr<
|
|
78
|
-
std::shared_ptr<
|
|
79
|
-
std::shared_ptr<
|
|
80
|
-
|
|
81
|
-
const
|
|
82
|
-
std::shared_ptr<
|
|
83
|
-
|
|
84
|
-
static std::shared_ptr<AudioBuffer>
|
|
85
|
-
createBuffer(int numberOfChannels, size_t length, float sampleRate);
|
|
86
|
+
std::shared_ptr<DelayNode> createDelay(const DelayOptions &options);
|
|
87
|
+
std::shared_ptr<IIRFilterNode> createIIRFilter(const IIRFilterOptions &options);
|
|
88
|
+
std::shared_ptr<OscillatorNode> createOscillator(const OscillatorOptions &options);
|
|
89
|
+
std::shared_ptr<ConstantSourceNode> createConstantSource(const ConstantSourceOptions &options);
|
|
90
|
+
std::shared_ptr<StreamerNode> createStreamer(const StreamerOptions &options);
|
|
91
|
+
std::shared_ptr<GainNode> createGain(const GainOptions &options);
|
|
92
|
+
std::shared_ptr<StereoPannerNode> createStereoPanner(const StereoPannerOptions &options);
|
|
93
|
+
std::shared_ptr<BiquadFilterNode> createBiquadFilter(const BiquadFilterOptions &options);
|
|
94
|
+
std::shared_ptr<AudioBufferSourceNode> createBufferSource(
|
|
95
|
+
const AudioBufferSourceOptions &options);
|
|
96
|
+
std::shared_ptr<AudioBufferQueueSourceNode> createBufferQueueSource(
|
|
97
|
+
const BaseAudioBufferSourceOptions &options);
|
|
98
|
+
static std::shared_ptr<AudioBuffer> createBuffer(const AudioBufferOptions &options);
|
|
86
99
|
std::shared_ptr<PeriodicWave> createPeriodicWave(
|
|
87
100
|
const std::vector<std::complex<float>> &complexData,
|
|
88
101
|
bool disableNormalization,
|
|
89
102
|
int length);
|
|
90
|
-
std::shared_ptr<AnalyserNode> createAnalyser();
|
|
91
|
-
std::shared_ptr<ConvolverNode> createConvolver(
|
|
92
|
-
|
|
93
|
-
bool disableNormalization);
|
|
94
|
-
std::shared_ptr<WaveShaperNode> createWaveShaper();
|
|
103
|
+
std::shared_ptr<AnalyserNode> createAnalyser(const AnalyserOptions &options);
|
|
104
|
+
std::shared_ptr<ConvolverNode> createConvolver(const ConvolverOptions &options);
|
|
105
|
+
std::shared_ptr<WaveShaperNode> createWaveShaper(const WaveShaperOptions &options);
|
|
95
106
|
|
|
96
107
|
std::shared_ptr<PeriodicWave> getBasicWaveForm(OscillatorType type);
|
|
97
108
|
[[nodiscard]] float getNyquistFrequency() const;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
#include <audioapi/HostObjects/utils/NodeOptions.h>
|
|
1
2
|
#include <audioapi/core/BaseAudioContext.h>
|
|
2
3
|
#include <audioapi/core/analysis/AnalyserNode.h>
|
|
3
4
|
#include <audioapi/dsp/AudioUtils.h>
|
|
@@ -12,12 +13,13 @@
|
|
|
12
13
|
#include <vector>
|
|
13
14
|
|
|
14
15
|
namespace audioapi {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
|
|
17
|
+
AnalyserNode::AnalyserNode(std::shared_ptr<BaseAudioContext> context, const AnalyserOptions &options)
|
|
18
|
+
: AudioNode(context, options),
|
|
19
|
+
fftSize_(options.fftSize),
|
|
20
|
+
minDecibels_(options.minDecibels),
|
|
21
|
+
maxDecibels_(options.maxDecibels),
|
|
22
|
+
smoothingTimeConstant_(options.smoothingTimeConstant),
|
|
21
23
|
windowType_(WindowType::BLACKMAN),
|
|
22
24
|
inputBuffer_(std::make_unique<CircularAudioArray>(MAX_FFT_SIZE * 2)),
|
|
23
25
|
downMixBus_(std::make_unique<AudioBus>(RENDER_QUANTUM_SIZE, 1, context->getSampleRate())),
|
|
@@ -15,11 +15,12 @@ namespace audioapi {
|
|
|
15
15
|
class AudioBus;
|
|
16
16
|
class AudioArray;
|
|
17
17
|
class CircularAudioArray;
|
|
18
|
+
class AnalyserOptions;
|
|
18
19
|
|
|
19
20
|
class AnalyserNode : public AudioNode {
|
|
20
21
|
public:
|
|
21
22
|
enum class WindowType { BLACKMAN, HANN };
|
|
22
|
-
explicit AnalyserNode(std::shared_ptr<BaseAudioContext> context);
|
|
23
|
+
explicit AnalyserNode(std::shared_ptr<BaseAudioContext> context, const AnalyserOptions &options);
|
|
23
24
|
|
|
24
25
|
int getFftSize() const;
|
|
25
26
|
int getFrequencyBinCount() const;
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
|
+
#include <audioapi/HostObjects/utils/NodeOptions.h>
|
|
29
30
|
#include <audioapi/core/BaseAudioContext.h>
|
|
30
31
|
#include <audioapi/core/effects/BiquadFilterNode.h>
|
|
31
32
|
#include <audioapi/utils/AudioArray.h>
|
|
@@ -38,26 +39,24 @@
|
|
|
38
39
|
|
|
39
40
|
namespace audioapi {
|
|
40
41
|
|
|
41
|
-
BiquadFilterNode::BiquadFilterNode(std::shared_ptr<BaseAudioContext> context) : AudioNode(context) {
|
|
42
|
+
BiquadFilterNode::BiquadFilterNode(std::shared_ptr<BaseAudioContext> context, const BiquadFilterOptions &options) : AudioNode(context, options) {
|
|
42
43
|
frequencyParam_ =
|
|
43
|
-
std::make_shared<AudioParam>(
|
|
44
|
+
std::make_shared<AudioParam>(options.frequency, 0.0f, context->getNyquistFrequency(), context);
|
|
44
45
|
detuneParam_ = std::make_shared<AudioParam>(
|
|
45
|
-
|
|
46
|
+
options.detune,
|
|
46
47
|
-1200 * LOG2_MOST_POSITIVE_SINGLE_FLOAT,
|
|
47
48
|
1200 * LOG2_MOST_POSITIVE_SINGLE_FLOAT,
|
|
48
49
|
context);
|
|
49
50
|
QParam_ = std::make_shared<AudioParam>(
|
|
50
|
-
|
|
51
|
+
options.Q, MOST_NEGATIVE_SINGLE_FLOAT, MOST_POSITIVE_SINGLE_FLOAT, context);
|
|
51
52
|
gainParam_ = std::make_shared<AudioParam>(
|
|
52
|
-
|
|
53
|
-
type_ =
|
|
53
|
+
options.gain, MOST_NEGATIVE_SINGLE_FLOAT, 40 * LOG10_MOST_POSITIVE_SINGLE_FLOAT, context);
|
|
54
|
+
type_ = options.type;
|
|
54
55
|
x1_.resize(MAX_CHANNEL_COUNT, 0.0f);
|
|
55
56
|
x2_.resize(MAX_CHANNEL_COUNT, 0.0f);
|
|
56
57
|
y1_.resize(MAX_CHANNEL_COUNT, 0.0f);
|
|
57
58
|
y2_.resize(MAX_CHANNEL_COUNT, 0.0f);
|
|
58
59
|
isInitialized_ = true;
|
|
59
|
-
channelCountMode_ = ChannelCountMode::MAX;
|
|
60
|
-
isInitialized_ = true;
|
|
61
60
|
}
|
|
62
61
|
|
|
63
62
|
std::string BiquadFilterNode::getType() {
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
namespace audioapi {
|
|
47
47
|
|
|
48
48
|
class AudioBus;
|
|
49
|
+
class BiquadFilterOptions;
|
|
49
50
|
|
|
50
51
|
class BiquadFilterNode : public AudioNode {
|
|
51
52
|
#if RN_AUDIO_API_TEST
|
|
@@ -54,7 +55,9 @@ class BiquadFilterNode : public AudioNode {
|
|
|
54
55
|
#endif // RN_AUDIO_API_TEST
|
|
55
56
|
|
|
56
57
|
public:
|
|
57
|
-
explicit BiquadFilterNode(
|
|
58
|
+
explicit BiquadFilterNode(
|
|
59
|
+
std::shared_ptr<BaseAudioContext> context,
|
|
60
|
+
const BiquadFilterOptions &options);
|
|
58
61
|
|
|
59
62
|
[[nodiscard]] std::string getType();
|
|
60
63
|
void setType(const std::string &type);
|