summaryrefslogtreecommitdiffhomepage
path: root/src/audio.h
diff options
context:
space:
mode:
authorRay <[email protected]>2016-07-15 19:44:18 +0200
committerGitHub <[email protected]>2016-07-15 19:44:18 +0200
commita2794379a0e1e2ab1486888aaa710f65d492e0fc (patch)
treeacd8185cf8574ccba8fab46ccdbca30f9a3cd895 /src/audio.h
parent1c98e6b698b8002e0c6c769c6d9f23a6e15f3bdf (diff)
parentfc19e24eba4358b3afb052f80425af4947b172d6 (diff)
downloadraylib-a2794379a0e1e2ab1486888aaa710f65d492e0fc.tar.gz
raylib-a2794379a0e1e2ab1486888aaa710f65d492e0fc.zip
Merge pull request #132 from raysan5/develop
Develop branch integration
Diffstat (limited to 'src/audio.h')
-rw-r--r--src/audio.h35
1 files changed, 21 insertions, 14 deletions
diff --git a/src/audio.h b/src/audio.h
index fe72d866..f4a82a55 100644
--- a/src/audio.h
+++ b/src/audio.h
@@ -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
@@ -100,17 +110,14 @@ void PauseMusicStream(int index); // Pause music p
void ResumeMusicStream(int index); // Resume playing paused music
bool IsMusicPlaying(int index); // Check if music is playing
void SetMusicVolume(int index, float volume); // Set volume for music (1.0 is max level)
+void SetMusicPitch(int index, float pitch); // Set pitch for a music (1.0 is base level)
float GetMusicTimeLength(int index); // Get music time length (in seconds)
float GetMusicTimePlayed(int index); // Get current music time played (in seconds)
-int GetMusicStreamCount(void);
-void SetMusicPitch(int index, float pitch);
-
-// 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);
+int GetMusicStreamCount(void); // Get number of streams loaded
-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
}