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
setGlobalPanwith0, so it dispatchesmaster_pan_changedfirst and thenSoundEventsEnum.PAN_RESET('pan_reset') withisMaster: true. - Because it goes through
setGlobalPan, it also removes the 3D panner from every sound that has one. - It resets to
0, not todefaultPanfrom the hub config. - The value it replaced is kept, so
soundHub.setGlobalPan(soundHub.getPreviousMasterPan())undoes the reset. resetPanwithout an id does the same thing.
See also
setGlobalPan: set the master pan.getPreviousMasterPan: the value before the reset.resetPan: centre one sound.