Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
process_context.hpp
Go to the documentation of this file.
1#pragma once
2
3// Per-block host state handed to Processor::process(): transport position,
4// tempo, render hints, and the SMPTE frame rate. processor.hpp includes this
5// header, so existing consumers keep compiling unchanged; new code should
6// include it directly.
7
10#include <cstdint>
11
12namespace pulp::format {
13
34
46
90 double sample_rate = 0;
91 int num_samples = 0;
92
97
102 bool is_bypassed = false;
103
106 bool is_tail_drain = false;
107
111 bool reset_requested = false;
112
117 bool transport_jump = false;
118
122
123 bool is_playing = false;
124 bool is_recording = false;
125 double tempo_bpm = 120.0;
126 double position_beats = 0.0;
127 int64_t position_samples = 0;
130
131 // New fields default to "host did not provide" sentinels so adapters that
132 // don't populate them keep the pre-extension behavior exactly.
133
142 int64_t bar = 0;
143
150 bool is_looping = false;
151
159 double loop_start_beats = 0.0;
160
164 double loop_end_beats = 0.0;
165
176 int64_t host_time_ns = 0;
177
182
190 bool tempo_changed = false;
191
196 bool time_sig_changed = false;
197
203 bool transport_changed = false;
204
225 bool transport_started = false;
226
233
244 bool ordinary_loop_wrap = false;
245
246 constexpr bool has_transport(TransportField field) const noexcept {
247 return transport_validity.has(field);
248 }
249
250 bool is_realtime() const noexcept {
252 }
253
254 bool is_offline() const noexcept {
256 }
257
258 bool allows_offline_quality_work() const noexcept {
259 return is_offline() &&
261 }
262
267 bool should_reset_dsp_state() const noexcept {
269 }
270
276 bool should_reset_stream_history() const noexcept {
278 }
279
284 bool is_maintenance_render() const noexcept {
285 return is_bypassed || is_tail_drain;
286 }
287
292 bool should_render_tail_only() const noexcept {
293 return is_tail_drain;
294 }
295};
296
297} // namespace pulp::format
Compact validity mask for the transport values carried by ProcessContext.
Definition transport_fields.hpp:29
What the product grants a device: the quota table indexed by capability tier and live thermal state.
Definition aax_editor.hpp:31
RenderSpeedHint
Host render-speed hint for offline or constrained live rendering.
Definition process_context.hpp:40
@ FasterThanRealtime
Definition process_context.hpp:43
@ Unknown
Definition process_context.hpp:41
@ Realtime
Definition process_context.hpp:42
@ SlowerThanRealtime
Definition process_context.hpp:44
ProcessMode
Coarse processing mode for one block.
Definition process_block.hpp:29
@ Offline
Definition process_block.hpp:31
@ Realtime
Definition process_block.hpp:30
FrameRate
SMPTE video frame rate.
Definition process_context.hpp:24
@ fps_25
PAL. VST3 kFrameRate25fps.
Definition process_context.hpp:27
@ fps_30_drop
30 drop-frame. VST3 kFrameRate30DropFps.
Definition process_context.hpp:31
@ fps_60
High-rate. VST3 kFrameRate60fps.
Definition process_context.hpp:32
@ unknown
Definition process_context.hpp:25
@ fps_30
NTSC integer. VST3 kFrameRate30fps.
Definition process_context.hpp:30
@ fps_29_97
NTSC non-drop. VST3 kFrameRate2997fps.
Definition process_context.hpp:28
@ fps_24
Film. VST3 kFrameRate24fps.
Definition process_context.hpp:26
@ fps_29_97_drop
NTSC drop-frame. VST3 kFrameRate2997DropFps.
Definition process_context.hpp:29
TransportField
Independently optional fields in a per-block host transport snapshot.
Definition transport_fields.hpp:9
@ unknown
Not declared; the note says nothing about installing.
Definition app_updates.hpp:35
@ Unknown
Definition host_type.hpp:12
Process context — passed every audio callback with transport state.
Definition process_context.hpp:89
bool transport_jump
True when the host observed a discontinuous timeline move since the previous block.
Definition process_context.hpp:117
int time_sig_denominator
Definition process_context.hpp:129
int64_t position_samples
Definition process_context.hpp:127
int num_samples
Definition process_context.hpp:91
bool is_looping
True when the host's transport is in cycle/loop mode.
Definition process_context.hpp:150
int64_t host_time_ns
Host clock timestamp matching the start of this block, in nanoseconds since an epoch the host chooses...
Definition process_context.hpp:176
double loop_start_beats
Loop start in quarter notes, only meaningful when is_looping is true.
Definition process_context.hpp:159
int64_t bar
Bar index derived from position_beats + the active time signature.
Definition process_context.hpp:142
RenderSpeedHint render_speed_hint
Advisory render-speed category for hosts that know whether the current pass is live,...
Definition process_context.hpp:121
bool transport_started
True on the first block of a run — the block where the host's transport begins rolling.
Definition process_context.hpp:225
double position_beats
Position in quarter notes.
Definition process_context.hpp:126
bool should_reset_stream_history() const noexcept
True when continuous audio-stream history should be cleared.
Definition process_context.hpp:276
double loop_end_beats
Loop end in quarter notes, only meaningful when is_looping is true.
Definition process_context.hpp:164
bool ordinary_loop_wrap
True when the adapter classified this block's transport_jump as the expected backward move from a sta...
Definition process_context.hpp:244
bool is_recording
Definition process_context.hpp:124
FrameRate frame_rate
SMPTE frame rate when the host exposes one.
Definition process_context.hpp:181
bool is_playing
Definition process_context.hpp:123
TransportValidity transport_validity
Identifies which transport values were supplied for this block.
Definition process_context.hpp:232
bool is_bypassed
True when the host is rendering the plugin's bypass path for this block.
Definition process_context.hpp:102
constexpr bool has_transport(TransportField field) const noexcept
Definition process_context.hpp:246
bool is_tail_drain
True when the host is asking a processor to continue rendering after input/transport stop so delay,...
Definition process_context.hpp:106
bool is_maintenance_render() const noexcept
True when this block is not a normal input-driven render but the host is still calling process() so a...
Definition process_context.hpp:284
bool should_render_tail_only() const noexcept
True when the host is asking the processor to render only existing tail state.
Definition process_context.hpp:292
bool is_realtime() const noexcept
Definition process_context.hpp:250
double sample_rate
Definition process_context.hpp:90
bool transport_changed
True when any transport state field (is_playing, is_recording, is_looping) flipped since the previous...
Definition process_context.hpp:203
double tempo_bpm
Definition process_context.hpp:125
bool time_sig_changed
True when the host's reported time signature (time_sig_numerator or time_sig_denominator) differs fro...
Definition process_context.hpp:196
bool is_offline() const noexcept
Definition process_context.hpp:254
bool reset_requested
True for the first block after a transport jump, seek, or explicit DSP reset boundary.
Definition process_context.hpp:111
bool tempo_changed
True when the host's reported tempo_bpm differs from the previous block.
Definition process_context.hpp:190
bool should_reset_dsp_state() const noexcept
True when DSP state should treat this block as a discontinuity boundary.
Definition process_context.hpp:267
int time_sig_numerator
Definition process_context.hpp:128
ProcessMode process_mode
Runtime mode for this block.
Definition process_context.hpp:96
bool allows_offline_quality_work() const noexcept
Definition process_context.hpp:258