text
stringlengths 12
786k
|
---|
let get_event_state e = event_state e sdl_query
|
let set_event_state e s = ignore ( event_state e s )
|
let flush_event = foreign " SDL_FlushEvent " ( event_type @-> returning void )
|
let flush_events = foreign " SDL_FlushEvents " ( event_type @-> event_type @-> returning void )
|
let has_event = foreign " SDL_HasEvent " ( event_type @-> returning bool )
|
let has_events = foreign " SDL_HasEvents " ( event_type @-> event_type @-> returning bool )
|
let poll_event = foreign " SDL_PollEvent " ( ptr Event . t @-> returning bool )
|
let poll_event e = poll_event ( Event . opt_addr e )
|
let pump_events = foreign " SDL_PumpEvents " ( void @-> returning void )
|
let push_event = foreign " SDL_PushEvent " ( ptr Event . t @-> returning bool_to_ok )
|
let push_event e = push_event ( addr e )
|
let register_events = foreign " SDL_RegisterEvents " ( int @-> returning uint32_t )
|
let register_event ( ) = match Unsigned . UInt32 . to_int32 ( register_events 1 ) with
|
let wait_event = foreign ~ release_runtime_lock : true " SDL_WaitEvent " ( ptr Event . t @-> returning int )
|
let wait_event e = match wait_event ( Event . opt_addr e ) with
|
let wait_event_timeout = foreign " SDL_WaitEventTimeout " ~ release_runtime_lock : true ( ptr Event . t @-> int @-> returning bool )
|
let wait_event_timeout e t = wait_event_timeout ( Event . opt_addr e ) t
|
type haptic = unit ptr
|
let haptic : haptic typ = ptr void
|
let haptic_opt : haptic option typ = ptr_opt void
|
let unsafe_haptic_of_ptr addr : haptic = ptr_of_raw_address addr
|
let unsafe_ptr_of_haptic haptic = raw_address_of_ptr ( to_voidp haptic )
|
module Haptic = struct let infinity = - 1l type feature = int let gain = sdl_haptic_gain let autocenter = sdl_haptic_autocenter let status = sdl_haptic_status let pause = sdl_haptic_pause type direction_type = int let polar = sdl_haptic_polar let cartesian = sdl_haptic_cartesian let spherical = sdl_haptic_spherical module Direction = struct type _t type t = _t structure let t : _t structure typ = structure " SDL_HapticDirection " let typ = field t " type " int_as_uint8_t let dir_0 = field t " dir0 " int32_t let dir_1 = field t " dir1 " int32_t let dir_2 = field t " dir2 " int32_t let ( ) = seal t let create typv d0 d1 d2 = let d = make t in setf d typ typv ; setf d dir_0 d0 ; setf d dir_1 d1 ; setf d dir_2 d2 ; d let typ d = getf d typ let dir_0 d = getf d dir_0 let dir_1 d = getf d dir_1 let dir_2 d = getf d dir_2 end module Constant = struct type t let t : t structure typ = structure " SDL_HapticConstant " let typ = field t " type " int_as_uint16_t let direction = field t " direction " Direction . t let length = field t " length " int32_as_uint32_t let delay = field t " delay " int_as_uint16_t let button = field t " button " int_as_uint16_t let interval = field t " interval " int_as_uint16_t let level = field t " level " int16_t let attack_length = field t " attack_length " int_as_uint16_t let attack_level = field t " attack_level " int_as_uint16_t let fade_length = field t " fade_length " int_as_uint16_t let fade_level = field t " fade_level " int_as_uint16_t let ( ) = seal t end module Periodic = struct type t let t : t structure typ = structure " SDL_HapticPeriodic " let typ = field t " type " int_as_uint16_t let direction = field t " direction " Direction . t let length = field t " length " int32_as_uint32_t let delay = field t " delay " int_as_uint16_t let button = field t " button " int_as_uint16_t let interval = field t " interval " int_as_uint16_t let period = field t " period " int_as_uint16_t let magnitude = field t " magnitude " int16_t let offset = field t " offset " int16_t let phase = field t " phase " int_as_uint16_t let attack_length = field t " attack_length " int_as_uint16_t let attack_level = field t " attack_level " int_as_uint16_t let fade_length = field t " fade_length " int_as_uint16_t let fade_level = field t " fade_level " int_as_uint16_t let ( ) = seal t end module Condition = struct type t let t : t structure typ = structure " SDL_HapticCondition " let typ = field t " type " int_as_uint16_t let direction = field t " direction " Direction . t let length = field t " length " int32_as_uint32_t let delay = field t " delay " int_as_uint16_t let button = field t " button " int_as_uint16_t let interval = field t " interval " int_as_uint16_t let right_sat_0 = field t " right_sat [ 0 ] " int_as_uint16_t let right_sat_1 = field t " right_sat [ 1 ] " int_as_uint16_t let right_sat_2 = field t " right_sat [ 2 ] " int_as_uint16_t let left_sat_0 = field t " left_sat [ 0 ] " int_as_uint16_t let left_sat_1 = field t " left_sat [ 1 ] " int_as_uint16_t let left_sat_2 = field t " left_sat [ 2 ] " int_as_uint16_t let right_coeff_0 = field t " right_coeff [ 0 ] " int16_t let right_coeff_1 = field t " right_coeff [ 1 ] " int16_t let right_coeff_2 = field t " right_coeff [ 2 ] " int16_t let left_coeff_0 = field t " left_coeff [ 0 ] " int16_t let left_coeff_1 = field t " left_coeff [ 1 ] " int16_t let left_coeff_2 = field t " left_coeff [ 2 ] " int16_t let deadband_0 = field t " deadband [ 0 ] " int_as_uint16_t let deadband_1 = field t " deadband [ 1 ] " int_as_uint16_t let deadband_2 = field t " deadband [ 2 ] " int_as_uint16_t let center_0 = field t " center [ 0 ] " int16_t let center_1 = field t " center [ 1 ] " int16_t let center_2 = field t " center [ 2 ] " int16_t let ( ) = seal t end module Ramp = struct type t let t : t structure typ = structure " SDL_HapticRamp " let typ = field t " type " int_as_uint16_t let direction = field t " direction " Direction . t let length = field t " length " int32_as_uint32_t let delay = field t " delay " int_as_uint16_t let button = field t " button " int_as_uint16_t let interval = field t " interval " int_as_uint16_t let start = field t " start " int16_t let end_ = field t " end " int16_t let attack_length = field t " attack_length " int_as_uint16_t let attack_level = field t " attack_level " int_as_uint16_t let fade_length = field t " fade_length " int_as_uint16_t let fade_level = field t " fade_level " int_as_uint16_t let ( ) = seal t end module Left_right = struct type t let t : t structure typ = structure " SDL_HapticLeftRight " let typ = field t " type " int_as_uint16_t let direction = field t " direction " Direction . t let length = field t " length " int32_as_uint32_t let large_magnitude = field t " large_magnitude " int_as_uint16_t let small_magnitude = field t " small_magnitude " int_as_uint16_t let ( ) = seal t end module Custom = struct let int_list_as_uint16_t_ptr = let read _ = invalid_arg err_read_field in let write l = let l = List . map Unsigned . UInt16 . of_int l in let a = CArray . of_list uint16_t l in CArray . start a in view ~ read ~ write ( ptr uint16_t ) type t let t : t structure typ = structure " SDL_HapticCustom " let typ = field t " type " int_as_uint16_t let direction = field t " direction " Direction . t let length = field t " length " int32_as_uint32_t let delay = field t " delay " int_as_uint16_t let button = field t " button " int_as_uint16_t let interval = field t " interval " int_as_uint16_t let channels = field t " channels " int_as_uint8_t let period = field t " period " int_as_uint16_t let samples = field t " samples " int_as_uint16_t let data = field t " data " int_list_as_uint16_t_ptr let attack_length = field t " attack_length " int_as_uint16_t let attack_level = field t " attack_level " int_as_uint16_t let fade_length = field t " fade_length " int_as_uint16_t let fade_level = field t " fade_level " int_as_uint16_t let ( ) = seal t end module Effect = struct type t let t : t union typ = union " SDL_HapticEffect " let typ = field t " type " int_as_uint16_t let constant = field t " constant " Constant . t let periodic = field t " periodic " Periodic . t let condition = field t " condition " Condition . t let ramp = field t " ramp " Ramp . t let left_right = field t " condition " Left_right . t let custom = field t " custom " Custom . t let ( ) = seal t end type effect_type = int let create_effect ( ) = make Effect . t let opt_addr = function | None -> coerce ( ptr void ) ( ptr Effect . t ) null | Some v -> addr v type _ field = F : ( ( ' a structure , Effect . t union ) Ctypes . field * ( ' b , ' a structure ) Ctypes . field ) -> ' b field let get e ( F ( s , f ) ) = getf ( getf e s ) f let set e ( F ( s , f ) ) v = setf ( getf e s ) f v let typ = F ( Effect . constant , Constant . typ ) let constant = sdl_haptic_constant let constant_type = F ( Effect . constant , Constant . typ ) let constant_direction = F ( Effect . constant , Constant . direction ) let constant_length = F ( Effect . constant , Constant . length ) let constant_delay = F ( Effect . constant , Constant . delay ) let constant_button = F ( Effect . constant , Constant . button ) let constant_interval = F ( Effect . constant , Constant . interval ) let constant_level = F ( Effect . constant , Constant . level ) let constant_attack_length = F ( Effect . constant , Constant . attack_length ) let constant_attack_level = F ( Effect . constant , Constant . attack_level ) let constant_fade_length = F ( Effect . constant , Constant . fade_length ) let constant_fade_level = F ( Effect . constant , Constant . fade_level ) let sine = sdl_haptic_sine let left_right = sdl_haptic_leftright let triangle = sdl_haptic_triangle let sawtooth_up = sdl_haptic_sawtoothup let sawtooth_down = sdl_haptic_sawtoothdown let periodic_type = F ( Effect . periodic , Periodic . typ ) let periodic_direction = F ( Effect . periodic , Periodic . direction ) let periodic_length = F ( Effect . periodic , Periodic . length ) let periodic_delay = F ( Effect . periodic , Periodic . delay ) let periodic_button = F ( Effect . periodic , Periodic . button ) let periodic_interval = F ( Effect . periodic , Periodic . interval ) let periodic_period = F ( Effect . periodic , Periodic . period ) let periodic_magnitude = F ( Effect . periodic , Periodic . magnitude ) let periodic_offset = F ( Effect . periodic , Periodic . offset ) let periodic_phase = F ( Effect . periodic , Periodic . phase ) let periodic_attack_length = F ( Effect . periodic , Periodic . attack_length ) let periodic_attack_level = F ( Effect . periodic , Periodic . attack_level ) let periodic_fade_length = F ( Effect . periodic , Periodic . fade_length ) let periodic_fade_level = F ( Effect . periodic , Periodic . fade_level ) let spring = sdl_haptic_spring let damper = sdl_haptic_damper let inertia = sdl_haptic_inertia let friction = sdl_haptic_friction let condition_type = F ( Effect . condition , Condition . typ ) let condition_direction = F ( Effect . condition , Condition . direction ) let condition_length = F ( Effect . condition , Condition . length ) let condition_delay = F ( Effect . condition , Condition . delay ) let condition_button = F ( Effect . condition , Condition . button ) let condition_interval = F ( Effect . condition , Condition . interval ) let condition_right_sat_0 = F ( Effect . condition , Condition . right_sat_0 ) let condition_right_sat_1 = F ( Effect . condition , Condition . right_sat_1 ) let condition_right_sat_2 = F ( Effect . condition , Condition . right_sat_2 ) let condition_left_sat_0 = F ( Effect . condition , Condition . left_sat_0 ) let condition_left_sat_1 = F ( Effect . condition , Condition . left_sat_1 ) let condition_left_sat_2 = F ( Effect . condition , Condition . left_sat_2 ) let condition_right_coeff_0 = F ( Effect . condition , Condition . right_coeff_0 ) let condition_right_coeff_1 = F ( Effect . condition , Condition . right_coeff_1 ) let condition_right_coeff_2 = F ( Effect . condition , Condition . right_coeff_2 ) let condition_left_coeff_0 = F ( Effect . condition , Condition . left_coeff_0 ) let condition_left_coeff_1 = F ( Effect . condition , Condition . left_coeff_1 ) let condition_left_coeff_2 = F ( Effect . condition , Condition . left_coeff_2 ) let condition_deadband_0 = F ( Effect . condition , Condition . deadband_0 ) let condition_deadband_1 = F ( Effect . condition , Condition . deadband_1 ) let condition_deadband_2 = F ( Effect . condition , Condition . deadband_2 ) let condition_center_0 = F ( Effect . condition , Condition . center_0 ) let condition_center_1 = F ( Effect . condition , Condition . center_1 ) let condition_center_2 = F ( Effect . condition , Condition . center_2 ) let ramp = sdl_haptic_ramp let ramp_type = F ( Effect . ramp , Ramp . typ ) let ramp_direction = F ( Effect . ramp , Ramp . direction ) let ramp_length = F ( Effect . ramp , Ramp . length ) let ramp_delay = F ( Effect . ramp , Ramp . delay ) let ramp_button = F ( Effect . ramp , Ramp . button ) let ramp_interval = F ( Effect . ramp , Ramp . interval ) let ramp_start = F ( Effect . ramp , Ramp . start ) let ramp_end = F ( Effect . ramp , Ramp . end_ ) let ramp_attack_length = F ( Effect . ramp , Ramp . attack_length ) let ramp_attack_level = F ( Effect . ramp , Ramp . attack_level ) let ramp_fade_length = F ( Effect . ramp , Ramp . fade_length ) let ramp_fade_level = F ( Effect . ramp , Ramp . fade_level ) let left_right_type = F ( Effect . left_right , Left_right . typ ) let left_right_length = F ( Effect . left_right , Left_right . length ) let left_right_large_magnitude = F ( Effect . left_right , Left_right . large_magnitude ) let left_right_small_magnitude = F ( Effect . left_right , Left_right . small_magnitude ) let custom = sdl_haptic_custom let custom_type = F ( Effect . custom , Custom . typ ) let custom_direction = F ( Effect . custom , Custom . direction ) let custom_length = F ( Effect . custom , Custom . length ) let custom_delay = F ( Effect . custom , Custom . delay ) let custom_button = F ( Effect . custom , Custom . button ) let custom_interval = F ( Effect . custom , Custom . interval ) let custom_channels = F ( Effect . custom , Custom . channels ) let custom_period = F ( Effect . custom , Custom . period ) let custom_samples = F ( Effect . custom , Custom . samples ) let custom_data = F ( Effect . custom , Custom . data ) let custom_attack_length = F ( Effect . custom , Custom . attack_length ) let custom_attack_level = F ( Effect . custom , Custom . attack_level ) let custom_fade_length = F ( Effect . custom , Custom . fade_length ) let custom_fade_level = F ( Effect . custom , Custom . fade_level ) end
|
type haptic_effect = Haptic . Effect . t union
|
let haptic_effect_id : int typ = int
|
let haptic_close = foreign " SDL_HapticClose " ( haptic @-> returning void )
|
let haptic_destroy_effect = foreign " SDL_HapticDestroyEffect " ( haptic @-> int @-> returning void )
|
let haptic_effect_supported = foreign " SDL_HapticEffectSupported " ( haptic @-> ptr Haptic . Effect . t @-> returning bool_to_ok )
|
let haptic_effect_supported h e = haptic_effect_supported h ( addr e )
|
let haptic_get_effect_status = foreign " SDL_HapticGetEffectStatus " ( haptic @-> haptic_effect_id @-> returning bool_to_ok )
|
let haptic_index = foreign " SDL_HapticIndex " ( haptic @-> returning nat_to_ok )
|
let haptic_name = foreign " SDL_HapticName " ( int @-> returning ( some_to_ok string_opt ) )
|
let haptic_new_effect = foreign " SDL_HapticNewEffect " ( haptic @-> ptr Haptic . Effect . t @-> returning nat_to_ok )
|
let haptic_new_effect h e = haptic_new_effect h ( addr e )
|
let haptic_num_axes = foreign " SDL_HapticNumAxes " ( haptic @-> returning nat_to_ok )
|
let haptic_num_effects = foreign " SDL_HapticNumEffects " ( haptic @-> returning nat_to_ok )
|
let haptic_num_effects_playing = foreign " SDL_HapticNumEffectsPlaying " ( haptic @-> returning nat_to_ok )
|
let haptic_open = foreign " SDL_HapticOpen " ( int @-> returning ( some_to_ok haptic_opt ) )
|
let haptic_open_from_joystick = foreign " SDL_HapticOpenFromJoystick " ( joystick @-> returning ( some_to_ok haptic_opt ) )
|
let haptic_open_from_mouse = foreign " SDL_HapticOpenFromMouse " ( void @-> returning ( some_to_ok haptic_opt ) )
|
let haptic_opened = foreign " SDL_HapticOpened " ( int @-> returning int )
|
let haptic_opened i = match haptic_opened i with
|
let haptic_pause = foreign " SDL_HapticPause " ( haptic @-> returning zero_to_ok )
|
let haptic_query = foreign " SDL_HapticQuery " ( haptic @-> returning int )
|
let haptic_rumble_init = foreign " SDL_HapticRumbleInit " ( haptic @-> returning zero_to_ok )
|
let haptic_rumble_play = foreign " SDL_HapticRumblePlay " ( haptic @-> float @-> int32_t @-> returning zero_to_ok )
|
let haptic_rumble_stop = foreign " SDL_HapticRumbleStop " ( haptic @-> returning zero_to_ok )
|
let haptic_rumble_supported = foreign " SDL_HapticRumbleSupported " ( haptic @-> returning bool_to_ok )
|
let haptic_run_effect = foreign " SDL_HapticRunEffect " ( haptic @-> haptic_effect_id @-> int32_t @-> returning zero_to_ok )
|
let haptic_set_autocenter = foreign " SDL_HapticSetAutocenter " ( haptic @-> int @-> returning zero_to_ok )
|
let haptic_set_gain = foreign " SDL_HapticSetGain " ( haptic @-> int @-> returning zero_to_ok )
|
let haptic_stop_all = foreign " SDL_HapticStopAll " ( haptic @-> returning zero_to_ok )
|
let haptic_stop_effect = foreign " SDL_HapticStopEffect " ( haptic @-> haptic_effect_id @-> returning zero_to_ok )
|
let haptic_unpause = foreign " SDL_HapticUnpause " ( haptic @-> returning zero_to_ok )
|
let haptic_update_effect = foreign " SDL_HapticUpdateEffect " ( haptic @-> haptic_effect_id @-> ptr Haptic . Effect . t @-> returning zero_to_ok )
|
let haptic_update_effect h id e = haptic_update_effect h id ( addr e )
|
let joystick_is_haptic = foreign " SDL_JoystickIsHaptic " ( joystick @-> returning bool_to_ok )
|
let mouse_is_haptic = foreign " SDL_MouseIsHaptic " ( void @-> returning bool_to_ok )
|
let num_haptics = foreign " SDL_NumHaptics " ( void @-> returning nat_to_ok )
|
let audio_init = foreign " SDL_AudioInit " ( string_opt @-> returning zero_to_ok )
|
let audio_quit = foreign " SDL_AudioQuit " ( void @-> returning void )
|
let get_audio_driver = foreign " SDL_GetAudioDriver " ( int @-> returning ( some_to_ok string_opt ) )
|
let get_current_audio_driver = foreign " SDL_GetCurrentAudioDriver " ( void @-> returning string_opt )
|
let get_num_audio_drivers = foreign " SDL_GetNumAudioDrivers " ( void @-> returning nat_to_ok )
|
module Audio = struct type status = int let stopped = sdl_audio_stopped let playing = sdl_audio_playing let paused = sdl_audio_paused type format = int let format = int_as_uint16_t let s8 = audio_s8 let u8 = audio_u8 let s16_lsb = audio_s16lsb let s16_msb = audio_s16msb let s16_sys = audio_s16sys let s16 = audio_s16 let s16_lsb = audio_s16lsb let u16_lsb = audio_u16lsb let u16_msb = audio_u16msb let u16_sys = audio_u16sys let u16 = audio_u16 let u16_lsb = audio_u16lsb let s32_lsb = audio_s32lsb let s32_msb = audio_s32msb let s32_sys = audio_s32sys let s32 = audio_s32 let s32_lsb = audio_s32lsb let f32_lsb = audio_f32lsb let f32_msb = audio_f32msb let f32_sys = audio_f32sys let f32 = audio_f32 type allow = int let allow = int let allow_frequency_change = sdl_audio_allow_frequency_change let allow_format_change = sdl_audio_allow_format_change let allow_channels_change = sdl_audio_allow_channels_change let allow_any_change = sdl_audio_allow_any_change end
|
type audio_callback = unit Ctypes_static . ptr -> Unsigned . uint8 Ctypes_static . ptr -> int -> unit
|
let audio_callback kind f = let kind_bytes = ba_kind_byte_size kind in let ba_ptr_typ = access_ptr_typ_of_ba_kind kind in fun _ p len -> let p = coerce ( ptr uint8_t ) ba_ptr_typ p in let len = len / kind_bytes in f ( bigarray_of_ptr array1 len kind p )
|
type audio_spec = { as_freq : int ; as_format : Audio . format ; as_channels : uint8 ; as_silence : uint8 ; as_samples : uint8 ; as_size : uint32 ; as_callback : audio_callback option ; }
|
let audio_callback kind f = let kind_bytes = ba_kind_byte_size kind in let ba_ptr_typ = access_ptr_typ_of_ba_kind kind in fun _ p len -> let p = coerce ( ptr uint8_t ) ba_ptr_typ p in let len = len / kind_bytes in f ( bigarray_of_ptr array1 len kind p )
|
let as_callback = ( ptr void @-> ptr uint8_t @-> int @-> returning void )
|
let audio_spec : _audio_spec structure typ = structure " SDL_AudioSpec "
|
let as_freq = field audio_spec " freq " int
|
let as_format = field audio_spec " format " Audio . format
|
let as_channels = field audio_spec " channels " int_as_uint8_t
|
let as_silence = field audio_spec " silence " int_as_uint8_t
|
let as_samples = field audio_spec " samples " int_as_uint16_t
|
let _ = field audio_spec " padding " uint16_t
|
let as_size = field audio_spec " size " int32_as_uint32_t
|
let as_callback = field audio_spec " callback " ( funptr_opt ~ thread_registration : true ~ runtime_lock : true as_callback )
|
let as_userdata = field audio_spec " userdata " ( ptr void )
|
let ( ) = seal audio_spec
|
let audio_spec_of_c c = let as_freq = getf c as_freq in let as_format = getf c as_format in let as_channels = getf c as_channels in let as_silence = getf c as_silence in let as_samples = getf c as_samples in let as_size = getf c as_size in let as_callback = None in { as_freq ; as_format ; as_channels ; as_silence ; as_samples ; as_size ; as_callback ; }
|
let audio_spec_to_c a = let c = make audio_spec in setf c as_freq a . as_freq ; setf c as_format a . as_format ; setf c as_channels a . as_channels ; setf c as_silence a . as_silence ; setf c as_samples a . as_samples ; setf c as_size a . as_size ; setf c as_callback a . as_callback ; setf c as_userdata null ; c
|
let close_audio_device = foreign " SDL_CloseAudioDevice " ( audio_device_id @-> returning void )
|
let free_wav = foreign " SDL_FreeWAV " ( ptr void @-> returning void )
|
let free_wav ba = free_wav ( to_voidp ( bigarray_start array1 ba ) )
|
let get_audio_device_name = foreign " SDL_GetAudioDeviceName " ( int @-> bool @-> returning ( some_to_ok string_opt ) )
|
let get_audio_device_status = foreign " SDL_GetAudioDeviceStatus " ( audio_device_id @-> returning int )
|
let get_num_audio_devices = foreign " SDL_GetNumAudioDevices " ( bool @-> returning nat_to_ok )
|
let load_wav_rw = foreign ~ release_runtime_lock : true " SDL_LoadWAV_RW " ( rw_ops @-> int @-> ptr audio_spec @-> ptr ( ptr void ) @-> ptr uint32_t @-> returning ( some_to_ok ( ptr_opt audio_spec ) ) )
|
let load_wav_rw ops spec kind = let d = allocate ( ptr void ) null in let len = allocate uint32_t Unsigned . UInt32 . zero in match load_wav_rw ops 0 ( addr ( audio_spec_to_c spec ) ) d len with | Error _ as e -> e | Ok r -> let rspec = audio_spec_of_c ( !@ r ) in let kind_size = ba_kind_byte_size kind in let len = Unsigned . UInt32 . to_int ( !@ len ) in if len mod kind_size <> 0 then invalid_arg ( err_bigarray_data len kind_size ) else let ba_size = len / kind_size in let ba_ptr = access_ptr_typ_of_ba_kind kind in let d = coerce ( ptr void ) ba_ptr ( !@ d ) in Ok ( rspec , bigarray_of_ptr array1 ba_size kind d )
|
let lock_audio_device = foreign " SDL_LockAudioDevice " ( audio_device_id @-> returning void )
|
let open_audio_device = foreign " SDL_OpenAudioDevice " ( string_opt @-> bool @-> ptr audio_spec @-> ptr audio_spec @-> Audio . allow @-> returning int32_as_uint32_t )
|
let open_audio_device dev capture desired allow = let desiredc = audio_spec_to_c desired in let obtained = make audio_spec in match open_audio_device dev capture ( addr desiredc ) ( addr obtained ) allow with | id when id = Int32 . zero -> error ( ) | id -> Ok ( id , audio_spec_of_c obtained )
|
let pause_audio_device = foreign " SDL_PauseAudioDevice " ( audio_device_id @-> bool @-> returning void )
|
let unlock_audio_device = foreign " SDL_UnlockAudioDevice " ( audio_device_id @-> returning void )
|
let queue_audio = foreign " SDL_QueueAudio " ( audio_device_id @-> ptr void @-> int_as_uint32_t @-> returning zero_to_ok )
|
let queue_audio dev ba = let len = Bigarray . Array1 . dim ba in let kind_size = ba_kind_byte_size ( Bigarray . Array1 . kind ba ) in queue_audio dev ( to_voidp ( bigarray_start array1 ba ) ) ( len * kind_size )
|
let dequeue_audio = foreign " SDL_DequeueAudio " ( audio_device_id @-> ptr void @-> int @-> returning int_as_uint32_t )
|
let dequeue_audio dev ba = let len = Bigarray . Array1 . dim ba in let kind_size = ba_kind_byte_size ( Bigarray . Array1 . kind ba ) in dequeue_audio dev ( to_voidp ( bigarray_start array1 ba ) ) ( len * kind_size )
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.