Skip to content

Commit

Permalink
FileReader timestamp --> sampleNumber
Browse files Browse the repository at this point in the history
  • Loading branch information
jsiegle committed Aug 21, 2024
1 parent 2b7a2e8 commit fd70d52
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions Source/Processors/FileReader/FileReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ void FileReader::updateSettings()

isEnabled = true;

/* Set the timestamp to start of playback and reset loop counter */
/* Set the sample to start of playback and reset loop counter */
playbackSamplePos = startSample;
loopCount = 0;

Expand Down Expand Up @@ -666,19 +666,19 @@ void FileReader::addEventsInRange (int64 start, int64 stop)

for (int i = 0; i < events.channels.size(); i++)
{
int64 absoluteCurrentTimestamp = events.timestamps[i] + loopCount * (stopSample - startSample);
int64 absoluteCurrentSampleNumber = events.sampleNumbers[i] + loopCount * (stopSample - startSample);
if (events.text.size() && ! events.text[i].isEmpty())
{
String msg = events.text[i];
LOGD ("Broadcasting message: ", msg, " at timestamp: ", absoluteCurrentTimestamp, " channel: ", events.channels[i]);
LOGD ("File read broadcasting message: ", msg, " at sample number: ", absoluteCurrentSampleNumber, " channel: ", events.channels[i]);
broadcastMessage (msg);
}
else
{
uint8 ttlBit = events.channels[i];
bool state = events.channelStates[i] > 0;
TTLEventPtr event = TTLEvent::createTTLEvent (eventChannels[0], events.timestamps[i], ttlBit, state);
addEvent (event, int(absoluteCurrentTimestamp));
TTLEventPtr event = TTLEvent::createTTLEvent (eventChannels[0], events.sampleNumbers[i], ttlBit, state);
addEvent (event, int (absoluteCurrentSampleNumber));
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions Source/Processors/FileReader/ScrubberInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ void FullTimeline::paint (Graphics& g)

for (auto info : fileReader->getActiveEventInfo())
{
for (int i = 0; i < info.timestamps.size(); i++)
for (int i = 0; i < info.sampleNumbers.size(); i++)
{
int64 sampleNumber = info.timestamps[i]; //TODO: Update EventInfo object name timestamps -> sampleNumbers
int64 sampleNumber = info.sampleNumbers[i]; //TODO: Update EventInfo object name timestamps -> sampleNumbers
int16 state = info.channelStates[i];

if (state && sampleNumber >= startSample && sampleNumber <= stopSample)
Expand Down Expand Up @@ -193,9 +193,9 @@ void ZoomTimeline::paint (Graphics& g)

for (auto info : fileReader->getActiveEventInfo())
{
for (int i = 0; i < info.timestamps.size(); i++)
for (int i = 0; i < info.sampleNumbers.size(); i++)
{
int64 sampleNumber = info.timestamps[i];
int64 sampleNumber = info.sampleNumbers[i];
int16 state = info.channelStates[i];

if (state && sampleNumber >= startSampleNumber && sampleNumber <= stopSampleNumber)
Expand Down

0 comments on commit fd70d52

Please sign in to comment.