Winforms 在调用函数之前,不会执行所有代码
全部。感谢您抽出时间,我们非常感谢您的帮助 这是我的问题:我在“Windows Form VC++”中编写了一些代码,使用文本到语音算法翻转文本文件执行语音到文本的转换。在使用MS“Speak”功能发声文本后,应该将一些标题信息和所说的内容写入文本框。之后,更新计数变量,然后调用另一个函数,从不同方向合成另一个语音 问题在于,第一个语音在正确的时间被正确合成,但是在标题信息和口语词被写入文本框之前,第二个函数被调用,一旦结束,它将仅用其信息填充文本框。第一次输入的任何信息都不会写入文本框 这可能是什么原因造成的??我尝试用几种不同的方法延迟对第二个函数的调用,但没有成功。我肯定需要尽可能多的帮助。我在这两个问题的代码片段。提前谢谢你,我希望能尽快得到帮助。再次感谢 调用第二个的第一个代码:Winforms 在调用函数之前,不会执行所有代码,winforms,visual-studio-2010,c++-cli,Winforms,Visual Studio 2010,C++ Cli,全部。感谢您抽出时间,我们非常感谢您的帮助 这是我的问题:我在“Windows Form VC++”中编写了一些代码,使用文本到语音算法翻转文本文件执行语音到文本的转换。在使用MS“Speak”功能发声文本后,应该将一些标题信息和所说的内容写入文本框。之后,更新计数变量,然后调用另一个函数,从不同方向合成另一个语音 问题在于,第一个语音在正确的时间被正确合成,但是在标题信息和口语词被写入文本框之前,第二个函数被调用,一旦结束,它将仅用其信息填充文本框。第一次输入的任何信息都不会写入文本框 这可能
for(ClickCount_ATCText = 0; ClickCount_ATCText < FilesSelected_ATC_A; ClickCount_ATCText++)
{
SetChannelVolumeLevel(ATC_OverLord);
PlaySound(TEXT("c:\\SSL_Sound\\AC_AudioBackground.wav"), NULL, SND_FILENAME);
//GetWavFilePath(ATC_OverLord);
//if(ClickCount_ATCText > (FilesSelected_ATC_A - 1))
//{
//ClickCount_ATCText = 0;
//}// End DataLink if statement
SpeechSynthesizer^ Vocalize = gcnew SpeechSynthesizer(); //Create a voice synthesizer instance.
string TTS_TxtPath = ATC_TxtFiles[ClickCount_ATCText]; //The following two lines converts the standard string in to a system string for use in the StreamReader function.
String^ TTS_FilePath = gcnew String(TTS_TxtPath.c_str());
StreamReader^ FileRead = gcnew StreamReader(TTS_FilePath); //Get the text file from the path identified.
String^ AutoTTSFileRead = FileRead->ReadToEnd(); //Read the entire file and store the text characters in the string variable "AutoTTSFileRead".
Vocalize->Speak(AutoTTSFileRead); //Vocalize the text in the textbox.
//Sleep(3000); //Pause half a second before displaying the text. Not needed, but kept for reference.
//* The 6 lines code below provides a timestamp and formats the output of the data link message.
TextToSpeechTextbox->Text = " Data Link Message \r\n \r\n";
time(&WhatTimeIsIt);
String^ strNew = gcnew String(ctime(&WhatTimeIsIt));
TextToSpeechTextbox->Text = TextToSpeechTextbox->Text + "Timestamp: " + strNew + "\r\n";
TextToSpeechTextbox->Text = TextToSpeechTextbox->Text + "\r\n";
TextToSpeechTextbox->Text = TextToSpeechTextbox->Text + "Message: " + AutoTTSFileRead + "\r\n"; //Display the speech data in the text box.
ClickCount_ATCText++;
NE_STT_SLL_Function();
}//End for loop
**NE_STT_SLL_Function:**
void NE_STT_SLL_Function()
{
//Sleep(3000);
SetChannelVolumeLevel(North_East); //Set the volume level for this SSL and zero the rest.
PlaySound(TEXT("c:\\SSL_Sound\\AC_AudioBackground.wav"), NULL, SND_FILENAME); //Play a snippet of radio noise in the background before sythesizing
if(ClickCount_NorthEastText >= (FilesSelected_NE - 1))
{
ClickCount_NorthEastText = 0;
}// End DataLink if statement
SpeechSynthesizer^ Vocalize = gcnew SpeechSynthesizer(); //Create a voice synthesizer instance.
string TTS_TxtPath = NorthEast_TxtFiles[ClickCount_NorthEastText]; //The following two lines converts the standard string in to a system string for use in the StreamReader function.
String^ TTS_FilePath = gcnew String(TTS_TxtPath.c_str());
StreamReader^ FileRead = gcnew StreamReader(TTS_FilePath); //Get the text file from the path identified.
String^ AutoTTSFileRead = FileRead->ReadToEnd(); //Read the entire file and store the text characters in the string variable "AutoTTSFileRead".
Vocalize->Speak(AutoTTSFileRead); //Vocalize the text in the textbox.
//* The 6 lines code below provides a timestamp and formats the output of the data link message.
TextToSpeechTextbox->Text = " (NE) Sound Source Location Message \r\n \r\n";
time(&WhatTimeIsIt);
String^ strNew = gcnew String(ctime(&WhatTimeIsIt));
TextToSpeechTextbox->Text = TextToSpeechTextbox->Text + "Timestamp: " + strNew + "\r\n";
TextToSpeechTextbox->Text = TextToSpeechTextbox->Text + "\r\n";
TextToSpeechTextbox->Text = TextToSpeechTextbox->Text + "Message: " + AutoTTSFileRead + "\r\n"; //Display the speech data in the text box.
ClickCount_NorthEastText++; //Increment array index value.
return;
}//End NE STT SSL function
for(ClickCount\u ATCText=0;ClickCount\u ATCText(所选文件\u ATC\u A-1))
//{
//单击Count_ATCText=0;
//}//End DataLink if语句
SpeechSynthesizer ^Vocalize=gcnew SpeechSynthesizer();//创建语音合成器实例。
string TTS_TxtPath=ATC_TxtFiles[ClickCount_ATCText];//以下两行将中的标准字符串转换为系统字符串,以便在StreamReader函数中使用。
String^TTS_FilePath=gcnewstring(TTS_TxtPath.c_str());
StreamReader^FileRead=gcnewstreamreader(TTS_FilePath);//从标识的路径获取文本文件。
String ^AutoTTSFileRead=FileRead->ReadToEnd();//读取整个文件并将文本字符存储在字符串变量“AutoTTSFileRead”中。
发声->说话(AutoTsFileRead);//发声文本框中的文本。
//Sleep(3000);//在显示文本之前暂停半秒钟。不需要,但保留以供参考。
//*下面的6行代码提供时间戳并格式化数据链路消息的输出。
TextToSpeechTextbox->Text=“数据链接消息\r\n\r\n”;
时间(whattimeit);
字符串^strNew=gcnew字符串(ctime(&whattimeiit));
TextToSpeechTextbox->Text=TextToSpeechTextbox->Text+“时间戳:”+strNew+“\r\n”;
TextToSpeechTextbox->Text=TextToSpeechTextbox->Text+“\r\n”;
TextToSpeechTextbox->Text=TextToSpeechTextbox->Text+“消息:”+AutoTTSFileRead+“\r\n”;//在文本框中显示语音数据。
单击Count_ATCText++;
NE_STT_SLL_函数();
}//循环结束
**NEU STT SLU功能:**
void NE_STT_SLL_函数()
{
//睡眠(3000);
SetChannelVolumeLevel(北东);//设置此SSL的卷级别,并将其余的设置为零。
播放声音(文本(“c:\\SSL\u Sound\\AC\u AudioBackground.wav”),NULL,SND\u文件名);//在合成之前在背景中播放一段无线电噪音
如果(单击计数\u东北文本>=(选择的文件\u NE-1))
{
单击Count_NorthEastText=0;
}//End DataLink if语句
SpeechSynthesizer ^Vocalize=gcnew SpeechSynthesizer();//创建语音合成器实例。
string TTS_TxtPath=Northwestern_TxtFiles[ClickCount_NorthEastText];//以下两行将中的标准字符串转换为系统字符串,以便在StreamReader函数中使用。
String^TTS_FilePath=gcnewstring(TTS_TxtPath.c_str());
StreamReader^FileRead=gcnewstreamreader(TTS_FilePath);//从标识的路径获取文本文件。
String ^AutoTTSFileRead=FileRead->ReadToEnd();//读取整个文件并将文本字符存储在字符串变量“AutoTTSFileRead”中。
发声->说话(AutoTsFileRead);//发声文本框中的文本。
//*下面的6行代码提供时间戳并格式化数据链路消息的输出。
TextToSpeechTextbox->Text=“(NE)声源位置消息\r\n\r\n”;
时间(whattimeit);
字符串^strNew