XJ music engine  1.9.6
In-game runtime engine for XJ music.
Public Member Functions | List of all members
XJ::CraftWork Class Referencefinal

#include <CraftWork.h>

Public Member Functions

 CraftWork (SegmentEntityStore *store, ContentEntityStore *content, int persistenceWindowSeconds, int craftAheadSeconds, int deadlineSeconds)
 
void start ()
 
void finish ()
 
bool isFinished () const
 
void runCycle (const unsigned long long int atChainMicros)
 
TemplateConfig getTemplateConfig () const
 
std::vector< const Segment * > getSegmentsIfReady (unsigned long long fromChainMicros, unsigned long long toChainMicros) const
 
std::optional< const Segment * > getSegmentAtChainMicros (unsigned long long chainMicros) const
 
std::optional< const Segment * > getSegmentAtOffset (int offset) const
 
std::set< const SegmentChoiceArrangementPick * > getPicks (const std::vector< const Segment * > &segments) const
 
const InstrumentgetInstrument (const InstrumentAudio *audio) const
 
const InstrumentAudiogetInstrumentAudio (const SegmentChoiceArrangementPick *pick) const
 
std::optional< const Program * > getMainProgram (const Segment *segment) const
 
std::optional< const Program * > getMacroProgram (const Segment &segment) const
 
ContentEntityStoregetSourceMaterial () const
 
bool isReady () const
 
void doOverrideMacro (const Program *macroProgram)
 
void doOverrideMemes (std::set< std::string > memes)
 
bool getAndResetDidOverride ()
 
std::set< const SegmentChoice * > getChoices (const Segment *segment) const
 
std::set< const SegmentChoiceArrangement * > getArrangements (const SegmentChoice *choice) const
 
std::set< const SegmentChoiceArrangementPick * > getPicks (const SegmentChoiceArrangement *arrangement) const
 

Detailed Description

THERE IS NO SPOON

Ground-up rewrite of the XJ work logic. First we instantiate the dub cycle, which depends on the craft cycle operating on a separate thread. All Segment craft is persisted in memory, and the dub cycle is responsible for requesting crafted segments and specifically the picked audio, and then dubbing each output audio chunk.

Output audio chunks are dynamically sized. There is a default size, but the size is also determined by the duration of the segment. E.g., during gapless album output, the chunk will cut short if necessary to begin the next chunk at exactly the top of the following segment.

Constructor & Destructor Documentation

◆ CraftWork()

CraftWork::CraftWork ( SegmentEntityStore store,
ContentEntityStore content,
int  persistenceWindowSeconds,
int  craftAheadSeconds,
int  deadlineSeconds 
)
explicit

Member Function Documentation

◆ doOverrideMacro()

void CraftWork::doOverrideMacro ( const Program macroProgram)

Go to the given macro program right now https://github.com/xjmusic/xjmusic/issues/197

Parameters
macroProgramthe macro program to go to

◆ doOverrideMemes()

void CraftWork::doOverrideMemes ( std::set< std::string >  memes)

Manually go to a specific taxonomy category meme, and force until reset https://github.com/xjmusic/xjmusic/issues/199

Parameters
memesspecific (assumed allowably) set of taxonomy category memes

◆ finish()

void CraftWork::finish ( )

Stop work

◆ getAndResetDidOverride()

bool CraftWork::getAndResetDidOverride ( )

Get whether an override happened, and reset its state after getting

Returns
true if an override happened

◆ getArrangements()

std::set< const SegmentChoiceArrangement * > CraftWork::getArrangements ( const SegmentChoice choice) const

Get all arrangements for the given choice

Parameters
choicefor which to get arrangements
Returns
arrangements

◆ getChoices()

std::set< const SegmentChoice * > CraftWork::getChoices ( const Segment segment) const

Get all choices for the given segment

Parameters
segmentfor which to get choices
Returns
choices

◆ getInstrument()

const Instrument * CraftWork::getInstrument ( const InstrumentAudio audio) const

Get the instrument for the given pick

Parameters
audiothe audio for which to get instrument
Returns
the instrument for the given pick

◆ getInstrumentAudio()

const InstrumentAudio * CraftWork::getInstrumentAudio ( const SegmentChoiceArrangementPick pick) const

Get the audio for the given pick

Parameters
pickthe pick for which to get audio
Returns
the audio for the given pick

◆ getMacroProgram()

std::optional< const Program * > CraftWork::getMacroProgram ( const Segment segment) const

Get the macro program for the given segment

Parameters
segmentfor which to get macro program
Returns
the macro program for the given segment, or empty if not chosen

◆ getMainProgram()

std::optional< const Program * > CraftWork::getMainProgram ( const Segment segment) const

Get the main program for the given segment

Parameters
segmentfor which to get main program
Returns
the main program for the given segment, or empty if not chosen

◆ getPicks() [1/2]

std::set< const SegmentChoiceArrangementPick * > CraftWork::getPicks ( const SegmentChoiceArrangement arrangement) const

Get all picks for the given arrangement

Parameters
arrangementfor which to get picks
Returns
picks

◆ getPicks() [2/2]

std::set< const SegmentChoiceArrangementPick * > CraftWork::getPicks ( const std::vector< const Segment * > &  segments) const

Get the segments spanning the given time range, if they are ready- if not, return an empty list

Parameters
segmentsthe segments for which to get picks
Returns
the picks for the given segments

◆ getSegmentAtChainMicros()

std::optional< const Segment * > CraftWork::getSegmentAtChainMicros ( unsigned long long  chainMicros) const

Get the segment at the given chain microseconds, if it is ready segment beginning <= chain microseconds < end

Parameters
chainMicrosthe microseconds since beginning of chain for which to get the segment
Returns
the segment at the given chain microseconds, or an empty optional if the segment is not ready

◆ getSegmentAtOffset()

std::optional< const Segment * > CraftWork::getSegmentAtOffset ( int  offset) const

Get the segment at the given offset, if it is ready

Parameters
offsetof segment
Returns
the segment at the given offset

◆ getSegmentsIfReady()

std::vector< const Segment * > CraftWork::getSegmentsIfReady ( unsigned long long  fromChainMicros,
unsigned long long  toChainMicros 
) const

Get the segments spanning the given time range, if they are ready- if not, return an empty list

Parameters
fromChainMicrosthe start time
toChainMicrosthe end time
Returns
the segments spanning the given time range, or an empty list if the segment span is not ready

◆ getSourceMaterial()

ContentEntityStore * CraftWork::getSourceMaterial ( ) const

Get the source material

◆ getTemplateConfig()

TemplateConfig CraftWork::getTemplateConfig ( ) const

Get the template config, if loaded

Returns
the template config

◆ isFinished()

bool CraftWork::isFinished ( ) const

Check whether the craft work is finished

Returns
true if finished (not running)

◆ isReady()

bool CraftWork::isReady ( ) const

Whether the current craft state is ready

Returns
true if ready

◆ runCycle()

void CraftWork::runCycle ( const unsigned long long int  atChainMicros)

This is the internal cycle that's Run indefinitely

◆ start()

void CraftWork::start ( )

Start work


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