Deluge Firmware
1.3.0
Build date: 2026.08.16
Toggle main menu visibility
Loading...
Searching...
No Matches
sample_holder.h
1
/*
2
* Copyright © 2019-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
#include "model/sample/sample_playback_guide.h"
22
#include "storage/audio/audio_file_holder.h"
23
#include "util/d_string.h"
24
25
extern
"C"
{
26
#include "fatfs/ff.h"
27
}
28
29
class
Sample
;
30
class
Cluster
;
31
32
class
SampleHolder :
public
AudioFileHolder {
33
public
:
34
SampleHolder();
35
~SampleHolder()
override
;
36
void
unassignAllClusterReasons(
bool
beingDestructed =
false
)
override
;
37
int64_t getEndPos(
bool
forTimeStretching =
false
);
38
int64_t getDurationInSamples(
bool
forTimeStretching =
false
);
39
void
beenClonedFrom(SampleHolder
const
* other,
bool
reversed);
40
virtual
void
claimClusterReasons(
bool
reversed, int32_t clusterLoadInstruction = CLUSTER_ENQUEUE);
41
int32_t getLengthInSamplesAtSystemSampleRate(
bool
forTimeStretching =
false
);
42
int32_t getLoopLengthAtSystemSampleRate(
bool
forTimeStretching =
false
);
43
void
setAudioFile(
AudioFile
* newAudioFile,
bool
reversed =
false
,
bool
manuallySelected =
false
,
44
int32_t clusterLoadInstruction = CLUSTER_ENQUEUE)
override
;
45
46
// In samples.
47
uint64_t startPos;
48
uint64_t endPos;
// Don't access this directly. Call getPos(). This variable may be beyond the end of the sample
49
50
int32_t waveformViewScroll;
51
int32_t waveformViewZoom;
// 0 means neither of these vars set up yet
52
53
int32_t neutralPhaseIncrement;
54
55
Cluster
* clustersForStart[kNumClustersLoadedAhead];
56
57
protected
:
58
void
claimClusterReasonsForMarker(
Cluster
** clusters, uint32_t startPlaybackAtByte, int32_t playDirection,
59
int32_t clusterLoadInstruction);
60
virtual
void
sampleBeenSet(
bool
reversed,
bool
manuallySelected) {}
61
};
AudioFile
Definition
audio_file.h:26
Cluster
Definition
cluster.h:34
Sample
Definition
sample.h:50