Hi,

It looks like VSSpeechSynthesizer doesn't have a getter method for the
delegate, only a setter.

Try the following:

class MyDelegate : VSSpeechSynthesizerDelegate
{
    override void DidFinishSpeaking(NSObject synth, bool success, IntPtr
error)
    {
    }
}

and then:

var del = new MyDelegate ();
var speech = new VSSpeechSynthesizer();
speech.WeakDelegate = del;

The support for using C# events cannot be used because it expects the
getter to work.

I hope this helps,
Rolf

On Mon, Jan 21, 2013 at 1:50 AM, alexgcuesoft <alexgcues...@gmail.com>wrote:

> I have a research project for which I need TTS.  I found that this
> functionality is found in a private framework.  I understand that this
> preclude it from showing up on the App Store, which is fine...this app
> won't
> be going the app store.
>
> In any case, I'm having some issues getting the delegate properly
> registered.  I'm getting the error message:
>
> 2013-01-20 17:29:48.338 BuildingNaviOS[9554:907] -[VSSpeechSynthesizer
> delegate]: unrecognized selector sent to instance 0x4493670
>
> when I try and subscribe to the event:
>
>                         speech = new VSSpeechSynthesizer();
>                         speech.DidFinishSpeaking += delegate( object
> sender,
> FinishSpeakingEventArgs args)
>                         {
>                                 IsSpeaking = false;
>                         };
>
> the speech part of it is working and the phone is talking.  I'm thinking
> that I'm missing something here in my bindings.  Do I have to provide the
> complete delegate in order for it to register correctly?  or will a partial
> delegate work? (i'm only interested in the finish speaking callback.)
>
> Here's my current definition...
>
>         [BaseType(typeof (NSObject), Delegates = new string[] {
> "WeakDelegate" },
> Events=new Type [] { typeof (VSSpeechSynthesizerDelegate) })]
>         public interface VSSpeechSynthesizer
>         {
>                 [Static, Export("isSystemSpeaking")]
>                 bool IsSystemSpeaking { get; }
>
>                 [Export("rate")]
>                 float Rate();
>
>                 [Export("setRate:")]
>                 void SetRate(float rate);
>
>                 [Export("pitch")]
>                 float Pitch();
>
>                 [Export("setPitch:")]
>                 void SetPitch(float pitch);
>
>                 [Export("volume")]
>                 float Volume();
>
>                 [Export("setVolume:")]
>                 void SetVolume(float volume);
>
>                 [Export("startSpeakingString:")]
>                 void StartSpeakingString([NullAllowed]string text);
>
>                 [Export("stopSpeaking")]
>                 void StopSpeaking();
>
>                 [Export ("delegate"), NullAllowed]
>                 NSObject WeakDelegate { get; set; }
>
>                 [Wrap ("WeakDelegate"), NullAllowed]
>                 VSSpeechSynthesizerDelegate Delegate { get; set; }
>         }
>
>         [BaseType (typeof (NSObject))]
>         public interface VSSpeechSynthesizerDelegate
>         {
>                 [Export("speechSynthesizer:didFinishSpeaking:withError:"),
> EventArgs("FinishSpeaking")]
>                 void DidFinishSpeaking(NSObject synth, bool success,
> IntPtr error);
>
>                 [Export("speechSynthesizer:didEncounterSyncMessage:"),
> EventArgs("EncounterSyncMessage")]
>                 void DidEncounterSyncMessage(NSObject sync, string
> message);
>
>
> [Export("speechSynthesizer:didEncounterErrorAtIndex:ofString:message:"),
> EventArgs("EncounterError")]
>                 void DidEncounterErrorAtIndex(NSObject sync, int index,
> string text,
> string message);
>
>                 [Export("speechSynthesizer:willSpeakWord:ofString:"),
> EventArgs("SpeakWord")]
>                 void WillSpeakWord(NSObject sync, NSRange range, string
> text);
>
>                 [Export("speechSynthesizer:willSpeakPhoneme:"),
> EventArgs("SpeakPhoneme")]
>                 void WillSpeakPhoneme(NSObject sync, short code);
>         }
>
>
> Any help is greatly appreciated!
>
> -Alex
>
>
>
>
> --
> View this message in context:
> http://monotouch.2284126.n4.nabble.com/Accessing-VSSpeechSynthesizer-engine-on-iPhone-tp4657969.html
> Sent from the MonoTouch mailing list archive at Nabble.com.
> _______________________________________________
> MonoTouch mailing list
> MonoTouch@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monotouch
>
_______________________________________________
MonoTouch mailing list
MonoTouch@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to