3 |
* LinuxSampler - modular, streaming capable sampler * |
* LinuxSampler - modular, streaming capable sampler * |
4 |
* * |
* * |
5 |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
6 |
|
* Copyright (C) 2005 Christian Schoenebeck * |
7 |
* * |
* * |
8 |
* This program is free software; you can redistribute it and/or modify * |
* This program is free software; you can redistribute it and/or modify * |
9 |
* 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 * |
47 |
|
|
48 |
}} // namespace LinuxSampler::gig |
}} // namespace LinuxSampler::gig |
49 |
|
|
50 |
|
#include "EngineChannel.h" |
51 |
#include "Engine.h" |
#include "Engine.h" |
52 |
|
|
53 |
namespace LinuxSampler { namespace gig { |
namespace LinuxSampler { namespace gig { |
54 |
|
|
55 |
// just symbol prototyping |
// just symbol prototyping |
56 |
class Engine; |
class EngineChannel; |
57 |
|
|
58 |
/** |
/** |
59 |
* Explicitly identifies a Gigasampler instrument. |
* Explicitly identifies a Gigasampler instrument. |
71 |
/** Gig instrument manager |
/** Gig instrument manager |
72 |
* |
* |
73 |
* Manager to share gig instruments between multiple Gigasampler |
* Manager to share gig instruments between multiple Gigasampler |
74 |
* engines. The engines Borrow() instruments when they need them and |
* engine channels. The engine channels Borrow() instruments when they |
75 |
* HandBack() when they don't need them anymore. The |
* need them and HandBack() when they don't need them anymore. The |
76 |
* InstrumentResourceManager loads the corresponding gig file and gig |
* InstrumentResourceManager loads the corresponding gig file and gig |
77 |
* instrument if needed, if it's already in use by another engine, then |
* instrument if needed, if it's already in use by another engine |
78 |
* it just returns the same resource, if an gig instrument / file is not |
* channel, then it just returns the same resource, if an gig |
79 |
* in use by any engine anymore, then it will be freed from memory. |
* instrument / file is not in use by any engine channel anymore, then |
80 |
|
* it will be freed from memory. |
81 |
*/ |
*/ |
82 |
class InstrumentResourceManager : public ResourceManager<instrument_id_t, ::gig::Instrument> { |
class InstrumentResourceManager : public ResourceManager<instrument_id_t, ::gig::Instrument> { |
83 |
public: |
public: |
84 |
virtual ~InstrumentResourceManager() {} |
virtual ~InstrumentResourceManager() {} |
85 |
protected: |
protected: |
86 |
virtual ::gig::Instrument* Create(instrument_id_t Key, InstrumentConsumer* pConsumer, void*& pArg); |
virtual ::gig::Instrument* Create(instrument_id_t Key, InstrumentConsumer* pConsumer, void*& pArg); |
87 |
virtual void Destroy(::gig::Instrument* pResource, void* pArg); |
virtual void Destroy(::gig::Instrument* pResource, void* pArg); |
100 |
virtual ::gig::File* Create(String Key, GigConsumer* pConsumer, void*& pArg); |
virtual ::gig::File* Create(String Key, GigConsumer* pConsumer, void*& pArg); |
101 |
virtual void Destroy(::gig::File* pResource, void* pArg); |
virtual void Destroy(::gig::File* pResource, void* pArg); |
102 |
virtual void OnBorrow(::gig::File* pResource, GigConsumer* pConsumer, void*& pArg) {} // ignore |
virtual void OnBorrow(::gig::File* pResource, GigConsumer* pConsumer, void*& pArg) {} // ignore |
103 |
public: |
public: |
104 |
virtual ~GigResourceManager() {} |
virtual ~GigResourceManager() {} |
105 |
} Gigs; |
} Gigs; |
106 |
|
|
107 |
void CacheInitialSamples(::gig::Sample* pSample, gig::Engine* pEngine); |
void CacheInitialSamples(::gig::Sample* pSample, gig::EngineChannel* pEngineChannel); |
108 |
}; |
}; |
109 |
|
|
110 |
/** |
/** |