Skip to content

Commit

Permalink
async midi load
Browse files Browse the repository at this point in the history
  • Loading branch information
frett27 committed Oct 8, 2023
1 parent 641a409 commit 765f472
Show file tree
Hide file tree
Showing 10 changed files with 382 additions and 158 deletions.
66 changes: 66 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,9 @@ sys-locale = "0.3.1"
player= { path = "depends/player" }
midir = { version = "0.9.1" }



tracing-subscriber = "0.3"
im-native-dialog = "0.3.0"


# all plateforms support jack
nodi= { version = "0.19.2" , features=["midir-jack"]}
clap = { version = "4.3.10", features = ["derive"] }
Expand All @@ -41,6 +38,7 @@ pid-lite = { git = "https://github.com/yoshuawuyts/pid-lite", tag="v1.1.2" }

egui-phosphor = "0.3.0"
egui_dnd = "0.5.1"
egui_extras_xt = { git="https://github.com/xTibor/egui_extras_xt", branch="master", features=["ui","displays"]}

winit = {version="0.28.7", features=["wayland"]}

Expand Down
2 changes: 2 additions & 0 deletions depends/player/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@ midir = { version = "0.9.1" }
env_logger = "0.10.0"
log = "0.4.8"

thread-priority = "0.13.1"

[patch.crates-io]
midly = { git = "https://github.com/negamartin/midly" }
11 changes: 8 additions & 3 deletions depends/player/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{
path::PathBuf,
sync::{
mpsc::{Receiver, Sender},
Arc,
Arc, Mutex,
},
time::Duration,
};
Expand Down Expand Up @@ -38,12 +38,16 @@ pub trait PlayerFactory {
}

pub trait Player: Send {
fn play(&mut self, filename: &PathBuf, start_time: Option<f32>) -> Result<(), Box<dyn Error>>;
fn start_play(
&mut self,
filename: &PathBuf,
start_time: Option<f32>,
) -> Result<(), Box<dyn Error>>;
fn stop(&mut self);
fn is_playing(&self) -> bool;
// in milliseconds
fn current_play_time(&self) -> i64;
fn associated_notes(&self) -> Arc<Vec<Note>>;
fn associated_notes(&self) -> Arc<Mutex<Arc<Vec<Note>>>>;
}

pub trait FileInformationsConstructor: Send {
Expand All @@ -55,6 +59,7 @@ pub enum Response {
EndOfFile,
FileCancelled,
CurrentPlayTime(Duration),
FilePlayStarted((String, Arc<Vec<Note>>)),
}

#[derive(Debug)]
Expand Down
Loading

0 comments on commit 765f472

Please sign in to comment.