resetMasterSpatialPosition
Undo setMasterSpatialPosition. The master position goes back to 0, 0, 0 and the master panner is removed from the output chain.
resetMasterSpatialPosition(): 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 });
soundHub.setMasterSpatialPosition(6, 0, -3);
// Back to a plain mix
soundHub.resetMasterSpatialPosition();
soundHub.getMasterSpatialPosition(); // { x: 0, y: 0, z: 0 }
Good to know
- Only acts when a master panner exists. Without one, the stored position is left alone, which matters after
cleanupGlobalPan: that removes the panner but keeps the old position. - The master chain is rebuilt with the master stereo panner in place, so
setGlobalPankeeps working. Since 6.3.2 this no longer disconnects nodes your app connected togetMasterOutput. - The master orientation is not reset.
getMasterSpatialOrientationkeeps returning the last direction, while a panner made later bysetMasterSpatialPositionstarts pointing along positive x. - Always dispatches
SoundEventsEnum.GLOBAL_SPATIAL_POSITION_CHANGED('global_spatial_position_changed') withposition, even when there was no panner to remove.
See also
setMasterSpatialPosition: position the whole mix.cleanupGlobalPan: remove the master panner without resetting or an event.resetSpatialPosition: reset one sound, or set the master to0, 0, 0and keep the panner.