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