AudioDevice and AudioRecorder interfaces, create sound effects via the Sound interface
and play music streams via the Music interface.
All resources created via this interface have to be disposed as soon as they are no longer used.
Note that all Music instances will be automatically paused when the ApplicationListener#pause() method is
called, and automatically resumed when the ApplicationListener#resume() method is called.
| Modifier and Type | Method and Description |
|---|---|
| public String[] | Returns: A array of available output devicesThis function returns a list of fully qualified Output device names. |
| public AudioDevice | Returns: the AudioDevicethe sampling rate. samplingRate, boolean whether the AudioDevice should be in mono or stereo mode isMono)Creates a new |
| public AudioRecorder | Returns: the AudioRecorderthe sampling rate in Hertz samplingRate, boolean whether the recorder records in mono or stereo isMono)Creates a new |
| public Music | Returns: the new Music or null if the Music could not be loadedthe FileHandle file)Creates a new |
| public Sound | Returns: the new Sound
Creates a new |
| public boolean | switchOutputDevice(String
device identifier to switch to, or null for auto deviceIdentifier)Sets a new OutputDevice. |
| getAvailableOutputDevices | back to summary |
|---|---|
| public String[] 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.
| |
| newAudioDevice | back to summary |
|---|---|
| public AudioDevice newAudioDevice(int samplingRate, boolean isMono) Creates a new
| |
| newAudioRecorder | back to summary |
|---|---|
| public AudioRecorder newAudioRecorder(int samplingRate, boolean isMono) Creates a new
| |
| newMusic | back to summary |
|---|---|
| public Music newMusic(FileHandle file) Creates a new
| |
| newSound | back to summary |
|---|---|
| public Sound newSound(FileHandle fileHandle)
Creates a new Currently supported formats are WAV, MP3 and OGG.
The Sound has to be disposed if it is no longer used via the
| |
| switchOutputDevice | back to summary |
|---|---|
| public boolean switchOutputDevice(String deviceIdentifier) Sets a new OutputDevice. The identifier can be retrieved from
| |