Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix playmus.py example (broken in 2.0.1) #2738

Closed
wants to merge 5 commits into from
Closed

Fix playmus.py example (broken in 2.0.1) #2738

wants to merge 5 commits into from

Conversation

rethanon
Copy link
Contributor

@rethanon rethanon commented Sep 28, 2021

This PR is to fix an issue with the bundled example file playmus.py which stopped working correctly as of pygame 2.0.1 due to a change in returning False for pygame.mixer.music.get_busy() when music is paused (previously returned True).

Also tidied up the wording a little bit and fixed a typo.

Issue was raised #2734

Copy link
Contributor

@Starbuck5 Starbuck5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is great!

Think it would be prettier with some different colors? The blue on white isn't the prettiest on the eyes.

@Starbuck5 Starbuck5 linked an issue Sep 28, 2021 that may be closed by this pull request
@Starbuck5
Copy link
Contributor

If I play a .wav I can't rewind, but if I play a .mp3 I can?

Also another thing I've found that isn't ideal- you can't close the window when in a paused state.

@rethanon
Copy link
Contributor Author

Thanks I'll resubmit with updated color scheme and I've fixed the being able to quit when a track is paused. I'll have a look at not being able to rewind a wav but I'm getting the same, could be a deeper issue causing that one.

@rethanon
Copy link
Contributor Author

rethanon commented Sep 29, 2021

@Starbuck5 I checked the SDL_Mixer docs and it states rewind only works for MOD, OGG, MP3, and Native MIDI. Presume that's still the case, although their website seems to indicate the latest version of SDL_Mixer is version 2.0.4 yet the docs don't appear to have been updated in a long time (they refer to SDL_mixer version 1.2.10, dated November 2009!)

Fixed issue where music is paused, the program couldn't be exited.

Change colors for background and text.
@Starbuck5
Copy link
Contributor

Thanks for all the investigation! The SDL_Mixer docs are old but it has a very stable interface throughout the years. However, sometimes you have to dig into the SDL_Mixer source directly to see how things fit together. Maybe we should add a note that WAV doesn't support rewind to the mixer.music docs.

@rethanon
Copy link
Contributor Author

rethanon commented Sep 29, 2021

@Starbuck5 I've fixed this so that playmus.py will use rewind for MOD, MP3 and WAV files, and for anything else will restart (using pygame.mixer.music.play(). SDL_mixer docs say Native MIDI files are supported but I can't seem to find what this means. I tested with a standard .mid file and rewind wasn't working for that so I thought it better to just use rewind for the 3 main file types.

I had a go at updating the docs for pygame.mixer.music.rewind() but I still have that issue where I can't build the docs locally to test them so could you check them as well please?

…ported types

Updated to use play() to restart file types that don't support rewind().
Updated docs to note supported file types which are limited
@Starbuck5
Copy link
Contributor

I still have that issue where I can't build the docs locally to test them so could you check them as well please?

That's because you're using an old version of main, from like August.

@rethanon
Copy link
Contributor Author

I still have that issue where I can't build the docs locally to test them so could you check them as well please?

That's because you're using an old version of main, from like August.

Ah yeah, I was able to check the docs built correctly on my Mac machine instead.

@rethanon
Copy link
Contributor Author

rethanon commented Oct 4, 2021

Closing this so I can rebase code and will then raise a new PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Playmus example is broken
2 participants