Skip to main content

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, defaultPanSpatialPosition and fetchHeaders are 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 defaultVolume outside 0 to 1 comes back clamped, a negative fade duration comes back as 0, and spatialAudio is false when the browser has no spatial audio support.
  • Some methods write to the configuration, so it can change after construction. setDebugMode changes debug, for example.

See also​