24 |
#include <algorithm> |
#include <algorithm> |
25 |
#include <string> |
#include <string> |
26 |
|
|
27 |
|
#include "../common/File.h" |
28 |
#include "lscpserver.h" |
#include "lscpserver.h" |
29 |
#include "lscpresultset.h" |
#include "lscpresultset.h" |
30 |
#include "lscpevent.h" |
#include "lscpevent.h" |
335 |
} |
} |
336 |
#endif // HAVE_SQLITE3 |
#endif // HAVE_SQLITE3 |
337 |
|
|
338 |
|
void LSCPServer::RemoveListeners() { |
339 |
|
pSampler->RemoveChannelCountListener(&eventHandler); |
340 |
|
pSampler->RemoveAudioDeviceCountListener(&eventHandler); |
341 |
|
pSampler->RemoveMidiDeviceCountListener(&eventHandler); |
342 |
|
pSampler->RemoveVoiceCountListener(&eventHandler); |
343 |
|
pSampler->RemoveStreamCountListener(&eventHandler); |
344 |
|
pSampler->RemoveBufferFillListener(&eventHandler); |
345 |
|
pSampler->RemoveTotalStreamCountListener(&eventHandler); |
346 |
|
pSampler->RemoveTotalVoiceCountListener(&eventHandler); |
347 |
|
pSampler->RemoveFxSendCountListener(&eventHandler); |
348 |
|
MidiInstrumentMapper::RemoveMidiInstrumentCountListener(&eventHandler); |
349 |
|
MidiInstrumentMapper::RemoveMidiInstrumentInfoListener(&eventHandler); |
350 |
|
MidiInstrumentMapper::RemoveMidiInstrumentMapCountListener(&eventHandler); |
351 |
|
MidiInstrumentMapper::RemoveMidiInstrumentMapInfoListener(&eventHandler); |
352 |
|
#if HAVE_SQLITE3 |
353 |
|
InstrumentsDb::GetInstrumentsDb()->RemoveInstrumentsDbListener(&dbInstrumentsEventHandler); |
354 |
|
#endif |
355 |
|
} |
356 |
|
|
357 |
/** |
/** |
358 |
* Blocks the calling thread until the LSCP Server is initialized and |
* Blocks the calling thread until the LSCP Server is initialized and |
1278 |
for (;iter != parameters.end(); iter++) { |
for (;iter != parameters.end(); iter++) { |
1279 |
if (s != "") s += ","; |
if (s != "") s += ","; |
1280 |
s += iter->first; |
s += iter->first; |
1281 |
|
delete iter->second; |
1282 |
} |
} |
1283 |
result.Add("PARAMETERS", s); |
result.Add("PARAMETERS", s); |
1284 |
} |
} |
1303 |
for (;iter != parameters.end(); iter++) { |
for (;iter != parameters.end(); iter++) { |
1304 |
if (s != "") s += ","; |
if (s != "") s += ","; |
1305 |
s += iter->first; |
s += iter->first; |
1306 |
|
delete iter->second; |
1307 |
} |
} |
1308 |
result.Add("PARAMETERS", s); |
result.Add("PARAMETERS", s); |
1309 |
} |
} |
1334 |
if (oRangeMin) result.Add("RANGE_MIN", *oRangeMin); |
if (oRangeMin) result.Add("RANGE_MIN", *oRangeMin); |
1335 |
if (oRangeMax) result.Add("RANGE_MAX", *oRangeMax); |
if (oRangeMax) result.Add("RANGE_MAX", *oRangeMax); |
1336 |
if (oPossibilities) result.Add("POSSIBILITIES", *oPossibilities); |
if (oPossibilities) result.Add("POSSIBILITIES", *oPossibilities); |
1337 |
|
delete pParameter; |
1338 |
} |
} |
1339 |
catch (Exception e) { |
catch (Exception e) { |
1340 |
result.Error(e); |
result.Error(e); |
1362 |
if (oRangeMin) result.Add("RANGE_MIN", *oRangeMin); |
if (oRangeMin) result.Add("RANGE_MIN", *oRangeMin); |
1363 |
if (oRangeMax) result.Add("RANGE_MAX", *oRangeMax); |
if (oRangeMax) result.Add("RANGE_MAX", *oRangeMax); |
1364 |
if (oPossibilities) result.Add("POSSIBILITIES", *oPossibilities); |
if (oPossibilities) result.Add("POSSIBILITIES", *oPossibilities); |
1365 |
|
delete pParameter; |
1366 |
} |
} |
1367 |
catch (Exception e) { |
catch (Exception e) { |
1368 |
result.Error(e); |
result.Error(e); |
2823 |
throw Exception("Directory is specified"); |
throw Exception("Directory is specified"); |
2824 |
} |
} |
2825 |
#else |
#else |
2826 |
struct stat statBuf; |
File f(Filename); |
2827 |
int res = stat(Filename.c_str(), &statBuf); |
if(!f.Exist()) throw Exception(f.GetErrorMsg()); |
2828 |
if (res) { |
if (f.IsDirectory()) throw Exception("Directory is specified"); |
|
std::stringstream ss; |
|
|
ss << "Fail to stat `" << Filename << "`: " << strerror(errno); |
|
|
throw Exception(ss.str()); |
|
|
} |
|
|
|
|
|
if (S_ISDIR(statBuf.st_mode)) { |
|
|
throw Exception("Directory is specified"); |
|
|
} |
|
2829 |
#endif |
#endif |
2830 |
} |
} |
2831 |
|
|