sorceress
sorceress copied to clipboard
Live reloading development workflow
Some ideas regarding the live reloading development workflow.
- I have had success with https://crates.io/crates/dynamic_reload for live reloading of Rust DLLs (auto rebuilding the DLL with
cargo watch -x build
) for the purpose of live coding in Rust. (This can also be made ABI-stable with https://crates.io/crates/abi_stable but when compiling host and DLL with the same nightly, I had no issues.) - Here is a Rust evaluator: https://crates.io/crates/evcxr (used by https://crates.io/crates/evcxr_repl)
- Here is another Rust evaluator that can be embedded into any host: https://crates.io/crates/irust_repl It was factored out of
IRust
to make it easily re-useable from other hosts, after I raised this issue: https://github.com/sigmaSd/IRust/issues/77 These evaluators can be combined with file reloading after saving a file, by using https://crates.io/crates/hotwatch, https://crates.io/crates/notify or https://crates.io/crates/warmy
Other relevant links: https://github.com/Michael-F-Bryan/plugins_in_rust https://adventures.michaelfbryan.com/posts/plugins-in-rust/
Btw, someone also implemented a UGen in Rust: http://www.andrewchristophersmith.com/2015/01/01/implementing-a-supercollider-external-in-rust/ https://github.com/andrewcsmith/vox_box_supercollider
Btw, sorceress seems to work already inside evcxr
, I just tried it in PowerShell on Win 10:
> cargo install evcxr_repl
> evcxr
Welcome to evcxr. For help, type :help
>> :dep sorceress = "*"
>> use sorceress::{server::{self, Result, Server}, synthdef::{encoder::encode_synth_defs, SynthDef}, ugen};
>> let server = Server::connect("127.0.0.1:57110")?;
>> let sine_wave = SynthDef::new("sine_wave", |_| { ugen::Out::ar().channels(ugen::Pan2::ar().input(ugen::SinOsc::ar().freq(220))) });
>> let encoded_synthdef = encode_synth_defs(vec![sine_wave]);
>> server.send_sync(server::SynthDefRecv::new(&encoded_synthdef))?;
>> server.send(server::SynthNew::new("sine_wave", 0))?;
>> server.reset()?;
>>
Then SC played the sine wave until I entered server.reset()?;
:)