docs & fixes

This commit is contained in:
Franz Heinzmann (Frando) 2021-10-18 22:18:34 +02:00
parent 88722c3ce4
commit 0863cd57e4
3 changed files with 42 additions and 5 deletions

View file

@ -4,6 +4,7 @@ use futures_lite::prelude::*;
use log::*;
use regex::Regex;
use std::env;
use std::io;
#[derive(Debug)]
@ -16,8 +17,18 @@ pub struct FaustHandle {
impl FaustHandle {
pub async fn spawn() -> Result<Self, std::io::Error> {
let exec = "/home/bit/Code/studiox/studiox-mixer/mixer-jackconsole";
let mut child = Command::new(exec)
let bin_path = env::var("FAUST_DSP")
.expect("Set FAUST_DSP env variable to path to mixer faust executable");
let bin_path = if !bin_path.starts_with("/") {
format!(
"{}/{}",
env::current_dir().unwrap().to_str().unwrap(),
bin_path
)
} else {
bin_path.to_string()
};
let mut child = Command::new(bin_path)
.arg(".")
.stdout(Stdio::piped())
// .stderr(Stdio::piped())

View file

@ -3,6 +3,7 @@ use async_std::stream::{Stream, StreamExt};
use async_std::sync::{Arc, Mutex};
use async_std::task::{self, JoinHandle};
use std::collections::HashMap;
use std::env;
use std::net::SocketAddr;
use std::pin::Pin;
use std::task::{Context, Poll};
@ -83,9 +84,14 @@ pub fn run(
}
});
app.at("/")
.serve_dir("/home/bit/Code/studiox/studiox/frontend/build")
.unwrap();
let frontend_dir = env::var("FRONTEND_PATH").unwrap_or_else(|_| {
format!(
"{}/{}",
env::current_dir().unwrap().to_str().unwrap(),
"frontend/build"
)
});
app.at("/").serve_dir(frontend_dir).unwrap();
app.at("/ws")
.get(WebSocket::new(move |request, mut stream| {