react-native-audio-api 0.12.0-nightly-37d6b7c-20260119 → 0.12.0-nightly-75589dc-20260121

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.
Files changed (356) hide show
  1. package/android/src/main/cpp/audioapi/android/core/AndroidAudioRecorder.cpp +8 -5
  2. package/android/src/main/cpp/audioapi/android/core/AndroidAudioRecorder.h +1 -1
  3. package/android/src/main/cpp/audioapi/android/core/utils/AndroidFileWriterBackend.h +1 -1
  4. package/android/src/main/cpp/audioapi/android/core/utils/FileOptions.cpp +7 -3
  5. package/android/src/main/cpp/audioapi/android/core/utils/FileOptions.h +1 -1
  6. package/android/src/main/cpp/audioapi/android/core/utils/ffmpegBackend/FFmpegFileWriter.cpp +4 -2
  7. package/android/src/main/cpp/audioapi/android/core/utils/ffmpegBackend/FFmpegFileWriter.h +1 -1
  8. package/android/src/main/cpp/audioapi/android/core/utils/miniaudioBackend/MiniAudioFileWriter.cpp +5 -4
  9. package/android/src/main/cpp/audioapi/android/core/utils/miniaudioBackend/MiniAudioFileWriter.h +2 -2
  10. package/common/cpp/audioapi/HostObjects/BaseAudioContextHostObject.cpp +52 -49
  11. package/common/cpp/audioapi/HostObjects/inputs/AudioRecorderHostObject.cpp +2 -1
  12. package/common/cpp/audioapi/HostObjects/sources/StreamerNodeHostObject.cpp +6 -0
  13. package/common/cpp/audioapi/HostObjects/sources/StreamerNodeHostObject.h +1 -0
  14. package/common/cpp/audioapi/HostObjects/utils/NodeOptions.h +111 -0
  15. package/common/cpp/audioapi/HostObjects/utils/NodeOptionsParser.h +262 -0
  16. package/common/cpp/audioapi/core/AudioNode.cpp +13 -6
  17. package/common/cpp/audioapi/core/AudioNode.h +2 -0
  18. package/common/cpp/audioapi/core/BaseAudioContext.cpp +42 -44
  19. package/common/cpp/audioapi/core/BaseAudioContext.h +32 -21
  20. package/common/cpp/audioapi/core/analysis/AnalyserNode.cpp +8 -6
  21. package/common/cpp/audioapi/core/analysis/AnalyserNode.h +2 -1
  22. package/common/cpp/audioapi/core/effects/BiquadFilterNode.cpp +7 -8
  23. package/common/cpp/audioapi/core/effects/BiquadFilterNode.h +4 -1
  24. package/common/cpp/audioapi/core/effects/ConvolverNode.cpp +5 -9
  25. package/common/cpp/audioapi/core/effects/ConvolverNode.h +2 -2
  26. package/common/cpp/audioapi/core/effects/DelayNode.cpp +5 -4
  27. package/common/cpp/audioapi/core/effects/DelayNode.h +2 -1
  28. package/common/cpp/audioapi/core/effects/GainNode.cpp +4 -3
  29. package/common/cpp/audioapi/core/effects/GainNode.h +2 -1
  30. package/common/cpp/audioapi/core/effects/IIRFilterNode.cpp +6 -6
  31. package/common/cpp/audioapi/core/effects/IIRFilterNode.h +3 -2
  32. package/common/cpp/audioapi/core/effects/StereoPannerNode.cpp +3 -3
  33. package/common/cpp/audioapi/core/effects/StereoPannerNode.h +4 -1
  34. package/common/cpp/audioapi/core/effects/WaveShaperNode.cpp +4 -3
  35. package/common/cpp/audioapi/core/effects/WaveShaperNode.h +4 -1
  36. package/common/cpp/audioapi/core/inputs/AudioRecorder.h +1 -1
  37. package/common/cpp/audioapi/core/sources/AudioBuffer.cpp +3 -2
  38. package/common/cpp/audioapi/core/sources/AudioBuffer.h +2 -1
  39. package/common/cpp/audioapi/core/sources/AudioBufferBaseSourceNode.cpp +16 -22
  40. package/common/cpp/audioapi/core/sources/AudioBufferBaseSourceNode.h +2 -1
  41. package/common/cpp/audioapi/core/sources/AudioBufferQueueSourceNode.cpp +9 -6
  42. package/common/cpp/audioapi/core/sources/AudioBufferQueueSourceNode.h +2 -1
  43. package/common/cpp/audioapi/core/sources/AudioBufferSourceNode.cpp +9 -7
  44. package/common/cpp/audioapi/core/sources/AudioBufferSourceNode.h +4 -1
  45. package/common/cpp/audioapi/core/sources/ConstantSourceNode.cpp +5 -8
  46. package/common/cpp/audioapi/core/sources/ConstantSourceNode.h +4 -1
  47. package/common/cpp/audioapi/core/sources/OscillatorNode.cpp +21 -16
  48. package/common/cpp/audioapi/core/sources/OscillatorNode.h +4 -1
  49. package/common/cpp/audioapi/core/sources/StreamerNode.cpp +4 -2
  50. package/common/cpp/audioapi/core/sources/StreamerNode.h +11 -1
  51. package/common/cpp/test/src/ConstantSourceTest.cpp +3 -2
  52. package/common/cpp/test/src/DelayTest.cpp +12 -5
  53. package/common/cpp/test/src/GainTest.cpp +3 -2
  54. package/common/cpp/test/src/IIRFilterTest.cpp +3 -2
  55. package/common/cpp/test/src/OscillatorTest.cpp +2 -1
  56. package/common/cpp/test/src/StereoPannerTest.cpp +3 -2
  57. package/common/cpp/test/src/biquad/BiquadFilterTest.cpp +10 -9
  58. package/common/cpp/test/src/core/effects/WaveShaperNodeTest.cpp +4 -3
  59. package/ios/audioapi/ios/core/IOSAudioRecorder.h +1 -1
  60. package/ios/audioapi/ios/core/IOSAudioRecorder.mm +5 -4
  61. package/ios/audioapi/ios/core/utils/FileOptions.h +3 -1
  62. package/ios/audioapi/ios/core/utils/FileOptions.mm +9 -3
  63. package/ios/audioapi/ios/core/utils/IOSFileWriter.h +2 -1
  64. package/ios/audioapi/ios/core/utils/IOSFileWriter.mm +5 -2
  65. package/lib/commonjs/api.js +11 -3
  66. package/lib/commonjs/api.js.map +1 -1
  67. package/lib/commonjs/api.web.js +4 -10
  68. package/lib/commonjs/api.web.js.map +1 -1
  69. package/lib/commonjs/core/AnalyserNode.js +11 -0
  70. package/lib/commonjs/core/AnalyserNode.js.map +1 -1
  71. package/lib/commonjs/core/AudioBuffer.js +20 -6
  72. package/lib/commonjs/core/AudioBuffer.js.map +1 -1
  73. package/lib/commonjs/core/AudioBufferQueueSourceNode.js +9 -0
  74. package/lib/commonjs/core/AudioBufferQueueSourceNode.js.map +1 -1
  75. package/lib/commonjs/core/AudioBufferSourceNode.js +9 -0
  76. package/lib/commonjs/core/AudioBufferSourceNode.js.map +1 -1
  77. package/lib/commonjs/core/AudioRecorder.js +3 -3
  78. package/lib/commonjs/core/AudioRecorder.js.map +1 -1
  79. package/lib/commonjs/core/BaseAudioContext.js +52 -65
  80. package/lib/commonjs/core/BaseAudioContext.js.map +1 -1
  81. package/lib/commonjs/core/BiquadFilterNode.js +7 -1
  82. package/lib/commonjs/core/BiquadFilterNode.js.map +1 -1
  83. package/lib/commonjs/core/ConstantSourceNode.js +7 -1
  84. package/lib/commonjs/core/ConstantSourceNode.js.map +1 -1
  85. package/lib/commonjs/core/ConvolverNode.js +9 -3
  86. package/lib/commonjs/core/ConvolverNode.js.map +1 -1
  87. package/lib/commonjs/core/DelayNode.js +7 -1
  88. package/lib/commonjs/core/DelayNode.js.map +1 -1
  89. package/lib/commonjs/core/GainNode.js +9 -3
  90. package/lib/commonjs/core/GainNode.js.map +1 -1
  91. package/lib/commonjs/core/IIRFilterNode.js +9 -0
  92. package/lib/commonjs/core/IIRFilterNode.js.map +1 -1
  93. package/lib/commonjs/core/OscillatorNode.js +10 -1
  94. package/lib/commonjs/core/OscillatorNode.js.map +1 -1
  95. package/lib/commonjs/core/PeriodicWave.js +30 -2
  96. package/lib/commonjs/core/PeriodicWave.js.map +1 -1
  97. package/lib/commonjs/core/RecorderAdapterNode.js +3 -0
  98. package/lib/commonjs/core/RecorderAdapterNode.js.map +1 -1
  99. package/lib/commonjs/core/StereoPannerNode.js +7 -1
  100. package/lib/commonjs/core/StereoPannerNode.js.map +1 -1
  101. package/lib/commonjs/core/StreamerNode.js +25 -1
  102. package/lib/commonjs/core/StreamerNode.js.map +1 -1
  103. package/lib/commonjs/core/WaveShaperNode.js +12 -0
  104. package/lib/commonjs/core/WaveShaperNode.js.map +1 -1
  105. package/lib/commonjs/core/WorkletNode.js +13 -1
  106. package/lib/commonjs/core/WorkletNode.js.map +1 -1
  107. package/lib/commonjs/core/WorkletProcessingNode.js +14 -1
  108. package/lib/commonjs/core/WorkletProcessingNode.js.map +1 -1
  109. package/lib/commonjs/core/WorkletSourceNode.js +13 -1
  110. package/lib/commonjs/core/WorkletSourceNode.js.map +1 -1
  111. package/lib/commonjs/defaults.js +78 -0
  112. package/lib/commonjs/defaults.js.map +1 -0
  113. package/lib/commonjs/options-validators.js +40 -0
  114. package/lib/commonjs/options-validators.js.map +1 -0
  115. package/lib/commonjs/types.js.map +1 -1
  116. package/lib/commonjs/web-core/AnalyserNode.js +2 -1
  117. package/lib/commonjs/web-core/AnalyserNode.js.map +1 -1
  118. package/lib/commonjs/web-core/AudioBuffer.js +14 -6
  119. package/lib/commonjs/web-core/AudioBuffer.js.map +1 -1
  120. package/lib/commonjs/web-core/AudioBufferSourceNode.js +276 -89
  121. package/lib/commonjs/web-core/AudioBufferSourceNode.js.map +1 -1
  122. package/lib/commonjs/web-core/AudioContext.js +33 -32
  123. package/lib/commonjs/web-core/AudioContext.js.map +1 -1
  124. package/lib/commonjs/web-core/AudioNode.js +4 -0
  125. package/lib/commonjs/web-core/AudioNode.js.map +1 -1
  126. package/lib/commonjs/web-core/BiquadFilterNode.js +2 -1
  127. package/lib/commonjs/web-core/BiquadFilterNode.js.map +1 -1
  128. package/lib/commonjs/web-core/ConstantSourceNode.js +2 -1
  129. package/lib/commonjs/web-core/ConstantSourceNode.js.map +1 -1
  130. package/lib/commonjs/web-core/ConvolverNode.js +3 -5
  131. package/lib/commonjs/web-core/ConvolverNode.js.map +1 -1
  132. package/lib/commonjs/web-core/DelayNode.js +7 -1
  133. package/lib/commonjs/web-core/DelayNode.js.map +1 -1
  134. package/lib/commonjs/web-core/GainNode.js +2 -1
  135. package/lib/commonjs/web-core/GainNode.js.map +1 -1
  136. package/lib/commonjs/web-core/IIRFilterNode.js +12 -0
  137. package/lib/commonjs/web-core/IIRFilterNode.js.map +1 -1
  138. package/lib/commonjs/web-core/OfflineAudioContext.js +33 -32
  139. package/lib/commonjs/web-core/OfflineAudioContext.js.map +1 -1
  140. package/lib/commonjs/web-core/OscillatorNode.js +2 -1
  141. package/lib/commonjs/web-core/OscillatorNode.js.map +1 -1
  142. package/lib/commonjs/web-core/PeriodicWave.js +6 -1
  143. package/lib/commonjs/web-core/PeriodicWave.js.map +1 -1
  144. package/lib/commonjs/web-core/StereoPannerNode.js +2 -1
  145. package/lib/commonjs/web-core/StereoPannerNode.js.map +1 -1
  146. package/lib/module/api.js +2 -1
  147. package/lib/module/api.js.map +1 -1
  148. package/lib/module/api.web.js +2 -1
  149. package/lib/module/api.web.js.map +1 -1
  150. package/lib/module/core/AnalyserNode.js +11 -0
  151. package/lib/module/core/AnalyserNode.js.map +1 -1
  152. package/lib/module/core/AudioBuffer.js +19 -6
  153. package/lib/module/core/AudioBuffer.js.map +1 -1
  154. package/lib/module/core/AudioBufferQueueSourceNode.js +9 -0
  155. package/lib/module/core/AudioBufferQueueSourceNode.js.map +1 -1
  156. package/lib/module/core/AudioBufferSourceNode.js +9 -0
  157. package/lib/module/core/AudioBufferSourceNode.js.map +1 -1
  158. package/lib/module/core/AudioRecorder.js +3 -4
  159. package/lib/module/core/AudioRecorder.js.map +1 -1
  160. package/lib/module/core/BaseAudioContext.js +52 -65
  161. package/lib/module/core/BaseAudioContext.js.map +1 -1
  162. package/lib/module/core/BiquadFilterNode.js +7 -1
  163. package/lib/module/core/BiquadFilterNode.js.map +1 -1
  164. package/lib/module/core/ConstantSourceNode.js +7 -1
  165. package/lib/module/core/ConstantSourceNode.js.map +1 -1
  166. package/lib/module/core/ConvolverNode.js +9 -3
  167. package/lib/module/core/ConvolverNode.js.map +1 -1
  168. package/lib/module/core/DelayNode.js +7 -1
  169. package/lib/module/core/DelayNode.js.map +1 -1
  170. package/lib/module/core/GainNode.js +9 -3
  171. package/lib/module/core/GainNode.js.map +1 -1
  172. package/lib/module/core/IIRFilterNode.js +9 -0
  173. package/lib/module/core/IIRFilterNode.js.map +1 -1
  174. package/lib/module/core/OscillatorNode.js +10 -1
  175. package/lib/module/core/OscillatorNode.js.map +1 -1
  176. package/lib/module/core/PeriodicWave.js +29 -2
  177. package/lib/module/core/PeriodicWave.js.map +1 -1
  178. package/lib/module/core/RecorderAdapterNode.js +3 -0
  179. package/lib/module/core/RecorderAdapterNode.js.map +1 -1
  180. package/lib/module/core/StereoPannerNode.js +7 -1
  181. package/lib/module/core/StereoPannerNode.js.map +1 -1
  182. package/lib/module/core/StreamerNode.js +25 -1
  183. package/lib/module/core/StreamerNode.js.map +1 -1
  184. package/lib/module/core/WaveShaperNode.js +12 -0
  185. package/lib/module/core/WaveShaperNode.js.map +1 -1
  186. package/lib/module/core/WorkletNode.js +13 -1
  187. package/lib/module/core/WorkletNode.js.map +1 -1
  188. package/lib/module/core/WorkletProcessingNode.js +14 -1
  189. package/lib/module/core/WorkletProcessingNode.js.map +1 -1
  190. package/lib/module/core/WorkletSourceNode.js +13 -1
  191. package/lib/module/core/WorkletSourceNode.js.map +1 -1
  192. package/lib/module/defaults.js +74 -0
  193. package/lib/module/defaults.js.map +1 -0
  194. package/lib/module/options-validators.js +36 -0
  195. package/lib/module/options-validators.js.map +1 -0
  196. package/lib/module/types.js.map +1 -1
  197. package/lib/module/web-core/AnalyserNode.js +2 -1
  198. package/lib/module/web-core/AnalyserNode.js.map +1 -1
  199. package/lib/module/web-core/AudioBuffer.js +13 -6
  200. package/lib/module/web-core/AudioBuffer.js.map +1 -1
  201. package/lib/module/web-core/AudioBufferSourceNode.js +277 -90
  202. package/lib/module/web-core/AudioBufferSourceNode.js.map +1 -1
  203. package/lib/module/web-core/AudioContext.js +33 -32
  204. package/lib/module/web-core/AudioContext.js.map +1 -1
  205. package/lib/module/web-core/AudioNode.js +4 -0
  206. package/lib/module/web-core/AudioNode.js.map +1 -1
  207. package/lib/module/web-core/BiquadFilterNode.js +2 -1
  208. package/lib/module/web-core/BiquadFilterNode.js.map +1 -1
  209. package/lib/module/web-core/ConstantSourceNode.js +2 -1
  210. package/lib/module/web-core/ConstantSourceNode.js.map +1 -1
  211. package/lib/module/web-core/ConvolverNode.js +3 -5
  212. package/lib/module/web-core/ConvolverNode.js.map +1 -1
  213. package/lib/module/web-core/DelayNode.js +7 -1
  214. package/lib/module/web-core/DelayNode.js.map +1 -1
  215. package/lib/module/web-core/GainNode.js +2 -1
  216. package/lib/module/web-core/GainNode.js.map +1 -1
  217. package/lib/module/web-core/IIRFilterNode.js +12 -0
  218. package/lib/module/web-core/IIRFilterNode.js.map +1 -1
  219. package/lib/module/web-core/OfflineAudioContext.js +33 -32
  220. package/lib/module/web-core/OfflineAudioContext.js.map +1 -1
  221. package/lib/module/web-core/OscillatorNode.js +2 -1
  222. package/lib/module/web-core/OscillatorNode.js.map +1 -1
  223. package/lib/module/web-core/PeriodicWave.js +6 -1
  224. package/lib/module/web-core/PeriodicWave.js.map +1 -1
  225. package/lib/module/web-core/StereoPannerNode.js +2 -1
  226. package/lib/module/web-core/StereoPannerNode.js.map +1 -1
  227. package/lib/typescript/api.d.ts +2 -1
  228. package/lib/typescript/api.d.ts.map +1 -1
  229. package/lib/typescript/api.web.d.ts +2 -1
  230. package/lib/typescript/api.web.d.ts.map +1 -1
  231. package/lib/typescript/core/AnalyserNode.d.ts +3 -1
  232. package/lib/typescript/core/AnalyserNode.d.ts.map +1 -1
  233. package/lib/typescript/core/AudioBuffer.d.ts +3 -0
  234. package/lib/typescript/core/AudioBuffer.d.ts.map +1 -1
  235. package/lib/typescript/core/AudioBufferQueueSourceNode.d.ts +3 -0
  236. package/lib/typescript/core/AudioBufferQueueSourceNode.d.ts.map +1 -1
  237. package/lib/typescript/core/AudioBufferSourceNode.d.ts +3 -0
  238. package/lib/typescript/core/AudioBufferSourceNode.d.ts.map +1 -1
  239. package/lib/typescript/core/AudioRecorder.d.ts +2 -2
  240. package/lib/typescript/core/AudioRecorder.d.ts.map +1 -1
  241. package/lib/typescript/core/BaseAudioContext.d.ts +10 -6
  242. package/lib/typescript/core/BaseAudioContext.d.ts.map +1 -1
  243. package/lib/typescript/core/BiquadFilterNode.d.ts +2 -3
  244. package/lib/typescript/core/BiquadFilterNode.d.ts.map +1 -1
  245. package/lib/typescript/core/ConstantSourceNode.d.ts +2 -2
  246. package/lib/typescript/core/ConstantSourceNode.d.ts.map +1 -1
  247. package/lib/typescript/core/ConvolverNode.d.ts +2 -2
  248. package/lib/typescript/core/ConvolverNode.d.ts.map +1 -1
  249. package/lib/typescript/core/DelayNode.d.ts +2 -2
  250. package/lib/typescript/core/DelayNode.d.ts.map +1 -1
  251. package/lib/typescript/core/GainNode.d.ts +2 -2
  252. package/lib/typescript/core/GainNode.d.ts.map +1 -1
  253. package/lib/typescript/core/IIRFilterNode.d.ts +3 -0
  254. package/lib/typescript/core/IIRFilterNode.d.ts.map +1 -1
  255. package/lib/typescript/core/OscillatorNode.d.ts +2 -3
  256. package/lib/typescript/core/OscillatorNode.d.ts.map +1 -1
  257. package/lib/typescript/core/PeriodicWave.d.ts +4 -1
  258. package/lib/typescript/core/PeriodicWave.d.ts.map +1 -1
  259. package/lib/typescript/core/RecorderAdapterNode.d.ts +2 -0
  260. package/lib/typescript/core/RecorderAdapterNode.d.ts.map +1 -1
  261. package/lib/typescript/core/StereoPannerNode.d.ts +2 -2
  262. package/lib/typescript/core/StereoPannerNode.d.ts.map +1 -1
  263. package/lib/typescript/core/StreamerNode.d.ts +5 -0
  264. package/lib/typescript/core/StreamerNode.d.ts.map +1 -1
  265. package/lib/typescript/core/WaveShaperNode.d.ts +3 -0
  266. package/lib/typescript/core/WaveShaperNode.d.ts.map +1 -1
  267. package/lib/typescript/core/WorkletNode.d.ts +3 -0
  268. package/lib/typescript/core/WorkletNode.d.ts.map +1 -1
  269. package/lib/typescript/core/WorkletProcessingNode.d.ts +3 -0
  270. package/lib/typescript/core/WorkletProcessingNode.d.ts.map +1 -1
  271. package/lib/typescript/core/WorkletSourceNode.d.ts +3 -0
  272. package/lib/typescript/core/WorkletSourceNode.d.ts.map +1 -1
  273. package/lib/typescript/defaults.d.ts +16 -0
  274. package/lib/typescript/defaults.d.ts.map +1 -0
  275. package/lib/typescript/interfaces.d.ts +17 -16
  276. package/lib/typescript/interfaces.d.ts.map +1 -1
  277. package/lib/typescript/options-validators.d.ts +6 -0
  278. package/lib/typescript/options-validators.d.ts.map +1 -0
  279. package/lib/typescript/types.d.ts +83 -11
  280. package/lib/typescript/types.d.ts.map +1 -1
  281. package/lib/typescript/web-core/AnalyserNode.d.ts +2 -2
  282. package/lib/typescript/web-core/AnalyserNode.d.ts.map +1 -1
  283. package/lib/typescript/web-core/AudioBuffer.d.ts +3 -0
  284. package/lib/typescript/web-core/AudioBuffer.d.ts.map +1 -1
  285. package/lib/typescript/web-core/AudioBufferSourceNode.d.ts +24 -15
  286. package/lib/typescript/web-core/AudioBufferSourceNode.d.ts.map +1 -1
  287. package/lib/typescript/web-core/AudioContext.d.ts +5 -6
  288. package/lib/typescript/web-core/AudioContext.d.ts.map +1 -1
  289. package/lib/typescript/web-core/AudioNode.d.ts +2 -2
  290. package/lib/typescript/web-core/AudioNode.d.ts.map +1 -1
  291. package/lib/typescript/web-core/BaseAudioContext.d.ts +3 -3
  292. package/lib/typescript/web-core/BaseAudioContext.d.ts.map +1 -1
  293. package/lib/typescript/web-core/BiquadFilterNode.d.ts +2 -2
  294. package/lib/typescript/web-core/BiquadFilterNode.d.ts.map +1 -1
  295. package/lib/typescript/web-core/ConstantSourceNode.d.ts +2 -1
  296. package/lib/typescript/web-core/ConstantSourceNode.d.ts.map +1 -1
  297. package/lib/typescript/web-core/ConvolverNode.d.ts +2 -1
  298. package/lib/typescript/web-core/ConvolverNode.d.ts.map +1 -1
  299. package/lib/typescript/web-core/DelayNode.d.ts +2 -1
  300. package/lib/typescript/web-core/DelayNode.d.ts.map +1 -1
  301. package/lib/typescript/web-core/GainNode.d.ts +2 -1
  302. package/lib/typescript/web-core/GainNode.d.ts.map +1 -1
  303. package/lib/typescript/web-core/IIRFilterNode.d.ts +3 -0
  304. package/lib/typescript/web-core/IIRFilterNode.d.ts.map +1 -1
  305. package/lib/typescript/web-core/OfflineAudioContext.d.ts +5 -6
  306. package/lib/typescript/web-core/OfflineAudioContext.d.ts.map +1 -1
  307. package/lib/typescript/web-core/OscillatorNode.d.ts +2 -2
  308. package/lib/typescript/web-core/OscillatorNode.d.ts.map +1 -1
  309. package/lib/typescript/web-core/PeriodicWave.d.ts +3 -1
  310. package/lib/typescript/web-core/PeriodicWave.d.ts.map +1 -1
  311. package/lib/typescript/web-core/StereoPannerNode.d.ts +2 -1
  312. package/lib/typescript/web-core/StereoPannerNode.d.ts.map +1 -1
  313. package/package.json +1 -1
  314. package/src/api.ts +3 -1
  315. package/src/api.web.ts +1 -2
  316. package/src/core/AnalyserNode.ts +16 -1
  317. package/src/core/AudioBuffer.ts +26 -6
  318. package/src/core/AudioBufferQueueSourceNode.ts +15 -0
  319. package/src/core/AudioBufferSourceNode.ts +12 -0
  320. package/src/core/AudioRecorder.ts +4 -3
  321. package/src/core/BaseAudioContext.ts +48 -151
  322. package/src/core/BiquadFilterNode.ts +9 -2
  323. package/src/core/ConstantSourceNode.ts +9 -1
  324. package/src/core/ConvolverNode.ts +11 -3
  325. package/src/core/DelayNode.ts +5 -2
  326. package/src/core/GainNode.ts +10 -3
  327. package/src/core/IIRFilterNode.ts +12 -0
  328. package/src/core/OscillatorNode.ts +13 -2
  329. package/src/core/PeriodicWave.ts +36 -2
  330. package/src/core/RecorderAdapterNode.ts +5 -0
  331. package/src/core/StereoPannerNode.ts +9 -1
  332. package/src/core/StreamerNode.ts +29 -1
  333. package/src/core/WaveShaperNode.ts +17 -0
  334. package/src/core/WorkletNode.ts +30 -1
  335. package/src/core/WorkletProcessingNode.ts +39 -1
  336. package/src/core/WorkletSourceNode.ts +36 -1
  337. package/src/defaults.ts +100 -0
  338. package/src/interfaces.ts +38 -25
  339. package/src/options-validators.ts +66 -0
  340. package/src/types.ts +100 -12
  341. package/src/web-core/AnalyserNode.tsx +15 -6
  342. package/src/web-core/AudioBuffer.tsx +20 -6
  343. package/src/web-core/AudioBufferSourceNode.tsx +393 -148
  344. package/src/web-core/AudioContext.tsx +22 -72
  345. package/src/web-core/AudioNode.tsx +6 -2
  346. package/src/web-core/BaseAudioContext.tsx +3 -7
  347. package/src/web-core/BiquadFilterNode.tsx +6 -2
  348. package/src/web-core/ConstantSourceNode.tsx +3 -1
  349. package/src/web-core/ConvolverNode.tsx +8 -8
  350. package/src/web-core/DelayNode.tsx +5 -1
  351. package/src/web-core/GainNode.tsx +3 -1
  352. package/src/web-core/IIRFilterNode.tsx +15 -0
  353. package/src/web-core/OfflineAudioContext.tsx +19 -67
  354. package/src/web-core/OscillatorNode.tsx +3 -2
  355. package/src/web-core/PeriodicWave.tsx +11 -1
  356. package/src/web-core/StereoPannerNode.tsx +9 -1
@@ -1,3 +1,4 @@
1
+ #include <audioapi/HostObjects/utils/NodeOptions.h>
1
2
  #include <audioapi/core/BaseAudioContext.h>
2
3
  #include <audioapi/core/effects/ConvolverNode.h>
3
4
  #include <audioapi/core/sources/AudioBuffer.h>
@@ -11,23 +12,18 @@
11
12
  #include <vector>
12
13
 
13
14
  namespace audioapi {
14
- ConvolverNode::ConvolverNode(
15
- std::shared_ptr<BaseAudioContext> context,
16
- const std::shared_ptr<AudioBuffer> &buffer,
17
- bool disableNormalization)
18
- : AudioNode(context),
15
+ ConvolverNode::ConvolverNode(std::shared_ptr<BaseAudioContext> context, const ConvolverOptions &options)
16
+ : AudioNode(context, options),
19
17
  gainCalibrationSampleRate_(context->getSampleRate()),
20
18
  remainingSegments_(0),
21
19
  internalBufferIndex_(0),
22
- normalize_(!disableNormalization),
20
+ normalize_(!options.disableNormalization),
23
21
  signalledToStop_(false),
24
22
  scaleFactor_(1.0f),
25
23
  intermediateBus_(nullptr),
26
24
  buffer_(nullptr),
27
25
  internalBuffer_(nullptr) {
28
- channelCount_ = 2;
29
- channelCountMode_ = ChannelCountMode::CLAMPED_MAX;
30
- setBuffer(buffer);
26
+ setBuffer(options.bus);
31
27
  audioBus_ =
32
28
  std::make_shared<AudioBus>(RENDER_QUANTUM_SIZE, channelCount_, context->getSampleRate());
33
29
  requiresTailProcessing_ = true;
@@ -17,13 +17,13 @@ namespace audioapi {
17
17
 
18
18
  class AudioBus;
19
19
  class AudioBuffer;
20
+ class ConvolverOptions;
20
21
 
21
22
  class ConvolverNode : public AudioNode {
22
23
  public:
23
24
  explicit ConvolverNode(
24
25
  std::shared_ptr<BaseAudioContext> context,
25
- const std::shared_ptr<AudioBuffer> &buffer,
26
- bool disableNormalization);
26
+ const ConvolverOptions &options);
27
27
 
28
28
  [[nodiscard]] bool getNormalize_() const;
29
29
  [[nodiscard]] const std::shared_ptr<AudioBuffer> &getBuffer() const;
@@ -1,3 +1,4 @@
1
+ #include <audioapi/HostObjects/utils/NodeOptions.h>
1
2
  #include <audioapi/core/BaseAudioContext.h>
2
3
  #include <audioapi/core/effects/DelayNode.h>
3
4
  #include <audioapi/dsp/VectorMath.h>
@@ -7,13 +8,13 @@
7
8
 
8
9
  namespace audioapi {
9
10
 
10
- DelayNode::DelayNode(std::shared_ptr<BaseAudioContext> context, float maxDelayTime)
11
- : AudioNode(context),
12
- delayTimeParam_(std::make_shared<AudioParam>(0, 0, maxDelayTime, context)),
11
+ DelayNode::DelayNode(std::shared_ptr<BaseAudioContext> context, const DelayOptions &options)
12
+ : AudioNode(context, options),
13
+ delayTimeParam_(std::make_shared<AudioParam>(options.delayTime, 0, options.maxDelayTime, context)),
13
14
  delayBuffer_(
14
15
  std::make_shared<AudioBus>(
15
16
  static_cast<size_t>(
16
- maxDelayTime * context->getSampleRate() +
17
+ options.maxDelayTime * context->getSampleRate() +
17
18
  1), // +1 to enable delayTime equal to maxDelayTime
18
19
  channelCount_,
19
20
  context->getSampleRate())) {
@@ -9,10 +9,11 @@
9
9
  namespace audioapi {
10
10
 
11
11
  class AudioBus;
12
+ class DelayOptions;
12
13
 
13
14
  class DelayNode : public AudioNode {
14
15
  public:
15
- explicit DelayNode(std::shared_ptr<BaseAudioContext> context, float maxDelayTime);
16
+ explicit DelayNode(std::shared_ptr<BaseAudioContext> context, const DelayOptions &options);
16
17
 
17
18
  [[nodiscard]] std::shared_ptr<AudioParam> getDelayTimeParam() const;
18
19
 
@@ -1,3 +1,4 @@
1
+ #include <audioapi/HostObjects/utils/NodeOptions.h>
1
2
  #include <audioapi/core/BaseAudioContext.h>
2
3
  #include <audioapi/core/effects/GainNode.h>
3
4
  #include <audioapi/dsp/VectorMath.h>
@@ -7,11 +8,11 @@
7
8
 
8
9
  namespace audioapi {
9
10
 
10
- GainNode::GainNode(std::shared_ptr<BaseAudioContext> context)
11
- : AudioNode(context),
11
+ GainNode::GainNode(std::shared_ptr<BaseAudioContext> context, const GainOptions &options)
12
+ : AudioNode(context, options),
12
13
  gainParam_(
13
14
  std::make_shared<AudioParam>(
14
- 1.0,
15
+ options.gain,
15
16
  MOST_NEGATIVE_SINGLE_FLOAT,
16
17
  MOST_POSITIVE_SINGLE_FLOAT,
17
18
  context)) {
@@ -8,10 +8,11 @@
8
8
  namespace audioapi {
9
9
 
10
10
  class AudioBus;
11
+ class GainOptions;
11
12
 
12
13
  class GainNode : public AudioNode {
13
14
  public:
14
- explicit GainNode(std::shared_ptr<BaseAudioContext> context);
15
+ explicit GainNode(std::shared_ptr<BaseAudioContext> context, const GainOptions &options);
15
16
 
16
17
  [[nodiscard]] std::shared_ptr<AudioParam> getGainParam() const;
17
18
 
@@ -23,6 +23,7 @@
23
23
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
24
  */
25
25
 
26
+ #include <audioapi/HostObjects/utils/NodeOptions.h>
26
27
  #include <audioapi/core/BaseAudioContext.h>
27
28
  #include <audioapi/core/effects/IIRFilterNode.h>
28
29
  #include <audioapi/core/utils/Constants.h>
@@ -30,16 +31,15 @@
30
31
  #include <audioapi/utils/AudioBus.h>
31
32
  #include <algorithm>
32
33
  #include <memory>
34
+ #include <utility>
33
35
  #include <vector>
34
36
 
35
37
  namespace audioapi {
36
38
 
37
- IIRFilterNode::IIRFilterNode(
38
- std::shared_ptr<BaseAudioContext> context,
39
- const std::vector<float> &feedforward,
40
- const std::vector<float> &feedback)
41
- : AudioNode(context), feedforward_(feedforward), feedback_(feedback) {
42
- channelCountMode_ = ChannelCountMode::MAX;
39
+ IIRFilterNode::IIRFilterNode(std::shared_ptr<BaseAudioContext> context, const IIRFilterOptions &options)
40
+ : AudioNode(context, options),
41
+ feedforward_(std::move(options.feedforward)),
42
+ feedback_(std::move(options.feedback)) {
43
43
 
44
44
  int maxChannels = MAX_CHANNEL_COUNT;
45
45
  xBuffers_.resize(maxChannels);
@@ -33,13 +33,14 @@
33
33
 
34
34
  namespace audioapi {
35
35
 
36
+ class IIRFilterOptions;
37
+
36
38
  class IIRFilterNode : public AudioNode {
37
39
 
38
40
  public:
39
41
  explicit IIRFilterNode(
40
42
  std::shared_ptr<BaseAudioContext> context,
41
- const std::vector<float> &feedforward,
42
- const std::vector<float> &feedback);
43
+ const IIRFilterOptions &options);
43
44
 
44
45
  void getFrequencyResponse(
45
46
  const float *frequencyArray,
@@ -1,3 +1,4 @@
1
+ #include <audioapi/HostObjects/utils/NodeOptions.h>
1
2
  #include <audioapi/core/BaseAudioContext.h>
2
3
  #include <audioapi/core/effects/StereoPannerNode.h>
3
4
  #include <audioapi/core/utils/Constants.h>
@@ -9,9 +10,8 @@
9
10
 
10
11
  namespace audioapi {
11
12
 
12
- StereoPannerNode::StereoPannerNode(std::shared_ptr<BaseAudioContext> context)
13
- : AudioNode(context), panParam_(std::make_shared<AudioParam>(0.0, -1.0f, 1.0f, context)) {
14
- channelCountMode_ = ChannelCountMode::CLAMPED_MAX;
13
+ StereoPannerNode::StereoPannerNode(std::shared_ptr<BaseAudioContext> context, const StereoPannerOptions &options)
14
+ : AudioNode(context, options), panParam_(std::make_shared<AudioParam>(options.pan, -1.0f, 1.0f, context)) {
15
15
  isInitialized_ = true;
16
16
  }
17
17
 
@@ -10,10 +10,13 @@
10
10
  namespace audioapi {
11
11
 
12
12
  class AudioBus;
13
+ class StereoPannerOptions;
13
14
 
14
15
  class StereoPannerNode : public AudioNode {
15
16
  public:
16
- explicit StereoPannerNode(std::shared_ptr<BaseAudioContext> context);
17
+ explicit StereoPannerNode(
18
+ std::shared_ptr<BaseAudioContext> context,
19
+ const StereoPannerOptions &options);
17
20
 
18
21
  [[nodiscard]] std::shared_ptr<AudioParam> getPanParam() const;
19
22
 
@@ -3,6 +3,7 @@
3
3
  #include <audioapi/dsp/VectorMath.h>
4
4
  #include <audioapi/utils/AudioArray.h>
5
5
  #include <audioapi/utils/AudioBus.h>
6
+ #include <audioapi/HostObjects/utils/NodeOptions.h>
6
7
 
7
8
  #include <algorithm>
8
9
  #include <memory>
@@ -10,14 +11,14 @@
10
11
 
11
12
  namespace audioapi {
12
13
 
13
- WaveShaperNode::WaveShaperNode(std::shared_ptr<BaseAudioContext> context)
14
- : AudioNode(context), oversample_(OverSampleType::OVERSAMPLE_NONE) {
14
+ WaveShaperNode::WaveShaperNode(std::shared_ptr<BaseAudioContext> context, const WaveShaperOptions &options)
15
+ : AudioNode(context, options), oversample_(options.oversample) {
15
16
 
16
17
  waveShapers_.reserve(6);
17
18
  for (int i = 0; i < channelCount_; i++) {
18
19
  waveShapers_.emplace_back(std::make_unique<WaveShaper>(nullptr));
19
20
  }
20
-
21
+ setCurve(options.curve);
21
22
  // to change after graph processing improvement - should be max
22
23
  channelCountMode_ = ChannelCountMode::CLAMPED_MAX;
23
24
  isInitialized_ = true;
@@ -16,10 +16,13 @@ namespace audioapi {
16
16
 
17
17
  class AudioBus;
18
18
  class AudioArray;
19
+ class WaveShaperOptions;
19
20
 
20
21
  class WaveShaperNode : public AudioNode {
21
22
  public:
22
- explicit WaveShaperNode(std::shared_ptr<BaseAudioContext> context);
23
+ explicit WaveShaperNode(
24
+ std::shared_ptr<BaseAudioContext> context,
25
+ const WaveShaperOptions &options);
23
26
 
24
27
  [[nodiscard]] std::string getOversample() const;
25
28
  [[nodiscard]] std::shared_ptr<AudioArray> getCurve() const;
@@ -25,7 +25,7 @@ class AudioRecorder {
25
25
  : audioEventHandlerRegistry_(audioEventHandlerRegistry) {}
26
26
  virtual ~AudioRecorder() = default;
27
27
 
28
- virtual Result<std::string, std::string> start() = 0;
28
+ virtual Result<std::string, std::string> start(const std::string &fileNameOverride) = 0;
29
29
  virtual Result<std::tuple<std::string, double, double>, std::string> stop() = 0;
30
30
 
31
31
  virtual Result<std::string, std::string> enableFileOutput(
@@ -1,3 +1,4 @@
1
+ #include <audioapi/HostObjects/utils/NodeOptions.h>
1
2
  #include <audioapi/core/sources/AudioBuffer.h>
2
3
  #include <audioapi/utils/AudioArray.h>
3
4
  #include <audioapi/utils/AudioBus.h>
@@ -8,8 +9,8 @@
8
9
 
9
10
  namespace audioapi {
10
11
 
11
- AudioBuffer::AudioBuffer(int numberOfChannels, size_t length, float sampleRate)
12
- : bus_(std::make_shared<AudioBus>(length, numberOfChannels, sampleRate)) {}
12
+ AudioBuffer::AudioBuffer(const AudioBufferOptions &options)
13
+ : bus_(std::make_shared<AudioBus>(options.length, options.numberOfChannels, options.sampleRate)) {}
13
14
 
14
15
  AudioBuffer::AudioBuffer(std::shared_ptr<AudioBus> bus) {
15
16
  bus_ = std::move(bus);
@@ -10,10 +10,11 @@
10
10
  namespace audioapi {
11
11
 
12
12
  class AudioBus;
13
+ class AudioBufferOptions;
13
14
 
14
15
  class AudioBuffer {
15
16
  public:
16
- explicit AudioBuffer(int numberOfChannels, size_t length, float sampleRate);
17
+ explicit AudioBuffer(const AudioBufferOptions &options);
17
18
  explicit AudioBuffer(std::shared_ptr<AudioBus> bus);
18
19
 
19
20
  [[nodiscard]] size_t getLength() const;
@@ -1,3 +1,4 @@
1
+ #include <audioapi/HostObjects/utils/NodeOptions.h>
1
2
  #include <audioapi/core/AudioParam.h>
2
3
  #include <audioapi/core/BaseAudioContext.h>
3
4
  #include <audioapi/core/sources/AudioBufferBaseSourceNode.h>
@@ -12,29 +13,22 @@
12
13
  namespace audioapi {
13
14
  AudioBufferBaseSourceNode::AudioBufferBaseSourceNode(
14
15
  std::shared_ptr<BaseAudioContext> context,
15
- bool pitchCorrection)
16
+ const BaseAudioBufferSourceOptions &options)
16
17
  : AudioScheduledSourceNode(context),
17
- pitchCorrection_(pitchCorrection),
18
- stretch_(std::make_shared<signalsmith::stretch::SignalsmithStretch<float>>()),
19
- playbackRateBus_(
20
- std::make_shared<AudioBus>(
21
- RENDER_QUANTUM_SIZE * 3,
22
- channelCount_,
23
- context->getSampleRate())),
24
- detuneParam_(
25
- std::make_shared<AudioParam>(
26
- 0.0,
27
- MOST_NEGATIVE_SINGLE_FLOAT,
28
- MOST_POSITIVE_SINGLE_FLOAT,
29
- context)),
30
- playbackRateParam_(
31
- std::make_shared<AudioParam>(
32
- 1.0,
33
- MOST_NEGATIVE_SINGLE_FLOAT,
34
- MOST_POSITIVE_SINGLE_FLOAT,
35
- context)),
36
- vReadIndex_(0.0),
37
- onPositionChangedInterval_(static_cast<int>(context->getSampleRate() * 0.1f)) {}
18
+ pitchCorrection_(options.pitchCorrection),
19
+ vReadIndex_(0.0) {
20
+ onPositionChangedInterval_ = static_cast<int>(context->getSampleRate() * 0.1);
21
+
22
+ detuneParam_ = std::make_shared<AudioParam>(
23
+ options.detune, MOST_NEGATIVE_SINGLE_FLOAT, MOST_POSITIVE_SINGLE_FLOAT, context);
24
+ playbackRateParam_ = std::make_shared<AudioParam>(
25
+ options.playbackRate, MOST_NEGATIVE_SINGLE_FLOAT, MOST_POSITIVE_SINGLE_FLOAT, context);
26
+
27
+ playbackRateBus_ =
28
+ std::make_shared<AudioBus>(RENDER_QUANTUM_SIZE * 3, channelCount_, context->getSampleRate());
29
+
30
+ stretch_ = std::make_shared<signalsmith::stretch::SignalsmithStretch<float>>();
31
+ }
38
32
 
39
33
  std::shared_ptr<AudioParam> AudioBufferBaseSourceNode::getDetuneParam() const {
40
34
  return detuneParam_;
@@ -11,12 +11,13 @@ namespace audioapi {
11
11
 
12
12
  class AudioBus;
13
13
  class AudioParam;
14
+ class BaseAudioBufferSourceOptions;
14
15
 
15
16
  class AudioBufferBaseSourceNode : public AudioScheduledSourceNode {
16
17
  public:
17
18
  explicit AudioBufferBaseSourceNode(
18
19
  std::shared_ptr<BaseAudioContext> context,
19
- bool pitchCorrection);
20
+ const BaseAudioBufferSourceOptions &options);
20
21
 
21
22
  [[nodiscard]] std::shared_ptr<AudioParam> getDetuneParam() const;
22
23
  [[nodiscard]] std::shared_ptr<AudioParam> getPlaybackRateParam() const;
@@ -1,3 +1,4 @@
1
+ #include <audioapi/HostObjects/utils/NodeOptions.h>
1
2
  #include <audioapi/core/AudioParam.h>
2
3
  #include <audioapi/core/BaseAudioContext.h>
3
4
  #include <audioapi/core/sources/AudioBufferQueueSourceNode.h>
@@ -18,19 +19,21 @@
18
19
  namespace audioapi {
19
20
 
20
21
  AudioBufferQueueSourceNode::AudioBufferQueueSourceNode(
21
- std::shared_ptr<BaseAudioContext> context,
22
- bool pitchCorrection)
23
- : AudioBufferBaseSourceNode(context, pitchCorrection), buffers_() {
22
+ std::shared_ptr<BaseAudioContext> context,
23
+ const BaseAudioBufferSourceOptions &options)
24
+ : AudioBufferBaseSourceNode(context, options) {
25
+ buffers_ = {};
24
26
  stretch_->presetDefault(channelCount_, context->getSampleRate());
25
27
 
26
- if (pitchCorrection) {
28
+ if (options.pitchCorrection) {
27
29
  // If pitch correction is enabled, add extra frames at the end
28
30
  // to compensate for processing latency.
29
31
  addExtraTailFrames_ = true;
30
32
 
31
33
  int extraTailFrames = static_cast<int>(stretch_->inputLatency() + stretch_->outputLatency());
32
- tailBuffer_ =
33
- std::make_shared<AudioBuffer>(channelCount_, extraTailFrames, context->getSampleRate());
34
+ auto audioBufferOptions = AudioBufferOptions(
35
+ extraTailFrames, static_cast<size_t>(channelCount_), context->getSampleRate());
36
+ tailBuffer_ = std::make_shared<AudioBuffer>(audioBufferOptions);
34
37
 
35
38
  tailBuffer_->bus_->zero();
36
39
  }
@@ -14,12 +14,13 @@ namespace audioapi {
14
14
 
15
15
  class AudioBus;
16
16
  class AudioParam;
17
+ class BaseAudioBufferSourceOptions;
17
18
 
18
19
  class AudioBufferQueueSourceNode : public AudioBufferBaseSourceNode {
19
20
  public:
20
21
  explicit AudioBufferQueueSourceNode(
21
22
  std::shared_ptr<BaseAudioContext> context,
22
- bool pitchCorrection);
23
+ const BaseAudioBufferSourceOptions &options);
23
24
  ~AudioBufferQueueSourceNode() override;
24
25
 
25
26
  void stop(double when) override;
@@ -1,3 +1,4 @@
1
+ #include <audioapi/HostObjects/utils/NodeOptions.h>
1
2
  #include <audioapi/core/AudioParam.h>
2
3
  #include <audioapi/core/BaseAudioContext.h>
3
4
  #include <audioapi/core/sources/AudioBufferSourceNode.h>
@@ -14,14 +15,15 @@ namespace audioapi {
14
15
 
15
16
  AudioBufferSourceNode::AudioBufferSourceNode(
16
17
  std::shared_ptr<BaseAudioContext> context,
17
- bool pitchCorrection)
18
- : AudioBufferBaseSourceNode(context, pitchCorrection),
19
- loop_(false),
18
+ const AudioBufferSourceOptions &options)
19
+ : AudioBufferBaseSourceNode(context, options),
20
+ loop_(options.loop),
20
21
  loopSkip_(false),
21
- loopStart_(0),
22
- loopEnd_(0),
23
- buffer_(nullptr),
24
- alignedBus_(nullptr) {
22
+ loopStart_(options.loopStart),
23
+ loopEnd_(options.loopEnd) {
24
+ buffer_ = std::shared_ptr<AudioBuffer>(options.buffer);
25
+ alignedBus_ = std::shared_ptr<AudioBus>(nullptr);
26
+
25
27
  isInitialized_ = true;
26
28
  }
27
29
 
@@ -13,10 +13,13 @@ namespace audioapi {
13
13
 
14
14
  class AudioBus;
15
15
  class AudioParam;
16
+ class AudioBufferSourceOptions;
16
17
 
17
18
  class AudioBufferSourceNode : public AudioBufferBaseSourceNode {
18
19
  public:
19
- explicit AudioBufferSourceNode(std::shared_ptr<BaseAudioContext> context, bool pitchCorrection);
20
+ explicit AudioBufferSourceNode(
21
+ std::shared_ptr<BaseAudioContext> context,
22
+ const AudioBufferSourceOptions &options);
20
23
  ~AudioBufferSourceNode() override;
21
24
 
22
25
  [[nodiscard]] bool getLoop() const;
@@ -1,3 +1,4 @@
1
+ #include <audioapi/HostObjects/utils/NodeOptions.h>
1
2
  #include <audioapi/core/BaseAudioContext.h>
2
3
  #include <audioapi/core/sources/ConstantSourceNode.h>
3
4
  #include <audioapi/dsp/AudioUtils.h>
@@ -6,14 +7,10 @@
6
7
  #include <memory>
7
8
 
8
9
  namespace audioapi {
9
- ConstantSourceNode::ConstantSourceNode(std::shared_ptr<BaseAudioContext> context)
10
- : AudioScheduledSourceNode(context),
11
- offsetParam_(
12
- std::make_shared<AudioParam>(
13
- 1.0,
14
- MOST_NEGATIVE_SINGLE_FLOAT,
15
- MOST_POSITIVE_SINGLE_FLOAT,
16
- context)) {
10
+ ConstantSourceNode::ConstantSourceNode(std::shared_ptr<BaseAudioContext> context, const ConstantSourceOptions &options)
11
+ : AudioScheduledSourceNode(context) {
12
+ offsetParam_ = std::make_shared<AudioParam>(
13
+ options.offset, MOST_NEGATIVE_SINGLE_FLOAT, MOST_POSITIVE_SINGLE_FLOAT, context);
17
14
  isInitialized_ = true;
18
15
  }
19
16
 
@@ -10,10 +10,13 @@
10
10
  namespace audioapi {
11
11
 
12
12
  class AudioBus;
13
+ class ConstantSourceOptions;
13
14
 
14
15
  class ConstantSourceNode : public AudioScheduledSourceNode {
15
16
  public:
16
- explicit ConstantSourceNode(std::shared_ptr<BaseAudioContext> context);
17
+ explicit ConstantSourceNode(
18
+ std::shared_ptr<BaseAudioContext> context,
19
+ const ConstantSourceOptions &options);
17
20
 
18
21
  [[nodiscard]] std::shared_ptr<AudioParam> getOffsetParam() const;
19
22
 
@@ -1,3 +1,4 @@
1
+ #include <audioapi/HostObjects/utils/NodeOptions.h>
1
2
  #include <audioapi/core/BaseAudioContext.h>
2
3
  #include <audioapi/core/sources/OscillatorNode.h>
3
4
  #include <audioapi/dsp/AudioUtils.h>
@@ -8,23 +9,27 @@
8
9
 
9
10
  namespace audioapi {
10
11
 
11
- OscillatorNode::OscillatorNode(std::shared_ptr<BaseAudioContext> context)
12
- : AudioScheduledSourceNode(context),
13
- frequencyParam_(
14
- std::make_shared<AudioParam>(
15
- 444.0,
16
- -context->getNyquistFrequency(),
17
- context->getNyquistFrequency(),
18
- context)),
19
- detuneParam_(
20
- std::make_shared<AudioParam>(
21
- 0.0,
22
- -1200 * LOG2_MOST_POSITIVE_SINGLE_FLOAT,
23
- 1200 * LOG2_MOST_POSITIVE_SINGLE_FLOAT,
24
- context)),
25
- type_(OscillatorType::SINE),
26
- periodicWave_(context->getBasicWaveForm(type_)) {
12
+ OscillatorNode::OscillatorNode(std::shared_ptr<BaseAudioContext> context, const OscillatorOptions &options)
13
+ : AudioScheduledSourceNode(context) {
14
+ frequencyParam_ = std::make_shared<AudioParam>(
15
+ options.frequency,
16
+ -context->getNyquistFrequency(),
17
+ context->getNyquistFrequency(),
18
+ context);
19
+ detuneParam_ = std::make_shared<AudioParam>(
20
+ options.detune,
21
+ -1200 * LOG2_MOST_POSITIVE_SINGLE_FLOAT,
22
+ 1200 * LOG2_MOST_POSITIVE_SINGLE_FLOAT,
23
+ context);
24
+ type_ = options.type;
25
+ if (options.periodicWave) {
26
+ periodicWave_ = options.periodicWave;
27
+ } else {
28
+ periodicWave_ = context->getBasicWaveForm(type_);
29
+ }
30
+
27
31
  audioBus_ = std::make_shared<AudioBus>(RENDER_QUANTUM_SIZE, 1, context->getSampleRate());
32
+
28
33
  isInitialized_ = true;
29
34
  }
30
35
 
@@ -13,10 +13,13 @@
13
13
  namespace audioapi {
14
14
 
15
15
  class AudioBus;
16
+ class OscillatorOptions;
16
17
 
17
18
  class OscillatorNode : public AudioScheduledSourceNode {
18
19
  public:
19
- explicit OscillatorNode(std::shared_ptr<BaseAudioContext> context);
20
+ explicit OscillatorNode(
21
+ std::shared_ptr<BaseAudioContext> context,
22
+ const OscillatorOptions &options);
20
23
 
21
24
  [[nodiscard]] std::shared_ptr<AudioParam> getFrequencyParam() const;
22
25
  [[nodiscard]] std::shared_ptr<AudioParam> getDetuneParam() const;
@@ -8,6 +8,7 @@
8
8
  * FFmpeg, you must comply with the terms of the LGPL for FFmpeg itself.
9
9
  */
10
10
 
11
+ #include <audioapi/HostObjects/utils/NodeOptions.h>
11
12
  #include <audioapi/core/BaseAudioContext.h>
12
13
  #include <audioapi/core/sources/StreamerNode.h>
13
14
  #include <audioapi/core/utils/Locker.h>
@@ -22,7 +23,7 @@
22
23
 
23
24
  namespace audioapi {
24
25
  #if !RN_AUDIO_API_FFMPEG_DISABLED
25
- StreamerNode::StreamerNode(std::shared_ptr<BaseAudioContext> context)
26
+ StreamerNode::StreamerNode(std::shared_ptr<BaseAudioContext> context, const StreamerOptions &options)
26
27
  : AudioScheduledSourceNode(context),
27
28
  fmtCtx_(nullptr),
28
29
  codecCtx_(nullptr),
@@ -37,7 +38,7 @@ StreamerNode::StreamerNode(std::shared_ptr<BaseAudioContext> context)
37
38
  maxResampledSamples_(0),
38
39
  processedSamples_(0) {}
39
40
  #else
40
- StreamerNode::StreamerNode(std::shared_ptr<BaseAudioContext> context) : AudioScheduledSourceNode(context) {}
41
+ StreamerNode::StreamerNode(std::shared_ptr<BaseAudioContext> context, const StreamerOptions &options) : AudioScheduledSourceNode(context) {}
41
42
  #endif // RN_AUDIO_API_FFMPEG_DISABLED
42
43
 
43
44
  StreamerNode::~StreamerNode() {
@@ -48,6 +49,7 @@ StreamerNode::~StreamerNode() {
48
49
 
49
50
  bool StreamerNode::initialize(const std::string &input_url) {
50
51
  #if !RN_AUDIO_API_FFMPEG_DISABLED
52
+ streamPath_ = input_url;
51
53
  std::shared_ptr<BaseAudioContext> context = context_.lock();
52
54
  if (context == nullptr) {
53
55
  return false;
@@ -59,10 +59,11 @@ struct StreamingData {
59
59
  namespace audioapi {
60
60
 
61
61
  class AudioBus;
62
+ class StreamerOptions;
62
63
 
63
64
  class StreamerNode : public AudioScheduledSourceNode {
64
65
  public:
65
- explicit StreamerNode(std::shared_ptr<BaseAudioContext> context);
66
+ explicit StreamerNode(std::shared_ptr<BaseAudioContext> context, const StreamerOptions &options);
66
67
  ~StreamerNode() override;
67
68
 
68
69
  /**
@@ -70,6 +71,14 @@ class StreamerNode : public AudioScheduledSourceNode {
70
71
  */
71
72
  bool initialize(const std::string &inputUrl);
72
73
 
74
+ std::string getStreamPath() const {
75
+ #if !RN_AUDIO_API_TEST
76
+ return streamPath_;
77
+ #else
78
+ return "";
79
+ #endif // RN_AUDIO_API_TEST
80
+ }
81
+
73
82
  protected:
74
83
  std::shared_ptr<AudioBus> processNode(
75
84
  const std::shared_ptr<AudioBus> &processingBus,
@@ -103,6 +112,7 @@ class StreamerNode : public AudioScheduledSourceNode {
103
112
  STREAMER_NODE_SPSC_OVERFLOW_STRATEGY,
104
113
  STREAMER_NODE_SPSC_WAIT_STRATEGY>
105
114
  receiver_;
115
+ std::string streamPath_;
106
116
 
107
117
  /**
108
118
  * @brief Setting up the resampler
@@ -1,3 +1,4 @@
1
+ #include <audioapi/HostObjects/utils/NodeOptions.h>
1
2
  #include <audioapi/core/OfflineAudioContext.h>
2
3
  #include <audioapi/core/sources/ConstantSourceNode.h>
3
4
  #include <audioapi/core/utils/worklets/SafeIncludes.h>
@@ -26,7 +27,7 @@ class ConstantSourceTest : public ::testing::Test {
26
27
  class TestableConstantSourceNode : public ConstantSourceNode {
27
28
  public:
28
29
  explicit TestableConstantSourceNode(std::shared_ptr<BaseAudioContext> context)
29
- : ConstantSourceNode(context) {}
30
+ : ConstantSourceNode(context, ConstantSourceOptions()) {}
30
31
 
31
32
  void setOffsetParam(float value) {
32
33
  getOffsetParam()->setValue(value);
@@ -40,7 +41,7 @@ class TestableConstantSourceNode : public ConstantSourceNode {
40
41
  };
41
42
 
42
43
  TEST_F(ConstantSourceTest, ConstantSourceCanBeCreated) {
43
- auto constantSource = context->createConstantSource();
44
+ auto constantSource = context->createConstantSource(ConstantSourceOptions());
44
45
  ASSERT_NE(constantSource, nullptr);
45
46
  }
46
47