diff options
| author | Ray <raysan5@gmail.com> | 2016-05-20 09:22:07 +0200 |
|---|---|---|
| committer | Ray <raysan5@gmail.com> | 2016-05-20 09:22:07 +0200 |
| commit | bdb450fccb1404cbf47f4f8103a28d598178bfc3 (patch) | |
| tree | d823b9cc9155e3104525dffd9f1c0e584bb104a6 /src/raylib.h | |
| parent | 8bbbe8cd76d93bc85810fd13a6cb6c4df18bd30d (diff) | |
| parent | 179f2f9e4fd9ad43e120f186484a78984a2ac063 (diff) | |
| download | raylib-bdb450fccb1404cbf47f4f8103a28d598178bfc3.tar.gz raylib-bdb450fccb1404cbf47f4f8103a28d598178bfc3.zip | |
Merge pull request #116 from kd7tck/newaudio
Redesign audio system to support multiple mix channels
Diffstat (limited to 'src/raylib.h')
| -rw-r--r-- | src/raylib.h | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/src/raylib.h b/src/raylib.h index 911fd8b5..986dc7bf 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -451,10 +451,7 @@ 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; +typedef int RawAudioContext; // Texture formats // NOTE: Support depends on OpenGL version and platform @@ -876,13 +873,6 @@ void InitAudioDevice(void); // Initialize au 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, 0, 2, true); // mixchannel 1, 48khz, stereo, floating point -AudioContext InitAudioContext(unsigned short sampleRate, unsigned char mixChannel, unsigned char channels, bool floatingPoint); -void CloseAudioContext(AudioContext ctx); // Frees audio context -unsigned short UpdateAudioContext(AudioContext ctx, void *data, unsigned short numberElements); // Pushes more audio data into context mix channel, if NULL is passed to data then zeros are played - Sound LoadSound(char *fileName); // Load sound to memory Sound LoadSoundFromWave(Wave wave); // Load sound to memory from wave data Sound LoadSoundFromRES(const char *rresName, int resId); // Load sound to memory from rRES file (raylib Resource) @@ -894,15 +884,24 @@ bool IsSoundPlaying(Sound sound); // Check if a so void SetSoundVolume(Sound sound, float volume); // Set volume for a sound (1.0 is max level) void SetSoundPitch(Sound sound, float pitch); // Set pitch for a sound (1.0 is base level) -void PlayMusicStream(char *fileName); // Start music playing (open stream) -void UpdateMusicStream(void); // Updates buffers for music streaming -void StopMusicStream(void); // Stop music playing (close stream) -void PauseMusicStream(void); // Pause music playing -void ResumeMusicStream(void); // Resume playing paused music -bool IsMusicPlaying(void); // Check if music is playing -void SetMusicVolume(float volume); // Set volume for music (1.0 is max level) -float GetMusicTimeLength(void); // Get current music time length (in seconds) -float GetMusicTimePlayed(void); // Get current music time played (in seconds) +int PlayMusicStream(int musicIndex, char *fileName); // Start music playing (open stream) +void UpdateMusicStream(int index); // Updates buffers for music streaming +void StopMusicStream(int index); // Stop music playing (close stream) +void PauseMusicStream(int index); // Pause music playing +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) +float GetMusicTimeLength(int index); // Get current 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); + +void CloseRawAudioContext(RawAudioContext ctx); +int BufferRawAudioContext(RawAudioContext ctx, void *data, int numberElements); // returns number of elements buffered #ifdef __cplusplus } |
