Bugfix referrring nframesperblock before assignment

This commit is contained in:
Anne de Jong 2020-10-06 13:25:01 +02:00
parent c8bfc461ce
commit fda78a6f2c

View File

@ -61,28 +61,21 @@ ctypedef struct PyStreamData:
cdef void audioCallbackPythonThreadFunction(void* voidsd) nogil:
cdef:
PyStreamData* sd
PyStreamData* sd = <PyStreamData*> voidsd
cnp.NPY_TYPES npy_format
double* inbuffer = NULL
double* outbuffer = NULL
unsigned noutchannels
unsigned ninchannels
unsigned nBytesPerChan
unsigned nFramesPerBlock
unsigned noutchannels = sd.noutchannels
unsigned ninchannels = sd.ninchannels
unsigned nBytesPerChan = sd.nBytesPerChan
unsigned nFramesPerBlock = sd.nFramesPerBlock
unsigned sw = sizeof(double)
sd = <PyStreamData*> voidsd
cdef:
double sleeptime = (<double> nFramesPerBlock)/(4*sd.samplerate);
us sleeptime_us = <us> (sleeptime*1e6);
ninchannels = sd.ninchannels
noutchannels = sd.noutchannels
nBytesPerChan = sd.nBytesPerChan
nFramesPerBlock = sd.nFramesPerBlock
with gil:
npy_format = cnp.NPY_FLOAT64