Hi, I'm not very experienced with C++ and I've been trying to figure out what this bug is.
I'm trying to make my code as modular as possible so I've put several classes in .h and .cpp files. One of them is a Note object which for now just outputs a filtered square wave when its "process" is called. I've tested that this object works so far, but when I try to initialize another custom object to test, my Note object no longer outputs the square wave, only 0. I've gone as far as creating an entirely separate Dummy class with its own header and cpp file, which does nothing and is only initialized in setup.
The only other thing I've found is that if the Dummy class doesn't have any object variables, the Note outputs a square wave as expected, but as soon as I put a single object variable in the .h file, the Note's square wave stops working. If the Dummy class has functions and a constructor that's also fine, but for some reason, object variables are a problem. It doesn't matter if the variable is private or public. Once again this Dummy class is not at all related to the Note class other than them both being included in render.cpp, declared before setup, and constructed within setup. The Dummy class/object isn't called anywhere else.
I've never encountered anything like this and am absolutely flummoxed. Next thing I'm going to try is taking the other class's functionality out of a class and just store them as functions.
Here is an example of the Dummy .h and .cpp files
/***** dummy.h *****/
#ifndef DUMMY_H
#define DUMMY_H
class Dummy
{
public:
Dummy();
private:
// int testVar_;
};
#endif
#include "dummy.h"
Dummy::Dummy()
{
// testVar_ = 0;
}