summaryrefslogtreecommitdiffhomepage
path: root/src/audio.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/audio.c')
-rw-r--r--src/audio.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/audio.c b/src/audio.c
index d29ad1ba..48e33d19 100644
--- a/src/audio.c
+++ b/src/audio.c
@@ -1426,6 +1426,13 @@ void UpdateMusicStream(Music music)
music->loopCount--; // Decrease loop count
PlayMusicStream(music); // Play again
}
+ else
+ {
+ if (music->loopCount == -1)
+ {
+ PlayMusicStream(music);
+ }
+ }
}
else
{
@@ -1506,6 +1513,13 @@ void UpdateMusicStream(Music music)
music->loopCount--; // Decrease loop count
PlayMusicStream(music); // Play again
}
+ else
+ {
+ if (music->loopCount == -1)
+ {
+ PlayMusicStream(music);
+ }
+ }
}
else
{
@@ -1537,13 +1551,21 @@ bool IsMusicPlaying(Music music)
// Set volume for music
void SetMusicVolume(Music music, float volume)
{
+#if USE_MINI_AL
+ SetAudioStreamVolume(music->stream, volume);
+#else
alSourcef(music->stream.source, AL_GAIN, volume);
+#endif
}
// Set pitch for music
void SetMusicPitch(Music music, float pitch)
{
+#if USE_MINI_AL
+ SetAudioStreamPitch(music->stream, pitch);
+#else
alSourcef(music->stream.source, AL_PITCH, pitch);
+#endif
}
// Set music loop count (loop repeats)
@@ -1964,6 +1986,38 @@ void StopAudioStream(AudioStream stream)
#endif
}
+void SetAudioStreamVolume(AudioStream stream, float volume)
+{
+#if USE_MINI_AL
+ AudioStreamData* internalData = (AudioStreamData*)stream.handle;
+ if (internalData == NULL)
+ {
+ TraceLog(LOG_ERROR, "Invalid audio stream");
+ return;
+ }
+
+ internalData->volume = volume;
+#else
+ alSourcef(stream.source, AL_GAIN, volume);
+#endif
+}
+
+void SetAudioStreamPitch(AudioStream stream, float pitch)
+{
+#if USE_MINI_AL
+ AudioStreamData* internalData = (AudioStreamData*)stream.handle;
+ if (internalData == NULL)
+ {
+ TraceLog(LOG_ERROR, "Invalid audio stream");
+ return;
+ }
+
+ internalData->pitch = pitch;
+#else
+ alSourcef(stream.source, AL_PITCH, pitch);
+#endif
+}
+
//----------------------------------------------------------------------------------
// Module specific Functions Definition
//----------------------------------------------------------------------------------