MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / sortedSpeakers

Method sortedSpeakers

source/frontend/StarVoice.cpp:300–316  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

298}
299
300List<Voice::SpeakerPtr> Voice::sortedSpeakers(bool onlyPlaying) {
301 List<SpeakerPtr> result;
302
303 auto sorter = [](SpeakerPtr const& a, SpeakerPtr const& b) -> bool {
304 if (a->lastPlayTime != b->lastPlayTime)
305 return a->lastPlayTime < b->lastPlayTime;
306 else
307 return a->speakerId < b->speakerId;
308 };
309
310 for (auto& p : m_speakers) {
311 if (!onlyPlaying || p.second->playing)
312 result.insertSorted(p.second, sorter);
313 }
314
315 return result;
316}
317
318void Voice::clearSpeakers() {
319 auto it = m_speakers.begin();

Callers 1

makeVoiceCallbacksMethod · 0.80

Calls 1

insertSortedMethod · 0.80

Tested by

no test coverage detected