XJ music engine
1.9.6
In-game runtime engine for XJ music.
|
#include <Craft.h>
Classes | |
class | ChoiceIndexProvider |
class | InstrumentProvider |
class | LambdaChoiceIndexProvider |
class | LambdaInstrumentProvider |
class | Section |
Public Member Functions | |
Craft (Fabricator *fabricator) | |
bool | isIntroSegment (const SegmentChoice *choice) const |
bool | isOutroSegment (const SegmentChoice *choice) const |
bool | isSilentEntireSegment (const SegmentChoice *choice) const |
bool | isActiveEntireSegment (const SegmentChoice *choice) const |
void | craftNoteEventArrangements (float tempo, const SegmentChoice *choice, bool defaultAtonal) |
void | precomputeDeltas (const std::function< bool(const SegmentChoice *)> &choiceFilter, const ChoiceIndexProvider &setChoiceIndexProvider, const std::vector< std::string > &layersInCraftOrder, const std::set< std::string > &layerPrioritizationSearches, const int numLayersIncoming) |
std::optional< const Program * > | chooseFreshProgram (Program::Type programType, std::optional< Instrument::Type > voicingType) const |
std::optional< const Instrument * > | chooseFreshInstrument (Instrument::Type type, const std::set< std::string > &requireEventNames) const |
std::optional< const InstrumentAudio * > | chooseFreshInstrumentAudio (const std::set< Instrument::Type > &types, const std::set< Instrument::Mode > &modes, const std::set< UUID > &avoidIds, const std::set< std::string > &preferredEvents) const |
std::optional< const InstrumentAudio * > | selectNewChordPartInstrumentAudio (const Instrument *instrument, const Chord &chord) const |
std::set< const InstrumentAudio * > | selectGeneralAudioIntensityLayers (const Instrument *instrument) const |
Static Public Member Functions | |
static bool | inBounds (int floor, int ceiling, float value) |
static bool | isUnlimitedIn (const SegmentChoice &choice) |
static bool | isUnlimitedOut (const SegmentChoice &choice) |
Public Attributes | |
ChoiceIndexProvider | choiceIndexProvider = {} |
Protected Member Functions | |
std::set< const Program * > | programsDirectlyBound (const std::set< const Program * > &programs) const |
std::set< const Instrument * > | instrumentsDirectlyBound (const std::set< const Instrument * > &instruments) const |
std::set< const InstrumentAudio * > | audiosDirectlyBound (const std::set< const InstrumentAudio * > &instrumentAudios) const |
std::set< const InstrumentAudio * > | audiosPublished (const std::set< const InstrumentAudio * > &instrumentAudios) const |
bool | computeMute (Instrument::Type instrumentType) const |
void | pickInstrumentAudio (const SegmentChoiceArrangement *arrangement, const InstrumentAudio *audio, long startAtSegmentMicros, long lengthMicros, const std::string &event) const |
std::set< const InstrumentAudio * > | selectAudioIntensityLayers (std::set< const InstrumentAudio * > audios, const int layers) const |
void | craftNoteEvents (float tempo, const ProgramSequence *sequence, const std::set< const ProgramVoice * > &voices, LambdaInstrumentProvider instrumentProvider) |
void | craftChordParts (float tempo, const Instrument *instrument) |
void | craftChordParts (float tempo, const Instrument *instrument, const SegmentChoice *choice) |
void | craftEventParts (float tempo, const Instrument *instrument, const Program *program) |
int | computeDeltaIn (const SegmentChoice *choice) |
int | computeDeltaOut (const SegmentChoice *choice) |
![]() | |
FabricationWrapper (Fabricator *fabricator) | |
FabricationException | exception (const std::string &message) const |
std::string | formatLog (const std::string &message) const |
void | reportMissing (const std::map< std::string, std::string > &traces) const |
Static Protected Member Functions | |
static std::set< const Program * > | programsPublished (const std::set< const Program * > &programs) |
static std::set< const Instrument * > | instrumentsPublished (const std::set< const Instrument * > &instruments) |
Protected Attributes | |
std::map< std::string, int > | deltaIns |
std::map< std::string, int > | deltaOuts |
std::set< Instrument::Type > | finalizeAudioLengthsForInstrumentTypes |
![]() | |
Fabricator * | fabricator |
Arrangement of Segment Events is a common foundation for all craft
|
explicit |
Must extend this class and inject
fabricator | internal |
|
protected |
Filter only the directly bound instrumentAudios
instrumentAudios | to filter |
|
protected |
Filter only the published instrumentAudios
instrumentAudios | to filter |
std::optional< const Instrument * > Craft::chooseFreshInstrument | ( | Instrument::Type | type, |
const std::set< std::string > & | requireEventNames | ||
) | const |
Choose instrument
Choose drum instrument to fulfill beat program event names https://github.com/xjmusic/xjmusic/issues/253
type | of instrument to choose from |
requireEventNames | instrument candidates are required to have event names https://github.com/xjmusic/xjmusic/issues/253 |
std::optional< const InstrumentAudio * > Craft::chooseFreshInstrumentAudio | ( | const std::set< Instrument::Type > & | types, |
const std::set< Instrument::Mode > & | modes, | ||
const std::set< UUID > & | avoidIds, | ||
const std::set< std::string > & | preferredEvents | ||
) | const |
Percussion-type Loop-mode instrument audios are chosen in order of priority https://github.com/xjmusic/xjmusic/issues/255
Choose drum instrument to fulfill beat program event names https://github.com/xjmusic/xjmusic/issues/253
types | of instrument to choose from |
modes | of instrument to choose from |
avoidIds | to avoid, or empty list |
preferredEvents | instrument candidates are required to have event names https://github.com/xjmusic/xjmusic/issues/253 |
std::optional< const Program * > Craft::chooseFreshProgram | ( | Program::Type | programType, |
std::optional< Instrument::Type > | voicingType | ||
) | const |
Choose a fresh program based on a set of memes
programType | to choose |
voicingType | (optional) for which to choose a program for– and the program is required to have this type of voice |
|
protected |
Get the delta in for the given voice
choice | for which to get delta in |
|
protected |
Get the delta out for the given voice
choice | for which to get delta out |
|
protected |
Compute a mute value, based on the template config
instrumentType | of instrument for which to compute mute |
|
protected |
Chord instrument mode https://github.com/xjmusic/xjmusic/issues/235
tempo | of main program |
instrument | for which to craft choices @on failure |
|
protected |
Chord instrument mode https://github.com/xjmusic/xjmusic/issues/235
tempo | of main program |
instrument | chosen |
choice | for which to craft chord parts @on failure |
|
protected |
Event instrument mode
tempo | of main program |
instrument | for which to craft choices |
program | for which to craft choices @on failure |
void Craft::craftNoteEventArrangements | ( | float | tempo, |
const SegmentChoice * | choice, | ||
bool | defaultAtonal | ||
) |
Craft the arrangement for a given voice
Choice inertia https://github.com/xjmusic/xjmusic/issues/242 Perform the inertia analysis, and determine whether they actually use the new choice or not IMPORTANT** If the previously chosen instruments are for the previous main program as the current segment, the inertia scores are not actually added to the regular scores or used to make choices– this would prevent new choices from being made. Inertia must be its own layer of calculation, a question of whether the choices will be followed or whether the inertia will be followed thus the new choices have been made, we know where we're going next, but we aren't actually using them yet until we hit the next main program in full, N segments later.
Ends with a pass to set the actual length of one-shot audio picks One-shot instruments cut off when other notes played with same instrument, or at end of segment https://github.com/xjmusic/xjmusic/issues/243
tempo | of main program |
choice | to craft arrangements for |
defaultAtonal | whether to default to a single atonal note, if no voicings are available @on failure |
|
protected |
Segments have intensity arcs; automate mixer layers in and out of each main program https://github.com/xjmusic/xjmusic/issues/233
tempo | of main program |
sequence | for which to craft choices |
voices | for which to craft choices |
instrumentProvider | from which to get instruments @on failure |
|
static |
Whether a position is in the given bounds
floor | of boundary |
ceiling | of boundary |
value | to test for within bounds |
|
protected |
Filter only the directly bound instruments
instruments | to filter |
|
staticprotected |
Filter only the published instruments
instruments | to filter |
bool Craft::isActiveEntireSegment | ( | const SegmentChoice * | choice | ) | const |
Whether the given choice is fully active during the current segment
choice | to test for activation |
bool Craft::isIntroSegment | ( | const SegmentChoice * | choice | ) | const |
Whether the current segment contains the delta in for the given choice
choice | to test whether the current segment contains this choice delta in |
bool Craft::isOutroSegment | ( | const SegmentChoice * | choice | ) | const |
Whether the current segment contains the delta out for the given choice
choice | to test whether the current segment contains this choice delta out |
bool Craft::isSilentEntireSegment | ( | const SegmentChoice * | choice | ) | const |
Whether the given choice is silent during the entire segment
choice | to test for silence |
|
static |
Whether a given choice has deltaIn unlimited
choice | to test |
|
static |
Whether a given choice has deltaOut unlimited
choice | to test |
|
protected |
Pick the transition
arrangement | to pick |
audio | to pick |
startAtSegmentMicros | to pick |
lengthMicros | to pick |
event | to pick @on failure |
void Craft::precomputeDeltas | ( | const std::function< bool(const SegmentChoice *)> & | choiceFilter, |
const ChoiceIndexProvider & | setChoiceIndexProvider, | ||
const std::vector< std::string > & | layersInCraftOrder, | ||
const std::set< std::string > & | layerPrioritizationSearches, | ||
const int | numLayersIncoming | ||
) |
Precompute all deltas for a given program. This is where deltaIns and deltaOuts values come from.
Precompute deltas dynamically based on whatever is extending the arranger– Don't have anything in this class that's proprietary to beat or detail– abstract that out into provider interfaces
Segments have intensity arcs; automate mixer layers in and out of each main program https://github.com/xjmusic/xjmusic/issues/233
Shift deltas so 2x more time is spent on construction than deconstruction
Vary the high plateau between delta in and out across layers
@on failure
|
protected |
Filter only the directly bound programs
programs | to filter |
|
staticprotected |
Filter only the published programs
programs | to filter |
|
protected |
Pick one audio for each desired intensity level, by layering the audios by intensity and picking one from each layer. Divide the audios into layers (ergo grouping them by intensity ascending) and pick one audio per layer.
audios | from which to pick layers |
layers | number of layers to pick |
std::set< const InstrumentAudio * > Craft::selectGeneralAudioIntensityLayers | ( | const Instrument * | instrument | ) | const |
Select audios for the given instrument
instrument | for which to pick audio |
std::optional< const InstrumentAudio * > Craft::selectNewChordPartInstrumentAudio | ( | const Instrument * | instrument, |
const Chord & | chord | ||
) | const |
Select a new random instrument audio based on a pattern event
instrument | of which to score available audios, and make a selection |
chord | to match |
ChoiceIndexProvider XJ::Craft::choiceIndexProvider = {} |
|
protected |
|
protected |
|
protected |