@libraz/libsonare 1.4.1 → 1.5.1

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 (66) hide show
  1. package/README.md +51 -20
  2. package/dist/index.d.ts +5416 -1
  3. package/dist/index.js +938 -583
  4. package/dist/index.js.map +1 -1
  5. package/dist/sonare.js +2 -2
  6. package/dist/sonare.wasm +0 -0
  7. package/dist/worklet.d.ts +1083 -5227
  8. package/dist/worklet.js +2683 -2451
  9. package/dist/worklet.js.map +1 -1
  10. package/package.json +4 -9
  11. package/src/clip_page_streamer.ts +298 -0
  12. package/src/effects_mastering.ts +85 -1089
  13. package/src/effects_transform.ts +286 -0
  14. package/src/effects_voice_change.ts +118 -0
  15. package/src/feature_music.ts +5 -2
  16. package/src/feature_spectrogram.ts +42 -2
  17. package/src/features.ts +1 -0
  18. package/src/index.ts +23 -0
  19. package/src/mastering_chain.ts +200 -0
  20. package/src/mastering_core.ts +248 -0
  21. package/src/mastering_dynamics.ts +105 -0
  22. package/src/mastering_repair.ts +161 -0
  23. package/src/mixer.ts +8 -0
  24. package/src/mixing_oneshot.ts +54 -0
  25. package/src/module_state.ts +1 -2
  26. package/src/project.ts +71 -1712
  27. package/src/project_class.ts +871 -0
  28. package/src/project_internal.ts +333 -0
  29. package/src/project_synth.ts +43 -0
  30. package/src/project_types.ts +570 -0
  31. package/src/public_types.ts +6 -1221
  32. package/src/public_types_acoustic.ts +115 -0
  33. package/src/public_types_mastering.ts +333 -0
  34. package/src/public_types_mixing.ts +97 -0
  35. package/src/public_types_music.ts +352 -0
  36. package/src/public_types_realtime.ts +163 -0
  37. package/src/public_types_spectral.ts +194 -0
  38. package/src/realtime_engine.ts +94 -0
  39. package/src/sonare.js.d.ts +117 -38
  40. package/src/stream_analyzer.ts +3 -0
  41. package/src/stream_types.ts +4 -0
  42. package/src/worklet/engine-automation.ts +73 -0
  43. package/src/worklet/engine-capture-facade.ts +80 -0
  44. package/src/worklet/engine-clips.ts +71 -0
  45. package/src/worklet/engine-markers.ts +93 -0
  46. package/src/worklet/engine-mixer-facade.ts +186 -0
  47. package/src/worklet/engine-node.ts +451 -0
  48. package/src/worklet/engine-offline.ts +162 -0
  49. package/src/worklet/engine-options.ts +13 -0
  50. package/src/worklet/engine-parameter-facade.ts +172 -0
  51. package/src/worklet/engine-processor.ts +764 -0
  52. package/src/worklet/engine-register.ts +136 -0
  53. package/src/worklet/engine-strips.ts +315 -0
  54. package/src/worklet/engine-sync.ts +94 -0
  55. package/src/worklet/engine-tempo-facade.ts +141 -0
  56. package/src/worklet/engine.ts +998 -0
  57. package/src/worklet/guards.ts +14 -1
  58. package/src/worklet/messages.ts +60 -20
  59. package/src/worklet/mixer-processor.ts +368 -0
  60. package/src/worklet/protocol.ts +3 -0
  61. package/src/worklet/voice-changer-processor.ts +246 -0
  62. package/src/worklet.ts +20 -3549
  63. package/dist/sonare-rt-module.js +0 -2
  64. package/dist/sonare-rt.js +0 -2
  65. package/dist/sonare-rt.wasm +0 -0
  66. package/src/sonare-rt.d.ts +0 -93
@@ -1,2 +0,0 @@
1
- async function SonareRt(moduleArg={}){var Module=moduleArg;var ENVIRONMENT_IS_WASM_WORKER=globalThis.name=="em-ww";var ENVIRONMENT_IS_AUDIO_WORKLET=false;if(ENVIRONMENT_IS_AUDIO_WORKLET)ENVIRONMENT_IS_WASM_WORKER=true;var ENVIRONMENT_IS_WEB=!!globalThis.window;var ENVIRONMENT_IS_WORKER=!!globalThis.WorkerGlobalScope||!!globalThis.AudioWorkletGlobalScope;var ENVIRONMENT_IS_NODE=globalThis.process?.versions?.node&&globalThis.process?.type!="renderer";if(ENVIRONMENT_IS_NODE){const{createRequire}=await import("node:module");var require=createRequire(import.meta.url);var worker_threads=require("node:worker_threads");globalThis.Worker=worker_threads.Worker;ENVIRONMENT_IS_WORKER=!worker_threads.isMainThread;ENVIRONMENT_IS_WASM_WORKER=ENVIRONMENT_IS_WORKER&&worker_threads.workerData=="em-ww"}var programArgs=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var _scriptName=import.meta.url;var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var readAsync,readBinary;if(ENVIRONMENT_IS_NODE){var fs=require("node:fs");if(_scriptName.startsWith("file:")){scriptDirectory=require("node:path").dirname(require("node:url").fileURLToPath(_scriptName))+"/"}readBinary=filename=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename);return ret};readAsync=async(filename,binary=true)=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename,binary?undefined:"utf8");return ret};if(process.argv.length>1){thisProgram=process.argv[1].replace(/\\/g,"/")}programArgs=process.argv.slice(2);quit_=(status,toThrow)=>{process.exitCode=status;throw toThrow}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){try{scriptDirectory=new URL(".",_scriptName).href}catch{}{if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=async url=>{if(isFileURI(url)){return new Promise((resolve,reject)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){resolve(xhr.response);return}reject(xhr.status)};xhr.onerror=reject;xhr.send(null)})}var response=await fetch(url,{credentials:"same-origin"});if(response.ok){return response.arrayBuffer()}throw new Error(response.status+" : "+response.url)}}}else{}var defaultPrint=console.log.bind(console);var defaultPrintErr=console.error.bind(console);if(ENVIRONMENT_IS_NODE){var utils=require("node:util");var stringify=a=>typeof a=="object"?utils.inspect(a):a;defaultPrint=(...args)=>fs.writeSync(1,args.map(stringify).join(" ")+"\n");defaultPrintErr=(...args)=>fs.writeSync(2,args.map(stringify).join(" ")+"\n")}var out=defaultPrint;var err=defaultPrintErr;var wasmBinary;var wasmModule;var ABORT=false;var EXITSTATUS;var isFileURI=filename=>filename.startsWith("file://");class EmscriptenEH{}class EmscriptenSjLj extends EmscriptenEH{}if(ENVIRONMENT_IS_NODE&&ENVIRONMENT_IS_WASM_WORKER){globalThis.self=globalThis;var parentPort=worker_threads.parentPort;if(!globalThis.postMessage){parentPort.on("message",msg=>globalThis.onmessage?.({data:msg}));globalThis.postMessage=msg=>parentPort.postMessage(msg)}process.on("uncaughtException",err=>{postMessage({cmd:8,error:err});process.exit(1)})}var wwParams;function startWasmWorker(props){wwParams=props;wasmMemory=props.wasmMemory;updateMemoryViews();wasmModule=props.wasm;createWasm();run();props.wasm=props.wasmMemory=0}if(ENVIRONMENT_IS_WASM_WORKER&&!ENVIRONMENT_IS_AUDIO_WORKLET){if(ENVIRONMENT_IS_NODE){var wrappedHandlers=new WeakMap;globalThis.onmessage=null;function wrapMsgHandler(h){var f=wrappedHandlers.get(h);if(!f){f=msg=>h({data:msg});wrappedHandlers.set(h,f)}return f}Object.assign(globalThis,{addEventListener:(name,handler)=>parentPort["on"](name,wrapMsgHandler(handler)),removeEventListener:(name,handler)=>parentPort["off"](name,wrapMsgHandler(handler))})}onmessage=d=>{onmessage=null;startWasmWorker(d.data)}}if(ENVIRONMENT_IS_AUDIO_WORKLET){function createWasmAudioWorkletProcessor(audioParams){class WasmAudioWorkletProcessor extends AudioWorkletProcessor{constructor(args){super();let opts=args.processorOptions;this.callback=getWasmTableEntry(opts.callback);this.userData=opts.userData;this.samplesPerChannel=opts.samplesPerChannel;this.bytesPerChannel=this.samplesPerChannel*4;this.outputViews=new Array(Math.min((wwParams.stackSize-16)/this.bytesPerChannel|0,64));this.createOutputViews()}createOutputViews(){var oldStackPtr=stackSave();var viewDataIdx=stackAlloc(this.outputViews.length*this.bytesPerChannel)>>2;for(var n=this.outputViews.length-1;n>=0;n--){this.outputViews[n]=HEAPF32.subarray(viewDataIdx,viewDataIdx+=this.samplesPerChannel)}stackRestore(oldStackPtr)}static get parameterDescriptors(){return audioParams}process(inputList,outputList,parameters){var numInputs=inputList.length;var numOutputs=outputList.length;var entry;var subentry;var stackMemoryStruct=(numInputs+numOutputs)*12;var stackMemoryData=0;for(entry of inputList){stackMemoryData+=entry.length}stackMemoryData*=this.bytesPerChannel;var outputViewsNeeded=0;for(entry of outputList){outputViewsNeeded+=entry.length}stackMemoryData+=outputViewsNeeded*this.bytesPerChannel;var numParams=0;for(entry in parameters){++numParams;stackMemoryStruct+=8;stackMemoryData+=parameters[entry].byteLength}var oldStackPtr=stackSave();var stackMemoryAligned=stackMemoryStruct+stackMemoryData+15&~15;var structPtr=stackAlloc(stackMemoryAligned);var dataPtr=structPtr+(stackMemoryAligned-stackMemoryData);var inputsPtr=structPtr;for(entry of inputList){HEAPU32[structPtr>>2]=entry.length;HEAPU32[structPtr+4>>2]=this.samplesPerChannel;HEAPU32[structPtr+8>>2]=dataPtr;structPtr+=12;for(subentry of entry){HEAPF32.set(subentry,dataPtr>>2);dataPtr+=this.bytesPerChannel}}var paramsPtr=structPtr;for(entry=0;subentry=parameters[entry++];){HEAPU32[structPtr>>2]=subentry.length;HEAPU32[structPtr+4>>2]=dataPtr;structPtr+=8;HEAPF32.set(subentry,dataPtr>>2);dataPtr+=subentry.length*4}var outputsPtr=structPtr;for(entry of outputList){HEAPU32[structPtr>>2]=entry.length;HEAPU32[structPtr+4>>2]=this.samplesPerChannel;HEAPU32[structPtr+8>>2]=dataPtr;structPtr+=12;dataPtr+=this.bytesPerChannel*entry.length}var didProduceAudio=this.callback(numInputs,inputsPtr,numOutputs,outputsPtr,numParams,paramsPtr,this.userData);if(didProduceAudio){for(entry of outputList){for(subentry of entry){subentry.set(this.outputViews[--outputViewsNeeded])}}}stackRestore(oldStackPtr);return!!didProduceAudio}}return WasmAudioWorkletProcessor}var port=globalThis.port||{};class BootstrapMessages extends AudioWorkletProcessor{constructor(arg){super();startWasmWorker(arg.processorOptions);if(!(port instanceof MessagePort)){this.port.onmessage=port.onmessage;port=this.port}}process(){}}registerProcessor("em-bootstrap",BootstrapMessages);port.onmessage=async msg=>{let d=msg.data;if(d["_boot"]){startWasmWorker(d)}else if(d["_wpn"]){registerProcessor(d["_wpn"],createWasmAudioWorkletProcessor(d.audioParams));port.postMessage({_wsc:d.callback,args:[d.contextHandle,1,d.userData]})}else if(d["_wsc"]){getWasmTableEntry(d["_wsc"])(...d.args)}}}var runtimeInitialized=false;function updateMemoryViews(){var b=wasmMemory.buffer;HEAP8=new Int8Array(b);HEAP16=new Int16Array(b);HEAPU8=new Uint8Array(b);HEAPU16=new Uint16Array(b);HEAP32=new Int32Array(b);HEAPU32=new Uint32Array(b);HEAPF32=new Float32Array(b);HEAPF64=new Float64Array(b);HEAP64=new BigInt64Array(b);HEAPU64=new BigUint64Array(b)}function initMemory(){if(ENVIRONMENT_IS_WASM_WORKER){return}if(Module["wasmMemory"]){wasmMemory=Module["wasmMemory"]}else{var INITIAL_MEMORY=Module["INITIAL_MEMORY"]||67108864;wasmMemory=new WebAssembly.Memory({initial:INITIAL_MEMORY/65536,maximum:INITIAL_MEMORY/65536,shared:true})}updateMemoryViews()}function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(onPreRuns)}function initRuntime(){runtimeInitialized=true;if(ENVIRONMENT_IS_WASM_WORKER)return _wasmWorkerInitializeRuntime();wasmExports["g"]()}function postRun(){if(ENVIRONMENT_IS_WASM_WORKER){return}if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(onPostRuns)}function abort(what){Module["onAbort"]?.(what);what=`Aborted(${what})`;err(what);ABORT=true;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);throw e}var wasmBinaryFile;function findWasmBinary(){return locateFile("sonare-rt.wasm")}function getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}async function getWasmBinary(binaryFile){if(!wasmBinary){try{var response=await readAsync(binaryFile);return new Uint8Array(response)}catch{}}return getBinarySync(binaryFile)}async function instantiateArrayBuffer(binaryFile,imports){try{var binary=await getWasmBinary(binaryFile);var instance=await WebAssembly.instantiate(binary,imports);return instance}catch(reason){err(`failed to asynchronously prepare wasm: ${reason}`);abort(reason)}}async function instantiateAsync(binary,binaryFile,imports){if(!binary&&!isFileURI(binaryFile)&&!ENVIRONMENT_IS_NODE){try{var response=fetch(binaryFile,{credentials:"same-origin"});var instantiationResult=await WebAssembly.instantiateStreaming(response,imports);return instantiationResult}catch(reason){err(`wasm streaming compile failed: ${reason}`);err("falling back to ArrayBuffer instantiation")}}return instantiateArrayBuffer(binaryFile,imports)}function getWasmImports(){assignWasmImports();var imports={a:wasmImports};return imports}async function createWasm(){function receiveInstance(instance,module){wasmExports=instance.exports;assignWasmExports(wasmExports);wasmModule=module;return wasmExports}function receiveInstantiationResult(result){return receiveInstance(result["instance"],result["module"])}var info=getWasmImports();if(Module["instantiateWasm"]){return new Promise((resolve,reject)=>{Module["instantiateWasm"](info,(inst,mod)=>{resolve(receiveInstance(inst,mod))})})}if(ENVIRONMENT_IS_WASM_WORKER){var instance=new WebAssembly.Instance(wasmModule,getWasmImports());return receiveInstance(instance,wasmModule)}wasmBinaryFile??=findWasmBinary();var result=await instantiateAsync(wasmBinary,wasmBinaryFile,info);var exports=receiveInstantiationResult(result);return exports}class ExitStatus{name="ExitStatus";constructor(status){this.message=`Program terminated with exit(${status})`;this.status=status}}var HEAP16;var HEAP32;var HEAP64;var HEAP8;var HEAPF32;var HEAPF64;var HEAPU16;var HEAPU32;var HEAPU64;var HEAPU8;var _wasmWorkerDelayedMessageQueue=[];var handleException=e=>{if(e instanceof ExitStatus||e=="unwind"){return EXITSTATUS}quit_(1,e)};var runtimeKeepaliveCounter=0;var keepRuntimeAlive=()=>noExitRuntime||runtimeKeepaliveCounter>0;var _proc_exit=code=>{EXITSTATUS=code;if(!keepRuntimeAlive()){Module["onExit"]?.(code);ABORT=true}quit_(code,new ExitStatus(code))};var exitJS=(status,implicit)=>{EXITSTATUS=status;_proc_exit(status)};var _exit=exitJS;var maybeExit=()=>{if(!keepRuntimeAlive()){try{_exit(EXITSTATUS)}catch(e){handleException(e)}}};var callUserCallback=func=>{if(ABORT){return}try{return func()}catch(e){handleException(e)}finally{maybeExit()}};var wasmTableMirror=[];var getWasmTableEntry=funcPtr=>{var func=wasmTableMirror[funcPtr];if(!func){wasmTableMirror[funcPtr]=func=wasmTable.get(funcPtr)}return func};var _wasmWorkerRunPostMessage=e=>{let data=e.data;let wasmCall=data["_wsc"];wasmCall&&callUserCallback(()=>getWasmTableEntry(wasmCall)(...data["x"]))};var _wasmWorkerAppendToQueue=e=>{_wasmWorkerDelayedMessageQueue.push(e)};var _wasmWorkerInitializeRuntime=()=>{noExitRuntime=1;__emscripten_wasm_worker_initialize(wwParams.wwID,wwParams.stackLowestAddress,wwParams.stackSize);if(!ENVIRONMENT_IS_AUDIO_WORKLET){removeEventListener("message",_wasmWorkerAppendToQueue);_wasmWorkerDelayedMessageQueue=_wasmWorkerDelayedMessageQueue.forEach(_wasmWorkerRunPostMessage);addEventListener("message",_wasmWorkerRunPostMessage)}};var callRuntimeCallbacks=callbacks=>{while(callbacks.length>0){callbacks.shift()(Module)}};var onPostRuns=[];var addOnPostRun=cb=>onPostRuns.push(cb);var onPreRuns=[];var addOnPreRun=cb=>onPreRuns.push(cb);var noExitRuntime=true;var stackRestore=val=>__emscripten_stack_restore(val);var stackSave=()=>_emscripten_stack_get_current();var wasmMemory;class ExceptionInfo{constructor(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24}set_type(type){HEAPU32[this.ptr+4>>2]=type}get_type(){return HEAPU32[this.ptr+4>>2]}set_destructor(destructor){HEAPU32[this.ptr+8>>2]=destructor}get_destructor(){return HEAPU32[this.ptr+8>>2]}set_caught(caught){caught=caught?1:0;HEAP8[this.ptr+12]=caught}get_caught(){return HEAP8[this.ptr+12]!=0}set_rethrown(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13]=rethrown}get_rethrown(){return HEAP8[this.ptr+13]!=0}init(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor)}set_adjusted_ptr(adjustedPtr){HEAPU32[this.ptr+16>>2]=adjustedPtr}get_adjusted_ptr(){return HEAPU32[this.ptr+16>>2]}}var uncaughtExceptionCount=0;var ___cxa_throw=(ptr,type,destructor)=>{var info=new ExceptionInfo(ptr);info.init(type,destructor);uncaughtExceptionCount++;abort()};var ___do_set_thread_state=()=>{___set_thread_state(0,!ENVIRONMENT_IS_WORKER&&!ENVIRONMENT_IS_AUDIO_WORKLET,!ENVIRONMENT_IS_WASM_WORKER,ENVIRONMENT_IS_WORKER&&!ENVIRONMENT_IS_AUDIO_WORKLET)};var __abort_js=()=>abort("");var _emscripten_get_now;if(globalThis.performance?.now){_emscripten_get_now=()=>performance.now()}else{_emscripten_get_now=Date.now}var abortOnCannotGrowMemory=requestedSize=>{abort("OOM")};var _emscripten_resize_heap=requestedSize=>{var oldSize=HEAPU8.length;requestedSize>>>=0;abortOnCannotGrowMemory(requestedSize)};{initMemory();if(Module["noExitRuntime"])noExitRuntime=Module["noExitRuntime"];if(Module["print"])out=Module["print"];if(Module["printErr"])err=Module["printErr"];if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];if(Module["arguments"])programArgs=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].shift()()}}}var _sonare_rt_engine_abi_version,_sonare_rt_engine_create,_sonare_rt_engine_destroy,_sonare_rt_engine_prepare,_sonare_rt_engine_play,_sonare_rt_engine_stop,_sonare_rt_engine_seek_sample,_sonare_rt_engine_seek_ppq,_sonare_rt_engine_set_tempo,_sonare_rt_engine_set_loop,_sonare_rt_engine_seek_marker,_sonare_rt_engine_set_metronome_enabled,_sonare_rt_engine_set_capture_armed,_sonare_rt_engine_set_capture_punch,_sonare_rt_engine_process,_sonare_rt_engine_drain_telemetry,_free,_malloc,___set_thread_state,__emscripten_stack_restore,_emscripten_stack_get_current,__emscripten_wasm_worker_initialize,__indirect_function_table,wasmTable;function assignWasmExports(wasmExports){_sonare_rt_engine_abi_version=Module["_sonare_rt_engine_abi_version"]=wasmExports["h"];_sonare_rt_engine_create=Module["_sonare_rt_engine_create"]=wasmExports["i"];_sonare_rt_engine_destroy=Module["_sonare_rt_engine_destroy"]=wasmExports["j"];_sonare_rt_engine_prepare=Module["_sonare_rt_engine_prepare"]=wasmExports["l"];_sonare_rt_engine_play=Module["_sonare_rt_engine_play"]=wasmExports["m"];_sonare_rt_engine_stop=Module["_sonare_rt_engine_stop"]=wasmExports["n"];_sonare_rt_engine_seek_sample=Module["_sonare_rt_engine_seek_sample"]=wasmExports["o"];_sonare_rt_engine_seek_ppq=Module["_sonare_rt_engine_seek_ppq"]=wasmExports["p"];_sonare_rt_engine_set_tempo=Module["_sonare_rt_engine_set_tempo"]=wasmExports["q"];_sonare_rt_engine_set_loop=Module["_sonare_rt_engine_set_loop"]=wasmExports["r"];_sonare_rt_engine_seek_marker=Module["_sonare_rt_engine_seek_marker"]=wasmExports["s"];_sonare_rt_engine_set_metronome_enabled=Module["_sonare_rt_engine_set_metronome_enabled"]=wasmExports["t"];_sonare_rt_engine_set_capture_armed=Module["_sonare_rt_engine_set_capture_armed"]=wasmExports["u"];_sonare_rt_engine_set_capture_punch=Module["_sonare_rt_engine_set_capture_punch"]=wasmExports["v"];_sonare_rt_engine_process=Module["_sonare_rt_engine_process"]=wasmExports["w"];_sonare_rt_engine_drain_telemetry=Module["_sonare_rt_engine_drain_telemetry"]=wasmExports["x"];_free=Module["_free"]=wasmExports["y"];_malloc=Module["_malloc"]=wasmExports["z"];___set_thread_state=wasmExports["A"];__emscripten_stack_restore=wasmExports["B"];_emscripten_stack_get_current=wasmExports["C"];__emscripten_wasm_worker_initialize=wasmExports["D"];__indirect_function_table=wasmTable=wasmExports["k"]}var wasmImports;function assignWasmImports(){wasmImports={b:___cxa_throw,f:___do_set_thread_state,d:__abort_js,c:_emscripten_get_now,e:_emscripten_resize_heap,a:wasmMemory}}async function run(){if(ENVIRONMENT_IS_WASM_WORKER){initRuntime();return}preRun();var setStatus=Module["setStatus"];if(setStatus){setStatus("Running...");await new Promise(resolve=>setTimeout(resolve,1));setTimeout(setStatus,1,"")}if(ABORT)return;initRuntime();Module["onRuntimeInitialized"]?.();postRun()}var wasmExports;if(!ENVIRONMENT_IS_WASM_WORKER){wasmExports=await createWasm();await run()}
2
- ;return Module}export default SonareRt;var isWW=globalThis.name=="em-ww";var isNode=globalThis.process?.versions?.node&&globalThis.process?.type!="renderer";if(isNode)isWW=(await import("node:worker_threads")).workerData==="em-ww";isWW||=!!globalThis.AudioWorkletGlobalScope;false&&isWW&&SonareRt();
package/dist/sonare-rt.js DELETED
@@ -1,2 +0,0 @@
1
- async function SonareRt(moduleArg={}){var Module=moduleArg;var ENVIRONMENT_IS_WASM_WORKER=globalThis.name=="em-ww";var ENVIRONMENT_IS_AUDIO_WORKLET=!!globalThis.AudioWorkletGlobalScope;if(ENVIRONMENT_IS_AUDIO_WORKLET)ENVIRONMENT_IS_WASM_WORKER=true;var ENVIRONMENT_IS_WEB=!!globalThis.window;var ENVIRONMENT_IS_WORKER=!!globalThis.WorkerGlobalScope;var ENVIRONMENT_IS_NODE=globalThis.process?.versions?.node&&globalThis.process?.type!="renderer";if(ENVIRONMENT_IS_NODE){const{createRequire}=await import("node:module");var require=createRequire(import.meta.url);var worker_threads=require("node:worker_threads");globalThis.Worker=worker_threads.Worker;ENVIRONMENT_IS_WORKER=!worker_threads.isMainThread;ENVIRONMENT_IS_WASM_WORKER=ENVIRONMENT_IS_WORKER&&worker_threads.workerData=="em-ww"}var programArgs=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var _scriptName=import.meta.url;var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var readAsync,readBinary;if(ENVIRONMENT_IS_NODE){var fs=require("node:fs");if(_scriptName.startsWith("file:")){scriptDirectory=require("node:path").dirname(require("node:url").fileURLToPath(_scriptName))+"/"}readBinary=filename=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename);return ret};readAsync=async(filename,binary=true)=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename,binary?undefined:"utf8");return ret};if(process.argv.length>1){thisProgram=process.argv[1].replace(/\\/g,"/")}programArgs=process.argv.slice(2);quit_=(status,toThrow)=>{process.exitCode=status;throw toThrow}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){try{scriptDirectory=new URL(".",_scriptName).href}catch{}{if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=async url=>{if(isFileURI(url)){return new Promise((resolve,reject)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){resolve(xhr.response);return}reject(xhr.status)};xhr.onerror=reject;xhr.send(null)})}var response=await fetch(url,{credentials:"same-origin"});if(response.ok){return response.arrayBuffer()}throw new Error(response.status+" : "+response.url)}}}else{}var defaultPrint=console.log.bind(console);var defaultPrintErr=console.error.bind(console);if(ENVIRONMENT_IS_NODE){var utils=require("node:util");var stringify=a=>typeof a=="object"?utils.inspect(a):a;defaultPrint=(...args)=>fs.writeSync(1,args.map(stringify).join(" ")+"\n");defaultPrintErr=(...args)=>fs.writeSync(2,args.map(stringify).join(" ")+"\n")}var out=defaultPrint;var err=defaultPrintErr;var wasmBinary;var wasmModule;var ABORT=false;var EXITSTATUS;var isFileURI=filename=>filename.startsWith("file://");class EmscriptenEH{}class EmscriptenSjLj extends EmscriptenEH{}if(ENVIRONMENT_IS_NODE&&ENVIRONMENT_IS_WASM_WORKER){globalThis.self=globalThis;var parentPort=worker_threads.parentPort;if(!globalThis.postMessage){parentPort.on("message",msg=>globalThis.onmessage?.({data:msg}));globalThis.postMessage=msg=>parentPort.postMessage(msg)}process.on("uncaughtException",err=>{postMessage({cmd:8,error:err});process.exit(1)})}var wwParams;function startWasmWorker(props){wwParams=props;wasmMemory=props.wasmMemory;updateMemoryViews();wasmModule=props.wasm;createWasm();run();props.wasm=props.wasmMemory=0}if(ENVIRONMENT_IS_WASM_WORKER&&!ENVIRONMENT_IS_AUDIO_WORKLET){if(ENVIRONMENT_IS_NODE){var wrappedHandlers=new WeakMap;globalThis.onmessage=null;function wrapMsgHandler(h){var f=wrappedHandlers.get(h);if(!f){f=msg=>h({data:msg});wrappedHandlers.set(h,f)}return f}Object.assign(globalThis,{addEventListener:(name,handler)=>parentPort["on"](name,wrapMsgHandler(handler)),removeEventListener:(name,handler)=>parentPort["off"](name,wrapMsgHandler(handler))})}onmessage=d=>{onmessage=null;startWasmWorker(d.data)}}if(ENVIRONMENT_IS_AUDIO_WORKLET){function createWasmAudioWorkletProcessor(audioParams){class WasmAudioWorkletProcessor extends AudioWorkletProcessor{constructor(args){super();let opts=args.processorOptions;this.callback=getWasmTableEntry(opts.callback);this.userData=opts.userData;this.samplesPerChannel=opts.samplesPerChannel;this.bytesPerChannel=this.samplesPerChannel*4;this.outputViews=new Array(Math.min((wwParams.stackSize-16)/this.bytesPerChannel|0,64));this.createOutputViews()}createOutputViews(){var oldStackPtr=stackSave();var viewDataIdx=stackAlloc(this.outputViews.length*this.bytesPerChannel)>>2;for(var n=this.outputViews.length-1;n>=0;n--){this.outputViews[n]=HEAPF32.subarray(viewDataIdx,viewDataIdx+=this.samplesPerChannel)}stackRestore(oldStackPtr)}static get parameterDescriptors(){return audioParams}process(inputList,outputList,parameters){var numInputs=inputList.length;var numOutputs=outputList.length;var entry;var subentry;var stackMemoryStruct=(numInputs+numOutputs)*12;var stackMemoryData=0;for(entry of inputList){stackMemoryData+=entry.length}stackMemoryData*=this.bytesPerChannel;var outputViewsNeeded=0;for(entry of outputList){outputViewsNeeded+=entry.length}stackMemoryData+=outputViewsNeeded*this.bytesPerChannel;var numParams=0;for(entry in parameters){++numParams;stackMemoryStruct+=8;stackMemoryData+=parameters[entry].byteLength}var oldStackPtr=stackSave();var stackMemoryAligned=stackMemoryStruct+stackMemoryData+15&~15;var structPtr=stackAlloc(stackMemoryAligned);var dataPtr=structPtr+(stackMemoryAligned-stackMemoryData);var inputsPtr=structPtr;for(entry of inputList){HEAPU32[structPtr>>2]=entry.length;HEAPU32[structPtr+4>>2]=this.samplesPerChannel;HEAPU32[structPtr+8>>2]=dataPtr;structPtr+=12;for(subentry of entry){HEAPF32.set(subentry,dataPtr>>2);dataPtr+=this.bytesPerChannel}}var paramsPtr=structPtr;for(entry=0;subentry=parameters[entry++];){HEAPU32[structPtr>>2]=subentry.length;HEAPU32[structPtr+4>>2]=dataPtr;structPtr+=8;HEAPF32.set(subentry,dataPtr>>2);dataPtr+=subentry.length*4}var outputsPtr=structPtr;for(entry of outputList){HEAPU32[structPtr>>2]=entry.length;HEAPU32[structPtr+4>>2]=this.samplesPerChannel;HEAPU32[structPtr+8>>2]=dataPtr;structPtr+=12;dataPtr+=this.bytesPerChannel*entry.length}var didProduceAudio=this.callback(numInputs,inputsPtr,numOutputs,outputsPtr,numParams,paramsPtr,this.userData);if(didProduceAudio){for(entry of outputList){for(subentry of entry){subentry.set(this.outputViews[--outputViewsNeeded])}}}stackRestore(oldStackPtr);return!!didProduceAudio}}return WasmAudioWorkletProcessor}var port=globalThis.port||{};class BootstrapMessages extends AudioWorkletProcessor{constructor(arg){super();startWasmWorker(arg.processorOptions);if(!(port instanceof MessagePort)){this.port.onmessage=port.onmessage;port=this.port}}process(){}}registerProcessor("em-bootstrap",BootstrapMessages);port.onmessage=async msg=>{let d=msg.data;if(d["_boot"]){startWasmWorker(d)}else if(d["_wpn"]){registerProcessor(d["_wpn"],createWasmAudioWorkletProcessor(d.audioParams));port.postMessage({_wsc:d.callback,args:[d.contextHandle,1,d.userData]})}else if(d["_wsc"]){getWasmTableEntry(d["_wsc"])(...d.args)}}}var runtimeInitialized=false;function updateMemoryViews(){var b=wasmMemory.buffer;HEAP8=new Int8Array(b);HEAP16=new Int16Array(b);HEAPU8=new Uint8Array(b);HEAPU16=new Uint16Array(b);HEAP32=new Int32Array(b);HEAPU32=new Uint32Array(b);HEAPF32=new Float32Array(b);HEAPF64=new Float64Array(b);HEAP64=new BigInt64Array(b);HEAPU64=new BigUint64Array(b)}function initMemory(){if(ENVIRONMENT_IS_WASM_WORKER){return}if(Module["wasmMemory"]){wasmMemory=Module["wasmMemory"]}else{var INITIAL_MEMORY=Module["INITIAL_MEMORY"]||67108864;wasmMemory=new WebAssembly.Memory({initial:INITIAL_MEMORY/65536,maximum:INITIAL_MEMORY/65536,shared:true})}updateMemoryViews()}function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(onPreRuns)}function initRuntime(){runtimeInitialized=true;if(ENVIRONMENT_IS_WASM_WORKER)return _wasmWorkerInitializeRuntime();wasmExports["g"]()}function postRun(){if(ENVIRONMENT_IS_WASM_WORKER){return}if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(onPostRuns)}function abort(what){Module["onAbort"]?.(what);what=`Aborted(${what})`;err(what);ABORT=true;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);throw e}var wasmBinaryFile;function findWasmBinary(){return locateFile("sonare-rt.wasm")}function getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}async function getWasmBinary(binaryFile){if(!wasmBinary){try{var response=await readAsync(binaryFile);return new Uint8Array(response)}catch{}}return getBinarySync(binaryFile)}async function instantiateArrayBuffer(binaryFile,imports){try{var binary=await getWasmBinary(binaryFile);var instance=await WebAssembly.instantiate(binary,imports);return instance}catch(reason){err(`failed to asynchronously prepare wasm: ${reason}`);abort(reason)}}async function instantiateAsync(binary,binaryFile,imports){if(!binary&&!isFileURI(binaryFile)&&!ENVIRONMENT_IS_NODE){try{var response=fetch(binaryFile,{credentials:"same-origin"});var instantiationResult=await WebAssembly.instantiateStreaming(response,imports);return instantiationResult}catch(reason){err(`wasm streaming compile failed: ${reason}`);err("falling back to ArrayBuffer instantiation")}}return instantiateArrayBuffer(binaryFile,imports)}function getWasmImports(){assignWasmImports();var imports={a:wasmImports};return imports}async function createWasm(){function receiveInstance(instance,module){wasmExports=instance.exports;assignWasmExports(wasmExports);wasmModule=module;return wasmExports}function receiveInstantiationResult(result){return receiveInstance(result["instance"],result["module"])}var info=getWasmImports();if(Module["instantiateWasm"]){return new Promise((resolve,reject)=>{Module["instantiateWasm"](info,(inst,mod)=>{resolve(receiveInstance(inst,mod))})})}if(ENVIRONMENT_IS_WASM_WORKER){var instance=new WebAssembly.Instance(wasmModule,getWasmImports());return receiveInstance(instance,wasmModule)}wasmBinaryFile??=findWasmBinary();var result=await instantiateAsync(wasmBinary,wasmBinaryFile,info);var exports=receiveInstantiationResult(result);return exports}class ExitStatus{name="ExitStatus";constructor(status){this.message=`Program terminated with exit(${status})`;this.status=status}}var HEAP16;var HEAP32;var HEAP64;var HEAP8;var HEAPF32;var HEAPF64;var HEAPU16;var HEAPU32;var HEAPU64;var HEAPU8;var _wasmWorkerDelayedMessageQueue=[];var handleException=e=>{if(e instanceof ExitStatus||e=="unwind"){return EXITSTATUS}quit_(1,e)};var runtimeKeepaliveCounter=0;var keepRuntimeAlive=()=>noExitRuntime||runtimeKeepaliveCounter>0;var _proc_exit=code=>{EXITSTATUS=code;if(!keepRuntimeAlive()){Module["onExit"]?.(code);ABORT=true}quit_(code,new ExitStatus(code))};var exitJS=(status,implicit)=>{EXITSTATUS=status;_proc_exit(status)};var _exit=exitJS;var maybeExit=()=>{if(!keepRuntimeAlive()){try{_exit(EXITSTATUS)}catch(e){handleException(e)}}};var callUserCallback=func=>{if(ABORT){return}try{return func()}catch(e){handleException(e)}finally{maybeExit()}};var wasmTableMirror=[];var getWasmTableEntry=funcPtr=>{var func=wasmTableMirror[funcPtr];if(!func){wasmTableMirror[funcPtr]=func=wasmTable.get(funcPtr)}return func};var _wasmWorkerRunPostMessage=e=>{let data=e.data;let wasmCall=data["_wsc"];wasmCall&&callUserCallback(()=>getWasmTableEntry(wasmCall)(...data["x"]))};var _wasmWorkerAppendToQueue=e=>{_wasmWorkerDelayedMessageQueue.push(e)};var _wasmWorkerInitializeRuntime=()=>{noExitRuntime=1;__emscripten_wasm_worker_initialize(wwParams.wwID,wwParams.stackLowestAddress,wwParams.stackSize);if(!ENVIRONMENT_IS_AUDIO_WORKLET){removeEventListener("message",_wasmWorkerAppendToQueue);_wasmWorkerDelayedMessageQueue=_wasmWorkerDelayedMessageQueue.forEach(_wasmWorkerRunPostMessage);addEventListener("message",_wasmWorkerRunPostMessage)}};var callRuntimeCallbacks=callbacks=>{while(callbacks.length>0){callbacks.shift()(Module)}};var onPostRuns=[];var addOnPostRun=cb=>onPostRuns.push(cb);var onPreRuns=[];var addOnPreRun=cb=>onPreRuns.push(cb);var noExitRuntime=true;var stackRestore=val=>__emscripten_stack_restore(val);var stackSave=()=>_emscripten_stack_get_current();var wasmMemory;class ExceptionInfo{constructor(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24}set_type(type){HEAPU32[this.ptr+4>>2]=type}get_type(){return HEAPU32[this.ptr+4>>2]}set_destructor(destructor){HEAPU32[this.ptr+8>>2]=destructor}get_destructor(){return HEAPU32[this.ptr+8>>2]}set_caught(caught){caught=caught?1:0;HEAP8[this.ptr+12]=caught}get_caught(){return HEAP8[this.ptr+12]!=0}set_rethrown(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13]=rethrown}get_rethrown(){return HEAP8[this.ptr+13]!=0}init(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor)}set_adjusted_ptr(adjustedPtr){HEAPU32[this.ptr+16>>2]=adjustedPtr}get_adjusted_ptr(){return HEAPU32[this.ptr+16>>2]}}var uncaughtExceptionCount=0;var ___cxa_throw=(ptr,type,destructor)=>{var info=new ExceptionInfo(ptr);info.init(type,destructor);uncaughtExceptionCount++;abort()};var ___do_set_thread_state=()=>{___set_thread_state(0,!ENVIRONMENT_IS_WORKER&&!ENVIRONMENT_IS_AUDIO_WORKLET,!ENVIRONMENT_IS_WASM_WORKER,ENVIRONMENT_IS_WORKER&&!ENVIRONMENT_IS_AUDIO_WORKLET)};var __abort_js=()=>abort("");var _emscripten_get_now;if(globalThis.performance?.now){_emscripten_get_now=()=>performance.now()}else{_emscripten_get_now=Date.now}var abortOnCannotGrowMemory=requestedSize=>{abort("OOM")};var _emscripten_resize_heap=requestedSize=>{var oldSize=HEAPU8.length;requestedSize>>>=0;abortOnCannotGrowMemory(requestedSize)};{initMemory();if(Module["noExitRuntime"])noExitRuntime=Module["noExitRuntime"];if(Module["print"])out=Module["print"];if(Module["printErr"])err=Module["printErr"];if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];if(Module["arguments"])programArgs=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].shift()()}}}var _sonare_rt_engine_abi_version,_sonare_rt_engine_create,_sonare_rt_engine_destroy,_sonare_rt_engine_prepare,_sonare_rt_engine_play,_sonare_rt_engine_stop,_sonare_rt_engine_seek_sample,_sonare_rt_engine_seek_ppq,_sonare_rt_engine_set_tempo,_sonare_rt_engine_set_loop,_sonare_rt_engine_seek_marker,_sonare_rt_engine_set_metronome_enabled,_sonare_rt_engine_set_capture_armed,_sonare_rt_engine_set_capture_punch,_sonare_rt_engine_process,_sonare_rt_engine_drain_telemetry,_free,_malloc,___set_thread_state,__emscripten_stack_restore,_emscripten_stack_get_current,__emscripten_wasm_worker_initialize,__indirect_function_table,wasmTable;function assignWasmExports(wasmExports){_sonare_rt_engine_abi_version=Module["_sonare_rt_engine_abi_version"]=wasmExports["h"];_sonare_rt_engine_create=Module["_sonare_rt_engine_create"]=wasmExports["i"];_sonare_rt_engine_destroy=Module["_sonare_rt_engine_destroy"]=wasmExports["j"];_sonare_rt_engine_prepare=Module["_sonare_rt_engine_prepare"]=wasmExports["l"];_sonare_rt_engine_play=Module["_sonare_rt_engine_play"]=wasmExports["m"];_sonare_rt_engine_stop=Module["_sonare_rt_engine_stop"]=wasmExports["n"];_sonare_rt_engine_seek_sample=Module["_sonare_rt_engine_seek_sample"]=wasmExports["o"];_sonare_rt_engine_seek_ppq=Module["_sonare_rt_engine_seek_ppq"]=wasmExports["p"];_sonare_rt_engine_set_tempo=Module["_sonare_rt_engine_set_tempo"]=wasmExports["q"];_sonare_rt_engine_set_loop=Module["_sonare_rt_engine_set_loop"]=wasmExports["r"];_sonare_rt_engine_seek_marker=Module["_sonare_rt_engine_seek_marker"]=wasmExports["s"];_sonare_rt_engine_set_metronome_enabled=Module["_sonare_rt_engine_set_metronome_enabled"]=wasmExports["t"];_sonare_rt_engine_set_capture_armed=Module["_sonare_rt_engine_set_capture_armed"]=wasmExports["u"];_sonare_rt_engine_set_capture_punch=Module["_sonare_rt_engine_set_capture_punch"]=wasmExports["v"];_sonare_rt_engine_process=Module["_sonare_rt_engine_process"]=wasmExports["w"];_sonare_rt_engine_drain_telemetry=Module["_sonare_rt_engine_drain_telemetry"]=wasmExports["x"];_free=Module["_free"]=wasmExports["y"];_malloc=Module["_malloc"]=wasmExports["z"];___set_thread_state=wasmExports["A"];__emscripten_stack_restore=wasmExports["B"];_emscripten_stack_get_current=wasmExports["C"];__emscripten_wasm_worker_initialize=wasmExports["D"];__indirect_function_table=wasmTable=wasmExports["k"]}var wasmImports;function assignWasmImports(){wasmImports={b:___cxa_throw,f:___do_set_thread_state,d:__abort_js,c:_emscripten_get_now,e:_emscripten_resize_heap,a:wasmMemory}}async function run(){if(ENVIRONMENT_IS_WASM_WORKER){initRuntime();return}preRun();var setStatus=Module["setStatus"];if(setStatus){setStatus("Running...");await new Promise(resolve=>setTimeout(resolve,1));setTimeout(setStatus,1,"")}if(ABORT)return;initRuntime();Module["onRuntimeInitialized"]?.();postRun()}var wasmExports;if(!ENVIRONMENT_IS_WASM_WORKER){wasmExports=await createWasm();await run()}
2
- ;return Module}export default SonareRt;var isWW=globalThis.name=="em-ww";var isNode=globalThis.process?.versions?.node&&globalThis.process?.type!="renderer";if(isNode)isWW=(await import("node:worker_threads")).workerData==="em-ww";isWW||=!!globalThis.AudioWorkletGlobalScope;isWW&&SonareRt();
Binary file
@@ -1,93 +0,0 @@
1
- /**
2
- * Type definitions for the standalone realtime WASM module (`sonare-rt`).
3
- *
4
- * This is a DELIBERATELY REDUCED surface optimized for the AudioWorklet hot
5
- * path: a thin C ABI over {@link RealtimeEngine} that avoids embind, JS `val`
6
- * marshalling, and string handling so the audio render quantum stays
7
- * allocation- and GC-free. Use the full {@link RealtimeEngine} class from the
8
- * main `sonare` bundle when you need the complete feature set.
9
- *
10
- * Omitted here (available only on the full embind `RealtimeEngine`):
11
- * - Parameter registry & automation: `addParameter`, `parameterInfo`,
12
- * `setAutomationLane`, `automationLaneCount`, `setParameter`,
13
- * `setParameterSmoothed`.
14
- * - Transport read-back: `getTransportState` (transport is driven from the
15
- * worklet; state is mirrored on the main thread there).
16
- * - Markers beyond seek: `setMarkers`, `markerCount`, `marker`,
17
- * `setLoopFromMarkers`, `setTimeSignature`, `countInEndSample`.
18
- * - Graph topology: `setGraph`, `graphNodeCount`, `graphConnectionCount`.
19
- * - Clip scheduling: `setClips`, `clipCount`, `freezeOffline`.
20
- * - Capture read-back & offline rendering: `setCaptureBuffer`, `captureStatus`,
21
- * `capturedAudio`, `resetCapture`, `renderOffline`, `bounceOffline`.
22
- * - Meter telemetry: `drainMeterTelemetry`.
23
- *
24
- * The exposed surface intentionally covers only transport, tempo/loop, marker
25
- * seek, metronome, capture arming/punch, block processing, and basic telemetry
26
- * drain.
27
- */
28
- export interface SonareRtModuleOptions {
29
- locateFile?: (path: string, scriptDirectory: string) => string;
30
- wasmBinary?: ArrayBuffer | Uint8Array;
31
- wasmMemory?: WebAssembly.Memory;
32
- print?: (...args: unknown[]) => void;
33
- printErr?: (...args: unknown[]) => void;
34
- }
35
-
36
- export interface SonareRtModule {
37
- _malloc(size: number): number;
38
- _free(ptr: number): void;
39
- _sonare_rt_engine_abi_version(): number;
40
- _sonare_rt_engine_create(): number;
41
- _sonare_rt_engine_destroy(engine: number): void;
42
- _sonare_rt_engine_prepare(
43
- engine: number,
44
- sampleRate: number,
45
- maxBlockSize: number,
46
- commandCapacity: number,
47
- telemetryCapacity: number,
48
- ): number;
49
- _sonare_rt_engine_play(engine: number, renderFrame: bigint): number;
50
- _sonare_rt_engine_stop(engine: number, renderFrame: bigint): number;
51
- _sonare_rt_engine_seek_sample(
52
- engine: number,
53
- timelineSample: bigint,
54
- renderFrame: bigint,
55
- ): number;
56
- _sonare_rt_engine_seek_ppq(engine: number, ppq: number, renderFrame: bigint): number;
57
- _sonare_rt_engine_set_tempo(engine: number, bpm: number): number;
58
- _sonare_rt_engine_set_loop(
59
- engine: number,
60
- startPpq: number,
61
- endPpq: number,
62
- enabled: number,
63
- ): number;
64
- _sonare_rt_engine_seek_marker(engine: number, markerId: number, renderFrame: bigint): number;
65
- _sonare_rt_engine_set_metronome_enabled(
66
- engine: number,
67
- enabled: number,
68
- beatGain: number,
69
- accentGain: number,
70
- clickSamples: number,
71
- ): number;
72
- _sonare_rt_engine_set_capture_armed(engine: number, armed: number): number;
73
- _sonare_rt_engine_set_capture_punch(
74
- engine: number,
75
- startSample: bigint,
76
- endSample: bigint,
77
- enabled: number,
78
- ): number;
79
- _sonare_rt_engine_process(
80
- engine: number,
81
- channelsPtr: number,
82
- numChannels: number,
83
- numFrames: number,
84
- ): void;
85
- _sonare_rt_engine_drain_telemetry(
86
- engine: number,
87
- typesErrorsValuesPtr: number,
88
- frameValuesPtr: number,
89
- maxRecords: number,
90
- ): number;
91
- }
92
-
93
- export default function SonareRt(options?: SonareRtModuleOptions): Promise<SonareRtModule>;