natiny.audio.source_set_volume
natiny.audio.source_set_volume(source, volume)
Sets a source's linear gain before master volume is applied.
Parameters
| Name | Type | Description |
|---|---|---|
source |
number |
Source handle |
volume |
number |
Linear gain; 1.0 is unchanged and 0.0 is silent |
Example
natiny.audio.source_set_volume(source, 0.6)
Notes
- Sources start at volume
1.0. Negative values are clamped to0.0; values above1.0are allowed and can cause clipping. - Distance attenuation multiplies this value for spatial sources.
- Invalid and non-source handles are ignored.