aboutsummaryrefslogtreecommitdiff
path: root/src/raylib.h
diff options
context:
space:
mode:
authorRay <raysan5@gmail.com>2016-05-01 01:49:40 +0200
committerRay <raysan5@gmail.com>2016-05-01 01:49:40 +0200
commit6ca1fd59a9ec1b61f4e9b48ed979e643b1dbcb6d (patch)
treef3f55ed2ac8891fcf4be17317bd96c383eb1143c /src/raylib.h
parent1fb874cdc5be59c510b46fd8b1a10b458ad3fb45 (diff)
parent34e5fcf47e99deecc9954fd848130c61119e2e93 (diff)
downloadraylib-6ca1fd59a9ec1b61f4e9b48ed979e643b1dbcb6d.tar.gz
raylib-6ca1fd59a9ec1b61f4e9b48ed979e643b1dbcb6d.zip
Merge pull request #111 from kd7tck/develop
First stage of audio API update
Diffstat (limited to 'src/raylib.h')
-rw-r--r--src/raylib.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/raylib.h b/src/raylib.h
index 699fbbdb..8390d176 100644
--- a/src/raylib.h
+++ b/src/raylib.h
@@ -446,6 +446,11 @@ typedef struct Wave {
short channels;
} Wave;
+// Audio Context, used to create custom audio streams that are not bound to a sound file. There can be
+// no more than 4 concurrent audio contexts in use. This is due to each active context being tied to
+// a dedicated mix channel.
+typedef void* AudioContext;
+
// Texture formats
// NOTE: Support depends on OpenGL version and platform
typedef enum {
@@ -863,6 +868,14 @@ void DrawPhysicObjectInfo(PhysicObject *pObj, Vector2 position, int fontSize);
//------------------------------------------------------------------------------------
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
+
+// Audio contexts are for outputing custom audio waveforms, This will shut down any other sound sources currently playing
+// The mixChannel is what mix channel you want to operate on, 0-3 are the ones available. Each mix channel can only be used one at a time.
+// exmple usage is InitAudioContext(48000, 16, 0, 2); // stereo, mixchannel 1, 16bit, 48khz
+AudioContext InitAudioContext(unsigned short sampleRate, unsigned char bitsPerSample, unsigned char mixChannel, unsigned char channels);
+void CloseAudioContext(AudioContext ctx); // Frees audio context
+void UpdateAudioContext(AudioContext ctx, void *data, unsigned short *dataLength); // Pushes more audio data into context mix channel, if none are ever pushed then zeros are fed in
Sound LoadSound(char *fileName); // Load sound to memory
Sound LoadSoundFromWave(Wave wave); // Load sound to memory from wave data