/[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 4018 by persson, Sat Jun 23 11:02:48 2012 UTC revision 4019 by schoenebeck, Mon Jan 3 17:45:26 2022 UTC
# Line 1  Line 1 
1  /***************************************************************************  /***************************************************************************
2   *                                                                         *   *                                                                         *
3   *   Copyright (C) 2005 - 2012 Christian Schoenebeck                       *   *   Copyright (C) 2005 - 2022 Christian Schoenebeck                       *
4   *                                                                         *   *                                                                         *
5   *   This library is free software; you can redistribute it and/or modify  *   *   This library is free software; you can redistribute it and/or modify  *
6   *   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 30  Line 30 
30  #include "InstrumentManager.h"  #include "InstrumentManager.h"
31    
32  #include <list>  #include <list>
33    #include <functional>
34    
35  namespace LinuxSampler {  namespace LinuxSampler {
36    
# Line 47  namespace LinuxSampler { Line 48  namespace LinuxSampler {
48              InstrumentManagerThread();              InstrumentManagerThread();
49              void StartNewLoad(String Filename, uint uiInstrumentIndex, EngineChannel* pEngineChannel);              void StartNewLoad(String Filename, uint uiInstrumentIndex, EngineChannel* pEngineChannel);
50              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);
51                void AddPeriodicJob(String name, std::function<void()> fn);
52                void RemovePeriodicJob(String name);
53              virtual ~InstrumentManagerThread();              virtual ~InstrumentManagerThread();
54  #if (defined(__APPLE__) && !defined(__x86_64__)) || defined(WIN32)  #if (defined(__APPLE__) && !defined(__x86_64__)) || defined(WIN32)
55              int StopThread();              int StopThread();
# Line 63  namespace LinuxSampler { Line 66  namespace LinuxSampler {
66                  InstrumentManager::mode_t          mode;         ///< only for INSTR_MODE commands                  InstrumentManager::mode_t          mode;         ///< only for INSTR_MODE commands
67              };              };
68    
69                /// Custom job to be executed on behalf of external components.
70                struct ext_job_t {
71                    String name; ///< unique name of the job
72                    std::function<void()> fn; ///< The actual callback for the job to be executed.
73                };
74    
75              // Instance variables.              // Instance variables.
76              std::list<command_t> queue; ///< queue with commands for loading new instruments.              std::list<command_t> queue; ///< queue with commands for loading new instruments.
77              Mutex                mutex; ///< for making the queue thread safe              Mutex                mutex; ///< for making the queue thread safe
78              Condition            conditionJobsLeft; ///< synchronizer to block this thread until a new job arrives              Condition            conditionJobsLeft; ///< synchronizer to block this thread until a new job arrives
79    
80                std::vector<ext_job_t> periodicJobs; ///< list of external tasks to be executed periodically
81                Mutex                  periodicJobsMutex; ///< for making access to periodicJobs thread safe
82    
83              int Main(); ///< Implementation of virtual method from class Thread.              int Main(); ///< Implementation of virtual method from class Thread.
84                void RemovePeriodicJobWithoutLock(String name);
85                bool AnyPeriodicJobs();
86          private:          private:
87              class EventHandler : public ChannelCountAdapter {              class EventHandler : public ChannelCountAdapter {
88                  public:                  public:

Legend:
Removed from v.4018  
changed lines
  Added in v.4019

  ViewVC Help
Powered by ViewVC