package portaudio

  1. Overview
  2. Docs
Bindings for the portaudio library which provides high-level functions for using soundcards

Install

Dune Dependency

Authors

Maintainers

Sources

v0.2.3.tar.gz
md5=88990ca94141e132a816c704a3100bbb
sha512=9f292e7e9dc073472488eff97e28ddc538a6f6f6fcfd2bbdc94d0fe7a40c94c0c30685c26df96eb7a9e1b6ceac933ec0fde6779322b8649adecd248ca4f41379

doc/portaudio/Portaudio/index.html

Module PortaudioSource

* Bindings for the portaudio portable audio library. * *

  • author Samuel Mimram

*

  • author Niki Yoshiuchi

Exceptions

Sourceexception Error of int

An error occured. In the future, this exception should be replaced by more * specific exceptions. Use string_of_error to get a description of the * error.

Sourceexception Unanticipated_host_error

An unanticipaced

Sourceval string_of_error : int -> string

Get a description of an error.

Sourceval get_last_host_error : unit -> int * string

Get the last errror which occured together with its description.

General

Sourceval get_version : unit -> int

Version of portaudio.

Sourceval get_version_string : unit -> string

Version of portaudio.

Sourceval init : unit -> unit

Initialize the portaudio library. Should be called before calling any other * function.

Sourceval terminate : unit -> unit

Stop using the library. This function should be called before ending the * program and no other portaudio function should be called after.

Host API

Sourcetype host_api_info = {
  1. h_struct_version : int;
  2. h_host_api_type : int;
  3. h_name : string;
  4. h_device_count : int;
  5. h_default_input_device : int;
  6. h_default_output_device : int;
}

Host API Information

Sourceval get_host_api_count : unit -> int

Number of available host API.

Sourceval get_default_host_api : unit -> int

Index of the default host API.

Sourceval get_host_api_info : int -> host_api_info

Information on a host API

Sourcetype device_info = {
  1. d_struct_version : int;
  2. d_name : string;
  3. d_host_api : int;
  4. d_max_input_channels : int;
  5. d_max_output_channels : int;
  6. d_default_low_input_latency : float;
  7. d_default_low_output_latency : float;
  8. d_default_high_input_latency : float;
  9. d_default_high_output_latency : float;
  10. d_default_sample_rate : float;
}

Device Information

Sourceval get_default_input_device : unit -> int

Default input device.

Sourceval get_default_output_device : unit -> int

Default output device.

Sourceval get_device_count : unit -> int

Number of available devices.

Sourceval get_device_info : int -> device_info

Information on device

Streams

Sourcetype ('a, 'b) sample_format

The abstract type ('a, 'b) sample_format describes the OCaml type 'a and the underlying C type 'b used to represent the data being written to or read from a stream. This type is compatible with ('a, 'b) Bigarray.kind.

Sourceval format_float32 : (float, Bigarray.float32_elt) sample_format

The stream uses floats in the range of -1.,1. to represent audio data. * The underlying type is a 32 bit float.

Sourcetype ('a, 'b) stream_parameters = {
  1. channels : int;
  2. device : int;
  3. sample_format : ('a, 'b) sample_format;
  4. latency : float;
}
Sourcetype stream_flag
Sourcetype ('a, 'b, 'c, 'd) stream
Sourcetype ('a, 'b, 'c, 'd) callback = ('a, 'b, Bigarray.c_layout) Bigarray.Genarray.t -> ('c, 'd, Bigarray.c_layout) Bigarray.Genarray.t -> int -> int

The function signature of a callback. Callbacks only work with interleaved streams.

Sourceval open_stream : ('a, 'b) stream_parameters option -> ('c, 'd) stream_parameters option -> ?interleaved:bool -> float -> int -> ?callback:('a, 'b, 'c, 'd) callback -> stream_flag list -> ('a, 'b, 'c, 'd) stream

open_stream inparam outparam interleaved rate bufframes callback flags opens a new * stream with input stream of format inparam, output stream of format * outparam using interleaved or non-interleaved interleaved buffers * at rate samples per second, with bufframes frames per buffer * passed the callback function callback (0 means leave this choice to * portaudio).

Sourceval open_default_stream : ?callback:('a, 'b, 'a, 'b) callback -> ?format:('a, 'b) sample_format -> ?interleaved:bool -> int -> int -> int -> int -> ('a, 'b, 'a, 'b) stream

open_default_stream callback format interleaved inchans outchans rate bufframes * opens default stream with callback as callback function, handling samples in * format format using interleaved or non-interleaved buffers interleaved with * inchans input channels and outchans output channels * at rate samples per seconds with handling buffers of size bufframes.

Sourceval close_stream : ('a, 'b, 'c, 'd) stream -> unit

Close a stream.

Sourceval start_stream : ('a, 'b, 'c, 'd) stream -> unit

Start a stream.

Sourceval stop_stream : ('a, 'b, 'c, 'd) stream -> unit

Stop a stream.

Sourceval abort_stream : ('a, 'b, 'c, 'd) stream -> unit

Abort a stream.

Sourceval sleep : int -> unit

Sleep.

Sourceval write_stream : ('a, 'b, 'c, 'd) stream -> 'c array array -> int -> int -> unit

Write to a stream.

Sourceval read_stream : ('a, 'b, 'c, 'd) stream -> 'a array array -> int -> int -> unit

Read from a stream.

Sourceval write_stream_ba : ('a, 'b, 'c, 'd) stream -> ('c, 'd, Bigarray.c_layout) Bigarray.Genarray.t -> int -> int -> unit

Write to a stream using a bigarray.

Sourceval read_stream_ba : ('a, 'b, 'c, 'd) stream -> ('a, 'b, Bigarray.c_layout) Bigarray.Genarray.t -> int -> int -> unit

Read from a stream using a bigarray.

Sourceval read_stream_available_frames : ('a, 'b, 'c, 'd) stream -> int
Sourceval write_stream_available_frames : ('a, 'b, 'c, 'd) stream -> int
OCaml

Innovation. Community. Security.