/[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 3053 by persson, Sun Aug 23 06:14:00 2015 UTC revision 3054 by schoenebeck, Thu Dec 15 12:47:45 2016 UTC
# Line 3  Line 3 
3   *   LinuxSampler - modular, streaming capable sampler                     *   *   LinuxSampler - modular, streaming capable sampler                     *
4   *                                                                         *   *                                                                         *
5   *   Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck   *   *   Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck   *
6   *   Copyright (C) 2005 - 2015 Christian Schoenebeck                       *   *   Copyright (C) 2005 - 2016 Christian Schoenebeck                       *
7   *                                                                         *   *                                                                         *
8   *   This library is free software; you can redistribute it and/or modify  *   *   This library is free software; you can redistribute it and/or modify  *
9   *   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 111  Mutex LSCPServer::RTNotifyMutex; Line 111  Mutex LSCPServer::RTNotifyMutex;
111    
112  LSCPServer::LSCPServer(Sampler* pSampler, long int addr, short int port) : Thread(true, false, 0, -4), eventHandler(this) {  LSCPServer::LSCPServer(Sampler* pSampler, long int addr, short int port) : Thread(true, false, 0, -4), eventHandler(this) {
113      SocketAddress.sin_family      = AF_INET;      SocketAddress.sin_family      = AF_INET;
114      SocketAddress.sin_addr.s_addr = addr;      SocketAddress.sin_addr.s_addr = (in_addr_t)addr;
115      SocketAddress.sin_port        = port;      SocketAddress.sin_port        = (in_port_t)port;
116      this->pSampler = pSampler;      this->pSampler = pSampler;
117      LSCPEvent::RegisterEvent(LSCPEvent::event_audio_device_count, "AUDIO_OUTPUT_DEVICE_COUNT");      LSCPEvent::RegisterEvent(LSCPEvent::event_audio_device_count, "AUDIO_OUTPUT_DEVICE_COUNT");
118      LSCPEvent::RegisterEvent(LSCPEvent::event_audio_device_info, "AUDIO_OUTPUT_DEVICE_INFO");      LSCPEvent::RegisterEvent(LSCPEvent::event_audio_device_info, "AUDIO_OUTPUT_DEVICE_INFO");
# Line 708  extern int GetLSCPCommand( void *buf, in Line 708  extern int GetLSCPCommand( void *buf, in
708    
709          strcpy((char*) buf, command.c_str());          strcpy((char*) buf, command.c_str());
710          LSCPServer::bufferedCommands.erase(LSCPServer::currentSocket);          LSCPServer::bufferedCommands.erase(LSCPServer::currentSocket);
711          return command.size();          return (int) command.size();
712  }  }
713    
714  extern yyparse_param_t* GetCurrentYaccSession() {  extern yyparse_param_t* GetCurrentYaccSession() {
# Line 762  bool LSCPServer::GetLSCPCommand( std::ve Line 762  bool LSCPServer::GetLSCPCommand( std::ve
762          // first get as many character as possible and add it to the 'input' buffer          // first get as many character as possible and add it to the 'input' buffer
763          while (true) {          while (true) {
764                  #if defined(WIN32)                  #if defined(WIN32)
765                  result = recv(socket, (char *)&c, 1, 0); //Read one character at a time for now                  result = (int)recv(socket, (char*)&c, 1, 0); //Read one character at a time for now
766                  #else                  #else
767                  result = recv(socket, (void *)&c, 1, 0); //Read one character at a time for now                  result = (int)recv(socket, (void*)&c, 1, 0); //Read one character at a time for now
768                  #endif                  #endif
769                  if (result == 1) input.push_back(c);                  if (result == 1) input.push_back(c);
770                  else break; // end of input or some error                  else break; // end of input or some error
# Line 798  bool LSCPServer::GetLSCPCommand( std::ve Line 798  bool LSCPServer::GetLSCPCommand( std::ve
798                  } else if (c == 3) { // custom ASCII code usage for moving cursor right (LSCP shell)                  } else if (c == 3) { // custom ASCII code usage for moving cursor right (LSCP shell)
799                          if (iter->iCursorOffset < 0) iter->iCursorOffset++;                          if (iter->iCursorOffset < 0) iter->iCursorOffset++;
800                  } else {                  } else {
801                          size_t cursorPos = bufferedCommands[socket].size() + iter->iCursorOffset;                          ssize_t cursorPos = bufferedCommands[socket].size() + iter->iCursorOffset;
802                          // backspace character - should only happen with shell                          // backspace character - should only happen with shell
803                          if (c == '\b') {                          if (c == '\b') {
804                                  if (!bufferedCommands[socket].empty() && cursorPos > 0)                                  if (!bufferedCommands[socket].empty() && cursorPos > 0)
# Line 1146  String LSCPServer::GetAvailableEngines() Line 1146  String LSCPServer::GetAvailableEngines()
1146      dmsg(2,("LSCPServer: GetAvailableEngines()\n"));      dmsg(2,("LSCPServer: GetAvailableEngines()\n"));
1147      LSCPResultSet result;      LSCPResultSet result;
1148      try {      try {
1149          int n = EngineFactory::AvailableEngineTypes().size();          int n = (int)EngineFactory::AvailableEngineTypes().size();
1150          result.Add(n);          result.Add(n);
1151      }      }
1152      catch (Exception e) {      catch (Exception e) {
# Line 1350  String LSCPServer::GetAvailableAudioOutp Line 1350  String LSCPServer::GetAvailableAudioOutp
1350      dmsg(2,("LSCPServer: GetAvailableAudioOutputDrivers()\n"));      dmsg(2,("LSCPServer: GetAvailableAudioOutputDrivers()\n"));
1351      LSCPResultSet result;      LSCPResultSet result;
1352      try {      try {
1353          int n = AudioOutputDeviceFactory::AvailableDrivers().size();          int n = (int) AudioOutputDeviceFactory::AvailableDrivers().size();
1354          result.Add(n);          result.Add(n);
1355      }      }
1356      catch (Exception e) {      catch (Exception e) {
# Line 1376  String LSCPServer::GetAvailableMidiInput Line 1376  String LSCPServer::GetAvailableMidiInput
1376      dmsg(2,("LSCPServer: GetAvailableMidiInputDrivers()\n"));      dmsg(2,("LSCPServer: GetAvailableMidiInputDrivers()\n"));
1377      LSCPResultSet result;      LSCPResultSet result;
1378      try {      try {
1379          int n = MidiInputDeviceFactory::AvailableDrivers().size();          int n = (int)MidiInputDeviceFactory::AvailableDrivers().size();
1380          result.Add(n);          result.Add(n);
1381      }      }
1382      catch (Exception e) {      catch (Exception e) {
# Line 2434  String LSCPServer::GetMidiInstrumentMaps Line 2434  String LSCPServer::GetMidiInstrumentMaps
2434      dmsg(2,("LSCPServer: GetMidiInstrumentMaps()\n"));      dmsg(2,("LSCPServer: GetMidiInstrumentMaps()\n"));
2435      LSCPResultSet result;      LSCPResultSet result;
2436      try {      try {
2437          result.Add(MidiInstrumentMapper::Maps().size());          result.Add(int(MidiInstrumentMapper::Maps().size()));
2438      } catch (Exception e) {      } catch (Exception e) {
2439          result.Error(e);          result.Error(e);
2440      }      }
# Line 3275  String LSCPServer::GetTotalVoiceCount() Line 3275  String LSCPServer::GetTotalVoiceCount()
3275  String LSCPServer::GetTotalVoiceCountMax() {  String LSCPServer::GetTotalVoiceCountMax() {
3276      dmsg(2,("LSCPServer: GetTotalVoiceCountMax()\n"));      dmsg(2,("LSCPServer: GetTotalVoiceCountMax()\n"));
3277      LSCPResultSet result;      LSCPResultSet result;
3278      result.Add(EngineFactory::EngineInstances().size() * pSampler->GetGlobalMaxVoices());      result.Add(int(EngineFactory::EngineInstances().size() * pSampler->GetGlobalMaxVoices()));
3279      return result.Produce();      return result.Produce();
3280  }  }
3281    
# Line 3377  String LSCPServer::GetFileInstruments(St Line 3377  String LSCPServer::GetFileInstruments(St
3377                  std::vector<InstrumentManager::instrument_id_t> IDs =                  std::vector<InstrumentManager::instrument_id_t> IDs =
3378                      pManager->GetInstrumentFileContent(Filename);                      pManager->GetInstrumentFileContent(Filename);
3379                  // return the amount of instruments in the file                  // return the amount of instruments in the file
3380                  result.Add(IDs.size());                  result.Add((int)IDs.size());
3381                  // no more need to ask other engine types                  // no more need to ask other engine types
3382                  bFound = true;                  bFound = true;
3383              } else dmsg(1,("Warning: engine '%s' does not provide an instrument manager\n", engineTypes[i].c_str()));              } else dmsg(1,("Warning: engine '%s' does not provide an instrument manager\n", engineTypes[i].c_str()));

Legend:
Removed from v.3053  
changed lines
  Added in v.3054

  ViewVC Help
Powered by ViewVC