Deluge Firmware
1.3.0
Build date: 2026.08.16
Toggle main menu visibility
Loading...
Searching...
No Matches
sample_cache.h
1
/*
2
* Copyright © 2018-2023 Synthstrom Audible Limited
3
*
4
* This file is part of The Synthstrom Audible Deluge Firmware.
5
*
6
* The Synthstrom Audible Deluge Firmware is free software: you can redistribute it and/or modify it under the
7
* terms of the GNU General Public License as published by the Free Software Foundation,
8
* either version 3 of the License, or (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
11
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
* See the GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License along with this program.
15
* If not, see <https://www.gnu.org/licenses/>.
16
*/
17
18
#pragma once
19
20
#include "definitions_cxx.hpp"
21
22
class
Sample
;
23
class
Cluster
;
24
25
class
SampleCache {
26
public
:
27
SampleCache(
Sample
* newSample, int32_t newNumClusters, int32_t newWaveformLengthBytes, int32_t newPhaseIncrement,
28
int32_t newTimeStretchRatio, int32_t newSkipSamplesAtStart,
bool
newReversed);
29
~SampleCache();
30
void
clusterStolen(int32_t clusterIndex);
31
bool
setupNewCluster(int32_t cachedClusterIndex);
32
Cluster
* getCluster(int32_t clusterIndex);
33
void
setWriteBytePos(int32_t newWriteBytePos);
34
35
int32_t writeBytePos;
36
#if ALPHA_OR_BETA_VERSION
37
int32_t numClusters;
38
#endif
39
int32_t waveformLengthBytes;
40
Sample
* sample;
41
int32_t phaseIncrement;
42
int32_t timeStretchRatio;
43
int32_t skipSamplesAtStart;
44
bool
reversed;
45
46
private
:
47
void
unlinkClusters(int32_t startAtIndex,
bool
beingDestructed);
48
int32_t getNumExistentClusters(int32_t thisWriteBytePos);
49
void
prioritizeNotStealingCluster(int32_t clusterIndex);
50
51
// This has to be last!!!
52
Cluster
* clusters[1];
// These are not initialized, and are only "valid" as far as writeBytePos dictates
53
};
Cluster
Definition
cluster.h:34
Sample
Definition
sample.h:50