{"action":"created","issue":{"url":"https://api.github.com/repos/haskell-game/sdl2/issues/65","labels_url":"https://api.github.com/repos/haskell-game/sdl2/issues/65/labels{/name}","comments_url":"https://api.github.com/repos/haskell-game/sdl2/issues/65/comments","events_url":"https://api.github.com/repos/haskell-game/sdl2/issues/65/events","html_url":"https://github.com/haskell-game/sdl2/pull/65","id":86924186,"number":65,"title":"Add new datatypes for SDL2's audio format","user":{"login":"svenkeidel","id":266500,"avatar_url":"https://avatars.githubusercontent.com/u/266500?v=3","gravatar_id":"","url":"https://api.github.com/users/svenkeidel","html_url":"https://github.com/svenkeidel","followers_url":"https://api.github.com/users/svenkeidel/followers","following_url":"https://api.github.com/users/svenkeidel/following{/other_user}","gists_url":"https://api.github.com/users/svenkeidel/gists{/gist_id}","starred_url":"https://api.github.com/users/svenkeidel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/svenkeidel/subscriptions","organizations_url":"https://api.github.com/users/svenkeidel/orgs","repos_url":"https://api.github.com/users/svenkeidel/repos","events_url":"https://api.github.com/users/svenkeidel/events{/privacy}","received_events_url":"https://api.github.com/users/svenkeidel/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-06-10T10:44:18Z","updated_at":"2015-06-10T11:23:47Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/haskell-game/sdl2/pulls/65","html_url":"https://github.com/haskell-game/sdl2/pull/65","diff_url":"https://github.com/haskell-game/sdl2/pull/65.diff","patch_url":"https://github.com/haskell-game/sdl2/pull/65.patch"},"body":"The code for the encoding and decoding of the audio format is derived from\r\nhttps://wiki.libsdl.org/SDL_AudioFormat\r\n\r\n     +----------------------sample is signed if set\r\n     |\r\n     |        +----------sample is bigendian if set\r\n     |        |\r\n     |        |           +--sample is float if set\r\n     |        |           |\r\n     |        |           |  +--sample bit size---+\r\n     |        |           |  |                    |\r\n    15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0\r\n\r\nThe new introduced haskell datatypes are the following\r\n\r\n    data AudioFormat = AudioFormat NumberFormat SampleBitSize Endianess\r\n    data NumberFormat = SignedInteger | UnsignedInteger | Float\r\n    type SampleBitSize = Word8\r\n    data Endianess = LittleEndian | BigEndian | Native\r\n\r\nThe native endianess detection is not implemented yet. The endianess could be\r\ndetected using SDL_endian.h\r\n\r\nI hope the use of the new feature `BinaryLiterals` is ok.\r\n\r\nBest,\r\nSven"},"comment":{"url":"https://api.github.com/repos/haskell-game/sdl2/issues/comments/110705567","html_url":"https://github.com/haskell-game/sdl2/pull/65#issuecomment-110705567","issue_url":"https://api.github.com/repos/haskell-game/sdl2/issues/65","id":110705567,"user":{"login":"svenkeidel","id":266500,"avatar_url":"https://avatars.githubusercontent.com/u/266500?v=3","gravatar_id":"","url":"https://api.github.com/users/svenkeidel","html_url":"https://github.com/svenkeidel","followers_url":"https://api.github.com/users/svenkeidel/followers","following_url":"https://api.github.com/users/svenkeidel/following{/other_user}","gists_url":"https://api.github.com/users/svenkeidel/gists{/gist_id}","starred_url":"https://api.github.com/users/svenkeidel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/svenkeidel/subscriptions","organizations_url":"https://api.github.com/users/svenkeidel/orgs","repos_url":"https://api.github.com/users/svenkeidel/repos","events_url":"https://api.github.com/users/svenkeidel/events{/privacy}","received_events_url":"https://api.github.com/users/svenkeidel/received_events","type":"User","site_admin":false},"created_at":"2015-06-10T11:23:47Z","updated_at":"2015-06-10T11:23:47Z","body":"I left the binary literals in the code as documentation. I find binary literals much easier to understand than bit wise shifts. In the future if binary literals are a standard feature, we can switch easily to binary literals just by uncommenting and deleting the shift operations and magic numbers."}}