Audacity 3.2.0
WaveTrackSink.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 @file WaveTrackSink.h
6 @brief Adapter of WaveTrack to the interface AudioGraph::Sink
7
8 Dominic Mazzoni
9 Vaughan Johnson
10
11 Paul Licameli split from PerTrackEffect.h
12
13**********************************************************************/
14
15#ifndef __AUDACITY_WAVE_TRACK_SINK__
16#define __AUDACITY_WAVE_TRACK_SINK__
17
18#include "AudioGraphSink.h" // to inherit
19#include "SampleCount.h"
20#include "SampleFormat.h"
21#include <memory>
22
23class WaveChannel;
24class WaveTrack;
25class TrackList;
26
27class WAVE_TRACK_API WaveTrackSink final : public AudioGraph::Sink {
28public:
30 WaveTrack *pGenerated, sampleCount start, bool isProcessor,
32 sampleFormat effectiveFormat);
33 ~WaveTrackSink() override;
34
36 bool AcceptsBuffers(const Buffers &buffers) const override;
37
38 bool Acquire(Buffers &data) override;
39 bool Release(const Buffers &data, size_t curBlockSize) override;
40
44 void Flush(Buffers &data);
45
47 bool IsOk() const { return mOk; }
48
49private:
54 void DoConsume(Buffers &data);
55
61 const bool mIsProcessor;
63
65 bool mOk{ true };
66};
67#endif
sampleFormat
The ordering of these values with operator < agrees with the order of increasing bit width.
Definition: SampleFormat.h:30
Accumulates (non-interleaved) data during effect processing.
Downstream receiver of sample streams, taking Buffers as external context.
virtual bool Acquire(Buffers &data)=0
Guarantee empty space in Buffers before they are written.
virtual bool AcceptsBuffers(const Buffers &buffers) const =0
virtual bool Release(const Buffers &data, size_t curBlockSize)=0
Acknowledge receipt of data in Buffers, which caller may then Advance()
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
Definition: Track.h:850
A Track that contains audio waveform data.
Definition: WaveTrack.h:203
WaveChannel & mLeft
Definition: WaveTrackSink.h:56
const sampleFormat mEffectiveFormat
Definition: WaveTrackSink.h:62
~WaveTrackSink() override
bool IsOk() const
Whether any errors have occurred in writing data.
Definition: WaveTrackSink.h:47
const bool mIsProcessor
Definition: WaveTrackSink.h:61
sampleCount mOutPos
Definition: WaveTrackSink.h:64
WaveChannel *const mGenRight
Definition: WaveTrackSink.h:60
WaveTrack *const mpGenerated
Definition: WaveTrackSink.h:58
WaveChannel *const mpRight
Definition: WaveTrackSink.h:57
WaveChannel *const mGenLeft
Definition: WaveTrackSink.h:59
Positions or offsets within audio files need a wide type.
Definition: SampleCount.h:19