Skip to content

Config API ​

Methods for persistent configuration storage, audio output devices, DSP presets, advanced preferences, and playback behaviors.

config ​

config.export ​

Read the whole store both as a map and as one JSON text.

This method takes no parameters.

Returns

FieldTypeDescription
dataRecord<string, any>Every stored key with its value; the map config.getAll reports.
jsonstringdata serialized as one compact JSON text.
countintegerNumber of keys in the store.

success is true on success. On failure the response is { success: false, error, code }; see Error codes for code.

js
const result = await fb2k.invoke('config.export');

config.get ​

Read the value stored under a key. A key that is not there is not an error: found is false and value is default, or null when no default was given.

ParameterTypeRequiredDescription
keystringYesKey to read. Must not be empty.
defaultanyNoValue to answer with when the key is absent.

Returns

FieldTypeDescription
keystringThe key asked for.
valueanyThe stored value; when the key is absent, default if it was given, otherwise null.
foundbooleanWhether the key is in the store.

success is true on success. On failure the response is { success: false, error, code }; see Error codes for code.

js
const res = await fb2k.invoke('config.get', { key: 'theme' });
if (res.success === false) throw new Error(res.error);
const { value, found } = res;

config.getActiveDspPreset ​

Report which DSP preset is selected. index and name are null and isActive is false when none is selected or presets are unavailable.

This method takes no parameters.

Returns

FieldTypeDescription
indexinteger | nullPosition of the selected preset; null when none is selected.
namestring | nullName of the selected preset; null when none is selected.
isActivebooleanWhether a preset is selected.

success is true on success. On failure the response is { success: false, error, code }; see Error codes for code.

js
const result = await fb2k.invoke('config.getActiveDspPreset');

config.getAdvancedConfig ​

List foobar2000's Advanced preferences as a tree, from the root or from below parentGuid.

ParameterTypeRequiredDescription
parentGuidstringNoGUID of the branch to list, rendered as {...}; the root of the tree when omitted or empty. A well-formed GUID that names no branch lists nothing.

Returns

FieldTypeDescription
entriesAdvancedConfigItem[]Entries directly below the requested branch; each branch carries its own entries in children.
entries[].namestringDisplay name.
entries[].guidstringEntry GUID rendered as {...}, as config.getAdvancedConfigValue, config.setAdvancedConfigValue and config.resetAdvancedConfig take it.
entries[].sortPrioritynumberSort priority the entry reports.
entries[].type"branch" | "checkbox" | "radio" | "integer" | "string" | "unknown"Kind of an Advanced preferences entry: branch holds other entries, checkbox and radio hold a boolean, integer and string hold text, unknown is any other kind.
entries[].valueanyCurrent value: a boolean on checkbox and radio; the stored text on integer and string, so an integer entry reads as its decimal text here while config.getAdvancedConfigValue reports a number; absent on branch and unknown.
entries[].defaultValueanyDefault value in the same form as value; present only when the entry reports one.
entries[].isSignedbooleanWhether the entry is flagged as a signed integer; present on integer and string.
entries[].isFilePathbooleanWhether the entry is flagged as holding a file path; present on integer and string.
entries[].isFolderPathbooleanWhether the entry is flagged as holding a folder path; present on integer and string.
entries[].childrenAdvancedConfigItem[]The entries inside a branch; present on branch only. The tree stops eleven levels below the requested parent: a branch on that level is listed with an empty children.
countintegerNumber of entries in entries; nested entries are not counted.

success is true on success. On failure the response is { success: false, error, code }; see Error codes for code.

js
const entries = await fb2k.invoke('config.getAdvancedConfig');

config.getAdvancedConfigValue ​

Read one Advanced preferences entry by GUID. An integer entry's value comes back as a number here, while config.getAdvancedConfig lists it as its decimal text.

ParameterTypeRequiredDescription
guidstringYesEntry GUID rendered as {...}. Must not be empty.

Returns

FieldTypeDescription
namestringDisplay name of the entry.
guidstringThe GUID as it was sent; its letter case is not normalized.
type"branch" | "checkbox" | "radio" | "integer" | "string" | "unknown"Kind of an Advanced preferences entry: branch holds other entries, checkbox and radio hold a boolean, integer and string hold text, unknown is any other kind.
valueanyCurrent value: a boolean on checkbox and radio, a number on integer (0 when the stored text does not start with a number), a string on string, null on branch and unknown.

success is true on success. On failure the response is { success: false, error, code }; see Error codes for code.

js
const entry = await fb2k.invoke('config.getAdvancedConfigValue', { guid: '{some-guid}' });

config.getAll ​

Read the whole store: every key with its value.

This method takes no parameters.

Returns

FieldTypeDescription
itemsRecord<string, any>Every stored key with its value.
configsRecord<string, any>The same map as items, under its older name.
countintegerNumber of keys in the store.

success is true on success. On failure the response is { success: false, error, code }; see Error codes for code.

js
const result = await fb2k.invoke('config.getAll');

config.getComponents ​

List the installed components with their versions.

This method takes no parameters.

Returns

FieldTypeDescription
componentsConfigComponentInfo[]Every installed component, in enumeration order.
components[].namestringName the component reports.
components[].versionstringVersion string the component reports.
components[].filenamestringFile name the component reports for its module; absent when it reports none.
components[].fileNamestringThe same as filename.
countintegerNumber of entries in components.

success is true on success. On failure the response is { success: false, error, code }; see Error codes for code.

js
const result = await fb2k.invoke('config.getComponents');

config.getCursorFollowPlayback ​

Report foobar2000's "cursor follows playback" setting.

This method takes no parameters.

Returns

FieldTypeDescription
enabledbooleanWhether the setting is on.
valuebooleanThe same as enabled.

success is true on success. On failure the response is { success: false, error, code }; see Error codes for code.

js
const result = await fb2k.invoke('config.getCursorFollowPlayback');

config.getDspPresets ​

List the DSP presets stored in the profile. A host without DSP preset support reports an empty list.

This method takes no parameters.

Returns

FieldTypeDescription
presetsConfigDspPreset[]Every stored preset, in list order.
presets[].indexintegerPosition in the preset list, as config.setActiveDspPreset takes it.
presets[].namestringPreset name.
countintegerNumber of entries in presets.

success is true on success. On failure the response is { success: false, error, code }; see Error codes for code.

js
const result = await fb2k.invoke('config.getDspPresets');

config.getLibraryFilePatterns ​

Report where foobar2000 puts newly encoded, copied or moved tracks and album images. A pattern that is not configured is absent, so with neither configured the response is { success: true } alone.

This method takes no parameters.

Returns

FieldTypeDescription
tracksConfigLibraryFilePatternPattern for newly encoded, copied or moved tracks; absent when not configured.
tracks.directorystringTarget folder as configured.
tracks.formatstringTitle formatting pattern for the subfolders and the file name below that folder.
imagesConfigLibraryFilePatternPattern for newly encoded, copied or moved album images; absent when not configured.
images.directorystringTarget folder as configured.
images.formatstringTitle formatting pattern for the subfolders and the file name below that folder.

success is true on success. On failure the response is { success: false, error, code }; see Error codes for code.

js
const result = await fb2k.invoke('config.getLibraryFilePatterns');

config.getLibraryStatus ​

Report whether the media library is enabled and loaded, and how many items it holds. The count walks the whole library on every call.

This method takes no parameters.

Returns

FieldTypeDescription
enabledbooleanWhether the media library is enabled, which foobar2000 takes to mean that at least one library folder is configured.
itemCountintegerNumber of items in the media library, counted on every call.
initializedbooleanWhether the media library has finished loading; true on a host that cannot tell.

success is true on success. On failure the response is { success: false, error, code }; see Error codes for code.

js
const result = await fb2k.invoke('config.getLibraryStatus');

config.getOutputConfig ​

Report the output settings in effect: module, device, buffer length, bit depth, dithering and fades.

This method takes no parameters.

Returns

FieldTypeDescription
outputIdstringGUID of the output module in effect, rendered as {...}.
deviceIdstringGUID of the device in effect, rendered as {...}.
bufferLengthnumberOutput buffer length in seconds.
bitDepthintegerOutput bit depth setting, in bits.
useDitherbooleanWhether dithering is on.
useFadesbooleanWhether fades are on.
outputNamestringDisplay name of the output module; absent when no installed module has that GUID.
deviceNamestringDisplay name of the device; absent when the module does not name it.

success is true on success. On failure the response is { success: false, error, code }; see Error codes for code.

js
const result = await fb2k.invoke('config.getOutputConfig');

config.getOutputDevices ​

List the devices of every output module and flag the one in effect. These are the devices output.getDevices lists, in a flat shape that pairs each with the GUID of its module.

This method takes no parameters.

Returns

FieldTypeDescription
devicesConfigOutputDevice[]Devices of all output modules.
devices[].namestringDisplay name: the full name the output manager reports, or <module>: <device> when the device list comes from the output modules themselves.
devices[].idstringThe same as deviceId.
devices[].outputIdstringGUID of the output module, rendered as {...}.
devices[].deviceIdstringDevice GUID rendered as {...}. Not unique on its own: a module reports its default device with the all-zero GUID, so key devices by (outputId, deviceId).
devices[].isCurrentbooleanWhether this module and device are the ones in effect, as config.getOutputConfig reports them.
countintegerNumber of entries in devices.

success is true on success. On failure the response is { success: false, error, code }; see Error codes for code.

js
const result = await fb2k.invoke('config.getOutputDevices');

config.getPlaybackFollowCursor ​

Report foobar2000's "playback follows cursor" setting.

This method takes no parameters.

Returns

FieldTypeDescription
enabledbooleanWhether the setting is on.
valuebooleanThe same as enabled.

success is true on success. On failure the response is { success: false, error, code }; see Error codes for code.

js
const result = await fb2k.invoke('config.getPlaybackFollowCursor');

config.getPreferencesPages ​

List every registered preferences page and preferences branch: the pages first, then the branches.

This method takes no parameters.

Returns

FieldTypeDescription
pagesConfigPreferencesPage[]Every page, then every branch.
pages[].namestringDisplay name.
pages[].guidstringGUID of the page or branch, rendered as {...}.
pages[].parentGuidstringGUID of the page or branch it sits under, rendered as {...}; a standard parent from config.getPreferencesStandardGuids for a top-level page.
pages[].sortPrioritynumberSort priority it reports: lower sorts first and 0 sorts by name; 0 as well when it reports none.
pages[].isBranchbooleantrue on a branch; absent on a page.
countintegerNumber of entries in pages.

success is true on success. On failure the response is { success: false, error, code }; see Error codes for code.

js
const result = await fb2k.invoke('config.getPreferencesPages');

config.getPreferencesStandardGuids ​

Report the GUIDs of foobar2000's standard preferences parents, which registered pages and branches name as their parent.

This method takes no parameters.

Returns

FieldTypeDescription
rootstringpreferences_page::guid_root, rendered as {...}: the root of the preferences tree.
hiddenstringpreferences_page::guid_hidden, rendered as {...}.
toolsstringpreferences_page::guid_tools, rendered as {...}.
corestringpreferences_page::guid_core, rendered as {...}.
displaystringpreferences_page::guid_display, rendered as {...}.
playbackstringpreferences_page::guid_playback, rendered as {...}.
visualisationsstringpreferences_page::guid_visualisations, rendered as {...}.
inputstringpreferences_page::guid_input, rendered as {...}.
tagWritingstringpreferences_page::guid_tag_writing, rendered as {...}.
mediaLibrarystringpreferences_page::guid_media_library, rendered as {...}.
taggingstringpreferences_page::guid_tagging, rendered as {...}.
outputstringpreferences_page::guid_output, rendered as {...}.
advancedstringpreferences_page::guid_advanced, rendered as {...}.
componentsstringpreferences_page::guid_components, rendered as {...}.
dspstringpreferences_page::guid_dsp, rendered as {...}.
shellstringpreferences_page::guid_shell, rendered as {...}.
keyboardShortcutsstringpreferences_page::guid_keyboard_shortcuts, rendered as {...}.

success is true on success. On failure the response is { success: false, error, code }; see Error codes for code.

js
const result = await fb2k.invoke('config.getPreferencesStandardGuids');

config.getReplaygainMode ​

Report the ReplayGain source mode as a number. replaygain.getMode reports the same setting by name.

This method takes no parameters.

Returns

FieldTypeDescription
modeintegerSource mode: 0 none, 1 track, 2 album, 3 by playback order.
valueintegerThe same as mode.

success is true on success. On failure the response is { success: false, error, code }; see Error codes for code.

js
const result = await fb2k.invoke('config.getReplaygainMode');

config.getVersionInfo ​

Report the foobar2000 version, this component's version and the profile folder.

This method takes no parameters.

Returns

FieldTypeDescription
versionstringfoobar2000's version string as the core reports it; it includes the product name.
foobar2000stringThe same as version.
versionFullstringWhat core_version_info_v2::get_name() reports, which the foobar2000 SDK documents as the product name foobar2000; despite the key, not a longer form of version.
is64bitbooleanWhether this is a 64-bit build.
isPortablebooleanWhether foobar2000 runs as a portable installation.
pluginobjectThis component.
plugin.namestringAlways foo_ui_webview2.
plugin.versionstringThis component's version, major.minor.patch.
profilePathstringThe profile folder as a display path.

success is true on success. On failure the response is { success: false, error, code }; see Error codes for code.

js
const result = await fb2k.invoke('config.getVersionInfo');

config.remove ​

Delete a key from the store. Deleting a key that is not there succeeds with existed: false.

ParameterTypeRequiredDescription
keystringYesKey to delete. Must not be empty.

Returns

FieldTypeDescription
keystringThe key asked for.
existedbooleanWhether the key was in the store before the call.

success is true on success. On failure the response is { success: false, error, code }; see Error codes for code.

js
await fb2k.invoke('config.remove', { key: 'theme' });

config.resetAdvancedConfig ​

Return one Advanced preferences entry to its default value.

ParameterTypeRequiredDescription
guidstringYesEntry GUID rendered as {...}. Must not be empty.

Returns

success is true on success. On failure the response is { success: false, error, code }; see Error codes for code.

js
await fb2k.invoke('config.resetAdvancedConfig', { guid: '{some-guid}' });

config.set ​

Store a value under a key in this component's own key-value store, replacing any value the key held. The store is kept in foobar2000's configuration store, so it survives a restart. Fails with OPERATION_FAILED when the store cannot be read or the value cannot be saved.

ParameterTypeRequiredDescription
keystringYesKey to store under. Every page of this component shares one store, so give your keys a prefix of your own. Must not be empty.
valueanyYesValue to store, any JSON value. A top-level null counts as missing and is refused, so clear a key with config.remove; a null inside an object or an array is kept.

Returns

FieldTypeDescription
keystringThe key written.

success is true on success. On failure the response is { success: false, error, code }; see Error codes for code.

js
await fb2k.invoke('config.set', { key: 'theme', value: { mode: 'dark' } });

config.setActiveDspPreset ​

Select a DSP preset by index, which replaces the whole active DSP chain with the preset's; the same operation as dsp.applyPreset by index. Nothing selects "no preset" again.

ParameterTypeRequiredDescription
indexintegerYesPosition of the preset in config.getDspPresets. At least 0.

Returns

success is true on success. On failure the response is { success: false, error, code }; see Error codes for code.

js
await fb2k.invoke('config.setActiveDspPreset', { index: 0 });

config.setAdvancedConfigValue ​

Write one Advanced preferences entry. The value has to suit the entry: a boolean for a checkbox or radio entry; a string or a number for an integer or string entry, where a number is stored as its decimal text (an integer entry drops the fraction, a string entry keeps six decimals). A branch or an entry of another kind cannot be written.

ParameterTypeRequiredDescription
guidstringYesEntry GUID rendered as {...}. Must not be empty.
valueanyYesValue to write; what each kind of entry accepts is in the method description.

Returns

success is true on success. On failure the response is { success: false, error, code }; see Error codes for code.

js
await fb2k.invoke('config.setAdvancedConfigValue', { guid: '{some-guid}', value: true });

config.setCursorFollowPlayback ​

Turn foobar2000's "cursor follows playback" setting on or off.

ParameterTypeRequiredDescription
enabledbooleanYestrue turns the setting on, false turns it off.

Returns

FieldTypeDescription
enabledbooleanThe value written.

success is true on success. On failure the response is { success: false, error, code }; see Error codes for code.

js
await fb2k.invoke('config.setCursorFollowPlayback', { enabled: true });

config.setOutputBuffer ​

Set the output buffer length, in seconds (bufferLength) or in milliseconds (milliseconds). One of the two is required; milliseconds wins when both are given, and bufferLength is range-checked even then.

ParameterTypeRequiredDescription
bufferLengthnumberNoBuffer length in seconds. Ignored when milliseconds is given, but range-checked all the same. Between 0.05 and 2 inclusive.
millisecondsnumberNoBuffer length in milliseconds; takes precedence over bufferLength. Between 50 and 2000 inclusive.

Returns

success is true on success. On failure the response is { success: false, error, code }; see Error codes for code.

js
// milliseconds is converted to seconds; the effective range is 0.05-2.0 seconds
await fb2k.invoke('config.setOutputBuffer', { milliseconds: 1000 });

config.setOutputDevice ​

Switch output to a device of an output module; take both GUIDs from config.getOutputDevices.

ParameterTypeRequiredDescription
outputIdstringYesGUID of the output module, as config.getOutputDevices reports it in outputId. Must not be empty.
deviceIdstringYesGUID of the device, as config.getOutputDevices reports it in deviceId. Must not be empty.

Returns

success is true on success. On failure the response is { success: false, error, code }; see Error codes for code.

js
await fb2k.invoke('config.setOutputDevice', { outputId: '{output-guid}', deviceId: '{device-guid}' });

config.setPlaybackFollowCursor ​

Turn foobar2000's "playback follows cursor" setting on or off.

ParameterTypeRequiredDescription
enabledbooleanYestrue turns the setting on, false turns it off.

Returns

FieldTypeDescription
enabledbooleanThe value written.

success is true on success. On failure the response is { success: false, error, code }; see Error codes for code.

js
await fb2k.invoke('config.setPlaybackFollowCursor', { enabled: true });

config.setReplaygainMode ​

Set the ReplayGain source mode by number (mode) or by name (sourceMode). One of the two is required; mode wins when both are given. replaygain.setMode changes the same setting by name.

ParameterTypeRequiredDescription
modeintegerNoSource mode by number, as config.getReplaygainMode reports it; takes precedence over sourceMode. Between 0 and 3 inclusive.
sourceMode"none" | "track" | "album" | "byPlaybackOrder" | "auto"NoSource mode by name: none is 0, track 1, album 2, and byPlaybackOrder or its other spelling auto is 3. Read only when mode is absent.

Returns

FieldTypeDescription
modeintegerThe source mode now in effect, as a number.
valueintegerThe same as mode.

success is true on success. On failure the response is { success: false, error, code }; see Error codes for code.

js
await fb2k.invoke('config.setReplaygainMode', { sourceMode: 'album' });

config.showLibraryPreferences ​

Open foobar2000's Media Library preferences page.

This method takes no parameters.

Returns

success is true on success. On failure the response is { success: false, error, code }; see Error codes for code.

js
const result = await fb2k.invoke('config.showLibraryPreferences');

Storage and preference semantics ​

config.set, config.get, config.remove, config.getAll, and config.export operate on the component's persistent configuration store. config.get requires key; when the key is absent it returns found: false and uses the optional default value when supplied. config.set requires both key and value, accepting any JSON-serializable value.

Output and advanced preference methods interact directly with foobar2000 services. Specifically, config.setOutputDevice requires valid outputId and deviceId GUIDs, while config.setOutputBuffer accepts either seconds in bufferLength or milliseconds in milliseconds. Advanced preference entries require a valid guid; the expected value type depends on the entry's underlying preference type rather than a single unified schema.

Cursor-follow and ReplayGain setters accept documented compatibility parameters. For ReplayGain, mode and value are numeric, while sourceMode accepts track, album, auto, byPlaybackOrder, or none. The handler returns INVALID_PARAMS for an unknown string sourceMode.