Browse Source

Removing last remains of the Lua interface

native_animation
Thomas Kolb 8 months ago
parent
commit
fc43035f9b
  1. 41
      Cargo.lock
  2. 1
      Cargo.toml
  3. 3
      src/animation.rs
  4. 26
      src/main.rs

41
Cargo.lock

@ -41,27 +41,12 @@ version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
[[package]]
name = "bstr"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "473fc6b38233f9af7baa94fb5852dca389e3d95b8e21c8e3719301462c5d9faf"
dependencies = [
"memchr",
]
[[package]]
name = "byteorder"
version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae44d1a3d5a19df61dd0c8beb138458ac2a53a7ac09eba97d55592540004306b"
[[package]]
name = "cc"
version = "1.0.66"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c0496836a84f8d0495758516b8621a622beb77c0fed418570e50764093ced48"
[[package]]
name = "cfg-if"
version = "1.0.0"
@ -168,12 +153,6 @@ dependencies = [
"rawpointer",
]
[[package]]
name = "memchr"
version = "2.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525"
[[package]]
name = "miniz_oxide"
version = "0.4.3"
@ -184,26 +163,12 @@ dependencies = [
"autocfg",
]
[[package]]
name = "mlua"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0bd179c80340f87911c17eb365ab9f890cf745ac722860d1465be5889be2853a"
dependencies = [
"bstr",
"cc",
"lazy_static",
"num-traits",
"pkg-config",
]
[[package]]
name = "musiclight"
version = "0.1.0"
dependencies = [
"byteorder",
"fftw",
"mlua",
"rand",
]
@ -244,12 +209,6 @@ version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9a7ab5d64814df0fe4a4b5ead45ed6c5f181ee3ff04ba344313a6c80446c5d4"
[[package]]
name = "pkg-config"
version = "0.3.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c"
[[package]]
name = "ppv-lite86"
version = "0.2.10"

1
Cargo.toml

@ -9,5 +9,4 @@ edition = "2018"
[dependencies]
byteorder = "1.4"
fftw = { version = "0.6", default-features = false, features = ["system"] }
mlua = { version = "0.5", features = ["lua53"] }
rand = "0.8"

3
src/animation.rs

@ -16,14 +16,12 @@ type Result<T> = std::result::Result<T, AnimationError>;
#[derive(Debug)]
pub enum AnimationError
{
LuaError(mlua::Error),
ErrorMessage(std::string::String),
}
impl fmt::Display for AnimationError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
AnimationError::LuaError(e) => f.write_fmt(format_args!("=== Lua Error ===\n{}\n=================", e))?,
AnimationError::ErrorMessage(s) => f.write_fmt(format_args!("Message({})", s))?,
};
@ -34,7 +32,6 @@ impl fmt::Display for AnimationError {
impl StdError for AnimationError {
fn description(&self) -> &str {
match *self {
AnimationError::LuaError(_) => "Lua Error",
AnimationError::ErrorMessage(_) => "Error Message",
}
}

26
src/main.rs

@ -7,12 +7,10 @@ use byteorder::{NativeEndian, ReadBytesExt};
mod signal_processing;
mod config;
//mod userscript;
mod udpproto;
mod animation;
use crate::signal_processing::SignalProcessing;
//use crate::userscript::UserScript;
use crate::udpproto::UdpProto;
use crate::animation::Animation;
@ -42,30 +40,6 @@ fn main()
let sigproc = Rc::new(RefCell::new(
SignalProcessing::new(config::BLOCK_LEN, config::SAMP_RATE).unwrap()));
/*
// set up Lua environment
println!("Loading user script...");
let mut script = match UserScript::new(sigproc.clone(), "particles.lua") {
Ok(script) => script,
Err(e) => {
println!("=== Lua Error ===\n{}\n====> Terminating.", e);
exit(1);
}
};
println!("Calling init()...");
match script.init() {
Ok(_) => (),
Err(e) => {
println!("=== Lua Error ===\n{}\n====> Terminating.", e);
exit(1);
}
};
*/
println!("Contructing Animation...");
// TODO: let the user select via the command line

Loading…
Cancel
Save