mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-08-20 07:25:59 +00:00
samples stability
This commit is contained in:
parent
73810a5059
commit
eea614b4f5
|
@ -73,10 +73,17 @@ class PolygonSpectogram extends MeshRender
|
|||
|
||||
start = Math.max(start, 0);
|
||||
|
||||
// gets how many samples to generate
|
||||
var samplesToGen:Int = Std.int(sampleRate * seconds);
|
||||
|
||||
if (samplesToGen == 0) return;
|
||||
// gets which sample to start at
|
||||
var startSample:Int = Std.int(FlxMath.remapToRange(start, 0, vis.snd.length, 0, numSamples));
|
||||
|
||||
// Check if startSample and samplesToGen are within the bounds of the audioData array
|
||||
if (startSample < 0 || startSample >= numSamples) return;
|
||||
if (samplesToGen <= 0 || startSample + samplesToGen > numSamples) samplesToGen = numSamples - startSample;
|
||||
|
||||
var prevPoint:FlxPoint = new FlxPoint();
|
||||
|
||||
var funnyPixels:Int = Std.int(daHeight); // sorta redundant but just need it for different var...
|
||||
|
@ -123,7 +130,7 @@ class PolygonSpectogram extends MeshRender
|
|||
|
||||
curTime = vis.snd.time;
|
||||
|
||||
generateSection(vis.snd.time, realtimeVisLenght);
|
||||
if (vis.snd.time < vis.snd.length - realtimeVisLenght) generateSection(vis.snd.time, realtimeVisLenght);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,6 +111,7 @@ import haxe.ui.events.UIEvent;
|
|||
import haxe.ui.focus.FocusManager;
|
||||
import openfl.display.BitmapData;
|
||||
import funkin.audio.visualize.PolygonSpectogram;
|
||||
import flixel.group.FlxGroup.FlxTypedGroup;
|
||||
|
||||
using Lambda;
|
||||
|
||||
|
@ -1328,6 +1329,10 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
*/
|
||||
// ==============================
|
||||
|
||||
/**
|
||||
* The group containing the visulizers! */
|
||||
var visulizerGrps:FlxTypedGroup<PolygonSpectogram> = null;
|
||||
|
||||
/**
|
||||
* The IMAGE used for the grid. Updated by ChartEditorThemeHandler.
|
||||
*/
|
||||
|
@ -1871,6 +1876,9 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
healthIconBF.flipX = true;
|
||||
add(healthIconBF);
|
||||
healthIconBF.zIndex = 30;
|
||||
|
||||
visulizerGrps = new FlxTypedGroup<PolygonSpectogram>();
|
||||
add(visulizerGrps);
|
||||
}
|
||||
|
||||
function buildNotePreview():Void
|
||||
|
@ -2226,11 +2234,9 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
#if sys
|
||||
menubarItemGoToBackupsFolder.onClick = _ -> this.openBackupsFolder();
|
||||
#else
|
||||
|
||||
// Disable the menu item if we're not on a desktop platform.
|
||||
var menubarItemGoToBackupsFolder = findComponent('menubarItemGoToBackupsFolder', MenuItem);
|
||||
if (menubarItemGoToBackupsFolder != null) menubarItemGoToBackupsFolder.disabled = true;
|
||||
|
||||
#end
|
||||
|
||||
menubarItemUserGuide.onClick = _ -> this.openUserGuideDialog();
|
||||
|
@ -5054,8 +5060,8 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
}
|
||||
|
||||
var vis:PolygonSpectogram = new PolygonSpectogram(audioInstTrack);
|
||||
vis.generateSection(0, 4);
|
||||
add(vis);
|
||||
vis.realtimeVisLenght = 1;
|
||||
visulizerGrps.add(vis);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue