Guitarix
engine.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2009, 2010 Hermann Meyer, James Warden, Andreas Degert
3  * Copyright (C) 2011 Pete Shorthose
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  * --------------------------------------------------------------------------
19  */
20 
21 #pragma once
22 
23 #ifndef SRC_HEADERS_ENGINE_H_
24 #define SRC_HEADERS_ENGINE_H_
25 
26 #ifdef GUITARIX_AS_PLUGIN
27 #define GX_DATA_FOLDER "gx_head/"
28 #define GX_STYLE_DIR GX_DATA_FOLDER ""
29 #define GX_FACTORY_DIR GX_DATA_FOLDER "factorysettings"
30 #define GX_SOUND_DIR GX_DATA_FOLDER "sounds"
31 #define GX_SOUND_BPB_DIR GX_DATA_FOLDER "sounds/bands"
32 #define GX_SOUND_BPA_DIR GX_DATA_FOLDER "sounds/amps"
33 #define GX_BUILDER_DIR GX_DATA_FOLDER ""
34 #define GX_ICON_DIR GX_DATA_FOLDER ""
35 #define GX_PIXMAPS_DIR GX_DATA_FOLDER ""
36 #define GX_FONTS_DIR GX_DATA_FOLDER ""
37 #define GX_VERSION "0.44.1"
38 #endif // GUITARIX_AS_PLUGIN
39 
40 /* system header files */
41 #include <semaphore.h>
42 #include <cmath>
43 #include <ctime>
44 #include <sstream>
45 #include <fstream>
46 #include <iostream>
47 #include <string>
48 #include <list>
49 #include <set>
50 #include <vector>
51 #include <map>
52 #include <algorithm>
53 #include <sys/stat.h>
54 #include <boost/format.hpp>
55 #include <boost/noncopyable.hpp>
56 #include <boost/thread/mutex.hpp>
57 #include <glibmm/i18n.h> // NOLINT
58 #include <glibmm/optioncontext.h> // NOLINT
59 #include <glibmm/dispatcher.h>
60 #include <glibmm/miscutils.h>
61 #include <giomm/file.h>
62 
63 /* LV2 header files */
64 #include <lilv/lilv.h>
65 #include <lv2/presets/presets.h>
66 #include <lv2/state/state.h>
67 #include <lv2/urid/urid.h>
68 #include <lv2/atom/atom.h>
69 #include <lv2/buf-size/buf-size.h>
70 #include <lv2/options/options.h>
71 #include <lv2/uri-map/uri-map.h>
72 #include <lv2/port-props/port-props.h>
73 
74 #ifndef GUITARIX_AS_PLUGIN
75 /* waf generated defines */
76 #include "../config.h"
77 #endif // GUITARIX_AS_PLUGIN
78 
79 // define USE_MIDI_OUT to create a midi output port and
80 // make the MidiAudioBuffer plugin activatable
81 // for the UI:
82 // - menudef.xml: make action MidiOut visible (its commented out)
83 // - ports.glade: set scrolledwindow5 and label12 to visible
84 //
85 //#define USE_MIDI_OUT
86 
87 // use MIDI control out
88 #define USE_MIDI_CC_OUT
89 
90 #ifdef LADSPA_SO
91 #define gettext(x) dgettext(GETTEXT_PACKAGE, x)
92 #endif
93 
94 #ifndef LV2_CORE__enabled
95 #define LV2_CORE__enabled LV2_CORE_PREFIX "enabled"
96 #endif
97 
98 using namespace std;
99 
100 #include "gx_compiler.h"
101 
102 /* guitarix declarations */
103 #include "gx_plugin.h"
104 #include "gx_logging.h"
105 #include "gx_system.h"
106 #include "gx_parameter.h"
107 
108 #include "gx_resampler.h"
109 #include "gx_convolver.h"
110 #include "gx_pitch_tracker.h"
111 #include "gx_pluginloader.h"
112 #include "gx_modulesequencer.h"
113 #include "gx_json.h"
114 
115 #ifndef GUITARIX_AS_PLUGIN
116 #include "gx_jack.h"
117 #else
118 #include "gx_jack_wrapper.h"
119 #endif // GUITARIX_AS_PLUGIN
120 #include "gx_internal_plugins.h"
121 #include "gx_preset.h"
122 #include "gx_engine.h"
123 
124 #include "tunerswitcher.h"
125 #include "ladspaback.h"
126 
127 #ifdef GUITARIX_AS_PLUGIN
128 #include <glibmm/i18n.h> // NOLINT
129 #include <glibmm/optioncontext.h> // NOLINT
130 #include <glibmm/dispatcher.h>
131 #include <glibmm/miscutils.h>
132 #include <giomm/file.h>
133 #endif // GUITARIX_AS_PLUGIN
134 
135 #ifdef _WINDOWS
136 #include <io.h>
137 #define R_OK 4 /* Test for read permission. */
138 #define W_OK 2 /* Test for write permission. */
139 #define X_OK 1 /* execute permission - unsupported in windows*/
140 #define F_OK 0 /* Test for existence. */
141 #define access _access
142 
143 #include <chrono>
144 #include <thread>
145 #undef _stat
146 #endif // _WINDOWS
147 
148 #endif // SRC_HEADERS_ENGINE_H_