-
Notifications
You must be signed in to change notification settings - Fork 517
Expand file tree
/
Copy pathNotifications.cs
More file actions
259 lines (231 loc) · 9.17 KB
/
Copy pathNotifications.cs
File metadata and controls
259 lines (231 loc) · 9.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
using System;
using OpenUtau.Core.Ustx;
namespace OpenUtau.Core {
public class UNotification : UCommand {
public UProject project;
public UPart part;
public override void Execute() { }
public override void Unexecute() { }
public override string ToString() => "Notification";
}
public class ErrorMessageNotification : UNotification {
public readonly string message = string.Empty;
public readonly Exception e;
public ErrorMessageNotification(Exception e) {
this.e = e;
}
public ErrorMessageNotification(string message) {
this.message = message;
}
public ErrorMessageNotification(string message, Exception e) {
this.message = message;
this.e = e;
}
public override string ToString() {
if (e is MessageCustomizableException mce) {
if (string.IsNullOrWhiteSpace(mce.Message)) {
return $"Error message: {mce.SubstanceException.Message} {mce.SubstanceException}";
} else {
return $"Error message: {mce.Message} {mce.SubstanceException}";
}
} else {
return $"Error message: {message} {e}";
}
}
}
public class LoadingNotification : UNotification {
public readonly Type window;
public readonly bool startLoading;
public readonly string loadObject;
public LoadingNotification(Type window, bool startLoading, string loadObject) {
this.window = window;
this.startLoading = startLoading;
this.loadObject = loadObject;
}
public override string ToString() {
if (startLoading) {
return $"Start loading {loadObject}";
} else {
return $"Finish loading {loadObject}";
}
}
}
public class LoadPartNotification : UNotification {
public readonly int tick;
public LoadPartNotification(UPart part, UProject project, int tick) {
this.part = part;
this.project = project;
this.tick = tick;
}
public override string ToString() => "Load part";
}
public class LoadProjectNotification : UNotification {
public LoadProjectNotification(UProject project) {
this.project = project;
}
public override string ToString() => "Load project";
}
public class SaveProjectNotification : UNotification {
public string Path;
public SaveProjectNotification(string path) {
Path = path;
}
public override string ToString() => "Save project";
}
public class ValidateProjectNotification : UNotification {
public override string ToString() => "Validate Project";
}
public class PhonemizedNotification : UNotification {
public override string ToString() => "Phonemized";
}
public class SelectExpressionNotification : UNotification {
public string ExpKey;
public bool UpdateShadow;
public int SelectorIndex;
public SelectExpressionNotification(string expKey, int index, bool updateShadow) {
ExpKey = expKey;
SelectorIndex = index;
UpdateShadow = updateShadow;
}
public override string ToString() => $"Select expression {ExpKey}";
}
// Notification for UI to move PlayPosMarker
public class SetPlayPosTickNotification : UNotification {
public readonly int playPosTick;
public readonly bool waitingRendering;
public readonly bool pause;
public override bool Silent => true;
public SetPlayPosTickNotification(int tick, bool waitingRendering = false, bool pause = false) {
playPosTick = tick;
this.waitingRendering = waitingRendering;
this.pause = pause;
}
public override string ToString() => $"Set play position to tick {playPosTick}";
}
// Notification for playback manager to change play position
public class SeekPlayPosTickNotification : UNotification {
public int playPosTick;
public readonly bool pause;
public override bool Silent => true;
public SeekPlayPosTickNotification(int tick, bool pause = false) {
playPosTick = tick;
this.pause = pause;
}
public override string ToString() => $"Seek play position to tick {playPosTick}";
}
public class ProgressBarNotification : UNotification {
public double Progress;
public string Info;
public override bool Silent => true;
public ProgressBarNotification(double progress, string info) {
Progress = progress;
Info = info;
}
public override string ToString() => $"Set progress {Progress} {Info}";
}
public class VolumeChangeNotification : UNotification {
public double Volume;
public int TrackNo;
public override bool Silent => true;
public VolumeChangeNotification(int trackNo, double volume) {
TrackNo = trackNo;
Volume = volume;
}
public override string ToString() => $"Set track {TrackNo} volume to {Volume}";
}
public class PanChangeNotification : UNotification {
public double Pan;
public int TrackNo;
public override bool Silent => true;
public PanChangeNotification(int trackNo, double pan) {
TrackNo = trackNo;
Pan = pan;
}
public override string ToString() => $"Set track {TrackNo} panning to {Pan}";
}
public class SoloTrackNotification : UNotification {
public readonly int trackNo;
public readonly bool solo;
public SoloTrackNotification(int trackNo, bool solo) {
this.trackNo = trackNo;
this.solo = solo;
}
public override string ToString() => $"Solo track {solo}";
}
public class SingersChangedNotification : UNotification {
public SingersChangedNotification() { }
public override string ToString() => "Singers changed.";
}
public class SingersRefreshedNotification : UNotification {
public readonly USinger? singer;
public SingersRefreshedNotification() { }
public SingersRefreshedNotification(USinger singer) {
this.singer = singer;
}
public override string ToString() => "Singers refreshed.";
}
public class VoiceColorRemappingNotification : UNotification {
public int TrackNo;
public bool Validate;
/// <summary>
/// Remap when the singer's voice color changes. Or use when the user intentionally wants to remap.
/// </summary>
/// <param name="trackNo">Track number for remapping the singer. When -1, checks whether remapping is required for all tracks.</param>
/// <param name="validate">When verifying if the color lineup has changed, set to true; when forcing remapping even if no changes occur, set to false.</param>
public VoiceColorRemappingNotification(int trackNo, bool validate) {
TrackNo = trackNo;
Validate = validate;
}
public override string ToString() => "Voice color remapping.";
}
public class OtoChangedNotification : UNotification {
public readonly bool external;
public OtoChangedNotification(bool external = false) {
this.external = external;
}
public override string ToString() => "Oto changed.";
}
public class WillRemoveTrackNotification : UNotification {
public int TrackNo;
public WillRemoveTrackNotification(int trackNo) {
TrackNo = trackNo;
}
public override string ToString() => $"Will remove track {TrackNo}.";
}
public class FocusNoteNotification : UNotification {
public readonly UNote note;
public FocusNoteNotification(UPart part, UNote note) {
this.part = part;
this.note = note;
}
public override string ToString() => $"Focus note {note.lyric} at {note.position}.";
}
public class PreRenderNotification : UNotification {
public readonly int focusTick;
public PreRenderNotification(UPart part = null, int focusTick = -1) {
this.part = part;
this.focusTick = focusTick;
}
public override string ToString() => "Pre-render notification.";
}
public class PartRenderedNotification : UNotification {
public PartRenderedNotification(UVoicePart part) {
this.part = part;
}
public override string ToString() => "Part rendered.";
}
public class GotoOtoNotification : UNotification {
public readonly USinger? singer;
public readonly UOto? oto;
public GotoOtoNotification(USinger? singer, UOto? oto) {
this.singer = singer;
this.oto = oto;
}
public override string ToString() => "Goto oto.";
}
public class NotePresetChangedNotification : UNotification {
public NotePresetChangedNotification() {
}
public override string ToString() => "Note preset changed.";
}
}