vis wips wips wips

This commit is contained in:
Cameron Taylor 2023-12-01 19:58:58 -05:00
parent df427c8ecb
commit a750cc1620
4 changed files with 21 additions and 4 deletions

View file

@ -16,6 +16,7 @@ class PolygonSpectogram extends MeshRender
public var visType:VISTYPE = UPDATED; public var visType:VISTYPE = UPDATED;
public var daHeight:Float = FlxG.height; public var daHeight:Float = FlxG.height;
public var realtimeVisLenght:Float = 0.2; public var realtimeVisLenght:Float = 0.2;
public var realtimeStartOffset:Float = 0;
var numSamples:Int = 0; var numSamples:Int = 0;
var setBuffer:Bool = false; var setBuffer:Bool = false;
@ -86,7 +87,7 @@ class PolygonSpectogram extends MeshRender
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 * detail); // sorta redundant but just need it for different var...
if (prevAudioData == audioData.subarray(startSample, startSample + samplesToGen)) return; // optimize / finish funciton here, no need to re-render if (prevAudioData == audioData.subarray(startSample, startSample + samplesToGen)) return; // optimize / finish funciton here, no need to re-render
@ -130,7 +131,7 @@ class PolygonSpectogram extends MeshRender
curTime = vis.snd.time; curTime = vis.snd.time;
if (vis.snd.time < vis.snd.length - realtimeVisLenght) generateSection(vis.snd.time, realtimeVisLenght); if (vis.snd.time < vis.snd.length - realtimeVisLenght) generateSection(vis.snd.time + realtimeStartOffset, realtimeVisLenght);
} }
} }
} }

View file

@ -6,8 +6,9 @@ import flixel.sound.FlxSound;
class PolygonVisGroup extends FlxTypedGroup<PolygonSpectogram> class PolygonVisGroup extends FlxTypedGroup<PolygonSpectogram>
{ {
var playerVis:PolygonSpectogram; public var playerVis:PolygonSpectogram;
var opponentVis:PolygonSpectogram; public var opponentVis:PolygonSpectogram;
var instVis:PolygonSpectogram; var instVis:PolygonSpectogram;
public function new() public function new()

View file

@ -330,6 +330,11 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
{ {
gridTiledSprite.y = -scrollPositionInPixels + (MENU_BAR_HEIGHT + GRID_TOP_PAD); gridTiledSprite.y = -scrollPositionInPixels + (MENU_BAR_HEIGHT + GRID_TOP_PAD);
gridPlayheadScrollArea.y = gridTiledSprite.y; gridPlayheadScrollArea.y = gridTiledSprite.y;
if (audioVisGroup != null && audioVisGroup.playerVis != null)
{
audioVisGroup.playerVis.y = Math.max(gridTiledSprite.y, MENU_BAR_HEIGHT);
}
} }
} }
@ -428,12 +433,16 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
function get_playheadPositionInMs():Float function get_playheadPositionInMs():Float
{ {
if (audioVisGroup != null && audioVisGroup.playerVis != null)
audioVisGroup.playerVis.realtimeStartOffset = -Conductor.getStepTimeInMs(playheadPositionInSteps);
return Conductor.getStepTimeInMs(playheadPositionInSteps); return Conductor.getStepTimeInMs(playheadPositionInSteps);
} }
function set_playheadPositionInMs(value:Float):Float function set_playheadPositionInMs(value:Float):Float
{ {
playheadPositionInSteps = Conductor.getTimeInSteps(value); playheadPositionInSteps = Conductor.getTimeInSteps(value);
if (audioVisGroup != null && audioVisGroup.playerVis != null) audioVisGroup.playerVis.realtimeStartOffset = -value;
return value; return value;
} }

View file

@ -178,9 +178,15 @@ class ChartEditorAudioHandler
case BF: case BF:
state.audioVocalTrackGroup.addPlayerVoice(vocalTrack); state.audioVocalTrackGroup.addPlayerVoice(vocalTrack);
state.audioVisGroup.addPlayerVis(vocalTrack); state.audioVisGroup.addPlayerVis(vocalTrack);
state.audioVisGroup.playerVis.x = 885;
state.audioVisGroup.playerVis.realtimeVisLenght = Conductor.getStepTimeInMs(16) * 0.00195;
state.audioVisGroup.playerVis.daHeight = (ChartEditorState.GRID_SIZE) * 16;
state.audioVisGroup.playerVis.detail = 1;
return true; return true;
case DAD: case DAD:
state.audioVocalTrackGroup.addOpponentVoice(vocalTrack); state.audioVocalTrackGroup.addOpponentVoice(vocalTrack);
state.audioVisGroup.addOpponentVis(vocalTrack);
state.audioVisGroup.opponentVis.x = 435;
return true; return true;
case OTHER: case OTHER:
state.audioVocalTrackGroup.add(vocalTrack); state.audioVocalTrackGroup.add(vocalTrack);