annotate plugin/FeatureExtractionPluginFactory.cpp @ 1258:200c60de27ca 3.0-integration

More timings and cache hit counts
author Chris Cannam
date Thu, 10 Nov 2016 09:58:28 +0000
parents d45a16c232bd
children a99641535e02
rev   line source
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@1229 29 static FeatureExtractionPluginFactory *instance = 0;
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@1249 37 SVDEBUG << "FeatureExtractionPluginFactory: creating native instance"
Chris@1249 38 << endl;
Chris@1229 39 instance = new NativeVampPluginFactory();
Chris@1229 40 } else {
Chris@1249 41 SVDEBUG << "FeatureExtractionPluginFactory: creating Piper instance"
Chris@1249 42 << endl;
Chris@1229 43 instance = new PiperVampPluginFactory();
Chris@1229 44 }
Chris@1249 45 #else
Chris@1249 46 SVDEBUG << "FeatureExtractionPluginFactory: no Piper support enabled,"
Chris@1249 47 << " creating native instance" << endl;
Chris@1249 48 instance = new NativeVampPluginFactory();
Chris@1249 49 #endif
Chris@1229 50 }
Chris@1229 51
Chris@1229 52 return instance;
Chris@1229 53 }