-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathAdaptiveMusicController.hxc
More file actions
43 lines (39 loc) · 893 Bytes
/
AdaptiveMusicController.hxc
File metadata and controls
43 lines (39 loc) · 893 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import StringTools;
import flixel.FlxG;
import flixel.sound.FlxSoundGroup;
import funkin.audio.FunkinSound;
import funkin.modding.module.Module;
import funkin.modding.module.ModuleHandler;
class AdaptiveMusicController extends Module
{
var playTime:Float = 0;
var stopRecordingPlaytime:Bool = false;
public function new()
{
super("AdaptiveMusicController", 23);
}
public function play(name)
{
if (FlxG.sound.music != null && !stopRecordingPlaytime)
{
playTime = FlxG.sound.music.time;
}
FunkinSound.playMusic(name, {
startingVolume: 0.7,
overrideExisting: true,
restartTrack: false,
loop: true
});
FlxG.sound.music.pause();
FlxG.sound.music.time = playTime;
FlxG.sound.music.resume();
}
public function onUpdate(e)
{
if (FlxG.sound.music != null && !stopRecordingPlaytime)
{
playTime = FlxG.sound.music.time;
}
super.onUpdate(e);
}
}