Skip to content

Commit 7d39e95

Browse files
committed
Merge branch 'AP-CustomEx' of https://github.com/Z11Coding/Mixtape-Engine-Rework into AP-CustomEx
2 parents 9c8b614 + 7998d4c commit 7d39e95

File tree

1 file changed

+24
-34
lines changed

1 file changed

+24
-34
lines changed

source/archipelago/APPlayState.hx

Lines changed: 24 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2036,10 +2036,12 @@ class APPlayState extends PlayState {
20362036

20372037
public var isFrozen:Bool = false;
20382038
var doRandomize:Bool = false;
2039+
var lowpass:FlxSoundFilter;
2040+
var lowpassVocal:FlxSoundFilter;
20392041
override public function update(elapsed:Float)
20402042
{
20412043

2042-
if (archipelago.APInfo.inMinigame != None)
2044+
if (archipelago.APInfo.inMinigame != None)
20432045
{
20442046
// Save current state before switching to minigame
20452047
if (APEntryState.apGame != null) {
@@ -2255,43 +2257,30 @@ class APPlayState extends PlayState {
22552257
}
22562258
trace("Triggering DeathLink!");
22572259
}
2260+
2261+
if (lowpass == null) {
2262+
lowpass = new FlxSoundFilter();
2263+
lowpass.filterType = FlxSoundFilterType.LOWPASS;
2264+
add(lowpass);
2265+
2266+
lowpassVocal = new FlxSoundFilter();
2267+
lowpassVocal.filterType = FlxSoundFilterType.LOWPASS;
2268+
add(lowpassVocal);
2269+
2270+
lowpass.applyFilter(FlxG.sound.music);
2271+
lowpassVocal.applyFilter(vocals);
2272+
lowpassVocal.applyFilter(opponentVocals);
2273+
}
2274+
22582275
#if cpp
22592276
if(FlxG.sound.music != null && FlxG.sound.music.playing)
2260-
{
2261-
@:privateAccess
2262-
{
2263-
var af = lime.media.openal.AL.createFilter(); // create AudioFilter
2264-
lime.media.openal.AL.filteri( af, lime.media.openal.AL.FILTER_TYPE, lime.media.openal.AL.FILTER_LOWPASS ); // set filter type
2265-
lime.media.openal.AL.filterf( af, lime.media.openal.AL.LOWPASS_GAIN, 1 ); // set gain
2266-
lime.media.openal.AL.filterf( af, lime.media.openal.AL.LOWPASS_GAINHF, lowFilterAmount ); // set gainhf
2267-
lime.media.openal.AL.sourcei( FlxG.sound.music._channel.__audioSource.__backend.handle, lime.media.openal.AL.DIRECT_FILTER, af ); // apply filter to source (handle)
2268-
//lime.media.openal.AL.sourcef(FlxG.sound.music._channel.__audioSource.__backend.handle, lime.media.openal.AL.HIGHPASS_GAIN, 0);
2269-
}
2270-
}
2277+
lowpass.gainHF = lowFilterAmount;
2278+
22712279
if(vocals != null && vocals.playing)
2272-
{
2273-
@:privateAccess
2274-
{
2275-
var af = lime.media.openal.AL.createFilter(); // create AudioFilter
2276-
lime.media.openal.AL.filteri( af, lime.media.openal.AL.FILTER_TYPE, lime.media.openal.AL.FILTER_LOWPASS ); // set filter type
2277-
lime.media.openal.AL.filterf( af, lime.media.openal.AL.LOWPASS_GAIN, 1 ); // set gain
2278-
lime.media.openal.AL.filterf( af, lime.media.openal.AL.LOWPASS_GAINHF, vocalLowFilterAmount ); // set gainhf
2279-
lime.media.openal.AL.sourcei( vocals._channel.__audioSource.__backend.handle, lime.media.openal.AL.DIRECT_FILTER, af ); // apply filter to source (handle)
2280-
//lime.media.openal.AL.sourcef(FlxG.sound.music._channel.__audioSource.__backend.handle, lime.media.openal.AL.HIGHPASS_GAIN, 0);
2281-
}
2282-
}
2280+
lowpassVocal.gainHF = vocalLowFilterAmount;
2281+
22832282
if(opponentVocals != null && opponentVocals.playing)
2284-
{
2285-
@:privateAccess
2286-
{
2287-
var af = lime.media.openal.AL.createFilter(); // create AudioFilter
2288-
lime.media.openal.AL.filteri( af, lime.media.openal.AL.FILTER_TYPE, lime.media.openal.AL.FILTER_LOWPASS ); // set filter type
2289-
lime.media.openal.AL.filterf( af, lime.media.openal.AL.LOWPASS_GAIN, 1 ); // set gain
2290-
lime.media.openal.AL.filterf( af, lime.media.openal.AL.LOWPASS_GAINHF, vocalLowFilterAmount ); // set gainhf
2291-
lime.media.openal.AL.sourcei( opponentVocals._channel.__audioSource.__backend.handle, lime.media.openal.AL.DIRECT_FILTER, af ); // apply filter to source (handle)
2292-
//lime.media.openal.AL.sourcef(FlxG.sound.music._channel.__audioSource.__backend.handle, lime.media.openal.AL.HIGHPASS_GAIN, 0);
2293-
}
2294-
}
2283+
lowpassVocal.gainHF = vocalLowFilterAmount;
22952284

22962285
/*if(gfVocals != null && gfVocals.playing)
22972286
{
@@ -2322,6 +2311,7 @@ class APPlayState extends PlayState {
23222311
}
23232312
}*/
23242313
#end
2314+
23252315
curEffect = FlxG.random.int(0, 38);
23262316
if (isFrozen) boyfriend.stunned = true;
23272317
if (notes != null)

0 commit comments

Comments
 (0)