annotate plugin/FeatureExtractionPluginFactory.cpp @ 1235:7f4230e7d83a project-file-rework

Error handling
author Chris Cannam
date Thu, 27 Oct 2016 16:13:25 +0100
parents 9ae2ce9190e6
children d45a16c232bd
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@1229 23
Chris@1229 24 FeatureExtractionPluginFactory *
Chris@1229 25 FeatureExtractionPluginFactory::instance()
Chris@1229 26 {
Chris@1229 27 static QMutex mutex;
Chris@1229 28 static FeatureExtractionPluginFactory *instance = 0;
Chris@1229 29
Chris@1229 30 QMutexLocker locker(&mutex);
Chris@1229 31
Chris@1229 32 if (!instance) {
Chris@1229 33
Chris@1229 34 if (Preferences::getInstance()->getRunPluginsInProcess()) {
Chris@1229 35 cerr << "creating native instance" << endl;
Chris@1229 36 instance = new NativeVampPluginFactory();
Chris@1229 37 } else {
Chris@1229 38 cerr << "creating piper instance" << endl;
Chris@1229 39 instance = new PiperVampPluginFactory();
Chris@1229 40 }
Chris@1229 41 }
Chris@1229 42
Chris@1229 43 return instance;
Chris@1229 44 }