Skip to content

Commit ea3a18a

Browse files
authored
Merge pull request #1648 from DragoonBoots/#1604
Add in/out point support to ola_recorder
2 parents 28fa304 + 3e1a6c4 commit ea3a18a

6 files changed

Lines changed: 503 additions & 118 deletions

File tree

examples/ShowLoader.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,14 @@ void ShowLoader::Reset() {
9191
}
9292

9393

94+
/**
95+
* @brief Get most recent line number read (1-indexed)
96+
*/
97+
unsigned int ShowLoader::GetCurrentLineNumber() const {
98+
return m_line;
99+
}
100+
101+
94102
/**
95103
* Get the next time offset
96104
* @param timeout a pointer to the timeout in ms
@@ -141,6 +149,26 @@ ShowLoader::State ShowLoader::NextFrame(unsigned int *universe,
141149
}
142150

143151

152+
/**
153+
* Read the next show file entry
154+
* @param entry a ShowEntry to fill with data
155+
*/
156+
ShowLoader::State ShowLoader::NextEntry(ShowEntry *entry) {
157+
State state = NextFrame(&entry->universe, &entry->buffer);
158+
if (state != State::OK) {
159+
return state;
160+
}
161+
162+
state = NextTimeout(&entry->next_wait);
163+
if (state == State::END_OF_FILE) {
164+
// Ensure the entry is whole before sending.
165+
entry->next_wait = 0;
166+
}
167+
168+
return state;
169+
}
170+
171+
144172
void ShowLoader::ReadLine(string *line) {
145173
getline(m_show_file, *line);
146174
ola::StripSuffix(line, "\r");

examples/ShowLoader.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@
2626
#ifndef EXAMPLES_SHOWLOADER_H_
2727
#define EXAMPLES_SHOWLOADER_H_
2828

29+
/**
30+
* Holds a single entry in the show file
31+
*/
32+
struct ShowEntry {
33+
unsigned int universe;
34+
ola::DmxBuffer buffer;
35+
unsigned int next_wait;
36+
};
37+
2938
/**
3039
* Loads a show file and reads the DMX data.
3140
*/
@@ -42,9 +51,9 @@ class ShowLoader {
4251

4352
bool Load();
4453
void Reset();
54+
unsigned int GetCurrentLineNumber() const;
4555

46-
State NextTimeout(unsigned int *timeout);
47-
State NextFrame(unsigned int *universe, ola::DmxBuffer *data);
56+
State NextEntry(ShowEntry *entry);
4857

4958
private:
5059
const std::string m_filename;
@@ -54,5 +63,7 @@ class ShowLoader {
5463
static const char OLA_SHOW_HEADER[];
5564

5665
void ReadLine(std::string *line);
66+
State NextTimeout(unsigned int *timeout);
67+
State NextFrame(unsigned int *universe, ola::DmxBuffer *data);
5768
};
5869
#endif // EXAMPLES_SHOWLOADER_H_

0 commit comments

Comments
 (0)