GuitarPrometheus::Parser::ScoreBuilder
GuitarPrometheus::Parser::ScoreBuilder
Finalises a parser-built [IntermediateScore](/api-reference/classes/structguitarprometheus_1_1parser_1_1intermediatescore/) into an immutable [SongStructure::Score](). More…
#include <ScoreBuilder.h>
Public Functions
| Name | |
|---|---|
| SongStructure::Score | build(IntermediateScore ir) Build the final immutable Score. |
| Techniques::Technique | resolveHopoDirection(Techniques::Technique declared, int startPitchSemitones, int endPitchSemitones) Resolve a HammerOn/PullOff direction from declared technique plus source pitches. |
Detailed Description
class GuitarPrometheus::Parser::ScoreBuilder;Finalises a parser-built [IntermediateScore](/api-reference/classes/structguitarprometheus_1_1parser_1_1intermediatescore/) into an immutable [SongStructure::Score]().
Shared between every concrete-format importer (MusicXML, GP7/8, GP6) so the format-specific code only has to handle walking its own grammar — the final assembly (Uuid generation, cached-scalar derivation, immutable construction) lives here.
Public Functions Documentation
function build
static SongStructure::Score build( IntermediateScore ir)Build the final immutable Score.
Parameters:
- ir Parser-built intermediate state. Moved-from after this call.
Return: The finalised immutable Score.
Performs the following steps:
- For each
[IntermediatePart](/api-reference/classes/structguitarprometheus_1_1parser_1_1intermediatepart/), mints a freshjuce::Uuidand constructs the immutable Part. - Derives
initialTempoBpmandcurrentScoreTempoBpmfrom thetempoChangestimeline (first / last entries). Falls back to[IntermediateScore::fallbackTempoBpm](/api-reference/classes/structguitarprometheus_1_1parser_1_1intermediatescore/#variable-fallbacktempobpm)when the timeline is empty. - Constructs and returns the final
Score.
The ir argument is consumed (move-from) — pass std::move(ir) to avoid the copy.
function resolveHopoDirection
static Techniques::Technique resolveHopoDirection( Techniques::Technique declared, int startPitchSemitones, int endPitchSemitones)Resolve a HammerOn/PullOff direction from declared technique plus source pitches.
Parameters:
- declared The technique as named in the source format.
- startPitchSemitones MIDI pitch of the span’s first note (chromatic semitones from C-1 = 0). Use 0 for rest sources — degenerate spans on rests pass through unchanged.
- endPitchSemitones MIDI pitch of the span’s last note.
Return: The resolved technique: PullOff iff declared was HammerOn and the destination sits below the source; otherwise declared unchanged.
MusicXML emits both legato directions as <hammer-on> regardless of the actual pitch direction; Guitar Pro’s HopoOrigin property is the same. This helper reclassifies a declared HammerOn to PullOff when the destination pitch is strictly lower than the source, matching the convention captured in guitar-prometheus/documentation/development/techniques.md. Any other declared technique is returned unchanged.
Updated on 2026-05-29 at 07:39:52 +0000