コード例 #1
0
ファイル: dictcorner.c プロジェクト: Psych0-Smil3s/cntdn
/* Return 1 if player p's word is valid and 0 otherwise. This functions produces
   game output */
int valid_word(int p, const char *letters) {
  char *line;

  if(!can_make_word(player[p].word, letters)) {
    /* TODO: this should be more specific about what letters are missing */
    speak(SUSIE, "Sorry %s, you can't make \"%s\" with those letters.",
          player[p].name, player[p].word);

    if(!word_in_dictionary(player[p].word))
      slow_printf(" It isn't in my dictionary, either.");

    printf("\n");
    return 0;
  }

  if(!word_in_dictionary(player[p].word)) {
    while(1) {
      speak(SUSIE, "%s, \"%s\" isn't in my dictionary. Do you want to use it "
            "anyway? [yn] ", player[p].name, player[p].word);

      line = get_line();

      if(tolower(*line) == 'y') return 1;
      else if(tolower(*line) == 'n') return 0;
    }
  }

  /* TODO: decide whether the word is good or not and react accordingly */
  speak(SUSIE, "\"%s\"! Excellent!\n", player[p].word);

  return 1;
}
コード例 #2
0
ファイル: yang.c プロジェクト: segfault87/SheepCounter
void speaknum(int n)
{
	int buf[20], len = 0;
	
	if (n % 10) buf[len++] = DIGIT(n % 10);
	n /= 10;
	if (n > 0) {
		buf[len++] = TEN;
		if (n % 10 > 1) buf[len++] = DIGIT(n % 10);
		n /= 10;
		if (n > 0) {
			buf[len++] = HUNDRED;
			if (n % 10 > 1) buf[len++] = DIGIT(n % 10);
			n /= 10;
			if (n > 0) {
				buf[len++] = THOUSAND;
				if (n % 10 > 1) buf[len++] = DIGIT(n % 10);
				n /= 10;
				if (n > 0) {
					buf[len++] = TENTHOUSAND;
					if (n % 10 > 1) buf[len++] = DIGIT(n % 10);
				}
			}
		}
	}
	
	speak(YANG);
	while (len--) speak(buf[len]);
	speak(MARI);
}
コード例 #3
0
int main()
{
	Dog dog;
	Bird bird;

	Animal& animal = dog;
	speak(animal);
	animal = bird;
	speak(bird);
}
コード例 #4
0
ファイル: IRCBot.cpp プロジェクト: segrax/KiLLARMY
bool IRCBot::testPrepare() {
	StoreQueryResult			 ircBots = _db->ircBotReadAll();
	StoreQueryResult::iterator	 ircIT;
	stringstream				 ircs;
	size_t						 sleepTime = 500, count = 0;
	Row							 irc, ircBot;
	_ircMii						*botMii;

	if(ircBots.empty())
		return false;

	// loop through and start each server test
	for( ircIT = ircBots.begin(); ircIT != ircBots.end(); ++ircIT, ++count ) {
		
		ircBot = *ircIT;
		irc = _db->ircRead( (size_t) ircBot["ircID"] );
		if(irc.empty())
			return false;

		botMii = _Miis->ircMiiLoad( (string) irc["nick"] );
		if(botMii) {
			botMii->ircBotRowLoad();
			botMii->silentSet();
			
			botTestAdd( botMii, 0 );
		} else {
			stringstream ircs;
			ircs << "Bot " << ( (string) irc["nick"] ) << " is not online.";
			speak("Test", ircs, _testChannel);
		}

		Sleep(sleepTime);

		// Every 4, sleep triple time
		if(count == 4) {
			Sleep(sleepTime*2);
			count=0;
		}
	}

	// Nothing to do?
	if(_testMiis.empty()) {
		stringstream ircs;
		ircs << "No bots to test.";
		speak("Test", ircs, _testChannel);
		return false;
	}

	return true;
}
コード例 #5
0
ファイル: IRCBot.cpp プロジェクト: segrax/KiLLARMY
void IRCBot::actionIRCUserAdd( ircChannel pChannel, irc_reply_data *hostd,string pParameters ) {
size_t				memberID = 0, serverID = 0;
	string				memberName, ircNick, ircNickAlt;
	stringstream		irc;

	memberName	= parameterGet(pParameters);
	memberID	= readMemberID( memberName );

	if(memberID==0) {
		irc << "Syntax: !ircuseradd <issoria_user_name> <irc_nick> <alt_irc_nick> ";
		speak( "Mii", irc, pChannel );
		return;
	}

	ircNick = parameterGet(pParameters);
	ircNickAlt = parameterGet(pParameters);
	
	_ircMii		*ircMii =  _Miis->ircMiiLoad( ircNick);
	if(ircMii && ircMii->recognised()) {
		irc << "I already know " << ircNick;
		speak( "Mii", irc, pChannel );
		return;
	}
	
	ircMii = _Miis->ircMiiSeen( ircNick );
	if(!ircMii) {
		irc << "I cant seem to find " << ircNick;
		speak( "Mii", irc, pChannel );
		return;
	}

	ircMii = new _ircMii( _smokingman, _Miis, ircMii->hostGet(), memberID );
	if(!ircMii->recognised()) {
		delete ircMii;
		irc << "I couldn't match " << ircNick << " to the database";
		speak( "Mii", irc, pChannel );
		return;
	}
	
	irc << ircMii->detailLoad( ircNickAlt );

	_Miis->ircMiiKnownRemove( hostd );
	_Miis->MiiAdd( ircMii );
	
	irc << "" << memberName << " User Added";

	if(irc.str().size())
		speak( "Mii", irc, pChannel );
}
コード例 #6
0
WaterCooler::WaterCooler(QObject *parent) : QObject(parent)
{
    Person sally;
    Person joe;
    Person jill;

    sally.setName("Sally");
    joe.setName("Joe");
    jill.setName("Jill");

    connect(&sally,SIGNAL(speak(QString)),&joe,SLOT(listen(QString))); // Sally speaks, Joe listens
    connect(&sally,SIGNAL(speak(QString)),&jill,SLOT(listen(QString))); // Sally speaks, Jill listens

    sally.gossip("I heard Will wears a wig.");
}
コード例 #7
0
static void
im_recv_im(PurpleAccount *account, char *who, char *what,
	    PurpleConversation * conv, PurpleMessageFlags flags)
{
  int wasPlaying = 0;

  if(system("dbus-send --print-reply --dest=net.kevinmehall.Pithos /net/kevinmehall/Pithos net.kevinmehall.Pithos.IsPlaying")){
    wasPlaying = 1;
    system("dbus-send --print-reply --dest=net.kevinmehall.Pithos /net/kevinmehall/Pithos net.kevinmehall.Pithos.PlayPause");
  }

  char *stripped;
  const char *alias = get_best_name(account, who);
  silent_joins = NULL;

  GString *buffer= g_string_new("");

/*  msg_utf8=purple_utf8_try_convert(what) */

  stripped = (char *)purple_markup_strip_html(/*msg_utf8?msg_utf8:*/what);
    
  if(purple_prefs_get_bool("/plugins/gtk/festival/speaker/replace_url"))
    stripped = unlinkify_text(stripped);

  if (strlen(stripped) <= purple_prefs_get_int("/plugins/gtk/festival/speaker/maxlength")) {

    if(purple_prefs_get_bool("/plugins/gtk/festival/speaker/prepend_who") &&
       strcmp(alias, prev_alias))
      g_string_printf(buffer,"%s %s %s", alias, _("says"), stripped);
    else
      g_string_printf(buffer,"%s", stripped);

    strcpy(prev_alias, alias);
    speak(buffer);
  } else {
    g_string_printf(buffer, "message overflow");
    speak(buffer);
  }

  g_free(stripped);
/*  if (msg_utf8) g_free(msg_utf8); */
  g_string_free(buffer,TRUE);

  if(wasPlaying==1 && !system("dbus-send --print-reply --dest=net.kevinmehall.Pithos /net/kevinmehall/Pithos net.kevinmehall.Pithos.IsPlaying")){
    sleep(5);
    system("dbus-send --print-reply --dest=net.kevinmehall.Pithos /net/kevinmehall/Pithos net.kevinmehall.Pithos.PlayPause");
  }
}
コード例 #8
0
ファイル: IRCBot.cpp プロジェクト: segrax/KiLLARMY
void IRCBot::actionMIA( ircChannel pChannel, irc_reply_data *hostd, string pParameters ) {
	size_t			count = 1;
	size_t			lastOnline;
	bool			active, showAll = false;

	if( pParameters == "all" )
		showAll = true;

	StoreQueryResult			members =	_db->membersReadSeen( true );
	StoreQueryResult::iterator	memberIT;
	Row							member;

	for(memberIT = members.begin(); memberIT != members.end(); memberIT++ ) {
		stringstream		irc;
		
		member = *memberIT;

		active = (bool) member["active"];
		if( !showAll && !active )
			continue;

		if( _smokingman->thepipeGet()->userOnline( ((size_t) member["memberID"] ) ) != userOFFLINE )
			continue;

		lastOnline = (size_t) member["lastOnline"];
		irc << count << ". " << ((string) member["nameUser"]) << " : " << timeCalc( time(0) - lastOnline );
		speak( "LastOn", irc, pChannel );

		++count;
	}

}
コード例 #9
0
ファイル: Monster.cpp プロジェクト: porzell/Duke-Spookem-3D
void Monster::addAttachment(Entity *attachment)
{
    Entity::addAttachment(attachment);

    if(/*rand() % 3 == 0*/ mAttachments.size() >= 3)
    {
        if(rand() % 3 == 0)
            game->getPlayer()->speak(game->getPlayer()->getQuipSetFire());

        if(rand() % 2 == 0)
        {
            speak(getSoundFireScream());

            mVoice->setIsLooped(true);

            /*if(rand() % 2)
            	mIsFleeing = true;*/

            if(rand() % 4 == 0)
                game->getPlayer()->speak(game->getPlayer()->getQuipRespondScreams());
        }
    }

    //game->shout("Health: " + std::to_string(mHealth));
}
コード例 #10
0
ファイル: done.c プロジェクト: lattera/openbsd
void
done(int entry)		/* entry=1 means goto 13000 */	/* game is over */
			/* entry=2 means goto 20000 */	/* 3=19000 */
{
	int     i, sc;

	if (entry == 1)
		mspeak(1);
	if (entry == 3)
		rspeak(136);
	printf("\n\n\nYou scored %d out of a ", (sc = score()));
	printf("possible %d using %d turns.\n", mxscor, turns);
	for (i = 1; i <= clsses; i++)
		if (cval[i] >= sc) {
			speak(&ctext[i]);
			if (i == clsses - 1) {
				printf("To achieve the next higher rating");
				printf(" would be a neat trick!\n\n");
				printf("Congratulations!!\n");
				exit(0);
			}
			k = cval[i] + 1 - sc;
			printf("To achieve the next higher rating, you need");
			printf(" %d more point", k);
			if (k == 1)
				printf(".\n");
			else
				printf("s.\n");
			exit(0);
		}
	printf("You just went off my scale!!!\n");
	exit(0);
}
コード例 #11
0
ファイル: IRCBot.cpp プロジェクト: segrax/KiLLARMY
void IRCBot::testThreadSingle( _ircMii *botMii) {
	bool done = false;
	time_t							startTime = time(0);

	while(!done) {
		
		if(botMii->testDone()) {
			done = true;
			break;
		}

		if( time(0) - startTime > 30 )
			break;

		Sleep(1000);
	}


	botTestDone( botMii );
	
	if(!done) {	
		stringstream ircs;
		ircs << "4Bot " << botMii->ircNickGet() << " Failed";
		speak("Test", ircs, _testChannel);
	}

	botMii->threadClear();
	return;
}
コード例 #12
0
ファイル: main.cpp プロジェクト: CCJY/coliru
int main()
{
    AnimalRegistry registry;
    registry.register_creator<Dog>();
    registry.register_creator<Cat>();
    
    Message received_message { "Dog" /*this is a part of your protobuf*/ };
    
    auto dog = registry.create(received_message);
    if (dog)
        dog->speak();
        
    Message another_message { "Cat" };
    auto cat = registry.create(another_message);
    if (cat)
        cat->speak();
}
コード例 #13
0
ファイル: IRCBot.cpp プロジェクト: segrax/KiLLARMY
void IRCBot::actionVersion( ircChannel pChannel, irc_reply_data *hostd, string pParameters ) {
	stringstream    title;

	title << "v"			<< VERSION;
	title << "  svn rev: "	<< SVNREV;
	title << " date: "		<< SVNDATE;

	speak("smokingman", title.str(), pChannel );
}
コード例 #14
0
ファイル: talk.c プロジェクト: simpleavr/webbot_talk430
//______________________________________________________________________
int main() {
	WDTCTL = WDTPW + WDTHOLD;
	__use_cal_clk(MHZ);

	P1SEL = 0;
	P1DIR = 0;
	P1OUT = 0;
	P2SEL = 0;
	P2DIR = 0;
	P2OUT = 0;

	_BIC_SR(GIE);

	led_init();
	led_off();

	uart_init();

	_BIS_SR(GIE);

	char buf[64], *at=buf;
	uint8_t c = 0;

	while (1) {
		if (c || uart_getc(&c)) {
			switch (c) {
				case '.': led_flip(); break;
				case '1': uart_puts(quick); uart_putc('\n'); say(quick); break;
				case '2': uart_puts(dave); uart_putc('\n'); say(dave); break;
				case '3': uart_puts(luke); uart_putc('\n'); say(luke); break;
				case '4': uart_puts(time); uart_putc('\n'); say(time); break;
				case '5': uart_puts(temp); uart_putc('\n'); say(temp); break;
				case '\r':	// end of command
					uart_putc('\n');
					*at = '\0';
					at = buf;
					if (*at == '*') {
						speak(at+1);
					}//if
					else {
						if (*at == '!')
							setPitch(*(at+1)-'A');
						else
							say(at);
					}//else
					uart_puts("\ndone\n");
					break;
				default:
					*at++ = c;
					uart_putc(c);
					break;
			}//switch
		}//if
		c = 0;
	}//while

}
コード例 #15
0
ファイル: io.c プロジェクト: keith-dev/openbsd
void
twrite(int loq)			/* travel options from this loc */
{
	struct	travlist *t;

	printf("If");
	speak(&ltext[loq]);
	printf("then\n");
	for (t = travel[loq]; t != 0; t = t->next) {
		printf("verb %d takes you to ", t->tverb);
		if (t->tloc <= 300)
			speak(&ltext[t->tloc]);
		else if (t->tloc <= 500)
			printf("special code %d\n", t->tloc - 300);
		else
			rspeak(t->tloc - 500);
		printf("under conditions %d\n", t->conditions);
	}
}
コード例 #16
0
void SpyFrame::on(ClientManagerListener::IncomingSearch, const string& s) throw() {
	if(bIgnoreTTH && s.compare(0, 4, "TTH:") == 0)
		return;
	tstring* x = new tstring(Text::toT(s));
	tstring::size_type i = 0;
	while( (i=x->find(_T('$'))) != string::npos) {
		(*x)[i] = _T(' ');
	}
	speak(SPEAK_SEARCH, reinterpret_cast<LPARAM>(x));
}
コード例 #17
0
ファイル: IRCBot.cpp プロジェクト: segrax/KiLLARMY
void IRCBot::actionHelp( ircChannel pChannel, irc_reply_data *hostd, string pParameters) {
	stringstream			 response;
	const ircHelpItem		*Items = _actions;
	
	for(Items = _actions; Items->mCommand; Items++) {
		response.str("");
		response << "" << Items->mCommand << " :  " << Items->mDetails;

		speak("help", response, pChannel );
	}
}
コード例 #18
0
ファイル: dictcorner.c プロジェクト: Psych0-Smil3s/cntdn
/* Get dictionary corner to give their best word */
void dict_solve(const char *letters) {
  int i;

  /* TODO: this function should be more intelligent about when it gets a word
     that one of the players got */

  best_word[0] = '\0';

  solve_letters(letters, store_word, NULL);

  for(i = 0; best_word[i]; i++) {
    best_word[i] = tolower(best_word[i]);
  }

  if(!*best_word) {
    speak(SUSIE, "We couldn't find any words at all.\n");
  } else {
    speak(SUSIE, "The best word we found was \"%s\".\n", best_word);
  }
}
コード例 #19
0
ファイル: IRCBot.cpp プロジェクト: segrax/KiLLARMY
void IRCBot::actionServerAdd( ircChannel pChannel, irc_reply_data *hostd, string pParameters ) {
	size_t		serverID, sitescript;
	string		serverShort, botNick, botAltNick, command;
	_ircMii		*Mii = _Miis->ircMiiLoad( hostd );
	stringstream	irc;

	serverShort = parameterGet(pParameters);
	serverID	= readServerName( serverShort );

	botNick = parameterGet(pParameters);
	botAltNick = parameterGet(pParameters);
	command = parameterGet(pParameters);
	sitescript = atoi(parameterGet(pParameters).c_str());

	if(serverID==0) {
		irc << "Syntax: !botadd <issoria_server_short_name> <bot_irc_nick> <bot_alt_nick> <command> <0-PZS, 1-Dekuf, 2-Sitestat>";
		speak( "Mii", irc, pChannel );
		return;
	}

	if(command == "") {
		irc << "Please specify the bot trigger";
		speak( "Mii", irc, pChannel );
		irc << "Syntax: !botadd <issoria_server_short_name> <bot_irc_nick> <bot_alt_nick> <command> <0-PZS, 1-Dekuf, 2-Sitestat>";
		speak( "Mii", irc, pChannel );
		return;
	}

	if(Mii==0) {
		irc << "Error, couldnt find you... who are you?";
		speak( "Mii", irc, pChannel );
		return;
	}

	irc << Mii->detailBotLoad(serverID, botNick, botAltNick, command, sitescript );

	if(irc.str().size())
		speak( "Mii", irc, pChannel );

}
コード例 #20
0
static void
_event_speak(const char *buddy, char *state)
{

  time_t now;
  time(&now);
  if(purple_prefs_get_bool("/plugins/gtk/festival/speaker/announce_events") &&
     now - connect_time > 10  ) {
    GString *buffer= g_string_new("");
    g_string_printf(buffer,"%s %s", buddy, state);
    speak(buffer);
    g_string_free(buffer,TRUE);
  }
}
コード例 #21
0
ファイル: main.c プロジェクト: kunyi731/C-practices
int main()
{
    Dog spot, fido;
    Animal wild1;
    Animal * animals[3];
    
    Dog_ctor(&spot);
    Dog_ctor(&fido);
    Animal_ctor(&wild1);
    
    animals[0] = &spot;
    animals[1] = &wild1;
    animals[2] = &fido;
    
    speak(animals, 3);
}
コード例 #22
0
void SwampMonster::attack()
{
	Vec3d playerPos = game->getPlayer()->getPosition() - mPosition;

	//Vec2d angle(atan2(playerPos.X-mPosition.X, playerPos.Z-mPosition.Z));

	playerPos.normalize();

	playerPos /= 8;

	//range.setLength(1.0);

	game->getEntityManager()->add(New Projectile(mPosition,playerPos,game->getAnimationManager()->get("fireball"),Vec2d(5,10),ENTITY_ATTACK_ENEMY));

	speak(getAttackSound());
	game->getSoundEngine()->play3DSound(game->getResourceManager()->get("flame_attack"),mPosition);
}
コード例 #23
0
ファイル: IRCBot.cpp プロジェクト: segrax/KiLLARMY
void IRCBot::actionIRCBotAdd( ircChannel pChannel, irc_reply_data *hostd,string pParameters ) {
	size_t		serverID, sitescript;
	string		ircNick, serverShort, botNick, botAltNick, command;
	_ircMii		*Mii = 0;
	stringstream	irc;
	
	ircNick = parameterGet(pParameters);
	serverShort = parameterGet(pParameters);
	serverID	= readServerName( serverShort );

	botNick = parameterGet(pParameters);
	botAltNick = parameterGet(pParameters);
	command = parameterGet(pParameters);
	sitescript = atoi(parameterGet(pParameters).c_str());

	Mii = _Miis->ircMiiLoad( ircNick );
	
	if(serverID==0) {
		irc << "Syntax: !ircbotadd <users_irc_nick> <issoria_server_short_name> <bot_irc_nick> <bot_alt_nick> <command> <0-PZS, 1-Dekuf, 2-Sitestat>";
		speak( "Mii", irc, pChannel );
		return;
	}

	if(command.size() == 0) {
		irc << "Please specify the bot trigger";
		speak( "Mii", irc, pChannel );
		irc.str("");
		irc << "Syntax: !ircbotadd <users_irc_nick> <issoria_server_short_name> <bot_irc_nick> <bot_alt_nick> <command> <0-PZS, 1-Dekuf, 2-Sitestat>";
		speak( "Mii", irc, pChannel );
		return;
	}

	if(Mii==0) {
		irc << "Error, couldnt find " << ircNick << " who are they?";
		speak( "Mii", irc, pChannel );
		return;
	}
	
	Mii->ircRowLoad();
	if(Mii->recognised() == false) {
		irc << "Error, I don't recognise " << ircNick;
		speak( "Mii", irc, pChannel );
		return;
	}

	irc << Mii->detailBotLoad(serverID, botNick, botAltNick, command, sitescript );

	if(irc.str().size())
		speak( "Mii", irc, pChannel );
}
コード例 #24
0
ファイル: main.c プロジェクト: trangthancb/Cyclotron
//Chuong trinh Close Slide----------------------------------------------------//
void program_Close_Slide()
{
   boolean exit;
   Slide_Close_temp = true; //Khai bao dang Close Slide
   exit = 1;
   denbao =  0x20;
   quangbao();
   xoadong(2);
   lcd_putc(" DANG DONG SLIDE...");
   if(kiemtra_vitri() != 0) 
   {
      xoadong(2);
      lcd_putc("   LOI DONG SLIDE   ");
      exit = 0;
   }
   while(program_emergency() && program_stop() && exit){
      D5 = 1;
      xuat_E0();
      if(SW_Close_Slide==0)
      {
         D5 = 0;
         xuat_E0();
         if(SW_Open_Slide ==0) 
         {
            xoadong(2);
            lcd_putc("   SLIDE DA DONG    ");
         } else {
            xoadong(1);
            lcd_putc("ERROR SW OPEN SLIDE");
            xoadong(2);
            lcd_putc("   DUNG THAO TAC   ");
            speak();//Bao dong bang coi.
            error_close_slide = true;
         }
         exit = 0;
      }
   }
   bit_clear(denbao,5);
   quangbao();
   Slide_Close_temp = false; //Khai bao het Close Slide.
}
コード例 #25
0
ファイル: main.c プロジェクト: trangthancb/Cyclotron
//Chuong trinh Open Slide-----------------------------------------------------//
void program_Open_Slide()
{
   boolean exit;
   Slide_Open_temp = true;//Bien trung gian bao dang OPen Slide
   exit = 1;
   xoadong(2);
   lcd_putc("  DANG MO SLIDE...");
   denbao = 0x10;
   quangbao();
   if(SW_Close_Slide == 1 && SW_Open_Slide == 1) 
   {
      xoadong(2);
      lcd_putc("     DA MO SLIDE    ");
      exit = 0;
   }
   while(program_emergency() && program_stop() && exit){
      D6 = 1;
      xuat_E0();
      if(SW_Open_Slide==1)
      {
         D6 = 0;
         xuat_E0();
         if(SW_Close_Slide ==1) 
         {
            xoadong(2);
            lcd_putc("    SLIDE DA MO");
         } else {
            xoadong(1);
            lcd_putc("HONG SW CLOSE SLIDE");
            xoadong(2);
            lcd_putc("   DUNG THAO TAC   ");
            speak();//Bao dong bang coi.
            error_open_slide = true;
         }
         exit = 0;
      }
   }
   bit_clear(denbao,4);
   Slide_Open_temp = false; // Khai bao het Open Slide
   quangbao();
}
コード例 #26
0
ファイル: IRCBot.cpp プロジェクト: segrax/KiLLARMY
void IRCBot::actionTotalTime( ircChannel pChannel, irc_reply_data *hostd, string pParameters ) {
	size_t			count = 1;
	time_t			timeOnline;
	bool			active, showAll = false;

	if( pParameters == "all" )
		showAll = true;

	StoreQueryResult			members =	_db->memberTimeOnGet( false );
	StoreQueryResult::iterator	memberIT;
	Row							member;

	for(memberIT = members.begin(); memberIT != members.end(); memberIT++ ) {
		
		member = *memberIT;

		active = (bool) member["active"];
		if( !showAll && !active )
			continue;

		timeOnline = (time_t) member["timeOnline"];

		/*
		if( _smokingman->thepipeGet()->userOnline( ((size_t) member["memberID"] ) ) != userOFFLINE ) {
			client *user = _smokingman->thepipeGet()->userClient(((size_t) member["memberID"] ) );

			time_t addTime = time(0) - user->connectedTimeGet();

			timeOnline += addTime;
		}*/

		if(timeOnline > 0) {
			stringstream		irc;
			irc << count << ". " << ((string) member["nameUser"]) << " : " << timeCalc( timeOnline );
			speak( "TotalTime", irc, pChannel );

			++count;
		}
	}

}
コード例 #27
0
TTSWidget::TTSWidget(QWidget* parent /*= 0*/, Qt::WFlags flags /*= 0*/) : QWidget(parent, flags)
{
	setupUi(this);

#ifdef _WIN32
	CoInitialize(NULL);
	HRESULT                             hr = S_OK;
	CComPtr<ISpObjectToken>             cpVoiceToken;
	CComPtr<IEnumSpObjectTokens>        cpEnum;
	CComPtr<ISpVoice>                   cpVoice;
	ULONG                               ulCount = 0;
	
	// Create the SAPI voice
	if(SUCCEEDED(hr))
		hr = cpVoice.CoCreateInstance( CLSID_SpVoice ); 
	//Enumerate the available voices 
	if(SUCCEEDED(hr))
		hr = SpEnumTokens(SPCAT_VOICES, NULL, NULL, &cpEnum);
	//Get the number of voices
	if(SUCCEEDED(hr))
		hr = cpEnum->GetCount(&ulCount);
	// Obtain a list of available voice tokens
	while (SUCCEEDED(hr) && ulCount-- )
	{
		cpVoiceToken.Release();
		if(SUCCEEDED(hr))
			hr = cpEnum->Next( 1, &cpVoiceToken, NULL );
		WCHAR* voiceName = 0;
		if (SUCCEEDED(SpGetDescription(cpVoiceToken, &voiceName)))
		{
			m_voice->addItem(QString::fromUtf16((const ushort*) voiceName));
			CoTaskMemFree(voiceName);
		}
	}
	CoUninitialize();
#endif

	connect(m_voice, SIGNAL(currentIndexChanged(int)), this, SLOT(voiceChanged(int)));
	connect(m_speakButton, SIGNAL(clicked()), this, SLOT(speak()));	
}
void
SynthesizerController::exec()
{
	for (;;) {
		moduleController_.getSynthCommand(commandType_, commandMessage_, true);

		switch (commandType_) {
		case ModuleController::COMMAND_INIT:
			init();
			break;
		case ModuleController::COMMAND_SET:
			set();
			break;
		case ModuleController::COMMAND_SPEAK:
			speak();
			break;
		case ModuleController::COMMAND_QUIT:
			return;
		default:
			break;
		}
	}
}
コード例 #29
0
void ScreenReader::processTouchPoint()
{
    if (m_activateCalled) {
        return;
    }

    if (m_rootInterface == 0) {
        return;
    }

    QAccessibleInterface * currentInterface = m_rootInterface;

    int hit = -2;
    int guardCounter = 0;
    const int guardMax = 40;
    while (currentInterface != 0) {
        ++guardCounter;
        if (guardCounter > guardMax) {
            qDebug() << "touchPoint exit recursion overflow";
            return; // outside
        }

        QAccessibleInterface * hit = currentInterface->childAt(m_currentTouchPoint.x(), m_currentTouchPoint.y());
        if (!hit)
            break;
        currentInterface = hit;
    }

    m_selectedInterface = currentInterface;
    if (m_selectedInterface->object())
        emit selected(m_selectedInterface->object());
    if (m_optionsWidget->enableTextToSpeach())
        speak(m_selectedInterface->text(QAccessible::Name)
              /*+ "," + translateRole(m_selectedInterface->role(0)) */);

//    qDebug() << "touchPoint exit found" << m_selectedInterface->text(QAccessible::Name, 0) << m_selectedInterface->object() << m_selectedInterface->rect(0);
}
コード例 #30
0
ファイル: IRCBot.cpp プロジェクト: segrax/KiLLARMY
void IRCBot::motd( string _motd ) {

	if(!_chansJoined) {
		// Join the desired channel
		_irc->join( _smokingman->ircChanGet().c_str() );
		Sleep(500);
		
		_irc->join( _smokingman->ircChanBotsGet().c_str() );
		Sleep(500);

		_irc->join( _smokingman->ircChanAdminGet().c_str() );
		Sleep(500);

		_chansJoined = true;
		// Create the version string
		stringstream    title;
		title << "v" << VERSION << " svn:" << SVNREV; 

		// Say hello
	    speak("smokingman", title.str() );
	
	}

}