summaryrefslogtreecommitdiffhomepage
path: root/examples/audio_module_playing.c
diff options
context:
space:
mode:
authorraysan5 <[email protected]>2016-08-01 12:49:17 +0200
committerraysan5 <[email protected]>2016-08-01 12:49:17 +0200
commit02c456432d7f284c41519f6d540ad6c4dfb4a065 (patch)
tree2c59dab7bc67e2ae7164d942535bd3d77f3809cf /examples/audio_module_playing.c
parenta61b832c4ad976ab083cfebf8039149c2a7022f8 (diff)
downloadraylib-02c456432d7f284c41519f6d540ad6c4dfb4a065.tar.gz
raylib-02c456432d7f284c41519f6d540ad6c4dfb4a065.zip
Complete review of audio system
Still some work left...
Diffstat (limited to 'examples/audio_module_playing.c')
-rw-r--r--examples/audio_module_playing.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/examples/audio_module_playing.c b/examples/audio_module_playing.c
index 6189b866..07165c76 100644
--- a/examples/audio_module_playing.c
+++ b/examples/audio_module_playing.c
@@ -57,7 +57,9 @@ int main()
// Create a RenderTexture2D to be used for render to texture
RenderTexture2D target = LoadRenderTexture(screenWidth, screenHeight);
- PlayMusicStream(0, "resources/audio/2t2m_spa.xm"); // Play module stream
+ Music xm = LoadMusicStream("resources/audio/2t2m_spa.xm");
+
+ PlayMusicStream(xm);
float timePlayed = 0.0f;
@@ -88,9 +90,9 @@ int main()
}
// Get timePlayed scaled to bar dimensions
- timePlayed = (GetMusicTimePlayed(0)/GetMusicTimeLength(0)*(screenWidth - 40))*2;
+ timePlayed = (GetMusicTimePlayed(xm)/GetMusicTimeLength(xm)*(screenWidth - 40))*2;
- UpdateMusicStream(0); // Update music buffer with new stream data
+ UpdateMusicStream(xm); // Update music buffer with new stream data
//----------------------------------------------------------------------------------
// Draw
@@ -129,6 +131,8 @@ int main()
UnloadShader(shader); // Unload shader
UnloadRenderTexture(target); // Unload render texture
+ UnloadMusicStream(xm); // Unload music stream buffers from RAM
+
CloseAudioDevice(); // Close audio device (music streaming is automatically stopped)
CloseWindow(); // Close window and OpenGL context