Class Channel

java.lang.Object
com.mojang.blaze3d.audio.Channel

public class Channel extends Object
Represents an OpenAL audio channel.
  • 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

      private final AtomicBoolean initialized
    • streamingBufferSize

      private int streamingBufferSize
    • stream

      @Nullable private AudioStream stream
  • Constructor Details

    • Channel

      private Channel(int pSource)
  • Method Details

    • create

      @Nullable static Channel 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

      public void setSelfPosition(Vec3 pSource)
      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

      public void attachStaticBuffer(SoundBuffer pBuffer)
      Attaches a static buffer to the audio channel.
      Parameters:
      pBuffer - the buffer to attach
    • attachBufferStream

      public void attachBufferStream(AudioStream pStream)
      Attaches a buffer stream to the audio channel.
      Parameters:
      pStream - the stream to attach
    • calculateBufferSize

      private static int calculateBufferSize(AudioFormat pFormat, int pSampleAmount)
      Calculates the buffer size for an audio stream.
      Parameters:
      pFormat - the audio format of the stream
      pSampleAmount - 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()