{"action":"created","issue":{"url":"https://api.github.com/repos/cyxx/rawgl/issues/24","repository_url":"https://api.github.com/repos/cyxx/rawgl","labels_url":"https://api.github.com/repos/cyxx/rawgl/issues/24/labels{/name}","comments_url":"https://api.github.com/repos/cyxx/rawgl/issues/24/comments","events_url":"https://api.github.com/repos/cyxx/rawgl/issues/24/events","html_url":"https://github.com/cyxx/rawgl/issues/24","id":296202550,"node_id":"MDU6SXNzdWUyOTYyMDI1NTA=","number":24,"title":"[Proposed optimization] Is pre-converting sounds possible?","user":{"login":"vanfanel","id":837585,"node_id":"MDQ6VXNlcjgzNzU4NQ==","avatar_url":"https://avatars1.githubusercontent.com/u/837585?v=4","gravatar_id":"","url":"https://api.github.com/users/vanfanel","html_url":"https://github.com/vanfanel","followers_url":"https://api.github.com/users/vanfanel/followers","following_url":"https://api.github.com/users/vanfanel/following{/other_user}","gists_url":"https://api.github.com/users/vanfanel/gists{/gist_id}","starred_url":"https://api.github.com/users/vanfanel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vanfanel/subscriptions","organizations_url":"https://api.github.com/users/vanfanel/orgs","repos_url":"https://api.github.com/users/vanfanel/repos","events_url":"https://api.github.com/users/vanfanel/events{/privacy}","received_events_url":"https://api.github.com/users/vanfanel/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-02-11T16:23:16Z","updated_at":"2018-07-30T20:45:40Z","closed_at":null,"author_association":"NONE","body":"Hi there, cyxx\r\n\r\nToday I was playing rawgl on the Raspberry Pi, and I noticed it has some strange pauses in points of the game where the original Amiga version runs smoothly. For example, when you start a new game, the game stalls like a second when Lester is teleported underwater. That does NOT happen on Amiga, so I went on to investigate.\r\n\r\nThe cause is the call to Mix_LoadWAV_RW() in mixer.cpp here at this point: \r\nhttps://github.com/cyxx/rawgl/blob/master/mixer.cpp#L118\r\n\r\nIn the past, I found out that other SDL2 games had the same problem, and it was fixed by moving the conversion code to where it belongs: when the sounds are loaded and not when they are going to be played:\r\nhttps://github.com/NagyD/SDLPoP/issues/142\r\n(SDLPop had the same pauses, but it was fixed by pre-loading the sounds and pre-converting their formats via Mix_LoadWAV_RW(), and now performs perfectly on the Pi)\r\n\r\nCould something similar be done for rawgl?\r\n\r\nNOTE: The real problem is the SDL_BuildAudioCVT() call that Mix_LoadWAV_RW() does under the hood, just as a curiosity.\r\nMix_QuickLoad_WAV() does not have this problem, since it does not use SDL_BuildAudioCVT() internally."},"comment":{"url":"https://api.github.com/repos/cyxx/rawgl/issues/comments/409004116","html_url":"https://github.com/cyxx/rawgl/issues/24#issuecomment-409004116","issue_url":"https://api.github.com/repos/cyxx/rawgl/issues/24","id":409004116,"node_id":"MDEyOklzc3VlQ29tbWVudDQwOTAwNDExNg==","user":{"login":"vanfanel","id":837585,"node_id":"MDQ6VXNlcjgzNzU4NQ==","avatar_url":"https://avatars1.githubusercontent.com/u/837585?v=4","gravatar_id":"","url":"https://api.github.com/users/vanfanel","html_url":"https://github.com/vanfanel","followers_url":"https://api.github.com/users/vanfanel/followers","following_url":"https://api.github.com/users/vanfanel/following{/other_user}","gists_url":"https://api.github.com/users/vanfanel/gists{/gist_id}","starred_url":"https://api.github.com/users/vanfanel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vanfanel/subscriptions","organizations_url":"https://api.github.com/users/vanfanel/orgs","repos_url":"https://api.github.com/users/vanfanel/repos","events_url":"https://api.github.com/users/vanfanel/events{/privacy}","received_events_url":"https://api.github.com/users/vanfanel/received_events","type":"User","site_admin":false},"created_at":"2018-07-30T20:45:40Z","updated_at":"2018-07-30T20:45:40Z","author_association":"NONE","body":"@cyxx : I detected a similar problem with SDL's audio conversion on DoomRetro:\r\n\r\nIt got fixed by going back to the engine's own conversion code instead of using SDL2/SDL2_Mixer conversion, which as I said causes a stall everytime a sound is converted.\r\nhttps://github.com/bradharding/doomretro/commit/a6084f2f5f5ad3ee83d5bef22cdc3e2dd6ebadab\r\n\r\nAnd this is where the code lives, maybe you can use it on RawGL so it performs as expected on the Raspberry Pi and other ARM boards:\r\nhttps://github.com/bradharding/doomretro/blob/master/src/i_sound.c#L243\r\nThat function performs well on ARM boards, instead of using SDL2's SLOOOOW converter stuff."}}
{"actor":{"display_login":"vanfanel"}}