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() {
|
||||
|
||||
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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
mod metadata;
|
||||
mod project;
|
||||
pub mod metadata;
|
||||
|
||||
mod region;
|
||||
mod track;
|
||||
pub mod region;
|
||||
pub mod track;
|
||||
pub mod project;
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
use uuid::Uuid;
|
||||
|
||||
pub(crate) struct Metadata {
|
||||
pub struct Metadata {
|
||||
id: Uuid,
|
||||
name: String,
|
||||
}
|
||||
|
||||
impl Metadata {
|
||||
pub(crate) fn new(name: String) -> Self {
|
||||
pub fn new(name: String) -> Self {
|
||||
let id = Uuid::new_v4();
|
||||
Self { id, name }
|
||||
}
|
||||
|
||||
pub(crate) fn id(&self) -> Uuid {
|
||||
pub fn id(&self) -> Uuid {
|
||||
self.id
|
||||
}
|
||||
|
||||
pub(crate) fn name(&self) -> &str {
|
||||
pub fn name(&self) -> &str {
|
||||
&self.name
|
||||
}
|
||||
|
||||
pub(crate) fn set_name(&mut self, name: String) {
|
||||
pub fn set_name(&mut self, name: String) {
|
||||
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 {
|
||||
name: String,
|
||||
tracks: Vec<Track>,
|
||||
regions: Vec<Region>,
|
||||
pub struct Project {
|
||||
pub name: String,
|
||||
pub tracks: Option<Vec<Track>>,
|
||||
pub regions: Option<Vec<Region>>,
|
||||
// Current playhead position
|
||||
pub current_sample: u64,
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
use crate::metadata::Metadata;
|
||||
|
||||
pub(crate) struct Region {
|
||||
metadata: Metadata,
|
||||
pub struct Region {
|
||||
pub metadata: Metadata,
|
||||
// Position of the track on the track
|
||||
starts_at: u64,
|
||||
pub starts_at: u64,
|
||||
// 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: u64,
|
||||
pub duration: u64,
|
||||
}
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
use crate::metadata::Metadata;
|
||||
|
||||
use super::region::Region;
|
||||
|
||||
pub(crate) enum TrackType {
|
||||
pub enum TrackType {
|
||||
Audio,
|
||||
Midi,
|
||||
}
|
||||
|
||||
pub(crate) struct Track {
|
||||
metadata: Metadata,
|
||||
track_type: TrackType,
|
||||
pub struct Track {
|
||||
pub metadata: Metadata,
|
||||
pub track_type: TrackType,
|
||||
pub active: bool,
|
||||
}
|
||||
|
||||
pub(crate) struct TrackStatus {}
|
||||
pub struct TrackStatus {}
|
||||
|
||||
Reference in New Issue
Block a user