[music-dsp] DspFilters open-source library v0.8.5

Martin Eisenberg martin.eisenberg at udo.edu
Tue Jun 9 16:33:44 EDT 2009


You have code like this:

| if( r==negativeInfinity )  {
|    c=Complex( -1, 0 );
| }  else if( r==positiveInfinity )  {
|    c=Complex( 1, 0 );
| }  else  // ordinary case

First of all, "positiveInfinity" is never generated because your
prototyes are lowpass. Second, there is only one infinity in the
complex plane (lying equally in any direction) and the (LP-to-LP)
BLT maps it to z=-1. The preimage of z=1 is just s=0. So you can
simplify the code as follows:

// .h
typedef Complex Root;
extern const Root infinity;

// .cpp
#include <limits>
const Root infinity(std::numeric_limits<double>::infinity());

if( r==infinity )  {
   c=Complex( -1, 0 );
}  else  // ordinary case


Martin



More information about the music-dsp mailing list