summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/audio.c340
-rw-r--r--src/audio.h20
-rw-r--r--src/easings.h10
-rw-r--r--src/raylib.h20
4 files changed, 181 insertions, 209 deletions
diff --git a/src/audio.c b/src/audio.c
index fbf53df6..cc964cd1 100644
--- a/src/audio.c
+++ b/src/audio.c
@@ -61,6 +61,7 @@
//----------------------------------------------------------------------------------
#define MAX_STREAM_BUFFERS 2
#define MAX_AUDIO_CONTEXTS 4 // Number of open AL sources
+#define MAX_MUSIC_STREAMS 2
#if defined(PLATFORM_RPI) || defined(PLATFORM_ANDROID)
// NOTE: On RPI and Android should be lower to avoid frame-stalls
@@ -81,13 +82,8 @@
typedef struct Music {
stb_vorbis *stream;
jar_xm_context_t *chipctx; // Stores jar_xm context
-
- ALuint buffers[MAX_STREAM_BUFFERS];
- ALuint source;
- ALenum format;
-
- int channels;
- int sampleRate;
+ AudioContext_t *ctx; // audio context
+
int totalSamplesLeft;
float totalLengthSeconds;
bool loop;
@@ -117,17 +113,17 @@ typedef enum { INFO = 0, ERROR, WARNING, DEBUG, OTHER } TraceLogType;
//----------------------------------------------------------------------------------
static AudioContext_t* mixChannelsActive_g[MAX_AUDIO_CONTEXTS]; // What mix channels are currently active
static bool musicEnabled = false;
-static Music currentMusic; // Current music loaded
- // NOTE: Only one music file playing at a time
+static Music currentMusic[MAX_MUSIC_STREAMS]; // Current music loaded, up to two can play at the same time
+
//----------------------------------------------------------------------------------
// Module specific Functions Declaration
//----------------------------------------------------------------------------------
-static Wave LoadWAV(const char *fileName); // Load WAV file
-static Wave LoadOGG(char *fileName); // Load OGG file
-static void UnloadWave(Wave wave); // Unload wave data
+static Wave LoadWAV(const char *fileName); // Load WAV file
+static Wave LoadOGG(char *fileName); // Load OGG file
+static void UnloadWave(Wave wave); // Unload wave data
-static bool BufferMusicStream(ALuint buffer); // Fill music buffers with data
-static void EmptyMusicStream(void); // Empty music buffers
+static bool BufferMusicStream(int index); // Fill music buffers with data
+static void EmptyMusicStream(int index); // Empty music buffers
static unsigned short FillAlBufferWithSilence(AudioContext_t *context, ALuint buffer);// fill buffer with zeros, returns number processed
static void ResampleShortToFloat(short *shorts, float *floats, unsigned short len); // pass two arrays of the same legnth in
@@ -767,205 +763,202 @@ void SetSoundPitch(Sound sound, float pitch)
//----------------------------------------------------------------------------------
// Start music playing (open stream)
-void PlayMusicStream(char *fileName)
+// returns 0 on success
+int PlayMusicStream(int musicIndex, char *fileName)
{
+ int mixIndex;
+
+ if(currentMusic[musicIndex].stream != NULL || currentMusic[musicIndex].chipTune) return 1; // error
+
+ for(mixIndex = 0; mixIndex < MAX_AUDIO_CONTEXTS; mixIndex++) // find empty mix channel slot
+ {
+ if(mixChannelsActive_g[mixIndex] == NULL) break;
+ else if(musicIndex = MAX_AUDIO_CONTEXTS - 1) return 2; // error
+ }
+
+
if (strcmp(GetExtension(fileName),"ogg") == 0)
{
- // Stop current music, clean buffers, unload current stream
- StopMusicStream();
-
// Open audio stream
- currentMusic.stream = stb_vorbis_open_filename(fileName, NULL, NULL);
+ currentMusic[musicIndex].stream = stb_vorbis_open_filename(fileName, NULL, NULL);
- if (currentMusic.stream == NULL)
+ if (currentMusic[musicIndex].stream == NULL)
{
TraceLog(WARNING, "[%s] OGG audio file could not be opened", fileName);
+ return 3; // error
}
else
{
// Get file info
- stb_vorbis_info info = stb_vorbis_get_info(currentMusic.stream);
-
- currentMusic.channels = info.channels;
- currentMusic.sampleRate = info.sample_rate;
+ stb_vorbis_info info = stb_vorbis_get_info(currentMusic[musicIndex].stream);
TraceLog(INFO, "[%s] Ogg sample rate: %i", fileName, info.sample_rate);
TraceLog(INFO, "[%s] Ogg channels: %i", fileName, info.channels);
TraceLog(DEBUG, "[%s] Temp memory required: %i", fileName, info.temp_memory_required);
- if (info.channels == 2) currentMusic.format = AL_FORMAT_STEREO16;
- else currentMusic.format = AL_FORMAT_MONO16;
-
- currentMusic.loop = true; // We loop by default
+ currentMusic[musicIndex].loop = true; // We loop by default
musicEnabled = true;
- // Create an audio source
- alGenSources(1, &currentMusic.source); // Generate pointer to audio source
-
- alSourcef(currentMusic.source, AL_PITCH, 1);
- alSourcef(currentMusic.source, AL_GAIN, 1);
- alSource3f(currentMusic.source, AL_POSITION, 0, 0, 0);
- alSource3f(currentMusic.source, AL_VELOCITY, 0, 0, 0);
- //alSourcei(currentMusic.source, AL_LOOPING, AL_TRUE); // ERROR: Buffers do not queue!
-
- // Generate two OpenAL buffers
- alGenBuffers(2, currentMusic.buffers);
-
- // Fill buffers with music...
- BufferMusicStream(currentMusic.buffers[0]);
- BufferMusicStream(currentMusic.buffers[1]);
-
- // Queue buffers and start playing
- alSourceQueueBuffers(currentMusic.source, 2, currentMusic.buffers);
- alSourcePlay(currentMusic.source);
-
- // NOTE: Regularly, we must check if a buffer has been processed and refill it: UpdateMusicStream()
-
- currentMusic.totalSamplesLeft = stb_vorbis_stream_length_in_samples(currentMusic.stream) * currentMusic.channels;
- currentMusic.totalLengthSeconds = stb_vorbis_stream_length_in_seconds(currentMusic.stream);
+ currentMusic[musicIndex].totalSamplesLeft = stb_vorbis_stream_length_in_samples(currentMusic[musicIndex].stream) * info.channels;
+ currentMusic[musicIndex].totalLengthSeconds = stb_vorbis_stream_length_in_seconds(currentMusic[musicIndex].stream);
+
+ if (info.channels == 2){
+ currentMusic[musicIndex].ctx = InitAudioContext(info.sample_rate, mixIndex, 2, false);
+ }
+ else{
+ currentMusic[musicIndex].ctx = InitAudioContext(info.sample_rate, mixIndex, 1, false);
+ }
}
}
else if (strcmp(GetExtension(fileName),"xm") == 0)
{
- // Stop current music, clean buffers, unload current stream
- StopMusicStream();
-
- // new song settings for xm chiptune
- currentMusic.chipTune = true;
- currentMusic.channels = 2;
- currentMusic.sampleRate = 48000;
- currentMusic.loop = true;
-
// only stereo is supported for xm
- if(!jar_xm_create_context_from_file(&currentMusic.chipctx, currentMusic.sampleRate, fileName))
+ if(!jar_xm_create_context_from_file(&currentMusic[musicIndex].chipctx, 48000, fileName))
{
- currentMusic.format = AL_FORMAT_STEREO16;
- jar_xm_set_max_loop_count(currentMusic.chipctx, 0); // infinite number of loops
- currentMusic.totalSamplesLeft = jar_xm_get_remaining_samples(currentMusic.chipctx);
- currentMusic.totalLengthSeconds = ((float)currentMusic.totalSamplesLeft) / ((float)currentMusic.sampleRate);
+ currentMusic[musicIndex].chipTune = true;
+ currentMusic[musicIndex].loop = true;
+ jar_xm_set_max_loop_count(currentMusic[musicIndex].chipctx, 0); // infinite number of loops
+ currentMusic[musicIndex].totalSamplesLeft = jar_xm_get_remaining_samples(currentMusic[musicIndex].chipctx);
+ currentMusic[musicIndex].totalLengthSeconds = ((float)currentMusic[musicIndex].totalSamplesLeft) / 48000.f;
musicEnabled = true;
- TraceLog(INFO, "[%s] XM number of samples: %i", fileName, currentMusic.totalSamplesLeft);
- TraceLog(INFO, "[%s] XM track length: %11.6f sec", fileName, currentMusic.totalLengthSeconds);
+ TraceLog(INFO, "[%s] XM number of samples: %i", fileName, currentMusic[musicIndex].totalSamplesLeft);
+ TraceLog(INFO, "[%s] XM track length: %11.6f sec", fileName, currentMusic[musicIndex].totalLengthSeconds);
- // Set up OpenAL
- alGenSources(1, &currentMusic.source);
- alSourcef(currentMusic.source, AL_PITCH, 1);
- alSourcef(currentMusic.source, AL_GAIN, 1);
- alSource3f(currentMusic.source, AL_POSITION, 0, 0, 0);
- alSource3f(currentMusic.source, AL_VELOCITY, 0, 0, 0);
- alGenBuffers(2, currentMusic.buffers);
- BufferMusicStream(currentMusic.buffers[0]);
- BufferMusicStream(currentMusic.buffers[1]);
- alSourceQueueBuffers(currentMusic.source, 2, currentMusic.buffers);
- alSourcePlay(currentMusic.source);
-
- // NOTE: Regularly, we must check if a buffer has been processed and refill it: UpdateMusicStream()
+ currentMusic[musicIndex].ctx = InitAudioContext(48000, mixIndex, 2, true);
+ }
+ else
+ {
+ TraceLog(WARNING, "[%s] XM file could not be opened", fileName);
+ return 4; // error
}
- else TraceLog(WARNING, "[%s] XM file could not be opened", fileName);
}
- else TraceLog(WARNING, "[%s] Music extension not recognized, it can't be loaded", fileName);
+ else
+ {
+ TraceLog(WARNING, "[%s] Music extension not recognized, it can't be loaded", fileName);
+ return 5; // error
+ }
+ return 0; // normal return
}
-// Stop music playing (close stream)
-void StopMusicStream(void)
+// Stop music playing for individual music index of currentMusic array (close stream)
+void StopMusicStream(int index)
{
- if (musicEnabled)
+ if (index < MAX_MUSIC_STREAMS && currentMusic[index].ctx)
{
- alSourceStop(currentMusic.source);
- EmptyMusicStream(); // Empty music buffers
- alDeleteSources(1, &currentMusic.source);
- alDeleteBuffers(2, currentMusic.buffers);
+ CloseAudioContext(currentMusic[index].ctx);
- if (currentMusic.chipTune)
+ if (currentMusic[index].chipTune)
{
- jar_xm_free_context(currentMusic.chipctx);
+ jar_xm_free_context(currentMusic[index].chipctx);
}
else
{
- stb_vorbis_close(currentMusic.stream);
+ stb_vorbis_close(currentMusic[index].stream);
}
+
+ if(!getMusicStreamCount()) musicEnabled = false;
}
+}
- musicEnabled = false;
+//get number of music channels active at this time, this does not mean they are playing
+int getMusicStreamCount(void)
+{
+ int musicCount;
+ for(int musicIndex = 0; musicIndex < MAX_MUSIC_STREAMS; musicIndex++) // find empty music slot
+ if(currentMusic[musicIndex].stream != NULL || currentMusic[musicIndex].chipTune) musicCount++;
+
+ return musicCount;
}
// Pause music playing
-void PauseMusicStream(void)
+void PauseMusicStream(int index)
{
// Pause music stream if music available!
if (musicEnabled)
{
TraceLog(INFO, "Pausing music stream");
- alSourcePause(currentMusic.source);
+ UpdateAudioContext(currentMusic[index].ctx, NULL, 0); // pushing null data auto pauses stream
musicEnabled = false;
}
}
// Resume music playing
-void ResumeMusicStream(void)
+void ResumeMusicStream(int index)
{
// Resume music playing... if music available!
ALenum state;
- alGetSourcei(currentMusic.source, AL_SOURCE_STATE, &state);
-
- if (state == AL_PAUSED)
- {
- TraceLog(INFO, "Resuming music stream");
- alSourcePlay(currentMusic.source);
- musicEnabled = true;
+ if(currentMusic[musicIndex].ctx){
+ alGetSourcei(currentMusic[musicIndex].ctx->alSource, AL_SOURCE_STATE, &state);
+ if (state == AL_PAUSED)
+ {
+ TraceLog(INFO, "Resuming music stream");
+ alSourcePlay(currentMusic[musicIndex].ctx->alSource);
+ musicEnabled = true;
+ }
}
}
-// Check if music is playing
-bool IsMusicPlaying(void)
+// Check if any music is playing
+bool IsMusicPlaying(int index)
{
bool playing = false;
ALint state;
-
- alGetSourcei(currentMusic.source, AL_SOURCE_STATE, &state);
- if (state == AL_PLAYING) playing = true;
+
+ if(index < MAX_MUSIC_STREAMS && currentMusic[index].ctx){
+ alGetSourcei(currentMusic[index].ctx->alSource, AL_SOURCE_STATE, &state);
+ if (state == AL_PLAYING) playing = true;
+ }
return playing;
}
// Set volume for music
-void SetMusicVolume(float volume)
+void SetMusicVolume(int index, float volume)
{
- alSourcef(currentMusic.source, AL_GAIN, volume);
+ if(index < MAX_MUSIC_STREAMS && currentMusic[index].ctx){
+ alSourcef(currentMusic[index].ctx->alSource, AL_GAIN, volume);
+ }
+}
+
+void SetMusicPitch(int index, float pitch)
+{
+ if(index < MAX_MUSIC_STREAMS && currentMusic[index].ctx){
+ alSourcef(currentMusic[index].ctx->alSource, AL_PITCH, pitch);
+ }
}
// Get current music time length (in seconds)
-float GetMusicTimeLength(void)
+float GetMusicTimeLength(int index)
{
float totalSeconds;
- if (currentMusic.chipTune)
+ if (currentMusic[index].chipTune)
{
- totalSeconds = currentMusic.totalLengthSeconds;
+ totalSeconds = currentMusic[index].totalLengthSeconds;
}
else
{
- totalSeconds = stb_vorbis_stream_length_in_seconds(currentMusic.stream);
+ totalSeconds = stb_vorbis_stream_length_in_seconds(currentMusic[index].stream);
}
return totalSeconds;
}
// Get current music time played (in seconds)
-float GetMusicTimePlayed(void)
+float GetMusicTimePlayed(int index)
{
float secondsPlayed;
- if (currentMusic.chipTune)
+ if (currentMusic[index].chipTune)
{
uint64_t samples;
- jar_xm_get_position(currentMusic.chipctx, NULL, NULL, NULL, &samples);
- secondsPlayed = (float)samples / (currentMusic.sampleRate * currentMusic.channels); // Not sure if this is the correct value
+ jar_xm_get_position(currentMusic[index].chipctx, NULL, NULL, NULL, &samples);
+ secondsPlayed = (float)samples / (48000 * currentMusic[index].ctx->channels); // Not sure if this is the correct value
}
else
{
- int totalSamples = stb_vorbis_stream_length_in_samples(currentMusic.stream) * currentMusic.channels;
- int samplesPlayed = totalSamples - currentMusic.totalSamplesLeft;
- secondsPlayed = (float)samplesPlayed / (currentMusic.sampleRate * currentMusic.channels);
+ int totalSamples = stb_vorbis_stream_length_in_samples(currentMusic[index].stream) * currentMusic[index].ctx->channels;
+ int samplesPlayed = totalSamples - currentMusic[index].totalSamplesLeft;
+ secondsPlayed = (float)samplesPlayed / (currentMusic[index].ctx->sampleRate * currentMusic[index].ctx->channels);
}
@@ -977,9 +970,10 @@ float GetMusicTimePlayed(void)
//----------------------------------------------------------------------------------
// Fill music buffers with new data from music stream
-static bool BufferMusicStream(ALuint buffer)
+static bool BufferMusicStream(int index)
{
short pcm[MUSIC_BUFFER_SIZE_SHORT];
+ float pcmf[MUSIC_BUFFER_SIZE_FLOAT];
int size = 0; // Total size of data steamed (in bytes)
int streamedBytes = 0; // samples of data obtained, channels are not included in calculation
@@ -987,106 +981,80 @@ static bool BufferMusicStream(ALuint buffer)
if (musicEnabled)
{
- if (currentMusic.chipTune) // There is no end of stream for xmfiles, once the end is reached zeros are generated for non looped chiptunes.
+ if (currentMusic[index].chipTune) // There is no end of stream for xmfiles, once the end is reached zeros are generated for non looped chiptunes.
{
- int readlen = MUSIC_BUFFER_SIZE_SHORT / 2;
- jar_xm_generate_samples_16bit(currentMusic.chipctx, pcm, readlen); // reads 2*readlen shorts and moves them to buffer+size memory location
- size += readlen * currentMusic.channels; // Not sure if this is what it needs
+ int readlen = MUSIC_BUFFER_SIZE_FLOAT / 2;
+ jar_xm_generate_samples(currentMusic[index].chipctx, pcmf, readlen); // reads 2*readlen shorts and moves them to buffer+size memory location
+ UpdateAudioContext(currentMusic[index].ctx, pcmf, MUSIC_BUFFER_SIZE_FLOAT);
+ size += readlen * currentMusic[index].ctx->channels; // Not sure if this is what it needs
+ currentMusic[index].totalSamplesLeft -= size;
+ if(currentMusic[index].totalSamplesLeft <= 0) active = false;
}
else
{
- while (size < MUSIC_BUFFER_SIZE_SHORT)
- {
- streamedBytes = stb_vorbis_get_samples_short_interleaved(currentMusic.stream, currentMusic.channels, pcm + size, MUSIC_BUFFER_SIZE_SHORT - size);
- if (streamedBytes > 0) size += (streamedBytes*currentMusic.channels);
- else break;
- }
+ streamedBytes = stb_vorbis_get_samples_short_interleaved(currentMusic[index].stream, currentMusic[index].ctx->channels, pcm, MUSIC_BUFFER_SIZE_SHORT);
+ UpdateAudioContext(currentMusic[index].ctx, pcm, MUSIC_BUFFER_SIZE_SHORT);
+ currentMusic[index].totalSamplesLeft -= MUSIC_BUFFER_SIZE_SHORT;
+ if(currentMusic[index].totalSamplesLeft <= 0) active = false;
}
TraceLog(DEBUG, "Streaming music data to buffer. Bytes streamed: %i", size);
}
- if (size > 0)
- {
- alBufferData(buffer, currentMusic.format, pcm, size*sizeof(short), currentMusic.sampleRate);
- currentMusic.totalSamplesLeft -= size;
-
- if(currentMusic.totalSamplesLeft <= 0) active = false; // end if no more samples left
- }
- else
- {
- active = false;
- TraceLog(WARNING, "No more data obtained from stream");
- }
-
return active;
}
// Empty music buffers
-static void EmptyMusicStream(void)
+static void EmptyMusicStream(int index)
{
ALuint buffer = 0;
int queued = 0;
- alGetSourcei(currentMusic.source, AL_BUFFERS_QUEUED, &queued);
+ alGetSourcei(currentMusic[index].source, AL_BUFFERS_QUEUED, &queued);
while (queued > 0)
{
- alSourceUnqueueBuffers(currentMusic.source, 1, &buffer);
+ alSourceUnqueueBuffers(currentMusic[index].source, 1, &buffer);
queued--;
}
}
// Update (re-fill) music buffers if data already processed
-void UpdateMusicStream(void)
+void UpdateMusicStream(int index)
{
- ALuint buffer = 0;
- ALint processed = 0;
+ ALenum state;
bool active = true;
- if (musicEnabled)
+ if (index < MAX_MUSIC_STREAMS && musicEnabled)
{
- // Get the number of already processed buffers (if any)
- alGetSourcei(currentMusic.source, AL_BUFFERS_PROCESSED, &processed);
-
- while (processed > 0)
+ active = BufferMusicStream(index);
+
+ if ((!active) && (currentMusic[index].loop))
{
- // Recover processed buffer for refill
- alSourceUnqueueBuffers(currentMusic.source, 1, &buffer);
-
- // Refill buffer
- active = BufferMusicStream(buffer);
-
- // If no more data to stream, restart music (if loop)
- if ((!active) && (currentMusic.loop))
+ if(currentMusic[index].chipTune)
{
- if(currentMusic.chipTune)
- {
- currentMusic.totalSamplesLeft = currentMusic.totalLengthSeconds * currentMusic.sampleRate;
- }
- else
- {
- stb_vorbis_seek_start(currentMusic.stream);
- currentMusic.totalSamplesLeft = stb_vorbis_stream_length_in_samples(currentMusic.stream)*currentMusic.channels;
- }
- active = BufferMusicStream(buffer);
+ currentMusic[index].totalSamplesLeft = currentMusic[index].totalLengthSeconds * currentMusic[index].ctx->sampleRate;
}
+ else
+ {
+ stb_vorbis_seek_start(currentMusic[index].stream);
+ currentMusic[index].totalSamplesLeft = stb_vorbis_stream_length_in_samples(currentMusic[index].stream)*currentMusic[index].ctx->channels;
+ }
+ active = BufferMusicStream(index);
+ }
+
- // Add refilled buffer to queue again... don't let the music stop!
- alSourceQueueBuffers(currentMusic.source, 1, &buffer);
-
- if (alGetError() != AL_NO_ERROR) TraceLog(WARNING, "Error buffering data...");
+ if (alGetError() != AL_NO_ERROR) TraceLog(WARNING, "Error buffering data...");
- processed--;
- }
+ processed--;
+ }
- ALenum state;
- alGetSourcei(currentMusic.source, AL_SOURCE_STATE, &state);
+
+ alGetSourcei(currentMusic[index].source, AL_SOURCE_STATE, &state);
- if ((state != AL_PLAYING) && active) alSourcePlay(currentMusic.source);
+ if ((state != AL_PLAYING) && active) alSourcePlay(currentMusic[index].source);
- if (!active) StopMusicStream();
- }
+ if (!active) StopMusicStream();
}
// Load WAV file into Wave structure
diff --git a/src/audio.h b/src/audio.h
index afd881b7..63c1c136 100644
--- a/src/audio.h
+++ b/src/audio.h
@@ -100,15 +100,17 @@ 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 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 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);
#ifdef __cplusplus
}
diff --git a/src/easings.h b/src/easings.h
index e1e5465a..a8178f4a 100644
--- a/src/easings.h
+++ b/src/easings.h
@@ -18,11 +18,11 @@
* float speed = 1.f;
* float currentTime = 0.f;
* float currentPos[2] = {0,0};
-* float newPos[2] = {1,1};
-* float tempPosition[2] = currentPos;//x,y positions
-* while(currentPos[0] < newPos[0])
-* currentPos[0] = EaseSineIn(currentTime, tempPosition[0], tempPosition[0]-newPos[0], speed);
-* currentPos[1] = EaseSineIn(currentTime, tempPosition[1], tempPosition[1]-newPos[0], speed);
+* float finalPos[2] = {1,1};
+* float startPosition[2] = currentPos;//x,y positions
+* while(currentPos[0] < finalPos[0])
+* currentPos[0] = EaseSineIn(currentTime, startPosition[0], startPosition[0]-finalPos[0], speed);
+* currentPos[1] = EaseSineIn(currentTime, startPosition[1], startPosition[1]-finalPos[0], speed);
* currentTime += diffTime();
*
* A port of Robert Penner's easing equations to C (http://robertpenner.com/easing/)
diff --git a/src/raylib.h b/src/raylib.h
index 911fd8b5..ea9fbfcb 100644
--- a/src/raylib.h
+++ b/src/raylib.h
@@ -894,15 +894,17 @@ 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);
#ifdef __cplusplus
}