tracktion-engine 3.0-10-g034fdde4aa5
Tracktion Engine — High level data model for audio applications

« « « Anklang Documentation
Loading...
Searching...
No Matches
tracktion_AudioReader.h
Go to the documentation of this file.
1 /*
2 ,--. ,--. ,--. ,--.
3 ,-' '-.,--.--.,--,--.,---.| |,-.,-' '-.`--' ,---. ,--,--, Copyright 2024
4 '-. .-'| .--' ,-. | .--'| /'-. .-',--.| .-. || \ Tracktion Software
5 | | | | \ '-' \ `--.| \ \ | | | |' '-' '| || | Corporation
6 `---' `--' `--`--'`---'`--'`--' `---' `--' `---' `--''--' www.tracktion.com
7
8 Tracktion Engine uses a GPL/commercial licence - see LICENCE.md for details.
9*/
10
11#pragma once
12
13#if __has_include(<choc/audio/choc_SampleBuffers.h>)
14 #include <choc/audio/choc_SampleBuffers.h>
15#else
16 #include "../../3rd_party/choc/audio/choc_SampleBuffers.h"
17#endif
18
19#include "../utilities/tracktion_Time.h"
20#include "tracktion_Types.h"
21
22
23namespace tracktion { inline namespace core
24{
25
26//==============================================================================
27//==============================================================================
32{
33public:
34 //==============================================================================
36 virtual ~AudioReader() = default;
37
39 virtual choc::buffer::ChannelCount getNumChannels() = 0;
40
42 virtual double getSampleRate() = 0;
43
44 //==============================================================================
46 virtual SampleCount getPosition() = 0;
47
49 virtual void setPosition (SampleCount) = 0;
50
52 virtual void setPosition (TimePosition) = 0;
53
55 virtual void reset() = 0;
56
57 //==============================================================================
59 virtual bool readSamples (choc::buffer::ChannelArrayView<float>&) = 0;
60};
61
62}} // namespace tracktion { inline namespace core
Base class for audio based readers that can be chained together.
virtual SampleCount getPosition()=0
Must return the sample position that will be read from next.
virtual void setPosition(TimePosition)=0
Should set the time position to be read from next.
virtual double getSampleRate()=0
Should set the time position to be read from next.
virtual void reset()=0
Signifies a break in continuity and that the stream should reset itself.
virtual ~AudioReader()=default
Destructor.
virtual bool readSamples(choc::buffer::ChannelArrayView< float > &)=0
Must read a number of frames from the source, filling the buffer.
virtual choc::buffer::ChannelCount getNumChannels()=0
Must return the number of channels in the reader.
virtual void setPosition(SampleCount)=0
Should set the sample position to be read from next.
Represents a position in real-life time.