mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 20:31:51 +09:00
polarity-correct scope
This commit is contained in:
@@ -2,6 +2,7 @@ package net.torvald.terrarum.audio
|
||||
|
||||
import com.jme3.math.FastMath
|
||||
import net.torvald.terrarum.audio.TerrarumAudioMixerTrack.Companion.BUFFER_SIZE
|
||||
import net.torvald.terrarum.modulebasegame.ui.abs
|
||||
import kotlin.math.tanh
|
||||
|
||||
abstract class TerrarumAudioFilter {
|
||||
@@ -55,11 +56,11 @@ class Scope : TerrarumAudioFilter() {
|
||||
|
||||
// plot dots
|
||||
for (i in 0 until BUFFER_SIZE/4) {
|
||||
val x0 = inbuf1[0][i] * 0.7
|
||||
val y0 = inbuf1[1][i] * 0.7
|
||||
val y0 = inbuf1[0][i] * 0.7
|
||||
val x0 = -inbuf1[1][i] * 0.7 // rotate the domain by -90 deg
|
||||
|
||||
val x = (x0*sqrt2p + y0*sqrt2p) * 1.414
|
||||
val y = (x0*sqrt2p - y0*sqrt2p) * 1.414
|
||||
val x = (+x0*sqrt2p -y0*sqrt2p) * 1.414
|
||||
val y = (-x0*sqrt2p -y0*sqrt2p) * 1.414 // further rotate by -45 deg then flip along the y axis
|
||||
|
||||
backbufL[0][i] = x.toFloat()
|
||||
backbufR[0][i] = y.toFloat()
|
||||
|
||||
@@ -569,6 +569,9 @@ class BasicDebugInfoWindow : UICanvas() {
|
||||
App.fontSmallNumbers.draw(batch, "Bs:${BUFFER_SIZE/4}", x+3f, y+1f)
|
||||
}
|
||||
is Scope -> {
|
||||
// batch.color = COL_FILTER_WELL_BACK
|
||||
// Toolkit.fillArea(batch, 200, 200, 256, 256)
|
||||
|
||||
batch.color = scopePlotCol
|
||||
val xxs = filter.backbufR
|
||||
val yys = filter.backbufL
|
||||
@@ -586,6 +589,9 @@ class BasicDebugInfoWindow : UICanvas() {
|
||||
val py = ys[i] * halfStripW + halfStripW
|
||||
Toolkit.fillArea(batch, x + px, y + py, 1f, 1f)
|
||||
|
||||
|
||||
// Toolkit.fillArea(batch, 328 + xs[i] * 128, 328 + ys[i] * 128, 1f, 1f)
|
||||
|
||||
// scopedSamples++
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user