forked from LIJI32/SameBoy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGBHapticManagerLegacy.m
27 lines (24 loc) · 1.01 KB
/
GBHapticManagerLegacy.m
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
#import "GBHapticManagerLegacy.h"
#import <UIKit/UIKit.h>
#import <AudioToolbox/AudioToolbox.h>
@implementation GBHapticManagerLegacy
- (void)doTapHaptic
{
[[[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleMedium] impactOccurred];
}
- (void)setRumbleStrength:(double)rumble
{
void AudioServicesStopSystemSound(SystemSoundID inSystemSoundID);
void AudioServicesPlaySystemSoundWithVibration(SystemSoundID inSystemSoundID, id arg, NSDictionary* vibratePattern);
if (rumble) {
AudioServicesPlaySystemSoundWithVibration(kSystemSoundID_Vibrate, nil, @{@"Intensity": @(rumble),
@"OffDuration": @0,
@"OnDuration": @100,
@"VibePattern": @[@YES, @1000],
});
}
else {
AudioServicesStopSystemSound(kSystemSoundID_Vibrate);
}
}
@end