Class SmartDeviceRerouter
java.lang.Object
de.pottgames.tuningfork.router.SmartDeviceRerouter
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable, AudioDeviceRerouter
The SmartDeviceRerouter checks every 1.5 seconds (configurable) whether the connection to the audio device still exists and whether it is the optimal
connection. If not, it tries to establish a connection with the following prioritization:
- desired device
- current default device
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a newSmartDeviceRerouterwith the default check interval.SmartDeviceRerouter(long checkInterval) Creates a newSmartDeviceRerouterwith the given check interval for the background thread. -
Method Summary
Modifier and TypeMethodDescriptionvoiddispose()voidGets called when a disconnect to the audio device is detected.voidsetup(long device, String desiredDeviceSpecifier, ContextAttributes attributes) This method is called beforerun.voidstart()Starts the thread.voidupdateContextAttributes(ContextAttributes attributes) This method gets called whenever the OpenAL context attributes change.voidupdateDesiredDevice(String desiredDeviceSpecifier) This method gets called when the user changes the device at runtime viaAudioDevice.switchToDevice(String).
-
Constructor Details
-
SmartDeviceRerouter
public SmartDeviceRerouter()Creates a newSmartDeviceRerouterwith the default check interval. -
SmartDeviceRerouter
public SmartDeviceRerouter(long checkInterval) Creates a newSmartDeviceRerouterwith the given check interval for the background thread.- Parameters:
checkInterval- sleep time of the background thread in milliseconds
-
-
Method Details
-
setup
Description copied from interface:AudioDeviceRerouterThis method is called beforerun.- Specified by:
setupin interfaceAudioDeviceRerouter- Parameters:
device- the OpenAL device handledesiredDeviceSpecifier- the device specifier that was specified inAudioDeviceConfig.setDeviceSpecifier(String)attributes- the context attributes
-
updateDesiredDevice
Description copied from interface:AudioDeviceRerouterThis method gets called when the user changes the device at runtime viaAudioDevice.switchToDevice(String).- Specified by:
updateDesiredDevicein interfaceAudioDeviceRerouter- Parameters:
desiredDeviceSpecifier- the device name
-
updateContextAttributes
Description copied from interface:AudioDeviceRerouterThis method gets called whenever the OpenAL context attributes change.- Specified by:
updateContextAttributesin interfaceAudioDeviceRerouter- Parameters:
attributes- the context attributes
-
start
-
onDisconnect
public void onDisconnect()Description copied from interface:AudioDeviceRerouterGets called when a disconnect to the audio device is detected.- Specified by:
onDisconnectin interfaceAudioDeviceRerouter
-
dispose
public void dispose()- Specified by:
disposein interfacecom.badlogic.gdx.utils.Disposable
-