Skip to content

Commit

Permalink
Rust: cleanup import and test architecture files
Browse files Browse the repository at this point in the history
  • Loading branch information
crop2000 committed Dec 1, 2024
1 parent 9a4dd16 commit 8fd319c
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 32 deletions.
2 changes: 0 additions & 2 deletions compiler/generator/rust/rust_code_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,6 @@ void RustCodeContainer::produceClass()
tab(n, *fOut);
*fOut << "pub type FaustFloat = " << ifloat() << ";";

tab(n, *fOut);
*fOut << "use std::convert::TryInto;";
tab(n, *fOut);
*fOut << "use std::borrow;";

Expand Down
9 changes: 3 additions & 6 deletions tests/impulse-tests/archs/rust/architecture_cm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,9 @@ extern crate libm;
extern crate num_traits;
/* extern crate fastfloat; */

use std::env;
use std::fs::File;
use std::io::Write;

use default_boxed::DefaultBoxed;
use num_traits::{cast::FromPrimitive, float::Float};
use std::{env, fs::File, io::Write};

type F32 = f32;
type F64 = f64;
Expand Down Expand Up @@ -180,10 +177,10 @@ impl<T: Float + FromPrimitive> UI<T> for ButtonUI {
}

// // Generated intrinsics:
// <<includeIntrinsic>>
<<includeIntrinsic>>

// // Generated class:
// <<includeclass>>
<<includeclass>>

const SAMPLE_RATE: i32 = 44100;

Expand Down
4 changes: 2 additions & 2 deletions tests/impulse-tests/archs/rust/architecture_ecrnt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,10 @@ impl<T: Float + FromPrimitive> UI<T> for ButtonUI {
fn declare(&mut self, param: Option<ParamIndex>, key: &str, value: &str) {}
}

// Generated intrinsics:
// // Generated intrinsics:
<<includeIntrinsic>>

// Generated class:
// // Generated class:
<<includeclass>>

const SAMPLE_RATE: i32 = 44100;
Expand Down
14 changes: 6 additions & 8 deletions tests/impulse-tests/archs/rust/architecture_inpl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,9 @@ extern crate libm;
extern crate num_traits;
/* extern crate fastfloat; */

use std::env;
use std::fs::File;
use std::io::Write;

use default_boxed::DefaultBoxed;
use num_traits::{cast::FromPrimitive, float::Float};
use std::{env, fs::File, io::Write};

type F32 = f32;
type F64 = f64;
Expand Down Expand Up @@ -152,10 +149,10 @@ impl<T: Float + FromPrimitive> UI<T> for ButtonUI {
fn declare(&mut self, param: Option<ParamIndex>, key: &str, value: &str) {}
}

// Generated intrinsics:
// // Generated intrinsics:
<<includeIntrinsic>>

// Generated class:
// // Generated class:
<<includeclass>>

const SAMPLE_RATE: i32 = 44100;
Expand All @@ -181,7 +178,8 @@ fn run_dsp(

// Prepare buffers
//let mut in_buffer = vec![vec![0 as FaustFloat; buffer_size]; FAUST_INPUTS];
let mut buffers = vec![vec![0 as FaustFloat; buffer_size]; std::cmp::max(FAUST_INPUTS, FAUST_OUTPUTS)];
let mut buffers =
vec![vec![0 as FaustFloat; buffer_size]; std::cmp::max(FAUST_INPUTS, FAUST_OUTPUTS)];

// Prepare UI
let mut ui = ButtonUI {
Expand All @@ -197,7 +195,7 @@ fn run_dsp(

// handle inputs
for buffer in buffers.iter_mut() {
for (i,sample) in buffer.iter_mut().enumerate() {
for (i, sample) in buffer.iter_mut().enumerate() {
let first_frame = num_samples_written == 0 && i == 0;
*sample = if first_frame { 1.0 } else { 0.0 };
}
Expand Down
5 changes: 1 addition & 4 deletions tests/impulse-tests/archs/rust/architecture_osecrnt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,9 @@ extern crate libm;
extern crate num_traits;
/* extern crate fastfloat; */

use std::env;
use std::fs::File;
use std::io::Write;

use default_boxed::DefaultBoxed;
use num_traits::{cast::FromPrimitive, float::Float};
use std::{convert::TryInto, env, fs::File, io::Write};

type F32 = f32;
type F64 = f64;
Expand Down
5 changes: 1 addition & 4 deletions tests/impulse-tests/archs/rust/architecture_osrnt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,9 @@ extern crate libm;
extern crate num_traits;
/* extern crate fastfloat; */

use std::env;
use std::fs::File;
use std::io::Write;

use default_boxed::DefaultBoxed;
use num_traits::{cast::FromPrimitive, float::Float};
use std::{convert::TryInto, env, fs::File, io::Write};

type F32 = f32;
type F64 = f64;
Expand Down
9 changes: 3 additions & 6 deletions tests/impulse-tests/archs/rust/architecture_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,8 @@ extern crate libm;
extern crate num_traits;
/* extern crate fastfloat; */

use std::env;
use std::fs::File;
use std::io::Write;

use num_traits::{cast::FromPrimitive, float::Float};
use std::{env, fs::File, io::Write};

type F32 = f32;
type F64 = f64;
Expand Down Expand Up @@ -178,10 +175,10 @@ impl<T: Float + FromPrimitive> UI<T> for ButtonUI {
fn declare(&mut self, param: Option<ParamIndex>, key: &str, value: &str) {}
}

// Generated intrinsics:
// // Generated intrinsics:
<<includeIntrinsic>>

// Generated class:
// // Generated class:
<<includeclass>>

const SAMPLE_RATE: i32 = 44100;
Expand Down

0 comments on commit 8fd319c

Please sign in to comment.