Review some functions, formatting and comments

This commit is contained in:
raysan5
2016-07-15 18:16:34 +02:00
parent 338bb3fd9c
commit 7959ccd84d
3 changed files with 148 additions and 125 deletions

View File

@ -2,13 +2,26 @@
*
* raylib.audio
*
* Basic functions to manage Audio: InitAudioDevice, LoadAudioFiles, PlayAudioFiles
* Basic functions to manage Audio:
* Manage audio device (init/close)
* Load and Unload audio files
* Play/Stop/Pause/Resume loaded audio
* Manage mixing channels
* Manage raw audio context
*
* Uses external lib:
* OpenAL Soft - Audio device management lib (http://kcat.strangesoft.net/openal.html)
* stb_vorbis - Ogg audio files loading (http://www.nothings.org/stb_vorbis/)
* jar_xm - XM module file loading
* jar_mod - MOD audio file loading
*
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
* Many thanks to Joshua Reisenauer (github: @kd7tck) for the following additions:
* XM audio module support (jar_xm)
* MOD audio module support (jar_mod)
* Mixing channels support
* Raw audio context support
*
* Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
*
* This software is provided "as-is", without any express or implied warranty. In no event
* will the authors be held liable for any damages arising from the use of this software.
@ -63,9 +76,6 @@ typedef struct Wave {
short channels;
} Wave;
typedef int RawAudioContext;
#ifdef __cplusplus
extern "C" { // Prevents name mangling of functions
#endif
@ -80,7 +90,7 @@ extern "C" { // Prevents name mangling of functions
//----------------------------------------------------------------------------------
void InitAudioDevice(void); // Initialize audio device and context
void CloseAudioDevice(void); // Close the audio device and context (and music stream)
bool IsAudioDeviceReady(void); // True if call to InitAudioDevice() was successful and CloseAudioDevice() has not been called yet
bool IsAudioDeviceReady(void); // Check if device has been initialized successfully
Sound LoadSound(char *fileName); // Load sound to memory
Sound LoadSoundFromWave(Wave wave); // Load sound to memory from wave data
@ -105,12 +115,9 @@ float GetMusicTimeLength(int index); // Get music tim
float GetMusicTimePlayed(int index); // Get current music time played (in seconds)
int GetMusicStreamCount(void); // Get number of streams loaded
// used to output raw audio streams, returns negative numbers on error
// if floating point is false the data size is 16bit short, otherwise it is float 32bit
RawAudioContext InitRawAudioContext(int sampleRate, int channels, bool floatingPoint);
void CloseRawAudioContext(RawAudioContext ctx);
int BufferRawAudioContext(RawAudioContext ctx, void *data, unsigned short numberElements); // returns number of elements buffered
int InitRawMixChannel(int sampleRate, int channels, bool floatingPoint); // Initialize raw audio mix channel for audio buffering
int BufferRawMixChannel(int mixc, void *data, unsigned short numberElements); // Buffers data directly to raw mix channel
void CloseRawMixChannel(int mixc); // Closes and frees raw mix channel
#ifdef __cplusplus
}