{"action":"created","issue":{"url":"https://api.github.com/repos/Sakura-IT/SonnetAmiga/issues/31","repository_url":"https://api.github.com/repos/Sakura-IT/SonnetAmiga","labels_url":"https://api.github.com/repos/Sakura-IT/SonnetAmiga/issues/31/labels{/name}","comments_url":"https://api.github.com/repos/Sakura-IT/SonnetAmiga/issues/31/comments","events_url":"https://api.github.com/repos/Sakura-IT/SonnetAmiga/issues/31/events","html_url":"https://github.com/Sakura-IT/SonnetAmiga/issues/31","id":132661364,"number":31,"title":"Sound distorted when using AHI and a sound card","user":{"login":"DvdBoon","id":10966544,"avatar_url":"https://avatars.githubusercontent.com/u/10966544?v=3","gravatar_id":"","url":"https://api.github.com/users/DvdBoon","html_url":"https://github.com/DvdBoon","followers_url":"https://api.github.com/users/DvdBoon/followers","following_url":"https://api.github.com/users/DvdBoon/following{/other_user}","gists_url":"https://api.github.com/users/DvdBoon/gists{/gist_id}","starred_url":"https://api.github.com/users/DvdBoon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DvdBoon/subscriptions","organizations_url":"https://api.github.com/users/DvdBoon/orgs","repos_url":"https://api.github.com/users/DvdBoon/repos","events_url":"https://api.github.com/users/DvdBoon/events{/privacy}","received_events_url":"https://api.github.com/users/DvdBoon/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Sakura-IT/SonnetAmiga/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":{"login":"DvdBoon","id":10966544,"avatar_url":"https://avatars.githubusercontent.com/u/10966544?v=3","gravatar_id":"","url":"https://api.github.com/users/DvdBoon","html_url":"https://github.com/DvdBoon","followers_url":"https://api.github.com/users/DvdBoon/followers","following_url":"https://api.github.com/users/DvdBoon/following{/other_user}","gists_url":"https://api.github.com/users/DvdBoon/gists{/gist_id}","starred_url":"https://api.github.com/users/DvdBoon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DvdBoon/subscriptions","organizations_url":"https://api.github.com/users/DvdBoon/orgs","repos_url":"https://api.github.com/users/DvdBoon/repos","events_url":"https://api.github.com/users/DvdBoon/events{/privacy}","received_events_url":"https://api.github.com/users/DvdBoon/received_events","type":"User","site_admin":false},"milestone":null,"comments":2,"created_at":"2016-02-10T10:32:09Z","updated_at":"2016-02-15T12:31:30Z","closed_at":null,"body":"Using AHI together with a sound card results in a distorted sound. Using the Paula audio-modes from AHI does not give this distorted sound.\r\n\r\nCurrent hypothesis is because there is no priority-based scheduler yet in the sonnet.library (all tasks get equal time) the sound task gets not enough cpu time (switches away too much)."},"comment":{"url":"https://api.github.com/repos/Sakura-IT/SonnetAmiga/issues/comments/184187069","html_url":"https://github.com/Sakura-IT/SonnetAmiga/issues/31#issuecomment-184187069","issue_url":"https://api.github.com/repos/Sakura-IT/SonnetAmiga/issues/31","id":184187069,"user":{"login":"DvdBoon","id":10966544,"avatar_url":"https://avatars.githubusercontent.com/u/10966544?v=3","gravatar_id":"","url":"https://api.github.com/users/DvdBoon","html_url":"https://github.com/DvdBoon","followers_url":"https://api.github.com/users/DvdBoon/followers","following_url":"https://api.github.com/users/DvdBoon/following{/other_user}","gists_url":"https://api.github.com/users/DvdBoon/gists{/gist_id}","starred_url":"https://api.github.com/users/DvdBoon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DvdBoon/subscriptions","organizations_url":"https://api.github.com/users/DvdBoon/orgs","repos_url":"https://api.github.com/users/DvdBoon/repos","events_url":"https://api.github.com/users/DvdBoon/events{/privacy}","received_events_url":"https://api.github.com/users/DvdBoon/received_events","type":"User","site_admin":false},"created_at":"2016-02-15T12:31:30Z","updated_at":"2016-02-15T12:31:30Z","body":"Well, been busy this weekend with the sound issue. Thinking out loud here:\r\n\r\nLooking into the various programs using AHI shows that the programs actually not really use different priorities/niceness for the various tasks. Frogger uses a nice level of 1 for audio and video decoding which means it gets slightly less CPU time than the main program. The rest have a nice level of 0.\r\n\r\nUpping the switch frequency from 20 ms to 0.5 ms removes the stuttering from single threaded programs like Quake and glQuake, but not for multi-threaded games like Quake2.\r\n\r\nIt's still either scheduler or interrupt related. There's still the strange observation that Run68K does a context switch of 0.5 ms according to WarpRace, while RunPPC does 6.0 ms (while using the same mechanisms on both sides). Maybe there's a problem in the task switching on the PPC side with tasks having a default run time of 6 ms because interruption/signalling fails somehow. In the case of Quake2 (which has 3 tasks running) it would mean a latency of 18 ms before the sound task would get CPU time again, even when asking CPU time long before that. (resulting in a buffer under-run).\r\n\r\nThe fact that upping the frequency of the decrementer interrupt helps with single threaded software would indicate a problem with getting tasks back from the wait status correctly. Upping the decrementer frequency did not lower the RunPPC lateny of 6 ms. \r\n\r\nI'll add debug code to measure the switch latency of RunPPC directly, bypassing the scheduler."}}