1 |
/*************************************************************************** |
/*************************************************************************** |
2 |
* * |
* * |
3 |
* Copyright (C) 2005 Christian Schoenebeck * |
* Copyright (C) 2005, 2006 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 * |
31 |
// all currently existing engine instances |
// all currently existing engine instances |
32 |
static std::set<LinuxSampler::Engine*> engines; |
static std::set<LinuxSampler::Engine*> engines; |
33 |
|
|
34 |
LinuxSampler::Engine* EngineFactory::Create(String EngineType) throw (LinuxSamplerException) { |
std::vector<String> EngineFactory::AvailableEngineTypes() { |
35 |
|
std::vector<String> result; |
36 |
|
result.push_back("GIG"); // we only have one sampler engine implementation ATM |
37 |
|
return result; |
38 |
|
} |
39 |
|
|
40 |
|
String EngineFactory::AvailableEngineTypesAsString() { |
41 |
|
std::vector<String> types = AvailableEngineTypes(); |
42 |
|
String result; |
43 |
|
std::vector<String>::iterator iter = types.begin(); |
44 |
|
for (; iter != types.end(); iter++) { |
45 |
|
if (result != "") result += ","; |
46 |
|
result += *iter; |
47 |
|
} |
48 |
|
return result; |
49 |
|
} |
50 |
|
|
51 |
|
LinuxSampler::Engine* EngineFactory::Create(String EngineType) throw (Exception) { |
52 |
if (!strcasecmp(EngineType.c_str(),"GigEngine") || !strcasecmp(EngineType.c_str(),"gig")) { |
if (!strcasecmp(EngineType.c_str(),"GigEngine") || !strcasecmp(EngineType.c_str(),"gig")) { |
53 |
Engine* pEngine = new gig::Engine; |
Engine* pEngine = new gig::Engine; |
54 |
engines.insert(pEngine); |
engines.insert(pEngine); |
55 |
return pEngine; |
return pEngine; |
56 |
} |
} |
57 |
throw LinuxSamplerException("Unknown engine type"); |
throw Exception("Unknown engine type"); |
58 |
} |
} |
59 |
|
|
60 |
void EngineFactory::Destroy(LinuxSampler::Engine* pEngine) { |
void EngineFactory::Destroy(LinuxSampler::Engine* pEngine) { |
61 |
engines.erase(pEngine); |
engines.erase(pEngine); |
62 |
} |
} |
63 |
|
|
64 |
std::set<LinuxSampler::Engine*> EngineFactory::EngineInstances() { |
const std::set<LinuxSampler::Engine*>& EngineFactory::EngineInstances() { |
65 |
return engines; |
return engines; |
66 |
} |
} |
67 |
|
|
68 |
} // namepsace LinuxSampler |
} // namespace LinuxSampler |