Introduction

Audeal is a addon you can add to any C++ project that makes using Miniaudio a little easier. It's primary use is for games or game engines. Example usage of Audeal:

#include <iostream>

#include "Audeal.h"

int main() {
    Sound mySound = Sound("MySound.wav");
    mySound.play();
    
    std::cout<<"press enter to exit"<<std::endl;
    std::cin.ignore()

    sound.destroy();
    return 0;
    

}

Then compile the project. Example compile: g++ main.cpp -lpthread -lm -ldl -o main

Audeal.h

The Audeal header is the basis of the addon.

ClassAbout
AudioInitializes the Miniaudio Engine.
SoundPlaying the sound.

Audio Class

It's purpose is to initialize the Miniaudio Engine. There typically is no need to create a variable of this, unless you want to use the Miniaudio functionality directly.

Variables

Public

ma_engine engine - The Miniaudio sound engine.

ma_result result - For Miniaudio error handling.

Functions

Public

Audio() - Class constructor. It initializes the Miniaudio engine.

cleanupAudio() - Cleans up the Miniaudio engine.

Sound Class

Handles playing the sound.

Variables

Public

const char* path - Path to the sound file, e.g "path/to/sound.wav".

Protected

ma_sound sound - The Miniaudio sound variable. Used internally to play the sound and change different aspects of it e.g. volume, pitch, pan, etc.

Functions

Public

Sound(const char* p, bool global = false) - Class constructor. Initializes the sound variable, and sets it to be in 3D space or not.

  • const char* p - Path to the sound file, e.g "path/to/sound.wav".
  • bool global - Should the sound be heard regardless of where the listener is? The = false just makes the variable optional, so by default it will be a 3D sound.

setVolume(float value) - Sets the volume of the sound. Typically recommended for value to be within 0.0f and 1.0f.

  • float value - The new volume.

setPan(float value) - Sets the pan direction (left to right) of the sound. Typically recommended for value to be between -1.0f (left ear) and 1.0f (right ear).

  • float value - The new pan.

destroy() - Uninitializes the sound and cleanup the Miniaudio Engine.

Credits

External Libraries

License

todo...