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.
Description
Section titled “Description”Every call does nothing while no OpenAL context is current; when the context changed, the source creates its OpenAL objects again.
Learn more
Section titled “Learn more”Creation
Section titled “Creation”| Returns | Signature | Summary |
|---|---|---|
| AlAudioSource(AlAudioBridge bridge, int sampleRate, int channels) | Creates a source of the bridge for that sample rate and channel count; AlAudioBridge.createSource calls it. |
Methods
Section titled “Methods”| Returns | Signature | Summary |
|---|---|---|
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. |
Creation details
Section titled “Creation details”AlAudioSource
Section titled “AlAudioSource”AlAudioSource(AlAudioBridge bridge, int sampleRate, int channels)
Creates a source of the bridge for that sample rate and channel count; AlAudioBridge.createSource calls it.
Method details
Section titled “Method details”delete
Section titled “delete”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.
getBufferedSamples
Section titled “getBufferedSamples”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.
isPlaying
Section titled “isPlaying”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
