encode_tempo

Function encode_tempo 

Source
pub fn encode_tempo(tempo_events: &[TempoEvent]) -> Result<String, EncodeError>
Expand description

Encodes a list of tempo events into the given writer

Events should be sorted by type and time to be pastable into ArrowVortex.

use arrowvortex_clipboard::{TempoEvent, TempoEventKind};

let events = &[
    TempoEvent { row: 0, kind: TempoEventKind::Bpm { bpm: 120.0 } },
    TempoEvent { row: 48, kind: TempoEventKind::Delay { time: 0.2 } },
    TempoEvent { row: 96, kind: TempoEventKind::Warp { num_skipped_rows: 24 } },
    TempoEvent { row: 144, kind: TempoEventKind::Scroll { ratio: 2.0 } },
];

assert_eq!(
    arrowvortex_clipboard::encode_tempo(events)?,
    r#"ArrowVortex:tempo:!<<*"zz?9eMm0E;(QR[KS3R@2/]!<Z^0!!!i9!!!$*O8o7\z!!!!a!!"#,
);