Skip to content

lunaris audio voice

Lohk edited this page Sep 16, 2021 · 1 revision

AudioVoice

⇨ About

Voice is the main hardware interface. This represent an "audio device". You can attach mixers to this and so you can play audio files.

⇨ Interface

Function About
create(const int, const ALLEGRO_AUDIO_DEPTH, const ALLEGRO_CHANNEL_CONF) : bool Create a voice with a frequency (in hertz, defaults 48 kHz), depth (one of the enum, defaults to 16 bits) and audio configuration (mono, stereo, surround, defaults to stereo). Returns true on success.
destroy() : void Destroy the voice (it should detach mixers attached to it, but it's recommended to detach manually)
mute(const bool) : void Mute output?
exists() : bool Check if this voice is initialized. Recommended before any attach or get/set. Returns true if it's good.

⇨ Examples

1. Simple one file music player (without error checks)

Lunaris::voice audio;
audio.create();

Lunaris::mixer mixing;
mixing.create();
mixing.attach_to(audio);

Lunaris::track mytrack;
Lunaris::sample mysample;

mysample.load("fancy_music.ogg");

mytrack.load(mysample);
mytrack.attach_to(mixing);
mytrack.set_gain(0.3f);
mytrack.play();
  • Lunaris (rebrand & dev)
  • LSWv5
    • _Macros
    • Handling
    • Tools
      • AdvancedShared
      • Any
      • Common
      • CString
      • FastFunction
      • Future
      • Hash
      • Launcher
      • Resource
      • Stopwatch
      • SuperFunctionalMap
      • SuperMap
      • SuperMutex
      • SuperPair
      • SuperResource
      • SuperThread
    • Interface
      • Bitmap
      • Camera
      • Color
      • Config
      • Connection
      • DelayedTask
      • Display
      • Downloader
      • EventCustom
      • Events
      • EventTimer
      • Font
      • Logger
      • Mixer
      • PathManager
      • Sample
      • SmartFile
      • Target
      • Track
      • Vertex
      • Voice
    • Work
      • Block
      • BubbleFX
      • Button
      • Collisioner
      • GameCore
      • ProgressBar
      • ShineFX
      • Sprite
      • Text
      • TextInput
Clone this wiki locally