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

#include <SegmentUtils.h>

Static Public Member Functions

static std::optional< const SegmentChoice * > findFirstOfType (const std::set< const SegmentChoice * > &segmentChoices, Program::Type type)
 
static std::optional< const SegmentChoice * > findFirstOfType (const std::set< const SegmentChoice * > &segmentChoices, Instrument::Type type)
 
static std::string getIdentifier (const Segment *segment)
 
static std::optional< const Segment * > getLastCrafted (const std::vector< const Segment * > &segments)
 
static std::optional< const Segment * > getLast (const std::vector< const Segment * > &segments)
 
static std::vector< const Segment * > getCrafted (const std::vector< const Segment * > &segments)
 
static bool containsAnyValidNotes (const SegmentChordVoicing *voicing)
 
static bool isSpanning (const Segment *segment, unsigned long long fromChainMicros, unsigned long long toChainMicros)
 
static bool isIntersecting (const Segment *segment, unsigned long long atChainMicros, unsigned long long thresholdMicros)
 
static std::string getStorageFilename (const Segment *segment, const std::string &extension)
 
static std::string getStorageFilename (const Segment *segment)
 
static std::string describe (const SegmentChoice &choice)
 
static long getEndAtChainMicros (const Segment *segment)
 
static bool isSameButUpdated (const Segment *s1, const Segment *s2)
 
static long getDurationMinMicros (std::vector< Segment > &segments)
 

Member Function Documentation

◆ containsAnyValidNotes()

bool SegmentUtils::containsAnyValidNotes ( const SegmentChordVoicing voicing)
static

Whether a segment chord voicing contains any valid notes

Parameters
voicingto test
Returns
true if contains any valid notes

◆ describe()

std::string SegmentUtils::describe ( const SegmentChoice choice)
static
Parameters
choiceto describe
Returns
description of choice

◆ findFirstOfType() [1/2]

std::optional< const SegmentChoice * > SegmentUtils::findFirstOfType ( const std::set< const SegmentChoice * > &  segmentChoices,
Instrument::Type  type 
)
static

Find first segment choice of a given type in a collection of segment choices

Parameters
segmentChoicesto filter from
typeto find one of
Returns
segment choice of given type

◆ findFirstOfType() [2/2]

std::optional< const SegmentChoice * > SegmentUtils::findFirstOfType ( const std::set< const SegmentChoice * > &  segmentChoices,
Program::Type  type 
)
static

Find first segment choice of a given type in a collection of segment choices

Parameters
segmentChoicesto filter from
typeto find one of
Returns
segment choice of given type

◆ getCrafted()

std::vector< const Segment * > SegmentUtils::getCrafted ( const std::vector< const Segment * > &  segments)
static

Get only the dubbed from any collection of Segments

Parameters
segmentsto get dubbed from
Returns
dubbed segments from collection

◆ getDurationMinMicros()

long SegmentUtils::getDurationMinMicros ( std::vector< Segment > &  segments)
static

Get the duration of a collection of segments in microseconds

Parameters
segmentscollection of segments
Returns
duration in microseconds

◆ getEndAtChainMicros()

long SegmentUtils::getEndAtChainMicros ( const Segment segment)
static

Get the end-at time of a segment in chain micros

Parameters
segmentfor which to get time
Returns
end-at time in chain micros

◆ getIdentifier()

std::string SegmentUtils::getIdentifier ( const Segment segment)
static

Get the identifier or a Segment: ship key if available, else ID

Parameters
segmentto get identifier of
Returns
ship key if available, else ID

◆ getLast()

std::optional< const Segment * > SegmentUtils::getLast ( const std::vector< const Segment * > &  segments)
static

Get the last from any collection of Segments

Parameters
segmentsto get last from
Returns
last segment from collection

◆ getLastCrafted()

std::optional< const Segment * > SegmentUtils::getLastCrafted ( const std::vector< const Segment * > &  segments)
static

Get the last dubbed from any collection of Segments

Parameters
segmentsto get last dubbed from
Returns
last dubbed segment from collection

◆ getStorageFilename() [1/2]

std::string SegmentUtils::getStorageFilename ( const Segment segment)
static

Get the full storage key for a segment audio

Parameters
segmentfor which to get storage key
Returns
storage key for segment

◆ getStorageFilename() [2/2]

std::string SegmentUtils::getStorageFilename ( const Segment segment,
const std::string &  extension 
)
static

Get the storage filename for a Segment

Parameters
segmentfor which to get storage filename
extensionof key
Returns
segment ship key

◆ isIntersecting()

bool SegmentUtils::isIntersecting ( const Segment segment,
unsigned long long  atChainMicros,
unsigned long long  thresholdMicros 
)
static

Whether the segment is intersecting a given time. Inclusive of segment start time; exclusive of segment end time. Designed so to return true when within the threshold of being active (may true for multiple segments)

  • return false when threshold is 0 and at the exact end of the segment (to avoid double-activation)
Parameters
segmentto test
atChainMicrosto test at
thresholdMicrosto test threshold
Returns
true if segment is spanning time

◆ isSameButUpdated()

bool SegmentUtils::isSameButUpdated ( const Segment s1,
const Segment s2 
)
static

Whether two segments are the same but updated

Parameters
s1segment one
s2segment two
Returns
true if same but updated

◆ isSpanning()

bool SegmentUtils::isSpanning ( const Segment segment,
unsigned long long  fromChainMicros,
unsigned long long  toChainMicros 
)
static

Whether the segment is spanning a given time frame. Inclusive of segment start time; exclusive of segment end time.

Parameters
segmentto test
fromChainMicrosto test frame from
toChainMicrosto test frame to
Returns
true if segment is spanning time frame

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