Welcome to Our Next Tutorial in the Free JUCE 6 Tutorial Series
Welcome to our JUCE 6 Tutorial FREE YouTube Tutorial Series and this Tutorial 01. In this Series Josh Hodge will introduce you to JUCE 6 and how to use it to build your own Audio Software and Plugins. Along the way, Stu Last will be adding tips, explanations and alternative approaches in our new Tutorial Supplementals. We’ll also be adding a transcription of Josh’s YouTube Tutorial to really help you get to grips with the JUCE 6 Framework.
In Tutorial 02 Josh explains the Projucer Basics and how to leverage this JUCE 6 tool to streamline you project creation and manage your workflow. Stu jumps in with an explanation of the work the Projucer does on your p>behalf, and why it’s such a useful tool.
How to use these tutorials.
Stu recommends watching Josh’s YouTube video first, and working through the examples with Josh. Then jump on over to Stu’s Tutorial Supplementary and read the additional material. You’ll find the Tutorial Supplementary and Transcription below.
Note that time indexes have been added to the beginning of each paragraph to aid in navigation around the the YouTube video.
— Transcription Begins —
Josh Hodges –
(00:00) “Hey what’s up everybody, I’d like to welcome you to another JUCE tutorial. In this tutorial we’re going to talk a little bit about the Projucer itself. So, the Projucer is what comes with, when you actually download JUCE, and it’s a way to actually get your first project started when you build your first JUCE 6 application.
(00:18) So when your first open JUCE \[sic\] (Josh means “Projucer” here), you’ll be presented with this screen, or if not, you can actually go up here to “file” and do “new project” and then this should bring up this screen. Then you can see over here on the left hand side that you have a couple of different types of application that you can actually build.
- Blank Application, which basically has nothing.
- A UI application just has basically a window where you can actually start building and using some graphics but it doesn’t have any sort of facilities for audio input and output and that sort of thing.
- Audio application which is where you can build a standalone audio application
- Plugin Application which is where you can actually build a “vst” or “au” or “aax” plug-in.
… and these are templates to help you get started. They provide you with the basic source files that you need to build that type of application…
The audio application and the basic plugin application are the ones that I tend to use. Sometimes I’ll use a UI application if I’m just trying to show an example or build something very quickly; something visual.
(1:40) For this one we’ll just use a UI application. Coming over here to the right side of your Projucer now, you can give your project a name, so I will just call this “sample”. Below that we have a module section where you can actually … JUCE is more a kind of of collection of libraries so you have different the you can include or disclude from your JUCE project. As you can see some of them are checked in here because we’re creating a template. You have others that you can include such as DSP library, you have OpenCL library, so on and so forth, but they’re not included because we don’t need them just yet. So I will just leave that as is.
(2:26) Then we have the path to the modules. Normally, at least on a Mac, those will be in the applications folder and then we have our exporter section. So we have checked in “XCode” as our choice of integrated development environment or IDE. If we were on windows then we would have “Visual Studio” and so on. That’s it, so what I can could do is actually create this project (by) just going down here to the bottom right, and hit “create project” and then I will just choose desktop. To actually create the project I hit “Open”. And now it’s created my project.
(3:13) So once it’s created the project, then you have your source files here. You have 3 source files, “main”, “maincomponent” and “maincomponent.cpp” – we’ll go through those in future tutorials and show you some of the basics around those.
(3:31) Those are your source files, and then, below that, you have your modules section so that corresponds with what we did when we were actually creating the project, where we included certain modules. What you can do, if you want to include other modules is you can hit this plus button down here at the bottom, hit “add a module”, then I’m going to go to “Global JUCE modules path”, and what I can do is I can include something else. Now I’ll just, for example, include this juce_dsp library. Now I’ve included this we can see that it’s in red, and we have a warning down here that says “Missing Module Dependencies – Module(s) have missing dependencies”. What this means is that the JUCE DSP module depends on other modules for it to function. What I need to do is either remove the module, which will just remove the DSP module from our list of included libraries, or I can hit “add missing dependencies” and that will automatically include the other libraries that we need for the JUCE DSP module to work. So I will just click that, and now it’s included these other modules that we need for the JUCE DSP library to actually work properly.
(4:51) Down at the bottom we have exporters, so as you can see we have our XCode (MacOS) as our exporter, which is the IDE that we’re going to be using. If I click in here then we’ll see that we have these other sections and these are more for advanced features such as if you want to create compiler flags, extra linker flags or you have other libraries that you’re trying to link, you would do that in here rather than trying to do that through your IDE.
(5:20) So make sure you do that all here in the Projucer. The Projucer is a way of managing your whole project.
(5:28) And then I think that’s everything important. A lot of these I’ve never actually used myself, but they’re more kind of advanced things. Sometimes you’ll have some menus that are here in debug that aren’t in the main Xcode section and vice-versa.
(5:51) Then what else we have is the settings menu. Up here at the top in the left, if I click “project settings” then you’ll see here that I can change the project name. The main thing that you want to be concerned about here is “Add ‘Using Namespace juce” to JuceHeader.h. So I explained a little bit about that in my [last tutorial, JUCE tutorial 1](../Tutorial_01/Tutorial_01.md), so I won’t go through that again, so check that tutorial if you’re not sure what that means.
(6:26) Down here a little bit further the other thing you may want to change at some point is the C++ Language Standard – the default is C++14 – I tend to use C++ 17. These are just different updates to C++. If you needed to use an earlier version of C++ you can actually go back and check that in, so if you were using, let’s say, an external library that was using C++11, then you may need to change the C++ Language Standard there.
(7.02) Also header search paths, if you have different headers that you’re trying to link in from other libraries, and that’s the main thing.
(7:11) So once you have all of this selected and you have your options created the way you like them, you’re now ready to open this up in your IDE. You can do that up here in the centre, where it says “Save and Open in IDE”. Now I’ve just clicked that and it will open up my XCode project.
(7:36) Now we see all of our JUCE modules that we included from our Projucer and if we click in here we’ll se our source files, “main.cpp”, “maincomponent.h” and “maincomponent.cpp”. Those correspond with our files here.
(7:57) One of the main things that I can tell you that you don’t want to do is that, people, when they first get started with JUCE, they tend to start, when they want to create more source files, they’ll try to do that through the IDE. What I’ll do, just to demonstrate this for you is I will create file, let’s say a a new class or a new source file here, then I will just create this and I will call this test; I’ll hit next; and I will put this in where the rest of my source files are. Now we have this “test.cpp” and “test.hpp” that are now here. Now watch what happens if I close out XCode. You’ll notice that “test.cpp” and “test.hpp”. So if I go like this and I open it back up, now those source files are actually gone.
(9:14) What I’ll do is go back in to the folder itself (because those files actually still exist) and I will delete these. Any files that you’re trying to create, you need to create actually in the Projucer itself. This is where you manage your whole project. Files that you’re trying to create, header search paths, any sort of libraries that you’re trying to link into your project your need to do that via the Projucer.
(9:49) The way that we can do that is by going to our file explorer and then, down here at the bottom, we just hit our “plus” button. I will now do a “new CPP & Header file”. I’ll call this “test2”, then I’ll hit save. This will create the source files, and you can actually move them around, so I’ll just move them in here, into the “source” folder. Now I’ll save it and open it in IDE again, and now you see those files are there.
(10:27) So make sure that, when you’re creating new source files, that you’re actually creating that in the Projucer itself and not in the IDE, or else they will disappear and that’s very frustrating.
(10:42) Those are the basics of the Projucer, just to get your first JUCE project started. I hope you enjoyed this tutorial. Please be sure to like and subscribe and I will see you next time.
— Transcription Ends —
In this lesson Josh covers the basics of using the Projucer project management tool that comes with the JUCE 6 framework. We’ve included some supplemental explanations below for those who are less familiar with JUCE, Audio Programming and C++, along with some explanations of terms used frequently in the tutorial.
Getting and Installing JUCE.
The JUCE framework, and the related tools, are available for download as a zip file from the [JUCE website](https://juce.com/get-juce). There is no installer as such, just a collection of files that you can put where you choose. In Josh’s tutorials, the zip folder is unzipped into the application folder on is MacOS machine. On my Windows machine, I have unzipped the folder onto my C Drive, as C:/JUCE/JUCE-6. On Linux machines you will probably need to clone JUCE directly from the GitHub repository. Instructions on getting the repo via “`git clone“` are included in the Tutorial 00 of this series.
Once you’ve unzipped the folder to your desired location, the Projucer can be found in the top level of folder. It is worth, at the point of installation, just running the Projucer to make sure the paths to the JUCE library files are correct. The Projucer will tell you if it can’t find the file path, and will let you tell it where you have stored those files.
What is the Projucer?
You can think of the Projucer as a sort of file and resource management tool. C++ projects can get pretty complicated, not just in your source code files, but also in where the libraries are, what folders should be looked at for the “linker” and “header paths”. The Projucer takes care of a lot of this for you and, as a result, make life easier and cuts down on a lot of needless debugging.
The other thing the Projucer does for you is take a lot of the guesswork out of which modules you need for which project type. You don’t need to know which modules are needed to create a plugin or GUI application. Just tell Projucer that’s what you need to do, and it will go away and select the right JUCE 6 modules for the type of project you are doing.
One thing that Josh mentions is the need to do everything via the Projucer. The Projucer keeps track of everything in a set of XML files, but if you make changes in, for an example, an IDE, those changes won’t be reflected in the Projucer XML files. Basically, you should use the Projucer to manage all files, modules, libraries etc etc of your JUCE project.
Modules, Libraries and Frameworks.
You’ll hear these terms used somewhat interchangeably, but they are slightly different, so let’s take a quick look at what they mean in the context of JUCE.
A Framework is a library, or set of libraries, and usually some tools that help you create, manage and build projects. The purpose is usually to take commonly required tasks and code and save developers from having to reinvent the wheel each time they want to do something.
A library is a collection of code, usually within the same [namespace](../Tutorial_01/Supplemental.md/#why-namespaces-came-into-being), that provides functionality common to acheiving a certain goal, in the case of JUCE, audio software development using C++.
A Module is a subset of a library that provides specific functionality. The example Josh uses in the tutorial is that of the DSP module, which also requires other modules to carry out certain tasks.
A good way of looking at this is to take Josh’s DSP example in the tutorial. He’s created a project using the tools that come as part of the JUCE framework. That framework also contains a library of code containing a number of modules, some of which will be required for the GUI application, and some of which won’t. Josh can then extend the functionality of his project by adding a module (in this case DSP), which also requires other modules to work. All of the code in the modules and libraries is, thus far, part of the JUCE namespace, and the JUCE framework – although it’s important to note that a framework could well contain more than one namespace.