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

#include <Fabricator.h>

Public Types

enum class  ControlMode { Auto , Macro , Taxonomy }
 

Public Member Functions

virtual ~Fabricator ()=default
 
 Fabricator (ContentEntityStore *contentEntityStore, SegmentEntityStore *segmentEntityStore, const SegmentRetrospective *segmentRetrospective, int segmentId, std::optional< Segment::Type > overrideSegmentType)
 
virtual void addMessage (SegmentMessage::Type messageType, std::string body)
 
virtual void addErrorMessage (std::string body)
 
virtual void addWarningMessage (std::string body)
 
virtual void addInfoMessage (std::string body)
 
virtual void deletePick (const UUID &id)
 
virtual std::set< const SegmentChoiceArrangement * > getArrangements ()
 
virtual std::set< const SegmentChoiceArrangement * > getArrangements (std::set< const SegmentChoice * > &choices)
 
virtual ChaingetChain ()
 
virtual TemplateConfig getTemplateConfig ()
 
virtual std::set< const SegmentChoice * > getChoices () const
 
virtual std::optional< const SegmentChoice * > getChoiceIfContinued (const ProgramVoice *voice)
 
virtual std::set< const SegmentChoice * > getChoicesIfContinued (const Program::Type programType)
 
virtual std::optional< const SegmentChoice * > getChoiceIfContinued (Instrument::Type instrumentType)
 
virtual std::optional< const SegmentChoice * > getChoiceIfContinued (Instrument::Type instrumentType, Instrument::Mode instrumentMode)
 
virtual std::optional< const SegmentChord * > getChordAt (float position)
 
virtual std::optional< const SegmentChoice * > getCurrentMainChoice ()
 
virtual std::optional< const ProgramSequence * > getCurrentMainSequence ()
 
virtual std::set< const SegmentChoice * > getCurrentDetailChoices ()
 
virtual std::optional< const SegmentChoice * > getCurrentBeatChoice ()
 
virtual std::set< Instrument::TypegetDistinctChordVoicingTypes ()
 
virtual long getElapsedMicros ()
 
virtual Chord getKeyForChoice (const SegmentChoice *choice)
 
virtual std::optional< const SegmentChoice * > getMacroChoiceOfPreviousSegment ()
 
virtual std::optional< const SegmentChoice * > getPreviousMainChoice ()
 
virtual ProgramConfig getCurrentMainProgramConfig ()
 
virtual std::optional< const ProgramSequence * > getPreviousMainSequence ()
 
virtual MemeIsometry getMemeIsometryOfNextSequenceInPreviousMacro ()
 
virtual MemeIsometry getMemeIsometryOfSegment ()
 
virtual int getNextSequenceBindingOffset (const SegmentChoice *choice)
 
virtual std::set< const SegmentChoiceArrangementPick * > getPicks ()
 
virtual std::vector< const SegmentChoiceArrangementPick * > getPicks (const SegmentChoice *choice)
 
virtual std::optional< const InstrumentAudio * > getPreferredAudio (const std::string &parentIdent, const std::string &ident)
 
virtual std::optional< const Program * > getProgram (const SegmentChoice *choice)
 
virtual std::vector< const ProgramSequenceChord * > getProgramSequenceChords (const ProgramSequence *programSequence)
 
virtual NoteRange getProgramRange (const UUID &programId, Instrument::Type instrumentType)
 
virtual int getProgramRangeShiftOctaves (Instrument::Type instrumentType, NoteRange *sourceRange, NoteRange *targetRange)
 
virtual std::optional< const ProgramSequence * > getProgramSequence (const SegmentChoice *choice)
 
virtual int getProgramTargetShift (Instrument::Type instrumentType, const Chord *fromChord, const Chord *toChord)
 
virtual Program::Type getProgramType (const ProgramVoice *voice)
 
virtual Instrument::Type getProgramVoiceType (const ProgramSequenceChordVoicing *voicing)
 
virtual NoteRange getProgramVoicingNoteRange (Instrument::Type instrumentType)
 
virtual std::optional< const ProgramSequence * > getRandomlySelectedSequence (const Program *program)
 
virtual std::optional< const ProgramSequencePattern * > getRandomlySelectedPatternOfSequenceByVoiceAndType (const SegmentChoice *choice)
 
virtual std::optional< const ProgramSequenceBinding * > getRandomlySelectedSequenceBindingAtOffset (const Program *program, int offset)
 
virtual std::optional< NotegetRootNoteMidRange (const std::string &voicingNotes, const Chord *chord)
 
virtual long getSegmentMicrosAtPosition (float tempo, float position)
 
virtual long getTotalSegmentMicros ()
 
virtual const SegmentgetSegment ()
 
virtual std::vector< const SegmentChord * > getSegmentChords ()
 
virtual std::set< const SegmentChordVoicing * > getChordVoicings ()
 
virtual std::set< const SegmentMeme * > getSegmentMemes ()
 
virtual std::optional< const ProgramSequence * > getSequence (const SegmentChoice *choice)
 
virtual int getSequenceBindingOffsetForChoice (const SegmentChoice *choice)
 
virtual void putStickyBun (StickyBun bun)
 
virtual std::optional< const StickyBungetStickyBun (const UUID &eventId)
 
virtual std::string getTrackName (const ProgramSequencePatternEvent *event)
 
virtual Segment::Type getType ()
 
virtual std::optional< const SegmentChordVoicing * > chooseVoicing (const SegmentChord *chord, Instrument::Type instrumentType)
 
virtual bool hasMoreSequenceBindingOffsets (const SegmentChoice *choice, int N)
 
virtual bool hasOneMoreSequenceBindingOffset (const SegmentChoice *choice)
 
virtual bool hasTwoMoreSequenceBindingOffsets (const SegmentChoice *choice)
 
virtual bool isContinuationOfMacroProgram ()
 
virtual bool isDirectlyBound (const Instrument *instrument)
 
virtual bool isDirectlyBound (const InstrumentAudio *instrumentAudio)
 
virtual bool isDirectlyBound (const Program *program)
 
virtual bool isOneShot (const Instrument *instrument, const std::string &trackName)
 
virtual bool isOneShot (const Instrument *instrument)
 
virtual bool isOneShotCutoffEnabled (const Instrument *instrument)
 
virtual bool isInitialSegment ()
 
virtual std::optional< const SegmentChoice * > put (const SegmentChoice &entity, const bool force)
 
virtual const SegmentChoiceArrangementput (const SegmentChoiceArrangement &entity)
 
virtual const SegmentChoiceArrangementPickput (const SegmentChoiceArrangementPick &entity)
 
virtual const SegmentChordput (const SegmentChord &entity)
 
virtual const SegmentChordVoicingput (const SegmentChordVoicing &entity)
 
virtual std::optional< const SegmentMeme * > put (const SegmentMeme &entity, bool force)
 
virtual const SegmentMessageput (const SegmentMessage &entity)
 
virtual const SegmentMetaput (const SegmentMeta &entity)
 
virtual void putPreferredAudio (const std::string &parentIdent, const std::string &ident, const InstrumentAudio *instrumentAudio)
 
virtual const SegmentupdateSegment (Segment segment)
 
virtual const SegmentRetrospectivegetRetrospective ()
 
virtual ContentEntityStoregetSourceMaterial ()
 
virtual double getMicrosPerBeat (float tempo)
 
virtual int getSecondMacroSequenceBindingOffset (const Program *macroProgram)
 
virtual double getTempo ()
 
virtual MemeTaxonomy getMemeTaxonomy () const
 

Static Public Member Functions

static std::vector< std::string > getNotes (const SegmentChordVoicing *voicing)
 
static int getSegmentId (const SegmentChoice *segmentChoice)
 
static int getSegmentId (const SegmentChoiceArrangement *segmentChoiceArrangement)
 
static int getSegmentId (const SegmentChoiceArrangementPick *segmentChoiceArrangementPick)
 
static int getSegmentId (const SegmentChord *segmentChord)
 
static int getSegmentId (const SegmentChordVoicing *segmentChordVoicing)
 
static int getSegmentId (const SegmentMeme *segmentMeme)
 
static int getSegmentId (const SegmentMessage *segmentMessage)
 
static int getSegmentId (const SegmentMeta *segmentMeta)
 
static std::string toString (ControlMode controlMode)
 
static ControlMode parseControlMode (const char *str)
 

Member Enumeration Documentation

◆ ControlMode

Fabrication control mode

Enumerator
Auto 
Macro 
Taxonomy 

Constructor & Destructor Documentation

◆ ~Fabricator()

virtual XJ::Fabricator::~Fabricator ( )
virtualdefault

◆ Fabricator()

Fabricator::Fabricator ( ContentEntityStore contentEntityStore,
SegmentEntityStore segmentEntityStore,
const SegmentRetrospective segmentRetrospective,
int  segmentId,
std::optional< Segment::Type overrideSegmentType 
)
explicit

Construct new fabricator with the given segment retrospective

Parameters
segmentEntityStoreto use for segment entities
segmentRetrospectiveto use for segment retrospective
contentEntityStorecontentEntityStore from which to fabricate
segmentIdcurrent segment to fabricate
overrideSegmentTypeoverride segment type

Member Function Documentation

◆ addErrorMessage()

void Fabricator::addErrorMessage ( std::string  body)
virtual

Add an error message to the segment, with the given body

Parameters
bodyto include in message

◆ addInfoMessage()

void Fabricator::addInfoMessage ( std::string  body)
virtual

Add an info message to the segment, with the given body

Parameters
bodyto include in message

◆ addMessage()

void Fabricator::addMessage ( SegmentMessage::Type  messageType,
std::string  body 
)
virtual

Add a message of the given type to the segment, with the given body

Parameters
messageTypeof message to add
bodyto include in message

◆ addWarningMessage()

void Fabricator::addWarningMessage ( std::string  body)
virtual

Add a warning message to the segment, with the given body

Parameters
bodyto include in message

◆ chooseVoicing()

std::optional< const SegmentChordVoicing * > Fabricator::chooseVoicing ( const SegmentChord chord,
Instrument::Type  instrumentType 
)
virtual

Get segment chord voicing for a given chord

Parameters
chordto get voicing for
instrumentTypefor which to get voicing
Returns
chord voicing for chord

◆ deletePick()

void Fabricator::deletePick ( const UUID id)
virtual

Delete a pick from the current segment specified by Segment id and id

Parameters
idto delete

◆ getArrangements() [1/2]

std::set< const SegmentChoiceArrangement * > Fabricator::getArrangements ( )
virtual

Get arrangements for segment

Returns
arrangements for segment

◆ getArrangements() [2/2]

std::set< const SegmentChoiceArrangement * > Fabricator::getArrangements ( std::set< const SegmentChoice * > &  choices)
virtual

Get segment arrangements for a given choice

Parameters
choicesto get segment arrangements for
Returns
segments arrangements for the given segment choice

◆ getChain()

Chain * Fabricator::getChain ( )
virtual

Get the Chain

Returns
Chain

◆ getChoiceIfContinued() [1/3]

std::optional< const SegmentChoice * > Fabricator::getChoiceIfContinued ( const ProgramVoice voice)
virtual

Determine if a choice has been previously crafted in one of the previous segments of the current main sequence

Beat and Detail choices are kept for an entire Main Program https://github.com/xjmusic/xjmusic/issues/265

Returns
choice if previously made, or null if none is found

◆ getChoiceIfContinued() [2/3]

std::optional< const SegmentChoice * > Fabricator::getChoiceIfContinued ( Instrument::Type  instrumentType)
virtual

Determine if a choice has been previously crafted in one of the previous segments of the current main sequence

Returns
choice if previously made, or null if none is found

◆ getChoiceIfContinued() [3/3]

std::optional< const SegmentChoice * > Fabricator::getChoiceIfContinued ( Instrument::Type  instrumentType,
Instrument::Mode  instrumentMode 
)
virtual

Determine if a choice has been previously crafted in one of the previous segments of the current main sequence

Returns
choice if previously made, or null if none is found

◆ getChoices()

std::set< const SegmentChoice * > Fabricator::getChoices ( ) const
virtual

Get choices for segment

Returns
choices for segment

◆ getChoicesIfContinued()

std::set< const SegmentChoice * > Fabricator::getChoicesIfContinued ( const Program::Type  programType)
virtual

Determine if a choice has been previously crafted in one of the previous segments of the current main sequence

Returns
choice if previously made, or null if none is found

◆ getChordAt()

std::optional< const SegmentChord * > Fabricator::getChordAt ( float  position)
virtual

Get current ChordEntity for any position in Segment. Defaults to returning a chord based on the segment key, if nothing else is found

Parameters
positionin segment
Returns
ChordEntity

◆ getChordVoicings()

std::set< const SegmentChordVoicing * > Fabricator::getChordVoicings ( )
virtual

Get all segment chord voicings

Returns
segment chord voicings

◆ getCurrentBeatChoice()

std::optional< const SegmentChoice * > Fabricator::getCurrentBeatChoice ( )
virtual

Get the beat-type choice for the current segment in the chain

Returns
beat-type segment choice

◆ getCurrentDetailChoices()

std::set< const SegmentChoice * > Fabricator::getCurrentDetailChoices ( )
virtual

Get the detail-type choice for the current segment in the chain

Returns
detail-type segment choice

◆ getCurrentMainChoice()

std::optional< const SegmentChoice * > Fabricator::getCurrentMainChoice ( )
virtual

Get the main-type choice for the current segment in the chain

Returns
main-type segment choice

◆ getCurrentMainProgramConfig()

ProgramConfig Fabricator::getCurrentMainProgramConfig ( )
virtual

Get the configuration of the current main program

Returns
main-program configuration @ on failure

◆ getCurrentMainSequence()

std::optional< const ProgramSequence * > Fabricator::getCurrentMainSequence ( )
virtual

Get the sequence targeted by the current main choice

Returns
current main sequence

◆ getDistinctChordVoicingTypes()

std::set< Instrument::Type > Fabricator::getDistinctChordVoicingTypes ( )
virtual

Get a list of unique voicing (instrument) types present in the voicings of the current main program's chords.

Returns
set of voicing (instrument) types

◆ getElapsedMicros()

long Fabricator::getElapsedMicros ( )
virtual
Returns
Seconds elapsed since fabricator was instantiated

◆ getKeyForChoice()

Chord Fabricator::getKeyForChoice ( const SegmentChoice choice)
virtual

Get the Key for any given Choice, preferring its Sequence Key (bound), defaulting to the Program Key.

If Sequence has no key/tempo/intensity inherit from Program https://github.com/xjmusic/xjmusic/issues/246

Parameters
choiceto get key for
Returns
key of specified sequence/program via choice @ if unable to determine key of choice

◆ getMacroChoiceOfPreviousSegment()

std::optional< const SegmentChoice * > Fabricator::getMacroChoiceOfPreviousSegment ( )
virtual

Get the macro-type choice for the previous segment in the chain

Returns
macro-type segment choice, null if none found

◆ getMemeIsometryOfNextSequenceInPreviousMacro()

MemeIsometry Fabricator::getMemeIsometryOfNextSequenceInPreviousMacro ( )
virtual

Get meme isometry for the next offset in the previous segment's macro-choice

Returns
MemeIsometry for previous macro-choice

◆ getMemeIsometryOfSegment()

MemeIsometry Fabricator::getMemeIsometryOfSegment ( )
virtual

Get meme isometry for the current segment

Returns
MemeIsometry for current segment

◆ getMemeTaxonomy()

MemeTaxonomy Fabricator::getMemeTaxonomy ( ) const
virtual
Returns
the meme taxonomy for the source material

◆ getMicrosPerBeat()

double Fabricator::getMicrosPerBeat ( float  tempo)
virtual

Get the number of micros per beat for the current segment

Returns
micros per beat @ on failure

◆ getNextSequenceBindingOffset()

int Fabricator::getNextSequenceBindingOffset ( const SegmentChoice choice)
virtual

Given a Choice having a SequenceBinding, determine the next available SequenceBinding offset of the chosen sequence, or loop back to zero (if past the end of the available SequenceBinding offsets)

Parameters
choicehaving a SequenceBinding
Returns
next available SequenceBinding offset of the chosen sequence, or zero (if past the end of the available SequenceBinding offsets)

◆ getNotes()

std::vector< std::string > Fabricator::getNotes ( const SegmentChordVoicing voicing)
static

Get the Notes from a Voicing

Parameters
voicingto get notes of
Returns
notes from voicing @ on failure

◆ getPicks() [1/2]

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

Get arrangement picks for segment

Returns
arrangement picks for segment

◆ getPicks() [2/2]

std::vector< const SegmentChoiceArrangementPick * > Fabricator::getPicks ( const SegmentChoice choice)
virtual

Get the picks for a given choice, in order of position ascending from beginning of segment

Parameters
choicefor which to get picks
Returns
picks

◆ getPreferredAudio()

std::optional< const InstrumentAudio * > Fabricator::getPreferredAudio ( const std::string &  parentIdent,
const std::string &  ident 
)
virtual

Get preferred (previously chosen) instrument audios

Returns
preferred audios

◆ getPreviousMainChoice()

std::optional< const SegmentChoice * > Fabricator::getPreviousMainChoice ( )
virtual

Get the main-type choice for the previous segment in the chain

Returns
main-type segment choice, null if none found

◆ getPreviousMainSequence()

std::optional< const ProgramSequence * > Fabricator::getPreviousMainSequence ( )
virtual

Get the sequence targeted by the previous main choice

Returns
previous main sequence

◆ getProgram()

std::optional< const Program * > Fabricator::getProgram ( const SegmentChoice choice)
virtual

Get Program for any given choice

Parameters
choiceto get program for
Returns
Program for the specified choice

◆ getProgramRange()

NoteRange Fabricator::getProgramRange ( const UUID programId,
Instrument::Type  instrumentType 
)
virtual

Get the note range for an arrangement based on all the events in its program

Parameters
programIdto get range of
instrumentTypeto get range of
Returns
Note range of arrangement @ on failure

◆ getProgramRangeShiftOctaves()

int Fabricator::getProgramRangeShiftOctaves ( Instrument::Type  instrumentType,
NoteRange sourceRange,
NoteRange targetRange 
)
virtual

Detail craft shifts source program events into the target range https://github.com/xjmusic/xjmusic/issues/221

via average of delta from source low to target low, and from source high to target high, rounded to octave

Parameters
instrumentTypeof instrument
sourceRangeto compute from
targetRangeto compute required # of octaves to shift into
Returns
+/- octaves required to shift from source to target range @ on failure

◆ getProgramSequence()

std::optional< const ProgramSequence * > Fabricator::getProgramSequence ( const SegmentChoice choice)
virtual

Get the sequence for a given choice

Parameters
choicefor which to get sequence
Returns
sequence of choice

◆ getProgramSequenceChords()

std::vector< const ProgramSequenceChord * > Fabricator::getProgramSequenceChords ( const ProgramSequence programSequence)
virtual

Get the complete set of program sequence chords, ignoring ghost chords* REF by choosing the voicings with largest # of notes at that position https://github.com/xjmusic/xjmusic/issues/248 (caches results)

Parameters
programSequencefor which to get complete do-ghosted set of chords
Returns
get complete do-ghosted set of chords for program sequence

◆ getProgramTargetShift()

int Fabricator::getProgramTargetShift ( Instrument::Type  instrumentType,
const Chord fromChord,
const Chord toChord 
)
virtual

Compute the target shift from a key toward a chord

Parameters
instrumentTypeto switch behavior
fromChordto compute shift from
toChordto compute shift toward
Returns
computed target shift

◆ getProgramType()

Program::Type Fabricator::getProgramType ( const ProgramVoice voice)
virtual

Get the program type of given voice

Parameters
voicefor which to get program type
Returns
program type @ on failure

◆ getProgramVoiceType()

Instrument::Type Fabricator::getProgramVoiceType ( const ProgramSequenceChordVoicing voicing)
virtual

Get the voice type for the given voicing

Programs persist main chord/voicing structure sensibly https://github.com/xjmusic/xjmusic/issues/266

Parameters
voicingfor which to get voice type
Returns
type of voice for voicing @ on failure

◆ getProgramVoicingNoteRange()

NoteRange Fabricator::getProgramVoicingNoteRange ( Instrument::Type  instrumentType)
virtual

Get the lowest note present in any voicing of all the segment chord voicings for this segment and instrument instrumentType

Parameters
instrumentTypeto get voicing threshold low of
Returns
low voicing threshold @ on failure

◆ getRandomlySelectedPatternOfSequenceByVoiceAndType()

std::optional< const ProgramSequencePattern * > Fabricator::getRandomlySelectedPatternOfSequenceByVoiceAndType ( const SegmentChoice choice)
virtual

Selects one (at random) of all available patterns of a given type within a sequence. https://github.com/xjmusic/xjmusic/issues/204

Caches the selection, so it will always return the same output for any given input.

Beat fabrication composited of layered Patterns https://github.com/xjmusic/xjmusic/issues/267

Returns
Pattern model, or null if no pattern of this type is found @ on failure

◆ getRandomlySelectedSequence()

std::optional< const ProgramSequence * > Fabricator::getRandomlySelectedSequence ( const Program program)
virtual

Randomly select any sequence

Returns
randomly selected sequence

◆ getRandomlySelectedSequenceBindingAtOffset()

std::optional< const ProgramSequenceBinding * > Fabricator::getRandomlySelectedSequenceBindingAtOffset ( const Program program,
int  offset 
)
virtual

Randomly select any sequence binding at the given offset

Parameters
programfrom which to get sequence binding
offsetto get sequence binding at
Returns
randomly selected sequence binding

◆ getRetrospective()

const SegmentRetrospective * Fabricator::getRetrospective ( )
virtual

Get the Segment Retrospective

Returns
retrospective

◆ getRootNoteMidRange()

std::optional< Note > Fabricator::getRootNoteMidRange ( const std::string &  voicingNotes,
const Chord chord 
)
virtual

Get the root note from an available set of voicings and a given chord

Parameters
voicingNotesavailable voicing notes
chordfor which to seek root note among available voicings
Returns
root note

◆ getSecondMacroSequenceBindingOffset()

int Fabricator::getSecondMacroSequenceBindingOffset ( const Program macroProgram)
virtual

Get the second macro sequence binding offset of a given macro program

Parameters
macroProgramfor which to get second macro sequence binding offset
Returns
second macro sequence binding offset

◆ getSegment()

const Segment * Fabricator::getSegment ( )
virtual

The segment being fabricated

Returns
Segment

◆ getSegmentChords()

std::vector< const SegmentChord * > Fabricator::getSegmentChords ( )
virtual

Get all segment chords, guaranteed to be in order of position ascending

Returns
segment chords

◆ getSegmentId() [1/8]

int Fabricator::getSegmentId ( const SegmentChoice segmentChoice)
static

Get Segment ID of Segment Choice

Parameters
segmentChoice
Returns

◆ getSegmentId() [2/8]

int Fabricator::getSegmentId ( const SegmentChoiceArrangement segmentChoiceArrangement)
static

Get Segment ID of Segment Choice Arrangement

◆ getSegmentId() [3/8]

int Fabricator::getSegmentId ( const SegmentChoiceArrangementPick segmentChoiceArrangementPick)
static

Get Segment ID of Segment Choice Arrangement Pick

◆ getSegmentId() [4/8]

int Fabricator::getSegmentId ( const SegmentChord segmentChord)
static

Get Segment ID of Segment Chord

◆ getSegmentId() [5/8]

int Fabricator::getSegmentId ( const SegmentChordVoicing segmentChordVoicing)
static

Get Segment ID of Segment Chord Voicing

◆ getSegmentId() [6/8]

int Fabricator::getSegmentId ( const SegmentMeme segmentMeme)
static

Get Segment ID of Segment Meme

◆ getSegmentId() [7/8]

int Fabricator::getSegmentId ( const SegmentMessage segmentMessage)
static

Get Segment ID of Segment Message

◆ getSegmentId() [8/8]

int Fabricator::getSegmentId ( const SegmentMeta segmentMeta)
static

Get Segment ID of Segment Meta

◆ getSegmentMemes()

std::set< const SegmentMeme * > Fabricator::getSegmentMemes ( )
virtual

Get all segment memes

Returns
segment memes

◆ getSegmentMicrosAtPosition()

long Fabricator::getSegmentMicrosAtPosition ( float  tempo,
float  position 
)
virtual

Compute using an integral the seconds of start for any given position in beats Velocity of Segment meter (beats per minute) increases linearly of the beginning of the Segment (at the previous Segment's tempo) to the end of the Segment (arriving at the current Segment's tempo, only at its end)

Segment should never be fabricated longer than its loop beats. https://github.com/xjmusic/xjmusic/issues/268 Segment wherein tempo changes expect perfectly smooth sound of previous segment through to following segment https://github.com/xjmusic/xjmusic/issues/269

Parameters
tempoin beats per minute
positionin beats
Returns
seconds of start

◆ getSequence()

std::optional< const ProgramSequence * > Fabricator::getSequence ( const SegmentChoice choice)
virtual

Get the sequence for a Choice either directly (beat- and detail-type sequences), or by sequence-pattern (macro- or main-type sequences) https://github.com/xjmusic/xjmusic/issues/204

Beat and Detail programs are allowed to have only one (default) sequence.

Parameters
choiceto get sequence for
Returns
Sequence for choice @ on failure

◆ getSequenceBindingOffsetForChoice()

int Fabricator::getSequenceBindingOffsetForChoice ( const SegmentChoice choice)
virtual

Get the sequence pattern offset of a given Choice

Parameters
choicehaving a SequenceBinding
Returns
sequence pattern offset

◆ getSourceMaterial()

ContentEntityStore * Fabricator::getSourceMaterial ( )
virtual

Get the ingested source material for fabrication

Returns
source material

◆ getStickyBun()

std::optional< const StickyBun > Fabricator::getStickyBun ( const UUID eventId)
virtual

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

  • Sticky bun is a simple coded key-value in segment meta — key by pattern ID — value is a comma-separated list of integers, one integer for each note in the pattern, where --— tonal note is coded as a 0 value --— atonal note has a random integer value generated ranging from -50 to 50
  • Rendering a pattern X voicing considers the sticky bun values — the random seed for rendering the pattern will always come from the associated sticky bun

Sticky buns v2 persisted for each randomly selected note in the series for any given pattern https://github.com/xjmusic/xjmusic/issues/231

  • key on program-sequence-pattern-event id, persisting only the first value seen for any given event
  • super-key on program-sequence-pattern id, measuring delta from the first event seen in that pattern

TemplateConfig parameter stickyBunEnabled https://github.com/xjmusic/xjmusic/issues/251

Parameters
eventIdfor super-key
Returns
sticky bun if present

◆ getTemplateConfig()

TemplateConfig Fabricator::getTemplateConfig ( )
virtual

Chain configuration, by type If no chain config is found for this type, a default config is returned.

Returns
chain configuration

◆ getTempo()

double Fabricator::getTempo ( )
virtual
Returns
the tempo of the current main program @ on failure

◆ getTotalSegmentMicros()

long Fabricator::getTotalSegmentMicros ( )
virtual
Returns
the total number of seconds in the segment

◆ getTrackName()

std::string Fabricator::getTrackName ( const ProgramSequencePatternEvent event)
virtual

Get the track name for a give program sequence pattern event

Parameters
eventfor which to get track name
Returns
Track name @ on failure

◆ getType()

Segment::Type Fabricator::getType ( )
virtual

Determine type of content, e.g. initial segment in chain, or next macro-sequence

Returns
macro-craft type @ on failure

◆ hasMoreSequenceBindingOffsets()

bool Fabricator::hasMoreSequenceBindingOffsets ( const SegmentChoice choice,
int  N 
)
virtual

Does the program of the specified Choice have at least N more sequence binding offsets available?

Parameters
choiceof which to check the program for next available sequence binding offsets
Nmore sequence offsets to check for
Returns
true if N more sequence binding offsets are available

◆ hasOneMoreSequenceBindingOffset()

bool Fabricator::hasOneMoreSequenceBindingOffset ( const SegmentChoice choice)
virtual

Whether the current Segment Choice has one or more sequence pattern offsets with a higher pattern offset than the current one

Parameters
choicefor which to check
Returns
true if it has at least one more sequence pattern offset

◆ hasTwoMoreSequenceBindingOffsets()

bool Fabricator::hasTwoMoreSequenceBindingOffsets ( const SegmentChoice choice)
virtual

Whether the current Segment Choice has two or more sequence pattern offsets with a higher pattern offset than the current two

Parameters
choicefor which to check
Returns
true if it has at least two more sequence pattern offsets

◆ isContinuationOfMacroProgram()

bool Fabricator::isContinuationOfMacroProgram ( )
virtual

Whether this type of segment continues the same macro-program from the previous segment

Returns
true if this segment continues the same macro-program @ on failure

◆ isDirectlyBound() [1/3]

bool Fabricator::isDirectlyBound ( const Instrument instrument)
virtual

Whether a given Instrument is directly bound to the Chain, where "directly" means a level more specific than Library, e.g. Program or Instrument

Parameters
instrumentto test for direct binding
Returns
true if Instrument is directly bound to chain

◆ isDirectlyBound() [2/3]

bool Fabricator::isDirectlyBound ( const InstrumentAudio instrumentAudio)
virtual

Whether a given InstrumentAudio is directly bound to the Chain, where "directly" means a level more specific than Library, e.g. Program or InstrumentAudio

Parameters
instrumentAudioto test for direct binding
Returns
true if InstrumentAudio is directly bound to chain

◆ isDirectlyBound() [3/3]

bool Fabricator::isDirectlyBound ( const Program program)
virtual

Whether a given Program is directly bound to the Chain, where "directly" means a level more specific than Library, e.g. Program or Instrument

Parameters
programto test for direct binding
Returns
true if Program is directly bound to chain

◆ isInitialSegment()

bool Fabricator::isInitialSegment ( )
virtual

is initial segment?

Returns
whether this is the initial segment in a chain

◆ isOneShot() [1/2]

bool Fabricator::isOneShot ( const Instrument instrument)
virtual

Test if a given instrument is one-shot

Parameters
instrumentto test
Returns
true if this is a one-shot instrument @ on failure

◆ isOneShot() [2/2]

bool Fabricator::isOneShot ( const Instrument instrument,
const std::string &  trackName 
)
virtual

Test if a given instrument and track name is a one-shot sample hit

Parameters
instrumentto test
trackNameto test
Returns
true if this is a one-shot instrument and track name @ on failure

◆ isOneShotCutoffEnabled()

bool Fabricator::isOneShotCutoffEnabled ( const Instrument instrument)
virtual

Test if a given one-shot instrument has its cutoffs enable

Parameters
instrumentto test
Returns
true if a given one-shot instrument has its cutoffs enable @ on failure

◆ parseControlMode()

Fabricator::ControlMode Fabricator::parseControlMode ( const char *  str)
static

Parse the control mode from a string

Parameters
strto parse
Returns
control mode

◆ put() [1/8]

std::optional< const SegmentChoice * > Fabricator::put ( const SegmentChoice entity,
const bool  force 
)
virtual

Put a SegmentChoice in the store

Should add memes from ALL program and instrument types! https://github.com/xjmusic/xjmusic/issues/210

Parameters
entityChoice to put
Returns
choice if successfully put @ on failure

◆ put() [2/8]

const SegmentChoiceArrangement * Fabricator::put ( const SegmentChoiceArrangement entity)
virtual

Put a SegmentChoiceArrangement in the store

Parameters
entityArrangement to put
Returns
Arrangement successfully put @ on failure

◆ put() [3/8]

const SegmentChoiceArrangementPick * Fabricator::put ( const SegmentChoiceArrangementPick entity)
virtual

Put a SegmentChoiceArrangementPick in the store

Parameters
entityChoiceArrangementPick to put
Returns
ChoiceArrangementPick successfully put @ on failure

◆ put() [4/8]

const SegmentChord * Fabricator::put ( const SegmentChord entity)
virtual

Put a SegmentChord in the store

Parameters
entityChord to put
Returns
Chord successfully put @ on failure

◆ put() [5/8]

const SegmentChordVoicing * Fabricator::put ( const SegmentChordVoicing entity)
virtual

Put a SegmentChordVoicing in the store

Parameters
entityChordVoicing to put
Returns
ChordVoicing successfully put @ on failure

◆ put() [6/8]

std::optional< const SegmentMeme * > Fabricator::put ( const SegmentMeme entity,
bool  force 
)
virtual

Put a SegmentMeme in the store

Parameters
entityMeme to put
forcewhether to force meme addition without valid theorem checks
Returns
Meme successfully put @ on failure

◆ put() [7/8]

const SegmentMessage * Fabricator::put ( const SegmentMessage entity)
virtual

Put a SegmentMessage in the store

Parameters
entityMessage to put
Returns
Message successfully put @ on failure

◆ put() [8/8]

const SegmentMeta * Fabricator::put ( const SegmentMeta entity)
virtual

Put a SegmentMeta in the store

Parameters
entityMeta to put
Returns
Meta successfully put @ on failure

◆ putPreferredAudio()

void Fabricator::putPreferredAudio ( const std::string &  parentIdent,
const std::string &  ident,
const InstrumentAudio instrumentAudio 
)
virtual

Set the preferred audio for a key

Parameters
parentIdentfor which to set
identfor which to set
instrumentAudiovalue to set

◆ putStickyBun()

void Fabricator::putStickyBun ( StickyBun  bun)
virtual

Store a sticky bun in the fabricator

Parameters
bunto store
Exceptions
JsonProcessingExceptionon failure @ on failure

◆ toString()

std::string Fabricator::toString ( ControlMode  controlMode)
static

Get the string representation of the control mode

Parameters
controlMode

◆ updateSegment()

const Segment * Fabricator::updateSegment ( Segment  segment)
virtual

Set the Segment. Any modifications to the Segment must be re-written to here because protobuf instances are immutable

Parameters
segmentto set @ on failure

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