1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
|
/****************************************************************************
AZR-3 - An organ synth
Copyright (C) 2006-2010 Lars Luthman <lars.luthman@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as published
by the Free Software Foundation.
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, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 01222-1307 USA
****************************************************************************/
#include <string>
#include <jack/jack.h>
#include <gtkmm.h>
#include <pthread.h>
#include <semaphore.h>
#include "azr3.hpp"
#include "azr3gui.hpp"
struct Preset {
Preset() : empty(true) { }
std::string name;
float values[63];
bool empty;
};
struct Main {
Main(int& argc, char**& argv);
void run();
bool is_ok() const;
protected:
void load_presets(char const* file);
void write_presets(char const* file);
void gui_changed_control(uint32_t index, float value);
void gui_set_preset(unsigned char number);
void gui_save_preset(unsigned char number, const std::string& name);
bool engine_changed_control(uint32_t index, float value);
void check_changes();
int process(jack_nframes_t nframes);
void auto_connect();
static int static_process(jack_nframes_t frames, void* arg);
jack_client_t* m_jack_client;
jack_port_t* m_midi_port;
jack_port_t* m_left_port;
jack_port_t* m_right_port;
AZR3* m_engine;
AZR3GUI* m_gui;
pthread_mutex_t m_engine_wlock;
sem_t m_engine_changed;
sem_t m_program_changed;
float m_controls[63];
unsigned char m_program;
pthread_mutex_t m_gui_wlock;
sem_t m_gui_changed;
float m_gui_controls[63];
Preset m_presets[128];
bool m_ok;
std::string m_auto_midi;
std::string m_auto_audio;
Gtk::Main* m_kit;
Gtk::Window* m_win;
};
|