{"action":"created","comment":{"url":"https://api.github.com/repos/mixxxdj/mixxx/pulls/comments/49664644","id":49664644,"diff_hunk":"@@ -0,0 +1,55 @@\n+#include <QApplication>\n+#include <QtDebug>\n+\n+#include \"controlobjectscript.h\"\n+\n+ControlObjectScript::ControlObjectScript(const ConfigKey& key, QObject* pParent)\n+        : ControlObjectSlave(key, pParent) {\n+}\n+\n+void ControlObjectScript::connectScriptFunction(\n+        const ControllerEngineConnection& conn) {\n+    if (m_connectedScriptFunctions.isEmpty()) {\n+        // we connect the slots only, if there will be actually a script\n+        // connected\n+        connect(m_pControl.data(), SIGNAL(valueChanged(double, QObject*)),\n+                this, SLOT(slotValueChanged(double,QObject*)),\n+                Qt::QueuedConnection);\n+        connect(this, SIGNAL(trigger(double, QObject*)),\n+                this, SLOT(slotValueChanged(double,QObject*)),\n+                Qt::QueuedConnection);\n+    }\n+    m_connectedScriptFunctions.append(conn);\n+}\n+\n+bool ControlObjectScript::disconnectScriptFunction(\n+        const ControllerEngineConnection& conn) {\n+    bool ret = m_connectedScriptFunctions.removeAll(conn) > 0;\n+    if (m_connectedScriptFunctions.isEmpty()) {\n+        // no script left, we can disconnected\n+        disconnect(m_pControl.data(), SIGNAL(valueChanged(double, QObject*)),\n+                this, SLOT(slotValueChanged(double,QObject*)));\n+        disconnect(this, SIGNAL(trigger(double, QObject*)),\n+                this, SLOT(slotValueChanged(double,QObject*)));\n+    }\n+    return ret;\n+}\n+\n+void ControlObjectScript::slotValueChanged(double value, QObject*) {\n+    // Make a local copy of m_connectedScriptFunctions fist.\n+    // This allows a script to disconnect a callback from the callback\n+    // itself. Otherwise the this may crash since the disconnect call\n+    // happens during conn.function.call() in the middle of the loop below.\n+    QList<ControllerEngineConnection> connections = m_connectedScriptFunctions;\n+    for(auto&& conn: connections) {","path":"src/controlobjectscript.cpp","position":null,"original_position":44,"commit_id":"cb66e8367940683bc759c568bb01eb04f77e9995","original_commit_id":"cd1816d0dd7b0ed321c14a4f54df204366fdd3c3","user":{"login":"rryan","id":26527,"avatar_url":"https://avatars.githubusercontent.com/u/26527?v=3","gravatar_id":"","url":"https://api.github.com/users/rryan","html_url":"https://github.com/rryan","followers_url":"https://api.github.com/users/rryan/followers","following_url":"https://api.github.com/users/rryan/following{/other_user}","gists_url":"https://api.github.com/users/rryan/gists{/gist_id}","starred_url":"https://api.github.com/users/rryan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rryan/subscriptions","organizations_url":"https://api.github.com/users/rryan/orgs","repos_url":"https://api.github.com/users/rryan/repos","events_url":"https://api.github.com/users/rryan/events{/privacy}","received_events_url":"https://api.github.com/users/rryan/received_events","type":"User","site_admin":false},"body":"(It would also be nice to know what Qt does that the STL containers don't that allows ```auto&``` to work (and whether a copy occurs in that case)... )","created_at":"2016-01-13T22:58:08Z","updated_at":"2016-01-13T22:58:08Z","html_url":"https://github.com/mixxxdj/mixxx/pull/853#discussion_r49664644","pull_request_url":"https://api.github.com/repos/mixxxdj/mixxx/pulls/853","_links":{"self":{"href":"https://api.github.com/repos/mixxxdj/mixxx/pulls/comments/49664644"},"html":{"href":"https://github.com/mixxxdj/mixxx/pull/853#discussion_r49664644"},"pull_request":{"href":"https://api.github.com/repos/mixxxdj/mixxx/pulls/853"}}},"pull_request":{"url":"https://api.github.com/repos/mixxxdj/mixxx/pulls/853","id":55574823,"html_url":"https://github.com/mixxxdj/mixxx/pull/853","diff_url":"https://github.com/mixxxdj/mixxx/pull/853.diff","patch_url":"https://github.com/mixxxdj/mixxx/pull/853.patch","issue_url":"https://api.github.com/repos/mixxxdj/mixxx/issues/853","number":853,"state":"open","locked":false,"title":"ControlObjectScript (midi Speedup) ","user":{"login":"daschuer","id":1777442,"avatar_url":"https://avatars.githubusercontent.com/u/1777442?v=3","gravatar_id":"","url":"https://api.github.com/users/daschuer","html_url":"https://github.com/daschuer","followers_url":"https://api.github.com/users/daschuer/followers","following_url":"https://api.github.com/users/daschuer/following{/other_user}","gists_url":"https://api.github.com/users/daschuer/gists{/gist_id}","starred_url":"https://api.github.com/users/daschuer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daschuer/subscriptions","organizations_url":"https://api.github.com/users/daschuer/orgs","repos_url":"https://api.github.com/users/daschuer/repos","events_url":"https://api.github.com/users/daschuer/events{/privacy}","received_events_url":"https://api.github.com/users/daschuer/received_events","type":"User","site_admin":false},"body":"This is another PR to speedup the controller thread. \r\nInstead of searching the connected script function in a MultiHash, I have introduced a new ControlObjectScript inherited from ControlObjectSlave, which is able to hold on or more script functions.\r\n\r\nThis PR also optimized the thread changes when using Queud connections, since the ControlObjectSlave will most likely live in the target thread.  \r\nrequested: Queued -> COP = Queued / SCO = Auto\r\n\r\n","created_at":"2016-01-10T21:29:47Z","updated_at":"2016-01-13T22:58:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5c6ae8efa50e31900538c9d17dd98b6e95d74c26","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mixxxdj/mixxx/pulls/853/commits","review_comments_url":"https://api.github.com/repos/mixxxdj/mixxx/pulls/853/comments","review_comment_url":"https://api.github.com/repos/mixxxdj/mixxx/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mixxxdj/mixxx/issues/853/comments","statuses_url":"https://api.github.com/repos/mixxxdj/mixxx/statuses/cb66e8367940683bc759c568bb01eb04f77e9995","head":{"label":"daschuer:controlobjectscript","ref":"controlobjectscript","sha":"cb66e8367940683bc759c568bb01eb04f77e9995","user":{"login":"daschuer","id":1777442,"avatar_url":"https://avatars.githubusercontent.com/u/1777442?v=3","gravatar_id":"","url":"https://api.github.com/users/daschuer","html_url":"https://github.com/daschuer","followers_url":"https://api.github.com/users/daschuer/followers","following_url":"https://api.github.com/users/daschuer/following{/other_user}","gists_url":"https://api.github.com/users/daschuer/gists{/gist_id}","starred_url":"https://api.github.com/users/daschuer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daschuer/subscriptions","organizations_url":"https://api.github.com/users/daschuer/orgs","repos_url":"https://api.github.com/users/daschuer/repos","events_url":"https://api.github.com/users/daschuer/events{/privacy}","received_events_url":"https://api.github.com/users/daschuer/received_events","type":"User","site_admin":false},"repo":{"id":10669071,"name":"mixxx","full_name":"daschuer/mixxx","owner":{"login":"daschuer","id":1777442,"avatar_url":"https://avatars.githubusercontent.com/u/1777442?v=3","gravatar_id":"","url":"https://api.github.com/users/daschuer","html_url":"https://github.com/daschuer","followers_url":"https://api.github.com/users/daschuer/followers","following_url":"https://api.github.com/users/daschuer/following{/other_user}","gists_url":"https://api.github.com/users/daschuer/gists{/gist_id}","starred_url":"https://api.github.com/users/daschuer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daschuer/subscriptions","organizations_url":"https://api.github.com/users/daschuer/orgs","repos_url":"https://api.github.com/users/daschuer/repos","events_url":"https://api.github.com/users/daschuer/events{/privacy}","received_events_url":"https://api.github.com/users/daschuer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/daschuer/mixxx","description":"Mixxx is Free DJ software that gives you everything you need to perform live mixes.","fork":true,"url":"https://api.github.com/repos/daschuer/mixxx","forks_url":"https://api.github.com/repos/daschuer/mixxx/forks","keys_url":"https://api.github.com/repos/daschuer/mixxx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/daschuer/mixxx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/daschuer/mixxx/teams","hooks_url":"https://api.github.com/repos/daschuer/mixxx/hooks","issue_events_url":"https://api.github.com/repos/daschuer/mixxx/issues/events{/number}","events_url":"https://api.github.com/repos/daschuer/mixxx/events","assignees_url":"https://api.github.com/repos/daschuer/mixxx/assignees{/user}","branches_url":"https://api.github.com/repos/daschuer/mixxx/branches{/branch}","tags_url":"https://api.github.com/repos/daschuer/mixxx/tags","blobs_url":"https://api.github.com/repos/daschuer/mixxx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/daschuer/mixxx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/daschuer/mixxx/git/refs{/sha}","trees_url":"https://api.github.com/repos/daschuer/mixxx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/daschuer/mixxx/statuses/{sha}","languages_url":"https://api.github.com/repos/daschuer/mixxx/languages","stargazers_url":"https://api.github.com/repos/daschuer/mixxx/stargazers","contributors_url":"https://api.github.com/repos/daschuer/mixxx/contributors","subscribers_url":"https://api.github.com/repos/daschuer/mixxx/subscribers","subscription_url":"https://api.github.com/repos/daschuer/mixxx/subscription","commits_url":"https://api.github.com/repos/daschuer/mixxx/commits{/sha}","git_commits_url":"https://api.github.com/repos/daschuer/mixxx/git/commits{/sha}","comments_url":"https://api.github.com/repos/daschuer/mixxx/comments{/number}","issue_comment_url":"https://api.github.com/repos/daschuer/mixxx/issues/comments{/number}","contents_url":"https://api.github.com/repos/daschuer/mixxx/contents/{+path}","compare_url":"https://api.github.com/repos/daschuer/mixxx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/daschuer/mixxx/merges","archive_url":"https://api.github.com/repos/daschuer/mixxx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/daschuer/mixxx/downloads","issues_url":"https://api.github.com/repos/daschuer/mixxx/issues{/number}","pulls_url":"https://api.github.com/repos/daschuer/mixxx/pulls{/number}","milestones_url":"https://api.github.com/repos/daschuer/mixxx/milestones{/number}","notifications_url":"https://api.github.com/repos/daschuer/mixxx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/daschuer/mixxx/labels{/name}","releases_url":"https://api.github.com/repos/daschuer/mixxx/releases{/id}","created_at":"2013-06-13T15:21:23Z","updated_at":"2015-04-23T06:18:48Z","pushed_at":"2016-01-13T22:33:48Z","git_url":"git://github.com/daschuer/mixxx.git","ssh_url":"git@github.com:daschuer/mixxx.git","clone_url":"https://github.com/daschuer/mixxx.git","svn_url":"https://github.com/daschuer/mixxx","homepage":null,"size":258973,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"mixxxdj:master","ref":"master","sha":"49aaf97de17612b57d2a7618fcae0e687dbea8e0","user":{"login":"mixxxdj","id":1743769,"avatar_url":"https://avatars.githubusercontent.com/u/1743769?v=3","gravatar_id":"","url":"https://api.github.com/users/mixxxdj","html_url":"https://github.com/mixxxdj","followers_url":"https://api.github.com/users/mixxxdj/followers","following_url":"https://api.github.com/users/mixxxdj/following{/other_user}","gists_url":"https://api.github.com/users/mixxxdj/gists{/gist_id}","starred_url":"https://api.github.com/users/mixxxdj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mixxxdj/subscriptions","organizations_url":"https://api.github.com/users/mixxxdj/orgs","repos_url":"https://api.github.com/users/mixxxdj/repos","events_url":"https://api.github.com/users/mixxxdj/events{/privacy}","received_events_url":"https://api.github.com/users/mixxxdj/received_events","type":"Organization","site_admin":false},"repo":{"id":10126031,"name":"mixxx","full_name":"mixxxdj/mixxx","owner":{"login":"mixxxdj","id":1743769,"avatar_url":"https://avatars.githubusercontent.com/u/1743769?v=3","gravatar_id":"","url":"https://api.github.com/users/mixxxdj","html_url":"https://github.com/mixxxdj","followers_url":"https://api.github.com/users/mixxxdj/followers","following_url":"https://api.github.com/users/mixxxdj/following{/other_user}","gists_url":"https://api.github.com/users/mixxxdj/gists{/gist_id}","starred_url":"https://api.github.com/users/mixxxdj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mixxxdj/subscriptions","organizations_url":"https://api.github.com/users/mixxxdj/orgs","repos_url":"https://api.github.com/users/mixxxdj/repos","events_url":"https://api.github.com/users/mixxxdj/events{/privacy}","received_events_url":"https://api.github.com/users/mixxxdj/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mixxxdj/mixxx","description":"Mixxx is Free DJ software that gives you everything you need to perform live mixes.","fork":false,"url":"https://api.github.com/repos/mixxxdj/mixxx","forks_url":"https://api.github.com/repos/mixxxdj/mixxx/forks","keys_url":"https://api.github.com/repos/mixxxdj/mixxx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mixxxdj/mixxx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mixxxdj/mixxx/teams","hooks_url":"https://api.github.com/repos/mixxxdj/mixxx/hooks","issue_events_url":"https://api.github.com/repos/mixxxdj/mixxx/issues/events{/number}","events_url":"https://api.github.com/repos/mixxxdj/mixxx/events","assignees_url":"https://api.github.com/repos/mixxxdj/mixxx/assignees{/user}","branches_url":"https://api.github.com/repos/mixxxdj/mixxx/branches{/branch}","tags_url":"https://api.github.com/repos/mixxxdj/mixxx/tags","blobs_url":"https://api.github.com/repos/mixxxdj/mixxx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mixxxdj/mixxx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mixxxdj/mixxx/git/refs{/sha}","trees_url":"https://api.github.com/repos/mixxxdj/mixxx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mixxxdj/mixxx/statuses/{sha}","languages_url":"https://api.github.com/repos/mixxxdj/mixxx/languages","stargazers_url":"https://api.github.com/repos/mixxxdj/mixxx/stargazers","contributors_url":"https://api.github.com/repos/mixxxdj/mixxx/contributors","subscribers_url":"https://api.github.com/repos/mixxxdj/mixxx/subscribers","subscription_url":"https://api.github.com/repos/mixxxdj/mixxx/subscription","commits_url":"https://api.github.com/repos/mixxxdj/mixxx/commits{/sha}","git_commits_url":"https://api.github.com/repos/mixxxdj/mixxx/git/commits{/sha}","comments_url":"https://api.github.com/repos/mixxxdj/mixxx/comments{/number}","issue_comment_url":"https://api.github.com/repos/mixxxdj/mixxx/issues/comments{/number}","contents_url":"https://api.github.com/repos/mixxxdj/mixxx/contents/{+path}","compare_url":"https://api.github.com/repos/mixxxdj/mixxx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mixxxdj/mixxx/merges","archive_url":"https://api.github.com/repos/mixxxdj/mixxx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mixxxdj/mixxx/downloads","issues_url":"https://api.github.com/repos/mixxxdj/mixxx/issues{/number}","pulls_url":"https://api.github.com/repos/mixxxdj/mixxx/pulls{/number}","milestones_url":"https://api.github.com/repos/mixxxdj/mixxx/milestones{/number}","notifications_url":"https://api.github.com/repos/mixxxdj/mixxx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mixxxdj/mixxx/labels{/name}","releases_url":"https://api.github.com/repos/mixxxdj/mixxx/releases{/id}","created_at":"2013-05-17T15:14:38Z","updated_at":"2016-01-13T17:08:31Z","pushed_at":"2016-01-13T22:45:32Z","git_url":"git://github.com/mixxxdj/mixxx.git","ssh_url":"git@github.com:mixxxdj/mixxx.git","clone_url":"https://github.com/mixxxdj/mixxx.git","svn_url":"https://github.com/mixxxdj/mixxx","homepage":"http://mixxx.org","size":265821,"stargazers_count":435,"watchers_count":435,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":279,"mirror_url":null,"open_issues_count":47,"forks":279,"open_issues":47,"watchers":435,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mixxxdj/mixxx/pulls/853"},"html":{"href":"https://github.com/mixxxdj/mixxx/pull/853"},"issue":{"href":"https://api.github.com/repos/mixxxdj/mixxx/issues/853"},"comments":{"href":"https://api.github.com/repos/mixxxdj/mixxx/issues/853/comments"},"review_comments":{"href":"https://api.github.com/repos/mixxxdj/mixxx/pulls/853/comments"},"review_comment":{"href":"https://api.github.com/repos/mixxxdj/mixxx/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mixxxdj/mixxx/pulls/853/commits"},"statuses":{"href":"https://api.github.com/repos/mixxxdj/mixxx/statuses/cb66e8367940683bc759c568bb01eb04f77e9995"}}}}