clsSFX // Add machine-gun farting / beeping effect.

This commit is contained in:
ShikiSuen 2022-06-22 21:35:02 +08:00
parent 648938081c
commit be91805dee
1 changed files with 12 additions and 1 deletions

View File

@ -25,7 +25,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import AVFoundation
import Foundation
public class clsSFX {
public enum clsSFX {
static func beep() {
let filePath = Bundle.main.path(forResource: mgrPrefs.shouldNotFartInLieuOfBeep ? "Beep" : "Fart", ofType: "m4a")!
let fileURL = URL(fileURLWithPath: filePath)
@ -33,4 +33,15 @@ public class clsSFX {
AudioServicesCreateSystemSoundID(fileURL as CFURL, &soundID)
AudioServicesPlaySystemSound(soundID)
}
static func beep(count: Int = 1) {
if count <= 1 {
clsSFX.beep()
return
}
for _ in 0...count {
clsSFX.beep()
usleep(500_000)
}
}
}