FR: SIMD Tutorial Improvement Ideas

https://docs.juce.com/master/tutorial_simd_register_optimisation.html

After seeing someone else here struggling with this tutorial, I decided to try it myself. Just downloaded and ran the code and already noticed various workflow problems:

  1. The interface says you can drag n drop a file, but you can’t.
  2. Reopening the window makes the application forget what file you included and the parameter values. That’s pretty annoying when trying to focus on code changes or bugs.
  3. Maybe it would be cool to make an alternative version of this tutorial as a console application, so that the code base doesn’t require all this GUI code and we can focus on what’s important. Maybe even a pre-included and imported and auto-looped sound.
  4. It’s not very helpful that the tutorial reinvents what a parameter is. Gives it an unfamiliar interface.
  5. some class has this-> everywhere despite not being a templated class. idk yet if this is for a good reason, but i’ll investigate that.

Whenever I have fixed one of the remaining problems I put the solution here:


This term from the tutorial was confusing. I wasn’t familiar with the ~ operator yet but it stood out to me that ~mask was wrapped in brackets despite being basically just a single variable:

auto z = ((x + (y * 2.0f)) & mask) + (y & (~mask));

I used an endless while loop and randomized values to test if there are ever different results if ~mask is not in brackets and that doesn’t seem to be the case. I propose the following change, because finding brackets without a function can be distracting, especially when already having to deal with unfamiliar symbols:

auto z = ((x + (y * 2.0f)) & mask) + (y & ~mask);

by setting loopState in AudioFileReaderComponent to true by default and adding

play();

after init(); in the loadFile function the debugging workflow can be significantly improved by 2 clicks per build. no one will ever actively load a file but then not want to play it

3 Likes