Skip to content

Commit

Permalink
added asserts
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanPudashkin committed Feb 24, 2025
1 parent b0b69d6 commit b6b5812
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
7 changes: 5 additions & 2 deletions src/engraving/dom/harmony.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1073,9 +1073,12 @@ const ChordDescription* Harmony::getDescription(const String& name, const Parsed

const RealizedHarmony& Harmony::getRealizedHarmony() const
{
Fraction tick = this->tick();
const Staff* st = staff();
IF_ASSERT_FAILED(st) {
return m_realizedHarmony;
}

const Fraction tick = this->tick();
const CapoParams& capo = st->capo(tick);

int offset = 0;
Expand All @@ -1091,7 +1094,7 @@ const RealizedHarmony& Harmony::getRealizedHarmony() const
//Adjust for Nashville Notation, might be temporary
// TODO: set dirty on add/remove of keysig
if (m_harmonyType == HarmonyType::NASHVILLE && !m_realizedHarmony.valid()) {
Key key = staff()->key(tick);
Key key = st->key(tick);

//parse root
int rootTpc = function2Tpc(m_function, key);
Expand Down
15 changes: 12 additions & 3 deletions src/engraving/playback/playbackeventsrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ void PlaybackEventsRenderer::renderChordSymbol(const Harmony* chordSymbol,
return;
}

const Staff* staff = chordSymbol->staff();
IF_ASSERT_FAILED(staff) {
return;
}

const RealizedHarmony& realized = chordSymbol->getRealizedHarmony();
const RealizedHarmony::PitchMap& notes = realized.notes();

Expand All @@ -130,7 +135,7 @@ void PlaybackEventsRenderer::renderChordSymbol(const Harmony* chordSymbol,

voice_layer_idx_t voiceIdx = static_cast<voice_layer_idx_t>(chordSymbol->voice());
staff_layer_idx_t staffIdx = static_cast<staff_layer_idx_t>(chordSymbol->staffIdx());
Key key = chordSymbol->staff()->key(chordSymbol->tick());
Key key = staff->key(chordSymbol->tick());

ArticulationMap articulations = makeStandardArticulationMap(profile, eventTimestamp, duration);

Expand Down Expand Up @@ -161,15 +166,19 @@ void PlaybackEventsRenderer::renderChordSymbol(const Harmony* chordSymbol, const
return;
}

const Staff* staff = chordSymbol->staff();
IF_ASSERT_FAILED(staff) {
return;
}

const RealizedHarmony& realized = chordSymbol->getRealizedHarmony();
const RealizedHarmony::PitchMap& notes = realized.notes();

PlaybackEventList& events = result[actualTimestamp];

voice_layer_idx_t voiceIdx = static_cast<voice_layer_idx_t>(chordSymbol->voice());
staff_layer_idx_t staffIdx = static_cast<staff_layer_idx_t>(chordSymbol->staffIdx());

Key key = chordSymbol->staff()->key(chordSymbol->tick());
Key key = staff->key(chordSymbol->tick());

ArticulationMap articulations = makeStandardArticulationMap(profile, actualTimestamp, actualDuration);

Expand Down

0 comments on commit b6b5812

Please sign in to comment.