AudioSource

clay.audio.AudioSource (Class)

Instance Members



streamBufferLength: Int

Streams only: The size in bytes of a single stream buffer. This is ~1 sec in 16 bit mono. default:176400 for most cases this can be left alone.


streamBufferCount: Int

Streams only: The number of buffers to queue up. default:2 For most cases this can be left alone.


destroyed: Bool

Whether this source has been destroyed


sourceId: String

A unique key for this source


instance(handle: AudioHandle): AudioInstance

Called by the audio system to obtain a new instance of this source.

Name Type
handle AudioHandle
Returns
AudioInstance

bytesToSeconds(bytes: Int): Float

A helper for converting bytes to seconds for a sound source

Name Type
bytes Int
Returns
Float

secondsToBytes(seconds: Float): Int

A helper for converting seconds to bytes for this audio source

Name Type
seconds Float
Returns
Int

getDuration(): Float
Returns
Float

destroy(): Void

new(app: clay.Clay, data: AudioData): Void
Name Type
app clay.Clay
data AudioData

Private Members

instances: Array<AudioInstance>

Local list of instances spawned from this source. used when destroying the source, to take instances with it.


instanceKilled(instance: AudioInstance): Void
Name Type
instance AudioInstance