Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
source.hpp
Go to the documentation of this file.
1#pragma once
2
19
20#include <pulp/audio/buffer.hpp>
21
22#include <cstdint>
23
24namespace pulp::audio {
25
34public:
35 virtual ~AudioSource() = default;
36
41 virtual void prepare_to_play(int samples_per_block_expected,
42 double sample_rate) = 0;
43
46 virtual void release_resources() = 0;
47
52 int start_sample,
53 int num_samples) = 0;
54};
55
61public:
67 virtual void set_next_read_position(uint64_t new_position) = 0;
68
71 virtual uint64_t get_next_read_position() const = 0;
72
74 virtual uint64_t get_total_length() const = 0;
75
78 virtual bool is_looping() const = 0;
79
82 virtual void set_looping(bool /*should_loop*/) {}
83};
84
85} // namespace pulp::audio
Abstract base — host-callable audio source.
Definition source.hpp:33
virtual void release_resources()=0
Called when playback is finished.
virtual void get_next_audio_block(BufferView< float > out, int start_sample, int num_samples)=0
Fill num_samples of out, starting at start_sample within out.
virtual void prepare_to_play(int samples_per_block_expected, double sample_rate)=0
Called before playback begins.
virtual ~AudioSource()=default
Non-owning view over multi-channel audio sample data.
Definition buffer.hpp:30
AudioSource with a notion of position.
Definition source.hpp:60
virtual void set_looping(bool)
Enable / disable looping.
Definition source.hpp:82
virtual uint64_t get_total_length() const =0
Total length in frames. 0 means "unknown" or "infinite".
virtual void set_next_read_position(uint64_t new_position)=0
Move the read head to new_position (frames from the start of the source).
virtual uint64_t get_next_read_position() const =0
Current frame position the next get_next_audio_block call will read from.
virtual bool is_looping() const =0
True if the source should wrap back to 0 when it reaches the end.
Definition analyzer_provider.hpp:12