From 8a6227d382784aa8b77235513722042bdfa88fab Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Sun, 30 Nov 2025 14:22:16 +0100 Subject: [PATCH] Keep adding irrelevant stuff --- Cargo.lock | 65 +++++++++++++++++++++++++++++++++++ engine/Cargo.toml | 3 ++ engine/src/main.rs | 45 +++++++++++++++++------- lib/build.rs | 3 +- lib/proto/audio_backend.proto | 13 ++----- lib/proto/items.proto | 18 ---------- 6 files changed, 103 insertions(+), 44 deletions(-) delete mode 100644 lib/proto/items.proto diff --git a/Cargo.lock b/Cargo.lock index 1348247..b0af3e8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -469,13 +469,39 @@ version = "0.1.0" dependencies = [ "clap", "coreaudio-rs", + "env_logger", "jack", "lib", + "log", "prost", "tokio", + "tonic", "tonic-prost", ] +[[package]] +name = "env_filter" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2" +dependencies = [ + "log", + "regex", +] + +[[package]] +name = "env_logger" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "jiff", + "log", +] + [[package]] name = "equivalent" version = "1.0.2" @@ -827,6 +853,30 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "jiff" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49cce2b81f2098e7e3efc35bc2e0a6b7abec9d34128283d7a26fa8f32a6dbb35" +dependencies = [ + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", +] + +[[package]] +name = "jiff-static" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "980af8b43c3ad5d8d349ace167ec8170839f753a42d233ba19e08afe1850fa69" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "js-sys" version = "0.3.82" @@ -1142,6 +1192,21 @@ version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" +[[package]] +name = "portable-atomic" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" + +[[package]] +name = "portable-atomic-util" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +dependencies = [ + "portable-atomic", +] + [[package]] name = "prettyplease" version = "0.2.37" diff --git a/engine/Cargo.toml b/engine/Cargo.toml index a2c1afd..580fb75 100644 --- a/engine/Cargo.toml +++ b/engine/Cargo.toml @@ -6,10 +6,13 @@ edition = "2024" [dependencies] clap = { version = "4.5.53", features = ["derive"] } coreaudio-rs = { version = "0.13.0", optional = true } +env_logger = "0.11.8" jack = {version = "0.13.3", optional = true } lib = { path = "../lib/" } +log = "0.4.28" prost = "0.14.1" tokio = { version = "1.48.0", features = ["rt-multi-thread"] } +tonic = "0.14.2" tonic-prost = "0.14.2" [features] diff --git a/engine/src/main.rs b/engine/src/main.rs index 2a5f12a..d76c01d 100644 --- a/engine/src/main.rs +++ b/engine/src/main.rs @@ -1,24 +1,43 @@ mod audio_engine; use clap::Parser; -use lib::termix::audio_backend::audio_backend_server; - +use lib::termix::audio_backend::audio_backend_server::{AudioBackend, AudioBackendServer}; +use tonic::{transport::Server, Request, Response, Status}; +use log::{debug, error, log_enabled, info, Level}; /// 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, + #[arg(long, default_value_t = 50051)] + grpc_port: i32, } -fn main() { - let args = Args::parse(); +#[derive(Debug, Default)] +pub struct TermixAudioBackend {} - for _ in 0..args.count { - println!("Hello {}!", args.name); +#[tonic::async_trait] +impl AudioBackend for TermixAudioBackend { + async fn start_client(&self,request:tonic::Request<()>,) -> std::result::Result,tonic::Status> { + todo!() + } + + async fn init_connection(&self,request:tonic::Request<()>,) -> std::result::Result,tonic::Status> { + todo!() } } + +#[tokio::main] +async fn main() -> Result<(), Box> { + env_logger::init(); + let args = Args::parse(); + info!("starting the grpc server on port {:?}", args.grpc_port); + + let addr = "[::1]:50051".parse()?; + let greeter = TermixAudioBackend::default(); + + Server::builder() + .add_service(AudioBackendServer::new(greeter)) + .serve(addr) + .await?; + + Ok(()) +} diff --git a/lib/build.rs b/lib/build.rs index efa4502..a1ab6bb 100644 --- a/lib/build.rs +++ b/lib/build.rs @@ -1,5 +1,4 @@ -use std::{fs, io::Result}; -use tonic_prost_build; +use std::io::Result; fn main() -> Result<()> { //let proto_dir = "proto"; diff --git a/lib/proto/audio_backend.proto b/lib/proto/audio_backend.proto index 1f4ec12..00b98aa 100644 --- a/lib/proto/audio_backend.proto +++ b/lib/proto/audio_backend.proto @@ -8,16 +8,7 @@ service AudioBackend { rpc InitConnection(google.protobuf.Empty) returns (google.protobuf.Empty); } -message Shirt { - // Label sizes - enum Size { - SMALL = 0; - MEDIUM = 1; - LARGE = 2; - } - // The base color - string color = 1; - // The size as stated on the label - Size size = 2; +message Shirt { + google.protobuf.Empty dummy = 1; } diff --git a/lib/proto/items.proto b/lib/proto/items.proto deleted file mode 100644 index 56c50c9..0000000 --- a/lib/proto/items.proto +++ /dev/null @@ -1,18 +0,0 @@ -syntax = "proto3"; - -package snazzy.items; - -// A snazzy new shirt! -message Shirt { - // Label sizes - enum Size { - SMALL = 0; - MEDIUM = 1; - LARGE = 2; - } - - // The base color - string color = 1; - // The size as stated on the label - Size size = 2; -}