Home Reference Source Repository
import {ServerDataBase} from 'binaural/src/sofa/ServerDataBase.js'
public class | source

ServerDataBase

SOFA remote data-base.

Constructor Summary

Public Constructor
public

constructor(options: Object)

This is only a constructor, it does not load any thing.

Method Summary

Public Methods
public

getDataSetDefinitions(sourceUrl: String): Promise.<Object | String>

Get the data-set definitions of a given URL.

public

getSourcePositions(sourceUrl: String): Promise<Array<Array.<Number>> | Error>

Get all source positions of a given URL.

public

getUrls(options: Object): Array<String>

Get URLs, possibly filtered.

public

loadCatalogue(sourceUrl: String, destination: Object): Promise.<String | Error>

Asynchronously load complete catalogue from the server, including the catalogue links found in any partial catalogue.

Public Constructors

public constructor(options: Object) source

This is only a constructor, it does not load any thing.

Params:

NameTypeAttributeDescription
options Object
  • optional
options.serverUrl String
  • optional

base URL of server, including protocol, eg. 'http://bili2.ircam.fr'. Default protocol is https: if window.location.protocol is also https:, or http:, to avoid mixed contents (that are often blocked).

See:

Public Methods

public getDataSetDefinitions(sourceUrl: String): Promise.<Object | String> source

Get the data-set definitions of a given URL.

Params:

NameTypeAttributeDescription
sourceUrl String

is the complete SOFA URL, with the server, like 'http://bili2.ircam.fr/SimpleFreeFieldHRIR/BILI/COMPENSATED/44100/IRC_1100_C_HRIR.sofa'

Return:

Promise.<Object | String>

The promise will resolve after successfully loading, with definitions as * {definition: {key: values}} objects; the promise will reject is the transfer fails, with an error.

public getSourcePositions(sourceUrl: String): Promise<Array<Array.<Number>> | Error> source

Get all source positions of a given URL.

Params:

NameTypeAttributeDescription
sourceUrl String

is the complete SOFA URL, with the server, like 'http://bili2.ircam.fr/SimpleFreeFieldHRIR/BILI/COMPENSATED/44100/IRC_1100_C_HRIR.sofa'

Return:

Promise<Array<Array.<Number>> | Error>

The promise will resolve after successfully loading, with an array of positions (which are arrays of 3 numbers); the promise will reject is the transfer fails, with an error.

public getUrls(options: Object): Array<String> source

Get URLs, possibly filtered.

Any filter can be partial, and is case-insensitive. The result must match every supplied filter. Undefined filters are not applied. For any filter, | is the or operator.

Params:

NameTypeAttributeDescription
options Object
  • optional

optional filters

options.convention String
  • optional

'HRIR' or 'SOS'

options.dataBase String
  • optional

'LISTEN', 'BILI', etc.

options.equalisation String
  • optional

'RAW','COMPENSATED'

options.sampleRate String
  • optional

in Hertz

options.sosOrder String
  • optional

'12order' or '24order'

options.freePattern String
  • optional

any pattern matched globally. Use separators (spaces, tabs, etc.) to combine multiple patterns: '44100 listen' will restrict on URLs matching '44100' and 'listen'; '44100|48000 bili|listen' matches ('44100' or '48000') and ('bili' or 'listen').

Return:

Array<String>

URLs that match every filter.

public loadCatalogue(sourceUrl: String, destination: Object): Promise.<String | Error> source

Asynchronously load complete catalogue from the server, including the catalogue links found in any partial catalogue.

Params:

NameTypeAttributeDescription
sourceUrl String
  • optional

URL of the root catalogue, including the server, like 'http://bili2.ircam.fr/catalog.xml'. Default is 'catalog.xml' at serverURL supplied at ServerDataBase#constructor.

destination Object
  • optional

Catalogue to update. Default is internal.

Return:

Promise.<String | Error>

The promise will resolve (with sourceUrl) when every sub-catalogue will successfully load, or will reject (with an error) as soon as one transfer fails.