1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-12-27 23:46:45 +00:00

more voice group stuff in progress

This commit is contained in:
Cameron Taylor 2021-09-20 11:50:52 -04:00
parent 466181bbbd
commit ac2d0d2a38
2 changed files with 29 additions and 6 deletions

View file

@ -49,7 +49,7 @@ class PlayState extends MusicBeatState
var halloweenLevel:Bool = false;
private var vocals:FlxSound;
private var vocals:VoicesGroup;
private var vocalsFinished:Bool = false;
private var dad:Character;
@ -1524,15 +1524,16 @@ class PlayState extends MusicBeatState
curSong = songData.song;
if (SONG.needsVoices)
vocals = new FlxSound().loadEmbedded(Paths.voices(SONG.song));
{
vocals = new VoicesGroup(SONG.song);
}
else
vocals = new FlxSound();
vocals = new VoicesGroup(SONG.song, null, false);
vocals.onComplete = function()
vocals.members[0].onComplete = function()
{
vocalsFinished = true;
};
FlxG.sound.list.add(vocals);
notes = new FlxTypedGroup<Note>();
add(notes);

View file

@ -7,11 +7,22 @@ class VoicesGroup extends FlxTypedGroup<FlxSound>
{
public var time(default, set):Float = 0;
public var volume(default, set):Float = 1;
// make it a group that you add to?
public function new(song:String, ?files:Array<String>)
public function new(song:String, ?files:Array<String>, ?needsVoices:Bool = true)
{
super();
if (!needsVoices)
{
// simply adds an empty sound? fills it in moreso for easier backwards compatibility
add(new FlxSound());
// FlxG.sound.list.add(snd);
return;
}
if (files == null)
files = [""]; // loads with no file name assumption, to load "Voices.ogg" or whatev normally
@ -58,4 +69,15 @@ class VoicesGroup extends FlxTypedGroup<FlxSound>
return time;
}
// in PlayState, adjust the code so that it only mutes the player1 vocal tracks?
function set_volume(volume:Float):Float
{
forEachAlive(function(snd)
{
snd.volume = volume;
});
return volume;
}
}