Processor ignoring parameter changes while smoke testing

I have a plugin that uses the AudioProcessorValueStateTree. While debugging some nasty “std::variant” related bug I have tried to set up a smoke test by just using the static library of the plugin and emulating calls.

The thing is that I can see that I set the parameters correctly, I can even print out its value and it is correct, but the value changes aren’t seen from the audio processor. It works perfectly on the host. Am I missing some call? All parameters are AudioParameterInt.

#include <optional>

#include <gtest/gtest.h>

#include <juce_audio_processors/juce_audio_processors.h>

extern juce::AudioProcessor* JUCE_CALLTYPE createPluginFilter();

class smoke_test : public ::testing::Test {
  smoke_test() {}

  void SetUp()
    float io_cfg = ((float) 0x8421) / ((float) 0xffff);

    plugin.reset (createPluginFilter());
    audio.setSize (8, 128);
    plugin->prepareToPlay (44100, 1024);

    for (juce::AudioProcessorParameter* param : plugin->getParameters()) {
      juce::String name = param->getName (64);
      if (name == "fx_type_01") {
        fx_type_param = param;
      else if (name == "in_selection") {
        ins_param = param;
        param->setValue (io_cfg);
      else if (name == "out_selection") {
        outs_param = param;
        param->setValue (io_cfg);
    ASSERT_TRUE (fx_type_param != nullptr);
    ASSERT_TRUE (ins_param != nullptr);
    ASSERT_TRUE (outs_param != nullptr);

  void TearDown()

  std::optional<juce::ScopedJuceInitialiser_GUI> gui_emu;
  std::unique_ptr<juce::AudioProcessor>          plugin;
  juce::AudioBuffer<float>                       audio;
  juce::AudioProcessorParameter*                 fx_type_param = nullptr;
  juce::AudioProcessorParameter*                 ins_param     = nullptr;
  juce::AudioProcessorParameter*                 outs_param    = nullptr;
  juce::MidiBuffer                               midi;
TEST_F (smoke_test, run_all_fx_on_ch1)
  float interval = 1. / fx_type_param->getNumSteps();
  for (float v = 0.; v <= 1.; v += interval) {
    fx_type_param->setValue (v);
    plugin->processBlock (audio, midi);

I can add this to each parameter and they get the expected values. It is just the processor that ignores them…

printf("%s\n", param->getText (param->getValue(), 0).toRawUTF8());

How are you reading the values in the processor?

If you’re using APVTS::getRawParameterValue, the APVTS only updates its unnormalised representation when it receives a parameter change callback. You can trigger the callback by using setValueNotifyingHost rather than just setValue.

You nailed it, I’m using getRawParameterValue and setValueNotifyingHost did the trick. I don’t know how I missed that one when looking at the reference.

Thank you!