Skip to content

Commit

Permalink
Clean-up some code and update readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
andy840119 committed Jul 5, 2020
1 parent 17e1774 commit 565ba3a
Show file tree
Hide file tree
Showing 17 changed files with 42 additions and 42 deletions.
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,40 @@
# karaoke!
[![CodeFactor](https://www.codefactor.io/repository/github/karaoke-dev/karaoke/badge)](https://www.codefactor.io/repository/github/karaoke-dev/karaoke)
[![Build status](https://ci.appveyor.com/api/projects/status/toy4vlii1t2vl8yr?svg=true)](https://ci.appveyor.com/project/karaoke-dev/karaoke)
[![Build status](https://ci.appveyor.com/api/projects/status/07ytm0sei6l5oy08?svg=true)](https://ci.appveyor.com/project/andy840119/karaoke)
[![NuGet](https://img.shields.io/badge/月子我婆-passed-ff69b4.svg)](https://github.com/karaoke-dev/karaoke)
[![GitHub last commit](https://img.shields.io/github/last-commit/karaoke-dev/karaoke)](https://github.com/karaoke-dev/karaoke/releases)
[![Tagged Release](https://github.com/karaoke-dev/karaoke/workflows/Tagged%20Release/badge.svg)](https://github.com/karaoke-dev/karaoke/releases)
[![dev chat](https://discordapp.com/api/guilds/299006062323826688/widget.png?style=shield)](https://discord.gg/ga2xZXk)


The source code of `karaoke!` ruleset

[Notice] : This is edge branch, some crash issue cause by using new package might be ignored.
The source code of `karaoke!` ruleset.

## How to run this project

The fastest way is run [launcher](https://github.com/karaoke-dev/launcher)(you might need to comile yourself).
The fastest way is download [release](https://github.com/karaoke-dev/karaoke/releases) `.dil` file and throw into lazer like [other customize ruleset](https://github.com/LumpBloom7/sentakki/wiki/Ruleset-installation-guide) do.
Or you can compile yourself.

Or compile `osu.Game.Rulesets.Karaoke`, then throw dll into official osu!lazer's folder(sometimes might not working).
If wants to try on other platform like android or ios, you might use [launcher](https://github.com/karaoke-dev/launcher).
Notice : Launcher is still under develop so it might not working.

## License

This repo is under [GPL V3](LICENSE) license.

## Rules

1. If using this repo in commercial, please contact me([email protected]) to got permission first.
1. If using this repo in commercial, please contact me([email protected]) to get permission first.
2. Use this repo to create/use `PIRATED` karaoke beatmap is absolutely forbidden.

## Thanks to

[osu!](https://github.com/ppy/osu) and it's [framework](https://github.com/ppy/osu-framework), karaoke! is modified from them.
- [osu!](https://github.com/ppy/osu) and it's [framework](https://github.com/ppy/osu-framework), karaoke! is modified from them.

[RhythmKaTTE](http://juna-idler.blogspot.com/2016/05/rhythmkatte-version-01.html) and [RhythmicaLyrics](http://suwa.pupu.jp/RhythmicaLyrics.html), an open-source software to create lyric with time tag.
- [RhythmKaTTE](http://juna-idler.blogspot.com/2016/05/rhythmkatte-version-01.html) and [RhythmicaLyrics](http://suwa.pupu.jp/RhythmicaLyrics.html), an open-source software to create lyric with time tag.
Some of lyric editor in this ruleset is inspired from them.

[ニコカラメーカー](http://shinta0806be.ldblog.jp/tag/%E3%83%8B%E3%82%B3%E3%82%AB%E3%83%A9%E3%83%A1%E3%83%BC%E3%82%AB%E3%83%BC), a software to convert `.lrc` file into karaoke video with beautiful text effect.
- [ニコカラメーカー](http://shinta0806be.ldblog.jp/tag/%E3%83%8B%E3%82%B3%E3%82%AB%E3%83%A9%E3%83%A1%E3%83%BC%E3%82%AB%E3%83%BC), a software to convert `.lrc` file into karaoke video with beautiful text effect.

- [Jetbrain](https://www.jetbrains.com/?from=osu-karaoke), thanks for free [rider](https://www.jetbrains.com/rider/) license for clean-up code.

[Jetbrain](https://www.jetbrains.com/?from=osu-karaoke), thanks for free [rider](https://www.jetbrains.com/rider/) license for clean-up code.
- [Appveyor](https://www.appveyor.com/), [CodeFactor](https://www.codefactor.io/) and [Github action](https://github.com/features/actions) for providing free `CI`/`CD` service.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void TestDecodeLyric()
}

[Test]
public void TestDecodeLyricWithDulicatedTimeTag()
public void TestDecodeLyricWithDuplicatedTimeTag()
{
const string wrong_lyric_text = "[00:04.00]か[00:04.00]ら[00:05.00]お[00:06.00]け[00:07.00]";
Assert.Throws<FormatException>(() => decodeLrcLine(wrong_lyric_text));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
namespace osu.Game.Rulesets.Karaoke.Tests.Edit
{
[TestFixture]
[Ignore("Will fail if run muliple tests. No idea how to fix that.")]
[Ignore("Will fail if run multiple tests. No idea how to fix that.")]
public class TestSceneLyricEditorScreen : EditorClockTestScene
{
public TestSceneLyricEditorScreen()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
using osu.Game.Graphics.UserInterface;
using osu.Game.IO;
using osu.Game.Rulesets.Karaoke.Beatmaps.Formats;
using osu.Game.Rulesets.Karaoke.Edit.LyricEditor;
using osu.Game.Rulesets.Karaoke.Objects;
using osu.Game.Rulesets.Karaoke.Objects.Drawables;
using osu.Game.Rulesets.Karaoke.Skinning;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets.Karaoke.Edit.LyricEditor;
using osu.Game.Rulesets.Karaoke.Objects;
using osu.Game.Rulesets.Karaoke.Objects.Drawables;
using osu.Game.Rulesets.Karaoke.Skinning;
Expand Down
1 change: 0 additions & 1 deletion osu.Game.Rulesets.Karaoke.Tests/Edit/TestSceneSinger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets.Karaoke.Edit.LyricEditor;
using osu.Game.Rulesets.Karaoke.Skinning;
using osu.Game.Rulesets.Karaoke.Skinning.Components;
using osu.Game.Tests.Visual;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public void TestCheckNoteExistInPlayfield() => CreateModTest(new ModTestData
return false;

// check has no note in playfield
return lyricPlayfield.AllHitObjects.Any() && notePlayfield.AllHitObjects.Count() == 0;
return lyricPlayfield.AllHitObjects.Any() && !notePlayfield.AllHitObjects.Any();
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void TestSingDemoSong()

// Get generated frame and compare frame
var karaokeFrames = generated.Frames.OfType<KaraokeReplayFrame>().ToList();
var compareFrame = GetCompareResultFromName("demo");
var compareFrame = getCompareResultFromName("demo");

// Check total frames.
Assert.AreEqual(karaokeFrames.Count, compareFrame.Count, $"Replay frame should have {compareFrame.Count}.");
Expand All @@ -44,7 +44,7 @@ public void TestSingDemoSong()
}
}

private static IList<TestKaraokeReplayFrame> GetCompareResultFromName(string name)
private static IList<TestKaraokeReplayFrame> getCompareResultFromName(string name)
{
var data = TestResources.OpenResource($"Testing/Track/{name}.json");

Expand Down
6 changes: 4 additions & 2 deletions osu.Game.Rulesets.Karaoke.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeInspection/ExcludedFiles/FileMasksToSkip/=_002A_002Efnt/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/ExcludedFiles/FileMasksToSkip/=_002A_002Emp3/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/ExcludedFiles/FileMasksToSkip/=_002A_002Epng/@EntryIndexedValue">True</s:Boolean>
Expand Down Expand Up @@ -915,6 +915,7 @@ private void load()
<s:Boolean x:Key="/Default/UserDictionary/Words/=Kiai/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Leaderboard/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Leaderboards/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Lyric_0027s/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Naka/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=nkmproj/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Playfield/@EntryIndexedValue">True</s:Boolean>
Expand All @@ -931,4 +932,5 @@ private void load()
<s:Boolean x:Key="/Default/UserDictionary/Words/=Skinnable/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=splitted/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Taiko/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Unranked/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Unranked/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=upppppdate/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ protected override void ParseLine(Beatmap beatmap, Section section, string line)
}
}

private void processNotes(Beatmap beatmap, IList<string> noteLines)
private void processNotes(Beatmap beatmap, IList<string> lines)
{
// Remove all karaoke note
beatmap.HitObjects.RemoveAll(x => x is Note);
Expand All @@ -105,7 +105,7 @@ private void processNotes(Beatmap beatmap, IList<string> noteLines)
for (int l = 0; l < lyricLines.Count; l++)
{
var lyricLine = lyricLines[l];
var line = noteLines.ElementAtOrDefault(l)?.Split('=').Last();
var line = lines.ElementAtOrDefault(l)?.Split('=').Last();

// Create default note if not exist
if (string.IsNullOrEmpty(line))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ static Skinning.Components.BrushInfo convertBrushInfo(BrushInfo info)
BrushGradients = brushGradient
};

Color4 convertColor(System.Drawing.Color color) => new Color4(color.R, color.G, color.B, color.A);
static Color4 convertColor(System.Drawing.Color color) => new Color4(color.R, color.G, color.B, color.A);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) andy840119 <[email protected]>. Licensed under the GPL Licence.
// See the LICENCE file in the repository root for full licence text.

using System.Collections.Generic;
using System.Linq;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Karaoke.Beatmaps.Patterns;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
// See the LICENCE file in the repository root for full licence text.

using System.Collections.Generic;
using osu.Game.Rulesets.Karaoke.Objects;

namespace osu.Game.Rulesets.Karaoke.Beatmaps.Patterns
{
public interface IPatternGenerator<T>
public interface IPatternGenerator<TObject> where TObject : KaraokeHitObject
{
void Generate(IEnumerable<T> hitObjects);
void Generate(IEnumerable<TObject> hitObjects);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ public void Generate(IEnumerable<LyricLine> hitObjects)
/// ****** (left) 12
/// ****** (right) 13
/// </example>
/// <param name="lyrics"></param>
/// <param name="bottomOnly"></param>
private void assignLayoutArrangement(IList<LyricLine> lyrics, bool bottomOnly = false)
/// <param name="lyrics">Lyrics</param>
private void assignLayoutArrangement(IList<LyricLine> lyrics)
{
// Force change to new line if lyric has long time
const int new_lyric_line_time = 15000;
Expand Down Expand Up @@ -83,15 +82,15 @@ private void assignLyricTime(IList<LyricLine> lyrics)
var lastLyricLine = i >= number_of_line ? lyrics[i - number_of_line] : null;
var lyricLine = lyrics[i];

if (lastLyricLine != null)
{
// Adjust start time and end time
var lyricEndTime = lyricLine.EndTime;
lyricLine.StartTime = lastLyricLine.EndTime + 1000;
if (lastLyricLine == null)
continue;

// Should re-assign duration here
lyricLine.Duration = lyricEndTime - lyricLine.StartTime;
}
// Adjust start time and end time
var lyricEndTime = lyricLine.EndTime;
lyricLine.StartTime = lastLyricLine.EndTime + 1000;

// Should re-assign duration here
lyricLine.Duration = lyricEndTime - lyricLine.StartTime;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ private void handleScrollViaDrag(DragEvent e)

internal class TimelineSelectionHandler : SelectionHandler
{
// for now we always allow movement. snapping is provided by the Timeline's "distance" snap implementation
// for now we always allow movement. snapping is provided by the time line's "distance" snap implementation
public override bool HandleMovement(MoveSelectionEvent moveEvent) => true;
}

Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Karaoke/Mods/KaraokeModWindowsUpdate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public WindowsUpdateContainer()
};
}

public class LoadingIcon : ModButton
private class LoadingIcon : ModButton
{
public LoadingIcon()
: base(new KaraokeModWindowsUpdate())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public class KaraokeAutoGeneratorBySinger : AutoGenerator
private readonly Task<Dictionary<double, float?>> readTask;

/// <summary>
/// Using audio's vioce to generate replay frames
/// Logic is copird from <see cref="Waveform"/>
/// Using audio's voice to generate replay frames
/// Logic is copied from <see cref="Waveform"/>
/// </summary>
/// <param name="beatmap"></param>
/// <param name="data"></param>
Expand Down

0 comments on commit 565ba3a

Please sign in to comment.