{"action":"created","comment":{"url":"https://api.github.com/repos/AudioKit/AudioKit/pulls/comments/186244699","pull_request_review_id":117795421,"id":186244699,"diff_hunk":"@@ -130,12 +130,18 @@ extension AudioKit {\n                 // Note: doesn't throw since this is called from a notification observer\n             }\n         }\n+        if Thread.isMainThread {","path":"AudioKit/Common/Internals/AudioKit+StartStop.swift","position":13,"original_position":13,"commit_id":"ff43976916a96756aa325a205f3087307e82ad04","original_commit_id":"ff43976916a96756aa325a205f3087307e82ad04","user":{"login":"dave234","id":4334667,"avatar_url":"https://avatars2.githubusercontent.com/u/4334667?v=4","gravatar_id":"","url":"https://api.github.com/users/dave234","html_url":"https://github.com/dave234","followers_url":"https://api.github.com/users/dave234/followers","following_url":"https://api.github.com/users/dave234/following{/other_user}","gists_url":"https://api.github.com/users/dave234/gists{/gist_id}","starred_url":"https://api.github.com/users/dave234/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dave234/subscriptions","organizations_url":"https://api.github.com/users/dave234/orgs","repos_url":"https://api.github.com/users/dave234/repos","events_url":"https://api.github.com/users/dave234/events{/privacy}","received_events_url":"https://api.github.com/users/dave234/received_events","type":"User","site_admin":false},"body":"@warpling If the notification. was called on the main thread you would get a deadlock on DispatchQueue.main.sync.  In general, use async unless there's a concrete reason to use sync on the main thread.","created_at":"2018-05-04T23:57:17Z","updated_at":"2018-05-04T23:57:17Z","html_url":"https://github.com/AudioKit/AudioKit/pull/1363#discussion_r186244699","pull_request_url":"https://api.github.com/repos/AudioKit/AudioKit/pulls/1363","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/AudioKit/AudioKit/pulls/comments/186244699"},"html":{"href":"https://github.com/AudioKit/AudioKit/pull/1363#discussion_r186244699"},"pull_request":{"href":"https://api.github.com/repos/AudioKit/AudioKit/pulls/1363"}}},"pull_request":{"url":"https://api.github.com/repos/AudioKit/AudioKit/pulls/1363","id":186126845,"html_url":"https://github.com/AudioKit/AudioKit/pull/1363","diff_url":"https://github.com/AudioKit/AudioKit/pull/1363.diff","patch_url":"https://github.com/AudioKit/AudioKit/pull/1363.patch","issue_url":"https://api.github.com/repos/AudioKit/AudioKit/issues/1363","number":1363,"state":"open","locked":false,"title":"Clip recorder refactor","user":{"login":"dave234","id":4334667,"avatar_url":"https://avatars2.githubusercontent.com/u/4334667?v=4","gravatar_id":"","url":"https://api.github.com/users/dave234","html_url":"https://github.com/dave234","followers_url":"https://api.github.com/users/dave234/followers","following_url":"https://api.github.com/users/dave234/following{/other_user}","gists_url":"https://api.github.com/users/dave234/gists{/gist_id}","starred_url":"https://api.github.com/users/dave234/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dave234/subscriptions","organizations_url":"https://api.github.com/users/dave234/orgs","repos_url":"https://api.github.com/users/dave234/repos","events_url":"https://api.github.com/users/dave234/events{/privacy}","received_events_url":"https://api.github.com/users/dave234/received_events","type":"User","site_admin":false},"body":"This should really be two+ PRs.\r\n\r\nThe clip recorder was refactored to use an result type instead of the many fielded callback that was before.\r\nReordered the clip \"tap\" callback and the write to disk so that the tap can alter the audio before it gets written to disk.\r\n\r\nThere's also a change in AudioKit.start() where I addressed a deadlock caused by dispatch sync being called on the same thread it was dispatching to.\r\n\r\nAVAudioTime can use both sample and host times, made a change so that hostTime is preferred when both are present.\r\n\r\nI created the LoopbackRecording iOS example where we play the metronome, record it and play the recording of it along with itself. We get the recording, and playback scheduled as close to perfect as possible without applying device specific heuristics.\r\n\r\n### Notes\r\n\r\nI use AudioKit.engine.inputNode rather than AKMicrophone in the example. AKMicrophone currently uses an internal mixer, but this hides the timing info needed for accurate scheduling when tapping it. It would be nice to refactor AKMicrophone, or create AudioKit.inputNode to get around having to access the engine so much.\r\n\r\nI also don't call AudioKit.start(), there were multiple instances where I was getting off base warnings and unnecessary restarts, I was also forced to enable background mode, avoiding the use of AudioKit.output and AudioKit.start() seemed to make the issues go away. It is my opinion that the AVAudioSession management, along with any restarting code is application logic, and doesn't belong in AudioKit. At very least it should be separated from the rest of the audio management as much as possible.","created_at":"2018-05-04T23:53:13Z","updated_at":"2018-05-04T23:57:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4584fd964b84f244d1c2cb3e016deb7a5007cafb","assignee":null,"assignees":[],"requested_reviewers":[{"login":"aure","id":13122,"avatar_url":"https://avatars1.githubusercontent.com/u/13122?v=4","gravatar_id":"","url":"https://api.github.com/users/aure","html_url":"https://github.com/aure","followers_url":"https://api.github.com/users/aure/followers","following_url":"https://api.github.com/users/aure/following{/other_user}","gists_url":"https://api.github.com/users/aure/gists{/gist_id}","starred_url":"https://api.github.com/users/aure/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aure/subscriptions","organizations_url":"https://api.github.com/users/aure/orgs","repos_url":"https://api.github.com/users/aure/repos","events_url":"https://api.github.com/users/aure/events{/privacy}","received_events_url":"https://api.github.com/users/aure/received_events","type":"User","site_admin":false},{"login":"eljeff","id":4977304,"avatar_url":"https://avatars2.githubusercontent.com/u/4977304?v=4","gravatar_id":"","url":"https://api.github.com/users/eljeff","html_url":"https://github.com/eljeff","followers_url":"https://api.github.com/users/eljeff/followers","following_url":"https://api.github.com/users/eljeff/following{/other_user}","gists_url":"https://api.github.com/users/eljeff/gists{/gist_id}","starred_url":"https://api.github.com/users/eljeff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eljeff/subscriptions","organizations_url":"https://api.github.com/users/eljeff/orgs","repos_url":"https://api.github.com/users/eljeff/repos","events_url":"https://api.github.com/users/eljeff/events{/privacy}","received_events_url":"https://api.github.com/users/eljeff/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/AudioKit/AudioKit/pulls/1363/commits","review_comments_url":"https://api.github.com/repos/AudioKit/AudioKit/pulls/1363/comments","review_comment_url":"https://api.github.com/repos/AudioKit/AudioKit/pulls/comments{/number}","comments_url":"https://api.github.com/repos/AudioKit/AudioKit/issues/1363/comments","statuses_url":"https://api.github.com/repos/AudioKit/AudioKit/statuses/ff43976916a96756aa325a205f3087307e82ad04","head":{"label":"dave234:clip-recorder-refactor","ref":"clip-recorder-refactor","sha":"ff43976916a96756aa325a205f3087307e82ad04","user":{"login":"dave234","id":4334667,"avatar_url":"https://avatars2.githubusercontent.com/u/4334667?v=4","gravatar_id":"","url":"https://api.github.com/users/dave234","html_url":"https://github.com/dave234","followers_url":"https://api.github.com/users/dave234/followers","following_url":"https://api.github.com/users/dave234/following{/other_user}","gists_url":"https://api.github.com/users/dave234/gists{/gist_id}","starred_url":"https://api.github.com/users/dave234/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dave234/subscriptions","organizations_url":"https://api.github.com/users/dave234/orgs","repos_url":"https://api.github.com/users/dave234/repos","events_url":"https://api.github.com/users/dave234/events{/privacy}","received_events_url":"https://api.github.com/users/dave234/received_events","type":"User","site_admin":false},"repo":{"id":99749538,"name":"AudioKit","full_name":"dave234/AudioKit","owner":{"login":"dave234","id":4334667,"avatar_url":"https://avatars2.githubusercontent.com/u/4334667?v=4","gravatar_id":"","url":"https://api.github.com/users/dave234","html_url":"https://github.com/dave234","followers_url":"https://api.github.com/users/dave234/followers","following_url":"https://api.github.com/users/dave234/following{/other_user}","gists_url":"https://api.github.com/users/dave234/gists{/gist_id}","starred_url":"https://api.github.com/users/dave234/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dave234/subscriptions","organizations_url":"https://api.github.com/users/dave234/orgs","repos_url":"https://api.github.com/users/dave234/repos","events_url":"https://api.github.com/users/dave234/events{/privacy}","received_events_url":"https://api.github.com/users/dave234/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dave234/AudioKit","description":"Swift audio synthesis, processing, & analysis platform for iOS, macOS and tvOS","fork":true,"url":"https://api.github.com/repos/dave234/AudioKit","forks_url":"https://api.github.com/repos/dave234/AudioKit/forks","keys_url":"https://api.github.com/repos/dave234/AudioKit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dave234/AudioKit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dave234/AudioKit/teams","hooks_url":"https://api.github.com/repos/dave234/AudioKit/hooks","issue_events_url":"https://api.github.com/repos/dave234/AudioKit/issues/events{/number}","events_url":"https://api.github.com/repos/dave234/AudioKit/events","assignees_url":"https://api.github.com/repos/dave234/AudioKit/assignees{/user}","branches_url":"https://api.github.com/repos/dave234/AudioKit/branches{/branch}","tags_url":"https://api.github.com/repos/dave234/AudioKit/tags","blobs_url":"https://api.github.com/repos/dave234/AudioKit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dave234/AudioKit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dave234/AudioKit/git/refs{/sha}","trees_url":"https://api.github.com/repos/dave234/AudioKit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dave234/AudioKit/statuses/{sha}","languages_url":"https://api.github.com/repos/dave234/AudioKit/languages","stargazers_url":"https://api.github.com/repos/dave234/AudioKit/stargazers","contributors_url":"https://api.github.com/repos/dave234/AudioKit/contributors","subscribers_url":"https://api.github.com/repos/dave234/AudioKit/subscribers","subscription_url":"https://api.github.com/repos/dave234/AudioKit/subscription","commits_url":"https://api.github.com/repos/dave234/AudioKit/commits{/sha}","git_commits_url":"https://api.github.com/repos/dave234/AudioKit/git/commits{/sha}","comments_url":"https://api.github.com/repos/dave234/AudioKit/comments{/number}","issue_comment_url":"https://api.github.com/repos/dave234/AudioKit/issues/comments{/number}","contents_url":"https://api.github.com/repos/dave234/AudioKit/contents/{+path}","compare_url":"https://api.github.com/repos/dave234/AudioKit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dave234/AudioKit/merges","archive_url":"https://api.github.com/repos/dave234/AudioKit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dave234/AudioKit/downloads","issues_url":"https://api.github.com/repos/dave234/AudioKit/issues{/number}","pulls_url":"https://api.github.com/repos/dave234/AudioKit/pulls{/number}","milestones_url":"https://api.github.com/repos/dave234/AudioKit/milestones{/number}","notifications_url":"https://api.github.com/repos/dave234/AudioKit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dave234/AudioKit/labels{/name}","releases_url":"https://api.github.com/repos/dave234/AudioKit/releases{/id}","deployments_url":"https://api.github.com/repos/dave234/AudioKit/deployments","created_at":"2017-08-09T00:52:48Z","updated_at":"2017-08-09T00:52:53Z","pushed_at":"2018-05-04T23:30:38Z","git_url":"git://github.com/dave234/AudioKit.git","ssh_url":"git@github.com:dave234/AudioKit.git","clone_url":"https://github.com/dave234/AudioKit.git","svn_url":"https://github.com/dave234/AudioKit","homepage":"http://audiokit.io/","size":209398,"stargazers_count":0,"watchers_count":0,"language":"Swift","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"AudioKit:develop","ref":"develop","sha":"81ae37d6904ae117376c01343c8ed3dff70bcf14","user":{"login":"AudioKit","id":6593633,"avatar_url":"https://avatars0.githubusercontent.com/u/6593633?v=4","gravatar_id":"","url":"https://api.github.com/users/AudioKit","html_url":"https://github.com/AudioKit","followers_url":"https://api.github.com/users/AudioKit/followers","following_url":"https://api.github.com/users/AudioKit/following{/other_user}","gists_url":"https://api.github.com/users/AudioKit/gists{/gist_id}","starred_url":"https://api.github.com/users/AudioKit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AudioKit/subscriptions","organizations_url":"https://api.github.com/users/AudioKit/orgs","repos_url":"https://api.github.com/users/AudioKit/repos","events_url":"https://api.github.com/users/AudioKit/events{/privacy}","received_events_url":"https://api.github.com/users/AudioKit/received_events","type":"Organization","site_admin":false},"repo":{"id":16096528,"name":"AudioKit","full_name":"AudioKit/AudioKit","owner":{"login":"AudioKit","id":6593633,"avatar_url":"https://avatars0.githubusercontent.com/u/6593633?v=4","gravatar_id":"","url":"https://api.github.com/users/AudioKit","html_url":"https://github.com/AudioKit","followers_url":"https://api.github.com/users/AudioKit/followers","following_url":"https://api.github.com/users/AudioKit/following{/other_user}","gists_url":"https://api.github.com/users/AudioKit/gists{/gist_id}","starred_url":"https://api.github.com/users/AudioKit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AudioKit/subscriptions","organizations_url":"https://api.github.com/users/AudioKit/orgs","repos_url":"https://api.github.com/users/AudioKit/repos","events_url":"https://api.github.com/users/AudioKit/events{/privacy}","received_events_url":"https://api.github.com/users/AudioKit/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/AudioKit/AudioKit","description":"Swift audio synthesis, processing, & analysis platform for iOS, macOS and tvOS","fork":false,"url":"https://api.github.com/repos/AudioKit/AudioKit","forks_url":"https://api.github.com/repos/AudioKit/AudioKit/forks","keys_url":"https://api.github.com/repos/AudioKit/AudioKit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AudioKit/AudioKit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AudioKit/AudioKit/teams","hooks_url":"https://api.github.com/repos/AudioKit/AudioKit/hooks","issue_events_url":"https://api.github.com/repos/AudioKit/AudioKit/issues/events{/number}","events_url":"https://api.github.com/repos/AudioKit/AudioKit/events","assignees_url":"https://api.github.com/repos/AudioKit/AudioKit/assignees{/user}","branches_url":"https://api.github.com/repos/AudioKit/AudioKit/branches{/branch}","tags_url":"https://api.github.com/repos/AudioKit/AudioKit/tags","blobs_url":"https://api.github.com/repos/AudioKit/AudioKit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AudioKit/AudioKit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AudioKit/AudioKit/git/refs{/sha}","trees_url":"https://api.github.com/repos/AudioKit/AudioKit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AudioKit/AudioKit/statuses/{sha}","languages_url":"https://api.github.com/repos/AudioKit/AudioKit/languages","stargazers_url":"https://api.github.com/repos/AudioKit/AudioKit/stargazers","contributors_url":"https://api.github.com/repos/AudioKit/AudioKit/contributors","subscribers_url":"https://api.github.com/repos/AudioKit/AudioKit/subscribers","subscription_url":"https://api.github.com/repos/AudioKit/AudioKit/subscription","commits_url":"https://api.github.com/repos/AudioKit/AudioKit/commits{/sha}","git_commits_url":"https://api.github.com/repos/AudioKit/AudioKit/git/commits{/sha}","comments_url":"https://api.github.com/repos/AudioKit/AudioKit/comments{/number}","issue_comment_url":"https://api.github.com/repos/AudioKit/AudioKit/issues/comments{/number}","contents_url":"https://api.github.com/repos/AudioKit/AudioKit/contents/{+path}","compare_url":"https://api.github.com/repos/AudioKit/AudioKit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AudioKit/AudioKit/merges","archive_url":"https://api.github.com/repos/AudioKit/AudioKit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AudioKit/AudioKit/downloads","issues_url":"https://api.github.com/repos/AudioKit/AudioKit/issues{/number}","pulls_url":"https://api.github.com/repos/AudioKit/AudioKit/pulls{/number}","milestones_url":"https://api.github.com/repos/AudioKit/AudioKit/milestones{/number}","notifications_url":"https://api.github.com/repos/AudioKit/AudioKit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AudioKit/AudioKit/labels{/name}","releases_url":"https://api.github.com/repos/AudioKit/AudioKit/releases{/id}","deployments_url":"https://api.github.com/repos/AudioKit/AudioKit/deployments","created_at":"2014-01-21T08:16:07Z","updated_at":"2018-05-04T21:51:00Z","pushed_at":"2018-05-04T23:53:13Z","git_url":"git://github.com/AudioKit/AudioKit.git","ssh_url":"git@github.com:AudioKit/AudioKit.git","clone_url":"https://github.com/AudioKit/AudioKit.git","svn_url":"https://github.com/AudioKit/AudioKit","homepage":"http://audiokit.io/","size":213323,"stargazers_count":5279,"watchers_count":5279,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":781,"mirror_url":null,"archived":false,"open_issues_count":9,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":781,"open_issues":9,"watchers":5279,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/AudioKit/AudioKit/pulls/1363"},"html":{"href":"https://github.com/AudioKit/AudioKit/pull/1363"},"issue":{"href":"https://api.github.com/repos/AudioKit/AudioKit/issues/1363"},"comments":{"href":"https://api.github.com/repos/AudioKit/AudioKit/issues/1363/comments"},"review_comments":{"href":"https://api.github.com/repos/AudioKit/AudioKit/pulls/1363/comments"},"review_comment":{"href":"https://api.github.com/repos/AudioKit/AudioKit/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/AudioKit/AudioKit/pulls/1363/commits"},"statuses":{"href":"https://api.github.com/repos/AudioKit/AudioKit/statuses/ff43976916a96756aa325a205f3087307e82ad04"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"dave234"}}