8#include "utils/units.h"
20playhead_position_after_adding_frames (
21 units::sample_t current_position,
22 units::sample_t frames_to_add,
24 units::sample_t loop_start,
25 units::sample_t loop_end)
noexcept
27 auto new_pos = current_position + frames_to_add;
33 while (current_position < loop_end && new_pos >= loop_end)
36 new_pos += loop_start - loop_end;
49 enum class PlayState : std::uint8_t
63 virtual std::pair<units::sample_t, units::sample_t>
69 virtual std::pair<units::sample_t, units::sample_t>
72 virtual PlayState get_play_state () const noexcept [[clang::nonblocking]] = 0;
79 virtual units::sample_t
81 [[clang::nonblocking]] = 0;
90 const units::sample_t current_playhead_position,
91 const units::sample_t frames_to_add) const noexcept [[clang::nonblocking]]
94 return playhead_position_after_adding_frames (
95 current_playhead_position, frames_to_add, loop_enabled (), loop_start,
99 virtual bool loop_enabled () const noexcept [[clang::nonblocking]] = 0;
101 virtual
bool punch_enabled () const noexcept [[clang::nonblocking]] = 0;
116 [[clang::nonblocking]] = 0;
119 has_recording_preroll_frames_remaining () const noexcept [[clang::nonblocking]]
130 [[clang::nonblocking]] = 0;
138 units::sample_t g_start_frames,
139 units::sample_t nframes) const noexcept [[clang::nonblocking]]
142 bool loop_end_between_start_and_end =
143 (loop_end_pos > g_start_frames && loop_end_pos <= g_start_frames + nframes);
145 if (loop_end_between_start_and_end && loop_enabled ()) [[unlikely]]
147 return loop_end_pos - g_start_frames;
149 return units::samples (0);
virtual units::sample_t recording_preroll_frames_remaining() const noexcept=0
Frames remaining to preroll (playing back some time earlier before actually recording/rolling).
units::sample_t get_playhead_position_after_adding_frames_in_audio_thread(const units::sample_t current_playhead_position, const units::sample_t frames_to_add) const noexcept
Gets the playhead position, similarly to get_playhead_position(), except that it adjusts the new posi...
virtual bool recording_enabled() const noexcept=0
Returns whether recording is enabled.
virtual std::pair< units::sample_t, units::sample_t > get_loop_range_positions() const noexcept=0
Returns the loop range positions in samples.
virtual std::pair< units::sample_t, units::sample_t > get_punch_range_positions() const noexcept=0
Returns the punch recording range positions in samples.
virtual units::sample_t get_playhead_position_in_audio_thread() const noexcept=0
Get the playhead position.
units::sample_t is_loop_point_met_in_audio_thread(units::sample_t g_start_frames, units::sample_t nframes) const noexcept
Returns the number of processable frames until and excluding the loop end point as a positive number ...
virtual units::sample_t metronome_countin_frames_remaining() const noexcept=0
Frames remaining for metronome countin.