Skip to main content

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 setGlobalPan keeps working.
  • Since 6.3.2, rebuilding the chain no longer disconnects nodes your app connected to getMasterOutput, such as an AnalyserNode for a meter.
  • No event is dispatched, and the stored master position and orientation are left as they were. getMasterSpatialPosition still returns the last position. Use resetMasterSpatialPosition if you want the position put back to 0, 0, 0 as well.

See also​