Loading...
Searching...
No Matches
oscr::SoundSetLoader Class Referencefinal
Inheritance diagram for oscr::SoundSetLoader:

Detailed Description

Lists, decodes and watches the folder of a sound_set port, and publishes the result to the processor.

Lives on the UI thread. Listing and decoding run on score::TaskPool. Each new snapshot reaches the processor through publish, which swaps it in between two ticks and flags the previous one as superseded. A superseded snapshot is freed here, on the UI thread, once nothing pins the sounds only it holds. The audio thread never frees nor drops a reference to anything.

Public Types

using publish_function = std::function< void(std::shared_ptr< SoundSetSnapshot > next, SoundSetSnapshot *previous)>
 Swaps next in, then flags previous as superseded, on the audio thread.
 
using dispose_function = std::function< void(std::vector< std::shared_ptr< SoundSetSnapshot > >)>
 

Public Member Functions

 SoundSetLoader (SoundSetOptions opts, publish_function publish, dispose_function dispose, QObject *parent)
 
void setPath (const QString &path)
 A folder, or a file naming its folder; resolved.
 
const std::shared_ptr< SoundSetSnapshot > & current () const noexcept
 
std::size_t retiredCount () const noexcept
 
void reap ()
 Frees the superseded snapshots whose own sounds nobody pins anymore.
 

Member Typedef Documentation

◆ dispose_function

using oscr::SoundSetLoader::dispose_function = std::function<void(std::vector<std::shared_ptr<SoundSetSnapshot> >)>

Hands what may still be read by the audio thread to a place where it is freed once the processor stopped running, e.g. an execution command


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