Choosing the right template for your application can be a tricky task at first and inheriting from the right class from the start can give a tremendous boost in productivity. In this tutorial we explore the different template projects that the Projucer offers and the main classes to watch for when conceiving your applications.
Level: Beginner
Platforms: Windows , macOS , Linux , iOS , Android
Classes: JUCEApplication, Component, AudioAppComponent, AnimatedAppComponent, OpenGLAppComponent, AudioProcessor, AudioProcessorEditor
Please make sure you are familiar with the Projucer and have a basic understanding of the structure of a Projucer project.
If you need help with this step, see Tutorial: Projucer Part 1: Getting started with the Projucer.
Depending on the project you are developing, you may want to choose a different template project from the Projucer wizard. The following graph provides a visual questionnaire to help you choose the best template for your project:
You can navigate to the corresponding project type right away or read along for an explanation of how a JUCE project is structured.
All GUI project templates will provide you with source files to get you started in your development. Since the application will display a graphical user interface, the template provides you with a Main.cpp file in which a class derived from JUCEApplication will have been created.
The JUCEApplication class is an abstract base class that provides startup and shutdown functionalities for your applications. The Main.cpp file also creates the application window in which your GUI will reside.
The GUI Application project is the most generic of all GUI projects and in addition to the Main.cpp file, it also creates a MainComponent class derived from the Component class.
The Component class is a base class for all user-interface objects in JUCE. All your GUI elements should be defined and placed in the MainComponent class.
When a GUI Application project is created you will find the following files in the source folder:
Use this project type when you know you will need a GUI in your application but are unsure or need flexibility as to the features of your application.
The Audio Application is similar to the GUI Application but instead of the MainComponent deriving from the Component class, it derives from the AudioAppComponent class.
The AudioAppComponent class is an abstract base class that combines the functionalities of a Component with an AudioSource to provide a convenient starting point to handle audio input/output.
When an Audio Application project is created you will find the following files in the source folder:
Use this project type when you want audio input/output functionalities with a GUI in your application.
The Animated Application is similar to the GUI Application but instead of the MainComponent deriving from the Component class, it derives from the AnimatedAppComponent class.
The AnimatedAppComponent class is an abstract base class that combines the functionalities of a Component with a Timer to provide a convenient starting point to display animations.
When an Animated Application project is created you will find the following files in the source folder:
Use this project type when you want to create simple animations in the GUI of your application.
The OpenGL Application is similar to the GUI Application but instead of the MainComponent deriving from the Component class, it derives from the OpenGLAppComponent class.
The OpenGLAppComponent class is an abstract base class that combines the functionalities of a Component with an OpenGLRenderer to provide a convenient starting point to render complex graphics.
When an OpenGL Application project is created you will find the following files in the source folder:
Use this project type when you want to render complex graphical elements using OpenGL in the GUI of your application.
When a Console Application project is created you will find the following file in the source folder:
When the binary is executed in the command line, the following function will be called:
This project type will not create any classes in the Main.cpp file nor inherit any base classes but will create a .jucer file and a JUCE library code folder along with any exporter you may have chosen when creating the project.
Use this project type when you do not need a GUI in your application and want to run the application in a command line console.
The Audio Plugin project has an all around different project structure compared to other template projects offered by the Projucer and creates an AudioProcessor and an AudioProcessorEditor.
The AudioProcessor class is an abstract base class that handles the audio processing of your audio plugin. It represents an instance of a loaded plugin and is wrapped by the different plugin formats such as VST, AU, RTAS and AAX.
The AudioProcessorEditor class is a base class derived from the Component class and holds the GUI functionalities of your audio plugin.
When an Audio Plugin project is created you will find the following files in the source folder:
Use this project type when you want to create a plugin that can be hosted in a DAW or as a standalone application with a GUI.
In case your interest lies in creating a library to use in other projects, the Projucer offers an option to create static and dynamic libraries.
This project type will not create any source files but will create a .jucer file and a JUCE library code folder along with any exporter you may have chosen when creating the project.
You are then free to add files as you wish with the convenience of having access to the JUCE modules at any time.
In this tutorial, we have learnt the different types of Projucer template projects. In particular, we have: