1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-11-27 14:46:06 +00:00

Merge pull request #561 from FunkinCrew/fix/grig-viz

desktop vis testing
This commit is contained in:
Cameron Taylor 2024-06-06 20:51:31 -04:00 committed by GitHub
commit b852811418
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 19 additions and 6 deletions

View file

@ -126,6 +126,7 @@ xsi:schemaLocation="http://lime.openfl.org/project/1.0.4 http://lime.openfl.org/
<haxelib name="flxanimate" /> <!-- Texture atlas rendering --> <haxelib name="flxanimate" /> <!-- Texture atlas rendering -->
<haxelib name="hxCodec" if="desktop" unless="hl" /> <!-- Video playback --> <haxelib name="hxCodec" if="desktop" unless="hl" /> <!-- Video playback -->
<haxelib name="funkin.vis"/> <haxelib name="funkin.vis"/>
<haxelib name="grig.audio" />
<haxelib name="FlxPartialSound" /> <!-- Loading partial sound data --> <haxelib name="FlxPartialSound" /> <!-- Loading partial sound data -->

View file

@ -56,9 +56,16 @@
"name": "funkin.vis", "name": "funkin.vis",
"type": "git", "type": "git",
"dir": null, "dir": null,
"ref": "2aa654b974507ab51ab1724d2d97e75726fd7d78", "ref": "38261833590773cb1de34ac5d11e0825696fc340",
"url": "https://github.com/FunkinCrew/funkVis" "url": "https://github.com/FunkinCrew/funkVis"
}, },
{
"name": "grig.audio",
"type": "git",
"dir": "src",
"ref": "57f5d47f2533fd0c3dcd025a86cb86c0dfa0b6d2",
"url": "https://gitlab.com/haxe-grig/grig.audio.git"
},
{ {
"name": "hamcrest", "name": "hamcrest",
"type": "haxelib", "type": "haxelib",

View file

@ -54,8 +54,15 @@ class ABotVis extends FlxTypedSpriteGroup<FlxSprite>
public function initAnalyzer() public function initAnalyzer()
{ {
@:privateAccess @:privateAccess
analyzer = new SpectralAnalyzer(7, new LimeAudioClip(cast snd._channel.__source), 0.01, 30); analyzer = new SpectralAnalyzer(snd._channel.__source, 7, 0.1, 30);
analyzer.maxDb = -35;
#if desktop
// On desktop it uses FFT stuff that isn't as optimized as the direct browser stuff we use on HTML5
// So we want to manually change it!
analyzer.fftN = 512;
#end
// analyzer.maxDb = -35;
// analyzer.fftN = 2048; // analyzer.fftN = 2048;
} }
@ -79,9 +86,7 @@ class ABotVis extends FlxTypedSpriteGroup<FlxSprite>
override function draw() override function draw()
{ {
#if web
if (analyzer != null) drawFFT(); if (analyzer != null) drawFFT();
#end
super.draw(); super.draw();
} }
@ -90,7 +95,7 @@ class ABotVis extends FlxTypedSpriteGroup<FlxSprite>
*/ */
function drawFFT():Void function drawFFT():Void
{ {
var levels = analyzer.getLevels(false); var levels = analyzer.getLevels();
for (i in 0...min(group.members.length, levels.length)) for (i in 0...min(group.members.length, levels.length))
{ {