1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-07-12 06:10:23 +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; var halloweenLevel:Bool = false;
private var vocals:FlxSound; private var vocals:VoicesGroup;
private var vocalsFinished:Bool = false; private var vocalsFinished:Bool = false;
private var dad:Character; private var dad:Character;
@ -1524,15 +1524,16 @@ class PlayState extends MusicBeatState
curSong = songData.song; curSong = songData.song;
if (SONG.needsVoices) if (SONG.needsVoices)
vocals = new FlxSound().loadEmbedded(Paths.voices(SONG.song)); {
vocals = new VoicesGroup(SONG.song);
}
else else
vocals = new FlxSound(); vocals = new VoicesGroup(SONG.song, null, false);
vocals.onComplete = function() vocals.members[0].onComplete = function()
{ {
vocalsFinished = true; vocalsFinished = true;
}; };
FlxG.sound.list.add(vocals);
notes = new FlxTypedGroup<Note>(); notes = new FlxTypedGroup<Note>();
add(notes); add(notes);

View file

@ -7,11 +7,22 @@ class VoicesGroup extends FlxTypedGroup<FlxSound>
{ {
public var time(default, set):Float = 0; public var time(default, set):Float = 0;
public var volume(default, set):Float = 1;
// make it a group that you add to? // 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(); 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) if (files == null)
files = [""]; // loads with no file name assumption, to load "Voices.ogg" or whatev normally 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; 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;
}
} }