Complete review of audio system

Still some work left...
This commit is contained in:
raysan5 2016-08-01 12:49:17 +02:00
parent a61b832c4a
commit 02c456432d
6 changed files with 483 additions and 804 deletions

View file

@ -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