123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129(*
* Copyright 2007-2010 Samuel Mimram
*
* This file is part of ocaml-ladspa.
*
* ocaml-ladspa is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* ocaml-ladspa is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with ocaml-ladspa; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* As a special exception to the GNU Library General Public License, you may
* link, statically or dynamically, a "work that uses the Library" with a publicly
* distributed version of the Library to produce an executable file containing
* portions of the Library, and distribute that executable file under terms of
* your choice, without any of the additional requirements listed in clause 6
* of the GNU Library General Public License.
* By "a publicly distributed version of the Library", we mean either the unmodified
* Library as distributed by The Savonet Team, or a modified version of the Library that is
* distributed under the conditions defined in clause 3 of the GNU Library General
* Public License. This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU Library General Public License.
*
*)let()=Callback.register_exception"ocaml_ladspa_exn_not_found"Not_foundexternalversion:unit->string="ocaml_ladspa_version"externalversion_major:unit->int="ocaml_ladspa_version_major"externalversion_minor:unit->int="ocaml_ladspa_version_minor"modulePlugin=structtypetexceptionNot_a_pluginexternalload:string->t="ocaml_ladspa_open"externalunload:t->unit="ocaml_ladspa_close"endlet()=Callback.register_exception"ocaml_ladspa_exn_not_a_plugin"Plugin.Not_a_pluginmoduleDescriptor=structtypetexternaldescriptor:Plugin.t->int->t="ocaml_ladspa_descriptor"letrecdescriptorspn=tryletd=descriptorpninletdd=descriptorsp(n+1)ind::ddwithNot_found->[]letdescriptorsp=Array.of_list(descriptorsp0)externalunique_id:t->int="ocaml_ladspa_unique_id"externallabel:t->string="ocaml_ladspa_label"externalname:t->string="ocaml_ladspa_name"externalmaker:t->string="ocaml_ladspa_maker"externalcopyright:t->string="ocaml_ladspa_copyright"letcopyrightd=letc=copyrightdin(* "None" is the standard answer when there is no copyright. *)ifc="None"thenNoneelseSomecexternalport_count:t->int="ocaml_ladspa_port_count"externalport_names:t->stringarray="ocaml_ladspa_port_names"letport_namedn=(port_namesd).(n)externalport_is_input:t->int->bool="ocaml_ladspa_port_is_input"externalport_is_output:t->int->bool="ocaml_ladspa_port_is_output"externalport_is_control:t->int->bool="ocaml_ladspa_port_is_control"externalport_is_audio:t->int->bool="ocaml_ladspa_port_is_audio"externalport_is_integer:t->int->bool="ocaml_ladspa_port_is_integer"externalport_is_boolean:t->int->bool="ocaml_ladspa_port_is_boolean"externalport_is_logarithmic:t->int->bool="ocaml_ladspa_port_is_logarithmic"externalport_get_default:t->int->int->floatoption="ocaml_ladspa_port_get_default"letport_get_defaultd?(samplerate=44100)p=port_get_defaultdsampleratepexternalport_get_min:t->int->int->floatoption="ocaml_ladspa_port_get_min"letport_get_mind?(samplerate=44100)p=port_get_mindsampleratepexternalport_get_max:t->int->int->floatoption="ocaml_ladspa_port_get_max"letport_get_maxd?(samplerate=44100)p=port_get_maxdsamplerateptypeinstanceexternalget_descriptor:instance->t="ocaml_ladspa_get_descriptor"externalinstantiate:t->int->instance="ocaml_ladspa_instantiate"externalconnect_port:instance->int->(float,Bigarray.float32_elt,Bigarray.c_layout)Bigarray.Array1.t->unit="ocaml_ladspa_connect_port"letset_control_portinv=assert(port_is_control(get_descriptori)n);letbuf=Bigarray.Array1.createBigarray.float32Bigarray.c_layout1inbuf.{0}<-v;connect_portinbufexternalactivate:instance->unit="ocaml_ladspa_activate"externaldeactivate:instance->unit="ocaml_ladspa_deactivate"externalrun:instance->int->unit="ocaml_ladspa_run"end