diff --git a/src/dsp/mod.rs b/src/dsp/mod.rs index cf7d936..83c28ce 100644 --- a/src/dsp/mod.rs +++ b/src/dsp/mod.rs @@ -388,12 +388,13 @@ macro_rules! node_list { out => Out UIType::Generic UICategory::IOUtil (0 ch1 n_id d_id r_id f_def stp_d -1.0, 1.0, 0.0) (1 ch2 n_id d_id r_id f_def stp_d -1.0, 1.0, 0.0) + (2 gain n_gain d_gain r_id f_def stp_d 0.0, 1.0, 1.0) // node_param_idx // | atom_idx format fun // | | name constructor| min max // | | | | def|ult_value | / // | | | | | | | | - {2 0 mono setting(0) fa_out_mono 0 1}, + {3 0 mono setting(0) fa_out_mono 0 1}, fbwr => FbWr UIType::Generic UICategory::IOUtil (0 inp n_id d_id r_id f_def stp_d -1.0, 1.0, 0.0), fbrd => FbRd UIType::Generic UICategory::IOUtil diff --git a/src/dsp/node_out.rs b/src/dsp/node_out.rs index 30438e2..10814a6 100644 --- a/src/dsp/node_out.rs +++ b/src/dsp/node_out.rs @@ -3,7 +3,7 @@ // See README.md and COPYING for details. use crate::nodes::{NodeAudioContext, NodeExecContext}; -use crate::dsp::{NodeId, SAtom, ProcBuf, inp, at, DspNode, LedPhaseVals}; +use crate::dsp::{NodeId, SAtom, ProcBuf, inp, at, denorm, DspNode, LedPhaseVals}; #[macro_export] macro_rules! fa_out_mono { ($formatter: expr, $v: expr, $denorm_v: expr) => { { @@ -54,8 +54,18 @@ impl Out { pub const ch16: &'static str = "Out ch2\nAudio channel 2 (right)\nRange: (-1..1)"; pub const ch17: &'static str = "Out ch2\nAudio channel 2 (right)\nRange: (-1..1)"; - pub const DESC : &'static str = r#""#; - pub const HELP : &'static str = r#""#; + pub const DESC : &'static str = + "Audio Output Port\n\n\ + This output port node allows you to send audio signals \ + to audio devices or tracks in your DAW."; + pub const HELP : &'static str = +r#"Audio Output Port + +This output port node allows you to send audio signals to audio devices +or tracks in your DAW. If you need a stereo output but only have a mono +signal you can use the 'mono' setting to duplicate the signal on the 'ch1' +input to the second channel 'ch2'. +"#; } impl DspNode for Out { @@ -70,19 +80,22 @@ impl DspNode for Out { atoms: &[SAtom], _params: &[ProcBuf], inputs: &[ProcBuf], _outputs: &mut [ProcBuf], ctx_vals: LedPhaseVals) { - let in1 = inp::Out::ch1(inputs); + let in1 = inp::Out::ch1(inputs); + let gain = inp::Out::gain(inputs); if at::Out::mono(atoms).i() > 0 { for frame in 0..ctx.nframes() { - ctx.output(0, frame, in1.read(frame)); - ctx.output(1, frame, in1.read(frame)); + let gain = denorm::Out::gain(gain, frame); + ctx.output(0, frame, gain * in1.read(frame)); + ctx.output(1, frame, gain * in1.read(frame)); } } else { let in2 = inp::Out::ch2(inputs); for frame in 0..ctx.nframes() { - ctx.output(0, frame, in1.read(frame)); - ctx.output(1, frame, in2.read(frame)); + let gain = denorm::Out::gain(gain, frame); + ctx.output(0, frame, gain * in1.read(frame)); + ctx.output(1, frame, gain * in2.read(frame)); } }