{"action":"created","issue":{"url":"https://api.github.com/repos/ggez/ggez/issues/208","repository_url":"https://api.github.com/repos/ggez/ggez","labels_url":"https://api.github.com/repos/ggez/ggez/issues/208/labels{/name}","comments_url":"https://api.github.com/repos/ggez/ggez/issues/208/comments","events_url":"https://api.github.com/repos/ggez/ggez/issues/208/events","html_url":"https://github.com/ggez/ggez/issues/208","id":275714977,"number":208,"title":"Stop sound before append","user":{"login":"rap2hpoutre","id":1575946,"avatar_url":"https://avatars3.githubusercontent.com/u/1575946?v=4","gravatar_id":"","url":"https://api.github.com/users/rap2hpoutre","html_url":"https://github.com/rap2hpoutre","followers_url":"https://api.github.com/users/rap2hpoutre/followers","following_url":"https://api.github.com/users/rap2hpoutre/following{/other_user}","gists_url":"https://api.github.com/users/rap2hpoutre/gists{/gist_id}","starred_url":"https://api.github.com/users/rap2hpoutre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rap2hpoutre/subscriptions","organizations_url":"https://api.github.com/users/rap2hpoutre/orgs","repos_url":"https://api.github.com/users/rap2hpoutre/repos","events_url":"https://api.github.com/users/rap2hpoutre/events{/privacy}","received_events_url":"https://api.github.com/users/rap2hpoutre/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-11-21T13:39:23Z","updated_at":"2017-11-21T17:11:09Z","closed_at":null,"author_association":"NONE","body":"Sometimes, when I call play twice on the same `audio::Source`, I don't want to just append the sound *after* the same sound, I would prefer stopping the previous one and play the new one. Uh, not sure it's clear. Let's try something else. Think about double jump in a game: I would like to cut the previous jump sound with the second one. Not waiting the first one to finish before appending the second one.\r\n\r\nI tried to call `stop` before playing but it seems `stop` is called after the actual play (I'm not clear, again, sorry). It means that if I add this line:\r\n\r\n```\r\nself.sink.stop();\r\n```\r\n... in the `play` method (it's just a test, I don't want to modify the lib) of `audio.rs` like this:\r\n\r\n```\r\npub fn play(&self) -> GameResult<()> {\r\n    // Creating a new Decoder each time seems a little messy,\r\n    // since it may do checking and data-type detection that is\r\n    // redundant, but it's not super expensive.\r\n    // See https://github.com/ggez/ggez/issues/98 for discussion\r\n    let cursor = self.data.clone();\r\n    let decoder = rodio::Decoder::new(cursor)?;\r\n    self.sink.stop();\r\n    self.sink.append(decoder);\r\n    Ok(())\r\n}\r\n```\r\n\r\nIt plays and cuts the sound in the same cycle(?) or microsecond.\r\n\r\nDoes this request have an interest for this crate? Did I missed something?"},"comment":{"url":"https://api.github.com/repos/ggez/ggez/issues/comments/346095493","html_url":"https://github.com/ggez/ggez/issues/208#issuecomment-346095493","issue_url":"https://api.github.com/repos/ggez/ggez/issues/208","id":346095493,"user":{"login":"icefoxen","id":1335133,"avatar_url":"https://avatars3.githubusercontent.com/u/1335133?v=4","gravatar_id":"","url":"https://api.github.com/users/icefoxen","html_url":"https://github.com/icefoxen","followers_url":"https://api.github.com/users/icefoxen/followers","following_url":"https://api.github.com/users/icefoxen/following{/other_user}","gists_url":"https://api.github.com/users/icefoxen/gists{/gist_id}","starred_url":"https://api.github.com/users/icefoxen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/icefoxen/subscriptions","organizations_url":"https://api.github.com/users/icefoxen/orgs","repos_url":"https://api.github.com/users/icefoxen/repos","events_url":"https://api.github.com/users/icefoxen/events{/privacy}","received_events_url":"https://api.github.com/users/icefoxen/received_events","type":"User","site_admin":false},"created_at":"2017-11-21T17:11:09Z","updated_at":"2017-11-21T17:11:09Z","author_association":"CONTRIBUTOR","body":"I get what you mean, it is definitely something that we should be able to do."}}
{"actor":{"display_login":"icefoxen"}}