2019-08-03 09:48:50 -04:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2014-2019 Robin Gareus <robin@gareus.org>
|
|
|
|
*
|
|
|
|
* 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, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
2014-02-24 23:37:55 -05:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <vector>
|
2017-12-02 06:46:20 -05:00
|
|
|
|
|
|
|
#ifdef COMPILER_MSVC
|
|
|
|
#include <sys/utime.h>
|
|
|
|
#else
|
2017-11-29 12:53:06 -05:00
|
|
|
#include <utime.h>
|
2017-12-02 06:46:20 -05:00
|
|
|
#endif
|
2014-02-24 23:37:55 -05:00
|
|
|
|
2015-04-27 12:23:51 -04:00
|
|
|
#include <glib.h>
|
|
|
|
|
2014-05-17 10:54:12 -04:00
|
|
|
#include "pbd/pbd.h"
|
|
|
|
#include "pbd/transmitter.h"
|
|
|
|
#include "pbd/receiver.h"
|
|
|
|
|
2014-10-05 12:11:11 -04:00
|
|
|
#ifdef __MINGW64__
|
|
|
|
#define NO_OLDNAMES // no backwards compat _pid_t, conflict with w64 pthread/sched
|
|
|
|
#endif
|
|
|
|
|
2014-02-24 23:37:55 -05:00
|
|
|
#include "ardour/filesystem_paths.h"
|
2014-03-04 09:25:58 -05:00
|
|
|
#ifdef LXVST_SUPPORT
|
2014-02-24 23:37:55 -05:00
|
|
|
#include "ardour/linux_vst_support.h"
|
2014-03-04 09:25:58 -05:00
|
|
|
#endif
|
2014-02-24 23:37:55 -05:00
|
|
|
#include "ardour/vst_info_file.h"
|
|
|
|
|
|
|
|
/* make stupid waf happy.
|
|
|
|
* waf cannot build multiple variants of .o object files from the same
|
|
|
|
* source using different wscripts.. it mingles e.g.
|
|
|
|
* build/libs/ardour/vst_info_file.cc.1.o for
|
|
|
|
* both lib/ardour/wscript and lib/fst/wscript
|
|
|
|
*
|
|
|
|
* ...but waf does track include dependencies.
|
|
|
|
*/
|
|
|
|
#include "../ardour/vst_info_file.cc"
|
2014-03-04 09:25:58 -05:00
|
|
|
#ifdef LXVST_SUPPORT
|
2014-02-24 23:37:55 -05:00
|
|
|
#include "../ardour/linux_vst_support.cc"
|
2014-03-04 09:25:58 -05:00
|
|
|
#endif
|
2016-11-13 10:31:15 -05:00
|
|
|
#ifdef MACVST_SUPPORT
|
|
|
|
#include "../ardour/mac_vst_support.cc"
|
|
|
|
#endif
|
2014-02-24 23:37:55 -05:00
|
|
|
#include "../ardour/filesystem_paths.cc"
|
|
|
|
#include "../ardour/directory_names.cc"
|
2014-05-17 10:54:12 -04:00
|
|
|
|
2016-11-15 11:07:04 -05:00
|
|
|
#include "../ardour/vst_state.cc"
|
2014-02-24 23:37:55 -05:00
|
|
|
|
|
|
|
#ifdef LXVST_SUPPORT
|
|
|
|
void
|
|
|
|
vstfx_destroy_editor (VSTState* /*vstfx*/) { }
|
|
|
|
#endif
|
|
|
|
|
2014-05-17 10:54:12 -04:00
|
|
|
using namespace PBD;
|
|
|
|
|
|
|
|
class DummyReceiver : public Receiver {
|
|
|
|
protected:
|
|
|
|
void receive (Transmitter::Channel chn, const char * str) {
|
|
|
|
const char *prefix = "";
|
|
|
|
switch (chn) {
|
|
|
|
case Transmitter::Error:
|
|
|
|
prefix = "[ERROR]: ";
|
|
|
|
break;
|
|
|
|
case Transmitter::Info:
|
|
|
|
/* ignore */
|
|
|
|
return;
|
|
|
|
case Transmitter::Warning:
|
|
|
|
prefix = "[WARNING]: ";
|
|
|
|
break;
|
|
|
|
case Transmitter::Fatal:
|
|
|
|
prefix = "[FATAL]: ";
|
|
|
|
break;
|
|
|
|
case Transmitter::Throw:
|
|
|
|
abort ();
|
|
|
|
}
|
|
|
|
|
|
|
|
std::cerr << prefix << str << std::endl;
|
|
|
|
|
|
|
|
if (chn == Transmitter::Fatal) {
|
2019-07-04 16:21:35 -04:00
|
|
|
::exit (EXIT_FAILURE);
|
2014-05-17 10:54:12 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
DummyReceiver dummy_receiver;
|
|
|
|
|
2014-02-24 23:37:55 -05:00
|
|
|
int main (int argc, char **argv) {
|
2014-05-17 10:54:12 -04:00
|
|
|
char *dllpath = NULL;
|
|
|
|
if (argc == 3 && !strcmp("-f", argv[1])) {
|
|
|
|
dllpath = argv[2];
|
2015-04-27 12:23:51 -04:00
|
|
|
const size_t slen = strlen (dllpath);
|
|
|
|
if (
|
|
|
|
(slen > 3 && 0 == g_ascii_strcasecmp (&dllpath[slen-3], ".so"))
|
|
|
|
||
|
|
|
|
(slen > 4 && 0 == g_ascii_strcasecmp (&dllpath[slen-4], ".dll"))
|
|
|
|
) {
|
2014-05-17 10:54:12 -04:00
|
|
|
vstfx_remove_infofile(dllpath);
|
|
|
|
vstfx_un_blacklist(dllpath);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
else if (argc != 2) {
|
|
|
|
fprintf(stderr, "usage: %s [-f] <vst>\n", argv[0]);
|
2014-02-24 23:37:55 -05:00
|
|
|
return EXIT_FAILURE;
|
2014-05-17 10:54:12 -04:00
|
|
|
} else {
|
|
|
|
dllpath = argv[1];
|
2014-02-24 23:37:55 -05:00
|
|
|
}
|
|
|
|
|
2014-05-17 10:54:12 -04:00
|
|
|
PBD::init();
|
|
|
|
|
|
|
|
dummy_receiver.listen_to (error);
|
|
|
|
dummy_receiver.listen_to (info);
|
|
|
|
dummy_receiver.listen_to (fatal);
|
|
|
|
dummy_receiver.listen_to (warning);
|
|
|
|
|
2014-03-18 15:38:37 -04:00
|
|
|
std::vector<VSTInfo *> *infos = 0;
|
2014-05-17 10:54:12 -04:00
|
|
|
|
2015-04-27 12:23:51 -04:00
|
|
|
const size_t slen = strlen (dllpath);
|
2014-05-17 10:54:12 -04:00
|
|
|
if (0) { }
|
2014-02-24 23:37:55 -05:00
|
|
|
#ifdef LXVST_SUPPORT
|
2015-04-27 12:23:51 -04:00
|
|
|
else if (slen > 3 && 0 == g_ascii_strcasecmp (&dllpath[slen-3], ".so")) {
|
2014-02-24 23:37:55 -05:00
|
|
|
infos = vstfx_get_info_lx(dllpath);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef WINDOWS_VST_SUPPORT
|
2015-04-27 12:23:51 -04:00
|
|
|
else if (slen > 4 && 0 == g_ascii_strcasecmp (&dllpath[slen-4], ".dll")) {
|
2014-02-24 23:37:55 -05:00
|
|
|
infos = vstfx_get_info_fst(dllpath);
|
|
|
|
}
|
|
|
|
#endif
|
2016-11-13 10:31:15 -05:00
|
|
|
|
|
|
|
#ifdef MACVST_SUPPORT
|
|
|
|
else if (slen > 4 && 0 == g_ascii_strcasecmp (&dllpath[slen-4], ".vst")) {
|
|
|
|
infos = vstfx_get_info_mac(dllpath);
|
|
|
|
}
|
|
|
|
#endif
|
2014-05-17 10:54:12 -04:00
|
|
|
else {
|
|
|
|
fprintf(stderr, "'%s' is not a supported VST plugin.\n", dllpath);
|
|
|
|
}
|
|
|
|
|
|
|
|
PBD::cleanup();
|
2014-02-24 23:37:55 -05:00
|
|
|
|
2014-03-18 15:38:37 -04:00
|
|
|
if (!infos || infos->empty()) {
|
2014-02-24 23:37:55 -05:00
|
|
|
return EXIT_FAILURE;
|
|
|
|
} else {
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|