How to Handle Pause Event in SAPI Engine - sapi

I currently have a SAPI voice implemented which works fine. I would like to know how do I handle Pause event in the engine when the application calls ISpVoice->Pause.

As near as I can tell, ISpVoice::Pause is implemented entirely in the SAPI layer and doesn't make any engine calls.

I'm trying to understand exactly what your end goal is, but I think I'll take a stab at answering this.
For voices, pause does the following according to MSDN:
ISpVoice::Pause pauses the voice at the nearest alert boundary and closes the output device, allowing access to pending speak requests from other voices.
Assuming you've used the speak call with SPF_AYSNC, you might also have to also set event interests and alert boundaries as seen here
Where the example shows handling bookmark alert boundaries
'Create a Normal Priority voice - male
Set objHIM = New SpVoice
Set objHIM.Voice = objHIM.GetVoices("gender=male").Item(0)
objHER.Speak "the priority of this voice is S V P alert"
objHIM.Speak "the priority of this voice is S V P normal"
objHIM.EventInterests = SVEBookmark 'Receive bookmark events only
objHIM.AlertBoundary = SVEPhoneme 'Let alert voices interrupt words
'Normal voice speaks text which generates events.
strSpeak = "This is text that contains bookmarks " _
& "for the purpose of generating events."
objHIM.Speak strSpeak, SVSFIsXML + SVSFlagsAsync

Related

Console application - first Message Box is not focused

I am in the process of developing a VB.Net console app to get ID & password from users and should pop a message when invalid ID or password is entered, but I am stuck with a peculiar behavior observed while using Message box in console app. When the first message box is shown, its Out-Of-Focus & we explicitly need to bring the message box to focus. But the next subsequent message boxes are In-Focus.
Below is just the sample code.
Sub Main()
Start:
Console.WriteLine("Press Enter")
Console.ReadLine()
MsgBox("Good Day")
GoTo Start
End Sub
Just want to know why such thing is happening & what should be done so the first message box also will be In-Focus.?
You can use the MessageBoxOptions.ServiceNotification to show the dialog on top.
This is converted from a C# application, so not exactly sure if this is correct VB.NET (it should be though):
MsgBox( "Good Day"
, ""
, MessageBoxButtons.OK
, MessageBoxIcon.Asterisk
, MessageBoxDefaultButton.Button1
, MessageBoxOptions.ServiceNotification
)
But note this:
You shouldn't use a MessageBox inside a Console application. These are just two different worlds.
To explain why:
What do you expect when you run this application remotely using the console? There is no way to show that messagebox then. Use Console.WriteLine, but with different coloring if you want to show something is in error, or a warning, or something good.

Record and view video at the same time DirectShow

I have used the sample code of DirectShow in order to record a video. however, I want to display the video during recording as well. But I can't do it at the same time, this error always shows:
' Const VIDEODEVICE As Integer = 0
' zero based index of video capture device to use
Cursor.Current = Cursors.WaitCursor
If cam Is Nothing Then
cam = New AsfFilter.Capture(VIDEODEVICE, textBox1.Text)
previewCamera(PictureBox1) <----- this is my code regarding on previewing the video recording.
cam.Start()
button1.Text = "Stop"
textBox1.[ReadOnly] = True
Else
button1.Text = "Start"
textBox1.[ReadOnly] = False
' Pause the recording
cam.Pause()
' Close it down
cam.Dispose()
cam = Nothing
End If
Cursor.Current = Cursors.[Default]
Error:
Insufficient system resources exist to complete the requested service. (Exception from HRESULT: 0x800705AA)
What am I doing wrong? Did somebody know of this?
0x800705AA: ERROR_NO_SYSTEM_RESOURCES "Insufficient system resources exist to complete the requested service."
Here is the thing you need to know: video capture devices are exclusive access resources. You use it once, you cannot use it simultaneously again on another filter graph (that is, one graph for recording, and another one for monitoring). You have to have single filter graph to host video capture. From there, you can either use Smart Tee Filter, or Infinite Pin Tee Filter to duplicate the video feed on recording and monitoring legs. Or, alternatively, use multigraph solution with still video capture taking place on single graph.

Save and retrieve multiple videos to local storage?

I'm using the sample app from microsoft here:
http://msdn.microsoft.com/en-us/library/hh394041(v=vs.92).aspx
as a starting point to develop an app that allows the user to record multiple videos in the app to a collection.
What is the best way to accomplish this? I noticed that the example uses a fileSink object to specify the capture source and file name in isolated storage.
Private Sub StartVideoRecording()
Try
' Connect fileSink to captureSource.
If captureSource.VideoCaptureDevice IsNot Nothing AndAlso captureSource.State = CaptureState.Started Then
captureSource.Stop()
' Connect the input and output of fileSink.
fileSink.CaptureSource = captureSource
fileSink.IsolatedStorageFileName = isoVideoFileName
End If
' Begin recording.
If captureSource.VideoCaptureDevice IsNot Nothing AndAlso captureSource.State = CaptureState.Stopped Then
captureSource.Start()
End If
' Set the button states and the message.
UpdateUI(ButtonState.Recording, "Recording...")
' If recording fails, display an error.
Catch e As Exception
Me.Dispatcher.BeginInvoke(Sub() txtDebug.Text = "ERROR: " & e.Message.ToString())
End Try
End Sub
How would I then query that collection and allow the user to select that video for viewing in a listview? Is there no way to specify a folder to keep the video files organized?
Just looking for some advice on best practices to get this done. I wanted to use a video chooser that would allow the user to choose a video from their photo roll, but Windows Phone doesn't currently allow this.....
Well, is there any need to use a folder? noone can browse the ISO storage, so I see no need for folders :).
Using that tutorial, two files are created: "CameraMovie.mp4" and "CameraMovie.mp4.jpg" (the jpg is at least created on my phone, use ISETool to see the content of the ISO storage).
To record multiple videos, you would have to rename the filename each time
private string isoVideoFileName = "CameraMovie.mp4";
// reset the name when the recording starts
isoVideoFileName = DateTime.Now.ToString("yyyy-MM-dd_HH_mm") + ".mp4";
just change that variable when you start recording.
At the end of each recording, add the name of the video to a list, and once a video is added, you save the list (also to the ISO storage).
While loading the app, you load the list from the ISO, use the jpg's to make video tiles (or w/e you wanna do with it ;))
Hope this will help you a little forward, if not you have found the solution yet.
note, im sorry for using C#, whereas you use VB. It is however that i dont know VB well enough to type it at will ;)

Quality Center: link to attachment

In HP Qualtiy Center,
I have a test case where I have attached some documents.
I want to call directly the attachment from other test cases(not the test case).
Can somebody help out?
You can define a custom action (which will appear as additional button), and use OTA API to retrieve attachments you want when user clicks on that icon.
(it's been a while since I worked with QC workflow, so apologies for possibly wrong syntax, but it demonstrates the idea)
Add new action button through UI (let's call it "getMyFiles"). After that catch event - user clicked the button:
Function ActionCanExecute(Action)
...
if Action = "getMyFiles"
getMyFiles
end if
...
End Function
Now retrieve the attachments and do whatever you want with them (e.g. open...copy...save somewhere)
Sub getMyFiles
Set tst = TDConnection.TestFactory.Item(##id of the test with attachments##)
Set attf = tst.Attachments
' From here you can do whatever you want with those attachments
' In my example I will just download them:
Set attLst = attf.NewList("")
For Each att In attLst
' Don't remember what those parameters mean (took from old example),
' so check OTA API guide
att.Load True, ""
Next
End Sub
That's about it

Use VBA to call a cellphone

About a year ago, a manager in another department brainstormed that I could code up some VBA to auto call me in the event one of my automated reports crashes. I laughed at the time, but my skills have improved considerably and I wonder if it's technically possible
(not that I'd actually do it, mind you. I like my early Saturday mornings workplace-free).
This would need:
1. Access to the internet (not a problem)
2. A means of connecting to some service to place the call, preferably free, lest I cost the company $10 a month (Skype?)
3. An automated voice (already exists on the standard Access install package)
What do you think?
Edited 08/24/2009 - Spacing added. No text was changed.
Do the simplest thing that could possibly work. In this case, making phonecalls is hard, but sending emails is easy.
Most cellphone providers expose a phone's mailbox (something like 555-867-5309#cellphoneprovider.com) to the internet, allowing you to send an email to that address and have it show up on your phone as a text message.
You can use Skype in combination with VBA. It's actually not that complicated and you will find a couple of samples written in VBScript on the Skype website. I don't know whether it is possible to actually play an audio file, but you can send SMS easily:
'// Create a Skype4COM object:
Set oSkype = WScript.CreateObject("Skype4COM.Skype", "Skype_")
'// Start the Skype client:
If Not oSkype.Client.IsRunning Then oSkype.Client.Start() End If
'// Send SMS:
Set oSMS = oSkype.SendSms("+1234567890", "Hello!")
WScript.Sleep(60000)
'// Message event handler:
Public Sub Skype_SmsMessageStatusChanged(ByRef aSms, ByVal aStatus)
WScript.Echo ">Sms " & aSms.Id & " status " & aStatus & " " & oSkype.Convert.SmsMessageStatusToText(aStatus)
End Sub
'// Target event handler:
Public Sub Skype_SmsTargetStatusChanged(ByRef aTarget, ByVal aStatus)
WScript.Echo ">Sms " & aTarget.Message.Id & " target " & aTarget.Number & " status " & aStatus & " " & oSkype.Convert.SmsTargetStatusToText(aStatus)
End Sub
If you have a old dial up modem, then you could (in 'old VB6 days) dial via the modem programmatically, however I'm not sure if its possible in VBA. The next challange would be to get the audio down the line.
I would suggest that you butcher a headless earphone & microphone that connects to phones, you could then take a 3.5mm audio jack from your PC speaker output and connect this to the headless earphone/microphone set, unless there are cables that already do that (possibly).
Then it would be a simple matter of coding up Microsofts 'text to speech' engine.
Darknight
http://chandoo.org/wp/2009/02/05/twitter-from-excel/. Set up a twitter account that pings your phone and create twitters with this.
It's not as easy as the email idea, but you could be the first person to tweet from Excel for a reason other than novelty.
Another quite simple option is to send yourself a text message which is almost but not quite as easy to do as sending an email, but much easier to recieve. Companies such as clickatell.com provide cheap web based text services with good api's where once you are signed up all you need do is call a URL and you can send a text message.
Well worth a try.