/[svn]/linuxsampler/trunk/src/engines/gig/InstrumentResourceManager.h
ViewVC logotype

Diff of /linuxsampler/trunk/src/engines/gig/InstrumentResourceManager.h

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

revision 53 by schoenebeck, Mon Apr 26 17:15:51 2004 UTC revision 517 by schoenebeck, Sun May 8 00:26:21 2005 UTC
# Line 2  Line 2 
2   *                                                                         *   *                                                                         *
3   *   LinuxSampler - modular, streaming capable sampler                     *   *   LinuxSampler - modular, streaming capable sampler                     *
4   *                                                                         *   *                                                                         *
5   *   Copyright (C) 2003 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  *
# Line 29  Line 30 
30  # warning InstrumentResourceManager.h included  # warning InstrumentResourceManager.h included
31  #endif // DEBUG_HEADERS  #endif // DEBUG_HEADERS
32    
33    #include <gig.h>
34    
35  #include "../../common/global.h"  #include "../../common/global.h"
36  #include "../../common/LinuxSamplerException.h"  #include "../../common/LinuxSamplerException.h"
37  #include "../../common/ResourceManager.h"  #include "../../common/ResourceManager.h"
38  #include "../../audiodriver/AudioOutputDevice.h"  #include "../../drivers/audio/AudioOutputDevice.h"
 #include "../../lib/fileloader/libgig/gig.h"  
39    
40  // preload 64k samples = 128kB of data in RAM for 16 bit mono samples  // preload 64k samples = 128kB of data in RAM for 16 bit mono samples
41  #define NUM_RAM_PRELOAD_SAMPLES 32768  #define NUM_RAM_PRELOAD_SAMPLES 32768
# Line 46  namespace LinuxSampler { namespace gig { Line 48  namespace LinuxSampler { namespace gig {
48    
49  }} // namespace LinuxSampler::gig  }} // namespace LinuxSampler::gig
50    
51    #include "EngineChannel.h"
52  #include "Engine.h"  #include "Engine.h"
53    
54  namespace LinuxSampler { namespace gig {  namespace LinuxSampler { namespace gig {
55    
56      // just symbol prototyping      // just symbol prototyping
57      class Engine;      class EngineChannel;
58    
59      /**      /**
60       * Explicitly identifies a Gigasampler instrument.       * Explicitly identifies a Gigasampler instrument.
# Line 69  namespace LinuxSampler { namespace gig { Line 72  namespace LinuxSampler { namespace gig {
72      /** Gig instrument manager      /** Gig instrument manager
73       *       *
74       * Manager to share gig instruments between multiple Gigasampler       * Manager to share gig instruments between multiple Gigasampler
75       * engines. The engines Borrow() instruments when they need them and       * engine channels. The engine channels Borrow() instruments when they
76       * HandBack() when they don't need them anymore. The       * need them and HandBack() when they don't need them anymore. The
77       * InstrumentResourceManager loads the corresponding gig file and gig       * InstrumentResourceManager loads the corresponding gig file and gig
78       * 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
79       * it just returns the same resource, if an gig instrument / file is not       * channel, then it just returns the same resource, if an gig
80       * 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
81         * it will be freed from memory.
82       */       */
83      class InstrumentResourceManager : public ResourceManager<instrument_id_t, ::gig::Instrument> {      class InstrumentResourceManager : public ResourceManager<instrument_id_t, ::gig::Instrument> {
84            public:
85                virtual ~InstrumentResourceManager() {}
86                static void OnInstrumentLoadingProgress(::gig::progress_t* pProgress);
87          protected:          protected:
88              virtual ::gig::Instrument* Create(instrument_id_t Key, InstrumentConsumer* pConsumer, void*& pArg);              virtual ::gig::Instrument* Create(instrument_id_t Key, InstrumentConsumer* pConsumer, void*& pArg);
89              virtual void               Destroy(::gig::Instrument* pResource, void* pArg);              virtual void               Destroy(::gig::Instrument* pResource, void* pArg);
# Line 95  namespace LinuxSampler { namespace gig { Line 102  namespace LinuxSampler { namespace gig {
102                      virtual ::gig::File* Create(String Key, GigConsumer* pConsumer, void*& pArg);                      virtual ::gig::File* Create(String Key, GigConsumer* pConsumer, void*& pArg);
103                      virtual void         Destroy(::gig::File* pResource, void* pArg);                      virtual void         Destroy(::gig::File* pResource, void* pArg);
104                      virtual void         OnBorrow(::gig::File* pResource, GigConsumer* pConsumer, void*& pArg) {} // ignore                      virtual void         OnBorrow(::gig::File* pResource, GigConsumer* pConsumer, void*& pArg) {} // ignore
105                    public:
106                        virtual ~GigResourceManager() {}
107              } Gigs;              } Gigs;
108    
109              void CacheInitialSamples(::gig::Sample* pSample, gig::Engine* pEngine);              void CacheInitialSamples(::gig::Sample* pSample, gig::EngineChannel* pEngineChannel);
110      };      };
111    
112      /**      /**

Legend:
Removed from v.53  
changed lines
  Added in v.517

  ViewVC Help
Powered by ViewVC