Chris@1229
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@1229
|
2
|
Chris@1229
|
3 /*
|
Chris@1229
|
4 Sonic Visualiser
|
Chris@1229
|
5 An audio file viewer and annotation editor.
|
Chris@1229
|
6 Centre for Digital Music, Queen Mary, University of London.
|
Chris@1229
|
7 This file copyright 2006-2016 Chris Cannam and QMUL.
|
Chris@1229
|
8
|
Chris@1229
|
9 This program is free software; you can redistribute it and/or
|
Chris@1229
|
10 modify it under the terms of the GNU General Public License as
|
Chris@1229
|
11 published by the Free Software Foundation; either version 2 of the
|
Chris@1229
|
12 License, or (at your option) any later version. See the file
|
Chris@1229
|
13 COPYING included with this distribution for more information.
|
Chris@1229
|
14 */
|
Chris@1229
|
15
|
Chris@1229
|
16 #include "PiperVampPluginFactory.h"
|
Chris@1229
|
17 #include "NativeVampPluginFactory.h"
|
Chris@1229
|
18
|
Chris@1229
|
19 #include <QMutex>
|
Chris@1229
|
20 #include <QMutexLocker>
|
Chris@1229
|
21
|
Chris@1229
|
22 #include "base/Preferences.h"
|
Chris@1249
|
23 #include "base/Debug.h"
|
Chris@1229
|
24
|
Chris@1229
|
25 FeatureExtractionPluginFactory *
|
Chris@1229
|
26 FeatureExtractionPluginFactory::instance()
|
Chris@1229
|
27 {
|
Chris@1229
|
28 static QMutex mutex;
|
Chris@1582
|
29 static FeatureExtractionPluginFactory *instance = nullptr;
|
Chris@1229
|
30
|
Chris@1229
|
31 QMutexLocker locker(&mutex);
|
Chris@1229
|
32
|
Chris@1229
|
33 if (!instance) {
|
Chris@1229
|
34
|
Chris@1249
|
35 #ifdef HAVE_PIPER
|
Chris@1229
|
36 if (Preferences::getInstance()->getRunPluginsInProcess()) {
|
Chris@1264
|
37 SVDEBUG << "FeatureExtractionPluginFactory: in-process preference set, using native factory" << endl;
|
Chris@1229
|
38 instance = new NativeVampPluginFactory();
|
Chris@1229
|
39 } else {
|
Chris@1264
|
40 SVDEBUG << "FeatureExtractionPluginFactory: in-process preference not set, using Piper factory" << endl;
|
Chris@1229
|
41 instance = new PiperVampPluginFactory();
|
Chris@1229
|
42 }
|
Chris@1249
|
43 #else
|
Chris@1264
|
44 SVDEBUG << "FeatureExtractionPluginFactory: no Piper support compiled in, using native factory" << endl;
|
Chris@1249
|
45 instance = new NativeVampPluginFactory();
|
Chris@1249
|
46 #endif
|
Chris@1229
|
47 }
|
Chris@1229
|
48
|
Chris@1229
|
49 return instance;
|
Chris@1229
|
50 }
|