52 |
fd_set LSCPServer::fdSet; |
fd_set LSCPServer::fdSet; |
53 |
int LSCPServer::currentSocket = -1; |
int LSCPServer::currentSocket = -1; |
54 |
std::vector<yyparse_param_t> LSCPServer::Sessions = std::vector<yyparse_param_t>(); |
std::vector<yyparse_param_t> LSCPServer::Sessions = std::vector<yyparse_param_t>(); |
55 |
|
std::vector<yyparse_param_t>::iterator itCurrentSession = std::vector<yyparse_param_t>::iterator(); |
56 |
std::map<int,String> LSCPServer::bufferedNotifies = std::map<int,String>(); |
std::map<int,String> LSCPServer::bufferedNotifies = std::map<int,String>(); |
57 |
std::map<int,String> LSCPServer::bufferedCommands = std::map<int,String>(); |
std::map<int,String> LSCPServer::bufferedCommands = std::map<int,String>(); |
58 |
std::map< LSCPEvent::event_t, std::list<int> > LSCPServer::eventSubscriptions = std::map< LSCPEvent::event_t, std::list<int> >(); |
std::map< LSCPEvent::event_t, std::list<int> > LSCPServer::eventSubscriptions = std::map< LSCPEvent::event_t, std::list<int> >(); |
219 |
|
|
220 |
listen(hSocket, 1); |
listen(hSocket, 1); |
221 |
Initialized.Set(true); |
Initialized.Set(true); |
222 |
|
|
223 |
// Registering event listeners |
// Registering event listeners |
224 |
pSampler->AddChannelCountListener(&eventHandler); |
pSampler->AddChannelCountListener(&eventHandler); |
225 |
pSampler->AddAudioDeviceCountListener(&eventHandler); |
pSampler->AddAudioDeviceCountListener(&eventHandler); |
328 |
int dummy; // just a temporary hack to fulfill the restart() function prototype |
int dummy; // just a temporary hack to fulfill the restart() function prototype |
329 |
restart(NULL, dummy); // restart the 'scanner' |
restart(NULL, dummy); // restart the 'scanner' |
330 |
currentSocket = (*iter).hSession; //a hack |
currentSocket = (*iter).hSession; //a hack |
331 |
|
itCurrentSession = iter; // another hack |
332 |
dmsg(2,("LSCPServer: [%s]\n",bufferedCommands[currentSocket].c_str())); |
dmsg(2,("LSCPServer: [%s]\n",bufferedCommands[currentSocket].c_str())); |
333 |
if ((*iter).bVerbose) { // if echo mode enabled |
if ((*iter).bVerbose) { // if echo mode enabled |
334 |
AnswerClient(bufferedCommands[currentSocket]); |
AnswerClient(bufferedCommands[currentSocket]); |
335 |
} |
} |
336 |
int result = yyparse(&(*iter)); |
int result = yyparse(&(*iter)); |
337 |
currentSocket = -1; //continuation of a hack |
currentSocket = -1; //continuation of a hack |
338 |
|
itCurrentSession = Sessions.end(); // hack as well |
339 |
dmsg(3,("LSCPServer: Done parsing on socket %d.\n", currentSocket)); |
dmsg(3,("LSCPServer: Done parsing on socket %d.\n", currentSocket)); |
340 |
if (result == LSCP_QUIT) { //Was it a quit command by any chance? |
if (result == LSCP_QUIT) { //Was it a quit command by any chance? |
341 |
CloseConnection(iter); |
CloseConnection(iter); |
428 |
return command.size(); |
return command.size(); |
429 |
} |
} |
430 |
|
|
431 |
|
extern yyparse_param_t* GetCurrentYaccSession() { |
432 |
|
return &(*itCurrentSession); |
433 |
|
} |
434 |
|
|
435 |
/** |
/** |
436 |
* Will be called to try to read the command from the socket |
* Will be called to try to read the command from the socket |
437 |
* If command is read, it will return true. Otherwise false is returned. |
* If command is read, it will return true. Otherwise false is returned. |
619 |
EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel(); |
EngineChannel* pEngineChannel = pSamplerChannel->GetEngineChannel(); |
620 |
if (!pEngineChannel) throw Exception("There is no engine deployed on this sampler channel yet"); |
if (!pEngineChannel) throw Exception("There is no engine deployed on this sampler channel yet"); |
621 |
|
|
622 |
return pEngineChannel; |
return pEngineChannel; |
623 |
} |
} |
624 |
|
|
625 |
/** |
/** |
2006 |
LSCPResultSet result; |
LSCPResultSet result; |
2007 |
try { |
try { |
2008 |
EngineChannel* pEngineChannel = GetEngineChannel(uiSamplerChannel); |
EngineChannel* pEngineChannel = GetEngineChannel(uiSamplerChannel); |
2009 |
|
|
2010 |
FxSend* pFxSend = pEngineChannel->AddFxSend(MidiCtrl, Name); |
FxSend* pFxSend = pEngineChannel->AddFxSend(MidiCtrl, Name); |
2011 |
if (!pFxSend) throw Exception("Could not add FxSend, don't ask, I don't know why (probably a bug)"); |
if (!pFxSend) throw Exception("Could not add FxSend, don't ask, I don't know why (probably a bug)"); |
2012 |
|
|
2090 |
try { |
try { |
2091 |
EngineChannel* pEngineChannel = GetEngineChannel(uiSamplerChannel); |
EngineChannel* pEngineChannel = GetEngineChannel(uiSamplerChannel); |
2092 |
FxSend* pFxSend = GetFxSend(uiSamplerChannel, FxSendID); |
FxSend* pFxSend = GetFxSend(uiSamplerChannel, FxSendID); |
2093 |
|
|
2094 |
// gather audio routing informations |
// gather audio routing informations |
2095 |
String AudioRouting; |
String AudioRouting; |
2096 |
for (int chan = 0; chan < pEngineChannel->Channels(); chan++) { |
for (int chan = 0; chan < pEngineChannel->Channels(); chan++) { |
2230 |
#else |
#else |
2231 |
result.Add("INSTRUMENTS_DB_SUPPORT", "no"); |
result.Add("INSTRUMENTS_DB_SUPPORT", "no"); |
2232 |
#endif |
#endif |
2233 |
|
|
2234 |
return result.Produce(); |
return result.Produce(); |
2235 |
} |
} |
2236 |
|
|
2479 |
} else { |
} else { |
2480 |
throw Exception("Unknown scan mode: " + ScanMode); |
throw Exception("Unknown scan mode: " + ScanMode); |
2481 |
} |
} |
2482 |
|
|
2483 |
if (bBackground) result = id; |
if (bBackground) result = id; |
2484 |
} catch (Exception e) { |
} catch (Exception e) { |
2485 |
result.Error(e); |
result.Error(e); |
2773 |
if (s2.at(i) == '\r') s2.at(i) = ' '; |
if (s2.at(i) == '\r') s2.at(i) = ' '; |
2774 |
else if (s2.at(i) == '\n') s2.at(i) = ' '; |
else if (s2.at(i) == '\n') s2.at(i) = ' '; |
2775 |
} |
} |
2776 |
|
|
2777 |
return s2; |
return s2; |
2778 |
} |
} |