nikeocom / qt_with_juce_example

Example project shows how to use Qt and JUCE library together

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to

First, you need to generate project in Projucer: Alt text

And now you have a generated code like this: Alt text

Dependecies

For example, i used XCode project. And now you need to get frameworks and defines from project Alt text Alt text

Qt Creator

For using a JUCE code in Qt project you need to add all sources, defines and set path to JUCE modules in project:

# Path to JUCE modules
INCLUDEPATH += /path/to/JUCE/modules

# Juce defines
DEFINES += JUCE_APP_VERSION=1.0.0 \
           JUCE_APP_VERSION_HEX=0x10000 \
           JucePlugin_Build_VST=0 \
           JucePlugin_Build_VST3=0 \
           JucePlugin_Build_AU=0 \
           JucePlugin_Build_AUv3=0 \
           JucePlugin_Build_RTAS=0 \
           JucePlugin_Build_AAX=0 \
           JucePlugin_Build_Standalone=0 \
           JucePlugin_Build_Unity=0 \
           JUCE_USE_MP3AUDIOFORMAT=1 \

For Android you can find defines in CMakeLists.txt

add_definitions("-DJUCE_ANDROID=1" "-DJUCE_ANDROID_API_VERSION=16" "-DJUCE_PUSH_NOTIFICATIONS=1" "-DJUCE_PUSH_NOTIFICATIONS_ACTIVITY=\"com/roli/juce/JuceActivity\"" "-DJUCER_ANDROIDSTUDIO_7F0E4A25=1" "-DJUCE_APP_VERSION=1.0.0" "-DJUCE_APP_VERSION_HEX=0x10000")

For OS X:

# Add framework for JUCE
    LIBS += -framework Foundation
    LIBS += -framework UIKit
    LIBS += -framework AudioToolBox
    LIBS += -framework CoreAudio
    LIBS += -framework CoreAudioKit
    LIBS += -framework CoreMIDI
    LIBS += -framework Accelerate
    LIBS += -framework Carbon
    LIBS += -framework Cocoa
    LIBS += -framework IOKit

(for other system you need to add special for OS libs)

Now JUCE code is added and we can compile it. But!

For full functionality you must run JuceApplication:

  1. Inherrit from JUCEApplication
  2. Call:
juce::JUCEApplicationBase* juce_CreateApplication();
juce::JUCEApplicationBase* juce_CreateApplication() { return new YourJuceApplicationClass();
  1. Initialise JUCE GUI (order is required):
    // Need for MessageManager
    initialiseJuce_GUI();
    // for isStandalone() == true
    juce::JUCEApplicationBase::createInstance = &juce_CreateApplication;

About

Example project shows how to use Qt and JUCE library together


Languages

Language:C++ 39.8%Language:C 24.5%Language:QMake 17.4%Language:Objective-C++ 9.8%Language:QML 8.4%