WIP: Still nothing meaningful
Signed-off-by: Nikolai Rodionov <allanger@badhouseplants.net>
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
mod metadata;
|
pub mod metadata;
|
||||||
mod project;
|
|
||||||
|
|
||||||
mod region;
|
pub mod region;
|
||||||
mod track;
|
pub mod track;
|
||||||
|
pub mod project;
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 {}
|
||||||
|
|||||||
Reference in New Issue
Block a user