Volunteer needed for Mac build of DspFilters

I need a volunteer who can check out the sources for DspFilters from Google code SVN and build it for Mac. There’s no XCode project file or anything, just raw sources.

In theory, it should work without changes. Private message me or reply here! Thanks.

I downloaded the source code and made a project.
There are errors with:
#include <type_traits>
I quickly googled it and it seems to be Windows only.
I am not very familiar with advanced template and have no time to found the solution for the moment. I will have more time next week (I hope).



I fixed the problem with type_traits and missing tr1::bind

I’ll check it


OK, in biquad.h, here:

[code]void process (int numSamples,
Sample* dest,
StateType& state,
PoleZeroForm zPrev) const
PoleZeros z (*this);
double t = 1. / numSamples;
complex_t dp0 = (z.pole[0] - zPrev.pole[0]) * t;
complex_t dp1 = (z.pole[1] - zPrev.pole[1]) * t;
complex_t dz0 = (z.zero[0] - zPrev.zero[0]) * t;
complex_t dz1 = (z.zero[1] - zPrev.zero[1]) * t;
double dg = (z.gain - zPrev.gain) * t;

while (--numSamples >= 0)
  zPrev.pole[0] += dp0;
  zPrev.pole[1] += dp1;
  zPrev.zero[0] += dz0;
  zPrev.zero[1] += dz1;
  zPrev.gain += dg;

  *dest++ = state.process (*dest, Biquad (zPrev));


z is declared as a PoleZeros type, which has members poles and zeros. The code calls ‘pole[0]’ though. GCC won’t pass it, although the code being in the .h made it hard to dig out. Not sure how windows liked it? What’s the intent? Should z be a PoleZero, not a PoleZeros?


In polefilter.h, shouldn’t this:

[code] complex_t& pole (int index)
assert (index >= 0 && index < m_numPoles);
return poleArray[index];

complex_t& zero (int index)
  assert (index >= 0 && index < m_numPoles);
  return zeroArray[index];


be this:

[code] complex_t& pole (int index)
assert (index >= 0 && index < m_numPoles);
return m_poleArray[index];

complex_t& zero (int index)
  assert (index >= 0 && index < m_numPoles);
  return m_zeroArray[index];


Again, how does Windows pass it? There’s more stuff that seems related to visibility - not found in this scope stuff, and it’s in classes that inherit and are templated. Still looking.



template <typename Sample> Sample process (const Sample in, const detail::BiquadBase& s) { double d2 = m_v2 = m_v1; double d1 = m_v1 = m_v0; double a1i = 1. / s.getA1(); double d0 = m_v0 = in - (s.getA1() * d1 + s.getA2() * d2) * a1i; double out = (s.getB0() * d0 + s.getB1() * d1 + s.getB2() * d2) * a1i + ac(); return static_cast<Sample> (out); }

s.getB0 -> s.getB0()

I am going to run headlong into a wall on some things, like I have:

…/…/include/DspFilters/DspFilter.h:237:0 ‘i’ was not declared in this scope in …/…/include/DspFilters/DspFilter.h

That’s a bit hard to find without micro-analyzing every line in state.h.


Ok, something clicked in Xcode, it’s being more helpful.

DspFilter.h, envelopefollower class this was ‘i’:

Value operator[] (int channel) const { return m_env[channel]; }

And in the same class, what should ‘s’ be?

[code] void Process (size_t samples, const Value** src)
for( int i=0; i<Channels; i++ )
const Ty* cur = src[i];

  CalcT e = m_env[i];
  for (int n = samples; n; n--)
    double v = ::fabs(*s++);
    if (v > e)
      e = m_a * (e - v) + v;
      e = m_r * (e - v) + v;


‘Ty*’ also gets flagged and I can’t find the definition of it.

Also coming up, tr1:is_pod isn’t found.

Sorry this is so piecemeal - it seems that since the code is in includes, the definition fails and subsequent code is borked, maybe?


I see what’s going on.

Visual C++ doesn’t actually check the validity of template functions until they are invoked. GCC on the other hand, does a full syntax / symbol checking (well, to the extent that it is possible without knowing the template arguments).

Let me work on it a little bit and look at those examples you gave me.

Okay I installed Qt creator and I am building using GCC and getting the same errors. Don’t mess with DspFilters any more until I have fixed all of these errors - I will post a message.

Unfortunately…there are a lot of errors :frowning:

Sometimes Visual Studio is a pain in the ass.

All errors fixed.

Juce 1.52 generates tons of warnings under gcc. Give it a whirl!

OK, reverted and updated.

Lots of warnings about classes with virtual methods but no virtual destructor… but pretty good compared… whammo! The juce_amalgamted file stops us. This may be that we need the objective C++ wrapper. Yup, we had both, when I dropped all the files into jucer. Pulled that, building again.

Here’s something real - In the PoleZeroForm (Biquad) constructor:

[code]/Users/brucewheaton/Documents/Code Examples Snippets SDKs/DspFilters/trunk/Builds/MacOSX/…/…/source/Biquad.cpp:19:0 /Users/brucewheaton/Documents/Code Examples Snippets SDKs/DspFilters/trunk/Builds/MacOSX/…/…/source/Biquad.cpp:19: error: call of overloaded ‘isnan(Dsp::complex_t&)’ is ambiguous

…/…/include/DspFilters/MathSupplement.h:69:0 …/…/include/DspFilters/MathSupplement.h:69: note: candidates are: bool Dsp::isnan(Ty) [with Ty = std::complex]

/usr/include/c++/4.2.1/cmath:551:0 /usr/include/c++/4.2.1/cmath:551: note: int std::isnan(_Tp) [with _Tp = std::complex][/code]

Probably quicker for you to hit it than me dig around…

Apparently std::is_nan() is declared for you but not me. I fixed it (using Dsp::is_nan()). It should build now.

OK, you got it. So, I have a jucer file and xcode project. The jucer file is unusual in that you added the juce amalgamated, so it is set to ‘don’t link to juce’ which could be confusing. You may want to consider moving to a jucer generated project - it’s pretty nifty, and covers the other platforms for free. Mostly would just need to change a few include statements.

Also, to be Mac friendly (for the demo) you should consider native windows and Mac toolbar.

Good deal! I’m in Starbucks, so I can’t listen much, but it looks awesome.


Wait…you’re saying it runs?? WOOHOO!!

I don’t understand what you mean by a Jucer-generated project. I don’t use Jucer, at all. What’s wrong with just having the xcode file? And why shouldn’t I just include the amalgamation in the demo?

I want to have this source code set up so all someone has to do is download it, open the appropriate file for their build environment (visual studio project file, xcode project file, Linux Makefile) build without error, and run. I checked in a qmake .pro file, will that be sufficient for Linux ?

OK, fun to play with too.

Well, the jucer file will let you build reasonable build setups for most platforms for your project. Right now, you get iOS, MacOSX, MSVC6, VS2005, 2008, 2010, and I guess soon Android.

I use Linux for our video playback product, so I do a fair amount of Linux, but qmake and .pro doesn’t mean much to me, so I’ll guess no, that wouldn’t be ‘simple’ on Linux. The situation on Linux is that there’s 4-5 build systems, and then there’s 4-5 different ‘package’ systems that install libraries, sometimes using source code. The default though is a make file. Most of the other systems end up generating a make file.

Hey, it looks like jucer doesn’t make a Linux build? What gives?

But yes, you could just add an Xcode project. Main difference would be that when you add or remove files or settings, you can regen the xcode project at the same time.

Hey - I only have the RBJ filter active though - the others are greyed out.


Yeah they are still in development. Got a girl coming in through sunday so I won’t be able to get back to it until then but I’m thinking by the end of next week everything should be working. I will have something new checked in Monday night at the latest for sure, probably earlier.

Redesigning the templates to be more user friendly and flexible, while still retaining performance, has proven to be quite a challenge but I got the Butterworth working with the new class design and I think that the results will be very appealing once I tidy everything up.

The current checkin uses the “SmoothedFilter” implementation by default, which modulates interpolates parameters over time to give good subjective characteristics. You can hammer the filter knobs and it shouldn’t sound bad.

Also, there’s a pitch slider that uses the juce::ResamplingAudioSource to achieve time stretching with the ratio adjusted dynamically and the result is pretty awesome. I implemented my own simple per-sample linear interpolation of the resampling ratio, and you can tweak the block size up from 1 sample by changing it in AudioOutput.cpp.

So overall I’m pretty happy with this demo so far, almost done with the most difficult part which is refactoring all the classes and then after that its just porting over the existing filter formulas which I consider gravy. Although in the process I’m hoping to fix some flaws with the original filter designs, such as the singularity with the Chebyshev I shelves when the shelf gain is less than the ripple dB.

I’m confused. Are you saying that Jucer can produce a .vcproj file?

Yes, the experimental jucer makes projects - that’s about all it does right now. I moved to using it to get separate iOS and Mac projects, but it acts as an awesome ‘wizard’ to make projects.

You can either just kick things off, or try to keep it in sync and add files through it. Since it’s the new wave, Jules is keen on making sure it can be your ‘one stop shop’ for starting a project. There’s even code editing, though not really up to platform tools yet.


[attachment=0]jucer results.tiff[/attachment]

I just checkout the new sources.
Everything is compiling ok.
But there is some assert when I close the app.
In ThreadQueue destructor (I think you forgot to call audioDeviceStopped because it is the only place where you close the queue).
Tell me if you want the Xcode project.