Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 6 additions & 1 deletion OpenUtau.Core/Classic/ClassicSinger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
using WanaKanaNet;

namespace OpenUtau.Classic {
public class ClassicSinger : USinger {
public class ClassicSinger : USinger, IDisposable {
public override string Id => voicebank.Id;
public override string Name => voicebank.Name;
public override Dictionary<string, string> LocalizedNames => voicebank.LocalizedNames;
Expand Down Expand Up @@ -160,6 +160,11 @@ public override void Save() {
otoWatcher.Paused = false;
}
}

public void Dispose() {
otoWatcher?.Dispose();
otoWatcher = null;
}

public override bool TryGetOto(string phoneme, out UOto oto) {
if (otoMap.TryGetValue(phoneme, out oto)) {
Expand Down
4 changes: 4 additions & 0 deletions OpenUtau.Core/SingerManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public void SearchAllSingers() {
Log.Information("Searching singers.");
Directory.CreateDirectory(PathManager.Inst.SingersPath);
var stopWatch = Stopwatch.StartNew();
var oldSingers = Singers.Values.ToList();
var singers = ClassicSingerLoader.FindAllSingers()
.Concat(Vogen.VogenSingerLoader.FindAllSingers())
.Distinct();
Expand All @@ -38,6 +39,9 @@ public void SearchAllSingers() {
SingerGroups = singers
.GroupBy(s => s.SingerType)
.ToDictionary(s => s.Key, s => s.LocalizedOrderBy(singer => singer.LocalizedName).ToList());
foreach (var old in oldSingers) {
(old as IDisposable)?.Dispose();
}
stopWatch.Stop();
Log.Information($"Search all singers: {stopWatch.Elapsed}");
}
Expand Down
1 change: 1 addition & 0 deletions OpenUtau/ViewModels/TrackHeaderViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@ public void RefreshRenderers() {

public void RefreshAvatar() {
var singer = track?.Singer;
Avatar?.Dispose();
if (singer == null || singer.AvatarData == null) {
Avatar = new RenderTargetBitmap(new PixelSize(1, 1));
return;
Expand Down
Loading