Foundry Virtual Tabletop - API Documentation - Version 14
    Preparing search index...

    Class AudioBufferCache

    A specialized cache used for audio buffers. This is an LRU cache which expires buffers from the cache once the maximum cache size is exceeded.

    Hierarchy

    • Map
      • AudioBufferCache
    Index

    Constructors

    Accessors

    Methods

    Constructors

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

      Parameters

      • OptionalcacheSize: number = ...

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

      Returns AudioBufferCache

    Accessors

    • get usage(): {
          current: number;
          currentString: string;
          max: number;
          maxString: string;
          pct: number;
          pctString: string;
      }

      A string representation of the current cache utilization.

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

    Methods

    • Delete an entry from the cache.

      Parameters

      • src: string

        The audio buffer source path

      Returns boolean

      Was the buffer deleted from the cache?

    • Retrieve an AudioBuffer from the cache.

      Parameters

      • src: string

        The audio buffer source path

      Returns AudioBuffer

      The cached audio buffer, or undefined

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

      Parameters

      • src: string

        The audio buffer source path

      • Optionallocked: boolean = true

        Lock the buffer, preventing its expiration?

      Returns void

    • Insert an AudioBuffer into the buffers cache.

      Parameters

      • src: string

        The audio buffer source path

      • buffer: AudioBuffer

        The audio buffer to insert

      Returns AudioBufferCache

    • Returns string