Simple Music Player
With control flow we can now build a simple music player that lets the user load and play songs. This program will:
- Show a menu for the user to select from
- Allows the user to load a song from a file
- Outputs a message to confirm if the music file was loaded
- Allows the user to play a song
- Will output a message if they try to play something they have not loaded
- Allows the user to stop the music
- Will output a message if they try to stop music and nothing is playing
Here is an example of the output from this:
Welcome to my simple music player
1: Load song2: Play song3: Stop song4: QuitOption: 1
What is the name of the song: TestPath to the file: /c/Users/andrew/Downloads/test.oggg
Loading /c/Users/andrew/Downloads/test.oggg failed!
1: Load song2: Play song3: Stop song4: QuitOption: 3
No music is playing playing
1: Load song2: Play song3: Stop song4: QuitOption: 1
What is the name of the song: TestPath to the file: /c/Users/andrew/Downloads/test.ogg
Loading /c/Users/andrew/Downloads/test.ogg passed!
1: Load song2: Play song3: Stop song4: QuitOption: 2
What is the name of the song: my songThere is nothing called 'my song' loaded
1: Load song2: Play song3: Stop song4: QuitOption: 2
What is the name of the song: Test(music starts playing)
1: Load song2: Play song3: Stop song4: QuitOption: 4
Bye