* added ne wproject + deleted old one

* added assets + fix simulator crash

* updated formatting

* updated screenshots
This commit is contained in:
Mykyta Bondarenko 2018-12-07 06:26:28 +02:00 коммит произвёл Craig Dunn
Родитель 2e9220aba8
Коммит bca7e699df
52 изменённых файлов: 922 добавлений и 600 удалений

Двоичные данные
Sound/Screenshots/01.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 40 KiB

Двоичные данные
Sound/Screenshots/02.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 40 KiB

Двоичные данные
Sound/Screenshots/03.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 40 KiB

Двоичные данные
Sound/Screenshots/04.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 86 KiB

Двоичные данные
Sound/Screenshots/screenshot-1.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 65 KiB

Двоичные данные
Sound/Screenshots/screenshot-2.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 68 KiB

Двоичные данные
Sound/Screenshots/screenshot-3.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 72 KiB

Двоичные данные
Sound/Screenshots/screenshot-4.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 65 KiB

Просмотреть файл

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sound", "Sound\Sound.csproj", "{55F46846-CDA1-4BC2-9C40-0458BC6F909C}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sound", "Sound\Sound.csproj", "{A31153BC-4CD6-497B-B5BA-D1921CDF5F27}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -11,14 +11,14 @@ Global
Release|iPhone = Release|iPhone
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{55F46846-CDA1-4BC2-9C40-0458BC6F909C}.Debug|iPhone.ActiveCfg = Debug|iPhone
{55F46846-CDA1-4BC2-9C40-0458BC6F909C}.Debug|iPhone.Build.0 = Debug|iPhone
{55F46846-CDA1-4BC2-9C40-0458BC6F909C}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{55F46846-CDA1-4BC2-9C40-0458BC6F909C}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{55F46846-CDA1-4BC2-9C40-0458BC6F909C}.Release|iPhone.ActiveCfg = Release|iPhone
{55F46846-CDA1-4BC2-9C40-0458BC6F909C}.Release|iPhone.Build.0 = Release|iPhone
{55F46846-CDA1-4BC2-9C40-0458BC6F909C}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{55F46846-CDA1-4BC2-9C40-0458BC6F909C}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
{A31153BC-4CD6-497B-B5BA-D1921CDF5F27}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{A31153BC-4CD6-497B-B5BA-D1921CDF5F27}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{A31153BC-4CD6-497B-B5BA-D1921CDF5F27}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{A31153BC-4CD6-497B-B5BA-D1921CDF5F27}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
{A31153BC-4CD6-497B-B5BA-D1921CDF5F27}.Debug|iPhone.ActiveCfg = Debug|iPhone
{A31153BC-4CD6-497B-B5BA-D1921CDF5F27}.Debug|iPhone.Build.0 = Debug|iPhone
{A31153BC-4CD6-497B-B5BA-D1921CDF5F27}.Release|iPhone.ActiveCfg = Release|iPhone
{A31153BC-4CD6-497B-B5BA-D1921CDF5F27}.Release|iPhone.Build.0 = Release|iPhone
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = Sound\Sound.csproj

Просмотреть файл

@ -1,12 +1,21 @@
using Foundation;
using Foundation;
using UIKit;
namespace Sound
{
[Register ("AppDelegate")]
public class AppDelegate : UIApplicationDelegate
{
public override UIWindow Window { get; set; }
}
}
// 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 class AppDelegate : UIApplicationDelegate
{
public override UIWindow Window { get; set; }
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
{
// Override point for customization after application launch.
// If not required for your application you can safely delete this method
return true;
}
}
}

Просмотреть файл

@ -0,0 +1,244 @@
{
"images": [
{
"size": "20x20",
"scale": "2x",
"idiom": "iphone"
},
{
"size": "20x20",
"scale": "3x",
"idiom": "iphone"
},
{
"filename": "icon-spotlight-29@2x.png",
"size": "29x29",
"scale": "2x",
"idiom": "iphone"
},
{
"filename": "icon-spotlight-29@3x.png",
"size": "29x29",
"scale": "3x",
"idiom": "iphone"
},
{
"filename": "icon-spotlight-40@2x.png",
"size": "40x40",
"scale": "2x",
"idiom": "iphone"
},
{
"filename": "icon-spotlight-40@3x.png",
"size": "40x40",
"scale": "3x",
"idiom": "iphone"
},
{
"filename": "icon-app-60@2x.png",
"size": "60x60",
"scale": "2x",
"idiom": "iphone"
},
{
"filename": "Icon-app-60@3x.png",
"size": "60x60",
"scale": "3x",
"idiom": "iphone"
},
{
"size": "20x20",
"scale": "1x",
"idiom": "ipad"
},
{
"size": "20x20",
"scale": "2x",
"idiom": "ipad"
},
{
"filename": "icon-spotlight-29.png",
"size": "29x29",
"scale": "1x",
"idiom": "ipad"
},
{
"filename": "icon-spotlight-29@2x.png",
"size": "29x29",
"scale": "2x",
"idiom": "ipad"
},
{
"size": "40x40",
"scale": "1x",
"idiom": "ipad"
},
{
"filename": "icon-spotlight-40@2x.png",
"size": "40x40",
"scale": "2x",
"idiom": "ipad"
},
{
"filename": "Icon-app-83.5@2x.png",
"size": "83.5x83.5",
"scale": "2x",
"idiom": "ipad"
},
{
"filename": "icon-app-76.png",
"size": "76x76",
"scale": "1x",
"idiom": "ipad"
},
{
"filename": "icon-app-76@2x.png",
"size": "76x76",
"scale": "2x",
"idiom": "ipad"
},
{
"filename": "app-store-logo.png",
"size": "1024x1024",
"scale": "1x",
"idiom": "ios-marketing"
},
{
"size": "60x60",
"scale": "2x",
"idiom": "car"
},
{
"size": "60x60",
"scale": "3x",
"idiom": "car"
},
{
"role": "notificationCenter",
"size": "24x24",
"subtype": "38mm",
"scale": "2x",
"idiom": "watch"
},
{
"role": "notificationCenter",
"size": "27.5x27.5",
"subtype": "42mm",
"scale": "2x",
"idiom": "watch"
},
{
"role": "companionSettings",
"size": "29x29",
"scale": "2x",
"idiom": "watch"
},
{
"role": "companionSettings",
"size": "29x29",
"scale": "3x",
"idiom": "watch"
},
{
"role": "appLauncher",
"size": "40x40",
"subtype": "38mm",
"scale": "2x",
"idiom": "watch"
},
{
"role": "appLauncher",
"size": "44x44",
"subtype": "40mm",
"scale": "2x",
"idiom": "watch"
},
{
"role": "appLauncher",
"size": "50x50",
"subtype": "44mm",
"scale": "2x",
"idiom": "watch"
},
{
"role": "quickLook",
"size": "86x86",
"subtype": "38mm",
"scale": "2x",
"idiom": "watch"
},
{
"role": "quickLook",
"size": "98x98",
"subtype": "42mm",
"scale": "2x",
"idiom": "watch"
},
{
"role": "quickLook",
"size": "108x108",
"subtype": "44mm",
"scale": "2x",
"idiom": "watch"
},
{
"size": "1024x1024",
"scale": "1x",
"idiom": "watch-marketing"
},
{
"size": "16x16",
"scale": "1x",
"idiom": "mac"
},
{
"size": "16x16",
"scale": "2x",
"idiom": "mac"
},
{
"size": "32x32",
"scale": "1x",
"idiom": "mac"
},
{
"size": "32x32",
"scale": "2x",
"idiom": "mac"
},
{
"size": "128x128",
"scale": "1x",
"idiom": "mac"
},
{
"size": "128x128",
"scale": "2x",
"idiom": "mac"
},
{
"size": "256x256",
"scale": "1x",
"idiom": "mac"
},
{
"size": "256x256",
"scale": "2x",
"idiom": "mac"
},
{
"size": "512x512",
"scale": "1x",
"idiom": "mac"
},
{
"size": "512x512",
"scale": "2x",
"idiom": "mac"
}
],
"info": {
"version": 1,
"author": "xcode"
}
}

Двоичные данные
Sound/Sound/Assets.xcassets/AppIcon.appiconset/Icon-app-60@3x.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 5.0 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 8.6 KiB

Двоичные данные
Sound/Sound/Assets.xcassets/AppIcon.appiconset/app-store-logo.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 22 KiB

Двоичные данные
Sound/Sound/Assets.xcassets/AppIcon.appiconset/icon-app-60@2x.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 3.3 KiB

Двоичные данные
Sound/Sound/Assets.xcassets/AppIcon.appiconset/icon-app-76.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.0 KiB

Двоичные данные
Sound/Sound/Assets.xcassets/AppIcon.appiconset/icon-app-76@2x.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 4.3 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 900 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.8 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.5 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.2 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 3.3 KiB

Просмотреть файл

@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Просмотреть файл

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
</dict>
</plist>

Просмотреть файл

@ -1,51 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<key>CFBundleName</key>
<string>Sound</string>
<key>CFBundleIconFiles</key>
<array>
<string>Resources/icon-57.png</string>
<string>Resources/icon-114.png</string>
<string>Resources/icon-72.png</string>
<string>Resources/icon-144.png</string>
<string>Resources/icon-29.png</string>
<string>Resources/icon-58.png</string>
<string>Resources/icon-50.png</string>
<string>Resources/icon-100.png</string>
</array>
<key>CFBundleIdentifier</key>
<string>com.xamarin.sound</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>MinimumOSVersion</key>
<string>9.0</string>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>CFBundleIdentifier</key>
<string>com.xamarin.sound</string>
<key>CFBundleShortVersionString</key>
<string>1</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>MinimumOSVersion</key>
<string>9.0</string>
<key>UIMainStoryboardFile</key>
<string>SoundViewControllerIPhone</string>
<key>UIMainStoryboardFile~ipad</key>
<string>SoundViewControllerIPad</string>
<key>CFBundleName</key>
<string>Sound</string>
<key>XSAppIconAssets</key>
<string>Assets.xcassets/AppIcon.appiconset</string>
<key>NSMicrophoneUsageDescription</key>
<string>This app needs access to the mic to rec sounds.</string>
</dict>

Просмотреть файл

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Xamarin" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="FUS-9F-WOK">
<rect key="frame" x="117" y="319" width="142" height="48"/>
<fontDescription key="fontDescription" type="system" pointSize="40"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="FUS-9F-WOK" firstAttribute="centerX" secondItem="xhD-1C-HfJ" secondAttribute="centerX" id="fgY-fC-Jn9"/>
<constraint firstItem="FUS-9F-WOK" firstAttribute="centerY" secondItem="xhD-1C-HfJ" secondAttribute="centerY" id="r2m-s3-7Wj"/>
</constraints>
<viewLayoutGuide key="safeArea" id="xhD-1C-HfJ"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>

Просмотреть файл

@ -1,15 +1,15 @@
using UIKit;
using UIKit;
namespace Sound
{
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");
}
}
}
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");
}
}
}

Просмотреть файл

@ -0,0 +1,94 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Recording and Playing Sound" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SNu-rH-RdL">
<rect key="frame" x="16" y="36" width="224" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="6CM-J7-bZ9">
<rect key="frame" x="16" y="89" width="120" height="33"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<state key="normal" title="Start Recording"/>
<connections>
<action selector="StartRecording:" destination="BYZ-38-t0r" eventType="touchUpInside" id="233"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="aZb-o8-sGM">
<rect key="frame" x="16" y="130" width="134" height="33"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<state key="normal" title="Stop Recordering"/>
<connections>
<action selector="StopRecording:" destination="BYZ-38-t0r" eventType="touchUpInside" id="251"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="IlG-d5-omK">
<rect key="frame" x="16" y="171" width="164" height="33"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<state key="normal" title="Play Recorded Sound"/>
<connections>
<action selector="PlayRecorded:" destination="BYZ-38-t0r" eventType="touchUpInside" id="269"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="[status]" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="F7M-dg-IZM">
<rect key="frame" x="299" y="95" width="60" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="[lengh]" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="379-Ra-b6N">
<rect key="frame" x="304" y="136" width="55" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="IlG-d5-omK" firstAttribute="leading" secondItem="IO7-m7-ZIF" secondAttribute="leading" constant="16" id="82K-r1-ywz"/>
<constraint firstItem="IO7-m7-ZIF" firstAttribute="trailing" secondItem="F7M-dg-IZM" secondAttribute="trailing" constant="16" id="G1C-Ix-KAv"/>
<constraint firstItem="aZb-o8-sGM" firstAttribute="top" secondItem="6CM-J7-bZ9" secondAttribute="bottom" constant="8" id="H13-g8-GlM"/>
<constraint firstItem="SNu-rH-RdL" firstAttribute="leading" secondItem="IO7-m7-ZIF" secondAttribute="leading" constant="16" id="Kj2-sV-5tU"/>
<constraint firstItem="379-Ra-b6N" firstAttribute="centerY" secondItem="aZb-o8-sGM" secondAttribute="centerY" id="Oet-kq-AEX"/>
<constraint firstItem="6CM-J7-bZ9" firstAttribute="leading" secondItem="IO7-m7-ZIF" secondAttribute="leading" constant="16" id="Qg3-SU-feH"/>
<constraint firstItem="aZb-o8-sGM" firstAttribute="leading" secondItem="IO7-m7-ZIF" secondAttribute="leading" constant="16" id="QgG-mw-cmt"/>
<constraint firstItem="6CM-J7-bZ9" firstAttribute="top" secondItem="SNu-rH-RdL" secondAttribute="bottom" constant="32" id="TuR-1D-O9Q"/>
<constraint firstItem="F7M-dg-IZM" firstAttribute="centerY" secondItem="6CM-J7-bZ9" secondAttribute="centerY" id="cAT-HC-vON"/>
<constraint firstItem="IlG-d5-omK" firstAttribute="top" secondItem="aZb-o8-sGM" secondAttribute="bottom" constant="8" id="eGD-W0-JSh"/>
<constraint firstItem="SNu-rH-RdL" firstAttribute="top" secondItem="IO7-m7-ZIF" secondAttribute="top" constant="16" id="jPq-6j-mRm"/>
<constraint firstItem="IO7-m7-ZIF" firstAttribute="trailing" secondItem="379-Ra-b6N" secondAttribute="trailing" constant="16" id="kH6-xM-Jst"/>
</constraints>
<viewLayoutGuide key="safeArea" id="IO7-m7-ZIF"/>
</view>
<connections>
<outlet property="lenghtButton" destination="379-Ra-b6N" id="name-outlet-379-Ra-b6N"/>
<outlet property="playButton" destination="IlG-d5-omK" id="name-outlet-IlG-d5-omK"/>
<outlet property="startButton" destination="6CM-J7-bZ9" id="name-outlet-6CM-J7-bZ9"/>
<outlet property="statusLabel" destination="F7M-dg-IZM" id="name-outlet-F7M-dg-IZM"/>
<outlet property="stopButton" destination="aZb-o8-sGM" id="name-outlet-aZb-o8-sGM"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="0.0" y="0.0"/>
</scene>
</scenes>
</document>

Двоичные данные
Sound/Sound/Resources/Default-568h@2x.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 12 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 24 KiB

Двоичные данные
Sound/Sound/Resources/Default-Landscape~ipad.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 9.4 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 25 KiB

Двоичные данные
Sound/Sound/Resources/Default-Portrait~ipad.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 9.8 KiB

Двоичные данные
Sound/Sound/Resources/Default.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 5.2 KiB

Двоичные данные
Sound/Sound/Resources/Default@2x.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 12 KiB

Двоичные данные
Sound/Sound/Resources/iTunesArtwork.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 106 KiB

Двоичные данные
Sound/Sound/Resources/iTunesArtwork@2x.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 273 KiB

Двоичные данные
Sound/Sound/Resources/icon-100.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 11 KiB

Двоичные данные
Sound/Sound/Resources/icon-114.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 14 KiB

Двоичные данные
Sound/Sound/Resources/icon-144.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 18 KiB

Двоичные данные
Sound/Sound/Resources/icon-29.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 2.0 KiB

Двоичные данные
Sound/Sound/Resources/icon-50.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 4.2 KiB

Двоичные данные
Sound/Sound/Resources/icon-57.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 5.1 KiB

Двоичные данные
Sound/Sound/Resources/icon-58.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 5.2 KiB

Двоичные данные
Sound/Sound/Resources/icon-72.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 6.6 KiB

Просмотреть файл

@ -1,116 +1,128 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{55F46846-CDA1-4BC2-9C40-0458BC6F909C}</ProjectGuid>
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<RootNamespace>Sound</RootNamespace>
<AssemblyName>Sound</AssemblyName>
<TargetFrameworkIdentifier>Xamarin.iOS</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v1.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
<DebugSymbols>True</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>False</Optimize>
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>
<MtouchDebug>True</MtouchDebug>
<MtouchProfiling>True</MtouchProfiling>
<MtouchLink>None</MtouchLink>
<MtouchArch>x86_64</MtouchArch>
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<DebugType>none</DebugType>
<Optimize>False</Optimize>
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>
<MtouchLink>None</MtouchLink>
<MtouchArch>x86_64</MtouchArch>
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
<DebugSymbols>True</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>False</Optimize>
<OutputPath>bin\iPhone\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchDebug>True</MtouchDebug>
<MtouchProfiling>True</MtouchProfiling>
<IpaPackageName></IpaPackageName>
<MtouchI18n></MtouchI18n>
<MtouchArch>ARM64</MtouchArch>
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<DebugType>none</DebugType>
<Optimize>False</Optimize>
<OutputPath>bin\iPhone\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchArch>ARM64</MtouchArch>
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="Xamarin.iOS" />
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
</ItemGroup>
<ItemGroup>
<Compile Include="Main.cs" />
<Compile Include="AppDelegate.cs" />
<Compile Include="SoundViewController.cs" />
<Compile Include="SoundViewController.designer.cs">
<DependentUpon>SoundViewController.cs</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<InterfaceDefinition Include="SoundViewControllerIPhone.storyboard" />
<InterfaceDefinition Include="SoundViewControllerIPad.storyboard" />
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\Default-568h%402x.png" />
<BundleResource Include="Resources\Default-Landscape%402x~ipad.png" />
<BundleResource Include="Resources\Default-Landscape~ipad.png" />
<BundleResource Include="Resources\Default-Portrait%402x~ipad.png" />
<BundleResource Include="Resources\Default-Portrait~ipad.png" />
<BundleResource Include="Resources\Default.png" />
<BundleResource Include="Resources\Default%402x.png" />
<BundleResource Include="Resources\iTunesArtwork%402x.png" />
<BundleResource Include="Resources\icon-100.png" />
<BundleResource Include="Resources\icon-114.png" />
<BundleResource Include="Resources\icon-144.png" />
<BundleResource Include="Resources\icon-29.png" />
<BundleResource Include="Resources\icon-50.png" />
<BundleResource Include="Resources\icon-57.png" />
<BundleResource Include="Resources\icon-58.png" />
<BundleResource Include="Resources\icon-72.png" />
</ItemGroup>
<ItemGroup>
<ITunesArtwork Include="Resources\iTunesArtwork.png" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{A31153BC-4CD6-497B-B5BA-D1921CDF5F27}</ProjectGuid>
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<RootNamespace>Sound</RootNamespace>
<AssemblyName>Sound</AssemblyName>
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
<DefineConstants>DEBUG;ENABLE_TEST_CLOUD;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodesignKey>iPhone Developer</CodesignKey>
<DeviceSpecificBuild>true</DeviceSpecificBuild>
<MtouchDebug>true</MtouchDebug>
<MtouchNoSymbolStrip>true</MtouchNoSymbolStrip>
<MtouchFastDev>true</MtouchFastDev>
<MtouchFloat32>true</MtouchFloat32>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<IOSDebuggerPort>11857</IOSDebuggerPort>
<MtouchLink>None</MtouchLink>
<MtouchArch>x86_64</MtouchArch>
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
<MtouchVerbosity></MtouchVerbosity>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\iPhone\Release</OutputPath>
<DefineConstants></DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchUseLlvm>true</MtouchUseLlvm>
<MtouchFloat32>true</MtouchFloat32>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<MtouchLink>SdkOnly</MtouchLink>
<MtouchArch>ARM64</MtouchArch>
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
<MtouchVerbosity></MtouchVerbosity>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
<DefineConstants></DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchNoSymbolStrip>true</MtouchNoSymbolStrip>
<MtouchUseLlvm>true</MtouchUseLlvm>
<MtouchFloat32>true</MtouchFloat32>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<MtouchLink>None</MtouchLink>
<MtouchArch>x86_64</MtouchArch>
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
<MtouchVerbosity></MtouchVerbosity>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhone\Debug</OutputPath>
<DefineConstants>DEBUG;ENABLE_TEST_CLOUD;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodesignKey>iPhone Developer</CodesignKey>
<DeviceSpecificBuild>true</DeviceSpecificBuild>
<MtouchDebug>true</MtouchDebug>
<MtouchNoSymbolStrip>true</MtouchNoSymbolStrip>
<MtouchFastDev>true</MtouchFastDev>
<MtouchFloat32>true</MtouchFloat32>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<IOSDebuggerPort>45256</IOSDebuggerPort>
<MtouchLink>SdkOnly</MtouchLink>
<MtouchArch>ARM64</MtouchArch>
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
<MtouchVerbosity></MtouchVerbosity>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="Xamarin.iOS" />
</ItemGroup>
<ItemGroup>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Contents.json" />
<ImageAsset Include="Assets.xcassets\Contents.json" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\app-store-logo.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon-app-83.5%402x.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-app-76%402x.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-app-76.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-app-60%402x.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon-app-60%403x.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-spotlight-29.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-spotlight-29%402x.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-spotlight-29%403x.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-spotlight-40%402x.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\icon-spotlight-40%403x.png" />
</ItemGroup>
<ItemGroup>
<InterfaceDefinition Include="LaunchScreen.storyboard" />
<InterfaceDefinition Include="Main.storyboard" />
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
<None Include="Entitlements.plist" />
</ItemGroup>
<ItemGroup>
<Compile Include="Main.cs" />
<Compile Include="AppDelegate.cs" />
<Compile Include="ViewController.cs" />
<Compile Include="ViewController.designer.cs">
<DependentUpon>ViewController.cs</DependentUpon>
</Compile>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
</Project>

Просмотреть файл

@ -1,181 +0,0 @@
using System;
using System.IO;
using System.Diagnostics;
using UIKit;
using Foundation;
using AVFoundation;
namespace Sound
{
public partial class SoundViewController : UIViewController
{
AVAudioRecorder recorder;
AVPlayer player;
Stopwatch stopwatch;
NSUrl audioFilePath;
NSObject observer;
public SoundViewController (IntPtr handle)
: base(handle)
{
}
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
RecordingStatusLabel.Text = string.Empty;
LengthOfRecordingLabel.Text = string.Empty;
StartRecordingButton.TouchUpInside += OnStartRecording;
StopRecordingButton.TouchUpInside += OnStopRecording;
PlayRecordedSoundButton.TouchUpInside += OnPlayRecordedSound;
observer = AVPlayerItem.Notifications.ObserveDidPlayToEndTime (OnDidPlayToEndTime);
}
void OnStopRecording (object sender, EventArgs e)
{
if (recorder == null)
return;
recorder.Stop ();
stopwatch.Stop ();
LengthOfRecordingLabel.Text = string.Format ("{0:hh\\:mm\\:ss}", stopwatch.Elapsed);
RecordingStatusLabel.Text = "";
StartRecordingButton.Enabled = true;
StopRecordingButton.Enabled = false;
PlayRecordedSoundButton.Enabled = true;
}
void OnStartRecording (object sender, EventArgs e)
{
Console.WriteLine ("Begin Recording");
var session = AVAudioSession.SharedInstance ();
session.RequestRecordPermission (delegate (bool granted) {
Console.WriteLine ($"Audio Permission: {granted}");
if (granted) {
NSError error = null;
session.SetCategory (AVAudioSession.CategoryRecord, out error);
if (error != null) {
Console.WriteLine (error);
return;
}
session.SetActive (true, out error);
if (error != null) {
Console.WriteLine (error);
return;
}
if (!PrepareAudioRecording ()) {
RecordingStatusLabel.Text = "Error preparing";
return;
}
if (!recorder.Record ()) {
RecordingStatusLabel.Text = "Error preparing";
return;
}
stopwatch = new Stopwatch ();
stopwatch.Start ();
BeginInvokeOnMainThread (() => {
LengthOfRecordingLabel.Text = string.Empty;
RecordingStatusLabel.Text = "Recording";
StartRecordingButton.Enabled = false;
StopRecordingButton.Enabled = true;
PlayRecordedSoundButton.Enabled = false;
});
} else {
Console.WriteLine ("YOU MUST ENABLE MICROPHONE PERMISSION");
}
});
}
NSUrl CreateOutputUrl ()
{
string fileName = string.Format ("Myfile{0}.aac", DateTime.Now.ToString ("yyyyMMddHHmmss"));
string tempRecording = Path.Combine (Path.GetTempPath (), fileName);
return NSUrl.FromFilename (tempRecording);
}
void OnDidPlayToEndTime (object sender, NSNotificationEventArgs e)
{
player.Dispose ();
player = null;
}
void OnPlayRecordedSound (object sender, EventArgs e)
{
try {
Console.WriteLine ("Playing Back Recording {0}", audioFilePath);
// The following line prevents the audio from stopping
// when the device autolocks. will also make sure that it plays, even
// if the device is in mute
NSError error = null;
AVAudioSession.SharedInstance ().SetCategory (AVAudioSession.CategoryPlayback, out error);
if (error != null)
throw new Exception (error.DebugDescription);
player = new AVPlayer (audioFilePath);
player.Play ();
} catch (Exception ex) {
Console.WriteLine ("There was a problem playing back audio: ");
Console.WriteLine (ex.Message);
}
}
bool PrepareAudioRecording ()
{
audioFilePath = CreateOutputUrl ();
var audioSettings = new AudioSettings {
SampleRate = 44100,
Format = AudioToolbox.AudioFormatType.MPEG4AAC,
NumberChannels = 1,
AudioQuality = AVAudioQuality.High
};
//Set recorder parameters
NSError error;
recorder = AVAudioRecorder.Create (audioFilePath, audioSettings, out error);
if (error != null) {
Console.WriteLine (error);
return false;
}
//Set Recorder to Prepare To Record
if (!recorder.PrepareToRecord ()) {
recorder.Dispose ();
recorder = null;
return false;
}
recorder.FinishedRecording += OnFinishedRecording;
return true;
}
void OnFinishedRecording (object sender, AVStatusEventArgs e)
{
recorder.Dispose ();
recorder = null;
Console.WriteLine ("Done Recording (status: {0})", e.Status);
}
protected override void Dispose (bool disposing)
{
observer.Dispose ();
base.Dispose (disposing);
}
}
}

58
Sound/Sound/SoundViewController.designer.cs сгенерированный
Просмотреть файл

@ -1,58 +0,0 @@
// WARNING
//
// This file has been generated automatically by Xamarin Studio to store outlets and
// actions made in the UI designer. If it is removed, they will be lost.
// Manual changes to this file may not be handled correctly.
//
using Foundation;
using System.CodeDom.Compiler;
namespace Sound
{
[Register ("SoundViewController")]
partial class SoundViewController
{
[Outlet]
UIKit.UILabel LengthOfRecordingLabel { get; set; }
[Outlet]
UIKit.UIButton PlayRecordedSoundButton { get; set; }
[Outlet]
UIKit.UILabel RecordingStatusLabel { get; set; }
[Outlet]
UIKit.UIButton StartRecordingButton { get; set; }
[Outlet]
UIKit.UIButton StopRecordingButton { get; set; }
void ReleaseDesignerOutlets ()
{
if (StartRecordingButton != null) {
StartRecordingButton.Dispose ();
StartRecordingButton = null;
}
if (StopRecordingButton != null) {
StopRecordingButton.Dispose ();
StopRecordingButton = null;
}
if (PlayRecordedSoundButton != null) {
PlayRecordedSoundButton.Dispose ();
PlayRecordedSoundButton = null;
}
if (RecordingStatusLabel != null) {
RecordingStatusLabel.Dispose ();
RecordingStatusLabel = null;
}
if (LengthOfRecordingLabel != null) {
LengthOfRecordingLabel.Dispose ();
LengthOfRecordingLabel = null;
}
}
}
}

Просмотреть файл

@ -1,94 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6750" systemVersion="14D113c" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" useAutolayout="YES" initialViewController="Mnq-c5-2ET">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6735"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
</dependencies>
<scenes>
<!--Sound View Controller-->
<scene sceneID="96J-1g-2vQ">
<objects>
<viewController id="Mnq-c5-2ET" customClass="SoundViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="zyK-ob-Fbo"/>
<viewControllerLayoutGuide type="bottom" id="rx5-Bg-Szc"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ppt-vR-Hoi">
<rect key="frame" x="0.0" y="0.0" width="768" height="1024"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Recording and Playing Sound" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cW5-ED-kDz">
<rect key="frame" x="20" y="70" width="325" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="25"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="b86-7g-GD4">
<rect key="frame" x="20" y="170" width="138" height="36"/>
<fontDescription key="fontDescription" type="system" pointSize="20"/>
<state key="normal" title="Start Recording">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="MYe-A5-RZg">
<rect key="frame" x="20" y="256" width="138" height="36"/>
<fontDescription key="fontDescription" type="system" pointSize="20"/>
<state key="normal" title="Stop Recording">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="[status]" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="oZ7-x9-3ch">
<rect key="frame" x="345" y="176" width="64" height="24"/>
<fontDescription key="fontDescription" type="system" pointSize="20"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="[length of recording]" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hup-nn-eFD">
<rect key="frame" x="345" y="262" width="176" height="24"/>
<fontDescription key="fontDescription" type="system" pointSize="20"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="h3c-he-yD2">
<rect key="frame" x="20" y="342" width="193" height="36"/>
<fontDescription key="fontDescription" type="system" pointSize="20"/>
<state key="normal" title="Play Recorded Sound">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="b86-7g-GD4" firstAttribute="leading" secondItem="Ppt-vR-Hoi" secondAttribute="leadingMargin" id="4xV-85-aCA"/>
<constraint firstItem="MYe-A5-RZg" firstAttribute="leading" secondItem="Ppt-vR-Hoi" secondAttribute="leadingMargin" id="6Zt-MH-12f"/>
<constraint firstItem="cW5-ED-kDz" firstAttribute="top" secondItem="zyK-ob-Fbo" secondAttribute="bottom" constant="50" id="7IT-YK-23m"/>
<constraint firstItem="cW5-ED-kDz" firstAttribute="trailing" secondItem="oZ7-x9-3ch" secondAttribute="leading" id="8oQ-Fg-0Oy"/>
<constraint firstItem="cW5-ED-kDz" firstAttribute="trailing" secondItem="hup-nn-eFD" secondAttribute="leading" id="LLn-Mi-CNa"/>
<constraint firstItem="MYe-A5-RZg" firstAttribute="top" secondItem="b86-7g-GD4" secondAttribute="bottom" constant="50" id="bpi-fs-M7f"/>
<constraint firstItem="h3c-he-yD2" firstAttribute="leading" secondItem="Ppt-vR-Hoi" secondAttribute="leadingMargin" id="cCY-Nz-inc"/>
<constraint firstItem="cW5-ED-kDz" firstAttribute="leading" secondItem="Ppt-vR-Hoi" secondAttribute="leadingMargin" id="e6L-mO-BPg"/>
<constraint firstItem="MYe-A5-RZg" firstAttribute="centerY" secondItem="hup-nn-eFD" secondAttribute="centerY" id="odL-l6-4ni"/>
<constraint firstItem="h3c-he-yD2" firstAttribute="top" secondItem="MYe-A5-RZg" secondAttribute="bottom" constant="50" id="pBg-XG-Im8"/>
<constraint firstItem="b86-7g-GD4" firstAttribute="centerY" secondItem="oZ7-x9-3ch" secondAttribute="centerY" id="wBD-D7-wpd"/>
<constraint firstItem="b86-7g-GD4" firstAttribute="top" secondItem="cW5-ED-kDz" secondAttribute="bottom" constant="70" id="wx2-6m-bGQ"/>
</constraints>
</view>
<connections>
<outlet property="LengthOfRecordingLabel" destination="hup-nn-eFD" id="Oem-P6-gis"/>
<outlet property="PlayRecordedSoundButton" destination="h3c-he-yD2" id="1qv-5r-F7H"/>
<outlet property="RecordingStatusLabel" destination="oZ7-x9-3ch" id="nDK-pG-Hbc"/>
<outlet property="StartRecordingButton" destination="b86-7g-GD4" id="do3-Ut-pkd"/>
<outlet property="StopRecordingButton" destination="MYe-A5-RZg" id="Qce-Ua-gO9"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="9pW-65-ebP" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="483" y="530"/>
</scene>
</scenes>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar" statusBarStyle="lightContent"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination"/>
</simulatedMetricsContainer>
</document>

Просмотреть файл

@ -1,91 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6750" systemVersion="14D113c" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="gjP-Ja-ZW4">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6735"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
</dependencies>
<scenes>
<!--Sound View Controller-->
<scene sceneID="EvZ-Km-nQy">
<objects>
<viewController id="gjP-Ja-ZW4" customClass="SoundViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="dv1-Yj-SHi"/>
<viewControllerLayoutGuide type="bottom" id="OEW-GU-zZn"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="ER8-UG-Qs0">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Recording and Playing Sound" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="h6V-Hc-U4C">
<rect key="frame" x="16" y="40" width="228" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="FTs-ce-dxh">
<rect key="frame" x="16" y="111" width="108" height="30"/>
<state key="normal" title="Start Recording">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="SJK-Mi-bur">
<rect key="frame" x="16" y="171" width="108" height="30"/>
<state key="normal" title="Stop Recording">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="tdV-Nb-WC5">
<rect key="frame" x="16" y="231" width="150" height="30"/>
<state key="normal" title="Play Recorded Sound">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="[status]" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vjx-xt-lhq">
<rect key="frame" x="248" y="115" width="56" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="[length of recording]" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ymg-wB-LoZ">
<rect key="frame" x="150" y="175" width="154" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="vjx-xt-lhq" firstAttribute="trailing" secondItem="ER8-UG-Qs0" secondAttribute="trailingMargin" id="1sU-mf-A3i"/>
<constraint firstItem="SJK-Mi-bur" firstAttribute="leading" secondItem="ER8-UG-Qs0" secondAttribute="leadingMargin" id="69C-Ae-Wrr"/>
<constraint firstItem="ymg-wB-LoZ" firstAttribute="centerY" secondItem="SJK-Mi-bur" secondAttribute="centerY" id="Ktn-Bc-pxZ"/>
<constraint firstItem="FTs-ce-dxh" firstAttribute="centerY" secondItem="vjx-xt-lhq" secondAttribute="centerY" id="Lji-ZI-cWh"/>
<constraint firstItem="FTs-ce-dxh" firstAttribute="leading" secondItem="ER8-UG-Qs0" secondAttribute="leadingMargin" id="RE6-JN-16B"/>
<constraint firstItem="SJK-Mi-bur" firstAttribute="top" secondItem="FTs-ce-dxh" secondAttribute="bottom" constant="30" id="Vci-uY-H8p"/>
<constraint firstItem="h6V-Hc-U4C" firstAttribute="leading" secondItem="ER8-UG-Qs0" secondAttribute="leadingMargin" id="ZiN-Aj-1ug"/>
<constraint firstItem="tdV-Nb-WC5" firstAttribute="leading" secondItem="ER8-UG-Qs0" secondAttribute="leadingMargin" id="hpa-1c-ga9"/>
<constraint firstItem="ymg-wB-LoZ" firstAttribute="trailing" secondItem="ER8-UG-Qs0" secondAttribute="trailingMargin" id="o9Q-HT-7FP"/>
<constraint firstItem="h6V-Hc-U4C" firstAttribute="top" secondItem="ER8-UG-Qs0" secondAttribute="topMargin" constant="40" id="sfa-aM-MhP"/>
<constraint firstItem="tdV-Nb-WC5" firstAttribute="top" secondItem="SJK-Mi-bur" secondAttribute="bottom" constant="30" id="sid-9Y-4Xo"/>
<constraint firstItem="FTs-ce-dxh" firstAttribute="top" secondItem="h6V-Hc-U4C" secondAttribute="bottom" constant="50" id="xEu-B4-Ja7"/>
</constraints>
</view>
<connections>
<outlet property="LengthOfRecordingLabel" destination="ymg-wB-LoZ" id="Vkd-GH-gj2"/>
<outlet property="PlayRecordedSoundButton" destination="tdV-Nb-WC5" id="Q9G-Ed-drK"/>
<outlet property="RecordingStatusLabel" destination="vjx-xt-lhq" id="kYU-YW-im3"/>
<outlet property="StartRecordingButton" destination="FTs-ce-dxh" id="Tln-JL-8dE"/>
<outlet property="StopRecordingButton" destination="SJK-Mi-bur" id="Abd-nL-djL"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="cTm-8X-Obd" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="580" y="493"/>
</scene>
</scenes>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
</document>

Просмотреть файл

@ -0,0 +1,269 @@
using System;
using System.Diagnostics;
using System.IO;
using AVFoundation;
using Foundation;
using UIKit;
namespace Sound
{
public partial class ViewController : UIViewController
{
private NSObject observer;
private AVPlayer player;
private NSUrl audioFilePath;
private AVAudioRecorder recorder;
private Stopwatch stopwatch;
private Status status;
protected ViewController(IntPtr handle) : base(handle) { }
protected Status Status
{
get
{
return status;
}
set
{
if (status != value)
{
status = value;
UpdateUserInterface();
}
}
}
public override void ViewDidLoad()
{
base.ViewDidLoad();
playButton.Enabled = false;
stopButton.Enabled = false;
statusLabel.Text = string.Empty;
lenghtButton.Text = string.Empty;
observer = AVPlayerItem.Notifications.ObserveDidPlayToEndTime(OnDidPlayToEndTime);
}
private void UpdateUserInterface()
{
switch (status)
{
case Status.PreparingError:
statusLabel.Text = "Error preparing";
lenghtButton.Text = string.Empty;
startButton.Enabled = true;
stopButton.Enabled = false;
playButton.Enabled = false;
break;
case Status.Playing:
statusLabel.Text = "Playing";
startButton.Enabled = false;
stopButton.Enabled = false;
playButton.Enabled = false;
break;
case Status.Recording:
lenghtButton.Text = string.Empty;
statusLabel.Text = "Recording";
startButton.Enabled = false;
stopButton.Enabled = true;
playButton.Enabled = false;
break;
case Status.Recorded:
lenghtButton.Text = string.Format("{0:hh\\:mm\\:ss}", stopwatch.Elapsed);
statusLabel.Text = string.Empty;
startButton.Enabled = true;
stopButton.Enabled = false;
playButton.Enabled = true;
break;
}
}
partial void StartRecording(UIButton sender)
{
Console.WriteLine("Begin Recording");
var session = AVAudioSession.SharedInstance();
session.RequestRecordPermission((granted) =>
{
Console.WriteLine($"Audio Permission: {granted}");
if (granted)
{
session.SetCategory(AVAudioSession.CategoryRecord, out NSError error);
if (error == null)
{
session.SetActive(true, out error);
if (error != null)
{
Status = Status.PreparingError;
}
else
{
var isPrepared = PrepareAudioRecording() && recorder.Record();
if (isPrepared)
{
stopwatch = new Stopwatch();
stopwatch.Start();
Status = Status.Recording;
}
else
{
Status = Status.PreparingError;
}
}
}
else
{
Console.WriteLine(error.LocalizedDescription);
}
}
else
{
Console.WriteLine("YOU MUST ENABLE MICROPHONE PERMISSION");
}
});
}
partial void StopRecording(UIButton sender)
{
if (recorder != null)
{
recorder.Stop();
stopwatch?.Stop();
Status = Status.Recorded;
}
}
private NSUrl CreateOutputUrl()
{
var fileName = $"Myfile-{DateTime.Now.ToString("yyyyMMddHHmmss")}.aac";
var tempRecording = Path.Combine(Path.GetTempPath(), fileName);
return NSUrl.FromFilename(tempRecording);
}
private void OnDidPlayToEndTime(object sender, NSNotificationEventArgs e)
{
player.Dispose();
player = null;
Status = Status.Recorded;
}
partial void PlayRecorded(UIButton sender)
{
Console.WriteLine($"Playing Back Recording {audioFilePath}");
// The following line prevents the audio from stopping
// when the device autolocks. will also make sure that it plays, even
// if the device is in mute
AVAudioSession.SharedInstance().SetCategory(AVAudioSession.CategoryPlayback, out NSError error);
if (error == null)
{
Status = Status.Playing;
player = new AVPlayer(audioFilePath);
player.Play();
}
else
{
Status = Status.Recorded;
Console.WriteLine(error.LocalizedDescription);
}
}
private bool PrepareAudioRecording()
{
var result = false;
audioFilePath = CreateOutputUrl();
var audioSettings = new AudioSettings
{
SampleRate = 44100,
NumberChannels = 1,
AudioQuality = AVAudioQuality.High,
Format = AudioToolbox.AudioFormatType.MPEG4AAC,
};
// Set recorder parameters
recorder = AVAudioRecorder.Create(audioFilePath, audioSettings, out NSError error);
if (error == null)
{
// Set Recorder to Prepare To Record
if (!recorder.PrepareToRecord())
{
recorder.Dispose();
recorder = null;
}
else
{
recorder.FinishedRecording += OnFinishedRecording;
result = true;
}
}
else
{
Console.WriteLine(error.LocalizedDescription);
}
return result;
}
private void OnFinishedRecording(object sender, AVStatusEventArgs e)
{
recorder.Dispose();
recorder = null;
Console.WriteLine($"Done Recording (status: {e.Status})");
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (observer != null)
{
observer.Dispose();
observer = null;
}
if (player != null)
{
player.Dispose();
player = null;
}
if (recorder != null)
{
recorder.Dispose();
recorder = null;
}
if (audioFilePath != null)
{
audioFilePath.Dispose();
audioFilePath = null;
}
}
}
public enum Status
{
Unknown,
PreparingError,
Recording,
Recorded,
Playing,
}
}

76
Sound/Sound/ViewController.designer.cs сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,76 @@
// WARNING
//
// This file has been generated automatically by Visual Studio from the outlets and
// actions declared in your storyboard file.
// Manual changes to this file will not be maintained.
//
using Foundation;
using System;
using System.CodeDom.Compiler;
namespace Sound
{
[Register ("ViewController")]
partial class ViewController
{
[Outlet]
[GeneratedCode ("iOS Designer", "1.0")]
UIKit.UILabel lenghtButton { get; set; }
[Outlet]
[GeneratedCode ("iOS Designer", "1.0")]
UIKit.UIButton playButton { get; set; }
[Outlet]
[GeneratedCode ("iOS Designer", "1.0")]
UIKit.UIButton startButton { get; set; }
[Outlet]
[GeneratedCode ("iOS Designer", "1.0")]
UIKit.UILabel statusLabel { get; set; }
[Outlet]
[GeneratedCode ("iOS Designer", "1.0")]
UIKit.UIButton stopButton { get; set; }
[Action ("PlayRecorded:")]
[GeneratedCode ("iOS Designer", "1.0")]
partial void PlayRecorded (UIKit.UIButton sender);
[Action ("StartRecording:")]
[GeneratedCode ("iOS Designer", "1.0")]
partial void StartRecording (UIKit.UIButton sender);
[Action ("StopRecording:")]
[GeneratedCode ("iOS Designer", "1.0")]
partial void StopRecording (UIKit.UIButton sender);
void ReleaseDesignerOutlets ()
{
if (lenghtButton != null) {
lenghtButton.Dispose ();
lenghtButton = null;
}
if (playButton != null) {
playButton.Dispose ();
playButton = null;
}
if (startButton != null) {
startButton.Dispose ();
startButton = null;
}
if (statusLabel != null) {
statusLabel.Dispose ();
statusLabel = null;
}
if (stopButton != null) {
stopButton.Dispose ();
stopButton = null;
}
}
}
}