MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / progressTrack

Method progressTrack

framework/jukebox.cpp:79–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77 }
78
79 static void progressTrack(void *data)
80 {
81 JukeBoxImpl *jukebox = static_cast<JukeBoxImpl *>(data);
82 if (jukebox->trackList.empty())
83 {
84 LogWarning("Trying to play empty jukebox");
85 return;
86 }
87 if (jukebox->position >= jukebox->trackList.size())
88 {
89 LogInfo("End of jukebox playlist");
90 return;
91 }
92 LogInfo("Playing track %u (%s)", jukebox->position,
93 jukebox->trackList[jukebox->position]->getName());
94 jukebox->fw.soundBackend->setTrack(jukebox->trackList[jukebox->position]);
95
96 jukebox->position++;
97 if (jukebox->position >= jukebox->trackList.size())
98 {
99 if (jukebox->mode == PlayMode::Loop)
100 {
101 jukebox->position = 0;
102 }
103 else if (jukebox->mode == PlayMode::Shuffle)
104 {
105 jukebox->position = 0;
106 jukebox->shuffle();
107 }
108 }
109 }
110
111 void stop() override
112 {

Callers 1

playMethod · 0.95

Calls 5

emptyMethod · 0.80
shuffleMethod · 0.80
sizeMethod · 0.45
getNameMethod · 0.45
setTrackMethod · 0.45

Tested by

no test coverage detected