Skip to main content

resetGlobalPan

Set the master stereo pan back to the centre (0).

resetGlobalPan(): 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.setGlobalPan(0.6);
soundHub.resetGlobalPan();
console.log(soundHub.getGlobalPan()); // 0

Good to know​

  • It calls setGlobalPan with 0, so it dispatches master_pan_changed first and then SoundEventsEnum.PAN_RESET ('pan_reset') with isMaster: true.
  • Because it goes through setGlobalPan, it also removes the 3D panner from every sound that has one.
  • It resets to 0, not to defaultPan from the hub config.
  • The value it replaced is kept, so soundHub.setGlobalPan(soundHub.getPreviousMasterPan()) undoes the reset.
  • resetPan without an id does the same thing.

See also​