clsSFX // Add machine-gun farting / beeping effect.
This commit is contained in:
parent
648938081c
commit
be91805dee
|
@ -25,7 +25,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
import AVFoundation
|
import AVFoundation
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class clsSFX {
|
public enum clsSFX {
|
||||||
static func beep() {
|
static func beep() {
|
||||||
let filePath = Bundle.main.path(forResource: mgrPrefs.shouldNotFartInLieuOfBeep ? "Beep" : "Fart", ofType: "m4a")!
|
let filePath = Bundle.main.path(forResource: mgrPrefs.shouldNotFartInLieuOfBeep ? "Beep" : "Fart", ofType: "m4a")!
|
||||||
let fileURL = URL(fileURLWithPath: filePath)
|
let fileURL = URL(fileURLWithPath: filePath)
|
||||||
|
@ -33,4 +33,15 @@ public class clsSFX {
|
||||||
AudioServicesCreateSystemSoundID(fileURL as CFURL, &soundID)
|
AudioServicesCreateSystemSoundID(fileURL as CFURL, &soundID)
|
||||||
AudioServicesPlaySystemSound(soundID)
|
AudioServicesPlaySystemSound(soundID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static func beep(count: Int = 1) {
|
||||||
|
if count <= 1 {
|
||||||
|
clsSFX.beep()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for _ in 0...count {
|
||||||
|
clsSFX.beep()
|
||||||
|
usleep(500_000)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue