{"action":"created","comment":{"url":"https://api.github.com/repos/aframevr/aframe/pulls/comments/80347616","id":80347616,"diff_hunk":"@@ -125,24 +127,48 @@ module.exports.Component = registerComponent('sound', {\n       evt.detail.cameraEl.getObject3D('camera').add(listener);\n     });\n \n-    sound = this.sound = new THREE.PositionalAudio(listener);\n-    el.setObject3D(this.attrName, sound);\n-\n-    sound.source.onended = function () {\n-      sound.onEnded();\n-      el.emit('sound-ended');\n-    };\n+    // Create [poolSize] audio instances and attach them to soundsPool\n+    this.soundsPool = new THREE.Group();\n+    for (var i = 0; i < this.data.poolSize; i++) {\n+      var sound = new THREE.PositionalAudio(listener);\n+      this.soundsPool.add(sound);\n+    }\n+    el.setObject3D(this.attrName, this.soundsPool);\n \n-    return sound;\n+    this.soundsPool.children.forEach(function (sound) {\n+      sound.source.onended = function () {\n+        sound.onEnded();\n+        el.emit('sound-ended', {index: i});\n+      };\n+    });\n   },\n \n   playSound: function () {\n-    if (!this.sound.source.buffer) { return; }\n-    this.sound.play();\n+    // Look for an unused sound in the pool and play it if found.\n+    for (var i = 0; i < this.soundsPool.children.length; i++) {","path":"src/components/sound.js","position":146,"original_position":146,"commit_id":"482a8ae790af2e8ad3bc4f8284bf2cdfc965a5e6","original_commit_id":"482a8ae790af2e8ad3bc4f8284bf2cdfc965a5e6","user":{"login":"fernandojsg","id":782511,"avatar_url":"https://avatars.githubusercontent.com/u/782511?v=3","gravatar_id":"","url":"https://api.github.com/users/fernandojsg","html_url":"https://github.com/fernandojsg","followers_url":"https://api.github.com/users/fernandojsg/followers","following_url":"https://api.github.com/users/fernandojsg/following{/other_user}","gists_url":"https://api.github.com/users/fernandojsg/gists{/gist_id}","starred_url":"https://api.github.com/users/fernandojsg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fernandojsg/subscriptions","organizations_url":"https://api.github.com/users/fernandojsg/orgs","repos_url":"https://api.github.com/users/fernandojsg/repos","events_url":"https://api.github.com/users/fernandojsg/events{/privacy}","received_events_url":"https://api.github.com/users/fernandojsg/received_events","type":"User","site_admin":false},"body":"I used because I use `return` to exit the method if a instance is found on the pool, otherwise I show the warning message. I'll change it to use foreach and some boolean variable `isFound` that will determine if the message will be shown or not","created_at":"2016-09-24T00:29:49Z","updated_at":"2016-09-24T00:29:49Z","html_url":"https://github.com/aframevr/aframe/pull/1934#discussion_r80347616","pull_request_url":"https://api.github.com/repos/aframevr/aframe/pulls/1934","_links":{"self":{"href":"https://api.github.com/repos/aframevr/aframe/pulls/comments/80347616"},"html":{"href":"https://github.com/aframevr/aframe/pull/1934#discussion_r80347616"},"pull_request":{"href":"https://api.github.com/repos/aframevr/aframe/pulls/1934"}}},"pull_request":{"url":"https://api.github.com/repos/aframevr/aframe/pulls/1934","id":86582868,"html_url":"https://github.com/aframevr/aframe/pull/1934","diff_url":"https://github.com/aframevr/aframe/pull/1934.diff","patch_url":"https://github.com/aframevr/aframe/pull/1934.patch","issue_url":"https://api.github.com/repos/aframevr/aframe/issues/1934","number":1934,"state":"open","locked":false,"title":"Added sounds pool to sound component","user":{"login":"fernandojsg","id":782511,"avatar_url":"https://avatars.githubusercontent.com/u/782511?v=3","gravatar_id":"","url":"https://api.github.com/users/fernandojsg","html_url":"https://github.com/fernandojsg","followers_url":"https://api.github.com/users/fernandojsg/followers","following_url":"https://api.github.com/users/fernandojsg/following{/other_user}","gists_url":"https://api.github.com/users/fernandojsg/gists{/gist_id}","starred_url":"https://api.github.com/users/fernandojsg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fernandojsg/subscriptions","organizations_url":"https://api.github.com/users/fernandojsg/orgs","repos_url":"https://api.github.com/users/fernandojsg/repos","events_url":"https://api.github.com/users/fernandojsg/events{/privacy}","received_events_url":"https://api.github.com/users/fernandojsg/received_events","type":"User","site_admin":false},"body":"**Description:** Added `pool` attribute to create a soundpool for the `sound` component. With that we could play multiple sound on the same instance at the same time, for example when you're shooting a gun multiple times.\r\n\r\n**Changes proposed:**\r\n- Add `pool` attribute, by default 1\r\n- Replace `this.sound` from the component with `this.soundsPool` that will store the multiple instances of the sound.\r\n- I've modified the `cursor` example adding a new cube that you could click quickly to see the effect.\r\n\r\n\r\nI didn't update the test yet until you validate the proposal.","created_at":"2016-09-23T21:19:54Z","updated_at":"2016-09-24T00:29:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e1cdd9ee7d54e799f9c6fc3ee427b1eab27547fd","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/aframevr/aframe/pulls/1934/commits","review_comments_url":"https://api.github.com/repos/aframevr/aframe/pulls/1934/comments","review_comment_url":"https://api.github.com/repos/aframevr/aframe/pulls/comments{/number}","comments_url":"https://api.github.com/repos/aframevr/aframe/issues/1934/comments","statuses_url":"https://api.github.com/repos/aframevr/aframe/statuses/482a8ae790af2e8ad3bc4f8284bf2cdfc965a5e6","head":{"label":"fernandojsg:soundpool","ref":"soundpool","sha":"482a8ae790af2e8ad3bc4f8284bf2cdfc965a5e6","user":{"login":"fernandojsg","id":782511,"avatar_url":"https://avatars.githubusercontent.com/u/782511?v=3","gravatar_id":"","url":"https://api.github.com/users/fernandojsg","html_url":"https://github.com/fernandojsg","followers_url":"https://api.github.com/users/fernandojsg/followers","following_url":"https://api.github.com/users/fernandojsg/following{/other_user}","gists_url":"https://api.github.com/users/fernandojsg/gists{/gist_id}","starred_url":"https://api.github.com/users/fernandojsg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fernandojsg/subscriptions","organizations_url":"https://api.github.com/users/fernandojsg/orgs","repos_url":"https://api.github.com/users/fernandojsg/repos","events_url":"https://api.github.com/users/fernandojsg/events{/privacy}","received_events_url":"https://api.github.com/users/fernandojsg/received_events","type":"User","site_admin":false},"repo":{"id":54497967,"name":"aframe","full_name":"fernandojsg/aframe","owner":{"login":"fernandojsg","id":782511,"avatar_url":"https://avatars.githubusercontent.com/u/782511?v=3","gravatar_id":"","url":"https://api.github.com/users/fernandojsg","html_url":"https://github.com/fernandojsg","followers_url":"https://api.github.com/users/fernandojsg/followers","following_url":"https://api.github.com/users/fernandojsg/following{/other_user}","gists_url":"https://api.github.com/users/fernandojsg/gists{/gist_id}","starred_url":"https://api.github.com/users/fernandojsg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fernandojsg/subscriptions","organizations_url":"https://api.github.com/users/fernandojsg/orgs","repos_url":"https://api.github.com/users/fernandojsg/repos","events_url":"https://api.github.com/users/fernandojsg/events{/privacy}","received_events_url":"https://api.github.com/users/fernandojsg/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/fernandojsg/aframe","description":"Building Blocks for the VR Web","fork":true,"url":"https://api.github.com/repos/fernandojsg/aframe","forks_url":"https://api.github.com/repos/fernandojsg/aframe/forks","keys_url":"https://api.github.com/repos/fernandojsg/aframe/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fernandojsg/aframe/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fernandojsg/aframe/teams","hooks_url":"https://api.github.com/repos/fernandojsg/aframe/hooks","issue_events_url":"https://api.github.com/repos/fernandojsg/aframe/issues/events{/number}","events_url":"https://api.github.com/repos/fernandojsg/aframe/events","assignees_url":"https://api.github.com/repos/fernandojsg/aframe/assignees{/user}","branches_url":"https://api.github.com/repos/fernandojsg/aframe/branches{/branch}","tags_url":"https://api.github.com/repos/fernandojsg/aframe/tags","blobs_url":"https://api.github.com/repos/fernandojsg/aframe/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fernandojsg/aframe/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fernandojsg/aframe/git/refs{/sha}","trees_url":"https://api.github.com/repos/fernandojsg/aframe/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fernandojsg/aframe/statuses/{sha}","languages_url":"https://api.github.com/repos/fernandojsg/aframe/languages","stargazers_url":"https://api.github.com/repos/fernandojsg/aframe/stargazers","contributors_url":"https://api.github.com/repos/fernandojsg/aframe/contributors","subscribers_url":"https://api.github.com/repos/fernandojsg/aframe/subscribers","subscription_url":"https://api.github.com/repos/fernandojsg/aframe/subscription","commits_url":"https://api.github.com/repos/fernandojsg/aframe/commits{/sha}","git_commits_url":"https://api.github.com/repos/fernandojsg/aframe/git/commits{/sha}","comments_url":"https://api.github.com/repos/fernandojsg/aframe/comments{/number}","issue_comment_url":"https://api.github.com/repos/fernandojsg/aframe/issues/comments{/number}","contents_url":"https://api.github.com/repos/fernandojsg/aframe/contents/{+path}","compare_url":"https://api.github.com/repos/fernandojsg/aframe/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fernandojsg/aframe/merges","archive_url":"https://api.github.com/repos/fernandojsg/aframe/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fernandojsg/aframe/downloads","issues_url":"https://api.github.com/repos/fernandojsg/aframe/issues{/number}","pulls_url":"https://api.github.com/repos/fernandojsg/aframe/pulls{/number}","milestones_url":"https://api.github.com/repos/fernandojsg/aframe/milestones{/number}","notifications_url":"https://api.github.com/repos/fernandojsg/aframe/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fernandojsg/aframe/labels{/name}","releases_url":"https://api.github.com/repos/fernandojsg/aframe/releases{/id}","deployments_url":"https://api.github.com/repos/fernandojsg/aframe/deployments","created_at":"2016-03-22T18:09:23Z","updated_at":"2016-03-22T18:09:25Z","pushed_at":"2016-09-24T00:20:54Z","git_url":"git://github.com/fernandojsg/aframe.git","ssh_url":"git@github.com:fernandojsg/aframe.git","clone_url":"https://github.com/fernandojsg/aframe.git","svn_url":"https://github.com/fernandojsg/aframe","homepage":"https://aframe.io/","size":150268,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"aframevr:master","ref":"master","sha":"dfb1d92cc8f2062d278f3c5697c2c69ce5a1ca1a","user":{"login":"aframevr","id":16024092,"avatar_url":"https://avatars.githubusercontent.com/u/16024092?v=3","gravatar_id":"","url":"https://api.github.com/users/aframevr","html_url":"https://github.com/aframevr","followers_url":"https://api.github.com/users/aframevr/followers","following_url":"https://api.github.com/users/aframevr/following{/other_user}","gists_url":"https://api.github.com/users/aframevr/gists{/gist_id}","starred_url":"https://api.github.com/users/aframevr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aframevr/subscriptions","organizations_url":"https://api.github.com/users/aframevr/orgs","repos_url":"https://api.github.com/users/aframevr/repos","events_url":"https://api.github.com/users/aframevr/events{/privacy}","received_events_url":"https://api.github.com/users/aframevr/received_events","type":"Organization","site_admin":false},"repo":{"id":42488903,"name":"aframe","full_name":"aframevr/aframe","owner":{"login":"aframevr","id":16024092,"avatar_url":"https://avatars.githubusercontent.com/u/16024092?v=3","gravatar_id":"","url":"https://api.github.com/users/aframevr","html_url":"https://github.com/aframevr","followers_url":"https://api.github.com/users/aframevr/followers","following_url":"https://api.github.com/users/aframevr/following{/other_user}","gists_url":"https://api.github.com/users/aframevr/gists{/gist_id}","starred_url":"https://api.github.com/users/aframevr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aframevr/subscriptions","organizations_url":"https://api.github.com/users/aframevr/orgs","repos_url":"https://api.github.com/users/aframevr/repos","events_url":"https://api.github.com/users/aframevr/events{/privacy}","received_events_url":"https://api.github.com/users/aframevr/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aframevr/aframe","description":"A web framework for building VR experiences.","fork":false,"url":"https://api.github.com/repos/aframevr/aframe","forks_url":"https://api.github.com/repos/aframevr/aframe/forks","keys_url":"https://api.github.com/repos/aframevr/aframe/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aframevr/aframe/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aframevr/aframe/teams","hooks_url":"https://api.github.com/repos/aframevr/aframe/hooks","issue_events_url":"https://api.github.com/repos/aframevr/aframe/issues/events{/number}","events_url":"https://api.github.com/repos/aframevr/aframe/events","assignees_url":"https://api.github.com/repos/aframevr/aframe/assignees{/user}","branches_url":"https://api.github.com/repos/aframevr/aframe/branches{/branch}","tags_url":"https://api.github.com/repos/aframevr/aframe/tags","blobs_url":"https://api.github.com/repos/aframevr/aframe/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aframevr/aframe/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aframevr/aframe/git/refs{/sha}","trees_url":"https://api.github.com/repos/aframevr/aframe/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aframevr/aframe/statuses/{sha}","languages_url":"https://api.github.com/repos/aframevr/aframe/languages","stargazers_url":"https://api.github.com/repos/aframevr/aframe/stargazers","contributors_url":"https://api.github.com/repos/aframevr/aframe/contributors","subscribers_url":"https://api.github.com/repos/aframevr/aframe/subscribers","subscription_url":"https://api.github.com/repos/aframevr/aframe/subscription","commits_url":"https://api.github.com/repos/aframevr/aframe/commits{/sha}","git_commits_url":"https://api.github.com/repos/aframevr/aframe/git/commits{/sha}","comments_url":"https://api.github.com/repos/aframevr/aframe/comments{/number}","issue_comment_url":"https://api.github.com/repos/aframevr/aframe/issues/comments{/number}","contents_url":"https://api.github.com/repos/aframevr/aframe/contents/{+path}","compare_url":"https://api.github.com/repos/aframevr/aframe/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aframevr/aframe/merges","archive_url":"https://api.github.com/repos/aframevr/aframe/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aframevr/aframe/downloads","issues_url":"https://api.github.com/repos/aframevr/aframe/issues{/number}","pulls_url":"https://api.github.com/repos/aframevr/aframe/pulls{/number}","milestones_url":"https://api.github.com/repos/aframevr/aframe/milestones{/number}","notifications_url":"https://api.github.com/repos/aframevr/aframe/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aframevr/aframe/labels{/name}","releases_url":"https://api.github.com/repos/aframevr/aframe/releases{/id}","deployments_url":"https://api.github.com/repos/aframevr/aframe/deployments","created_at":"2015-09-15T02:04:40Z","updated_at":"2016-09-23T22:41:30Z","pushed_at":"2016-09-24T00:20:54Z","git_url":"git://github.com/aframevr/aframe.git","ssh_url":"git@github.com:aframevr/aframe.git","clone_url":"https://github.com/aframevr/aframe.git","svn_url":"https://github.com/aframevr/aframe","homepage":"https://aframe.io/","size":140842,"stargazers_count":3468,"watchers_count":3468,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":646,"mirror_url":null,"open_issues_count":218,"forks":646,"open_issues":218,"watchers":3468,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/aframevr/aframe/pulls/1934"},"html":{"href":"https://github.com/aframevr/aframe/pull/1934"},"issue":{"href":"https://api.github.com/repos/aframevr/aframe/issues/1934"},"comments":{"href":"https://api.github.com/repos/aframevr/aframe/issues/1934/comments"},"review_comments":{"href":"https://api.github.com/repos/aframevr/aframe/pulls/1934/comments"},"review_comment":{"href":"https://api.github.com/repos/aframevr/aframe/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/aframevr/aframe/pulls/1934/commits"},"statuses":{"href":"https://api.github.com/repos/aframevr/aframe/statuses/482a8ae790af2e8ad3bc4f8284bf2cdfc965a5e6"}}}}
{"actor":{"display_login":"fernandojsg"}}