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

Diff of /linuxsampler/trunk/src/engines/InstrumentManagerThread.h

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

revision 947 by schoenebeck, Mon Nov 27 21:34:55 2006 UTC revision 2187 by persson, Sun Jun 19 18:54:11 2011 UTC
# Line 24  Line 24 
24  #include "../common/global.h"  #include "../common/global.h"
25  #include "../common/Thread.h"  #include "../common/Thread.h"
26  #include "../common/Condition.h"  #include "../common/Condition.h"
27  #include "../common/RingBuffer.h"  #include "../common/Mutex.h"
28  #include "../Sampler.h"  #include "../Sampler.h"
29    #include "../EventListeners.h"
30  #include "InstrumentManager.h"  #include "InstrumentManager.h"
31    
32  /// Maximum numbers of instruments waiting to be loaded by the InstrumentLoader.  #include <list>
 #define INSTRUMENT_LOADER_QUEUE_SIZE    200  
33    
34  namespace LinuxSampler {  namespace LinuxSampler {
35    
# Line 41  namespace LinuxSampler { Line 41  namespace LinuxSampler {
41       * to the API.       * to the API.
42       */       */
43      class InstrumentManagerThread : public Thread {      class InstrumentManagerThread : public Thread {
44            friend class EventHandler;
45            
46          public:          public:
47              InstrumentManagerThread();              InstrumentManagerThread();
48              void StartNewLoad(String Filename, uint uiInstrumentIndex, EngineChannel* pEngineChannel);              void StartNewLoad(String Filename, uint uiInstrumentIndex, EngineChannel* pEngineChannel);
49              void StartSettingMode(InstrumentManager* pManager, const InstrumentManager::instrument_id_t& ID, InstrumentManager::mode_t Mode);              void StartSettingMode(InstrumentManager* pManager, const InstrumentManager::instrument_id_t& ID, InstrumentManager::mode_t Mode);
50              virtual ~InstrumentManagerThread();              virtual ~InstrumentManagerThread();
51    #ifdef __APPLE__
52                int StopThread();
53    #endif
54          protected:          protected:
55              struct command_t {              struct command_t {
56                  enum cmd_type_t {                  enum cmd_type_t {
# Line 59  namespace LinuxSampler { Line 64  namespace LinuxSampler {
64              };              };
65    
66              // Instance variables.              // Instance variables.
67              RingBuffer<command_t>* pQueue; ///< queue with commands for loading new instruments.              std::list<command_t> queue; ///< queue with commands for loading new instruments.
68              Condition              conditionJobsLeft; ///< synchronizer to block this thread until a new job arrives              Mutex                mutex; ///< for making the queue thread safe
69                Condition            conditionJobsLeft; ///< synchronizer to block this thread until a new job arrives
70    
71              int Main(); ///< Implementation of virtual method from class Thread.              int Main(); ///< Implementation of virtual method from class Thread.
72            private:
73                class EventHandler : public ChannelCountAdapter {
74                    public:
75                        InstrumentManagerThread* pThread;
76                        virtual void ChannelToBeRemoved(SamplerChannel* pChannel);
77                };
78                
79                EventHandler eventHandler;
80      };      };
81    
82  } // namespace LinuxSampler  } // namespace LinuxSampler

Legend:
Removed from v.947  
changed lines
  Added in v.2187

  ViewVC Help
Powered by ViewVC