(* $Id: jack.ml 2604 2006-07-07 09:35:43Z smimram $ *) let _ = Callback.register "caml_mutex_create" Mutex.create; Callback.register "caml_mutex_unlock" Mutex.unlock external set_error_function : (string -> unit) -> unit = "ocaml_jack_set_error_function" external get_sample_size : unit -> int = "ocaml_jack_get_sample_size" module Ringbuffer = struct type t external create : int -> t = "ocaml_jack_ringbuffer_create" external read : t -> string -> int -> int -> int = "ocaml_jack_ringbuffer_read" external read_advance : t -> int -> unit = "ocaml_jack_ringbuffer_read_advance" external read_space : t -> int = "ocaml_jack_ringbuffer_read_space" external reset : t -> unit = "ocaml_jack_ringbuffer_reset" external write : t -> string -> int -> int -> int = "ocaml_jack_ringbuffer_write" external write_advance : t -> int -> unit = "ocaml_jack_ringbuffer_write_advance" external write_space : t -> int = "ocaml_jack_ringbuffer_write_space" end module Port = struct type t external name : t -> string = "ocaml_jack_port_name" external short_name : t -> string = "ocaml_jack_port_short_name" type flags = Input | Output | Pysical | Can_monitor | Terminal external flags : t -> flags list = "ocaml_jack_port_flags" external port_type : t -> string = "ocaml_jack_port_type" external connected : t -> int = "ocaml_jack_port_connected" external connected_to : t -> string -> bool = "ocaml_jack_port_connected_to" end module Client = struct type t external create : string -> t = "ocaml_jack_client_new" external close : t -> unit = "ocaml_jack_client_close" external is_realtime : t -> bool = "ocaml_jack_is_realtime" external get_max_buffer_size : t -> int = "ocaml_jack_get_max_buffer_size" type direction = Read | Write external set_process_ringbuffer_callback : t -> (Port.t * Ringbuffer.t * direction) list -> unit = "ocaml_jack_set_process_ringbuffer_callback" external get_process_callback_mutex : t -> Mutex.t = "ocaml_jack_get_process_callback_mutex" let sync c = Mutex.lock (get_process_callback_mutex c) external activate : t -> unit = "ocaml_jack_activate" external deactivate : t -> unit = "ocaml_jack_deactivate" external on_shutdown : t -> (unit -> unit) -> unit = "ocaml_jack_on_shutdown" external register_port : t -> string -> string -> Port.flags list -> int -> Port.t = "ocaml_jack_port_register" external get_sample_rate : t -> int = "ocaml_jack_get_sample_rate" end