Repository navigation
ExampleAudio
da772 edited this page Apr 27, 2020
·
2 revisions
All audio is controlled by the audio manager which creates audio sources that it manages. These audio sources are pooled so if an audio source is already loaded into memory the engine will reuse it. Only the audio's pitch and volume can be adjusted. The audio manager also allows for audio sources to be grouped into categories. These categories allow for changing the volume of multiple audios sources at once. Only .wav files are supported for now.
@Override
public void OnBegin() {
// Create audio source, returns source unique identifier
String audioSource = AudioManager.CreateAudioSource("gamePauseBack",// Unique audio source identifier
"Audio/buttonMouseOver.wav", // Path to audio file
"sfx", // Category name
1f, // Volume of audio source
1f, // Pitch of audio source
false, // Should loop?
true // Should auto delete (delete when source is finished playing)
);
}@Override
public void OnBegin() {
String audioSource = AudioManager.CreateAudioSource("gamePauseBack",// Unique audio source identifier
"Audio/buttonMouseOver.wav", // Path to audio file
"sfx", // Category name
1f, // Volume of audio source
1f, // Pitch of audio source
false, // Should loop?
true // Should auto delete (delete when source is finished playing)
);
// Plays source
AudioManager.PlaySource(audioSource);
// Stop source
AudioManager.RemoveSource(audioSource);
}@Override
public void OnBegin() {
AudioManager.SetCategoryVolume(
"sfx", // Category name
1.f // Volume
);
}