Module Tportaudio.Buffer

Audio buffers.

Linear bigarrays

type ('a, 'b) array = ('a, 'b, Bigarray.c_layout) Bigarray.Array1.t

The type for linear bigarrays.

val length : ('a, 'b) array -> int

length is Bigarray.Array1.dim.

val get : ('a, 'b) array -> int -> 'a

get is Bigarray.Array1.get

val set : ('a, 'b) array -> int -> 'a -> unit

set is Bigarray.Array1.set

Buffers

type layout = [
  1. | `Interleaved
  2. | `Planar
]

The type for specifying how frames are laid out in buffers. See data.

type ('a, 'b) t

The type for buffers of audio frames.

val create : channel_count:int -> ('a, 'b) sample_format -> layout -> frame_count:int -> ('a, 'b) t

create ~channel_count sf layout ~frame_count is a buffer of frame_count frames for channel_count channels of sample format sf laid out according to layout (see data) and initially filled with zero_sample.

val channel_count : ('a, 'b) t -> int

channel_count b is the number of channels in b.

val sample_format : ('a, 'b) t -> ('a, 'b) sample_format

sample_format b is the sample format of b.

val layout : ('a, 'b) t -> layout

layout b is the buffer layout of b.

val frame_count : ('a, 'b) t -> int

frame_count b is the number of frames in b.

val data : ('a, 'b) t -> ('a, 'b) array Stdlib.Array.t

data b is d the data of buffer b. If the layout of b is

  • `Interleaved the resulting array has a single element. The sample of channel c at frame f is given at get d.(0) (f * channel_count + c).
  • `Planar, the resulting array one element per channel. The sample of channel c at frame f is given at get d.(c) f.