WIP: Trying to get somewhere

Signed-off-by: Nikolai Rodionov <allanger@badhouseplants.net>
This commit is contained in:
2025-11-23 12:01:03 +01:00
parent 435d6c15be
commit 16e5951c1e
8 changed files with 225 additions and 5 deletions

View File

@@ -4,3 +4,4 @@ version = "0.1.0"
edition = "2024"
[dependencies]
uuid = { version = "1.18.1", features = ["v4"] }

View File

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

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

View File

@@ -1,3 +1,11 @@
struct Region {
name: String,
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,
}

View File

@@ -1,9 +1,16 @@
enum TrackType {
use crate::metadata::Metadata;
use super::region::Region;
pub (crate) enum TrackType {
Audio,
Midi,
}
struct Track {
name: String,
pub(crate) struct Track {
metadata: Metadata,
track_type: TrackType,
}
pub(crate) struct TrackStatus {
}