/[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 1399 by schoenebeck, Thu Oct 11 18:53:29 2007 UTC revision 1471 by schoenebeck, Mon Nov 5 13:56:26 2007 UTC
# Line 58  static String _escapeLscpResponse(String Line 58  static String _escapeLscpResponse(String
58              !(c == '*') && !(c == '+') && !(c == ',') && !(c == '-') &&              !(c == '*') && !(c == '+') && !(c == ',') && !(c == '-') &&
59              !(c == '.') && !(c == '/') && !(c == ':') && !(c == ';') &&              !(c == '.') && !(c == '/') && !(c == ':') && !(c == ';') &&
60              !(c == '<') && !(c == '=') && !(c == '>') && !(c == '?') &&              !(c == '<') && !(c == '=') && !(c == '>') && !(c == '?') &&
61              !(c == '@') && !(c == '[') && !(c == '\\') && !(c == ']') &&              !(c == '@') && !(c == '[') && !(c == ']') &&
62              !(c == '^') && !(c == '_') && !(c == '`') && !(c == '{') &&              !(c == '^') && !(c == '_') && !(c == '`') && !(c == '{') &&
63              !(c == '|') && !(c == '}') && !(c == '~')              !(c == '|') && !(c == '}') && !(c == '~')
64          ) {          ) {
# Line 877  String LSCPServer::GetChannelInfo(uint u Line 877  String LSCPServer::GetChannelInfo(uint u
877          if (pSamplerChannel->GetMidiInputChannel() == midi_chan_all) result.Add("MIDI_INPUT_CHANNEL", "ALL");          if (pSamplerChannel->GetMidiInputChannel() == midi_chan_all) result.Add("MIDI_INPUT_CHANNEL", "ALL");
878          else result.Add("MIDI_INPUT_CHANNEL", pSamplerChannel->GetMidiInputChannel());          else result.Add("MIDI_INPUT_CHANNEL", pSamplerChannel->GetMidiInputChannel());
879    
880          result.Add("INSTRUMENT_FILE",          // convert the filename into the correct encoding as defined for LSCP
881                     (InstrumentFileName != "NONE" && InstrumentFileName != "") ?          // (especially in terms of special characters -> escape sequences)
882                          Path::fromPosix(InstrumentFileName).toLscp() : // TODO: assuming POSIX          if (InstrumentFileName != "NONE" && InstrumentFileName != "") {
883                          InstrumentFileName  #if WIN32
884          );              InstrumentFileName = Path::fromWindows(InstrumentFileName).toLscp();
885    #else
886                // assuming POSIX
887                InstrumentFileName = Path::fromPosix(InstrumentFileName).toLscp();
888    #endif
889            }
890    
891            result.Add("INSTRUMENT_FILE", InstrumentFileName);
892          result.Add("INSTRUMENT_NR", InstrumentIndex);          result.Add("INSTRUMENT_NR", InstrumentIndex);
893          result.Add("INSTRUMENT_NAME", _escapeLscpResponse(InstrumentName));          result.Add("INSTRUMENT_NAME", _escapeLscpResponse(InstrumentName));
894          result.Add("INSTRUMENT_STATUS", InstrumentStatus);          result.Add("INSTRUMENT_STATUS", InstrumentStatus);
# Line 1825  String LSCPServer::GetMidiInstrumentMapp Line 1832  String LSCPServer::GetMidiInstrumentMapp
1832          std::map<midi_prog_index_t,MidiInstrumentMapper::entry_t>::iterator iter = mappings.find(idx);          std::map<midi_prog_index_t,MidiInstrumentMapper::entry_t>::iterator iter = mappings.find(idx);
1833          if (iter == mappings.end()) result.Error("there is no map entry with that index");          if (iter == mappings.end()) result.Error("there is no map entry with that index");
1834          else { // found          else { // found
1835    
1836                // convert the filename into the correct encoding as defined for LSCP
1837                // (especially in terms of special characters -> escape sequences)
1838    #if WIN32
1839                const String instrumentFileName = Path::fromWindows(iter->second.InstrumentFile).toLscp();
1840    #else
1841                // assuming POSIX
1842                const String instrumentFileName = Path::fromPosix(iter->second.InstrumentFile).toLscp();
1843    #endif
1844    
1845              result.Add("NAME", _escapeLscpResponse(iter->second.Name));              result.Add("NAME", _escapeLscpResponse(iter->second.Name));
1846              result.Add("ENGINE_NAME", iter->second.EngineName);              result.Add("ENGINE_NAME", iter->second.EngineName);
1847              result.Add("INSTRUMENT_FILE", Path::fromPosix(iter->second.InstrumentFile).toLscp()); //TODO: assuming POSIX              result.Add("INSTRUMENT_FILE", instrumentFileName);
1848              result.Add("INSTRUMENT_NR", (int) iter->second.InstrumentIndex);              result.Add("INSTRUMENT_NR", (int) iter->second.InstrumentIndex);
1849              String instrumentName;              String instrumentName;
1850              Engine* pEngine = EngineFactory::Create(iter->second.EngineName);              Engine* pEngine = EngineFactory::Create(iter->second.EngineName);
# Line 2416  String LSCPServer::GetDbInstrumentDirect Line 2433  String LSCPServer::GetDbInstrumentDirect
2433      try {      try {
2434          DbDirectory info = InstrumentsDb::GetInstrumentsDb()->GetDirectoryInfo(Dir);          DbDirectory info = InstrumentsDb::GetInstrumentsDb()->GetDirectoryInfo(Dir);
2435    
2436          result.Add("DESCRIPTION", InstrumentsDb::toEscapedText(info.Description));          result.Add("DESCRIPTION", _escapeLscpResponse(info.Description));
2437          result.Add("CREATED", info.Created);          result.Add("CREATED", info.Created);
2438          result.Add("MODIFIED", info.Modified);          result.Add("MODIFIED", info.Modified);
2439      } catch (Exception e) {      } catch (Exception e) {
# Line 2600  String LSCPServer::GetDbInstrumentInfo(S Line 2617  String LSCPServer::GetDbInstrumentInfo(S
2617          result.Add("SIZE", (int)info.Size);          result.Add("SIZE", (int)info.Size);
2618          result.Add("CREATED", info.Created);          result.Add("CREATED", info.Created);
2619          result.Add("MODIFIED", info.Modified);          result.Add("MODIFIED", info.Modified);
2620          result.Add("DESCRIPTION", InstrumentsDb::toEscapedText(info.Description));          result.Add("DESCRIPTION", _escapeLscpResponse(info.Description));
2621          result.Add("IS_DRUM", info.IsDrum);          result.Add("IS_DRUM", info.IsDrum);
2622          result.Add("PRODUCT", InstrumentsDb::toEscapedText(info.Product));          result.Add("PRODUCT", _escapeLscpResponse(info.Product));
2623          result.Add("ARTISTS", InstrumentsDb::toEscapedText(info.Artists));          result.Add("ARTISTS", _escapeLscpResponse(info.Artists));
2624          result.Add("KEYWORDS", InstrumentsDb::toEscapedText(info.Keywords));          result.Add("KEYWORDS", _escapeLscpResponse(info.Keywords));
2625      } catch (Exception e) {      } catch (Exception e) {
2626           result.Error(e);           result.Error(e);
2627      }      }

Legend:
Removed from v.1399  
changed lines
  Added in v.1471

  ViewVC Help
Powered by ViewVC