Skip to main content

AudioVizBuffer

Struct AudioVizBuffer 

Source
pub struct AudioVizBuffer {
    pub samples: AtomicRingBuffer,
    pub fft_bins: AtomicRingBuffer,
    pub rms_left: AtomicF32,
    pub rms_right: AtomicF32,
    pub peak_left: AtomicF32,
    pub peak_right: AtomicF32,
    pub phase_correlation: AtomicF32,
    pub audio_clock_us: AtomicU64,
    pub game_tick_us: AtomicU64,
    pub active_lane: AtomicU8,
    pub underrun_count: AtomicU32,
}
Expand description

Shared visualization buffer between audio and render threads.

Fields§

§samples: AtomicRingBuffer

PCM stereo interleaved samples.

§fft_bins: AtomicRingBuffer

FFT magnitude bins.

§rms_left: AtomicF32

RMS levels (300ms integration window).

§rms_right: AtomicF32§peak_left: AtomicF32

Peak levels (1.7s hold, then decay).

§peak_right: AtomicF32§phase_correlation: AtomicF32

Phase correlation coefficient (-1.0 to 1.0).

§audio_clock_us: AtomicU64

Audio thread clock (microseconds since start).

§game_tick_us: AtomicU64

Game tick clock (microseconds since start).

§active_lane: AtomicU8

Active lane indicator (0=game, 1=mixer, 2=file).

§underrun_count: AtomicU32

Buffer underrun counter.

Implementations§

Source§

impl AudioVizBuffer

Source

pub fn new(sample_capacity: usize, fft_capacity: usize) -> Self

Source

pub fn compute_and_store_rms(&self, window: usize)

Compute RMS from the last window stereo interleaved samples. Called by audio thread after writing samples.

Source

pub fn update_peak_hold(&self)

Update peak hold with decay. Called by audio thread.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.