package llama
Language for Live Audio Module Arrangement
Install
Dune Dependency
Authors
Maintainers
Sources
0.1.0_rust-deps-vendored.tar.gz
sha256=a6a44fc98530192676effb02e1ea3a136bc53bf880f43d89e8998c48c3592eda
sha512=2adb2220c02e36f327d13085651c7a31ad189a828e353ca7ecf3996ffffb78a7a13edf3a3ba4818cd7d50c5d1fe3fbbf62f83f3d9c00d2a3d5cde223eca166a0
doc/src/llama.low_level/llama_low_level.ml.html
Source file llama_low_level.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
module System = struct external env_logger_init_raw : unit -> unit = "env_logger_init" let is_initialized = ref false let env_logger_init () = if not !is_initialized then ( is_initialized := true; env_logger_init_raw ()) end module Wav = struct external read_wav_file_mono_exn_raw : string -> float array = "read_wav_file_mono" let read_wav_file_mono_exn path = (* TODO: This array can't be indexed with [Array.get] but values can be obtained with (say) [Array.iter]. This is possibly a bug in the ocaml rust bindings for the [floatarray] special case. *) let broken_array = read_wav_file_mono_exn_raw path in Float.Array.of_seq (Array.to_seq broken_array) end module Output_stream = struct type t external create_with_downsample_32 : int32 -> t = "create_output_stream_with_downsample" external sample_rate_hz_32 : t -> int32 = "sample_rate_hz" let sample_rate_hz t = sample_rate_hz_32 t |> Int32.to_int external num_channels_32 : t -> int32 = "num_channels" let num_channels t = num_channels_32 t |> Int32.to_int external set_buffer_padding_32 : t -> int32 -> unit = "set_buffer_padding" let set_buffer_padding t buffer_padding = set_buffer_padding_32 t (Int32.of_int buffer_padding) let create ?(downsample = 1) () = let stream = create_with_downsample_32 (Int32.of_int downsample) in set_buffer_padding stream 2500; stream external samples_behind_32 : t -> int32 = "samples_behind" let samples_behind t = samples_behind_32 t |> Int32.to_int external send_sample : t -> float -> unit = "send_sample" end module Midi_input = struct type t external create : unit -> t = "create_midi_input" external midi_port_names_raw : t -> string array = "midi_port_names" external get_num_midi_ports_raw : t -> int32 = "get_num_midi_ports" external is_midi_input_available_raw : t -> bool = "is_midi_input_available" external midi_port_connect_raw : t -> int32 -> unit = "midi_port_connect" external midi_port_drain_messages_raw : t -> int32 array = "midi_port_drain_messages" let port_names t = midi_port_names_raw t |> Array.to_list let get_num_ports t = get_num_midi_ports_raw t |> Int32.to_int let port_connect t index = let num_ports = get_num_ports t in if index < num_ports then if is_midi_input_available_raw t then midi_port_connect_raw t (Int32.of_int index) else failwith "Midi input may only be used to connect to a single port (ever)" else failwith (Printf.sprintf "Midi port index %d is out of range (there are %d midi ports)" index num_ports) let port_drain_messages_to_char_array t = midi_port_drain_messages_raw t |> Array.map (fun i32 -> char_of_int (Int32.to_int i32)) end
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>