JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
juce_AudioTransportSource.h
Go to the documentation of this file.
1 /*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 The code included in this file is provided under the terms of the ISC license
11 http://www.isc.org/downloads/software-support-policy/isc-license. Permission
12 To use, copy, modify, and/or distribute this software for any purpose with or
13 without fee is hereby granted provided that the above copyright notice and
14 this permission notice appear in all copies.
15
16 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
17 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
18 DISCLAIMED.
19
20 ==============================================================================
21*/
22
23namespace juce
24{
25
26//==============================================================================
43{
44public:
45 //==============================================================================
50
52 ~AudioTransportSource() override;
53
54 //==============================================================================
78 void setSource (PositionableAudioSource* newSource,
79 int readAheadBufferSize = 0,
80 TimeSliceThread* readAheadThread = nullptr,
81 double sourceSampleRateToCorrectFor = 0.0,
82 int maxNumChannels = 2);
83
84 //==============================================================================
94 void setPosition (double newPosition);
95
99 double getCurrentPosition() const;
100
102 double getLengthInSeconds() const;
103
105 bool hasStreamFinished() const noexcept;
106
107 //==============================================================================
113 void start();
114
120 void stop();
121
123 bool isPlaying() const noexcept { return playing; }
124
125 //==============================================================================
130 void setGain (float newGain) noexcept;
131
135 float getGain() const noexcept { return gain; }
136
137 //==============================================================================
139 void prepareToPlay (int samplesPerBlockExpected, double sampleRate) override;
140
142 void releaseResources() override;
143
145 void getNextAudioBlock (const AudioSourceChannelInfo&) override;
146
147 //==============================================================================
149 void setNextReadPosition (int64 newPosition) override;
150
152 int64 getNextReadPosition() const override;
153
155 int64 getTotalLength() const override;
156
158 bool isLooping() const override;
159
160private:
161 //==============================================================================
162 PositionableAudioSource* source = nullptr;
163 ResamplingAudioSource* resamplerSource = nullptr;
164 BufferingAudioSource* bufferingSource = nullptr;
165 PositionableAudioSource* positionableSource = nullptr;
166 AudioSource* masterSource = nullptr;
167
168 CriticalSection callbackLock;
169 float gain = 1.0f, lastGain = 1.0f;
170 std::atomic<bool> playing { false }, stopped { true };
171 double sampleRate = 44100.0, sourceSampleRate = 0;
172 int blockSize = 128, readAheadBufferSize = 0;
173 bool isPrepared = false;
174
175 void releaseMasterResources();
176
178};
179
180} // namespace juce
Base class for objects that can produce a continuous stream of audio.
An AudioSource that takes a PositionableAudioSource and allows it to be played, stopped,...
float getGain() const noexcept
Returns the current gain setting.
bool isPlaying() const noexcept
Returns true if it's currently playing.
An AudioSource which takes another source as input, and buffers it using a thread.
Holds a list of ChangeListeners, and sends messages to them when instructed.
A type of AudioSource which can be repositioned.
A type of AudioSource that takes an input source and changes its sample rate.
A thread that keeps a list of clients, and calls each one in turn, giving them all a chance to run so...
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
This is a shorthand way of writing both a JUCE_DECLARE_NON_COPYABLE and JUCE_LEAK_DETECTOR macro for ...
JUCE Namespace.
long long int64
A platform-independent 64-bit integer type.
Used by AudioSource::getNextAudioBlock().