*/
+#include <math.h>
#include <iostream>
-#include <cmath>
#ifdef COMPILER_MSVC
#include <float.h>
/* isinf() & isnan() are C99 standards, which older MSVC doesn't provide */
-#define isinf(val) !((bool)_finite((double)val))
-#define isnan(val) (bool)_isnan((double)val)
-#endif
-
-#ifdef __APPLE__
-#define isinf(val) std::isinf((val))
-#define isnan(val) std::isnan((val))
+#define ISINF(val) !((bool)_finite((double)val))
+#define ISNAN(val) (bool)_isnan((double)val)
+#else
+#define ISINF(val) std::isinf((val))
+#define ISNAN(val) std::isnan((val))
#endif
#include <gtkmm/box.h>
}
*/
- if (isinf(power)) {
+ if (ISINF(power)) {
if (power < 0) {
power = _min_dB - 1.0;
} else {
power = _max_dB - 1.0;
}
- } else if (isnan(power)) {
+ } else if (ISNAN(power)) {
power = _min_dB - 1.0;
}
sigc::signal<void> DPIReset;
+#ifdef PLATFORM_WINDOWS
+#define random() rand()
+#endif
+
/** Add an element to a menu, settings its sensitivity.
* @param m Menu to add to.
*/
+#include <gtkmm.h>
#include "ardour/vst_plugin.h"
#include "ardour/vst_types.h"
#include "vst_plugin_ui.h"
+
+#ifdef PLATFORM_WINDOWS
+#include <gdk/gdkwin32.h>
+#elif defined __APPLE__
+// TODO
+#else
#include <gdk/gdkx.h>
+#endif
VSTPluginUI::VSTPluginUI (boost::shared_ptr<ARDOUR::PluginInsert> insert, boost::shared_ptr<ARDOUR::VSTPlugin> plugin)
: PlugUIBase (insert)
*/
#include <fst.h>
+#include <gtkmm.h>
#include <gtk/gtk.h>
#include <gtk/gtksocket.h>
#include "ardour/plugin_insert.h"
#include "windows_vst_plugin_ui.h"
-#ifdef GDK_WINDOWING_X11
-#include <gdk/gdkx.h>
-#elif defined GDK_WINDOWING_WIN32
+#ifdef PLATFORM_WINDOWS
#include <gdk/gdkwin32.h>
-#elif defined GDK_WINDOWING_QUARTZ
-/* not yet supported */
+#elif defined __APPLE__
+// TODO
+#else
+#include <gdk/gdkx.h>
#endif
using namespace Gtk;
{
#ifdef GDK_WINDOWING_WIN32
- GtkWindow* wobj = win->gobj();
+
+#if 0 // TODO verify window vs vbox-widget WRT to plugin_analysis_expander
+ GtkWindow* wobj = GTK_WINDOW(gtk_widget_get_toplevel(this->gobj()));
+#else
+ GtkVBox* wobj = this->gobj();
+#endif
+
gtk_widget_realize(GTK_WIDGET(wobj));
void* hWndHost = gdk_win32_drawable_get_handle(GTK_WIDGET(wobj)->window);
fst_run_editor (_vst->state(), hWndHost);
#else
fst_run_editor (_vst->state(), NULL);
-#endif
-
-
pack_start (plugin_analysis_expander, true, true);
+#endif
}
WindowsVSTPluginUI::~WindowsVSTPluginUI ()
obj.source = gtk2_ardour_sources
obj.target = 'ardour-' + bld.env['VERSION']
obj.includes = ['.']
+ obj.ldflags = ['-no-undefined']
if bld.is_defined('WINDOWS_VST_SUPPORT'):
# Windows VST support mingw
- obj.source += (
- '../libs/fst/fst.c',
- '../libs/fst/vstwin.c',
- '../vst/winmain.c',
- )
+ obj.source += [ '../vst/winmain.c' ]
obj.includes += [ '../libs/fst' ]
# at this point, "obj" refers to either the normal native executable
if bld.is_defined('WINDOWS_VST_SUPPORT'):
obj.source += [ 'windows_vst_plugin_ui.cc' ]
obj.defines += [ 'WINDOWS_VST_SUPPORT' ]
- obj.use += [ 'X11' ]
+ if bld.env['build_target'] != 'mingw':
+ obj.use += [ 'X11' ]
if bld.is_defined('LXVST_SUPPORT'):
obj.source += [ 'linux_vst_gui_support.cc', 'lxvst_plugin_ui.cc' ]
using namespace ARDOUR;
using namespace PBD;
+#ifdef PLATFORM_WINDOWS
+#define sleep(X) Sleep((X) * 1000)
+#endif
+
static const char* localedir = LOCALEDIR;
TestReceiver test_receiver;
#ifndef __ardour_vst_types_h__
#define __ardour_vst_types_h__
+#include <pthread.h>
#include "ardour/libardour_visibility.h"
#include "ardour/vestige/aeffectx.h"
#else
sscanf (r.uri.c_str(), "VST:%d:%d", &id, &index);
#endif
-
-#ifdef PLATFORM_WINDOWS
- int const vst_version = _plugin->dispatcher (_plugin, effGetVstVersion, 0, 0, NULL, 0);
- if (vst_version >= 2) {
- _plugin->dispatcher (_plugin, effBeginSetProgram, 0, 0, NULL, 0);
- }
-
- _plugin->dispatcher (_plugin, effSetProgram, 0, index, NULL, 0);
-
- if (vst_version >= 2) {
- _plugin->dispatcher (_plugin, effEndSetProgram, 0, 0, NULL, 0);
- }
-
- //unfortunately, we don't get any opcodes back from the plugin when this happens (?!)
- //so we have to manually update param values from the plugin to our listeners
- for (int n = 0; n < parameter_count(); n++ ) {
- float p = get_parameter(n); //ask the plugin what its new setting is
- Plugin::set_parameter (which, newval);
- }
-
-#else
_state->want_program = index;
-#endif
return true;
}
#ifdef PLATFORM_WINDOWS
+#include <windows.h>
+#include <shlobj.h> // CSIDL_*
#include "pbd/windows_special_dirs.h"
namespace ARDOUR {
if (p == 0) {
char *pVSTx86 = 0;
- char *pProgFilesX86 = get_win_special_folder (CSIDL_PROGRAM_FILESX86);
+ char *pProgFilesX86 = PBD::get_win_special_folder (CSIDL_PROGRAM_FILESX86);
if (pProgFilesX86) {
// Look for a VST folder under C:\Program Files (x86)
if (p == 0) {
// Look for a VST folder under C:\Program Files
char *pVST = 0;
- char *pProgFiles = get_win_special_folder (CSIDL_PROGRAM_FILES);
+ char *pProgFiles = PBD::get_win_special_folder (CSIDL_PROGRAM_FILES);
if (pProgFiles) {
if (pVST = g_build_filename (pProgFiles, "Steinberg", "VSTPlugins", 0)) {
if (p == 0) {
// If all else failed, assume the plugins are under "My Documents"
- user_home = g_get_user_special_dir (G_USER_DIRECTORY_DOCUMENTS);
+ user_home = (char*) g_get_user_special_dir (G_USER_DIRECTORY_DOCUMENTS);
if (user_home) {
p = g_build_filename (user_home, "Plugins", "VST", 0);
} else {
} else {
// Concatenate the registry path with the user's personal path
- user_home = g_get_user_special_dir (G_USER_DIRECTORY_DOCUMENTS);
+ user_home = (char*) g_get_user_special_dir (G_USER_DIRECTORY_DOCUMENTS);
if (user_home) {
p = g_build_path (";", p, g_build_filename(user_home, "Plugins", "VST", 0), 0);
# controls whether we actually use it in preference to soundtouch
# Note: as of 2104, soundtouch (WSOLA) has been out-of-use for years.
- conf.define('USE_RUBBERBAND', 1)
+ conf.define('USE_RUBBERBAND', 1)
conf.define('CURRENT_SESSION_FILE_VERSION', CURRENT_SESSION_FILE_VERSION)
autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
autowaf.check_header(conf, 'cxx', 'boost/scoped_ptr.hpp')
autowaf.check_header(conf, 'cxx', 'boost/ptr_container/ptr_list.hpp')
+ if conf.env['WINDOWS_VST_SUPPORT'] == True and Options.options.dist_target == 'mingw':
+ conf.check(compiler='cxx',
+ lib='gdi32',
+ mandatory=True,
+ uselib_store='GDI32')
def build(bld):
obj.target = 'ardour'
obj.uselib = ['GLIBMM','GTHREAD','AUBIO','SIGCPP','XML','UUID',
'SNDFILE','SAMPLERATE','LRDF','AUDIOUNITS',
- 'OSX','BOOST','CURL','DL','TAGLIB','VAMPSDK','VAMPHOSTSDK','RUBBERBAND']
+ 'OSX','BOOST','CURL','TAGLIB','VAMPSDK','VAMPHOSTSDK','RUBBERBAND']
obj.use = ['libpbd','libmidipp','libevoral',
- 'libaudiographer',
+ 'libaudiographer',
'libtimecode',
]
+ if bld.env['build_target'] != 'mingw':
+ obj.uselib += ['DL']
if bld.is_defined('USE_EXTERNAL_LIBS'):
obj.uselib.extend(['VAMPSDK', 'LIBLTC'])
else:
#obj.add_objects = 'default/libs/surfaces/control_protocol/smpte_1.o'
if bld.is_defined('HAVE_LILV') :
- obj.source += ['lv2_plugin.cc', 'lv2_evbuf.c', 'uri_map.cc']
+ obj.source += ['lv2_plugin.cc', 'lv2_evbuf.c', 'uri_map.cc']
obj.uselib += ['LILV']
if bld.is_defined('HAVE_SUIL'):
obj.uselib += ['SUIL']
obj.includes += [ '../fst' ]
obj.defines += [ 'WINDOWS_VST_SUPPORT' ]
if bld.env['build_target'] == 'mingw':
- obj.source += [ '../fst/vstwin.c']
+ obj.source += [ '../fst/vstwin.c', '../fst/fst.c']
+ obj.uselib += ['GDI32']
if bld.is_defined('LXVST_SUPPORT'):
obj.source += [ 'lxvst_plugin.cc', 'linux_vst_support.cc' ]
map<string, struct timeval>::iterator last = last_time.find (group);
if (last != last_time.end ()) {
+#if 0
time_t seconds = now.tv_sec - last->second.tv_sec;
suseconds_t useconds = now.tv_usec - last->second.tv_usec;
if (useconds < 0) {
--seconds;
}
cout << (now.tv_sec + ((double) now.tv_usec / 1e6)) << " [" << (seconds + ((double) useconds / 1e6)) << "]: " << message << "\n";
+#endif
} else {
cout << message << "\n";
}
#include <vector>
#include "ardour/filesystem_paths.h"
+#ifdef LXVST_SUPPORT
#include "ardour/linux_vst_support.h"
+#endif
#include "ardour/vst_info_file.h"
/* make stupid waf happy.
* ...but waf does track include dependencies.
*/
#include "../ardour/vst_info_file.cc"
+#ifdef LXVST_SUPPORT
#include "../ardour/linux_vst_support.cc"
+#endif
#include "../ardour/filesystem_paths.cc"
#include "../ardour/directory_names.cc"
#include "../pbd/error.cc"
#ifdef PLATFORM_WINDOWS
-#include <ardourext/misc.h>
-#include <ardourext/pthread.h>
+#include <pthread.h>
static UINT_PTR idle_timer_id = 0;
+extern char *basename(char *path);
#else /* linux + wine */
}
}
+ pthread_mutex_lock (&fst->lock);
#ifndef PLATFORM_WINDOWS /* linux + wine */
/* Dispatch messages to send keypresses to the plugin */
- pthread_mutex_lock (&fst->lock);
int i;
for (i = 0; i < fst->n_pending_keys; ++i) {
}
fst->n_pending_keys = 0;
+#endif
/* See comment for maybe_set_program call below */
maybe_set_program (fst);
maybe_set_program (fst);
fst->program_set_without_editor = 1;
}
-#endif
pthread_mutex_unlock (&fst->lock);
}
conf.load('misc')
conf.load('compiler_cxx')
autowaf.configure(conf)
+ if conf.env['WINDOWS_VST_SUPPORT'] == True and bld.env['build_target'] == 'mingw':
+ conf.check(compiler='cxx',
+ lib='gdi32',
+ mandatory=True,
+ uselib_store='GDI32')
# Add a waf `feature' to allow compilation of things using winegcc
from waflib.TaskGen import feature
)
obj.linkflags = ['-mwindows', '-Wl,--export-dynamic']
obj.target = 'ardour-vst-scanner.exe.so'
+ obj.uselib = ['GIOMM', 'DL']
else:
obj = bld (features = 'cxx c cxxprogram')
- obj.source = ( 'scanner.cc' )
+ if bld.is_defined('WINDOWS_VST_SUPPORT'):
+ obj.source = ( 'scanner.cc', 'fst.c', 'vstwin.c' )
+ obj.uselib = ['GIOMM', 'DL', 'GDI32']
+ else:
+ obj.source = ( 'scanner.cc' )
+ obj.uselib = ['GIOMM', 'DL']
obj.target = 'ardour-vst-scanner'
obj.includes = [ '../pbd/', '../ardour/', '.' ]
'PACKAGE="' + I18N_PACKAGE + '"',
]
obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3/fst')
- obj.uselib = ['GIOMM', 'DL']
}
#endif
+
+#ifdef __MINGW64__
+ struct tm *
+__cdecl localtime(const long int *_Time)
+{
+ if (_Time == NULL)
+ {
+ return localtime((const time_t *const)NULL); // Unpredictable behavior in case of _Time == NULL;
+ }
+ else
+ {
+ const time_t tempTime = *_Time;
+ return localtime(&tempTime);
+ }
+}
+#endif
};
typedef typename RequestBuffer::rw_vector RequestBufferVector;
-#if defined(__MINGW32__) && !defined (__MINGW64__)
+#ifdef COMPILER_MSVC // ?? (not needed for ming32 nor mingw64)
struct pthread_cmp
{
#include <time.h>
#ifdef COMPILER_MSVC
- #define localtime_r( _clock, _result ) \
- ( *(_result) = *localtime( (_clock) ), \
- (_result) )
-#else
- extern struct tm *localtime_r(const time_t *const timep, struct tm *p_tm);
+
+#define localtime_r( _clock, _result ) \
+ ( *(_result) = *localtime( (_clock) ), (_result) )
+
+#elif defined __MINGW64__
+
+# ifdef (localtime_r)
+# undef localtime_r
+# endif
+
+// As in 64 bit time_t is 64 bit integer, compiler breaks compilation
+// everytime implicit cast from long int* to time_t* worked in
+// the past (32 bit). To unblock such a cast we added the localtime below:
+extern struct tm *localtime(const long int *_Time);
+extern struct tm *localtime_r(const time_t *const timep, struct tm *p_tm);
+
#endif
#endif
#define STDERR_FILENO 2
#endif
-#if defined (__MINGW64__)
+#ifdef PLATFORM_WINDOWS
#include <windows.h>
#ifdef interface
//
char *
-get_win_special_folder (int csidl)
+PBD::get_win_special_folder (int csidl)
{
wchar_t path[PATH_MAX+1];
HRESULT hr;
# Boost headers
autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
+ if conf.env['WINDOWS_VST_SUPPORT'] == True and Options.options.dist_target == 'mingw':
+ conf.check(compiler='cxx',
+ lib='ole32',
+ mandatory=True,
+ uselib_store='OLE')
def build(bld):
-
+
# Make signals_generated.h using signals.py
bld(rule = 'python ${SRC} ${TGT}', source = 'pbd/signals.py', target = 'pbd/signals_generated.h')
obj.vnum = LIBPBD_LIB_VERSION
obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
obj.defines += [ 'PACKAGE="' + I18N_PACKAGE + '"',
- 'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"'
+ 'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"'
]
-
+
if bld.env['build_target'] == 'x86_64':
obj.defines += [ 'USE_X86_64_ASM' ]
if bld.env['build_target'] == 'mingw':
obj.source += [ 'windows_special_dirs.cc' ]
- obj.linkflags = ['-lole']
+ obj.uselib += ' OLE'
if bld.env['BUILD_TESTS'] and bld.is_defined('HAVE_CPPUNIT'):
# Unit tests
self->synth = synth_alloc();
synth_init(self->synth, rate);
-
+#ifndef PLATFORM_WINDOWS // easter egg is for sane platforms with native support for localtime_r only
struct tm date;
time_t now;
time(&now);
printf("reasonable synth.lv2 says: happy holidays!\n");
self->xmas = true;
}
+#endif
return (LV2_Handle)self;
}
using namespace ARDOUR;
using namespace PBD;
+#ifndef timeradd /// only avail with __USE_BSD
+#define timeradd(a,b,result) \
+ do { \
+ (result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \
+ (result)->tv_usec = (a)->tv_usec + (b)->tv_usec; \
+ if ((result)->tv_usec >= 1000000) \
+ { \
+ ++(result)->tv_sec; \
+ (result)->tv_usec -= 1000000; \
+ } \
+ } while (0)
+#endif
+
#define ui_context() MackieControlProtocol::instance() /* a UICallback-derived object that specifies the event loop for signal handling */
Strip::Strip (Surface& s, const std::string& name, int index, const map<Button::ID,StripButtonInfo>& strip_buttons)
#include <cerrno>
#include <algorithm>
-#include <sys/poll.h>
#include <unistd.h>
#include <fcntl.h>
if opts.windows_vst:
conf.define('WINDOWS_VST_SUPPORT', 1)
conf.env['WINDOWS_VST_SUPPORT'] = True
- conf.env.append_value('CFLAGS', '-I' + Options.options.wine_include)
- conf.env.append_value('CXXFLAGS', '-I' + Options.options.wine_include)
- autowaf.check_header(conf, 'cxx', 'windows.h', mandatory = True)
+ if not Options.options.dist_target == 'mingw':
+ conf.env.append_value('CFLAGS', '-I' + Options.options.wine_include)
+ conf.env.append_value('CXXFLAGS', '-I' + Options.options.wine_include)
+ autowaf.check_header(conf, 'cxx', 'windows.h', mandatory = True)
if opts.lxvst:
if sys.platform == 'darwin':
conf.env['LXVST_SUPPORT'] = False