/[svn]/linuxsampler/trunk/src/network/lscpinstrumentloader.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/network/lscpinstrumentloader.cpp

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

revision 389 by schoenebeck, Thu Feb 17 02:53:45 2005 UTC revision 390 by schoenebeck, Fri Feb 18 03:58:55 2005 UTC
# Line 40  LSCPInstrumentLoader::~LSCPInstrumentLoa Line 40  LSCPInstrumentLoader::~LSCPInstrumentLoa
40   */   */
41  void LSCPInstrumentLoader::StartNewLoad(String Filename, uint uiInstrumentIndex, Engine* pEngine) {  void LSCPInstrumentLoader::StartNewLoad(String Filename, uint uiInstrumentIndex, Engine* pEngine) {
42      command_t cmd;      command_t cmd;
43      cmd.Filename          = Filename;      cmd.pFilename         = new String(Filename);
44      cmd.uiInstrumentIndex = uiInstrumentIndex;      cmd.uiInstrumentIndex = uiInstrumentIndex;
45      cmd.pEngine           = pEngine;      cmd.pEngine           = pEngine;
46      pQueue->push(&cmd);      pQueue->push(&cmd);
47      StartThread(); // ensure the thread is running      StartThread(); // ensure thread is running
48        conditionJobsLeft.Set(true); // wake up thread
49  }  }
50    
51  // Entry point for the InstrumentLoader Thread.  // Entry point for the InstrumentLoader Thread.
52  int LSCPInstrumentLoader::Main() {  int LSCPInstrumentLoader::Main() {
53      while (pQueue->read_space()) {      while (true) {
54          command_t cmd;          while (pQueue->read_space()) {
55          pQueue->pop(&cmd);              command_t cmd;
56          try {              pQueue->pop(&cmd);
57              cmd.pEngine->LoadInstrument(cmd.Filename.c_str(), cmd.uiInstrumentIndex);              try {
58                    cmd.pEngine->LoadInstrument(cmd.pFilename->c_str(), cmd.uiInstrumentIndex);
59                }
60                catch (LinuxSamplerException e) {
61                    e.PrintMessage();
62                }
63                delete cmd.pFilename;
64                // Always re-enable the engine.
65                cmd.pEngine->Enable();
66          }          }
         catch (LinuxSamplerException e) {  
             e.PrintMessage();  
         }  
         // Always re-enable the engine.  
         cmd.pEngine->Enable();  
     }  
67    
68      // nothing left to do          // nothing left to do, sleep until new jobs arrive
69      StopThread();          conditionJobsLeft.WaitIf(false);
70            // reset flag
71            conditionJobsLeft.Set(false);
72            // unlock condition object so it can be turned again by other thread
73            conditionJobsLeft.Unlock();
74        }
75  }  }

Legend:
Removed from v.389  
changed lines
  Added in v.390

  ViewVC Help
Powered by ViewVC