-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAudioManager.cs
36 lines (32 loc) · 994 Bytes
/
AudioManager.cs
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
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FNAFC
{
public class AudioManager
{
public static Process? AudioManagerProcess;
public bool Playing = false;
public string FileName = "";
public void Play(string filename = "", bool loop = false)
{
if (AudioManagerProcess == null && !Playing)
{
Playing = true;
AudioManagerProcess = Process.Start("AudioManager.exe", @$"Data/Audio/{FileName}{filename}.wav {(loop == true ? "true" : "false")}");
}
}
public void Stop()
{
if (AudioManagerProcess != null && Playing)
{
Playing = false;
AudioManagerProcess.Kill();
AudioManagerProcess = null;
}
}
}
}