Fixed some bugs. Lrftubes is temporarily disabled on this branch
This commit is contained in:
parent
1678a0767a
commit
9005bda017
@ -68,6 +68,7 @@ endif(LASP_FLOAT STREQUAL "double")
|
|||||||
|
|
||||||
# ##################### END Cmake variables converted to a macro
|
# ##################### END Cmake variables converted to a macro
|
||||||
set(Python_ADDITIONAL_VERSIONS "3.8")
|
set(Python_ADDITIONAL_VERSIONS "3.8")
|
||||||
|
set(python_version_windll "38")
|
||||||
# #################### Setting definitions and debug-specific compilation flags
|
# #################### Setting definitions and debug-specific compilation flags
|
||||||
|
|
||||||
# General make flags
|
# General make flags
|
||||||
@ -80,11 +81,14 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
|||||||
message("Building for Windows")
|
message("Building for Windows")
|
||||||
include_directories(
|
include_directories(
|
||||||
..\\rtaudio
|
..\\rtaudio
|
||||||
C:\\mingw\\include\\OpenBLAS
|
C:\\mingw\\mingw64\\include\\OpenBLAS
|
||||||
|
link_directories(C:\\Users\\User\\miniconda3\\Library\\include)
|
||||||
)
|
)
|
||||||
add_definitions(-DMS_WIN64)
|
add_definitions(-DMS_WIN64)
|
||||||
link_directories(C:\\mingw\\lib)
|
link_directories(C:\\mingw\\mingw64\\lib)
|
||||||
link_directories(C:\\mingw\\bin)
|
LINK_DIRECTORIES(C:\\Users\\User\\miniconda3)
|
||||||
|
link_directories(C:\\mingw\\mingw64\\bin)
|
||||||
|
link_directories(C:\\mingw\\mingw64\\bin)
|
||||||
link_directories(..\\rtaudio)
|
link_directories(..\\rtaudio)
|
||||||
link_directories(C:\\Users\\User\\Miniconda3)
|
link_directories(C:\\Users\\User\\Miniconda3)
|
||||||
add_definitions(-DHAS_RTAUDIO_WIN_WASAPI_API)
|
add_definitions(-DHAS_RTAUDIO_WIN_WASAPI_API)
|
||||||
|
@ -17,5 +17,5 @@ set_source_files_properties(wrappers.c PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS
|
|||||||
cython_add_module(wrappers wrappers.pyx)
|
cython_add_module(wrappers wrappers.pyx)
|
||||||
target_link_libraries(wrappers lasp_lib)
|
target_link_libraries(wrappers lasp_lib)
|
||||||
if(win32)
|
if(win32)
|
||||||
target_link_libraries(wrappers python37)
|
target_link_libraries(wrappers python${python_version_windll})
|
||||||
endif(win32)
|
endif(win32)
|
||||||
|
@ -17,6 +17,7 @@ add_library(lasp_lib
|
|||||||
lasp_mq.c
|
lasp_mq.c
|
||||||
lasp_siggen.c
|
lasp_siggen.c
|
||||||
lasp_worker.c
|
lasp_worker.c
|
||||||
|
lasp_nprocs.c
|
||||||
lasp_dfifo.c
|
lasp_dfifo.c
|
||||||
lasp_firfilterbank.c
|
lasp_firfilterbank.c
|
||||||
lasp_sosfilterbank.c
|
lasp_sosfilterbank.c
|
||||||
|
@ -68,7 +68,11 @@ static inline PyObject *data_to_ndarray(void *data, int n_rows, int n_cols,
|
|||||||
// Note that in general it was disadvised to build all C code with MinGW on
|
// Note that in general it was disadvised to build all C code with MinGW on
|
||||||
// Windows. We do it anyway, see if we find any problems on the way.
|
// Windows. We do it anyway, see if we find any problems on the way.
|
||||||
PyObject *capsule = PyCapsule_New(data, "data destructor", capsule_cleanup);
|
PyObject *capsule = PyCapsule_New(data, "data destructor", capsule_cleanup);
|
||||||
PyArray_SetBaseObject(arr, capsule);
|
int res = PyArray_SetBaseObject(arr, capsule);
|
||||||
|
if(res != 0) {
|
||||||
|
fprintf(stderr, "Failed to set base object of array!");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
/* fprintf(stderr, "============Ownership transfer================\n"); */
|
/* fprintf(stderr, "============Ownership transfer================\n"); */
|
||||||
PyArray_ENABLEFLAGS(arr, NPY_OWNDATA);
|
PyArray_ENABLEFLAGS(arr, NPY_OWNDATA);
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
#include "lasp_sosfilterbank.h"
|
#include "lasp_sosfilterbank.h"
|
||||||
#include "lasp_mq.h"
|
#include "lasp_mq.h"
|
||||||
#include "lasp_worker.h"
|
#include "lasp_worker.h"
|
||||||
#include <sys/sysinfo.h>
|
#include "lasp_nprocs.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct Sosfilterbank {
|
typedef struct Sosfilterbank {
|
||||||
@ -89,7 +90,7 @@ Sosfilterbank* Sosfilterbank_create(
|
|||||||
vd_free(&imp_response);
|
vd_free(&imp_response);
|
||||||
|
|
||||||
us nthreads;
|
us nthreads;
|
||||||
us nprocs = (us) get_nprocs();
|
us nprocs = getNumberOfProcs();
|
||||||
|
|
||||||
if(nthreads_ == 0) {
|
if(nthreads_ == 0) {
|
||||||
nthreads = min(max(nprocs/2,1), filterbank_size);
|
nthreads = min(max(nprocs/2,1), filterbank_size);
|
||||||
|
@ -11,7 +11,7 @@ if(LASP_ULDAQ)
|
|||||||
list(PREPEND cpp_daq_linklibs uldaq)
|
list(PREPEND cpp_daq_linklibs uldaq)
|
||||||
endif()
|
endif()
|
||||||
if(win32)
|
if(win32)
|
||||||
list(APPEND cpp_daq_linklibs python)
|
list(APPEND cpp_daq_linklibs python${python_version_windll})
|
||||||
endif(win32)
|
endif(win32)
|
||||||
|
|
||||||
add_library(cpp_daq ${cpp_daq_files})
|
add_library(cpp_daq ${cpp_daq_files})
|
||||||
|
@ -50,11 +50,12 @@ const DataType dtype_invalid;
|
|||||||
const DataType dtype_fl32("32-bits floating point", 4, true);
|
const DataType dtype_fl32("32-bits floating point", 4, true);
|
||||||
const DataType dtype_fl64("64-bits floating point", 8, true);
|
const DataType dtype_fl64("64-bits floating point", 8, true);
|
||||||
const DataType dtype_int8("8-bits integers", 1, false);
|
const DataType dtype_int8("8-bits integers", 1, false);
|
||||||
|
const DataType dtype_int24("24-bits integers", 1, false);
|
||||||
const DataType dtype_int16("16-bits integers", 2, false);
|
const DataType dtype_int16("16-bits integers", 2, false);
|
||||||
const DataType dtype_int32("32-bits integers", 4, false);
|
const DataType dtype_int32("32-bits integers", 4, false);
|
||||||
|
|
||||||
const std::vector<DataType> dataTypes = {
|
const std::vector<DataType> dataTypes = {
|
||||||
dtype_int8, dtype_int16, dtype_int32, dtype_fl32, dtype_fl64,
|
dtype_int8, dtype_int16,dtype_int24, dtype_int32, dtype_fl32, dtype_fl64,
|
||||||
};
|
};
|
||||||
|
|
||||||
class DaqApi {
|
class DaqApi {
|
||||||
|
@ -5,10 +5,7 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#if MS_WIN64
|
#if MS_WIN64
|
||||||
// #include <inttypes.h>
|
|
||||||
// #include <stdint.h>
|
|
||||||
typedef uint8_t u_int8_t;
|
typedef uint8_t u_int8_t;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using std::atomic;
|
using std::atomic;
|
||||||
@ -24,7 +21,10 @@ void fillRtAudioDeviceInfo(vector<DeviceInfo> &devinfolist) {
|
|||||||
for(us devno = 0; devno< count;devno++) {
|
for(us devno = 0; devno< count;devno++) {
|
||||||
|
|
||||||
RtAudio::DeviceInfo devinfo = rtaudio.getDeviceInfo(devno);
|
RtAudio::DeviceInfo devinfo = rtaudio.getDeviceInfo(devno);
|
||||||
|
if(!devinfo.probed) {
|
||||||
|
// Device capabilities not successfully probed. Continue to next
|
||||||
|
continue;
|
||||||
|
}
|
||||||
DeviceInfo d;
|
DeviceInfo d;
|
||||||
switch(api){
|
switch(api){
|
||||||
case RtAudio::LINUX_ALSA:
|
case RtAudio::LINUX_ALSA:
|
||||||
@ -71,12 +71,18 @@ void fillRtAudioDeviceInfo(vector<DeviceInfo> &devinfolist) {
|
|||||||
if(formats & RTAUDIO_SINT16) {
|
if(formats & RTAUDIO_SINT16) {
|
||||||
d.availableDataTypes.push_back(dtype_int16);
|
d.availableDataTypes.push_back(dtype_int16);
|
||||||
}
|
}
|
||||||
|
if(formats & RTAUDIO_SINT32) {
|
||||||
|
d.availableDataTypes.push_back(dtype_int24);
|
||||||
|
}
|
||||||
if(formats & RTAUDIO_SINT32) {
|
if(formats & RTAUDIO_SINT32) {
|
||||||
d.availableDataTypes.push_back(dtype_fl32);
|
d.availableDataTypes.push_back(dtype_fl32);
|
||||||
}
|
}
|
||||||
if(formats & RTAUDIO_FLOAT64) {
|
if(formats & RTAUDIO_FLOAT64) {
|
||||||
d.availableDataTypes.push_back(dtype_fl64);
|
d.availableDataTypes.push_back(dtype_fl64);
|
||||||
}
|
}
|
||||||
|
if(d.availableDataTypes.size() == 0) {
|
||||||
|
std::cerr << "RtAudio: No data types found in device!" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
d.prefDataTypeIndex = d.availableDataTypes.size() - 1;
|
d.prefDataTypeIndex = d.availableDataTypes.size() - 1;
|
||||||
|
|
||||||
|
@ -109,8 +109,10 @@ class AudioStream:
|
|||||||
"""
|
"""
|
||||||
logging.debug('AudioStream()')
|
logging.debug('AudioStream()')
|
||||||
|
|
||||||
self.running = Atomic(False)
|
# self.running = Atomic(False)
|
||||||
self.aframectr = Atomic(0)
|
# self.aframectr = Atomic(0)
|
||||||
|
self.running = False
|
||||||
|
self.aframectr = 0
|
||||||
self.avtype = avtype
|
self.avtype = avtype
|
||||||
self.siggen_activated = Atomic(False)
|
self.siggen_activated = Atomic(False)
|
||||||
|
|
||||||
@ -144,17 +146,16 @@ class AudioStream:
|
|||||||
blocksize=self.daq.nFramesPerBlock,
|
blocksize=self.daq.nFramesPerBlock,
|
||||||
dtype=self.daq.getNumpyDataType(),
|
dtype=self.daq.getNumpyDataType(),
|
||||||
)
|
)
|
||||||
self.running <<= True
|
self.running = True
|
||||||
|
|
||||||
def streamCallback(self, indata, outdata, nframes):
|
def streamCallback(self, indata, outdata, nframes):
|
||||||
"""
|
"""
|
||||||
This is called (from a separate thread) for each block
|
This is called (from a separate thread) for each block
|
||||||
of audio data.
|
of audio data.
|
||||||
"""
|
"""
|
||||||
if not self.running():
|
if not self.running:
|
||||||
return 1
|
return 1
|
||||||
|
self.aframectr += 1
|
||||||
self.aframectr += 1
|
|
||||||
|
|
||||||
rv = self.processCallback(self, indata, outdata)
|
rv = self.processCallback(self, indata, outdata)
|
||||||
if rv != 0:
|
if rv != 0:
|
||||||
@ -282,7 +283,7 @@ class AvStreamProcess(mp.Process):
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.sendAllQueues(
|
self.sendAllQueues(
|
||||||
StreamMsg.streamError, avtype, "Error starting stream {str(e)}"
|
StreamMsg.streamError, avtype, f"Error starting stream {str(e)}"
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -6,12 +6,12 @@ Author: J.A. de Jong - ASCEE
|
|||||||
Description: Two-microphone impedance tube methods
|
Description: Two-microphone impedance tube methods
|
||||||
"""
|
"""
|
||||||
__all__ = ['TwoMicImpedanceTube']
|
__all__ = ['TwoMicImpedanceTube']
|
||||||
from lrftubes import Air
|
# from lrftubes import Air
|
||||||
from .lasp_measurement import Measurement
|
from .lasp_measurement import Measurement
|
||||||
from numpy import pi, sqrt, exp
|
from numpy import pi, sqrt, exp
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from scipy.interpolate import UnivariateSpline
|
from scipy.interpolate import UnivariateSpline
|
||||||
from lrftubes import PrsDuct
|
# from lrftubes import PrsDuct
|
||||||
from functools import lru_cache
|
from functools import lru_cache
|
||||||
|
|
||||||
class TwoMicImpedanceTube:
|
class TwoMicImpedanceTube:
|
||||||
@ -23,7 +23,7 @@ class TwoMicImpedanceTube:
|
|||||||
fl: float = None,
|
fl: float = None,
|
||||||
fu: float = None,
|
fu: float = None,
|
||||||
periodic_method=False,
|
periodic_method=False,
|
||||||
mat= Air(),
|
# mat= Air(),
|
||||||
D_imptube = 50e-3,
|
D_imptube = 50e-3,
|
||||||
thermoviscous = True,
|
thermoviscous = True,
|
||||||
**kwargs):
|
**kwargs):
|
||||||
|
Loading…
Reference in New Issue
Block a user