import { audioGain } from '@datamoc/mw_games/audio';
audioGain(0, { refDistance: 2 }); // 1 - inside the full-volume radius
audioGain(2, { refDistance: 2 }); // 1 - the reference distance itself
audioGain(4, { refDistance: 2 }); // 0.5 - one doubling away
audioGain(4, { refDistance: 2, maxDistance: 4 }); // 0 - at the edge of hearing
The gain a listener at
distancehears a source at, clamped to [0, 1]: 1 at or insiderefDistance, 0 at or beyondmaxDistance, an inverse-distance curve between them.