[Mono-bugs] [Bug 586875] wrapper managed-to-native crash
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Mon Mar 15 09:40:47 EDT 2010
http://bugzilla.novell.com/show_bug.cgi?id=586875
http://bugzilla.novell.com/show_bug.cgi?id=586875#c2
--- Comment #2 from Rick Gross <rickgross at mac.com> 2010-03-15 13:40:46 UTC ---
[Export("ThreadSay")]
void ThreadSay (object input)
{
using(var pool = new NSAutoreleasePool())
{
string textToSpeak = input.ToString();
try{
//while (audioPlayer!=null)
//{
//wait if already speaking
//}
var basedir = Path.Combine
(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "..");
var tmpdir = Path.Combine(basedir, "tmp");
string audioFilePath = Path.Combine(tmpdir, "foo.wav");
Debug.WriteLine("start TTS - " +
DateTime.Now.ToLongTimeString());
//TextToSpeech tts = new TextToSpeech();
var tts = new TextToSpeech();
tts.ConvertTextToWav(textToSpeak, audioFilePath,
2);//Was 2
Debug.WriteLine("end TTS - " +
DateTime.Now.ToLongTimeString());
//AVAudioPlayer audioPlayer = new
AVAudioPlayer(NSUrl.FromFilename(audioFilePath), null);
string volLevel = store.GetPref("volume");
if(volLevel=="")
{
volLevel="1";
}
var audioPlayer = AVAudioPlayer.FromUrl (new NSUrl
(audioFilePath, false));
//audioPlayer = AVAudioPlayer.FromUrl (new NSUrl
(audioFilePath, false));
audioPlayer.PrepareToPlay();
audioPlayer.Volume = store.volLevel;
//float.Parse(volLevel);
audioPlayer.Play();
}
catch(Exception ex)
{
Console.WriteLine(ex.Message.ToString());
}
}
}
--
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
More information about the mono-bugs
mailing list