1 |
schoenebeck |
2611 |
/* |
2 |
schoenebeck |
2902 |
* Copyright (c) 2014-2016 Christian Schoenebeck |
3 |
schoenebeck |
2611 |
* |
4 |
|
|
* http://www.linuxsampler.org |
5 |
|
|
* |
6 |
|
|
* This file is part of LinuxSampler and released under the same terms. |
7 |
|
|
* See README file for details. |
8 |
|
|
*/ |
9 |
|
|
|
10 |
|
|
#ifndef LS_ABSTRACTINSTRUMENTMANAGER_H |
11 |
|
|
#define LS_ABSTRACTINSTRUMENTMANAGER_H |
12 |
|
|
|
13 |
|
|
#include "../InstrumentManager.h" |
14 |
|
|
#include "../../common/ResourceManager.h" |
15 |
|
|
#include "../../common/global_private.h" |
16 |
|
|
#include "InstrumentScriptVM.h" |
17 |
|
|
|
18 |
|
|
namespace LinuxSampler { |
19 |
|
|
|
20 |
|
|
typedef ResourceConsumer<VMParserContext> InstrumentScriptConsumer; |
21 |
|
|
|
22 |
|
|
class AbstractInstrumentManager : public InstrumentManager { |
23 |
|
|
public: |
24 |
|
|
AbstractInstrumentManager() { } |
25 |
|
|
virtual ~AbstractInstrumentManager() { } |
26 |
|
|
|
27 |
schoenebeck |
2902 |
/** |
28 |
|
|
* Resource manager for loading and sharing the parsed (executable) VM |
29 |
|
|
* presentation of real-time instrument scripts. The key used here, and |
30 |
|
|
* associated with each script resource, is not as one might expect the |
31 |
|
|
* script name or something equivalent, instead the key used is |
32 |
|
|
* actually the entire script's source code text. The value (the actual |
33 |
|
|
* resource) is of type @c VMParserContext, which is the parsed |
34 |
|
|
* (executable) VM representation of the respective script. |
35 |
|
|
*/ |
36 |
schoenebeck |
2611 |
class ScriptResourceManager : public ResourceManager<String, VMParserContext> { |
37 |
|
|
public: |
38 |
|
|
ScriptResourceManager() {} |
39 |
|
|
virtual ~ScriptResourceManager() {} |
40 |
|
|
protected: |
41 |
|
|
// implementation of derived abstract methods from 'ResourceManager' |
42 |
|
|
virtual VMParserContext* Create(String Key, InstrumentScriptConsumer* pConsumer, void*& pArg); |
43 |
|
|
virtual void Destroy(VMParserContext* pResource, void* pArg); |
44 |
|
|
virtual void OnBorrow(VMParserContext* pResource, InstrumentScriptConsumer* pConsumer, void*& pArg) {} // ignore |
45 |
|
|
} scripts; |
46 |
|
|
}; |
47 |
|
|
|
48 |
|
|
} // namespace LinuxSampler |
49 |
|
|
|
50 |
|
|
#endif // LS_ABSTRACTINSTRUMENTMANAGER_H |