new song and ogg/vorbis format #1

Open
ratijas wants to merge 9 commits from ratijas/muzika-gromche:work/r/en_US into master
2 changed files with 18 additions and 2 deletions
Showing only changes of commit 0b2b8992a5 - Show all commits

View File

@ -1 +1,3 @@
*.mp3 filter=lfs diff=lfs merge=lfs -text *.mp3 filter=lfs diff=lfs merge=lfs -text
*.ogg filter=lfs diff=lfs merge=lfs -text
*.wav filter=lfs diff=lfs merge=lfs -text

View File

@ -109,8 +109,8 @@ namespace MuzikaGromche
UnityWebRequest[] requests = new UnityWebRequest[Tracks.Length * 2]; UnityWebRequest[] requests = new UnityWebRequest[Tracks.Length * 2];
for (int i = 0; i < Tracks.Length; i++) { for (int i = 0; i < Tracks.Length; i++) {
Track track = Tracks[i]; Track track = Tracks[i];
requests[i * 2] = UnityWebRequestMultimedia.GetAudioClip($"File://{text}{track.Name}Start.mp3", AudioType.MPEG); requests[i * 2] = UnityWebRequestMultimedia.GetAudioClip($"File://{text}{track.FileNameStart}", track.AudioType);
requests[i * 2 + 1] = UnityWebRequestMultimedia.GetAudioClip($"File://{text}{track.Name}Loop.mp3", AudioType.MPEG); requests[i * 2 + 1] = UnityWebRequestMultimedia.GetAudioClip($"File://{text}{track.FileNameLoop}", track.AudioType);
requests[i * 2].SendWebRequest(); requests[i * 2].SendWebRequest();
requests[i * 2 + 1].SendWebRequest(); requests[i * 2 + 1].SendWebRequest();
} }
@ -141,8 +141,22 @@ namespace MuzikaGromche
// so the Loop track should start precisely on a beat. // so the Loop track should start precisely on a beat.
public float Bpm; public float Bpm;
// MPEG is basically mp3, and it can produce gaps at the start.
// WAV is OK, but takes a lot of space. Try OGGVORBIS instead.
public AudioType AudioType = AudioType.MPEG;
public AudioClip LoadedStart; public AudioClip LoadedStart;
public AudioClip LoadedLoop; public AudioClip LoadedLoop;
public string FileNameStart => $"{Name}Start.{ext}";
public string FileNameLoop => $"{Name}Loop.{ext}";
private string ext => AudioType switch
{
AudioType.MPEG => "mp3",
AudioType.WAV => "wav",
AudioType.OGGVORBIS => "ogg",
_ => "",
};
} }
[HarmonyPatch(typeof(JesterAI))] [HarmonyPatch(typeof(JesterAI))]