Im currently trying to create my first bigger project, however it doesn’t work and i don’t really know why.
I’m trying to create a plugin using a distortion algorithm i created. The algorithm is located in “dsp/ExoAlgo.cpp” & “dsp/ExoAlgo.h”. The Plugin should work with a processorchain located in “dsp/ExoChain.cpp” & “dsp/ExoChain.h”.
There i’ve too added a pregain and a postgain and a filter.
Why doesn’t the code work? as far as im concerned i should have implemented everything correctly.
Project is here: https://github.com/arcathrax/ExoDist
Can you clarify what “doesn’t work” exactly means?
sorry.
The project wont compile. Gives me a “LNK1120 6 unresolved externals” error.
My guess is that the PluginProcessor.cpp gets the buffer/audioblock wrong, however im no expert, thats why im here:
void ExoDistAudioProcessor::processBlock(juce::AudioBuffer<float>& buffer, juce::MidiBuffer& midiMessages)
{
float maxThreshold = *apvts.getRawParameterValue("maxThreshold");
float scalingFactor = *apvts.getRawParameterValue("Hardness");
exoChain.updateDistortion(maxThreshold, scalingFactor);
juce::dsp::ProcessContextReplacing<float> context(juce::dsp::AudioBlock<float>(buffer));
exoChain.process(context);
}
This means a function or external data was declared but not defined/implemented.
It is of interest, which symbols were not found. This is usually a problem with your project setup, like a cpp or juce module was not added to the build.
If you used Projucer, resave the project after adding the sources and make sure your IDE picked up the change.
If you used CMake, run cmake again to recreate project files.
Checked and i’ve added every cpp or juce module i am using.
The error messages should state which symbols are missing. So very simply speaking something you declared in a header is not implemented in a cpp file.
With a quick look, you have lots of templates there, but they’re not instantiated in their cpp files. Move all templated code to the header and it will work.
Separating templated code into header and cpp file mostly doesn’t work, because the compiler can’t know what these function templates will be called with. If you absolutely want to keep the templates in the cpp you need to explicitly instantiate them in the cpp file for every template parameter (or combination thereof) you’ll ever use.
^ this. And adding a classic mistake: implementing the function but forgetting the class namespace:
class Foo {
void bar();
};
// in cpp:
#include "foo.h"
void bar() { // < should be void Foo::bar()
}
It would help if you posted the error message verbatim including which symbols or externals are missing
Here are the error codes
(2 because im trying to explicitly instantiate my templates)
unresolved externalsunresolved external symbol "public: void __cdecl ExoChain::process<struct juce::dsp::ProcessContextReplacing<float> __cdecl(class juce::dsp::AudioBlock<float>)>(struct juce::dsp::ProcessContextReplacing<float> (__cdecl&)(class juce::dsp::AudioBlock<float>))" (??$process@$$A6A?AU?$ProcessContextReplacing@M@dsp@juce@@V?$AudioBlock@M@23@@Z@ExoChain@@QEAAXA6A?AU?$ProcessContextReplacing@M@dsp@juce@@V?$AudioBlock@M@23@@Z@Z) referenced in function "public: virtual void __cdecl ExoDistAudioProcessor::processBlock(class juce::AudioBuffer<float> &,class juce::MidiBuffer &)"unresolved external symbol "struct juce::dsp::ProcessContextReplacing<float> __cdecl context(class juce::dsp::AudioBlock<float>)" (?context@@YA?AU?$ProcessContextReplacing@M@dsp@juce@@V?$AudioBlock@M@23@@Z) referenced in function "public: virtual void __cdecl ExoDistAudioProcessor::processBlock(class juce::AudioBuffer<float> &,class juce::MidiBuffer &)"
