128 |
FD_SET(hSocket, &fdSet); |
FD_SET(hSocket, &fdSet); |
129 |
int maxSessions = hSocket; |
int maxSessions = hSocket; |
130 |
|
|
131 |
|
timeval timeout; |
132 |
|
|
133 |
while (true) { |
while (true) { |
134 |
fd_set selectSet = fdSet; |
// check if some engine channel's parameter / status changed, if so notify the respective LSCP event subscribers |
135 |
int retval = select(maxSessions+1, &selectSet, NULL, NULL, NULL); |
{ |
136 |
|
std::set<EngineChannel*> engineChannels = EngineChannelFactory::EngineChannelInstances(); |
137 |
|
std::set<EngineChannel*>::iterator itEngineChannel = engineChannels.begin(); |
138 |
|
std::set<EngineChannel*>::iterator itEnd = engineChannels.end(); |
139 |
|
for (; itEngineChannel != itEnd; ++itEngineChannel) { |
140 |
|
if ((*itEngineChannel)->StatusChanged()) { |
141 |
|
SendLSCPNotify(LSCPEvent(LSCPEvent::event_channel_info, (*itEngineChannel)->iSamplerChannelIndex)); |
142 |
|
} |
143 |
|
} |
144 |
|
} |
145 |
|
|
146 |
|
//Now let's deliver late notifies (if any) |
147 |
|
NotifyBufferMutex.Lock(); |
148 |
|
for (std::map<int,String>::iterator iterNotify = bufferedNotifies.begin(); iterNotify != bufferedNotifies.end(); iterNotify++) { |
149 |
|
send(iterNotify->first, iterNotify->second.c_str(), iterNotify->second.size(), MSG_NOSIGNAL); |
150 |
|
bufferedNotifies.erase(iterNotify); |
151 |
|
} |
152 |
|
NotifyBufferMutex.Unlock(); |
153 |
|
|
154 |
|
fd_set selectSet = fdSet; |
155 |
|
timeout.tv_sec = 0; |
156 |
|
timeout.tv_usec = 100000; |
157 |
|
|
158 |
|
int retval = select(maxSessions+1, &selectSet, NULL, NULL, &timeout); |
159 |
|
|
160 |
if (retval == 0) |
if (retval == 0) |
161 |
continue; //Nothing try again |
continue; //Nothing try again |
162 |
if (retval == -1) { |
if (retval == -1) { |
216 |
break; |
break; |
217 |
} |
} |
218 |
} |
} |
|
|
|
|
// check if some engine channel's parameter / status changed, if so notify the respective LSCP event subscribers |
|
|
{ |
|
|
std::set<EngineChannel*> engineChannels = EngineChannelFactory::EngineChannelInstances(); |
|
|
std::set<EngineChannel*>::iterator itEngineChannel = engineChannels.begin(); |
|
|
std::set<EngineChannel*>::iterator itEnd = engineChannels.end(); |
|
|
for (; itEngineChannel != itEnd; ++itEngineChannel) { |
|
|
if ((*itEngineChannel)->StatusChanged()) { |
|
|
SendLSCPNotify(LSCPEvent(LSCPEvent::event_channel_info, (*itEngineChannel)->iSamplerChannelIndex)); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
//Now let's deliver late notifies (if any) |
|
|
NotifyBufferMutex.Lock(); |
|
|
for (std::map<int,String>::iterator iterNotify = bufferedNotifies.begin(); iterNotify != bufferedNotifies.end(); iterNotify++) { |
|
|
send(iterNotify->first, iterNotify->second.c_str(), iterNotify->second.size(), MSG_NOSIGNAL); |
|
|
bufferedNotifies.erase(iterNotify); |
|
|
} |
|
|
NotifyBufferMutex.Unlock(); |
|
219 |
} |
} |
220 |
} |
} |
221 |
|
|