Bugfix for transposing an numpy array in code. Can only be done by calling PyArray_Transpose, not by setting flags, apparently. Fixed the lasp_recording for new member attributes of AvStream.
This commit is contained in:
parent
287b0cfe83
commit
c9ad4dc1b4
@ -39,7 +39,15 @@ static inline PyObject *data_to_ndarray(void *data, int n_rows, int n_cols,
|
||||
assert(data);
|
||||
import_array();
|
||||
|
||||
npy_intp dims[2] = {n_rows, n_cols};
|
||||
npy_intp dims[2];
|
||||
if(F_contiguous){
|
||||
dims[0] = n_cols;
|
||||
dims[1] = n_rows;
|
||||
|
||||
} else {
|
||||
dims[0] = n_rows;
|
||||
dims[1] = n_cols;
|
||||
}
|
||||
assert(n_rows > 0);
|
||||
assert(n_cols > 0);
|
||||
|
||||
@ -50,7 +58,7 @@ static inline PyObject *data_to_ndarray(void *data, int n_rows, int n_cols,
|
||||
return NULL;
|
||||
}
|
||||
if (F_contiguous) {
|
||||
PyArray_ENABLEFLAGS(arr, NPY_ARRAY_F_CONTIGUOUS);
|
||||
arr = (PyArrayObject*) PyArray_Transpose(arr, NULL);
|
||||
}
|
||||
|
||||
if (transfer_ownership == true) {
|
||||
|
@ -74,7 +74,7 @@ class SIQtys:
|
||||
level_ref_name=('1V',),
|
||||
level_ref_value=(1.0,),
|
||||
)
|
||||
types = (AP, V, N)
|
||||
types = (N, AP, V)
|
||||
default = N
|
||||
default_index = 0
|
||||
|
||||
|
@ -37,7 +37,7 @@ class Recording:
|
||||
if stream.avtype != AvType.audio_input:
|
||||
raise RuntimeError('Stream does not have any input channels')
|
||||
self.blocksize = stream.blocksize
|
||||
self.samplerate = stream.samplerate
|
||||
self.samplerate = stream.input_samplerate
|
||||
self._running = Atomic(False)
|
||||
self._running_cond = Condition()
|
||||
self.rectime = rectime
|
||||
@ -77,11 +77,11 @@ class Recording:
|
||||
|
||||
stream = self._stream
|
||||
f = self._f
|
||||
nchannels = stream.nchannels
|
||||
nchannels = len(stream.input_channel_names)
|
||||
|
||||
self._ad = f.create_dataset('audio',
|
||||
(1, stream.blocksize, nchannels),
|
||||
dtype=stream.numpy_dtype,
|
||||
dtype=stream.input_numpy_dtype,
|
||||
maxshape=(None, stream.blocksize,
|
||||
nchannels),
|
||||
compression='gzip'
|
||||
@ -96,11 +96,11 @@ class Recording:
|
||||
compression='gzip'
|
||||
)
|
||||
|
||||
f.attrs['samplerate'] = stream.samplerate
|
||||
f.attrs['nchannels'] = stream.nchannels
|
||||
f.attrs['samplerate'] = stream.input_samplerate
|
||||
f.attrs['nchannels'] = nchannels
|
||||
f.attrs['blocksize'] = stream.blocksize
|
||||
f.attrs['sensitivity'] = stream.sensitivity
|
||||
f.attrs['channel_names'] = stream.channel_names
|
||||
f.attrs['sensitivity'] = stream.input_sensitivity
|
||||
f.attrs['channel_names'] = stream.input_channel_names
|
||||
f.attrs['time'] = time.time()
|
||||
self._running <<= True
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user