1
/*************************************************************************
2
* Copyright 2010 Olivier Belanger *
4
* This file is part of pyo, a python module to help digital signal *
5
* processing script creation. *
7
* pyo is free software: you can redistribute it and/or modify *
8
* it under the terms of the GNU General Public License as published by *
9
* the Free Software Foundation, either version 3 of the License, or *
10
* (at your option) any later version. *
12
* pyo is distributed in the hope that it will be useful, *
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15
* GNU General Public License for more details. *
17
* You should have received a copy of the GNU General Public License *
18
* along with pyo. If not, see <http://www.gnu.org/licenses/>. *
19
*************************************************************************/
22
#include "structmember.h"
24
#include "pyomodule.h"
25
#include "streammodule.h"
26
#include "servermodule.h"
27
#include "dummymodule.h"
39
MYFLT y1; // sample memory
54
Disto_transform_ii(Disto *self) {
57
MYFLT *in = Stream_getData((Stream *)self->input_stream);
59
MYFLT drv = .4 - _clip(PyFloat_AS_DOUBLE(self->drive)) * .3999;
60
MYFLT slp = _clip(PyFloat_AS_DOUBLE(self->slope));
62
for (i=0; i<self->bufsize; i++) {
63
val = MYATAN2(in[i], drv);
67
for (i=0; i<self->bufsize; i++) {
68
val = self->data[i] * coeff + self->y1 * slp;
75
Disto_transform_ai(Disto *self) {
76
MYFLT val, drv, coeff;
78
MYFLT *in = Stream_getData((Stream *)self->input_stream);
80
MYFLT *drive = Stream_getData((Stream *)self->drive_stream);
81
MYFLT slp = _clip(PyFloat_AS_DOUBLE(self->slope));
83
for (i=0; i<self->bufsize; i++) {
84
drv = .4 - _clip(drive[i]) * .3999;
85
val = MYATAN2(in[i], drv);
90
for (i=0; i<self->bufsize; i++) {
91
val = self->data[i] * coeff + self->y1 * slp;
98
Disto_transform_ia(Disto *self) {
99
MYFLT val, coeff, slp;
101
MYFLT *in = Stream_getData((Stream *)self->input_stream);
103
MYFLT drv = .4 - _clip(PyFloat_AS_DOUBLE(self->drive)) * .3999;
104
MYFLT *slope = Stream_getData((Stream *)self->slope_stream);
106
for (i=0; i<self->bufsize; i++) {
107
val = MYATAN2(in[i], drv);
110
for (i=0; i<self->bufsize; i++) {
111
slp = _clip(slope[i]);
113
val = self->data[i] * coeff + self->y1 * slp;
120
Disto_transform_aa(Disto *self) {
121
MYFLT val, drv, coeff, slp;
123
MYFLT *in = Stream_getData((Stream *)self->input_stream);
125
MYFLT *drive = Stream_getData((Stream *)self->drive_stream);
126
MYFLT *slope = Stream_getData((Stream *)self->slope_stream);
128
for (i=0; i<self->bufsize; i++) {
129
drv = .4 - _clip(drive[i]) * .3999;
130
val = MYATAN2(in[i], drv);
133
for (i=0; i<self->bufsize; i++) {
134
slp = _clip(slope[i]);
136
val = self->data[i] * coeff + self->y1 * slp;
142
static void Disto_postprocessing_ii(Disto *self) { POST_PROCESSING_II };
143
static void Disto_postprocessing_ai(Disto *self) { POST_PROCESSING_AI };
144
static void Disto_postprocessing_ia(Disto *self) { POST_PROCESSING_IA };
145
static void Disto_postprocessing_aa(Disto *self) { POST_PROCESSING_AA };
146
static void Disto_postprocessing_ireva(Disto *self) { POST_PROCESSING_IREVA };
147
static void Disto_postprocessing_areva(Disto *self) { POST_PROCESSING_AREVA };
148
static void Disto_postprocessing_revai(Disto *self) { POST_PROCESSING_REVAI };
149
static void Disto_postprocessing_revaa(Disto *self) { POST_PROCESSING_REVAA };
150
static void Disto_postprocessing_revareva(Disto *self) { POST_PROCESSING_REVAREVA };
153
Disto_setProcMode(Disto *self)
155
int procmode, muladdmode;
156
procmode = self->modebuffer[2] + self->modebuffer[3] * 10;
157
muladdmode = self->modebuffer[0] + self->modebuffer[1] * 10;
161
self->proc_func_ptr = Disto_transform_ii;
164
self->proc_func_ptr = Disto_transform_ai;
167
self->proc_func_ptr = Disto_transform_ia;
170
self->proc_func_ptr = Disto_transform_aa;
173
switch (muladdmode) {
175
self->muladd_func_ptr = Disto_postprocessing_ii;
178
self->muladd_func_ptr = Disto_postprocessing_ai;
181
self->muladd_func_ptr = Disto_postprocessing_revai;
184
self->muladd_func_ptr = Disto_postprocessing_ia;
187
self->muladd_func_ptr = Disto_postprocessing_aa;
190
self->muladd_func_ptr = Disto_postprocessing_revaa;
193
self->muladd_func_ptr = Disto_postprocessing_ireva;
196
self->muladd_func_ptr = Disto_postprocessing_areva;
199
self->muladd_func_ptr = Disto_postprocessing_revareva;
205
Disto_compute_next_data_frame(Disto *self)
207
(*self->proc_func_ptr)(self);
208
(*self->muladd_func_ptr)(self);
212
Disto_traverse(Disto *self, visitproc visit, void *arg)
215
Py_VISIT(self->input);
216
Py_VISIT(self->input_stream);
217
Py_VISIT(self->drive);
218
Py_VISIT(self->drive_stream);
219
Py_VISIT(self->slope);
220
Py_VISIT(self->slope_stream);
225
Disto_clear(Disto *self)
228
Py_CLEAR(self->input);
229
Py_CLEAR(self->input_stream);
230
Py_CLEAR(self->drive);
231
Py_CLEAR(self->drive_stream);
232
Py_CLEAR(self->slope);
233
Py_CLEAR(self->slope_stream);
238
Disto_dealloc(Disto* self)
242
self->ob_type->tp_free((PyObject*)self);
245
static PyObject * Disto_deleteStream(Disto *self) { DELETE_STREAM };
248
Disto_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
252
self = (Disto *)type->tp_alloc(type, 0);
254
self->drive = PyFloat_FromDouble(.75);
255
self->slope = PyFloat_FromDouble(.5);
256
self->modebuffer[0] = 0;
257
self->modebuffer[1] = 0;
258
self->modebuffer[2] = 0;
259
self->modebuffer[3] = 0;
263
Stream_setFunctionPtr(self->stream, Disto_compute_next_data_frame);
264
self->mode_func_ptr = Disto_setProcMode;
266
return (PyObject *)self;
270
Disto_init(Disto *self, PyObject *args, PyObject *kwds)
272
PyObject *inputtmp, *input_streamtmp, *drivetmp=NULL, *slopetmp=NULL, *multmp=NULL, *addtmp=NULL;
274
static char *kwlist[] = {"input", "drive", "slope", "mul", "add", NULL};
276
if (! PyArg_ParseTupleAndKeywords(args, kwds, "O|OOOO", kwlist, &inputtmp, &drivetmp, &slopetmp, &multmp, &addtmp))
282
PyObject_CallMethod((PyObject *)self, "setDrive", "O", drivetmp);
286
PyObject_CallMethod((PyObject *)self, "setSlope", "O", slopetmp);
290
PyObject_CallMethod((PyObject *)self, "setMul", "O", multmp);
294
PyObject_CallMethod((PyObject *)self, "setAdd", "O", addtmp);
297
Py_INCREF(self->stream);
298
PyObject_CallMethod(self->server, "addStream", "O", self->stream);
300
(*self->mode_func_ptr)(self);
306
static PyObject * Disto_getServer(Disto* self) { GET_SERVER };
307
static PyObject * Disto_getStream(Disto* self) { GET_STREAM };
308
static PyObject * Disto_setMul(Disto *self, PyObject *arg) { SET_MUL };
309
static PyObject * Disto_setAdd(Disto *self, PyObject *arg) { SET_ADD };
310
static PyObject * Disto_setSub(Disto *self, PyObject *arg) { SET_SUB };
311
static PyObject * Disto_setDiv(Disto *self, PyObject *arg) { SET_DIV };
313
static PyObject * Disto_play(Disto *self, PyObject *args, PyObject *kwds) { PLAY };
314
static PyObject * Disto_out(Disto *self, PyObject *args, PyObject *kwds) { OUT };
315
static PyObject * Disto_stop(Disto *self) { STOP };
317
static PyObject * Disto_multiply(Disto *self, PyObject *arg) { MULTIPLY };
318
static PyObject * Disto_inplace_multiply(Disto *self, PyObject *arg) { INPLACE_MULTIPLY };
319
static PyObject * Disto_add(Disto *self, PyObject *arg) { ADD };
320
static PyObject * Disto_inplace_add(Disto *self, PyObject *arg) { INPLACE_ADD };
321
static PyObject * Disto_sub(Disto *self, PyObject *arg) { SUB };
322
static PyObject * Disto_inplace_sub(Disto *self, PyObject *arg) { INPLACE_SUB };
323
static PyObject * Disto_div(Disto *self, PyObject *arg) { DIV };
324
static PyObject * Disto_inplace_div(Disto *self, PyObject *arg) { INPLACE_DIV };
327
Disto_setDrive(Disto *self, PyObject *arg)
329
PyObject *tmp, *streamtmp;
336
int isNumber = PyNumber_Check(arg);
340
Py_DECREF(self->drive);
342
self->drive = PyNumber_Float(tmp);
343
self->modebuffer[2] = 0;
347
streamtmp = PyObject_CallMethod((PyObject *)self->drive, "_getStream", NULL);
348
Py_INCREF(streamtmp);
349
Py_XDECREF(self->drive_stream);
350
self->drive_stream = (Stream *)streamtmp;
351
self->modebuffer[2] = 1;
354
(*self->mode_func_ptr)(self);
361
Disto_setSlope(Disto *self, PyObject *arg)
363
PyObject *tmp, *streamtmp;
370
int isNumber = PyNumber_Check(arg);
374
Py_DECREF(self->slope);
376
self->slope = PyNumber_Float(tmp);
377
self->modebuffer[3] = 0;
381
streamtmp = PyObject_CallMethod((PyObject *)self->slope, "_getStream", NULL);
382
Py_INCREF(streamtmp);
383
Py_XDECREF(self->slope_stream);
384
self->slope_stream = (Stream *)streamtmp;
385
self->modebuffer[3] = 1;
388
(*self->mode_func_ptr)(self);
394
static PyMemberDef Disto_members[] = {
395
{"server", T_OBJECT_EX, offsetof(Disto, server), 0, "Pyo server."},
396
{"stream", T_OBJECT_EX, offsetof(Disto, stream), 0, "Stream object."},
397
{"input", T_OBJECT_EX, offsetof(Disto, input), 0, "Input sound object."},
398
{"drive", T_OBJECT_EX, offsetof(Disto, drive), 0, "Cutoff driveuency in cycle per second."},
399
{"slope", T_OBJECT_EX, offsetof(Disto, slope), 0, "Lowpass filter slope factor."},
400
{"mul", T_OBJECT_EX, offsetof(Disto, mul), 0, "Mul factor."},
401
{"add", T_OBJECT_EX, offsetof(Disto, add), 0, "Add factor."},
402
{NULL} /* Sentinel */
405
static PyMethodDef Disto_methods[] = {
406
{"getServer", (PyCFunction)Disto_getServer, METH_NOARGS, "Returns server object."},
407
{"_getStream", (PyCFunction)Disto_getStream, METH_NOARGS, "Returns stream object."},
408
{"deleteStream", (PyCFunction)Disto_deleteStream, METH_NOARGS, "Remove stream from server and delete the object."},
409
{"play", (PyCFunction)Disto_play, METH_VARARGS|METH_KEYWORDS, "Starts computing without sending sound to soundcard."},
410
{"out", (PyCFunction)Disto_out, METH_VARARGS|METH_KEYWORDS, "Starts computing and sends sound to soundcard channel speficied by argument."},
411
{"stop", (PyCFunction)Disto_stop, METH_NOARGS, "Stops computing."},
412
{"setDrive", (PyCFunction)Disto_setDrive, METH_O, "Sets distortion drive factor (0 -> 1)."},
413
{"setSlope", (PyCFunction)Disto_setSlope, METH_O, "Sets lowpass filter slope factor."},
414
{"setMul", (PyCFunction)Disto_setMul, METH_O, "Sets oscillator mul factor."},
415
{"setAdd", (PyCFunction)Disto_setAdd, METH_O, "Sets oscillator add factor."},
416
{"setSub", (PyCFunction)Disto_setSub, METH_O, "Sets inverse add factor."},
417
{"setDiv", (PyCFunction)Disto_setDiv, METH_O, "Sets inverse mul factor."},
418
{NULL} /* Sentinel */
421
static PyNumberMethods Disto_as_number = {
422
(binaryfunc)Disto_add, /*nb_add*/
423
(binaryfunc)Disto_sub, /*nb_subtract*/
424
(binaryfunc)Disto_multiply, /*nb_multiply*/
425
(binaryfunc)Disto_div, /*nb_divide*/
431
0, /*(unaryfunc)array_abs,*/
445
(binaryfunc)Disto_inplace_add, /*inplace_add*/
446
(binaryfunc)Disto_inplace_sub, /*inplace_subtract*/
447
(binaryfunc)Disto_inplace_multiply, /*inplace_multiply*/
448
(binaryfunc)Disto_inplace_div, /*inplace_divide*/
449
0, /*inplace_remainder*/
451
0, /*inplace_lshift*/
452
0, /*inplace_rshift*/
456
0, /*nb_floor_divide*/
457
0, /*nb_true_divide*/
458
0, /*nb_inplace_floor_divide*/
459
0, /*nb_inplace_true_divide*/
463
PyTypeObject DistoType = {
464
PyObject_HEAD_INIT(NULL)
466
"_pyo.Disto_base", /*tp_name*/
467
sizeof(Disto), /*tp_basicsize*/
469
(destructor)Disto_dealloc, /*tp_dealloc*/
475
&Disto_as_number, /*tp_as_number*/
476
0, /*tp_as_sequence*/
484
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_CHECKTYPES, /*tp_flags*/
485
"Disto objects. Arctan distortion.", /* tp_doc */
486
(traverseproc)Disto_traverse, /* tp_traverse */
487
(inquiry)Disto_clear, /* tp_clear */
488
0, /* tp_richcompare */
489
0, /* tp_weaklistoffset */
492
Disto_methods, /* tp_methods */
493
Disto_members, /* tp_members */
497
0, /* tp_descr_get */
498
0, /* tp_descr_set */
499
0, /* tp_dictoffset */
500
(initproc)Disto_init, /* tp_init */
502
Disto_new, /* tp_new */
512
Stream *input_stream;
521
Clip_transform_ii(Clip *self) {
524
MYFLT *in = Stream_getData((Stream *)self->input_stream);
525
MYFLT mi = PyFloat_AS_DOUBLE(self->min);
526
MYFLT ma = PyFloat_AS_DOUBLE(self->max);
528
for (i=0; i<self->bufsize; i++) {
540
Clip_transform_ai(Clip *self) {
543
MYFLT *in = Stream_getData((Stream *)self->input_stream);
544
MYFLT *mi = Stream_getData((Stream *)self->min_stream);
545
MYFLT ma = PyFloat_AS_DOUBLE(self->max);
547
for (i=0; i<self->bufsize; i++) {
551
self->data[i] = mini;
560
Clip_transform_ia(Clip *self) {
563
MYFLT *in = Stream_getData((Stream *)self->input_stream);
564
MYFLT mi = PyFloat_AS_DOUBLE(self->min);
565
MYFLT *ma = Stream_getData((Stream *)self->max_stream);
567
for (i=0; i<self->bufsize; i++) {
573
self->data[i] = maxi;
580
Clip_transform_aa(Clip *self) {
581
MYFLT val, mini, maxi;
583
MYFLT *in = Stream_getData((Stream *)self->input_stream);
584
MYFLT *mi = Stream_getData((Stream *)self->min_stream);
585
MYFLT *ma = Stream_getData((Stream *)self->max_stream);
587
for (i=0; i<self->bufsize; i++) {
592
self->data[i] = mini;
594
self->data[i] = maxi;
600
static void Clip_postprocessing_ii(Clip *self) { POST_PROCESSING_II };
601
static void Clip_postprocessing_ai(Clip *self) { POST_PROCESSING_AI };
602
static void Clip_postprocessing_ia(Clip *self) { POST_PROCESSING_IA };
603
static void Clip_postprocessing_aa(Clip *self) { POST_PROCESSING_AA };
604
static void Clip_postprocessing_ireva(Clip *self) { POST_PROCESSING_IREVA };
605
static void Clip_postprocessing_areva(Clip *self) { POST_PROCESSING_AREVA };
606
static void Clip_postprocessing_revai(Clip *self) { POST_PROCESSING_REVAI };
607
static void Clip_postprocessing_revaa(Clip *self) { POST_PROCESSING_REVAA };
608
static void Clip_postprocessing_revareva(Clip *self) { POST_PROCESSING_REVAREVA };
611
Clip_setProcMode(Clip *self)
613
int procmode, muladdmode;
614
procmode = self->modebuffer[2] + self->modebuffer[3] * 10;
615
muladdmode = self->modebuffer[0] + self->modebuffer[1] * 10;
619
self->proc_func_ptr = Clip_transform_ii;
622
self->proc_func_ptr = Clip_transform_ai;
625
self->proc_func_ptr = Clip_transform_ia;
628
self->proc_func_ptr = Clip_transform_aa;
631
switch (muladdmode) {
633
self->muladd_func_ptr = Clip_postprocessing_ii;
636
self->muladd_func_ptr = Clip_postprocessing_ai;
639
self->muladd_func_ptr = Clip_postprocessing_revai;
642
self->muladd_func_ptr = Clip_postprocessing_ia;
645
self->muladd_func_ptr = Clip_postprocessing_aa;
648
self->muladd_func_ptr = Clip_postprocessing_revaa;
651
self->muladd_func_ptr = Clip_postprocessing_ireva;
654
self->muladd_func_ptr = Clip_postprocessing_areva;
657
self->muladd_func_ptr = Clip_postprocessing_revareva;
663
Clip_compute_next_data_frame(Clip *self)
665
(*self->proc_func_ptr)(self);
666
(*self->muladd_func_ptr)(self);
670
Clip_traverse(Clip *self, visitproc visit, void *arg)
673
Py_VISIT(self->input);
674
Py_VISIT(self->input_stream);
676
Py_VISIT(self->min_stream);
678
Py_VISIT(self->max_stream);
683
Clip_clear(Clip *self)
686
Py_CLEAR(self->input);
687
Py_CLEAR(self->input_stream);
689
Py_CLEAR(self->min_stream);
691
Py_CLEAR(self->max_stream);
696
Clip_dealloc(Clip* self)
700
self->ob_type->tp_free((PyObject*)self);
703
static PyObject * Clip_deleteStream(Clip *self) { DELETE_STREAM };
706
Clip_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
710
self = (Clip *)type->tp_alloc(type, 0);
712
self->min = PyFloat_FromDouble(-1.0);
713
self->max = PyFloat_FromDouble(1.0);
714
self->modebuffer[0] = 0;
715
self->modebuffer[1] = 0;
716
self->modebuffer[2] = 0;
717
self->modebuffer[3] = 0;
720
Stream_setFunctionPtr(self->stream, Clip_compute_next_data_frame);
721
self->mode_func_ptr = Clip_setProcMode;
723
return (PyObject *)self;
727
Clip_init(Clip *self, PyObject *args, PyObject *kwds)
729
PyObject *inputtmp, *input_streamtmp, *mintmp=NULL, *maxtmp=NULL, *multmp=NULL, *addtmp=NULL;
731
static char *kwlist[] = {"input", "min", "max", "mul", "add", NULL};
733
if (! PyArg_ParseTupleAndKeywords(args, kwds, "O|OOOO", kwlist, &inputtmp, &mintmp, &maxtmp, &multmp, &addtmp))
739
PyObject_CallMethod((PyObject *)self, "setMin", "O", mintmp);
743
PyObject_CallMethod((PyObject *)self, "setMax", "O", maxtmp);
747
PyObject_CallMethod((PyObject *)self, "setMul", "O", multmp);
751
PyObject_CallMethod((PyObject *)self, "setAdd", "O", addtmp);
754
Py_INCREF(self->stream);
755
PyObject_CallMethod(self->server, "addStream", "O", self->stream);
757
(*self->mode_func_ptr)(self);
763
static PyObject * Clip_getServer(Clip* self) { GET_SERVER };
764
static PyObject * Clip_getStream(Clip* self) { GET_STREAM };
765
static PyObject * Clip_setMul(Clip *self, PyObject *arg) { SET_MUL };
766
static PyObject * Clip_setAdd(Clip *self, PyObject *arg) { SET_ADD };
767
static PyObject * Clip_setSub(Clip *self, PyObject *arg) { SET_SUB };
768
static PyObject * Clip_setDiv(Clip *self, PyObject *arg) { SET_DIV };
770
static PyObject * Clip_play(Clip *self, PyObject *args, PyObject *kwds) { PLAY };
771
static PyObject * Clip_out(Clip *self, PyObject *args, PyObject *kwds) { OUT };
772
static PyObject * Clip_stop(Clip *self) { STOP };
774
static PyObject * Clip_multiply(Clip *self, PyObject *arg) { MULTIPLY };
775
static PyObject * Clip_inplace_multiply(Clip *self, PyObject *arg) { INPLACE_MULTIPLY };
776
static PyObject * Clip_add(Clip *self, PyObject *arg) { ADD };
777
static PyObject * Clip_inplace_add(Clip *self, PyObject *arg) { INPLACE_ADD };
778
static PyObject * Clip_sub(Clip *self, PyObject *arg) { SUB };
779
static PyObject * Clip_inplace_sub(Clip *self, PyObject *arg) { INPLACE_SUB };
780
static PyObject * Clip_div(Clip *self, PyObject *arg) { DIV };
781
static PyObject * Clip_inplace_div(Clip *self, PyObject *arg) { INPLACE_DIV };
784
Clip_setMin(Clip *self, PyObject *arg)
786
PyObject *tmp, *streamtmp;
793
int isNumber = PyNumber_Check(arg);
797
Py_DECREF(self->min);
799
self->min = PyNumber_Float(tmp);
800
self->modebuffer[2] = 0;
804
streamtmp = PyObject_CallMethod((PyObject *)self->min, "_getStream", NULL);
805
Py_INCREF(streamtmp);
806
Py_XDECREF(self->min_stream);
807
self->min_stream = (Stream *)streamtmp;
808
self->modebuffer[2] = 1;
811
(*self->mode_func_ptr)(self);
818
Clip_setMax(Clip *self, PyObject *arg)
820
PyObject *tmp, *streamtmp;
827
int isNumber = PyNumber_Check(arg);
831
Py_DECREF(self->max);
833
self->max = PyNumber_Float(tmp);
834
self->modebuffer[3] = 0;
838
streamtmp = PyObject_CallMethod((PyObject *)self->max, "_getStream", NULL);
839
Py_INCREF(streamtmp);
840
Py_XDECREF(self->max_stream);
841
self->max_stream = (Stream *)streamtmp;
842
self->modebuffer[3] = 1;
845
(*self->mode_func_ptr)(self);
851
static PyMemberDef Clip_members[] = {
852
{"server", T_OBJECT_EX, offsetof(Clip, server), 0, "Pyo server."},
853
{"stream", T_OBJECT_EX, offsetof(Clip, stream), 0, "Stream object."},
854
{"input", T_OBJECT_EX, offsetof(Clip, input), 0, "Input sound object."},
855
{"min", T_OBJECT_EX, offsetof(Clip, min), 0, "Minimum possible value."},
856
{"max", T_OBJECT_EX, offsetof(Clip, max), 0, "Maximum possible value."},
857
{"mul", T_OBJECT_EX, offsetof(Clip, mul), 0, "Mul factor."},
858
{"add", T_OBJECT_EX, offsetof(Clip, add), 0, "Add factor."},
859
{NULL} /* Sentinel */
862
static PyMethodDef Clip_methods[] = {
863
{"getServer", (PyCFunction)Clip_getServer, METH_NOARGS, "Returns server object."},
864
{"_getStream", (PyCFunction)Clip_getStream, METH_NOARGS, "Returns stream object."},
865
{"deleteStream", (PyCFunction)Clip_deleteStream, METH_NOARGS, "Remove stream from server and delete the object."},
866
{"play", (PyCFunction)Clip_play, METH_VARARGS|METH_KEYWORDS, "Starts computing without sending sound to soundcard."},
867
{"out", (PyCFunction)Clip_out, METH_VARARGS|METH_KEYWORDS, "Starts computing and sends sound to soundcard channel speficied by argument."},
868
{"stop", (PyCFunction)Clip_stop, METH_NOARGS, "Stops computing."},
869
{"setMin", (PyCFunction)Clip_setMin, METH_O, "Sets the minimum value."},
870
{"setMax", (PyCFunction)Clip_setMax, METH_O, "Sets the maximum value."},
871
{"setMul", (PyCFunction)Clip_setMul, METH_O, "Sets oscillator mul factor."},
872
{"setAdd", (PyCFunction)Clip_setAdd, METH_O, "Sets oscillator add factor."},
873
{"setSub", (PyCFunction)Clip_setSub, METH_O, "Sets inverse add factor."},
874
{"setDiv", (PyCFunction)Clip_setDiv, METH_O, "Sets inverse mul factor."},
875
{NULL} /* Sentinel */
878
static PyNumberMethods Clip_as_number = {
879
(binaryfunc)Clip_add, /*nb_add*/
880
(binaryfunc)Clip_sub, /*nb_subtract*/
881
(binaryfunc)Clip_multiply, /*nb_multiply*/
882
(binaryfunc)Clip_div, /*nb_divide*/
888
0, /*(unaryfunc)array_abs,*/
902
(binaryfunc)Clip_inplace_add, /*inplace_add*/
903
(binaryfunc)Clip_inplace_sub, /*inplace_subtract*/
904
(binaryfunc)Clip_inplace_multiply, /*inplace_multiply*/
905
(binaryfunc)Clip_inplace_div, /*inplace_divide*/
906
0, /*inplace_remainder*/
908
0, /*inplace_lshift*/
909
0, /*inplace_rshift*/
913
0, /*nb_floor_divide*/
914
0, /*nb_true_divide*/
915
0, /*nb_inplace_floor_divide*/
916
0, /*nb_inplace_true_divide*/
920
PyTypeObject ClipType = {
921
PyObject_HEAD_INIT(NULL)
923
"_pyo.Clip_base", /*tp_name*/
924
sizeof(Clip), /*tp_basicsize*/
926
(destructor)Clip_dealloc, /*tp_dealloc*/
932
&Clip_as_number, /*tp_as_number*/
933
0, /*tp_as_sequence*/
941
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_CHECKTYPES, /*tp_flags*/
942
"Clip objects. Clips a signal to a predefined limit.", /* tp_doc */
943
(traverseproc)Clip_traverse, /* tp_traverse */
944
(inquiry)Clip_clear, /* tp_clear */
945
0, /* tp_richcompare */
946
0, /* tp_weaklistoffset */
949
Clip_methods, /* tp_methods */
950
Clip_members, /* tp_members */
954
0, /* tp_descr_get */
955
0, /* tp_descr_set */
956
0, /* tp_dictoffset */
957
(initproc)Clip_init, /* tp_init */
959
Clip_new, /* tp_new */
969
Stream *input_stream;
978
Mirror_transform_ii(Mirror *self) {
981
MYFLT *in = Stream_getData((Stream *)self->input_stream);
982
MYFLT mi = PyFloat_AS_DOUBLE(self->min);
983
MYFLT ma = PyFloat_AS_DOUBLE(self->max);
986
avg = (mi + ma) * 0.5;
987
for (i=0; i<self->bufsize; i++) {
992
for (i=0; i<self->bufsize; i++) {
994
while ((val > ma) || (val < mi)) {
1000
self->data[i] = val;
1006
Mirror_transform_ai(Mirror *self) {
1009
MYFLT *in = Stream_getData((Stream *)self->input_stream);
1010
MYFLT *mini = Stream_getData((Stream *)self->min_stream);
1011
MYFLT ma = PyFloat_AS_DOUBLE(self->max);
1013
for (i=0; i<self->bufsize; i++) {
1017
avg = (mi + ma) * 0.5;
1018
self->data[i] = avg;
1021
while ((val > ma) || (val < mi)) {
1023
val = ma + ma - val;
1025
val = mi + mi - val;
1027
self->data[i] = val;
1033
Mirror_transform_ia(Mirror *self) {
1036
MYFLT *in = Stream_getData((Stream *)self->input_stream);
1037
MYFLT mi = PyFloat_AS_DOUBLE(self->min);
1038
MYFLT *maxi = Stream_getData((Stream *)self->max_stream);
1040
for (i=0; i<self->bufsize; i++) {
1044
avg = (mi + ma) * 0.5;
1045
self->data[i] = avg;
1048
while ((val > ma) || (val < mi)) {
1050
val = ma + ma - val;
1052
val = mi + mi - val;
1054
self->data[i] = val;
1060
Mirror_transform_aa(Mirror *self) {
1061
MYFLT val, avg, mi, ma;
1063
MYFLT *in = Stream_getData((Stream *)self->input_stream);
1064
MYFLT *mini = Stream_getData((Stream *)self->min_stream);
1065
MYFLT *maxi = Stream_getData((Stream *)self->max_stream);
1067
for (i=0; i<self->bufsize; i++) {
1072
avg = (mi + ma) * 0.5;
1073
self->data[i] = avg;
1076
while ((val > ma) || (val < mi)) {
1078
val = ma + ma - val;
1080
val = mi + mi - val;
1082
self->data[i] = val;
1087
static void Mirror_postprocessing_ii(Mirror *self) { POST_PROCESSING_II };
1088
static void Mirror_postprocessing_ai(Mirror *self) { POST_PROCESSING_AI };
1089
static void Mirror_postprocessing_ia(Mirror *self) { POST_PROCESSING_IA };
1090
static void Mirror_postprocessing_aa(Mirror *self) { POST_PROCESSING_AA };
1091
static void Mirror_postprocessing_ireva(Mirror *self) { POST_PROCESSING_IREVA };
1092
static void Mirror_postprocessing_areva(Mirror *self) { POST_PROCESSING_AREVA };
1093
static void Mirror_postprocessing_revai(Mirror *self) { POST_PROCESSING_REVAI };
1094
static void Mirror_postprocessing_revaa(Mirror *self) { POST_PROCESSING_REVAA };
1095
static void Mirror_postprocessing_revareva(Mirror *self) { POST_PROCESSING_REVAREVA };
1098
Mirror_setProcMode(Mirror *self)
1100
int procmode, muladdmode;
1101
procmode = self->modebuffer[2] + self->modebuffer[3] * 10;
1102
muladdmode = self->modebuffer[0] + self->modebuffer[1] * 10;
1106
self->proc_func_ptr = Mirror_transform_ii;
1109
self->proc_func_ptr = Mirror_transform_ai;
1112
self->proc_func_ptr = Mirror_transform_ia;
1115
self->proc_func_ptr = Mirror_transform_aa;
1118
switch (muladdmode) {
1120
self->muladd_func_ptr = Mirror_postprocessing_ii;
1123
self->muladd_func_ptr = Mirror_postprocessing_ai;
1126
self->muladd_func_ptr = Mirror_postprocessing_revai;
1129
self->muladd_func_ptr = Mirror_postprocessing_ia;
1132
self->muladd_func_ptr = Mirror_postprocessing_aa;
1135
self->muladd_func_ptr = Mirror_postprocessing_revaa;
1138
self->muladd_func_ptr = Mirror_postprocessing_ireva;
1141
self->muladd_func_ptr = Mirror_postprocessing_areva;
1144
self->muladd_func_ptr = Mirror_postprocessing_revareva;
1150
Mirror_compute_next_data_frame(Mirror *self)
1152
(*self->proc_func_ptr)(self);
1153
(*self->muladd_func_ptr)(self);
1157
Mirror_traverse(Mirror *self, visitproc visit, void *arg)
1160
Py_VISIT(self->input);
1161
Py_VISIT(self->input_stream);
1162
Py_VISIT(self->min);
1163
Py_VISIT(self->min_stream);
1164
Py_VISIT(self->max);
1165
Py_VISIT(self->max_stream);
1170
Mirror_clear(Mirror *self)
1173
Py_CLEAR(self->input);
1174
Py_CLEAR(self->input_stream);
1175
Py_CLEAR(self->min);
1176
Py_CLEAR(self->min_stream);
1177
Py_CLEAR(self->max);
1178
Py_CLEAR(self->max_stream);
1183
Mirror_dealloc(Mirror* self)
1187
self->ob_type->tp_free((PyObject*)self);
1190
static PyObject * Mirror_deleteStream(Mirror *self) { DELETE_STREAM };
1193
Mirror_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
1197
self = (Mirror *)type->tp_alloc(type, 0);
1199
self->min = PyFloat_FromDouble(0.0);
1200
self->max = PyFloat_FromDouble(1.0);
1201
self->modebuffer[0] = 0;
1202
self->modebuffer[1] = 0;
1203
self->modebuffer[2] = 0;
1204
self->modebuffer[3] = 0;
1207
Stream_setFunctionPtr(self->stream, Mirror_compute_next_data_frame);
1208
self->mode_func_ptr = Mirror_setProcMode;
1210
return (PyObject *)self;
1214
Mirror_init(Mirror *self, PyObject *args, PyObject *kwds)
1216
PyObject *inputtmp, *input_streamtmp, *mintmp=NULL, *maxtmp=NULL, *multmp=NULL, *addtmp=NULL;
1218
static char *kwlist[] = {"input", "min", "max", "mul", "add", NULL};
1220
if (! PyArg_ParseTupleAndKeywords(args, kwds, "O|OOOO", kwlist, &inputtmp, &mintmp, &maxtmp, &multmp, &addtmp))
1226
PyObject_CallMethod((PyObject *)self, "setMin", "O", mintmp);
1230
PyObject_CallMethod((PyObject *)self, "setMax", "O", maxtmp);
1234
PyObject_CallMethod((PyObject *)self, "setMul", "O", multmp);
1238
PyObject_CallMethod((PyObject *)self, "setAdd", "O", addtmp);
1241
Py_INCREF(self->stream);
1242
PyObject_CallMethod(self->server, "addStream", "O", self->stream);
1244
(*self->mode_func_ptr)(self);
1250
static PyObject * Mirror_getServer(Mirror* self) { GET_SERVER };
1251
static PyObject * Mirror_getStream(Mirror* self) { GET_STREAM };
1252
static PyObject * Mirror_setMul(Mirror *self, PyObject *arg) { SET_MUL };
1253
static PyObject * Mirror_setAdd(Mirror *self, PyObject *arg) { SET_ADD };
1254
static PyObject * Mirror_setSub(Mirror *self, PyObject *arg) { SET_SUB };
1255
static PyObject * Mirror_setDiv(Mirror *self, PyObject *arg) { SET_DIV };
1257
static PyObject * Mirror_play(Mirror *self, PyObject *args, PyObject *kwds) { PLAY };
1258
static PyObject * Mirror_out(Mirror *self, PyObject *args, PyObject *kwds) { OUT };
1259
static PyObject * Mirror_stop(Mirror *self) { STOP };
1261
static PyObject * Mirror_multiply(Mirror *self, PyObject *arg) { MULTIPLY };
1262
static PyObject * Mirror_inplace_multiply(Mirror *self, PyObject *arg) { INPLACE_MULTIPLY };
1263
static PyObject * Mirror_add(Mirror *self, PyObject *arg) { ADD };
1264
static PyObject * Mirror_inplace_add(Mirror *self, PyObject *arg) { INPLACE_ADD };
1265
static PyObject * Mirror_sub(Mirror *self, PyObject *arg) { SUB };
1266
static PyObject * Mirror_inplace_sub(Mirror *self, PyObject *arg) { INPLACE_SUB };
1267
static PyObject * Mirror_div(Mirror *self, PyObject *arg) { DIV };
1268
static PyObject * Mirror_inplace_div(Mirror *self, PyObject *arg) { INPLACE_DIV };
1271
Mirror_setMin(Mirror *self, PyObject *arg)
1273
PyObject *tmp, *streamtmp;
1280
int isNumber = PyNumber_Check(arg);
1284
Py_DECREF(self->min);
1285
if (isNumber == 1) {
1286
self->min = PyNumber_Float(tmp);
1287
self->modebuffer[2] = 0;
1291
streamtmp = PyObject_CallMethod((PyObject *)self->min, "_getStream", NULL);
1292
Py_INCREF(streamtmp);
1293
Py_XDECREF(self->min_stream);
1294
self->min_stream = (Stream *)streamtmp;
1295
self->modebuffer[2] = 1;
1298
(*self->mode_func_ptr)(self);
1305
Mirror_setMax(Mirror *self, PyObject *arg)
1307
PyObject *tmp, *streamtmp;
1314
int isNumber = PyNumber_Check(arg);
1318
Py_DECREF(self->max);
1319
if (isNumber == 1) {
1320
self->max = PyNumber_Float(tmp);
1321
self->modebuffer[3] = 0;
1325
streamtmp = PyObject_CallMethod((PyObject *)self->max, "_getStream", NULL);
1326
Py_INCREF(streamtmp);
1327
Py_XDECREF(self->max_stream);
1328
self->max_stream = (Stream *)streamtmp;
1329
self->modebuffer[3] = 1;
1332
(*self->mode_func_ptr)(self);
1338
static PyMemberDef Mirror_members[] = {
1339
{"server", T_OBJECT_EX, offsetof(Mirror, server), 0, "Pyo server."},
1340
{"stream", T_OBJECT_EX, offsetof(Mirror, stream), 0, "Stream object."},
1341
{"input", T_OBJECT_EX, offsetof(Mirror, input), 0, "Input sound object."},
1342
{"min", T_OBJECT_EX, offsetof(Mirror, min), 0, "Minimum possible value."},
1343
{"max", T_OBJECT_EX, offsetof(Mirror, max), 0, "Maximum possible value."},
1344
{"mul", T_OBJECT_EX, offsetof(Mirror, mul), 0, "Mul factor."},
1345
{"add", T_OBJECT_EX, offsetof(Mirror, add), 0, "Add factor."},
1346
{NULL} /* Sentinel */
1349
static PyMethodDef Mirror_methods[] = {
1350
{"getServer", (PyCFunction)Mirror_getServer, METH_NOARGS, "Returns server object."},
1351
{"_getStream", (PyCFunction)Mirror_getStream, METH_NOARGS, "Returns stream object."},
1352
{"deleteStream", (PyCFunction)Mirror_deleteStream, METH_NOARGS, "Remove stream from server and delete the object."},
1353
{"play", (PyCFunction)Mirror_play, METH_VARARGS|METH_KEYWORDS, "Starts computing without sending sound to soundcard."},
1354
{"out", (PyCFunction)Mirror_out, METH_VARARGS|METH_KEYWORDS, "Starts computing and sends sound to soundcard channel speficied by argument."},
1355
{"stop", (PyCFunction)Mirror_stop, METH_NOARGS, "Stops computing."},
1356
{"setMin", (PyCFunction)Mirror_setMin, METH_O, "Sets the minimum value."},
1357
{"setMax", (PyCFunction)Mirror_setMax, METH_O, "Sets the maximum value."},
1358
{"setMul", (PyCFunction)Mirror_setMul, METH_O, "Sets oscillator mul factor."},
1359
{"setAdd", (PyCFunction)Mirror_setAdd, METH_O, "Sets oscillator add factor."},
1360
{"setSub", (PyCFunction)Mirror_setSub, METH_O, "Sets inverse add factor."},
1361
{"setDiv", (PyCFunction)Mirror_setDiv, METH_O, "Sets inverse mul factor."},
1362
{NULL} /* Sentinel */
1365
static PyNumberMethods Mirror_as_number = {
1366
(binaryfunc)Mirror_add, /*nb_add*/
1367
(binaryfunc)Mirror_sub, /*nb_subtract*/
1368
(binaryfunc)Mirror_multiply, /*nb_multiply*/
1369
(binaryfunc)Mirror_div, /*nb_divide*/
1375
0, /*(unaryfunc)array_abs,*/
1389
(binaryfunc)Mirror_inplace_add, /*inplace_add*/
1390
(binaryfunc)Mirror_inplace_sub, /*inplace_subtract*/
1391
(binaryfunc)Mirror_inplace_multiply, /*inplace_multiply*/
1392
(binaryfunc)Mirror_inplace_div, /*inplace_divide*/
1393
0, /*inplace_remainder*/
1394
0, /*inplace_power*/
1395
0, /*inplace_lshift*/
1396
0, /*inplace_rshift*/
1400
0, /*nb_floor_divide*/
1401
0, /*nb_true_divide*/
1402
0, /*nb_inplace_floor_divide*/
1403
0, /*nb_inplace_true_divide*/
1407
PyTypeObject MirrorType = {
1408
PyObject_HEAD_INIT(NULL)
1410
"_pyo.Mirror_base", /*tp_name*/
1411
sizeof(Mirror), /*tp_basicsize*/
1413
(destructor)Mirror_dealloc, /*tp_dealloc*/
1419
&Mirror_as_number, /*tp_as_number*/
1420
0, /*tp_as_sequence*/
1421
0, /*tp_as_mapping*/
1428
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_CHECKTYPES, /*tp_flags*/
1429
"Mirror objects. Reflects the signal that exceeds the min and max thresholds.", /* tp_doc */
1430
(traverseproc)Mirror_traverse, /* tp_traverse */
1431
(inquiry)Mirror_clear, /* tp_clear */
1432
0, /* tp_richcompare */
1433
0, /* tp_weaklistoffset */
1435
0, /* tp_iternext */
1436
Mirror_methods, /* tp_methods */
1437
Mirror_members, /* tp_members */
1441
0, /* tp_descr_get */
1442
0, /* tp_descr_set */
1443
0, /* tp_dictoffset */
1444
(initproc)Mirror_init, /* tp_init */
1446
Mirror_new, /* tp_new */
1456
Stream *input_stream;
1465
Wrap_transform_ii(Wrap *self) {
1466
MYFLT val, avg, rng, tmp;
1468
MYFLT *in = Stream_getData((Stream *)self->input_stream);
1469
MYFLT mi = PyFloat_AS_DOUBLE(self->min);
1470
MYFLT ma = PyFloat_AS_DOUBLE(self->max);
1473
avg = (mi + ma) * 0.5;
1474
for (i=0; i<self->bufsize; i++) {
1475
self->data[i] = avg;
1480
for (i=0; i<self->bufsize; i++) {
1482
tmp = (val - mi) / rng;
1485
val = tmp * rng + mi;
1488
tmp += (int)(-tmp) + 1;
1489
val = tmp * rng + mi;
1491
self->data[i] = val;
1497
Wrap_transform_ai(Wrap *self) {
1498
MYFLT val, avg, rng, tmp, mi;
1500
MYFLT *in = Stream_getData((Stream *)self->input_stream);
1501
MYFLT *mini = Stream_getData((Stream *)self->min_stream);
1502
MYFLT ma = PyFloat_AS_DOUBLE(self->max);
1504
for (i=0; i<self->bufsize; i++) {
1508
avg = (mi + ma) * 0.5;
1509
self->data[i] = avg;
1513
tmp = (val - mi) / rng;
1516
val = tmp * rng + mi;
1519
tmp += (int)(-tmp) + 1;
1520
val = tmp * rng + mi;
1522
self->data[i] = val;
1528
Wrap_transform_ia(Wrap *self) {
1529
MYFLT val, avg, rng, tmp, ma;
1531
MYFLT *in = Stream_getData((Stream *)self->input_stream);
1532
MYFLT mi = PyFloat_AS_DOUBLE(self->min);
1533
MYFLT *maxi = Stream_getData((Stream *)self->max_stream);
1535
for (i=0; i<self->bufsize; i++) {
1539
avg = (mi + ma) * 0.5;
1540
self->data[i] = avg;
1544
tmp = (val - mi) / rng;
1547
val = tmp * rng + mi;
1550
tmp += (int)(-tmp) + 1;
1551
val = tmp * rng + mi;
1553
self->data[i] = val;
1559
Wrap_transform_aa(Wrap *self) {
1560
MYFLT val, avg, rng, tmp, mi, ma;
1562
MYFLT *in = Stream_getData((Stream *)self->input_stream);
1563
MYFLT *mini = Stream_getData((Stream *)self->min_stream);
1564
MYFLT *maxi = Stream_getData((Stream *)self->max_stream);
1566
for (i=0; i<self->bufsize; i++) {
1571
avg = (mi + ma) * 0.5;
1572
self->data[i] = avg;
1576
tmp = (val - mi) / rng;
1579
val = tmp * rng + mi;
1582
tmp += (int)(-tmp) + 1;
1583
val = tmp * rng + mi;
1585
self->data[i] = val;
1590
static void Wrap_postprocessing_ii(Wrap *self) { POST_PROCESSING_II };
1591
static void Wrap_postprocessing_ai(Wrap *self) { POST_PROCESSING_AI };
1592
static void Wrap_postprocessing_ia(Wrap *self) { POST_PROCESSING_IA };
1593
static void Wrap_postprocessing_aa(Wrap *self) { POST_PROCESSING_AA };
1594
static void Wrap_postprocessing_ireva(Wrap *self) { POST_PROCESSING_IREVA };
1595
static void Wrap_postprocessing_areva(Wrap *self) { POST_PROCESSING_AREVA };
1596
static void Wrap_postprocessing_revai(Wrap *self) { POST_PROCESSING_REVAI };
1597
static void Wrap_postprocessing_revaa(Wrap *self) { POST_PROCESSING_REVAA };
1598
static void Wrap_postprocessing_revareva(Wrap *self) { POST_PROCESSING_REVAREVA };
1601
Wrap_setProcMode(Wrap *self)
1603
int procmode, muladdmode;
1604
procmode = self->modebuffer[2] + self->modebuffer[3] * 10;
1605
muladdmode = self->modebuffer[0] + self->modebuffer[1] * 10;
1609
self->proc_func_ptr = Wrap_transform_ii;
1612
self->proc_func_ptr = Wrap_transform_ai;
1615
self->proc_func_ptr = Wrap_transform_ia;
1618
self->proc_func_ptr = Wrap_transform_aa;
1621
switch (muladdmode) {
1623
self->muladd_func_ptr = Wrap_postprocessing_ii;
1626
self->muladd_func_ptr = Wrap_postprocessing_ai;
1629
self->muladd_func_ptr = Wrap_postprocessing_revai;
1632
self->muladd_func_ptr = Wrap_postprocessing_ia;
1635
self->muladd_func_ptr = Wrap_postprocessing_aa;
1638
self->muladd_func_ptr = Wrap_postprocessing_revaa;
1641
self->muladd_func_ptr = Wrap_postprocessing_ireva;
1644
self->muladd_func_ptr = Wrap_postprocessing_areva;
1647
self->muladd_func_ptr = Wrap_postprocessing_revareva;
1653
Wrap_compute_next_data_frame(Wrap *self)
1655
(*self->proc_func_ptr)(self);
1656
(*self->muladd_func_ptr)(self);
1660
Wrap_traverse(Wrap *self, visitproc visit, void *arg)
1663
Py_VISIT(self->input);
1664
Py_VISIT(self->input_stream);
1665
Py_VISIT(self->min);
1666
Py_VISIT(self->min_stream);
1667
Py_VISIT(self->max);
1668
Py_VISIT(self->max_stream);
1673
Wrap_clear(Wrap *self)
1676
Py_CLEAR(self->input);
1677
Py_CLEAR(self->input_stream);
1678
Py_CLEAR(self->min);
1679
Py_CLEAR(self->min_stream);
1680
Py_CLEAR(self->max);
1681
Py_CLEAR(self->max_stream);
1686
Wrap_dealloc(Wrap* self)
1690
self->ob_type->tp_free((PyObject*)self);
1693
static PyObject * Wrap_deleteStream(Wrap *self) { DELETE_STREAM };
1696
Wrap_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
1700
self = (Wrap *)type->tp_alloc(type, 0);
1702
self->min = PyFloat_FromDouble(0.0);
1703
self->max = PyFloat_FromDouble(1.0);
1704
self->modebuffer[0] = 0;
1705
self->modebuffer[1] = 0;
1706
self->modebuffer[2] = 0;
1707
self->modebuffer[3] = 0;
1710
Stream_setFunctionPtr(self->stream, Wrap_compute_next_data_frame);
1711
self->mode_func_ptr = Wrap_setProcMode;
1713
return (PyObject *)self;
1717
Wrap_init(Wrap *self, PyObject *args, PyObject *kwds)
1719
PyObject *inputtmp, *input_streamtmp, *mintmp=NULL, *maxtmp=NULL, *multmp=NULL, *addtmp=NULL;
1721
static char *kwlist[] = {"input", "min", "max", "mul", "add", NULL};
1723
if (! PyArg_ParseTupleAndKeywords(args, kwds, "O|OOOO", kwlist, &inputtmp, &mintmp, &maxtmp, &multmp, &addtmp))
1729
PyObject_CallMethod((PyObject *)self, "setMin", "O", mintmp);
1733
PyObject_CallMethod((PyObject *)self, "setMax", "O", maxtmp);
1737
PyObject_CallMethod((PyObject *)self, "setMul", "O", multmp);
1741
PyObject_CallMethod((PyObject *)self, "setAdd", "O", addtmp);
1744
Py_INCREF(self->stream);
1745
PyObject_CallMethod(self->server, "addStream", "O", self->stream);
1747
(*self->mode_func_ptr)(self);
1753
static PyObject * Wrap_getServer(Wrap* self) { GET_SERVER };
1754
static PyObject * Wrap_getStream(Wrap* self) { GET_STREAM };
1755
static PyObject * Wrap_setMul(Wrap *self, PyObject *arg) { SET_MUL };
1756
static PyObject * Wrap_setAdd(Wrap *self, PyObject *arg) { SET_ADD };
1757
static PyObject * Wrap_setSub(Wrap *self, PyObject *arg) { SET_SUB };
1758
static PyObject * Wrap_setDiv(Wrap *self, PyObject *arg) { SET_DIV };
1760
static PyObject * Wrap_play(Wrap *self, PyObject *args, PyObject *kwds) { PLAY };
1761
static PyObject * Wrap_out(Wrap *self, PyObject *args, PyObject *kwds) { OUT };
1762
static PyObject * Wrap_stop(Wrap *self) { STOP };
1764
static PyObject * Wrap_multiply(Wrap *self, PyObject *arg) { MULTIPLY };
1765
static PyObject * Wrap_inplace_multiply(Wrap *self, PyObject *arg) { INPLACE_MULTIPLY };
1766
static PyObject * Wrap_add(Wrap *self, PyObject *arg) { ADD };
1767
static PyObject * Wrap_inplace_add(Wrap *self, PyObject *arg) { INPLACE_ADD };
1768
static PyObject * Wrap_sub(Wrap *self, PyObject *arg) { SUB };
1769
static PyObject * Wrap_inplace_sub(Wrap *self, PyObject *arg) { INPLACE_SUB };
1770
static PyObject * Wrap_div(Wrap *self, PyObject *arg) { DIV };
1771
static PyObject * Wrap_inplace_div(Wrap *self, PyObject *arg) { INPLACE_DIV };
1774
Wrap_setMin(Wrap *self, PyObject *arg)
1776
PyObject *tmp, *streamtmp;
1783
int isNumber = PyNumber_Check(arg);
1787
Py_DECREF(self->min);
1788
if (isNumber == 1) {
1789
self->min = PyNumber_Float(tmp);
1790
self->modebuffer[2] = 0;
1794
streamtmp = PyObject_CallMethod((PyObject *)self->min, "_getStream", NULL);
1795
Py_INCREF(streamtmp);
1796
Py_XDECREF(self->min_stream);
1797
self->min_stream = (Stream *)streamtmp;
1798
self->modebuffer[2] = 1;
1801
(*self->mode_func_ptr)(self);
1808
Wrap_setMax(Wrap *self, PyObject *arg)
1810
PyObject *tmp, *streamtmp;
1817
int isNumber = PyNumber_Check(arg);
1821
Py_DECREF(self->max);
1822
if (isNumber == 1) {
1823
self->max = PyNumber_Float(tmp);
1824
self->modebuffer[3] = 0;
1828
streamtmp = PyObject_CallMethod((PyObject *)self->max, "_getStream", NULL);
1829
Py_INCREF(streamtmp);
1830
Py_XDECREF(self->max_stream);
1831
self->max_stream = (Stream *)streamtmp;
1832
self->modebuffer[3] = 1;
1835
(*self->mode_func_ptr)(self);
1841
static PyMemberDef Wrap_members[] = {
1842
{"server", T_OBJECT_EX, offsetof(Wrap, server), 0, "Pyo server."},
1843
{"stream", T_OBJECT_EX, offsetof(Wrap, stream), 0, "Stream object."},
1844
{"input", T_OBJECT_EX, offsetof(Wrap, input), 0, "Input sound object."},
1845
{"min", T_OBJECT_EX, offsetof(Wrap, min), 0, "Minimum possible value."},
1846
{"max", T_OBJECT_EX, offsetof(Wrap, max), 0, "Maximum possible value."},
1847
{"mul", T_OBJECT_EX, offsetof(Wrap, mul), 0, "Mul factor."},
1848
{"add", T_OBJECT_EX, offsetof(Wrap, add), 0, "Add factor."},
1849
{NULL} /* Sentinel */
1852
static PyMethodDef Wrap_methods[] = {
1853
{"getServer", (PyCFunction)Wrap_getServer, METH_NOARGS, "Returns server object."},
1854
{"_getStream", (PyCFunction)Wrap_getStream, METH_NOARGS, "Returns stream object."},
1855
{"deleteStream", (PyCFunction)Wrap_deleteStream, METH_NOARGS, "Remove stream from server and delete the object."},
1856
{"play", (PyCFunction)Wrap_play, METH_VARARGS|METH_KEYWORDS, "Starts computing without sending sound to soundcard."},
1857
{"out", (PyCFunction)Wrap_out, METH_VARARGS|METH_KEYWORDS, "Starts computing and sends sound to soundcard channel speficied by argument."},
1858
{"stop", (PyCFunction)Wrap_stop, METH_NOARGS, "Stops computing."},
1859
{"setMin", (PyCFunction)Wrap_setMin, METH_O, "Sets the minimum value."},
1860
{"setMax", (PyCFunction)Wrap_setMax, METH_O, "Sets the maximum value."},
1861
{"setMul", (PyCFunction)Wrap_setMul, METH_O, "Sets oscillator mul factor."},
1862
{"setAdd", (PyCFunction)Wrap_setAdd, METH_O, "Sets oscillator add factor."},
1863
{"setSub", (PyCFunction)Wrap_setSub, METH_O, "Sets inverse add factor."},
1864
{"setDiv", (PyCFunction)Wrap_setDiv, METH_O, "Sets inverse mul factor."},
1865
{NULL} /* Sentinel */
1868
static PyNumberMethods Wrap_as_number = {
1869
(binaryfunc)Wrap_add, /*nb_add*/
1870
(binaryfunc)Wrap_sub, /*nb_subtract*/
1871
(binaryfunc)Wrap_multiply, /*nb_multiply*/
1872
(binaryfunc)Wrap_div, /*nb_divide*/
1878
0, /*(unaryfunc)array_abs,*/
1892
(binaryfunc)Wrap_inplace_add, /*inplace_add*/
1893
(binaryfunc)Wrap_inplace_sub, /*inplace_subtract*/
1894
(binaryfunc)Wrap_inplace_multiply, /*inplace_multiply*/
1895
(binaryfunc)Wrap_inplace_div, /*inplace_divide*/
1896
0, /*inplace_remainder*/
1897
0, /*inplace_power*/
1898
0, /*inplace_lshift*/
1899
0, /*inplace_rshift*/
1903
0, /*nb_floor_divide*/
1904
0, /*nb_true_divide*/
1905
0, /*nb_inplace_floor_divide*/
1906
0, /*nb_inplace_true_divide*/
1910
PyTypeObject WrapType = {
1911
PyObject_HEAD_INIT(NULL)
1913
"_pyo.Wrap_base", /*tp_name*/
1914
sizeof(Wrap), /*tp_basicsize*/
1916
(destructor)Wrap_dealloc, /*tp_dealloc*/
1922
&Wrap_as_number, /*tp_as_number*/
1923
0, /*tp_as_sequence*/
1924
0, /*tp_as_mapping*/
1931
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_CHECKTYPES, /*tp_flags*/
1932
"Wrap objects. Wraps-around the signal that exceeds the min and max thresholds.", /* tp_doc */
1933
(traverseproc)Wrap_traverse, /* tp_traverse */
1934
(inquiry)Wrap_clear, /* tp_clear */
1935
0, /* tp_richcompare */
1936
0, /* tp_weaklistoffset */
1938
0, /* tp_iternext */
1939
Wrap_methods, /* tp_methods */
1940
Wrap_members, /* tp_members */
1944
0, /* tp_descr_get */
1945
0, /* tp_descr_set */
1946
0, /* tp_dictoffset */
1947
(initproc)Wrap_init, /* tp_init */
1949
Wrap_new, /* tp_new */
1953
/** Degrade object **/
1959
Stream *input_stream;
1961
Stream *bitdepth_stream;
1963
Stream *srscale_stream;
1970
_bit_clip(MYFLT x) {
1981
// half sr ten times
1982
if (x <= 0.0009765625)
1983
return 0.0009765625;
1991
Degrade_transform_ii(Degrade *self) {
1992
MYFLT bitscl, ibitscl, newsr;
1995
MYFLT *in = Stream_getData((Stream *)self->input_stream);
1996
MYFLT bitdepth = _bit_clip(PyFloat_AS_DOUBLE(self->bitdepth));
1997
MYFLT srscale = _sr_clip(PyFloat_AS_DOUBLE(self->srscale));
1999
bitscl = MYPOW(2.0, bitdepth-1);
2000
ibitscl = 1.0 / bitscl;
2002
newsr = self->sr * srscale;
2003
nsamps = (int)(self->sr / newsr);
2005
for (i=0; i<self->bufsize; i++) {
2007
if (self->sampsCount >= nsamps) {
2008
self->sampsCount = 0;
2009
tmp = (int)(in[i] * bitscl + 0.5);
2010
self->value = tmp * ibitscl;
2012
self->data[i] = self->value;
2017
Degrade_transform_ai(Degrade *self) {
2018
MYFLT bitscl, ibitscl, newsr;
2021
MYFLT *in = Stream_getData((Stream *)self->input_stream);
2022
MYFLT *bitdepth = Stream_getData((Stream *)self->bitdepth_stream);
2023
MYFLT srscale = _sr_clip(PyFloat_AS_DOUBLE(self->srscale));
2025
newsr = self->sr * srscale;
2026
nsamps = (int)(self->sr / newsr);
2028
for (i=0; i<self->bufsize; i++) {
2030
if (self->sampsCount >= nsamps) {
2031
self->sampsCount = 0;
2032
bitscl = MYPOW(2.0, _bit_clip(bitdepth[i])-1);
2033
ibitscl = 1.0 / bitscl;
2034
tmp = (int)(in[i] * bitscl + 0.5);
2035
self->value = tmp * ibitscl;
2037
self->data[i] = self->value;
2042
Degrade_transform_ia(Degrade *self) {
2043
MYFLT bitscl, ibitscl, newsr;
2046
MYFLT *in = Stream_getData((Stream *)self->input_stream);
2047
MYFLT bitdepth = _bit_clip(PyFloat_AS_DOUBLE(self->bitdepth));
2048
MYFLT *srscale = Stream_getData((Stream *)self->srscale_stream);
2050
bitscl = MYPOW(2.0, bitdepth-1);
2051
ibitscl = 1.0 / bitscl;
2053
for (i=0; i<self->bufsize; i++) {
2054
newsr = self->sr * _sr_clip(srscale[i]);
2055
nsamps = (int)(self->sr / newsr);
2057
if (self->sampsCount >= nsamps) {
2058
self->sampsCount = 0;
2059
tmp = (int)(in[i] * bitscl + 0.5);
2060
self->value = tmp * ibitscl;
2062
self->data[i] = self->value;
2067
Degrade_transform_aa(Degrade *self) {
2068
MYFLT bitscl, ibitscl, newsr;
2071
MYFLT *in = Stream_getData((Stream *)self->input_stream);
2072
MYFLT *bitdepth = Stream_getData((Stream *)self->bitdepth_stream);
2073
MYFLT *srscale = Stream_getData((Stream *)self->srscale_stream);
2075
for (i=0; i<self->bufsize; i++) {
2076
newsr = self->sr * _sr_clip(srscale[i]);
2077
nsamps = (int)(self->sr / newsr);
2079
if (self->sampsCount >= nsamps) {
2080
self->sampsCount = 0;
2081
bitscl = MYPOW(2.0, _bit_clip(bitdepth[i])-1);
2082
ibitscl = 1.0 / bitscl;
2083
tmp = (int)(in[i] * bitscl + 0.5);
2084
self->value = tmp * ibitscl;
2086
self->data[i] = self->value;
2090
static void Degrade_postprocessing_ii(Degrade *self) { POST_PROCESSING_II };
2091
static void Degrade_postprocessing_ai(Degrade *self) { POST_PROCESSING_AI };
2092
static void Degrade_postprocessing_ia(Degrade *self) { POST_PROCESSING_IA };
2093
static void Degrade_postprocessing_aa(Degrade *self) { POST_PROCESSING_AA };
2094
static void Degrade_postprocessing_ireva(Degrade *self) { POST_PROCESSING_IREVA };
2095
static void Degrade_postprocessing_areva(Degrade *self) { POST_PROCESSING_AREVA };
2096
static void Degrade_postprocessing_revai(Degrade *self) { POST_PROCESSING_REVAI };
2097
static void Degrade_postprocessing_revaa(Degrade *self) { POST_PROCESSING_REVAA };
2098
static void Degrade_postprocessing_revareva(Degrade *self) { POST_PROCESSING_REVAREVA };
2101
Degrade_setProcMode(Degrade *self)
2103
int procmode, muladdmode;
2104
procmode = self->modebuffer[2] + self->modebuffer[3] * 10;
2105
muladdmode = self->modebuffer[0] + self->modebuffer[1] * 10;
2109
self->proc_func_ptr = Degrade_transform_ii;
2112
self->proc_func_ptr = Degrade_transform_ai;
2115
self->proc_func_ptr = Degrade_transform_ia;
2118
self->proc_func_ptr = Degrade_transform_aa;
2121
switch (muladdmode) {
2123
self->muladd_func_ptr = Degrade_postprocessing_ii;
2126
self->muladd_func_ptr = Degrade_postprocessing_ai;
2129
self->muladd_func_ptr = Degrade_postprocessing_revai;
2132
self->muladd_func_ptr = Degrade_postprocessing_ia;
2135
self->muladd_func_ptr = Degrade_postprocessing_aa;
2138
self->muladd_func_ptr = Degrade_postprocessing_revaa;
2141
self->muladd_func_ptr = Degrade_postprocessing_ireva;
2144
self->muladd_func_ptr = Degrade_postprocessing_areva;
2147
self->muladd_func_ptr = Degrade_postprocessing_revareva;
2153
Degrade_compute_next_data_frame(Degrade *self)
2155
(*self->proc_func_ptr)(self);
2156
(*self->muladd_func_ptr)(self);
2160
Degrade_traverse(Degrade *self, visitproc visit, void *arg)
2163
Py_VISIT(self->input);
2164
Py_VISIT(self->input_stream);
2165
Py_VISIT(self->bitdepth);
2166
Py_VISIT(self->bitdepth_stream);
2167
Py_VISIT(self->srscale);
2168
Py_VISIT(self->srscale_stream);
2173
Degrade_clear(Degrade *self)
2176
Py_CLEAR(self->input);
2177
Py_CLEAR(self->input_stream);
2178
Py_CLEAR(self->bitdepth);
2179
Py_CLEAR(self->bitdepth_stream);
2180
Py_CLEAR(self->srscale);
2181
Py_CLEAR(self->srscale_stream);
2186
Degrade_dealloc(Degrade* self)
2189
Degrade_clear(self);
2190
self->ob_type->tp_free((PyObject*)self);
2193
static PyObject * Degrade_deleteStream(Degrade *self) { DELETE_STREAM };
2196
Degrade_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
2200
self = (Degrade *)type->tp_alloc(type, 0);
2202
self->bitdepth = PyFloat_FromDouble(16);
2203
self->srscale = PyFloat_FromDouble(1.0);
2205
self->sampsCount = 0;
2206
self->modebuffer[0] = 0;
2207
self->modebuffer[1] = 0;
2208
self->modebuffer[2] = 0;
2209
self->modebuffer[3] = 0;
2212
Stream_setFunctionPtr(self->stream, Degrade_compute_next_data_frame);
2213
self->mode_func_ptr = Degrade_setProcMode;
2215
return (PyObject *)self;
2219
Degrade_init(Degrade *self, PyObject *args, PyObject *kwds)
2221
PyObject *inputtmp, *input_streamtmp, *bitdepthtmp=NULL, *srscaletmp=NULL, *multmp=NULL, *addtmp=NULL;
2223
static char *kwlist[] = {"input", "bitdepth", "srscale", "mul", "add", NULL};
2225
if (! PyArg_ParseTupleAndKeywords(args, kwds, "O|OOOO", kwlist, &inputtmp, &bitdepthtmp, &srscaletmp, &multmp, &addtmp))
2231
PyObject_CallMethod((PyObject *)self, "setBitdepth", "O", bitdepthtmp);
2235
PyObject_CallMethod((PyObject *)self, "setSrscale", "O", srscaletmp);
2239
PyObject_CallMethod((PyObject *)self, "setMul", "O", multmp);
2243
PyObject_CallMethod((PyObject *)self, "setAdd", "O", addtmp);
2246
Py_INCREF(self->stream);
2247
PyObject_CallMethod(self->server, "addStream", "O", self->stream);
2249
(*self->mode_func_ptr)(self);
2255
static PyObject * Degrade_getServer(Degrade* self) { GET_SERVER };
2256
static PyObject * Degrade_getStream(Degrade* self) { GET_STREAM };
2257
static PyObject * Degrade_setMul(Degrade *self, PyObject *arg) { SET_MUL };
2258
static PyObject * Degrade_setAdd(Degrade *self, PyObject *arg) { SET_ADD };
2259
static PyObject * Degrade_setSub(Degrade *self, PyObject *arg) { SET_SUB };
2260
static PyObject * Degrade_setDiv(Degrade *self, PyObject *arg) { SET_DIV };
2262
static PyObject * Degrade_play(Degrade *self, PyObject *args, PyObject *kwds) { PLAY };
2263
static PyObject * Degrade_out(Degrade *self, PyObject *args, PyObject *kwds) { OUT };
2264
static PyObject * Degrade_stop(Degrade *self) { STOP };
2266
static PyObject * Degrade_multiply(Degrade *self, PyObject *arg) { MULTIPLY };
2267
static PyObject * Degrade_inplace_multiply(Degrade *self, PyObject *arg) { INPLACE_MULTIPLY };
2268
static PyObject * Degrade_add(Degrade *self, PyObject *arg) { ADD };
2269
static PyObject * Degrade_inplace_add(Degrade *self, PyObject *arg) { INPLACE_ADD };
2270
static PyObject * Degrade_sub(Degrade *self, PyObject *arg) { SUB };
2271
static PyObject * Degrade_inplace_sub(Degrade *self, PyObject *arg) { INPLACE_SUB };
2272
static PyObject * Degrade_div(Degrade *self, PyObject *arg) { DIV };
2273
static PyObject * Degrade_inplace_div(Degrade *self, PyObject *arg) { INPLACE_DIV };
2276
Degrade_setBitdepth(Degrade *self, PyObject *arg)
2278
PyObject *tmp, *streamtmp;
2285
int isNumber = PyNumber_Check(arg);
2289
Py_DECREF(self->bitdepth);
2290
if (isNumber == 1) {
2291
self->bitdepth = PyNumber_Float(tmp);
2292
self->modebuffer[2] = 0;
2295
self->bitdepth = tmp;
2296
streamtmp = PyObject_CallMethod((PyObject *)self->bitdepth, "_getStream", NULL);
2297
Py_INCREF(streamtmp);
2298
Py_XDECREF(self->bitdepth_stream);
2299
self->bitdepth_stream = (Stream *)streamtmp;
2300
self->modebuffer[2] = 1;
2303
(*self->mode_func_ptr)(self);
2310
Degrade_setSrscale(Degrade *self, PyObject *arg)
2312
PyObject *tmp, *streamtmp;
2319
int isNumber = PyNumber_Check(arg);
2323
Py_DECREF(self->srscale);
2324
if (isNumber == 1) {
2325
self->srscale = PyNumber_Float(tmp);
2326
self->modebuffer[3] = 0;
2329
self->srscale = tmp;
2330
streamtmp = PyObject_CallMethod((PyObject *)self->srscale, "_getStream", NULL);
2331
Py_INCREF(streamtmp);
2332
Py_XDECREF(self->srscale_stream);
2333
self->srscale_stream = (Stream *)streamtmp;
2334
self->modebuffer[3] = 1;
2337
(*self->mode_func_ptr)(self);
2343
static PyMemberDef Degrade_members[] = {
2344
{"server", T_OBJECT_EX, offsetof(Degrade, server), 0, "Pyo server."},
2345
{"stream", T_OBJECT_EX, offsetof(Degrade, stream), 0, "Stream object."},
2346
{"input", T_OBJECT_EX, offsetof(Degrade, input), 0, "Input sound object."},
2347
{"bitdepth", T_OBJECT_EX, offsetof(Degrade, bitdepth), 0, "Number of bits for amplitude values."},
2348
{"srscale", T_OBJECT_EX, offsetof(Degrade, srscale), 0, "Sampling depth factor."},
2349
{"mul", T_OBJECT_EX, offsetof(Degrade, mul), 0, "Mul factor."},
2350
{"add", T_OBJECT_EX, offsetof(Degrade, add), 0, "Add factor."},
2351
{NULL} /* Sentinel */
2354
static PyMethodDef Degrade_methods[] = {
2355
{"getServer", (PyCFunction)Degrade_getServer, METH_NOARGS, "Returns server object."},
2356
{"_getStream", (PyCFunction)Degrade_getStream, METH_NOARGS, "Returns stream object."},
2357
{"deleteStream", (PyCFunction)Degrade_deleteStream, METH_NOARGS, "Remove stream from server and delete the object."},
2358
{"play", (PyCFunction)Degrade_play, METH_VARARGS|METH_KEYWORDS, "Starts computing without sending sound to soundcard."},
2359
{"out", (PyCFunction)Degrade_out, METH_VARARGS|METH_KEYWORDS, "Starts computing and sends sound to soundcard channel speficied by argument."},
2360
{"stop", (PyCFunction)Degrade_stop, METH_NOARGS, "Stops computing."},
2361
{"setBitdepth", (PyCFunction)Degrade_setBitdepth, METH_O, "Sets the bitdepth value."},
2362
{"setSrscale", (PyCFunction)Degrade_setSrscale, METH_O, "Sets the srscale value."},
2363
{"setMul", (PyCFunction)Degrade_setMul, METH_O, "Sets oscillator mul factor."},
2364
{"setAdd", (PyCFunction)Degrade_setAdd, METH_O, "Sets oscillator add factor."},
2365
{"setSub", (PyCFunction)Degrade_setSub, METH_O, "Sets inverse add factor."},
2366
{"setDiv", (PyCFunction)Degrade_setDiv, METH_O, "Sets inverse mul factor."},
2367
{NULL} /* Sentinel */
2370
static PyNumberMethods Degrade_as_number = {
2371
(binaryfunc)Degrade_add, /*nb_add*/
2372
(binaryfunc)Degrade_sub, /*nb_subtract*/
2373
(binaryfunc)Degrade_multiply, /*nb_multiply*/
2374
(binaryfunc)Degrade_div, /*nb_divide*/
2380
0, /*(unaryfunc)array_abs,*/
2394
(binaryfunc)Degrade_inplace_add, /*inplace_add*/
2395
(binaryfunc)Degrade_inplace_sub, /*inplace_subtract*/
2396
(binaryfunc)Degrade_inplace_multiply, /*inplace_multiply*/
2397
(binaryfunc)Degrade_inplace_div, /*inplace_divide*/
2398
0, /*inplace_remainder*/
2399
0, /*inplace_power*/
2400
0, /*inplace_lshift*/
2401
0, /*inplace_rshift*/
2405
0, /*nb_floor_divide*/
2406
0, /*nb_true_divide*/
2407
0, /*nb_inplace_floor_divide*/
2408
0, /*nb_inplace_true_divide*/
2412
PyTypeObject DegradeType = {
2413
PyObject_HEAD_INIT(NULL)
2415
"_pyo.Degrade_base", /*tp_name*/
2416
sizeof(Degrade), /*tp_basicsize*/
2418
(destructor)Degrade_dealloc, /*tp_dealloc*/
2424
&Degrade_as_number, /*tp_as_number*/
2425
0, /*tp_as_sequence*/
2426
0, /*tp_as_mapping*/
2433
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_CHECKTYPES, /*tp_flags*/
2434
"Degrade objects. Applies different bitdepth and sr on a signal.", /* tp_doc */
2435
(traverseproc)Degrade_traverse, /* tp_traverse */
2436
(inquiry)Degrade_clear, /* tp_clear */
2437
0, /* tp_richcompare */
2438
0, /* tp_weaklistoffset */
2440
0, /* tp_iternext */
2441
Degrade_methods, /* tp_methods */
2442
Degrade_members, /* tp_members */
2446
0, /* tp_descr_get */
2447
0, /* tp_descr_set */
2448
0, /* tp_dictoffset */
2449
(initproc)Degrade_init, /* tp_init */
2451
Degrade_new, /* tp_new */