ChartProcessor

Trait ChartProcessor 

Source
pub trait ChartProcessor {
    // Required methods
    fn audio_files(&self) -> HashMap<WavId, &Path>;
    fn bmp_files(&self) -> HashMap<BmpId, &Path>;
    fn default_visible_y_length(&self) -> YCoordinate;
    fn current_bpm(&self) -> Decimal;
    fn current_speed(&self) -> Decimal;
    fn current_scroll(&self) -> Decimal;
    fn start_play(&mut self, now: SystemTime);
    fn update(
        &mut self,
        now: SystemTime,
    ) -> impl Iterator<Item = ChartEventWithPosition>;
    fn post_events(&mut self, events: &[ControlEvent]);
    fn visible_events(
        &mut self,
        now: SystemTime,
    ) -> impl Iterator<Item = VisibleEvent>;
}
Expand description

Unified y unit description: In default 4/4 time, one measure equals 1; BMS uses #SECLEN for linear conversion, BMSON normalizes via pulses / (4*resolution).

Required Methods§

Source

fn audio_files(&self) -> HashMap<WavId, &Path>

Read: audio file resources (id to path mapping).

Source

fn bmp_files(&self) -> HashMap<BmpId, &Path>

Read: BGA/BMP image resources (id to path mapping).

Source

fn default_visible_y_length(&self) -> YCoordinate

Read: default visible Y range length (distance from when note appears in visible area to judgment line, unit: y coordinate).

Source

fn current_bpm(&self) -> Decimal

Read: current BPM (changes with events).

Source

fn current_speed(&self) -> Decimal

Read: current Speed factor (changes with events).

Source

fn current_scroll(&self) -> Decimal

Read: current Scroll factor (changes with events).

Source

fn start_play(&mut self, now: SystemTime)

Notify: start playback, record starting absolute time.

Source

fn update( &mut self, now: SystemTime, ) -> impl Iterator<Item = ChartEventWithPosition>

Update: advance internal timeline, return timeline events generated since last call (Elm style).

Source

fn post_events(&mut self, events: &[ControlEvent])

Post external control events (such as setting default reaction time/default BPM), will be consumed before next update.

These events are used to dynamically adjust player configuration parameters. Chart playback related events (such as notes, BGM, etc.) are returned by the [update] method, not posted through this method.

Source

fn visible_events( &mut self, now: SystemTime, ) -> impl Iterator<Item = VisibleEvent>

Query: all events in current visible area (preload logic).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl ChartProcessor for BmsProcessor

Source§

impl<'a> ChartProcessor for BmsonProcessor<'a>

Available on crate feature bmson only.