• 0

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191


File: /var/www/html/cnasolution/site/application/views/question.php
Line: 191
Function: _error_handler

File: /var/www/html/cnasolution/site/application/controllers/Questions.php
Line: 419
Function: view

File: /var/www/html/cnasolution/site/index.php
Line: 315
Function: require_once

I am just working on the flow of input & outputs (trying to figure out how to do this project theoretically before I implement it). I have read a bunch of previous posts and documentation but still need help.

my background: I am a bit new to Javascript and very new to the Web Audio Api and Web Speech Api. I know html, css, and some php. I would be willing to puzzle through another language if neccesary (but would prefer not).

languages using for this project: javascript and html.

Problem Defined: Ideally I would aquire the streaming output from the soundcard (generated by an mp4 file being played) and send it to both the microphone and speakers. I know I can use "getUserMedia" and "createChannelSplitter" (in the Web Audio Api) to acquire & split (based on Audacity analysis the original signal is in stero) the user media into 2 outputs which leaves me with 2 problems.

1) getUserMedia can only get streaming input from the microphone not from the soundcard (from what I have read)

2) streaming output can only be recorded/sent to a buffer and not sent to the microphone directly (from what I have read

Is this correct?

possible workaround - stalled: The user will most likely have a headset microphone on but one workaround I have thought of is to switch to the inbuilt microphone on the device and capture what comes out of the speakers and then switch back to the headset for user input. However, I haven't found a way to switch between the inbuilt microphone and the headset microphone without asking the user every time.

Is there a way to do this that I haven't found?

What other solutions would you suggest?

Project Explanation: I am creating a spanish language practice program/website written in html & javascript. An mp4 will play and the speech recognition api will display what it says on the screen (as it is spoken in spanish) and it will be translated into english so the user hears, sees, and understands what is being said by the person speaking in the mp4. Then the user will use the headset microphone to answer the mp4 person (often the inbuilt microphone doesn't give good enough quality for voice recognition - depending on the device - thus the use of the headset).

flow chart of my workaround using inbuilt microphone

mp4->soundcard-> Web Audio Api -> channel 1 -> user's ears

                                channel 2 -> microphone input-> Web Speech Api-> html->text onscreen 

flow chart of ideal situation skippng microphone input

mp4->soundcard-> Web Audio Api -> channel 1 -> user's ears

                                channel 2-> Web Speech Api-> html->text onscreen -> user's eyes  

another potential work around: I would like to avoid having to manually strip an mp3 from each mp4 and then have to try and sync them so the voice recognition happens as the mp4 person speaks. I have read that I can run an mp3 through the voice recognition api.

Download script demo [LINK] [Origin]
Download script demo [LINK 2] [Onedrive] Download script demo [LINK 2] [Google drive]

You can add a mouse click event to the TreeView, then select the correct node using GetNodeAt given the mouse coordinates provided by the MouseEventArgs.

void treeView1MouseUp(object sender, MouseEventArgs e) {     if(e.Button == MouseButtons.Right)     {         // Select the clicked node         treeView1.SelectedNode = treeView1.GetNodeAt(e.X, e.Y);          if(treeView1.SelectedNode != null)         {             myContextMenuStrip.Show(treeView1, e.Location);         }     } } 
see demo
  • 282
Reply Report

I find the standard windows treeview behavior selection behavior to be quite annoying. For example, if you are using Explorer and right click on a node and hit Properties, it highlights the node and shows the properties dialog for the node you clicked on. But when you return from the dialog, the highlighted node was the node previously selected/highlighted before you did the right-click. I find this causes usability problems because I am forever being confused on whether I acted on the right node.

So in many of our GUIs, we change the selected tree node on a right-click so that there is no confusion. This may not be the same as a standard iwndos app like Explorer (and I tend to strongly model our GUI behavior after standard window apps for usabiltiy reasons), I believe that this one exception case results in far more usable trees.

Here is some code that changes the selection during the right click:

  private void tree_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)   {      // only need to change selected note during right-click - otherwise tree does      // fine by itself      if ( e.Button == MouseButtons.Right )      {                  Point pt = new Point( e.X, e.Y );         tree.PointToClient( pt );          TreeNode Node = tree.GetNodeAt( pt );         if ( Node != null )         {            if ( Node.Bounds.Contains( pt ) )            {               tree.SelectedNode = Node;               ResetContextMenu();               contextMenuTree.Show( tree, pt );            }         }      }   } 
  • 445
Reply Report

Reviving this question because I find this to be a much better solution. I use the NodeMouseClick event instead.

void treeview_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) {     if( e.Button == MouseButtons.Right )     {         tree.SelectedNode = e.Node;     } } 
  • 304
Reply Report

This is a very old question, but I still found it useful. I am using a combination of some of the answers above, because I don't want the right-clicked node to become the selectedNode. If I have the root node selected and want to delete one of it's children, I don't want the child selected when I delete it (I am also doing some work on the selectedNode that I don't want to happen on a right-click). Here is my contribution:

// Global Private Variable to hold right-clicked Node private TreeNode _currentNode = new TreeNode();  // Set Global Variable to the Node that was right-clicked private void treeView_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) {     if (e.Button == System.Windows.Forms.MouseButtons.Right)         _currentNode = e.Node; }  // Do something when the Menu Item is clicked using the _currentNode private void toolStripMenuItem_Clicked(object sender, EventArgs e) {     if (_currentNode != null)         MessageBox.Show(_currentNode.Text); } 
  • 341
Reply Report