Main.cpp from pip vs new project wizard

I’m going through the tutorials and I’m struggling to understand how to start new projects to work on the tutorials and why the projects generated from pips differ from ones from the project wizard.

For example on the basic audio player tutorial:

The tutorial doesn’t make explicity clear if I’m supposed to start from a AudioApplication or some other variant. From context it appears that AudioApplication is the correct choice for this application. However, I’m a little unclear on why the project generated from a pip differs from one generated from the wizard and I’m not feeling very confident about the process.

For example, the project generated from pip has a MainWindow constructor that includes additional parameters:

MainWindow (const String& name, Component* c, JUCEApplication& a)

while from the wizard we get

MainWindow (String name)

Additionally there are differences in what is public/private, and various other changes related to the app variable.

I’m interested in the differences, advice on which version is more appropriate for what scenarios and advice on how to approach starting tutorials that don’t have explicit instructions on how to prepare the project before the tutorial.

1 Like

The differences between the tutorial/example projects and the templates generated by the Projucer’s new project wizards are purely stylistic - there’s not really a “right” or “wrong” way to do it and both methods are valid.

The tutorial projects are prepared for you - if you download the .zip version then you just need to open the project in your IDE of choice, or if you download the PIP then you need to drag and drop the file onto the Projucer and it will generate the project for you.

Great, that’s very helpful.

I then have a question about how the tutorials are supposed to be approached. The first few, as well as some of the graphics tutorials all seem to be of the “walkthrough” variety with steps and discussion from start to finish.

Are the remaining tutorials meant to be approached from a higher level, with the tutorial simply explaining pain points without a complete walk through?

Thank for your help.

Ok, I’ve spent some time reading through the tutorial and the header file in the pips. What I’ve gathered is that we are supposed to start with the first header file, and we progress through the tutorial adding the additional parts, finally reaching the last header file.

I’m not sure if I’m slow or dense but this was incredibly not obvious to me. I’m not sure if these tutorials are aimed at someone with more common sense or some kind of expected understanding of code tutorials, but some notes on what the intent or path you are expected to follow for the tutorial would be great. The first few tutorials seem a little more obvious in what you are starting with an what is to be accomplished through the tutorial.

I think it would be helpful to add a few lines throughout the tutorial explicitly stating the PIP provides the starting point to follow the tutorial from and that the other header files are check points, through the tutorial. Also listing at which point in the tutorial you reach the header would also be useful. I might be sufficient to clarify the language in the “Getting Started” section, but when you say “Download the demo project for this tutorial here” it makes it sound like it’s already complete, especially considering each header file compiles and works.

I’m not sure if I’m being clear at this stage, I hope I am, but I was essentially confused by the goal of the tutorial and how I was supposed to follow it, some additional information on what the process to follow for the tutorials would be really helpful.


The tutorials do point out which header file should be used. For example in the “Build an audio player” tutorial that you posted above, there are notes which say:

The source code for this modified version of the application can be found in the PlayingSoundFilesTutorial_02.h file of the demo project.


The source code for this exercise can be found in the PlayingSoundFilesTutorial_03.h file of the demo project.

Yes, but you don’t actually start the tutorial by saying to begin with the first header file and those notes are at the bottom of the summary. There’s no guarantee I’d even get to the bottom of the page if I don’t know how to start, and there wasn’t any indication from the beginning that information would be present at the end.

The information may be “all there”, but it isn’t obvious, it would probably be beneficial to add more information actually explicitly stating these instructions since a major goal of 5.3 was making on boarding for new JUCE users easier.

I totally understand that it may not be obvious, I’ll add a note to the beginning of the tutorial indicating to start with the first header file. Thanks for the feedback!

1 Like

I have the same question about the structure of the tutorials vs. a new project from the Projucer wizard. Thanks for posting this almaclaine.

Can someone explain their way to navigate from a new project to recording/playing audio?

Two main points of confusion for me are that the tutorials (AudioPlaybackDemo) has only a Main.cpp & AudioPlaybackDemo.h while a project created from the Application>Audio ‘template’ creates a Main.cpp, MainComponent.h and a MainComponent.cpp. I understand that the equivalent to the tutorial are the Main.cpp and the MainComponent.h but the extra MainComponent.cpp has more unique methods like prepareToPlay that are not really used in the AudioPlaybackDemo.

I am just trying to wrap my head around these tutorials in order to write my own apps, like a standalone play + record app. I am struggling to determine where/how to start…