Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MU4] playback_integration #10701

Merged
merged 28 commits into from
Mar 2, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
0f723dd
Fixed missing wind instruments setup data
vpereverzev Mar 1, 2022
a5db429
Introduced InstrumentTrackId type
vpereverzev Mar 1, 2022
c9cc3b3
Added support for ChordLine articulations
vpereverzev Mar 1, 2022
08e55a5
Added processing for fermata elements
vpereverzev Mar 1, 2022
59461d5
Added processing for hairpins
vpereverzev Mar 1, 2022
d1c1854
Fixed an issue with tempo recalculations
vpereverzev Mar 1, 2022
2df3ed5
Extended supported playing techniques with Distortion and Overdrive
vpereverzev Mar 1, 2022
74110d0
Added missing SymId for symbols meta parser
vpereverzev Mar 1, 2022
720f3c1
Added playback setup data for Metronome
vpereverzev Mar 1, 2022
ffeaecd
Fixed an issue with wrong pitch range calculations for Glissando
vpereverzev Mar 1, 2022
96b5d06
Fixed an issue with tied notes playback
vpereverzev Mar 1, 2022
8365cbb
Fixed an issue with the loading of PlaybackModel considering expand r…
vpereverzev Mar 1, 2022
187ec99
Actualized playback model unit tests
vpereverzev Mar 1, 2022
c74263f
Implemented AbstractSynthesizer as a base implementation for Fluid, V…
vpereverzev Mar 1, 2022
e4ee5f7
Reworked fluid synthesizer wrapper
vpereverzev Mar 1, 2022
d88cf92
Reworked VST synthesizer wrapper
vpereverzev Mar 1, 2022
3465d83
Integrated EventAudioSource into audio-engine
vpereverzev Mar 1, 2022
5aa66d8
Added convenient method for SharedHashMap container
vpereverzev Mar 1, 2022
74780b9
Added missing articulations in MPE definitions
vpereverzev Mar 1, 2022
1daff96
Replaced MasterNotationMidiData with NotationPlayback
vpereverzev Mar 1, 2022
a86673c
Prevent undo-stack notifications without any valid updates
vpereverzev Mar 1, 2022
9bcf979
Added notification for PlayRepeats setting
vpereverzev Mar 1, 2022
966736f
Actualized PlaybackController with the usage of INotationPlayback
vpereverzev Mar 1, 2022
c1e183c
Fixed an issue with Metronome audio params updates
vpereverzev Mar 1, 2022
5486197
Got rid of unnecessary assert
vpereverzev Mar 1, 2022
348b7db
Added switch for Limiter and Compressor
vpereverzev Mar 1, 2022
f6ae8b0
Changed default duration for off-stream playback
vpereverzev Mar 1, 2022
c2cdb78
Fixed a couple of crashes
vpereverzev Mar 2, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fixed a couple of crashes
  • Loading branch information
vpereverzev committed Mar 2, 2022
commit c2cdb78f35e6c258f365d0013fa3518890cee17d
4 changes: 4 additions & 0 deletions src/context/internal/globalcontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ Notification GlobalContext::currentMasterNotationChanged() const

void GlobalContext::setCurrentNotation(const INotationPtr& notation)
{
if (m_currentNotation == notation) {
return;
}

doSetCurrentNotation(notation);
m_currentNotationChanged.notify();
}
Expand Down
5 changes: 5 additions & 0 deletions src/engraving/libmscore/score.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1843,6 +1843,11 @@ Measure* Score::crMeasure(int idx) const
Measure* Score::lastMeasure() const
{
MeasureBase* mb = _measures.last();

if (!mb) {
return nullptr;
}

while (mb && mb->type() != ElementType::MEASURE) {
mb = mb->prev();
}
Expand Down
4 changes: 2 additions & 2 deletions src/engraving/playback/playbackcontext.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct PlaybackContext {
mpe::dynamic_level_t nominalDynamicLevel(const int nominalPositionTick) const
{
if (m_dynamicsMap.size() == 1) {
return m_dynamicsMap.at(0);
return m_dynamicsMap.begin()->second;
}

auto it = m_dynamicsMap.lower_bound(nominalPositionTick);
Expand All @@ -53,7 +53,7 @@ struct PlaybackContext {
mpe::ArticulationType persistentArticulationType(const int nominalPositionTick) const
{
if (m_playTechniquesMap.size() == 1) {
return m_playTechniquesMap.at(0);
return m_playTechniquesMap.begin()->second;
}

auto it = m_playTechniquesMap.lower_bound(nominalPositionTick);
Expand Down
11 changes: 10 additions & 1 deletion src/engraving/playback/playbackmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const InstrumentTrackId PlaybackModel::METRONOME_TRACK_ID = { 999, METRONOME_INS

void PlaybackModel::load(Ms::Score* score, async::Channel<int, int, int, int> notationChangesRangeChannel)
{
if (!score || score->measures()->empty()) {
if (!score || score->measures()->empty() || !score->lastMeasure()) {
return;
}

Expand Down Expand Up @@ -164,6 +164,11 @@ void PlaybackModel::updateSetupData()
for (const Ms::Part* part : m_score->parts()) {
for (const auto& pair : *part->instruments()) {
InstrumentTrackId trackId = idKey(part->id(), pair.second->id().toStdString());

if (!trackId.isValid()) {
continue;
}

m_setupResolver.resolveSetupData(pair.second, m_playbackDataMap[std::move(trackId)].setupData);
}
}
Expand Down Expand Up @@ -211,6 +216,10 @@ void PlaybackModel::updateEvents(const int tickFrom, const int tickTo, const int

InstrumentTrackId trackId = idKey(item);

if (!trackId.isValid()) {
continue;
}

PlaybackContext& ctx = m_playbackCtxMap[trackId];
ctx.update(segment, segmentPositionTick);

Expand Down
5 changes: 5 additions & 0 deletions src/engraving/types/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,11 @@ struct InstrumentTrackId {

return instrumentId < other.instrumentId;
}

bool isValid() const
{
return partId.isValid() && !instrumentId.empty();
}
};

using InstrumentTrackIdSet = std::unordered_set<InstrumentTrackId>;
Expand Down
5 changes: 5 additions & 0 deletions src/playback/internal/playbackcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,11 @@ void PlaybackController::addTrack(const InstrumentTrackId& instrumentTrackId, co
IF_ASSERT_FAILED(notationPlayback() && playback()) {
return;
}

if (!instrumentTrackId.isValid()) {
return;
}

AudioInputParams inParams = audioSettings()->trackInputParams(instrumentTrackId);
AudioOutputParams outParams = trackOutputParams(instrumentTrackId);
mpe::PlaybackData playbackData = notationPlayback()->trackPlaybackData(instrumentTrackId);
Expand Down