mirror of
https://github.com/raysan5/raylib.git
synced 2026-01-31 03:09:17 -05:00
Complete review of audio system
Still some work left...
This commit is contained in:
@ -24,7 +24,9 @@ int main()
|
||||
|
||||
InitAudioDevice(); // Initialize audio device
|
||||
|
||||
PlayMusicStream(0, "resources/audio/guitar_noodling.ogg"); // Play music stream
|
||||
Music music = LoadMusicStream("resources/audio/guitar_noodling.ogg");
|
||||
|
||||
PlayMusicStream(music);
|
||||
|
||||
int framesCounter = 0;
|
||||
float timePlayed = 0.0f;
|
||||
@ -58,12 +60,12 @@ int main()
|
||||
SetMusicVolume(volume);
|
||||
}
|
||||
*/
|
||||
if (IsWindowMinimized()) PauseMusicStream(0);
|
||||
else ResumeMusicStream(0);
|
||||
if (IsWindowMinimized()) PauseMusicStream(music);
|
||||
else ResumeMusicStream(music);
|
||||
|
||||
timePlayed = GetMusicTimePlayed(0)/GetMusicTimeLength(0)*100*4; // We scale by 4 to fit 400 pixels
|
||||
|
||||
UpdateMusicStream(0); // Update music buffer with new stream data
|
||||
timePlayed = GetMusicTimePlayed(music)/GetMusicTimeLength(music)*100*4; // We scale by 4 to fit 400 pixels
|
||||
|
||||
UpdateMusicStream(music); // Update music buffer with new stream data
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
@ -83,9 +85,11 @@ int main()
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
CloseAudioDevice(); // Close audio device (music streaming is automatically stopped)
|
||||
UnloadMusicStream(music); // Unload music stream buffers from RAM
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
CloseAudioDevice(); // Close audio device (music streaming is automatically stopped)
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user