performance improvements + oscilloscope

This commit is contained in:
Boof2015
2026-06-18 15:52:48 -04:00
parent 5853edd933
commit 9fd37c93d7
14 changed files with 907 additions and 236 deletions
@@ -24,5 +24,10 @@ class AstraScopeModule : Module() {
Function("getSpectrumFrame") { out: Float32Array ->
ScopeBridge.nativeFillSpectrum(out.toDirectBuffer(), out.length)
}
// Fill `out` with render-ready oscilloscope points (~[-1,1]).
Function("getOscilloscopeFrame") { out: Float32Array ->
ScopeBridge.nativeFillOscilloscope(out.toDirectBuffer(), out.length)
}
}
}
@@ -33,4 +33,12 @@ object ScopeBridge {
* Returns the number of bins written. Zero-copy: writes straight into JS memory.
*/
external fun nativeFillSpectrum(buffer: java.nio.ByteBuffer, capacityFloats: Int): Int
/**
* Render thread. Fill `buffer` (a direct ByteBuffer over the JS Float32Array's
* memory) with render-ready, evenly spaced points from the latest triggered
* oscilloscope window. Returns the number of points written. Zero-copy:
* writes straight into JS memory.
*/
external fun nativeFillOscilloscope(buffer: java.nio.ByteBuffer, capacityFloats: Int): Int
}