Added documentation for Out, FbWr and FbRd.

This commit is contained in:
Weird Constructor 2021-06-08 05:03:45 +02:00
parent 8eed5a0661
commit faf06be4e1
2 changed files with 23 additions and 9 deletions

View file

@ -388,12 +388,13 @@ macro_rules! node_list {
out => Out UIType::Generic UICategory::IOUtil out => Out UIType::Generic UICategory::IOUtil
(0 ch1 n_id d_id r_id f_def stp_d -1.0, 1.0, 0.0) (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) (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 // node_param_idx
// | atom_idx format fun // | atom_idx format fun
// | | name constructor| min max // | | name constructor| min max
// | | | | def|ult_value | / // | | | | 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 fbwr => FbWr UIType::Generic UICategory::IOUtil
(0 inp n_id d_id r_id f_def stp_d -1.0, 1.0, 0.0), (0 inp n_id d_id r_id f_def stp_d -1.0, 1.0, 0.0),
fbrd => FbRd UIType::Generic UICategory::IOUtil fbrd => FbRd UIType::Generic UICategory::IOUtil

View file

@ -3,7 +3,7 @@
// See README.md and COPYING for details. // See README.md and COPYING for details.
use crate::nodes::{NodeAudioContext, NodeExecContext}; 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_export]
macro_rules! fa_out_mono { ($formatter: expr, $v: expr, $denorm_v: expr) => { { 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 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 ch17: &'static str = "Out ch2\nAudio channel 2 (right)\nRange: (-1..1)";
pub const DESC : &'static str = r#""#; pub const DESC : &'static str =
pub const HELP : &'static str = r#""#; "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 { impl DspNode for Out {
@ -70,19 +80,22 @@ impl DspNode for Out {
atoms: &[SAtom], _params: &[ProcBuf], inputs: &[ProcBuf], atoms: &[SAtom], _params: &[ProcBuf], inputs: &[ProcBuf],
_outputs: &mut [ProcBuf], ctx_vals: LedPhaseVals) _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 { if at::Out::mono(atoms).i() > 0 {
for frame in 0..ctx.nframes() { for frame in 0..ctx.nframes() {
ctx.output(0, frame, in1.read(frame)); let gain = denorm::Out::gain(gain, frame);
ctx.output(1, frame, in1.read(frame)); ctx.output(0, frame, gain * in1.read(frame));
ctx.output(1, frame, gain * in1.read(frame));
} }
} else { } else {
let in2 = inp::Out::ch2(inputs); let in2 = inp::Out::ch2(inputs);
for frame in 0..ctx.nframes() { for frame in 0..ctx.nframes() {
ctx.output(0, frame, in1.read(frame)); let gain = denorm::Out::gain(gain, frame);
ctx.output(1, frame, in2.read(frame)); ctx.output(0, frame, gain * in1.read(frame));
ctx.output(1, frame, gain * in2.read(frame));
} }
} }