Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added key click sound

  • Loading branch information...
commit 88a4d7c7619f21c6c41abf748d1fbd08ec2563c2 1 parent 4c32fde
@dparnell authored
View
4 Classes/MainViewController.h
@@ -8,10 +8,12 @@
#import <UIKit/UIKit.h>
#import "MainView.h"
+#import <AudioToolbox/AudioToolbox.h>
@interface MainViewController : UIViewController {
unsigned char* _display_buffer;
-
+
+ SystemSoundID soundID;
CGContextRef lcdContext;
NSThread* emulatorThread;
View
10 Classes/MainViewController.m
@@ -348,6 +348,9 @@ void AudioQueueCallback(void* inUserData, AudioQueueRef inAQ,
- (void)viewDidLoad {
[super viewDidLoad];
+ NSString *path = [[NSBundle bundleWithIdentifier:@"com.apple.UIKit"] pathForResource:@"Tock" ofType:@"aiff"];
+ AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:path], &soundID);
+
instance = self;
memset(&saturn, 0, sizeof(saturn));
@@ -450,6 +453,7 @@ - (void)didReceiveMemoryWarning {
- (void)dealloc {
instance = nil;
+ AudioServicesDisposeSystemSoundID(soundID);
[super dealloc];
}
@@ -460,6 +464,12 @@ - (IBAction) buttonPressed:(UIButton*)sender {
int i, r, c;
+ NSNumber* play_click = [[NSUserDefaults standardUserDefaults] objectForKey: @"key_click"];
+
+ if([play_click boolValue]) {
+ AudioServicesPlaySystemSound(soundID);
+ }
+
if (code == 0x8000) {
for (i = 0; i < 9; i++) {
saturn.keybuf.rows[i] |= 0x8000;
View
1  Classes/i48AppDelegate.m
@@ -20,6 +20,7 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application {
[[NSUserDefaults standardUserDefaults]
registerDefaults: [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool: YES], @"limit_speed",
+ [NSNumber numberWithBool: NO], @"key_click",
@"MainView", @"skin",
nil
]
View
10 Settings.bundle/Root.plist
@@ -36,6 +36,16 @@
<key>DefaultValue</key>
<true/>
</dict>
+ <dict>
+ <key>Type</key>
+ <string>PSToggleSwitchSpecifier</string>
+ <key>Title</key>
+ <string>Play Key Click Sound</string>
+ <key>Key</key>
+ <string>key_click</string>
+ <key>DefaultValue</key>
+ <false/>
+ </dict>
</array>
</dict>
</plist>
Please sign in to comment.
Something went wrong with that request. Please try again.