0

Xamarin example found here : http://docs.xamarin.com/samples/Sound works, but the GUI is not Monotouch.Dialog, and it looks poor together with the rest of my MD APP.

How to add a Monotouch.Dialog controller, to start and stop recording, and show the elapsed time while recording.

Apple made this http://developer.apple.com/library/ios/#samplecode/SpeakHere/Introduction/Intro.html with a VU meter included.

1 Answers1

3

Look at this class inside the Xamarin sample https://github.com/xamarin/monotouch-samples/blob/master/Sound/Sound/SoundViewController.cs

Basically, you would want to create you're own DialogViewController: You will need the using statements from the sample.

using MonoTouch.AVFoundation;
using System.Diagnostics;
using System.IO;
using MonoTouch.AudioToolbox;

public class SoundRecorder : DialogViewController {
    this.Title = "Record Sound";
    root = new RootElement() {
        new section () {
            new StringElement ("Record", delegate {
                // sound recording code from sample for the first button
            }
        }
    }
}

This should give you a start.

You may want to separate the elements and declare them separately like this:

StringElement myElement = new StyledStringElement("record something"); 

You can then subscribe to the tapped event with a delegate and handle the when a button is hit that way too. So that you can do a little more. For more styling choices you would want a StyledStringElement

Hope this helps

BRogers
  • 3,534
  • 4
  • 23
  • 32
  • You would also need the `MT.D` using statement as well – BRogers Mar 08 '13 at 19:19
  • Thanks Do you know how to make e stopwatch update an Element, while recording? – Claus Elmann Mar 19 '13 at 14:16
  • I thought that was in the code sample in the link. If not you would have to use a timer and keep updating the main threads UI. I believe I answered your initial post with my answer above. If so please mark it as the answer. Cheers ~Blake – BRogers Mar 20 '13 at 00:26