Hierarchy

  • Map
    • AudioBufferCache

Constructors

  • Construct an AudioBufferCache providing a maximum disk size beyond which entries are expired.

    Parameters

    • Optional cacheSize: number = ...

      The maximum cache size in bytes. 1GB by default.

    Returns AudioBufferCache

Properties

#maxSize: number

The maximum cache size in bytes.

#memorySize: number = 0

The current memory utilization in bytes.

The head of the doubly-linked list.

The tail of the doubly-linked list

Accessors

  • get usage(): {
        current: number;
        max: number;
        pct: number;
        currentString: string;
        maxString: string;
        pctString: string;
    }
  • A string representation of the current cache utilization.

    Returns {
        current: number;
        max: number;
        pct: number;
        currentString: string;
        maxString: string;
        pctString: string;
    }

    • current: number
    • max: number
    • pct: number
    • currentString: string
    • maxString: string
    • pctString: string

Methods

  • Retrieve an AudioBuffer from the cache.

    Parameters

    • src: string

      The audio buffer source path

    Returns AudioBuffer

    The cached audio buffer, or undefined

  • Insert an AudioBuffer into the buffers cache.

    Parameters

    • src: string

      The audio buffer source path

    • buffer: AudioBuffer

      The audio buffer to insert

    Returns AudioBufferCache

  • Delete an entry from the cache.

    Parameters

    • src: string

      The audio buffer source path

    Returns boolean

    Was the buffer deleted from the cache?

  • Lock a buffer, preventing it from being expired even if it is least-recently-used.

    Parameters

    • src: string

      The audio buffer source path

    • Optional locked: boolean = true

      Lock the buffer, preventing its expiration?

    Returns void

  • Returns string

  • Insert a new node into the cache, updating the linked list and cache size.

    Parameters

    Returns void

  • Remove a node from the cache, updating the linked list and cache size.

    Parameters

    Returns void

  • Shift an accessed node to the head of the linked list.

    Parameters

    Returns void

  • Recursively expire entries from the cache in least-recently used order. Skip expiration of any entries which are locked.

    Parameters

    • Optional node: AudioBufferCacheEntry

      A node from which to start expiring. Otherwise, starts from the tail.

    Returns void