Created
January 16, 2010 18:49
-
-
Save migueldeicaza/278950 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using MonoTouch.Foundation; | |
using MonoTouch.UIKit; | |
using MonoTouch.AddressBook; | |
using MonoTouch.AudioToolbox; | |
namespace Test | |
{ | |
public class Application | |
{ | |
static void Main (string[] args) | |
{ | |
UIApplication.Main (args); | |
} | |
} | |
public partial class AppDelegate : UIApplicationDelegate | |
{ | |
public AudioStreamBasicDescription SetupAudioFormat (AudioFormatType type) | |
{ | |
var desc = new AudioStreamBasicDescription (); | |
desc.Format = type; | |
desc.SampleRate = 44100; | |
desc.BytesPerFrame = 4; | |
desc.ChannelsPerFrame = 2; | |
if (type == AudioFormatType.LinearPCM){ | |
// Configure PCM | |
desc.FormatFlags = 12; // AudioFormatFlags.LinearPCMIsSignedInteger | AudioFormatFlags.LinearPCMIsPacked; | |
desc.BitsPerChannel = 16; | |
desc.BytesPerPacket = (desc.BitsPerChannel / 8) * desc.ChannelsPerFrame; | |
desc.FramesPerPacket = 1; | |
} | |
return desc; | |
} | |
public override bool FinishedLaunching (UIApplication app, NSDictionary options) | |
{ | |
AudioSession.Category = AudioSessionCategory.RecordAudio; | |
AudioSession.SetActive (true); | |
var desc = SetupAudioFormat (AudioFormatType.LinearPCM); | |
var capture = new InputAudioQueue (desc); | |
window.MakeKeyAndVisible (); | |
return true; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment