WIP: Preparing the codebase, nothing important

Signed-off-by: Nikolai Rodionov <allanger@badhouseplants.net>
This commit is contained in:
2025-11-22 20:31:38 +01:00
parent 6e7b07ab28
commit 285c4a10fd
10 changed files with 368 additions and 0 deletions

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 @@
mod metadata;
mod project;
mod region;
mod track;

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

@@ -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;
}
}

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

@@ -0,0 +1,7 @@
use crate::{region::Region, track::Track};
pub(crate) struct Project {
name: String,
tracks: Vec<Track>,
regions: Vec<Region>,
}

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

@@ -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,
}

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

@@ -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 {}