123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257(*
Copyright 2005-2020 Savonet team
This file is part of Ocaml-alsa.
Ocaml-alsa 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-alsa 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-alsa; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*)externalget_version:unit->string="ocaml_alsa_version"exceptionBuffer_xrunexceptionBad_stateexceptionSuspendedexceptionIO_errorexceptionDevice_busyexceptionInvalid_argumentexceptionDevice_removedexceptionInterruptedexceptionTry_againexceptionUnknown_errorofinttypedirection=Dir_down|Dir_eq|Dir_uplet()=Callback.register_exception"alsa_exn_buffer_xrun"Buffer_xrun;Callback.register_exception"alsa_exn_bad_state"Bad_state;Callback.register_exception"alsa_exn_suspended"Suspended;Callback.register_exception"alsa_exn_io_error"IO_error;Callback.register_exception"alsa_exn_device_busy"Device_busy;Callback.register_exception"alsa_exn_invalid_argument"Invalid_argument;Callback.register_exception"alsa_exn_device_removed"Device_removed;Callback.register_exception"alsa_exn_interrupted"Interrupted;Callback.register_exception"alsa_exn_try_again"Try_again;Callback.register_exception"alsa_exn_unknown_error"(Unknown_error0)externalno_stderr_report:unit->unit="ocaml_snd_no_stderr_report"externalstring_of_error:int->string="ocaml_snd_string_of_error"externalint_of_error:string->int="ocaml_snd_int_of_error"letint_of_errore=letf=int_of_errorinmatchewith|Buffer_xrun->f"alsa_exn_buffer_xrun"|Bad_state->f"alsa_exn_bad_state"|Suspended->f"alsa_exn_suspended"|IO_error->f"alsa_exn_io_error"|Device_busy->f"alsa_exn_device_busy"|Invalid_argument->f"alsa_exn_invalid_argument"|Device_removed->f"alsa_exn_device_removed"|Interrupted->f"alsa_exn_interrupted"|Unknown_errorx->x|_->raiseeletstring_of_errore=string_of_error(int_of_errore)modulePcm=structtypehandletypeparamstypestream=Playback|Capturetypemode=Async|Non_blockingtypestate=|St_open|St_setup|St_prepared|St_running|St_xrun|St_draining|St_paused|St_suspended|St_disconnectedexternalopen_pcm:string->streamlist->modelist->handle="ocaml_snd_pcm_open"externalclose:handle->unit="ocaml_snd_pcm_close"externalprepare:handle->unit="ocaml_snd_pcm_prepare"externalresume:handle->unit="ocaml_snd_pcm_resume"externalrecover:handle->int->bool->unit="ocaml_snd_pcm_recover"letrecover?(verbose=false)he=recoverh(int_of_errore)verboseexternalstart:handle->unit="ocaml_snd_pcm_start"externaldrain:handle->unit="ocaml_snd_pcm_drain"externaldrop:handle->unit="ocaml_snd_pcm_drop"externalpause:handle->bool->unit="ocaml_snd_pcm_pause"externalreset:handle->unit="ocaml_snd_pcm_reset"externalwait:handle->int->bool="ocaml_snd_pcm_wait"externalreadi:handle->bytes->int->int->int="ocaml_snd_pcm_readi"externalwritei:handle->bytes->int->int->int="ocaml_snd_pcm_writei"externalreadn:handle->bytesarray->int->int->int="ocaml_snd_pcm_readn"externalwriten:handle->bytesarray->int->int->int="ocaml_snd_pcm_writen"externalreadn_float:handle->floatarrayarray->int->int->int="ocaml_snd_pcm_readn_float"externalwriten_float:handle->floatarrayarray->int->int->int="ocaml_snd_pcm_writen_float"externalreadn_float_ba:handle->(float,Bigarray.float32_elt,Bigarray.c_layout)Bigarray.Array1.tarray->int="ocaml_snd_pcm_readn_float_ba"externalwriten_float_ba:handle->(float,Bigarray.float32_elt,Bigarray.c_layout)Bigarray.Array1.tarray->int="ocaml_snd_pcm_writen_float_ba"externalwritei_float_ba:handle->int->(float,Bigarray.float32_elt,Bigarray.c_layout)Bigarray.Array1.t->int="ocaml_snd_pcm_writei_float_ba"externalreadn_float64:handle->floatarrayarray->int->int->int="ocaml_snd_pcm_readn_float64"externalwriten_float64:handle->floatarrayarray->int->int->int="ocaml_snd_pcm_writen_float64"externalget_state:handle->state="ocaml_snd_pcm_get_state"externalget_delay:handle->int="ocaml_snd_pcm_get_delay"externalget_params:handle->params="ocaml_snd_pcm_get_params"externalset_params:handle->params->unit="ocaml_snd_pcm_set_params"typeaccess=Access_rw_interleaved|Access_rw_noninterleavedexternalset_access:handle->params->access->unit="ocaml_snd_set_access"typefmt=|Format_s16_le(* TODO *)|Format_s24_3le|Format_float|Format_float64externalset_format:handle->params->fmt->unit="ocaml_snd_pcm_set_format"externalset_rate_near:handle->params->int->direction->int="ocaml_snd_pcm_set_rate_near"externalset_channels:handle->params->int->unit="ocaml_snd_pcm_set_channels"externalset_periods:handle->params->int->direction->unit="ocaml_snd_pcm_set_periods"externalget_period_size:params->int="ocaml_snd_pcm_get_period_size"externalget_periods_max:params->int*direction="ocaml_snd_pcm_get_periods_max"externalget_periods_min:params->int*direction="ocaml_snd_pcm_get_periods_min"externalset_buffer_size:handle->params->int->unit="ocaml_snd_pcm_set_buffer_size"externalset_buffer_size_near:handle->params->int->int="ocaml_snd_pcm_set_buffer_size_near"externalget_buffer_size:params->int="ocaml_snd_pcm_get_buffer_size"externalget_buffer_size_min:params->int="ocaml_snd_pcm_get_buffer_size_min"externalget_buffer_size_max:params->int="ocaml_snd_pcm_get_buffer_size_max"externalset_nonblock:handle->bool->unit="ocaml_snd_pcm_set_nonblock"(* TODO *)letget_frame_size_=4endmoduleSequencer=structtypetexternalcreate:string->int->int->t="ocaml_snd_seq_open"letcreatename?(blocking=true)stream=letstream=matchstreamwith|`Input->2|`Output->1|`Duplex->3inletmode=ifblockingthen0else1increatenamestreammodeexternalset_client_name:t->string->unit="ocaml_snd_seq_set_client_name"typeport_caps=Port_cap_read|Port_cap_write|Port_cap_sync_read|Port_cap_sync_write|Port_cap_duplex|Port_cap_subs_read|Port_cap_subs_write|Port_cap_no_exporttypeport_type=Port_type_specific|Port_type_MIDI_generic|Port_type_MIDI_GM|Port_type_MIDI_GM2|Port_type_MIDI_GS|Port_type_MIDI_XG|Port_type_MIDI_MT32|Port_type_hardware|Port_type_software|Port_type_sythesizer|Port_type_port|Port_type_applicationexternalcreate_port:t->string->port_capslist->port_typelist->int="ocaml_snd_seq_create_port"externalsubscribe_read_all:t->int->unit="ocaml_snd_subscribe_read_all"externalsubscribe_write_all:t->int->unit="ocaml_snd_subscribe_write_all"moduleEvent=structtypenote={note_channel:int;note_note:int;note_velocity:int;note_off_velocity:int;note_duration:int;}typecontroller={controller_channel:int;controller_param:int;controller_value:int;}typet=|Systemofint*int|Resultofint*int|Noteofnote|Note_onofnote|Note_offofnote|Keypressofnote|Controllerofcontroller|Program_changeofcontroller|Channel_pressureofcontroller|Pitch_bendofcontroller|Unhandledofintendtypetime=unittypeevent={ev_event:Event.t;ev_time:time;}externalinput_event:t->event="ocaml_snd_seq_event_input"externaloutput_event:t->Event.t->unit="ocaml_snd_seq_event_output"end