-
Notifications
You must be signed in to change notification settings - Fork 2
Sound
WAV:
- Format: PCM
- Codec ID: 1
- Channels: 1 or 2
- Bit depth: 16
- Might support wider range of formats, depends on libsndfile (try at your own risk).
OGG
FLAC
- Incase of missing OpenAL32.dll and libsndfile-1.dll
Copy it into Debug folder to test.
-
Include Audio.hpp in header
-
Create Sound pointer in header
Sound* sound; -
Example:
Until master is updated, use uth::Sound::Load("file");
sound = uthRS.LoadSound("filepath.extension");
sound->Play();
sound->Loop(true);- Load(const char* fileName)
Loads and creates sound file.
- Play()
Plays sound file from beginning.
- Play(float offsetInMilliseconds)
Plays sound file from specified point.
- PlayEffect()
Intented for effects as Play() starts playing sound from beginning.
This function copies source to start over while keeping original playing.
- Stop()
Stops sound from playing.
- Pause()
Toggles pause.
- Loop()
Toggles loop on / off.
- Loop(bool looping)
Sets loop true or false.
- SetVolume(int volumePercent)
Adjust volume.
Range: 0-100
Default: 100
- SetPitch(int pitchPercent)
Adjust pitch.
Range: 50-200
Default: 100
- SetSourcePosition(float x, float y, float z = 0)
- SetSourcePosition(umath::vector3 position)
Sets sound position. Works only with mono sounds.
-
SetListenerPosition(float x, float y, float z = 0)
-
SetListenerPosition(umath::vector3 position)
Sets listener position. Works only with mono sounds.