Gain
Its input times `gain`; the wires into `input` sum.
input
out
- Type name
audio:Gain- Plane
audio- Tags
transform- Language
rust- Tier
native- Bundle
audio- Source
node-bundles/audio/Gain.rs- Availability
- available
Slots
| Slot | Direction | Type | |
|---|---|---|---|
input | input | AUDIO | accepts several cables |
out | output | AUDIO |
Parameters
gain
| Name | Type | Default | Range | Doc |
|---|---|---|---|---|
gain | float | 1 | 0 … 10 | what every sample is multiplied by; 1 leaves the signal as it is |
Source
The current source of this node, as it stands in the goofi repository at node-bundles/audio/Gain.rs.
use goofi_audio_sdk::goofi_core::SlotType;
use goofi_audio_sdk::{AudioNode, Block, Manifest, OutputDecl, ParamDecl, ParamSpec, SlotDecl, Tag, BLOCK};
goofi_audio_sdk::params! {
GAIN = ParamDecl {
group: "gain",
name: "gain",
spec: ParamSpec::Float { default: 1.0, min: 0.0, max: 10.0 },
expression: None,
doc: Some("what every sample is multiplied by; 1 leaves the signal as it is"),
},
}
static INS: &[SlotDecl] =
&[SlotDecl { name: "input", kind: SlotType::Audio, trigger_process: false, multi: true, required: false }];
static OUTS: &[OutputDecl] = &[OutputDecl { name: "out", kind: SlotType::Audio }];
static MANIFEST: Manifest = Manifest {
tags: &[Tag::Transform],
doc: "Its input times `gain`; the wires into `input` sum.",
inputs: INS,
outputs: OUTS,
params: PARAMS,
};
#[derive(Default)]
struct Gain;
impl AudioNode for Gain {
fn prepare(&mut self, _rate: f64) {}
fn process(&mut self, b: &mut Block<'_>) {
let input = &b.ins[0];
let gain = &b.params[P::GAIN];
let out = &mut b.outs[0];
for c in 0..out.channels() as usize {
let x = input.chan(c);
let g = gain.chan(c);
let y = out.chan_mut(c);
for i in 0..BLOCK {
y[i] = x[i] * g[i];
}
}
}
}
goofi_audio_sdk::export!(Gain, MANIFEST);This reference describes goofi 3.1.0(537cd394), generated from a running instance on 2026-09-06.