Simple getting started question - standalone audio processor


#1

Hi all,

Please excuse the simplicity of this post - new here to C++ and relatively new to audio programming in general.

I’ve been working through the API and demo code. I’ve had some of the basics working, the demo, and also a program to simply load and play a .wav file using AudioSource. This uses an AudioSourcePlayer to to pass into the device manager.

Now I’m trying to do some processing on a simple sine wave, and ultimately have a few controls to play with the sound, maybe frequency, amplitude etc. This is what I’m having trouble with. I think I should be using AudioProcessor here, rather than AudioSource. So I’ve tried to link up a simple source (the demo plugin source) to an AudioProcessorPlayer. I can compile, but when I debug, and stick breakpoints in the processors prepareToPlay, or processBlock methods, I’m not getting there. I hoped I would be, but guessing I’m omitting something pretty fundamental. I can accept this might not link up and play the sine synth in response to the midi keyboard in the default demo editor, but I hoped I’d get into those methods.

MainComponent.h:

private:
	AudioProcessorPlayer processorPlayer;
	AudioDeviceManager deviceManager;
	JuceDemoPluginAudioProcessor processor;

MainComponent.cpp (constructor)

deviceManager.initialise(1, 2, 0, false);

addAndMakeVisible(processor.createEditor());
processorPlayer.setProcessor(&processor);
deviceManager.addAudioCallback(&processorPlayer);

Hope this makes sense, any help gratefully received,
Matt


#2

Hmm, don’t really follow what you’re doing… :expressionless:

But I suggest that you take a look at the audio plugin host. Then derive a processor from the AudioProcessor class that does something very simple like changing the volume or something. Hook that up in the audio plugin host and get that to work. Look at how the external plugins are connected.

When you’ve got that working, move on and make another AudioProcessor that reads from your wave file. Then use that as the input source to your first processor.


#3

Alternatively, you can use the StandAloneFilterWindow class. You’ll find it in /modules/juce_audio_plugin_client