mirror of
https://github.com/raysan5/raylib.git
synced 2025-12-16 03:15:40 +00:00
Complete review of audio system
Still some work left...
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user