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

#include <SegmentRetrospective.h>

Public Member Functions

virtual ~SegmentRetrospective ()=default
 
 SegmentRetrospective (SegmentEntityStore *entityStore, int segmentId, bool autoload=true)
 
virtual const SegmentChoiceArrangementgetArrangement (const SegmentChoiceArrangementPick *pick) const
 
virtual std::set< const SegmentChoice * > getChoices () const
 
virtual const SegmentChoicegetChoice (const SegmentChoiceArrangement *arrangement) const
 
virtual Instrument::Type getInstrumentType (const SegmentChoiceArrangementPick *pick) const
 
virtual std::optional< const SegmentMeta * > getPreviousMeta (const std::string &key) const
 
virtual std::set< const SegmentChoice * > getPreviousChoicesForInstrument (const UUID &instrumentId) const
 
virtual std::set< const SegmentChoiceArrangement * > getPreviousArrangementsForInstrument (const UUID &instrumentId) const
 
virtual std::set< const SegmentChoiceArrangementPick * > getPicks () const
 
virtual std::optional< const SegmentChoice * > getPreviousChoiceOfType (const Segment *segment, Program::Type programType) const
 
virtual std::optional< const SegmentChoice * > getPreviousChoiceOfType (Program::Type programType) const
 
virtual std::set< const SegmentChoice * > getPreviousChoicesOfMode (Instrument::Mode instrumentMode) const
 
virtual std::set< const SegmentChoice * > getPreviousChoicesOfTypeMode (Instrument::Type instrumentType, Instrument::Mode instrumentMode) const
 
virtual std::optional< const SegmentChoice * > getPreviousChoiceOfType (Instrument::Type instrumentType) const
 
virtual std::set< const SegmentChoiceArrangementPick * > getPreviousPicksForInstrument (const UUID &instrumentId) const
 
virtual std::optional< const Segment * > getPreviousSegment () const
 
virtual std::vector< const Segment * > getSegments () const
 
virtual std::vector< const SegmentChord * > getSegmentChords (int segmentId) const
 

Detailed Description

Digest segments of the previous main program

NextMain/NextMacro-type: Retrospective of the previous main choice, primary choices only REF https://github.com/xjmusic/xjmusic/issues/242

Continue-type: Retrospective of all segments in this main program REF https://github.com/xjmusic/xjmusic/issues/242

Constructor & Destructor Documentation

◆ ~SegmentRetrospective()

virtual XJ::SegmentRetrospective::~SegmentRetrospective ( )
virtualdefault

◆ SegmentRetrospective()

SegmentRetrospective::SegmentRetrospective ( SegmentEntityStore entityStore,
int  segmentId,
bool  autoload = true 
)
explicit

Constructor from entity store and segment id Compute the retrospective

NOTE: the segment retrospective is empty for segments of type Initial, NextMain, and NextMacro– Only Continue-type segments have a retrospective

Begin by getting the previous segment Only can build retrospective if there is at least one previous segment The previous segment is the first one cached here. We may cache even further back segments below if found

Parameters
entityStorefor retrospective
segmentIdfrom which to create retrospective
autoloadwhether to autoload the retrospective
Exceptions
FabricationFatalExceptionon failure to retrieve @ on failure to compute

Member Function Documentation

◆ getArrangement()

const SegmentChoiceArrangement * SegmentRetrospective::getArrangement ( const SegmentChoiceArrangementPick pick) const
virtual

Get the arrangement for the given pick

Parameters
pickfor which to get arrangement
Returns
arrangement @ on failure to retrieve

◆ getChoice()

const SegmentChoice * SegmentRetrospective::getChoice ( const SegmentChoiceArrangement arrangement) const
virtual

Get the choice for the given arrangement

Parameters
arrangementfor which to get choice
Returns
choice @ on failure to retrieve

◆ getChoices()

std::set< const SegmentChoice * > SegmentRetrospective::getChoices ( ) const
virtual
Returns
all choices

◆ getInstrumentType()

Instrument::Type SegmentRetrospective::getInstrumentType ( const SegmentChoiceArrangementPick pick) const
virtual

Get the instrument type for a given pick

Parameters
pickfor which to get instrument type
Returns
instrument type of pick

◆ getPicks()

std::set< const SegmentChoiceArrangementPick * > SegmentRetrospective::getPicks ( ) const
virtual

Get the picks of any previous segments which selected the same main sequence

Artist writing detail program expects 'X' note value to result in random part creation from available Voicings https://github.com/xjmusic/xjmusic/issues/251

Returns
map of all previous segment meme constellations (as keys) to a collection of choices made

◆ getPreviousArrangementsForInstrument()

std::set< const SegmentChoiceArrangement * > SegmentRetrospective::getPreviousArrangementsForInstrument ( const UUID instrumentId) const
virtual

Get the previous arrangements for the given instrument id

Parameters
instrumentIdfor which to get arrangements
Returns
segment choice arrangements

◆ getPreviousChoiceOfType() [1/3]

std::optional< const SegmentChoice * > SegmentRetrospective::getPreviousChoiceOfType ( const Segment segment,
Program::Type  programType 
) const
virtual

Get the choice of a given type

Parameters
segmentfor which to get choice
programTypeof choice to get
Returns
choice of given type

◆ getPreviousChoiceOfType() [2/3]

std::optional< const SegmentChoice * > SegmentRetrospective::getPreviousChoiceOfType ( Instrument::Type  instrumentType) const
virtual

Get the previous-segment choices of a given instrument type

Parameters
instrumentTypefor which to get previous-segment choices
Returns
choices

◆ getPreviousChoiceOfType() [3/3]

std::optional< const SegmentChoice * > SegmentRetrospective::getPreviousChoiceOfType ( Program::Type  programType) const
virtual

Get the previous-segment choice of a given type

Parameters
programTypeof choice to get
Returns
choice of given type

◆ getPreviousChoicesForInstrument()

std::set< const SegmentChoice * > SegmentRetrospective::getPreviousChoicesForInstrument ( const UUID instrumentId) const
virtual

Get the previous segment choices for the given instrument (although there should only be one previous segment choice for each instrument)

Parameters
instrumentIdfor which to get choice
Returns
previous segment choice

◆ getPreviousChoicesOfMode()

std::set< const SegmentChoice * > SegmentRetrospective::getPreviousChoicesOfMode ( Instrument::Mode  instrumentMode) const
virtual

Get the previous-segment choices of a given instrument mode

Parameters
instrumentModefor which to get previous-segment choices
Returns
choices

◆ getPreviousChoicesOfTypeMode()

std::set< const SegmentChoice * > SegmentRetrospective::getPreviousChoicesOfTypeMode ( Instrument::Type  instrumentType,
Instrument::Mode  instrumentMode 
) const
virtual

Get the previous-segment choices of a given instrument type and mode

Parameters
instrumentTypefor which to get previous-segment choices
instrumentModefor which to get previous-segment choices
Returns
choices

◆ getPreviousMeta()

std::optional< const SegmentMeta * > SegmentRetrospective::getPreviousMeta ( const std::string &  key) const
virtual

Get the meta from the previous segment with the given key

Segment has metadata for XJ to persist "notes in the margin" of the composition for itself to read https://github.com/xjmusic/xjmusic/issues/222

Parameters
keyto search for meta
Returns
meta if found

◆ getPreviousPicksForInstrument()

std::set< const SegmentChoiceArrangementPick * > SegmentRetrospective::getPreviousPicksForInstrument ( const UUID instrumentId) const
virtual

Get the previous picks for the given instrument id

Parameters
instrumentIdfor which to get picks
Returns
segment choice picks

◆ getPreviousSegment()

std::optional< const Segment * > SegmentRetrospective::getPreviousSegment ( ) const
virtual

Get the segment immediately previous to the current segment

Returns
previous segment

◆ getSegmentChords()

std::vector< const SegmentChord * > SegmentRetrospective::getSegmentChords ( int  segmentId) const
virtual

Get all segment chords for the given segment id, ordered by position

Parameters
segmentIdfor which to get chords
Returns
chords

◆ getSegments()

std::vector< const Segment * > SegmentRetrospective::getSegments ( ) const
virtual
Returns
all cached segments, ordered by id

Always starts with the segment at current offset minus one, includes that segment and all others with the same main program, which covers both whether this retrospective is looking back on the current main program (Continue segment), or the previous one (NextMain/NextMacro segments)


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