问题描述
在Microsoft提供的示例应用程序和我的应用程序(在示例之后建模)中,应用程序在发送MidiSystemExclusiveMessage后挂起。以下是示例应用的摘录。在我的应用程序中,发送
的数据是在Platform :: Array< unsigned char>中。阵列。我正在尝试将数据发送到LoopBe虚拟端口。我发现如果我发送长度超过4个字节的sysex消息,则会发生挂起。 可能导致此问题的原因是什么?
In both the sample application provided by Microsoft and my application, which is modeled after the sample, the application hangs after a MidiSystemExclusiveMessage is sent. Below is a snippet from the sample app. In my application the data being sent is in a Platform::Array<unsigned char> array. I'm trying to send data to a LoopBe virtual port. I find that if I send a sysex message that is more than 4 bytes in length then the hang occurs. What could be causing this?
DataWriter^ dataWriter = ref new DataWriter();
// expecting a string of format "NN NN NN NN...." where NN is a byte in hex
int len = _sendMessageTextBox->Text->Length();
if (0 == len)
{
return;
}
const wchar_t* startPointer = _sendMessageTextBox->Text->Data();
wchar_t* endPointer = nullptr;
do
{
byte midiByte = (byte)wcstoul(startPointer, &endPointer, 16);
if (endPointer == startPointer)
{
// conversion failed, bail out
break;
}
dataWriter->WriteByte(midiByte);
// prep for next iteration
startPointer = endPointer;
} while (nullptr != endPointer);
midiMessage = ref new MidiSystemExclusiveMessage(dataWriter->DetachBuffer());
break;
推荐答案
这看起来很可疑。我不知道wcstoul如何处理内部空间,但我会从这开始作为调查的基础。
这篇关于发送WindowsPriview :: Device :: Midi :: MidiSystemExclusiveMessage消息时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!