mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-09-12 05:07:06 +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);
|
start = Math.max(start, 0);
|
||||||
|
|
||||||
|
// gets how many samples to generate
|
||||||
var samplesToGen:Int = Std.int(sampleRate * seconds);
|
var samplesToGen:Int = Std.int(sampleRate * seconds);
|
||||||
|
|
||||||
|
if (samplesToGen == 0) return;
|
||||||
// gets which sample to start at
|
// gets which sample to start at
|
||||||
var startSample:Int = Std.int(FlxMath.remapToRange(start, 0, vis.snd.length, 0, numSamples));
|
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 prevPoint:FlxPoint = new FlxPoint();
|
||||||
|
|
||||||
var funnyPixels:Int = Std.int(daHeight); // sorta redundant but just need it for different var...
|
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;
|
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 haxe.ui.focus.FocusManager;
|
||||||
import openfl.display.BitmapData;
|
import openfl.display.BitmapData;
|
||||||
import funkin.audio.visualize.PolygonSpectogram;
|
import funkin.audio.visualize.PolygonSpectogram;
|
||||||
|
import flixel.group.FlxGroup.FlxTypedGroup;
|
||||||
|
|
||||||
using Lambda;
|
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.
|
* The IMAGE used for the grid. Updated by ChartEditorThemeHandler.
|
||||||
*/
|
*/
|
||||||
|
@ -1871,6 +1876,9 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
||||||
healthIconBF.flipX = true;
|
healthIconBF.flipX = true;
|
||||||
add(healthIconBF);
|
add(healthIconBF);
|
||||||
healthIconBF.zIndex = 30;
|
healthIconBF.zIndex = 30;
|
||||||
|
|
||||||
|
visulizerGrps = new FlxTypedGroup<PolygonSpectogram>();
|
||||||
|
add(visulizerGrps);
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildNotePreview():Void
|
function buildNotePreview():Void
|
||||||
|
@ -2226,11 +2234,9 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
||||||
#if sys
|
#if sys
|
||||||
menubarItemGoToBackupsFolder.onClick = _ -> this.openBackupsFolder();
|
menubarItemGoToBackupsFolder.onClick = _ -> this.openBackupsFolder();
|
||||||
#else
|
#else
|
||||||
|
|
||||||
// Disable the menu item if we're not on a desktop platform.
|
// Disable the menu item if we're not on a desktop platform.
|
||||||
var menubarItemGoToBackupsFolder = findComponent('menubarItemGoToBackupsFolder', MenuItem);
|
var menubarItemGoToBackupsFolder = findComponent('menubarItemGoToBackupsFolder', MenuItem);
|
||||||
if (menubarItemGoToBackupsFolder != null) menubarItemGoToBackupsFolder.disabled = true;
|
if (menubarItemGoToBackupsFolder != null) menubarItemGoToBackupsFolder.disabled = true;
|
||||||
|
|
||||||
#end
|
#end
|
||||||
|
|
||||||
menubarItemUserGuide.onClick = _ -> this.openUserGuideDialog();
|
menubarItemUserGuide.onClick = _ -> this.openUserGuideDialog();
|
||||||
|
@ -5054,8 +5060,8 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
||||||
}
|
}
|
||||||
|
|
||||||
var vis:PolygonSpectogram = new PolygonSpectogram(audioInstTrack);
|
var vis:PolygonSpectogram = new PolygonSpectogram(audioInstTrack);
|
||||||
vis.generateSection(0, 4);
|
vis.realtimeVisLenght = 1;
|
||||||
add(vis);
|
visulizerGrps.add(vis);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue