fplayer
C99 Falcon Sequence (fseq) file player for Light-O-Rama hardware (like xLights)
|
Audio system implementation. More...
#include "audio.h"
#include <assert.h>
#include <stdio.h>
#include <AL/alut.h>
#include "std2/errcode.h"
Functions | |
static void | perror_al (const char *const msg) |
Prints the last OpenAL error to stderr with the given message. | |
static void | perror_alut (const char *const msg) |
Prints the last ALUT error to stderr with the given message. | |
static int | audioInit (void) |
Initializes the audio system if it has not been initialized yet. | |
static void | audioStopPlayback (void) |
Stops the current audio playback, if any. The last allocated AL buffer is then detached from the source and deleted. The source is retained. | |
void | Audio_exit (void) |
Exits the audio system and frees all resources. This function should be called before the program exits, or when the audio system is no longer needed. This function is safe to call even if the audio system has not been initialized. | |
bool | Audio_isPlaying (void) |
Checks the playback status of the audio system. | |
int | Audio_play (const char *const fp) |
Attempts to play the audio file at the given file path. This function initializes the audio system if it has not been initialized yet. If the audio system is already playing audio, the current audio playback is stopped before the new audio file is played. | |
Variables | ||
struct { | ||
bool init | ||
True if the audio system has been initialized. More... | ||
ALuint sid | ||
Allocated source id for audio playback. More... | ||
ALuint bid | ||
Allocated buffer id for audio data. More... | ||
} | gAudio | |
Global audio system state. | ||
Audio system implementation.
void Audio_exit | ( | void | ) |
Exits the audio system and frees all resources. This function should be called before the program exits, or when the audio system is no longer needed. This function is safe to call even if the audio system has not been initialized.
bool Audio_isPlaying | ( | void | ) |
Checks the playback status of the audio system.
int Audio_play | ( | const char * | fp | ) |
Attempts to play the audio file at the given file path. This function initializes the audio system if it has not been initialized yet. If the audio system is already playing audio, the current audio playback is stopped before the new audio file is played.
fp | the file path of the audio file to play |
|
static |
Initializes the audio system if it has not been initialized yet.
|
static |
Stops the current audio playback, if any. The last allocated AL buffer is then detached from the source and deleted. The source is retained.
|
static |
Prints the last OpenAL error to stderr with the given message.
msg | message to print before the error message |
|
static |
Prints the last ALUT error to stderr with the given message.
msg | message to print before the error message |
ALuint bid |
Allocated buffer id for audio data.
struct { ... } gAudio |
Global audio system state.
bool init |
True if the audio system has been initialized.
ALuint sid |
Allocated source id for audio playback.