APIdia Launch Partner
Top Description Constructors Methods
com.badlogic.gdx.backends.headless.mock.audio

public Class MockAudio

extends Object
implements Audio
Class Inheritance
All Implemented Interfaces
com.badlogic.gdx.Audio, com.badlogic.gdx.utils.Disposable
Imports
com.badlogic.gdx.Audio, com.badlogic.gdx.audio.AudioDevice, .AudioRecorder, .Music, .Sound, com.badlogic.gdx.files.FileHandle

The headless backend does its best to mock elements. This is intended to make code-sharing between server and client as simple as possible.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
dispose()

Implements com.badlogic.gdx.utils.Disposable.dispose.

Releases all resources of this object.

public String[]
getAvailableOutputDevices()

Implements com.badlogic.gdx.Audio.getAvailableOutputDevices.

This function returns a list of fully qualified Output device names.

public AudioDevice
newAudioDevice(int samplingRate, boolean isMono)

Implements com.badlogic.gdx.Audio.newAudioDevice.

Creates a new AudioDevice either in mono or stereo mode.

public AudioRecorder
newAudioRecorder(int samplingRate, boolean isMono)

Implements com.badlogic.gdx.Audio.newAudioRecorder.

Creates a new AudioRecorder.

public Music
newMusic(FileHandle file)

Implements com.badlogic.gdx.Audio.newMusic.

Creates a new Music instance which is used to play back a music stream from a file.

public Sound
newSound(FileHandle fileHandle)

Implements com.badlogic.gdx.Audio.newSound.

Creates a new Sound which is used to play back audio effects such as gun shots or explosions.

public boolean
switchOutputDevice(String deviceIdentifier)

Implements com.badlogic.gdx.Audio.switchOutputDevice.

Sets a new OutputDevice.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

MockAudioback to summary
public MockAudio()

Method Detail

disposeback to summary
public void dispose()

Implements com.badlogic.gdx.utils.Disposable.dispose.

Doc from com.badlogic.gdx.utils.Disposable.dispose.

Releases all resources of this object.

Annotations
@Override
getAvailableOutputDevicesback to summary
public String[] getAvailableOutputDevices()

Implements com.badlogic.gdx.Audio.getAvailableOutputDevices.

Doc from com.badlogic.gdx.Audio.getAvailableOutputDevices.

This function returns a list of fully qualified Output device names. This function is only implemented on desktop and web. Note that on gwt the GwtApplicationConfiguration#fetchAvailableOutputDevices attribute needs to be set to true for asking the user for permission! On all other platforms it will return an empty array. It will also return an empty array on error. The names returned need os dependent preprocessing before exposing to a user.

Annotations
@Override
newAudioDeviceback to summary
public AudioDevice newAudioDevice(int samplingRate, boolean isMono)

Implements com.badlogic.gdx.Audio.newAudioDevice.

Doc from com.badlogic.gdx.Audio.newAudioDevice.

Creates a new AudioDevice either in mono or stereo mode. The AudioDevice has to be disposed via its AudioDevice#dispose() method when it is no longer used.

Annotations
@Override
newAudioRecorderback to summary
public AudioRecorder newAudioRecorder(int samplingRate, boolean isMono)

Implements com.badlogic.gdx.Audio.newAudioRecorder.

Doc from com.badlogic.gdx.Audio.newAudioRecorder.

Creates a new AudioRecorder. The AudioRecorder has to be disposed after it is no longer used.

Annotations
@Override
newMusicback to summary
public Music newMusic(FileHandle file)

Implements com.badlogic.gdx.Audio.newMusic.

Doc from com.badlogic.gdx.Audio.newMusic.

Creates a new Music instance which is used to play back a music stream from a file. Currently supported formats are WAV, MP3 and OGG. The Music instance has to be disposed if it is no longer used via the Music#dispose() method. Music instances are automatically paused when ApplicationListener#pause() is called and resumed when ApplicationListener#resume() is called.

Annotations
@Override
newSoundback to summary
public Sound newSound(FileHandle fileHandle)

Implements com.badlogic.gdx.Audio.newSound.

Doc from com.badlogic.gdx.Audio.newSound.

Creates a new Sound which is used to play back audio effects such as gun shots or explosions. The Sound's audio data is retrieved from the file specified via the FileHandle. Note that the complete audio data is loaded into RAM. You should therefore not load big audio files with this methods. The current upper limit for decoded audio is 1 MB.

Currently supported formats are WAV, MP3 and OGG.

The Sound has to be disposed if it is no longer used via the Sound#dispose() method.

Annotations
@Override
switchOutputDeviceback to summary
public boolean switchOutputDevice(String deviceIdentifier)

Implements com.badlogic.gdx.Audio.switchOutputDevice.

Doc from com.badlogic.gdx.Audio.switchOutputDevice.

Sets a new OutputDevice. The identifier can be retrieved from Audio#getAvailableOutputDevices(). If null is passed, it will switch to auto.

Annotations
@Override