Class OpenAlUtil

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

public class OpenAlUtil extends Object
The OpenALUtil class provides utility functions for working with OpenAL audio.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final org.slf4j.Logger
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private static String
    alcErrorToString(int pErrorCode)
    Converts an ALC error code to a human-readable error message.
    private static String
    alErrorToString(int pErrorCode)
    Converts an OpenAL error code to a human-readable error message.
    (package private) static int
    Converts an AudioFormat object to the corresponding OpenAL audio format code.
    (package private) static boolean
    checkALCError(long pDeviceHandle, String pOperationState)
    Checks for an ALC error and logs an error message if one is found.
    (package private) static boolean
    checkALError(String pOperationState)
    Checks for an OpenAL error and logs an error message if one is found.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
  • Constructor Details

    • OpenAlUtil

      public OpenAlUtil()
  • Method Details

    • alErrorToString

      private static String alErrorToString(int pErrorCode)
      Converts an OpenAL error code to a human-readable error message.
      Parameters:
      pErrorCode - The OpenAL error code to convert
      Returns:
      A String representing the error message for the given error code.
    • checkALError

      static boolean checkALError(String pOperationState)
      Checks for an OpenAL error and logs an error message if one is found.
      Parameters:
      pOperationState - A String describing the operation being performed when the error occurred
      Returns:
      true if an OpenAL error was found, false otherwise.
    • alcErrorToString

      private static String alcErrorToString(int pErrorCode)
      Converts an ALC error code to a human-readable error message.
      Parameters:
      pErrorCode - The ALC error code to convert
      Returns:
      A String representing the error message for the given error code.
    • checkALCError

      static boolean checkALCError(long pDeviceHandle, String pOperationState)
      Checks for an ALC error and logs an error message if one is found.
      Parameters:
      pDeviceHandle - The handle of the device to check for errors on
      pOperationState - A String describing the operation being performed when the error occurred
      Returns:
      true if an ALC error was found, false otherwise.
    • audioFormatToOpenAl

      static int audioFormatToOpenAl(AudioFormat pFormat)
      Converts an AudioFormat object to the corresponding OpenAL audio format code.
      Parameters:
      pFormat - The AudioFormat object to convert
      Returns:
      An integer representing the corresponding OpenAL audio format code.
      Throws:
      IllegalArgumentException - if the given AudioFormat is not a supported format.