mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2025-03-22 09:59:25 +00:00
funkVis html5
This commit is contained in:
parent
e5a10c6a25
commit
b75c7c2361
2
hmm.json
2
hmm.json
|
@ -49,7 +49,7 @@
|
||||||
"name": "funkVis",
|
"name": "funkVis",
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"dir": null,
|
"dir": null,
|
||||||
"ref": "0ac2fffa67fd30563df97c66718551efa92d283e",
|
"ref": "backend-rework",
|
||||||
"url": "https://github.com/FunkinCrew/funkVis"
|
"url": "https://github.com/FunkinCrew/funkVis"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,6 +9,7 @@ import flixel.math.FlxMath;
|
||||||
import flixel.sound.FlxSound;
|
import flixel.sound.FlxSound;
|
||||||
import funkin.util.MathUtil;
|
import funkin.util.MathUtil;
|
||||||
import funkVis.dsp.SpectralAnalyzer;
|
import funkVis.dsp.SpectralAnalyzer;
|
||||||
|
import funkVis.audioclip.frontends.LimeAudioClip;
|
||||||
|
|
||||||
using Lambda;
|
using Lambda;
|
||||||
|
|
||||||
|
@ -57,7 +58,7 @@ class ABotVis extends FlxTypedSpriteGroup<FlxSprite>
|
||||||
public function initAnalyzer()
|
public function initAnalyzer()
|
||||||
{
|
{
|
||||||
@:privateAccess
|
@: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.maxDb = -35;
|
||||||
// analyzer.fftN = 2048;
|
// analyzer.fftN = 2048;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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));
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue