VideoAudioPlayer
final class VideoAudioPlayer
Package: dev.joid.lib.video · Module: core · Source: VideoAudioPlayer.java
Plays the sound of one video through the audio bridge, in step with its frames.
Description
Section titled “Description”Each VideoResourceDecoder creates its own when the video has sound and an audio bridge is registered; you only call audioListenerPosition.
The gain of its source is the volume of the video, times the falloff of the distance to the listener when the video has a location; the audio bridge then applies its own volumes.
Learn more
Section titled “Learn more”Creation
Section titled “Creation”| Returns | Signature | Summary |
|---|---|---|
| VideoAudioPlayer(int channels, int sampleRate, VideoResourceDecoder owner) | Creates the player of owner, for channels channels at sampleRate samples per second. |
Methods
Section titled “Methods”| Returns | Signature | Summary |
|---|---|---|
void | audioListenerPosition(AudioListenerPosition audioListenerPosition) static | Sets where the listener stands for every video placed with a location, such as the camera of your scene; null puts it at (0, 0, 0). |
void | cleanup() | Stops and deletes the audio source and drops the waiting samples. |
void | play() | Creates the audio source on its first call, then starts the sound from the samples to come; without an audio device, it warns once and the video plays silent. |
void | stop() | Stops the sound. |
void | pause() | Pauses the sound. |
void | resume() | Resumes the sound after pause(). |
void | flush() | Drops the waiting samples and stops the source, after a seek. |
void | update(double elapsed) | Sets the volume and the group of the source, then feeds it the samples for elapsed seconds of playback, skipping the samples the picture is ahead of; the decoder calls it on each draw. |
void | pushSamples(Buffer[] samples, int skip) | Queues decoded samples, the first skip frames of samples dropped; the decoding thread calls it. |
boolean | isFull() | If true, the queue of samples is full, so the decoder waits. |
Creation details
Section titled “Creation details”VideoAudioPlayer
Section titled “VideoAudioPlayer”VideoAudioPlayer(int channels, int sampleRate, VideoResourceDecoder owner)
Creates the player of owner, for channels channels at sampleRate samples per second.
Method details
Section titled “Method details”audioListenerPosition
Section titled “audioListenerPosition”void audioListenerPosition(AudioListenerPosition audioListenerPosition) static
Sets where the listener stands for every video placed with a location, such as the camera of your scene; null puts it at (0, 0, 0).
Set it back to null when the screen that set it closes.
cleanup
Section titled “cleanup”void cleanup()
Stops and deletes the audio source and drops the waiting samples.
void play()
Creates the audio source on its first call, then starts the sound from the samples to come; without an audio device, it warns once and the video plays silent.
void stop()
Stops the sound.
void pause()
Pauses the sound.
resume
Section titled “resume”void resume()
Resumes the sound after pause().
void flush()
Drops the waiting samples and stops the source, after a seek.
update
Section titled “update”void update(double elapsed)
Sets the volume and the group of the source, then feeds it the samples for elapsed seconds of playback, skipping the samples the picture is ahead of; the decoder calls it on each draw.
pushSamples
Section titled “pushSamples”void pushSamples(Buffer[] samples, int skip)
Queues decoded samples, the first skip frames of samples dropped; the decoding thread calls it.
isFull
Section titled “isFull”boolean isFull()
If true, the queue of samples is full, so the decoder waits.
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
