Complete review of audio system
Still some work left...
This commit is contained in:
parent
a61b832c4a
commit
02c456432d
6 changed files with 483 additions and 804 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue