Skip to content

Commit

Permalink
修复part属性修改时不触发重渲染的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
LiuYunPlayer committed Jun 10, 2024
1 parent 65aa4c0 commit 9304f98
Showing 1 changed file with 11 additions and 18 deletions.
29 changes: 11 additions & 18 deletions TuneLab/Data/MidiPart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -744,15 +744,16 @@ public SynthesisPiece(MidiPart part, SynthesisSegment<INote> segment)
};
mTask.Error += (error) => { mLastError = error; SynthesisStatus = SynthesisStatus.SynthesisFailed; Complete?.Invoke(); };
mTask.Progress += (progress) => { mSynthesisProgress = progress; Progress?.Invoke(); };
part.Properties.Modified.Subscribe(SetDirtyAndResegment, s);
foreach (var note in Notes)
{
note.Pos.Modified.Subscribe(SetDirtyAndResegment);
note.Dur.Modified.Subscribe(SetDirtyAndResegment);
note.Pitch.Modified.Subscribe(SetDirtyAndResegment);
note.Lyric.Modified.Subscribe(SetDirtyAndResegment);
note.Pronunciation.Modified.Subscribe(SetDirtyAndResegment);
note.Properties.PropertyModified.Subscribe(OnNotePropertyModified);
note.Phonemes.Modified.Subscribe(OnPhonemeChanged);
note.Pos.Modified.Subscribe(SetDirtyAndResegment, s);
note.Dur.Modified.Subscribe(SetDirtyAndResegment, s);
note.Pitch.Modified.Subscribe(SetDirtyAndResegment, s);
note.Lyric.Modified.Subscribe(SetDirtyAndResegment, s);
note.Pronunciation.Modified.Subscribe(SetDirtyAndResegment, s);
note.Properties.PropertyModified.Subscribe(OnNotePropertyModified, s);
note.Phonemes.Modified.Subscribe(OnPhonemeChanged, s);
}
}

Expand Down Expand Up @@ -781,17 +782,7 @@ public void SetDirty(string dirtyType)

public void Dispose()
{
foreach (var note in Notes)
{
note.SynthesizedPhonemes = null;
note.Pos.Modified.Unsubscribe(SetDirtyAndResegment);
note.Dur.Modified.Unsubscribe(SetDirtyAndResegment);
note.Pitch.Modified.Unsubscribe(SetDirtyAndResegment);
note.Lyric.Modified.Unsubscribe(SetDirtyAndResegment);
note.Pronunciation.Modified.Unsubscribe(SetDirtyAndResegment);
note.Properties.PropertyModified.Unsubscribe(OnNotePropertyModified);
note.Phonemes.Modified.Unsubscribe(OnPhonemeChanged);
}
s.DisposeAll();

if (SynthesisStatus == SynthesisStatus.Synthesizing)
mTask.Stop();
Expand Down Expand Up @@ -840,6 +831,8 @@ bool ISynthesisData.GetAutomation(string automationID, [MaybeNullWhen(false)][No
Waveform? mWaveform = null;
double mSynthesisProgress = 0;
string? mLastError = null;

DisposableManager s = new();
}

List<SynthesisPiece> mSynthesisPieces = new();
Expand Down

0 comments on commit 9304f98

Please sign in to comment.