Options
All
  • Public
  • Public/Protected
  • All
V1.7
  • V1.6
  • V1.7
Menu

Class AudioNode

Hierarchy

Index

Methods

Methods

addChild

  • addChild(a_pChild: Node | null): boolean
  • Adds a child to the current Node, removing it from its current parent.

    A child can only have a single Parent

    priv

    none

    Parameters

    • a_pChild: Node | null

      The Node to add as a child to this Node.

    Returns boolean

    true if successful, false if failed

addMoveCallback

  • addMoveCallback(track?: number): void
  • Adds a client-side callback event to the move list. When the event is reached during the animation playback, the ServerEventCallback function set in Client will be called with an event TransformAnimationEventData.

    priv

    none

    Parameters

    • Optional track: number

    Returns void

addResource

  • addResource(resourceID: bigint): boolean
  • AudioNode can have multiple AudioResource(s) associated with it. The first resource is associated when AudioNode is initialized by calling createSoundWithLoadefFile or createSoundWithStreamedFile API. This addResource API may be called to add(associate) more resources. However, it must be called after initializing the AudioNode with the above mentioned createSoundWithXxxx APIs.

    Note that the same resource type must be used when adding additional resources as the one used in createSoundWithXxxx API Example: AudioNode->createSoundWithLoadedFile( loadedFileResourceID_1 ); // Node initialized with "loaded file" type resource. AudioNode->addResource( loadedFileResourceID_2 ); // OK - adding "loaded file" resource AudioNode->addResource( streamedFileResourceID_3 ); // ERROR - adding "streamed file" resource ... Later, when startSound() API is called, it will play any one randomly picked resource sound.

    Some use cases: Example 1: Using just one AudioNode, an alternative to having multiple AudioNodes for different sounds playing from the same position(and orientation) but not at the same time(not overlapped). Just add (associate) multiple resources using this addResource(resID_n) API and call startSound(resID_n) different times with different resource IDs to play. NOTE: Intentionally not adding resource if not already added when startSound(resId_n) is called. This, is to avoid accidentally or easily associating too many resources which, has performance implications.

    Example 2: Randomly playing different sound(from set of already added resources) each time startSound() is called. This can be used to repeated sounds with slight variations for realism like, footsteps, breathing, bullets, etc.. In this case, associate slightly varying audio resources with the same AudioNode and call audioNode->statrtSound() with no arguments. It will play one randomly picked resource each time startSound() is called.

    Parameters

    • resourceID: bigint

      Additional AudioResource ID to be associated with this AudioNode. Calling addResource on same resource again is okay. The resource is added(associated) only the first time.

    Returns boolean

    • true, if successful added or already associated.
          false, if the type of resource is not the same type of resource (LoadedFile
          or StreamedFile) as the one when AudioNode was initialized with the resource using
          createSoundWithXxxx API.

    NOTE: Associating many resources to one AudioNode will result in slight performance penalty. So, only associate multiple resources if necessary(eg. playing random sounds) and do not add resources to AudioNode which will be never used or used only once. If the resource is not going to be used any more, remove the association using removeResource() API.

addToLayer

  • addToLayer(a_layer: bigint): void

createSoundWithLoadedFile

  • createSoundWithLoadedFile(resourceID: bigint, autoDestroy?: boolean, dynamicDecode?: boolean): boolean
  • createSoundWithLoadedFile(resourceIDs: Array<bigint>, autoDestroy?: boolean, dynamicDecode?: boolean): boolean
  • Initializes the AudioNode for using the already loaded resource(keyed on resource ID) Associates audio resource id with AudioNode. Also, sets resource related properties.

    NOTE: Must be called only once to set the AudioNode's behavior in terms of it's sound resource(s).

    Parameters

    • resourceID: bigint

      ID of the audio resource which is already created.

    • Optional autoDestroy: boolean

      default = false
      - If true, play the sound once and delete the node. If false the audio node will stay until scenegraph is destroyed. It is good practice to remove the unused node sooner than later after it's not required.

    • Optional dynamicDecode: boolean

      default = false
      - true = The file resource is compressed and will be decoded when playing. false = The file\resource is an uncompressed PCM data.

    Returns boolean

    bool - Returns true on success else, returns false.

  • An overload of createSoundWithLoadedFile with a vector of resource IDs. See the comments for single resource Id overload. This API will associate all the resource IDs in the vector with the AudioNode.

    NOTE: Must be called only once to set the AudioNode's behavior in terms of it's sound resource(s).

    PERFORMANCE: Associating many resources to one AudioNode will result in slight performance penalty. So, only associate multiple resources if necessary(eg. playing random sounds) and do not add resources to AudioNode which will be never used or used only once. If the resource is not going to be used any more, remove the association using removeResource() API.

    Parameters

    • resourceIDs: Array<bigint>
    • Optional autoDestroy: boolean
    • Optional dynamicDecode: boolean

    Returns boolean

createSoundWithStreamedFile

  • createSoundWithStreamedFile(resourceID: bigint, autoDestroy?: boolean): boolean
  • createSoundWithStreamedFile(resourceIDs: Array<bigint>, autoDestroy?: boolean): boolean
  • Initializes the AudioNode for loading the audio file chunk at a time in memory. Associates audio resource(file) with audio node. Also, sets resource related properties.

    Parameters

    • resourceID: bigint

      resource id of sound resource

    • Optional autoDestroy: boolean

      default = false
      - If true, play the sound once and delete the node. If false the audio node will stay until scenegraph is destroyed. It is good practice to remove the unused node sooner than later after it's not required.

    Returns boolean

    bool - Returns true on success else, returns false.

  • An overload of createSoundWithStreamedFile with a vector of resource IDs. See the comments for single resource Id overload. This API will associate all the resource IDs in the vector with the AudioNode.

    NOTE: Must be called only once to set the AudioNode's behavior in terms of it's sound resource(s).

    PERFORMANCE: Associating many resources to one AudioNode will result in slight performance penalty. So, only associate multiple resources if necessary(eg. playing random sounds) and do not add resources to AudioNode which will be never used or used only once. If the resource is not going to be used any more, remove the association using removeResource() API.

    Parameters

    • resourceIDs: Array<bigint>
    • Optional autoDestroy: boolean

    Returns boolean

createSoundWithSystemEnum

  • createSoundWithSystemEnum(): boolean
  • Sets the AudioNode for playing the predefined system sounds using the AudioSytemSound enums.

    NOTE: Must be called only once to set the AudioNode's behavior in terms of it's sound resource(s).

    1) The node can be the child of some visible node to perceive the sounds direction coming from that visual artifact\model's location. -- OR -- 2) The node may be the child of RootNode and set the audioNode->setLocalPosition(x,y,z) to perceive the sounds direction coming from the arbitrary location specified by x,y,z

    Call audionode->playSystemSound(SystemSoundEnum sysSound); to play the specified system sound from the location specified by #1 or #2 method.

    Returns boolean

createWithSound

  • createWithSound(sound: Sound | null, autoDestroy?: boolean): void
  • Creates the AudioNode using the properties set in Sound object. The Sound object reads it's properties from an XML Sound Model file. XML Sound Model which, contains AudioNode's properties are created for various purposes for example, internally, SystemSoundModel.xml is used to define each system sound's properties.

    NOTE: Must be called only once to set the AudioNode's behavior in terms of it's sound resource(s).

    Parameters

    • sound: Sound | null

      A Sound object to apply it's properties to this AudioNode.

    • Optional autoDestroy: boolean

      default = false
      Default is false and currently ignored.

    Returns void

delayMove

  • delayMove(durationSecs: number, track?: number): void
  • Adds a delay to the current move sequence.

    priv

    none

    Parameters

    • durationSecs: number

      How long to delay, in seconds.

    • Optional track: number

      default = 0
      which animation track to add the delay to.

    Returns void

findChild

  • findChild(name: string): Node | null
  • Find the first named child in the node hierarchy, including this Node.

    Does a breadth-first search of the child node hierarchy for the specified named Node and will return the first encountered match, or nullptr if no named Node found.

    priv

    none

    Parameters

    • name: string

      The name to search for.

    Returns Node | null

findChildren

  • findChildren(a_type: number, a_bExactType?: boolean, a_bIncludeSelf?: boolean): Array<Node | null>
  • Does a breadth-first search of the child node hierarchy for the specified Node type.

    priv

    none

    Parameters

    • a_type: number

      The type of Node to find in the child hierarchy.

    • Optional a_bExactType: boolean

      default = false
      Flag to indicate if the child node must be the exact type or can be derived from the type (default false).

    • Optional a_bIncludeSelf: boolean

      default = false
      Flag to indicate if the search should include this Node (default false).

    Returns Array<Node | null>

    A vector of Node pointers containing the results.

findParent

  • findParent(a_type: number, a_bExactType?: boolean): Node | null
  • Searches up the tree parentage for the specific Node type.

    priv

    none

    Parameters

    • a_type: number

      The type of Node to find in the parent hierarchy.

    • Optional a_bExactType: boolean

      default = false
      Flag to indicate if the parent node must be the exact type or can be derived from the type (default false).

    Returns Node | null

    The parent node, if found, null if not found.

getAABB

  • Get the AABB of this Node's full hierarchy, including all descendants, with all Node transforms applied.

    The returned AABB encompasses this Node and all descendant Nodes and is aligned to the coordinate system the Node resides within, i.e. the Node's parent coordinate system. Note, the returned AABB is not guaranteed to be the minimal, tightest fitting AABB to encompass the Node's descendant hierarchy, but it will fully enlose the Node's hierarchy.

    priv

    none

    Returns AABB

    The bounding box

getAnchorPosition

  • getAnchorPosition(): [number, number, number]

getChild

  • getChild(a_iIndex: number): Node | null

getChildCount

  • getChildCount(): number

getCurrentPrismTransform

  • getCurrentPrismTransform(): [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number]
  • Get the Cached Prism Transform of this Node

    priv

    none

    Returns [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number]

    Transform Matrix

getCurrentWorldTransform

  • getCurrentWorldTransform(): [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number]
  • Get the Cached World Transform of this Node

    priv

    none

    Returns [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number]

    Transform Matrix

getCursorHoverState

getLocalAABB

  • getLocalAABB(): AABB
  • Get the local AABB of this Node only, not including children, aligned to this Node's local coordinate system.

    A local AABB of math::AABB::EMPTY indicates the Node either has no visual information or that local AABB is not supported for the Node.

    Note: The local AABB for ModelNodes is currently not supported and will report math::AABB::EMPTY.

    priv

    none

    Returns AABB

    The bounding box.

getLocalPosition

  • getLocalPosition(): [number, number, number]

getLocalRotation

  • getLocalRotation(): [number, number, number, number]

getLocalScale

  • getLocalScale(): [number, number, number]

getLocalTransform

  • getLocalTransform(): [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number]
  • Get the Local Transform of this Node

    priv

    none

    Returns [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number]

    Transform Matrix

getName

  • getName(): string
  • Get the name of the Node.

    This call returns EMPTY_STRING if the Node's name has not been set.

    priv

    none

    Returns string

    The name of the Node, if set.

getNodeId

  • getNodeId(): bigint

getNumResources

  • getNumResources(): number

getParent

  • getParent(): Node | null

getParentedBoneName

  • getParentedBoneName(): string

getPrismId

  • getPrismId(): bigint

getPrismPosition

  • getPrismPosition(): [number, number, number]

getResources

  • getResources(): Array<bigint>
  • Gets the list of already associated resource IDs

    Returns Array<bigint>

    std::vector of already associated resources.

getRigidBody

getRoot

getSoundPitch

  • getSoundPitch(): number

getSoundState

getSoundVolumeLinear

  • getSoundVolumeLinear(): number

getSpatialSoundDirectSendLevels

  • Gets the direct send levels for one channel of a sound output.

    Multi-channel sounds require the direct send levels to be read individually for each channel by calling this function once for each channel. For mono sounds use channel = 0. For stereo sounds use channel = 0 for left and channel = 1 for right.

    Parameters

    • channel: number

      selects the channel whose direct send levels are being read

    Returns SpatialSoundSendLevels

    • SpatialSoundSendLevels struct to return the levels

getSpatialSoundDirection

  • getSpatialSoundDirection(channel: number): [number, number, number, number]
  • Get sound direction of a given audio channel. Direction is relative to audio node's local orientation.

    Parameters

    • channel: number

      Channel index(zero based).

    Returns [number, number, number, number]

    • A quaternion (glm::quat) which gets populated by direction
              of the sound for the given channel.

getSpatialSoundDistanceProperties

getSpatialSoundEnable

  • getSpatialSoundEnable(): boolean

getSpatialSoundPosition

  • getSpatialSoundPosition(channel: number): [number, number, number]
  • Get position of the given audio channel. Position is relative to audio node's local position.

    Parameters

    • channel: number

      Channel index(zero based).

    Returns [number, number, number]

    • A glm::vec3 which gets populated by the offset
              of channels position.

getSpatialSoundRadiationProperties

getSpatialSoundRoomSendLevels

  • Gets the room send levels for one channel of a sound output.

    Multi-channel sounds require the room send levels to be read individually for each channel by calling this function once for each channel. For mono sounds use channel = 0. For stereo sounds use channel = 0 for left and channel = 1 for right.

    Parameters

    • channel: number

      selects the channel whose room send levels are being read

    Returns SpatialSoundSendLevels

    • SpatialSoundSendLevels struct to return the levels

getStreamedFileOffset

  • getStreamedFileOffset(): number
  • Gets the currently set starting point for playback of a streamed-file sound.

    Returns number

    • Reference to uint32_t to output the current value of offset.

getWorldPosition

  • getWorldPosition(): [number, number, number]

isInLayer

  • isInLayer(a_layer: bigint): boolean
  • Checks to see if node subscribes to the specified node layer.

    priv

    none

    Parameters

    • a_layer: bigint

      The layer to test if this node is a member of.

    Returns boolean

    True if this node subscribes to the specified layer.

isInSubtree

  • isInSubtree(pParent: Node | null): boolean

isSkipRaycast

  • isSkipRaycast(): boolean

isSoundLooping

  • isSoundLooping(): boolean

isSoundMuted

  • isSoundMuted(): boolean
  • Check if sound is muted or not.

    Returns boolean

    • Reference to a bool to output current value.
              true - muted
              false - not muted

isTriggerable

  • isTriggerable(): boolean
  • Returns true if this node should handle trigger presses directly.

    Returns boolean

    true if this node will handle trigger presses directly when focused, false if trigger press will instead enter prism placement mode.

isVisibilityInherited

  • isVisibilityInherited(): boolean

isVisible

  • isVisible(): boolean
  • Returns the visibility state of the node. Note that only the local state is checked, the effect of a parent's visibility is ignored.

    priv

    none

    Returns boolean

    True if the Node is visible.

isVisibleInPrism

  • isVisibleInPrism(): boolean
  • Returns the visibility of the Node in the hierarchy based on self visibility and any potential inherited visibility.

    priv

    none

    Returns boolean

    True if the Node is visible in the Prism.

pauseSound

  • pauseSound(): void

playSystemSound

  • Plays the specified system sound. By nature system sounds are expected to be of small duration like button_click etc... and are of fire-and-forget style, that is, cannot be stopped, paused and such. Usage: dialogBox_1->setLocalPosition(1.2, 0.0. -0.5); dialogBox_2->setLocalPosition(-0.7, 0.0. -0.5); AudioNode* audioNode = prism->createAudioNode(); audioNode->createSoundWithSystenEnum();

    // Upon some event or a particular iteration of update loop. // To play sound from dialogBox_1's location: dialogBox_1->addChild(audioNode); audioNode->playSystemSound(SystemSoundEnum::kClose);

    // Upon some other event or other iteration of update loop. // To play sound from dialogBox_2's location: dialogBox_2->addChild(audioNode); audioNode->playSystemSound(SystemSoundEnum::kClick);

    // Upon yet other event or yet another iteration of update loop: // To play the sound from arbitrary location: rootNode->addChild(audioNode); audioNode->setLocalPosition(x,y,z); audioNode->playSystemSound(SystemSoundEnum::kAlert);

    Parameters

    Returns boolean

    Returns true if successful, else returns false.

releaseOutputStreamBuffer

  • releaseOutputStreamBuffer(): boolean
  • releaseOutputStreamBuffer(streamId: bigint): boolean
  • Lets the audio service know that the buffer is filled and ready.

    Returns boolean

    bool - Returns true on success else false.

  • Lets the audio service know that the buffer is filled and ready.

    Parameters

    • streamId: bigint

      OutputStream's Id whose buffer is being released.

    Returns boolean

    bool - Returns true on success else false.

removeChild

  • removeChild(a_pChild: Node | null): void

removeFromLayer

  • removeFromLayer(a_layer: bigint): void

removeResource

  • removeResource(resourceID: bigint): boolean
  • Removes or disassociates the specified resource from the AudioNode. A valid AudioNode should have at least one resource associated with it. Hence, if the node has only one resource it will not be removed and the method will return false.

    Parameters

    • resourceID: bigint

    Returns boolean

    true, if resource successfully removed. false, if the node had only one resource in which case it cannot be removed. Or if the resource was not associated with the node.

replaceResource

  • replaceResource(newResourceID: bigint, oldResourceID?: bigint): boolean
  • Replaces the specified oldResourceID with the new one, newResourceID. If only one resource associated with the node, then the oldResourceID parameter is optional. In this case that resource will be replaced with the new one.

    Parameters

    • newResourceID: bigint

      The new resource to be associated.

    • Optional oldResourceID: bigint

      default = INVALID_RESOURCE_ID
      The old resource to be disassociated.

      @ return true, if the resource was successfully replaced. false, in the following scenarios: 1) If the specified old resource is not associated with the node. 2) If multiple resources are associated and oldResourceID argument not specified. 3) If this API called before any of the createSoundWithXxxx APIs were called.

    Returns boolean

resumeSound

  • resumeSound(): void

setAnchorPosition

  • setAnchorPosition(a_position: [number, number, number] | Float32Array): void
  • Sets the anchor position of the Node's transform. Rotations, scaling, and translations of the transform will take place around this point. Changing the anchor point will recalculate the transform to the new anchor point.

    priv

    none

    Parameters

    • a_position: [number, number, number] | Float32Array

      Anchor position. This is relative to the default 0,0,0 position of the transform.

    Returns void

setCursorHoverState

setLocalPosition

  • setLocalPosition(aPos: [number, number, number] | Float32Array): void

setLocalRotation

  • setLocalRotation(aRot: [number, number, number, number] | Float32Array): void

setLocalScale

  • setLocalScale(aScale: [number, number, number] | Float32Array): void

setLocalTransform

  • setLocalTransform(aTransform: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number] | Float32Array): void
  • Set the local transform of this Node

    priv

    none

    Parameters

    • aTransform: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number] | Float32Array

      transform matrix

    Returns void

setName

  • setName(a_name: string): boolean
  • Set the name of the Node

    By default a Node has no name.

    priv

    none

    Parameters

    • a_name: string

      The new name of the Node.

    Returns boolean

    true if the name of the Node was successfully set, false otherwise.

setParentedBoneName

  • setParentedBoneName(a_boneName: string): boolean
  • Set the bone in the parent by name that this child will attach to This node must have a parent and the parent must be of type ModelNode.

    priv

    none

    Parameters

    • a_boneName: string

      bone name to attach to

    Returns boolean

    true if successful, false if failed

setSkipRaycast

  • setSkipRaycast(a_skipRaycast: boolean, a_propagateToChildren?: boolean): void
  • Sets the skip raycast state of the node.

    priv

    none

    Parameters

    • a_skipRaycast: boolean

      Raycast skip flag.

    • Optional a_propagateToChildren: boolean

      default = false
      Flag to also set the raycast state of any children

    Returns void

setSoundLooping

  • setSoundLooping(isLooping: boolean): void
  • Sets the mode of playing audio in repeat mode. If enabled, audio will play from start after reaching the end, until disabled. When audio is created, the default is disabled.

    Parameters

    • isLooping: boolean

      true enables loop mode. false disables loop mode.

    Returns void

setSoundMute

  • setSoundMute(isMuted: boolean): void
  • Mute or unmute the sound.

    Parameters

    • isMuted: boolean

      true, mute the sound. false, unmute.

    Returns void

setSoundPitch

  • setSoundPitch(pitch: number): void
  • Sets sound pitch.

    The range of the pitch is 0.5 to 2.0, with 0.5 being one octave down and 2.0 being one octave up (i.e., the pitch is a frequency multiple). A pitch of 1.0 is the default and means no change.

    Parameters

    • pitch: number

      Pitch value to set. Range 0.5 t0 2.0

    Returns void

setSoundProperties

  • setSoundProperties(sound: Sound | null): void
  • Similar to createWithSound with a difference that the sound has already been create using any of the createWithXxxx APIs. This method will set the AudioNodes properties as set in the Sound* parameter.

    NOTE: The stream="false"|"true" and res= properties(from XML from which the Sound object was created) will be ignored because the AudioNode was already initialized using either createSoundWithLoadedfile, createSoundWithStreamedFile or any other createSoundXxxx APIs.

    Parameters

    • sound: Sound | null

      A Sound object to apply it's properties to this AudioNode.

    Returns void

setSoundVolumeLinear

  • setSoundVolumeLinear(volume: number): void
  • Sets the audio volume.

    The range of the volume is 0 to 8, with 0 for silence, 1 for unity gain, and 8 for 8x gain.

    Parameters

    • volume: number

      Range 0.0f to 8.0f

    Returns void

setSpatialSoundDirectSendLevels

  • Sets the direct send levels for one channel of a sound output.

    When 3D audio processing is enabled for a sound output (see setSpatialSoundEnabled) this function sets the send levels for the direct component of the sound, i.e., the audio mix for the the part of the sound not affected by room acoustics. Multi-channel sounds require the direct send levels to be set individually for each channel by calling this function once for each channel. For mono sounds use channel = 0. For stereo sounds use channel = 0 for left and channel = 1 for right.

    Parameters

    • channel: number

      selects the channel whose direct send levels are being set

    • channelSendlevels: SpatialSoundSendLevels

      SpatialSoundSendLevels struct to set the levels

    Returns void

setSpatialSoundDirection

  • setSpatialSoundDirection(channel: number, channelDirection: [number, number, number, number] | Float32Array): void
  • Set the sound direction of a given audio channel. Effective only if spatial sound is enabled (setSpatialSoundEnable) for an audio node. The Direction is relative to this nodes local orientation. By default that is, if this API not called then, the direction is same as the the parent nodes orientation. Will change the direction even if the audio clip is already playing.

    Parameters

    • channel: number

      Channel index(zero based).

    • channelDirection: [number, number, number, number] | Float32Array

      A quaternion (glm::quat) specifying the direction of the sound for the given channel relative to the node's local orientation.

    Returns void

setSpatialSoundDistanceProperties

  • Set spatial sound distance parameters for a given channel.

    Parameters

    • channel: number

      Channel index(zero based).

    • channelProperties: SpatialSoundDistanceProperties

      spatial sound distance parameters, See struct SpatialSoundDistanceProperties

    Returns void

setSpatialSoundEnable

  • setSpatialSoundEnable(isEnabled: boolean): void
  • Enable\Disable the capability for spatial sound. If enabled, setSpatialSoundPosition must be called for positional sound to be effective.

    Parameters

    • isEnabled: boolean

      true, Enable false, Disable

    Returns void

setSpatialSoundPosition

  • setSpatialSoundPosition(channel: number, channelPosition: [number, number, number] | Float32Array): void
  • Set the position of a given audio channel relative to this nodes local position. Effective only if spatial sound is enabled explicitly for an audio node. Will change the position even if the audio clip is already playing.

    Parameters

    • channel: number

      Channel index(zero based).

    • channelPosition: [number, number, number] | Float32Array

      A glm::vec3 specifying the offset of channel position relative to the node's local position.

    Returns void

setSpatialSoundRadiationProperties

setSpatialSoundRoomSendLevels

  • Sets the room send levels for one channel of a sound output.

    When 3D audio processing is enabled for a sound output (see setSpatialSoundEnabled) this function sets the send levels for the room component of the sound, i.e., the audio mix for the the part of the sound that's affected by room acoustics. Multi-channel sounds require the room send levels to be set individually for each channel by calling this function once for each channel. For mono sounds use channel = 0. For stereo sounds use channel = 0 for left and channel = 1 for right.

    Parameters

    • channel: number

      selects the channel whose room send levels are being set

    • channelSendLevels: SpatialSoundSendLevels

      SpatialSoundSendLevels struct to set the levels

    Returns void

setStreamedFileOffset

  • setStreamedFileOffset(offsetMilliSec: number): void
  • Sets the starting point for playback of a streamed-file sound.

    Parameters

    • offsetMilliSec: number

      Value for offset in milliseconds.

    Returns void

setTriggerable

  • setTriggerable(a_triggerable: boolean): void
  • Sets whether this node should handle trigger presses directly.

    priv

    none

    Parameters

    • a_triggerable: boolean

      true if this node should handle trigger presses directly when focused, false if trigger press should instead enter prism placement mode.

    Returns void

setVisibilityInherited

  • setVisibilityInherited(a_inherit: boolean): void
  • Flags that the visibility state of this node should be inherited by its children. This does not change a child's visibility set by setVisible. A visibility of false will take precedence over a visibility of true. The tables below show the draw result for various combinations of node visibility and inheritance.

             visible     inherit     drawn
    node  :   false       true        no
    child :   true          x         no
    
             visible     inherit     drawn
    node  :   false       false       no
    child :   true          x         yes
    
             visible     inherit     drawn
    node  :   true        true        yes
    child :   false         x         no
    
             visible     inherit     drawn
    node  :   true        false       yes
    child :   false         x         no
    priv

    none

    Parameters

    • a_inherit: boolean

      Flag that this node's children should inherit its visibility.

    Returns void

setVisible

  • setVisible(a_visible: boolean, a_propagateToChildren?: boolean): void
  • Sets the visibility state of the node.

    priv

    none

    Parameters

    • a_visible: boolean

      Visibility flag

    • Optional a_propagateToChildren: boolean

      default = false
      Flag to also set the visibility state of any children

    Returns void

startInput

  • startInput(): boolean
  • Starts capture for a sound input. This method must be called before acquiring audio data in the buffer using getInputBuffer().

    Returns boolean

    true if successful. false on any failure.

startSound

  • startSound(): void
  • startSound(resId: bigint): void
  • Plays either the only one resource sound associated with the node or if more than one resources associated, picks any one of them randomly

    • each time startSound() is called - and plays it.

    NOTE: If looping is enabled [setLooping(true)] and multiple resources associated, startSound() will indefinitely play random sequence of all the associated sound resources. If only one resource associated, will indefinitely play that one resource back to back. To stop playing, call stopSound().

    Returns void

  • Plays the sound specified by the audio resource ID. The resource ID must be associated prior to this API call.

    Intentionally not adding resource if not already added\associated with the node to avoid accidentally or easily associating too many resources which, has slight performance implications.

    NOTE: If looping is enabled [setLooping(true)] will indefinitely play the specified resource back to back. To stop playing, call stopSound().

    Parameters

    • resId: bigint

      The resource sound to play.

    Returns void

stopInput

  • stopInput(): boolean

stopSound

  • stopSound(): void

stopTransformAnimations

  • stopTransformAnimations(): void

Static Delete

  • Delete(node: Node | null): void
  • Client-side only: this static function is used to delete a node with its Prism's deleteNode function.

    priv

    none

    Parameters

    • node: Node | null

      is the node to delete

    Returns void

Static ReleaseInputBuffer

  • ReleaseInputBuffer(audioId: bigint): boolean
  • Releases the input audio buffer for reuse.

    After receiving a full buffer from getInputBuffer and reading the audio data from that buffer, call this function to indicate that the buffer has been read and can now be re-used.

    Parameters

    • audioId: bigint

      MLHandle used to identify the sound input

    Returns boolean

    true if successful. false on any failure.

Static playSound

  • playSound(prism: Prism | null, sound: Sound | null): boolean
  • playSound(prism: Prism | null, sound: Sound | null, pos: [number, number, number] | Float32Array): boolean
  • playSound(prism: Prism | null, soundName: string): boolean
  • playSound(prism: Prism | null, soundName: string, pos: [number, number, number] | Float32Array): boolean
  • Fire and forget API. Creates an AudioNode with the properties from the given Sound and sets a callback to destroy the node when it has finished playing.

    Parameters

    • prism: Prism | null

      Prism instance that the created node will belong to.

    • sound: Sound | null

      Sound instance that contains audio properties for the created AudioNode.

    Returns boolean

    True if the audio node was successfully created, added to the scene and set to delete on play end.

  • Fire and forget API. Creates an AudioNode with the properties from the given Sound and sets a callback to destroy the node when it has finished playing.

    Parameters

    • prism: Prism | null

      Prism instance that the created node will belong to.

    • sound: Sound | null

      Sound instance that contains audio properties for the created AudioNode.

    • pos: [number, number, number] | Float32Array

      Position to set to the created AudioNode.

    Returns boolean

    True if the audio node was successfully created, added to the scene and set to delete on play end.

  • Fire and forget API. Creates an AudioNode with the properties from the given Sound and sets a callback to destroy the node when it has finished playing.

    Parameters

    • prism: Prism | null

      Prism instance that the created node will belong to.

    • soundName: string

      name of a Sound instance that contains audio properties for the created AudioNode.

    Returns boolean

    True if the audio node was successfully created, added to the scene and set to delete on play end.

  • Fire and forget API. Creates an AudioNode with the properties from the given Sound and sets a callback to destroy the node when it has finished playing.

    Parameters

    • prism: Prism | null

      Prism instance that the created node will belong to.

    • soundName: string

      name of a Sound instance that contains audio properties for the created AudioNode.

    • pos: [number, number, number] | Float32Array

      Position to set to the created AudioNode.

    Returns boolean

    True if the audio node was successfully created, added to the scene and set to delete on play end.

Generated using TypeDoc