Lens Scripting API

    Class FileLicensedSoundProvider

    A file track provider of the Licensed Sounds from Asset LIbrary.

    //@input Asset.AudioTrackAsset audioTrack

    var control = script.audioTrack.control;
    var sampleRate = control.sampleRate;
    var audioBuffer = new Float32Array(control.maxFrameSize);
    control.loops = -1;


    script.createEvent("UpdateEvent").bind(function (eventData) {
    var readSize = eventData.getDeltaTime() * sampleRate;
    control.getAudioBuffer(audioBuffer, readSize);
    });

    Hierarchy (View Summary, Expand)

    Index

    Constructors

    Properties

    duration: number

    The duration of the AudioTrackAsset in seconds.

    loops: number

    Loop count, if -1 is provided, the audio track will loop forever.

    maxFrameSize: number

    The maximum frame size of the audio track asset.

    sampleRate: number

    Sample rate (samples per second) of the audio track asset.

    Methods

    • Writes readSize samples into the passed in audioBuffer Float32Array.

      Parameters

      • audioBuffer: Float32Array
      • readSize: number

      Returns vec3

    • Writes current audio frame to the passed in Float32Array and returns the frame shape.

      Parameters

      • audioFrame: Float32Array

      Returns vec3

    • Returns true if the object matches or derives from the passed in type.

      Parameters

      • type: string

      Returns boolean

    MMNEPVFCICPMFPCPTTAAATR