/[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 390 by schoenebeck, Fri Feb 18 03:58:55 2005 UTC revision 392 by schoenebeck, Sat Feb 19 02:40:24 2005 UTC
# Line 20  Line 20 
20    
21  #include "lscpinstrumentloader.h"  #include "lscpinstrumentloader.h"
22    
23  LSCPInstrumentLoader::LSCPInstrumentLoader() : Thread(false, 0, -4) {  LSCPInstrumentLoader::LSCPInstrumentLoader() : Thread(true, false, 0, -4) {
24      pQueue = new RingBuffer<command_t>(INSTRUMENT_LOADER_QUEUE_SIZE);      pQueue = new RingBuffer<command_t>(INSTRUMENT_LOADER_QUEUE_SIZE);
25  }  }
26    
# Line 39  LSCPInstrumentLoader::~LSCPInstrumentLoa Line 39  LSCPInstrumentLoader::~LSCPInstrumentLoa
39   * @param pEngine - engine on which the instrument should be loaded   * @param pEngine - engine on which the instrument should be loaded
40   */   */
41  void LSCPInstrumentLoader::StartNewLoad(String Filename, uint uiInstrumentIndex, Engine* pEngine) {  void LSCPInstrumentLoader::StartNewLoad(String Filename, uint uiInstrumentIndex, Engine* pEngine) {
42        // already tell the engine which instrument to load
43        pEngine->PrepareLoadInstrument(Filename.c_str(), uiInstrumentIndex);
44    
45      command_t cmd;      command_t cmd;
46      cmd.pFilename         = new String(Filename);      cmd.pEngine = pEngine;
     cmd.uiInstrumentIndex = uiInstrumentIndex;  
     cmd.pEngine           = pEngine;  
47      pQueue->push(&cmd);      pQueue->push(&cmd);
48      StartThread(); // ensure thread is running      StartThread(); // ensure thread is running
49      conditionJobsLeft.Set(true); // wake up thread      conditionJobsLeft.Set(true); // wake up thread
# Line 55  int LSCPInstrumentLoader::Main() { Line 56  int LSCPInstrumentLoader::Main() {
56              command_t cmd;              command_t cmd;
57              pQueue->pop(&cmd);              pQueue->pop(&cmd);
58              try {              try {
59                  cmd.pEngine->LoadInstrument(cmd.pFilename->c_str(), cmd.uiInstrumentIndex);                  cmd.pEngine->LoadInstrument();
60              }              }
61              catch (LinuxSamplerException e) {              catch (LinuxSamplerException e) {
62                  e.PrintMessage();                  e.PrintMessage();
63              }              }
             delete cmd.pFilename;  
64              // Always re-enable the engine.              // Always re-enable the engine.
65              cmd.pEngine->Enable();              cmd.pEngine->Enable();
66          }          }

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

  ViewVC Help
Powered by ViewVC