mirror of
https://github.com/SirusDoma/VoxCharger.git
synced 2024-11-27 17:00:51 +01:00
b8f49e3e2d
- Fix naming and other code style issues - Fix `float` and `double` parsing issue when current System Culture comma separator is not `.` - This fixes issue when parsing BPM and other floating numbers. - Fix song selection when the program doesn't support the latest datecode in the future - It will disable Game Version and Infinite Version selection. - Replaced ancient `FolderBrowserDialog` with `CommonFileDialog` - Update default GameVersion and BackgroundId to latest version - Implement Radar information in `LevelEditorForm` - Implement built-in 2DX Encoder - Start Offset / TimeStamp and Fader effect for audio preview is now supported - Audio preview files is no longer divided into multiple files by default when audio files are unique. It still possible to specify unique preview via `LevelEditorForm` - Implement advanced configuration when importing .ksh chart - Add draft codes for Effect Mapping configurations and S3V support - Other Bugfixes and QoL improvements
81 lines
2.2 KiB
C#
81 lines
2.2 KiB
C#
using System;
|
|
using System.Linq;
|
|
|
|
namespace VoxCharger
|
|
{
|
|
public partial class Effect
|
|
{
|
|
public class BitCrusher : Effect
|
|
{
|
|
public float Mix { get; set; }
|
|
|
|
public int Reduction { get; set; }
|
|
|
|
public BitCrusher(float mix, int reduction)
|
|
: base(FxType.BitCrusher)
|
|
{
|
|
Mix = mix;
|
|
Reduction = reduction;
|
|
}
|
|
|
|
private BitCrusher()
|
|
: base(FxType.None)
|
|
{
|
|
}
|
|
|
|
public new static BitCrusher FromVox(string data)
|
|
{
|
|
var bitCrusher = new BitCrusher();
|
|
var prop = data.Trim().Split(',').Select(p => p.Trim()).ToArray();
|
|
if (!Enum.TryParse(prop[0], out FxType type) || type != FxType.BitCrusher)
|
|
return bitCrusher;
|
|
|
|
if (prop.Length != 3)
|
|
return bitCrusher;
|
|
|
|
try
|
|
{
|
|
bitCrusher.Type = type;
|
|
bitCrusher.Mix = float.Parse(prop[1]);
|
|
bitCrusher.Reduction = int.Parse(prop[2]);
|
|
}
|
|
catch (Exception)
|
|
{
|
|
bitCrusher.Type = FxType.None;
|
|
}
|
|
|
|
return bitCrusher;
|
|
}
|
|
|
|
public new static BitCrusher FromKsh(KshDefinition definition)
|
|
{
|
|
var bitCrusher = new BitCrusher();
|
|
|
|
try
|
|
{
|
|
definition.GetValue("mix", out float mix);
|
|
definition.GetValue("reduction", out int samples);
|
|
|
|
bitCrusher.Mix = mix;
|
|
bitCrusher.Reduction = samples;
|
|
bitCrusher.Type = FxType.BitCrusher;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
bitCrusher.Type = FxType.None;
|
|
}
|
|
|
|
return bitCrusher;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
if (Type == FxType.None)
|
|
return base.ToString();
|
|
|
|
return $"{(int)Type},\t{Mix:0.00},\t{Reduction}";
|
|
}
|
|
}
|
|
}
|
|
}
|