mirror of
https://github.com/Boof2015/astra-mobile.git
synced 2026-08-16 00:01:59 +02:00
performance improvements + oscilloscope
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user