mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2025-02-17 04:11:23 -05:00
sound grouping in progress
This commit is contained in:
parent
1acc039e77
commit
466181bbbd
4 changed files with 73 additions and 8 deletions
|
@ -82,7 +82,7 @@ class ChartingState extends MusicBeatState
|
|||
|
||||
var tempBpm:Float = 0;
|
||||
|
||||
var vocals:FlxSound;
|
||||
var vocals:VoicesGroup;
|
||||
|
||||
var leftIcon:HealthIcon;
|
||||
var rightIcon:HealthIcon;
|
||||
|
@ -404,17 +404,18 @@ class ChartingState extends MusicBeatState
|
|||
add(playheadTest);
|
||||
|
||||
// WONT WORK FOR TUTORIAL OR TEST SONG!!! REDO LATER
|
||||
vocals = new FlxSound().loadEmbedded(Paths.voices(daSong));
|
||||
FlxG.sound.list.add(vocals);
|
||||
vocals = new VoicesGroup(daSong);
|
||||
// vocals = new FlxSound().loadEmbedded(Paths.voices(daSong));
|
||||
// FlxG.sound.list.add(vocals);
|
||||
|
||||
var vocalSpec:SpectogramSprite = new SpectogramSprite(vocals);
|
||||
var vocalSpec:SpectogramSprite = new SpectogramSprite(vocals.members[0]);
|
||||
vocalSpec.x += 70;
|
||||
vocalSpec.daHeight = musSpec.daHeight;
|
||||
vocalSpec.y = vocalSpec.daHeight;
|
||||
vocalSpec.scrollFactor.set();
|
||||
add(vocalSpec);
|
||||
|
||||
spec = new SpectogramSprite(vocals);
|
||||
spec = new SpectogramSprite(vocals.members[0]);
|
||||
spec.x -= 150;
|
||||
spec.daHeight = GRID_SIZE * 16;
|
||||
spec.visType = STATIC;
|
||||
|
|
|
@ -84,9 +84,12 @@ class Paths
|
|||
return getPath('music/$key.$SOUND_EXT', MUSIC, library);
|
||||
}
|
||||
|
||||
inline static public function voices(song:String)
|
||||
inline static public function voices(song:String, ?suffix:String)
|
||||
{
|
||||
return 'songs:assets/songs/${song.toLowerCase()}/Voices.$SOUND_EXT';
|
||||
if (suffix == null)
|
||||
suffix = ""; // no suffix, for a sorta backwards compatibility with older-ish voice files
|
||||
|
||||
return 'songs:assets/songs/${song.toLowerCase()}/Voices$suffix.$SOUND_EXT';
|
||||
}
|
||||
|
||||
inline static public function inst(song:String)
|
||||
|
|
|
@ -103,7 +103,7 @@ class SpectogramSprite extends FlxTypedSpriteGroup<FlxSprite>
|
|||
|
||||
public function checkAndSetBuffer()
|
||||
{
|
||||
if (daSound.playing)
|
||||
if (daSound != null && daSound.playing)
|
||||
{
|
||||
if (!setBuffer)
|
||||
{
|
||||
|
|
61
source/VoicesGroup.hx
Normal file
61
source/VoicesGroup.hx
Normal file
|
@ -0,0 +1,61 @@
|
|||
import flixel.group.FlxGroup.FlxTypedGroup;
|
||||
import flixel.system.FlxSound;
|
||||
|
||||
// different than FlxSoundGroup cuz this can control all the sounds time and shit
|
||||
// when needed
|
||||
class VoicesGroup extends FlxTypedGroup<FlxSound>
|
||||
{
|
||||
public var time(default, set):Float = 0;
|
||||
|
||||
// make it a group that you add to?
|
||||
public function new(song:String, ?files:Array<String>)
|
||||
{
|
||||
super();
|
||||
|
||||
if (files == null)
|
||||
files = [""]; // loads with no file name assumption, to load "Voices.ogg" or whatev normally
|
||||
|
||||
for (sndFile in files)
|
||||
{
|
||||
var snd:FlxSound = new FlxSound().loadEmbedded(Paths.voices(song, '$sndFile'));
|
||||
FlxG.sound.list.add(snd); // adds it to sound group for proper volumes
|
||||
add(snd); // adds it to main group for other shit
|
||||
}
|
||||
}
|
||||
|
||||
// prob a better / cleaner way to do all these forEach stuff?
|
||||
public function pause()
|
||||
{
|
||||
forEachAlive(function(snd)
|
||||
{
|
||||
snd.pause();
|
||||
});
|
||||
}
|
||||
|
||||
public function play()
|
||||
{
|
||||
forEachAlive(function(snd)
|
||||
{
|
||||
snd.play();
|
||||
});
|
||||
}
|
||||
|
||||
public function stop()
|
||||
{
|
||||
forEachAlive(function(snd)
|
||||
{
|
||||
snd.stop();
|
||||
});
|
||||
}
|
||||
|
||||
function set_time(time:Float):Float
|
||||
{
|
||||
forEachAlive(function(snd)
|
||||
{
|
||||
// account for different offsets per sound?
|
||||
snd.time = time;
|
||||
});
|
||||
|
||||
return time;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue