/*
* Main.cpp
* MidiLFO
*
* Midi-Lfo: This is a small project using the JUCE library.
* It provides a user tweakable Midi LFO. This sends a
* (selectable) CC with LFO modulated values to a
* (selectable) Midi output.
*
* Copyright (C) 2009, Christian Stoecklmeier and Volker Duemke
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
*/
#include "includes.h"
#include "MainComponent.h"
//==============================================================================
/**
This is the top-level window that we'll pop up. Inside it, we'll create and
show a component from the MainComponent.cpp file (you can open this file using
the Jucer to edit it).
*/
class MidiLfoWindow : public DocumentWindow
{
public:
//==============================================================================
MidiLfoWindow()
: DocumentWindow (T("Midi LFO"),
Colours::lightgrey,
closeButton | minimiseButton,
true)
{
// Create an instance of our main content component, and add it
// to our window.
MainComponent* const contentComponent = new MainComponent();
setContentComponent (contentComponent, true, true);
centreWithSize (getWidth(), getHeight());
setVisible (true);
setAlwaysOnTop(true);
}
~MidiLfoWindow()
{
// (the content component will be deleted automatically, so no need to do it here)
}
//==============================================================================
void closeButtonPressed()
{
// When the user presses the close button, we'll tell the app to quit. This
// window will be deleted by our MidiLfoApplication::shutdown() method
//
JUCEApplication::quit();
}
};
//==============================================================================
/** This is the application object that is started up when Juce starts. It handles
the initialisation and shutdown of the whole application.
*/
class JUCEMidiLfoApplication : public JUCEApplication
{
/* Important! NEVER embed objects directly inside your JUCEApplication class! Use
ONLY pointers to objects, which you should create during the initialise() method
(NOT in the constructor!) and delete in the shutdown() method (NOT in the
destructor!)
This is because the application object gets created before Juce has been properly
initialised, so any embedded objects would also get constructed too soon.
*/
MidiLfoWindow* midiLfoWindow;
public:
//==============================================================================
JUCEMidiLfoApplication()
: midiLfoWindow (0)
{
// NEVER do anything in here that could involve any Juce function being called
// - leave all your startup tasks until the initialise() method.
}
~JUCEMidiLfoApplication()
{
// Your shutdown() method should already have done all the things necessary to
// clean up this app object, so you should never need to put anything in
// the destructor.
// Making any Juce calls in here could be very dangerous...
}
//==============================================================================
void initialise (const String& commandLine)
{
// just create the main window...
midiLfoWindow = new MidiLfoWindow();
/* ..and now return, which will fall into to the main event
dispatch loop, and this will run until something calls
JUCEAppliction::quit().
In this case, JUCEAppliction::quit() will be called by the
midiLFO window being clicked.
*/
}
void shutdown()
{
// clear up..
if (midiLfoWindow != 0)
delete midiLfoWindow;
}
//==============================================================================
const String getApplicationName()
{
return T("Midi LFO");
}
const String getApplicationVersion()
{
return T("1.0");
}
bool moreThanOneInstanceAllowed()
{
return true;
}
void anotherInstanceStarted (const String& commandLine)
{
}
};
//==============================================================================
// This macro creates the application's main() function..
START_JUCE_APPLICATION (JUCEMidiLfoApplication)