72 |
LSCPEvent::RegisterEvent(LSCPEvent::event_buffer_fill, "BUFFER_FILL"); |
LSCPEvent::RegisterEvent(LSCPEvent::event_buffer_fill, "BUFFER_FILL"); |
73 |
LSCPEvent::RegisterEvent(LSCPEvent::event_channel_info, "CHANNEL_INFO"); |
LSCPEvent::RegisterEvent(LSCPEvent::event_channel_info, "CHANNEL_INFO"); |
74 |
LSCPEvent::RegisterEvent(LSCPEvent::event_misc, "MISCELLANEOUS"); |
LSCPEvent::RegisterEvent(LSCPEvent::event_misc, "MISCELLANEOUS"); |
75 |
|
LSCPEvent::RegisterEvent(LSCPEvent::event_total_voice_count, "TOTAL_VOICE_COUNT"); |
76 |
hSocket = -1; |
hSocket = -1; |
77 |
} |
} |
78 |
|
|
206 |
//Now let's deliver late notifies (if any) |
//Now let's deliver late notifies (if any) |
207 |
NotifyBufferMutex.Lock(); |
NotifyBufferMutex.Lock(); |
208 |
for (std::map<int,String>::iterator iterNotify = bufferedNotifies.begin(); iterNotify != bufferedNotifies.end(); iterNotify++) { |
for (std::map<int,String>::iterator iterNotify = bufferedNotifies.begin(); iterNotify != bufferedNotifies.end(); iterNotify++) { |
209 |
send(iterNotify->first, iterNotify->second.c_str(), iterNotify->second.size(), 0); |
send(iterNotify->first, iterNotify->second.c_str(), iterNotify->second.size(), MSG_NOSIGNAL); |
210 |
bufferedNotifies.erase(iterNotify); |
bufferedNotifies.erase(iterNotify); |
211 |
} |
} |
212 |
NotifyBufferMutex.Unlock(); |
NotifyBufferMutex.Unlock(); |
256 |
while (true) { |
while (true) { |
257 |
if (NotifyMutex.Trylock()) { |
if (NotifyMutex.Trylock()) { |
258 |
for(;iter != end; iter++) |
for(;iter != end; iter++) |
259 |
send(*iter, notify.c_str(), notify.size(), 0); |
send(*iter, notify.c_str(), notify.size(), MSG_NOSIGNAL); |
260 |
NotifyMutex.Unlock(); |
NotifyMutex.Unlock(); |
261 |
break; |
break; |
262 |
} else { |
} else { |
365 |
dmsg(2,("LSCPServer::AnswerClient(ReturnMessage=%s)", ReturnMessage.c_str())); |
dmsg(2,("LSCPServer::AnswerClient(ReturnMessage=%s)", ReturnMessage.c_str())); |
366 |
if (currentSocket != -1) { |
if (currentSocket != -1) { |
367 |
NotifyMutex.Lock(); |
NotifyMutex.Lock(); |
368 |
send(currentSocket, ReturnMessage.c_str(), ReturnMessage.size(), 0); |
send(currentSocket, ReturnMessage.c_str(), ReturnMessage.size(), MSG_NOSIGNAL); |
369 |
NotifyMutex.Unlock(); |
NotifyMutex.Unlock(); |
370 |
} |
} |
371 |
} |
} |
1546 |
return result.Produce(); |
return result.Produce(); |
1547 |
} |
} |
1548 |
|
|
1549 |
|
/** |
1550 |
|
* Will be called by the parser to return the current number of all active voices. |
1551 |
|
*/ |
1552 |
|
String LSCPServer::GetTotalVoiceCount() { |
1553 |
|
dmsg(2,("LSCPServer: GetTotalVoiceCount()\n")); |
1554 |
|
LSCPResultSet result; |
1555 |
|
result.Add(pSampler->GetVoiceCount()); |
1556 |
|
return result.Produce(); |
1557 |
|
} |
1558 |
|
|
1559 |
|
/** |
1560 |
|
* Will be called by the parser to return the maximum number of voices. |
1561 |
|
*/ |
1562 |
|
String LSCPServer::GetTotalVoiceCountMax() { |
1563 |
|
dmsg(2,("LSCPServer: GetTotalVoiceCountMax()\n")); |
1564 |
|
LSCPResultSet result; |
1565 |
|
result.Add(EngineFactory::EngineInstances().size() * CONFIG_MAX_VOICES); |
1566 |
|
return result.Produce(); |
1567 |
|
} |
1568 |
|
|
1569 |
/** |
/** |
1570 |
* Will be called by the parser to subscribe a client (frontend) on the |
* Will be called by the parser to subscribe a client (frontend) on the |
1571 |
* server for receiving event messages. |
* server for receiving event messages. |