36class SampleLowLevelReader {
38 SampleLowLevelReader() =
default;
39 virtual ~SampleLowLevelReader() { unassignAllReasons(
false); };
40 explicit SampleLowLevelReader(SampleLowLevelReader&,
bool stealReasons =
false);
41 SampleLowLevelReader(SampleLowLevelReader&& other)
noexcept;
42 SampleLowLevelReader& operator=(
const SampleLowLevelReader& other) =
delete;
43 SampleLowLevelReader& operator=(SampleLowLevelReader&& other)
noexcept;
45 void unassignAllReasons(
bool wontBeUsedAgain);
46 void jumpForwardLinear(int32_t numChannels, int32_t byteDepth, uint32_t bitMask, int32_t jumpAmount,
47 int32_t phaseIncrement);
48 void jumpForwardZeroes(int32_t bufferSize, int32_t numChannels, int32_t phaseIncrement);
49 void fillInterpolationBufferRetrospectively(
Sample* sample, int32_t bufferSize, int32_t startI,
50 int32_t playDirection);
51 void jumpBackSamples(
Sample* sample, int32_t numToJumpBack, int32_t playDirection);
55 bool justLooped =
false, int32_t priorityRating = 1);
58 int32_t priorityRating = 1);
60 bool loopingAtLowLevel, int32_t bufferSize,
bool allowEndlessSilenceAtEnd =
false,
61 int32_t priorityRating = 1);
63 void misalignPlaybackParameters(
Sample* sample);
64 void realignPlaybackParameters(
Sample* sample);
67 bool compensateForInterpolationBuffer =
false);
70 int32_t priorityRating);
72 [[nodiscard]]
virtual bool shouldObeyMarkers()
const {
return false; }
74 void readSamplesNative(int32_t** __restrict__ oscBufferPos, int32_t numSamplesTotal,
Sample* sample,
75 int32_t jumpAmount, int32_t numChannels, int32_t numChannelsAfterCondensing,
76 int32_t* amplitude, int32_t amplitudeIncrement,
TimeStretcher* timeStretcher =
nullptr,
77 bool bufferingToTimeStretcher =
false);
79 void readSamplesResampled(int32_t** __restrict__ oscBufferPos, int32_t numSamples,
Sample* sample,
80 int32_t jumpAmount, int32_t numChannels, int32_t numChannelsAfterCondensing,
81 int32_t phaseIncrement, int32_t* amplitude, int32_t amplitudeIncrement,
82 int32_t bufferSize,
bool writingCache,
char** __restrict__ cacheWritePos,
83 bool* doneAnySamplesYet,
TimeStretcher* timeStretcher,
bool bufferingToTimeStretcher,
87 int32_t numSamples, int32_t numChannels, int32_t numChannelsAfterCondensing,
88 int32_t phaseIncrement, int32_t amplitude, int32_t amplitudeIncrement,
89 bool loopingAtLowLevel, int32_t jumpAmount, int32_t bufferSize,
91 int32_t whichPlayHead, int32_t whichKernel, int32_t priorityRating);
92 void steal_clusters(SampleLowLevelReader& other,
bool stealReasons);
94 void bufferIndividualSampleForInterpolation(int32_t numChannels, int32_t byteDepth,
char* playPosNow);
95 void bufferZeroForInterpolation(int32_t numChannels);
98 char* currentPlayPos{};
99 char* reassessmentLocation{};
100 char* clusterStartLocation{};
101 uint8_t reassessmentAction{};
102 int8_t interpolationBufferSizeLastTime{};
106 std::array<Cluster*, kNumClustersLoadedAhead> clusters = {
nullptr,
nullptr};
111 bool loopingAtLowLevel, int32_t numSpacesToFill, int32_t priorityRating);