Package com.mojang.blaze3d.audio
Class Channel
java.lang.Object
com.mojang.blaze3d.audio.Channel
Represents an OpenAL audio channel.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
private final AtomicBoolean
private static final org.slf4j.Logger
private static final int
private final int
private AudioStream
private int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
attachBufferStream
(AudioStream pStream) Attaches a buffer stream to the audio channel.void
attachStaticBuffer
(SoundBuffer pBuffer) Attaches a static buffer to the audio channel.private static int
calculateBufferSize
(AudioFormat pFormat, int pSampleAmount) Calculates the buffer size for an audio stream.(package private) static Channel
create()
void
destroy()
void
private int
getState()
void
linearAttenuation
(float pLinearAttenuation) Sets linear attenuation for the audio channel.void
pause()
void
play()
boolean
playing()
private void
pumpBuffers
(int pReadCount) Reads and queues audio buffers from the stream.private int
void
setLooping
(boolean pLooping) Sets whether the audio channel should loop.void
setPitch
(float pPitch) Sets the pitch of the audio channel.void
setRelative
(boolean pRelative) Sets whether the audio channel should be relative to the listener's position.void
setSelfPosition
(Vec3 pSource) Sets the position of the audio channel.void
setVolume
(float pVolume) Sets the volume of the audio channel.void
stop()
boolean
stopped()
void
unpause()
void
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
QUEUED_BUFFER_COUNT
private static final int QUEUED_BUFFER_COUNT- See Also:
-
BUFFER_DURATION_SECONDS
public static final int BUFFER_DURATION_SECONDS- See Also:
-
source
private final int source -
initialized
-
streamingBufferSize
private int streamingBufferSize -
stream
-
-
Constructor Details
-
Channel
private Channel(int pSource)
-
-
Method Details
-
create
-
destroy
public void destroy() -
play
public void play() -
getState
private int getState() -
pause
public void pause() -
unpause
public void unpause() -
stop
public void stop() -
playing
public boolean playing() -
stopped
public boolean stopped() -
setSelfPosition
Sets the position of the audio channel.- Parameters:
pSource
- the position of the audio channel
-
setPitch
public void setPitch(float pPitch) Sets the pitch of the audio channel.- Parameters:
pPitch
- the pitch of the audio channel
-
setLooping
public void setLooping(boolean pLooping) Sets whether the audio channel should loop.- Parameters:
pLooping
-true
if the audio channel should loop,false
otherwise
-
setVolume
public void setVolume(float pVolume) Sets the volume of the audio channel.- Parameters:
pVolume
- the volume of the audio channel
-
disableAttenuation
public void disableAttenuation() -
linearAttenuation
public void linearAttenuation(float pLinearAttenuation) Sets linear attenuation for the audio channel.- Parameters:
pLinearAttenuation
- the linear attenuation of the audio channel
-
setRelative
public void setRelative(boolean pRelative) Sets whether the audio channel should be relative to the listener's position.- Parameters:
pRelative
-true
if the audio channel should be relative,false
otherwise
-
attachStaticBuffer
Attaches a static buffer to the audio channel.- Parameters:
pBuffer
- the buffer to attach
-
attachBufferStream
Attaches a buffer stream to the audio channel.- Parameters:
pStream
- the stream to attach
-
calculateBufferSize
Calculates the buffer size for an audio stream.- Parameters:
pFormat
- the audio format of the streampSampleAmount
- the number of samples to buffer- Returns:
- the buffer size
-
pumpBuffers
private void pumpBuffers(int pReadCount) Reads and queues audio buffers from the stream.- Parameters:
pReadCount
- the number of buffers to read and queue
-
updateStream
public void updateStream() -
removeProcessedBuffers
private int removeProcessedBuffers()
-