2.1.22.3.16 ocmsp_readfcf


Description

Read filter coefficients from fcf file

Syntax

int ocmsp_readfcf( double ** ppb, UINT * pnb, double ** ppa, UINT * pna, const char * filename )

Parameters

ppb
[output] filter numerator coefficients
pnb
[output] size of numerator coefficients
ppa
[output] filter denominator coefficients
pna
[output] size of denominator coefficients
filename
[input] file name

Return

Return OE_NOERROR if succeed. non-zero error code is returned (OE_OPEN_FILE_FAILED, OE_READ_FILE_FAILED)

Examples

EX1

#include <ocmsp.h>
void ocmsp_read_fcf_ex1()
{
    int nRet = 0, type = OMSP_FCF_UNKNOWN;
    const char* filename = "d:\\my_filter.fcf";
    if (0 != (nRet = ocmsp_readfcf_header(&type, filename)))
    {
        printf("ocmsp_readfcf_header failed, error code = %d\n", nRet);
        return;
    }

    if (type != OMSP_FCF_TF)
    {
        printf("fcf file is not [num den] coefficient\n");
        return;
    }
    
    double *pb = NULL, *pa = NULL;
    UINT nb = 0, na = 0;
    if( 0 != (nRet = ocmsp_readfcf(&pb, &nb, &pa, &na, filename)))
    {
        printf("ocmsp_readfcf failed, error code = %d\n", nRet);
        return;
    }

    //...
    
    //release buffer
    ocmsp_release_filter(&pb, &pa);
    nb = na = 0;            
}

Remark

See Also

ocmsp_readfcf_header, ocmsp_readfcf_sos, ocmsp_readfcf_ss

Header to Included

ocmsp.h

Reference