SAF
Loading...
Searching...
No Matches
matrixconv.h

A standard matrix convolver.

A standard matrix convolver

Files

matrixconv.h (include), matrixconv_internal.h, matrixconv.c, matrixconv_internal.c

Include Header

/*
* Copyright 2019 Leo McCormack
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef __MATRIXCONV_H_INCLUDED__
#define __MATRIXCONV_H_INCLUDED__
#include "_common.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* ========================================================================== */
/* Main Functions */
/* ========================================================================== */
void matrixconv_create(void** const phMCnv);
void matrixconv_destroy(void** const phMCnv);
void matrixconv_init(void* const hMCnv,
int samplerate,
int hostBlockSize);
void matrixconv_process(void* const hMCnv,
const float *const * inputs,
float* const* const outputs,
int nInputs,
int nOutputs,
int nSamples);
/* ========================================================================== */
/* Set Functions */
/* ========================================================================== */
void matrixconv_refreshParams(void* const hMCnv);
void matrixconv_checkReInit(void* const hMCnv);
void matrixconv_setFilters(void* const hMCnv,
const float* const* H,
int numChannels,
int numSamples,
int sampleRate);
void matrixconv_setEnablePart(void* const hMCnv, int newState);
void matrixconv_setNumInputChannels(void* const hMCnv, int newValue);
/* ========================================================================== */
/* Get Functions */
/* ========================================================================== */
int matrixconv_getEnablePart(void* const hMCnv);
int matrixconv_getNumInputChannels(void* const hMCnv);
int matrixconv_getNumOutputChannels(void* const hMCnv);
int matrixconv_getHostBlockSize(void* const hMCnv);
int matrixconv_getNfilters(void* const hMCnv);
int matrixconv_getFilterLength(void* const hMCnv);
int matrixconv_getFilterFs(void* const hMCnv);
int matrixconv_getHostFs(void* const hMCnv);
int matrixconv_getProcessingDelay(void* const hMCnv);
#ifdef __cplusplus
} /* extern "C" { */
#endif /* __cplusplus */
#endif /* __MATRIXCONV_H_INCLUDED__ */
A bunch of things that are common to many of the saf examples.
int matrixconv_getNumOutputChannels(void *const hMCnv)
Returns the number of output channels (the same as the number of channels in the loaded wav file)
Definition matrixconv.c:278
void matrixconv_create(void **const phMCnv)
Creates an instance of matrixconv.
Definition matrixconv.c:29
void matrixconv_setNumInputChannels(void *const hMCnv, int newValue)
Sets the number of input channels.
Definition matrixconv.c:251
void matrixconv_destroy(void **const phMCnv)
Destroys an instance of matrixconv.
Definition matrixconv.c:61
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.
Definition matrixconv.c:101
void matrixconv_init(void *const hMCnv, int samplerate, int hostBlockSize)
Initialises an instance of matrixconv with default settings.
Definition matrixconv.c:81
int matrixconv_getProcessingDelay(void *const hMCnv)
Returns the processing delay in samples (may be used for delay compensation features)
Definition matrixconv.c:314
int matrixconv_getHostFs(void *const hMCnv)
Returns the samperate of the host.
Definition matrixconv.c:308
void matrixconv_setEnablePart(void *const hMCnv, int newState)
Enable (1), disable (0), partitioned convolution.
Definition matrixconv.c:242
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...
Definition matrixconv.c:290
int matrixconv_getFilterFs(void *const hMCnv)
Returns the samplerate of the loaded filters.
Definition matrixconv.c:302
int matrixconv_getEnablePart(void *const hMCnv)
Returns a flag indicating whether partitioned convolution is enabled (1) or disabled (0)
Definition matrixconv.c:266
int matrixconv_getHostBlockSize(void *const hMCnv)
Returns the currect host block size.
Definition matrixconv.c:284
void matrixconv_checkReInit(void *const hMCnv)
Checks whether things have to be reinitialised, and does so if it is needed.
Definition matrixconv.c:172
void matrixconv_refreshParams(void *const hMCnv)
Sets all intialisation flags to 1.
Definition matrixconv.c:166
int matrixconv_getFrameSize(void)
Returns the processing framesize (i.e., number of samples processed with every _process() call )
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.
Definition matrixconv.c:210
int matrixconv_getNumInputChannels(void *const hMCnv)
Returns the number input channels.
Definition matrixconv.c:272
int matrixconv_getFilterLength(void *const hMCnv)
Returns the current filter length, in samples.
Definition matrixconv.c:296