[SOLVED] Projucer Live Build audio input issue

I’m trying to process audio input in a Component running in the Projucer Live Build engine. It seems that audio input is not working. I made a simple PIP to demonstrate this.

It works as an app, but not in the live build engine. Does Projucer need to be built with audio input enabled?

AudioInputTest.h (3.5 KB)

 The block below describes the properties of this PIP. A PIP is a short snippet
 of code that can be read by the Projucer and used to generate a JUCE project.


  name:             AudioInputTest
  version:          1.0
  description:      Basic audio input test

  dependencies:     juce_core, juce_data_structures, juce_events, juce_graphics, juce_gui_basics, juce_audio_devices, juce_audio_utils, juce_audio_basics, juce_audio_processors, juce_gui_extra, juce_audio_formats
  exporters:        vs2017, xcode_mac


  type:             Component
  mainClass:        MainComponent



#pragma once

class MainComponent   : public AudioAppComponent, private Timer
        // Some platforms require permissions to open input channels so request that here
        if (RuntimePermissions::isRequired (RuntimePermissions::recordAudio)
            && ! RuntimePermissions::isGranted (RuntimePermissions::recordAudio))
            RuntimePermissions::request (RuntimePermissions::recordAudio,
                                         [&] (bool granted) { if (granted)  setAudioChannels (2, 2); });
            // Specify the number of input and output channels that we want to open
            setAudioChannels (2, 2);
        magnitude = -23.4;
        setSize (200, 200);

    void prepareToPlay (int samplesPerBlockExpected, double sampleRate) override {}
    void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill) override
        magnitude = bufferToFill.buffer->getMagnitude (0, bufferToFill.numSamples);
        // Right now we are not producing any data, in which case we need to clear the buffer
        // (to prevent the output of random noise)
    void releaseResources() override {}

    void paint (Graphics& g) override
        g.fillAll (getLookAndFeel().findColour (ResizableWindow::backgroundColourId));
        g.drawText(String(magnitude, 7, false), 50, 50, 200, 100, Justification::centredLeft);

    void resized() override
        // This is called when the MainComponent is resized.
        // If you add any child components, this is where you should
        // update their positions.

    void timerCallback() override
    // Your private member variables go here...
    std::atomic<float> magnitude;


Well, to answer my own question: Yes it does! It works now :slight_smile: