getConfig
Get the configuration the hub is running with. It holds every option from SoundHubConfig, with your constructor values merged over the defaults.
getConfig(): Readonly<SoundHubConfig>;
Parameters
This method takes no parameters.
Returns
Readonly<SoundHubConfig>: a copy of the current configuration.
Example
import { SoundHub } from 'soundhub';
const soundHub = new SoundHub({ defaultVolume: 0.8 });
const config = soundHub.getConfig();
config.defaultVolume; // 0.8, your value
config.maxParallelLoads; // 10, the default
config.masterLimiter; // false, the default
Good to know
- The copy is shallow. Top-level values are safe to change, but nested objects such as
pannerNodeConfig,defaultPanSpatialPositionandfetchHeadersare the hub's own. Treat the result as read-only, as the type says. - It shows what the hub made of your options, not only what you passed. A
defaultVolumeoutside 0 to 1 comes back clamped, a negative fade duration comes back as0, andspatialAudioisfalsewhen the browser has no spatial audio support. - Some methods write to the configuration, so it can change after construction.
setDebugModechangesdebug, for example.
See also
SoundHubConfig: every option and its default.setDebugMode: switch console logging on or off.getVersion: the library version you are running.