Source file ml_stubs.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
module CI = Cstubs_internals
external caml_portaudio_1_Pa_GetVersion : unit -> int
= "caml_portaudio_1_Pa_GetVersion"
external caml_portaudio_2_Pa_GetVersionText : unit -> CI.voidp
= "caml_portaudio_2_Pa_GetVersionText"
external caml_portaudio_3_Pa_GetVersionInfo : unit -> CI.voidp
= "caml_portaudio_3_Pa_GetVersionInfo"
external caml_portaudio_4_Pa_GetErrorText : int32 -> CI.voidp
= "caml_portaudio_4_Pa_GetErrorText"
external caml_portaudio_5_Pa_Initialize : unit -> int32
= "caml_portaudio_5_Pa_Initialize"
external caml_portaudio_6_Pa_Terminate : unit -> int32
= "caml_portaudio_6_Pa_Terminate"
external caml_portaudio_7_Pa_GetHostApiCount : unit -> int
= "caml_portaudio_7_Pa_GetHostApiCount"
external caml_portaudio_8_Pa_GetDefaultHostApi : unit -> int
= "caml_portaudio_8_Pa_GetDefaultHostApi"
external caml_portaudio_9_Pa_GetHostApiInfo : int -> CI.voidp
= "caml_portaudio_9_Pa_GetHostApiInfo"
external caml_portaudio_10_Pa_HostApiTypeIdToHostApiIndex
: Unsigned.uint32 -> int
= "caml_portaudio_10_Pa_HostApiTypeIdToHostApiIndex"
external caml_portaudio_11_Pa_GetLastHostErrorInfo : unit -> CI.voidp
= "caml_portaudio_11_Pa_GetLastHostErrorInfo"
external caml_portaudio_12_Pa_GetDeviceCount : unit -> int
= "caml_portaudio_12_Pa_GetDeviceCount"
external caml_portaudio_13_Pa_GetDefaultInputDevice : unit -> int
= "caml_portaudio_13_Pa_GetDefaultInputDevice"
external caml_portaudio_14_Pa_GetDefaultOutputDevice : unit -> int
= "caml_portaudio_14_Pa_GetDefaultOutputDevice"
external caml_portaudio_15_Pa_GetDeviceInfo : int -> CI.voidp
= "caml_portaudio_15_Pa_GetDeviceInfo"
external caml_portaudio_16_Pa_IsFormatSupported
: _ CI.fatptr -> _ CI.fatptr -> float -> int32
= "caml_portaudio_16_Pa_IsFormatSupported"
external caml_portaudio_17_Pa_OpenStream
: _ CI.fatptr -> _ CI.fatptr -> _ CI.fatptr -> float -> Unsigned.ulong ->
Unsigned.ulong -> _ CI.fatfunptr -> _ CI.fatptr -> int32
= "caml_portaudio_17_Pa_OpenStream_byte8" "caml_portaudio_17_Pa_OpenStream"
external caml_portaudio_18_Pa_OpenDefaultStream
: _ CI.fatptr -> int -> int -> Unsigned.ulong -> float -> Unsigned.ulong ->
_ CI.fatfunptr -> _ CI.fatptr -> int32
=
"caml_portaudio_18_Pa_OpenDefaultStream_byte8" "caml_portaudio_18_Pa_OpenDefaultStream"
external caml_portaudio_19_Pa_CloseStream : _ CI.fatptr -> int32
= "caml_portaudio_19_Pa_CloseStream"
external caml_portaudio_20_Pa_StartStream : _ CI.fatptr -> int32
= "caml_portaudio_20_Pa_StartStream"
external caml_portaudio_21_Pa_StopStream : _ CI.fatptr -> int32
= "caml_portaudio_21_Pa_StopStream"
external caml_portaudio_22_Pa_AbortStream : _ CI.fatptr -> int32
= "caml_portaudio_22_Pa_AbortStream"
external caml_portaudio_23_Pa_IsStreamStopped : _ CI.fatptr -> int32
= "caml_portaudio_23_Pa_IsStreamStopped"
external caml_portaudio_24_Pa_IsStreamActive : _ CI.fatptr -> int32
= "caml_portaudio_24_Pa_IsStreamActive"
external caml_portaudio_25_Pa_SetStreamFinishedCallback
: _ CI.fatptr -> _ CI.fatfunptr -> int32
= "caml_portaudio_25_Pa_SetStreamFinishedCallback"
external caml_portaudio_26_Pa_GetStreamInfo : _ CI.fatptr -> CI.voidp
= "caml_portaudio_26_Pa_GetStreamInfo"
external caml_portaudio_27_Pa_GetStreamTime : _ CI.fatptr -> float
= "caml_portaudio_27_Pa_GetStreamTime"
external caml_portaudio_28_Pa_GetStreamCpuLoad : _ CI.fatptr -> float
= "caml_portaudio_28_Pa_GetStreamCpuLoad"
external caml_portaudio_29_Pa_ReadStream
: _ CI.fatptr -> _ CI.fatptr -> Unsigned.ulong -> int32
= "caml_portaudio_29_Pa_ReadStream"
external caml_portaudio_30_Pa_WriteStream
: _ CI.fatptr -> _ CI.fatptr -> Unsigned.ulong -> int32
= "caml_portaudio_30_Pa_WriteStream"
external caml_portaudio_31_Pa_GetStreamReadAvailable
: _ CI.fatptr -> Signed.long
= "caml_portaudio_31_Pa_GetStreamReadAvailable"
external caml_portaudio_32_Pa_GetStreamWriteAvailable
: _ CI.fatptr -> Signed.long
= "caml_portaudio_32_Pa_GetStreamWriteAvailable"
external caml_portaudio_33_Pa_GetSampleSize : Unsigned.ulong -> int32
= "caml_portaudio_33_Pa_GetSampleSize"
external caml_portaudio_34_Pa_Sleep : Signed.long -> unit
= "caml_portaudio_34_Pa_Sleep"
type 'a result = 'a
type 'a return = 'a
type 'a fn =
| Returns : 'a CI.typ -> 'a return fn
| Function : 'a CI.typ * 'b fn -> ('a -> 'b) fn
let map_result f x = f x
let returning t = Returns t
let (@->) f p = Function (f, p)
let foreign : type a b. string -> (a -> b) fn -> (a -> b) =
fun name t -> match t, name with
| Function (CI.Primitive CI.Long, Returns CI.Void), "Pa_Sleep" ->
caml_portaudio_34_Pa_Sleep
| Function
(CI.Primitive CI.Ulong,
Returns (CI.View {CI.ty = CI.Primitive CI.Int32_t; read = x3; _})),
"Pa_GetSampleSize" ->
(fun x2 -> x3 (caml_portaudio_33_Pa_GetSampleSize x2))
| Function (CI.Pointer _, Returns (CI.Primitive CI.Long)),
"Pa_GetStreamWriteAvailable" ->
(fun x4 ->
let CI.CPointer x5 = x4 in
caml_portaudio_32_Pa_GetStreamWriteAvailable x5)
| Function (CI.Pointer _, Returns (CI.Primitive CI.Long)),
"Pa_GetStreamReadAvailable" ->
(fun x6 ->
let CI.CPointer x7 = x6 in caml_portaudio_31_Pa_GetStreamReadAvailable x7)
| Function
(CI.Pointer _,
Function
(CI.Pointer _,
Function
(CI.Primitive CI.Ulong,
Returns (CI.View {CI.ty = CI.Primitive CI.Int32_t; read = x13; _})))),
"Pa_WriteStream" ->
(fun x8 x10 x12 ->
let CI.CPointer x11 = x10 in
let CI.CPointer x9 = x8 in
x13 (caml_portaudio_30_Pa_WriteStream x9 x11 x12))
| Function
(CI.Pointer _,
Function
(CI.Pointer _,
Function
(CI.Primitive CI.Ulong,
Returns (CI.View {CI.ty = CI.Primitive CI.Int32_t; read = x19; _})))),
"Pa_ReadStream" ->
(fun x14 x16 x18 ->
let CI.CPointer x17 = x16 in
let CI.CPointer x15 = x14 in
x19 (caml_portaudio_29_Pa_ReadStream x15 x17 x18))
| Function (CI.Pointer _, Returns (CI.Primitive CI.Float)),
"Pa_GetStreamCpuLoad" ->
(fun x20 ->
let CI.CPointer x21 = x20 in caml_portaudio_28_Pa_GetStreamCpuLoad x21)
| Function (CI.Pointer _, Returns (CI.Primitive CI.Float)),
"Pa_GetStreamTime" ->
(fun x22 ->
let CI.CPointer x23 = x22 in caml_portaudio_27_Pa_GetStreamTime x23)
| Function (CI.Pointer _, Returns (CI.Pointer x26)), "Pa_GetStreamInfo" ->
(fun x24 ->
let CI.CPointer x25 = x24 in
CI.make_ptr x26 (caml_portaudio_26_Pa_GetStreamInfo x25))
| Function
(CI.Pointer _,
Function
(CI.View {CI.ty = CI.Funptr _; write = x30; _},
Returns (CI.View {CI.ty = CI.Primitive CI.Int32_t; read = x33; _}))),
"Pa_SetStreamFinishedCallback" ->
(fun x27 x29 ->
let CI.Static_funptr x32 = x30 x29 in
let CI.CPointer x28 = x27 in
let x31 = x32 in
x33 (caml_portaudio_25_Pa_SetStreamFinishedCallback x28 x31))
| Function
(CI.Pointer _,
Returns (CI.View {CI.ty = CI.Primitive CI.Int32_t; read = x36; _})),
"Pa_IsStreamActive" ->
(fun x34 ->
let CI.CPointer x35 = x34 in
x36 (caml_portaudio_24_Pa_IsStreamActive x35))
| Function
(CI.Pointer _,
Returns (CI.View {CI.ty = CI.Primitive CI.Int32_t; read = x39; _})),
"Pa_IsStreamStopped" ->
(fun x37 ->
let CI.CPointer x38 = x37 in
x39 (caml_portaudio_23_Pa_IsStreamStopped x38))
| Function
(CI.Pointer _,
Returns (CI.View {CI.ty = CI.Primitive CI.Int32_t; read = x42; _})),
"Pa_AbortStream" ->
(fun x40 ->
let CI.CPointer x41 = x40 in x42 (caml_portaudio_22_Pa_AbortStream x41))
| Function
(CI.Pointer _,
Returns (CI.View {CI.ty = CI.Primitive CI.Int32_t; read = x45; _})),
"Pa_StopStream" ->
(fun x43 ->
let CI.CPointer x44 = x43 in x45 (caml_portaudio_21_Pa_StopStream x44))
| Function
(CI.Pointer _,
Returns (CI.View {CI.ty = CI.Primitive CI.Int32_t; read = x48; _})),
"Pa_StartStream" ->
(fun x46 ->
let CI.CPointer x47 = x46 in x48 (caml_portaudio_20_Pa_StartStream x47))
| Function
(CI.Pointer _,
Returns (CI.View {CI.ty = CI.Primitive CI.Int32_t; read = x51; _})),
"Pa_CloseStream" ->
(fun x49 ->
let CI.CPointer x50 = x49 in x51 (caml_portaudio_19_Pa_CloseStream x50))
| Function
(CI.Pointer _,
Function
(CI.Primitive CI.Int,
Function
(CI.Primitive CI.Int,
Function
(CI.Primitive CI.Ulong,
Function
(CI.Primitive CI.Float,
Function
(CI.Primitive CI.Ulong,
Function
(CI.View {CI.ty = CI.Funptr _; write = x60; _},
Function
(CI.Pointer _,
Returns
(CI.View
{CI.ty = CI.Primitive CI.Int32_t; read = x65;
_}))))))))),
"Pa_OpenDefaultStream" ->
(fun x52 x54 x55 x56 x57 x58 x59 x63 ->
let CI.CPointer x64 = x63 in
let CI.Static_funptr x62 = x60 x59 in
let CI.CPointer x53 = x52 in
let x61 = x62 in
x65
(caml_portaudio_18_Pa_OpenDefaultStream x53 x54 x55 x56 x57 x58 x61 x64))
| Function
(CI.Pointer _,
Function
(CI.Pointer _,
Function
(CI.Pointer _,
Function
(CI.Primitive CI.Float,
Function
(CI.Primitive CI.Ulong,
Function
(CI.Primitive CI.Ulong,
Function
(CI.View {CI.ty = CI.Funptr _; write = x76; _},
Function
(CI.Pointer _,
Returns
(CI.View
{CI.ty = CI.Primitive CI.Int32_t; read = x81;
_}))))))))),
"Pa_OpenStream" ->
(fun x66 x68 x70 x72 x73 x74 x75 x79 ->
let CI.CPointer x80 = x79 in
let CI.Static_funptr x78 = x76 x75 in
let CI.CPointer x71 = x70 in
let CI.CPointer x69 = x68 in
let CI.CPointer x67 = x66 in
let x77 = x78 in
x81 (caml_portaudio_17_Pa_OpenStream x67 x69 x71 x72 x73 x74 x77 x80))
| Function
(CI.Pointer _,
Function
(CI.Pointer _,
Function
(CI.Primitive CI.Float,
Returns (CI.View {CI.ty = CI.Primitive CI.Int32_t; read = x87; _})))),
"Pa_IsFormatSupported" ->
(fun x82 x84 x86 ->
let CI.CPointer x85 = x84 in
let CI.CPointer x83 = x82 in
x87 (caml_portaudio_16_Pa_IsFormatSupported x83 x85 x86))
| Function (CI.Primitive CI.Int, Returns (CI.Pointer x89)),
"Pa_GetDeviceInfo" ->
(fun x88 -> CI.make_ptr x89 (caml_portaudio_15_Pa_GetDeviceInfo x88))
| Function (CI.Void, Returns (CI.Primitive CI.Int)),
"Pa_GetDefaultOutputDevice" -> caml_portaudio_14_Pa_GetDefaultOutputDevice
| Function (CI.Void, Returns (CI.Primitive CI.Int)),
"Pa_GetDefaultInputDevice" -> caml_portaudio_13_Pa_GetDefaultInputDevice
| Function (CI.Void, Returns (CI.Primitive CI.Int)), "Pa_GetDeviceCount" ->
caml_portaudio_12_Pa_GetDeviceCount
| Function (CI.Void, Returns (CI.Pointer x94)), "Pa_GetLastHostErrorInfo" ->
(fun x93 ->
CI.make_ptr x94 (caml_portaudio_11_Pa_GetLastHostErrorInfo x93))
| Function
(CI.View {CI.ty = CI.Primitive CI.Uint32_t; write = x96; _},
Returns (CI.Primitive CI.Int)),
"Pa_HostApiTypeIdToHostApiIndex" ->
(fun x95 ->
let x97 = x96 x95 in caml_portaudio_10_Pa_HostApiTypeIdToHostApiIndex x97)
| Function (CI.Primitive CI.Int, Returns (CI.Pointer x99)),
"Pa_GetHostApiInfo" ->
(fun x98 -> CI.make_ptr x99 (caml_portaudio_9_Pa_GetHostApiInfo x98))
| Function (CI.Void, Returns (CI.Primitive CI.Int)), "Pa_GetDefaultHostApi" ->
caml_portaudio_8_Pa_GetDefaultHostApi
| Function (CI.Void, Returns (CI.Primitive CI.Int)), "Pa_GetHostApiCount" ->
caml_portaudio_7_Pa_GetHostApiCount
| Function
(CI.Void,
Returns (CI.View {CI.ty = CI.Primitive CI.Int32_t; read = x103; _})),
"Pa_Terminate" -> (fun x102 -> x103 (caml_portaudio_6_Pa_Terminate x102))
| Function
(CI.Void,
Returns (CI.View {CI.ty = CI.Primitive CI.Int32_t; read = x105; _})),
"Pa_Initialize" -> (fun x104 -> x105 (caml_portaudio_5_Pa_Initialize x104))
| Function
(CI.View {CI.ty = CI.Primitive CI.Int32_t; write = x107; _},
Returns (CI.View {CI.ty = CI.Pointer x109; read = x110; _})),
"Pa_GetErrorText" ->
(fun x106 ->
let x108 = x107 x106 in
x110 (CI.make_ptr x109 (caml_portaudio_4_Pa_GetErrorText x108)))
| Function (CI.Void, Returns (CI.Pointer x112)), "Pa_GetVersionInfo" ->
(fun x111 -> CI.make_ptr x112 (caml_portaudio_3_Pa_GetVersionInfo x111))
| Function
(CI.Void, Returns (CI.View {CI.ty = CI.Pointer x114; read = x115; _})),
"Pa_GetVersionText" ->
(fun x113 ->
x115 (CI.make_ptr x114 (caml_portaudio_2_Pa_GetVersionText x113)))
| Function (CI.Void, Returns (CI.Primitive CI.Int)), "Pa_GetVersion" ->
caml_portaudio_1_Pa_GetVersion
| _, s -> Printf.ksprintf failwith "No match for %s" s
let foreign_value : type a. string -> a Ctypes.typ -> a Ctypes.ptr =
fun name t -> match t, name with
| _, s -> Printf.ksprintf failwith "No match for %s" s