Mp3读取,Effect Remove

Signed-off-by: TRAfoer <lhf190@outlook.com>
This commit is contained in:
2025-07-12 18:27:10 +08:00
parent 2ccac78620
commit 47ec9ddb21
164 changed files with 308674 additions and 50659 deletions

View File

@@ -5,7 +5,7 @@ using System.IO;
using Ichni.Editor;
using Ichni.RhythmGame.Beatmap;
using UnityEngine;
using NLayer;
namespace Ichni.RhythmGame
{
public class SongInformation : IBaseElement
@@ -35,7 +35,7 @@ namespace Ichni.RhythmGame
string extension = Path.GetExtension(songLocation).ToLower();
song = extension switch
{
".mp3" => ES3.LoadAudio(songLocation, AudioType.MPEG),
".mp3" => LoadMP3(songLocation),
".ogg" => ES3.LoadAudio(songLocation, AudioType.OGGVORBIS),
".wav" => ES3.LoadAudio(songLocation, AudioType.WAV),
_ => throw new Exception("Unsupported audio format: " + extension)
@@ -46,6 +46,22 @@ namespace Ichni.RhythmGame
}
songLength = song.length;
}
private AudioClip LoadMP3(string filepath)//猜猜我从哪里偷的
{
string filename = System.IO.Path.GetFileNameWithoutExtension(filepath);
MpegFile mpegFile = new MpegFile(filepath);
// assign samples into AudioClip
AudioClip ac = AudioClip.Create(filename,
(int)(mpegFile.Length / sizeof(float) / mpegFile.Channels),
mpegFile.Channels,
mpegFile.SampleRate,
true,
data => { int actualReadCount = mpegFile.ReadSamples(data, 0, data.Length); },
position => { mpegFile = new MpegFile(filepath); });
return ac;
}
public void SaveBM()
{