WIP: Still nothing meaningful
Some checks failed
ci/woodpecker/push/code_tests Pipeline was successful
ci/woodpecker/push/pre_commit_test Pipeline failed

Signed-off-by: Nikolai Rodionov <allanger@badhouseplants.net>
This commit is contained in:
2025-11-23 17:53:49 +01:00
parent 285c4a10fd
commit 0a1d68cb2d
6 changed files with 45 additions and 27 deletions

View File

@@ -1,6 +1,23 @@
use lib; use lib::{self, metadata::Metadata, track::Track};
fn main() { 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, * Engine should run and wait for commands,
* but currently I need to implement the multitrack * but currently I need to implement the multitrack

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,15 +1,14 @@
use crate::metadata::Metadata; use crate::metadata::Metadata;
use super::region::Region; pub enum TrackType {
pub(crate) enum TrackType {
Audio, Audio,
Midi, Midi,
} }
pub(crate) struct Track { pub struct Track {
metadata: Metadata, pub metadata: Metadata,
track_type: TrackType, pub track_type: TrackType,
pub active: bool,
} }
pub(crate) struct TrackStatus {} pub struct TrackStatus {}