Compare commits

...

5 Commits

Author SHA1 Message Date
208090b60e WIP: Apply cargo fmt checks
All checks were successful
ci/woodpecker/push/pre_commit_test Pipeline was successful
ci/woodpecker/push/code_tests Pipeline was successful
Signed-off-by: Nikolai Rodionov <allanger@badhouseplants.net>
2025-11-23 18:55:04 +01:00
bda50db3b9 Run the pre-commit locally
Signed-off-by: Nikolai Rodionov <allanger@badhouseplants.net>
2025-11-23 18:55:04 +01:00
93c7622ad1 WIP: Still nothing meaningful
Signed-off-by: Nikolai Rodionov <allanger@badhouseplants.net>
2025-11-23 18:55:04 +01:00
4a567d10eb WIP: Preparing the codebase, nothing important
Signed-off-by: Nikolai Rodionov <allanger@badhouseplants.net>
2025-11-23 18:55:04 +01:00
ff405e0fa6 Add cargo fmt to the pipeline
Signed-off-by: Nikolai Rodionov <allanger@badhouseplants.net>
2025-11-23 18:54:57 +01:00
11 changed files with 389 additions and 0 deletions

View File

@@ -7,6 +7,11 @@ steps:
commands:
- rustup component add clippy
- cargo clippy
- name: Rust fmt
image: rust:1.91.1-bullseye
commands:
- rustup component add rustfmt
- cargo fmt --check
- name: Unit tests
image: rust:1.91.1-bullseye
commands:

268
Cargo.lock generated
View File

@@ -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"

View File

@@ -3,4 +3,8 @@ name = "termix"
version = "0.1.0"
edition = "2024"
[workspace]
resolver = "3"
members = ["engine", "lib"]
[dependencies]

8
engine/Cargo.toml Normal file
View File

@@ -0,0 +1,8 @@
[package]
name = "engine"
version = "0.1.0"
edition = "2024"
[dependencies]
jack = "0.13.3"
lib = { path = "../lib/" }

33
engine/src/main.rs Normal file
View File

@@ -0,0 +1,33 @@
use lib::{self, metadata::Metadata, track::Track};
fn main() {
let mut current_project = lib::project::Project {
name: "test".to_string(),
tracks: None,
regions: None,
current_sample: 0,
};
let track = Track {
metadata: Metadata::new("test".to_string()),
track_type: lib::track::TrackType::Audio,
active: true,
};
current_project.tracks = Some(vec![track]);
/*
* 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!");
}

7
lib/Cargo.toml Normal file
View File

@@ -0,0 +1,7 @@
[package]
name = "lib"
version = "0.1.0"
edition = "2024"
[dependencies]
uuid = { version = "1.18.1", features = ["v4"] }

5
lib/src/lib.rs Normal file
View File

@@ -0,0 +1,5 @@
pub mod metadata;
pub mod project;
pub mod region;
pub mod track;

25
lib/src/metadata.rs Normal file
View File

@@ -0,0 +1,25 @@
use uuid::Uuid;
pub struct Metadata {
id: Uuid,
name: String,
}
impl Metadata {
pub fn new(name: String) -> Self {
let id = Uuid::new_v4();
Self { id, name }
}
pub fn id(&self) -> Uuid {
self.id
}
pub fn name(&self) -> &str {
&self.name
}
pub fn set_name(&mut self, name: String) {
self.name = name;
}
}

9
lib/src/project.rs Normal file
View File

@@ -0,0 +1,9 @@
use crate::{metadata::Metadata, region::Region, track::Track};
pub struct Project {
pub name: String,
pub tracks: Option<Vec<Track>>,
pub regions: Option<Vec<Region>>,
// Current playhead position
pub current_sample: u64,
}

11
lib/src/region.rs Normal file
View File

@@ -0,0 +1,11 @@
use crate::metadata::Metadata;
pub struct Region {
pub metadata: Metadata,
// Position of the track on the track
pub starts_at: u64,
// From which point of the audio source the region starts
pub plays_from: u64,
// Duration of the region after plays_from
pub duration: u64,
}

14
lib/src/track.rs Normal file
View File

@@ -0,0 +1,14 @@
use crate::metadata::Metadata;
pub enum TrackType {
Audio,
Midi,
}
pub struct Track {
pub metadata: Metadata,
pub track_type: TrackType,
pub active: bool,
}
pub struct TrackStatus {}