pub struct WaveformSynthesizer { /* private fields */ }Expand description
Synthesizes oscilloscope waveforms from YM2149 register state.
This generates per-channel waveforms based on the current register values, producing square waves for tone, pseudo-random noise, and envelope-accurate waveforms for buzz instruments.
Supports up to 4 PSGs (12 channels total) for multi-PSG configurations.
Implementations§
Source§impl WaveformSynthesizer
impl WaveformSynthesizer
Sourcepub fn set_psg_count(&mut self, count: usize)
pub fn set_psg_count(&mut self, count: usize)
Set the number of active PSGs (1-4).
Sourcepub fn channel_count(&self) -> usize
pub fn channel_count(&self) -> usize
Get the number of active channels.
Sourcepub fn update(&mut self, channel_states: &ChannelStates)
pub fn update(&mut self, channel_states: &ChannelStates)
Update waveforms from YM2149 channel states (single PSG, for backward compatibility).
Call this once per frame to generate new waveform samples based on the current register state. This updates channels 0-2.
Sourcepub fn update_psg(&mut self, psg_index: usize, channel_states: &ChannelStates)
pub fn update_psg(&mut self, psg_index: usize, channel_states: &ChannelStates)
Update waveforms for a specific PSG (0-3).
Call this for each active PSG to update its 3 channels.
Sourcepub fn update_multi_psg(
&mut self,
register_banks: &[[u8; 16]],
psg_count: usize,
)
pub fn update_multi_psg( &mut self, register_banks: &[[u8; 16]], psg_count: usize, )
Update waveforms from multiple PSG register banks.
Call this once per frame with all PSG register states.
Sourcepub fn get_samples(&self) -> Vec<[f32; 3]>
pub fn get_samples(&self) -> Vec<[f32; 3]>
Get waveform samples as a Vec for display (first 3 channels only for backward compat).
Returns samples in the format [amplitude_a, amplitude_b, amplitude_c] per sample.
Sourcepub fn channel_waveform(&self, channel: usize) -> &VecDeque<f32>
pub fn channel_waveform(&self, channel: usize) -> &VecDeque<f32>
Get waveform for a specific channel (0-11 for multi-PSG).
Trait Implementations§
Source§impl Clone for WaveformSynthesizer
impl Clone for WaveformSynthesizer
Source§fn clone(&self) -> WaveformSynthesizer
fn clone(&self) -> WaveformSynthesizer
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more