Options
All
  • Public
  • Public/Protected
  • All
Menu

Class NgxAudioComponent

The Audio component.

See the ngx3js docs page for details.

Create a ( global ) audio object.

This uses the Web Audio API.

<ngx3-audio
[type]="'audio'"
[url]="'sounds/376737_Skullbeatz___Bad_Cat_Maste.mp3'"
[refDistance]="1" [coneInnerAngle]="180 "
[coneOuterAngle]="230" [cconeOuterGain]="0.1"
></ngx3-audio>
<ngx3js-audio
[type]="'audio'" [url]="'sounds/Project_Utopia.ogg'"
[volume]="0.5" [loop]="true" [autoplay]="true"
></ngx3js-audio>
<ngx3js-audio
[type]="'PositionalAudio'" [url]="'sounds/358232_j_s_song.ogg'"
[refDistance]="20" [autoplay]="true"
></ngx3js-audio>
<ngx3js-audio
[type]="'PositionalAudio'" [urlType]="'listener'" [volume]="0.5 "
[refDistance]="20"
></ngx3js-audio>
Three Type Value String(case insensitive)
THREE.PositionalAudio PositionalAudio, Positional, Position
THREE.Audio Audio

Hierarchy

Implements

  • OnInit

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

Properties

Protected OBJECT3D_ATTR

OBJECT3D_ATTR: string[] = ...

Object3 d attr of abstract object3d component

Protected OBJECT_ATTR

OBJECT_ATTR: string[] = ...

Object attr of abstract subscribe component

Protected _changeList

_changeList: string[] = null

Change list of abstract subscribe component

Protected _needUpdate

_needUpdate: boolean = true

Need update of abstract subscribe component

autoplay

autoplay: boolean = true

Whether to start playback automatically. Default is false.

Protected cachedGeometryList

cachedGeometryList: NgxAbstractGeometryComponent[] = []

Protected cachedLookatList

cachedLookatList: NgxLookatComponent[] = []

Protected cachedMaterialList

cachedMaterialList: NgxAbstractMaterialComponent[] = []

Protected cachedPositionList

cachedPositionList: NgxPositionComponent[] = []

Protected cachedRotationList

cachedRotationList: NgxRotationComponent[] = []

Protected cachedScaleList

cachedScaleList: NgxScaleComponent[] = []

castShadow

castShadow: boolean = null

Whether the object gets rendered into shadow map. Default is false.

coneInnerAngle

coneInnerAngle: number = null

This method can be used in order to transform an omnidirectional sound into a directional sound.

coneOuterAngle

coneOuterAngle: number = null

This method can be used in order to transform an omnidirectional sound into a directional sound.

coneOuterGain

coneOuterGain: number = 1

This method can be used in order to transform an omnidirectional sound into a directional sound.

Protected controllerList

controllerList: QueryList<NgxAbstractControllerComponent>

Content children of abstract object3d component

debug

debug: boolean = false

Debug this Object

distanceModel

distanceModel: string = null

Sets the value of panner.distanceModel.

Notice - case insensitive.

enabled

enabled: boolean = true

Enabled or Not

fftSize

fftSize: number = 128

A non-zero power of two up to 2048, representing the size of the FFT (Fast Fourier Transform) to be used to determine the frequency domain. See this page for details.

frustumCulled

frustumCulled: boolean = null

When this is set, it checks every frame if the object is in the frustum of the camera before rendering the object. If set to false the object gets rendered every frame even if it is not in the frustum of the camera. Default is true.

geometry

geometry: any = null

The geometry of mesh

Protected geometryList

geometryList: QueryList<NgxAbstractGeometryComponent>

Content children of mesh component

Protected id

id: string = ''

The Id of abstract subscribe component

loop

loop: boolean = true

Set source.loop to value (whether playback should loop).

material

The material of mesh

materialIsArray

materialIsArray: boolean = null

The material of mesh is array

Protected materialList

materialList: QueryList<NgxAbstractMaterialComponent>

Content children of abstract object3d component

matrixAutoUpdate

matrixAutoUpdate: boolean = null

When this is set, it calculates the matrix of position, (rotation or quaternion) and scale every frame and also recalculates the matrixWorld property. Default is Object3D.DefaultMatrixAutoUpdate (true).

maxDistance

maxDistance: number = null

Sets the value of panner.maxDistance.

name

name: string = ''

The name of the object (doesn't need to be unique). Default is an empty string.

Protected object3d

object3d: I3JS.Object3D<Event> = null

The Object3d of abstract object3d component

Protected object3dList

object3dList: QueryList<NgxAbstractObject3dComponent>

Content children of abstract object3d component

onDestory

onDestory: EventEmitter<NgxAudioComponent> = ...

Will be called when before destory. The argument will be the loaded self

onLoad

onLoad: EventEmitter<NgxAudioComponent> = ...

Will be called when load completes. The argument will be the loaded self

overrideParams

overrideParams: {} = null

The override params

Type declaration

  • [key: string]: any

Protected parent

parent: any = null

The Parent of abstract subscribe component

Protected parentObject3d

parentObject3d: I3JS.Object3D<Event> = null

Parent object3d of abstract object3d component

play

play: boolean = true

Setup the source to the audioBuffer, and sets sourceType to 'buffer'. If autoplay, also starts playback.

receiveShadow

receiveShadow: boolean = null

Whether the material receives shadows. Default is false.

refDistance

refDistance: number = null

Sets the value of panner.refDistance.

rolloffFactor

rolloffFactor: number = null

Sets the value of panner.rolloffFactor.

Protected selfAny

selfAny: any = ...

Protected subscribeType

subscribeType: string = null

Subscribe type of abstract subscribe component

tween

tween: {} = null

Tween animation params

Type declaration

  • [key: string]: any

type

type: string = 'position'

The type of audio component

Three Type Value String(case insensitive)
THREE.PositionalAudio PositionalAudio, Positional, Position
THREE.Audio Audio

url

url: any = null

The Audio/Video Url

urlType

urlType: string = 'auto'

The Url Type

Notice - case insensitive. audio, video, listener, auto,

userData

userData: any = null

An object that can be used to store custom data about the Object3D. It should not hold references to functions as these will not be cloned.

visible

visible: boolean = true

Object gets rendered if true. Default is true.

volume

volume: number = null

Set the volume.

windowExport

windowExport: string = null

Export this Object to window global variables

Accessors

needUpdate

  • set needUpdate(value: boolean): void
  • Sets need update

    Parameters

    • value: boolean

    Returns void

Methods

addChanges

  • addChanges(key: string | string[] | SimpleChanges): void

addChildObject3d

addDebugLine

  • addDebugLine(objs: I3JS.Object3D<Event>[], lines: string[], prefix: string): string[]

addParentObject3d

addPosition

addRotation

Protected applyChanges

  • applyChanges(changes: string[]): void

applyChanges3d

  • applyChanges3d(changes: string[]): void

Protected callOnLoad

  • callOnLoad(): void

Protected checkChanges

  • checkChanges(changes: SimpleChanges): SimpleChanges

Protected clearChanges

  • clearChanges(): void

Protected consoleLog

  • consoleLog(key: string, object: any, level?: string): void

Protected consoleLogTime

  • consoleLogTime(key: string, object: any, repeat?: number): void

Protected destroyLocalComponent

  • destroyLocalComponent(key: string): void

dispose

  • dispose(): void

getAnalyser

getAudio

  • getAudio<T>(): T

Protected getChanges

  • getChanges(): string[]

getGeometry

getId

  • getId(): string

Protected getMaterialOne

Protected getMaterials

Protected getMaterialsMulti

Protected getName

  • getName(def?: string): string

getNumber

  • getNumber(): () => number

getObject

  • getObject<T>(): T

getObject3d

  • getObject3d<T>(): T

getObjectById

getObjectByName

getObjectByProperty

getObjectTop

getPosition

getRotation

getScale

getSubscribe

  • getSubscribe(): Observable<string[]>

getTagAttributeObject3d

getTexture

Protected getTimeout

  • getTimeout(timeDelay?: number): Promise<void>

getUserData

  • getUserData(): {}

Protected getVisible

  • getVisible(def?: boolean): boolean

Protected initLocalComponent

  • initLocalComponent<T>(key: string, component: T): T

Protected isIdEuals

  • isIdEuals(id: string): boolean

ngAfterContentInit

  • ngAfterContentInit(): void

ngOnChanges

  • ngOnChanges(changes: SimpleChanges): void
  • A callback method that is invoked immediately after the default change detector has checked data-bound properties if at least one has changed, and before the view and content children are checked.

    Parameters

    • changes: SimpleChanges

      The changed properties.

    Returns void

ngOnDestroy

  • ngOnDestroy(): void

ngOnInit

  • ngOnInit(): void
  • A callback method that is invoked immediately after the default change detector has checked the directive's data-bound properties for the first time, and before any of the view or content children have been checked. It is invoked only once when the directive is instantiated.

    Returns void

removeObject3d

resetTween

  • resetTween(): void

runSubscribeNext

  • runSubscribeNext(key: string | string[]): void

setListener

setLookat

Protected setObject

  • setObject(obj: any): void

Protected setObject3d

setParent

setParentObject3d

setPosition

setRotation

setScale

setScaleScalar

setSubscribeNext

  • setSubscribeNext(key: string | string[]): void

setSubscribeType

  • setSubscribeType(subscribeType: string): void

setTween

  • setTween(tweenData: {}): void

setTweenTarget

  • setTweenTarget(tweenTarget: any): void

setUserData

  • setUserData(key: string, value: any): void

setVisible

  • setVisible(visible: boolean, _?: boolean): void

showDebug

Protected subscribeListQuery

  • subscribeListQuery(queryList: QueryList<any>, subscribeKey: string, changeKey: string): void

Protected subscribeListQueryChange

  • subscribeListQueryChange(queryList: QueryList<any>, subscribeKey: string, changeKey: string): void

Protected subscribeRefer

  • subscribeRefer(key: string, subscription: Subscription): void

Protected subscribeReferList

  • subscribeReferList(key: string, subscription: Subscription): void

Protected unSubscribeRefer

  • unSubscribeRefer(key: string): void

Protected unSubscribeReferList

  • unSubscribeReferList(key: string): void

Protected unSubscription

  • unSubscription(subscriptions: Subscription[]): Subscription[]

update

  • update(): void

updateInputParams

  • updateInputParams(params: {}, firstChange?: boolean, changes?: SimpleChanges, type?: string): void

Static loadAudio

  • loadAudio(url: string, onLoad: (audioBuffer: AudioBuffer) => void): void
  • Loads audio

    Parameters

    • url: string
    • onLoad: (audioBuffer: AudioBuffer) => void
        • (audioBuffer: AudioBuffer): void
        • Parameters

          • audioBuffer: AudioBuffer

          Returns void

    Returns void

Generated using TypeDoc