cleanupGlobalPan
Remove the master 3D panner that setMasterSpatialPosition put into the output chain. Despite the name, it does not touch the stereo pan set by setGlobalPan.
cleanupGlobalPan(): void;
Parameters
This method takes no parameters.
Returns
Nothing.
Example
import { SoundHub } from 'soundhub';
const soundHub = new SoundHub();
await soundHub.loadSound('music', '/audio/theme.mp3');
soundHub.play('music', { loop: true });
// Place the whole mix to the right of the listener
soundHub.setMasterSpatialPosition(5, 0, 0);
// Later: back to a plain stereo mix
soundHub.cleanupGlobalPan();
Good to know
- Does nothing when there is no master panner.
- The master chain is rebuilt as master gain, then the master stereo panner, then the limiter when it is on. The value from
setGlobalPankeeps working. - Since 6.3.2, rebuilding the chain no longer disconnects nodes your app connected to
getMasterOutput, such as anAnalyserNodefor a meter. - No event is dispatched, and the stored master position and orientation are left as they were.
getMasterSpatialPositionstill returns the last position. UseresetMasterSpatialPositionif you want the position put back to0, 0, 0as well.
See also
resetMasterSpatialPosition: remove the master panner and reset its position, with an event.setMasterSpatialPosition: add the master panner.resetGlobalPan: centre the master stereo pan.