Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::audio::SampleStreamCacheService Class Reference

Bounded shared-page cache with deterministic caller-driven servicing. More...

#include <sample_stream_service.hpp>

Public Member Functions

 SampleStreamCacheService ()
 ~SampleStreamCacheService ()
 SampleStreamCacheService (const SampleStreamCacheService &)=delete
SampleStreamCacheService & operator= (const SampleStreamCacheService &)=delete
bool prepare (const SampleStreamCacheServiceConfig &config)
void release () noexcept
bool prepared () const noexcept
std::uint64_t begin_audio_page_read () const noexcept
 RT-safe page-lifetime barrier entry.
void complete_audio_page_read (std::uint64_t epoch) noexcept
 RT-safe page-lifetime barrier completion.
bool update_audio_generations (std::uint64_t active_audio_generation, std::uint64_t completed_audio_generation) noexcept
 Updates the generation currently allowed to hold page views and the last generation whose audio callback has completed.
SampleStreamSourceAddResult add_source (const SampleStreamCacheSourceConfig &config, FrameReader reader)
SampleStreamSourceRetireStatus retire_source_after_asset_unpublish (SampleStreamSourceToken token) noexcept
 Call only after the asset publisher has stopped issuing this source view.
bool discard_unpublished_source (SampleStreamSourceToken token) noexcept
 Remove a source that never became reachable from an audio-thread asset.
bool retirement_watermark_reached (SampleStreamSourceToken token) const noexcept
bool contains_source (SampleStreamSourceToken token) const noexcept
std::size_t collect_retired_sources () noexcept
SampleStreamScheduleStatus request_page (const SampleStreamPageDemand &demand) noexcept
std::size_t cancel_requester (SampleStreamRequesterToken requester) noexcept
std::size_t cancel_pending_source_demands (SampleStreamSourceToken source) noexcept
template<std::size_t Capacity>
SampleStreamCommandDrainResult drain_commands (SampleStreamCommandInbox< Capacity > &inbox) noexcept
 Applies all currently queued commands in producer order.
SampleStreamAsyncReserveResult reserve_async_page () noexcept
bool commit_async_dispatch (const SampleStreamAsyncReservation &reservation) noexcept
bool async_reservation_has_interest (const SampleStreamAsyncReservation &reservation) const noexcept
SampleStreamAsyncCompletionStatus cancel_async_reservation (const SampleStreamAsyncReservation &reservation) noexcept
SampleStreamAsyncCompletionStatus publish_async_reservation (const SampleStreamAsyncReservation &reservation, BufferView< const float > decoded) noexcept
SampleStreamServiceStatus service_once () noexcept
SampleStreamSchedulerStats scheduler_stats () const noexcept
SampleStreamCacheServiceStats stats () const noexcept

Friends

struct SampleStreamCacheServiceTestAccess

Detailed Description

Bounded shared-page cache with deterministic caller-driven servicing.

All direct methods belong to one non-audio owner. Audio code reads returned windows and pushes fixed commands into SampleStreamCommandInbox; the owner applies those commands in FIFO order through drain_commands().

Constructor & Destructor Documentation

◆ SampleStreamCacheService() [1/2]

pulp::audio::SampleStreamCacheService::SampleStreamCacheService ( )

◆ ~SampleStreamCacheService()

pulp::audio::SampleStreamCacheService::~SampleStreamCacheService ( )

◆ SampleStreamCacheService() [2/2]

pulp::audio::SampleStreamCacheService::SampleStreamCacheService ( const SampleStreamCacheService & )
delete

Member Function Documentation

◆ add_source()

SampleStreamSourceAddResult pulp::audio::SampleStreamCacheService::add_source ( const SampleStreamCacheSourceConfig & config,
FrameReader reader )

◆ async_reservation_has_interest()

bool pulp::audio::SampleStreamCacheService::async_reservation_has_interest ( const SampleStreamAsyncReservation & reservation) const
noexcept

◆ begin_audio_page_read()

std::uint64_t pulp::audio::SampleStreamCacheService::begin_audio_page_read ( ) const
noexcept

RT-safe page-lifetime barrier entry.

Capture this before the callback performs any page lookup and return the value at callback completion. Audio callbacks must be single-threaded, non-overlapping, and complete in entry order; overlapping render callbacks are unsupported.

◆ cancel_async_reservation()

SampleStreamAsyncCompletionStatus pulp::audio::SampleStreamCacheService::cancel_async_reservation ( const SampleStreamAsyncReservation & reservation)
noexcept

◆ cancel_pending_source_demands()

std::size_t pulp::audio::SampleStreamCacheService::cancel_pending_source_demands ( SampleStreamSourceToken source)
noexcept

◆ cancel_requester()

std::size_t pulp::audio::SampleStreamCacheService::cancel_requester ( SampleStreamRequesterToken requester)
noexcept

◆ collect_retired_sources()

std::size_t pulp::audio::SampleStreamCacheService::collect_retired_sources ( )
noexcept

◆ commit_async_dispatch()

bool pulp::audio::SampleStreamCacheService::commit_async_dispatch ( const SampleStreamAsyncReservation & reservation)
noexcept

◆ complete_audio_page_read()

void pulp::audio::SampleStreamCacheService::complete_audio_page_read ( std::uint64_t epoch)
noexcept

RT-safe page-lifetime barrier completion.

The callback must publish only the exact epoch captured by begin_audio_page_read(), after its last page access. Audio callbacks are single-threaded and complete in entry order.

◆ contains_source()

bool pulp::audio::SampleStreamCacheService::contains_source ( SampleStreamSourceToken token) const
noexcept

◆ discard_unpublished_source()

bool pulp::audio::SampleStreamCacheService::discard_unpublished_source ( SampleStreamSourceToken token)
noexcept

Remove a source that never became reachable from an audio-thread asset.

The owner may use this only before retirement or async work begins.

◆ drain_commands()

template<std::size_t Capacity>
SampleStreamCommandDrainResult pulp::audio::SampleStreamCacheService::drain_commands ( SampleStreamCommandInbox< Capacity > & inbox)
inlinenoexcept

Applies all currently queued commands in producer order.

Non-RT owner only; demand application may mutate the scheduler's pending vector.

◆ operator=()

SampleStreamCacheService & pulp::audio::SampleStreamCacheService::operator= ( const SampleStreamCacheService & )
delete

◆ prepare()

bool pulp::audio::SampleStreamCacheService::prepare ( const SampleStreamCacheServiceConfig & config)

◆ prepared()

bool pulp::audio::SampleStreamCacheService::prepared ( ) const
noexcept

◆ publish_async_reservation()

SampleStreamAsyncCompletionStatus pulp::audio::SampleStreamCacheService::publish_async_reservation ( const SampleStreamAsyncReservation & reservation,
BufferView< const float > decoded )
noexcept

◆ release()

void pulp::audio::SampleStreamCacheService::release ( )
noexcept

◆ request_page()

SampleStreamScheduleStatus pulp::audio::SampleStreamCacheService::request_page ( const SampleStreamPageDemand & demand)
noexcept

◆ reserve_async_page()

SampleStreamAsyncReserveResult pulp::audio::SampleStreamCacheService::reserve_async_page ( )
noexcept

◆ retire_source_after_asset_unpublish()

SampleStreamSourceRetireStatus pulp::audio::SampleStreamCacheService::retire_source_after_asset_unpublish ( SampleStreamSourceToken token)
noexcept

Call only after the asset publisher has stopped issuing this source view.

The current audio generation becomes the last generation allowed to hold a borrowed view; collection waits for that generation to complete.

◆ retirement_watermark_reached()

bool pulp::audio::SampleStreamCacheService::retirement_watermark_reached ( SampleStreamSourceToken token) const
noexcept

◆ scheduler_stats()

SampleStreamSchedulerStats pulp::audio::SampleStreamCacheService::scheduler_stats ( ) const
noexcept

◆ service_once()

SampleStreamServiceStatus pulp::audio::SampleStreamCacheService::service_once ( )
noexcept

◆ stats()

SampleStreamCacheServiceStats pulp::audio::SampleStreamCacheService::stats ( ) const
noexcept

◆ update_audio_generations()

bool pulp::audio::SampleStreamCacheService::update_audio_generations ( std::uint64_t active_audio_generation,
std::uint64_t completed_audio_generation )
noexcept

Updates the generation currently allowed to hold page views and the last generation whose audio callback has completed.

Values are monotonic. A retired page is not writable again until completed reaches the generation that was active when the page was retired.

◆ SampleStreamCacheServiceTestAccess

friend struct SampleStreamCacheServiceTestAccess
friend

The documentation for this class was generated from the following file: