0

I want to initialise a the EQ class in FilePlayerGui? In the header file for FilaPlayerGui I have this line in the private section

EQ& eq;

This is the FilePlayerGui constructor

FilePlayerGui::FilePlayerGui (FilePlayer& filePlayer_) : filePlayer (filePlayer_), waveform(2), eq(eq)

This is the EQ constructor

EQ::EQ() : filter{44100, 44100, 44100}
{
filter[0].FilterConfig(kLPF, 250, 0);
filter[1].FilterConfig(kBPF, 1125, 1750);
filter[2].FilterConfig(kHPF, 2000, 0);

for(int counter = 0; counter < 3; counter++)
{
    freqGain[counter] = 0;
}


}

When I try to run my program with the code as it is above I get an error that says "Juce Message Thread (1): EXC_BAD_ACCESS (code=1, address=0x5900)"

Sorry if this is a simple solution or I'm doing something completely wrong, not good with initialising things

harry97uk
  • 33
  • 5
  • 1
    Is `eq(eq)` initializing `eq` to refer to itself? What is it suppose to refer to? I'm not sure you meant `eq`to be a reference. Did you mean to just have `EQ eq;` instead? – François Andrieux Jan 09 '18 at 19:12
  • Did you intent to pass an `EQ` in as a constructor parameter? Because that's the only way to initialize your reference `EQ& eq;`. – Galik Jan 09 '18 at 19:27
  • @Galik yes thats what I want to do that but I'm not sure how – harry97uk Jan 09 '18 at 19:31
  • Do the same thing you did with `FilePlayer&` in the constructor arguments: `FilePlayerGui (FilePlayer& filePlayer, EQ& eq) ...` – Galik Jan 09 '18 at 19:36
  • @Galik Ah I knew it was something silly, I tried putting it in a different bracket, thank you for your help – harry97uk Jan 09 '18 at 19:50
  • https://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list – Galik Jan 09 '18 at 19:52

0 Answers0