/[svn]/linuxsampler/trunk/src/engines/EngineFactory.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/engines/EngineFactory.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 420 by schoenebeck, Thu Mar 3 03:25:17 2005 UTC revision 2012 by iliev, Fri Oct 23 17:53:17 2009 UTC
# Line 1  Line 1 
1  /***************************************************************************  /***************************************************************************
2   *                                                                         *   *                                                                         *
3   *   Copyright (C) 2005 Christian Schoenebeck                              *   *   Copyright (C) 2005-2007 Christian Schoenebeck                        *
4   *                                                                         *   *                                                                         *
5   *   This program is free software; you can redistribute it and/or modify  *   *   This program is free software; you can redistribute it and/or modify  *
6   *   it under the terms of the GNU General Public License as published by  *   *   it under the terms of the GNU General Public License as published by  *
# Line 24  Line 24 
24    
25  #include "gig/Engine.h"  #include "gig/Engine.h"
26    
27    #if HAVE_SF2
28    #include "sf2/Engine.h"
29    #endif
30    
31    #include "sfz/Engine.h"
32    
33  #include "../common/global.h"  #include "../common/global.h"
34    
35  namespace LinuxSampler {  namespace LinuxSampler {
# Line 31  namespace LinuxSampler { Line 37  namespace LinuxSampler {
37      // all currently existing engine instances      // all currently existing engine instances
38      static std::set<LinuxSampler::Engine*> engines;      static std::set<LinuxSampler::Engine*> engines;
39    
40      LinuxSampler::Engine* EngineFactory::Create(String EngineType) throw (LinuxSamplerException) {      std::vector<String> EngineFactory::AvailableEngineTypes() {
41            std::vector<String> result;
42            result.push_back("GIG");
43        #if HAVE_SF2
44            result.push_back("SF2");
45        #endif
46            result.push_back("SFZ");
47            return result;
48        }
49    
50        String EngineFactory::AvailableEngineTypesAsString() {
51            std::vector<String> types = AvailableEngineTypes();
52            String result;
53            std::vector<String>::iterator iter = types.begin();
54            for (; iter != types.end(); iter++) {
55                if (result != "") result += ",";
56                result += "'" + *iter + "'";
57            }
58            return result;
59        }
60    
61        LinuxSampler::Engine* EngineFactory::Create(String EngineType) throw (Exception) {
62          if (!strcasecmp(EngineType.c_str(),"GigEngine") || !strcasecmp(EngineType.c_str(),"gig")) {          if (!strcasecmp(EngineType.c_str(),"GigEngine") || !strcasecmp(EngineType.c_str(),"gig")) {
63              Engine* pEngine = new gig::Engine;              Engine* pEngine = new gig::Engine;
64              engines.insert(pEngine);              engines.insert(pEngine);
65              return pEngine;              return pEngine;
66            } else if (!strcasecmp(EngineType.c_str(),"sf2")) {
67            #if HAVE_SF2
68                Engine* pEngine = new sf2::Engine;
69                engines.insert(pEngine);
70                return pEngine;
71            #else
72                throw Exception("LinuxSampler is not compiled with SF2 support");
73            #endif
74            } else if (!strcasecmp(EngineType.c_str(),"sfz")) {
75                Engine* pEngine = new sfz::Engine;
76                engines.insert(pEngine);
77                return pEngine;
78          }          }
79          throw LinuxSamplerException("Unknown engine type");          
80            throw Exception("Unknown engine type");
81      }      }
82    
83      void EngineFactory::Destroy(LinuxSampler::Engine* pEngine) {      void EngineFactory::Erase(LinuxSampler::Engine* pEngine) {
84          engines.erase(pEngine);          engines.erase(pEngine);
85      }      }
86    
87      std::set<LinuxSampler::Engine*> EngineFactory::EngineInstances() {      void EngineFactory::Destroy(LinuxSampler::Engine* pEngine) {
88            delete pEngine;
89        }
90    
91        const std::set<LinuxSampler::Engine*>& EngineFactory::EngineInstances() {
92          return engines;          return engines;
93      }      }
94    
95  } // namepsace LinuxSampler  } // namespace LinuxSampler

Legend:
Removed from v.420  
changed lines
  Added in v.2012

  ViewVC Help
Powered by ViewVC