Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrGlad committed Aug 17, 2024
1 parent 6648f14 commit 93cf7e5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ Grid-less MIDI editor with following goals:
* Do not care (much) about measures. Primarily aimed at piano real time recordings without explicit tempo/bars.
* A feature absent in other midi editors I could get my hands on (both commercial and free ones): removing a piece
of MIDI recording as one can remove a time fragment from PCM recording. For some odd reason DAW authors insist on
handling MIDI recordings differently from PCM sound recordings. In some editors this is doable but cumbersome at best.
* Playing/editing very long (up to about 25K of playable events) files. Those files are usually recordings of real
performances (e.g. from a MIDI keyboard).
handling time in MIDI editors differently from PCM sound recordings. In some editors this is doable but cumbersome at
best.
* Playing/editing very long (at elast up to about 25K of playable events) files. Those files are usually recordings of
real performances (e.g. from a MIDI keyboard).
* Comfortable workflow with keyboard.
* Allows making fine adjustments of notes and tempo.
* Unlimited undo/redo. Never loose session data. Non destructive edits, do not override original files.
Expand Down
12 changes: 7 additions & 5 deletions src/track_source.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
use std::fmt::{Debug, Formatter, Write};
use std::sync::Arc;

use sync_cow::SyncCow;

use crate::common::Time;
use crate::engine;
use crate::engine::{EngineEvent, EventSource};
use crate::midi::{controller_set, note_off, note_on};
use crate::track::{Track, TrackEventType};
use std::fmt::{Debug, Formatter, Write};
use std::sync::{Arc, RwLock};
use sync_cow::SyncCow;

pub struct TrackSource {
track: Arc<SyncCow<Track>>,
Expand Down Expand Up @@ -121,7 +123,7 @@ mod tests {

#[test]
fn empty_track() {
let track = Arc::new(RwLock::new(Track::default()));
let track = Arc::new(SyncCow::new(Track::default()));
let mut source = TrackSource::new(track);
source.seek(&100_000i64);
assert_eq!(source.running_at, 100_000);
Expand All @@ -142,7 +144,7 @@ mod tests {
duration: 12,
}),
});
let track = Arc::new(RwLock::new(track));
let track = Arc::new(SyncCow::new(track));

let mut source = TrackSource::new(track);
source.seek(&0);
Expand Down

0 comments on commit 93cf7e5

Please sign in to comment.