mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
refactor into fewer crates, pt.2
This commit is contained in:
parent
77703d83a5
commit
a22a793c31
48 changed files with 2155 additions and 2157 deletions
53
crates/device/src/sequencer.rs
Normal file
53
crates/device/src/sequencer.rs
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
use crate::*;
|
||||
|
||||
mod seq_clip; pub use self::seq_clip::*;
|
||||
mod seq_launch; pub use self::seq_launch::*;
|
||||
mod seq_model; pub use self::seq_model::*;
|
||||
mod seq_view; pub use self::seq_view::*;
|
||||
|
||||
#[cfg(test)] #[test] pub fn test_midi_clip () {
|
||||
let clip = MidiClip::stop_all();
|
||||
println!("{clip:?}");
|
||||
|
||||
let clip = MidiClip::default();
|
||||
let mut clip = MidiClip::new("clip", true, 1, None, None);
|
||||
clip.set_length(96);
|
||||
clip.toggle_loop();
|
||||
clip.record_event(12, midly::MidiMessage::NoteOn { key: 36.into(), vel: 100.into() });
|
||||
assert!(clip.contains_note_on(36.into(), 6, 18));
|
||||
assert_eq!(&clip.notes, &clip.duplicate().notes);
|
||||
|
||||
let clip = std::sync::Arc::new(clip);
|
||||
assert_eq!(clip.clone(), clip);
|
||||
}
|
||||
|
||||
#[cfg(test)] #[test] fn test_midi_play () {
|
||||
let player = MidiPlayer::default();
|
||||
println!("{player:?}");
|
||||
}
|
||||
|
||||
#[cfg(test)] #[test] fn test_midi_edit () {
|
||||
let editor = MidiEditor::default();
|
||||
let mut editor = MidiEditor {
|
||||
mode: PianoHorizontal::new(Some(&Arc::new(RwLock::new(MidiClip::stop_all())))),
|
||||
size: Default::default(),
|
||||
keys: Default::default(),
|
||||
};
|
||||
let _ = editor.put_note(true);
|
||||
let _ = editor.put_note(false);
|
||||
let _ = editor.clip_status();
|
||||
let _ = editor.edit_status();
|
||||
struct TestEditorHost(Option<MidiEditor>);
|
||||
has_editor!(|self: TestEditorHost|{
|
||||
editor = self.0;
|
||||
editor_w = 0;
|
||||
editor_h = 0;
|
||||
is_editing = false;
|
||||
});
|
||||
let mut host = TestEditorHost(Some(editor));
|
||||
let _ = host.editor();
|
||||
let _ = host.editor_mut();
|
||||
let _ = host.is_editing();
|
||||
let _ = host.editor_w();
|
||||
let _ = host.editor_h();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue