ansiplay/
lib.rs

1mod music;
2mod music_sequence_iterator;
3mod player;
4pub use music::Music;
5pub use music_sequence_iterator::{IntoMusicSequenceIter, MusicSequenceIterator};
6pub use player::{Player, PlayerThread};
7
8#[cfg(test)]
9mod test {
10    use crate::{Music, Player};
11    use rodio::{OutputStream, Sink};
12
13    fn play_str(string: &str) {
14        let (_stream, stream_handle) = OutputStream::try_default().unwrap();
15        let mut player = Player::default();
16        let music = Music::from(string);
17        let sink = Sink::try_new(&stream_handle).expect("sink");
18        player.play(music, sink);
19    }
20
21    #[test]
22    fn test() {
23        play_str(";;;900000");
24    }
25
26    #[test]
27    fn tutor_tune() {
28        play_str("T200 L8 O4 C < B > C F4 C < G#4 A > C4 < F MS GGG MN G4 A# 892.32;1;8;;-19.04 O3 L2 F P2");
29    }
30
31    #[test]
32    fn tutor_bird_call() {
33        play_str("1397;4;2;250 2600;1.2;4;;150");
34    }
35
36    #[test]
37    fn tutor_steam_ship() {
38        play_str("57;15 37;25");
39    }
40
41    #[test]
42    fn zapped_by_martians() {
43        play_str("7000;.12;200;25;-100");
44    }
45
46    #[test]
47    fn tutor_variation() {
48        play_str("100;2;10;5;*");
49    }
50}