Skip to content

Commit

Permalink
Test Build 0.01
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Baykov committed Jul 5, 2014
1 parent 1a76a5a commit 68b5dea
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 35 deletions.
21 changes: 13 additions & 8 deletions GAVPI/GAVPI/VI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,24 @@ public class VI

SpeechSynthesizer vi_syn;
SpeechRecognitionEngine vi_sre;

ListView statusContainer; // listview in main form

public VI(VI_Profile profile, VI_Settings settings, ListView statusContainer)
public VI()
{

}
public void load_listen(VI_Profile profile, VI_Settings settings, ListView statusContainer)
{
this.profile = profile;
this.settings = settings;
this.statusContainer = statusContainer;
//get speech rec/syn prefs from settings

vi_syn = profile.synth;
vi_syn.SelectVoice(settings.voice_info);
vi_sre = new SpeechRecognitionEngine(settings.recognizer_info);

//--build grammar from vi_phrases
// more complex grammar later, let the speech engine fight over
// blurry phrases for now
GrammarBuilder phrases_grammar = new GrammarBuilder();

List<string> glossory = new List<string>();

foreach (VI_Phrase trigger in profile.Profile_Triggers)
{
glossory.Add(trigger.value);
Expand All @@ -59,6 +57,13 @@ public VI(VI_Profile profile, VI_Settings settings, ListView statusContainer)
vi_sre.SetInputToDefaultAudioDevice();
vi_sre.RecognizeAsync(RecognizeMode.Multiple);
}
public void stop_listen()
{
if (vi_sre!=null)
{
vi_sre.RecognizeAsyncStop();
}
}
private void phraseRecognized(object sender, SpeechRecognizedEventArgs e)
{
string recognized_value = e.Result.Text;
Expand Down
13 changes: 10 additions & 3 deletions GAVPI/GAVPI/VI_Profile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,15 @@ public void load_profile(string filename)
string action_type = action.Attributes.GetNamedItem("type").Value;
string action_value = action.Attributes.GetNamedItem("value").Value;
Type new_action_type = Type.GetType("GAVPI." + action_type );
object action_instance = Activator.CreateInstance(new_action_type, action_value);
object action_instance;
if (action_type == "Speak")
{
action_instance = Activator.CreateInstance(new_action_type,this.synth, action_value);
}
else
{
action_instance = Activator.CreateInstance(new_action_type, action_value);
}
ack_frm_file.Add((Action)action_instance);
}
if (!Profile_ActionSequences.Any(ack => ack.name == ack_frm_file.name))
Expand All @@ -116,9 +124,8 @@ public void load_profile(string filename)
string trigger_comment= element.Attributes.GetNamedItem("comment").Value;

Type new_trigger_type = Type.GetType("GAVPI." + trigger_type);
object trigger_isntance = Activator.CreateInstance(new_trigger_type, trigger_name , trigger_value);
object trigger_isntance = trigger_isntance = Activator.CreateInstance(new_trigger_type, trigger_name, trigger_value);
trig_frm_file = (VI_Trigger)trigger_isntance;

trig_frm_file.comment = trigger_comment;

// Trigger Events
Expand Down
15 changes: 13 additions & 2 deletions GAVPI/GAVPI/frmGAVPI.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 17 additions & 4 deletions GAVPI/GAVPI/frmGAVPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@ namespace GAVPI
{
public partial class frmGAVPI : Form
{
string BUILD_VERSION = "GAVPI Test Build 0.01 07.05.14";

VI_Settings vi_settings;
VI_Profile vi_profile;
VI virtualinterface;
VI vi;

public frmGAVPI()
{
InitializeComponent();

vi = new VI();
vi_settings = new VI_Settings();
vi_profile = new VI_Profile(vi_settings.current_profile_path);
}
Expand Down Expand Up @@ -61,8 +63,19 @@ private void mainStripSettings_Click(object sender, EventArgs e)

private void btnMainListen_Click(object sender, EventArgs e)
{
virtualinterface = new VI(vi_profile, vi_settings,lstMainHearing);
//btnMainListen.Enabled = false;
vi.load_listen(vi_profile, vi_settings, lstMainHearing);
btnMainListen.Enabled = false;
}

private void btnMainStop_Click(object sender, EventArgs e)
{
vi.stop_listen();
btnMainListen.Enabled = true;
}

private void mainStripAbout_Click(object sender, EventArgs e)
{
MessageBox.Show(BUILD_VERSION);
}
}
}
37 changes: 19 additions & 18 deletions GAVPI/GAVPI/frmProfile.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions GAVPI/GAVPI/frmProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,11 @@ private void closeToolStripMenuItem_Click(object sender, EventArgs e)
}
#endregion

private void stripProfileHelp_Click(object sender, EventArgs e)
{
MessageBox.Show("Nothing here yet");
}




Expand Down

0 comments on commit 68b5dea

Please sign in to comment.