Skip to content

GuitarPrometheus::SongStructure::Part

GuitarPrometheus::SongStructure::Part

One MusicXML part — one instrument with its own MIDI channel/program. More…

#include <SongStructure.h>

Public Functions

Name
Part(juce::Uuid id, std::string scorePartId, std::string name, std::string instrumentName, int midiChannel, int midiProgram, int midiBank, std::vector< Measure > measures, std::map< std::string, std::string > scoreInstruments ={}, std::map< std::string, int > instrumentMidiPitch ={}, std::vector< int > tuningMidiPitches ={})
Construct a Part with all fields explicit.
const juce::Uuid &getId() const
Auto-generated runtime identity.
const std::string &getScorePartId() const
MusicXML source value.
const std::string &getName() const
Human-readable part name from .
const std::string &getInstrumentName() const
Instrument label, if distinct from name.
intgetMidiChannel() const
MIDI channel for this part.
intgetMidiProgram() const
MIDI program (GM patch number).
intgetMidiBank() const
MIDI bank.
const std::vector< Measure > &getMeasures() const
All measures in this part, in score order.
const std::map< std::string, std::string > &getScoreInstruments() const
Map of MusicXML <score-instrument id> → its <instrument-name>.
const std::map< std::string, int > &getInstrumentMidiPitch() const
Map of MusicXML <score-instrument id> → GM percussion pitch from <midi-unpitched>.
boolisDrumPart() const
Quick check: does any note in this part carry an instrument-ref? (Heuristic for “drum part”.)
const std::vector< int > &getTuningMidiPitches() const
Sounding MIDI pitches per string in low-string-first order — index 0 is the lowest-pitched string.

Detailed Description

class GuitarPrometheus::SongStructure::Part;

One MusicXML part — one instrument with its own MIDI channel/program.

Identity is by juce::Uuid (auto-generated, stable across re-loads within a session); scorePartId preserves the source MusicXML id (“P1”, “P2”, …) for traceability and debugging.

Constructed once by the parser; immutable afterward.

Public Functions Documentation

function Part

Part(
juce::Uuid id,
std::string scorePartId,
std::string name,
std::string instrumentName,
int midiChannel,
int midiProgram,
int midiBank,
std::vector< Measure > measures,
std::map< std::string, std::string > scoreInstruments ={},
std::map< std::string, int > instrumentMidiPitch ={},
std::vector< int > tuningMidiPitches ={}
)

Construct a Part with all fields explicit.

Parameters:

  • id Auto-generated identity for this Part.
  • scorePartId Source MusicXML value.
  • name Human-readable part name (e.g. “Clean Guitar”).
  • instrumentName Instrument label, if distinct from the part name.
  • midiChannel MIDI channel from .
  • midiProgram MIDI program (GM patch number).
  • midiBank MIDI bank.
  • measures Parsed measures, in score order.
  • scoreInstruments Map of MusicXML <score-instrument id> to its <instrument-name>. Drum parts carry one entry per drum piece (e.g. “P5-I8” → “Kick (hit)”); pitched parts typically have zero or one entry.
  • instrumentMidiPitch Map of MusicXML <score-instrument id> to the GM percussion pitch declared in the matching <midi-instrument><midi-unpitched> element. Populated for drum kits so the injector can route drum notes to the correct GM pitch without a profile override.
  • tuningMidiPitches Sounding MIDI pitches per string in low-string-first order (index 0 = lowest-pitched string). Empty when the source format doesn’t carry tuning data. See [getTuningMidiPitches()](/api-reference/classes/classguitarprometheus_1_1songstructure_1_1part/#function-gettuningmidipitches) for the indexing convention and the guitarString lookup formula. Used by string-aware features (octave correction, fingering-aware MIDI emission) — manual offset remains the default.

function getId

const juce::Uuid & getId() const

Auto-generated runtime identity.

function getScorePartId

const std::string & getScorePartId() const

MusicXML source value.

function getName

const std::string & getName() const

Human-readable part name from .

function getInstrumentName

const std::string & getInstrumentName() const

Instrument label, if distinct from name.

function getMidiChannel

int getMidiChannel() const

MIDI channel for this part.

function getMidiProgram

int getMidiProgram() const

MIDI program (GM patch number).

function getMidiBank

int getMidiBank() const

MIDI bank.

function getMeasures

const std::vector< Measure > & getMeasures() const

All measures in this part, in score order.

function getScoreInstruments

const std::map< std::string, std::string > & getScoreInstruments() const

Map of MusicXML <score-instrument id> → its <instrument-name>.

Drum parts expose one entry per drum piece; pitched parts typically have zero or one entry.

function getInstrumentMidiPitch

const std::map< std::string, int > & getInstrumentMidiPitch() const

Map of MusicXML <score-instrument id> → GM percussion pitch from <midi-unpitched>.

The injector uses this as the default drum pitch when the active Profile’s drumMap has no override for the piece’s display name.

function isDrumPart

bool isDrumPart() const

Quick check: does any note in this part carry an instrument-ref? (Heuristic for “drum part”.)

function getTuningMidiPitches

const std::vector< int > & getTuningMidiPitches() const

Sounding MIDI pitches per string in low-string-first order — index 0 is the lowest-pitched string.

Standard six-string guitar in E-standard yields {40, 45, 50, 55, 59, 64} (low E to high E). Matches the raw order of GP’s <Property name="Tuning"><Pitches> list — no reordering during import — and MusicXML’s <staff-tuning line="N"> numbering (line 1 is the lowest string).

When looking up by Engraving::getGuitarString() (which is 1-based from the top, 1 = highest-pitched string): tuning[tuning.size() - guitarString].

Empty when the source format didn’t carry tuning data (MusicXML without <staff-tuning>, non-fretted parts).


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