Class AudioVisualizer

java.lang.Object
wiiuu.ui.AudioVisualizer

public class AudioVisualizer extends Object
FFT spectrum analysis and ambient/fullscreen painting for host-provided normalized mono audio. Supply samples at a fixed update cadence for smoothing; update and paint on the same UI thread. Branding, track text and exit hints are supplied by the host. No playback or input is installed.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
    static final int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    AudioVisualizer(double sampleRate)
    Audio in normalized mono samples; no audio device or playback is opened.
    AudioVisualizer(double sampleRate, LongSupplier clock)
    Supply a monotonic nanosecond clock for deterministic ring rotation.
  • Method Summary

    Modifier and Type
    Method
    Description
    float
    The bass, 0..1: jumps with each kick, then falls back.
    float[]
    A snapshot of the bars, 0..1, low to high.
    void
    paintAmbient(Graphics2D g, int w, float baseY, float maxH, Color accent)
    The strip behind the tiles: translucent bars standing on the dock's edge.
    void
    paintFull(Graphics2D g0, int w, int h, String title, String subtitle, String label, String accentLabel, Color accent, String hint)
    Full screen: a dark stage, the spectrum ring around WII-UU's name, the waveform and the track.
    void
    update(float[] mono, int end)
    Updates the bars from mono, the last 2048 samples before exclusive end, zero-padded when fewer are available.
    float[]
    A snapshot of the waveform just supplied, normalized to about -1..1.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • AudioVisualizer

      public AudioVisualizer(double sampleRate)
      Audio in normalized mono samples; no audio device or playback is opened.
    • AudioVisualizer

      public AudioVisualizer(double sampleRate, LongSupplier clock)
      Supply a monotonic nanosecond clock for deterministic ring rotation.
  • Method Details

    • update

      public void update(float[] mono, int end)
      Updates the bars from mono, the last 2048 samples before exclusive end, zero-padded when fewer are available.
    • levels

      public float[] levels()
      A snapshot of the bars, 0..1, low to high.
    • bass

      public float bass()
      The bass, 0..1: jumps with each kick, then falls back.
    • wave

      public float[] wave()
      A snapshot of the waveform just supplied, normalized to about -1..1.
    • paintAmbient

      public void paintAmbient(Graphics2D g, int w, float baseY, float maxH, Color accent)
      The strip behind the tiles: translucent bars standing on the dock's edge.
    • paintFull

      public void paintFull(Graphics2D g0, int w, int h, String title, String subtitle, String label, String accentLabel, Color accent, String hint)
      Full screen: a dark stage, the spectrum ring around WII-UU's name, the waveform and the track.