diff --git a/Cargo.lock b/Cargo.lock index d02558c..7a979d0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,274 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" + +[[package]] +name = "bumpalo" +version = "3.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "engine" +version = "0.1.0" +dependencies = [ + "jack", + "lib", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasip2", +] + +[[package]] +name = "jack" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f70ca699f44c04a32d419fc9ed699aaea89657fc09014bf3fa238e91d13041b9" +dependencies = [ + "bitflags 2.10.0", + "jack-sys", + "lazy_static", + "libc", + "log", +] + +[[package]] +name = "jack-sys" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6013b7619b95a22b576dfb43296faa4ecbe40abbdb97dfd22ead520775fc86ab" +dependencies = [ + "bitflags 1.3.2", + "lazy_static", + "libc", + "libloading", + "log", + "pkg-config", +] + +[[package]] +name = "js-sys" +version = "0.3.82" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b011eec8cc36da2aab2d5cff675ec18454fad408585853910a202391cf9f8e65" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "lib" +version = "0.1.0" +dependencies = [ + "uuid", +] + +[[package]] +name = "libc" +version = "0.2.177" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" + +[[package]] +name = "libloading" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +dependencies = [ + "cfg-if", + "winapi", +] + +[[package]] +name = "log" +version = "0.4.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "pkg-config" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" + +[[package]] +name = "proc-macro2" +version = "1.0.103" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[package]] +name = "syn" +version = "2.0.111" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "390cc9a294ab71bdb1aa2e99d13be9c753cd2d7bd6560c77118597410c4d2e87" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "termix" version = "0.1.0" + +[[package]] +name = "unicode-ident" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" + +[[package]] +name = "uuid" +version = "1.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f87b8aa10b915a06587d0dec516c282ff295b475d94abf425d62b57710070a2" +dependencies = [ + "getrandom", + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "wasip2" +version = "1.0.1+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.105" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da95793dfc411fbbd93f5be7715b0578ec61fe87cb1a42b12eb625caa5c5ea60" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.105" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04264334509e04a7bf8690f2384ef5265f05143a4bff3889ab7a3269adab59c2" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.105" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "420bc339d9f322e562942d52e115d57e950d12d88983a14c79b86859ee6c7ebc" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.105" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76f218a38c84bcb33c25ec7059b07847d465ce0e0a76b995e134a45adcb6af76" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "wit-bindgen" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" diff --git a/Cargo.toml b/Cargo.toml index 6a448db..80c9508 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,4 +3,8 @@ name = "termix" version = "0.1.0" edition = "2024" +[workspace] +resolver = "3" +members = ["engine", "lib"] + [dependencies] diff --git a/engine/Cargo.toml b/engine/Cargo.toml new file mode 100644 index 0000000..3e2f71e --- /dev/null +++ b/engine/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "engine" +version = "0.1.0" +edition = "2024" + +[dependencies] +jack = "0.13.3" +lib = { path = "../lib/" } diff --git a/engine/src/main.rs b/engine/src/main.rs new file mode 100644 index 0000000..0fca070 --- /dev/null +++ b/engine/src/main.rs @@ -0,0 +1,18 @@ +use lib; + +fn main() { + /* + * Engine should run and wait for commands, + * but currently I need to implement the multitrack + * audio player somehow + * + * + * for track in tracks { + * if track.is_region_playing(now: time) { + * let current_region = track.get_current_region(now: time) + * let audio = current_region.get_data(now: time) + * } + * } + */ + println!("Hello, world!"); +} diff --git a/lib/Cargo.toml b/lib/Cargo.toml new file mode 100644 index 0000000..6b9fdf7 --- /dev/null +++ b/lib/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "lib" +version = "0.1.0" +edition = "2024" + +[dependencies] +uuid = { version = "1.18.1", features = ["v4"] } diff --git a/lib/src/lib.rs b/lib/src/lib.rs new file mode 100644 index 0000000..619f897 --- /dev/null +++ b/lib/src/lib.rs @@ -0,0 +1,5 @@ +mod metadata; +mod project; + +mod region; +mod track; diff --git a/lib/src/metadata.rs b/lib/src/metadata.rs new file mode 100644 index 0000000..dd38dde --- /dev/null +++ b/lib/src/metadata.rs @@ -0,0 +1,25 @@ +use uuid::Uuid; + +pub(crate) struct Metadata { + id: Uuid, + name: String, +} + +impl Metadata { + pub(crate) fn new(name: String) -> Self { + let id = Uuid::new_v4(); + Self { id, name } + } + + pub(crate) fn id(&self) -> Uuid { + self.id + } + + pub(crate) fn name(&self) -> &str { + &self.name + } + + pub(crate) fn set_name(&mut self, name: String) { + self.name = name; + } +} diff --git a/lib/src/project.rs b/lib/src/project.rs new file mode 100644 index 0000000..c8bb7ea --- /dev/null +++ b/lib/src/project.rs @@ -0,0 +1,7 @@ +use crate::{region::Region, track::Track}; + +pub(crate) struct Project { + name: String, + tracks: Vec, + regions: Vec, +} diff --git a/lib/src/region.rs b/lib/src/region.rs new file mode 100644 index 0000000..04ecdb2 --- /dev/null +++ b/lib/src/region.rs @@ -0,0 +1,11 @@ +use crate::metadata::Metadata; + +pub(crate) struct Region { + metadata: Metadata, + // Position of the track on the track + starts_at: u64, + // From which point of the audio source the region starts + plays_from: u64, + // Duration of the region after plays_from + duration: u64, +} diff --git a/lib/src/track.rs b/lib/src/track.rs new file mode 100644 index 0000000..f68686e --- /dev/null +++ b/lib/src/track.rs @@ -0,0 +1,15 @@ +use crate::metadata::Metadata; + +use super::region::Region; + +pub(crate) enum TrackType { + Audio, + Midi, +} + +pub(crate) struct Track { + metadata: Metadata, + track_type: TrackType, +} + +pub(crate) struct TrackStatus {}