38 |
|
|
39 |
namespace LinuxSampler { namespace sf2 { |
namespace LinuxSampler { namespace sf2 { |
40 |
|
|
41 |
typedef ResourceConsumer< ::sf2::InstrumentBase> InstrumentConsumer; |
typedef ResourceConsumer< ::sf2::Preset> InstrumentConsumer; |
42 |
|
|
43 |
}} // namespace LinuxSampler::sf2 |
}} // namespace LinuxSampler::sf2 |
44 |
|
|
59 |
* instrument / file is not needed anymore, then it will be freed from |
* instrument / file is not needed anymore, then it will be freed from |
60 |
* memory. |
* memory. |
61 |
*/ |
*/ |
62 |
class InstrumentResourceManager : public InstrumentManagerDefaultImpl< ::sf2::File, ::sf2::InstrumentBase, ::sf2::Region, ::sf2::Sample> { |
class InstrumentResourceManager : public InstrumentManagerDefaultImpl< ::sf2::File, ::sf2::Preset, ::sf2::Region, ::sf2::Sample> { |
63 |
public: |
public: |
64 |
InstrumentResourceManager() : Sf2s(this) {} |
InstrumentResourceManager() : Sf2s(this) {} |
65 |
virtual ~InstrumentResourceManager() {} |
virtual ~InstrumentResourceManager() {} |
72 |
|
|
73 |
protected: |
protected: |
74 |
// implementation of derived abstract methods from 'ResourceManager' |
// implementation of derived abstract methods from 'ResourceManager' |
75 |
virtual ::sf2::InstrumentBase* Create(instrument_id_t Key, InstrumentConsumer* pConsumer, void*& pArg); |
virtual ::sf2::Preset* Create(instrument_id_t Key, InstrumentConsumer* pConsumer, void*& pArg); |
76 |
virtual void Destroy(::sf2::InstrumentBase* pResource, void* pArg); |
virtual void Destroy(::sf2::Preset* pResource, void* pArg); |
77 |
virtual void OnBorrow(::sf2::InstrumentBase* pResource, InstrumentConsumer* pConsumer, void*& pArg); |
virtual void OnBorrow(::sf2::Preset* pResource, InstrumentConsumer* pConsumer, void*& pArg); |
78 |
virtual void DeleteRegionIfNotUsed(::sf2::Region* pRegion, region_info_t* pRegInfo); |
virtual void DeleteRegionIfNotUsed(::sf2::Region* pRegion, region_info_t* pRegInfo); |
79 |
virtual void DeleteSampleIfNotUsed(::sf2::Sample* pSample, region_info_t* pRegInfo); |
virtual void DeleteSampleIfNotUsed(::sf2::Sample* pSample, region_info_t* pRegInfo); |
80 |
private: |
private: |
94 |
InstrumentResourceManager* parent; |
InstrumentResourceManager* parent; |
95 |
} Sf2s; |
} Sf2s; |
96 |
|
|
97 |
int GetSfInstrumentCount(::sf2::File* pFile); |
int GetSfInstrumentCount(::sf2::File* pFile); |
98 |
::sf2::InstrumentBase* GetSfInstrument(::sf2::File* pFile, int idx); |
::sf2::Preset* GetSfInstrument(::sf2::File* pFile, int idx); |
99 |
}; |
}; |
100 |
|
|
101 |
}} // namespace LinuxSampler::sf2 |
}} // namespace LinuxSampler::sf2 |