Skip to content

Commit

Permalink
bump xmodits-lib
Browse files Browse the repository at this point in the history
  • Loading branch information
B0ney committed Aug 19, 2024
1 parent 86ea66f commit d327057
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 33 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ tracing = "0.1"

[workspace.dependencies.xmodits-lib]
git = "https://github.com/B0ney/xmodits-lib.git"
rev = "f5674a2"
rev = "971dca25aec621ca88df589681b21ade539259f1"
features = ["serde"]

[workspace.dependencies.iced]
Expand Down
4 changes: 2 additions & 2 deletions audio_engine/src/sample/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ fn peak(buf: &[f32], rate: u32, interval: Duration) -> Vec<(f32, f32)> {
buf.chunks(chunks).map(min_max).collect()
}

impl From<xmodits_lib::dsp::SampleBuffer> for SampleBuffer {
fn from(sb: xmodits_lib::dsp::SampleBuffer) -> Self {
impl From<xmodits_lib::export::dsp::SampleBuffer> for SampleBuffer {
fn from(sb: xmodits_lib::export::dsp::SampleBuffer) -> Self {
let rate = sb.rate_original().clamp(1, u32::MAX);
Self::new(sb.buf, rate)
}
Expand Down
10 changes: 5 additions & 5 deletions audio_engine/src/sample_pack.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::path::{Path, PathBuf};

use xmodits_lib::dsp;
use xmodits_lib::export::dsp;
use xmodits_lib::{Module, Sample};

use crate::sample::buffer::SampleBuffer;
Expand All @@ -17,10 +17,10 @@ pub struct SamplePack {
}

impl SamplePack {
pub fn build(module: &dyn Module) -> Self {
let name = module.name().trim().to_owned();
let format = module.format().to_owned();
let total_samples = module.total_samples();
pub fn build(module: &Module) -> Self {
let name = module.info().name.trim().to_owned();
let format = module.info().format.to_owned();
let total_samples = module.len();
let total_sample_size = module.samples().iter().map(|m| m.length as usize).sum();

let samples = module
Expand Down
2 changes: 1 addition & 1 deletion data/src/config/sample_naming.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use serde::{Deserialize, Serialize};
use xmodits_lib::{SampleNamer, SampleNamerTrait};
use xmodits_lib::export::name::{SampleNamer, SampleNamerTrait};

#[derive(Serialize, Deserialize, Debug, Clone, Copy)]
#[serde(default)]
Expand Down
4 changes: 2 additions & 2 deletions data/src/config/sample_ripping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pub use super::SampleNameConfig;

use serde::{Deserialize, Serialize};
use std::path::PathBuf;
use xmodits_lib::exporter::AudioFormat;
use xmodits_lib::export::Format;

#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(default)]
Expand All @@ -12,7 +12,7 @@ pub struct SampleRippingConfig {
pub folder_max_depth: u8,
pub strict: bool,
pub worker_threads: usize,
pub exported_format: AudioFormat,
pub exported_format: Format,
}

impl Default for SampleRippingConfig {
Expand Down
16 changes: 8 additions & 8 deletions data/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ pub use config::Config;
pub use theme::Theme;
pub use time::Time;

use xmodits_lib::exporter::AudioFormat;
use xmodits_lib::export::Format;

pub const SUPPORTED_FORMATS: &[AudioFormat] = &[
AudioFormat::WAV,
AudioFormat::AIFF,
AudioFormat::ITS,
AudioFormat::S3I,
AudioFormat::IFF,
AudioFormat::RAW,
pub const SUPPORTED_FORMATS: &[Format] = &[
Format::WAV,
Format::AIFF,
Format::ITS,
Format::S3I,
Format::IFF,
Format::RAW,
];

#[cfg(feature = "manual")]
Expand Down
11 changes: 6 additions & 5 deletions src/app/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use crate::ripper::subscription::extraction::strict_loading;
use std::cmp::Ordering;
use std::path::PathBuf;

use xmodits_lib::interface::Error;
use xmodits_lib::{common::extract, interface::ripper::Ripper};
use xmodits_lib::Error;
use xmodits_lib::{extract, Ripper};

pub fn rip(paths: impl IntoIterator<Item = String>) {
let mut paths: Vec<PathBuf> = paths
Expand Down Expand Up @@ -53,9 +53,10 @@ pub fn rip(paths: impl IntoIterator<Item = String>) {

let self_contained = config.ripping.self_contained;

let mut ripper = Ripper::default();
ripper.change_namer(config.naming.build_func());
ripper.change_format(config.ripping.exported_format.get_impl());
let mut ripper = Ripper {
namer_func: config.naming.build_func(),
format: config.ripping.exported_format.get_impl()
};

let errors: Vec<(PathBuf, Error)> = paths
.into_iter()
Expand Down
2 changes: 1 addition & 1 deletion src/screen/config/name_preview.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Preview how ripped samples will be named
use data::config::{SampleNameConfig, SampleNameParams, SampleRippingConfig};
use xmodits_lib::interface::{name::Context, Sample};
use xmodits_lib::{export::name::Context, Sample};

pub fn preview_name<'a>(
params: &SampleNameParams,
Expand Down
4 changes: 2 additions & 2 deletions src/screen/config/sample_ripping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use std::path::{Path, PathBuf};

use data::config::SampleRippingConfig;
use xmodits_lib::exporter::AudioFormat;
use xmodits_lib::export::Format;

use crate::style;
use crate::utils::folder_dialog;
Expand All @@ -24,7 +24,7 @@ pub fn destination_is_valid(ripping: &SampleRippingConfig) -> bool {

#[derive(Debug, Clone)]
pub enum Message {
ExportFormat(AudioFormat),
ExportFormat(Format),
SelfContained(bool),
StrictLoad(bool),
WorkerThreads(Workers),
Expand Down
4 changes: 2 additions & 2 deletions src/screen/sample_player/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,8 +422,8 @@ fn load_samples(path: PathBuf) -> Task<Message> {
return Err(Error::io_error("File size exceeds 40 MB").unwrap_err());
}

let module = xmodits_lib::load_module(&mut file)?;
let sample_pack = audio_engine::SamplePack::build(&*module);
let module = xmodits_lib::load(&mut file, Some(path.to_owned()))?;
let sample_pack = audio_engine::SamplePack::build(&module);
let name = sample_pack.name;

let samples = sample_pack
Expand Down
1 change: 0 additions & 1 deletion src/screen/sample_player/preview_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ pub enum Message {
pub struct SamplePreview {
audio_engine: SamplePlayer,
windows: HashMap<Id, Instance>,
singleton: bool,
default_settings: MediaSettings,
}

Expand Down
2 changes: 1 addition & 1 deletion src/screen/tracker_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::widget::Element;

use iced::widget::{column, text, Space};
use iced::Alignment;
use xmodits_lib::common::info::Info;
use xmodits_lib::Info;

#[derive(Default, Debug, Clone)]
pub enum TrackerInfo {
Expand Down

0 comments on commit d327057

Please sign in to comment.