Skip to content

Commit

Permalink
work on sample player integration
Browse files Browse the repository at this point in the history
  • Loading branch information
B0ney committed Dec 13, 2023
1 parent bae78ea commit 92c8fcd
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ license = "GPLv3"
repository = "https://github.com/B0ney/xmodits"

[features]
default = ["built"]
default = ["built", "audio_engine"]
audio = ["audio_engine"]
wgpu = ["iced/wgpu"]

Expand Down
6 changes: 3 additions & 3 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ pub struct XMODITS {
state: State,
view: View,
ripper: ripper::Handle,
#[cfg(feature = "audio")]
audio: audio_engine::Handle,
// #[cfg(feature = "audio")]
audio: audio_engine::SamplePlayer,
// sample_pack: audio_engine::SamplePack,
tracker_info: Option<TrackerInfo>,
// sample_pack: (),
theme: theme::Theme,
naming_cfg: data::config::SampleNameConfig,
ripping_cfg: data::config::SampleRippingConfig,
Expand Down
2 changes: 1 addition & 1 deletion src/screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ pub mod config;
pub mod help;
pub mod history;
pub mod main_panel;
pub mod sample_preview;
pub mod sample_player;
pub mod settings;
pub mod tracker_info;
17 changes: 17 additions & 0 deletions src/screen/sample_player.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
pub mod sample_loader;
pub mod cache;


pub struct SamplePreviewWindow {

}


pub enum Message {
Play,
Pause,
Stop,
Loop,
}

pub fn view() {}
8 changes: 8 additions & 0 deletions src/screen/sample_player/cache.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
use std::{path::PathBuf, collections::HashMap};

use audio_engine::SamplePack;
use parking_lot::RwLock;

pub struct Cache {
cache: RwLock<HashMap<PathBuf, SamplePack>>,
}
14 changes: 14 additions & 0 deletions src/screen/sample_player/sample_loader.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use std::{fs::File, path::PathBuf};

use audio_engine::SamplePack;

// TODO
pub async fn load_sample_pack(path: PathBuf) -> SamplePack {
tokio::task::spawn_blocking(move || {
let mut file = File::open(path).unwrap();
let module = xmodits_lib::load_module(&mut file).unwrap();
SamplePack::build(&*module)
})
.await
.unwrap()
}
12 changes: 0 additions & 12 deletions src/screen/sample_preview.rs

This file was deleted.

0 comments on commit 92c8fcd

Please sign in to comment.