Using Timer without GUI

Hello Folks, I am new to JUCE and have the following problem: I want to make a console audio application without a GUI that uses a timer for checking certain flags I set in the audio thread (e.g. if a frequency/amplitude sweep has finished).

The problem is that I can’t get the timer to work without a GUI, even after I called initialise_GUI(). If i call the isTimerActive() method, it returns true, but i can’t see the message/GUI thread when i debug (I use win10 with Visual Studio 22). Also the timer callback never gets called.

I use startTimer() in the constructor of the class that inherits from timer and I already tried that in an application where I use a GUI and there it works.

Thanks in advance for your help,

You need to be running the event loop, so your code needs to do something like :

class MyTimer : public juce::Timer
    int count = 0;
    void timerCallback() override
        std::cout << "timer callback...\n";
        if (count == 5)

int main (int argc, char* argv[])
    ScopedJuceInitialiser_GUI gui_init;
    MyTimer tim;
    std::cout << "end program\n";
    return 0;

Even for a console application, I find it’s best to use a JUCEApplication and use the START_JUCE_APPLICATION macro rather than writing your own main().

Thanks a lot, now it works.