adjust smoothing in now playing spectrum

This commit is contained in:
Boof2015
2026-07-15 14:50:56 -04:00
parent b290cfed7a
commit b5f1ca9e99
9 changed files with 55 additions and 19 deletions
@@ -21,8 +21,8 @@ class AstraScopeModule : Module() {
}
// Fill `out` with the latest dB spectrum; returns the number of bins written.
Function("getSpectrumFrame") { out: Float32Array ->
ScopeBridge.nativeFillSpectrum(out.toDirectBuffer(), out.length)
Function("getSpectrumFrame") { out: Float32Array, smoothing: Double ->
ScopeBridge.nativeFillSpectrum(out.toDirectBuffer(), out.length, smoothing.toFloat())
}
// Fill `out` with render-ready oscilloscope points (~[-1,1]).
@@ -36,8 +36,8 @@ class AstraScopeModule : Module() {
ScopeBridge.postEqActive = active
}
Function("getSpectrumFramePostEq") { out: Float32Array ->
ScopeBridge.nativeFillSpectrumPostEq(out.toDirectBuffer(), out.length)
Function("getSpectrumFramePostEq") { out: Float32Array, smoothing: Double ->
ScopeBridge.nativeFillSpectrumPostEq(out.toDirectBuffer(), out.length, smoothing.toFloat())
}
// --- M4: EQ params + per-track gain (consumed by the kotlin-audio processors) ---
@@ -40,7 +40,11 @@ object ScopeBridge {
* memory) with the latest dB spectrum, up to `capacityFloats` floats.
* Returns the number of bins written. Zero-copy: writes straight into JS memory.
*/
external fun nativeFillSpectrum(buffer: java.nio.ByteBuffer, capacityFloats: Int): Int
external fun nativeFillSpectrum(
buffer: java.nio.ByteBuffer,
capacityFloats: Int,
smoothing: Float
): Int
/**
* Render thread. Fill `buffer` (a direct ByteBuffer over the JS Float32Array's
@@ -57,5 +61,9 @@ object ScopeBridge {
* Render thread. Fill `buffer` with the latest POST-EQ dB spectrum (feeds the
* EQ screen's response-curve overlay). Returns bins written. Zero-copy.
*/
external fun nativeFillSpectrumPostEq(buffer: java.nio.ByteBuffer, capacityFloats: Int): Int
external fun nativeFillSpectrumPostEq(
buffer: java.nio.ByteBuffer,
capacityFloats: Int,
smoothing: Float
): Int
}