Loading...
Searching...
No Matches
Tutorial: Projucer Part 3: Choosing the right Projucer template for your application

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

Getting started

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.

The right template for the right project

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.

The GUI projects

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

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:

  • Main.cpp: Derived from the JUCEApplication class, it provides initialisation code for your application and window.
  • MainComponent.h: Header file for the MainComponent derived from the Component class.
  • MainComponent.cpp: Implementation file for the MainComponent derived from the Component class.

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.

Note
For more details on the GUI Application project, please refer to the tutorial Tutorial: The application window for more information.

The Audio 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:

  • Main.cpp: Derived from the JUCEApplication class, it provides initialisation code for your application and window.
  • MainComponent.cpp: Header and implementation file for the MainComponent derived from the AudioAppComponent class.

Use this project type when you want audio input/output functionalities with a GUI in your application.

Note
For more details on the Audio Application project, please refer to the tutorial Tutorial: Build a white noise generator for more information.

The Animated 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:

  • Main.cpp: Derived from the JUCEApplication class, it provides initialisation code for your application and window.
  • MainComponent.cpp: Header and implementation file for the MainComponent derived from the AnimatedAppComponent class.

Use this project type when you want to create simple animations in the GUI of your application.

Note
For more details on the Animated Application project, please refer to the tutorial Tutorial: Animating geometry for more information.

The OpenGL 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:

  • Main.cpp: Derived from the JUCEApplication class, it provides initialisation code for your application and window.
  • MainComponent.cpp: Header and implementation file for the MainComponent derived from the OpenGLAppComponent class.

Use this project type when you want to render complex graphical elements using OpenGL in the GUI of your application.

Note
For more details on the OpenGL Application project, please refer to the tutorial Tutorial: Build an OpenGL application for more information.

The Command Line project

The Console Application

When a Console Application project is created you will find the following file in the source folder:

  • Main.cpp: Provides the C-style main() function for your application to run with corresponding command line arguments.

When the binary is executed in the command line, the following function will be called:

int main (int argc, char* argv[])
{
// ..your code goes here!
return 0;
}

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 Plugin project

The Audio Plugin

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:

  • PluginProcessor.h: Header file for the PluginProcessor derived from the AudioProcessor class.
  • PluginProcessor.cpp: Implementation file for the PluginProcessor derived from the AudioProcessor class.
  • PluginEditor.h: Header file for the PluginEditor derived from the AudioProcessorEditor class.
  • PluginEditor.cpp: Implementation file for the PluginEditor derived from the AudioProcessorEditor class.

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.

Note
For more details on the Audio Plugin project, please refer to the tutorial Tutorial: Create a basic Audio/MIDI plugin, Part 1: Setting up for more information.

The Library projects

The Static/Dynamic Library

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.

Summary

In this tutorial, we have learnt the different types of Projucer template projects. In particular, we have:

  • Learnt how each template calls for a specific type of project.
  • Explored the different JUCE classes that facilitate those different projects.
  • Understood the basic mechanics of the JUCE framework.

See also

linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram