The music player uses a global dictionary, and has a variety of issues associated with that.
A music player should be able to:
Keep track of the current song playing
Get the previous song played
Get the next song to play
Pause/Continue
The global dictionary does not support this.
A better collection should be used. A linked list would be very good for this situation. Other collections like a hashmap would work too.
There needs to be some way to track the state of the currently playing song. This would allow messages to be sent when the song ends so that the next song can play. A problem that could arise here is an infinite loop constantly checking the status of the song and blocking the game from playing.
The music player uses a global dictionary, and has a variety of issues associated with that.
A music player should be able to:
- Keep track of the current song playing
- Get the previous song played
- Get the next song to play
- Pause/Continue
The global dictionary does not support this.
A better collection should be used. A linked list would be very good for this situation. Other collections like a hashmap would work too.
There needs to be some way to track the state of the currently playing song. This would allow messages to be sent when the song ends so that the next song can play. A problem that could arise here is an infinite loop constantly checking the status of the song and blocking the game from playing.
I agree with all of that. The current issue is I don’t know of a way of checking the song position without using a different library. So that is step 1 I think.
Only the state and controls need to be in the global dict, the playlist and previous/next tracks can be moved locally.
I agree with all of that. The current issue is I don't know of a way of checking the song position without using a different library. So that is step 1 I think.
Only the state and controls need to be in the global dict, the playlist and previous/next tracks can be moved locally.
Why does anything need to be in the global dict? If the music player class is the only one who knows about the music player, then why bother with the global vars?
Why does anything need to be in the global dict? If the music player class is the only one who knows about the music player, then why bother with the global vars?
Almost everything gets the input status from global dict. I guess the only thing the music player needs to send out is the song name and the player status (playing/not). This is read from global dict on the overlay scene. If there’s a better way to pass the info I’m all for it, but this seems simplest and cleanest. :shrug:
I think you are thinking more about just abstracting the controls and status out of the player? That’s fine. For example we could just send requests to the component for play/pause and have it return track info.
Almost everything gets the input status from global dict. I guess the only thing the music player needs to send out is the song name and the player status (playing/not). This is read from global dict on the overlay scene. If there's a better way to pass the info I'm all for it, but this seems simplest and cleanest. :shrug:
I think you are thinking more about just abstracting the controls and status out of the player? That's fine. For example we could just send requests to the component for play/pause and have it return track info.
The music player uses a global dictionary, and has a variety of issues associated with that.
A music player should be able to:
The global dictionary does not support this.
A better collection should be used. A linked list would be very good for this situation. Other collections like a hashmap would work too.
There needs to be some way to track the state of the currently playing song. This would allow messages to be sent when the song ends so that the next song can play. A problem that could arise here is an infinite loop constantly checking the status of the song and blocking the game from playing.
I agree with all of that. The current issue is I don’t know of a way of checking the song position without using a different library. So that is step 1 I think.
Only the state and controls need to be in the global dict, the playlist and previous/next tracks can be moved locally.
Why does anything need to be in the global dict? If the music player class is the only one who knows about the music player, then why bother with the global vars?
Almost everything gets the input status from global dict. I guess the only thing the music player needs to send out is the song name and the player status (playing/not). This is read from global dict on the overlay scene. If there’s a better way to pass the info I’m all for it, but this seems simplest and cleanest. :shrug:
I think you are thinking more about just abstracting the controls and status out of the player? That’s fine. For example we could just send requests to the component for play/pause and have it return track info.
This issue is being handled by the Music Player branch. When the branch merges, this issue can be closed.
branch has been merged. considering this done for now.