Skip to content

Commit 5b5c614

Browse files
Merge pull request #45 from oxygen-dioxide/insider
Insider
2 parents eea982e + e75fc6e commit 5b5c614

36 files changed

+738
-193
lines changed

OpenUtau.Core/Classic/UstNote.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public UstNote(UProject project, UTrack track, UVoicePart part, UNote note) {
3737
intensity = (int)phoneme.GetExpression(project, track, Ustx.VOL).Item1;
3838
modulation = (int)phoneme.GetExpression(project, track, Ustx.MOD).Item1;
3939
flags = FlagsToString(phoneme.GetResamplerFlags(project, track));
40-
if (phoneme.oto != null) {
40+
if (phoneme.oto != null && phoneme.oto.File != null) {
4141
var relativePath = Path.GetRelativePath(track.Singer.Location, phoneme.oto.File);
4242
filename = relativePath;
4343
alias = phoneme.oto.Alias;

OpenUtau.Core/Commands/TrackCommands.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,19 @@ public RenameTrackCommand(UProject project, UTrack track, string name) {
100100
public override void Unexecute() => track.TrackName = oldName;
101101
}
102102

103+
public class ChangeTrackColorCommand : TrackCommand {
104+
readonly string newName, oldName;
105+
public ChangeTrackColorCommand(UProject project, UTrack track, string colorName) {
106+
this.project = project;
107+
this.track = track;
108+
newName = colorName;
109+
oldName = track.TrackColor;
110+
}
111+
public override string ToString() => "Change track color";
112+
public override void Execute() => track.TrackColor = newName;
113+
public override void Unexecute() => track.TrackColor = oldName;
114+
}
115+
103116
public class TrackChangeSingerCommand : TrackCommand {
104117
readonly USinger newSinger, oldSinger;
105118
public TrackChangeSingerCommand(UProject project, UTrack track, USinger newSinger) {

OpenUtau.Core/Enunu/EnunuEnglishPhonemizer.cs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
using TinyPinyin;
1313

1414
namespace OpenUtau.Core.Enunu {
15-
[Phonemizer("Enunu English Phonemizer", "ENUNU EN", language:"EN")]
15+
[Phonemizer("Enunu English Phonemizer", "ENUNU EN", "O3", language:"EN")]
1616
public class EnunuEnglishPhonemizer : EnunuPhonemizer {
1717
readonly string PhonemizerType = "ENUNU EN";
1818

@@ -104,14 +104,14 @@ protected EnunuNote[] ProcessWord(Note[] notes, int noteIndex) {
104104
// - Tries to align every note to one syllable.
105105
// - "+n" manually aligns to n-th phoneme.
106106
alignments.Clear();
107-
int position = 0;
107+
//notes except those whose lyrics start witn "+*" or "+~"
108+
var nonExtensionNotes = notes.Where(n=>!IsSyllableVowelExtensionNote(n)).ToArray();
108109
for (int i = 0; i < symbols.Length; i++) {
109-
if (isVowel[i] && alignments.Count < notes.Length) {
110-
alignments.Add(Tuple.Create(i, position, false));
111-
position += notes[alignments.Count - 1].duration;
110+
if (isVowel[i] && alignments.Count < nonExtensionNotes.Length) {
111+
alignments.Add(Tuple.Create(i, nonExtensionNotes[alignments.Count].position - notes[0].position, false));
112112
}
113113
}
114-
position = notes[0].duration;
114+
int position = notes[0].duration;
115115
for (int i = 1; i < notes.Length; ++i) {
116116
if (int.TryParse(notes[i].lyric.Substring(1), out var idx)) {
117117
alignments.Add(Tuple.Create(idx - 1, position, true));
@@ -164,6 +164,15 @@ protected EnunuNote[] ProcessWord(Note[] notes, int noteIndex) {
164164
return enunuNotes.ToArray();
165165
}
166166

167+
/// <summary>
168+
/// Does this note extend the previous syllable?
169+
/// </summary>
170+
/// <param name="note"></param>
171+
/// <returns></returns>
172+
protected bool IsSyllableVowelExtensionNote(Note note) {
173+
return note.lyric.StartsWith("+~") || note.lyric.StartsWith("+*");
174+
}
175+
167176
protected override EnunuNote[] NoteGroupsToEnunu(Note[][] notes) {
168177
var result = new List<EnunuNote>();
169178
int position = 0;

OpenUtau.Core/PlaybackManager.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ private PlaybackManager() {
6262
public Audio.IAudioOutput AudioOutput { get; set; } = new Audio.DummyAudioOutput();
6363
public bool Playing => AudioOutput.PlaybackState == PlaybackState.Playing;
6464
public bool StartingToPlay { get; private set; }
65-
public bool SoloTrackExist { get; set; } = false;
6665

6766
public void PlayTestSound() {
6867
masterMix = null;

OpenUtau.Core/Ustx/UProject.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public class UProject {
4949
public List<UTempo> tempos;
5050
public List<UTrack> tracks;
5151
[YamlIgnore] public List<UPart> parts;
52+
public bool SoloTrackExist { get => tracks.Any(t => t.Solo); }
5253

5354
/// <summary>
5455
/// Transient field used for serialization.

OpenUtau.Core/Ustx/UTrack.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ public USinger Singer {
8888
[YamlIgnore] public string SingerName => Singer != null ? Singer.DisplayName : "[No Singer]";
8989
[YamlIgnore] public int TrackNo { set; get; }
9090
public string TrackName { get; set; } = "New Track";
91+
public string TrackColor { get; set; } = "Blue";
9192
[YamlIgnore] public bool Muted { set; get; }
9293
public bool Mute { get; set; }
9394
public bool Solo { get; set; }
@@ -179,9 +180,7 @@ public void AfterLoad(UProject project) {
179180
};
180181
}
181182
TrackNo = project.tracks.IndexOf(this);
182-
if (Solo) {
183-
PlaybackManager.Inst.SoloTrackExist = true;
184-
} else if (Mute) {
183+
if (!Solo && Mute) {
185184
Muted = true;
186185
}
187186
}

OpenUtau.Core/Util/Preferences.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ public class SerializablePreferences {
112112
public bool ShowPrefs = true;
113113
public bool ShowTips = true;
114114
public int Theme;
115+
public bool UseTrackColor = false;
115116
public bool PreRender = true;
116117
public int NumRenderThreads = 2;
117118
public string OnnxRunner = string.Empty;

OpenUtau.Plugin.Builtin/JapaneseCVVCPhonemizer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public class JapaneseCVVCPhonemizer : Phonemizer {
6767

6868
// in case voicebank is missing certain symbols
6969
static readonly string[] substitution = new string[] {
70-
"ty,ch,ts=t", "j,dy=d", "gy=g", "ky=k", "py=p", "ny=n", "ry=r", "hy,f=h", "by,v=b", "dz=z", "l=r", "ly=l"
70+
"ty,ch,ts=t", "j,dy=d", "gy=g", "ky=k", "py=p", "ny=n", "ry=r", "my=m", "hy,f=h", "by,v=b", "dz=z", "l=r", "ly=l"
7171
};
7272

7373
static readonly Dictionary<string, string> vowelLookup;

OpenUtau.Plugin.Builtin/JapanesePresampPhonemizer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class JapanesePresampPhonemizer : Phonemizer {
2121

2222
// in case voicebank is missing certain symbols
2323
static readonly string[] substitution = new string[] {
24-
"ty,ch,ts=t", "j,dy=d", "gy=g", "ky=k", "py=p", "ny=n", "ry=r", "hy,f=h", "by,v=b", "dz=z", "l=r", "ly=l"
24+
"ty,ch,ts=t", "j,dy=d", "gy=g", "ky=k", "py=p", "ny=n", "ry=r", "my=m", "hy,f=h", "by,v=b", "dz=z", "l=r", "ly=l"
2525
};
2626

2727
static readonly Dictionary<string, string> substituteLookup;

OpenUtau.Plugin.Builtin/LatinDiphonePhonemizer.cs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public abstract class LatinDiphonePhonemizer : Phonemizer {
1616
protected IG2p g2p;
1717
protected bool isDictionaryLoading;
1818

19+
//[(index of phoneme, tick position from the lyrical note in notes[], is manual)]
1920
protected readonly List<Tuple<int, int, bool>> alignments = new List<Tuple<int, int, bool>>();
2021

2122
/// <summary>
@@ -89,14 +90,14 @@ public override Result Process(Note[] notes, Note? prev, Note? next, Note? prevN
8990
// - Tries to align every note to one syllable.
9091
// - "+n" manually aligns to n-th phoneme.
9192
alignments.Clear();
92-
int position = 0;
93+
//notes except those whose lyrics start witn "+*" or "+~"
94+
var nonExtensionNotes = notes.Where(n=>!IsSyllableVowelExtensionNote(n)).ToArray();
9395
for (int i = 0; i < symbols.Length; i++) {
94-
if (isVowel[i] && alignments.Count < notes.Length) {
95-
alignments.Add(Tuple.Create(i, position, false));
96-
position += notes[alignments.Count - 1].duration;
96+
if (isVowel[i] && alignments.Count < nonExtensionNotes.Length) {
97+
alignments.Add(Tuple.Create(i, nonExtensionNotes[alignments.Count].position - notes[0].position, false));
9798
}
9899
}
99-
position = notes[0].duration;
100+
int position = notes[0].duration;
100101
for (int i = 1; i < notes.Length; ++i) {
101102
if (int.TryParse(notes[i].lyric.Substring(1), out var idx)) {
102103
alignments.Add(Tuple.Create(idx - 1, position, true));
@@ -154,6 +155,15 @@ public override Result Process(Note[] notes, Note? prev, Note? next, Note? prevN
154155
};
155156
}
156157

158+
/// <summary>
159+
/// Does this note extend the previous syllable?
160+
/// </summary>
161+
/// <param name="note"></param>
162+
/// <returns></returns>
163+
protected bool IsSyllableVowelExtensionNote(Note note) {
164+
return note.lyric.StartsWith("+~") || note.lyric.StartsWith("+*");
165+
}
166+
157167
string[] GetSymbols(Note note) {
158168
if (string.IsNullOrEmpty(note.phoneticHint)) {
159169
// User has not provided hint, query CMUdict.

0 commit comments

Comments
 (0)