Skip to content

AlAudioSource

final class AlAudioSource
Implements: IAudioSource
Package: dev.joid.base.openal · Module: base-openal · Source: AlAudioSource.java

A source of OpenAL that streams the samples of a video through a queue of buffers.

Every call does nothing while no OpenAL context is current; when the context changed, the source creates its OpenAL objects again.

ReturnsSignatureSummary
AlAudioSource(AlAudioBridge bridge, int sampleRate, int channels)Creates a source of the bridge for that sample rate and channel count; AlAudioBridge.createSource calls it.

ReturnsSignatureSummary
voiddelete()Stops and deletes the OpenAL source and its buffers when their context is still current, then forgets them.
voidplay()Plays the source.
voidstop()Stops the source and drops its queued buffers, which it keeps for the next writes.
voidpause()Pauses the source.
voidgain(float gain)Sets the gain of the source, 1F for 100 %, before the mapping of the bridge.
voidgroup(Object group)Sets the audio group of the source, or null, and applies its volume.
voidwrite(short[] samples)Mixes the samples down to stereo when they have more than two channels, fills a processed or a new buffer with them and queues it; plays again when the source ran dry while playing.
intgetBufferedSamples()Returns the number of queued samples that OpenAL has not played yet, or 0 without a context.
booleansync()Follows the current context and sends the mapped gain to OpenAL when it changed; returns false when no context is current.
booleanisPlaying()If true, the source was asked to play and was not paused or stopped since.

AlAudioSource(AlAudioBridge bridge, int sampleRate, int channels)

Creates a source of the bridge for that sample rate and channel count; AlAudioBridge.createSource calls it.

void delete()

Stops and deletes the OpenAL source and its buffers when their context is still current, then forgets them.

void play()

Plays the source.

void stop()

Stops the source and drops its queued buffers, which it keeps for the next writes.

void pause()

Pauses the source.

void gain(float gain)

Sets the gain of the source, 1F for 100 %, before the mapping of the bridge.

void group(Object group)

Sets the audio group of the source, or null, and applies its volume.

void write(short[] samples)

Mixes the samples down to stereo when they have more than two channels, fills a processed or a new buffer with them and queues it; plays again when the source ran dry while playing.

int getBufferedSamples()

Returns the number of queued samples that OpenAL has not played yet, or 0 without a context.

boolean sync()

Follows the current context and sends the mapped gain to OpenAL when it changed; returns false when no context is current.

boolean isPlaying()

If true, the source was asked to play and was not paused or stopped since.


fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses

Report a problem with this page