forked from tempname11/sdl2-mixer
-
Notifications
You must be signed in to change notification settings - Fork 10
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
load music considered harmful? #5
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
sorry for the generic title.
I just finished debugging an issue where I used
load
to read a music file from disk and play it.I also kept all the
Music
values I loaded in a Map.I ran into all kinds of strange bugs, music jumping forward at a specific place,
trying to play music I already played wouldn't do anything after playing something else, music starting from the middle of the file, etc.
Then I thought that maybe the
ByteString
content of the file was garbage collected and/or overwritten or something. So instead of keeping a Map ofMusic
I kept a Map ofByteString
which is the result ofreadFile
and I played music usingplayMusic Forever <=< decode
. This fixed the issues I had.Am I correct in my assumptions? Maybe the
load
API is problematic and should be removed?I just wanted to share this so it might help others if they trip on these kind of bugs.
Thanks!
The text was updated successfully, but these errors were encountered: