Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrote the DeviceInfo struct so that it uses pure Go types and is no…
… longer directly passable to Miniaudio. This is to avoide subtle errors where Miniaudio updates, an internal struct field type changes, and suddenly your app is crashing for no good reason because the Malgo version of the Info struct is still using the old types, some field offsets are all wrong ETC. Before this, Malgo could crash on 32-bit Windows. Now CGO resolves struct field offsets and we just convert between C and Go. DeviceInfo now uses anonymous structs just like Miniaudio. The advantage of this is that everything is in one place and looks nicer in docs, and we can remove a bunch of types that are only ever used in device info and clutter up the docs. Added the DeviceInfo.toCRepr() and deviceInfoFromCRepr method and function which convert between C and Go representations of DeviceInfo. All fields with type uint32 are now type int, meaning you usually need less type conversions. Many Go functions just use int by default and converting between everything is annoying. Name is now type string instead of type [256]char and we use C.GoString to properly convert it into a Go string. We could probably convert it to a string instead using string(info.Name[:firstZeroByte]), but whatever. Fixes gen2brain#28. Added the Formats field which is a slice of FormatType. This replaces the old Formats and FormatCount fields and does a better job than both of them combined, which is basically what it is. Breaking change because the types of nearly all if not all fields has changed. Nothing else has changed.
- Loading branch information