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

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

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

revision 1774 by iliev, Thu Sep 11 18:11:06 2008 UTC revision 1808 by persson, Sun Dec 14 15:43:18 2008 UTC
# Line 507  int LSCPServer::Main() { Line 507  int LSCPServer::Main() {
507    
508          int retval = select(maxSessions+1, &selectSet, NULL, NULL, &timeout);          int retval = select(maxSessions+1, &selectSet, NULL, NULL, &timeout);
509    
510          if (retval == 0)          if (retval == 0 || (retval == -1 && errno == EINTR))
511                  continue; //Nothing try again                  continue; //Nothing try again
512          if (retval == -1) {          if (retval == -1) {
513                  std::cerr << "LSCPServer: Socket select error." << std::endl;                  std::cerr << "LSCPServer: Socket select error." << std::endl;
# Line 2540  String LSCPServer::GetTotalVoiceCount() Line 2540  String LSCPServer::GetTotalVoiceCount()
2540  String LSCPServer::GetTotalVoiceCountMax() {  String LSCPServer::GetTotalVoiceCountMax() {
2541      dmsg(2,("LSCPServer: GetTotalVoiceCountMax()\n"));      dmsg(2,("LSCPServer: GetTotalVoiceCountMax()\n"));
2542      LSCPResultSet result;      LSCPResultSet result;
2543      result.Add(EngineFactory::EngineInstances().size() * CONFIG_MAX_VOICES);      result.Add(EngineFactory::EngineInstances().size() * GLOBAL_MAX_VOICES);
2544        return result.Produce();
2545    }
2546    
2547    /**
2548     * Will be called by the parser to return the sampler global maximum
2549     * allowed number of voices.
2550     */
2551    String LSCPServer::GetGlobalMaxVoices() {
2552        dmsg(2,("LSCPServer: GetGlobalMaxVoices()\n"));
2553        LSCPResultSet result;
2554        result.Add(GLOBAL_MAX_VOICES);
2555        return result.Produce();
2556    }
2557    
2558    /**
2559     * Will be called by the parser to set the sampler global maximum number of
2560     * voices.
2561     */
2562    String LSCPServer::SetGlobalMaxVoices(int iVoices) {
2563        dmsg(2,("LSCPServer: SetGlobalMaxVoices(%d)\n", iVoices));
2564        LSCPResultSet result;
2565        try {
2566            if (iVoices < 1) throw Exception("Maximum voices may not be less than 1");
2567            GLOBAL_MAX_VOICES = iVoices; // see common/global_private.cpp
2568            const std::set<Engine*>& engines = EngineFactory::EngineInstances();
2569            if (engines.size() > 0) {
2570                std::set<Engine*>::iterator iter = engines.begin();
2571                std::set<Engine*>::iterator end  = engines.end();
2572                for (; iter != end; ++iter) {
2573                    (*iter)->SetMaxVoices(iVoices);
2574                }
2575            }
2576            LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_global_info, "VOICES", GLOBAL_MAX_VOICES));
2577        } catch (Exception e) {
2578            result.Error(e);
2579        }
2580        return result.Produce();
2581    }
2582    
2583    /**
2584     * Will be called by the parser to return the sampler global maximum
2585     * allowed number of disk streams.
2586     */
2587    String LSCPServer::GetGlobalMaxStreams() {
2588        dmsg(2,("LSCPServer: GetGlobalMaxStreams()\n"));
2589        LSCPResultSet result;
2590        result.Add(GLOBAL_MAX_STREAMS);
2591        return result.Produce();
2592    }
2593    
2594    /**
2595     * Will be called by the parser to set the sampler global maximum number of
2596     * disk streams.
2597     */
2598    String LSCPServer::SetGlobalMaxStreams(int iStreams) {
2599        dmsg(2,("LSCPServer: SetGlobalMaxStreams(%d)\n", iStreams));
2600        LSCPResultSet result;
2601        try {
2602            if (iStreams < 0) throw Exception("Maximum disk streams may not be negative");
2603            GLOBAL_MAX_STREAMS = iStreams; // see common/global_private.cpp
2604            const std::set<Engine*>& engines = EngineFactory::EngineInstances();
2605            if (engines.size() > 0) {
2606                std::set<Engine*>::iterator iter = engines.begin();
2607                std::set<Engine*>::iterator end  = engines.end();
2608                for (; iter != end; ++iter) {
2609                    (*iter)->SetMaxDiskStreams(iStreams);
2610                }
2611            }
2612            LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_global_info, "STREAMS", GLOBAL_MAX_STREAMS));
2613        } catch (Exception e) {
2614            result.Error(e);
2615        }
2616      return result.Produce();      return result.Produce();
2617  }  }
2618    
# Line 2933  String LSCPServer::AddDbInstruments(Stri Line 3005  String LSCPServer::AddDbInstruments(Stri
3005      return result.Produce();      return result.Produce();
3006  }  }
3007    
3008  String LSCPServer::AddDbInstruments(String ScanMode, String DbDir, String FsDir, bool bBackground) {  String LSCPServer::AddDbInstruments(String ScanMode, String DbDir, String FsDir, bool bBackground, bool insDir) {
3009      dmsg(2,("LSCPServer: AddDbInstruments(ScanMode=%s,DbDir=%s,FsDir=%s,bBackground=%d)\n", ScanMode.c_str(), DbDir.c_str(), FsDir.c_str(), bBackground));      dmsg(2,("LSCPServer: AddDbInstruments(ScanMode=%s,DbDir=%s,FsDir=%s,bBackground=%d,insDir=%d)\n", ScanMode.c_str(), DbDir.c_str(), FsDir.c_str(), bBackground, insDir));
3010      LSCPResultSet result;      LSCPResultSet result;
3011  #if HAVE_SQLITE3  #if HAVE_SQLITE3
3012      try {      try {
3013          int id;          int id;
3014          InstrumentsDb* db = InstrumentsDb::GetInstrumentsDb();          InstrumentsDb* db = InstrumentsDb::GetInstrumentsDb();
3015          if (ScanMode.compare("RECURSIVE") == 0) {          if (ScanMode.compare("RECURSIVE") == 0) {
3016             id = db->AddInstruments(RECURSIVE, DbDir, FsDir, bBackground);              id = db->AddInstruments(RECURSIVE, DbDir, FsDir, bBackground, insDir);
3017          } else if (ScanMode.compare("NON_RECURSIVE") == 0) {          } else if (ScanMode.compare("NON_RECURSIVE") == 0) {
3018             id = db->AddInstruments(NON_RECURSIVE, DbDir, FsDir, bBackground);              id = db->AddInstruments(NON_RECURSIVE, DbDir, FsDir, bBackground, insDir);
3019          } else if (ScanMode.compare("FLAT") == 0) {          } else if (ScanMode.compare("FLAT") == 0) {
3020             id = db->AddInstruments(FLAT, DbDir, FsDir, bBackground);              id = db->AddInstruments(FLAT, DbDir, FsDir, bBackground, insDir);
3021          } else {          } else {
3022              throw Exception("Unknown scan mode: " + ScanMode);              throw Exception("Unknown scan mode: " + ScanMode);
3023          }          }

Legend:
Removed from v.1774  
changed lines
  Added in v.1808

  ViewVC Help
Powered by ViewVC