From 9cbbf149d823237927fbd915b8c17bad64ee20bb Mon Sep 17 00:00:00 2001 From: Ray Date: Tue, 2 Aug 2022 10:23:54 +0200 Subject: [PATCH] Update audio_music_stream.c --- examples/audio/audio_music_stream.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/examples/audio/audio_music_stream.c b/examples/audio/audio_music_stream.c index ade7cebc..44b1faf0 100644 --- a/examples/audio/audio_music_stream.c +++ b/examples/audio/audio_music_stream.c @@ -43,6 +43,22 @@ int main(void) // Update //---------------------------------------------------------------------------------- UpdateMusicStream(music); // Update music buffer with new stream data + + // Restart music playing (stop and play) + if (IsKeyPressed(KEY_SPACE)) + { + StopMusicStream(music); + PlayMusicStream(music); + } + + // Pause/Resume music playing + if (IsKeyPressed(KEY_P)) + { + pause = !pause; + + if (pause) PauseMusicStream(music); + else ResumeMusicStream(music); + } // Get normalized time played for current music stream timePlayed = GetMusicTimePlayed(music)/GetMusicTimeLength(music);