Khris said:...
*In his best Scotty voice from Star Trek IV:
"Hello Computer"
"WORKING"
"Volume Up"
"WORKING"
Yes - All the while holding and speaking into the mouse. Priceless!
Khris said:...
*In his best Scotty voice from Star Trek IV:
"Hello Computer"
"WORKING"
"Volume Up"
"WORKING"
Then the next step would be audio sound feedback (using Majel Barrett Roddenberry - sound clips) for each command - that would be cool! Yes - I know... Not permitted due to copyright. But it still would be cool!
guilhem said:In the french forum we found a bug. When you have this plugin running and you use a contextual display ( F9 ), MediaPortal froze and the only thing we can do it's to kill it.
So if you have any idea or if somebody know how the modal dialog are implemented thanks to help me.
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using MediaPortal.GUI.Library;
using ACTIVELISTENPROJECTLib;
namespace TelecommandeVocale
{
public class Main : ISetupForm, IPlugin
{
// ******************************************
// *** D2claration
// ******************************************
private const String CRLF = "\r\n";
private DirectSRClass _vcrVoice = new DirectSRClass();
private String _speechGrammer = "[Grammar]" + CRLF +
"langid = 1033" + CRLF +
"type=cfg" + CRLF +
"[<Start>]" + CRLF +
"<start>=tv down" + CRLF +
"<start>=tv up" + CRLF +
"<start>=tv left" + CRLF +
"<start>=tv enter" + CRLF +
"<start>=tv right" + CRLF +
"<start>=tv back" + CRLF
;
//
// Constructeur
public Main()
{
}
// ******************************************
// *** Partie du formulaire du SETUP
// ******************************************
#region ISetupForm Members
// Returns the name of the plugin which is shown in the plugin menu
public string PluginName()
{
return "Telecommande Vocale";
}
// Returns the description of the plugin is shown in the plugin menu
public string Description()
{
return "Télécommander MP à la voix";
}
// Returns the author of the plugin which is shown in the plugin menu
public string Author()
{
return "Guilhem";
}
// show the setup dialog
public void ShowPlugin()
{
MessageBox.Show("Non encore implementé");
}
// Indicates whether plugin can be enabled/disabled
public bool CanEnable()
{
return true;
}
// get ID of windowplugin belonging to this setup
public int GetWindowId()
{
return 6780;
}
// Indicates if plugin is enabled by default;
public bool DefaultEnabled()
{
return true;
}
// indicates if a plugin has its own setup screen
public bool HasSetup()
{
return true;
}
/// <summary>
/// If the plugin should have its own button on the main menu of Media Portal then it
/// should return true to this method, otherwise if it should not be on home
/// it should return false
/// </summary>
/// <param name="strButtonText">text the button should have</param>
/// <param name="strButtonImage">image for the button, or empty for default</param>
/// <param name="strButtonImageFocus">image for the button, or empty for default</param>
/// <param name="strPictureImage">subpicture for the button or empty for none</param>
/// <returns>true : plugin needs its own button on home
/// false : plugin does not need its own button on home</returns>
public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage)
{
strButtonText = PluginName();
strButtonImage = String.Empty;
strButtonImageFocus = String.Empty;
strPictureImage = String.Empty;
return true;
}
#endregion
// ******************************************
// *** Plugin process
// ******************************************
#region IPlugin Members
public void Start()
{
_vcrVoice.GrammarFromString(_speechGrammer);
_vcrVoice.Activate();
_vcrVoice.PhraseFinish += new _DirectSREvents_PhraseFinishEventHandler(vcrVoice_PhraseFinish);
}
public void Stop()
{
_vcrVoice.Deactivate();
}
#endregion
// ******************************************
// *** TELECOMMANDE
// ******************************************
/// <summary>
/// Gestion de l'action
/// </summary>
/// <param name="flags"></param>
/// <param name="beginhi"></param>
/// <param name="beginlo"></param>
/// <param name="endhi"></param>
/// <param name="endlo"></param>
/// <param name="Phrase"></param>
/// <param name="parsed"></param>
/// <param name="results"></param>
public void vcrVoice_PhraseFinish(int flags, int beginhi, int beginlo, int endhi, int endlo, String Phrase, String parsed, int results)
{
switch (Phrase)
{
case "tv down":
SendKeys.Send("{DOWN}");
break;
case "tv up":
SendKeys.Send("{UP}");
break;
case "tv left":
SendKeys.Send("{LEFT}");
break;
case "tv right":
SendKeys.Send("{RIGHT}");
break;
case "tv enter":
SendKeys.Send("{ENTER}");
break;
case "tv back":
SendKeys.Send("{ESC}");
break;
}
}
}
}
mPod said:Use SendKeys.SendWait.
But another suggestion: Use the InputMapper in Core/InputDevices/InputHandler.cs. This makes it possible that your commands are user-configurable at the end. See for example the Hauppauge or X10 remotes how this can be used. For the mapping editor, see MediaPortal.Configuration/Sections/Remote.cs.
This makes your plugin much more flexible at the end.