Skip to content
Open
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
1 change: 1 addition & 0 deletions OpenUtau.Core/Util/Preferences.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ public class SerializablePreferences {
public bool DiffSingerTensorCache = true;
public bool DiffSingerLangCodeHide = false;
public bool SkipRenderingMutedTracks = false;
public bool UseSolidPlaybackLine = false;
public string Language = string.Empty;
public string? SortingOrder = null;
public List<string> RecentFiles = new List<string>();
Expand Down
7 changes: 7 additions & 0 deletions OpenUtau/Controls/PianoRoll.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,13 @@
Canvas.Left="{Binding NotesViewModel.PlayPosHighlightX, Mode=OneWay}"
Canvas.Top="0" ZIndex="-10"
Fill="{DynamicResource NeutralAccentBrushSemi2}"/>
<Rectangle Name="PlayPosHighlightSolid"
Width="{Binding NotesViewModel.PlayPosHighlightWidth, Mode=OneWay}"
Height="{Binding $parent.Bounds.Height, Mode=OneWay}"
Canvas.Left="{Binding NotesViewModel.PlayPosHighlightX, Mode=OneWay}"
Canvas.Top="0" ZIndex="-9" Opacity="0.5"
IsVisible="{Binding NotesViewModel.UseSolidPlaybackLine, Mode=OneWay}"
Fill="{DynamicResource NeutralAccentBrushSemi}"/>
<Rectangle Name="SelectionBox" StrokeThickness="2"
Stroke="{DynamicResource SystemControlForegroundBaseHighBrush}"
Fill="{DynamicResource TickLineBrushLow}" ZIndex="1000"
Expand Down
1 change: 1 addition & 0 deletions OpenUtau/Strings/Strings.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,7 @@ Warning: this option removes custom presets.</system:String>
<system:String x:Key="prefs.playback.lockstarttime.off">Do nothing</system:String>
<system:String x:Key="prefs.playback.lockstarttime.on">Move cursor and view position back to where you started playing</system:String>
<system:String x:Key="prefs.playback.lockstarttime.onlycursor">Move only cursor back to where you started playing</system:String>
<system:String x:Key="prefs.playback.solidline">Solid playback line</system:String>
<system:String x:Key="prefs.playback.test">Test</system:String>
<system:String x:Key="prefs.rendering">Rendering</system:String>
<system:String x:Key="prefs.rendering.defaultrenderer">Default renderer (for classic voicebanks)</system:String>
Expand Down
27 changes: 24 additions & 3 deletions OpenUtau/ViewModels/NotesViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public class NotesViewModel : ViewModelBase, ICmdSubscriber {
[Reactive] public double PlayPosHighlightX { get; set; }
[Reactive] public double PlayPosHighlightWidth { get; set; }
[Reactive] public bool PlayPosWaitingRendering { get; set; }
[Reactive] public bool UseSolidPlaybackLine { get; set; }
[Reactive] public bool CursorTool { get; set; }
[Reactive] public bool PenTool { get; set; }
[Reactive] public bool PenPlusTool { get; set; }
Expand Down Expand Up @@ -286,6 +287,14 @@ public NotesViewModel() {
Preferences.Default.ShowNoteParams = showNoteParams;
Preferences.Save();
});
UseSolidPlaybackLine = Preferences.Default.UseSolidPlaybackLine;
MessageBus.Current.Listen<PlaybackLineModeChangedEvent>()
.Subscribe(e => {
UseSolidPlaybackLine = e.UseSolidLine;
if (Part != null) {
SetPlayPos(DocManager.Inst.playPosTick, false);
}
});

TickWidth = ViewConstants.PianoRollTickWidthDefault;
TrackHeight = ViewConstants.NoteHeightDefault;
Expand Down Expand Up @@ -985,16 +994,28 @@ public void ClearPhraseCache() {
}
}

public class PlaybackLineModeChangedEvent {
public readonly bool UseSolidLine;
public PlaybackLineModeChangedEvent(bool useSolidLine) {
UseSolidLine = useSolidLine;
}
}

private void SetPlayPos(int tick, bool waitingRendering) {
PlayPosWaitingRendering = waitingRendering;
if (waitingRendering) {
return;
}
tick -= Part?.position ?? 0;
PlayPosX = TickToneToPoint(tick, 0).X;
TickToLineTick(tick, out int left, out int right);
PlayPosHighlightX = TickToneToPoint(left, 0).X;
PlayPosHighlightWidth = (right - left) * TickWidth;
if (UseSolidPlaybackLine) {
PlayPosHighlightX = PlayPosX - 1;
PlayPosHighlightWidth = 2;
} else {
TickToLineTick(tick, out int left, out int right);
PlayPosHighlightX = TickToneToPoint(left, 0).X;
PlayPosHighlightWidth = (right - left) * TickWidth;
}
}

private void FocusNote(UNote note) {
Expand Down
8 changes: 8 additions & 0 deletions OpenUtau/ViewModels/PreferencesViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public AudioOutputDevice? AudioOutputDevice {
[Reactive] public int LockStartTime { get; set; }
[Reactive] public int PlaybackAutoScroll { get; set; }
[Reactive] public double PlayPosMarkerMargin { get; set; }
[Reactive] public bool UseSolidPlaybackLine { get; set; }

// Paths
public string SingerPath => PathManager.Inst.SingersPath;
Expand Down Expand Up @@ -140,6 +141,7 @@ public PreferencesViewModel() {
PreferPortAudio = Preferences.Default.PreferPortAudio ? 1 : 0;
PlaybackAutoScroll = Preferences.Default.PlaybackAutoScroll;
PlayPosMarkerMargin = Preferences.Default.PlayPosMarkerMargin;
UseSolidPlaybackLine = Preferences.Default.UseSolidPlaybackLine;
LockStartTime = Preferences.Default.LockStartTime;
InstallToAdditionalSingersPath = Preferences.Default.InstallToAdditionalSingersPath;
LoadDeepFolders = Preferences.Default.LoadDeepFolderSinger;
Expand Down Expand Up @@ -220,6 +222,12 @@ public PreferencesViewModel() {
Preferences.Default.PlayPosMarkerMargin = playPosMarkerMargin;
Preferences.Save();
});
this.WhenAnyValue(vm => vm.UseSolidPlaybackLine)
.Subscribe(useSolidPlaybackLine => {
Preferences.Default.UseSolidPlaybackLine = useSolidPlaybackLine;
Preferences.Save();
MessageBus.Current.SendMessage(new NotesViewModel.PlaybackLineModeChangedEvent(useSolidPlaybackLine));
});
this.WhenAnyValue(vm => vm.LockStartTime)
.Subscribe(lockStartTime => {
Preferences.Default.LockStartTime = lockStartTime;
Expand Down
4 changes: 4 additions & 0 deletions OpenUtau/Views/PreferencesDialog.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@
<Slider Grid.Column="4" Classes="fader" Value="{Binding PlayPosMarkerMargin}" Minimum="0" Maximum="1"
TickPlacement="BottomRight" TickFrequency="0.1" IsSnapToTickEnabled="true"/>
</Grid>
<Grid Margin="0,10,0,0">
<TextBlock Text="{DynamicResource prefs.playback.solidline}" HorizontalAlignment="Left"/>
<ToggleSwitch IsChecked="{Binding UseSolidPlaybackLine}"/>
</Grid>
</StackPanel>

<!-- Paths -->
Expand Down
Loading