mirror of
https://github.com/SirusDoma/VoxCharger.git
synced 2024-11-24 07:00:14 +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
103 lines
3.2 KiB
C#
103 lines
3.2 KiB
C#
using System;
|
|
using System.Linq;
|
|
|
|
namespace VoxCharger
|
|
{
|
|
public partial class Effect
|
|
{
|
|
public class Flanger : Effect
|
|
{
|
|
public float Mix { get; set; }
|
|
public float Samples { get; set; }
|
|
public float Depth { get; set; }
|
|
public float Period { get; set; }
|
|
|
|
public Flanger(float mix, float samples, float depth, float period)
|
|
: base(FxType.Flanger)
|
|
{
|
|
Mix = mix;
|
|
Samples = samples;
|
|
Depth = depth;
|
|
Period = period;
|
|
}
|
|
|
|
public Flanger()
|
|
: base(FxType.None)
|
|
{
|
|
}
|
|
|
|
public new static Flanger FromVox(string data)
|
|
{
|
|
var highPass = new Flanger();
|
|
var prop = data.Trim().Split(',').Select(p => p.Trim()).ToArray();
|
|
if (!Enum.TryParse(prop[0], out FxType type) || type != FxType.Flanger)
|
|
return highPass;
|
|
|
|
if (prop.Length != 5)
|
|
return highPass;
|
|
|
|
try
|
|
{
|
|
highPass.Type = type;
|
|
highPass.Mix = float.Parse(prop[1]);
|
|
highPass.Samples = float.Parse(prop[2]);
|
|
highPass.Depth = float.Parse(prop[3]);
|
|
highPass.Period = float.Parse(prop[4]);
|
|
}
|
|
catch (Exception)
|
|
{
|
|
highPass.Type = FxType.None;
|
|
}
|
|
|
|
return highPass;
|
|
}
|
|
|
|
public new static Phaser FromKsh(string data)
|
|
{
|
|
var prop = data.Trim().Split(';').Select(p => p.Trim()).ToArray();
|
|
if (!Enum.TryParse(prop[0], out FxType type) || type != FxType.Flanger)
|
|
return null;
|
|
|
|
return new Phaser(80.00f, 2.00f, 0.50f, 90, 2.00f);
|
|
}
|
|
|
|
public new static Flanger FromKsh(KshDefinition definition)
|
|
{
|
|
var flanger = new Flanger();
|
|
|
|
try
|
|
{
|
|
definition.GetValue("mix", out float mix);
|
|
definition.GetValue("depth", out int depth);
|
|
definition.GetValue("period", out float period);
|
|
|
|
flanger.Mix = mix;
|
|
flanger.Samples = int.TryParse(definition.Value, out int samples) ? samples * 10 : 0;
|
|
flanger.Depth = depth;
|
|
flanger.Period = period;
|
|
flanger.Type = FxType.Flanger;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
flanger.Type = FxType.None;
|
|
}
|
|
|
|
return flanger;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
if (Type == FxType.None)
|
|
return base.ToString();
|
|
|
|
return $"{(int)Type}," +
|
|
$"\t{Mix:0.00}," +
|
|
$"\t{Samples:0.00}," +
|
|
$"\t{Depth:0.00}," +
|
|
$"\t{Period:0.00}";
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|