Trying to add protoc
This commit is contained in:
2
.codespellrc
Normal file
2
.codespellrc
Normal file
@@ -0,0 +1,2 @@
|
||||
[codespell]
|
||||
ignore-words-list = ratatui
|
||||
1276
Cargo.lock
generated
1276
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
[workspace]
|
||||
resolver = "3"
|
||||
members = ["engine", "examples/jack-sine", "lib"]
|
||||
members = ["engine", "examples/jack-sine", "lib", "tui"]
|
||||
|
||||
[workspace.dependencies]
|
||||
|
||||
@@ -1,2 +1,8 @@
|
||||
# termix
|
||||
[](https://ci.badhouseplants.net/repos/19)
|
||||
|
||||
|
||||
# Requirenments
|
||||
|
||||
On all systems:
|
||||
- protoc
|
||||
|
||||
@@ -4,9 +4,13 @@ version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
clap = { version = "4.5.53", features = ["derive"] }
|
||||
coreaudio-rs = { version = "0.13.0", optional = true }
|
||||
jack = {version = "0.13.3", optional = true }
|
||||
lib = { path = "../lib/" }
|
||||
prost = "0.14.1"
|
||||
tokio = { version = "1.48.0", features = ["rt-multi-thread"] }
|
||||
tonic-prost = "0.14.2"
|
||||
|
||||
[features]
|
||||
jack = ["dep:jack"]
|
||||
|
||||
@@ -1,35 +1,23 @@
|
||||
mod audio_engine;
|
||||
use clap::Parser;
|
||||
|
||||
use lib::{self, metadata::Metadata, track::Track};
|
||||
/// Simple program to greet a person
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(version, about, long_about = None)]
|
||||
struct Args {
|
||||
/// Name of the person to greet
|
||||
#[arg(short, long)]
|
||||
name: String,
|
||||
|
||||
/// Number of times to greet
|
||||
#[arg(short, long, default_value_t = 1)]
|
||||
count: u8,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let mut current_project = lib::project::Project {
|
||||
name: "test".to_string(),
|
||||
tracks: None,
|
||||
regions: None,
|
||||
current_sample: 0,
|
||||
};
|
||||
let args = Args::parse();
|
||||
|
||||
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
|
||||
* audio player somehow
|
||||
*
|
||||
*
|
||||
* for track in tracks {
|
||||
* if track.is_region_playing(now: time) {
|
||||
* let current_region = track.get_current_region(now: time)
|
||||
* let audio = current_region.get_data(now: time)
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
println!("Hello, world!");
|
||||
for _ in 0..args.count {
|
||||
println!("Hello {}!", args.name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,3 +5,6 @@ edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
uuid = { version = "1.18.1", features = ["v4"] }
|
||||
|
||||
[build-dependencies]
|
||||
tonic-prost-build = "0.14.2"
|
||||
|
||||
4
lib/build.rs
Normal file
4
lib/build.rs
Normal file
@@ -0,0 +1,4 @@
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
tonic_prost_build::compile_protos("proto/helloworld.proto")?;
|
||||
Ok(())
|
||||
}
|
||||
14
lib/proto/helloworld.proto
Normal file
14
lib/proto/helloworld.proto
Normal file
@@ -0,0 +1,14 @@
|
||||
syntax = "proto3";
|
||||
package helloworld;
|
||||
|
||||
service Greeter {
|
||||
rpc SayHello (HelloRequest) returns (HelloReply);
|
||||
}
|
||||
|
||||
message HelloRequest {
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
message HelloReply {
|
||||
string message = 1;
|
||||
}
|
||||
10
tui/Cargo.toml
Normal file
10
tui/Cargo.toml
Normal file
@@ -0,0 +1,10 @@
|
||||
[package]
|
||||
name = "tui"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
clap = { version = "4.5.53", features = ["derive"] }
|
||||
color-eyre = "0.6.5"
|
||||
crossterm = "0.29.0"
|
||||
ratatui = "0.29.0"
|
||||
31
tui/src/main.rs
Normal file
31
tui/src/main.rs
Normal file
@@ -0,0 +1,31 @@
|
||||
use color_eyre::Result;
|
||||
use crossterm::event::{self, Event};
|
||||
use ratatui::{DefaultTerminal, Frame};
|
||||
use clap::Parser;
|
||||
|
||||
/// Simple program to greet a person
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(version, about, long_about = None)]
|
||||
struct Args {}
|
||||
|
||||
fn main() -> Result<()> {
|
||||
let _ = Args::parse();
|
||||
color_eyre::install()?;
|
||||
let terminal = ratatui::init();
|
||||
let result = run(terminal);
|
||||
ratatui::restore();
|
||||
result
|
||||
}
|
||||
|
||||
fn run(mut terminal: DefaultTerminal) -> Result<()> {
|
||||
loop {
|
||||
terminal.draw(render)?;
|
||||
if matches!(event::read()?, Event::Key(_)) {
|
||||
break Ok(());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn render(frame: &mut Frame) {
|
||||
frame.render_widget("hello world", frame.area());
|
||||
}
|
||||
Reference in New Issue
Block a user