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

« back to all changes in this revision

Viewing changes to src/objects/lfomodule.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:
904
904
static void
905
905
LFO_dealloc(LFO* self)
906
906
{
907
 
    free(self->data);
 
907
    pyo_DEALLOC
908
908
    LFO_clear(self);
909
909
    self->ob_type->tp_free((PyObject*)self);
910
910
}
911
911
 
912
 
static PyObject * LFO_deleteStream(LFO *self) { DELETE_STREAM };
913
 
 
914
912
static PyObject *
915
913
LFO_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
916
914
{
917
915
    int i;
 
916
    PyObject *freqtmp=NULL, *sharptmp=NULL, *multmp=NULL, *addtmp=NULL;
918
917
    LFO *self;
919
918
    self = (LFO *)type->tp_alloc(type, 0);
920
919
        
936
935
    self->srOverEight = (MYFLT)self->sr * 0.125;
937
936
    Stream_setFunctionPtr(self->stream, LFO_compute_next_data_frame);
938
937
    self->mode_func_ptr = LFO_setProcMode;
939
 
    return (PyObject *)self;
940
 
}
941
 
 
942
 
static int
943
 
LFO_init(LFO *self, PyObject *args, PyObject *kwds)
944
 
{
945
 
    PyObject *freqtmp=NULL, *sharptmp=NULL, *multmp=NULL, *addtmp=NULL;
946
938
 
947
939
    static char *kwlist[] = {"freq", "sharp", "type", "mul", "add", NULL};
948
940
 
949
941
    if (! PyArg_ParseTupleAndKeywords(args, kwds, "|OOiOO", kwlist, &freqtmp, &sharptmp, &self->wavetype, &multmp, &addtmp))
950
 
        return -1; 
951
 
    
 
942
        Py_RETURN_NONE;
 
943
 
952
944
    if (freqtmp) {
953
945
        PyObject_CallMethod((PyObject *)self, "setFreq", "O", freqtmp);
954
946
    }
965
957
        PyObject_CallMethod((PyObject *)self, "setAdd", "O", addtmp);
966
958
    }
967
959
            
968
 
    Py_INCREF(self->stream);
969
960
    PyObject_CallMethod(self->server, "addStream", "O", self->stream);
970
961
 
971
962
    Server_generateSeed((Server *)self->server, LFO_ID);
974
965
    
975
966
    (*self->mode_func_ptr)(self);
976
967
 
977
 
    Py_INCREF(self);
978
 
    return 0;
 
968
    return (PyObject *)self;
979
969
}
980
970
 
981
971
static PyObject * LFO_getServer(LFO* self) { GET_SERVER };
1113
1103
static PyMethodDef LFO_methods[] = {
1114
1104
    {"getServer", (PyCFunction)LFO_getServer, METH_NOARGS, "Returns server object."},
1115
1105
    {"_getStream", (PyCFunction)LFO_getStream, METH_NOARGS, "Returns stream object."},
1116
 
    {"deleteStream", (PyCFunction)LFO_deleteStream, METH_NOARGS, "Remove stream from server and delete the object."},
1117
1106
    {"play", (PyCFunction)LFO_play, METH_VARARGS|METH_KEYWORDS, "Starts computing without sending sound to soundcard."},
1118
1107
    {"out", (PyCFunction)LFO_out, METH_VARARGS|METH_KEYWORDS, "Starts computing and sends sound to soundcard channel speficied by argument."},
1119
1108
    {"stop", (PyCFunction)LFO_stop, METH_NOARGS, "Stops computing."},
1207
1196
    0,                                              /* tp_descr_get */
1208
1197
    0,                                              /* tp_descr_set */
1209
1198
    0,                                              /* tp_dictoffset */
1210
 
    (initproc)LFO_init,                          /* tp_init */
 
1199
    0,                          /* tp_init */
1211
1200
    0,                                              /* tp_alloc */
1212
1201
    LFO_new,                                     /* tp_new */
1213
1202
};