docs & fixes
This commit is contained in:
parent
88722c3ce4
commit
0863cd57e4
3 changed files with 42 additions and 5 deletions
20
README.md
Normal file
20
README.md
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
|
||||||
|
build dsp:
|
||||||
|
```sh
|
||||||
|
cd dsp
|
||||||
|
faust2jackconsole -osc mixer.dsp
|
||||||
|
```
|
||||||
|
|
||||||
|
build frontend:
|
||||||
|
```sh
|
||||||
|
cd frontend
|
||||||
|
yarn
|
||||||
|
yarn build
|
||||||
|
```
|
||||||
|
|
||||||
|
build and run backend & serve frontend:
|
||||||
|
```sh
|
||||||
|
cargo run
|
||||||
|
```
|
||||||
|
|
||||||
|
open http://localhost:8080/index.html
|
||||||
15
src/spawn.rs
15
src/spawn.rs
|
|
@ -4,6 +4,7 @@ use futures_lite::prelude::*;
|
||||||
use log::*;
|
use log::*;
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
|
|
||||||
|
use std::env;
|
||||||
use std::io;
|
use std::io;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|
@ -16,8 +17,18 @@ pub struct FaustHandle {
|
||||||
|
|
||||||
impl FaustHandle {
|
impl FaustHandle {
|
||||||
pub async fn spawn() -> Result<Self, std::io::Error> {
|
pub async fn spawn() -> Result<Self, std::io::Error> {
|
||||||
let exec = "/home/bit/Code/studiox/studiox-mixer/mixer-jackconsole";
|
let bin_path = env::var("FAUST_DSP")
|
||||||
let mut child = Command::new(exec)
|
.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(".")
|
.arg(".")
|
||||||
.stdout(Stdio::piped())
|
.stdout(Stdio::piped())
|
||||||
// .stderr(Stdio::piped())
|
// .stderr(Stdio::piped())
|
||||||
|
|
|
||||||
12
src/ws.rs
12
src/ws.rs
|
|
@ -3,6 +3,7 @@ use async_std::stream::{Stream, StreamExt};
|
||||||
use async_std::sync::{Arc, Mutex};
|
use async_std::sync::{Arc, Mutex};
|
||||||
use async_std::task::{self, JoinHandle};
|
use async_std::task::{self, JoinHandle};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
use std::env;
|
||||||
use std::net::SocketAddr;
|
use std::net::SocketAddr;
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
use std::task::{Context, Poll};
|
use std::task::{Context, Poll};
|
||||||
|
|
@ -83,9 +84,14 @@ pub fn run(
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.at("/")
|
let frontend_dir = env::var("FRONTEND_PATH").unwrap_or_else(|_| {
|
||||||
.serve_dir("/home/bit/Code/studiox/studiox/frontend/build")
|
format!(
|
||||||
.unwrap();
|
"{}/{}",
|
||||||
|
env::current_dir().unwrap().to_str().unwrap(),
|
||||||
|
"frontend/build"
|
||||||
|
)
|
||||||
|
});
|
||||||
|
app.at("/").serve_dir(frontend_dir).unwrap();
|
||||||
|
|
||||||
app.at("/ws")
|
app.at("/ws")
|
||||||
.get(WebSocket::new(move |request, mut stream| {
|
.get(WebSocket::new(move |request, mut stream| {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue