| 1 |
/************************************************************************** |
| 2 |
* Copyright 2009-2015 Olivier Belanger * |
| 3 |
* * |
| 4 |
* This file is part of pyo, a python module to help digital signal * |
| 5 |
* processing script creation. * |
| 6 |
* * |
| 7 |
* pyo is free software: you can redistribute it and/or modify * |
| 8 |
* it under the terms of the GNU Lesser General Public License as * |
| 9 |
* published by the Free Software Foundation, either version 3 of the * |
| 10 |
* License, or (at your option) any later version. * |
| 11 |
* * |
| 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 Lesser General Public License for more details. * |
| 16 |
* * |
| 17 |
* You should have received a copy of the GNU Lesser General Public * |
| 18 |
* License along with pyo. If not, see <http://www.gnu.org/licenses/>. * |
| 19 |
*************************************************************************/ |
| 20 |
|
| 21 |
#include <Python.h> |
| 22 |
#include "structmember.h" |
| 23 |
#include "pyomodule.h" |
| 24 |
#include "streammodule.h" |
| 25 |
#include "servermodule.h" |
| 26 |
#include "dummymodule.h" |
| 27 |
|
| 28 |
typedef struct |
| 29 |
{ |
| 30 |
pyo_audio_HEAD |
| 31 |
int modebuffer[2]; |
| 32 |
int seed; |
| 33 |
int type; |
| 34 |
} Noise; |
| 35 |
|
| 36 |
static void |
| 37 |
Noise_generate(Noise *self) |
| 38 |
{ |
| 39 |
int i; |
| 40 |
|
| 41 |
for (i = 0; i < self->bufsize; i++) |
| 42 |
{ |
| 43 |
self->data[i] = RANDOM_UNIFORM * 1.98 - 0.99; |
| 44 |
} |
| 45 |
} |
| 46 |
|
| 47 |
static void |
| 48 |
Noise_generate_cheap(Noise *self) |
| 49 |
{ |
| 50 |
int i; |
| 51 |
|
| 52 |
for (i = 0; i < self->bufsize; i++) |
| 53 |
{ |
| 54 |
self->seed = (self->seed * 15625 + 1) & 0xFFFF; |
| 55 |
self->data[i] = (self->seed - 0x8000) * 3.0517578125e-05; |
| 56 |
} |
| 57 |
} |
| 58 |
|
| 59 |
static void Noise_postprocessing_ii(Noise *self) { POST_PROCESSING_II }; |
| 60 |
static void Noise_postprocessing_ai(Noise *self) { POST_PROCESSING_AI }; |
| 61 |
static void Noise_postprocessing_ia(Noise *self) { POST_PROCESSING_IA }; |
| 62 |
static void Noise_postprocessing_aa(Noise *self) { POST_PROCESSING_AA }; |
| 63 |
static void Noise_postprocessing_ireva(Noise *self) { POST_PROCESSING_IREVA }; |
| 64 |
static void Noise_postprocessing_areva(Noise *self) { POST_PROCESSING_AREVA }; |
| 65 |
static void Noise_postprocessing_revai(Noise *self) { POST_PROCESSING_REVAI }; |
| 66 |
static void Noise_postprocessing_revaa(Noise *self) { POST_PROCESSING_REVAA }; |
| 67 |
static void Noise_postprocessing_revareva(Noise *self) { POST_PROCESSING_REVAREVA }; |
| 68 |
|
| 69 |
static void |
| 70 |
Noise_setProcMode(Noise *self) |
| 71 |
{ |
| 72 |
int muladdmode; |
| 73 |
muladdmode = self->modebuffer[0] + self->modebuffer[1] * 10; |
| 74 |
|
| 75 |
switch (self->type) |
| 76 |
{ |
| 77 |
case 0: |
| 78 |
self->proc_func_ptr = Noise_generate; |
| 79 |
break; |
| 80 |
|
| 81 |
case 1: |
| 82 |
self->proc_func_ptr = Noise_generate_cheap; |
| 83 |
break; |
| 84 |
} |
| 85 |
|
| 86 |
switch (muladdmode) |
| 87 |
{ |
| 88 |
case 0: |
| 89 |
self->muladd_func_ptr = Noise_postprocessing_ii; |
| 90 |
break; |
| 91 |
|
| 92 |
case 1: |
| 93 |
self->muladd_func_ptr = Noise_postprocessing_ai; |
| 94 |
break; |
| 95 |
|
| 96 |
case 2: |
| 97 |
self->muladd_func_ptr = Noise_postprocessing_revai; |
| 98 |
break; |
| 99 |
|
| 100 |
case 10: |
| 101 |
self->muladd_func_ptr = Noise_postprocessing_ia; |
| 102 |
break; |
| 103 |
|
| 104 |
case 11: |
| 105 |
self->muladd_func_ptr = Noise_postprocessing_aa; |
| 106 |
break; |
| 107 |
|
| 108 |
case 12: |
| 109 |
self->muladd_func_ptr = Noise_postprocessing_revaa; |
| 110 |
break; |
| 111 |
|
| 112 |
case 20: |
| 113 |
self->muladd_func_ptr = Noise_postprocessing_ireva; |
| 114 |
break; |
| 115 |
|
| 116 |
case 21: |
| 117 |
self->muladd_func_ptr = Noise_postprocessing_areva; |
| 118 |
break; |
| 119 |
|
| 120 |
case 22: |
| 121 |
self->muladd_func_ptr = Noise_postprocessing_revareva; |
| 122 |
break; |
| 123 |
} |
| 124 |
} |
| 125 |
|
| 126 |
static void |
| 127 |
Noise_compute_next_data_frame(Noise *self) |
| 128 |
{ |
| 129 |
(*self->proc_func_ptr)(self); |
| 130 |
(*self->muladd_func_ptr)(self); |
| 131 |
} |
| 132 |
|
| 133 |
static int |
| 134 |
Noise_traverse(Noise *self, visitproc visit, void *arg) |
| 135 |
{ |
| 136 |
pyo_VISIT |
| 137 |
return 0; |
| 138 |
} |
| 139 |
|
| 140 |
static int |
| 141 |
Noise_clear(Noise *self) |
| 142 |
{ |
| 143 |
pyo_CLEAR |
| 144 |
return 0; |
| 145 |
} |
| 146 |
|
| 147 |
static void |
| 148 |
Noise_dealloc(Noise* self) |
| 149 |
{ |
| 150 |
pyo_DEALLOC |
| 151 |
Noise_clear(self); |
| 152 |
Py_TYPE(self->stream)->tp_free((PyObject*)self->stream); |
| 153 |
Py_TYPE(self)->tp_free((PyObject*)self); |
| 154 |
} |
| 155 |
|
| 156 |
static PyObject * |
| 157 |
Noise_new(PyTypeObject *type, PyObject *args, PyObject *kwds) |
| 158 |
{ |
| 159 |
int i; |
| 160 |
PyObject *multmp = NULL, *addtmp = NULL; |
| 161 |
Noise *self; |
| 162 |
self = (Noise *)type->tp_alloc(type, 0); |
| 163 |
|
| 164 |
self->type = 0; |
| 165 |
self->modebuffer[0] = 0; |
| 166 |
self->modebuffer[1] = 0; |
| 167 |
|
| 168 |
INIT_OBJECT_COMMON |
| 169 |
Stream_setFunctionPtr(self->stream, Noise_compute_next_data_frame); |
| 170 |
self->mode_func_ptr = Noise_setProcMode; |
| 171 |
|
| 172 |
static char *kwlist[] = {"mul", "add", NULL}; |
| 173 |
|
| 174 |
if (! PyArg_ParseTupleAndKeywords(args, kwds, "|OO", kwlist, &multmp, &addtmp)) |
| 175 |
Py_RETURN_NONE; |
| 176 |
|
| 177 |
if (multmp) |
| 178 |
{ |
| 179 |
PyObject_CallMethod((PyObject *)self, "setMul", "O", multmp); |
| 180 |
} |
| 181 |
|
| 182 |
if (addtmp) |
| 183 |
{ |
| 184 |
PyObject_CallMethod((PyObject *)self, "setAdd", "O", addtmp); |
| 185 |
} |
| 186 |
|
| 187 |
PyObject_CallMethod(self->server, "addStream", "O", self->stream); |
| 188 |
|
| 189 |
Server_generateSeed((Server *)self->server, NOISE_ID); |
| 190 |
|
| 191 |
self->seed = pyorand(); |
| 192 |
|
| 193 |
(*self->mode_func_ptr)(self); |
| 194 |
|
| 195 |
return (PyObject *)self; |
| 196 |
} |
| 197 |
|
| 198 |
static PyObject * Noise_getServer(Noise* self) { GET_SERVER }; |
| 199 |
static PyObject * Noise_getStream(Noise* self) { GET_STREAM }; |
| 200 |
static PyObject * Noise_setMul(Noise *self, PyObject *arg) { SET_MUL }; |
| 201 |
static PyObject * Noise_setAdd(Noise *self, PyObject *arg) { SET_ADD }; |
| 202 |
static PyObject * Noise_setSub(Noise *self, PyObject *arg) { SET_SUB }; |
| 203 |
static PyObject * Noise_setDiv(Noise *self, PyObject *arg) { SET_DIV }; |
| 204 |
|
| 205 |
static PyObject * Noise_play(Noise *self, PyObject *args, PyObject *kwds) { PLAY }; |
| 206 |
static PyObject * Noise_out(Noise *self, PyObject *args, PyObject *kwds) { OUT }; |
| 207 |
static PyObject * Noise_stop(Noise *self, PyObject *args, PyObject *kwds) { STOP }; |
| 208 |
|
| 209 |
static PyObject * Noise_multiply(Noise *self, PyObject *arg) { MULTIPLY }; |
| 210 |
static PyObject * Noise_inplace_multiply(Noise *self, PyObject *arg) { INPLACE_MULTIPLY }; |
| 211 |
static PyObject * Noise_add(Noise *self, PyObject *arg) { ADD }; |
| 212 |
static PyObject * Noise_inplace_add(Noise *self, PyObject *arg) { INPLACE_ADD }; |
| 213 |
static PyObject * Noise_sub(Noise *self, PyObject *arg) { SUB }; |
| 214 |
static PyObject * Noise_inplace_sub(Noise *self, PyObject *arg) { INPLACE_SUB }; |
| 215 |
static PyObject * Noise_div(Noise *self, PyObject *arg) { DIV }; |
| 216 |
static PyObject * Noise_inplace_div(Noise *self, PyObject *arg) { INPLACE_DIV }; |
| 217 |
|
| 218 |
static PyObject * |
| 219 |
Noise_setType(Noise *self, PyObject *arg) |
| 220 |
{ |
| 221 |
ASSERT_ARG_NOT_NULL |
| 222 |
|
| 223 |
if (PyLong_AsLong(arg) == 0) |
| 224 |
self->type = 0; |
| 225 |
else if (PyLong_AsLong(arg) == 1) |
| 226 |
self->type = 1; |
| 227 |
|
| 228 |
(*self->mode_func_ptr)(self); |
| 229 |
|
| 230 |
Py_RETURN_NONE; |
| 231 |
} |
| 232 |
|
| 233 |
static PyMemberDef Noise_members[] = |
| 234 |
{ |
| 235 |
{"server", T_OBJECT_EX, offsetof(Noise, server), 0, "Pyo server."}, |
| 236 |
{"stream", T_OBJECT_EX, offsetof(Noise, stream), 0, "Stream object."}, |
| 237 |
{"mul", T_OBJECT_EX, offsetof(Noise, mul), 0, "Mul factor."}, |
| 238 |
{"add", T_OBJECT_EX, offsetof(Noise, add), 0, "Add factor."}, |
| 239 |
{NULL} /* Sentinel */ |
| 240 |
}; |
| 241 |
|
| 242 |
static PyMethodDef Noise_methods[] = |
| 243 |
{ |
| 244 |
{"getServer", (PyCFunction)Noise_getServer, METH_NOARGS, "Returns server object."}, |
| 245 |
{"_getStream", (PyCFunction)Noise_getStream, METH_NOARGS, "Returns stream object."}, |
| 246 |
{"play", (PyCFunction)Noise_play, METH_VARARGS | METH_KEYWORDS, "Starts computing without sending sound to soundcard."}, |
| 247 |
{"out", (PyCFunction)Noise_out, METH_VARARGS | METH_KEYWORDS, "Starts computing and sends sound to soundcard channel speficied by argument."}, |
| 248 |
{"stop", (PyCFunction)Noise_stop, METH_VARARGS | METH_KEYWORDS, "Stops computing."}, |
| 249 |
{"setType", (PyCFunction)Noise_setType, METH_O, "Sets Noise generation algorithm."}, |
| 250 |
{"setMul", (PyCFunction)Noise_setMul, METH_O, "Sets Noise mul factor."}, |
| 251 |
{"setAdd", (PyCFunction)Noise_setAdd, METH_O, "Sets Noise add factor."}, |
| 252 |
{"setSub", (PyCFunction)Noise_setSub, METH_O, "Sets inverse add factor."}, |
| 253 |
{"setDiv", (PyCFunction)Noise_setDiv, METH_O, "Sets inverse mul factor."}, |
| 254 |
{NULL} /* Sentinel */ |
| 255 |
}; |
| 256 |
|
| 257 |
static PyNumberMethods Noise_as_number = |
| 258 |
{ |
| 259 |
(binaryfunc)Noise_add, /*nb_add*/ |
| 260 |
(binaryfunc)Noise_sub, /*nb_subtract*/ |
| 261 |
(binaryfunc)Noise_multiply, /*nb_multiply*/ |
| 262 |
0, /*nb_remainder*/ |
| 263 |
0, /*nb_divmod*/ |
| 264 |
0, /*nb_power*/ |
| 265 |
0, /*nb_neg*/ |
| 266 |
0, /*nb_pos*/ |
| 267 |
0, /*(unaryfunc)array_abs,*/ |
| 268 |
0, /*nb_nonzero*/ |
| 269 |
0, /*nb_invert*/ |
| 270 |
0, /*nb_lshift*/ |
| 271 |
0, /*nb_rshift*/ |
| 272 |
0, /*nb_and*/ |
| 273 |
0, /*nb_xor*/ |
| 274 |
0, /*nb_or*/ |
| 275 |
0, /*nb_int*/ |
| 276 |
0, /*nb_long*/ |
| 277 |
0, /*nb_float*/ |
| 278 |
(binaryfunc)Noise_inplace_add, /*inplace_add*/ |
| 279 |
(binaryfunc)Noise_inplace_sub, /*inplace_subtract*/ |
| 280 |
(binaryfunc)Noise_inplace_multiply, /*inplace_multiply*/ |
| 281 |
0, /*inplace_remainder*/ |
| 282 |
0, /*inplace_power*/ |
| 283 |
0, /*inplace_lshift*/ |
| 284 |
0, /*inplace_rshift*/ |
| 285 |
0, /*inplace_and*/ |
| 286 |
0, /*inplace_xor*/ |
| 287 |
0, /*inplace_or*/ |
| 288 |
0, /*nb_floor_divide*/ |
| 289 |
(binaryfunc)Noise_div, /*nb_true_divide*/ |
| 290 |
0, /*nb_inplace_floor_divide*/ |
| 291 |
(binaryfunc)Noise_inplace_div, /*nb_inplace_true_divide*/ |
| 292 |
0, /* nb_index */ |
| 293 |
}; |
| 294 |
|
| 295 |
PyTypeObject NoiseType = |
| 296 |
{ |
| 297 |
PyVarObject_HEAD_INIT(NULL, 0) |
| 298 |
"_pyo.Noise_base", /*tp_name*/ |
| 299 |
sizeof(Noise), /*tp_basicsize*/ |
| 300 |
0, /*tp_itemsize*/ |
| 301 |
(destructor)Noise_dealloc, /*tp_dealloc*/ |
| 302 |
0, /*tp_print*/ |
| 303 |
0, /*tp_getattr*/ |
| 304 |
0, /*tp_setattr*/ |
| 305 |
0, /*tp_as_async (tp_compare in Python 2)*/ |
| 306 |
0, /*tp_repr*/ |
| 307 |
&Noise_as_number, /*tp_as_number*/ |
| 308 |
0, /*tp_as_sequence*/ |
| 309 |
0, /*tp_as_mapping*/ |
| 310 |
0, /*tp_hash */ |
| 311 |
0, /*tp_call*/ |
| 312 |
0, /*tp_str*/ |
| 313 |
0, /*tp_getattro*/ |
| 314 |
0, /*tp_setattro*/ |
| 315 |
0, /*tp_as_buffer*/ |
| 316 |
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /*tp_flags*/ |
| 317 |
"Noise objects. White noise generator.", /* tp_doc */ |
| 318 |
(traverseproc)Noise_traverse, /* tp_traverse */ |
| 319 |
(inquiry)Noise_clear, /* tp_clear */ |
| 320 |
0, /* tp_richcompare */ |
| 321 |
0, /* tp_weaklistoffset */ |
| 322 |
0, /* tp_iter */ |
| 323 |
0, /* tp_iternext */ |
| 324 |
Noise_methods, /* tp_methods */ |
| 325 |
Noise_members, /* tp_members */ |
| 326 |
0, /* tp_getset */ |
| 327 |
0, /* tp_base */ |
| 328 |
0, /* tp_dict */ |
| 329 |
0, /* tp_descr_get */ |
| 330 |
0, /* tp_descr_set */ |
| 331 |
0, /* tp_dictoffset */ |
| 332 |
0, /* tp_init */ |
| 333 |
0, /* tp_alloc */ |
| 334 |
Noise_new, /* tp_new */ |
| 335 |
}; |
| 336 |
|
| 337 |
typedef struct |
| 338 |
{ |
| 339 |
pyo_audio_HEAD |
| 340 |
int modebuffer[2]; |
| 341 |
MYFLT c0; |
| 342 |
MYFLT c1; |
| 343 |
MYFLT c2; |
| 344 |
MYFLT c3; |
| 345 |
MYFLT c4; |
| 346 |
MYFLT c5; |
| 347 |
MYFLT c6; |
| 348 |
} PinkNoise; |
| 349 |
|
| 350 |
static void |
| 351 |
PinkNoise_generate(PinkNoise *self) |
| 352 |
{ |
| 353 |
MYFLT in, val; |
| 354 |
int i; |
| 355 |
|
| 356 |
for (i = 0; i < self->bufsize; i++) |
| 357 |
{ |
| 358 |
in = RANDOM_UNIFORM * 1.98 - 0.99; |
| 359 |
self->c0 = self->c0 * 0.99886 + in * 0.0555179; |
| 360 |
self->c1 = self->c1 * 0.99332 + in * 0.0750759; |
| 361 |
self->c2 = self->c2 * 0.96900 + in * 0.1538520; |
| 362 |
self->c3 = self->c3 * 0.86650 + in * 0.3104856; |
| 363 |
self->c4 = self->c4 * 0.55000 + in * 0.5329522; |
| 364 |
self->c5 = self->c5 * -0.7616 - in * 0.0168980; |
| 365 |
val = self->c0 + self->c1 + self->c2 + self->c3 + self->c4 + self->c5 + self->c6 + in * 0.5362; |
| 366 |
self->data[i] = val * 0.2; |
| 367 |
self->c6 = in * 0.115926; |
| 368 |
} |
| 369 |
} |
| 370 |
|
| 371 |
static void PinkNoise_postprocessing_ii(PinkNoise *self) { POST_PROCESSING_II }; |
| 372 |
static void PinkNoise_postprocessing_ai(PinkNoise *self) { POST_PROCESSING_AI }; |
| 373 |
static void PinkNoise_postprocessing_ia(PinkNoise *self) { POST_PROCESSING_IA }; |
| 374 |
static void PinkNoise_postprocessing_aa(PinkNoise *self) { POST_PROCESSING_AA }; |
| 375 |
static void PinkNoise_postprocessing_ireva(PinkNoise *self) { POST_PROCESSING_IREVA }; |
| 376 |
static void PinkNoise_postprocessing_areva(PinkNoise *self) { POST_PROCESSING_AREVA }; |
| 377 |
static void PinkNoise_postprocessing_revai(PinkNoise *self) { POST_PROCESSING_REVAI }; |
| 378 |
static void PinkNoise_postprocessing_revaa(PinkNoise *self) { POST_PROCESSING_REVAA }; |
| 379 |
static void PinkNoise_postprocessing_revareva(PinkNoise *self) { POST_PROCESSING_REVAREVA }; |
| 380 |
|
| 381 |
static void |
| 382 |
PinkNoise_setProcMode(PinkNoise *self) |
| 383 |
{ |
| 384 |
int muladdmode; |
| 385 |
muladdmode = self->modebuffer[0] + self->modebuffer[1] * 10; |
| 386 |
|
| 387 |
switch (muladdmode) |
| 388 |
{ |
| 389 |
case 0: |
| 390 |
self->muladd_func_ptr = PinkNoise_postprocessing_ii; |
| 391 |
break; |
| 392 |
|
| 393 |
case 1: |
| 394 |
self->muladd_func_ptr = PinkNoise_postprocessing_ai; |
| 395 |
break; |
| 396 |
|
| 397 |
case 2: |
| 398 |
self->muladd_func_ptr = PinkNoise_postprocessing_revai; |
| 399 |
break; |
| 400 |
|
| 401 |
case 10: |
| 402 |
self->muladd_func_ptr = PinkNoise_postprocessing_ia; |
| 403 |
break; |
| 404 |
|
| 405 |
case 11: |
| 406 |
self->muladd_func_ptr = PinkNoise_postprocessing_aa; |
| 407 |
break; |
| 408 |
|
| 409 |
case 12: |
| 410 |
self->muladd_func_ptr = PinkNoise_postprocessing_revaa; |
| 411 |
break; |
| 412 |
|
| 413 |
case 20: |
| 414 |
self->muladd_func_ptr = PinkNoise_postprocessing_ireva; |
| 415 |
break; |
| 416 |
|
| 417 |
case 21: |
| 418 |
self->muladd_func_ptr = PinkNoise_postprocessing_areva; |
| 419 |
break; |
| 420 |
|
| 421 |
case 22: |
| 422 |
self->muladd_func_ptr = PinkNoise_postprocessing_revareva; |
| 423 |
break; |
| 424 |
} |
| 425 |
} |
| 426 |
|
| 427 |
static void |
| 428 |
PinkNoise_compute_next_data_frame(PinkNoise *self) |
| 429 |
{ |
| 430 |
PinkNoise_generate(self); |
| 431 |
(*self->muladd_func_ptr)(self); |
| 432 |
} |
| 433 |
|
| 434 |
static int |
| 435 |
PinkNoise_traverse(PinkNoise *self, visitproc visit, void *arg) |
| 436 |
{ |
| 437 |
pyo_VISIT |
| 438 |
return 0; |
| 439 |
} |
| 440 |
|
| 441 |
static int |
| 442 |
PinkNoise_clear(PinkNoise *self) |
| 443 |
{ |
| 444 |
pyo_CLEAR |
| 445 |
return 0; |
| 446 |
} |
| 447 |
|
| 448 |
static void |
| 449 |
PinkNoise_dealloc(PinkNoise* self) |
| 450 |
{ |
| 451 |
pyo_DEALLOC |
| 452 |
PinkNoise_clear(self); |
| 453 |
Py_TYPE(self->stream)->tp_free((PyObject*)self->stream); |
| 454 |
Py_TYPE(self)->tp_free((PyObject*)self); |
| 455 |
} |
| 456 |
|
| 457 |
static PyObject * |
| 458 |
PinkNoise_new(PyTypeObject *type, PyObject *args, PyObject *kwds) |
| 459 |
{ |
| 460 |
int i; |
| 461 |
PyObject *multmp = NULL, *addtmp = NULL; |
| 462 |
PinkNoise *self; |
| 463 |
self = (PinkNoise *)type->tp_alloc(type, 0); |
| 464 |
|
| 465 |
self->c0 = self->c1 = self->c2 = self->c3 = self->c4 = self->c5 = self->c6 = 0.0; |
| 466 |
self->modebuffer[0] = 0; |
| 467 |
self->modebuffer[1] = 0; |
| 468 |
|
| 469 |
INIT_OBJECT_COMMON |
| 470 |
Stream_setFunctionPtr(self->stream, PinkNoise_compute_next_data_frame); |
| 471 |
self->mode_func_ptr = PinkNoise_setProcMode; |
| 472 |
|
| 473 |
static char *kwlist[] = {"mul", "add", NULL}; |
| 474 |
|
| 475 |
if (! PyArg_ParseTupleAndKeywords(args, kwds, "|OO", kwlist, &multmp, &addtmp)) |
| 476 |
Py_RETURN_NONE; |
| 477 |
|
| 478 |
if (multmp) |
| 479 |
{ |
| 480 |
PyObject_CallMethod((PyObject *)self, "setMul", "O", multmp); |
| 481 |
} |
| 482 |
|
| 483 |
if (addtmp) |
| 484 |
{ |
| 485 |
PyObject_CallMethod((PyObject *)self, "setAdd", "O", addtmp); |
| 486 |
} |
| 487 |
|
| 488 |
PyObject_CallMethod(self->server, "addStream", "O", self->stream); |
| 489 |
|
| 490 |
(*self->mode_func_ptr)(self); |
| 491 |
|
| 492 |
Server_generateSeed((Server *)self->server, PINKNOISE_ID); |
| 493 |
|
| 494 |
return (PyObject *)self; |
| 495 |
} |
| 496 |
|
| 497 |
static PyObject * PinkNoise_getServer(PinkNoise* self) { GET_SERVER }; |
| 498 |
static PyObject * PinkNoise_getStream(PinkNoise* self) { GET_STREAM }; |
| 499 |
static PyObject * PinkNoise_setMul(PinkNoise *self, PyObject *arg) { SET_MUL }; |
| 500 |
static PyObject * PinkNoise_setAdd(PinkNoise *self, PyObject *arg) { SET_ADD }; |
| 501 |
static PyObject * PinkNoise_setSub(PinkNoise *self, PyObject *arg) { SET_SUB }; |
| 502 |
static PyObject * PinkNoise_setDiv(PinkNoise *self, PyObject *arg) { SET_DIV }; |
| 503 |
|
| 504 |
static PyObject * PinkNoise_play(PinkNoise *self, PyObject *args, PyObject *kwds) { PLAY }; |
| 505 |
static PyObject * PinkNoise_out(PinkNoise *self, PyObject *args, PyObject *kwds) { OUT }; |
| 506 |
static PyObject * PinkNoise_stop(PinkNoise *self, PyObject *args, PyObject *kwds) { STOP }; |
| 507 |
|
| 508 |
static PyObject * PinkNoise_multiply(PinkNoise *self, PyObject *arg) { MULTIPLY }; |
| 509 |
static PyObject * PinkNoise_inplace_multiply(PinkNoise *self, PyObject *arg) { INPLACE_MULTIPLY }; |
| 510 |
static PyObject * PinkNoise_add(PinkNoise *self, PyObject *arg) { ADD }; |
| 511 |
static PyObject * PinkNoise_inplace_add(PinkNoise *self, PyObject *arg) { INPLACE_ADD }; |
| 512 |
static PyObject * PinkNoise_sub(PinkNoise *self, PyObject *arg) { SUB }; |
| 513 |
static PyObject * PinkNoise_inplace_sub(PinkNoise *self, PyObject *arg) { INPLACE_SUB }; |
| 514 |
static PyObject * PinkNoise_div(PinkNoise *self, PyObject *arg) { DIV }; |
| 515 |
static PyObject * PinkNoise_inplace_div(PinkNoise *self, PyObject *arg) { INPLACE_DIV }; |
| 516 |
|
| 517 |
static PyMemberDef PinkNoise_members[] = |
| 518 |
{ |
| 519 |
{"server", T_OBJECT_EX, offsetof(PinkNoise, server), 0, "Pyo server."}, |
| 520 |
{"stream", T_OBJECT_EX, offsetof(PinkNoise, stream), 0, "Stream object."}, |
| 521 |
{"mul", T_OBJECT_EX, offsetof(PinkNoise, mul), 0, "Mul factor."}, |
| 522 |
{"add", T_OBJECT_EX, offsetof(PinkNoise, add), 0, "Add factor."}, |
| 523 |
{NULL} /* Sentinel */ |
| 524 |
}; |
| 525 |
|
| 526 |
static PyMethodDef PinkNoise_methods[] = |
| 527 |
{ |
| 528 |
{"getServer", (PyCFunction)PinkNoise_getServer, METH_NOARGS, "Returns server object."}, |
| 529 |
{"_getStream", (PyCFunction)PinkNoise_getStream, METH_NOARGS, "Returns stream object."}, |
| 530 |
{"play", (PyCFunction)PinkNoise_play, METH_VARARGS | METH_KEYWORDS, "Starts computing without sending sound to soundcard."}, |
| 531 |
{"out", (PyCFunction)PinkNoise_out, METH_VARARGS | METH_KEYWORDS, "Starts computing and sends sound to soundcard channel speficied by argument."}, |
| 532 |
{"stop", (PyCFunction)PinkNoise_stop, METH_VARARGS | METH_KEYWORDS, "Stops computing."}, |
| 533 |
{"setMul", (PyCFunction)PinkNoise_setMul, METH_O, "Sets PinkNoise mul factor."}, |
| 534 |
{"setAdd", (PyCFunction)PinkNoise_setAdd, METH_O, "Sets PinkNoise add factor."}, |
| 535 |
{"setSub", (PyCFunction)PinkNoise_setSub, METH_O, "Sets inverse add factor."}, |
| 536 |
{"setDiv", (PyCFunction)PinkNoise_setDiv, METH_O, "Sets inverse mul factor."}, |
| 537 |
{NULL} /* Sentinel */ |
| 538 |
}; |
| 539 |
|
| 540 |
static PyNumberMethods PinkNoise_as_number = |
| 541 |
{ |
| 542 |
(binaryfunc)PinkNoise_add, /*nb_add*/ |
| 543 |
(binaryfunc)PinkNoise_sub, /*nb_subtract*/ |
| 544 |
(binaryfunc)PinkNoise_multiply, /*nb_multiply*/ |
| 545 |
0, /*nb_remainder*/ |
| 546 |
0, /*nb_divmod*/ |
| 547 |
0, /*nb_power*/ |
| 548 |
0, /*nb_neg*/ |
| 549 |
0, /*nb_pos*/ |
| 550 |
0, /*(unaryfunc)array_abs,*/ |
| 551 |
0, /*nb_nonzero*/ |
| 552 |
0, /*nb_invert*/ |
| 553 |
0, /*nb_lshift*/ |
| 554 |
0, /*nb_rshift*/ |
| 555 |
0, /*nb_and*/ |
| 556 |
0, /*nb_xor*/ |
| 557 |
0, /*nb_or*/ |
| 558 |
0, /*nb_int*/ |
| 559 |
0, /*nb_long*/ |
| 560 |
0, /*nb_float*/ |
| 561 |
(binaryfunc)PinkNoise_inplace_add, /*inplace_add*/ |
| 562 |
(binaryfunc)PinkNoise_inplace_sub, /*inplace_subtract*/ |
| 563 |
(binaryfunc)PinkNoise_inplace_multiply, /*inplace_multiply*/ |
| 564 |
0, /*inplace_remainder*/ |
| 565 |
0, /*inplace_power*/ |
| 566 |
0, /*inplace_lshift*/ |
| 567 |
0, /*inplace_rshift*/ |
| 568 |
0, /*inplace_and*/ |
| 569 |
0, /*inplace_xor*/ |
| 570 |
0, /*inplace_or*/ |
| 571 |
0, /*nb_floor_divide*/ |
| 572 |
(binaryfunc)PinkNoise_div, /*nb_true_divide*/ |
| 573 |
0, /*nb_inplace_floor_divide*/ |
| 574 |
(binaryfunc)PinkNoise_inplace_div, /*nb_inplace_true_divide*/ |
| 575 |
0, /* nb_index */ |
| 576 |
}; |
| 577 |
|
| 578 |
PyTypeObject PinkNoiseType = |
| 579 |
{ |
| 580 |
PyVarObject_HEAD_INIT(NULL, 0) |
| 581 |
"_pyo.PinkNoise_base", /*tp_name*/ |
| 582 |
sizeof(PinkNoise), /*tp_basicsize*/ |
| 583 |
0, /*tp_itemsize*/ |
| 584 |
(destructor)PinkNoise_dealloc, /*tp_dealloc*/ |
| 585 |
0, /*tp_print*/ |
| 586 |
0, /*tp_getattr*/ |
| 587 |
0, /*tp_setattr*/ |
| 588 |
0, /*tp_as_async (tp_compare in Python 2)*/ |
| 589 |
0, /*tp_repr*/ |
| 590 |
&PinkNoise_as_number, /*tp_as_number*/ |
| 591 |
0, /*tp_as_sequence*/ |
| 592 |
0, /*tp_as_mapping*/ |
| 593 |
0, /*tp_hash */ |
| 594 |
0, /*tp_call*/ |
| 595 |
0, /*tp_str*/ |
| 596 |
0, /*tp_getattro*/ |
| 597 |
0, /*tp_setattro*/ |
| 598 |
0, /*tp_as_buffer*/ |
| 599 |
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /*tp_flags*/ |
| 600 |
"PinkNoise objects. Pink noise generator.", /* tp_doc */ |
| 601 |
(traverseproc)PinkNoise_traverse, /* tp_traverse */ |
| 602 |
(inquiry)PinkNoise_clear, /* tp_clear */ |
| 603 |
0, /* tp_richcompare */ |
| 604 |
0, /* tp_weaklistoffset */ |
| 605 |
0, /* tp_iter */ |
| 606 |
0, /* tp_iternext */ |
| 607 |
PinkNoise_methods, /* tp_methods */ |
| 608 |
PinkNoise_members, /* tp_members */ |
| 609 |
0, /* tp_getset */ |
| 610 |
0, /* tp_base */ |
| 611 |
0, /* tp_dict */ |
| 612 |
0, /* tp_descr_get */ |
| 613 |
0, /* tp_descr_set */ |
| 614 |
0, /* tp_dictoffset */ |
| 615 |
0, /* tp_init */ |
| 616 |
0, /* tp_alloc */ |
| 617 |
PinkNoise_new, /* tp_new */ |
| 618 |
}; |
| 619 |
|
| 620 |
typedef struct |
| 621 |
{ |
| 622 |
pyo_audio_HEAD |
| 623 |
int modebuffer[2]; |
| 624 |
MYFLT y1; |
| 625 |
MYFLT c; |
| 626 |
} BrownNoise; |
| 627 |
|
| 628 |
static void |
| 629 |
BrownNoise_generate(BrownNoise *self) |
| 630 |
{ |
| 631 |
MYFLT rnd; |
| 632 |
int i; |
| 633 |
|
| 634 |
for (i = 0; i < self->bufsize; i++) |
| 635 |
{ |
| 636 |
rnd = RANDOM_UNIFORM * 1.98 - 0.99; |
| 637 |
self->y1 = rnd + (self->y1 - rnd) * self->c; |
| 638 |
self->data[i] = self->y1 * 20.0; /* gain compensation */ |
| 639 |
} |
| 640 |
} |
| 641 |
|
| 642 |
static void BrownNoise_postprocessing_ii(BrownNoise *self) { POST_PROCESSING_II }; |
| 643 |
static void BrownNoise_postprocessing_ai(BrownNoise *self) { POST_PROCESSING_AI }; |
| 644 |
static void BrownNoise_postprocessing_ia(BrownNoise *self) { POST_PROCESSING_IA }; |
| 645 |
static void BrownNoise_postprocessing_aa(BrownNoise *self) { POST_PROCESSING_AA }; |
| 646 |
static void BrownNoise_postprocessing_ireva(BrownNoise *self) { POST_PROCESSING_IREVA }; |
| 647 |
static void BrownNoise_postprocessing_areva(BrownNoise *self) { POST_PROCESSING_AREVA }; |
| 648 |
static void BrownNoise_postprocessing_revai(BrownNoise *self) { POST_PROCESSING_REVAI }; |
| 649 |
static void BrownNoise_postprocessing_revaa(BrownNoise *self) { POST_PROCESSING_REVAA }; |
| 650 |
static void BrownNoise_postprocessing_revareva(BrownNoise *self) { POST_PROCESSING_REVAREVA }; |
| 651 |
|
| 652 |
static void |
| 653 |
BrownNoise_setProcMode(BrownNoise *self) |
| 654 |
{ |
| 655 |
int muladdmode; |
| 656 |
muladdmode = self->modebuffer[0] + self->modebuffer[1] * 10; |
| 657 |
|
| 658 |
switch (muladdmode) |
| 659 |
{ |
| 660 |
case 0: |
| 661 |
self->muladd_func_ptr = BrownNoise_postprocessing_ii; |
| 662 |
break; |
| 663 |
|
| 664 |
case 1: |
| 665 |
self->muladd_func_ptr = BrownNoise_postprocessing_ai; |
| 666 |
break; |
| 667 |
|
| 668 |
case 2: |
| 669 |
self->muladd_func_ptr = BrownNoise_postprocessing_revai; |
| 670 |
break; |
| 671 |
|
| 672 |
case 10: |
| 673 |
self->muladd_func_ptr = BrownNoise_postprocessing_ia; |
| 674 |
break; |
| 675 |
|
| 676 |
case 11: |
| 677 |
self->muladd_func_ptr = BrownNoise_postprocessing_aa; |
| 678 |
break; |
| 679 |
|
| 680 |
case 12: |
| 681 |
self->muladd_func_ptr = BrownNoise_postprocessing_revaa; |
| 682 |
break; |
| 683 |
|
| 684 |
case 20: |
| 685 |
self->muladd_func_ptr = BrownNoise_postprocessing_ireva; |
| 686 |
break; |
| 687 |
|
| 688 |
case 21: |
| 689 |
self->muladd_func_ptr = BrownNoise_postprocessing_areva; |
| 690 |
break; |
| 691 |
|
| 692 |
case 22: |
| 693 |
self->muladd_func_ptr = BrownNoise_postprocessing_revareva; |
| 694 |
break; |
| 695 |
} |
| 696 |
} |
| 697 |
|
| 698 |
static void |
| 699 |
BrownNoise_compute_next_data_frame(BrownNoise *self) |
| 700 |
{ |
| 701 |
BrownNoise_generate(self); |
| 702 |
(*self->muladd_func_ptr)(self); |
| 703 |
} |
| 704 |
|
| 705 |
static int |
| 706 |
BrownNoise_traverse(BrownNoise *self, visitproc visit, void *arg) |
| 707 |
{ |
| 708 |
pyo_VISIT |
| 709 |
return 0; |
| 710 |
} |
| 711 |
|
| 712 |
static int |
| 713 |
BrownNoise_clear(BrownNoise *self) |
| 714 |
{ |
| 715 |
pyo_CLEAR |
| 716 |
return 0; |
| 717 |
} |
| 718 |
|
| 719 |
static void |
| 720 |
BrownNoise_dealloc(BrownNoise* self) |
| 721 |
{ |
| 722 |
pyo_DEALLOC |
| 723 |
BrownNoise_clear(self); |
| 724 |
Py_TYPE(self->stream)->tp_free((PyObject*)self->stream); |
| 725 |
Py_TYPE(self)->tp_free((PyObject*)self); |
| 726 |
} |
| 727 |
|
| 728 |
static PyObject * |
| 729 |
BrownNoise_new(PyTypeObject *type, PyObject *args, PyObject *kwds) |
| 730 |
{ |
| 731 |
int i; |
| 732 |
MYFLT b; |
| 733 |
PyObject *multmp = NULL, *addtmp = NULL; |
| 734 |
BrownNoise *self; |
| 735 |
self = (BrownNoise *)type->tp_alloc(type, 0); |
| 736 |
|
| 737 |
self->modebuffer[0] = 0; |
| 738 |
self->modebuffer[1] = 0; |
| 739 |
self->y1 = self->c = 0.0; |
| 740 |
|
| 741 |
INIT_OBJECT_COMMON |
| 742 |
Stream_setFunctionPtr(self->stream, BrownNoise_compute_next_data_frame); |
| 743 |
self->mode_func_ptr = BrownNoise_setProcMode; |
| 744 |
|
| 745 |
static char *kwlist[] = {"mul", "add", NULL}; |
| 746 |
|
| 747 |
if (! PyArg_ParseTupleAndKeywords(args, kwds, "|OO", kwlist, &multmp, &addtmp)) |
| 748 |
Py_RETURN_NONE; |
| 749 |
|
| 750 |
if (multmp) |
| 751 |
{ |
| 752 |
PyObject_CallMethod((PyObject *)self, "setMul", "O", multmp); |
| 753 |
} |
| 754 |
|
| 755 |
if (addtmp) |
| 756 |
{ |
| 757 |
PyObject_CallMethod((PyObject *)self, "setAdd", "O", addtmp); |
| 758 |
} |
| 759 |
|
| 760 |
PyObject_CallMethod(self->server, "addStream", "O", self->stream); |
| 761 |
|
| 762 |
b = 2.0 - MYCOS(TWOPI * 20.0 / self->sr); |
| 763 |
self->c = (b - MYSQRT(b * b - 1.0)); |
| 764 |
|
| 765 |
(*self->mode_func_ptr)(self); |
| 766 |
|
| 767 |
Server_generateSeed((Server *)self->server, BROWNNOISE_ID); |
| 768 |
|
| 769 |
return (PyObject *)self; |
| 770 |
} |
| 771 |
|
| 772 |
static PyObject * BrownNoise_getServer(BrownNoise* self) { GET_SERVER }; |
| 773 |
static PyObject * BrownNoise_getStream(BrownNoise* self) { GET_STREAM }; |
| 774 |
static PyObject * BrownNoise_setMul(BrownNoise *self, PyObject *arg) { SET_MUL }; |
| 775 |
static PyObject * BrownNoise_setAdd(BrownNoise *self, PyObject *arg) { SET_ADD }; |
| 776 |
static PyObject * BrownNoise_setSub(BrownNoise *self, PyObject *arg) { SET_SUB }; |
| 777 |
static PyObject * BrownNoise_setDiv(BrownNoise *self, PyObject *arg) { SET_DIV }; |
| 778 |
|
| 779 |
static PyObject * BrownNoise_play(BrownNoise *self, PyObject *args, PyObject *kwds) { PLAY }; |
| 780 |
static PyObject * BrownNoise_out(BrownNoise *self, PyObject *args, PyObject *kwds) { OUT }; |
| 781 |
static PyObject * BrownNoise_stop(BrownNoise *self, PyObject *args, PyObject *kwds) { STOP }; |
| 782 |
|
| 783 |
static PyObject * BrownNoise_multiply(BrownNoise *self, PyObject *arg) { MULTIPLY }; |
| 784 |
static PyObject * BrownNoise_inplace_multiply(BrownNoise *self, PyObject *arg) { INPLACE_MULTIPLY }; |
| 785 |
static PyObject * BrownNoise_add(BrownNoise *self, PyObject *arg) { ADD }; |
| 786 |
static PyObject * BrownNoise_inplace_add(BrownNoise *self, PyObject *arg) { INPLACE_ADD }; |
| 787 |
static PyObject * BrownNoise_sub(BrownNoise *self, PyObject *arg) { SUB }; |
| 788 |
static PyObject * BrownNoise_inplace_sub(BrownNoise *self, PyObject *arg) { INPLACE_SUB }; |
| 789 |
static PyObject * BrownNoise_div(BrownNoise *self, PyObject *arg) { DIV }; |
| 790 |
static PyObject * BrownNoise_inplace_div(BrownNoise *self, PyObject *arg) { INPLACE_DIV }; |
| 791 |
|
| 792 |
static PyMemberDef BrownNoise_members[] = |
| 793 |
{ |
| 794 |
{"server", T_OBJECT_EX, offsetof(BrownNoise, server), 0, "Pyo server."}, |
| 795 |
{"stream", T_OBJECT_EX, offsetof(BrownNoise, stream), 0, "Stream object."}, |
| 796 |
{"mul", T_OBJECT_EX, offsetof(BrownNoise, mul), 0, "Mul factor."}, |
| 797 |
{"add", T_OBJECT_EX, offsetof(BrownNoise, add), 0, "Add factor."}, |
| 798 |
{NULL} /* Sentinel */ |
| 799 |
}; |
| 800 |
|
| 801 |
static PyMethodDef BrownNoise_methods[] = |
| 802 |
{ |
| 803 |
{"getServer", (PyCFunction)BrownNoise_getServer, METH_NOARGS, "Returns server object."}, |
| 804 |
{"_getStream", (PyCFunction)BrownNoise_getStream, METH_NOARGS, "Returns stream object."}, |
| 805 |
{"play", (PyCFunction)BrownNoise_play, METH_VARARGS | METH_KEYWORDS, "Starts computing without sending sound to soundcard."}, |
| 806 |
{"out", (PyCFunction)BrownNoise_out, METH_VARARGS | METH_KEYWORDS, "Starts computing and sends sound to soundcard channel speficied by argument."}, |
| 807 |
{"stop", (PyCFunction)BrownNoise_stop, METH_VARARGS | METH_KEYWORDS, "Stops computing."}, |
| 808 |
{"setMul", (PyCFunction)BrownNoise_setMul, METH_O, "Sets BrownNoise mul factor."}, |
| 809 |
{"setAdd", (PyCFunction)BrownNoise_setAdd, METH_O, "Sets BrownNoise add factor."}, |
| 810 |
{"setSub", (PyCFunction)BrownNoise_setSub, METH_O, "Sets inverse add factor."}, |
| 811 |
{"setDiv", (PyCFunction)BrownNoise_setDiv, METH_O, "Sets inverse mul factor."}, |
| 812 |
{NULL} /* Sentinel */ |
| 813 |
}; |
| 814 |
|
| 815 |
static PyNumberMethods BrownNoise_as_number = |
| 816 |
{ |
| 817 |
(binaryfunc)BrownNoise_add, /*nb_add*/ |
| 818 |
(binaryfunc)BrownNoise_sub, /*nb_subtract*/ |
| 819 |
(binaryfunc)BrownNoise_multiply, /*nb_multiply*/ |
| 820 |
0, /*nb_remainder*/ |
| 821 |
0, /*nb_divmod*/ |
| 822 |
0, /*nb_power*/ |
| 823 |
0, /*nb_neg*/ |
| 824 |
0, /*nb_pos*/ |
| 825 |
0, /*(unaryfunc)array_abs,*/ |
| 826 |
0, /*nb_nonzero*/ |
| 827 |
0, /*nb_invert*/ |
| 828 |
0, /*nb_lshift*/ |
| 829 |
0, /*nb_rshift*/ |
| 830 |
0, /*nb_and*/ |
| 831 |
0, /*nb_xor*/ |
| 832 |
0, /*nb_or*/ |
| 833 |
0, /*nb_int*/ |
| 834 |
0, /*nb_long*/ |
| 835 |
0, /*nb_float*/ |
| 836 |
(binaryfunc)BrownNoise_inplace_add, /*inplace_add*/ |
| 837 |
(binaryfunc)BrownNoise_inplace_sub, /*inplace_subtract*/ |
| 838 |
(binaryfunc)BrownNoise_inplace_multiply, /*inplace_multiply*/ |
| 839 |
0, /*inplace_remainder*/ |
| 840 |
0, /*inplace_power*/ |
| 841 |
0, /*inplace_lshift*/ |
| 842 |
0, /*inplace_rshift*/ |
| 843 |
0, /*inplace_and*/ |
| 844 |
0, /*inplace_xor*/ |
| 845 |
0, /*inplace_or*/ |
| 846 |
0, /*nb_floor_divide*/ |
| 847 |
(binaryfunc)BrownNoise_div, /*nb_true_divide*/ |
| 848 |
0, /*nb_inplace_floor_divide*/ |
| 849 |
(binaryfunc)BrownNoise_inplace_div, /*nb_inplace_true_divide*/ |
| 850 |
0, /* nb_index */ |
| 851 |
}; |
| 852 |
|
| 853 |
PyTypeObject BrownNoiseType = |
| 854 |
{ |
| 855 |
PyVarObject_HEAD_INIT(NULL, 0) |
| 856 |
"_pyo.BrownNoise_base", /*tp_name*/ |
| 857 |
sizeof(BrownNoise), /*tp_basicsize*/ |
| 858 |
0, /*tp_itemsize*/ |
| 859 |
(destructor)BrownNoise_dealloc, /*tp_dealloc*/ |
| 860 |
0, /*tp_print*/ |
| 861 |
0, /*tp_getattr*/ |
| 862 |
0, /*tp_setattr*/ |
| 863 |
0, /*tp_as_async (tp_compare in Python 2)*/ |
| 864 |
0, /*tp_repr*/ |
| 865 |
&BrownNoise_as_number, /*tp_as_number*/ |
| 866 |
0, /*tp_as_sequence*/ |
| 867 |
0, /*tp_as_mapping*/ |
| 868 |
0, /*tp_hash */ |
| 869 |
0, /*tp_call*/ |
| 870 |
0, /*tp_str*/ |
| 871 |
0, /*tp_getattro*/ |
| 872 |
0, /*tp_setattro*/ |
| 873 |
0, /*tp_as_buffer*/ |
| 874 |
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /*tp_flags*/ |
| 875 |
"BrownNoise objects. Brown noise generator (-6dB/octave rolloff).", /* tp_doc */ |
| 876 |
(traverseproc)BrownNoise_traverse, /* tp_traverse */ |
| 877 |
(inquiry)BrownNoise_clear, /* tp_clear */ |
| 878 |
0, /* tp_richcompare */ |
| 879 |
0, /* tp_weaklistoffset */ |
| 880 |
0, /* tp_iter */ |
| 881 |
0, /* tp_iternext */ |
| 882 |
BrownNoise_methods, /* tp_methods */ |
| 883 |
BrownNoise_members, /* tp_members */ |
| 884 |
0, /* tp_getset */ |
| 885 |
0, /* tp_base */ |
| 886 |
0, /* tp_dict */ |
| 887 |
0, /* tp_descr_get */ |
| 888 |
0, /* tp_descr_set */ |
| 889 |
0, /* tp_dictoffset */ |
| 890 |
0, /* tp_init */ |
| 891 |
0, /* tp_alloc */ |
| 892 |
BrownNoise_new, /* tp_new */ |
| 893 |
}; |