{"action":"opened","issue":{"url":"https://api.github.com/repos/haskell-game/sdl2-mixer/issues/5","repository_url":"https://api.github.com/repos/haskell-game/sdl2-mixer","labels_url":"https://api.github.com/repos/haskell-game/sdl2-mixer/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/haskell-game/sdl2-mixer/issues/5/comments","events_url":"https://api.github.com/repos/haskell-game/sdl2-mixer/issues/5/events","html_url":"https://github.com/haskell-game/sdl2-mixer/issues/5","id":336746674,"node_id":"MDU6SXNzdWUzMzY3NDY2NzQ=","number":5,"title":"load music considered harmful?","user":{"login":"soupi","id":8547573,"node_id":"MDQ6VXNlcjg1NDc1NzM=","avatar_url":"https://avatars0.githubusercontent.com/u/8547573?v=4","gravatar_id":"","url":"https://api.github.com/users/soupi","html_url":"https://github.com/soupi","followers_url":"https://api.github.com/users/soupi/followers","following_url":"https://api.github.com/users/soupi/following{/other_user}","gists_url":"https://api.github.com/users/soupi/gists{/gist_id}","starred_url":"https://api.github.com/users/soupi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/soupi/subscriptions","organizations_url":"https://api.github.com/users/soupi/orgs","repos_url":"https://api.github.com/users/soupi/repos","events_url":"https://api.github.com/users/soupi/events{/privacy}","received_events_url":"https://api.github.com/users/soupi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-28T19:17:29Z","updated_at":"2018-06-28T19:17:29Z","closed_at":null,"author_association":"NONE","body":"sorry for the generic title.\r\n\r\nI just finished debugging an issue where I used `load` to read a music file from disk and play it.\r\nI also kept all the `Music` values I loaded in a Map.\r\nI ran into all kinds of strange bugs, music jumping forward at a specific place,\r\ntrying to play music I already played wouldn't do anything after playing something else, music starting from the middle of the file, etc.\r\n\r\nThen 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.\r\n\r\nAm I correct in my assumptions? Maybe the `load` API is problematic and should be removed?\r\n\r\nI just wanted to share this so it might help others if they trip on these kind of bugs.\r\n\r\nThanks!\r\n"}}
{"actor":{"display_login":"soupi"}}