Player APIs (BrightScript & Ja...
JavaScript APIs

audioconfig

7min
this object allows for mixing and leveling of audio streams before they are passed to audio outputs audioconfig idl interface audioconfiguration { promise\<audioconfig> getconfig(); promise\<void> applyconfig(audioconfig config); }; interface audioconfig { attribute string modename; \[optional] attribute int srcrate; \[optional] attribute bool pcmonly; \[optional] attribute bool autolevel; }; object creation to create an audioconfig object, load the brightsign/audioconfiguration module using the require() method var audioconfigurationclass = require("@brightsign/audioconfiguration"); var audioconfig = new audioconfigurationclass(); audioconfiguration use this interface to create audioconfig objects getconfig() promise\<audioconfig> getconfig() returns the audio configuration information applyconfig() promise\<void> applyconfig(audioconfig config) configures the audio mode to switch between dynamic and pre routed audioconfig this interface contains the audio configuration parameters for all but the au series 5 product line see the note below for more information about those products modename string string sets the audio routing mode "dynamic" the default mode mixing audio streams with differing sampling rates will cause playback to fail; differing volume levels will not be normalized; and audio streams cannot be added to an output that currently has audio playing on it other parameters in the associative array are ignored however, in the au product line, only a single audio stream can be played to an output at any one time all other parameters in the associative array are ignored "prerouted" add and remove audio streams on an output that currently has audio playing on it; additional audio routing behavior is determined with the srcrate , pcmonly , and autolevel parameters srcrate int int optional optional sets the sample rate to which all pcm audio streams are converted in the the "pre routed" audio mode this value can be either 44100 or 48000 pcmonly bool bool optional optional enables ("true") or disables ("false") compressed audio support in the "pre routed" audio mode autolevel bool bool optional optional enables ("on") or disables ("off") volume leveling for audio outputs in the "pre routed" audio mode when this setting is enabled, all pcm audio streams on a particular output will play at a similar volume these audio configuration parameter definitions are specific to au series 5 products modename string string sets the audio routing mode "dynamic" the default mode only a single audio stream can be played to an output at any one time all other parameters in the associative array are ignored "prerouted" multiple audio streams can be played simultaneously to analog or earc outputs (not usb) audio is always the sample rate converted to the value set in srcrate streams can be started and stopped without affecting other playing streams srcrate int int optional optional sets the sample rate to which all pcm audio streams are converted in the the "pre routed" audio mode this value can be from 32000 to 96000 pcmonly bool bool optional optional this feature is not available on the au series 5 product line autolevel bool bool optional optional this feature is not available on the au series 5 product line example in this example, the code gets the current audio configuration, alters it (though it doesn't check that the values are changing), and writes it back var audioconfigurationclass = require("@brightsign/audioconfiguration"); var audioconfig = new audioconfigurationclass(); var config state = await audioconfig getconfig(); config state mode = "prerouted" config state srcrate = 48000; await audioconfig applyconfig(config state);