mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-04 14:48:47 +00:00
SDL2 - audio allow change bit_set
sdl.OpenAudioDevice was incorrectly using a bool instead of a c.int for it's last parameter. To make the proc call more idiomatic and inline with other bindings a new bit_set was introduced to be used in place of the constants
This commit is contained in:
Vendored
+9
-7
@@ -74,12 +74,14 @@ when ODIN_ENDIAN == .Little {
|
|||||||
AUDIO_F32SYS :: AUDIO_F32MSB
|
AUDIO_F32SYS :: AUDIO_F32MSB
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AudioAllowChangeFlags :: distinct bit_set[AudioAllowChangeFlag; c.int]
|
||||||
AUDIO_ALLOW_FREQUENCY_CHANGE :: 0x00000001
|
AudioAllowChangeFlag :: enum c.int {
|
||||||
AUDIO_ALLOW_FORMAT_CHANGE :: 0x00000002
|
FREQUENCY = 0,
|
||||||
AUDIO_ALLOW_CHANNELS_CHANGE :: 0x00000004
|
FORMAT = 1,
|
||||||
AUDIO_ALLOW_SAMPLES_CHANGE :: 0x00000008
|
CHANNELS = 2,
|
||||||
AUDIO_ALLOW_ANY_CHANGE :: AUDIO_ALLOW_FREQUENCY_CHANGE|AUDIO_ALLOW_FORMAT_CHANGE|AUDIO_ALLOW_CHANNELS_CHANGE|AUDIO_ALLOW_SAMPLES_CHANGE
|
SAMPLES = 3,
|
||||||
|
}
|
||||||
|
AUDIO_ALLOW_ANY_CHANGE :: AudioAllowChangeFlags{.FREQUENCY, .FORMAT, .CHANNELS, .SAMPLES}
|
||||||
|
|
||||||
AudioCallback :: proc "c" (userdata: rawptr, stream: [^]u8, len: c.int)
|
AudioCallback :: proc "c" (userdata: rawptr, stream: [^]u8, len: c.int)
|
||||||
|
|
||||||
@@ -151,7 +153,7 @@ foreign lib {
|
|||||||
iscapture: bool,
|
iscapture: bool,
|
||||||
desired: ^AudioSpec,
|
desired: ^AudioSpec,
|
||||||
obtained: ^AudioSpec,
|
obtained: ^AudioSpec,
|
||||||
allowed_changes: bool) -> AudioDeviceID ---
|
allowed_changes: AudioAllowChangeFlags) -> AudioDeviceID ---
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user