2021-05-18 03:11:19 +00:00
|
|
|
// Copyright (c) 2021 Weird Constructor <weirdconstructor@gmail.com>
|
|
|
|
// This is a part of HexoDSP. Released under (A)GPLv3 or any later.
|
|
|
|
// See README.md and COPYING for details.
|
|
|
|
|
2021-06-02 01:59:21 +00:00
|
|
|
use crate::nodes::{NodeAudioContext, NodeExecContext};
|
2021-06-03 03:10:29 +00:00
|
|
|
use crate::dsp::{NodeId, SAtom, ProcBuf, GraphFun, GraphAtomData, DspNode, LedPhaseVals};
|
2021-05-18 03:11:19 +00:00
|
|
|
|
|
|
|
/// A simple amplifier
|
|
|
|
#[derive(Debug, Clone)]
|
|
|
|
pub struct Test {
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Test {
|
2021-06-03 03:10:29 +00:00
|
|
|
pub fn new(_nid: &NodeId) -> Self {
|
2021-05-18 03:11:19 +00:00
|
|
|
Self {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pub const f : &'static str = "F Test";
|
|
|
|
pub const s : &'static str = "S Test";
|
|
|
|
// pub const gain : &'static str =
|
|
|
|
// "Amp gain\nGain input\nRange: (0..1)\n";
|
|
|
|
// pub const sig : &'static str =
|
|
|
|
// "Amp sig\nAmplified signal output\nRange: (-1..1)\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
impl DspNode for Test {
|
|
|
|
fn outputs() -> usize { 1 }
|
|
|
|
|
|
|
|
fn set_sample_rate(&mut self, _srate: f32) { }
|
|
|
|
fn reset(&mut self) { }
|
|
|
|
|
|
|
|
#[inline]
|
|
|
|
fn process<T: NodeAudioContext>(
|
2021-06-02 01:59:21 +00:00
|
|
|
&mut self, _ctx: &mut T, _ectx: &mut NodeExecContext,
|
|
|
|
_atoms: &[SAtom], _params: &[ProcBuf], _inputs: &[ProcBuf],
|
|
|
|
_outputs: &mut [ProcBuf], _led: LedPhaseVals)
|
2021-05-18 03:11:19 +00:00
|
|
|
{
|
|
|
|
// use crate::dsp::out;
|
|
|
|
// use crate::dsp::inp;
|
|
|
|
// use crate::dsp::denorm;
|
|
|
|
//
|
|
|
|
// let gain = inp::Test::gain(inputs);
|
|
|
|
// let inp = inp::Test::inp(inputs);
|
|
|
|
// let out = out::Test::sig(outputs);
|
|
|
|
// for frame in 0..ctx.nframes() {
|
|
|
|
// out.write(frame, inp.read(frame) * denorm::Test::gain(gain, frame));
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
|
|
|
|
fn graph_fun() -> Option<GraphFun> {
|
|
|
|
Some(Box::new(|_gd: &dyn GraphAtomData, _init: bool, x: f32| -> f32 {
|
|
|
|
x
|
|
|
|
}))
|
|
|
|
}
|
|
|
|
}
|