I have my basic GUI system for a synth starting to come together so I want to start adding sound from some tutorials I’m following.
However, it doesn’t seem to work and I can’t understand why. For example, the basic code from the Sine Synth Tutorial is:
class MainContentComponent : public AudioAppComponent
{
public:
MainContentComponent()
{
addAndMakeVisible (frequencySlider);
frequencySlider.setRange (50.0, 5000.0);
frequencySlider.setSkewFactorFromMidPoint (500.0); // [4]
frequencySlider.onValueChange = [this]
{
if (currentSampleRate > 0.0)
updateAngleDelta();
};
setSize (600, 100);
setAudioChannels (0, 2); // no inputs, two outputs
But I can’t even get this to work in my design. My otherwise “working” GUI demo has a MainContentComponent that inherits from Component. But this does not seem to let me do things like setAudioChannels(0, 2);
If I try to make it or a new class that inherits from AudioAppComponent it tells me that doesn’t exist. I don’t get it.
If I started this project by selecting “GUI Application” would that cause problems? What am I supposed to do to fix this so I can get the basic audio functions working?
Also is there a difference in concept between “MainComponent” and “MainContentComponent”? I see some demos use one or the other.
Thanks.
Edit: I presume this has to do with what you select when you start a project and there’s no turning back after that. Started an “Audio Application” instead and copied my GUI code into it to integrate and now I can do all those commands.