blob: 40ef5e2dc4dc51a62b1d91c6e8daa3f9a3051066 [file] [log] [blame]
Serhiy Storchaka8d00d732014-01-25 11:57:59 +02001/*[clinic input]
2preserve
3[clinic start generated code]*/
4
5PyDoc_STRVAR(audioop_getsample__doc__,
Larry Hastings2623c8c2014-02-08 22:15:29 -08006"getsample($module, fragment, width, index, /)\n"
7"--\n"
8"\n"
Serhiy Storchaka8d00d732014-01-25 11:57:59 +02009"Return the value of sample index from the fragment.");
10
11#define AUDIOOP_GETSAMPLE_METHODDEF \
12 {"getsample", (PyCFunction)audioop_getsample, METH_VARARGS, audioop_getsample__doc__},
13
14static PyObject *
15audioop_getsample_impl(PyModuleDef *module, Py_buffer *fragment, int width, Py_ssize_t index);
16
17static PyObject *
18audioop_getsample(PyModuleDef *module, PyObject *args)
19{
20 PyObject *return_value = NULL;
21 Py_buffer fragment = {NULL, NULL};
22 int width;
23 Py_ssize_t index;
24
25 if (!PyArg_ParseTuple(args,
26 "y*in:getsample",
27 &fragment, &width, &index))
28 goto exit;
29 return_value = audioop_getsample_impl(module, &fragment, width, index);
30
31exit:
32 /* Cleanup for fragment */
33 if (fragment.obj)
34 PyBuffer_Release(&fragment);
35
36 return return_value;
37}
38
39PyDoc_STRVAR(audioop_max__doc__,
Larry Hastings2623c8c2014-02-08 22:15:29 -080040"max($module, fragment, width, /)\n"
41"--\n"
42"\n"
Serhiy Storchaka8d00d732014-01-25 11:57:59 +020043"Return the maximum of the absolute value of all samples in a fragment.");
44
45#define AUDIOOP_MAX_METHODDEF \
46 {"max", (PyCFunction)audioop_max, METH_VARARGS, audioop_max__doc__},
47
48static PyObject *
49audioop_max_impl(PyModuleDef *module, Py_buffer *fragment, int width);
50
51static PyObject *
52audioop_max(PyModuleDef *module, PyObject *args)
53{
54 PyObject *return_value = NULL;
55 Py_buffer fragment = {NULL, NULL};
56 int width;
57
58 if (!PyArg_ParseTuple(args,
59 "y*i:max",
60 &fragment, &width))
61 goto exit;
62 return_value = audioop_max_impl(module, &fragment, width);
63
64exit:
65 /* Cleanup for fragment */
66 if (fragment.obj)
67 PyBuffer_Release(&fragment);
68
69 return return_value;
70}
71
72PyDoc_STRVAR(audioop_minmax__doc__,
Larry Hastings2623c8c2014-02-08 22:15:29 -080073"minmax($module, fragment, width, /)\n"
74"--\n"
75"\n"
Serhiy Storchaka8d00d732014-01-25 11:57:59 +020076"Return the minimum and maximum values of all samples in the sound fragment.");
77
78#define AUDIOOP_MINMAX_METHODDEF \
79 {"minmax", (PyCFunction)audioop_minmax, METH_VARARGS, audioop_minmax__doc__},
80
81static PyObject *
82audioop_minmax_impl(PyModuleDef *module, Py_buffer *fragment, int width);
83
84static PyObject *
85audioop_minmax(PyModuleDef *module, PyObject *args)
86{
87 PyObject *return_value = NULL;
88 Py_buffer fragment = {NULL, NULL};
89 int width;
90
91 if (!PyArg_ParseTuple(args,
92 "y*i:minmax",
93 &fragment, &width))
94 goto exit;
95 return_value = audioop_minmax_impl(module, &fragment, width);
96
97exit:
98 /* Cleanup for fragment */
99 if (fragment.obj)
100 PyBuffer_Release(&fragment);
101
102 return return_value;
103}
104
105PyDoc_STRVAR(audioop_avg__doc__,
Larry Hastings2623c8c2014-02-08 22:15:29 -0800106"avg($module, fragment, width, /)\n"
107"--\n"
108"\n"
Serhiy Storchaka8d00d732014-01-25 11:57:59 +0200109"Return the average over all samples in the fragment.");
110
111#define AUDIOOP_AVG_METHODDEF \
112 {"avg", (PyCFunction)audioop_avg, METH_VARARGS, audioop_avg__doc__},
113
114static PyObject *
115audioop_avg_impl(PyModuleDef *module, Py_buffer *fragment, int width);
116
117static PyObject *
118audioop_avg(PyModuleDef *module, PyObject *args)
119{
120 PyObject *return_value = NULL;
121 Py_buffer fragment = {NULL, NULL};
122 int width;
123
124 if (!PyArg_ParseTuple(args,
125 "y*i:avg",
126 &fragment, &width))
127 goto exit;
128 return_value = audioop_avg_impl(module, &fragment, width);
129
130exit:
131 /* Cleanup for fragment */
132 if (fragment.obj)
133 PyBuffer_Release(&fragment);
134
135 return return_value;
136}
137
138PyDoc_STRVAR(audioop_rms__doc__,
Larry Hastings2623c8c2014-02-08 22:15:29 -0800139"rms($module, fragment, width, /)\n"
140"--\n"
141"\n"
Serhiy Storchaka8d00d732014-01-25 11:57:59 +0200142"Return the root-mean-square of the fragment, i.e. sqrt(sum(S_i^2)/n).");
143
144#define AUDIOOP_RMS_METHODDEF \
145 {"rms", (PyCFunction)audioop_rms, METH_VARARGS, audioop_rms__doc__},
146
147static PyObject *
148audioop_rms_impl(PyModuleDef *module, Py_buffer *fragment, int width);
149
150static PyObject *
151audioop_rms(PyModuleDef *module, PyObject *args)
152{
153 PyObject *return_value = NULL;
154 Py_buffer fragment = {NULL, NULL};
155 int width;
156
157 if (!PyArg_ParseTuple(args,
158 "y*i:rms",
159 &fragment, &width))
160 goto exit;
161 return_value = audioop_rms_impl(module, &fragment, width);
162
163exit:
164 /* Cleanup for fragment */
165 if (fragment.obj)
166 PyBuffer_Release(&fragment);
167
168 return return_value;
169}
170
171PyDoc_STRVAR(audioop_findfit__doc__,
Larry Hastings2623c8c2014-02-08 22:15:29 -0800172"findfit($module, fragment, reference, /)\n"
173"--\n"
174"\n"
Serhiy Storchaka8d00d732014-01-25 11:57:59 +0200175"Try to match reference as well as possible to a portion of fragment.");
176
177#define AUDIOOP_FINDFIT_METHODDEF \
178 {"findfit", (PyCFunction)audioop_findfit, METH_VARARGS, audioop_findfit__doc__},
179
180static PyObject *
181audioop_findfit_impl(PyModuleDef *module, Py_buffer *fragment, Py_buffer *reference);
182
183static PyObject *
184audioop_findfit(PyModuleDef *module, PyObject *args)
185{
186 PyObject *return_value = NULL;
187 Py_buffer fragment = {NULL, NULL};
188 Py_buffer reference = {NULL, NULL};
189
190 if (!PyArg_ParseTuple(args,
191 "y*y*:findfit",
192 &fragment, &reference))
193 goto exit;
194 return_value = audioop_findfit_impl(module, &fragment, &reference);
195
196exit:
197 /* Cleanup for fragment */
198 if (fragment.obj)
199 PyBuffer_Release(&fragment);
200 /* Cleanup for reference */
201 if (reference.obj)
202 PyBuffer_Release(&reference);
203
204 return return_value;
205}
206
207PyDoc_STRVAR(audioop_findfactor__doc__,
Larry Hastings2623c8c2014-02-08 22:15:29 -0800208"findfactor($module, fragment, reference, /)\n"
209"--\n"
210"\n"
Serhiy Storchaka8d00d732014-01-25 11:57:59 +0200211"Return a factor F such that rms(add(fragment, mul(reference, -F))) is minimal.");
212
213#define AUDIOOP_FINDFACTOR_METHODDEF \
214 {"findfactor", (PyCFunction)audioop_findfactor, METH_VARARGS, audioop_findfactor__doc__},
215
216static PyObject *
217audioop_findfactor_impl(PyModuleDef *module, Py_buffer *fragment, Py_buffer *reference);
218
219static PyObject *
220audioop_findfactor(PyModuleDef *module, PyObject *args)
221{
222 PyObject *return_value = NULL;
223 Py_buffer fragment = {NULL, NULL};
224 Py_buffer reference = {NULL, NULL};
225
226 if (!PyArg_ParseTuple(args,
227 "y*y*:findfactor",
228 &fragment, &reference))
229 goto exit;
230 return_value = audioop_findfactor_impl(module, &fragment, &reference);
231
232exit:
233 /* Cleanup for fragment */
234 if (fragment.obj)
235 PyBuffer_Release(&fragment);
236 /* Cleanup for reference */
237 if (reference.obj)
238 PyBuffer_Release(&reference);
239
240 return return_value;
241}
242
243PyDoc_STRVAR(audioop_findmax__doc__,
Larry Hastings2623c8c2014-02-08 22:15:29 -0800244"findmax($module, fragment, length, /)\n"
245"--\n"
246"\n"
Serhiy Storchaka8d00d732014-01-25 11:57:59 +0200247"Search fragment for a slice of specified number of samples with maximum energy.");
248
249#define AUDIOOP_FINDMAX_METHODDEF \
250 {"findmax", (PyCFunction)audioop_findmax, METH_VARARGS, audioop_findmax__doc__},
251
252static PyObject *
253audioop_findmax_impl(PyModuleDef *module, Py_buffer *fragment, Py_ssize_t length);
254
255static PyObject *
256audioop_findmax(PyModuleDef *module, PyObject *args)
257{
258 PyObject *return_value = NULL;
259 Py_buffer fragment = {NULL, NULL};
260 Py_ssize_t length;
261
262 if (!PyArg_ParseTuple(args,
263 "y*n:findmax",
264 &fragment, &length))
265 goto exit;
266 return_value = audioop_findmax_impl(module, &fragment, length);
267
268exit:
269 /* Cleanup for fragment */
270 if (fragment.obj)
271 PyBuffer_Release(&fragment);
272
273 return return_value;
274}
275
276PyDoc_STRVAR(audioop_avgpp__doc__,
Larry Hastings2623c8c2014-02-08 22:15:29 -0800277"avgpp($module, fragment, width, /)\n"
278"--\n"
279"\n"
Serhiy Storchaka8d00d732014-01-25 11:57:59 +0200280"Return the average peak-peak value over all samples in the fragment.");
281
282#define AUDIOOP_AVGPP_METHODDEF \
283 {"avgpp", (PyCFunction)audioop_avgpp, METH_VARARGS, audioop_avgpp__doc__},
284
285static PyObject *
286audioop_avgpp_impl(PyModuleDef *module, Py_buffer *fragment, int width);
287
288static PyObject *
289audioop_avgpp(PyModuleDef *module, PyObject *args)
290{
291 PyObject *return_value = NULL;
292 Py_buffer fragment = {NULL, NULL};
293 int width;
294
295 if (!PyArg_ParseTuple(args,
296 "y*i:avgpp",
297 &fragment, &width))
298 goto exit;
299 return_value = audioop_avgpp_impl(module, &fragment, width);
300
301exit:
302 /* Cleanup for fragment */
303 if (fragment.obj)
304 PyBuffer_Release(&fragment);
305
306 return return_value;
307}
308
309PyDoc_STRVAR(audioop_maxpp__doc__,
Larry Hastings2623c8c2014-02-08 22:15:29 -0800310"maxpp($module, fragment, width, /)\n"
311"--\n"
312"\n"
Serhiy Storchaka8d00d732014-01-25 11:57:59 +0200313"Return the maximum peak-peak value in the sound fragment.");
314
315#define AUDIOOP_MAXPP_METHODDEF \
316 {"maxpp", (PyCFunction)audioop_maxpp, METH_VARARGS, audioop_maxpp__doc__},
317
318static PyObject *
319audioop_maxpp_impl(PyModuleDef *module, Py_buffer *fragment, int width);
320
321static PyObject *
322audioop_maxpp(PyModuleDef *module, PyObject *args)
323{
324 PyObject *return_value = NULL;
325 Py_buffer fragment = {NULL, NULL};
326 int width;
327
328 if (!PyArg_ParseTuple(args,
329 "y*i:maxpp",
330 &fragment, &width))
331 goto exit;
332 return_value = audioop_maxpp_impl(module, &fragment, width);
333
334exit:
335 /* Cleanup for fragment */
336 if (fragment.obj)
337 PyBuffer_Release(&fragment);
338
339 return return_value;
340}
341
342PyDoc_STRVAR(audioop_cross__doc__,
Larry Hastings2623c8c2014-02-08 22:15:29 -0800343"cross($module, fragment, width, /)\n"
344"--\n"
345"\n"
Serhiy Storchaka8d00d732014-01-25 11:57:59 +0200346"Return the number of zero crossings in the fragment passed as an argument.");
347
348#define AUDIOOP_CROSS_METHODDEF \
349 {"cross", (PyCFunction)audioop_cross, METH_VARARGS, audioop_cross__doc__},
350
351static PyObject *
352audioop_cross_impl(PyModuleDef *module, Py_buffer *fragment, int width);
353
354static PyObject *
355audioop_cross(PyModuleDef *module, PyObject *args)
356{
357 PyObject *return_value = NULL;
358 Py_buffer fragment = {NULL, NULL};
359 int width;
360
361 if (!PyArg_ParseTuple(args,
362 "y*i:cross",
363 &fragment, &width))
364 goto exit;
365 return_value = audioop_cross_impl(module, &fragment, width);
366
367exit:
368 /* Cleanup for fragment */
369 if (fragment.obj)
370 PyBuffer_Release(&fragment);
371
372 return return_value;
373}
374
375PyDoc_STRVAR(audioop_mul__doc__,
Larry Hastings2623c8c2014-02-08 22:15:29 -0800376"mul($module, fragment, width, factor, /)\n"
377"--\n"
378"\n"
Serhiy Storchaka8d00d732014-01-25 11:57:59 +0200379"Return a fragment that has all samples in the original fragment multiplied by the floating-point value factor.");
380
381#define AUDIOOP_MUL_METHODDEF \
382 {"mul", (PyCFunction)audioop_mul, METH_VARARGS, audioop_mul__doc__},
383
384static PyObject *
385audioop_mul_impl(PyModuleDef *module, Py_buffer *fragment, int width, double factor);
386
387static PyObject *
388audioop_mul(PyModuleDef *module, PyObject *args)
389{
390 PyObject *return_value = NULL;
391 Py_buffer fragment = {NULL, NULL};
392 int width;
393 double factor;
394
395 if (!PyArg_ParseTuple(args,
396 "y*id:mul",
397 &fragment, &width, &factor))
398 goto exit;
399 return_value = audioop_mul_impl(module, &fragment, width, factor);
400
401exit:
402 /* Cleanup for fragment */
403 if (fragment.obj)
404 PyBuffer_Release(&fragment);
405
406 return return_value;
407}
408
409PyDoc_STRVAR(audioop_tomono__doc__,
Larry Hastings2623c8c2014-02-08 22:15:29 -0800410"tomono($module, fragment, width, lfactor, rfactor, /)\n"
411"--\n"
412"\n"
Serhiy Storchaka8d00d732014-01-25 11:57:59 +0200413"Convert a stereo fragment to a mono fragment.");
414
415#define AUDIOOP_TOMONO_METHODDEF \
416 {"tomono", (PyCFunction)audioop_tomono, METH_VARARGS, audioop_tomono__doc__},
417
418static PyObject *
419audioop_tomono_impl(PyModuleDef *module, Py_buffer *fragment, int width, double lfactor, double rfactor);
420
421static PyObject *
422audioop_tomono(PyModuleDef *module, PyObject *args)
423{
424 PyObject *return_value = NULL;
425 Py_buffer fragment = {NULL, NULL};
426 int width;
427 double lfactor;
428 double rfactor;
429
430 if (!PyArg_ParseTuple(args,
431 "y*idd:tomono",
432 &fragment, &width, &lfactor, &rfactor))
433 goto exit;
434 return_value = audioop_tomono_impl(module, &fragment, width, lfactor, rfactor);
435
436exit:
437 /* Cleanup for fragment */
438 if (fragment.obj)
439 PyBuffer_Release(&fragment);
440
441 return return_value;
442}
443
444PyDoc_STRVAR(audioop_tostereo__doc__,
Larry Hastings2623c8c2014-02-08 22:15:29 -0800445"tostereo($module, fragment, width, lfactor, rfactor, /)\n"
446"--\n"
447"\n"
Serhiy Storchaka8d00d732014-01-25 11:57:59 +0200448"Generate a stereo fragment from a mono fragment.");
449
450#define AUDIOOP_TOSTEREO_METHODDEF \
451 {"tostereo", (PyCFunction)audioop_tostereo, METH_VARARGS, audioop_tostereo__doc__},
452
453static PyObject *
454audioop_tostereo_impl(PyModuleDef *module, Py_buffer *fragment, int width, double lfactor, double rfactor);
455
456static PyObject *
457audioop_tostereo(PyModuleDef *module, PyObject *args)
458{
459 PyObject *return_value = NULL;
460 Py_buffer fragment = {NULL, NULL};
461 int width;
462 double lfactor;
463 double rfactor;
464
465 if (!PyArg_ParseTuple(args,
466 "y*idd:tostereo",
467 &fragment, &width, &lfactor, &rfactor))
468 goto exit;
469 return_value = audioop_tostereo_impl(module, &fragment, width, lfactor, rfactor);
470
471exit:
472 /* Cleanup for fragment */
473 if (fragment.obj)
474 PyBuffer_Release(&fragment);
475
476 return return_value;
477}
478
479PyDoc_STRVAR(audioop_add__doc__,
Larry Hastings2623c8c2014-02-08 22:15:29 -0800480"add($module, fragment1, fragment2, width, /)\n"
481"--\n"
482"\n"
Serhiy Storchaka8d00d732014-01-25 11:57:59 +0200483"Return a fragment which is the addition of the two samples passed as parameters.");
484
485#define AUDIOOP_ADD_METHODDEF \
486 {"add", (PyCFunction)audioop_add, METH_VARARGS, audioop_add__doc__},
487
488static PyObject *
489audioop_add_impl(PyModuleDef *module, Py_buffer *fragment1, Py_buffer *fragment2, int width);
490
491static PyObject *
492audioop_add(PyModuleDef *module, PyObject *args)
493{
494 PyObject *return_value = NULL;
495 Py_buffer fragment1 = {NULL, NULL};
496 Py_buffer fragment2 = {NULL, NULL};
497 int width;
498
499 if (!PyArg_ParseTuple(args,
500 "y*y*i:add",
501 &fragment1, &fragment2, &width))
502 goto exit;
503 return_value = audioop_add_impl(module, &fragment1, &fragment2, width);
504
505exit:
506 /* Cleanup for fragment1 */
507 if (fragment1.obj)
508 PyBuffer_Release(&fragment1);
509 /* Cleanup for fragment2 */
510 if (fragment2.obj)
511 PyBuffer_Release(&fragment2);
512
513 return return_value;
514}
515
516PyDoc_STRVAR(audioop_bias__doc__,
Larry Hastings2623c8c2014-02-08 22:15:29 -0800517"bias($module, fragment, width, bias, /)\n"
518"--\n"
519"\n"
Serhiy Storchaka8d00d732014-01-25 11:57:59 +0200520"Return a fragment that is the original fragment with a bias added to each sample.");
521
522#define AUDIOOP_BIAS_METHODDEF \
523 {"bias", (PyCFunction)audioop_bias, METH_VARARGS, audioop_bias__doc__},
524
525static PyObject *
526audioop_bias_impl(PyModuleDef *module, Py_buffer *fragment, int width, int bias);
527
528static PyObject *
529audioop_bias(PyModuleDef *module, PyObject *args)
530{
531 PyObject *return_value = NULL;
532 Py_buffer fragment = {NULL, NULL};
533 int width;
534 int bias;
535
536 if (!PyArg_ParseTuple(args,
537 "y*ii:bias",
538 &fragment, &width, &bias))
539 goto exit;
540 return_value = audioop_bias_impl(module, &fragment, width, bias);
541
542exit:
543 /* Cleanup for fragment */
544 if (fragment.obj)
545 PyBuffer_Release(&fragment);
546
547 return return_value;
548}
549
550PyDoc_STRVAR(audioop_reverse__doc__,
Larry Hastings2623c8c2014-02-08 22:15:29 -0800551"reverse($module, fragment, width, /)\n"
552"--\n"
553"\n"
Serhiy Storchaka8d00d732014-01-25 11:57:59 +0200554"Reverse the samples in a fragment and returns the modified fragment.");
555
556#define AUDIOOP_REVERSE_METHODDEF \
557 {"reverse", (PyCFunction)audioop_reverse, METH_VARARGS, audioop_reverse__doc__},
558
559static PyObject *
560audioop_reverse_impl(PyModuleDef *module, Py_buffer *fragment, int width);
561
562static PyObject *
563audioop_reverse(PyModuleDef *module, PyObject *args)
564{
565 PyObject *return_value = NULL;
566 Py_buffer fragment = {NULL, NULL};
567 int width;
568
569 if (!PyArg_ParseTuple(args,
570 "y*i:reverse",
571 &fragment, &width))
572 goto exit;
573 return_value = audioop_reverse_impl(module, &fragment, width);
574
575exit:
576 /* Cleanup for fragment */
577 if (fragment.obj)
578 PyBuffer_Release(&fragment);
579
580 return return_value;
581}
582
583PyDoc_STRVAR(audioop_byteswap__doc__,
Larry Hastings2623c8c2014-02-08 22:15:29 -0800584"byteswap($module, fragment, width, /)\n"
585"--\n"
586"\n"
Serhiy Storchaka8d00d732014-01-25 11:57:59 +0200587"Convert big-endian samples to little-endian and vice versa.");
588
589#define AUDIOOP_BYTESWAP_METHODDEF \
590 {"byteswap", (PyCFunction)audioop_byteswap, METH_VARARGS, audioop_byteswap__doc__},
591
592static PyObject *
593audioop_byteswap_impl(PyModuleDef *module, Py_buffer *fragment, int width);
594
595static PyObject *
596audioop_byteswap(PyModuleDef *module, PyObject *args)
597{
598 PyObject *return_value = NULL;
599 Py_buffer fragment = {NULL, NULL};
600 int width;
601
602 if (!PyArg_ParseTuple(args,
603 "y*i:byteswap",
604 &fragment, &width))
605 goto exit;
606 return_value = audioop_byteswap_impl(module, &fragment, width);
607
608exit:
609 /* Cleanup for fragment */
610 if (fragment.obj)
611 PyBuffer_Release(&fragment);
612
613 return return_value;
614}
615
616PyDoc_STRVAR(audioop_lin2lin__doc__,
Larry Hastings2623c8c2014-02-08 22:15:29 -0800617"lin2lin($module, fragment, width, newwidth, /)\n"
618"--\n"
619"\n"
Serhiy Storchaka8d00d732014-01-25 11:57:59 +0200620"Convert samples between 1-, 2-, 3- and 4-byte formats.");
621
622#define AUDIOOP_LIN2LIN_METHODDEF \
623 {"lin2lin", (PyCFunction)audioop_lin2lin, METH_VARARGS, audioop_lin2lin__doc__},
624
625static PyObject *
626audioop_lin2lin_impl(PyModuleDef *module, Py_buffer *fragment, int width, int newwidth);
627
628static PyObject *
629audioop_lin2lin(PyModuleDef *module, PyObject *args)
630{
631 PyObject *return_value = NULL;
632 Py_buffer fragment = {NULL, NULL};
633 int width;
634 int newwidth;
635
636 if (!PyArg_ParseTuple(args,
637 "y*ii:lin2lin",
638 &fragment, &width, &newwidth))
639 goto exit;
640 return_value = audioop_lin2lin_impl(module, &fragment, width, newwidth);
641
642exit:
643 /* Cleanup for fragment */
644 if (fragment.obj)
645 PyBuffer_Release(&fragment);
646
647 return return_value;
648}
649
650PyDoc_STRVAR(audioop_ratecv__doc__,
Larry Hastings2623c8c2014-02-08 22:15:29 -0800651"ratecv($module, fragment, width, nchannels, inrate, outrate, state,\n"
652" weightA=1, weightB=0, /)\n"
653"--\n"
654"\n"
Serhiy Storchaka8d00d732014-01-25 11:57:59 +0200655"Convert the frame rate of the input fragment.");
656
657#define AUDIOOP_RATECV_METHODDEF \
658 {"ratecv", (PyCFunction)audioop_ratecv, METH_VARARGS, audioop_ratecv__doc__},
659
660static PyObject *
661audioop_ratecv_impl(PyModuleDef *module, Py_buffer *fragment, int width, int nchannels, int inrate, int outrate, PyObject *state, int weightA, int weightB);
662
663static PyObject *
664audioop_ratecv(PyModuleDef *module, PyObject *args)
665{
666 PyObject *return_value = NULL;
667 Py_buffer fragment = {NULL, NULL};
668 int width;
669 int nchannels;
670 int inrate;
671 int outrate;
672 PyObject *state;
673 int weightA = 1;
674 int weightB = 0;
675
676 if (!PyArg_ParseTuple(args,
677 "y*iiiiO|ii:ratecv",
678 &fragment, &width, &nchannels, &inrate, &outrate, &state, &weightA, &weightB))
679 goto exit;
680 return_value = audioop_ratecv_impl(module, &fragment, width, nchannels, inrate, outrate, state, weightA, weightB);
681
682exit:
683 /* Cleanup for fragment */
684 if (fragment.obj)
685 PyBuffer_Release(&fragment);
686
687 return return_value;
688}
689
690PyDoc_STRVAR(audioop_lin2ulaw__doc__,
Larry Hastings2623c8c2014-02-08 22:15:29 -0800691"lin2ulaw($module, fragment, width, /)\n"
692"--\n"
693"\n"
Serhiy Storchaka8d00d732014-01-25 11:57:59 +0200694"Convert samples in the audio fragment to u-LAW encoding.");
695
696#define AUDIOOP_LIN2ULAW_METHODDEF \
697 {"lin2ulaw", (PyCFunction)audioop_lin2ulaw, METH_VARARGS, audioop_lin2ulaw__doc__},
698
699static PyObject *
700audioop_lin2ulaw_impl(PyModuleDef *module, Py_buffer *fragment, int width);
701
702static PyObject *
703audioop_lin2ulaw(PyModuleDef *module, PyObject *args)
704{
705 PyObject *return_value = NULL;
706 Py_buffer fragment = {NULL, NULL};
707 int width;
708
709 if (!PyArg_ParseTuple(args,
710 "y*i:lin2ulaw",
711 &fragment, &width))
712 goto exit;
713 return_value = audioop_lin2ulaw_impl(module, &fragment, width);
714
715exit:
716 /* Cleanup for fragment */
717 if (fragment.obj)
718 PyBuffer_Release(&fragment);
719
720 return return_value;
721}
722
723PyDoc_STRVAR(audioop_ulaw2lin__doc__,
Larry Hastings2623c8c2014-02-08 22:15:29 -0800724"ulaw2lin($module, fragment, width, /)\n"
725"--\n"
726"\n"
Serhiy Storchaka8d00d732014-01-25 11:57:59 +0200727"Convert sound fragments in u-LAW encoding to linearly encoded sound fragments.");
728
729#define AUDIOOP_ULAW2LIN_METHODDEF \
730 {"ulaw2lin", (PyCFunction)audioop_ulaw2lin, METH_VARARGS, audioop_ulaw2lin__doc__},
731
732static PyObject *
733audioop_ulaw2lin_impl(PyModuleDef *module, Py_buffer *fragment, int width);
734
735static PyObject *
736audioop_ulaw2lin(PyModuleDef *module, PyObject *args)
737{
738 PyObject *return_value = NULL;
739 Py_buffer fragment = {NULL, NULL};
740 int width;
741
742 if (!PyArg_ParseTuple(args,
743 "y*i:ulaw2lin",
744 &fragment, &width))
745 goto exit;
746 return_value = audioop_ulaw2lin_impl(module, &fragment, width);
747
748exit:
749 /* Cleanup for fragment */
750 if (fragment.obj)
751 PyBuffer_Release(&fragment);
752
753 return return_value;
754}
755
756PyDoc_STRVAR(audioop_lin2alaw__doc__,
Larry Hastings2623c8c2014-02-08 22:15:29 -0800757"lin2alaw($module, fragment, width, /)\n"
758"--\n"
759"\n"
Serhiy Storchaka8d00d732014-01-25 11:57:59 +0200760"Convert samples in the audio fragment to a-LAW encoding.");
761
762#define AUDIOOP_LIN2ALAW_METHODDEF \
763 {"lin2alaw", (PyCFunction)audioop_lin2alaw, METH_VARARGS, audioop_lin2alaw__doc__},
764
765static PyObject *
766audioop_lin2alaw_impl(PyModuleDef *module, Py_buffer *fragment, int width);
767
768static PyObject *
769audioop_lin2alaw(PyModuleDef *module, PyObject *args)
770{
771 PyObject *return_value = NULL;
772 Py_buffer fragment = {NULL, NULL};
773 int width;
774
775 if (!PyArg_ParseTuple(args,
776 "y*i:lin2alaw",
777 &fragment, &width))
778 goto exit;
779 return_value = audioop_lin2alaw_impl(module, &fragment, width);
780
781exit:
782 /* Cleanup for fragment */
783 if (fragment.obj)
784 PyBuffer_Release(&fragment);
785
786 return return_value;
787}
788
789PyDoc_STRVAR(audioop_alaw2lin__doc__,
Larry Hastings2623c8c2014-02-08 22:15:29 -0800790"alaw2lin($module, fragment, width, /)\n"
791"--\n"
792"\n"
Serhiy Storchaka8d00d732014-01-25 11:57:59 +0200793"Convert sound fragments in a-LAW encoding to linearly encoded sound fragments.");
794
795#define AUDIOOP_ALAW2LIN_METHODDEF \
796 {"alaw2lin", (PyCFunction)audioop_alaw2lin, METH_VARARGS, audioop_alaw2lin__doc__},
797
798static PyObject *
799audioop_alaw2lin_impl(PyModuleDef *module, Py_buffer *fragment, int width);
800
801static PyObject *
802audioop_alaw2lin(PyModuleDef *module, PyObject *args)
803{
804 PyObject *return_value = NULL;
805 Py_buffer fragment = {NULL, NULL};
806 int width;
807
808 if (!PyArg_ParseTuple(args,
809 "y*i:alaw2lin",
810 &fragment, &width))
811 goto exit;
812 return_value = audioop_alaw2lin_impl(module, &fragment, width);
813
814exit:
815 /* Cleanup for fragment */
816 if (fragment.obj)
817 PyBuffer_Release(&fragment);
818
819 return return_value;
820}
821
822PyDoc_STRVAR(audioop_lin2adpcm__doc__,
Larry Hastings2623c8c2014-02-08 22:15:29 -0800823"lin2adpcm($module, fragment, width, state, /)\n"
824"--\n"
825"\n"
Serhiy Storchaka8d00d732014-01-25 11:57:59 +0200826"Convert samples to 4 bit Intel/DVI ADPCM encoding.");
827
828#define AUDIOOP_LIN2ADPCM_METHODDEF \
829 {"lin2adpcm", (PyCFunction)audioop_lin2adpcm, METH_VARARGS, audioop_lin2adpcm__doc__},
830
831static PyObject *
832audioop_lin2adpcm_impl(PyModuleDef *module, Py_buffer *fragment, int width, PyObject *state);
833
834static PyObject *
835audioop_lin2adpcm(PyModuleDef *module, PyObject *args)
836{
837 PyObject *return_value = NULL;
838 Py_buffer fragment = {NULL, NULL};
839 int width;
840 PyObject *state;
841
842 if (!PyArg_ParseTuple(args,
843 "y*iO:lin2adpcm",
844 &fragment, &width, &state))
845 goto exit;
846 return_value = audioop_lin2adpcm_impl(module, &fragment, width, state);
847
848exit:
849 /* Cleanup for fragment */
850 if (fragment.obj)
851 PyBuffer_Release(&fragment);
852
853 return return_value;
854}
855
856PyDoc_STRVAR(audioop_adpcm2lin__doc__,
Larry Hastings2623c8c2014-02-08 22:15:29 -0800857"adpcm2lin($module, fragment, width, state, /)\n"
858"--\n"
859"\n"
Serhiy Storchaka8d00d732014-01-25 11:57:59 +0200860"Decode an Intel/DVI ADPCM coded fragment to a linear fragment.");
861
862#define AUDIOOP_ADPCM2LIN_METHODDEF \
863 {"adpcm2lin", (PyCFunction)audioop_adpcm2lin, METH_VARARGS, audioop_adpcm2lin__doc__},
864
865static PyObject *
866audioop_adpcm2lin_impl(PyModuleDef *module, Py_buffer *fragment, int width, PyObject *state);
867
868static PyObject *
869audioop_adpcm2lin(PyModuleDef *module, PyObject *args)
870{
871 PyObject *return_value = NULL;
872 Py_buffer fragment = {NULL, NULL};
873 int width;
874 PyObject *state;
875
876 if (!PyArg_ParseTuple(args,
877 "y*iO:adpcm2lin",
878 &fragment, &width, &state))
879 goto exit;
880 return_value = audioop_adpcm2lin_impl(module, &fragment, width, state);
881
882exit:
883 /* Cleanup for fragment */
884 if (fragment.obj)
885 PyBuffer_Release(&fragment);
886
887 return return_value;
888}
Larry Hastings2623c8c2014-02-08 22:15:29 -0800889/*[clinic end generated code: output=be840bba5d40c2ce input=a9049054013a1b77]*/