Skip to content

load music considered harmful? #5

@soupi

Description

@soupi

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 of Music I kept a Map of ByteString which is the result of readFile and I played music using playMusic 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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions