{"action":"created","comment":{"url":"https://api.github.com/repos/Cockatrice/Cockatrice/pulls/comments/38683147","id":38683147,"diff_hunk":"@@ -57,46 +85,157 @@ void SoundEngine::soundEnabledChanged()\n         audio->deleteLater();\n         audio = 0;\n     }\n+#else //QT5\n+    if (settingsCache->getSoundEnabled()) {\n+        qDebug(\"SoundEngine: enabling sound\");\n+        enabled = true;\n+    }else{\n+        qDebug(\"SoundEngine: disabling sound\");\n+        enabled = false;\n+        for (int i = 0; i < fileNames.size(); ++i) {\n+            audioData[fileNames[i]]->stop();\n+        }\n+    }\n+#endif\n }\n \n void SoundEngine::playSound(const QString &fileName)\n {\n+#if QT_VERSION < 0x050000 //QT4\n     if (!audio)\n         return;\n     \n     audio->stop();\n     inputBuffer->close();\n-    inputBuffer->setData(audioData[fileName]);\n+    inputBuffer->setData(audioCache[fileName]);\n     inputBuffer->open(QIODevice::ReadOnly);\n-#if QT_VERSION >= 0x050000\n-    audio->setVolume(settingsCache->getMasterVolume() / 100.0);\n-#endif\n     audio->start(inputBuffer);\n-    \n+#else //QT5\n+    if (!audioData.contains(fileName) || !enabled){\n+        return;\n+    }\n+\n+    audioData[fileName]->setVolume(settingsCache->getMasterVolume());\n+    audioData[fileName]->stop();\n+    audioData[fileName]->setPosition(0);\n+    audioData[fileName]->play();\n+#endif\n+}\n+void SoundEngine::untapStep(){\n+    playSound(\"untap_step\");\n+}\n+\n+void SoundEngine::upkeepStep(){\n+    playSound(\"upkeep_step\");\n+}\n+\n+void SoundEngine::drawStep(){\n+    playSound(\"draw_step\");\n+}\n+\n+void SoundEngine::main1(){\n+    playSound(\"main_1\");\n+}\n+\n+void SoundEngine::startCombat(){\n+    playSound(\"start_combat\");\n+}\n+\n+void SoundEngine::attackStep() {\n+    playSound(\"attack_step\");\n+}\n+\n+void SoundEngine::blockStep(){\n+    playSound(\"block_step\");\n+}\n+\n+void SoundEngine::damageStep(){\n+    playSound(\"damage_step\");\n }\n \n+void SoundEngine::endCombat(){\n+    playSound(\"end_combat\");\n+}\n+\n+void SoundEngine::main2(){\n+    playSound(\"main_2\");\n+}\n void SoundEngine::endStep()\n {\n-    if (lastEndStepPlayed.secsTo(QDateTime::currentDateTime()) >= 1)\n-        playSound(\"end_step\");\n-    lastEndStepPlayed = QDateTime::currentDateTime();\n+    playSound(\"end_step\");\n }\n \n-void SoundEngine::tap()\n-{\n-    if (lastTapPlayed.secsTo(QDateTime::currentDateTime()) >= 1)\n-        playSound(\"tap\");\n-    lastTapPlayed = QDateTime::currentDateTime();\n+void SoundEngine::drawCard(){\n+    //Add timer\n+    playSound(\"draw_card\");\n }\n \n-void SoundEngine::playerJoined()\n-{\n+void SoundEngine::playCard(){\n+    //Add timer\n+    playSound(\"play_card\");\n+}\n+\n+void SoundEngine::tap(){\n+    playSound(\"tap_card\");\n+}\n+\n+void SoundEngine::untap(){\n+    //Add timer\n+    playSound(\"untap_card\");\n+}\n+\n+void SoundEngine::shuffle(){\n+    //Add timer\n+    playSound(\"shuffle\");\n+}\n+\n+void SoundEngine::rollDice(){\n+    playSound(\"roll_dice\");\n+}\n+\n+void SoundEngine::lifeChange(){\n+    //Add timer\n+    playSound(\"life_change\");\n+}\n+\n+void SoundEngine::playerJoined(){\n     playSound(\"player_joined\");\n }\n \n+void SoundEngine::playerLeave(){\n+    playSound(\"player_leave\");\n+}\n+\n+void SoundEngine::playerDisconnect(){\n+    playSound(\"player_disconnect\");\n+}\n+\n+void SoundEngine::playerReconnect(){\n+    playSound(\"player_reconnect\");\n+}\n+\n+void SoundEngine::playerConcede(){\n+    playSound(\"player_concede\");\n+}\n \n-void SoundEngine::attack() {\n-    if (lastAttackStepPlayed.secsTo(QDateTime::currentDateTime()) >= 1)\n-        playSound(\"attack\");\n-    lastAttackStepPlayed = QDateTime::currentDateTime();\n+void SoundEngine::spectatorJoin(){\n+    playSound(\"spectator_joined\");\n }\n+\n+void SoundEngine::spectatorLeave(){\n+    playSound(\"spectator_leave\");\n+}\n+\n+void SoundEngine::chatMention(){\n+    //Add timer","path":"cockatrice/src/soundengine.cpp","position":262,"original_position":262,"commit_id":"3ab753b29f0de768ceca688ccd3873a80f26b3d9","original_commit_id":"3ab753b29f0de768ceca688ccd3873a80f26b3d9","user":{"login":"Fizztastic","id":11285250,"avatar_url":"https://avatars.githubusercontent.com/u/11285250?v=3","gravatar_id":"","url":"https://api.github.com/users/Fizztastic","html_url":"https://github.com/Fizztastic","followers_url":"https://api.github.com/users/Fizztastic/followers","following_url":"https://api.github.com/users/Fizztastic/following{/other_user}","gists_url":"https://api.github.com/users/Fizztastic/gists{/gist_id}","starred_url":"https://api.github.com/users/Fizztastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Fizztastic/subscriptions","organizations_url":"https://api.github.com/users/Fizztastic/orgs","repos_url":"https://api.github.com/users/Fizztastic/repos","events_url":"https://api.github.com/users/Fizztastic/events{/privacy}","received_events_url":"https://api.github.com/users/Fizztastic/received_events","type":"User","site_admin":false},"body":"Just forgot to remove the comments. The timer in not needed.","created_at":"2015-09-03T18:58:00Z","updated_at":"2015-09-03T18:58:00Z","html_url":"https://github.com/Cockatrice/Cockatrice/pull/1424#discussion_r38683147","pull_request_url":"https://api.github.com/repos/Cockatrice/Cockatrice/pulls/1424","_links":{"self":{"href":"https://api.github.com/repos/Cockatrice/Cockatrice/pulls/comments/38683147"},"html":{"href":"https://github.com/Cockatrice/Cockatrice/pull/1424#discussion_r38683147"},"pull_request":{"href":"https://api.github.com/repos/Cockatrice/Cockatrice/pulls/1424"}}},"pull_request":{"url":"https://api.github.com/repos/Cockatrice/Cockatrice/pulls/1424","id":43444900,"html_url":"https://github.com/Cockatrice/Cockatrice/pull/1424","diff_url":"https://github.com/Cockatrice/Cockatrice/pull/1424.diff","patch_url":"https://github.com/Cockatrice/Cockatrice/pull/1424.patch","issue_url":"https://api.github.com/repos/Cockatrice/Cockatrice/issues/1424","number":1424,"state":"open","locked":false,"title":"SoundEngine overhaul","user":{"login":"Fizztastic","id":11285250,"avatar_url":"https://avatars.githubusercontent.com/u/11285250?v=3","gravatar_id":"","url":"https://api.github.com/users/Fizztastic","html_url":"https://github.com/Fizztastic","followers_url":"https://api.github.com/users/Fizztastic/followers","following_url":"https://api.github.com/users/Fizztastic/following{/other_user}","gists_url":"https://api.github.com/users/Fizztastic/gists{/gist_id}","starred_url":"https://api.github.com/users/Fizztastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Fizztastic/subscriptions","organizations_url":"https://api.github.com/users/Fizztastic/orgs","repos_url":"https://api.github.com/users/Fizztastic/repos","events_url":"https://api.github.com/users/Fizztastic/events{/privacy}","received_events_url":"https://api.github.com/users/Fizztastic/received_events","type":"User","site_admin":false},"body":"Related #1403 \r\n\r\n- Added Qt5 support for .wav/.mp3/.mp4\r\n- Added Qt4 support  for .wav\r\n- Replace .raw sound files by .wav\r\n\r\nList of actions that can have sound:\r\n- Untap step, Upkeep step, Draw step, Main 1, Start Combat, _Attack step_, Block step, Damage step, End combat, Main 2, _End step_\r\n- Draw card, Play card, _Tap_, Untap, Shuffle, Life change, Roll dice\r\n- _Player join_, Player leave, Player disconnect, Player reconnect, Player concede\r\n- Spectator join, Spectator leave\r\n- Chat mention, @/all,  private message\r\n\r\nNote: only the actions that are in _italic_ have sound out of the box.","created_at":"2015-08-26T19:59:51Z","updated_at":"2015-09-03T18:58:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4ed32d9a357fcd2438e393189a88bb8540042858","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Cockatrice/Cockatrice/pulls/1424/commits","review_comments_url":"https://api.github.com/repos/Cockatrice/Cockatrice/pulls/1424/comments","review_comment_url":"https://api.github.com/repos/Cockatrice/Cockatrice/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Cockatrice/Cockatrice/issues/1424/comments","statuses_url":"https://api.github.com/repos/Cockatrice/Cockatrice/statuses/3ab753b29f0de768ceca688ccd3873a80f26b3d9","head":{"label":"Fizztastic:SoundEngine","ref":"SoundEngine","sha":"3ab753b29f0de768ceca688ccd3873a80f26b3d9","user":{"login":"Fizztastic","id":11285250,"avatar_url":"https://avatars.githubusercontent.com/u/11285250?v=3","gravatar_id":"","url":"https://api.github.com/users/Fizztastic","html_url":"https://github.com/Fizztastic","followers_url":"https://api.github.com/users/Fizztastic/followers","following_url":"https://api.github.com/users/Fizztastic/following{/other_user}","gists_url":"https://api.github.com/users/Fizztastic/gists{/gist_id}","starred_url":"https://api.github.com/users/Fizztastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Fizztastic/subscriptions","organizations_url":"https://api.github.com/users/Fizztastic/orgs","repos_url":"https://api.github.com/users/Fizztastic/repos","events_url":"https://api.github.com/users/Fizztastic/events{/privacy}","received_events_url":"https://api.github.com/users/Fizztastic/received_events","type":"User","site_admin":false},"repo":{"id":40459778,"name":"Cockatrice","full_name":"Fizztastic/Cockatrice","owner":{"login":"Fizztastic","id":11285250,"avatar_url":"https://avatars.githubusercontent.com/u/11285250?v=3","gravatar_id":"","url":"https://api.github.com/users/Fizztastic","html_url":"https://github.com/Fizztastic","followers_url":"https://api.github.com/users/Fizztastic/followers","following_url":"https://api.github.com/users/Fizztastic/following{/other_user}","gists_url":"https://api.github.com/users/Fizztastic/gists{/gist_id}","starred_url":"https://api.github.com/users/Fizztastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Fizztastic/subscriptions","organizations_url":"https://api.github.com/users/Fizztastic/orgs","repos_url":"https://api.github.com/users/Fizztastic/repos","events_url":"https://api.github.com/users/Fizztastic/events{/privacy}","received_events_url":"https://api.github.com/users/Fizztastic/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Fizztastic/Cockatrice","description":"A cross-platform virtual tabletop for multiplayer card games","fork":true,"url":"https://api.github.com/repos/Fizztastic/Cockatrice","forks_url":"https://api.github.com/repos/Fizztastic/Cockatrice/forks","keys_url":"https://api.github.com/repos/Fizztastic/Cockatrice/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Fizztastic/Cockatrice/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Fizztastic/Cockatrice/teams","hooks_url":"https://api.github.com/repos/Fizztastic/Cockatrice/hooks","issue_events_url":"https://api.github.com/repos/Fizztastic/Cockatrice/issues/events{/number}","events_url":"https://api.github.com/repos/Fizztastic/Cockatrice/events","assignees_url":"https://api.github.com/repos/Fizztastic/Cockatrice/assignees{/user}","branches_url":"https://api.github.com/repos/Fizztastic/Cockatrice/branches{/branch}","tags_url":"https://api.github.com/repos/Fizztastic/Cockatrice/tags","blobs_url":"https://api.github.com/repos/Fizztastic/Cockatrice/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Fizztastic/Cockatrice/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Fizztastic/Cockatrice/git/refs{/sha}","trees_url":"https://api.github.com/repos/Fizztastic/Cockatrice/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Fizztastic/Cockatrice/statuses/{sha}","languages_url":"https://api.github.com/repos/Fizztastic/Cockatrice/languages","stargazers_url":"https://api.github.com/repos/Fizztastic/Cockatrice/stargazers","contributors_url":"https://api.github.com/repos/Fizztastic/Cockatrice/contributors","subscribers_url":"https://api.github.com/repos/Fizztastic/Cockatrice/subscribers","subscription_url":"https://api.github.com/repos/Fizztastic/Cockatrice/subscription","commits_url":"https://api.github.com/repos/Fizztastic/Cockatrice/commits{/sha}","git_commits_url":"https://api.github.com/repos/Fizztastic/Cockatrice/git/commits{/sha}","comments_url":"https://api.github.com/repos/Fizztastic/Cockatrice/comments{/number}","issue_comment_url":"https://api.github.com/repos/Fizztastic/Cockatrice/issues/comments{/number}","contents_url":"https://api.github.com/repos/Fizztastic/Cockatrice/contents/{+path}","compare_url":"https://api.github.com/repos/Fizztastic/Cockatrice/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Fizztastic/Cockatrice/merges","archive_url":"https://api.github.com/repos/Fizztastic/Cockatrice/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Fizztastic/Cockatrice/downloads","issues_url":"https://api.github.com/repos/Fizztastic/Cockatrice/issues{/number}","pulls_url":"https://api.github.com/repos/Fizztastic/Cockatrice/pulls{/number}","milestones_url":"https://api.github.com/repos/Fizztastic/Cockatrice/milestones{/number}","notifications_url":"https://api.github.com/repos/Fizztastic/Cockatrice/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Fizztastic/Cockatrice/labels{/name}","releases_url":"https://api.github.com/repos/Fizztastic/Cockatrice/releases{/id}","created_at":"2015-08-10T02:44:43Z","updated_at":"2015-08-10T02:44:46Z","pushed_at":"2015-09-03T17:55:00Z","git_url":"git://github.com/Fizztastic/Cockatrice.git","ssh_url":"git@github.com:Fizztastic/Cockatrice.git","clone_url":"https://github.com/Fizztastic/Cockatrice.git","svn_url":"https://github.com/Fizztastic/Cockatrice","homepage":"","size":33137,"stargazers_count":0,"watchers_count":0,"language":"C++","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":"Cockatrice:master","ref":"master","sha":"d97a9bdb15eb4f55d2eef658a7360de05012280a","user":{"login":"Cockatrice","id":9746249,"avatar_url":"https://avatars.githubusercontent.com/u/9746249?v=3","gravatar_id":"","url":"https://api.github.com/users/Cockatrice","html_url":"https://github.com/Cockatrice","followers_url":"https://api.github.com/users/Cockatrice/followers","following_url":"https://api.github.com/users/Cockatrice/following{/other_user}","gists_url":"https://api.github.com/users/Cockatrice/gists{/gist_id}","starred_url":"https://api.github.com/users/Cockatrice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Cockatrice/subscriptions","organizations_url":"https://api.github.com/users/Cockatrice/orgs","repos_url":"https://api.github.com/users/Cockatrice/repos","events_url":"https://api.github.com/users/Cockatrice/events{/privacy}","received_events_url":"https://api.github.com/users/Cockatrice/received_events","type":"Organization","site_admin":false},"repo":{"id":2907031,"name":"Cockatrice","full_name":"Cockatrice/Cockatrice","owner":{"login":"Cockatrice","id":9746249,"avatar_url":"https://avatars.githubusercontent.com/u/9746249?v=3","gravatar_id":"","url":"https://api.github.com/users/Cockatrice","html_url":"https://github.com/Cockatrice","followers_url":"https://api.github.com/users/Cockatrice/followers","following_url":"https://api.github.com/users/Cockatrice/following{/other_user}","gists_url":"https://api.github.com/users/Cockatrice/gists{/gist_id}","starred_url":"https://api.github.com/users/Cockatrice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Cockatrice/subscriptions","organizations_url":"https://api.github.com/users/Cockatrice/orgs","repos_url":"https://api.github.com/users/Cockatrice/repos","events_url":"https://api.github.com/users/Cockatrice/events{/privacy}","received_events_url":"https://api.github.com/users/Cockatrice/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Cockatrice/Cockatrice","description":"A cross-platform virtual tabletop for multiplayer card games","fork":false,"url":"https://api.github.com/repos/Cockatrice/Cockatrice","forks_url":"https://api.github.com/repos/Cockatrice/Cockatrice/forks","keys_url":"https://api.github.com/repos/Cockatrice/Cockatrice/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Cockatrice/Cockatrice/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Cockatrice/Cockatrice/teams","hooks_url":"https://api.github.com/repos/Cockatrice/Cockatrice/hooks","issue_events_url":"https://api.github.com/repos/Cockatrice/Cockatrice/issues/events{/number}","events_url":"https://api.github.com/repos/Cockatrice/Cockatrice/events","assignees_url":"https://api.github.com/repos/Cockatrice/Cockatrice/assignees{/user}","branches_url":"https://api.github.com/repos/Cockatrice/Cockatrice/branches{/branch}","tags_url":"https://api.github.com/repos/Cockatrice/Cockatrice/tags","blobs_url":"https://api.github.com/repos/Cockatrice/Cockatrice/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Cockatrice/Cockatrice/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Cockatrice/Cockatrice/git/refs{/sha}","trees_url":"https://api.github.com/repos/Cockatrice/Cockatrice/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Cockatrice/Cockatrice/statuses/{sha}","languages_url":"https://api.github.com/repos/Cockatrice/Cockatrice/languages","stargazers_url":"https://api.github.com/repos/Cockatrice/Cockatrice/stargazers","contributors_url":"https://api.github.com/repos/Cockatrice/Cockatrice/contributors","subscribers_url":"https://api.github.com/repos/Cockatrice/Cockatrice/subscribers","subscription_url":"https://api.github.com/repos/Cockatrice/Cockatrice/subscription","commits_url":"https://api.github.com/repos/Cockatrice/Cockatrice/commits{/sha}","git_commits_url":"https://api.github.com/repos/Cockatrice/Cockatrice/git/commits{/sha}","comments_url":"https://api.github.com/repos/Cockatrice/Cockatrice/comments{/number}","issue_comment_url":"https://api.github.com/repos/Cockatrice/Cockatrice/issues/comments{/number}","contents_url":"https://api.github.com/repos/Cockatrice/Cockatrice/contents/{+path}","compare_url":"https://api.github.com/repos/Cockatrice/Cockatrice/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Cockatrice/Cockatrice/merges","archive_url":"https://api.github.com/repos/Cockatrice/Cockatrice/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Cockatrice/Cockatrice/downloads","issues_url":"https://api.github.com/repos/Cockatrice/Cockatrice/issues{/number}","pulls_url":"https://api.github.com/repos/Cockatrice/Cockatrice/pulls{/number}","milestones_url":"https://api.github.com/repos/Cockatrice/Cockatrice/milestones{/number}","notifications_url":"https://api.github.com/repos/Cockatrice/Cockatrice/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Cockatrice/Cockatrice/labels{/name}","releases_url":"https://api.github.com/repos/Cockatrice/Cockatrice/releases{/id}","created_at":"2011-12-03T20:58:09Z","updated_at":"2015-09-03T17:31:31Z","pushed_at":"2015-09-03T18:56:24Z","git_url":"git://github.com/Cockatrice/Cockatrice.git","ssh_url":"git@github.com:Cockatrice/Cockatrice.git","clone_url":"https://github.com/Cockatrice/Cockatrice.git","svn_url":"https://github.com/Cockatrice/Cockatrice","homepage":"","size":43770,"stargazers_count":310,"watchers_count":310,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":192,"mirror_url":null,"open_issues_count":232,"forks":192,"open_issues":232,"watchers":310,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Cockatrice/Cockatrice/pulls/1424"},"html":{"href":"https://github.com/Cockatrice/Cockatrice/pull/1424"},"issue":{"href":"https://api.github.com/repos/Cockatrice/Cockatrice/issues/1424"},"comments":{"href":"https://api.github.com/repos/Cockatrice/Cockatrice/issues/1424/comments"},"review_comments":{"href":"https://api.github.com/repos/Cockatrice/Cockatrice/pulls/1424/comments"},"review_comment":{"href":"https://api.github.com/repos/Cockatrice/Cockatrice/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Cockatrice/Cockatrice/pulls/1424/commits"},"statuses":{"href":"https://api.github.com/repos/Cockatrice/Cockatrice/statuses/3ab753b29f0de768ceca688ccd3873a80f26b3d9"}}}}