123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110(*
* Copyright 2003-2011 Savonet team
*
* This file is part of ocaml-dssi.
*
* Ocaml-mad is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Ocaml-mad 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 General Public License
* along with Ocaml-mad; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*)typeevent=|Event_systemofint*int|Event_resultofint*int(* Event_note is forbidden by DSSI specification. *)|Event_note_onofint*int*int|Event_note_offofint*int*intmodulePlugin=structtypetexceptionNot_a_pluginexternalload:string->t="ocaml_dssi_open"externalunload:t->unit="ocaml_dssi_close"endmoduleDescriptor=structtypetexceptionNot_implementedexternaldescriptor:Plugin.t->int->t="ocaml_dssi_descriptor"letrecdescriptorspn=tryletd=descriptorpninletdd=descriptorsp(n+1)ind::ddwith|Not_found->[]letdescriptorsp=Array.of_list(descriptorsp0)externalapi_version:t->int="ocaml_dssi_api_version"externalladspa:t->Ladspa.Descriptor.t="ocaml_dssi_ladspa"externalconfigure:t->Ladspa.Descriptor.instance->string->string->string="ocaml_dssi_configure"externalget_program:t->Ladspa.Descriptor.instance->int->int*int*string="ocaml_dssi_get_program"externalselect_program:t->Ladspa.Descriptor.instance->int->int->unit="ocaml_dssi_select_program"externalget_midi_controller:t->Ladspa.Descriptor.instance->int->int="ocaml_dssi_get_midi_controller_for_port"externalcan_run_synth:t->bool="ocaml_dssi_can_run_synth"externalcan_run_synth_adding:t->bool="ocaml_dssi_can_run_synth_adding"externalrun_synth:t->bool->Ladspa.Descriptor.instance->int->(int*event)array->unit="ocaml_dssi_run_synth"externalcan_run_multiple_synths:t->bool="ocaml_dssi_can_run_multiple_synths"externalcan_run_multiple_synths_adding:t->bool="ocaml_dssi_can_run_multiple_synths_adding"externalrun_multiple_synths:t->bool->Ladspa.Descriptor.instancearray->int->(int*event)arrayarray->unit="ocaml_dssi_run_multiple_synths"letrun_multiple_synthsd?(adding=false)ine=ifaddingthen(tryrun_multiple_synthsdtrueinewithNot_implemented->run_multiple_synthsdfalseine)elserun_multiple_synthsdfalseineletrun_synthd?(adding=false)ine=try(tryrun_synthdaddinginewith|Not_implemented->ifaddingthenrun_synthdfalseineelseraiseNot_implemented)with|Not_implemented->run_multiple_synthsd~adding[|i|]n[|e|]endletinit()=Callback.register_exception"ocaml_dssi_exn_not_found"Not_found;Callback.register_exception"ocaml_dssi_exn_not_a_plugin"Plugin.Not_a_plugin;Callback.register_exception"ocaml_dssi_exn_not_implemented"Descriptor.Not_implementedlet()=init()