34 *phMCnv = (
void*)pData;
103 const float *
const * inputs,
104 float*
const*
const outputs,
112 int numInputChannels, numOutputChannels;
120 for(s=0; s<nSamples; s++){
124 for(; ch<numInputChannels; ch++)
130 for(; ch<nOutputs; ch++)
131 outputs[ch][s] = 0.0f;
141 for(i=0; i < numInputChannels; i++)
212 const float*
const* H,
220 saf_assert(numChannels<=MAX_NUM_CHANNELS_FOR_WAV && numChannels > 0 && numSamples > 0,
"WAV is limited to 1024 channels");
228 for(i=0; i<numChannels; i++)
229 memcpy(&(pData->
filters[i*numSamples]), H[i], numSamples *
sizeof(
float));
#define MAX_NUM_CHANNELS
Maximum number of input/output channels supported.
void saf_matrixConv_apply(void *const hMC, float *inputSig, float *outputSig)
Performs the matrix convolution.
#define saf_assert(x, message)
Macro to make an assertion, along with a string explaining its purpose.
#define SAF_CLAMP(a, min, max)
Ensures value "a" is clamped between the "min" and "max" values.
void saf_matrixConv_create(void **const phMC, int hopSize, float *H, int length_h, int nCHin, int nCHout, int usePartFLAG)
Creates an instance of matrixConv.
void utility_svvcopy(const float *a, const int len, float *c)
Single-precision, vector-vector copy, i.e.
void saf_matrixConv_destroy(void **const phMC)
Destroys an instance of matrixConv.
#define SAF_MIN(a, b)
Returns the minimum of the two values.
int matrixconv_getNumOutputChannels(void *const hMCnv)
Returns the number of output channels (the same as the number of channels in the loaded wav file)
void matrixconv_create(void **const phMCnv)
Creates an instance of matrixconv.
void matrixconv_setNumInputChannels(void *const hMCnv, int newValue)
Sets the number of input channels.
void matrixconv_destroy(void **const phMCnv)
Destroys an instance of matrixconv.
void matrixconv_process(void *const hMCnv, const float *const *inputs, float *const *const outputs, int nInputs, int nOutputs, int nSamples)
Performs the matrix convolution processing.
int matrixconv_getProcessingDelay(void *const hMCnv)
Returns the processing delay in samples (may be used for delay compensation features)
int matrixconv_getHostFs(void *const hMCnv)
Returns the samperate of the host.
void matrixconv_setEnablePart(void *const hMCnv, int newState)
Enable (1), disable (0), partitioned convolution.
int matrixconv_getNfilters(void *const hMCnv)
Returns the number of filters in the loaded wav file (number of outputs multiplied by the number of i...
int matrixconv_getFilterFs(void *const hMCnv)
Returns the samplerate of the loaded filters.
int matrixconv_getEnablePart(void *const hMCnv)
Returns a flag indicating whether partitioned convolution is enabled (1) or disabled (0)
int matrixconv_getHostBlockSize(void *const hMCnv)
Returns the currect host block size.
void matrixconv_checkReInit(void *const hMCnv)
Checks whether things have to be reinitialised, and does so if it is needed.
void matrixconv_init(void *const hMCnv, int sampleRate, int hostBlockSize)
Initialises an instance of matrixconv with default settings.
void matrixconv_refreshParams(void *const hMCnv)
Sets all intialisation flags to 1.
void matrixconv_setFilters(void *const hMCnv, const float *const *H, int numChannels, int numSamples, int sampleRate)
Loads the matrix of filters, which should have the input filters concatenated for each output.
int matrixconv_getNumInputChannels(void *const hMCnv)
Returns the number input channels.
int matrixconv_getFilterLength(void *const hMCnv)
Returns the current filter length, in samples.
A standard matrix convolver.
A standard matrix convolver.
#define MIN_FRAME_SIZE
Minimum framesize, in time-domain samples.
#define MAX_FRAME_SIZE
Maximum framesize, in time-domain samples.
void ** realloc2d(void **ptr, size_t dim1, size_t dim2, size_t data_size)
2-D realloc which does NOT retain previous data order
void * malloc1d(size_t dim1_data_size)
1-D malloc (same as malloc, but with error checking)
void * realloc1d(void *ptr, size_t dim1_data_size)
1-D realloc (same as realloc, but with error checking)
void ** calloc2d(size_t dim1, size_t dim2, size_t data_size)
2-D calloc (contiguously allocated, so use free() as usual to deallocate)
#define FLATTEN2D(A)
Use this macro when passing a 2-D dynamic multi-dimensional array to memset, memcpy or any other func...
Main structure for matrixconv.
float * filters
the matrix of filters; FLAT: nOutputChannels x nInputChannels x filter_length
float ** outputFrameTD
Output buffer; MAX_NUM_CHANNELS x hostBlockSize_clamped.
int nOutputChannels
number of output channels (same as the number of channels in the loaded wav)
int input_wav_length
length of the wav files loaded in samples (inputs are concatenated)
float ** inFIFO
Input FIFO buffer.
int host_fs
current samplerate of the host
int enablePartitionedConv
0: disabled, 1: enabled
float ** inputFrameTD
Input buffer; MAX_NUM_CHANNELS x hostBlockSize_clamped.
void * hMatrixConv
saf_matrixConv handle
int nfilters
the number of filters (nOutputChannels x nInputChannels)
float ** outFIFO
Output FIFO buffer.
int hostBlockSize_clamped
Clamped between MIN_FRAME_SIZE and MAX_FRAME_SIZE.
int hostBlockSize
current host block size
int reInitFilters
FLAG: 0: do not reinit, 1: reinit, 2: reinit in progress.
int filter_length
length of the filters (input_wav_length/nInputChannels)
int nInputChannels
number of input channels
int FIFO_idx
FIFO buffer index.
int filter_fs
current samplerate of the filters