{"action":"created","comment":{"url":"https://api.github.com/repos/citra-emu/citra/pulls/comments/61288680","id":61288680,"diff_hunk":"@@ -0,0 +1,82 @@\n+// Copyright 2016 Citra Emulator Project\n+// Licensed under GPLv2 or any later version\n+// Refer to the license.txt file included.\n+\n+#include \"audio_core/interpolate.h\"\n+\n+#include \"common/assert.h\"\n+#include \"common/math_util.h\"\n+\n+namespace AudioInterp {\n+\n+// Calculations are done in fixed point with 24 fractional bits.\n+constexpr u64 scale_factor = static_cast<u64>(1 << 24);\n+constexpr u64 scale_mask = scale_factor - 1;\n+\n+/// Here we step over the input in steps of rate_multiplier, until we consume all of the input.\n+/// Three adjacent samples are passed to fn each step.\n+template <typename Function>\n+static StereoBuffer16 StepOverSamples(State& state, const StereoBuffer16& input, float rate_multiplier, Function fn) {\n+    if (input.size() < 2)\n+        return {};\n+\n+    StereoBuffer16 output;\n+    output.reserve(static_cast<size_t>(input.size() * rate_multiplier));\n+\n+    u64 step_size = static_cast<u64>(rate_multiplier * scale_factor);\n+\n+    u64 fposition = 0;\n+\n+    while (fposition < 2 * scale_factor) {\n+        u64 fraction = fposition & scale_mask;\n+\n+        if (fposition < 1 * scale_factor) {\n+            output.push_back(fn(fraction, state.xn2, state.xn1, input[0]));\n+        } else if (fposition < 2 * scale_factor) {\n+            output.push_back(fn(fraction, state.xn1, input[0], input[1]));\n+        } else {\n+            UNREACHABLE();","path":"src/audio_core/interpolate.cpp","position":38,"original_position":38,"commit_id":"1867e829207002716eedb70d933a264cc97d2860","original_commit_id":"1867e829207002716eedb70d933a264cc97d2860","user":{"login":"MerryMage","id":8682882,"avatar_url":"https://avatars.githubusercontent.com/u/8682882?v=3","gravatar_id":"","url":"https://api.github.com/users/MerryMage","html_url":"https://github.com/MerryMage","followers_url":"https://api.github.com/users/MerryMage/followers","following_url":"https://api.github.com/users/MerryMage/following{/other_user}","gists_url":"https://api.github.com/users/MerryMage/gists{/gist_id}","starred_url":"https://api.github.com/users/MerryMage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MerryMage/subscriptions","organizations_url":"https://api.github.com/users/MerryMage/orgs","repos_url":"https://api.github.com/users/MerryMage/repos","events_url":"https://api.github.com/users/MerryMage/events{/privacy}","received_events_url":"https://api.github.com/users/MerryMage/received_events","type":"User","site_admin":false},"body":"... in hind-sight this is rather silly","created_at":"2016-04-27T16:17:51Z","updated_at":"2016-04-27T16:17:51Z","html_url":"https://github.com/citra-emu/citra/pull/1723#discussion_r61288680","pull_request_url":"https://api.github.com/repos/citra-emu/citra/pulls/1723","_links":{"self":{"href":"https://api.github.com/repos/citra-emu/citra/pulls/comments/61288680"},"html":{"href":"https://github.com/citra-emu/citra/pull/1723#discussion_r61288680"},"pull_request":{"href":"https://api.github.com/repos/citra-emu/citra/pulls/1723"}}},"pull_request":{"url":"https://api.github.com/repos/citra-emu/citra/pulls/1723","id":68077246,"html_url":"https://github.com/citra-emu/citra/pull/1723","diff_url":"https://github.com/citra-emu/citra/pull/1723.diff","patch_url":"https://github.com/citra-emu/citra/pull/1723.patch","issue_url":"https://api.github.com/repos/citra-emu/citra/issues/1723","number":1723,"state":"open","locked":false,"title":"AudioCore: Implement interpolation","user":{"login":"MerryMage","id":8682882,"avatar_url":"https://avatars.githubusercontent.com/u/8682882?v=3","gravatar_id":"","url":"https://api.github.com/users/MerryMage","html_url":"https://github.com/MerryMage","followers_url":"https://api.github.com/users/MerryMage/followers","following_url":"https://api.github.com/users/MerryMage/following{/other_user}","gists_url":"https://api.github.com/users/MerryMage/gists{/gist_id}","starred_url":"https://api.github.com/users/MerryMage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MerryMage/subscriptions","organizations_url":"https://api.github.com/users/MerryMage/orgs","repos_url":"https://api.github.com/users/MerryMage/repos","events_url":"https://api.github.com/users/MerryMage/events{/privacy}","received_events_url":"https://api.github.com/users/MerryMage/received_events","type":"User","site_admin":false},"body":"Black-box tested against actual DSP firmware. Annoyingly I couldn't get it exact; that would have to wait for white-box RE. Error in values is +/- 1. `scale_factor` chosen for minimum error.","created_at":"2016-04-27T15:48:52Z","updated_at":"2016-04-27T16:17:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8a88a7db67849b2ce5426cbdba731fbd252ed182","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/citra-emu/citra/pulls/1723/commits","review_comments_url":"https://api.github.com/repos/citra-emu/citra/pulls/1723/comments","review_comment_url":"https://api.github.com/repos/citra-emu/citra/pulls/comments{/number}","comments_url":"https://api.github.com/repos/citra-emu/citra/issues/1723/comments","statuses_url":"https://api.github.com/repos/citra-emu/citra/statuses/1867e829207002716eedb70d933a264cc97d2860","head":{"label":"MerryMage:audio-interp","ref":"audio-interp","sha":"1867e829207002716eedb70d933a264cc97d2860","user":{"login":"MerryMage","id":8682882,"avatar_url":"https://avatars.githubusercontent.com/u/8682882?v=3","gravatar_id":"","url":"https://api.github.com/users/MerryMage","html_url":"https://github.com/MerryMage","followers_url":"https://api.github.com/users/MerryMage/followers","following_url":"https://api.github.com/users/MerryMage/following{/other_user}","gists_url":"https://api.github.com/users/MerryMage/gists{/gist_id}","starred_url":"https://api.github.com/users/MerryMage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MerryMage/subscriptions","organizations_url":"https://api.github.com/users/MerryMage/orgs","repos_url":"https://api.github.com/users/MerryMage/repos","events_url":"https://api.github.com/users/MerryMage/events{/privacy}","received_events_url":"https://api.github.com/users/MerryMage/received_events","type":"User","site_admin":false},"repo":{"id":49902315,"name":"citra","full_name":"MerryMage/citra","owner":{"login":"MerryMage","id":8682882,"avatar_url":"https://avatars.githubusercontent.com/u/8682882?v=3","gravatar_id":"","url":"https://api.github.com/users/MerryMage","html_url":"https://github.com/MerryMage","followers_url":"https://api.github.com/users/MerryMage/followers","following_url":"https://api.github.com/users/MerryMage/following{/other_user}","gists_url":"https://api.github.com/users/MerryMage/gists{/gist_id}","starred_url":"https://api.github.com/users/MerryMage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MerryMage/subscriptions","organizations_url":"https://api.github.com/users/MerryMage/orgs","repos_url":"https://api.github.com/users/MerryMage/repos","events_url":"https://api.github.com/users/MerryMage/events{/privacy}","received_events_url":"https://api.github.com/users/MerryMage/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/MerryMage/citra","description":"Nintendo 3DS emulator/debugger","fork":true,"url":"https://api.github.com/repos/MerryMage/citra","forks_url":"https://api.github.com/repos/MerryMage/citra/forks","keys_url":"https://api.github.com/repos/MerryMage/citra/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MerryMage/citra/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MerryMage/citra/teams","hooks_url":"https://api.github.com/repos/MerryMage/citra/hooks","issue_events_url":"https://api.github.com/repos/MerryMage/citra/issues/events{/number}","events_url":"https://api.github.com/repos/MerryMage/citra/events","assignees_url":"https://api.github.com/repos/MerryMage/citra/assignees{/user}","branches_url":"https://api.github.com/repos/MerryMage/citra/branches{/branch}","tags_url":"https://api.github.com/repos/MerryMage/citra/tags","blobs_url":"https://api.github.com/repos/MerryMage/citra/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MerryMage/citra/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MerryMage/citra/git/refs{/sha}","trees_url":"https://api.github.com/repos/MerryMage/citra/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MerryMage/citra/statuses/{sha}","languages_url":"https://api.github.com/repos/MerryMage/citra/languages","stargazers_url":"https://api.github.com/repos/MerryMage/citra/stargazers","contributors_url":"https://api.github.com/repos/MerryMage/citra/contributors","subscribers_url":"https://api.github.com/repos/MerryMage/citra/subscribers","subscription_url":"https://api.github.com/repos/MerryMage/citra/subscription","commits_url":"https://api.github.com/repos/MerryMage/citra/commits{/sha}","git_commits_url":"https://api.github.com/repos/MerryMage/citra/git/commits{/sha}","comments_url":"https://api.github.com/repos/MerryMage/citra/comments{/number}","issue_comment_url":"https://api.github.com/repos/MerryMage/citra/issues/comments{/number}","contents_url":"https://api.github.com/repos/MerryMage/citra/contents/{+path}","compare_url":"https://api.github.com/repos/MerryMage/citra/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MerryMage/citra/merges","archive_url":"https://api.github.com/repos/MerryMage/citra/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MerryMage/citra/downloads","issues_url":"https://api.github.com/repos/MerryMage/citra/issues{/number}","pulls_url":"https://api.github.com/repos/MerryMage/citra/pulls{/number}","milestones_url":"https://api.github.com/repos/MerryMage/citra/milestones{/number}","notifications_url":"https://api.github.com/repos/MerryMage/citra/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MerryMage/citra/labels{/name}","releases_url":"https://api.github.com/repos/MerryMage/citra/releases{/id}","deployments_url":"https://api.github.com/repos/MerryMage/citra/deployments","created_at":"2016-01-18T20:13:00Z","updated_at":"2016-04-20T16:50:20Z","pushed_at":"2016-04-27T15:44:20Z","git_url":"git://github.com/MerryMage/citra.git","ssh_url":"git@github.com:MerryMage/citra.git","clone_url":"https://github.com/MerryMage/citra.git","svn_url":"https://github.com/MerryMage/citra","homepage":null,"size":12739,"stargazers_count":7,"watchers_count":7,"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":7,"default_branch":"audio"}},"base":{"label":"citra-emu:master","ref":"master","sha":"1ecee38468f08445681e52f67dc9cf6b8302cffa","user":{"login":"citra-emu","id":7605670,"avatar_url":"https://avatars.githubusercontent.com/u/7605670?v=3","gravatar_id":"","url":"https://api.github.com/users/citra-emu","html_url":"https://github.com/citra-emu","followers_url":"https://api.github.com/users/citra-emu/followers","following_url":"https://api.github.com/users/citra-emu/following{/other_user}","gists_url":"https://api.github.com/users/citra-emu/gists{/gist_id}","starred_url":"https://api.github.com/users/citra-emu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/citra-emu/subscriptions","organizations_url":"https://api.github.com/users/citra-emu/orgs","repos_url":"https://api.github.com/users/citra-emu/repos","events_url":"https://api.github.com/users/citra-emu/events{/privacy}","received_events_url":"https://api.github.com/users/citra-emu/received_events","type":"Organization","site_admin":false},"repo":{"id":19866730,"name":"citra","full_name":"citra-emu/citra","owner":{"login":"citra-emu","id":7605670,"avatar_url":"https://avatars.githubusercontent.com/u/7605670?v=3","gravatar_id":"","url":"https://api.github.com/users/citra-emu","html_url":"https://github.com/citra-emu","followers_url":"https://api.github.com/users/citra-emu/followers","following_url":"https://api.github.com/users/citra-emu/following{/other_user}","gists_url":"https://api.github.com/users/citra-emu/gists{/gist_id}","starred_url":"https://api.github.com/users/citra-emu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/citra-emu/subscriptions","organizations_url":"https://api.github.com/users/citra-emu/orgs","repos_url":"https://api.github.com/users/citra-emu/repos","events_url":"https://api.github.com/users/citra-emu/events{/privacy}","received_events_url":"https://api.github.com/users/citra-emu/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/citra-emu/citra","description":"Nintendo 3DS Emulator","fork":false,"url":"https://api.github.com/repos/citra-emu/citra","forks_url":"https://api.github.com/repos/citra-emu/citra/forks","keys_url":"https://api.github.com/repos/citra-emu/citra/keys{/key_id}","collaborators_url":"https://api.github.com/repos/citra-emu/citra/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/citra-emu/citra/teams","hooks_url":"https://api.github.com/repos/citra-emu/citra/hooks","issue_events_url":"https://api.github.com/repos/citra-emu/citra/issues/events{/number}","events_url":"https://api.github.com/repos/citra-emu/citra/events","assignees_url":"https://api.github.com/repos/citra-emu/citra/assignees{/user}","branches_url":"https://api.github.com/repos/citra-emu/citra/branches{/branch}","tags_url":"https://api.github.com/repos/citra-emu/citra/tags","blobs_url":"https://api.github.com/repos/citra-emu/citra/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/citra-emu/citra/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/citra-emu/citra/git/refs{/sha}","trees_url":"https://api.github.com/repos/citra-emu/citra/git/trees{/sha}","statuses_url":"https://api.github.com/repos/citra-emu/citra/statuses/{sha}","languages_url":"https://api.github.com/repos/citra-emu/citra/languages","stargazers_url":"https://api.github.com/repos/citra-emu/citra/stargazers","contributors_url":"https://api.github.com/repos/citra-emu/citra/contributors","subscribers_url":"https://api.github.com/repos/citra-emu/citra/subscribers","subscription_url":"https://api.github.com/repos/citra-emu/citra/subscription","commits_url":"https://api.github.com/repos/citra-emu/citra/commits{/sha}","git_commits_url":"https://api.github.com/repos/citra-emu/citra/git/commits{/sha}","comments_url":"https://api.github.com/repos/citra-emu/citra/comments{/number}","issue_comment_url":"https://api.github.com/repos/citra-emu/citra/issues/comments{/number}","contents_url":"https://api.github.com/repos/citra-emu/citra/contents/{+path}","compare_url":"https://api.github.com/repos/citra-emu/citra/compare/{base}...{head}","merges_url":"https://api.github.com/repos/citra-emu/citra/merges","archive_url":"https://api.github.com/repos/citra-emu/citra/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/citra-emu/citra/downloads","issues_url":"https://api.github.com/repos/citra-emu/citra/issues{/number}","pulls_url":"https://api.github.com/repos/citra-emu/citra/pulls{/number}","milestones_url":"https://api.github.com/repos/citra-emu/citra/milestones{/number}","notifications_url":"https://api.github.com/repos/citra-emu/citra/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/citra-emu/citra/labels{/name}","releases_url":"https://api.github.com/repos/citra-emu/citra/releases{/id}","deployments_url":"https://api.github.com/repos/citra-emu/citra/deployments","created_at":"2014-05-16T18:33:15Z","updated_at":"2016-04-27T11:52:57Z","pushed_at":"2016-04-27T15:48:52Z","git_url":"git://github.com/citra-emu/citra.git","ssh_url":"git@github.com:citra-emu/citra.git","clone_url":"https://github.com/citra-emu/citra.git","svn_url":"https://github.com/citra-emu/citra","homepage":"https://citra-emu.org","size":19782,"stargazers_count":1730,"watchers_count":1730,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":414,"mirror_url":null,"open_issues_count":207,"forks":414,"open_issues":207,"watchers":1730,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/citra-emu/citra/pulls/1723"},"html":{"href":"https://github.com/citra-emu/citra/pull/1723"},"issue":{"href":"https://api.github.com/repos/citra-emu/citra/issues/1723"},"comments":{"href":"https://api.github.com/repos/citra-emu/citra/issues/1723/comments"},"review_comments":{"href":"https://api.github.com/repos/citra-emu/citra/pulls/1723/comments"},"review_comment":{"href":"https://api.github.com/repos/citra-emu/citra/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/citra-emu/citra/pulls/1723/commits"},"statuses":{"href":"https://api.github.com/repos/citra-emu/citra/statuses/1867e829207002716eedb70d933a264cc97d2860"}}}}