Class AudioConfig
java.lang.Object
de.pottgames.tuningfork.AudioConfig
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic enumHolds different options for enabling/disabling the virtualization that is performed when playing non-mono audio. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected com.badlogic.gdx.assets.AssetManagerprotected AudioDeviceConfigprotected DistanceAttenuationModelprotected intprotected TuningForkLoggerprotected intprotected AudioConfig.Spatializationprotected booleanprotected AudioConfig.Virtualizationprotected WavDecoderProvider -
Constructor Summary
ConstructorsConstructorDescriptionCreates an AudioConfig with default settings.AudioConfig(AudioDeviceConfig deviceConfig) Creates an AudioConfig with default settings and the providedAudioDeviceConfig.AudioConfig(AudioDeviceConfig deviceConfig, DistanceAttenuationModel distanceAttenuationModel, int simultaneousSources, int idleTasks, AudioConfig.Virtualization virtualization, TuningForkLogger logger) Creates an AudioConfig with the given settings.AudioConfig(AudioDeviceConfig deviceConfig, DistanceAttenuationModel distanceAttenuationModel, int simultaneousSources, int idleTasks, TuningForkLogger logger) Creates an AudioConfig with the given settings. -
Method Summary
Modifier and TypeMethodDescriptioncom.badlogic.gdx.assets.AssetManagerintintsetAssetManager(com.badlogic.gdx.assets.AssetManager assetManager) Sets a libGDXAssetManager.setDeviceConfig(AudioDeviceConfig deviceConfig) Sets the audio device config.setDistanceAttenuationModel(DistanceAttenuationModel distanceAttenuationModel) Sets the distance attenuation model.setIdleTasks(int idleTasks) The initial task pool capacity, 10 is the default, only go higher if you plan to make heavy use ofStreamedSoundSources simultaneously.setLogger(TuningForkLogger logger) Sets the logger to be used by TuningFork.setSimultaneousSources(int simultaneousSources) Defines how manyBufferedSoundSources are allowed to play simultaneously.setSpatialization(AudioConfig.Spatialization spatialization) Sets the spatialization mode that is used on all sources.setUseNativeDecoders(boolean value) If this is set to false, TuningFork will not load the native decoders and instead use the slower Java ones.setVirtualization(AudioConfig.Virtualization virtualization) Sets the default virtualization enabled state all sound sources are initialized with.setWavDecoderProvider(WavDecoderProvider decoderProvider) Sets the decoder provider that is used byWavInputStream.booleanWhen true, native decoders will be used if available.
-
Field Details
-
deviceConfig
-
distanceAttenuationModel
-
simultaneousSources
protected int simultaneousSources -
idleTasks
protected int idleTasks -
virtualization
-
spatialization
-
logger
-
wavDecoderProvider
-
useNativeDecoders
protected boolean useNativeDecoders -
assetManager
protected com.badlogic.gdx.assets.AssetManager assetManager
-
-
Constructor Details
-
AudioConfig
public AudioConfig()Creates an AudioConfig with default settings. -
AudioConfig
Creates an AudioConfig with default settings and the providedAudioDeviceConfig.- 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 configdistanceAttenuationModel- the distance attenuation modelsimultaneousSources- defines how manyBufferedSoundSources are allowed to play simultaneouslyidleTasks- the initial task pool capacity, 10 is the default, only go higher if you plan to make heavy use ofStreamedSoundSources simultaneouslylogger- the logger to be used by TuningFork. You can implement theTuningForkLoggerinterface 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 configdistanceAttenuationModel- the distance attenuation modelsimultaneousSources- defines how manyBufferedSoundSources are allowed to play simultaneouslyidleTasks- the initial task pool capacity, 10 is the default, only go higher if you plan to make heavy use ofStreamedSoundSources simultaneouslyvirtualization- seesetVirtualization(Virtualization)for infologger- the logger to be used by TuningFork. You can implement theTuningForkLoggerinterface to write your own or choose one of the available logger implementations that are shipped with TuningFork.
-
-
Method Details
-
getDeviceConfig
-
setDeviceConfig
Sets the audio device config.- Parameters:
deviceConfig- the device config- Returns:
- this
-
getDistanceAttenuationModel
-
setDistanceAttenuationModel
Sets the distance attenuation model.- Parameters:
distanceAttenuationModel- the distance attenuation model- Returns:
- this
-
getSimultaneousSources
public int getSimultaneousSources() -
setSimultaneousSources
Defines how manyBufferedSoundSources are allowed to play simultaneously.- Parameters:
simultaneousSources- the number of simultaneous sources- Returns:
- this
-
getIdleTasks
public int getIdleTasks() -
setIdleTasks
The initial task pool capacity, 10 is the default, only go higher if you plan to make heavy use ofStreamedSoundSources simultaneously.- Parameters:
idleTasks- the number of initial tasks- Returns:
- this
-
getSpatialization
-
setSpatialization
Sets the spatialization mode that is used on all sources. The default is:AudioConfig.Spatialization.ON
SeeAudioConfig.Spatializationfor the different methods available.- Parameters:
spatialization- the spatialization- Returns:
- this
-
getAssetManager
public com.badlogic.gdx.assets.AssetManager getAssetManager() -
setAssetManager
Sets a libGDXAssetManager. If set, the TuningFork loaders will be registered automatically whenAudiois initialized. If you can't provide an AssetManager at the time of initialization, useAudio.registerAssetManagerLoaders(AssetManager)later or register the loaders manually.- Parameters:
assetManager-- Returns:
- this
-
getVirtualization
-
setVirtualization
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.
CheckAudioConfig.Virtualizationfor 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
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
-
setLogger
Sets the logger to be used by TuningFork. You can implement theTuningForkLoggerinterface 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
-
setWavDecoderProvider
Sets the decoder provider that is used byWavInputStream.- Parameters:
decoderProvider- must not be null- Returns:
- this
-