Commit 2a1e19d2 authored by Pierre Donat-Bouillud's avatar Pierre Donat-Bouillud
Browse files

Fixing some warnings (cargo fix)

parent d667a217
Pipeline #1028 passed with stage
in 9 minutes and 26 seconds
......@@ -9,12 +9,12 @@ extern crate time;
use crossbeam_channel::unbounded;
use portaudio as pa;
use std::env;
use std::process::exit;
use std::thread;
use std::time as rust_time; //To be used for thread::sleep for instance
use time::{Duration, PreciseTime};
use time::{PreciseTime};
use std::ffi::OsStr;
use std::fs::File;
......
//! Parse a fileformat describing audiographs
use pest::Parser;
use std::collections::HashMap;
use std::error::Error;
use std::fs::File;
use std::io::prelude::*;
use std::path::Path;
......
......@@ -39,7 +39,7 @@ impl fmt::Debug for RandomGenerator {
impl RandomGenerator {
pub fn new(size: usize, p: f64) -> RandomGenerator {
let seed: &[_] = &[1, 21, 37, 4];
let _seed: &[_] = &[1, 21, 37, 4];
//let rng : StdRng = SeedableRng::from_seed(seed);
let rng = thread_rng();
RandomGenerator {
......@@ -117,8 +117,8 @@ impl<T: fmt::Display + AudioEffect + Copy + Hash + Eq> GraphGenerator<T> for Ran
#[cfg(test)]
mod tests {
use super::*;
use effect::*;
use rand::{thread_rng, Rng};
use rand::{Rng};
#[test]
fn test_graph_gen() {
......
......@@ -7,7 +7,7 @@ use audiograph_parser;
use std::fmt;
pub fn Guitar_faustpower2_f(value: f32) -> f32 {
return (value * value);
return value * value;
}
pub struct Guitar {
......@@ -266,89 +266,89 @@ impl Guitar {
pub fn instanceConstants(&mut self, sample_rate: i32) {
self.fSampleRate = sample_rate;
self.fConst0 = f32::min(192000.0, f32::max(1.0, (self.fSampleRate as f32)));
self.fConst1 = (0.00195588241 * self.fConst0);
self.fConst2 = (self.fConst1 + -1.49999499);
self.fConst0 = f32::min(192000.0, f32::max(1.0, self.fSampleRate as f32));
self.fConst1 = 0.00195588241 * self.fConst0;
self.fConst2 = self.fConst1 + -1.49999499;
self.fConst3 = f32::floor(self.fConst2);
self.fConst4 = (self.fConst1 + (-1.0 - self.fConst3));
self.fConst5 = (self.fConst1 + (-2.0 - self.fConst3));
self.fConst6 = (self.fConst1 + (-3.0 - self.fConst3));
self.fConst7 = (self.fConst1 + (-4.0 - self.fConst3));
self.fConst8 = ((((0.0 - self.fConst4) * (0.0 - (0.5 * self.fConst5)))
self.fConst4 = self.fConst1 + (-1.0 - self.fConst3);
self.fConst5 = self.fConst1 + (-2.0 - self.fConst3);
self.fConst6 = self.fConst1 + (-3.0 - self.fConst3);
self.fConst7 = self.fConst1 + (-4.0 - self.fConst3);
self.fConst8 = (((0.0 - self.fConst4) * (0.0 - (0.5 * self.fConst5)))
* (0.0 - (0.333333343 * self.fConst6)))
* (0.0 - (0.25 * self.fConst7)));
self.fConst9 = (0.00882352982 * self.fConst0);
self.iConst10 = (self.fConst2 as i32);
self.iConst11 = (f32::min(self.fConst9, (std::cmp::max(0, self.iConst10) as f32)) as i32);
self.iConst12 = (self.iConst11 + 1);
self.fConst13 = (self.fConst1 - self.fConst3);
self.fConst14 = (((0.0 - self.fConst5) * (0.0 - (0.5 * self.fConst6)))
* (0.0 - (0.333333343 * self.fConst7)));
* (0.0 - (0.25 * self.fConst7));
self.fConst9 = 0.00882352982 * self.fConst0;
self.iConst10 = self.fConst2 as i32;
self.iConst11 = f32::min(self.fConst9, std::cmp::max(0, self.iConst10) as f32) as i32;
self.iConst12 = self.iConst11 + 1;
self.fConst13 = self.fConst1 - self.fConst3;
self.fConst14 = ((0.0 - self.fConst5) * (0.0 - (0.5 * self.fConst6)))
* (0.0 - (0.333333343 * self.fConst7));
self.iConst15 =
(f32::min(self.fConst9, (std::cmp::max(0, (self.iConst10 + 1)) as f32)) as i32);
self.iConst16 = (self.iConst15 + 1);
f32::min(self.fConst9, std::cmp::max(0, self.iConst10 + 1) as f32) as i32;
self.iConst16 = self.iConst15 + 1;
self.fConst17 =
(0.5 * ((self.fConst4 * (0.0 - self.fConst6)) * (0.0 - (0.5 * self.fConst7))));
0.5 * ((self.fConst4 * (0.0 - self.fConst6)) * (0.0 - (0.5 * self.fConst7)));
self.iConst18 =
(f32::min(self.fConst9, (std::cmp::max(0, (self.iConst10 + 2)) as f32)) as i32);
self.iConst19 = (self.iConst18 + 1);
self.fConst20 = (self.fConst4 * self.fConst5);
self.fConst21 = (0.166666672 * (self.fConst20 * (0.0 - self.fConst7)));
f32::min(self.fConst9, std::cmp::max(0, self.iConst10 + 2) as f32) as i32;
self.iConst19 = self.iConst18 + 1;
self.fConst20 = self.fConst4 * self.fConst5;
self.fConst21 = 0.166666672 * (self.fConst20 * (0.0 - self.fConst7));
self.iConst22 =
(f32::min(self.fConst9, (std::cmp::max(0, (self.iConst10 + 3)) as f32)) as i32);
self.iConst23 = (self.iConst22 + 1);
self.fConst24 = (0.0416666679 * (self.fConst20 * self.fConst6));
f32::min(self.fConst9, std::cmp::max(0, self.iConst10 + 3) as f32) as i32;
self.iConst23 = self.iConst22 + 1;
self.fConst24 = 0.0416666679 * (self.fConst20 * self.fConst6);
self.iConst25 =
(f32::min(self.fConst9, (std::cmp::max(0, (self.iConst10 + 4)) as f32)) as i32);
self.iConst26 = (self.iConst25 + 1);
self.fConst27 = (0.000838235312 * self.fConst0);
self.fConst28 = (self.fConst27 + -1.49999499);
f32::min(self.fConst9, std::cmp::max(0, self.iConst10 + 4) as f32) as i32;
self.iConst26 = self.iConst25 + 1;
self.fConst27 = 0.000838235312 * self.fConst0;
self.fConst28 = self.fConst27 + -1.49999499;
self.fConst29 = f32::floor(self.fConst28);
self.fConst30 = (self.fConst27 + (-1.0 - self.fConst29));
self.fConst31 = (self.fConst27 + (-2.0 - self.fConst29));
self.fConst32 = (self.fConst27 + (-3.0 - self.fConst29));
self.fConst33 = (self.fConst27 + (-4.0 - self.fConst29));
self.fConst34 = ((((0.0 - self.fConst30) * (0.0 - (0.5 * self.fConst31)))
self.fConst30 = self.fConst27 + (-1.0 - self.fConst29);
self.fConst31 = self.fConst27 + (-2.0 - self.fConst29);
self.fConst32 = self.fConst27 + (-3.0 - self.fConst29);
self.fConst33 = self.fConst27 + (-4.0 - self.fConst29);
self.fConst34 = (((0.0 - self.fConst30) * (0.0 - (0.5 * self.fConst31)))
* (0.0 - (0.333333343 * self.fConst32)))
* (0.0 - (0.25 * self.fConst33)));
self.iConst35 = (self.fConst28 as i32);
self.iConst36 = (f32::min(self.fConst9, (std::cmp::max(0, self.iConst35) as f32)) as i32);
self.iConst37 = (self.iConst36 + 2);
self.fConst38 = (self.fConst27 - self.fConst29);
self.fConst39 = (((0.0 - self.fConst31) * (0.0 - (0.5 * self.fConst32)))
* (0.0 - (0.333333343 * self.fConst33)));
* (0.0 - (0.25 * self.fConst33));
self.iConst35 = self.fConst28 as i32;
self.iConst36 = f32::min(self.fConst9, std::cmp::max(0, self.iConst35) as f32) as i32;
self.iConst37 = self.iConst36 + 2;
self.fConst38 = self.fConst27 - self.fConst29;
self.fConst39 = ((0.0 - self.fConst31) * (0.0 - (0.5 * self.fConst32)))
* (0.0 - (0.333333343 * self.fConst33));
self.iConst40 =
(f32::min(self.fConst9, (std::cmp::max(0, (self.iConst35 + 1)) as f32)) as i32);
self.iConst41 = (self.iConst40 + 2);
f32::min(self.fConst9, std::cmp::max(0, self.iConst35 + 1) as f32) as i32;
self.iConst41 = self.iConst40 + 2;
self.fConst42 =
(0.5 * ((self.fConst30 * (0.0 - self.fConst32)) * (0.0 - (0.5 * self.fConst33))));
0.5 * ((self.fConst30 * (0.0 - self.fConst32)) * (0.0 - (0.5 * self.fConst33)));
self.iConst43 =
(f32::min(self.fConst9, (std::cmp::max(0, (self.iConst35 + 2)) as f32)) as i32);
self.iConst44 = (self.iConst43 + 2);
self.fConst45 = (self.fConst30 * self.fConst31);
self.fConst46 = (0.166666672 * (self.fConst45 * (0.0 - self.fConst33)));
f32::min(self.fConst9, std::cmp::max(0, self.iConst35 + 2) as f32) as i32;
self.iConst44 = self.iConst43 + 2;
self.fConst45 = self.fConst30 * self.fConst31;
self.fConst46 = 0.166666672 * (self.fConst45 * (0.0 - self.fConst33));
self.iConst47 =
(f32::min(self.fConst9, (std::cmp::max(0, (self.iConst35 + 3)) as f32)) as i32);
self.iConst48 = (self.iConst47 + 2);
self.fConst49 = (0.0416666679 * (self.fConst45 * self.fConst32));
f32::min(self.fConst9, std::cmp::max(0, self.iConst35 + 3) as f32) as i32;
self.iConst48 = self.iConst47 + 2;
self.fConst49 = 0.0416666679 * (self.fConst45 * self.fConst32);
self.iConst50 =
(f32::min(self.fConst9, (std::cmp::max(0, (self.iConst35 + 4)) as f32)) as i32);
self.iConst51 = (self.iConst50 + 2);
self.fConst52 = f32::tan((2670.35376 / self.fConst0));
self.fConst53 = (1.0 / self.fConst52);
self.fConst54 = (((self.fConst53 + 1.41421354) / self.fConst52) + 1.0);
self.fConst55 = (0.800000012 / self.fConst54);
self.fConst56 = (1.0 / self.fConst54);
self.fConst57 = (((self.fConst53 + -1.41421354) / self.fConst52) + 1.0);
self.fConst58 = (2.0 * (1.0 - (1.0 / Guitar_faustpower2_f(self.fConst52))));
self.fConst59 = (0.00355951115 * self.fConst0);
self.fConst60 = (0.00177975558 * self.fConst0);
self.fConst61 = (561.874939 / self.fConst0);
self.iConst62 = (self.iConst36 + 1);
self.iConst63 = (self.iConst40 + 1);
self.iConst64 = (self.iConst43 + 1);
self.iConst65 = (self.iConst47 + 1);
self.iConst66 = (self.iConst50 + 1);
f32::min(self.fConst9, std::cmp::max(0, self.iConst35 + 4) as f32) as i32;
self.iConst51 = self.iConst50 + 2;
self.fConst52 = f32::tan(2670.35376 / self.fConst0);
self.fConst53 = 1.0 / self.fConst52;
self.fConst54 = ((self.fConst53 + 1.41421354) / self.fConst52) + 1.0;
self.fConst55 = 0.800000012 / self.fConst54;
self.fConst56 = 1.0 / self.fConst54;
self.fConst57 = ((self.fConst53 + -1.41421354) / self.fConst52) + 1.0;
self.fConst58 = 2.0 * (1.0 - (1.0 / Guitar_faustpower2_f(self.fConst52)));
self.fConst59 = 0.00355951115 * self.fConst0;
self.fConst60 = 0.00177975558 * self.fConst0;
self.fConst61 = 561.874939 / self.fConst0;
self.iConst62 = self.iConst36 + 1;
self.iConst63 = self.iConst40 + 1;
self.iConst64 = self.iConst43 + 1;
self.iConst65 = self.iConst47 + 1;
self.iConst66 = self.iConst50 + 1;
}
pub fn instanceInit(&mut self, sample_rate: i32) {
......@@ -400,12 +400,12 @@ impl AudioEffect for Guitar {
self.iRec10[0] = 0;
self.iVec0[0] = 1;
let mut iRec11: i32 = self.iRec10[1];
let mut fRec14: f32 = ((self.iRec6[1] as f32)
let mut fRec14: f32 = (self.iRec6[1] as f32)
- (0.997843683
* ((0.699999988 * self.fRec15[2])
+ (0.150000006 * (self.fRec15[1] + self.fRec15[3])))));
+ (0.150000006 * (self.fRec15[1] + self.fRec15[3]))));
self.fVec1[0] = self.fConst0;
self.fRec22[0] = ((self.fConst8
self.fRec22[0] = (self.fConst8
* self.fRec2[((self.IOTA - self.iConst12) & 511) as usize])
+ (self.fConst13
* ((((self.fConst14
......@@ -415,15 +415,15 @@ impl AudioEffect for Guitar {
+ (self.fConst21
* self.fRec2[((self.IOTA - self.iConst23) & 511) as usize]))
+ (self.fConst24
* self.fRec2[((self.IOTA - self.iConst26) & 511) as usize]))));
self.fRec25[0] = ((0.0500000007 * self.fRec25[1]) + (0.949999988 * self.fRec22[1]));
* self.fRec2[((self.IOTA - self.iConst26) & 511) as usize])));
self.fRec25[0] = (0.0500000007 * self.fRec25[1]) + (0.949999988 * self.fRec22[1]);
let mut fRec23: f32 = self.fRec25[0];
self.fRec27[0] = self.fRec0[1];
self.fRec28[(self.IOTA & 255) as usize] = (-1.0
self.fRec28[(self.IOTA & 255) as usize] = -1.0
* (0.997843683
* ((0.699999988 * self.fRec27[2])
+ (0.150000006 * (self.fRec27[1] + self.fRec27[3])))));
self.fVec2[0] = ((self.fConst34
+ (0.150000006 * (self.fRec27[1] + self.fRec27[3]))));
self.fVec2[0] = (self.fConst34
* self.fRec28[((self.IOTA - self.iConst37) & 255) as usize])
+ (self.fConst38
* ((((self.fConst39
......@@ -433,44 +433,44 @@ impl AudioEffect for Guitar {
+ (self.fConst46
* self.fRec28[((self.IOTA - self.iConst48) & 255) as usize]))
+ (self.fConst49
* self.fRec28[((self.IOTA - self.iConst51) & 255) as usize]))));
self.iRec30[0] = ((1103515245 * self.iRec30[1]) + 12345);
self.fRec29[0] = ((4.65661287e-10 * (self.iRec30[0] as f32))
* self.fRec28[((self.IOTA - self.iConst51) & 255) as usize])));
self.iRec30[0] = (1103515245 * self.iRec30[1]) + 12345;
self.fRec29[0] = (4.65661287e-10 * (self.iRec30[0] as f32))
- (self.fConst56
* ((self.fConst57 * self.fRec29[2]) + (self.fConst58 * self.fRec29[1]))));
self.fRec31[0] = if ((((((1 - self.iVec0[1]) > 0) as i32) > 0) as i32) as i32 == 1) {
* ((self.fConst57 * self.fRec29[2]) + (self.fConst58 * self.fRec29[1])));
self.fRec31[0] = if (((((1 - self.iVec0[1]) > 0) as i32) > 0) as i32) as i32 == 1 {
0.0
} else {
f32::min(
self.fConst59,
((self.fRec31[1] + (0.00355951115 * (self.fConst0 - self.fVec1[1]))) + 1.0),
(self.fRec31[1] + (0.00355951115 * (self.fConst0 - self.fVec1[1]))) + 1.0,
)
};
let mut iTemp0: i32 = ((self.fRec31[0] < self.fConst60) as i32);
let mut fTemp1: f32 = (self.fConst55
let mut iTemp0: i32 = (self.fRec31[0] < self.fConst60) as i32;
let mut fTemp1: f32 = self.fConst55
* ((self.fRec29[2] + (self.fRec29[0] + (2.0 * self.fRec29[1])))
* if (iTemp0 as i32 == 1) {
if (((self.fRec31[0] < 0.0) as i32) as i32 == 1) {
* if iTemp0 as i32 == 1 {
if ((self.fRec31[0] < 0.0) as i32) as i32 == 1 {
0.0
} else {
if (iTemp0 as i32 == 1) {
if iTemp0 as i32 == 1 {
(self.fConst61 * self.fRec31[0])
} else {
1.0
}
}
} else {
if (((self.fRec31[0] < self.fConst59) as i32) as i32 == 1) {
if ((self.fRec31[0] < self.fConst59) as i32) as i32 == 1 {
((self.fConst61 * (0.0 - (self.fRec31[0] - self.fConst60))) + 1.0)
} else {
0.0
}
}));
self.fVec3[0] = (self.fVec2[1] + fTemp1);
self.fRec26[(self.IOTA & 511) as usize] = ((0.0500000007
});
self.fVec3[0] = self.fVec2[1] + fTemp1;
self.fRec26[(self.IOTA & 511) as usize] = (0.0500000007
* self.fRec26[((self.IOTA - 1) & 511) as usize])
+ (0.949999988 * self.fVec3[1]));
let mut fRec24: f32 = ((self.fConst8
+ (0.949999988 * self.fVec3[1]);
let mut fRec24: f32 = (self.fConst8
* self.fRec26[((self.IOTA - self.iConst11) & 511) as usize])
+ (self.fConst13
* ((((self.fConst14
......@@ -480,12 +480,12 @@ impl AudioEffect for Guitar {
+ (self.fConst21
* self.fRec26[((self.IOTA - self.iConst22) & 511) as usize]))
+ (self.fConst24
* self.fRec26[((self.IOTA - self.iConst25) & 511) as usize]))));
* self.fRec26[((self.IOTA - self.iConst25) & 511) as usize])));
self.fRec19[0] = fRec23;
let mut fRec20: f32 = (fTemp1 + self.fRec19[1]);
let mut fRec20: f32 = fTemp1 + self.fRec19[1];
let mut fRec21: f32 = fRec24;
self.fRec16[(self.IOTA & 255) as usize] = fRec20;
let mut fRec17: f32 = ((self.fConst34
let mut fRec17: f32 = (self.fConst34
* self.fRec16[((self.IOTA - self.iConst62) & 255) as usize])
+ (self.fConst38
* ((((self.fConst39
......@@ -495,7 +495,7 @@ impl AudioEffect for Guitar {
+ (self.fConst46
* self.fRec16[((self.IOTA - self.iConst65) & 255) as usize]))
+ (self.fConst49
* self.fRec16[((self.IOTA - self.iConst66) & 255) as usize]))));
* self.fRec16[((self.IOTA - self.iConst66) & 255) as usize])));
self.fRec18[0] = fRec21;
self.fRec15[0] = self.fRec18[1];
let mut fRec12: f32 = self.fRec15[1];
......@@ -506,11 +506,11 @@ impl AudioEffect for Guitar {
let mut fRec9: f32 = fRec13;
self.fRec2[(self.IOTA & 511) as usize] = fRec7;
let mut fRec3: f32 = fRec17;
let mut fRec4: f32 = fRec8;
let mut _fRec4: f32 = fRec8;
let mut fRec5: f32 = fRec9;
self.fRec0[0] = fRec3;
let mut fRec1: f32 = fRec5;
output[i as usize] = (fRec1 as f32);
output[i as usize] = fRec1 as f32;
self.iRec10[1] = self.iRec10[0];
self.iVec0[1] = self.iVec0[0];
self.fVec1[1] = self.fVec1[0];
......@@ -519,7 +519,7 @@ impl AudioEffect for Guitar {
for j0 in (0..4).rev() {
self.fRec27[j0 as usize] = self.fRec27[(j0 - 1) as usize];
}
self.IOTA = (self.IOTA + 1);
self.IOTA = self.IOTA + 1;
self.fVec2[1] = self.fVec2[0];
self.iRec30[1] = self.iRec30[0];
self.fRec29[2] = self.fRec29[1];
......
......@@ -97,7 +97,7 @@ impl<T: Clone + Default> RingBuffer<T> {
debug_assert!(self.slots_free() <= self.capacity());
let cnt = cmp::min(data.len(), self.slots_free());
{
let mut buf = self.buf.as_mut_slice();
let buf = self.buf.as_mut_slice();
let buf_len = buf.len();
for idx in 0..cnt {
buf[self.write_pos] = data[idx].clone();
......@@ -119,7 +119,7 @@ impl<T: Clone + Default> RingBuffer<T> {
debug_assert!(self.slots_free() <= self.capacity());
let cnt = cmp::min(count, self.slots_free());
{
let mut buf = self.buf.as_mut_slice();
let buf = self.buf.as_mut_slice();
let buf_len = buf.len();
for _ in 0..cnt {
......
......@@ -268,7 +268,7 @@ impl SmartResampler {
// This number is often less than the size of the provided input buffer (interm_buffer)
// especially if the resampler is a "sync" resampler
let gen_size = frames_gen * nb_channels;
let _gen_size = frames_gen * nb_channels;
let used_size = frames_used * nb_channels;
self.input_ring.skip(used_size as usize).unwrap();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment