diff --git a/source/PlayState.hx b/source/PlayState.hx index bfb9b2030..840d9da17 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -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(); add(notes); diff --git a/source/VoicesGroup.hx b/source/VoicesGroup.hx index 94e1ad9e0..426e2fe2e 100644 --- a/source/VoicesGroup.hx +++ b/source/VoicesGroup.hx @@ -7,11 +7,22 @@ class VoicesGroup extends FlxTypedGroup { 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) + public function new(song:String, ?files:Array, ?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 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; + } }