protected override void OnRender(DrawingContext drawingContext) { int firstTrack = (int)(OffsetY / TrackHeight); int alt = firstTrack; double top = TrackHeight * firstTrack - OffsetY; while (top < _size.Height) { drawingContext.DrawRectangle( MusicMath.IsBlackKey(alt) ? ThemeManager.BlackKeyBrushNormal : MusicMath.IsCenterKey(alt) ? ThemeManager.CenterKeyBrushNormal : ThemeManager.WhiteKeyBrushNormal, null, new Rect(0, (int)top, _size.Width, TrackHeight)); if (TrackHeight >= 12) { FormattedText text = new FormattedText( MusicMath.GetNoteString(UIConstants.MaxNoteNum - alt - 1), System.Threading.Thread.CurrentThread.CurrentUICulture, FlowDirection.LeftToRight, SystemFonts.CaptionFontFamily.GetTypefaces().First(), 12, MusicMath.IsBlackKey(alt) ? ThemeManager.BlackKeyNameBrushNormal : MusicMath.IsCenterKey(alt) ? ThemeManager.CenterKeyNameBrushNormal : ThemeManager.WhiteKeyNameBrushNormal ); drawingContext.DrawText(text, new Point(42 - text.Width, (int)(top + (TrackHeight - text.Height) / 2))); } top += TrackHeight; alt++; } }
protected override void OnRender(DrawingContext drawingContext) { int note = UIConstants.MaxNoteNum - 1 - (int)(OffsetY / TrackHeight); double top = TrackHeight * (UIConstants.MaxNoteNum - note - 1) - OffsetY; while (top < _size.Height) { drawingContext.DrawRectangle( MusicMath.IsBlackKey(note) ? ThemeManager.BlackKeyBrushNormal : MusicMath.IsCenterKey(note) ? ThemeManager.CenterKeyBrushNormal : ThemeManager.WhiteKeyBrushNormal, null, new Rect(0, (int)top, _size.Width, TrackHeight)); if (TrackHeight >= 12) { FormattedText text = new FormattedText( MusicMath.GetNoteString(note), System.Threading.Thread.CurrentThread.CurrentUICulture, FlowDirection.LeftToRight, SystemFonts.CaptionFontFamily.GetTypefaces().First(), 12, MusicMath.IsBlackKey(note) ? ThemeManager.BlackKeyNameBrushNormal : MusicMath.IsCenterKey(note) ? ThemeManager.CenterKeyNameBrushNormal : ThemeManager.WhiteKeyNameBrushNormal, VisualTreeHelper.GetDpi(this).PixelsPerDip ); drawingContext.DrawText(text, new Point(42 - text.Width, (int)(top + (TrackHeight - text.Height) / 2))); } top += TrackHeight; note--; } }
public string GetResamplerExeArgs() { // fresamp.exe <infile> <outfile> <tone> <velocity> <flags> <offset> <length_req> // <fixed_length> <endblank> <volume> <modulation> <pitch> return(string.Format( "{0} {1:D} {2} {3} {4:D} {5} {6} {7:D} {8:D} {9} {10}", MusicMath.GetNoteString(NoteNum), Velocity, StrFlags, Oto.Offset, RequiredLength, Oto.Consonant, Oto.Cutoff, Volume, 0, Tempo, String.Join(",", PitchData))); }
public EngineInput ToEngineInput() { return(new EngineInput { inputWaveFile = SourceFile, NoteString = MusicMath.GetNoteString(NoteNum), Velocity = Velocity, StrFlags = StrFlags, Offset = Oto.Offset, RequiredLength = RequiredLength, Consonant = Oto.Consonant, Cutoff = Oto.Cutoff, Volume = Volume, Modulation = 0, pitchBend = PitchData.ToArray(), nPitchBend = PitchData.Count, Tempo = Tempo }); }
/// <summary> /// 从RenderItem初始化过程 /// </summary> /// <returns></returns> internal static EngineInput CreateInputModel(RenderItem renderItem, double Modulation) { EngineInput Ret = new EngineInput(); Ret.inputWaveFile = renderItem.RawFile; Ret.NoteString = MusicMath.GetNoteString(renderItem.NoteNum); Ret.Velocity = renderItem.Velocity; Ret.StrFlags = renderItem.StrFlags; Ret.Offset = renderItem.Oto.Offset; Ret.RequiredLength = renderItem.RequiredLength; Ret.Consonant = renderItem.Oto.Consonant; Ret.Cutoff = renderItem.Oto.Cutoff; Ret.Volume = renderItem.Volume; Ret.Modulation = Modulation; Ret.pitchBend = renderItem.PitchData.ToArray(); Ret.nPitchBend = renderItem.PitchData.Count; Ret.Tempo = renderItem.Tempo; return(Ret); }
/// <summary> /// 从RenderItem初始化过程 /// </summary> /// <returns></returns> internal static EngineInput CreateInputModel(RenderItem renderItem, double Modulation) { EngineInput Ret = new EngineInput { inputWaveFile = renderItem.SourceFile, NoteString = MusicMath.GetNoteString(renderItem.NoteNum), Velocity = renderItem.Velocity, StrFlags = renderItem.StrFlags, Offset = renderItem.Oto.Offset, RequiredLength = renderItem.RequiredLength, Consonant = renderItem.Oto.Consonant, Cutoff = renderItem.Oto.Cutoff, Volume = renderItem.Volume, Modulation = Modulation, pitchBend = renderItem.PitchData.ToArray(), nPitchBend = renderItem.PitchData.Count, Tempo = renderItem.Tempo }; return(Ret); }
public string GetResamplerExeArgs() { // fresamp.exe <infile> <outfile> <tone> <velocity> <flags> <offset> <length_req> // <fixed_length> <endblank> <volume> <modulation> <pitch> return(FormattableString.Invariant($"{MusicMath.GetNoteString(NoteNum)} {Velocity:D} \"{StrFlags}\" {Oto.Offset} {RequiredLength:D} {Oto.Consonant} {Oto.Cutoff} {Volume:D} {Modulation:D} {Tempo} {Base64.Base64EncodeInt12(PitchData.ToArray())}")); }
public string GetResamplerExeArgs() { // fresamp.exe <infile> <outfile> <tone> <velocity> <flags> <offset> <length_req> // <fixed_length> <endblank> <volume> <modulation> <pitch> return($"{MusicMath.GetNoteString(NoteNum)} {Velocity:D} {StrFlags} {Oto.Offset} {RequiredLength:D} {Oto.Consonant} {Oto.Cutoff} {Volume:D} {0:D} {Tempo} {string.Join(",", PitchData)}"); }