Skip to content
Janzku edited this page Oct 3, 2014 · 24 revisions

Currently supported:


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


How to use:

  • 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);

Functions:

  • 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.

Clone this wiki locally