2014-11-05 14:24:36

Hi all,
I posted code over on the Blastbay forums as the author of the class and others tried to help me over there:
http://www.blastbay.com/forum/viewtopic.php?id=1505

I eventually want to implement this speech manager class into my sidescroller, but now I'm just trying to create a basic menu and not having much luck with it.
I wonder what the easiest way to do it is. Make a modified version of Dynamic Menu and notify the class to support Speech Manager or create a speech_manager global variable, which doesn't seem to be working when I call set_speech_mode in Dynamic Menu with the instance of Speech Manager.
Thanks all. I'll use Sapi if I have to, but if I can implement screen reader support with a backup Sapi option that'd be ideal.

2014-11-05 23:11:25 (edited by keyIsFull 2014-11-05 23:13:20)

dynamic_menu menu;
speech_manager speech;
void main() {
menu.set_speech_mode(speech.mode);
menu.set_tts_object(speech.sapi);//in case you have to use sapi, this will make sure the sapi settings are maintained.
}

I like to sleep, Sleep is good,
This is how I do it: Lie on a nice warm cozy bed, and dream dreams about how to rule the world!
Follow @TheGreatAthlon5 on twitter for humorous facts and game updates!
If you like my posts, thumb me up!

2014-11-05 23:27:25

Hi there,
Thanks for this. Which item should I call for the menus? add_item or add_item_tts? add_item_tts works, for for Sapi.
Its as though the engine is commenting out the speech manager functions okay.
Current code:

#include "dynamic_menu.bgt"
#include "speech_manager.bgt"
//The main menu, speech and other things.
speech_manager speech;
void main()

{

show_game_window("Test");
dynamic_menu menu;
set_error_output("error.log");
int result;
menu.set_speech_mode(speech.mode);
menu.set_tts_object(speech.sapi);
menu.add_item("start");
menu.add_item("exit");
result=menu.run("Please choose an option.", true);
}

2014-11-06 21:30:20 (edited by Jason SW 2014-11-06 21:32:13)

Hi,

Add_item_tts works for SAPI and for screen readers. Calling add_item is for playing sounds only.

If the menu is using SAPI instead of your screen reader, then BGT probably failed to find the required libraries.
Try setting:

speech.lib_directory = "";

Before the call to init, if any.

HTH

2014-11-06 22:53:15 (edited by Orin 2014-11-07 00:04:30)

Well, I turned Jaws on so that I didn't have to mess with Screen reader dependencies. Once I get it working with jaws I'll put the NVDA and SA files in the project.
Edit: Yay, finally got it working. It'd help if I actually called the Init function. Ugg.
Edit 2: Hmm, I shouldn't have to set a library directory. I put the libraries in the main project directory. later I'll organize it, but shouldn't that be enough?
edit 3: Okay, so I can't test SA, but with NVDA, typing the full path of my project for lib_directory results in something about an escape warning. But again, I don't see why I should set a path because the sapi32.dll and the NVDAControllerClient32.DLL is there in the main directory where the script resides.

2014-11-06 23:41:21

Hi,

No, you don't have to, but I set it up so by default, the manager tells BGT to look in the "lib" directory, for my own convenience, if not necessarily for the convenience of others. To prevent this, use:
speech.lib_directory = "";

Let me know if that works.

2014-11-07 04:30:03 (edited by Orin 2014-11-07 05:20:56)

Hi,
Unfortunately, this did not work. Alternatively, where is the lib directory? Figured I'd just create a "lib" directory, and put the files there, but that didn't work either.

Edit: Hmm. So my set_error_output log created the following log. I'm not sure what it's saying the Ilogical Operation is.
Engine error from function: bool screen_reader_set_library_path(int, const string&in)

Error: Illogical operation.

Call stack size: 2

File: C:\bgtstuff\firstshift\speech_manager.bgt
Line: 34 (1)
Function: void speech_manager::init(string, string = "")

File: C:\bgtstuff\firstshift\Firstshift.bgt
Line: 16 (1)
Function: void main()


Engine error from function: bool screen_reader_set_library_path(int, const string&in)

Error: File not found.

Call stack size: 2

File: C:\bgtstuff\firstshift\speech_manager.bgt
Line: 35 (1)
Function: void speech_manager::init(string, string = "")

File: C:\bgtstuff\firstshift\Firstshift.bgt
Line: 16 (1)
Function: void main()
edit2: Okay, so
something happened with the init call, because now even with jaws it's not working, and it worked earlier.
Here's my current code. I left the init call to initialize speech manager exactly the same, so is it the order I put all the other stuff in?

#include "dynamic_menu.bgt"
#include "speech_manager.bgt"
//The main menu, speech and other things.
speech_manager speech;
sound music;
void main()

{
music.stream("sounds/music/mainmenu.ogg");
music.volume = -10;

show_game_window("Test");
dynamic_menu menu;
set_error_output("error.log");
music.play_looped();
speech.init("Config", "Encrypttest");

int result;
menu.set_speech_mode(speech.mode);
menu.set_tts_object(speech.sapi);
menu.add_item_tts("start");
menu.add_item_tts("exit");
result=menu.run("Please choose an option.", true);
}