Class names Synthesiser, SamplerVoice, etc. not found

I am going through tutorials and trying to inherit a class from Synthesiser. But this name was not found. Out of sight are also AudioFormatManager, SamplerVoice, File, ScopedPointer and some methods. I do not understand, it seems that all the necessary namespaces and libraries are connected. In Projucer, “Plugin is a Synth” and “Plugin MIDI Input” are selected. What’s the matter?

// SimpleSynth.h

#pragma once
#include "../JuceLibraryCode/JuceHeader.h"

class SimpleSynth : public Synthesiser {
	void setup();
	AudioFormatManager audioFormatManager;

// SimpleSynth.cpp

#include "SimpleSynth.h"
#define MAX_VOICES 16

void SimpleSynth::setup() {
	// add voices to our sampler
	for (int i = 0; i < MAX_VOICES; i++) {
		addVoice(new SamplerVoice());

	// set up our AudioFormatManager class as detailed in the API docs
	// we can now use WAV and AIFF files!

	// now that we have our manager, lets read a simple file so we can pass it to our SamplerSound object.
	File* file = new File("1.wav");
	ScopedPointer<AudioFormatReader> reader = audioFormatManager.createReaderFor(*file);

	// allow our sound to be played on all notes
	BigInteger allNotes;
	allNotes.setRange(0, 128, true);

	// finally, add our sound
	addSound(new SamplerSound("default", *reader, allNotes, 60, 0, 10, 10.0));

You probably need to add juce:: prefixes to the symbols that cannot be found.

These tutorials were published on May 14th, 2017. At that time, the latest version of JUCE was 5.0.1. A lot of things have changed between that version and the current one, 6.1.4.

You can read about the breaking changes in the BREAKING-CHANGES.txt file of JUCE.

1 Like

Thanks! “using namespace juce;” fixes everything. I also figured out by trial and error that I should add “#include "SimpleSynth.h” to PluginProcessor. An interesting tutorial turns out, something like “find 10 errors”. Although it may really be a breaking changes in new versions.

However, it was still not possible to make the sound file play. Perhaps it’s the tutorial itself. I’m just trying to put together a minimal code to play a sample