Class AudioConfig

java.lang.Object
de.pottgames.tuningfork.AudioConfig

public class AudioConfig extends Object
  • Field Details

  • Constructor Details

    • AudioConfig

      public AudioConfig()
      Creates an AudioConfig with default settings.
    • AudioConfig

      public AudioConfig(AudioDeviceConfig deviceConfig)
      Creates an AudioConfig with default settings and the provided AudioDeviceConfig.
      Parameters:
      deviceConfig - the device config
    • AudioConfig

      public AudioConfig(AudioDeviceConfig deviceConfig, DistanceAttenuationModel distanceAttenuationModel, int simultaneousSources, int idleTasks, TuningForkLogger logger)
      Creates an AudioConfig with the given settings.
      Parameters:
      deviceConfig - the device config
      distanceAttenuationModel - the distance attenuation model
      simultaneousSources - defines how many BufferedSoundSources are allowed to play simultaneously
      idleTasks - the initial task pool capacity, 10 is the default, only go higher if you plan to make heavy use of StreamedSoundSources simultaneously
      logger - the logger to be used by TuningFork. You can implement the TuningForkLogger interface to write your own or choose one of the available logger implementations that are shipped with TuningFork.
    • AudioConfig

      public AudioConfig(AudioDeviceConfig deviceConfig, DistanceAttenuationModel distanceAttenuationModel, int simultaneousSources, int idleTasks, AudioConfig.Virtualization virtualization, TuningForkLogger logger)
      Creates an AudioConfig with the given settings.
      Parameters:
      deviceConfig - the device config
      distanceAttenuationModel - the distance attenuation model
      simultaneousSources - defines how many BufferedSoundSources are allowed to play simultaneously
      idleTasks - the initial task pool capacity, 10 is the default, only go higher if you plan to make heavy use of StreamedSoundSources simultaneously
      virtualization - see setVirtualization(Virtualization) for info
      logger - the logger to be used by TuningFork. You can implement the TuningForkLogger interface to write your own or choose one of the available logger implementations that are shipped with TuningFork.
  • Method Details

    • getDeviceConfig

      public AudioDeviceConfig getDeviceConfig()
    • setDeviceConfig

      public AudioConfig setDeviceConfig(AudioDeviceConfig deviceConfig)
      Sets the audio device config.
      Parameters:
      deviceConfig - the device config
      Returns:
      this
    • getDistanceAttenuationModel

      public DistanceAttenuationModel getDistanceAttenuationModel()
    • setDistanceAttenuationModel

      public AudioConfig setDistanceAttenuationModel(DistanceAttenuationModel distanceAttenuationModel)
      Sets the distance attenuation model.
      Parameters:
      distanceAttenuationModel - the distance attenuation model
      Returns:
      this
    • getSimultaneousSources

      public int getSimultaneousSources()
    • setSimultaneousSources

      public AudioConfig setSimultaneousSources(int simultaneousSources)
      Defines how many BufferedSoundSources are allowed to play simultaneously.
      Parameters:
      simultaneousSources - the number of simultaneous sources
      Returns:
      this
    • getIdleTasks

      public int getIdleTasks()
    • setIdleTasks

      public AudioConfig setIdleTasks(int idleTasks)
      The initial task pool capacity, 10 is the default, only go higher if you plan to make heavy use of StreamedSoundSources simultaneously.
      Parameters:
      idleTasks - the number of initial tasks
      Returns:
      this
    • getSpatialization

      public AudioConfig.Spatialization getSpatialization()
    • setSpatialization

      public AudioConfig setSpatialization(AudioConfig.Spatialization spatialization)
      Sets the spatialization mode that is used on all sources. The default is: AudioConfig.Spatialization.ON
      See AudioConfig.Spatialization for the different methods available.
      Parameters:
      spatialization - the spatialization
      Returns:
      this
    • getAssetManager

      public com.badlogic.gdx.assets.AssetManager getAssetManager()
    • setAssetManager

      public AudioConfig setAssetManager(com.badlogic.gdx.assets.AssetManager assetManager)
      Sets a libGDX AssetManager. If set, the TuningFork loaders will be registered automatically when Audio is initialized. If you can't provide an AssetManager at the time of initialization, use Audio.registerAssetManagerLoaders(AssetManager) later or register the loaders manually.
      Parameters:
      assetManager -
      Returns:
      this
    • getVirtualization

      public AudioConfig.Virtualization getVirtualization()
    • setVirtualization

      public AudioConfig setVirtualization(AudioConfig.Virtualization virtualization)
      Sets the default virtualization enabled state all sound sources are initialized with. You can change it on a per-source basis later.
      OpenAL requires buffer channels to be down-mixed to the output channel configuration, possibly using HRTF or other virtualization techniques to give a sense of speakers that may not be physically present. This leads to sometimes unexpected and unwanted audio output, so you can disable it.

      Check AudioConfig.Virtualization for the different methods available.
      Parameters:
      virtualization - the virtualization
      Returns:
      this
    • useNativeDecoders

      public boolean useNativeDecoders()
      When true, native decoders will be used if available.
      Returns:
      this
    • setUseNativeDecoders

      public AudioConfig setUseNativeDecoders(boolean value)
      If this is set to false, TuningFork will not load the native decoders and instead use the slower Java ones.
      Parameters:
      value - true if you want to load the native decoders
      Returns:
      this
    • getLogger

      public TuningForkLogger getLogger()
    • setLogger

      public AudioConfig setLogger(TuningForkLogger logger)
      Sets the logger to be used by TuningFork. You can implement the TuningForkLogger interface to write your own or choose one of the available logger implementations that are shipped with TuningFork.
      Parameters:
      logger - may be null to turn off logging
      Returns:
      this
    • getResamplerProvider

      public WavDecoderProvider getResamplerProvider()
    • setWavDecoderProvider

      public AudioConfig setWavDecoderProvider(WavDecoderProvider decoderProvider)
      Sets the decoder provider that is used by WavInputStream.
      Parameters:
      decoderProvider - must not be null
      Returns:
      this