diff --git a/SysSound/.DS_Store b/SysSound/.DS_Store new file mode 100644 index 00000000..0d71298d Binary files /dev/null and b/SysSound/.DS_Store differ diff --git a/SysSound/SysSound.sln b/SysSound/SysSound.sln new file mode 100644 index 00000000..4b8b5b10 --- /dev/null +++ b/SysSound/SysSound.sln @@ -0,0 +1,26 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SysSound", "SysSound\SysSound.csproj", "{B538DD79-C235-4E39-B3E9-0F90A6D07F78}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|iPhoneSimulator = Debug|iPhoneSimulator + Release|iPhoneSimulator = Release|iPhoneSimulator + Debug|iPhone = Debug|iPhone + Release|iPhone = Release|iPhone + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B538DD79-C235-4E39-B3E9-0F90A6D07F78}.Debug|iPhone.ActiveCfg = Debug|iPhone + {B538DD79-C235-4E39-B3E9-0F90A6D07F78}.Debug|iPhone.Build.0 = Debug|iPhone + {B538DD79-C235-4E39-B3E9-0F90A6D07F78}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator + {B538DD79-C235-4E39-B3E9-0F90A6D07F78}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator + {B538DD79-C235-4E39-B3E9-0F90A6D07F78}.Release|iPhone.ActiveCfg = Release|iPhone + {B538DD79-C235-4E39-B3E9-0F90A6D07F78}.Release|iPhone.Build.0 = Release|iPhone + {B538DD79-C235-4E39-B3E9-0F90A6D07F78}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator + {B538DD79-C235-4E39-B3E9-0F90A6D07F78}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator + EndGlobalSection + GlobalSection(MonoDevelopProperties) = preSolution + StartupItem = SysSound\SysSound.csproj + EndGlobalSection +EndGlobal diff --git a/SysSound/SysSound/.DS_Store b/SysSound/SysSound/.DS_Store new file mode 100644 index 00000000..6723f54c Binary files /dev/null and b/SysSound/SysSound/.DS_Store differ diff --git a/SysSound/SysSound/AppDelegate.cs b/SysSound/SysSound/AppDelegate.cs new file mode 100644 index 00000000..1d15eaf4 --- /dev/null +++ b/SysSound/SysSound/AppDelegate.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using MonoTouch.Foundation; +using MonoTouch.UIKit; +using System.Drawing; + +namespace SysSound { + + /// + /// The UIApplicationDelegate for the application. This class is responsible for launching the + /// User Interface of the application, as well as listening (and optionally responding) to + /// application events from iOS. + /// + [Register ("AppDelegate")] + public partial class AppDelegate : UIApplicationDelegate { + + // class-level declarations + UIWindow window; + SysSoundViewController _SysSoundViewController; + + /// + /// This method is invoked when the application has loaded and is ready to run. In this + /// method you should instantiate the window, load the UI into it and then make the window + /// visible. + /// + /// + /// You have 5 seconds to return from this method, or iOS will terminate your application. + /// + public override bool FinishedLaunching (UIApplication app, NSDictionary options) { + + // create a new window instance based on the screen size + window = new UIWindow (UIScreen.MainScreen.Bounds); + + // If you have defined a view, add it here: + + + // window.AddSubview (navigationController.View); + this._SysSoundViewController = new SysSoundViewController(); + this._SysSoundViewController.View.Frame = new RectangleF(0.0f, 20.0f, 320.0f, 460.0f); + this.window.AddSubview(this._SysSoundViewController.View); + + // make the window visible + window.MakeKeyAndVisible (); + + return true; + } + } +} diff --git a/SysSound/SysSound/Extensions/NSBundleExtensions.cs b/SysSound/SysSound/Extensions/NSBundleExtensions.cs new file mode 100644 index 00000000..93501d77 --- /dev/null +++ b/SysSound/SysSound/Extensions/NSBundleExtensions.cs @@ -0,0 +1,32 @@ +using System; +using MonoTouch.ObjCRuntime; +using MonoTouch.Foundation; + +namespace SysSound.Extensions { + + //helper methods for withing with bundles + public static class NSBundleExtensions { + private static readonly IntPtr _Selector_URLForResource = Selector.GetHandle ("URLForResource:withExtension:"); + + /// + /// Returns the file URL for the resource identified by the specified name and file extension. + /// + public static NSUrl URLForResource (this NSBundle source, string for_resource, string with_extension) { + var ns_for = new NSString(for_resource); + var ns_extension = new NSString(with_extension); + + //try and get the resource + var result = Messaging.IntPtr_objc_msgSend_IntPtr_IntPtr( + source.Handle, + NSBundleExtensions._Selector_URLForResource, + ns_for.Handle, + ns_extension.Handle); + + //return back as a NSUrl + return Runtime.GetNSObject(result) as NSUrl; + } + + } + +} + diff --git a/SysSound/SysSound/Info.plist b/SysSound/SysSound/Info.plist new file mode 100644 index 00000000..51efd267 --- /dev/null +++ b/SysSound/SysSound/Info.plist @@ -0,0 +1,12 @@ + + + + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/SysSound/SysSound/Main.cs b/SysSound/SysSound/Main.cs new file mode 100644 index 00000000..e92104c4 --- /dev/null +++ b/SysSound/SysSound/Main.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using MonoTouch.Foundation; +using MonoTouch.UIKit; + +namespace SysSound { + public class Application { + /// + /// This is the main entry point of the application. + /// + static void Main (string[] args) { + // if you want to use a different Application Delegate class from "AppDelegate" + // you can specify it here. + UIApplication.Main (args, null, "AppDelegate"); + } + } +} diff --git a/SysSound/SysSound/Sounds/tap.aif b/SysSound/SysSound/Sounds/tap.aif new file mode 100644 index 00000000..818676ef Binary files /dev/null and b/SysSound/SysSound/Sounds/tap.aif differ diff --git a/SysSound/SysSound/SysSound.csproj b/SysSound/SysSound/SysSound.csproj new file mode 100644 index 00000000..a8545769 --- /dev/null +++ b/SysSound/SysSound/SysSound.csproj @@ -0,0 +1,86 @@ + + + + Debug + iPhoneSimulator + 10.0.0 + 2.0 + {B538DD79-C235-4E39-B3E9-0F90A6D07F78} + {6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Exe + SysSound + SysSound + + + true + full + false + bin\iPhoneSimulator\Debug + DEBUG + prompt + 4 + false + None + true + + + none + false + bin\iPhoneSimulator\Release + prompt + 4 + false + None + + + true + full + false + bin\iPhone\Debug + DEBUG + prompt + 4 + false + true + iPhone Developer + + + none + false + bin\iPhone\Release + prompt + 4 + false + iPhone Developer + + + + + + + + + + + + + + + + SysSoundViewController.cs + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/SysSound/SysSound/SysSoundViewController.designer.cs b/SysSound/SysSound/SysSoundViewController.designer.cs new file mode 100644 index 00000000..454ee31a --- /dev/null +++ b/SysSound/SysSound/SysSoundViewController.designer.cs @@ -0,0 +1,23 @@ +// WARNING +// +// This file has been generated automatically by MonoDevelop to store outlets and +// actions made in the Xcode designer. If it is removed, they will be lost. +// Manual changes to this file may not be handled correctly. +// +using MonoTouch.Foundation; + +namespace SysSound +{ + [Register ("SysSoundViewController")] + partial class SysSoundViewController + { + [Action ("playSystemSound:")] + partial void playSystemSound (MonoTouch.Foundation.NSObject sender); + + [Action ("playAlertSound:")] + partial void playAlertSound (MonoTouch.Foundation.NSObject sender); + + [Action ("vibrate:")] + partial void vibrate (MonoTouch.Foundation.NSObject sender); + } +} diff --git a/SysSound/SysSound/SysSoundViewController.xib b/SysSound/SysSound/SysSoundViewController.xib new file mode 100644 index 00000000..d72de27b --- /dev/null +++ b/SysSound/SysSound/SysSoundViewController.xib @@ -0,0 +1,408 @@ + + + + 512 + 11B26 + 1617 + 1138 + 566.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 534 + + + YES + IBUINavigationItem + IBUIButton + IBUIView + IBUINavigationBar + IBProxyObject + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + YES + + + + + YES + + IBFilesOwner + IBCocoaTouchFramework + + + IBFirstResponder + IBCocoaTouchFramework + + + + 292 + + YES + + + 1316 + + {{20, 142}, {280, 37}} + + + + NO + NO + IBCocoaTouchFramework + 0 + 0 + + Helvetica-Bold + 15 + 16 + + 1 + System Sound + System Sound + System Sound + System Sound + + 1 + MSAxIDEAA + + + 3 + MAA + + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + + + + 1316 + + {{20, 197}, {280, 37}} + + + + NO + NO + IBCocoaTouchFramework + 0 + 0 + + 1 + Alert Sound + + + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + + + + 1828 + + {{20, 257}, {280, 37}} + + + + NO + NO + IBCocoaTouchFramework + 0 + 0 + + 1 + Vibration + Vibration + Vibration + Vibration + + + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + + + + 290 + {320, 44} + + + + NO + NO + IBCocoaTouchFramework + + YES + + + SysSound + IBCocoaTouchFramework + + + + + {320, 460} + + + + + IBCocoaTouchFramework + + + + + YES + + + view + + + + 3 + + + + playSystemSound: + + + 1 + + 25 + + + + playAlertSound: + + + 1 + + 26 + + + + vibrate: + + + 1 + + 28 + + + + + YES + + 0 + + + + + + 1 + + + YES + + + + + + + + + -1 + + + File's Owner + + + -2 + + + + + 6 + + + + + 11 + + + YES + + + + + + 12 + + + + + 13 + + + + + 15 + + + + + + + YES + + YES + -1.CustomClassName + -1.IBPluginDependency + -2.CustomClassName + -2.IBPluginDependency + 1.IBPluginDependency + 1.IBUserGuides + 11.IBPluginDependency + 12.IBPluginDependency + 13.IBAttributePlaceholdersKey + 13.IBPluginDependency + 15.IBAttributePlaceholdersKey + 15.IBPluginDependency + 6.IBAttributePlaceholdersKey + 6.IBPluginDependency + + + YES + SysSoundViewController + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + UIResponder + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + YES + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + YES + + + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + YES + + + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + YES + + + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + YES + + + + + + YES + + + + + 29 + + + + YES + + SysSoundViewController + UIViewController + + YES + + YES + playAlertSound: + playSystemSound: + vibrate: + + + YES + id + id + id + + + + YES + + YES + playAlertSound: + playSystemSound: + vibrate: + + + YES + + playAlertSound: + id + + + playSystemSound: + id + + + vibrate: + id + + + + + IBProjectSource + ./Classes/SysSoundViewController.h + + + + + 0 + IBCocoaTouchFramework + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + + + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 + + + YES + 3 + 534 + + diff --git a/SysSound/SysSound/SysSoundViewControllerController.cs b/SysSound/SysSound/SysSoundViewControllerController.cs new file mode 100644 index 00000000..6c3169fc --- /dev/null +++ b/SysSound/SysSound/SysSoundViewControllerController.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using MonoTouch.UIKit; +using MonoTouch.Foundation; +using SysSound.Extensions; +using MonoTouch.AudioToolbox; + +namespace SysSound { + + public partial class SysSoundViewController : UIViewController { + + //loads the SysSoundViewController.xib file and connects it to this object + public SysSoundViewController () + : base ("SysSoundViewController", null) { + } + + //holds the sound to play + private SystemSound _Sound; + + //prepares the audio + public override void ViewDidLoad () { + base.ViewDidLoad (); + + //enable audio + AudioSession.Initialize(); + + //load the sound + var url = NSBundle.MainBundle.URLForResource("tap", "aif"); + this._Sound = SystemSound.FromFile(url); + + } + + partial void playSystemSound(NSObject sender) { + this._Sound.PlaySystemSound(); + } + + partial void playAlertSound (NSObject sender) { + this._Sound.PlayAlertSound(); + } + + partial void vibrate (NSObject sender) { + SystemSound.Vibrate.PlaySystemSound(); + } + + } + + +} diff --git a/SysSound/SysSound/obj/.DS_Store b/SysSound/SysSound/obj/.DS_Store new file mode 100644 index 00000000..5a151172 Binary files /dev/null and b/SysSound/SysSound/obj/.DS_Store differ diff --git a/SysSound/SysSound/obj/Xcode/.DS_Store b/SysSound/SysSound/obj/Xcode/.DS_Store new file mode 100644 index 00000000..580af604 Binary files /dev/null and b/SysSound/SysSound/obj/Xcode/.DS_Store differ diff --git a/SysSound/SysSound/obj/Xcode/1/.DS_Store b/SysSound/SysSound/obj/Xcode/1/.DS_Store new file mode 100644 index 00000000..914b8a62 Binary files /dev/null and b/SysSound/SysSound/obj/Xcode/1/.DS_Store differ diff --git a/SysSound/SysSound/obj/Xcode/1/Images/background.png b/SysSound/SysSound/obj/Xcode/1/Images/background.png new file mode 100644 index 00000000..1fe70609 Binary files /dev/null and b/SysSound/SysSound/obj/Xcode/1/Images/background.png differ