summaryrefslogtreecommitdiff
path: root/JttyReplay.hpp
blob: 5a95ece2e618adcf99d3ee7b54cf1ee4499777de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#ifndef JTTY_REPLAY_HPP
#define JTTY_REPLAY_HPP

#include "DecDataMutex.hpp"
#include <QMutexLocker>

inline int snapshotJttyFrames (int const& liveFrames)
{
  QMutexLocker lock {&dec_data_mutex ()};
  return liveFrames;
}

// Shared traversal used by manual replay and waterfall-picked replay.
// stopAfterFrame returns true for EOM or the picked replay's stop position.
// Snapshot once: newly arriving audio belongs to later live processing.
template<typename StopAfterFrame>
void replayJttyFrames (int const& liveFrames, StopAfterFrame stopAfterFrame)
{
  int const end = snapshotJttyFrames (liveFrames);
  for (int k = 3456; k < end; k += 3456)
    {
      if (stopAfterFrame (k)) break;
    }
}

#endif