1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-05 06:14:36 +00:00

funkVis html5

This commit is contained in:
Cameron Taylor 2024-03-28 23:08:50 -04:00
parent e5a10c6a25
commit b75c7c2361
3 changed files with 3 additions and 25 deletions

View file

@ -49,7 +49,7 @@
"name": "funkVis",
"type": "git",
"dir": null,
"ref": "0ac2fffa67fd30563df97c66718551efa92d283e",
"ref": "backend-rework",
"url": "https://github.com/FunkinCrew/funkVis"
},
{

View file

@ -9,6 +9,7 @@ import flixel.math.FlxMath;
import flixel.sound.FlxSound;
import funkin.util.MathUtil;
import funkVis.dsp.SpectralAnalyzer;
import funkVis.audioclip.frontends.LimeAudioClip;
using Lambda;
@ -57,7 +58,7 @@ class ABotVis extends FlxTypedSpriteGroup<FlxSprite>
public function initAnalyzer()
{
@:privateAccess
analyzer = new SpectralAnalyzer(7, new AudioClip(cast snd._channel.__source), 0.01, 30);
analyzer = new SpectralAnalyzer(7, new LimeAudioClip(cast snd._channel.__source), 0.01, 30);
analyzer.maxDb = -35;
// analyzer.fftN = 2048;
}

View file

@ -1,23 +0,0 @@
package funkin.audio.visualize;
import flixel.FlxG;
import flixel.math.FlxMath;
import funkVis.AudioBuffer;
import lime.media.AudioSource;
class AudioClip implements funkVis.AudioClip
{
public var audioBuffer(default, null):AudioBuffer;
public var currentFrame(get, never):Int;
public function new(audioSource:AudioSource)
{
var data:lime.utils.UInt16Array = cast audioSource.buffer.data;
this.audioBuffer = new AudioBuffer(data, audioSource.buffer.sampleRate);
}
private function get_currentFrame():Int
{
return Std.int(FlxMath.remapToRange(FlxG.sound.music.time, 0, FlxG.sound.music.length, 0, audioBuffer.data.length / 2));
}
}