Skip to content

GuitarPrometheus::SongStructure::Score

GuitarPrometheus::SongStructure::Score

The complete parsed score: initial time/key/tempo, divisions (ticks per quarter note), plus a list of parts. More…

#include <SongStructure.h>

Public Types

Name
using std::pair< int, int >TempoChangeKey
Tempo-change identifier: (measureNumber, tickWithinMeasure).

Public Functions

Name
Score(int divisions, std::map< TempoChangeKey, int > tempoChanges, int initialTempoBpm, int currentScoreTempoBpm, MusicModels::TimeSignature initialTimeSignature, MusicModels::KeySignature initialKeySignature, std::vector< Part > parts)
Construct a Score with all fields explicit.
intgetDivisions() const
Ticks per quarter note (from MusicXML <divisions>).
const std::map< TempoChangeKey, int > &getTempoChanges() const
Sparse map of (measureNumber, tickWithinMeasure) → BPM, one entry per tempo change.
intgetInitialTempoBpm() const
Initial tempo at the start of the score.
intgetCurrentScoreTempoBpm() const
Most-recent tempo value in the score (last entry in tempoByMeasure).
const MusicModels::TimeSignature &getInitialTimeSignature() const
Initial time signature at the start of the score.
const MusicModels::KeySignature &getInitialKeySignature() const
Initial key signature at the start of the score.
const std::vector< Part > &getParts() const
All parts in the score, in source order.

Detailed Description

class GuitarPrometheus::SongStructure::Score;

The complete parsed score: initial time/key/tempo, divisions (ticks per quarter note), plus a list of parts.

Immutable after construction. Multi-file merging is a future feature (Phase 9) handled by a separate ScoreMerger utility, not by mutating [Score](/api-reference/classes/classguitarprometheus_1_1songstructure_1_1score/).

Public Types Documentation

using TempoChangeKey

using GuitarPrometheus::SongStructure::Score::TempoChangeKey = std::pair<int, int>;

Tempo-change identifier: (measureNumber, tickWithinMeasure).

Allows mid-measure tempo changes, which <sound tempo="X"/> directions placed between notes produce in MusicXML.

Public Functions Documentation

function Score

Score(
int divisions,
std::map< TempoChangeKey, int > tempoChanges,
int initialTempoBpm,
int currentScoreTempoBpm,
MusicModels::TimeSignature initialTimeSignature,
MusicModels::KeySignature initialKeySignature,
std::vector< Part > parts
)

Construct a Score with all fields explicit.

Parameters:

  • divisions Ticks per quarter note (from MusicXML <divisions>).
  • tempoChanges Sparse map of (measure, tickWithinMeasure) → BPM. Every entry represents a score-level tempo change. The first parsed measure always has a (measure, 0) entry (the initial tempo); subsequent entries land at the tick where each <sound tempo> direction was placed in source.
  • initialTempoBpm Cached first value inserted into tempoChanges. Must match tempoChanges.begin()->second.
  • currentScoreTempoBpm Cached most-recent value inserted into tempoChanges. Must match tempoChanges.rbegin()->second.
  • initialTimeSignature Time signature at the start of the score.
  • initialKeySignature Key signature at the start of the score.
  • parts The parts, in MusicXML order.

function getDivisions

int getDivisions() const

Ticks per quarter note (from MusicXML <divisions>).

function getTempoChanges

const std::map< TempoChangeKey, int > & getTempoChanges() const

Sparse map of (measureNumber, tickWithinMeasure) → BPM, one entry per tempo change.

The first entry is the initial tempo; subsequent entries reflect score-level tempo changes (including mid-measure ones). Pipeline stages (e.g. the MIDI writer emitting tempo meta events) walk this map.

function getInitialTempoBpm

int getInitialTempoBpm() const

Initial tempo at the start of the score.

Cached — O(1), no map lookup.

function getCurrentScoreTempoBpm

int getCurrentScoreTempoBpm() const

Most-recent tempo value in the score (last entry in tempoByMeasure).

Cached — O(1), no map iteration. Equal to [getInitialTempoBpm()](/api-reference/classes/classguitarprometheus_1_1songstructure_1_1score/#function-getinitialtempobpm) when the score has a single tempo throughout.

function getInitialTimeSignature

const MusicModels::TimeSignature & getInitialTimeSignature() const

Initial time signature at the start of the score.

function getInitialKeySignature

const MusicModels::KeySignature & getInitialKeySignature() const

Initial key signature at the start of the score.

function getParts

const std::vector< Part > & getParts() const

All parts in the score, in source order.


Updated on 2026-05-29 at 07:39:52 +0000