39 char str[256], *pc, *sp;
40 static DWORD last_beep = 0;
43 printf(
"%s\n", (
char *) (
message));
49 pc = strchr((
char *) (
message),
']') + 2;
50 sp = pc + strlen(pc) - 1;
51 while (*sp ==
' ' || *sp ==
'\t')
68 PlaySound(
str, NULL, SND_SYNC);
73 wchar_t wcstring[1000];
74 MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, (LPCSTR)pc, -1, wcstring, 1000);
77 Voice->Speak(wcstring, SPF_DEFAULT, NULL );
86int main(
int argc,
char *argv[])
96 strcpy(
mtTalkStr,
"\\Windows\\Media\\notify.wav");
97 strcpy(
mtUserStr,
"\\Windows\\Media\\notify.wav");
100 for (
i = 1;
i < argc;
i++) {
101 if (argv[
i][0] ==
'-') {
102 if (
i + 1 >= argc || argv[
i + 1][0] ==
'-')
104 if (argv[
i][1] ==
'e')
106 else if (argv[
i][1] ==
'h')
108 else if (argv[
i][1] ==
't')
110 else if (argv[
i][1] ==
'u')
112 else if (argv[
i][1] ==
's')
116 printf(
"usage: mspeaker [-h <hostname>] [-e <experiment>]\n\n");
117 printf(
" [-t <file>] Specify the alert wave file for MT_TALK messages\n");
118 printf(
" [-u <file>] Specify the alert wave file for MT_USER messages\n");
119 printf(
" [-s <sec>] Specify the min time interval between alert [s]\n");
126 CoInitialize ( NULL );
129 CoCreateInstance ( CLSID_SpVoice, NULL, CLSCTX_ALL, IID_ISpVoice, (
void**)&
Voice );
131 printf(
"Cannot initialize speech system\n");
147 printf(
"Midas Message Talker connected to %s. Press \"!\" to exit\n",
162 printf(
"Trying to reconnect...\n");
INT cm_yield(INT millisec)
INT cm_connect_experiment(const char *host_name, const char *exp_name, const char *client_name, void(*func)(char *))
INT cm_disconnect_experiment(void)
INT cm_get_environment(char *host_name, int host_name_size, char *exp_name, int exp_name_size)
INT cm_set_watchdog_params(BOOL call_watchdog, DWORD timeout)
INT ss_sleep(INT millisec)
INT cm_msg_register(EVENT_HANDLER *func)
char exp_name[NAME_LENGTH]
char host_name[HOST_NAME_LENGTH]
#define message(type, str)
void receive_message(HNDLE hBuf, HNDLE id, EVENT_HEADER *header, void *message)