~ubuntu-branches/ubuntu/quantal/python-pyo/quantal

« back to all changes in this revision

Viewing changes to src/objects/compressmodule.c

  • Committer: Package Import Robot
  • Author(s): Tiago Bortoletto Vaz
  • Date: 2012-07-03 23:45:41 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20120703234541-jh5jg00lvljnwq8m
Tags: 0.6.2-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
237
237
static void
238
238
Compress_dealloc(Compress* self)
239
239
{
240
 
    free(self->data);
 
240
    pyo_DEALLOC
241
241
    free(self->lh_buffer);
242
242
    Compress_clear(self);
243
243
    self->ob_type->tp_free((PyObject*)self);
244
244
}
245
245
 
246
 
static PyObject * Compress_deleteStream(Compress *self) { DELETE_STREAM };
247
 
 
248
246
static PyObject *
249
247
Compress_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
250
248
{
251
249
    int i;
 
250
    PyObject *inputtmp, *input_streamtmp, *threshtmp=NULL, *ratiotmp=NULL, *risetimetmp=NULL, *falltimetmp=NULL, *multmp=NULL, *addtmp=NULL;
 
251
    PyObject *looktmp=NULL, *kneetmp=NULL;
252
252
    Compress *self;
253
253
    self = (Compress *)type->tp_alloc(type, 0);
254
254
    
272
272
 
273
273
    Stream_setFunctionPtr(self->stream, Compress_compute_next_data_frame);
274
274
    self->mode_func_ptr = Compress_setProcMode;
275
 
    return (PyObject *)self;
276
 
}
277
275
 
278
 
static int
279
 
Compress_init(Compress *self, PyObject *args, PyObject *kwds)
280
 
{
281
 
    int i;
282
 
    PyObject *inputtmp, *input_streamtmp, *threshtmp=NULL, *ratiotmp=NULL, *risetimetmp=NULL, *falltimetmp=NULL, *multmp=NULL, *addtmp=NULL;
283
 
    PyObject *looktmp=NULL, *kneetmp=NULL;
284
 
    
285
276
    static char *kwlist[] = {"input", "thresh", "ratio", "risetime", "falltime", "lookahead", "knee", "outputAmp", "mul", "add", NULL};
286
277
    
287
278
    if (! PyArg_ParseTupleAndKeywords(args, kwds, "O|OOOOOOiOO", kwlist, &inputtmp, &threshtmp, &ratiotmp, &risetimetmp, &falltimetmp, &looktmp, &kneetmp, &self->outputAmp, &multmp, &addtmp))
288
 
        return -1; 
 
279
        Py_RETURN_NONE;
289
280
    
290
281
    INIT_INPUT_STREAM
291
282
    
324
315
 
325
316
    self->proc_func_ptr = Compress_compress_soft;
326
317
 
327
 
    Py_INCREF(self->stream);
328
318
    PyObject_CallMethod(self->server, "addStream", "O", self->stream);
329
319
    
330
320
    (*self->mode_func_ptr)(self);
331
 
        
332
 
    Py_INCREF(self);
333
 
    return 0;
 
321
 
 
322
    return (PyObject *)self;
334
323
}
335
324
 
336
325
static PyObject * Compress_getServer(Compress* self) { GET_SERVER };
541
530
static PyMethodDef Compress_methods[] = {
542
531
{"getServer", (PyCFunction)Compress_getServer, METH_NOARGS, "Returns server object."},
543
532
{"_getStream", (PyCFunction)Compress_getStream, METH_NOARGS, "Returns stream object."},
544
 
{"deleteStream", (PyCFunction)Compress_deleteStream, METH_NOARGS, "Remove stream from server and delete the object."},
545
533
{"play", (PyCFunction)Compress_play, METH_VARARGS|METH_KEYWORDS, "Starts computing without sending sound to soundcard."},
546
534
{"out", (PyCFunction)Compress_out, METH_VARARGS|METH_KEYWORDS, "Starts computing and sends sound to soundcard channel speficied by argument."},
547
535
{"stop", (PyCFunction)Compress_stop, METH_NOARGS, "Stops computing."},
637
625
0,                                              /* tp_descr_get */
638
626
0,                                              /* tp_descr_set */
639
627
0,                                              /* tp_dictoffset */
640
 
(initproc)Compress_init,                          /* tp_init */
 
628
0,                          /* tp_init */
641
629
0,                                              /* tp_alloc */
642
630
Compress_new,                                     /* tp_new */
643
631
};
1245
1233
static void
1246
1234
Gate_dealloc(Gate* self)
1247
1235
{
1248
 
    free(self->data);
 
1236
    pyo_DEALLOC
1249
1237
    free(self->lh_buffer);
1250
1238
    Gate_clear(self);
1251
1239
    self->ob_type->tp_free((PyObject*)self);
1252
1240
}
1253
1241
 
1254
 
static PyObject * Gate_deleteStream(Gate *self) { DELETE_STREAM };
1255
 
 
1256
1242
static PyObject *
1257
1243
Gate_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
1258
1244
{
1259
1245
    int i;
 
1246
    PyObject *inputtmp, *input_streamtmp, *threshtmp=NULL, *risetimetmp=NULL, *falltimetmp=NULL, *multmp=NULL, *addtmp=NULL;
 
1247
    PyObject *looktmp=NULL;
1260
1248
    Gate *self;
1261
1249
    self = (Gate *)type->tp_alloc(type, 0);
1262
1250
    
1282
1270
 
1283
1271
    Stream_setFunctionPtr(self->stream, Gate_compute_next_data_frame);
1284
1272
    self->mode_func_ptr = Gate_setProcMode;
1285
 
    return (PyObject *)self;
1286
 
}
1287
1273
 
1288
 
static int
1289
 
Gate_init(Gate *self, PyObject *args, PyObject *kwds)
1290
 
{
1291
 
    PyObject *inputtmp, *input_streamtmp, *threshtmp=NULL, *risetimetmp=NULL, *falltimetmp=NULL, *multmp=NULL, *addtmp=NULL;
1292
 
    PyObject *looktmp=NULL;
1293
 
    int i;
1294
 
    
1295
1274
    static char *kwlist[] = {"input", "thresh", "risetime", "falltime", "lookahead", "outputAmp", "mul", "add", NULL};
1296
1275
    
1297
1276
    if (! PyArg_ParseTupleAndKeywords(args, kwds, "O|OOOOiOO", kwlist, &inputtmp, &threshtmp, &risetimetmp, &falltimetmp, &looktmp, &self->outputAmp, &multmp, &addtmp))
1298
 
        return -1; 
 
1277
        Py_RETURN_NONE;
1299
1278
    
1300
1279
    INIT_INPUT_STREAM
1301
1280
 
1327
1306
        self->lh_buffer[i] = 0.;
1328
1307
    }    
1329
1308
    
1330
 
    Py_INCREF(self->stream);
1331
1309
    PyObject_CallMethod(self->server, "addStream", "O", self->stream);
1332
1310
    
1333
1311
    (*self->mode_func_ptr)(self);
1334
 
    
1335
 
    Py_INCREF(self);
1336
 
    return 0;
 
1312
 
 
1313
    return (PyObject *)self;
1337
1314
}
1338
1315
 
1339
1316
static PyObject * Gate_getServer(Gate* self) { GET_SERVER };
1495
1472
static PyMethodDef Gate_methods[] = {
1496
1473
    {"getServer", (PyCFunction)Gate_getServer, METH_NOARGS, "Returns server object."},
1497
1474
    {"_getStream", (PyCFunction)Gate_getStream, METH_NOARGS, "Returns stream object."},
1498
 
    {"deleteStream", (PyCFunction)Gate_deleteStream, METH_NOARGS, "Remove stream from server and delete the object."},
1499
1475
    {"play", (PyCFunction)Gate_play, METH_VARARGS|METH_KEYWORDS, "Starts computing without sending sound to soundcard."},
1500
1476
    {"out", (PyCFunction)Gate_out, METH_VARARGS|METH_KEYWORDS, "Starts computing and sends sound to soundcard channel speficied by argument."},
1501
1477
    {"stop", (PyCFunction)Gate_stop, METH_NOARGS, "Stops computing."},
1589
1565
    0,                                              /* tp_descr_get */
1590
1566
    0,                                              /* tp_descr_set */
1591
1567
    0,                                              /* tp_dictoffset */
1592
 
    (initproc)Gate_init,                          /* tp_init */
 
1568
    0,                          /* tp_init */
1593
1569
    0,                                              /* tp_alloc */
1594
1570
    Gate_new,                                     /* tp_new */
1595
1571
};